@aquera/nile-elements 1.3.9 → 1.4.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.
Files changed (45) hide show
  1. package/README.md +4 -0
  2. package/dist/index.js +25 -17
  3. package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
  4. package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
  5. package/dist/nile-calendar/nile-calendar.esm.js +1 -1
  6. package/dist/nile-option-group/nile-option-group.cjs.js +1 -1
  7. package/dist/nile-option-group/nile-option-group.cjs.js.map +1 -1
  8. package/dist/nile-option-group/nile-option-group.css.cjs.js +1 -1
  9. package/dist/nile-option-group/nile-option-group.css.cjs.js.map +1 -1
  10. package/dist/nile-option-group/nile-option-group.css.esm.js +14 -0
  11. package/dist/nile-option-group/nile-option-group.esm.js +2 -2
  12. package/dist/nile-select/nile-select.cjs.js +1 -1
  13. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  14. package/dist/nile-select/nile-select.css.cjs.js +1 -1
  15. package/dist/nile-select/nile-select.css.cjs.js.map +1 -1
  16. package/dist/nile-select/nile-select.css.esm.js +4 -2
  17. package/dist/nile-select/nile-select.esm.js +2 -2
  18. package/dist/nile-side-bar-footer-item/nile-side-bar-footer-item.css.cjs.js +1 -1
  19. package/dist/nile-side-bar-footer-item/nile-side-bar-footer-item.css.cjs.js.map +1 -1
  20. package/dist/nile-side-bar-footer-item/nile-side-bar-footer-item.css.esm.js +2 -10
  21. package/dist/src/nile-calendar/nile-calendar.js +10 -3
  22. package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
  23. package/dist/src/nile-option-group/nile-option-group.css.js +14 -0
  24. package/dist/src/nile-option-group/nile-option-group.css.js.map +1 -1
  25. package/dist/src/nile-option-group/nile-option-group.d.ts +1 -0
  26. package/dist/src/nile-option-group/nile-option-group.js +4 -0
  27. package/dist/src/nile-option-group/nile-option-group.js.map +1 -1
  28. package/dist/src/nile-select/nile-select.css.js +4 -2
  29. package/dist/src/nile-select/nile-select.css.js.map +1 -1
  30. package/dist/src/nile-select/nile-select.d.ts +3 -0
  31. package/dist/src/nile-select/nile-select.js +32 -0
  32. package/dist/src/nile-select/nile-select.js.map +1 -1
  33. package/dist/src/nile-side-bar-footer-item/nile-side-bar-footer-item.css.js +1 -9
  34. package/dist/src/nile-side-bar-footer-item/nile-side-bar-footer-item.css.js.map +1 -1
  35. package/dist/src/version.js +1 -1
  36. package/dist/src/version.js.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
  39. package/src/nile-calendar/nile-calendar.ts +24 -16
  40. package/src/nile-option-group/nile-option-group.css.ts +14 -0
  41. package/src/nile-option-group/nile-option-group.ts +1 -0
  42. package/src/nile-select/nile-select.css.ts +4 -2
  43. package/src/nile-select/nile-select.ts +33 -2
  44. package/src/nile-side-bar-footer-item/nile-side-bar-footer-item.css.ts +1 -9
  45. package/vscode-html-custom-data.json +12 -2
package/README.md CHANGED
@@ -79,6 +79,10 @@ To run a local development server that serves the basic demo located in `demo/in
79
79
 
80
80
  In this section, you can find the updates for each release of `nile-elements`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
81
81
 
82
+ #### Version 1.4.0
83
+ - Nile Calendar: Nile Calendar Fix when input time was (UIF-1036)
84
+ - Nile Select: stickyOption Header for Nile Select (UIF-1025)
85
+
82
86
  #### Version 1.3.9
83
87
  - Nile Sidebar: NXT Gen Tokenization(UIF-1035)
84
88
  - Nile Skeleton Loader: New component added (UIF-1028)
package/dist/index.js CHANGED
@@ -4128,8 +4128,10 @@ const de=1,he=2,Te=3,ye=4,Ae=e=>(...t)=>({_$litDirective$:e,values:t});let Oe=cl
4128
4128
  box-shadow: 0 0 0 1px var(--ng-colors-border-brand) inset ;
4129
4129
  }
4130
4130
 
4131
-
4132
-
4131
+ :host([stickyHeader]) .select__footer{
4132
+ z-index: 1;
4133
+ }
4134
+
4133
4135
  `,DM=r`
4134
4136
  :host {
4135
4137
  display: inline-block;
@@ -5193,7 +5195,7 @@ class CM{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
5193
5195
  <slot name="prefix" slot="prefix"></slot>
5194
5196
  </nile-virtual-select>
5195
5197
  </div>
5196
- `}}class XM{constructor(e){this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=null,this.clonedListbox=null,this.cleanupAutoUpdate=null,this.currentPlacement="bottom",this.currentMiddlewareData=null,this.component=e}createPortalAppendContainer(){const e=document.createElement("div");return e.style.position="absolute",e.style.zIndex="9999",e.style.pointerEvents="none",e.className="nile-select-portal-append",e}positionPortalAppend(){this.portalContainer&&this.component.popup&&(this.measurePopupHeight(),this.computeFloatingUIPosition())}measurePopupHeight(){!this.measuredPopupHeight&&this.portalContainer&&(this.portalContainer.style.position="absolute",this.portalContainer.style.visibility="hidden",this.portalContainer.style.top="0px",this.portalContainer.style.left="0px",this.portalContainer.offsetHeight,this.measuredPopupHeight=this.portalContainer.offsetHeight,this.portalContainer.style.visibility="")}async computeFloatingUIPosition(){if(!this.portalContainer)return;const e=this.component.combobox||this.component,t=this.portalContainer;try{const{x:i,y:M,placement:n,middlewareData:o}=await this.calculateFloatingUIPosition(e,t);this.applyFloatingUIPosition(t,e,i,M,n,o)}catch(e){console.warn("Floating UI positioning failed, falling back to simple positioning:",e),this.fallbackPositioning()}}async calculateFloatingUIPosition(e,t){const i=BM.findBoundaryElements(e),M=BM.getOptimalPlacement(e),n=this.createFloatingUIMiddleware(i);return await Ji(e,t,{placement:M,strategy:"fixed",middleware:n,platform:this.createCustomPlatform()})}createFloatingUIMiddleware(e){return[Bi(4),Fi({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:e}),_i({fallbackPlacements:["bottom","top","bottom-start","top-start","bottom-end","top-end"],fallbackStrategy:"bestFit",padding:10,boundary:e}),Gi({padding:10,crossAxis:!0,boundary:e})]}handleSizeMiddleware({availableWidth:e,availableHeight:t,elements:i,rects:M}){const n=BM.calculateOptimalHeight(M.reference,window.innerHeight,this.currentPlacement);i.floating.style.maxWidth=`${e}px`,i.floating.style.maxHeight=`${n}px`,i.floating.style.setProperty("--auto-size-available-width",`${e}px`),i.floating.style.setProperty("--auto-size-available-height",`${n}px`)}createCustomPlatform(){return Wi}applyFloatingUIPosition(e,t,i,M,n,o){Object.assign(e.style,{left:`${i}px`,top:`${M}px`,position:"fixed",pointerEvents:"auto"}),this.currentPlacement=n,this.currentMiddlewareData=o,BM.applyCollisionData(e,o,n);const r=n.split("-")[0];e.className=`nile-select-portal-append select__listbox--${r}`;const s=t.getBoundingClientRect();e.style.width=`${s.width}px`}fallbackPositioning(){if(!this.portalContainer)return;const e=(this.component.combobox||this.component).getBoundingClientRect(),t=window.innerHeight;this.measuredPopupHeight;const i=t-e.bottom,M=e.top;let n,o,r;M>i?(r=Math.max(M-20,100),n=Math.max(e.top-r-4,10),o="top"):(r=Math.max(i-20,100),n=e.bottom+4,o="bottom"),this.portalContainer.style.left=`${e.left}px`,this.portalContainer.style.top=`${n}px`,this.portalContainer.style.width=`${e.width}px`,this.portalContainer.style.maxHeight=`${r}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.className=`nile-select-portal-append select__listbox--${o}`,this.calculateAndSetAutoSizeProperties(e,n,o)}calculateAndSetAutoSizeProperties(e,t,i){if(!this.portalContainer)return;const M=window.innerHeight,n=window.innerWidth;let o;o="top"===i?e.top-10:M-e.bottom-10;const r=Math.min(e.width,n-e.left-10);this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(o,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(r,200)}px`)}updatePortalAppendPosition(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}handleWindowResize(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}setupAutoUpdatePositioning(){this.portalContainer&&this.component&&(this.cleanupAutoUpdatePositioning(),this.cleanupAutoUpdate=Ri(this.component,this.portalContainer,(()=>{this.computeFloatingUIPosition()}),{ancestorScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,animationFrame:!0}))}cleanupAutoUpdatePositioning(){this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null)}injectStylesToDocument(){if(!this.portalContainer)return;const e=BM.generateStyleId();if(document.getElementById(e))return;const t=this.component.constructor.styles;if(!t)return;const i=document.createElement("style");i.id=e,i.textContent=BM.extractStylesAsCSS(t),document.head.appendChild(i),this.portalContainer.__injectedStyleId=e}adoptStylesToPortalAppend(){this.portalContainer&&this.injectStylesToDocument()}setupPortalAppend(){this.component.portal&&this.component.updateComplete.then((()=>{setTimeout((()=>{const e=this.component.shadowRoot?.querySelector("#listbox");e&&(this.originalListboxParent=e.parentElement,this.clonedListbox=this.createPortalListbox(),this.portalContainer=this.createPortalAppendContainer(),this.portalContainer.appendChild(this.clonedListbox),document.body.appendChild(this.portalContainer),this.adoptStylesToPortalAppend(),this.clonedListbox.style.display="",this.positionPortalAppend(),this.setupPortalEventListeners(),this.updatePortalContent(),setTimeout((()=>{this.updateFooterState()}),50),this.setupAutoUpdatePositioning(),window.addEventListener("resize",this.handleWindowResize.bind(this)))}),10)}))}createPortalListbox(){return GM.createPortalListbox(this.component)}setupPortalEventListeners(){_M.setupPortalEventListeners(this.clonedListbox,this.component)}updatePortalContent(){this.clonedListbox&&(GM.updateClonedOptions(this.clonedListbox,this.component),this.updateFooterState())}updateFooterState(){const e=this.clonedListbox?.querySelector(".select__footer");if(!e||!this.component.multiple)return;const t=e.querySelector("nile-checkbox");t&&(t.disabled=0===this.component.selectedOptions.length,t.checked=this.component.showSelected);const i=e.querySelector(".select__clear");if(0===this.component.selectedOptions.length)i&&i.remove();else if(!i){const t=document.createElement("span");t.className="select__clear",t.textContent="Clear All",t.style.cursor="pointer",e.appendChild(t)}}cleanupPortalAppend(){if(this.cleanupAutoUpdatePositioning(),this.portalContainer&&this.portalContainer.parentNode){const e=this.portalContainer.__injectedStyleId;if(e){const t=document.getElementById(e);t&&t.remove()}this.portalContainer.parentNode.removeChild(this.portalContainer)}window.removeEventListener("resize",this.handleWindowResize.bind(this)),this.portalContainer=null,this.originalListboxParent=null,this.clonedListbox=null,this.measuredPopupHeight=null,this.currentPlacement="bottom",this.currentMiddlewareData=null}get portalContainerElement(){return this.portalContainer}resetMeasuredHeight(){this.measuredPopupHeight=null}updatePortalOptions(){this.portalContainer&&this.clonedListbox&&(this.updatePortalContent(),this.forceReposition())}forceReposition(){this.portalContainer&&this.computeFloatingUIPosition()}getCurrentPlacement(){return this.currentPlacement}getCurrentMiddlewareData(){return this.currentMiddlewareData}isUsingFloatingUI(){return null!==this.cleanupAutoUpdate}updatePositioningConfig(e){this.forceReposition()}handleViewportChange(){this.portalContainer&&(this.resetMeasuredHeight(),this.forceReposition())}isPositioningOptimal(){if(!this.portalContainer||!this.currentMiddlewareData)return!0;const e=(this.component.combobox||this.component).getBoundingClientRect(),t=window.innerHeight-e.bottom,i=e.top,M=this.currentPlacement.startsWith("top"),n=this.currentPlacement.startsWith("bottom");return!(M&&t>i)&&!(n&&i>t)}}let qM=class extends Re{get validity(){return this.valueInput?.validity}get validationMessage(){return this.valueInput?.validationMessage}constructor(){super(),this.portalManager=new XM(this),this.hasSlotController=new Ye(this,"help-text","label"),this.typeToSelectString="",this.scrolling=!1,this.options=[],this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.oldValue="",this.name="",this.value="",this.defaultValue="",this.size="medium",this.placeholder="Select...",this.searchValue="",this.searchEnabled=!1,this.internalSearchPlaceHolder="Search...",this.enableVisibilityEffect=!1,this.blockValueChange=!1,this.disableLocalSearch=!1,this.optionsLoading=!1,this.noWidthSync=!1,this.portal=!1,this.multiple=!1,this.helpText="",this.help_text="",this.autoResize=!1,this.errorMessage="",this.warning=!1,this.error=!1,this.success=!1,this.maxOptionsVisible=3,this.disabled=!1,this.clearable=!1,this.open=!1,this.hoist=!1,this.filled=!1,this.pill=!1,this.label="",this.placement="bottom",this.form="",this.required=!1,this.showSelected=!1,this.oldMaxOptionsVisible=1,this.enableTabClose=!1,this.showNoResults=!1,this.noResultsMessage="No results found",this.data=[],this.enableVirtualScroll=!1,this.enableGroupHeader=!1,this.autoFocusSearch=!1,this.loading=!1,this.handleWindowResize=()=>{this.portalManager.updatePortalAppendPosition()},this.handleWindowScroll=()=>{this.portalManager.updatePortalAppendPosition()}}connectedCallback(){super.connectedCallback(),this.enableVirtualScroll||(this.formControlController=new ve(this,{assumeInteractionOn:["nile-blur","nile-input"]})),this.virtualScrollHelper=new $M(this),this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.handleWindowScroll=this.handleWindowScroll.bind(this),this.open=!1,this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0),this.visibilityManager?.cleanup(),this.portalManager.cleanupPortalAppend(),this.emit("nile-destroy")}setupResizeObserver(){if(this.autoResize){const e=this.shadowRoot?.querySelector(".select__tags");e&&(this.resizeController=new HM(this,{callback:()=>this.calculateTotalWidthOfTags()}),this.resizeController.observe(e))}else this.resizeController?.unobserve?.(this.shadowRoot?.querySelector(".select__tags")),this.resizeController=void 0}updated(e){e.has("multiple")&&this.setCheckBoxInOption(this.multiple),e.has("autoResize")&&this.setupResizeObserver()}firstUpdated(e){this.enableGroupHeader&&this.handleGroupSearchChange(),this.setupResizeObserver(),e.has("multiple")&&this.setCheckBoxInOption(this.multiple),this.visibilityManager=new tM({host:this,target:this.combobox,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.open,onAnchorOutOfView:()=>{this.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view",name:this.name})},onDocumentHidden:()=>{this.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden",name:this.name})},emit:(e,t)=>this.emit(`nile-${e}`,t)})}setCheckBoxInOption(e){this.options.length||(this.options=this.getAllOptions()),this.options.forEach((t=>{t.showCheckbox=e}))}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.portal&&(window.addEventListener("resize",this.handleWindowResize),window.addEventListener("scroll",this.handleWindowScroll,!0))}removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("scroll",this.handleWindowScroll,!0)}handleFocus(){this.hasFocus=!0,this.displayInput.setSelectionRange(0,0),this.emit("nile-focus",{value:this.value,name:this.name})}handleBlur(){this.hasFocus=!1,this.emit("nile-blur",{value:this.value,name:this.name})}handleDocumentFocusIn(e){if(!this.open)return;const t=e.composedPath(),i=t.includes(this),M=this.popup&&t.includes(this.popup),n=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||M||n||this.hide()}handleFooterClick(e){e.stopPropagation(),e.preventDefault()}toggleShowSelected(e){if(e.stopPropagation(),e.preventDefault(),0===this.selectedOptions?.length)return;this.showSelected=!this.showSelected;this.getAllOptions().forEach((e=>{e.selected||(e.hidden=this.showSelected)})),this.enableGroupHeader&&this.handleGroupShowSelected(),this.portal&&this.open&&this.portalManager.updatePortalOptions()}unSlectAll(){this.showSelected=!1;this.getAllOptions().forEach((e=>{e.selected=!1,e.hidden=!1})),this.enableGroupHeader&&this.handleGroupShowSelected(),this.value="",this.selectionChanged(),this.emit("nile-change",{value:this.value,name:this.name}),this.emit("nile-clear",{value:this.multiple?this.value:"",name:this.name}),this.portal&&this.open&&this.portalManager.updatePortalOptions()}handleDocumentKeyDown(e){const t=e.target,i=null!==t.closest(".select__clear"),M=null!==t.closest("nile-icon-button");if(!i&&!M){if("Escape"===e.key&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})),"Enter"===e.key||" "===e.key&&""===this.typeToSelectString)return e.preventDefault(),e.stopImmediatePropagation(),this.open?void(this.currentOption&&!this.currentOption.disabled&&(this.multiple?this.toggleOptionSelection(this.currentOption):this.setSelectedOptions(this.currentOption),this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name})})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))):void this.show();if(1===e.key.length||"Backspace"===e.key){const t=this.getAllOptions();if(e.metaKey||e.ctrlKey||e.altKey)return;if(!this.open){if("Backspace"===e.key)return;this.show()}e.stopPropagation(),e.preventDefault(),clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=window.setTimeout((()=>this.typeToSelectString=""),1e3),"Backspace"===e.key?this.typeToSelectString=this.typeToSelectString.slice(0,-1):this.typeToSelectString+=e.key.toLowerCase();for(const e of t){if(e.getTextLabel().toLowerCase().startsWith(this.typeToSelectString)){this.setCurrentOption(e);break}}}}}handleDocumentMouseDown(e){if(!this.open)return;const t=e.composedPath(),i=t.includes(this),M=this.popup&&t.includes(this.popup),n=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||M||n||this.hide()}handleLabelClick(){this.displayInput.focus(),this.hide()}handleComboboxMouseDown(e){const t=e.composedPath().some((e=>e instanceof Element&&"nile-icon-button"===e.tagName.toLowerCase()));this.disabled||t||(e.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}handleComboboxKeyDown(e){e.stopPropagation(),this.handleDocumentKeyDown(e)}handleClearClick(e){e.stopPropagation(),""!==this.value&&(this.setSelectedOptions([]),this.showSelected=!1,this.value="",this.displayInput.focus({preventScroll:!0}),this.enableGroupHeader&&this.handleGroupShowSelected(),this.updateComplete.then((()=>{const e={value:this.multiple?this.value:"",name:this.name};this.emit("nile-clear",e),this.nileInput(e),this.nileChange(e)})))}handleClearMouseDown(e){e.stopPropagation(),e.preventDefault()}handleOptionClick(e){const t=e.target.closest("nile-option");if(this.blockValueChange&&t)return this.emit("nile-block-change",{value:t?.value,name:this.name}),void this.hide();const i=this.value;if(this.oldValue=i,t&&!t.disabled&&(this.multiple?this.toggleOptionSelection(t):this.setSelectedOptions(t),this.updateComplete.then((()=>this.displayInput.focus({preventScroll:!0}))),this.value!==i&&this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name})})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0}))),this.showSelected){this.getAllOptions().forEach((e=>{e.selected||(e.hidden=this.showSelected)})),this.enableGroupHeader&&this.handleGroupShowSelected(),this.requestUpdate()}this.portal&&this.open&&this.portalManager.updatePortalOptions()}handleDefaultSlotChange(){const e=this.getAllOptions(),t=Array.isArray(this.value)?this.value:[this.value],i=[];customElements.get("nile-option")?(e.forEach((e=>i.push(e.value))),this.setSelectedOptions(e.filter((e=>t.map(String).includes(e.value))))):customElements.whenDefined("nile-option").then((()=>this.handleDefaultSlotChange())),this.portal&&this.open&&this.portalManager.updatePortalOptions()}handleTagRemove(e,t){if(e.stopPropagation(),!this.disabled){this.toggleOptionSelection(t,!1);this.getAllOptions().forEach((e=>{e.selected||(e.hidden=this.showSelected)})),this.enableGroupHeader&&this.handleGroupShowSelected(),this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name}),this.emit("nile-tag-remove",{value:this.value,name:this.name,removedtagvalue:t.value})}))}}getAllOptions(){const e=[...this.querySelectorAll("nile-option")];return this.multiple&&this.oldValue?.length>0&&e.sort(((e,t)=>{let i=this.oldValue.indexOf(e.value),M=this.oldValue.indexOf(t.value);return-1===i&&(i=1/0),-1===M&&(M=1/0),i<M?-1:i>M?1:0})),e}getOptionPrefix(e){const t=e.shadowRoot?.querySelector('slot[name="prefix"]');if(!t)return"";const i=t.assignedNodes(),M=[];return i.forEach((e=>{e instanceof HTMLElement?M.push(e.outerHTML):e.nodeType===Node.TEXT_NODE&&M.push(e.textContent||"")})),M.join("")}getFirstOption(){return this.querySelector("nile-option")}setCurrentOption(e){this.getAllOptions().forEach((e=>{e.current=!1,e.tabIndex=-1})),e&&(this.currentOption=e,e.current=!0,e.tabIndex=0,e.focus())}setSelectedOptions(e){const t=this.getAllOptions(),i=Array.isArray(e)?e:[e];t.forEach((e=>e.selected=!1)),i.length&&i.forEach((e=>e.selected=!0)),this.selectionChanged(),this.portal&&this.open&&this.portalManager.updatePortalOptions()}toggleOptionSelection(e,t){e.selected=!0===t||!1===t?t:!e.selected,this.selectionChanged()}selectionChanged(){if(this.selectedOptions=this.getAllOptions().filter((e=>e.selected)),this.multiple){if(this.value=this.selectedOptions.map((e=>e.value)),this.placeholder&&0===this.value.length?this.displayLabel="":this.displayLabel=this.selectedOptions.length+" selected",0===this.selectedOptions.length){this.showSelected=!1;this.getAllOptions().forEach((e=>{e.selected||(e.hidden=this.showSelected)})),this.requestUpdate()}}else this.value=this.selectedOptions[0]?.value??this.value,this.displayLabel=this.selectedOptions[0]?.getTextLabel()?this.selectedOptions[0].getTextLabel():this.value??"";this.updateComplete.then((()=>{this.formControlController?.updateValidity()})),this.calculateTotalWidthOfTags()}handleSearchFocus(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}handleSearchBlur(){document.addEventListener("keydown",this.handleDocumentKeyDown)}handleSearchChange(e){if(this.searchValue=e.detail.value,this.emit("nile-search",{query:this.searchValue,name:this.name}),this.enableGroupHeader&&this.handleGroupSearchChange(),!this.disableLocalSearch){0===this.filterOptions(this.searchValue).length?this.showNoResults=!0:this.showNoResults=!1}}handleScroll(e){const t=e.target;this.emit("nile-scroll",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name}),this.scrolling||(this.scrolling=!0,this.emit("nile-scroll-start",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name})),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout((()=>{this.scrolling&&(this.scrolling=!1)}),300);Math.ceil(t.scrollTop)>=Math.floor(t.scrollHeight-t.offsetHeight)&&this.emit("nile-scroll-end",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name,isAtBottom:!0})}filterOptions(e){const t=this.getAllOptions(),i=e.toLowerCase();let M=[];return t.forEach((e=>{const t=e.getTextLabel().toLowerCase(),n=(e.value||"").toLowerCase();t.includes(i)||n.includes(i)?(e.hidden=!1,M.push(e)):e.hidden=!0})),this.portal&&this.open&&this.portalManager.updatePortalOptions(),M}handleInvalid(e){this.formControlController?.setValidity(!1),this.formControlController?.emitInvalidEvent(e)}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}handleValueChange(){const e=this.getAllOptions(),t=Array.isArray(this.value)?this.value:[this.value];this.enableVirtualScroll||this.setSelectedOptions(e.filter((e=>t.includes(e.value))))}handlePortalAppendChange(){this.open&&(this.portal?this.portalManager.setupPortalAppend():this.portalManager.cleanupPortalAppend())}async handleOpenChange(){if(this.open&&!this.disabled){this.setCurrentOption(this.selectedOptions[0]||this.getFirstOption()),this.emit("nile-show",{value:this.value,name:this.name}),this.enableGroupHeader&&this.getAllGroupAttributes().forEach((e=>{e.element.classList.remove("nile-group-hidden")})),this.addOpenListeners(),this.visibilityManager?.setup(),this.showNoResults=!this.getAllOptions()?.length,await jt(this),this.listbox.hidden=!1,this.popup.active=!0,requestAnimationFrame((()=>{this.setCurrentOption(this.currentOption)}));const{keyframes:e,options:t}=yt(this,"select.show",{dir:"ltr"});await ut(this.popup.popup,e,t),this.currentOption&&xt(this.currentOption,this.listbox,"vertical","auto"),this.searchValue="",this.filterOptions(this.searchValue),this.portal&&this.portalManager.setupPortalAppend(),this.emit("nile-after-show",{value:this.value,name:this.name}),this.autoFocusSearch&&this.handleInputAfterInit()}else{this.emit("nile-hide",{value:this.value,name:this.name}),this.showSelected=!1,this.removeOpenListeners(),this.visibilityManager?.cleanup(),await jt(this);const{keyframes:e,options:t}=yt(this,"select.hide",{dir:"ltr"});await ut(this.popup.popup,e,t),this.listbox.hidden=!0,this.popup.active=!1,this.portal&&this.portalManager.cleanupPortalAppend(),this.searchValue="",this.emit("nile-after-hide",{value:this.value,name:this.name})}}getAllGroupAttributes(){return Array.from(this.querySelectorAll("nile-option-group[name]")).map((e=>({name:e?.getAttribute("name")||"",data:e?.getAttribute("data"),element:e})))}getUniqueGroupNames(e){return Array.from(new Set(e.map((e=>e?.groupName))))}handleGroupSearchChange(){const e=new Set(this.getUniqueGroupNames(this.filterOptions(this.searchValue)));this.getAllGroupAttributes().forEach((({name:t,element:i})=>{i?.classList.toggle("nile-group-hidden",!e.has(t))}))}handleGroupShowSelected(){const e=new Set;this.showSelected&&this.getAllOptions().forEach((t=>{t.hidden||e.add(t.groupName)})),this.getAllGroupAttributes().forEach((({name:t,element:i})=>{i?.classList.toggle("nile-group-hidden",this.showSelected&&!e.has(t))}))}async show(){if(!this.open&&!this.disabled)return this.open=!0,St(this,"nile-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,St(this,"nile-after-hide");this.open=!1}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController?.getForm()||null}reportValidity(){return this.valueInput.reportValidity()}setCustomValidity(e){this.valueInput.setCustomValidity(e),this.formControlController?.updateValidity()}focus(e){this.displayInput.focus(e)}blur(){this.displayInput.blur()}onInputChange(e){e.stopPropagation()}calculateWidthOfSelectTagsDiv(){if(this.shadowRoot){const e=this.shadowRoot.querySelector("div.select__tags");if(e instanceof HTMLElement){return e.offsetWidth-70}}}calculateTotalWidthOfTags(){this.maxOptionsVisible!==1/0&&(this.oldMaxOptionsVisible=this.maxOptionsVisible),this.maxOptionsVisible=1/0,setTimeout((()=>{let e=[];if(this.shadowRoot){this.shadowRoot.querySelectorAll("nile-tag").forEach((t=>{t instanceof HTMLElement&&e.push(t.offsetWidth)}))}if(this.value.length!==e.length)return;const t=this.calculateWidthOfSelectTagsDiv();if(!t)return;let i=0,M=0;for(let n=0;n<e.length;n++)if(i+=e[n],i>t){M=n;break}this.maxOptionsVisible=M}),1)}handleInputAfterInit(){this.shadowRoot?.querySelector("nile-input")?.inputFocus()}render(){if(this.enableVirtualScroll)return this.virtualScrollHelper.renderVirtualizedContent();const e=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const t=this.hasSlotController.test("label-suffix"),i=this.hasSlotController.test("custom-select"),M=!!this.label||!!e,n=this.clearable&&!this.disabled&&this.value.length>0,o=this.placeholder&&0===this.value.length,r=!(!this.helpText&&!this.help_text),s=!!this.errorMessage,a=this.selectedOptions[0]?this.getOptionPrefix(this.selectedOptions[0]):"";return R`
5198
+ `}}class XM{constructor(e){this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=null,this.clonedListbox=null,this.cleanupAutoUpdate=null,this.currentPlacement="bottom",this.currentMiddlewareData=null,this.component=e}createPortalAppendContainer(){const e=document.createElement("div");return e.style.position="absolute",e.style.zIndex="9999",e.style.pointerEvents="none",e.className="nile-select-portal-append",e}positionPortalAppend(){this.portalContainer&&this.component.popup&&(this.measurePopupHeight(),this.computeFloatingUIPosition())}measurePopupHeight(){!this.measuredPopupHeight&&this.portalContainer&&(this.portalContainer.style.position="absolute",this.portalContainer.style.visibility="hidden",this.portalContainer.style.top="0px",this.portalContainer.style.left="0px",this.portalContainer.offsetHeight,this.measuredPopupHeight=this.portalContainer.offsetHeight,this.portalContainer.style.visibility="")}async computeFloatingUIPosition(){if(!this.portalContainer)return;const e=this.component.combobox||this.component,t=this.portalContainer;try{const{x:i,y:M,placement:n,middlewareData:o}=await this.calculateFloatingUIPosition(e,t);this.applyFloatingUIPosition(t,e,i,M,n,o)}catch(e){console.warn("Floating UI positioning failed, falling back to simple positioning:",e),this.fallbackPositioning()}}async calculateFloatingUIPosition(e,t){const i=BM.findBoundaryElements(e),M=BM.getOptimalPlacement(e),n=this.createFloatingUIMiddleware(i);return await Ji(e,t,{placement:M,strategy:"fixed",middleware:n,platform:this.createCustomPlatform()})}createFloatingUIMiddleware(e){return[Bi(4),Fi({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:e}),_i({fallbackPlacements:["bottom","top","bottom-start","top-start","bottom-end","top-end"],fallbackStrategy:"bestFit",padding:10,boundary:e}),Gi({padding:10,crossAxis:!0,boundary:e})]}handleSizeMiddleware({availableWidth:e,availableHeight:t,elements:i,rects:M}){const n=BM.calculateOptimalHeight(M.reference,window.innerHeight,this.currentPlacement);i.floating.style.maxWidth=`${e}px`,i.floating.style.maxHeight=`${n}px`,i.floating.style.setProperty("--auto-size-available-width",`${e}px`),i.floating.style.setProperty("--auto-size-available-height",`${n}px`)}createCustomPlatform(){return Wi}applyFloatingUIPosition(e,t,i,M,n,o){Object.assign(e.style,{left:`${i}px`,top:`${M}px`,position:"fixed",pointerEvents:"auto"}),this.currentPlacement=n,this.currentMiddlewareData=o,BM.applyCollisionData(e,o,n);const r=n.split("-")[0];e.className=`nile-select-portal-append select__listbox--${r}`;const s=t.getBoundingClientRect();e.style.width=`${s.width}px`}fallbackPositioning(){if(!this.portalContainer)return;const e=(this.component.combobox||this.component).getBoundingClientRect(),t=window.innerHeight;this.measuredPopupHeight;const i=t-e.bottom,M=e.top;let n,o,r;M>i?(r=Math.max(M-20,100),n=Math.max(e.top-r-4,10),o="top"):(r=Math.max(i-20,100),n=e.bottom+4,o="bottom"),this.portalContainer.style.left=`${e.left}px`,this.portalContainer.style.top=`${n}px`,this.portalContainer.style.width=`${e.width}px`,this.portalContainer.style.maxHeight=`${r}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.className=`nile-select-portal-append select__listbox--${o}`,this.calculateAndSetAutoSizeProperties(e,n,o)}calculateAndSetAutoSizeProperties(e,t,i){if(!this.portalContainer)return;const M=window.innerHeight,n=window.innerWidth;let o;o="top"===i?e.top-10:M-e.bottom-10;const r=Math.min(e.width,n-e.left-10);this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(o,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(r,200)}px`)}updatePortalAppendPosition(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}handleWindowResize(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}setupAutoUpdatePositioning(){this.portalContainer&&this.component&&(this.cleanupAutoUpdatePositioning(),this.cleanupAutoUpdate=Ri(this.component,this.portalContainer,(()=>{this.computeFloatingUIPosition()}),{ancestorScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,animationFrame:!0}))}cleanupAutoUpdatePositioning(){this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null)}injectStylesToDocument(){if(!this.portalContainer)return;const e=BM.generateStyleId();if(document.getElementById(e))return;const t=this.component.constructor.styles;if(!t)return;const i=document.createElement("style");i.id=e,i.textContent=BM.extractStylesAsCSS(t),document.head.appendChild(i),this.portalContainer.__injectedStyleId=e}adoptStylesToPortalAppend(){this.portalContainer&&this.injectStylesToDocument()}setupPortalAppend(){this.component.portal&&this.component.updateComplete.then((()=>{setTimeout((()=>{const e=this.component.shadowRoot?.querySelector("#listbox");e&&(this.originalListboxParent=e.parentElement,this.clonedListbox=this.createPortalListbox(),this.portalContainer=this.createPortalAppendContainer(),this.portalContainer.appendChild(this.clonedListbox),document.body.appendChild(this.portalContainer),this.adoptStylesToPortalAppend(),this.clonedListbox.style.display="",this.positionPortalAppend(),this.setupPortalEventListeners(),this.updatePortalContent(),setTimeout((()=>{this.updateFooterState()}),50),this.setupAutoUpdatePositioning(),window.addEventListener("resize",this.handleWindowResize.bind(this)))}),10)}))}createPortalListbox(){return GM.createPortalListbox(this.component)}setupPortalEventListeners(){_M.setupPortalEventListeners(this.clonedListbox,this.component)}updatePortalContent(){this.clonedListbox&&(GM.updateClonedOptions(this.clonedListbox,this.component),this.updateFooterState())}updateFooterState(){const e=this.clonedListbox?.querySelector(".select__footer");if(!e||!this.component.multiple)return;const t=e.querySelector("nile-checkbox");t&&(t.disabled=0===this.component.selectedOptions.length,t.checked=this.component.showSelected);const i=e.querySelector(".select__clear");if(0===this.component.selectedOptions.length)i&&i.remove();else if(!i){const t=document.createElement("span");t.className="select__clear",t.textContent="Clear All",t.style.cursor="pointer",e.appendChild(t)}}cleanupPortalAppend(){if(this.cleanupAutoUpdatePositioning(),this.portalContainer&&this.portalContainer.parentNode){const e=this.portalContainer.__injectedStyleId;if(e){const t=document.getElementById(e);t&&t.remove()}this.portalContainer.parentNode.removeChild(this.portalContainer)}window.removeEventListener("resize",this.handleWindowResize.bind(this)),this.portalContainer=null,this.originalListboxParent=null,this.clonedListbox=null,this.measuredPopupHeight=null,this.currentPlacement="bottom",this.currentMiddlewareData=null}get portalContainerElement(){return this.portalContainer}resetMeasuredHeight(){this.measuredPopupHeight=null}updatePortalOptions(){this.portalContainer&&this.clonedListbox&&(this.updatePortalContent(),this.forceReposition())}forceReposition(){this.portalContainer&&this.computeFloatingUIPosition()}getCurrentPlacement(){return this.currentPlacement}getCurrentMiddlewareData(){return this.currentMiddlewareData}isUsingFloatingUI(){return null!==this.cleanupAutoUpdate}updatePositioningConfig(e){this.forceReposition()}handleViewportChange(){this.portalContainer&&(this.resetMeasuredHeight(),this.forceReposition())}isPositioningOptimal(){if(!this.portalContainer||!this.currentMiddlewareData)return!0;const e=(this.component.combobox||this.component).getBoundingClientRect(),t=window.innerHeight-e.bottom,i=e.top,M=this.currentPlacement.startsWith("top"),n=this.currentPlacement.startsWith("bottom");return!(M&&t>i)&&!(n&&i>t)}}let qM=class extends Re{get validity(){return this.valueInput?.validity}get validationMessage(){return this.valueInput?.validationMessage}constructor(){super(),this.portalManager=new XM(this),this.hasSlotController=new Ye(this,"help-text","label"),this.typeToSelectString="",this.scrolling=!1,this.options=[],this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.oldValue="",this.name="",this.value="",this.defaultValue="",this.size="medium",this.placeholder="Select...",this.searchValue="",this.searchEnabled=!1,this.internalSearchPlaceHolder="Search...",this.enableVisibilityEffect=!1,this.blockValueChange=!1,this.disableLocalSearch=!1,this.optionsLoading=!1,this.noWidthSync=!1,this.portal=!1,this.multiple=!1,this.helpText="",this.help_text="",this.autoResize=!1,this.errorMessage="",this.warning=!1,this.error=!1,this.success=!1,this.maxOptionsVisible=3,this.disabled=!1,this.clearable=!1,this.open=!1,this.hoist=!1,this.filled=!1,this.pill=!1,this.label="",this.placement="bottom",this.form="",this.required=!1,this.showSelected=!1,this.oldMaxOptionsVisible=1,this.enableTabClose=!1,this.showNoResults=!1,this.noResultsMessage="No results found",this.data=[],this.enableVirtualScroll=!1,this.enableGroupHeader=!1,this.autoFocusSearch=!1,this.loading=!1,this.stickyHeader=!1,this.handleWindowResize=()=>{this.portalManager.updatePortalAppendPosition()},this.handleWindowScroll=()=>{this.portalManager.updatePortalAppendPosition()}}connectedCallback(){super.connectedCallback(),this.enableVirtualScroll||(this.formControlController=new ve(this,{assumeInteractionOn:["nile-blur","nile-input"]})),this.virtualScrollHelper=new $M(this),this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.handleWindowScroll=this.handleWindowScroll.bind(this),this.open=!1,this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0),this.visibilityManager?.cleanup(),this.portalManager.cleanupPortalAppend(),this.emit("nile-destroy")}setupResizeObserver(){if(this.autoResize){const e=this.shadowRoot?.querySelector(".select__tags");e&&(this.resizeController=new HM(this,{callback:()=>this.calculateTotalWidthOfTags()}),this.resizeController.observe(e))}else this.resizeController?.unobserve?.(this.shadowRoot?.querySelector(".select__tags")),this.resizeController=void 0}updated(e){e.has("searchEnabled")&&this.updateGroupStickyOffsets(),e.has("multiple")&&this.setCheckBoxInOption(this.multiple),e.has("autoResize")&&this.setupResizeObserver()}firstUpdated(e){this.enableGroupHeader&&(this.handleGroupSearchChange(),this.applyStickyToGroups()),this.setupResizeObserver(),e.has("multiple")&&this.setCheckBoxInOption(this.multiple),this.visibilityManager=new tM({host:this,target:this.combobox,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.open,onAnchorOutOfView:()=>{this.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view",name:this.name})},onDocumentHidden:()=>{this.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden",name:this.name})},emit:(e,t)=>this.emit(`nile-${e}`,t)})}setCheckBoxInOption(e){this.options.length||(this.options=this.getAllOptions()),this.options.forEach((t=>{t.showCheckbox=e}))}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.portal&&(window.addEventListener("resize",this.handleWindowResize),window.addEventListener("scroll",this.handleWindowScroll,!0))}removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("scroll",this.handleWindowScroll,!0)}handleFocus(){this.hasFocus=!0,this.displayInput.setSelectionRange(0,0),this.emit("nile-focus",{value:this.value,name:this.name})}handleBlur(){this.hasFocus=!1,this.emit("nile-blur",{value:this.value,name:this.name})}handleDocumentFocusIn(e){if(!this.open)return;const t=e.composedPath(),i=t.includes(this),M=this.popup&&t.includes(this.popup),n=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||M||n||this.hide()}updateGroupStickyOffsets(){this.querySelectorAll("nile-option-group").forEach((e=>{this.searchEnabled?e.setAttribute("search-enabled",""):e.removeAttribute("search-enabled")}))}handleFooterClick(e){e.stopPropagation(),e.preventDefault()}toggleShowSelected(e){if(e.stopPropagation(),e.preventDefault(),0===this.selectedOptions?.length)return;this.showSelected=!this.showSelected;this.getAllOptions().forEach((e=>{e.selected||(e.hidden=this.showSelected)})),this.enableGroupHeader&&this.handleGroupShowSelected(),this.portal&&this.open&&this.portalManager.updatePortalOptions()}unSlectAll(){this.showSelected=!1;this.getAllOptions().forEach((e=>{e.selected=!1,e.hidden=!1})),this.enableGroupHeader&&this.handleGroupShowSelected(),this.value="",this.selectionChanged(),this.emit("nile-change",{value:this.value,name:this.name}),this.emit("nile-clear",{value:this.multiple?this.value:"",name:this.name}),this.portal&&this.open&&this.portalManager.updatePortalOptions()}handleDocumentKeyDown(e){const t=e.target,i=null!==t.closest(".select__clear"),M=null!==t.closest("nile-icon-button");if(!i&&!M){if("Escape"===e.key&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})),"Enter"===e.key||" "===e.key&&""===this.typeToSelectString)return e.preventDefault(),e.stopImmediatePropagation(),this.open?void(this.currentOption&&!this.currentOption.disabled&&(this.multiple?this.toggleOptionSelection(this.currentOption):this.setSelectedOptions(this.currentOption),this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name})})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))):void this.show();if(1===e.key.length||"Backspace"===e.key){const t=this.getAllOptions();if(e.metaKey||e.ctrlKey||e.altKey)return;if(!this.open){if("Backspace"===e.key)return;this.show()}e.stopPropagation(),e.preventDefault(),clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=window.setTimeout((()=>this.typeToSelectString=""),1e3),"Backspace"===e.key?this.typeToSelectString=this.typeToSelectString.slice(0,-1):this.typeToSelectString+=e.key.toLowerCase();for(const e of t){if(e.getTextLabel().toLowerCase().startsWith(this.typeToSelectString)){this.setCurrentOption(e);break}}}}}handleDocumentMouseDown(e){if(!this.open)return;const t=e.composedPath(),i=t.includes(this),M=this.popup&&t.includes(this.popup),n=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||M||n||this.hide()}handleLabelClick(){this.displayInput.focus(),this.hide()}handleComboboxMouseDown(e){const t=e.composedPath().some((e=>e instanceof Element&&"nile-icon-button"===e.tagName.toLowerCase()));this.disabled||t||(e.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}handleComboboxKeyDown(e){e.stopPropagation(),this.handleDocumentKeyDown(e)}handleClearClick(e){e.stopPropagation(),""!==this.value&&(this.setSelectedOptions([]),this.showSelected=!1,this.value="",this.displayInput.focus({preventScroll:!0}),this.enableGroupHeader&&this.handleGroupShowSelected(),this.updateComplete.then((()=>{const e={value:this.multiple?this.value:"",name:this.name};this.emit("nile-clear",e),this.nileInput(e),this.nileChange(e)})))}handleClearMouseDown(e){e.stopPropagation(),e.preventDefault()}handleOptionClick(e){const t=e.target.closest("nile-option");if(this.blockValueChange&&t)return this.emit("nile-block-change",{value:t?.value,name:this.name}),void this.hide();const i=this.value;if(this.oldValue=i,t&&!t.disabled&&(this.multiple?this.toggleOptionSelection(t):this.setSelectedOptions(t),this.updateComplete.then((()=>this.displayInput.focus({preventScroll:!0}))),this.value!==i&&this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name})})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0}))),this.showSelected){this.getAllOptions().forEach((e=>{e.selected||(e.hidden=this.showSelected)})),this.enableGroupHeader&&this.handleGroupShowSelected(),this.requestUpdate()}this.portal&&this.open&&this.portalManager.updatePortalOptions()}applyStickyToGroups(){this.querySelectorAll("nile-option-group").forEach((e=>{this.stickyHeader?e.setAttribute("sticky",""):e.removeAttribute("sticky")}))}handleDefaultSlotChange(){const e=this.getAllOptions(),t=Array.isArray(this.value)?this.value:[this.value],i=[];this.updateGroupStickyOffsets(),this.applyStickyToGroups(),customElements.get("nile-option")?(e.forEach((e=>i.push(e.value))),this.setSelectedOptions(e.filter((e=>t.map(String).includes(e.value))))):customElements.whenDefined("nile-option").then((()=>this.handleDefaultSlotChange())),this.portal&&this.open&&this.portalManager.updatePortalOptions()}handleTagRemove(e,t){if(e.stopPropagation(),!this.disabled){this.toggleOptionSelection(t,!1);this.getAllOptions().forEach((e=>{e.selected||(e.hidden=this.showSelected)})),this.enableGroupHeader&&this.handleGroupShowSelected(),this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name}),this.emit("nile-tag-remove",{value:this.value,name:this.name,removedtagvalue:t.value})}))}}getAllOptions(){const e=[...this.querySelectorAll("nile-option")];return this.multiple&&this.oldValue?.length>0&&e.sort(((e,t)=>{let i=this.oldValue.indexOf(e.value),M=this.oldValue.indexOf(t.value);return-1===i&&(i=1/0),-1===M&&(M=1/0),i<M?-1:i>M?1:0})),e}getOptionPrefix(e){const t=e.shadowRoot?.querySelector('slot[name="prefix"]');if(!t)return"";const i=t.assignedNodes(),M=[];return i.forEach((e=>{e instanceof HTMLElement?M.push(e.outerHTML):e.nodeType===Node.TEXT_NODE&&M.push(e.textContent||"")})),M.join("")}getFirstOption(){return this.querySelector("nile-option")}setCurrentOption(e){this.getAllOptions().forEach((e=>{e.current=!1,e.tabIndex=-1})),e&&(this.currentOption=e,e.current=!0,e.tabIndex=0,e.focus())}setSelectedOptions(e){const t=this.getAllOptions(),i=Array.isArray(e)?e:[e];t.forEach((e=>e.selected=!1)),i.length&&i.forEach((e=>e.selected=!0)),this.selectionChanged(),this.portal&&this.open&&this.portalManager.updatePortalOptions()}toggleOptionSelection(e,t){e.selected=!0===t||!1===t?t:!e.selected,this.selectionChanged()}selectionChanged(){if(this.selectedOptions=this.getAllOptions().filter((e=>e.selected)),this.multiple){if(this.value=this.selectedOptions.map((e=>e.value)),this.placeholder&&0===this.value.length?this.displayLabel="":this.displayLabel=this.selectedOptions.length+" selected",0===this.selectedOptions.length){this.showSelected=!1;this.getAllOptions().forEach((e=>{e.selected||(e.hidden=this.showSelected)})),this.requestUpdate()}}else this.value=this.selectedOptions[0]?.value??this.value,this.displayLabel=this.selectedOptions[0]?.getTextLabel()?this.selectedOptions[0].getTextLabel():this.value??"";this.updateComplete.then((()=>{this.formControlController?.updateValidity()})),this.calculateTotalWidthOfTags()}handleSearchFocus(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}handleSearchBlur(){document.addEventListener("keydown",this.handleDocumentKeyDown)}handleSearchChange(e){if(this.searchValue=e.detail.value,this.emit("nile-search",{query:this.searchValue,name:this.name}),this.enableGroupHeader&&this.handleGroupSearchChange(),!this.disableLocalSearch){0===this.filterOptions(this.searchValue).length?this.showNoResults=!0:this.showNoResults=!1}}handleScroll(e){const t=e.target;this.emit("nile-scroll",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name}),this.scrolling||(this.scrolling=!0,this.emit("nile-scroll-start",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name})),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout((()=>{this.scrolling&&(this.scrolling=!1)}),300);Math.ceil(t.scrollTop)>=Math.floor(t.scrollHeight-t.offsetHeight)&&this.emit("nile-scroll-end",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name,isAtBottom:!0})}filterOptions(e){const t=this.getAllOptions(),i=e.toLowerCase();let M=[];return t.forEach((e=>{const t=e.getTextLabel().toLowerCase(),n=(e.value||"").toLowerCase();t.includes(i)||n.includes(i)?(e.hidden=!1,M.push(e)):e.hidden=!0})),this.portal&&this.open&&this.portalManager.updatePortalOptions(),M}handleInvalid(e){this.formControlController?.setValidity(!1),this.formControlController?.emitInvalidEvent(e)}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}handleValueChange(){const e=this.getAllOptions(),t=Array.isArray(this.value)?this.value:[this.value];this.enableVirtualScroll||this.setSelectedOptions(e.filter((e=>t.includes(e.value))))}handlePortalAppendChange(){this.open&&(this.portal?this.portalManager.setupPortalAppend():this.portalManager.cleanupPortalAppend())}async handleOpenChange(){if(this.open&&!this.disabled){this.setCurrentOption(this.selectedOptions[0]||this.getFirstOption()),this.emit("nile-show",{value:this.value,name:this.name}),this.enableGroupHeader&&this.getAllGroupAttributes().forEach((e=>{e.element.classList.remove("nile-group-hidden")})),this.addOpenListeners(),this.visibilityManager?.setup(),this.showNoResults=!this.getAllOptions()?.length,await jt(this),this.listbox.hidden=!1,this.popup.active=!0,requestAnimationFrame((()=>{this.setCurrentOption(this.currentOption)}));const{keyframes:e,options:t}=yt(this,"select.show",{dir:"ltr"});await ut(this.popup.popup,e,t),this.currentOption&&xt(this.currentOption,this.listbox,"vertical","auto"),this.searchValue="",this.filterOptions(this.searchValue),this.portal&&this.portalManager.setupPortalAppend(),this.emit("nile-after-show",{value:this.value,name:this.name}),this.autoFocusSearch&&this.handleInputAfterInit()}else{this.emit("nile-hide",{value:this.value,name:this.name}),this.showSelected=!1,this.removeOpenListeners(),this.visibilityManager?.cleanup(),await jt(this);const{keyframes:e,options:t}=yt(this,"select.hide",{dir:"ltr"});await ut(this.popup.popup,e,t),this.listbox.hidden=!0,this.popup.active=!1,this.portal&&this.portalManager.cleanupPortalAppend(),this.searchValue="",this.emit("nile-after-hide",{value:this.value,name:this.name})}}getAllGroupAttributes(){return Array.from(this.querySelectorAll("nile-option-group[name]")).map((e=>({name:e?.getAttribute("name")||"",data:e?.getAttribute("data"),element:e})))}getUniqueGroupNames(e){return Array.from(new Set(e.map((e=>e?.groupName))))}handleGroupSearchChange(){const e=new Set(this.getUniqueGroupNames(this.filterOptions(this.searchValue)));this.getAllGroupAttributes().forEach((({name:t,element:i})=>{i?.classList.toggle("nile-group-hidden",!e.has(t))}))}handleGroupShowSelected(){const e=new Set;this.showSelected&&this.getAllOptions().forEach((t=>{t.hidden||e.add(t.groupName)})),this.getAllGroupAttributes().forEach((({name:t,element:i})=>{i?.classList.toggle("nile-group-hidden",this.showSelected&&!e.has(t))}))}async show(){if(!this.open&&!this.disabled)return this.open=!0,St(this,"nile-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,St(this,"nile-after-hide");this.open=!1}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController?.getForm()||null}reportValidity(){return this.valueInput.reportValidity()}setCustomValidity(e){this.valueInput.setCustomValidity(e),this.formControlController?.updateValidity()}focus(e){this.displayInput.focus(e)}blur(){this.displayInput.blur()}onInputChange(e){e.stopPropagation()}calculateWidthOfSelectTagsDiv(){if(this.shadowRoot){const e=this.shadowRoot.querySelector("div.select__tags");if(e instanceof HTMLElement){return e.offsetWidth-70}}}calculateTotalWidthOfTags(){this.maxOptionsVisible!==1/0&&(this.oldMaxOptionsVisible=this.maxOptionsVisible),this.maxOptionsVisible=1/0,setTimeout((()=>{let e=[];if(this.shadowRoot){this.shadowRoot.querySelectorAll("nile-tag").forEach((t=>{t instanceof HTMLElement&&e.push(t.offsetWidth)}))}if(this.value.length!==e.length)return;const t=this.calculateWidthOfSelectTagsDiv();if(!t)return;let i=0,M=0;for(let n=0;n<e.length;n++)if(i+=e[n],i>t){M=n;break}this.maxOptionsVisible=M}),1)}handleInputAfterInit(){this.shadowRoot?.querySelector("nile-input")?.inputFocus()}render(){if(this.enableVirtualScroll)return this.virtualScrollHelper.renderVirtualizedContent();const e=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const t=this.hasSlotController.test("label-suffix"),i=this.hasSlotController.test("custom-select"),M=!!this.label||!!e,n=this.clearable&&!this.disabled&&this.value.length>0,o=this.placeholder&&0===this.value.length,r=!(!this.helpText&&!this.help_text),s=!!this.errorMessage,a=this.selectedOptions[0]?this.getOptionPrefix(this.selectedOptions[0]):"";return R`
5197
5199
  <div
5198
5200
  part="form-control"
5199
5201
  class=${pe({"form-control":!0,"form-control--small":"small"===this.size,"form-control--medium":"medium"===this.size,"form-control--large":"large"===this.size,"form-control--has-label":M,"form-control--has-help-text":r})}
@@ -5424,7 +5426,7 @@ class CM{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
5424
5426
  >
5425
5427
  `:""}
5426
5428
  </div>
5427
- `}nileInput(e){this.emit("nile-input",e)}nileChange(e){this.emit("nile-change",e)}};qM.styles=cM,e([Ie(".select")],qM.prototype,"popup",void 0),e([Ie(".select__combobox")],qM.prototype,"combobox",void 0),e([Ie(".select__display-input")],qM.prototype,"displayInput",void 0),e([Ie(".select__value-input")],qM.prototype,"valueInput",void 0),e([Ie(".select__listbox")],qM.prototype,"listbox",void 0),e([De()],qM.prototype,"hasFocus",void 0),e([De()],qM.prototype,"displayLabel",void 0),e([De()],qM.prototype,"currentOption",void 0),e([De()],qM.prototype,"selectedOptions",void 0),e([De()],qM.prototype,"oldValue",void 0),e([ce()],qM.prototype,"name",void 0),e([ce({converter:{fromAttribute:e=>e.split(" "),toAttribute:e=>e.join(" ")}})],qM.prototype,"value",void 0),e([Je()],qM.prototype,"defaultValue",void 0),e([ce()],qM.prototype,"size",void 0),e([ce()],qM.prototype,"placeholder",void 0),e([De()],qM.prototype,"searchValue",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"searchEnabled",void 0),e([ce({attribute:"internal-search-placeholder"})],qM.prototype,"internalSearchPlaceHolder",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"enableVisibilityEffect",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"blockValueChange",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"disableLocalSearch",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"optionsLoading",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"noWidthSync",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"portal",void 0),e([ce({reflect:!0,converter:{fromAttribute:e=>""===e||"true"===e||"false"!==e&&e,toAttribute:e=>"boolean"==typeof e?String(e):e}})],qM.prototype,"multiple",void 0),e([ce({attribute:!0,reflect:!0})],qM.prototype,"helpText",void 0),e([ce({attribute:"help-text",reflect:!0})],qM.prototype,"help_text",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],qM.prototype,"autoResize",void 0),e([ce({attribute:"error-message",reflect:!0})],qM.prototype,"errorMessage",void 0),e([ce({type:Boolean})],qM.prototype,"warning",void 0),e([ce({type:Boolean})],qM.prototype,"error",void 0),e([ce({type:Boolean})],qM.prototype,"success",void 0),e([ce({attribute:"max-options-visible",type:Number})],qM.prototype,"maxOptionsVisible",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"disabled",void 0),e([ce({type:Boolean})],qM.prototype,"clearable",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"open",void 0),e([ce({type:Boolean})],qM.prototype,"hoist",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"filled",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"pill",void 0),e([ce()],qM.prototype,"label",void 0),e([ce({reflect:!0})],qM.prototype,"placement",void 0),e([ce({reflect:!0})],qM.prototype,"form",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"required",void 0),e([ce({type:Boolean})],qM.prototype,"showSelected",void 0),e([De()],qM.prototype,"oldMaxOptionsVisible",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"enableTabClose",void 0),e([ce({type:Boolean})],qM.prototype,"showNoResults",void 0),e([ce({type:String})],qM.prototype,"noResultsMessage",void 0),e([ce({attribute:!1})],qM.prototype,"renderItemConfig",void 0),e([ce({type:Array})],qM.prototype,"data",void 0),e([ce({type:Boolean})],qM.prototype,"enableVirtualScroll",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"enableGroupHeader",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"autoFocusSearch",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"loading",void 0),e([We("disabled",{waitUntilFirstUpdate:!0})],qM.prototype,"handleDisabledChange",null),e([We("value",{waitUntilFirstUpdate:!0})],qM.prototype,"handleValueChange",null),e([We("portal",{waitUntilFirstUpdate:!0})],qM.prototype,"handlePortalAppendChange",null),e([We("open",{waitUntilFirstUpdate:!0})],qM.prototype,"handleOpenChange",null),qM=e([Ne("nile-select")],qM),Tt("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),Tt("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});const KM=r`
5429
+ `}nileInput(e){this.emit("nile-input",e)}nileChange(e){this.emit("nile-change",e)}};qM.styles=cM,e([Ie(".select")],qM.prototype,"popup",void 0),e([Ie(".select__combobox")],qM.prototype,"combobox",void 0),e([Ie(".select__display-input")],qM.prototype,"displayInput",void 0),e([Ie(".select__value-input")],qM.prototype,"valueInput",void 0),e([Ie(".select__listbox")],qM.prototype,"listbox",void 0),e([De()],qM.prototype,"hasFocus",void 0),e([De()],qM.prototype,"displayLabel",void 0),e([De()],qM.prototype,"currentOption",void 0),e([De()],qM.prototype,"selectedOptions",void 0),e([De()],qM.prototype,"oldValue",void 0),e([ce()],qM.prototype,"name",void 0),e([ce({converter:{fromAttribute:e=>e.split(" "),toAttribute:e=>e.join(" ")}})],qM.prototype,"value",void 0),e([Je()],qM.prototype,"defaultValue",void 0),e([ce()],qM.prototype,"size",void 0),e([ce()],qM.prototype,"placeholder",void 0),e([De()],qM.prototype,"searchValue",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"searchEnabled",void 0),e([ce({attribute:"internal-search-placeholder"})],qM.prototype,"internalSearchPlaceHolder",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"enableVisibilityEffect",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"blockValueChange",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"disableLocalSearch",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"optionsLoading",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"noWidthSync",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"portal",void 0),e([ce({reflect:!0,converter:{fromAttribute:e=>""===e||"true"===e||"false"!==e&&e,toAttribute:e=>"boolean"==typeof e?String(e):e}})],qM.prototype,"multiple",void 0),e([ce({attribute:!0,reflect:!0})],qM.prototype,"helpText",void 0),e([ce({attribute:"help-text",reflect:!0})],qM.prototype,"help_text",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],qM.prototype,"autoResize",void 0),e([ce({attribute:"error-message",reflect:!0})],qM.prototype,"errorMessage",void 0),e([ce({type:Boolean})],qM.prototype,"warning",void 0),e([ce({type:Boolean})],qM.prototype,"error",void 0),e([ce({type:Boolean})],qM.prototype,"success",void 0),e([ce({attribute:"max-options-visible",type:Number})],qM.prototype,"maxOptionsVisible",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"disabled",void 0),e([ce({type:Boolean})],qM.prototype,"clearable",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"open",void 0),e([ce({type:Boolean})],qM.prototype,"hoist",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"filled",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"pill",void 0),e([ce()],qM.prototype,"label",void 0),e([ce({reflect:!0})],qM.prototype,"placement",void 0),e([ce({reflect:!0})],qM.prototype,"form",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"required",void 0),e([ce({type:Boolean})],qM.prototype,"showSelected",void 0),e([De()],qM.prototype,"oldMaxOptionsVisible",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"enableTabClose",void 0),e([ce({type:Boolean})],qM.prototype,"showNoResults",void 0),e([ce({type:String})],qM.prototype,"noResultsMessage",void 0),e([ce({attribute:!1})],qM.prototype,"renderItemConfig",void 0),e([ce({type:Array})],qM.prototype,"data",void 0),e([ce({type:Boolean})],qM.prototype,"enableVirtualScroll",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"enableGroupHeader",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"autoFocusSearch",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],qM.prototype,"loading",void 0),e([ce({type:Boolean,reflect:!0})],qM.prototype,"stickyHeader",void 0),e([We("disabled",{waitUntilFirstUpdate:!0})],qM.prototype,"handleDisabledChange",null),e([We("value",{waitUntilFirstUpdate:!0})],qM.prototype,"handleValueChange",null),e([We("portal",{waitUntilFirstUpdate:!0})],qM.prototype,"handlePortalAppendChange",null),e([We("open",{waitUntilFirstUpdate:!0})],qM.prototype,"handleOpenChange",null),qM=e([Ne("nile-select")],qM),Tt("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),Tt("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});const KM=r`
5428
5430
  :host {
5429
5431
  display: block;
5430
5432
  user-select: none;
@@ -7262,7 +7264,7 @@ box-shadow: none;
7262
7264
  .month-dropdown, .year-dropdown {
7263
7265
  cursor: pointer;
7264
7266
  }
7265
- `;var Qn;!function(e){e.Single="single",e.Range="range",e.Relative="relative"}(Qn||(Qn={}));let kn=class extends Re{constructor(){super(...arguments),this.valueAttribute=null,this.allowedDates=JSON.stringify({}),this.range=!1,this.hideTypes=!1,this.doubleClickUnselect=!1,this.allowClear=!1,this.type="absolute",this.hideDurationFields=[],this.showManualInputs=!1,this.showMonthDropdown=!1,this.showYearDropdown=!1,this.dateFormat="MM/DD/YYYY",this.startDate=null,this.endDate=null,this.isSelectingStart=!0,this.hideInput=!1,this.currentMonth=(new Date).getMonth(),this.currentYear=(new Date).getFullYear(),this.allowedDatesLocal=null}static get styles(){return[wn]}connectedCallback(){super.connectedCallback(),this.initializeValue(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}updated(e){if(super.updated(e),e.has("valueAttribute")){this.valueAttribute||(this.value=null,this.startDate=null,this.endDate=null,this.isSelectingStart=!0);const e=new Date(this.valueAttribute||"");if(!isNaN(e.getTime())){const t=e.getTimezoneOffset();this.value=new Date(e.getTime()-60*t*1e3),this.currentMonth=this.value.getMonth(),this.currentYear=this.value.getFullYear()}this.initializeValue()}}get monthNames(){return Array.from({length:12},((e,t)=>new Date(0,t).toLocaleString("default",{month:"long"})))}get yearOptions(){const e=this.startYear??2e3,t=this.endYear??2050;return e>t?[]:Array.from({length:t-e+1},((t,i)=>e+i))}onMonthSelected(e){this.currentMonth=e,this.emit("nile-month-change",{month:e})}onYearSelected(e){this.currentYear=e,this.emit("nile-year-change",{year:e})}checkValidAllowedDate(){let e;try{e=JSON.parse(this.allowedDates)}catch(t){e=null}if(!e||0==Object.keys(e).length)return void(this.allowedDatesLocal=null);this.hideInput=!0;this.getUTCDate(e.startDate)>this.getUTCDate(e.endDate)?console.error("StartDate must be greater than endDate"):this.allowedDatesLocal=e}isPrevDisabled(){return 0===this.currentMonth&&void 0!==this.startYear&&this.currentYear<=this.startYear}isNextDisabled(){return 11===this.currentMonth&&void 0!==this.endYear&&this.currentYear>=this.endYear}formatDate(e){if(!e)return"";const t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),M=String(e.getDate()).padStart(2,"0");let n=this.dateFormat;return n=n.replace(/YYYY/g,String(t)),n=n.replace(/MM/g,i),n=n.replace(/DD/g,M),n=n.replace(/YY/g,String(t).slice(-2)),n}parseDate(e,t){if(!e||!this.dateFormat)return null;const i=this.dateFormat.replace(/YYYY/,"(?<year>\\d{4})").replace(/YY/,"(?<year>\\d{2})").replace(/MM/,"(?<month>\\d{1,2})").replace(/DD/,"(?<day>\\d{1,2})"),M=new RegExp(`^${i}$`),n=e.match(M);if(!n||!n.groups)return null;const o=2===n.groups.year.length?Number(`20${n.groups.year}`):Number(n.groups.year),r=Number(n.groups.month)-1,s=Number(n.groups.day),a=new Date(t||new Date);return a.setFullYear(o,r,s),isNaN(a.getTime())?null:a}handleStartDateInput(e){e.stopPropagation();const t=this.parseDate(e.detail.value,this.startDate);t&&(this.startDate=t,this.currentMonth=t.getMonth(),this.currentYear=t.getFullYear(),this.requestUpdate())}handleEndDateInput(e){e.stopPropagation();const t=this.parseDate(e.detail.value,this.endDate);t&&(this.endDate=t,this.currentMonth=t.getMonth(),this.currentYear=t.getFullYear(),this.requestUpdate())}render(){return R`
7267
+ `;var Qn;!function(e){e.Single="single",e.Range="range",e.Relative="relative"}(Qn||(Qn={}));let kn=class extends Re{constructor(){super(...arguments),this.valueAttribute=null,this.allowedDates=JSON.stringify({}),this.range=!1,this.hideTypes=!1,this.doubleClickUnselect=!1,this.allowClear=!1,this.type="absolute",this.hideDurationFields=[],this.showManualInputs=!1,this.showMonthDropdown=!1,this.showYearDropdown=!1,this.dateFormat="MM/DD/YYYY",this.startDate=null,this.endDate=null,this.isSelectingStart=!0,this.hideInput=!1,this.currentMonth=(new Date).getMonth(),this.currentYear=(new Date).getFullYear(),this.allowedDatesLocal=null}static get styles(){return[wn]}connectedCallback(){super.connectedCallback(),this.initializeValue(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}updated(e){if(super.updated(e),e.has("valueAttribute")){this.valueAttribute||(this.value=null,this.startDate=null,this.endDate=null,this.isSelectingStart=!0);const e=new Date(this.valueAttribute||"");if(!isNaN(e.getTime())){const t=e.getTimezoneOffset();this.value=new Date(e.getTime()-60*t*1e3),this.currentMonth=this.value.getMonth(),this.currentYear=this.value.getFullYear()}this.initializeValue()}}get monthNames(){return Array.from({length:12},((e,t)=>new Date(0,t).toLocaleString("default",{month:"long"})))}get yearOptions(){const e=this.startYear??2e3,t=this.endYear??2050;return e>t?[]:Array.from({length:t-e+1},((t,i)=>e+i))}onMonthSelected(e){this.currentMonth=e,this.emit("nile-month-change",{month:e})}onYearSelected(e){this.currentYear=e,this.emit("nile-year-change",{year:e})}checkValidAllowedDate(){let e;try{e=JSON.parse(this.allowedDates)}catch(t){e=null}if(!e||0==Object.keys(e).length)return void(this.allowedDatesLocal=null);this.hideInput=!0;this.getUTCDate(e.startDate)>this.getUTCDate(e.endDate)?console.error("StartDate must be greater than endDate"):this.allowedDatesLocal=e}isPrevDisabled(){return 0===this.currentMonth&&void 0!==this.startYear&&this.currentYear<=this.startYear}isNextDisabled(){return 11===this.currentMonth&&void 0!==this.endYear&&this.currentYear>=this.endYear}formatDate(e){if(!e)return"";const t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),M=String(e.getDate()).padStart(2,"0");let n=this.dateFormat;return n=n.replace(/YYYY/g,String(t)),n=n.replace(/MM/g,i),n=n.replace(/DD/g,M),n=n.replace(/YY/g,String(t).slice(-2)),n}parseDate(e,t){if(!e||!this.dateFormat)return null;const i=this.dateFormat.replace(/YYYY/,"(?<year>\\d{4})").replace(/YY/,"(?<year>\\d{2})").replace(/MM/,"(?<month>\\d{1,2})").replace(/DD/,"(?<day>\\d{1,2})"),M=new RegExp(`^${i}$`),n=e.match(M);if(!n||!n.groups)return null;const o=2===n.groups.year.length?Number(`20${n.groups.year}`):Number(n.groups.year),r=Number(n.groups.month)-1,s=Number(n.groups.day),a=new Date(o,r,s);return t?a.setHours(t.getHours(),t.getMinutes(),t.getSeconds()):a.setHours(0,0,0),a}handleStartDateInput(e){e.stopPropagation();const t=this.parseDate(e.detail.value,this.startDate);t&&(t.setHours(0,0,0),this.startDate=t,this.currentMonth=t.getMonth(),this.currentYear=t.getFullYear(),this.requestUpdate())}handleEndDateInput(e){e.stopPropagation();const t=this.parseDate(e.detail.value,this.endDate);t&&(t.setHours(23,59,59),this.endDate=t,this.currentMonth=t.getMonth(),this.currentYear=t.getFullYear(),this.requestUpdate())}render(){return R`
7266
7268
  <div
7267
7269
  class=${pe({base:!0,base__range:this.range})}
7268
7270
  part="calendar-container"
@@ -14266,7 +14268,21 @@ nile-badge::part(content) {
14266
14268
  :host(.nile-group-hidden)::part(option-group-header) {
14267
14269
  display: none !important;
14268
14270
  }
14269
- `;let HL=class extends Re{constructor(){super(...arguments),this.name="",this.data=null}static get styles(){return[FL]}checkForImageOrIcon(){return this.data?.prefix?.icon?.name||this.data?.prefix?.image?.src||this.data?.prefix?.prefixText}normalizeImageDimension(e){if(null==e||""===e)return"20";const t=Number(e);return isNaN(t)||t<=0?"20":t>40?"25":t.toString()}render(){return R`
14271
+
14272
+ .option-group-header {
14273
+ z-index: 2;
14274
+ }
14275
+ :host([sticky]) .option-group-header {
14276
+ position: sticky;
14277
+ top: 0;
14278
+ z-index: 1;
14279
+ background: var(--nile-colors-dark-200);
14280
+ }
14281
+ :host([sticky][search-enabled]) .option-group-header {
14282
+ top: 46px;
14283
+ }
14284
+
14285
+ `;let HL=class extends Re{constructor(){super(...arguments),this.name="",this.data=null,this.sticky=!1}static get styles(){return[FL]}checkForImageOrIcon(){return this.data?.prefix?.icon?.name||this.data?.prefix?.image?.src||this.data?.prefix?.prefixText}normalizeImageDimension(e){if(null==e||""===e)return"20";const t=Number(e);return isNaN(t)||t<=0?"20":t>40?"25":t.toString()}render(){return R`
14270
14286
  <div part="option-group-header" class="option-group-header">
14271
14287
  <div part="content-container" class="content-container ${this.checkForImageOrIcon()?"gap-18px":""}">
14272
14288
  <!-- prefix content -->
@@ -14279,7 +14295,7 @@ nile-badge::part(content) {
14279
14295
  <!-- suffix content -->
14280
14296
  ${this.data?.suffix?.icon?.name?R`<nile-icon part="suffix-icon" name="${this.data?.suffix?.icon?.name}" size="${this.data?.suffix?.icon?.size||"16"}" color="${this.data?.suffix?.icon?.color||"var(--nile-colors-dark-500)"}" method="${this.data?.suffix?.icon?.method||"fill"}"></nile-icon>`:this.data?.suffix?.suffixText?R`<span part="suffix-text">${this.data?.suffix?.suffixText}</span>`:this.data?.suffix?.image?.src?R`<img part="suffix-image" src="${this.data?.prefix?.image?.src}" width="${this.normalizeImageDimension(this.data?.suffix?.image?.width)}" height="${this.normalizeImageDimension(this.data?.suffix?.image?.height)}">`:R`<slot part="suffix" name="suffix" class="option-group-suffix"></slot>`}
14281
14297
  </div>
14282
- `}};e([ce({type:String,reflect:!0,attribute:!0})],HL.prototype,"name",void 0),e([ce({type:Object,reflect:!0,attribute:!0})],HL.prototype,"data",void 0),HL=e([Ne("nile-option-group")],HL);const JL=r`
14298
+ `}};e([ce({type:String,reflect:!0,attribute:!0})],HL.prototype,"name",void 0),e([ce({type:Object,reflect:!0,attribute:!0})],HL.prototype,"data",void 0),e([ce({type:Boolean,reflect:!0,attribute:!0})],HL.prototype,"sticky",void 0),HL=e([Ne("nile-option-group")],HL);const JL=r`
14283
14299
  :host {
14284
14300
  --min-width: 180px;
14285
14301
  display: grid;
@@ -14841,7 +14857,7 @@ nile-rte-toolbar-item nile-button[data-active]::part(base):hover {
14841
14857
 
14842
14858
 
14843
14859
 
14844
- `,_S={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let FS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=e=>{if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),US(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===e.key)return void e.preventDefault();if("Tab"!==e.key)return;e.preventDefault(),this.focusAndRestore();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(e.shiftKey){if(i.collapsed&&i.startContainer.nodeType===Node.TEXT_NODE){const e=i.startContainer,M=i.startOffset,n=e.data.slice(0,M),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(M);const i=document.createRange();i.setStart(e,o.length),i.collapse(!0),t.removeAllRanges(),t.addRange(i),this.updateContent(),this.updateToolbarState()}}return}i.deleteContents();const M=document.createTextNode("\t");i.insertNode(M);const n=document.createRange();n.setStartAfter(M),n.collapse(!0),t.removeAllRanges(),t.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);this.editorEl.contains(t.commonAncestorContainer)&&(this.lastRange=t.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(e){if(this.querySelector("style[data-rte-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-style","true"),t.textContent=e,this.insertBefore(t,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(GS.cssText),this.ensureStructure(),this.placeholder&&this.editorEl&&(this.editorEl.dataset.placeholder=this.placeholder),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(e){e.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),e.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable","true"),this.editorEl=e}this.placeholder&&(this.editorEl.dataset.placeholder=this.placeholder),this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const i=e.parentNode;if(!i)return;const M=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(M);i.insertBefore(n,e),i.removeChild(e);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((e=>{const t=e,i=t.getAttribute("data-mention-key"),M=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!i&&!!M&&o.length>0&&o.startsWith(n)&&o.includes(M);o&&r||this.unwrapMention(t,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(e){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(e.children).forEach((e=>{const t=e.tagName.toLowerCase();if("nile-rte-select"!==t||"align"!==e.getAttribute("type")){if("nile-rte-link"===t)return e.editorEl=this.editorEl,void e.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===t){let t=e.querySelector(":scope > nile-button");const i=e.getAttribute("name")||"",M=e.getAttribute("label")||i,n=e.getAttribute("icon"),o=e.innerHTML.trim().length>0;if(t||(t=document.createElement("nile-button"),t.variant="tertiary",t.size="small"),n)t.innerHTML=`<nile-icon name="${n}" aria-label="${M}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=_S[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${M}"></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected){const i=document.createElement("nile-tooltip");i.setAttribute("content",M),i.appendChild(t),e.appendChild(i)}t.setAttribute("aria-label",M),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(i)));const r=this.buttonMap.get(i)??[];return r.push(t),void this.buttonMap.set(i,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:i}=e.detail;"backColor"===t?WS(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){WS(e,"color",t,"data-rte-color")}(this.editorEl,i),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const i=e.detail;"heading"===t?function(e,t){const i=document.getSelection();if(!i||0===i.rangeCount)return;const M=fS(i.getRangeAt(0).startContainer,e);if(!M)return;if(M.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;M.firstChild;)n.appendChild(M.firstChild);M.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),i.removeAllRanges(),i.addRange(o)}(this.editorEl,i):"font"===t&&ZS(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;vS(this.editorEl,t),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const e=window.getSelection();e&&e.rangeCount&&(this.lastRange=e.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const e=document.getSelection();e&&(e.removeAllRanges(),e.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCleanContent(){const e=this.editorEl.cloneNode(!0);return e.querySelectorAll("*").forEach((e=>{e.removeAttribute("style")})),e.innerHTML}insertList(e){if(this.restoreSelection(),!this.lastRange)return;const t=document.createElement(e),i=this.lastRange.extractContents(),M=document.createElement("div");M.appendChild(i),Array.from(M.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const i=document.createElement("li");i.appendChild(e),t.appendChild(i)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(t),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const e=this.editorEl;if(!e)return;const t=""===(e.textContent??"").replace(/\u200B/g,"").trim();if(0===e.childNodes.length||t)return void(e.innerHTML="<p><br></p>");if(!e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const t=document.createElement("p");for(;e.firstChild;)t.appendChild(e.firstChild);return t.hasChildNodes()||t.appendChild(document.createElement("br")),void e.appendChild(t)}e.querySelectorAll("p").forEach((e=>{""===(e.textContent??"").replace(/\u200B/g,"")&&(e.innerHTML.toLowerCase().includes("<br")||(e.innerHTML="<br>"))}))}onToolbarCommand(e){switch(this.focusAndRestore(),e){case"bold":US(this.editorEl,"strong");break;case"italic":US(this.editorEl,"em");break;case"underline":US(this.editorEl,"u");break;case"left":vS(this.editorEl,"left");break;case"center":vS(this.editorEl,"center");break;case"right":vS(this.editorEl,"right");break;case"justify":vS(this.editorEl,"justify");break;case"ul":BS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":BS(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=[];for(;e.nextNode();){const i=e.currentNode;i.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(i.tagName)&&t.push(i)}for(const e of t){for(;e.firstChild;)e.parentNode?.insertBefore(e.firstChild,e);e.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(e,t){const i=this.buttonMap.get(e);if(i)for(const e of i)e.toggleAttribute("data-active",!!t)}updateToolbarState(){if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);if(!this.editorEl.contains(t.commonAncestorContainer))return;const i=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,M=getComputedStyle(i),n=fS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const i=getComputedStyle(e).fontWeight;if(parseInt(i,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("em"===t||"i"===t)return!0;if("italic"===getComputedStyle(e).fontStyle)return!0}e=e.parentNode}return!1})(),s=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=getComputedStyle(e).textDecorationLine;if(t&&t.includes("underline"))return!0;if("u"===e.tagName.toLowerCase())return!0}e=e.parentNode}return!1})(),a=!!i.closest("a"),l=n.style.textAlign||getComputedStyle(n).textAlign||"start",N="start"===l?"left":l,g=!!i.closest("li")&&i.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",s),this.setBtnActive("link",a),this.setBtnActive("left","left"===N&&!["center","right","justify"].includes(N)),this.setBtnActive("center","center"===N),this.setBtnActive("right","right"===N),this.setBtnActive("justify","justify"===N),this.setBtnActive("ul","ul"===g),this.setBtnActive("ol","ol"===g),this.headingSelect){const e=n.tagName.toLowerCase(),t=["h1","h2","h3"].includes(e)?e:"p";this.headingSelect.value!==t&&(this.headingSelect.value=t)}if(this.fontSelect){const e=(M.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(e)for(const t of Array.from(this.fontSelect.options))if(t.value.toLowerCase()===e){this.fontSelect.value=t.value;break}}if(this.colorInput){const e=YS(M.color);e&&this.colorInput.value.toLowerCase()!==e.toLowerCase()&&(this.colorInput.value=e),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const e=getComputedStyle(i).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=YS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=this.editorEl.cloneNode(!0);if(this.noStyles)t.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),M=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;e.nextNode()&&i.nextNode();){const t=e.currentNode,n=i.currentNode,o=window.getComputedStyle(t),r=M.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ce({type:String,attribute:!0,reflect:!0})],FS.prototype,"value",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],FS.prototype,"noStyles",void 0),e([ce({type:Boolean,attribute:"singlelineeditor",reflect:!0})],FS.prototype,"singleLineEditor",void 0),e([ce({type:String})],FS.prototype,"placeholder",void 0),e([ce({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),i={};for(const e of Object.keys(t)){const M=t[e];Array.isArray(M)&&(i[e]=M.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return i}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],FS.prototype,"mentions",void 0),e([De()],FS.prototype,"content",void 0),FS=e([Ne("nile-rich-text-editor")],FS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.3.9"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const HS=r`
14860
+ `,_S={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let FS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=e=>{if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),US(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===e.key)return void e.preventDefault();if("Tab"!==e.key)return;e.preventDefault(),this.focusAndRestore();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(e.shiftKey){if(i.collapsed&&i.startContainer.nodeType===Node.TEXT_NODE){const e=i.startContainer,M=i.startOffset,n=e.data.slice(0,M),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(M);const i=document.createRange();i.setStart(e,o.length),i.collapse(!0),t.removeAllRanges(),t.addRange(i),this.updateContent(),this.updateToolbarState()}}return}i.deleteContents();const M=document.createTextNode("\t");i.insertNode(M);const n=document.createRange();n.setStartAfter(M),n.collapse(!0),t.removeAllRanges(),t.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);this.editorEl.contains(t.commonAncestorContainer)&&(this.lastRange=t.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(e){if(this.querySelector("style[data-rte-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-style","true"),t.textContent=e,this.insertBefore(t,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(GS.cssText),this.ensureStructure(),this.placeholder&&this.editorEl&&(this.editorEl.dataset.placeholder=this.placeholder),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(e){e.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),e.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable","true"),this.editorEl=e}this.placeholder&&(this.editorEl.dataset.placeholder=this.placeholder),this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const i=e.parentNode;if(!i)return;const M=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(M);i.insertBefore(n,e),i.removeChild(e);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((e=>{const t=e,i=t.getAttribute("data-mention-key"),M=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!i&&!!M&&o.length>0&&o.startsWith(n)&&o.includes(M);o&&r||this.unwrapMention(t,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(e){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(e.children).forEach((e=>{const t=e.tagName.toLowerCase();if("nile-rte-select"!==t||"align"!==e.getAttribute("type")){if("nile-rte-link"===t)return e.editorEl=this.editorEl,void e.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===t){let t=e.querySelector(":scope > nile-button");const i=e.getAttribute("name")||"",M=e.getAttribute("label")||i,n=e.getAttribute("icon"),o=e.innerHTML.trim().length>0;if(t||(t=document.createElement("nile-button"),t.variant="tertiary",t.size="small"),n)t.innerHTML=`<nile-icon name="${n}" aria-label="${M}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=_S[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${M}"></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected){const i=document.createElement("nile-tooltip");i.setAttribute("content",M),i.appendChild(t),e.appendChild(i)}t.setAttribute("aria-label",M),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(i)));const r=this.buttonMap.get(i)??[];return r.push(t),void this.buttonMap.set(i,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:i}=e.detail;"backColor"===t?WS(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){WS(e,"color",t,"data-rte-color")}(this.editorEl,i),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const i=e.detail;"heading"===t?function(e,t){const i=document.getSelection();if(!i||0===i.rangeCount)return;const M=fS(i.getRangeAt(0).startContainer,e);if(!M)return;if(M.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;M.firstChild;)n.appendChild(M.firstChild);M.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),i.removeAllRanges(),i.addRange(o)}(this.editorEl,i):"font"===t&&ZS(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;vS(this.editorEl,t),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const e=window.getSelection();e&&e.rangeCount&&(this.lastRange=e.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const e=document.getSelection();e&&(e.removeAllRanges(),e.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCleanContent(){const e=this.editorEl.cloneNode(!0);return e.querySelectorAll("*").forEach((e=>{e.removeAttribute("style")})),e.innerHTML}insertList(e){if(this.restoreSelection(),!this.lastRange)return;const t=document.createElement(e),i=this.lastRange.extractContents(),M=document.createElement("div");M.appendChild(i),Array.from(M.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const i=document.createElement("li");i.appendChild(e),t.appendChild(i)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(t),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const e=this.editorEl;if(!e)return;const t=""===(e.textContent??"").replace(/\u200B/g,"").trim();if(0===e.childNodes.length||t)return void(e.innerHTML="<p><br></p>");if(!e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const t=document.createElement("p");for(;e.firstChild;)t.appendChild(e.firstChild);return t.hasChildNodes()||t.appendChild(document.createElement("br")),void e.appendChild(t)}e.querySelectorAll("p").forEach((e=>{""===(e.textContent??"").replace(/\u200B/g,"")&&(e.innerHTML.toLowerCase().includes("<br")||(e.innerHTML="<br>"))}))}onToolbarCommand(e){switch(this.focusAndRestore(),e){case"bold":US(this.editorEl,"strong");break;case"italic":US(this.editorEl,"em");break;case"underline":US(this.editorEl,"u");break;case"left":vS(this.editorEl,"left");break;case"center":vS(this.editorEl,"center");break;case"right":vS(this.editorEl,"right");break;case"justify":vS(this.editorEl,"justify");break;case"ul":BS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":BS(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=[];for(;e.nextNode();){const i=e.currentNode;i.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(i.tagName)&&t.push(i)}for(const e of t){for(;e.firstChild;)e.parentNode?.insertBefore(e.firstChild,e);e.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(e,t){const i=this.buttonMap.get(e);if(i)for(const e of i)e.toggleAttribute("data-active",!!t)}updateToolbarState(){if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);if(!this.editorEl.contains(t.commonAncestorContainer))return;const i=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,M=getComputedStyle(i),n=fS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const i=getComputedStyle(e).fontWeight;if(parseInt(i,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("em"===t||"i"===t)return!0;if("italic"===getComputedStyle(e).fontStyle)return!0}e=e.parentNode}return!1})(),s=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=getComputedStyle(e).textDecorationLine;if(t&&t.includes("underline"))return!0;if("u"===e.tagName.toLowerCase())return!0}e=e.parentNode}return!1})(),a=!!i.closest("a"),l=n.style.textAlign||getComputedStyle(n).textAlign||"start",N="start"===l?"left":l,g=!!i.closest("li")&&i.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",s),this.setBtnActive("link",a),this.setBtnActive("left","left"===N&&!["center","right","justify"].includes(N)),this.setBtnActive("center","center"===N),this.setBtnActive("right","right"===N),this.setBtnActive("justify","justify"===N),this.setBtnActive("ul","ul"===g),this.setBtnActive("ol","ol"===g),this.headingSelect){const e=n.tagName.toLowerCase(),t=["h1","h2","h3"].includes(e)?e:"p";this.headingSelect.value!==t&&(this.headingSelect.value=t)}if(this.fontSelect){const e=(M.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(e)for(const t of Array.from(this.fontSelect.options))if(t.value.toLowerCase()===e){this.fontSelect.value=t.value;break}}if(this.colorInput){const e=YS(M.color);e&&this.colorInput.value.toLowerCase()!==e.toLowerCase()&&(this.colorInput.value=e),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const e=getComputedStyle(i).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=YS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=this.editorEl.cloneNode(!0);if(this.noStyles)t.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),M=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;e.nextNode()&&i.nextNode();){const t=e.currentNode,n=i.currentNode,o=window.getComputedStyle(t),r=M.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ce({type:String,attribute:!0,reflect:!0})],FS.prototype,"value",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],FS.prototype,"noStyles",void 0),e([ce({type:Boolean,attribute:"singlelineeditor",reflect:!0})],FS.prototype,"singleLineEditor",void 0),e([ce({type:String})],FS.prototype,"placeholder",void 0),e([ce({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),i={};for(const e of Object.keys(t)){const M=t[e];Array.isArray(M)&&(i[e]=M.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return i}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],FS.prototype,"mentions",void 0),e([De()],FS.prototype,"content",void 0),FS=e([Ne("nile-rich-text-editor")],FS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.4.0"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const HS=r`
14845
14861
  :host {
14846
14862
 
14847
14863
  top: 0;
@@ -15389,17 +15405,9 @@ background: var(--nile-colors-neutral-400);
15389
15405
  border: none;
15390
15406
  }
15391
15407
  :host([collapsed][type='avatar']) .footer-item {
15392
- padding: 3px;
15393
- overflow: visible;
15394
- width: var(--ng-height-46px);
15395
-
15396
- }
15408
+ padding: 8px;
15397
15409
 
15398
- :host([collapsed][type='avatar']) ::slotted([slot='text']),
15399
- :host([collapsed][type='avatar']) ::slotted([slot='action']) {
15400
- display: none;
15401
15410
  }
15402
-
15403
15411
  :host([collapsed]) .footer-item{
15404
15412
  height: 38px;
15405
15413
  width: 38px;
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-calendar.css.cjs.js","lit/directives/class-map.js","../internal/watch.cjs.js","../internal/nile-element.cjs.js","./nile-calendar.enum.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,n,a,l,r,h,o,d,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_templateObject14,_templateObject15,_templateObject16,_templateObject17,_templateObject18,_templateObject19,_templateObject20,_templateObject21,_templateObject22,_templateObject23,_templateObject24,_templateObject25,c;function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;e=_lit.nothing;},function(_litDecoratorsJs){s=_litDecoratorsJs.property;n=_litDecoratorsJs.state;a=_litDecoratorsJs.customElement;},function(_nileCalendarCssCjsJs){l=_nileCalendarCssCjsJs.s;},function(_litDirectivesClassMapJs){r=_litDirectivesClassMapJs.classMap;},function(_internalWatchCjsJs){h=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){o=_internalNileElementCjsJs.N;},function(_nileCalendarEnumCjsJs){d=_nileCalendarEnumCjsJs.C;}],execute:function execute(){_export("N",c=/*#__PURE__*/function(_o){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,arguments),_this.valueAttribute=null,_this.allowedDates=JSON.stringify({}),_this.range=!1,_this.hideTypes=!1,_this.doubleClickUnselect=!1,_this.allowClear=!1,_this.type="absolute",_this.hideDurationFields=[],_this.showManualInputs=!1,_this.showMonthDropdown=!1,_this.showYearDropdown=!1,_this.dateFormat="MM/DD/YYYY",_this.startDate=null,_this.endDate=null,_this.isSelectingStart=!0,_this.hideInput=!1,_this.currentMonth=new Date().getMonth(),_this.currentYear=new Date().getFullYear(),_this.allowedDatesLocal=null;return _this;}_inherits(c,_o);return _createClass(c,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(c,"connectedCallback",this,3)([]),this.initializeValue(),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(c,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}},{key:"updated",value:function updated(t){if(_superPropGet(c,"updated",this,3)([t]),t.has("valueAttribute")){this.valueAttribute||(this.value=null,this.startDate=null,this.endDate=null,this.isSelectingStart=!0);var _t=new Date(this.valueAttribute||"");if(!isNaN(_t.getTime())){var _i=_t.getTimezoneOffset();this.value=new Date(_t.getTime()-60*_i*1e3),this.currentMonth=this.value.getMonth(),this.currentYear=this.value.getFullYear();}this.initializeValue();}}},{key:"monthNames",get:function get(){return Array.from({length:12},function(t,i){return new Date(0,i).toLocaleString("default",{month:"long"});});}},{key:"yearOptions",get:function get(){var _this$startYear,_this$endYear;var t=(_this$startYear=this.startYear)!==null&&_this$startYear!==void 0?_this$startYear:2e3,i=(_this$endYear=this.endYear)!==null&&_this$endYear!==void 0?_this$endYear:2050;return t>i?[]:Array.from({length:i-t+1},function(i,e){return t+e;});}},{key:"onMonthSelected",value:function onMonthSelected(t){this.currentMonth=t,this.emit("nile-month-change",{month:t});}},{key:"onYearSelected",value:function onYearSelected(t){this.currentYear=t,this.emit("nile-year-change",{year:t});}},{key:"checkValidAllowedDate",value:function checkValidAllowedDate(){var t;try{t=JSON.parse(this.allowedDates);}catch(i){t=null;}if(!t||0==Object.keys(t).length)return void(this.allowedDatesLocal=null);this.hideInput=!0;this.getUTCDate(t.startDate)>this.getUTCDate(t.endDate)?console.error("StartDate must be greater than endDate"):this.allowedDatesLocal=t;}},{key:"isPrevDisabled",value:function isPrevDisabled(){return 0===this.currentMonth&&void 0!==this.startYear&&this.currentYear<=this.startYear;}},{key:"isNextDisabled",value:function isNextDisabled(){return 11===this.currentMonth&&void 0!==this.endYear&&this.currentYear>=this.endYear;}},{key:"formatDate",value:function formatDate(t){if(!t)return"";var i=t.getFullYear(),e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");var n=this.dateFormat;return n=n.replace(/YYYY/g,String(i)),n=n.replace(/MM/g,e),n=n.replace(/DD/g,s),n=n.replace(/YY/g,String(i).slice(-2)),n;}},{key:"parseDate",value:function parseDate(t,i){if(!t||!this.dateFormat)return null;var e=this.dateFormat.replace(/YYYY/,"(?<year>\\d{4})").replace(/YY/,"(?<year>\\d{2})").replace(/MM/,"(?<month>\\d{1,2})").replace(/DD/,"(?<day>\\d{1,2})"),s=new RegExp("^".concat(e,"$")),n=t.match(s);if(!n||!n.groups)return null;var a=2===n.groups.year.length?Number("20".concat(n.groups.year)):Number(n.groups.year),l=Number(n.groups.month)-1,r=Number(n.groups.day),h=new Date(i||new Date());return h.setFullYear(a,l,r),isNaN(h.getTime())?null:h;}},{key:"handleStartDateInput",value:function handleStartDateInput(t){t.stopPropagation();var i=this.parseDate(t.detail.value,this.startDate);i&&(this.startDate=i,this.currentMonth=i.getMonth(),this.currentYear=i.getFullYear(),this.requestUpdate());}},{key:"handleEndDateInput",value:function handleEndDateInput(t){t.stopPropagation();var i=this.parseDate(t.detail.value,this.endDate);i&&(this.endDate=i,this.currentMonth=i.getMonth(),this.currentYear=i.getFullYear(),this.requestUpdate());}},{key:"render",value:function render(){var _this2=this;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n class=","\n part=\"calendar-container\"\n >\n <div class=",">\n <div class=\"calendar-switcher\" part=\"calendar-switcher\">\n <nile-tab-group centered @nile-tab-show=\"","\" value=\"","\">\n <nile-tab slot=\"nav\" panel=\"absolute\" tabindex=\"0\">Absolute</nile-tab>\n <nile-tab slot=\"nav\" panel=\"relative\" tabindex=\"0\">Relative</nile-tab>\n </nile-tab-group>\n </div>\n </div>\n \n ","\n ","\n\n ","\n </div>\n "])),r({base:!0,base__range:this.range}),r({"calendar-config":!0,hidden:!this.range||this.range&&this.hideTypes}),this.onTypeChange,this.type,"relative"==this.type?this.renderRelativeCalendar():"","absolute"==this.type?this.renderAbsoluteCalendar():"",this.range?i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <div class=\"button-container\" part=\"button-container\">\n ","\n <nile-button \n class=\"apply-button\" \n ?disabled=\"","\" \n @click=\"","\"\n @keydown=\"","\"\n > Apply</nile-button>\n </div>\n "])),this.allowClear?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-button \n class=\"clear-button\"\n variant=\"secondary\"\n role=\"button\"\n ?disabled=\"","\"\n @keydown=\"","\"\n @click=\"","\"\n\n > Reset</nile-button>"])),!this.startDate||!this.endDate,function(t){"Enter"!==t.key&&" "!==t.key||_this2.clearDate();},this.clearDate):e,!this.startDate||!this.endDate,this.confimRange,function(t){"Enter"!==t.key&&" "!==t.key||_this2.confimRange();}):"");}},{key:"renderAbsoluteCalendar",value:function renderAbsoluteCalendar(){return i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <div class=\"calendar-wrapper\" part=\"calendar-wrapper\">\n <div class=\"calendar-container\" >\n ","\n </div>\n </div>\n ","\n "])),this.renderMonth(this.currentYear,this.currentMonth,this.getDaysArray(this.currentYear,this.currentMonth)),this.range?i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <div class=\"calender-input ","\" >\n <div class=\"from\">\n <div class=\"from-date\">\n <nile-input\n label=\"From\"\n class=\"manual-input date-input\"\n placeholder=\"","\"\n value=\"","\"\n @nile-change=\"","\"\n ></nile-input>\n </div>\n\n <div class=\"from-time\">\n <nile-input\n class=\"manual-input time-input\"\n placeholder=\"HH:MM:SS\"\n value=\"","\"\n @nile-change=\"","\"\n ></nile-input>\n </div>\n</div>\n\n\n <div class=\"from\">\n <div class=\"from-date\">\n <nile-input\n label=\"To\"\n class=\"manual-input date-input\"\n placeholder=\"","\"\n value=\"","\"\n @nile-change=\"","\"\n ></nile-input>\n </div>\n <div class=\"from-time\">\n <nile-input\n class=\"manual-input time-input\"\n placeholder=\"HH:MM:SS\"\n value=\"","\"\n @nile-change=\"","\"\n ></nile-input>\n </div>\n </div>\n </div>\n "])),this.showManualInputs?"":"hidden",this.dateFormat,this.formatDate(this.startDate),this.handleStartDateInput,this.formatTime(this.startDate),this.handleStartTimeInput,this.dateFormat,this.formatDate(this.endDate),this.handleEndDateInput,this.formatTime(this.endDate),this.handleEndTimeInput):"");}},{key:"renderRelativeCalendar",value:function renderRelativeCalendar(){var _this$hideDurationFie,_this$hideDurationFie2,_this$hideDurationFie3,_this$hideDurationFie4,_this$hideDurationFie5,_this$hideDurationFie6,_this$hideDurationFie7,_this$hideDurationFie8,_this$hideDurationFie9,_this$hideDurationFie10;return i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <div class=\"units-wrapper\">\n <div class=\"unit-container\">\n \n ","\n \n ","\n \n ","\n \n ","\n \n ","\n </div>\n </div>\n \n ","\n "])),(_this$hideDurationFie=this.hideDurationFields)!==null&&_this$hideDurationFie!==void 0&&_this$hideDurationFie.includes("minutes")?"":i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Minutes</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("minutes",[1,5,15,30,45])),(_this$hideDurationFie2=this.hideDurationFields)!==null&&_this$hideDurationFie2!==void 0&&_this$hideDurationFie2.includes("hours")?"":i(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Hours</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("hours",[1,2,3,6,8,12])),(_this$hideDurationFie3=this.hideDurationFields)!==null&&_this$hideDurationFie3!==void 0&&_this$hideDurationFie3.includes("days")?"":i(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Days</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("days",[1,2,3,4,5,6])),(_this$hideDurationFie4=this.hideDurationFields)!==null&&_this$hideDurationFie4!==void 0&&_this$hideDurationFie4.includes("weeks")?"":i(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Weeks</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("weeks",[1,2,4,6])),(_this$hideDurationFie5=this.hideDurationFields)!==null&&_this$hideDurationFie5!==void 0&&_this$hideDurationFie5.includes("months")?"":i(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Months</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("months",[3,6,12,15])),this.range?i(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n <div>\n <div class=\"unit-input-container\">\n <nile-input \n class=\"manual-input duration-input\" \n label=\"Duration\"\n inputmode=\"numeric\"\n type=\"number\"\n value=\"","\" \n @nile-change=\"","\"\n placeholder=\"Enter Value\"\n ></nile-input>\n \n <nile-select \n class=\"manual-input time-input\" \n label=\"Unit of time\" \n value=\"","\"\n @nile-change=\"","\"\n >\n <nile-option value=\"minutes\" class=\"","\">Minutes</nile-option>\n <nile-option value=\"hours\" class=\"","\">Hours</nile-option>\n <nile-option value=\"days\" class=\"","\">Days</nile-option>\n <nile-option value=\"weeks\" class=\"","\">Weeks</nile-option>\n <nile-option value=\"months\" class=\"","\">Months</nile-option>\n </nile-select>\n </div>\n </div>\n "])),this.selectedValue,this.handleDurationChange,this.selectedUnit,this.handleUnitChange,(_this$hideDurationFie6=this.hideDurationFields)!==null&&_this$hideDurationFie6!==void 0&&_this$hideDurationFie6.includes("minutes")?"hidden":"",(_this$hideDurationFie7=this.hideDurationFields)!==null&&_this$hideDurationFie7!==void 0&&_this$hideDurationFie7.includes("hours")?"hidden":"",(_this$hideDurationFie8=this.hideDurationFields)!==null&&_this$hideDurationFie8!==void 0&&_this$hideDurationFie8.includes("days")?"hidden":"",(_this$hideDurationFie9=this.hideDurationFields)!==null&&_this$hideDurationFie9!==void 0&&_this$hideDurationFie9.includes("weeks")?"hidden":"",(_this$hideDurationFie10=this.hideDurationFields)!==null&&_this$hideDurationFie10!==void 0&&_this$hideDurationFie10.includes("months")?"hidden":""):"");}},{key:"renderTimeValues",value:function renderTimeValues(t,e){var _this3=this;return e.map(function(e){return i(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n <div\n class=\"duration__value ","\"\n @click=","\n @keydown=\"","\"\n >","\n </div>"])),_this3.selectedUnit===t&&_this3.selectedValue===e?"duration__value--selected":"",function(i){return _this3.handleTimeValueClick(t,e,i);},function(i){"Enter"!==i.key&&" "!==i.key||_this3.handleTimeValueClick(t,e,i);},e);});}},{key:"renderMonth",value:function renderMonth(t,s,n){var _this4=this;var a=new Date(t,s,1).getDay(),l=new Date(t,s+1,0).getDay(),h=this.getDaysArray(0===s?t-1:t,0===s?11:s-1),o=this.getDaysArray(11===s?t+1:t,11===s?0:s+1),d=h.slice(h.length-a),_c=o.slice(0,6-l),u=[].concat(_toConsumableArray(d),_toConsumableArray(n),_toConsumableArray(_c)),v=function v(t,i,e,s){if(!s)return"";if(!_this4.range&&_this4.value){if(t===_this4.value.getDate()&&i===_this4.value.getMonth()&&e===_this4.value.getFullYear())return"selected-date";}var n=_this4.startDate&&t===_this4.startDate.getDate()&&i===_this4.startDate.getMonth()&&e===_this4.startDate.getFullYear(),a=_this4.endDate&&t===_this4.endDate.getDate()&&i===_this4.endDate.getMonth()&&e===_this4.endDate.getFullYear();return n?"range-start":a?"range-end":"";},p=function p(t,i,e,s){if(!s)return!1;if(_this4.startDate&&_this4.endDate){var _s=new Date(e,i,t);return _s>=_this4.startDate&&_s<=_this4.endDate;}return!1;};return i(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n <div class=\"calendar\">\n <div class=\"calendar-header\">\n <nile-icon\n class=\"calendar-header__month-navigation\"\n name=\"var(--nile-icon-arrow-left, var(--ng-icon-chevron-left))\"\n method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"\n color=\"black\"\n role=\"button\"\n tabindex=\"","\"\n @keydown=\"","\"\n @click=\"","\"\n >\n </nile-icon>\n <div class=\"calendar-header__center\">\n\n","\n</div>\n\n <nile-icon\n class=\"calendar-header__month-navigation\"\n name=\"var(--nile-icon-arrow-right, var(--ng-icon-chevron-right))\"\n method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"\n color=\"black\"\n role=\"button\"\n tabindex=\"","\"\n @keydown=\"","\"\n @click=\"","\"\n >\n </nile-icon>\n </div>\n \n <div class=\"days_container\">\n ","\n ","\n </div>\n </div>\n "])),this.isPrevDisabled()?"-1":"0",function(t){"Enter"!==t.key&&" "!==t.key||_this4.prevMonth();},this.prevMonth,this.showMonthDropdown||this.showYearDropdown?i(_templateObject15||(_templateObject15=_taggedTemplateLiteral(["\n ","\n ","\n"])),this.showMonthDropdown?i(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n <nile-dropdown class=\"month-dropdown\">\n <span\n slot=\"trigger\"\n class=\"calendar-header__trigger month-trigger\"\n role=\"button\"\n part=\"trigger\"\n >\n ","\n <nile-icon name=\"arrowdropdown\" color=\"black\" class=\"calendar-header__caret\"></nile-icon>\n </span>\n <nile-menu>\n <div class=\"month-scroll-wrapper\">\n ","\n </div>\n </nile-menu>\n </nile-dropdown>\n "])),new Date(t,s).toLocaleString("default",{month:"long"}),this.monthNames.map(function(t,e){return i(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n <nile-menu-item\n class=\"month-menu-item\"\n ?selected=\"","\"\n @click=\"","\"\n >\n ","\n </nile-menu-item>\n "])),e===s,function(){return _this4.onMonthSelected(e);},t);})):i(_templateObject18||(_templateObject18=_taggedTemplateLiteral(["\n <span\n >","</span\n >\n "])),new Date(t,s).toLocaleString("default",{month:"long"})),this.showYearDropdown?i(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n <nile-dropdown class=\"year-dropdown\">\n <span\n slot=\"trigger\"\n class=\"calendar-header__trigger\"\n role=\"button\"\n part=\"trigger\"\n >\n ","\n <nile-icon name=\"arrowdropdown\" color=\"black\" class=\"calendar-header__caret\"></nile-icon>\n </span>\n <nile-menu>\n <div class=\"year-scroll-wrapper\">\n ","\n </div>\n </nile-menu>\n </nile-dropdown>\n "])),t,this.yearOptions.map(function(e){return i(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n <nile-menu-item\n class=\"year-menu-item\"\n ?selected=\"","\"\n @click=\"","\"\n >\n ","\n </nile-menu-item>\n "])),e===t,function(){return _this4.onYearSelected(e);},e);})):i(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n <span>","</span>\n "])),t)):i(_templateObject22||(_templateObject22=_taggedTemplateLiteral(["\n <span\n >","\n ","</span\n >\n"])),new Date(t,s).toLocaleString("default",{month:"long"}),t),this.isNextDisabled()?"-1":"0",function(t){"Enter"!==t.key&&" "!==t.key||_this4.nextMonth();},this.nextMonth,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(function(t){return i(_templateObject23||(_templateObject23=_taggedTemplateLiteral(["<div class=\"day_name\">","</div>"])),t);}),u.map(function(a,l){var h=l>=d.length&&l<d.length+n.length,o=v(a,s,t,h),_c2={day_date:!0,"not-allowed":!_this4.isAllowedDate(a,s,t),"in-range":p(a,s,t,h),filler:!h};return o&&(_c2[o]=!0),i(_templateObject24||(_templateObject24=_taggedTemplateLiteral([" \n <div\n part=\"calendar-day-","\"\n class=","\n tabindex=\"","\"\n @keydown=\"","\"\n @click=\"","\"\n >\n <span style=\"position:relative;\">\n ","\n ","\n </span>\n </div>"])),a,r(_c2),h&&_this4.isAllowedDate(a,s,t)?"0":"-1",function(i){"Enter"!==i.key&&" "!==i.key||_this4.selectDate(a,s,t);},function(){h&&_this4.selectDate(a,s,t);},a,function(t,i,e){var s=new Date();return t===s.getDate()&&i+1===s.getMonth()+1&&e===s.getFullYear();}(a,s,t)&&h?i(_templateObject25||(_templateObject25=_taggedTemplateLiteral(["<div class=\"current__date__dot\" part=\"current-date-dot\"></div>"]))):e);}));}},{key:"isAllowedDate",value:function isAllowedDate(t,i,e){if(!this.allowedDatesLocal)return!0;var s=new Date(Date.UTC(e,i,t)),n=this.getUTCDate(this.allowedDatesLocal.startDate),a=this.getUTCDate(this.allowedDatesLocal.endDate);a.setUTCHours(23,59,59,999);return s>=n&&s<=a;}},{key:"clearDate",value:function clearDate(t){(t!==null&&t!==void 0?t:this.range?"relative"===this.type?d.Relative:d.Range:d.Single)===d.Single?this.value=null:(this.valueAttribute="",this.startDate=null,this.endDate=null,this.selectedUnit=void 0,this.selectedValue=void 0),this.requestUpdate(),this.emit("nile-clear");}},{key:"selectDate",value:function selectDate(t,i,e){var s=new Date(e,i,t);if(this.range){if(this.startDate&&this.endDate&&(this.startDate=null,this.endDate=null),this.isSelectingStart)this.startDate=s,this.endDate&&s>this.endDate&&(this.endDate=null),this.isSelectingStart=!1;else if(this.isSelectingStart=!0,this.startDate&&s<this.startDate)this.startDate=s,this.endDate=null,this.isSelectingStart=!1;else{var _t2=s;_t2.setHours(23,59,59,999),this.endDate=_t2;}}else{if(String(this.value)==String(s)&&this.doubleClickUnselect)return void this.clearDate();this.value=s,this.emitChangedData({value:this.value});}}},{key:"initializeValue",value:function initializeValue(){if(this.range)try{var _t3=JSON.parse(this.valueAttribute||"");this.startDate=new Date(_t3.startDate),this.endDate=new Date(_t3.endDate),this.startDate=new Date(this.startDate.getTime()),this.endDate=new Date(this.endDate.getTime()),this.value=null;}catch(t){}else if(this.valueAttribute){var _t4=new Date(this.valueAttribute);_t4=new Date(_t4.getTime()-6e4*_t4.getTimezoneOffset()),isNaN(_t4.getTime())||(this.value=_t4,this.currentMonth=this.value.getMonth(),this.currentYear=this.value.getFullYear());}}},{key:"handleDurationChange",value:function handleDurationChange(t){t.stopPropagation(),t.detail.value=t.detail.value.replace(/e/gi,"");var i=Number(t.detail.value);i&&(this.selectedValue=i,this.selectedUnit&&this.selectedValue&&this.handleTimeValueClick(this.selectedUnit,this.selectedValue,t));}},{key:"handleUnitChange",value:function handleUnitChange(t){t.stopPropagation(),this.selectedUnit=t.detail.value,this.selectedUnit&&this.selectedValue&&this.handleTimeValueClick(this.selectedUnit,this.selectedValue,t);}},{key:"handleTimeValueClick",value:function handleTimeValueClick(t,i,e){this.createRelativePeriod(t,i),this.selectedUnit=t,this.selectedValue=i;}},{key:"createRelativePeriod",value:function createRelativePeriod(t,i){var e=new Date(),s=new Date();switch(t){case"minutes":s.setMinutes(s.getMinutes()-i);break;case"hours":s.setHours(s.getHours()-i);break;case"days":s.setDate(s.getDate()-i);break;case"weeks":s.setDate(s.getDate()-7*i);break;case"months":s.setMonth(s.getMonth()-i);}return this.startDate=new Date(s.getTime()),this.endDate=new Date(e.getTime()),{startDate:this.startDate,endDate:this.endDate};}},{key:"handleStartTimeInput",value:function handleStartTimeInput(t){if(t.stopPropagation(),!this.startDate)return void(this.startDate=null);var i=this.parseTime(t.detail.value,this.startDate);i?this.startDate=i:this.startDate.setHours(0,0,0),this.requestUpdate();}},{key:"handleEndTimeInput",value:function handleEndTimeInput(t){if(t.stopPropagation(),!this.endDate)return void(this.endDate=null);var i=this.parseTime(t.detail.value,this.endDate);i?this.endDate=i:this.endDate.setHours(0,0,0),this.requestUpdate();}},{key:"parseTime",value:function parseTime(t,i){if(!this.isValidTimeInput(t))return null;var _t$split$map=t.split(":").map(Number),_t$split$map2=_slicedToArray(_t$split$map,3),e=_t$split$map2[0],s=_t$split$map2[1],n=_t$split$map2[2],a=new Date(i.getTime());return a.setHours(e,s,n),a;}},{key:"isValidTimeInput",value:function isValidTimeInput(t){return /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/.test(t);}},{key:"formatTime",value:function formatTime(t){if(!t)return"";return"".concat(String(t.getHours()).padStart(2,"0"),":").concat(String(t.getMinutes()).padStart(2,"0"),":").concat(String(t.getSeconds()).padStart(2,"0"));}},{key:"nextMonth",value:function nextMonth(){if(11===this.currentMonth){var _t5=this.currentYear+1;if(void 0!==this.endYear&&_t5>this.endYear)return;this.currentMonth=0,this.currentYear=_t5;}else this.currentMonth++;}},{key:"prevMonth",value:function prevMonth(){if(0===this.currentMonth){var _t6=this.currentYear-1;if(void 0!==this.startYear&&_t6<this.startYear)return;this.currentMonth=11,this.currentYear=_t6;}else this.currentMonth--;}},{key:"confimRange",value:function confimRange(){this.startDate&&this.endDate&&this.emitChangedData({startDate:this.startDate,endDate:this.endDate});}},{key:"onTypeChange",value:function onTypeChange(t){this.type=t.detail.value,this.emit("nile-type-change",{value:this.type});}},{key:"getUTCDate",value:function getUTCDate(t){return new Date(Date.UTC(t.slice(0,4),t.slice(5,7)-1,t.slice(8,10)));}},{key:"emitChangedData",value:function emitChangedData(t){this.emit("nile-changed",t),this.emit("nile-change",t);}},{key:"getDaysArray",value:function getDaysArray(t,i){var e=new Date(t,i+1,0).getDate();return Array.from({length:e},function(t,i){return i+1;});}}],[{key:"styles",get:function get(){return[l];}}]);}(o));t([s({type:String,attribute:"value"})],c.prototype,"valueAttribute",void 0),t([s({type:String,attribute:!0,reflect:!0})],c.prototype,"allowedDates",void 0),t([s({type:Boolean,reflect:!0})],c.prototype,"range",void 0),t([s({type:Boolean,attribute:!0,reflect:!0})],c.prototype,"hideTypes",void 0),t([s({type:Boolean,reflect:!0})],c.prototype,"doubleClickUnselect",void 0),t([s({type:Boolean,reflect:!0})],c.prototype,"allowClear",void 0),t([s({type:String,reflect:!0})],c.prototype,"type",void 0),t([s({type:String})],c.prototype,"selectedUnit",void 0),t([s({type:Number})],c.prototype,"selectedValue",void 0),t([s({type:Array,attribute:"hide-duration-fields"})],c.prototype,"hideDurationFields",void 0),t([s({type:Boolean})],c.prototype,"showManualInputs",void 0),t([s({type:Number,attribute:!0,reflect:!0})],c.prototype,"startYear",void 0),t([s({type:Number,attribute:!0,reflect:!0})],c.prototype,"endYear",void 0),t([s({type:Boolean,attribute:!0,reflect:!0})],c.prototype,"showMonthDropdown",void 0),t([s({type:Boolean,attribute:!0,reflect:!0})],c.prototype,"showYearDropdown",void 0),t([s({type:String,reflect:!0,attribute:!0})],c.prototype,"dateFormat",void 0),t([n()],c.prototype,"startDate",void 0),t([n()],c.prototype,"endDate",void 0),t([n()],c.prototype,"isSelectingStart",void 0),t([n()],c.prototype,"hideInput",void 0),t([n()],c.prototype,"value",void 0),t([n()],c.prototype,"currentMonth",void 0),t([n()],c.prototype,"currentYear",void 0),t([n()],c.prototype,"allowedDatesLocal",void 0),t([h("allowedDates")],c.prototype,"checkValidAllowedDate",null),_export("N",c=t([a("nile-calendar")],c));}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-calendar.css.cjs.js","lit/directives/class-map.js","../internal/watch.cjs.js","../internal/nile-element.cjs.js","./nile-calendar.enum.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,n,a,l,r,h,o,d,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_templateObject14,_templateObject15,_templateObject16,_templateObject17,_templateObject18,_templateObject19,_templateObject20,_templateObject21,_templateObject22,_templateObject23,_templateObject24,_templateObject25,c;function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;e=_lit.nothing;},function(_litDecoratorsJs){s=_litDecoratorsJs.property;n=_litDecoratorsJs.state;a=_litDecoratorsJs.customElement;},function(_nileCalendarCssCjsJs){l=_nileCalendarCssCjsJs.s;},function(_litDirectivesClassMapJs){r=_litDirectivesClassMapJs.classMap;},function(_internalWatchCjsJs){h=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){o=_internalNileElementCjsJs.N;},function(_nileCalendarEnumCjsJs){d=_nileCalendarEnumCjsJs.C;}],execute:function execute(){_export("N",c=/*#__PURE__*/function(_o){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,arguments),_this.valueAttribute=null,_this.allowedDates=JSON.stringify({}),_this.range=!1,_this.hideTypes=!1,_this.doubleClickUnselect=!1,_this.allowClear=!1,_this.type="absolute",_this.hideDurationFields=[],_this.showManualInputs=!1,_this.showMonthDropdown=!1,_this.showYearDropdown=!1,_this.dateFormat="MM/DD/YYYY",_this.startDate=null,_this.endDate=null,_this.isSelectingStart=!0,_this.hideInput=!1,_this.currentMonth=new Date().getMonth(),_this.currentYear=new Date().getFullYear(),_this.allowedDatesLocal=null;return _this;}_inherits(c,_o);return _createClass(c,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(c,"connectedCallback",this,3)([]),this.initializeValue(),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(c,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}},{key:"updated",value:function updated(t){if(_superPropGet(c,"updated",this,3)([t]),t.has("valueAttribute")){this.valueAttribute||(this.value=null,this.startDate=null,this.endDate=null,this.isSelectingStart=!0);var _t=new Date(this.valueAttribute||"");if(!isNaN(_t.getTime())){var _i=_t.getTimezoneOffset();this.value=new Date(_t.getTime()-60*_i*1e3),this.currentMonth=this.value.getMonth(),this.currentYear=this.value.getFullYear();}this.initializeValue();}}},{key:"monthNames",get:function get(){return Array.from({length:12},function(t,i){return new Date(0,i).toLocaleString("default",{month:"long"});});}},{key:"yearOptions",get:function get(){var _this$startYear,_this$endYear;var t=(_this$startYear=this.startYear)!==null&&_this$startYear!==void 0?_this$startYear:2e3,i=(_this$endYear=this.endYear)!==null&&_this$endYear!==void 0?_this$endYear:2050;return t>i?[]:Array.from({length:i-t+1},function(i,e){return t+e;});}},{key:"onMonthSelected",value:function onMonthSelected(t){this.currentMonth=t,this.emit("nile-month-change",{month:t});}},{key:"onYearSelected",value:function onYearSelected(t){this.currentYear=t,this.emit("nile-year-change",{year:t});}},{key:"checkValidAllowedDate",value:function checkValidAllowedDate(){var t;try{t=JSON.parse(this.allowedDates);}catch(i){t=null;}if(!t||0==Object.keys(t).length)return void(this.allowedDatesLocal=null);this.hideInput=!0;this.getUTCDate(t.startDate)>this.getUTCDate(t.endDate)?console.error("StartDate must be greater than endDate"):this.allowedDatesLocal=t;}},{key:"isPrevDisabled",value:function isPrevDisabled(){return 0===this.currentMonth&&void 0!==this.startYear&&this.currentYear<=this.startYear;}},{key:"isNextDisabled",value:function isNextDisabled(){return 11===this.currentMonth&&void 0!==this.endYear&&this.currentYear>=this.endYear;}},{key:"formatDate",value:function formatDate(t){if(!t)return"";var i=t.getFullYear(),e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");var n=this.dateFormat;return n=n.replace(/YYYY/g,String(i)),n=n.replace(/MM/g,e),n=n.replace(/DD/g,s),n=n.replace(/YY/g,String(i).slice(-2)),n;}},{key:"parseDate",value:function parseDate(t,i){if(!t||!this.dateFormat)return null;var e=this.dateFormat.replace(/YYYY/,"(?<year>\\d{4})").replace(/YY/,"(?<year>\\d{2})").replace(/MM/,"(?<month>\\d{1,2})").replace(/DD/,"(?<day>\\d{1,2})"),s=new RegExp("^".concat(e,"$")),n=t.match(s);if(!n||!n.groups)return null;var a=2===n.groups.year.length?Number("20".concat(n.groups.year)):Number(n.groups.year),l=Number(n.groups.month)-1,r=Number(n.groups.day),h=new Date(a,l,r);return i?h.setHours(i.getHours(),i.getMinutes(),i.getSeconds()):h.setHours(0,0,0),h;}},{key:"handleStartDateInput",value:function handleStartDateInput(t){t.stopPropagation();var i=this.parseDate(t.detail.value,this.startDate);i&&(i.setHours(0,0,0),this.startDate=i,this.currentMonth=i.getMonth(),this.currentYear=i.getFullYear(),this.requestUpdate());}},{key:"handleEndDateInput",value:function handleEndDateInput(t){t.stopPropagation();var i=this.parseDate(t.detail.value,this.endDate);i&&(i.setHours(23,59,59),this.endDate=i,this.currentMonth=i.getMonth(),this.currentYear=i.getFullYear(),this.requestUpdate());}},{key:"render",value:function render(){var _this2=this;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n class=","\n part=\"calendar-container\"\n >\n <div class=",">\n <div class=\"calendar-switcher\" part=\"calendar-switcher\">\n <nile-tab-group centered @nile-tab-show=\"","\" value=\"","\">\n <nile-tab slot=\"nav\" panel=\"absolute\" tabindex=\"0\">Absolute</nile-tab>\n <nile-tab slot=\"nav\" panel=\"relative\" tabindex=\"0\">Relative</nile-tab>\n </nile-tab-group>\n </div>\n </div>\n \n ","\n ","\n\n ","\n </div>\n "])),r({base:!0,base__range:this.range}),r({"calendar-config":!0,hidden:!this.range||this.range&&this.hideTypes}),this.onTypeChange,this.type,"relative"==this.type?this.renderRelativeCalendar():"","absolute"==this.type?this.renderAbsoluteCalendar():"",this.range?i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <div class=\"button-container\" part=\"button-container\">\n ","\n <nile-button \n class=\"apply-button\" \n ?disabled=\"","\" \n @click=\"","\"\n @keydown=\"","\"\n > Apply</nile-button>\n </div>\n "])),this.allowClear?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-button \n class=\"clear-button\"\n variant=\"secondary\"\n role=\"button\"\n ?disabled=\"","\"\n @keydown=\"","\"\n @click=\"","\"\n\n > Reset</nile-button>"])),!this.startDate||!this.endDate,function(t){"Enter"!==t.key&&" "!==t.key||_this2.clearDate();},this.clearDate):e,!this.startDate||!this.endDate,this.confimRange,function(t){"Enter"!==t.key&&" "!==t.key||_this2.confimRange();}):"");}},{key:"renderAbsoluteCalendar",value:function renderAbsoluteCalendar(){return i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <div class=\"calendar-wrapper\" part=\"calendar-wrapper\">\n <div class=\"calendar-container\" >\n ","\n </div>\n </div>\n ","\n "])),this.renderMonth(this.currentYear,this.currentMonth,this.getDaysArray(this.currentYear,this.currentMonth)),this.range?i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <div class=\"calender-input ","\" >\n <div class=\"from\">\n <div class=\"from-date\">\n <nile-input\n label=\"From\"\n class=\"manual-input date-input\"\n placeholder=\"","\"\n value=\"","\"\n @nile-change=\"","\"\n ></nile-input>\n </div>\n\n <div class=\"from-time\">\n <nile-input\n class=\"manual-input time-input\"\n placeholder=\"HH:MM:SS\"\n value=\"","\"\n @nile-change=\"","\"\n ></nile-input>\n </div>\n</div>\n\n\n <div class=\"from\">\n <div class=\"from-date\">\n <nile-input\n label=\"To\"\n class=\"manual-input date-input\"\n placeholder=\"","\"\n value=\"","\"\n @nile-change=\"","\"\n ></nile-input>\n </div>\n <div class=\"from-time\">\n <nile-input\n class=\"manual-input time-input\"\n placeholder=\"HH:MM:SS\"\n value=\"","\"\n @nile-change=\"","\"\n ></nile-input>\n </div>\n </div>\n </div>\n "])),this.showManualInputs?"":"hidden",this.dateFormat,this.formatDate(this.startDate),this.handleStartDateInput,this.formatTime(this.startDate),this.handleStartTimeInput,this.dateFormat,this.formatDate(this.endDate),this.handleEndDateInput,this.formatTime(this.endDate),this.handleEndTimeInput):"");}},{key:"renderRelativeCalendar",value:function renderRelativeCalendar(){var _this$hideDurationFie,_this$hideDurationFie2,_this$hideDurationFie3,_this$hideDurationFie4,_this$hideDurationFie5,_this$hideDurationFie6,_this$hideDurationFie7,_this$hideDurationFie8,_this$hideDurationFie9,_this$hideDurationFie10;return i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <div class=\"units-wrapper\">\n <div class=\"unit-container\">\n \n ","\n \n ","\n \n ","\n \n ","\n \n ","\n </div>\n </div>\n \n ","\n "])),(_this$hideDurationFie=this.hideDurationFields)!==null&&_this$hideDurationFie!==void 0&&_this$hideDurationFie.includes("minutes")?"":i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Minutes</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("minutes",[1,5,15,30,45])),(_this$hideDurationFie2=this.hideDurationFields)!==null&&_this$hideDurationFie2!==void 0&&_this$hideDurationFie2.includes("hours")?"":i(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Hours</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("hours",[1,2,3,6,8,12])),(_this$hideDurationFie3=this.hideDurationFields)!==null&&_this$hideDurationFie3!==void 0&&_this$hideDurationFie3.includes("days")?"":i(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Days</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("days",[1,2,3,4,5,6])),(_this$hideDurationFie4=this.hideDurationFields)!==null&&_this$hideDurationFie4!==void 0&&_this$hideDurationFie4.includes("weeks")?"":i(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Weeks</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("weeks",[1,2,4,6])),(_this$hideDurationFie5=this.hideDurationFields)!==null&&_this$hideDurationFie5!==void 0&&_this$hideDurationFie5.includes("months")?"":i(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n <div class=\"unit-group\">\n <div class=\"duration-name\">Months</div>\n <div class=\"duration-units\">\n ","\n </div>\n </div>\n "])),this.renderTimeValues("months",[3,6,12,15])),this.range?i(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n <div>\n <div class=\"unit-input-container\">\n <nile-input \n class=\"manual-input duration-input\" \n label=\"Duration\"\n inputmode=\"numeric\"\n type=\"number\"\n value=\"","\" \n @nile-change=\"","\"\n placeholder=\"Enter Value\"\n ></nile-input>\n \n <nile-select \n class=\"manual-input time-input\" \n label=\"Unit of time\" \n value=\"","\"\n @nile-change=\"","\"\n >\n <nile-option value=\"minutes\" class=\"","\">Minutes</nile-option>\n <nile-option value=\"hours\" class=\"","\">Hours</nile-option>\n <nile-option value=\"days\" class=\"","\">Days</nile-option>\n <nile-option value=\"weeks\" class=\"","\">Weeks</nile-option>\n <nile-option value=\"months\" class=\"","\">Months</nile-option>\n </nile-select>\n </div>\n </div>\n "])),this.selectedValue,this.handleDurationChange,this.selectedUnit,this.handleUnitChange,(_this$hideDurationFie6=this.hideDurationFields)!==null&&_this$hideDurationFie6!==void 0&&_this$hideDurationFie6.includes("minutes")?"hidden":"",(_this$hideDurationFie7=this.hideDurationFields)!==null&&_this$hideDurationFie7!==void 0&&_this$hideDurationFie7.includes("hours")?"hidden":"",(_this$hideDurationFie8=this.hideDurationFields)!==null&&_this$hideDurationFie8!==void 0&&_this$hideDurationFie8.includes("days")?"hidden":"",(_this$hideDurationFie9=this.hideDurationFields)!==null&&_this$hideDurationFie9!==void 0&&_this$hideDurationFie9.includes("weeks")?"hidden":"",(_this$hideDurationFie10=this.hideDurationFields)!==null&&_this$hideDurationFie10!==void 0&&_this$hideDurationFie10.includes("months")?"hidden":""):"");}},{key:"renderTimeValues",value:function renderTimeValues(t,e){var _this3=this;return e.map(function(e){return i(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n <div\n class=\"duration__value ","\"\n @click=","\n @keydown=\"","\"\n >","\n </div>"])),_this3.selectedUnit===t&&_this3.selectedValue===e?"duration__value--selected":"",function(i){return _this3.handleTimeValueClick(t,e,i);},function(i){"Enter"!==i.key&&" "!==i.key||_this3.handleTimeValueClick(t,e,i);},e);});}},{key:"renderMonth",value:function renderMonth(t,s,n){var _this4=this;var a=new Date(t,s,1).getDay(),l=new Date(t,s+1,0).getDay(),h=this.getDaysArray(0===s?t-1:t,0===s?11:s-1),o=this.getDaysArray(11===s?t+1:t,11===s?0:s+1),d=h.slice(h.length-a),_c=o.slice(0,6-l),u=[].concat(_toConsumableArray(d),_toConsumableArray(n),_toConsumableArray(_c)),v=function v(t,i,e,s){if(!s)return"";if(!_this4.range&&_this4.value){if(t===_this4.value.getDate()&&i===_this4.value.getMonth()&&e===_this4.value.getFullYear())return"selected-date";}var n=_this4.startDate&&t===_this4.startDate.getDate()&&i===_this4.startDate.getMonth()&&e===_this4.startDate.getFullYear(),a=_this4.endDate&&t===_this4.endDate.getDate()&&i===_this4.endDate.getMonth()&&e===_this4.endDate.getFullYear();return n?"range-start":a?"range-end":"";},p=function p(t,i,e,s){if(!s)return!1;if(_this4.startDate&&_this4.endDate){var _s=new Date(e,i,t);return _s>=_this4.startDate&&_s<=_this4.endDate;}return!1;};return i(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n <div class=\"calendar\">\n <div class=\"calendar-header\">\n <nile-icon\n class=\"calendar-header__month-navigation\"\n name=\"var(--nile-icon-arrow-left, var(--ng-icon-chevron-left))\"\n method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"\n color=\"black\"\n role=\"button\"\n tabindex=\"","\"\n @keydown=\"","\"\n @click=\"","\"\n >\n </nile-icon>\n <div class=\"calendar-header__center\">\n\n","\n</div>\n\n <nile-icon\n class=\"calendar-header__month-navigation\"\n name=\"var(--nile-icon-arrow-right, var(--ng-icon-chevron-right))\"\n method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"\n color=\"black\"\n role=\"button\"\n tabindex=\"","\"\n @keydown=\"","\"\n @click=\"","\"\n >\n </nile-icon>\n </div>\n \n <div class=\"days_container\">\n ","\n ","\n </div>\n </div>\n "])),this.isPrevDisabled()?"-1":"0",function(t){"Enter"!==t.key&&" "!==t.key||_this4.prevMonth();},this.prevMonth,this.showMonthDropdown||this.showYearDropdown?i(_templateObject15||(_templateObject15=_taggedTemplateLiteral(["\n ","\n ","\n"])),this.showMonthDropdown?i(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n <nile-dropdown class=\"month-dropdown\">\n <span\n slot=\"trigger\"\n class=\"calendar-header__trigger month-trigger\"\n role=\"button\"\n part=\"trigger\"\n >\n ","\n <nile-icon name=\"arrowdropdown\" color=\"black\" class=\"calendar-header__caret\"></nile-icon>\n </span>\n <nile-menu>\n <div class=\"month-scroll-wrapper\">\n ","\n </div>\n </nile-menu>\n </nile-dropdown>\n "])),new Date(t,s).toLocaleString("default",{month:"long"}),this.monthNames.map(function(t,e){return i(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n <nile-menu-item\n class=\"month-menu-item\"\n ?selected=\"","\"\n @click=\"","\"\n >\n ","\n </nile-menu-item>\n "])),e===s,function(){return _this4.onMonthSelected(e);},t);})):i(_templateObject18||(_templateObject18=_taggedTemplateLiteral(["\n <span\n >","</span\n >\n "])),new Date(t,s).toLocaleString("default",{month:"long"})),this.showYearDropdown?i(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n <nile-dropdown class=\"year-dropdown\">\n <span\n slot=\"trigger\"\n class=\"calendar-header__trigger\"\n role=\"button\"\n part=\"trigger\"\n >\n ","\n <nile-icon name=\"arrowdropdown\" color=\"black\" class=\"calendar-header__caret\"></nile-icon>\n </span>\n <nile-menu>\n <div class=\"year-scroll-wrapper\">\n ","\n </div>\n </nile-menu>\n </nile-dropdown>\n "])),t,this.yearOptions.map(function(e){return i(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n <nile-menu-item\n class=\"year-menu-item\"\n ?selected=\"","\"\n @click=\"","\"\n >\n ","\n </nile-menu-item>\n "])),e===t,function(){return _this4.onYearSelected(e);},e);})):i(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n <span>","</span>\n "])),t)):i(_templateObject22||(_templateObject22=_taggedTemplateLiteral(["\n <span\n >","\n ","</span\n >\n"])),new Date(t,s).toLocaleString("default",{month:"long"}),t),this.isNextDisabled()?"-1":"0",function(t){"Enter"!==t.key&&" "!==t.key||_this4.nextMonth();},this.nextMonth,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(function(t){return i(_templateObject23||(_templateObject23=_taggedTemplateLiteral(["<div class=\"day_name\">","</div>"])),t);}),u.map(function(a,l){var h=l>=d.length&&l<d.length+n.length,o=v(a,s,t,h),_c2={day_date:!0,"not-allowed":!_this4.isAllowedDate(a,s,t),"in-range":p(a,s,t,h),filler:!h};return o&&(_c2[o]=!0),i(_templateObject24||(_templateObject24=_taggedTemplateLiteral([" \n <div\n part=\"calendar-day-","\"\n class=","\n tabindex=\"","\"\n @keydown=\"","\"\n @click=\"","\"\n >\n <span style=\"position:relative;\">\n ","\n ","\n </span>\n </div>"])),a,r(_c2),h&&_this4.isAllowedDate(a,s,t)?"0":"-1",function(i){"Enter"!==i.key&&" "!==i.key||_this4.selectDate(a,s,t);},function(){h&&_this4.selectDate(a,s,t);},a,function(t,i,e){var s=new Date();return t===s.getDate()&&i+1===s.getMonth()+1&&e===s.getFullYear();}(a,s,t)&&h?i(_templateObject25||(_templateObject25=_taggedTemplateLiteral(["<div class=\"current__date__dot\" part=\"current-date-dot\"></div>"]))):e);}));}},{key:"isAllowedDate",value:function isAllowedDate(t,i,e){if(!this.allowedDatesLocal)return!0;var s=new Date(Date.UTC(e,i,t)),n=this.getUTCDate(this.allowedDatesLocal.startDate),a=this.getUTCDate(this.allowedDatesLocal.endDate);a.setUTCHours(23,59,59,999);return s>=n&&s<=a;}},{key:"clearDate",value:function clearDate(t){(t!==null&&t!==void 0?t:this.range?"relative"===this.type?d.Relative:d.Range:d.Single)===d.Single?this.value=null:(this.valueAttribute="",this.startDate=null,this.endDate=null,this.selectedUnit=void 0,this.selectedValue=void 0),this.requestUpdate(),this.emit("nile-clear");}},{key:"selectDate",value:function selectDate(t,i,e){var s=new Date(e,i,t);if(this.range){if(this.startDate&&this.endDate&&(this.startDate=null,this.endDate=null),this.isSelectingStart)this.startDate=s,this.endDate&&s>this.endDate&&(this.endDate=null),this.isSelectingStart=!1;else if(this.isSelectingStart=!0,this.startDate&&s<this.startDate)this.startDate=s,this.endDate=null,this.isSelectingStart=!1;else{var _t2=s;_t2.setHours(23,59,59,999),this.endDate=_t2;}}else{if(String(this.value)==String(s)&&this.doubleClickUnselect)return void this.clearDate();this.value=s,this.emitChangedData({value:this.value});}}},{key:"initializeValue",value:function initializeValue(){if(this.range)try{var _t3=JSON.parse(this.valueAttribute||"");this.startDate=new Date(_t3.startDate),this.endDate=new Date(_t3.endDate),this.startDate=new Date(this.startDate.getTime()),this.endDate=new Date(this.endDate.getTime()),this.value=null;}catch(t){}else if(this.valueAttribute){var _t4=new Date(this.valueAttribute);_t4=new Date(_t4.getTime()-6e4*_t4.getTimezoneOffset()),isNaN(_t4.getTime())||(this.value=_t4,this.currentMonth=this.value.getMonth(),this.currentYear=this.value.getFullYear());}}},{key:"handleDurationChange",value:function handleDurationChange(t){t.stopPropagation(),t.detail.value=t.detail.value.replace(/e/gi,"");var i=Number(t.detail.value);i&&(this.selectedValue=i,this.selectedUnit&&this.selectedValue&&this.handleTimeValueClick(this.selectedUnit,this.selectedValue,t));}},{key:"handleUnitChange",value:function handleUnitChange(t){t.stopPropagation(),this.selectedUnit=t.detail.value,this.selectedUnit&&this.selectedValue&&this.handleTimeValueClick(this.selectedUnit,this.selectedValue,t);}},{key:"handleTimeValueClick",value:function handleTimeValueClick(t,i,e){this.createRelativePeriod(t,i),this.selectedUnit=t,this.selectedValue=i;}},{key:"createRelativePeriod",value:function createRelativePeriod(t,i){var e=new Date(),s=new Date();switch(t){case"minutes":s.setMinutes(s.getMinutes()-i);break;case"hours":s.setHours(s.getHours()-i);break;case"days":s.setDate(s.getDate()-i);break;case"weeks":s.setDate(s.getDate()-7*i);break;case"months":s.setMonth(s.getMonth()-i);}return this.startDate=new Date(s.getTime()),this.endDate=new Date(e.getTime()),{startDate:this.startDate,endDate:this.endDate};}},{key:"handleStartTimeInput",value:function handleStartTimeInput(t){if(t.stopPropagation(),!this.startDate)return void(this.startDate=null);var i=this.parseTime(t.detail.value,this.startDate);i?this.startDate=i:this.startDate.setHours(0,0,0),this.requestUpdate();}},{key:"handleEndTimeInput",value:function handleEndTimeInput(t){if(t.stopPropagation(),!this.endDate)return void(this.endDate=null);var i=this.parseTime(t.detail.value,this.endDate);i?this.endDate=i:this.endDate.setHours(0,0,0),this.requestUpdate();}},{key:"parseTime",value:function parseTime(t,i){if(!this.isValidTimeInput(t))return null;var _t$split$map=t.split(":").map(Number),_t$split$map2=_slicedToArray(_t$split$map,3),e=_t$split$map2[0],s=_t$split$map2[1],n=_t$split$map2[2],a=new Date(i.getTime());return a.setHours(e,s,n),a;}},{key:"isValidTimeInput",value:function isValidTimeInput(t){return /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/.test(t);}},{key:"formatTime",value:function formatTime(t){if(!t)return"";return"".concat(String(t.getHours()).padStart(2,"0"),":").concat(String(t.getMinutes()).padStart(2,"0"),":").concat(String(t.getSeconds()).padStart(2,"0"));}},{key:"nextMonth",value:function nextMonth(){if(11===this.currentMonth){var _t5=this.currentYear+1;if(void 0!==this.endYear&&_t5>this.endYear)return;this.currentMonth=0,this.currentYear=_t5;}else this.currentMonth++;}},{key:"prevMonth",value:function prevMonth(){if(0===this.currentMonth){var _t6=this.currentYear-1;if(void 0!==this.startYear&&_t6<this.startYear)return;this.currentMonth=11,this.currentYear=_t6;}else this.currentMonth--;}},{key:"confimRange",value:function confimRange(){this.startDate&&this.endDate&&this.emitChangedData({startDate:this.startDate,endDate:this.endDate});}},{key:"onTypeChange",value:function onTypeChange(t){this.type=t.detail.value,this.emit("nile-type-change",{value:this.type});}},{key:"getUTCDate",value:function getUTCDate(t){return new Date(Date.UTC(t.slice(0,4),t.slice(5,7)-1,t.slice(8,10)));}},{key:"emitChangedData",value:function emitChangedData(t){this.emit("nile-changed",t),this.emit("nile-change",t);}},{key:"getDaysArray",value:function getDaysArray(t,i){var e=new Date(t,i+1,0).getDate();return Array.from({length:e},function(t,i){return i+1;});}}],[{key:"styles",get:function get(){return[l];}}]);}(o));t([s({type:String,attribute:"value"})],c.prototype,"valueAttribute",void 0),t([s({type:String,attribute:!0,reflect:!0})],c.prototype,"allowedDates",void 0),t([s({type:Boolean,reflect:!0})],c.prototype,"range",void 0),t([s({type:Boolean,attribute:!0,reflect:!0})],c.prototype,"hideTypes",void 0),t([s({type:Boolean,reflect:!0})],c.prototype,"doubleClickUnselect",void 0),t([s({type:Boolean,reflect:!0})],c.prototype,"allowClear",void 0),t([s({type:String,reflect:!0})],c.prototype,"type",void 0),t([s({type:String})],c.prototype,"selectedUnit",void 0),t([s({type:Number})],c.prototype,"selectedValue",void 0),t([s({type:Array,attribute:"hide-duration-fields"})],c.prototype,"hideDurationFields",void 0),t([s({type:Boolean})],c.prototype,"showManualInputs",void 0),t([s({type:Number,attribute:!0,reflect:!0})],c.prototype,"startYear",void 0),t([s({type:Number,attribute:!0,reflect:!0})],c.prototype,"endYear",void 0),t([s({type:Boolean,attribute:!0,reflect:!0})],c.prototype,"showMonthDropdown",void 0),t([s({type:Boolean,attribute:!0,reflect:!0})],c.prototype,"showYearDropdown",void 0),t([s({type:String,reflect:!0,attribute:!0})],c.prototype,"dateFormat",void 0),t([n()],c.prototype,"startDate",void 0),t([n()],c.prototype,"endDate",void 0),t([n()],c.prototype,"isSelectingStart",void 0),t([n()],c.prototype,"hideInput",void 0),t([n()],c.prototype,"value",void 0),t([n()],c.prototype,"currentMonth",void 0),t([n()],c.prototype,"currentYear",void 0),t([n()],c.prototype,"allowedDatesLocal",void 0),t([h("allowedDates")],c.prototype,"checkValidAllowedDate",null),_export("N",c=t([a("nile-calendar")],c));}};});
2
2
  //# sourceMappingURL=nile-calendar.cjs.js.map