@aquera/nile-elements 2.0.11 → 2.0.13

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 (74) hide show
  1. package/README.md +7 -0
  2. package/demo/app-shell.html +21 -21
  3. package/dist/index.js +170 -167
  4. package/dist/nile-app-shell/nile-app-shell.cjs.js +1 -1
  5. package/dist/nile-app-shell/nile-app-shell.cjs.js.map +1 -1
  6. package/dist/nile-app-shell/nile-app-shell.css.cjs.js +1 -1
  7. package/dist/nile-app-shell/nile-app-shell.css.cjs.js.map +1 -1
  8. package/dist/nile-app-shell/nile-app-shell.css.esm.js +35 -32
  9. package/dist/nile-app-shell/nile-app-shell.esm.js +39 -34
  10. package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js +1 -1
  11. package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js.map +1 -1
  12. package/dist/nile-app-shell-panel/nile-app-shell-panel.css.esm.js +3 -1
  13. package/dist/nile-select/nile-select.cjs.js +2 -2
  14. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  15. package/dist/nile-select/nile-select.css.cjs.js +1 -1
  16. package/dist/nile-select/nile-select.css.cjs.js.map +1 -1
  17. package/dist/nile-select/nile-select.css.esm.js +12 -17
  18. package/dist/nile-select/nile-select.esm.js +43 -42
  19. package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
  20. package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
  21. package/dist/nile-select/virtual-scroll-helper.esm.js +2 -0
  22. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +4 -4
  23. package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
  24. package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js +1 -1
  25. package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js.map +1 -1
  26. package/dist/nile-virtual-select/nile-virtual-select.css.esm.js +12 -17
  27. package/dist/nile-virtual-select/nile-virtual-select.esm.js +26 -26
  28. package/dist/src/nile-app-shell/nile-app-shell-regions.test.js +9 -5
  29. package/dist/src/nile-app-shell/nile-app-shell-regions.test.js.map +1 -1
  30. package/dist/src/nile-app-shell/nile-app-shell.css.js +33 -30
  31. package/dist/src/nile-app-shell/nile-app-shell.css.js.map +1 -1
  32. package/dist/src/nile-app-shell/nile-app-shell.d.ts +22 -22
  33. package/dist/src/nile-app-shell/nile-app-shell.js +86 -76
  34. package/dist/src/nile-app-shell/nile-app-shell.js.map +1 -1
  35. package/dist/src/nile-app-shell/nile-app-shell.test.d.ts +1 -0
  36. package/dist/src/nile-app-shell/nile-app-shell.test.js +307 -89
  37. package/dist/src/nile-app-shell/nile-app-shell.test.js.map +1 -1
  38. package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js +3 -1
  39. package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js.map +1 -1
  40. package/dist/src/nile-select/nile-select.css.js +12 -17
  41. package/dist/src/nile-select/nile-select.css.js.map +1 -1
  42. package/dist/src/nile-select/nile-select.d.ts +18 -2
  43. package/dist/src/nile-select/nile-select.js +226 -64
  44. package/dist/src/nile-select/nile-select.js.map +1 -1
  45. package/dist/src/nile-select/nile-select.test.d.ts +1 -0
  46. package/dist/src/nile-select/nile-select.test.js +896 -17
  47. package/dist/src/nile-select/nile-select.test.js.map +1 -1
  48. package/dist/src/nile-select/virtual-scroll-helper.js +2 -0
  49. package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
  50. package/dist/src/nile-virtual-select/nile-virtual-select.css.js +12 -17
  51. package/dist/src/nile-virtual-select/nile-virtual-select.css.js.map +1 -1
  52. package/dist/src/nile-virtual-select/nile-virtual-select.d.ts +10 -2
  53. package/dist/src/nile-virtual-select/nile-virtual-select.js +142 -30
  54. package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
  55. package/dist/src/nile-virtual-select/nile-virtual-select.test.d.ts +1 -0
  56. package/dist/src/nile-virtual-select/nile-virtual-select.test.js +331 -16
  57. package/dist/src/nile-virtual-select/nile-virtual-select.test.js.map +1 -1
  58. package/dist/src/version.js +1 -1
  59. package/dist/src/version.js.map +1 -1
  60. package/dist/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +1 -1
  62. package/src/nile-app-shell/nile-app-shell-regions.test.ts +9 -5
  63. package/src/nile-app-shell/nile-app-shell.css.ts +33 -30
  64. package/src/nile-app-shell/nile-app-shell.test.ts +348 -105
  65. package/src/nile-app-shell/nile-app-shell.ts +89 -82
  66. package/src/nile-app-shell-panel/nile-app-shell-panel.css.ts +3 -1
  67. package/src/nile-select/nile-select.css.ts +12 -17
  68. package/src/nile-select/nile-select.test.ts +1112 -17
  69. package/src/nile-select/nile-select.ts +237 -67
  70. package/src/nile-select/virtual-scroll-helper.ts +2 -0
  71. package/src/nile-virtual-select/nile-virtual-select.css.ts +12 -17
  72. package/src/nile-virtual-select/nile-virtual-select.test.ts +404 -16
  73. package/src/nile-virtual-select/nile-virtual-select.ts +200 -79
  74. package/vscode-html-custom-data.json +36 -41
package/dist/index.js CHANGED
@@ -5155,35 +5155,23 @@ ${o?R`
5155
5155
  display: contents;
5156
5156
  }
5157
5157
 
5158
- .select__tags nile-tag {
5158
+ :host([showtooltip]) .select__tags nile-tag {
5159
5159
  flex: 0 1 auto;
5160
5160
  cursor: pointer;
5161
5161
  min-width: 0;
5162
- }
5163
-
5164
- /* A chip is capped - and so truncated - only when a tooltip can reveal the
5165
- full value. Without one it keeps its natural width and the fit pass moves
5166
- the surplus into the +N button instead. */
5167
- :host([showtooltip]) .select__tags nile-tag {
5168
5162
  max-width: var(--nile-width-180px, var(--ng-height-180px));
5169
5163
  }
5170
5164
 
5171
- /* Only the fitted layout can move a chip into the +N button, so only there
5172
- can a chip refuse to shrink. */
5173
- :host(:not([showtooltip])) .select__tags--fitted nile-tag {
5174
- flex-shrink: 0;
5175
- }
5176
-
5177
- .select__tags nile-tag::part(base) {
5165
+ :host([showtooltip]) .select__tags nile-tag::part(base) {
5178
5166
  max-width: 100%;
5179
5167
  }
5180
5168
 
5181
- .select__tags nile-tag::part(prefix_content_wrapper) {
5169
+ :host([showtooltip]) .select__tags nile-tag::part(prefix_content_wrapper) {
5182
5170
  flex: 1 1 auto;
5183
5171
  min-width: 0;
5184
5172
  }
5185
5173
 
5186
- .select__tags nile-tag::part(content) {
5174
+ :host([showtooltip]) .select__tags nile-tag::part(content) {
5187
5175
  display: block;
5188
5176
  flex: 1 1 auto;
5189
5177
  min-width: 0;
@@ -5199,7 +5187,7 @@ ${o?R`
5199
5187
  text-overflow: ellipsis;
5200
5188
  }
5201
5189
 
5202
- .select__tags nile-tag::part(remove-button) {
5190
+ :host([showtooltip]) .select__tags nile-tag::part(remove-button) {
5203
5191
  flex: 0 0 auto;
5204
5192
  }
5205
5193
 
@@ -5455,6 +5443,9 @@ ${o?R`
5455
5443
  bottom: 0;
5456
5444
  z-index: 1;
5457
5445
  background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
5446
+ }
5447
+
5448
+ .select__pre-footer-area--query {
5458
5449
  container-type: inline-size;
5459
5450
  container-name: nile-select-footer;
5460
5451
  }
@@ -5560,6 +5551,10 @@ ${o?R`
5560
5551
  }
5561
5552
  }
5562
5553
 
5554
+ .select__invisible {
5555
+ opacity: 0;
5556
+ }
5557
+
5563
5558
  .select__prefix--from-options {
5564
5559
  margin-inline-end: var(--nile-spacing-lg, var(--ng-spacing-md));
5565
5560
  }
@@ -6004,35 +5999,23 @@ ${o?R`
6004
5999
  display: contents;
6005
6000
  }
6006
6001
 
6007
- .select__tags nile-tag {
6002
+ :host([showtooltip]) .select__tags nile-tag {
6008
6003
  flex: 0 1 auto;
6009
6004
  cursor: pointer;
6010
6005
  min-width: 0;
6011
- }
6012
-
6013
- /* A chip is capped - and so truncated - only when a tooltip can reveal the
6014
- full value. Without one it keeps its natural width and the fit pass moves
6015
- the surplus into the +N button instead. */
6016
- :host([showtooltip]) .select__tags nile-tag {
6017
6006
  max-width: var(--nile-width-180px, var(--ng-height-180px));
6018
6007
  }
6019
6008
 
6020
- /* Only the fitted layout can move a chip into the +N button, so only there
6021
- can a chip refuse to shrink. */
6022
- :host(:not([showtooltip])) .select__tags--fitted nile-tag {
6023
- flex-shrink: 0;
6024
- }
6025
-
6026
- .select__tags nile-tag::part(base) {
6009
+ :host([showtooltip]) .select__tags nile-tag::part(base) {
6027
6010
  max-width: 100%;
6028
6011
  }
6029
6012
 
6030
- .select__tags nile-tag::part(prefix_content_wrapper) {
6013
+ :host([showtooltip]) .select__tags nile-tag::part(prefix_content_wrapper) {
6031
6014
  flex: 1 1 auto;
6032
6015
  min-width: 0;
6033
6016
  }
6034
6017
 
6035
- .select__tags nile-tag::part(content) {
6018
+ :host([showtooltip]) .select__tags nile-tag::part(content) {
6036
6019
  display: block;
6037
6020
  flex: 1 1 auto;
6038
6021
  min-width: 0;
@@ -6048,7 +6031,7 @@ ${o?R`
6048
6031
  text-overflow: ellipsis;
6049
6032
  }
6050
6033
 
6051
- .select__tags nile-tag::part(remove-button) {
6034
+ :host([showtooltip]) .select__tags nile-tag::part(remove-button) {
6052
6035
  flex: 0 0 auto;
6053
6036
  }
6054
6037
 
@@ -6310,6 +6293,9 @@ ${o?R`
6310
6293
  gap: var(--nile-spacing-none, var(--ng-spacing-none));
6311
6294
  justify-content: space-between;
6312
6295
  box-sizing: unset;
6296
+ }
6297
+
6298
+ .select__footer--query {
6313
6299
  container-type: inline-size;
6314
6300
  container-name: nile-select-footer;
6315
6301
  }
@@ -6378,6 +6364,10 @@ ${o?R`
6378
6364
  }
6379
6365
  }
6380
6366
 
6367
+ .select__invisible {
6368
+ opacity: 0;
6369
+ }
6370
+
6381
6371
  .select__prefix--from-options {
6382
6372
  margin-inline-end: var(--nile-spacing-lg, var(--ng-spacing-md));
6383
6373
  }
@@ -6500,7 +6490,7 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
6500
6490
  ${M?fe(p):p}
6501
6491
  ${fe(z)}
6502
6492
  </nile-option>
6503
- `}static shouldUseVirtualizer(e){return e.length>=5}}let Hs=class{static calculateAvailableSpace(e){const t=e.getBoundingClientRect(),i=window.innerHeight,n=i-t.bottom;return{spaceAbove:t.top,spaceBelow:n,viewportHeight:i}}static getOptimalPlacement(e){const{spaceAbove:t,spaceBelow:i}=this.calculateAvailableSpace(e);return i<200&&t>i?"top":"bottom"}static findBoundaryElements(e){const t=[];let i=e.parentElement;for(;i&&i!==document.body;){const e=window.getComputedStyle(i),n=e.overflow,o=e.overflowY,r=e.overflowX;"auto"!==n&&"scroll"!==n&&"auto"!==o&&"scroll"!==o&&"auto"!==r&&"scroll"!==r||t.push(i),(i.hasAttribute("data-floating-boundary")||i.classList.contains("floating-boundary")||i.classList.contains("scroll-container"))&&t.push(i),i=i.parentElement}return t.length>0?t:void 0}static calculateOptimalHeight(e,t,i){const n=t-(e.y+e.height),o=e.y;return o>n?Math.max(o-20,100):n>o?Math.max(n-20,100):Math.max(Math.min(o,n)-20,100)}static extractStylesAsCSS(e){return"string"==typeof e?e:Array.isArray(e)?e.map((e=>this.extractStylesAsCSS(e))).join("\n"):e&&"object"==typeof e&&e.cssText?e.cssText:""}static generateStyleId(){return`nile-select-styles-${Math.random().toString(36).substring(2,11)}`}static isPositioningOptimal(e,t){const{spaceAbove:i,spaceBelow:n}=this.calculateAvailableSpace(t),o=e.startsWith("top"),r=e.startsWith("bottom");return!(o&&n>i)&&!(r&&i>n)}static applyCollisionData(e,t,i){if(t.flip){const{overflows:n}=t.flip;if(e.setAttribute("data-placement",i),n&&n.length>0){const t=n.map((e=>e.placement)).join(",");e.setAttribute("data-overflow",t)}else e.removeAttribute("data-overflow")}if(t.shift){const{x:i,y:n}=t.shift;void 0===i||void 0===n||0===i&&0===n?e.removeAttribute("data-shift"):e.setAttribute("data-shift",`${i},${n}`)}if(t.size){const{availableWidth:i,availableHeight:n}=t.size;void 0!==i&&e.setAttribute("data-available-width",i.toString()),void 0!==n&&e.setAttribute("data-available-height",n.toString())}}static createFloatingUIMiddleware(e,t){return[]}},Js=class{static createBaseListbox(e){const t=document.createElement("div");return t.className="select__listbox "+(e.searchEnabled?"select__search-enabled ":""),t.setAttribute("tabindex","-1"),t}static addSearchSection(e,t){if(!t.searchEnabled)return;const i=document.createElement("div");i.className="select__search",i.innerHTML=`\n <nile-input size="small" clearable value="${t.searchValue}" placeholder="${t.internalSearchPlaceHolder}">\n <nile-icon name="var(--nile-icon-search, var(--ng-icon-search-lg))" method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))" slot="suffix"></nile-icon>\n </nile-input>\n `,e.appendChild(i)}static addLoadingSection(e,t){if(!t.optionsLoading)return;const i=document.createElement("span");i.className="select__loader",i.innerHTML='\n <nile-icon class="select__loader--icon" name="var(--nile-icon-button-loading-blue, var(--ng-icon-button-loading-blue))" method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"></nile-icon>\n ',e.appendChild(i)}static addOptionsSection(e,t){const i=document.createElement("div");i.className="select__options "+(t.searchEnabled?"select__options__search-enabled":""),this.addNoResultsMessage(i,t),this.addClonedOptions(i,t),e.appendChild(i)}static addNoResultsMessage(e,t){if(!t.showNoResults)return;const i=document.createElement("div");i.className="select__no-results",i.textContent=t.noResultsMessage,e.appendChild(i)}static addClonedOptions(e,t){Array.from(t.querySelectorAll("nile-option")).forEach((t=>{const i=this.cloneOption(t);e.appendChild(i)}))}static cloneOption(e){const t=e.cloneNode(!0);return Array.from(e.attributes).forEach((e=>{t.setAttribute(e.name,e.value)})),this.copyOptionProperties(e,t),t}static copyOptionProperties(e,t){["selected","disabled","current","hidden"].forEach((i=>{void 0!==e[i]&&(t[i]=e[i])}))}static addFooterSection(e,t){const i=t.querySelectorAll('[slot="pre-footer"]').length>0,n=t.multiple;if(!i&&!n)return;const o=document.createElement("div");if(o.setAttribute("part","footer-area"),o.className="select__footer-area",i&&this.addCustomFooter(o,t),n){const e=this.createFooter(t);o.appendChild(e)}e.appendChild(o)}static addCustomFooter(e,t){const i=Array.from(t.querySelectorAll('[slot="pre-footer"]'));if(0===i.length)return;const n=document.createElement("div");n.className="select__custom-footer",n.setAttribute("part","custom-footer"),i.forEach((e=>{n.appendChild(e.cloneNode(!0))})),n.addEventListener("click",(()=>t.hide())),e.appendChild(n)}static createFooter(e){const t=document.createElement("div");return t.setAttribute("part","footer"),t.className="select__footer",this.addShowSelectedToggle(t,e),this.addClearAllButton(t,e),t}static addShowSelectedToggle(e,t){const i=document.createElement("span");i.style.cursor="pointer";const n=document.createElement("nile-checkbox");n.disabled=0===t.selectedOptions.length,n.checked=t.showSelected,n.innerHTML="&nbsp; Show Selected",i.appendChild(n),e.appendChild(i)}static addClearAllButton(e,t){if(0===t.selectedOptions.length)return;const i=document.createElement("span");i.className="select__clear",i.textContent="Clear All",i.style.cursor="pointer",e.appendChild(i)}static updateClonedOptions(e,t){const i=e.querySelector(".select__options");if(!i)return;const n=Array.from(t.querySelectorAll("nile-option")),o=Array.from(i.querySelectorAll("nile-option"));n.forEach(((e,t)=>{const i=o[t];i&&this.updateClonedOption(e,i)}))}static updateClonedOption(e,t){t.selected=e.selected,t.disabled=e.disabled,t.current=e.current,t.hidden=e.hidden,this.updateClonedOptionAttributes(e,t)}static updateClonedOptionAttributes(e,t){[{prop:"selected",attr:"selected"},{prop:"disabled",attr:"disabled"},{prop:"current",attr:"current"},{prop:"hidden",attr:"hidden"}].forEach((({prop:i,attr:n})=>{e[i]?t.setAttribute(n,""):t.removeAttribute(n)}))}static createPortalListbox(e){const t=this.createBaseListbox(e);return this.addSearchSection(t,e),this.addLoadingSection(t,e),this.addOptionsSection(t,e),this.addFooterSection(t,e),t}},Xs=class{static setupPortalEventListeners(e,t){e&&(this.setupOptionClickListeners(e,t),this.setupScrollListeners(e,t),this.setupSearchListeners(e,t),this.setupFooterListeners(e,t),this.setupSlotListeners(e,t))}static setupOptionClickListeners(e,t){e&&e.addEventListener("mouseup",(e=>{const i=e.target.closest("nile-option");i&&this.handleOptionClick(i,t)}))}static handleOptionClick(e,t){const i=t.querySelector(`nile-option[value="${e.getAttribute("value")}"]`);if(i){const e=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window});Object.defineProperty(e,"target",{value:i,writable:!1}),t.handleOptionClick&&t.handleOptionClick(e)}}static setupScrollListeners(e,t){e&&e.addEventListener("scroll",(e=>{t.handleScroll&&t.handleScroll(e)}))}static setupSearchListeners(e,t){if(!e)return;const i=e.querySelector("nile-input");i&&(i.addEventListener("nile-input",(e=>{t.handleSearchChange&&t.handleSearchChange(e)})),i.addEventListener("nile-focus",(e=>{t.handleSearchFocus&&t.handleSearchFocus()})),i.addEventListener("nile-blur",(e=>{t.handleSearchBlur&&t.handleSearchBlur()})))}static setupFooterListeners(e,t){if(!e)return;const i=e.querySelector(".select__footer");i&&(this.setupFooterClickHandlers(i),this.setupShowSelectedToggle(i,t),this.setupClearAllHandler(i,t)),this.setupCustomFooterListeners(e,t)}static setupCustomFooterListeners(e,t){const i=e.querySelector(".select__custom-footer");i&&i.addEventListener("click",(e=>{e.stopPropagation()}))}static setupFooterClickHandlers(e){e.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault()}))}static setupShowSelectedToggle(e,t){const i=e.querySelector('span[style*="cursor: pointer"]');i&&i.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),t.toggleShowSelected&&t.toggleShowSelected(e)}))}static setupClearAllHandler(e,t){e.addEventListener("click",(e=>{e.target.classList.contains("select__clear")&&(e.stopPropagation(),e.preventDefault(),t.unSlectAll&&t.unSlectAll())}))}static setupSlotListeners(e,t){if(!e)return;const i=e.querySelector("slot");i&&i.addEventListener("slotchange",(()=>{t.updatePortalContent&&t.updatePortalContent()}))}},qs=class{constructor(e){this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=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-virtual-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:n,placement:o,middlewareData:r}=await this.calculateFloatingUIPosition(e,t);this.applyFloatingUIPosition(t,e,i,n,o,r)}catch(e){console.warn("Floating UI positioning failed, falling back to simple positioning:",e),this.fallbackPositioning()}}async calculateFloatingUIPosition(e,t){const i=Hs.findBoundaryElements(e),n=Hs.getOptimalPlacement(e),o=this.createFloatingUIMiddleware(i);return await zn(e,t,{placement:n,strategy:"fixed",middleware:o,platform:this.createCustomPlatform()})}createFloatingUIMiddleware(e){return[pn(4),In({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:e}),yn({fallbackPlacements:["bottom","top","bottom-start","top-start","bottom-end","top-end"],fallbackStrategy:"bestFit",padding:10,boundary:e}),Dn({padding:10,crossAxis:!0,boundary:e})]}handleSizeMiddleware({availableWidth:e,availableHeight:t,elements:i,rects:n}){const o=Hs.calculateOptimalHeight(n.reference,window.innerHeight,this.currentPlacement);i.floating.style.maxWidth=`${e}px`,i.floating.style.maxHeight=`${o}px`,i.floating.style.setProperty("--auto-size-available-width",`${e}px`),i.floating.style.setProperty("--auto-size-available-height",`${o}px`)}createCustomPlatform(){return dn}applyFloatingUIPosition(e,t,i,n,o,r){Object.assign(e.style,{left:`${i}px`,top:`${n}px`,position:"fixed",pointerEvents:"auto"}),this.currentPlacement=o,this.currentMiddlewareData=r,Hs.applyCollisionData(e,r,o);const s=o.split("-")[0];e.className=`nile-virtual-select-portal-append select__listbox--${s}`;const a=t.getBoundingClientRect();e.style.width=`${a.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,n=e.top;let o,r,s;n>i?(s=Math.max(n-20,100),o=Math.max(e.top-s-4,10),r="top"):(s=Math.max(i-20,100),o=e.bottom+4,r="bottom"),this.portalContainer.style.left=`${e.left}px`,this.portalContainer.style.top=`${o}px`,this.portalContainer.style.width=`${e.width}px`,this.portalContainer.style.maxHeight=`${s}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.className=`nile-virtual-select-portal-append select__listbox--${r}`,this.calculateAndSetAutoSizeProperties(e,o,r)}calculateAndSetAutoSizeProperties(e,t,i){if(!this.portalContainer)return;const n=window.innerHeight,o=window.innerWidth;let r;r="top"===i?e.top-10:n-e.bottom-10;const s=Math.min(e.width,o-e.left-10);this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(r,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(s,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=Nn(this.component,this.portalContainer,(()=>{this.computeFloatingUIPosition()}),{ancestorScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,animationFrame:!0}))}cleanupAutoUpdatePositioning(){this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null)}extractStylesAsCSS(e){return"string"==typeof e?e:Array.isArray(e)?e.map((e=>this.extractStylesAsCSS(e))).join("\n"):e&&"object"==typeof e&&e.cssText?e.cssText:""}injectStylesToDocument(){if(!this.portalContainer)return;const e=`nile-virtual-select-styles-${Math.random().toString(36).substring(2,11)}`;if(document.getElementById(e))return;const t=this.component.constructor.styles;if(!t)return;const i=document.createElement("style");i.id=e,i.textContent=this.extractStylesAsCSS(t),document.head.appendChild(i),this.portalContainer.__injectedStyleId=e}adoptStylesToPortalAppend(){this.portalContainer&&this.injectStylesToDocument()}setupPortalAppend(){this.component.portal&&this.component.updateComplete.then((()=>{const e=this.component.shadowRoot?.querySelector("#listbox");e&&(this.originalListboxParent=e.parentElement,this.portalContainer=this.createPortalAppendContainer(),this.portalContainer.appendChild(e),document.body.appendChild(this.portalContainer),this.adoptStylesToPortalAppend(),e.style.display="",this.positionPortalAppend(),this.setupAutoUpdatePositioning(),window.addEventListener("resize",this.handleWindowResize.bind(this)))}))}cleanupPortalAppend(){if(this.cleanupAutoUpdatePositioning(),this.portalContainer&&this.portalContainer.parentNode){const e=this.portalContainer.querySelector("#listbox");e&&this.originalListboxParent&&(this.originalListboxParent.appendChild(e),e.style.display=this.component.portal?"none":"");const t=this.portalContainer.__injectedStyleId;if(t){const e=document.getElementById(t);e&&e.remove()}this.portalContainer.parentNode.removeChild(this.portalContainer)}window.removeEventListener("resize",this.handleWindowResize.bind(this)),this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=null,this.currentPlacement="bottom",this.currentMiddlewareData=null}async resetScrollPosition(){await this.component.updateComplete,requestAnimationFrame((()=>{let e=null;if(e=this.component.portal&&this.portalContainer?this.portalContainer.querySelector("#listbox"):this.component.shadowRoot?.querySelector("#listbox"),!e||!e.isConnected)return;e.scrollTop=0;const t=e.querySelector(".virtualized");if(t&&t.isConnected){this.component.data?.length<5?(t.style.overflowY="hidden",t.style.maxHeight="none",e.style.overflowY="hidden",e.style.maxHeight="fit-content"):(t.style.overflowY="auto",t.style.maxHeight="",e.style.overflowY="auto",e.style.maxHeight=""),t.scrollTop=0}const i=e.querySelector("lit-virtualizer");i&&i.isConnected&&(i.scrollTop=0)}))}get portalContainerElement(){return this.portalContainer}resetMeasuredHeight(){this.measuredPopupHeight=null}forceReposition(){this.portalContainer&&this.computeFloatingUIPosition()}getCurrentPlacement(){return this.currentPlacement}getCurrentMiddlewareData(){return this.currentMiddlewareData}isUsingFloatingUI(){return null!==this.cleanupAutoUpdate}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,n=this.currentPlacement.startsWith("top"),o=this.currentPlacement.startsWith("bottom");return!(n&&t>i)&&!(o&&i>t)}},Ks=class{constructor(e,{target:t,config:i,callback:n,skipInitial:o}){this.t=new Set,this.o=!1,this.i=!1,this.h=e,null!==t&&this.t.add(t??e),this.l=i,this.o=o??this.o,this.callback=n,window.ResizeObserver?(this.u=new ResizeObserver((e=>{this.handleChanges(e),this.h.requestUpdate()})),e.addController(this)):console.warn("ResizeController error: browser does not support ResizeObserver.")}handleChanges(e){this.value=this.callback?.(e,this.u)}hostConnected(){for(const e of this.t)this.observe(e)}hostDisconnected(){this.disconnect()}async hostUpdated(){!this.o&&this.i&&this.handleChanges([]),this.i=!1}observe(e){this.t.add(e),this.u.observe(e,this.l),this.i=!0,this.h.requestUpdate()}unobserve(e){this.t.delete(e),this.u.unobserve(e)}disconnect(){this.u.disconnect()}target(e){return ea(this,e)}};const ea=Te(class extends Ss{constructor(){super(...arguments),this.observing=!1}render(e,t){}update(e,[t,i]){this.controller=t,this.part=e,this.observe=i,!1===i?(t.unobserve(e.element),this.observing=!1):!1===this.observing&&(t.observe(e.element),this.observing=!0)}disconnected(){this.controller?.unobserve(this.part.element),this.observing=!1}reconnected(){!1!==this.observe&&!1===this.observing&&(this.controller?.observe(this.part.element),this.observing=!0)}});let ta=class extends Fe{constructor(){super(...arguments),this.formControlController=new Ue(this,{assumeInteractionOn:["nile-blur","nile-input"]}),this.hasSlotController=new Ze(this,"help-text","label"),this.portalManager=new qs(this),this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.oldValue="",this.scrolling=!1,this.name="",this.data=[],this.originalOptionItems=[],this.value="",this.defaultValue="",this.size="medium",this.placeholder="Select...",this.autoResize=!1,this.searchValue="",this.searchEnabled=!1,this.enableVisibilityEffect=!1,this.internalSearchPlaceHolder="Search...",this.disableLocalSearch=!1,this.optionsLoading=!1,this.loading=!1,this.multiple=!1,this.helpText="",this.errorMessage="",this.warning=!1,this.error=!1,this.success=!1,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.showNoResults=!1,this.noResultsMessage="No results found",this.showSelected=!1,this.blockValueChange=!1,this.noWidthSync=!1,this.portal=!1,this._maxOptionsVisible=3,this.maxOptionsVisibleExplicit=!1,this.chipMinWidth=110,this.chipMaxWidth=180,this.showTooltip=!1,this.hiddenChipCount=0,this.lastOverflowWidth=0,this.chipFitFrame=0,this.lastChipLayout={hidden:-1,visible:-1},this.clippedChips=[],this.clipFrame=0,this.enableTabClose=!1,this.descriptionSearchEnabled=!1,this.allowHtmlLabel=!0,this.enableDescription=!1,this.legacy=!1,this.tickOnSelect=!1,this.showListbox=!1,this.wasShowSelectedCheckedOnClose=!1,this.handleDocumentMouseDown=e=>{if(!this.open)return;const t=e.composedPath(),i=t.includes(this),n=this.popup&&t.includes(this.popup),o=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||n||o||this.hide()},this.handleWindowError=e=>{(e.error?.message||e.message||"").includes("Cannot read properties of null (reading 'insertBefore')")&&e.preventDefault()},this.handleWindowResize=()=>{this.portalManager.updatePortalAppendPosition()},this.handleWindowScroll=()=>{this.portalManager.updatePortalAppendPosition()},this.resizeController=new Ks(this,{callback:e=>{for(const t of e)t.target.classList.contains("select__tags")&&this.calculateTotalWidthOfTags()}})}get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(e){const t=this._maxOptionsVisible;this._maxOptionsVisible=e,this.maxOptionsVisibleExplicit=!0,this.requestUpdate("maxOptionsVisible",t)}get chipFittingEnabled(){return!!this.multiple&&!this.maxOptionsVisibleExplicit}get validity(){return this.valueInput?.validity}get validationMessage(){return this.valueInput?.validationMessage??""}connectedCallback(){super.connectedCallback(),this.initializeComponent(),this.setupEventListeners(),this.updateComplete.then((()=>{this.value&&this.data.length>0&&this.selectionChanged()}))}disconnectedCallback(){this.removeOpenListeners(),this.visibilityManager?.cleanup(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0),this.portalManager.cleanupPortalAppend(),this.destroyChipFit()}updated(e){e.has("value")&&this.selectionChanged(),(e.has("autoResize")||e.has("multiple")||e.has("maxOptionsVisible"))&&this.setupResizeObserver(),(e.has("chipMinWidth")||e.has("chipMaxWidth"))&&this.destroyChipFit(),this.chipFittingEnabled&&this.calculateTotalWidthOfTags(),this.multiple&&this.showTooltip&&this.scheduleClipCheck()}initializeComponent(){this.open=!1,this.emit("nile-init")}getDisplayText(e){return this.renderItemConfig?.getDisplayText?this.renderItemConfig.getDisplayText(e):e?.label||e?.name||e?.toString()||""}getItemValue(e){return this.renderItemConfig?.getValue?this.renderItemConfig.getValue(e):e?.value||e}getItemDescription(e){return this.renderItemConfig?.getDescription?this.renderItemConfig.getDescription(e):e?.description||e||""}getItemPrefix(e){return this.renderItemConfig?.getPrefix?this.renderItemConfig.getPrefix(e):e?.prefix||e||""}getItemSuffix(e){return this.renderItemConfig?.getSuffix?this.renderItemConfig.getSuffix(e):e?.suffix||e||""}getSearchText(e){return this.renderItemConfig?.getSearchText?this.renderItemConfig.getSearchText(e):this.getDisplayText(e)}setupEventListeners(){this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleWindowError=this.handleWindowError.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.handleWindowScroll=this.handleWindowScroll.bind(this)}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),window.addEventListener("error",this.handleWindowError),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("error",this.handleWindowError),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("scroll",this.handleWindowScroll,!0)}handleFocus(){this.hasFocus=!0,this.emit("nile-focus")}handleBlur(){this.hasFocus=!1,this.emit("nile-blur")}firstUpdated(e){this.visibilityManager=new fn({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)})}handleDocumentFocusIn(e){if(!this.open)return;const t=e.composedPath(),i=t.includes(this),n=this.popup&&t.includes(this.popup),o=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||n||o||this.hide()}handleDocumentKeyDown(e){this.shouldIgnoreKeyPress(e)||(this.isEscapeKey(e)&&this.handleEscapeKey(e),this.isEnterOrSpaceKey(e)&&this.handleEnterOrSpaceKey(e))}shouldIgnoreKeyPress(e){const t=e.target,i=null!==t.closest(".select__clear"),n=null!==t.closest("nile-icon-button");return i||n}isEscapeKey(e){return"Escape"===e.key&&this.open}handleEscapeKey(e){e.preventDefault(),e.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})}isEnterOrSpaceKey(e){return"Enter"===e.key||" "===e.key}handleEnterOrSpaceKey(e){e.preventDefault(),e.stopImmediatePropagation(),this.open?this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})):this.show()}handleFooterClick(e){e.stopPropagation(),e.preventDefault()}toggleShowSelected(e){if(e.stopPropagation(),e.preventDefault(),0!==this.selectedOptions?.length){if(this.showSelected=!this.showSelected,this.showSelected){this.searchValue="";const e=Array.isArray(this.value)?this.value:[this.value];this.data=this.originalOptionItems.filter((t=>{const i=this.getItemValue(t);return e.some((e=>String(e)===String(i)))}))}else this.data=[...this.originalOptionItems];this.portalManager.resetMeasuredHeight(),this.requestUpdate(),this.repaintOptionsContainer()}}unSelectAll(){this.showSelected=!1,this.value=this.multiple?[]:"",this.data=[...this.originalOptionItems],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.resetScrollPosition()}handleLabelClick(){this.displayInput.focus(),this.hide()}handleComboboxMouseDown(e){this.shouldIgnoreComboboxClick(e)||(e.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}shouldIgnoreComboboxClick(e){const t=e.composedPath(),i=t.some((e=>e instanceof Element&&"nile-icon-button"===e.tagName.toLowerCase())),n=t.some((e=>e instanceof HTMLButtonElement&&e.classList.contains("select__tags-count")));return this.disabled||i||n}handleComboboxKeyDown(e){this.isEnterOrSpaceKey(e)&&(e.preventDefault(),this.open=!this.open)}handleClearClick(e){e.stopPropagation(),this.clearSelection()}clearSelection(){this.value,this.value=this.multiple?[]:"",this.selectionChanged(),this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name}),this.emit("nile-clear")}))}handleClearMouseDown(e){e.stopPropagation()}handleOptionClick(e){const t=e.target.closest("nile-option");if(this.shouldBlockValueChange(t))return;const i=this.value;this.oldValue=i,t&&!t.disabled&&this.handleOptionSelection(t)}shouldBlockValueChange(e){return!(!this.blockValueChange||!e)&&(this.emit("nile-block-change",{value:e?.value,name:this.name}),this.hide(),!0)}handleOptionSelection(e){const t=e.value;this.multiple?this.toggleOptionSelection(t):this.setSelectedOptions(t),this.updateComplete.then((()=>this.displayInput.focus({preventScroll:!0}))),this.value!==this.oldValue&&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}))}setSelectedOptions(e){this.value=e,this.selectionChanged()}toggleOptionSelection(e){const t=Array.isArray(this.value)?this.value:[];t.includes(e)?this.value=t.filter((t=>t!==e)):this.value=[...t,e],this.selectionChanged()}handleTagRemove(e,t){e.stopPropagation(),this.disabled||(this.removeTagFromSelection(t),this.emitTagRemovalEvent(t))}removeTagFromSelection(e){let t=this.value;Array.isArray(t)||(t=t?[t]:[]);const i=t.filter((t=>t!==e.value));this.value=i,this.selectionChanged()}emitTagRemovalEvent(e){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:e.value})}))}selectionChanged(){const e=this.originalOptionItems.length>0?this.originalOptionItems:this.data;if(this.selectedOptions=xs.createVirtualOptionsFromValues(this.value,e,this.getDisplayText.bind(this),this.renderItemConfig?.getValue,this.allowHtmlLabel),this.multiple)this.placeholder&&0===this.value.length?this.displayLabel="":this.displayLabel=this.selectedOptions.length+" selected";else{const e=Array.isArray(this.value)?this.value[0]:this.value,t=this.selectedOptions[0]?.getTextLabel();this.displayLabel=t||(e??"")}this.updateValidity(),0===this.selectedOptions.length&&(this.showSelected=!1,this.originalOptionItems?.length>0&&!this.searchValue&&(this.data=[...this.originalOptionItems]),this.repaintOptionsContainer()),this.calculateTotalWidthOfTags()}handleSearchFocus(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}handleSearchBlur(){document.addEventListener("keydown",this.handleDocumentKeyDown)}handleSearchChange(e){this.searchValue=e.detail.value,this.portal&&this.portalManager.updatePortalAppendPosition(),this.emit("nile-search",{query:this.searchValue,name:this.name}),this.disableLocalSearch||(this.filterVirtualOptions(this.searchValue),this.repaintOptionsContainer(),this.portalManager.resetMeasuredHeight())}repaintOptionsContainer(){this.resetScrollPosition(),this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".virtualized");e&&(this.data.length<5?e.classList.add("no-scroll"):e.classList.remove("no-scroll"))}))}handleScroll(e){if(this.showSelected)return;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.searchValue&&this.emit("nile-scroll-end",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name,isAtBottom:!0})}filterVirtualOptions(e){const t=As.filterVirtualOptions(e,this.originalOptionItems,this.data,this.getDisplayText.bind(this),this.getItemDescription.bind(this),this.descriptionSearchEnabled,this.renderItemConfig?.getSearchText);this.portal?(this.portalManager.updatePortalAppendPosition(),this.updateComplete.then((()=>{requestAnimationFrame((()=>{this.resetScrollPosition()}))}))):this.resetScrollPosition(),this.data=t.filteredItems,this.showNoResults=t.showNoResults,this.showSelected=!1,this.requestUpdate()}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}handleValueChange(){this.selectionChanged(),this.requestUpdate(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition()}handleDataChange(){this.data.length>0&&this.open&&!this.showSelected&&!this.searchValue&&(this.originalOptionItems=[...this.data]),this.selectionChanged(),this.optionsLoading||this.loading||0!==this.data.length?this.data.length>0&&(this.showNoResults=!1):this.showNoResults=!0,this.requestUpdate(),this.portalManager.resetMeasuredHeight(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition()}handleRenderItemConfigChange(){this.value&&this.data.length>0&&(this.selectionChanged(),this.requestUpdate())}handleOptionsLoadingChange(){this.optionsLoading||0!==this.data.length||(this.showNoResults=!0),this.requestUpdate(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition()}handlePortalAppendChange(){this.open&&(this.portal?this.portalManager.setupPortalAppend():this.portalManager.cleanupPortalAppend())}async handleOpenChange(){this.open&&!this.disabled?(this.visibilityManager?.setup(),this.showListbox=!0,await this.updateComplete,await this.handleOpen(),this.portal&&this.portalManager.setupPortalAppend()):(this.visibilityManager?.cleanup(),await this.handleClose(),this.showListbox=!1,this.portal&&this.portalManager.cleanupPortalAppend())}async handleOpen(){this.emit("nile-show",{value:this.value,name:this.name}),this.addOpenListeners(),this.showNoResults=!this.data?.length,await Yt(this),this.popup?.popup&&(this.popup.popup.style.visibility="hidden"),this.popup.active=!0,await new Promise((e=>requestAnimationFrame(e))),await new Promise((e=>requestAnimationFrame(e))),this.popup?.popup&&(this.popup.popup.style.visibility="");const{keyframes:e,options:t}=Wt(this,"select.show",{dir:"ltr"});await Ct(this.popup.popup,e,t),this.wasShowSelectedCheckedOnClose&&(this.showSelected=!1,this.data=[...this.originalOptionItems],this.wasShowSelectedCheckedOnClose=!1),this.filterVirtualOptions(""),this.resetScrollPosition(),this.emit("nile-after-show",{value:this.value,name:this.name})}async handleClose(){this.emit("nile-hide",{value:this.value,name:this.name}),this.removeOpenListeners(),this.wasShowSelectedCheckedOnClose=this.showSelected,await Yt(this);const{keyframes:e,options:t}=Wt(this,"select.hide",{dir:"ltr"});await Ct(this.popup.popup,e,t),this.popup.active=!1,this.popup?.popup&&(this.popup.popup.style.visibility=""),this.searchValue="",this.portalManager.resetMeasuredHeight(),this.emit("nile-after-hide",{value:this.value,name:this.name})}async show(){if(!this.open&&!this.disabled)return this.open=!0,Jt(this,"nile-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,Jt(this,"nile-after-hide");this.open=!1}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController.getForm()}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()}render(){const e=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const t=this.hasSlotController.test("label-suffix"),i=this.hasSlotController.test("custom-select"),n=!!this.label||!!e,o=this.clearable&&!this.disabled&&this.value.length>0,r=!!this.placeholder&&0===this.value.length,s=!!this.helpText,a=!!this.errorMessage;return R`
6493
+ `}static shouldUseVirtualizer(e){return e.length>=5}}let Hs=class{static calculateAvailableSpace(e){const t=e.getBoundingClientRect(),i=window.innerHeight,n=i-t.bottom;return{spaceAbove:t.top,spaceBelow:n,viewportHeight:i}}static getOptimalPlacement(e){const{spaceAbove:t,spaceBelow:i}=this.calculateAvailableSpace(e);return i<200&&t>i?"top":"bottom"}static findBoundaryElements(e){const t=[];let i=e.parentElement;for(;i&&i!==document.body;){const e=window.getComputedStyle(i),n=e.overflow,o=e.overflowY,r=e.overflowX;"auto"!==n&&"scroll"!==n&&"auto"!==o&&"scroll"!==o&&"auto"!==r&&"scroll"!==r||t.push(i),(i.hasAttribute("data-floating-boundary")||i.classList.contains("floating-boundary")||i.classList.contains("scroll-container"))&&t.push(i),i=i.parentElement}return t.length>0?t:void 0}static calculateOptimalHeight(e,t,i){const n=t-(e.y+e.height),o=e.y;return o>n?Math.max(o-20,100):n>o?Math.max(n-20,100):Math.max(Math.min(o,n)-20,100)}static extractStylesAsCSS(e){return"string"==typeof e?e:Array.isArray(e)?e.map((e=>this.extractStylesAsCSS(e))).join("\n"):e&&"object"==typeof e&&e.cssText?e.cssText:""}static generateStyleId(){return`nile-select-styles-${Math.random().toString(36).substring(2,11)}`}static isPositioningOptimal(e,t){const{spaceAbove:i,spaceBelow:n}=this.calculateAvailableSpace(t),o=e.startsWith("top"),r=e.startsWith("bottom");return!(o&&n>i)&&!(r&&i>n)}static applyCollisionData(e,t,i){if(t.flip){const{overflows:n}=t.flip;if(e.setAttribute("data-placement",i),n&&n.length>0){const t=n.map((e=>e.placement)).join(",");e.setAttribute("data-overflow",t)}else e.removeAttribute("data-overflow")}if(t.shift){const{x:i,y:n}=t.shift;void 0===i||void 0===n||0===i&&0===n?e.removeAttribute("data-shift"):e.setAttribute("data-shift",`${i},${n}`)}if(t.size){const{availableWidth:i,availableHeight:n}=t.size;void 0!==i&&e.setAttribute("data-available-width",i.toString()),void 0!==n&&e.setAttribute("data-available-height",n.toString())}}static createFloatingUIMiddleware(e,t){return[]}},Js=class{static createBaseListbox(e){const t=document.createElement("div");return t.className="select__listbox "+(e.searchEnabled?"select__search-enabled ":""),t.setAttribute("tabindex","-1"),t}static addSearchSection(e,t){if(!t.searchEnabled)return;const i=document.createElement("div");i.className="select__search",i.innerHTML=`\n <nile-input size="small" clearable value="${t.searchValue}" placeholder="${t.internalSearchPlaceHolder}">\n <nile-icon name="var(--nile-icon-search, var(--ng-icon-search-lg))" method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))" slot="suffix"></nile-icon>\n </nile-input>\n `,e.appendChild(i)}static addLoadingSection(e,t){if(!t.optionsLoading)return;const i=document.createElement("span");i.className="select__loader",i.innerHTML='\n <nile-icon class="select__loader--icon" name="var(--nile-icon-button-loading-blue, var(--ng-icon-button-loading-blue))" method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"></nile-icon>\n ',e.appendChild(i)}static addOptionsSection(e,t){const i=document.createElement("div");i.className="select__options "+(t.searchEnabled?"select__options__search-enabled":""),this.addNoResultsMessage(i,t),this.addClonedOptions(i,t),e.appendChild(i)}static addNoResultsMessage(e,t){if(!t.showNoResults)return;const i=document.createElement("div");i.className="select__no-results",i.textContent=t.noResultsMessage,e.appendChild(i)}static addClonedOptions(e,t){Array.from(t.querySelectorAll("nile-option")).forEach((t=>{const i=this.cloneOption(t);e.appendChild(i)}))}static cloneOption(e){const t=e.cloneNode(!0);return Array.from(e.attributes).forEach((e=>{t.setAttribute(e.name,e.value)})),this.copyOptionProperties(e,t),t}static copyOptionProperties(e,t){["selected","disabled","current","hidden"].forEach((i=>{void 0!==e[i]&&(t[i]=e[i])}))}static addFooterSection(e,t){const i=t.querySelectorAll('[slot="pre-footer"]').length>0,n=t.multiple;if(!i&&!n)return;const o=document.createElement("div");if(o.setAttribute("part","footer-area"),o.className="select__footer-area",i&&this.addCustomFooter(o,t),n){const e=this.createFooter(t);o.appendChild(e)}e.appendChild(o)}static addCustomFooter(e,t){const i=Array.from(t.querySelectorAll('[slot="pre-footer"]'));if(0===i.length)return;const n=document.createElement("div");n.className="select__custom-footer",n.setAttribute("part","custom-footer"),i.forEach((e=>{n.appendChild(e.cloneNode(!0))})),n.addEventListener("click",(()=>t.hide())),e.appendChild(n)}static createFooter(e){const t=document.createElement("div");return t.setAttribute("part","footer"),t.className="select__footer",this.addShowSelectedToggle(t,e),this.addClearAllButton(t,e),t}static addShowSelectedToggle(e,t){const i=document.createElement("span");i.style.cursor="pointer";const n=document.createElement("nile-checkbox");n.disabled=0===t.selectedOptions.length,n.checked=t.showSelected,n.innerHTML="&nbsp; Show Selected",i.appendChild(n),e.appendChild(i)}static addClearAllButton(e,t){if(0===t.selectedOptions.length)return;const i=document.createElement("span");i.className="select__clear",i.textContent="Clear All",i.style.cursor="pointer",e.appendChild(i)}static updateClonedOptions(e,t){const i=e.querySelector(".select__options");if(!i)return;const n=Array.from(t.querySelectorAll("nile-option")),o=Array.from(i.querySelectorAll("nile-option"));n.forEach(((e,t)=>{const i=o[t];i&&this.updateClonedOption(e,i)}))}static updateClonedOption(e,t){t.selected=e.selected,t.disabled=e.disabled,t.current=e.current,t.hidden=e.hidden,this.updateClonedOptionAttributes(e,t)}static updateClonedOptionAttributes(e,t){[{prop:"selected",attr:"selected"},{prop:"disabled",attr:"disabled"},{prop:"current",attr:"current"},{prop:"hidden",attr:"hidden"}].forEach((({prop:i,attr:n})=>{e[i]?t.setAttribute(n,""):t.removeAttribute(n)}))}static createPortalListbox(e){const t=this.createBaseListbox(e);return this.addSearchSection(t,e),this.addLoadingSection(t,e),this.addOptionsSection(t,e),this.addFooterSection(t,e),t}},Xs=class{static setupPortalEventListeners(e,t){e&&(this.setupOptionClickListeners(e,t),this.setupScrollListeners(e,t),this.setupSearchListeners(e,t),this.setupFooterListeners(e,t),this.setupSlotListeners(e,t))}static setupOptionClickListeners(e,t){e&&e.addEventListener("mouseup",(e=>{const i=e.target.closest("nile-option");i&&this.handleOptionClick(i,t)}))}static handleOptionClick(e,t){const i=t.querySelector(`nile-option[value="${e.getAttribute("value")}"]`);if(i){const e=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window});Object.defineProperty(e,"target",{value:i,writable:!1}),t.handleOptionClick&&t.handleOptionClick(e)}}static setupScrollListeners(e,t){e&&e.addEventListener("scroll",(e=>{t.handleScroll&&t.handleScroll(e)}))}static setupSearchListeners(e,t){if(!e)return;const i=e.querySelector("nile-input");i&&(i.addEventListener("nile-input",(e=>{t.handleSearchChange&&t.handleSearchChange(e)})),i.addEventListener("nile-focus",(e=>{t.handleSearchFocus&&t.handleSearchFocus()})),i.addEventListener("nile-blur",(e=>{t.handleSearchBlur&&t.handleSearchBlur()})))}static setupFooterListeners(e,t){if(!e)return;const i=e.querySelector(".select__footer");i&&(this.setupFooterClickHandlers(i),this.setupShowSelectedToggle(i,t),this.setupClearAllHandler(i,t)),this.setupCustomFooterListeners(e,t)}static setupCustomFooterListeners(e,t){const i=e.querySelector(".select__custom-footer");i&&i.addEventListener("click",(e=>{e.stopPropagation()}))}static setupFooterClickHandlers(e){e.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault()}))}static setupShowSelectedToggle(e,t){const i=e.querySelector('span[style*="cursor: pointer"]');i&&i.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),t.toggleShowSelected&&t.toggleShowSelected(e)}))}static setupClearAllHandler(e,t){e.addEventListener("click",(e=>{e.target.classList.contains("select__clear")&&(e.stopPropagation(),e.preventDefault(),t.unSlectAll&&t.unSlectAll())}))}static setupSlotListeners(e,t){if(!e)return;const i=e.querySelector("slot");i&&i.addEventListener("slotchange",(()=>{t.updatePortalContent&&t.updatePortalContent()}))}},qs=class{constructor(e){this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=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-virtual-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:n,placement:o,middlewareData:r}=await this.calculateFloatingUIPosition(e,t);this.applyFloatingUIPosition(t,e,i,n,o,r)}catch(e){console.warn("Floating UI positioning failed, falling back to simple positioning:",e),this.fallbackPositioning()}}async calculateFloatingUIPosition(e,t){const i=Hs.findBoundaryElements(e),n=Hs.getOptimalPlacement(e),o=this.createFloatingUIMiddleware(i);return await zn(e,t,{placement:n,strategy:"fixed",middleware:o,platform:this.createCustomPlatform()})}createFloatingUIMiddleware(e){return[pn(4),In({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:e}),yn({fallbackPlacements:["bottom","top","bottom-start","top-start","bottom-end","top-end"],fallbackStrategy:"bestFit",padding:10,boundary:e}),Dn({padding:10,crossAxis:!0,boundary:e})]}handleSizeMiddleware({availableWidth:e,availableHeight:t,elements:i,rects:n}){const o=Hs.calculateOptimalHeight(n.reference,window.innerHeight,this.currentPlacement);i.floating.style.maxWidth=`${e}px`,i.floating.style.maxHeight=`${o}px`,i.floating.style.setProperty("--auto-size-available-width",`${e}px`),i.floating.style.setProperty("--auto-size-available-height",`${o}px`)}createCustomPlatform(){return dn}applyFloatingUIPosition(e,t,i,n,o,r){Object.assign(e.style,{left:`${i}px`,top:`${n}px`,position:"fixed",pointerEvents:"auto"}),this.currentPlacement=o,this.currentMiddlewareData=r,Hs.applyCollisionData(e,r,o);const s=o.split("-")[0];e.className=`nile-virtual-select-portal-append select__listbox--${s}`;const a=t.getBoundingClientRect();e.style.width=`${a.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,n=e.top;let o,r,s;n>i?(s=Math.max(n-20,100),o=Math.max(e.top-s-4,10),r="top"):(s=Math.max(i-20,100),o=e.bottom+4,r="bottom"),this.portalContainer.style.left=`${e.left}px`,this.portalContainer.style.top=`${o}px`,this.portalContainer.style.width=`${e.width}px`,this.portalContainer.style.maxHeight=`${s}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.className=`nile-virtual-select-portal-append select__listbox--${r}`,this.calculateAndSetAutoSizeProperties(e,o,r)}calculateAndSetAutoSizeProperties(e,t,i){if(!this.portalContainer)return;const n=window.innerHeight,o=window.innerWidth;let r;r="top"===i?e.top-10:n-e.bottom-10;const s=Math.min(e.width,o-e.left-10);this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(r,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(s,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=Nn(this.component,this.portalContainer,(()=>{this.computeFloatingUIPosition()}),{ancestorScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,animationFrame:!0}))}cleanupAutoUpdatePositioning(){this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null)}extractStylesAsCSS(e){return"string"==typeof e?e:Array.isArray(e)?e.map((e=>this.extractStylesAsCSS(e))).join("\n"):e&&"object"==typeof e&&e.cssText?e.cssText:""}injectStylesToDocument(){if(!this.portalContainer)return;const e=`nile-virtual-select-styles-${Math.random().toString(36).substring(2,11)}`;if(document.getElementById(e))return;const t=this.component.constructor.styles;if(!t)return;const i=document.createElement("style");i.id=e,i.textContent=this.extractStylesAsCSS(t),document.head.appendChild(i),this.portalContainer.__injectedStyleId=e}adoptStylesToPortalAppend(){this.portalContainer&&this.injectStylesToDocument()}setupPortalAppend(){this.component.portal&&this.component.updateComplete.then((()=>{const e=this.component.shadowRoot?.querySelector("#listbox");e&&(this.originalListboxParent=e.parentElement,this.portalContainer=this.createPortalAppendContainer(),this.portalContainer.appendChild(e),document.body.appendChild(this.portalContainer),this.adoptStylesToPortalAppend(),e.style.display="",this.positionPortalAppend(),this.setupAutoUpdatePositioning(),window.addEventListener("resize",this.handleWindowResize.bind(this)))}))}cleanupPortalAppend(){if(this.cleanupAutoUpdatePositioning(),this.portalContainer&&this.portalContainer.parentNode){const e=this.portalContainer.querySelector("#listbox");e&&this.originalListboxParent&&(this.originalListboxParent.appendChild(e),e.style.display=this.component.portal?"none":"");const t=this.portalContainer.__injectedStyleId;if(t){const e=document.getElementById(t);e&&e.remove()}this.portalContainer.parentNode.removeChild(this.portalContainer)}window.removeEventListener("resize",this.handleWindowResize.bind(this)),this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=null,this.currentPlacement="bottom",this.currentMiddlewareData=null}async resetScrollPosition(){await this.component.updateComplete,requestAnimationFrame((()=>{let e=null;if(e=this.component.portal&&this.portalContainer?this.portalContainer.querySelector("#listbox"):this.component.shadowRoot?.querySelector("#listbox"),!e||!e.isConnected)return;e.scrollTop=0;const t=e.querySelector(".virtualized");if(t&&t.isConnected){this.component.data?.length<5?(t.style.overflowY="hidden",t.style.maxHeight="none",e.style.overflowY="hidden",e.style.maxHeight="fit-content"):(t.style.overflowY="auto",t.style.maxHeight="",e.style.overflowY="auto",e.style.maxHeight=""),t.scrollTop=0}const i=e.querySelector("lit-virtualizer");i&&i.isConnected&&(i.scrollTop=0)}))}get portalContainerElement(){return this.portalContainer}resetMeasuredHeight(){this.measuredPopupHeight=null}forceReposition(){this.portalContainer&&this.computeFloatingUIPosition()}getCurrentPlacement(){return this.currentPlacement}getCurrentMiddlewareData(){return this.currentMiddlewareData}isUsingFloatingUI(){return null!==this.cleanupAutoUpdate}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,n=this.currentPlacement.startsWith("top"),o=this.currentPlacement.startsWith("bottom");return!(n&&t>i)&&!(o&&i>t)}},Ks=class{constructor(e,{target:t,config:i,callback:n,skipInitial:o}){this.t=new Set,this.o=!1,this.i=!1,this.h=e,null!==t&&this.t.add(t??e),this.l=i,this.o=o??this.o,this.callback=n,window.ResizeObserver?(this.u=new ResizeObserver((e=>{this.handleChanges(e),this.h.requestUpdate()})),e.addController(this)):console.warn("ResizeController error: browser does not support ResizeObserver.")}handleChanges(e){this.value=this.callback?.(e,this.u)}hostConnected(){for(const e of this.t)this.observe(e)}hostDisconnected(){this.disconnect()}async hostUpdated(){!this.o&&this.i&&this.handleChanges([]),this.i=!1}observe(e){this.t.add(e),this.u.observe(e,this.l),this.i=!0,this.h.requestUpdate()}unobserve(e){this.t.delete(e),this.u.unobserve(e)}disconnect(){this.u.disconnect()}target(e){return ea(this,e)}};const ea=Te(class extends Ss{constructor(){super(...arguments),this.observing=!1}render(e,t){}update(e,[t,i]){this.controller=t,this.part=e,this.observe=i,!1===i?(t.unobserve(e.element),this.observing=!1):!1===this.observing&&(t.observe(e.element),this.observing=!0)}disconnected(){this.controller?.unobserve(this.part.element),this.observing=!1}reconnected(){!1!==this.observe&&!1===this.observing&&(this.controller?.observe(this.part.element),this.observing=!0)}});let ta=class extends Fe{constructor(){super(...arguments),this.formControlController=new Ue(this,{assumeInteractionOn:["nile-blur","nile-input"]}),this.hasSlotController=new Ze(this,"help-text","label"),this.portalManager=new qs(this),this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.oldValue="",this.scrolling=!1,this.name="",this.data=[],this.originalOptionItems=[],this.value="",this.defaultValue="",this.size="medium",this.placeholder="Select...",this.autoResize=!1,this.searchValue="",this.searchEnabled=!1,this.enableVisibilityEffect=!1,this.internalSearchPlaceHolder="Search...",this.disableLocalSearch=!1,this.optionsLoading=!1,this.loading=!1,this.multiple=!1,this.helpText="",this.errorMessage="",this.warning=!1,this.error=!1,this.success=!1,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.showNoResults=!1,this.noResultsMessage="No results found",this.showSelected=!1,this.blockValueChange=!1,this.noWidthSync=!1,this.portal=!1,this._maxOptionsVisible=3,this.maxOptionsVisibleExplicit=!1,this.chipMinWidth=110,this.chipMaxWidth=180,this.showTooltip=!1,this.hiddenChipCount=0,this.oldMaxOptionsVisible=1,this.lastOverflowWidth=0,this.chipFitFrame=0,this.lastChipLayout={hidden:-1,visible:-1},this.clippedChips=[],this.clipFrame=0,this.enableTabClose=!1,this.descriptionSearchEnabled=!1,this.allowHtmlLabel=!0,this.enableDescription=!1,this.legacy=!1,this.tickOnSelect=!1,this.showListbox=!1,this.wasShowSelectedCheckedOnClose=!1,this.handleDocumentMouseDown=e=>{if(!this.open)return;const t=e.composedPath(),i=t.includes(this),n=this.popup&&t.includes(this.popup),o=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||n||o||this.hide()},this.handleWindowError=e=>{(e.error?.message||e.message||"").includes("Cannot read properties of null (reading 'insertBefore')")&&e.preventDefault()},this.handleWindowResize=()=>{this.portalManager.updatePortalAppendPosition()},this.handleWindowScroll=()=>{this.portalManager.updatePortalAppendPosition()},this.resizeController=new Ks(this,{callback:e=>{for(const t of e)t.target.classList.contains("select__tags")&&this.calculateTotalWidthOfTags()}})}get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(e){const t=this._maxOptionsVisible;this._maxOptionsVisible=e,this.maxOptionsVisibleExplicit=!0,this.requestUpdate("maxOptionsVisible",t)}get chipFittingEnabled(){return!!this.multiple&&this.showTooltip&&!this.maxOptionsVisibleExplicit}get legacyTagFitEnabled(){return!!this.multiple&&!this.showTooltip}setFittedMaxOptionsVisible(e){const t=this._maxOptionsVisible;this._maxOptionsVisible=e,this.requestUpdate("maxOptionsVisible",t)}get validity(){return this.valueInput?.validity}get validationMessage(){return this.valueInput?.validationMessage??""}connectedCallback(){super.connectedCallback(),this.initializeComponent(),this.setupEventListeners(),this.updateComplete.then((()=>{this.value&&this.data.length>0&&this.selectionChanged()}))}disconnectedCallback(){this.removeOpenListeners(),this.visibilityManager?.cleanup(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0),this.portalManager.cleanupPortalAppend(),this.destroyChipFit()}updated(e){e.has("value")&&this.selectionChanged(),(e.has("autoResize")||e.has("multiple")||e.has("maxOptionsVisible")||e.has("showTooltip"))&&this.setupResizeObserver(),e.has("showTooltip")&&void 0!==e.get("showTooltip")&&this.legacyTagFitEnabled&&this.calculateTotalWidthOfTags(),(e.has("chipMinWidth")||e.has("chipMaxWidth"))&&this.destroyChipFit(),this.chipFittingEnabled&&this.calculateTotalWidthOfTags(),this.multiple&&this.showTooltip&&this.scheduleClipCheck()}initializeComponent(){this.open=!1,this.emit("nile-init")}getDisplayText(e){return this.renderItemConfig?.getDisplayText?this.renderItemConfig.getDisplayText(e):e?.label||e?.name||e?.toString()||""}getItemValue(e){return this.renderItemConfig?.getValue?this.renderItemConfig.getValue(e):e?.value||e}getItemDescription(e){return this.renderItemConfig?.getDescription?this.renderItemConfig.getDescription(e):e?.description||e||""}getItemPrefix(e){return this.renderItemConfig?.getPrefix?this.renderItemConfig.getPrefix(e):e?.prefix||e||""}getItemSuffix(e){return this.renderItemConfig?.getSuffix?this.renderItemConfig.getSuffix(e):e?.suffix||e||""}getSearchText(e){return this.renderItemConfig?.getSearchText?this.renderItemConfig.getSearchText(e):this.getDisplayText(e)}setupEventListeners(){this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleWindowError=this.handleWindowError.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.handleWindowScroll=this.handleWindowScroll.bind(this)}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),window.addEventListener("error",this.handleWindowError),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("error",this.handleWindowError),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("scroll",this.handleWindowScroll,!0)}handleFocus(){this.hasFocus=!0,this.emit("nile-focus")}handleBlur(){this.hasFocus=!1,this.emit("nile-blur")}firstUpdated(e){this.visibilityManager=new fn({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)})}handleDocumentFocusIn(e){if(!this.open)return;const t=e.composedPath(),i=t.includes(this),n=this.popup&&t.includes(this.popup),o=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||n||o||this.hide()}handleDocumentKeyDown(e){this.shouldIgnoreKeyPress(e)||(this.isEscapeKey(e)&&this.handleEscapeKey(e),this.isEnterOrSpaceKey(e)&&this.handleEnterOrSpaceKey(e))}shouldIgnoreKeyPress(e){const t=e.target,i=null!==t.closest(".select__clear"),n=null!==t.closest("nile-icon-button");return i||n}isEscapeKey(e){return"Escape"===e.key&&this.open}handleEscapeKey(e){e.preventDefault(),e.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})}isEnterOrSpaceKey(e){return"Enter"===e.key||" "===e.key}handleEnterOrSpaceKey(e){e.preventDefault(),e.stopImmediatePropagation(),this.open?this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})):this.show()}handleFooterClick(e){e.stopPropagation(),e.preventDefault()}toggleShowSelected(e){if(e.stopPropagation(),e.preventDefault(),0!==this.selectedOptions?.length){if(this.showSelected=!this.showSelected,this.showSelected){this.searchValue="";const e=Array.isArray(this.value)?this.value:[this.value];this.data=this.originalOptionItems.filter((t=>{const i=this.getItemValue(t);return e.some((e=>String(e)===String(i)))}))}else this.data=[...this.originalOptionItems];this.portalManager.resetMeasuredHeight(),this.requestUpdate(),this.repaintOptionsContainer()}}unSelectAll(){this.showSelected=!1,this.value=this.multiple?[]:"",this.data=[...this.originalOptionItems],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.resetScrollPosition()}handleLabelClick(){this.displayInput.focus(),this.hide()}handleComboboxMouseDown(e){this.shouldIgnoreComboboxClick(e)||(e.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}shouldIgnoreComboboxClick(e){const t=e.composedPath(),i=t.some((e=>e instanceof Element&&"nile-icon-button"===e.tagName.toLowerCase())),n=t.some((e=>e instanceof HTMLButtonElement&&e.classList.contains("select__tags-count")));return this.disabled||i||n}handleComboboxKeyDown(e){this.isEnterOrSpaceKey(e)&&(e.preventDefault(),this.open=!this.open)}handleClearClick(e){e.stopPropagation(),this.clearSelection()}clearSelection(){this.value,this.value=this.multiple?[]:"",this.selectionChanged(),this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name}),this.emit("nile-clear")}))}handleClearMouseDown(e){e.stopPropagation()}handleOptionClick(e){const t=e.target.closest("nile-option");if(this.shouldBlockValueChange(t))return;const i=this.value;this.oldValue=i,t&&!t.disabled&&this.handleOptionSelection(t)}shouldBlockValueChange(e){return!(!this.blockValueChange||!e)&&(this.emit("nile-block-change",{value:e?.value,name:this.name}),this.hide(),!0)}handleOptionSelection(e){const t=e.value;this.multiple?this.toggleOptionSelection(t):this.setSelectedOptions(t),this.updateComplete.then((()=>this.displayInput.focus({preventScroll:!0}))),this.value!==this.oldValue&&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}))}setSelectedOptions(e){this.value=e,this.selectionChanged()}toggleOptionSelection(e){const t=Array.isArray(this.value)?this.value:[];t.includes(e)?this.value=t.filter((t=>t!==e)):this.value=[...t,e],this.selectionChanged()}handleTagRemove(e,t){e.stopPropagation(),this.disabled||(this.removeTagFromSelection(t),this.emitTagRemovalEvent(t))}removeTagFromSelection(e){let t=this.value;Array.isArray(t)||(t=t?[t]:[]);const i=t.filter((t=>t!==e.value));this.value=i,this.selectionChanged()}emitTagRemovalEvent(e){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:e.value})}))}selectionChanged(){const e=this.originalOptionItems.length>0?this.originalOptionItems:this.data;if(this.selectedOptions=xs.createVirtualOptionsFromValues(this.value,e,this.getDisplayText.bind(this),this.renderItemConfig?.getValue,this.allowHtmlLabel),this.multiple)this.placeholder&&0===this.value.length?this.displayLabel="":this.displayLabel=this.selectedOptions.length+" selected";else{const e=Array.isArray(this.value)?this.value[0]:this.value,t=this.selectedOptions[0]?.getTextLabel();this.displayLabel=t||(e??"")}this.updateValidity(),0===this.selectedOptions.length&&(this.showSelected=!1,this.originalOptionItems?.length>0&&!this.searchValue&&(this.data=[...this.originalOptionItems]),this.repaintOptionsContainer()),this.calculateTotalWidthOfTags()}handleSearchFocus(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}handleSearchBlur(){document.addEventListener("keydown",this.handleDocumentKeyDown)}handleSearchChange(e){this.searchValue=e.detail.value,this.portal&&this.portalManager.updatePortalAppendPosition(),this.emit("nile-search",{query:this.searchValue,name:this.name}),this.disableLocalSearch||(this.filterVirtualOptions(this.searchValue),this.repaintOptionsContainer(),this.portalManager.resetMeasuredHeight())}repaintOptionsContainer(){this.resetScrollPosition(),this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".virtualized");e&&(this.data.length<5?e.classList.add("no-scroll"):e.classList.remove("no-scroll"))}))}handleScroll(e){if(this.showSelected)return;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.searchValue&&this.emit("nile-scroll-end",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name,isAtBottom:!0})}filterVirtualOptions(e){const t=As.filterVirtualOptions(e,this.originalOptionItems,this.data,this.getDisplayText.bind(this),this.getItemDescription.bind(this),this.descriptionSearchEnabled,this.renderItemConfig?.getSearchText);this.portal?(this.portalManager.updatePortalAppendPosition(),this.updateComplete.then((()=>{requestAnimationFrame((()=>{this.resetScrollPosition()}))}))):this.resetScrollPosition(),this.data=t.filteredItems,this.showNoResults=t.showNoResults,this.showSelected=!1,this.requestUpdate()}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}handleValueChange(){this.selectionChanged(),this.requestUpdate(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition()}handleDataChange(){this.data.length>0&&this.open&&!this.showSelected&&!this.searchValue&&(this.originalOptionItems=[...this.data]),this.selectionChanged(),this.optionsLoading||this.loading||0!==this.data.length?this.data.length>0&&(this.showNoResults=!1):this.showNoResults=!0,this.requestUpdate(),this.portalManager.resetMeasuredHeight(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition()}handleRenderItemConfigChange(){this.value&&this.data.length>0&&(this.selectionChanged(),this.requestUpdate())}handleOptionsLoadingChange(){this.optionsLoading||0!==this.data.length||(this.showNoResults=!0),this.requestUpdate(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition()}handlePortalAppendChange(){this.open&&(this.portal?this.portalManager.setupPortalAppend():this.portalManager.cleanupPortalAppend())}async handleOpenChange(){this.open&&!this.disabled?(this.visibilityManager?.setup(),this.showListbox=!0,await this.updateComplete,await this.handleOpen(),this.portal&&this.portalManager.setupPortalAppend()):(this.visibilityManager?.cleanup(),await this.handleClose(),this.showListbox=!1,this.portal&&this.portalManager.cleanupPortalAppend())}async handleOpen(){this.emit("nile-show",{value:this.value,name:this.name}),this.addOpenListeners(),this.showNoResults=!this.data?.length,await Yt(this),this.popup?.popup&&(this.popup.popup.style.visibility="hidden"),this.popup.active=!0,await new Promise((e=>requestAnimationFrame(e))),await new Promise((e=>requestAnimationFrame(e))),this.popup?.popup&&(this.popup.popup.style.visibility="");const{keyframes:e,options:t}=Wt(this,"select.show",{dir:"ltr"});await Ct(this.popup.popup,e,t),this.wasShowSelectedCheckedOnClose&&(this.showSelected=!1,this.data=[...this.originalOptionItems],this.wasShowSelectedCheckedOnClose=!1),this.filterVirtualOptions(""),this.resetScrollPosition(),this.emit("nile-after-show",{value:this.value,name:this.name})}async handleClose(){this.emit("nile-hide",{value:this.value,name:this.name}),this.removeOpenListeners(),this.wasShowSelectedCheckedOnClose=this.showSelected,await Yt(this);const{keyframes:e,options:t}=Wt(this,"select.hide",{dir:"ltr"});await Ct(this.popup.popup,e,t),this.popup.active=!1,this.popup?.popup&&(this.popup.popup.style.visibility=""),this.searchValue="",this.portalManager.resetMeasuredHeight(),this.emit("nile-after-hide",{value:this.value,name:this.name})}async show(){if(!this.open&&!this.disabled)return this.open=!0,Jt(this,"nile-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,Jt(this,"nile-after-hide");this.open=!1}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController.getForm()}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()}render(){const e=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const t=this.hasSlotController.test("label-suffix"),i=this.hasSlotController.test("custom-select"),n=!!this.label||!!e,o=this.clearable&&!this.disabled&&this.value.length>0,r=!!this.placeholder&&0===this.value.length,s=!!this.helpText,a=!!this.errorMessage;return R`
6504
6494
  <div
6505
6495
  part="form-control"
6506
6496
  class=${Ae({"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":n,"form-control--has-help-text":s})}
@@ -6636,36 +6626,36 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
6636
6626
  </div>
6637
6627
  `}renderTags(){return this.chipFittingEnabled?this.renderFittedTags():this.multiple?R`
6638
6628
  <div part="tags" class="select__tags">
6639
- ${this.selectedOptions.map(((e,t)=>t<this.maxOptionsVisible||this.maxOptionsVisible<=0?R`
6640
- <nile-lite-tooltip
6629
+ ${this.selectedOptions.map(((e,t)=>t<this.maxOptionsVisible||this.maxOptionsVisible<=0?this.showTooltip?R`<nile-lite-tooltip
6641
6630
  class="select__tag-tip"
6642
6631
  .content=${e.getTextLabel()}
6643
6632
  ?disabled=${this.chipTooltipDisabled(t)}
6644
- >
6645
- <nile-tag
6646
- part="tag"
6647
- exportparts="
6648
- base:tag__base,
6649
- content:tag__content,
6650
- remove-button:tag__remove-button,
6651
- remove-button__base:tag__remove-button__base
6652
- "
6653
- style="max-width:${this.chipMaxWidth}px"
6654
- ?pill=${this.pill}
6655
- size=${this.size}
6656
- removable
6657
- @nile-remove=${t=>this.handleTagRemove(t,e)}
6658
- >
6659
- ${e.getTextLabel()}
6660
- </nile-tag>
6661
- </nile-lite-tooltip>
6662
- `:t===this.maxOptionsVisible?R`
6633
+ >${this.renderLegacyTag(e,t)}</nile-lite-tooltip
6634
+ >`:this.renderLegacyTag(e,t):t===this.maxOptionsVisible?R`
6663
6635
  <span class="select__tags-count"
6664
6636
  >+${this.selectedOptions.length-t} More
6665
6637
  </span>
6666
6638
  `:null))}
6667
6639
  </div>
6668
- `:R``}renderValueInput(){return R`
6640
+ `:R``}renderLegacyTag(e,t){const i={select__invisible:t+1>this.oldMaxOptionsVisible&&this.maxOptionsVisible===1/0};return R`
6641
+ <nile-tag
6642
+ class=${Ae(i)}
6643
+ part="tag"
6644
+ exportparts="
6645
+ base:tag__base,
6646
+ content:tag__content,
6647
+ remove-button:tag__remove-button,
6648
+ remove-button__base:tag__remove-button__base
6649
+ "
6650
+ style=${Pe(this.showTooltip?`max-width:${this.chipMaxWidth}px`:void 0)}
6651
+ ?pill=${this.pill}
6652
+ size=${this.size}
6653
+ removable
6654
+ @nile-remove=${t=>this.handleTagRemove(t,e)}
6655
+ >
6656
+ ${e.getTextLabel()}
6657
+ </nile-tag>
6658
+ `}renderValueInput(){return R`
6669
6659
  <input
6670
6660
  class="select__value-input"
6671
6661
  type="text"
@@ -6751,7 +6741,7 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
6751
6741
  `:R``}renderFooter(){return this.multiple?R`
6752
6742
  <div
6753
6743
  part="footer"
6754
- class="select__footer ${this.loading?"loading":""}"
6744
+ class=${Ae({select__footer:!0,loading:!!this.loading,"select__footer--query":!this.noWidthSync||this.portal})}
6755
6745
  @click="${this.handleFooterClick}"
6756
6746
  >
6757
6747
  <span
@@ -6791,7 +6781,7 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
6791
6781
  >${this.errorMessage}</nile-form-error-message
6792
6782
  >
6793
6783
  `:""}
6794
- `}getVirtualizedContent(){return Gs.getVirtualizedContent(this.data,this.searchEnabled,this.getDisplayText.bind(this),this.value,this.multiple,this.renderItemConfig?.getDisplayText,this.renderItemConfig?.getValue,this.renderItemConfig?.getDescription,this.renderItemConfig?.getPrefix,this.renderItemConfig?.getSuffix,this.showNoResults,this.noResultsMessage,this.optionsLoading||this.loading,this.handleScroll.bind(this),this.allowHtmlLabel,this.enableDescription,this.tickOnSelect,this.legacy)}nileInput(e){this.emit("nile-input",e)}nileChange(e){this.emit("nile-change",e)}updateValidity(){this.updateComplete.then((()=>{this.formControlController.updateValidity()}))}setupResizeObserver(){const e=this.autoResize&&this.chipFittingEnabled?this.shadowRoot?.querySelector(".select__tags")??void 0:void 0;if(e!==this.observedTagsContainer){if(this.observedTagsContainer&&(this.resizeController.unobserve(this.observedTagsContainer),this.observedTagsContainer=void 0),e)return this.resizeController.observe(e),void(this.observedTagsContainer=e);this.chipFittingEnabled||this.destroyChipFit()}else this.chipFittingEnabled||this.destroyChipFit()}calculateTotalWidthOfTags(){this.chipFittingEnabled&&(this.chipFitFrame&&cancelAnimationFrame(this.chipFitFrame),this.chipFitFrame=requestAnimationFrame((()=>{this.chipFitFrame=0,this.layoutChips()})))}allocateChipWidths(e,t){const i=this.chipMinWidth,n=this.chipMaxWidth;if(e.reduce(((e,t)=>e+t),0)<=t)return e.slice();if(!this.showTooltip)return null;const o=e.map((e=>Math.min(e,n)));if(o.reduce(((e,t)=>e+t),0)<=t)return o;const r=new Array(e.length).fill(0);let s=o.map(((e,t)=>t)),a=t;for(;0!==s.length;){const e=a/s.length,t=s.filter((t=>o[t]<=e));if(0===t.length)break;for(const e of t)r[e]=o[e],a-=o[e];s=s.filter((t=>o[t]>e))}if(s.length>0){const e=a/s.length;if(e<i)return null;const t=Math.floor(e);for(const e of s)r[e]=t}return r}computeChipFit(e,t,i,n){const o=e.length;if(0===o)return{visibleCount:0,widths:[],hiddenCount:0};for(let r=o;r>=1;r--){const s=o-r,a=t-(s>0?i+n:0)-n*(r-1);if(a<=0)continue;const l=this.allocateChipWidths(e.slice(0,r),a);if(l)return{visibleCount:r,widths:l,hiddenCount:s}}const r=t-i-n;return{visibleCount:1,widths:[Math.max(0,Math.min(e[0],this.showTooltip?Math.max(this.chipMinWidth,r):r))],hiddenCount:o-1}}layoutChips(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector(".select__tags");if(!t)return;const i=Array.from(t.querySelectorAll("nile-tag"));if(0===i.length)return void(this.hiddenChipCount=0);const n=t.querySelector(".select__tags-count");for(const e of i)e.style.display="",e.style.width="auto",e.style.maxWidth="none",e.style.minWidth="0",e.style.flex="0 0 auto";const o=i.map((e=>Math.ceil(e.getBoundingClientRect().width))),r=n?Math.ceil(n.getBoundingClientRect().width):this.lastOverflowWidth;n&&(this.lastOverflowWidth=r);const s=getComputedStyle(t),a=parseFloat(s.columnGap||s.gap||"0")||0,l=this.computeChipFit(o,t.clientWidth,r,a);i.forEach(((e,t)=>{if(t<l.visibleCount){const i=Math.min(o[t],Math.max(l.widths[t],this.chipMinWidth));e.style.display="",e.style.width=`${i}px`,e.style.maxWidth=`${i}px`,e.style.flex="0 0 auto"}else e.style.display="none"})),this.lastChipLayout.hidden===l.hiddenCount&&this.lastChipLayout.visible===l.visibleCount||(this.lastChipLayout={hidden:l.hiddenCount,visible:l.visibleCount},this.hiddenChipCount=l.hiddenCount),this.refreshClippedChips()}isChipClipped(e){if(!e)return!1;const t=e.shadowRoot;if(t){const e=t.querySelector('[part="content"]');if(e&&e.scrollWidth>e.clientWidth+1)return!0;const i=t.querySelector('[part="prefix_content_wrapper"]');if(i&&i.scrollWidth>i.clientWidth+1)return!0}return e.scrollWidth>e.clientWidth+1}refreshClippedChips(){if(!this.multiple)return;const e=this.shadowRoot;if(!e)return;const t=Array.from(e.querySelectorAll(".select__tags nile-tag")).map((e=>this.isChipClipped(e))),i=t.length===this.clippedChips.length&&t.every(((e,t)=>e===this.clippedChips[t]));i||(this.clippedChips=t)}scheduleClipCheck(){this.clipFrame&&cancelAnimationFrame(this.clipFrame),this.clipFrame=requestAnimationFrame((()=>{this.clipFrame=0,this.refreshClippedChips()}))}chipTooltipDisabled(e){return!this.showTooltip||!this.clippedChips[e]}destroyChipFit(){this.chipFitFrame&&cancelAnimationFrame(this.chipFitFrame),this.chipFitFrame=0,this.clipFrame&&cancelAnimationFrame(this.clipFrame),this.clipFrame=0,this.lastChipLayout={hidden:-1,visible:-1}}getChipLabel(e){return(e.getTextLabel?.()??"").trim()}handleChipKeyDown(e,t){if(e.key!==gt.BACKSPACE&&e.key!==gt.DELETE)return;if(this.disabled)return;e.preventDefault(),e.stopPropagation();const i=this.selectedOptions.indexOf(t);this.handleTagRemove(new CustomEvent("nile-remove"),t),this.restoreFocusAfterChipRemoval(i)}async restoreFocusAfterChipRemoval(e){if(e<0)return;await this.updateComplete,await new Promise((e=>requestAnimationFrame((()=>e()))));const t=Array.from(this.shadowRoot?.querySelectorAll(".select__tags nile-tag")??[]).filter((e=>"none"!==e.style.display)),i=t[e]??t[t.length-1];i?i.focus({preventScroll:!0}):this.displayInput?.focus({preventScroll:!0})}handleOverflowActivate(e){e.preventDefault(),e.stopPropagation(),this.disabled||(this.open=!this.open)}handleOverflowKeyDown(e){e.key!==gt.ENTER&&e.key!==gt.SPACE||this.handleOverflowActivate(e)}async resetScrollPosition(){await this.portalManager.resetScrollPosition()}};ta.styles=Ts,e([pe(".select")],ta.prototype,"popup",void 0),e([pe(".select__combobox")],ta.prototype,"combobox",void 0),e([pe(".select__display-input")],ta.prototype,"displayInput",void 0),e([pe(".select__value-input")],ta.prototype,"valueInput",void 0),e([pe(".virtualized")],ta.prototype,"virtualizedContainer",void 0),e([he()],ta.prototype,"hasFocus",void 0),e([he()],ta.prototype,"displayLabel",void 0),e([he()],ta.prototype,"selectedOptions",void 0),e([he()],ta.prototype,"oldValue",void 0),e([de()],ta.prototype,"name",void 0),e([de({type:Array})],ta.prototype,"data",void 0),e([he()],ta.prototype,"originalOptionItems",void 0),e([de({converter:{fromAttribute:e=>e.split(" "),toAttribute:e=>e.join(" ")}})],ta.prototype,"value",void 0),e([et()],ta.prototype,"defaultValue",void 0),e([de()],ta.prototype,"size",void 0),e([de()],ta.prototype,"placeholder",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],ta.prototype,"autoResize",void 0),e([he()],ta.prototype,"searchValue",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"searchEnabled",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"enableVisibilityEffect",void 0),e([de({attribute:"internal-search-placeholder"})],ta.prototype,"internalSearchPlaceHolder",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"disableLocalSearch",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"optionsLoading",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"loading",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"multiple",void 0),e([de({attribute:"help-text",reflect:!0})],ta.prototype,"helpText",void 0),e([de({attribute:"error-message",reflect:!0})],ta.prototype,"errorMessage",void 0),e([de({type:Boolean})],ta.prototype,"warning",void 0),e([de({type:Boolean})],ta.prototype,"error",void 0),e([de({type:Boolean})],ta.prototype,"success",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"disabled",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"clearable",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"open",void 0),e([de({type:Boolean})],ta.prototype,"hoist",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"filled",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"pill",void 0),e([de()],ta.prototype,"label",void 0),e([de({reflect:!0})],ta.prototype,"placement",void 0),e([de({reflect:!0})],ta.prototype,"form",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"required",void 0),e([de({type:Boolean})],ta.prototype,"showNoResults",void 0),e([de({type:String})],ta.prototype,"noResultsMessage",void 0),e([de({type:Boolean})],ta.prototype,"showSelected",void 0),e([de({attribute:!1})],ta.prototype,"renderItemConfig",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"blockValueChange",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"noWidthSync",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"portal",void 0),e([de({attribute:"max-options-visible",type:Number})],ta.prototype,"maxOptionsVisible",null),e([de({type:Number,reflect:!0,attribute:!0})],ta.prototype,"chipMinWidth",void 0),e([de({type:Number,reflect:!0,attribute:!0})],ta.prototype,"chipMaxWidth",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],ta.prototype,"showTooltip",void 0),e([he()],ta.prototype,"hiddenChipCount",void 0),e([he()],ta.prototype,"clippedChips",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"enableTabClose",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"descriptionSearchEnabled",void 0),e([de({type:Boolean,reflect:!0,attribute:!0,converter:{fromAttribute:e=>"true"===e,toAttribute:e=>String(e)}})],ta.prototype,"allowHtmlLabel",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"enableDescription",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"legacy",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"tickOnSelect",void 0),e([he()],ta.prototype,"showListbox",void 0),e([he()],ta.prototype,"wasShowSelectedCheckedOnClose",void 0),e([Ve("disabled",{waitUntilFirstUpdate:!0})],ta.prototype,"handleDisabledChange",null),e([Ve("value",{waitUntilFirstUpdate:!0})],ta.prototype,"handleValueChange",null),e([Ve("data",{waitUntilFirstUpdate:!0})],ta.prototype,"handleDataChange",null),e([Ve("renderItemConfig",{waitUntilFirstUpdate:!0})],ta.prototype,"handleRenderItemConfigChange",null),e([Ve("optionsLoading",{waitUntilFirstUpdate:!0})],ta.prototype,"handleOptionsLoadingChange",null),e([Ve("portal",{waitUntilFirstUpdate:!0})],ta.prototype,"handlePortalAppendChange",null),e([Ve("open",{waitUntilFirstUpdate:!0})],ta.prototype,"handleOpenChange",null),ta=e([ce("nile-virtual-select")],ta),Rt("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),Rt("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});class ia{constructor(e){this.component=e}renderVirtualizedContent(){const e=this.component;return R`
6784
+ `}getVirtualizedContent(){return Gs.getVirtualizedContent(this.data,this.searchEnabled,this.getDisplayText.bind(this),this.value,this.multiple,this.renderItemConfig?.getDisplayText,this.renderItemConfig?.getValue,this.renderItemConfig?.getDescription,this.renderItemConfig?.getPrefix,this.renderItemConfig?.getSuffix,this.showNoResults,this.noResultsMessage,this.optionsLoading||this.loading,this.handleScroll.bind(this),this.allowHtmlLabel,this.enableDescription,this.tickOnSelect,this.legacy)}nileInput(e){this.emit("nile-input",e)}nileChange(e){this.emit("nile-change",e)}updateValidity(){this.updateComplete.then((()=>{this.formControlController.updateValidity()}))}setupResizeObserver(){const e=this.autoResize&&(this.chipFittingEnabled||this.legacyTagFitEnabled)?this.shadowRoot?.querySelector(".select__tags")??void 0:void 0;if(e!==this.observedTagsContainer){if(this.observedTagsContainer&&(this.resizeController.unobserve(this.observedTagsContainer),this.observedTagsContainer=void 0),e)return this.resizeController.observe(e),void(this.observedTagsContainer=e);this.chipFittingEnabled||this.destroyChipFit()}else this.chipFittingEnabled||this.destroyChipFit()}calculateTotalWidthOfTags(){this.legacyTagFitEnabled?this.fitTagsLegacy():this.chipFittingEnabled&&(this.chipFitFrame&&cancelAnimationFrame(this.chipFitFrame),this.chipFitFrame=requestAnimationFrame((()=>{this.chipFitFrame=0,this.layoutChips()})))}calculateWidthOfSelectTagsDiv(){if(this.shadowRoot){const e=this.shadowRoot.querySelector(".select__tags");if(e){return e.offsetWidth-70}}return null}fitTagsLegacy(){this.maxOptionsVisible!==1/0&&(this.oldMaxOptionsVisible=this.maxOptionsVisible),this.setFittedMaxOptionsVisible(1/0),setTimeout((()=>{const 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,n=0;for(let o=0;o<e.length;o++)if(i+=e[o],i>t){n=o;break}this.setFittedMaxOptionsVisible(n)}),1)}allocateChipWidths(e,t){const i=this.chipMinWidth,n=this.chipMaxWidth;if(e.reduce(((e,t)=>e+t),0)<=t)return e.slice();if(!this.showTooltip)return null;const o=e.map((e=>Math.min(e,n)));if(o.reduce(((e,t)=>e+t),0)<=t)return o;const r=new Array(e.length).fill(0);let s=o.map(((e,t)=>t)),a=t;for(;0!==s.length;){const e=a/s.length,t=s.filter((t=>o[t]<=e));if(0===t.length)break;for(const e of t)r[e]=o[e],a-=o[e];s=s.filter((t=>o[t]>e))}if(s.length>0){const e=a/s.length;if(e<i)return null;const t=Math.floor(e);for(const e of s)r[e]=t}return r}computeChipFit(e,t,i,n){const o=e.length;if(0===o)return{visibleCount:0,widths:[],hiddenCount:0};for(let r=o;r>=1;r--){const s=o-r,a=t-(s>0?i+n:0)-n*(r-1);if(a<=0)continue;const l=this.allocateChipWidths(e.slice(0,r),a);if(l)return{visibleCount:r,widths:l,hiddenCount:s}}const r=t-i-n;return{visibleCount:1,widths:[Math.max(0,Math.min(e[0],this.showTooltip?Math.max(this.chipMinWidth,r):r))],hiddenCount:o-1}}layoutChips(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector(".select__tags");if(!t)return;const i=Array.from(t.querySelectorAll("nile-tag"));if(0===i.length)return void(this.hiddenChipCount=0);const n=t.querySelector(".select__tags-count");for(const e of i)e.style.display="",e.style.width="auto",e.style.maxWidth="none",e.style.minWidth="0",e.style.flex="0 0 auto";const o=i.map((e=>Math.ceil(e.getBoundingClientRect().width))),r=n?Math.ceil(n.getBoundingClientRect().width):this.lastOverflowWidth;n&&(this.lastOverflowWidth=r);const s=getComputedStyle(t),a=parseFloat(s.columnGap||s.gap||"0")||0,l=this.computeChipFit(o,t.clientWidth,r,a);i.forEach(((e,t)=>{if(t<l.visibleCount){const i=Math.min(o[t],Math.max(l.widths[t],this.chipMinWidth));e.style.display="",e.style.width=`${i}px`,e.style.maxWidth=`${i}px`,e.style.flex="0 0 auto"}else e.style.display="none"})),this.lastChipLayout.hidden===l.hiddenCount&&this.lastChipLayout.visible===l.visibleCount||(this.lastChipLayout={hidden:l.hiddenCount,visible:l.visibleCount},this.hiddenChipCount=l.hiddenCount),this.refreshClippedChips()}labelOverflows(e){let t=1/0,i=-1/0;const n=document.createRange();for(const o of e.assignedNodes({flatten:!0})){let e;if(o.nodeType===Node.TEXT_NODE){if(!o.textContent?.trim())continue;n.selectNodeContents(o),e=n.getBoundingClientRect()}else{if(!(o instanceof Element))continue;e=o.getBoundingClientRect()}0!==e.width&&(t=Math.min(t,e.left),i=Math.max(i,e.right))}if(i<t)return!1;const o=e.getBoundingClientRect(),r=getComputedStyle(e),s=o.left+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingLeft),a=1/64;return i>o.right-parseFloat(r.borderRightWidth)-parseFloat(r.paddingRight)+a||t<s-a}isChipClipped(e){if(!e)return!1;const t=e.shadowRoot;if(t){const e=t.querySelector('[part="content"]');if(e&&this.labelOverflows(e))return!0;const i=t.querySelector('[part="prefix_content_wrapper"]');if(i&&i.scrollWidth>i.clientWidth+1)return!0}return e.scrollWidth>e.clientWidth+1}refreshClippedChips(){if(!this.multiple)return;const e=this.shadowRoot;if(!e)return;const t=Array.from(e.querySelectorAll(".select__tags nile-tag")).map((e=>this.isChipClipped(e))),i=t.length===this.clippedChips.length&&t.every(((e,t)=>e===this.clippedChips[t]));i||(this.clippedChips=t)}scheduleClipCheck(){this.clipFrame&&cancelAnimationFrame(this.clipFrame),this.clipFrame=requestAnimationFrame((()=>{this.clipFrame=0,this.refreshClippedChips()}))}chipTooltipDisabled(e){return!this.showTooltip||!this.clippedChips[e]}destroyChipFit(){this.chipFitFrame&&cancelAnimationFrame(this.chipFitFrame),this.chipFitFrame=0,this.clipFrame&&cancelAnimationFrame(this.clipFrame),this.clipFrame=0,this.lastChipLayout={hidden:-1,visible:-1}}getChipLabel(e){return(e.getTextLabel?.()??"").trim()}handleChipKeyDown(e,t){if(e.key!==gt.BACKSPACE&&e.key!==gt.DELETE)return;if(this.disabled)return;e.preventDefault(),e.stopPropagation();const i=this.selectedOptions.indexOf(t);this.handleTagRemove(new CustomEvent("nile-remove"),t),this.restoreFocusAfterChipRemoval(i)}async restoreFocusAfterChipRemoval(e){if(e<0)return;await this.updateComplete,await new Promise((e=>requestAnimationFrame((()=>e()))));const t=Array.from(this.shadowRoot?.querySelectorAll(".select__tags nile-tag")??[]).filter((e=>"none"!==e.style.display)),i=t[e]??t[t.length-1];i?i.focus({preventScroll:!0}):this.displayInput?.focus({preventScroll:!0})}handleOverflowActivate(e){e.preventDefault(),e.stopPropagation(),this.disabled||(this.open=!this.open)}handleOverflowKeyDown(e){e.key!==gt.ENTER&&e.key!==gt.SPACE||this.handleOverflowActivate(e)}async resetScrollPosition(){await this.portalManager.resetScrollPosition()}};ta.styles=Ts,e([pe(".select")],ta.prototype,"popup",void 0),e([pe(".select__combobox")],ta.prototype,"combobox",void 0),e([pe(".select__display-input")],ta.prototype,"displayInput",void 0),e([pe(".select__value-input")],ta.prototype,"valueInput",void 0),e([pe(".virtualized")],ta.prototype,"virtualizedContainer",void 0),e([he()],ta.prototype,"hasFocus",void 0),e([he()],ta.prototype,"displayLabel",void 0),e([he()],ta.prototype,"selectedOptions",void 0),e([he()],ta.prototype,"oldValue",void 0),e([de()],ta.prototype,"name",void 0),e([de({type:Array})],ta.prototype,"data",void 0),e([he()],ta.prototype,"originalOptionItems",void 0),e([de({converter:{fromAttribute:e=>e.split(" "),toAttribute:e=>e.join(" ")}})],ta.prototype,"value",void 0),e([et()],ta.prototype,"defaultValue",void 0),e([de()],ta.prototype,"size",void 0),e([de()],ta.prototype,"placeholder",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],ta.prototype,"autoResize",void 0),e([he()],ta.prototype,"searchValue",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"searchEnabled",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"enableVisibilityEffect",void 0),e([de({attribute:"internal-search-placeholder"})],ta.prototype,"internalSearchPlaceHolder",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"disableLocalSearch",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"optionsLoading",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"loading",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"multiple",void 0),e([de({attribute:"help-text",reflect:!0})],ta.prototype,"helpText",void 0),e([de({attribute:"error-message",reflect:!0})],ta.prototype,"errorMessage",void 0),e([de({type:Boolean})],ta.prototype,"warning",void 0),e([de({type:Boolean})],ta.prototype,"error",void 0),e([de({type:Boolean})],ta.prototype,"success",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"disabled",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"clearable",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"open",void 0),e([de({type:Boolean})],ta.prototype,"hoist",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"filled",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"pill",void 0),e([de()],ta.prototype,"label",void 0),e([de({reflect:!0})],ta.prototype,"placement",void 0),e([de({reflect:!0})],ta.prototype,"form",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"required",void 0),e([de({type:Boolean})],ta.prototype,"showNoResults",void 0),e([de({type:String})],ta.prototype,"noResultsMessage",void 0),e([de({type:Boolean})],ta.prototype,"showSelected",void 0),e([de({attribute:!1})],ta.prototype,"renderItemConfig",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"blockValueChange",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"noWidthSync",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"portal",void 0),e([de({attribute:"max-options-visible",type:Number})],ta.prototype,"maxOptionsVisible",null),e([de({type:Number,attribute:!0})],ta.prototype,"chipMinWidth",void 0),e([de({type:Number,attribute:!0})],ta.prototype,"chipMaxWidth",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],ta.prototype,"showTooltip",void 0),e([he()],ta.prototype,"hiddenChipCount",void 0),e([he()],ta.prototype,"oldMaxOptionsVisible",void 0),e([he()],ta.prototype,"clippedChips",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"enableTabClose",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"descriptionSearchEnabled",void 0),e([de({type:Boolean,reflect:!0,attribute:!0,converter:{fromAttribute:e=>"true"===e,toAttribute:e=>String(e)}})],ta.prototype,"allowHtmlLabel",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"enableDescription",void 0),e([de({type:Boolean,reflect:!0})],ta.prototype,"legacy",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],ta.prototype,"tickOnSelect",void 0),e([he()],ta.prototype,"showListbox",void 0),e([he()],ta.prototype,"wasShowSelectedCheckedOnClose",void 0),e([Ve("disabled",{waitUntilFirstUpdate:!0})],ta.prototype,"handleDisabledChange",null),e([Ve("value",{waitUntilFirstUpdate:!0})],ta.prototype,"handleValueChange",null),e([Ve("data",{waitUntilFirstUpdate:!0})],ta.prototype,"handleDataChange",null),e([Ve("renderItemConfig",{waitUntilFirstUpdate:!0})],ta.prototype,"handleRenderItemConfigChange",null),e([Ve("optionsLoading",{waitUntilFirstUpdate:!0})],ta.prototype,"handleOptionsLoadingChange",null),e([Ve("portal",{waitUntilFirstUpdate:!0})],ta.prototype,"handlePortalAppendChange",null),e([Ve("open",{waitUntilFirstUpdate:!0})],ta.prototype,"handleOpenChange",null),ta=e([ce("nile-virtual-select")],ta),Rt("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),Rt("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});class ia{constructor(e){this.component=e}renderVirtualizedContent(){const e=this.component;return R`
6795
6785
  <div class="virtual-select">
6796
6786
  <nile-virtual-select
6797
6787
  .name=${e.name}
@@ -6837,6 +6827,8 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
6837
6827
  .enableDescription=${e.enableDescription}
6838
6828
  .tickOnSelect=${e.tickOnSelect}
6839
6829
  .legacy=${e.legacy}
6830
+ @nile-input=${t=>e.syncValueFromVirtualSelect(t)}
6831
+ @nile-change=${t=>e.syncValueFromVirtualSelect(t)}
6840
6832
  exportparts="
6841
6833
  select-options,
6842
6834
  select-no-results,
@@ -6870,9 +6862,9 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
6870
6862
  <slot name="prefix" slot="prefix"></slot>
6871
6863
  </nile-virtual-select>
6872
6864
  </div>
6873
- `}}class na{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:n,placement:o,middlewareData:r}=await this.calculateFloatingUIPosition(e,t);this.applyFloatingUIPosition(t,e,i,n,o,r)}catch(e){console.warn("Floating UI positioning failed, falling back to simple positioning:",e),this.fallbackPositioning()}}async calculateFloatingUIPosition(e,t){const i=Hs.findBoundaryElements(e),n=Hs.getOptimalPlacement(e),o=this.createFloatingUIMiddleware(i);return await zn(e,t,{placement:n,strategy:"fixed",middleware:o,platform:this.createCustomPlatform()})}createFloatingUIMiddleware(e){return[pn(4),In({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:e}),yn({fallbackPlacements:["bottom","top","bottom-start","top-start","bottom-end","top-end"],fallbackStrategy:"bestFit",padding:10,boundary:e}),Dn({padding:10,crossAxis:!0,boundary:e})]}handleSizeMiddleware({availableWidth:e,availableHeight:t,elements:i,rects:n}){const o=Hs.calculateOptimalHeight(n.reference,window.innerHeight,this.currentPlacement);i.floating.style.maxWidth=`${e}px`,i.floating.style.maxHeight=`${o}px`,i.floating.style.setProperty("--auto-size-available-width",`${e}px`),i.floating.style.setProperty("--auto-size-available-height",`${o}px`)}createCustomPlatform(){return dn}applyFloatingUIPosition(e,t,i,n,o,r){Object.assign(e.style,{left:`${i}px`,top:`${n}px`,position:"fixed",pointerEvents:"auto"}),this.currentPlacement=o,this.currentMiddlewareData=r,Hs.applyCollisionData(e,r,o);const s=o.split("-")[0];e.className=`nile-select-portal-append select__listbox--${s}`;const a=t.getBoundingClientRect();e.style.width=`${a.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,n=e.top;let o,r,s;n>i?(s=Math.max(n-20,100),o=Math.max(e.top-s-4,10),r="top"):(s=Math.max(i-20,100),o=e.bottom+4,r="bottom"),this.portalContainer.style.left=`${e.left}px`,this.portalContainer.style.top=`${o}px`,this.portalContainer.style.width=`${e.width}px`,this.portalContainer.style.maxHeight=`${s}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.className=`nile-select-portal-append select__listbox--${r}`,this.calculateAndSetAutoSizeProperties(e,o,r)}calculateAndSetAutoSizeProperties(e,t,i){if(!this.portalContainer)return;const n=window.innerHeight,o=window.innerWidth;let r;r="top"===i?e.top-10:n-e.bottom-10;const s=Math.min(e.width,o-e.left-10);this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(r,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(s,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=Nn(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=Hs.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=Hs.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 Js.createPortalListbox(this.component)}setupPortalEventListeners(){Xs.setupPortalEventListeners(this.clonedListbox,this.component)}updatePortalContent(){this.clonedListbox&&(Js.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,n=this.currentPlacement.startsWith("top"),o=this.currentPlacement.startsWith("bottom");return!(n&&t>i)&&!(o&&i>t)}}let oa=class extends Fe{get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(e){const t=this._maxOptionsVisible;this._maxOptionsVisible=e,this.maxOptionsVisibleExplicit=!0,this.requestUpdate("maxOptionsVisible",t)}get chipFittingEnabled(){return!!this.multiple&&!this.maxOptionsVisibleExplicit}get validity(){return this.valueInput?.validity}get validationMessage(){return this.valueInput?.validationMessage}constructor(){super(),this.portalManager=new na(this),this.hasSlotController=new Ze(this,"help-text","label","pre-footer"),this.typeToSelectString="",this.scrolling=!1,this.options=[],this.resizeController=new Ks(this,{callback:e=>{for(const t of e)t.target.classList.contains("select__tags")&&this.calculateTotalWidthOfTags()}}),this.chipFitFrame=0,this.lastChipLayout={hidden:-1,visible:-1},this.clippedChips=[],this.clipFrame=0,this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.oldValue="",this.hiddenChipCount=0,this.lastOverflowWidth=0,this.name="",this.value="",this.defaultValue="",this.size="medium",this.placeholder="Select...",this.searchValue="",this.searchEnabled=!1,this.legacy=!1,this.tickOnSelect=!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.maxOptionsVisibleExplicit=!1,this.chipMinWidth=110,this.chipMaxWidth=180,this.showTooltip=!1,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.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.descriptionSearchEnabled=!1,this.enableDescription=!1,this.allowHtmlLabel=!0,this.handleWindowResize=()=>{this.portalManager.updatePortalAppendPosition()},this.handleWindowScroll=()=>{this.portalManager.updatePortalAppendPosition()}}connectedCallback(){super.connectedCallback(),this.enableVirtualScroll||(this.formControlController=new Ue(this,{assumeInteractionOn:["nile-blur","nile-input"]})),this.virtualScrollHelper=new ia(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.destroyChipFit(),this.emit("nile-destroy")}setupResizeObserver(){const e=this.autoResize&&this.chipFittingEnabled?this.shadowRoot?.querySelector(".select__tags")??void 0:void 0;if(e!==this.observedTagsContainer){if(this.observedTagsContainer&&(this.resizeController.unobserve(this.observedTagsContainer),this.observedTagsContainer=void 0),e)return this.resizeController.observe(e),void(this.observedTagsContainer=e);this.chipFittingEnabled||this.destroyChipFit()}else this.chipFittingEnabled||this.destroyChipFit()}syncVirtualSelectMaxOptionsVisible(){if(!this.enableVirtualScroll||!this.maxOptionsVisibleExplicit)return;const e=this.shadowRoot?.querySelector("nile-virtual-select");e&&e.maxOptionsVisible!==this._maxOptionsVisible&&(e.maxOptionsVisible=this._maxOptionsVisible)}updated(e){e.has("searchEnabled")&&this.updateGroupStickyOffsets(),e.has("multiple")&&this.setCheckBoxInOption(this.multiple),e.has("legacy")&&this.setLegacyInOptions(this.legacy),e.has("tickOnSelect")&&this.setTickOnSelectInOptions(this.tickOnSelect),(e.has("autoResize")||e.has("multiple")||e.has("maxOptionsVisible"))&&this.setupResizeObserver(),this.syncVirtualSelectMaxOptionsVisible(),e.has("enableDescription")&&this.setEnableDescriptionInOptions(),(e.has("chipMinWidth")||e.has("chipMaxWidth"))&&this.destroyChipFit(),this.chipFittingEnabled&&this.calculateTotalWidthOfTags(),this.multiple&&this.showTooltip&&this.scheduleClipCheck()}firstUpdated(e){this.enableGroupHeader&&(this.disableLocalSearch||this.handleGroupSearchChange(),this.applyStickyToGroups()),this.setupResizeObserver(),e.has("multiple")&&this.setCheckBoxInOption(this.multiple),this.setLegacyInOptions(this.legacy),this.setTickOnSelectInOptions(this.tickOnSelect),e.has("enableDescription")&&this.setEnableDescriptionInOptions(),this.visibilityManager=new fn({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}))}setLegacyInOptions(e){this.options.length||(this.options=this.getAllOptions()),this.options.forEach((t=>{t.legacy=e}))}setTickOnSelectInOptions(e){this.options.length||(this.options=this.getAllOptions()),this.options.forEach((t=>{t.tickOnSelect=e}))}setEnableDescriptionInOptions(){this.options=this.getAllOptions(),this.options.forEach((e=>{(e?.updateComplete??Promise.resolve()).then((()=>{e.isDescriptionEnabled=this.enableDescription})).catch((()=>{}))}))}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),n=this.popup&&t.includes(this.popup),o=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||n||o||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()}handlePreFooterClick(){this.hide()}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"),n=null!==t.closest("nile-icon-button");if(!i&&!n){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),n=this.popup&&t.includes(this.popup),o=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||n||o||this.hide()}handleLabelClick(){this.displayInput.focus(),this.hide()}handleComboboxMouseDown(e){const t=e.composedPath(),i=t.some((e=>e instanceof Element&&"nile-icon-button"===e.tagName.toLowerCase())),n=t.some((e=>e instanceof HTMLButtonElement&&e.classList.contains("select__tags-count")));this.disabled||i||n||(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(),this.setEnableDescriptionInOptions()}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),n=this.oldValue.indexOf(t.value);return-1===i&&(i=1/0),-1===n&&(n=1/0),i<n?-1:i>n?1:0})),e}getOptionPrefixNodes(e){const t=e.shadowRoot?.querySelector('slot[name="prefix"]');return t?t.assignedElements().map((e=>e.cloneNode(!0))):[]}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.getAllOptions().length>0&&(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.disableLocalSearch&&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 n=[];return t.forEach((e=>{const t=e.getTextLabel().toLowerCase(),o=(e.value||"").toLowerCase(),r=(e.description||"").toLowerCase(),s=t.includes(i)||o.includes(i)||this.descriptionSearchEnabled&&r.includes(i);e.hidden=!s,s&&n.push(e)})),this.portal&&this.open&&this.portalManager.updatePortalOptions(),n}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 Yt(this),this.listbox.hidden=!1,this.popup.active=!0,requestAnimationFrame((()=>{this.setCurrentOption(this.currentOption)}));const{keyframes:e,options:t}=Wt(this,"select.show",{dir:"ltr"});await Ct(this.popup.popup,e,t),this.currentOption&&Gt(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 Yt(this);const{keyframes:e,options:t}=Wt(this,"select.hide",{dir:"ltr"});await Ct(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,Jt(this,"nile-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,Jt(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()}calculateTotalWidthOfTags(){this.chipFittingEnabled&&(this.chipFitFrame&&cancelAnimationFrame(this.chipFitFrame),this.chipFitFrame=requestAnimationFrame((()=>{this.chipFitFrame=0,this.layoutChips()})))}allocateChipWidths(e,t){const i=this.chipMinWidth,n=this.chipMaxWidth;if(e.reduce(((e,t)=>e+t),0)<=t)return e.slice();if(!this.showTooltip)return null;const o=e.map((e=>Math.min(e,n)));if(o.reduce(((e,t)=>e+t),0)<=t)return o;const r=new Array(e.length).fill(0);let s=o.map(((e,t)=>t)),a=t;for(;0!==s.length;){const e=a/s.length,t=s.filter((t=>o[t]<=e));if(0===t.length)break;for(const e of t)r[e]=o[e],a-=o[e];s=s.filter((t=>o[t]>e))}if(s.length>0){const e=a/s.length;if(e<i)return null;const t=Math.floor(e);for(const e of s)r[e]=t}return r}computeChipFit(e,t,i,n){const o=e.length;if(0===o)return{visibleCount:0,widths:[],hiddenCount:0};for(let r=o;r>=1;r--){const s=o-r,a=t-(s>0?i+n:0)-n*(r-1);if(a<=0)continue;const l=this.allocateChipWidths(e.slice(0,r),a);if(l)return{visibleCount:r,widths:l,hiddenCount:s}}const r=t-i-n;return{visibleCount:1,widths:[Math.max(0,Math.min(e[0],this.showTooltip?Math.max(this.chipMinWidth,r):r))],hiddenCount:o-1}}layoutChips(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector(".select__tags");if(!t)return;const i=Array.from(t.querySelectorAll("nile-tag"));if(0===i.length)return void(this.hiddenChipCount=0);const n=t.querySelector(".select__tags-count");for(const e of i)e.style.display="",e.style.width="auto",e.style.maxWidth="none",e.style.minWidth="0",e.style.flex="0 0 auto";const o=i.map((e=>Math.ceil(e.getBoundingClientRect().width))),r=n?Math.ceil(n.getBoundingClientRect().width):this.lastOverflowWidth;n&&(this.lastOverflowWidth=r);const s=getComputedStyle(t),a=parseFloat(s.columnGap||s.gap||"0")||0,l=this.computeChipFit(o,t.clientWidth,r,a);i.forEach(((e,t)=>{if(t<l.visibleCount){const i=Math.min(o[t],Math.max(l.widths[t],this.chipMinWidth));e.style.display="",e.style.width=`${i}px`,e.style.maxWidth=`${i}px`,e.style.flex="0 0 auto"}else e.style.display="none"})),this.lastChipLayout.hidden===l.hiddenCount&&this.lastChipLayout.visible===l.visibleCount||(this.lastChipLayout={hidden:l.hiddenCount,visible:l.visibleCount},this.hiddenChipCount=l.hiddenCount),this.refreshClippedChips()}isChipClipped(e){if(!e)return!1;const t=e.shadowRoot;if(t){const e=t.querySelector('[part="content"]');if(e&&e.scrollWidth>e.clientWidth+1)return!0;const i=t.querySelector('[part="prefix_content_wrapper"]');if(i&&i.scrollWidth>i.clientWidth+1)return!0}return e.scrollWidth>e.clientWidth+1}refreshClippedChips(){if(!this.multiple)return;const e=this.shadowRoot;if(!e)return;const t=Array.from(e.querySelectorAll(".select__tags nile-tag")).map((e=>this.isChipClipped(e))),i=t.length===this.clippedChips.length&&t.every(((e,t)=>e===this.clippedChips[t]));i||(this.clippedChips=t)}scheduleClipCheck(){this.clipFrame&&cancelAnimationFrame(this.clipFrame),this.clipFrame=requestAnimationFrame((()=>{this.clipFrame=0,this.refreshClippedChips()}))}chipTooltipDisabled(e){return!this.showTooltip||!this.clippedChips[e]}destroyChipFit(){this.chipFitFrame&&cancelAnimationFrame(this.chipFitFrame),this.chipFitFrame=0,this.clipFrame&&cancelAnimationFrame(this.clipFrame),this.clipFrame=0,this.lastChipLayout={hidden:-1,visible:-1}}getChipLabel(e){return(e.getTextLabel?.()??"").trim()}handleChipKeyDown(e,t){if(e.key!==gt.BACKSPACE&&e.key!==gt.DELETE)return;if(this.disabled)return;e.preventDefault(),e.stopPropagation();const i=this.selectedOptions.indexOf(t);this.handleTagRemove(new CustomEvent("nile-remove"),t),this.restoreFocusAfterChipRemoval(i)}async restoreFocusAfterChipRemoval(e){if(e<0)return;await this.updateComplete,await new Promise((e=>requestAnimationFrame((()=>e()))));const t=Array.from(this.shadowRoot?.querySelectorAll(".select__tags nile-tag")??[]).filter((e=>"none"!==e.style.display)),i=t[e]??t[t.length-1];i?i.focus({preventScroll:!0}):this.displayInput?.focus({preventScroll:!0})}handleOverflowActivate(e){e.preventDefault(),e.stopPropagation(),this.disabled||(this.open?this.hide():this.show())}handleOverflowKeyDown(e){e.key!==gt.ENTER&&e.key!==gt.SPACE||this.handleOverflowActivate(e)}renderFittedTags(){return R`
6865
+ `}}class na{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:n,placement:o,middlewareData:r}=await this.calculateFloatingUIPosition(e,t);this.applyFloatingUIPosition(t,e,i,n,o,r)}catch(e){console.warn("Floating UI positioning failed, falling back to simple positioning:",e),this.fallbackPositioning()}}async calculateFloatingUIPosition(e,t){const i=Hs.findBoundaryElements(e),n=Hs.getOptimalPlacement(e),o=this.createFloatingUIMiddleware(i);return await zn(e,t,{placement:n,strategy:"fixed",middleware:o,platform:this.createCustomPlatform()})}createFloatingUIMiddleware(e){return[pn(4),In({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:e}),yn({fallbackPlacements:["bottom","top","bottom-start","top-start","bottom-end","top-end"],fallbackStrategy:"bestFit",padding:10,boundary:e}),Dn({padding:10,crossAxis:!0,boundary:e})]}handleSizeMiddleware({availableWidth:e,availableHeight:t,elements:i,rects:n}){const o=Hs.calculateOptimalHeight(n.reference,window.innerHeight,this.currentPlacement);i.floating.style.maxWidth=`${e}px`,i.floating.style.maxHeight=`${o}px`,i.floating.style.setProperty("--auto-size-available-width",`${e}px`),i.floating.style.setProperty("--auto-size-available-height",`${o}px`)}createCustomPlatform(){return dn}applyFloatingUIPosition(e,t,i,n,o,r){Object.assign(e.style,{left:`${i}px`,top:`${n}px`,position:"fixed",pointerEvents:"auto"}),this.currentPlacement=o,this.currentMiddlewareData=r,Hs.applyCollisionData(e,r,o);const s=o.split("-")[0];e.className=`nile-select-portal-append select__listbox--${s}`;const a=t.getBoundingClientRect();e.style.width=`${a.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,n=e.top;let o,r,s;n>i?(s=Math.max(n-20,100),o=Math.max(e.top-s-4,10),r="top"):(s=Math.max(i-20,100),o=e.bottom+4,r="bottom"),this.portalContainer.style.left=`${e.left}px`,this.portalContainer.style.top=`${o}px`,this.portalContainer.style.width=`${e.width}px`,this.portalContainer.style.maxHeight=`${s}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.className=`nile-select-portal-append select__listbox--${r}`,this.calculateAndSetAutoSizeProperties(e,o,r)}calculateAndSetAutoSizeProperties(e,t,i){if(!this.portalContainer)return;const n=window.innerHeight,o=window.innerWidth;let r;r="top"===i?e.top-10:n-e.bottom-10;const s=Math.min(e.width,o-e.left-10);this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(r,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(s,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=Nn(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=Hs.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=Hs.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 Js.createPortalListbox(this.component)}setupPortalEventListeners(){Xs.setupPortalEventListeners(this.clonedListbox,this.component)}updatePortalContent(){this.clonedListbox&&(Js.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,n=this.currentPlacement.startsWith("top"),o=this.currentPlacement.startsWith("bottom");return!(n&&t>i)&&!(o&&i>t)}}let oa=class extends Fe{get maxOptionsVisible(){return this._maxOptionsVisible}set maxOptionsVisible(e){const t=this._maxOptionsVisible;this._maxOptionsVisible=e,this.maxOptionsVisibleExplicit=!0,this.requestUpdate("maxOptionsVisible",t)}get chipFittingEnabled(){return!!this.multiple&&this.showTooltip&&!this.maxOptionsVisibleExplicit}get legacyTagFitEnabled(){return!!this.multiple&&!this.showTooltip}setFittedMaxOptionsVisible(e){const t=this._maxOptionsVisible;this._maxOptionsVisible=e,this.requestUpdate("maxOptionsVisible",t)}get validity(){return this.valueInput?.validity}get validationMessage(){return this.valueInput?.validationMessage}constructor(){super(),this.portalManager=new na(this),this.hasSlotController=new Ze(this,"help-text","label","pre-footer"),this.typeToSelectString="",this.scrolling=!1,this.options=[],this.resizeController=new Ks(this,{target:null,callback:e=>{for(const t of e)t.target.classList.contains("select__tags")&&this.calculateTotalWidthOfTags()}}),this.chipFitFrame=0,this.lastChipLayout={hidden:-1,visible:-1},this.clippedChips=[],this.clipFrame=0,this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.oldValue="",this.hiddenChipCount=0,this.oldMaxOptionsVisible=1,this.lastOverflowWidth=0,this.name="",this.value="",this.defaultValue="",this.size="medium",this.placeholder="Select...",this.searchValue="",this.searchEnabled=!1,this.legacy=!1,this.tickOnSelect=!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.maxOptionsVisibleExplicit=!1,this.chipMinWidth=110,this.chipMaxWidth=180,this.showTooltip=!1,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.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.descriptionSearchEnabled=!1,this.enableDescription=!1,this.allowHtmlLabel=!0,this.handleWindowResize=()=>{this.portalManager.updatePortalAppendPosition()},this.handleWindowScroll=()=>{this.portalManager.updatePortalAppendPosition()},this.prefixCopies=new WeakMap}connectedCallback(){super.connectedCallback(),this.enableVirtualScroll||(this.formControlController=new Ue(this,{assumeInteractionOn:["nile-blur","nile-input"]})),this.virtualScrollHelper=new ia(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.hasUpdated&&this.chipFittingEnabled&&this.calculateTotalWidthOfTags(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0),this.visibilityManager?.cleanup(),this.portalManager.cleanupPortalAppend(),this.destroyChipFit(),this.emit("nile-destroy")}setupResizeObserver(){const e=this.autoResize&&(this.chipFittingEnabled||this.legacyTagFitEnabled)?this.shadowRoot?.querySelector(".select__tags")??void 0:void 0;if(e!==this.observedTagsContainer){if(this.observedTagsContainer&&(this.resizeController.unobserve(this.observedTagsContainer),this.observedTagsContainer=void 0),e)return this.resizeController.observe(e),void(this.observedTagsContainer=e);this.chipFittingEnabled||this.destroyChipFit()}else this.chipFittingEnabled||this.destroyChipFit()}syncVirtualSelectMaxOptionsVisible(){if(!this.enableVirtualScroll||!this.maxOptionsVisibleExplicit)return;const e=this.shadowRoot?.querySelector("nile-virtual-select");e&&e.maxOptionsVisible!==this._maxOptionsVisible&&(e.maxOptionsVisible=this._maxOptionsVisible)}syncValueFromVirtualSelect(e){e.composedPath()[0]===e.currentTarget&&e.detail&&"value"in e.detail&&(this.value=e.detail.value??(this.multiple?[]:""))}updated(e){e.has("searchEnabled")&&this.updateGroupStickyOffsets(),e.has("multiple")&&this.setCheckBoxInOption(this.multiple),e.has("legacy")&&this.setLegacyInOptions(this.legacy),e.has("tickOnSelect")&&this.setTickOnSelectInOptions(this.tickOnSelect),(e.has("autoResize")||e.has("multiple")||e.has("maxOptionsVisible")||e.has("showTooltip"))&&this.setupResizeObserver(),e.has("showTooltip")&&void 0!==e.get("showTooltip")&&this.legacyTagFitEnabled&&this.calculateTotalWidthOfTags(),this.syncVirtualSelectMaxOptionsVisible(),e.has("enableDescription")&&this.setEnableDescriptionInOptions(),(e.has("chipMinWidth")||e.has("chipMaxWidth"))&&this.destroyChipFit(),this.chipFittingEnabled&&this.calculateTotalWidthOfTags(),this.multiple&&this.showTooltip&&this.scheduleClipCheck()}firstUpdated(e){this.enableGroupHeader&&(this.disableLocalSearch||this.handleGroupSearchChange(),this.applyStickyToGroups()),this.setupResizeObserver(),e.has("multiple")&&this.setCheckBoxInOption(this.multiple),this.setLegacyInOptions(this.legacy),this.setTickOnSelectInOptions(this.tickOnSelect),e.has("enableDescription")&&this.setEnableDescriptionInOptions(),this.visibilityManager=new fn({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}))}setLegacyInOptions(e){this.options.length||(this.options=this.getAllOptions()),this.options.forEach((t=>{t.legacy=e}))}setTickOnSelectInOptions(e){this.options.length||(this.options=this.getAllOptions()),this.options.forEach((t=>{t.tickOnSelect=e}))}setEnableDescriptionInOptions(){this.options=this.getAllOptions(),this.options.forEach((e=>{(e?.updateComplete??Promise.resolve()).then((()=>{e.isDescriptionEnabled=this.enableDescription})).catch((()=>{}))}))}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),n=this.popup&&t.includes(this.popup),o=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||n||o||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()}handlePreFooterClick(){this.hide()}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"),n=null!==t.closest("nile-icon-button");if(!i&&!n){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),n=this.popup&&t.includes(this.popup),o=this.portal&&this.portalManager.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||n||o||this.hide()}handleLabelClick(){this.displayInput.focus(),this.hide()}handleComboboxMouseDown(e){const t=e.composedPath(),i=t.some((e=>e instanceof Element&&"nile-icon-button"===e.tagName.toLowerCase())),n=t.some((e=>e instanceof HTMLButtonElement&&e.classList.contains("select__tags-count")));this.disabled||i||n||(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(),this.setEnableDescriptionInOptions()}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),n=this.oldValue.indexOf(t.value);return-1===i&&(i=1/0),-1===n&&(n=1/0),i<n?-1:i>n?1:0})),e}getOptionPrefixNodes(e,t){const i=e.shadowRoot?.querySelector('slot[name="prefix"]');if(!i)return[];const n=i.assignedElements(),o=n.map((e=>e.outerHTML)).join("");let r=this.prefixCopies.get(e);r||(r=new Map,this.prefixCopies.set(e,r));const s=r.get(t);if(s&&s.markup===o)return s.nodes;const a=n.map((e=>e.cloneNode(!0)));return r.set(t,{markup:o,nodes:a}),a}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.getAllOptions().length>0&&(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.disableLocalSearch&&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 n=[];return t.forEach((e=>{const t=e.getTextLabel().toLowerCase(),o=(e.value||"").toLowerCase(),r=(e.description||"").toLowerCase(),s=t.includes(i)||o.includes(i)||this.descriptionSearchEnabled&&r.includes(i);e.hidden=!s,s&&n.push(e)})),this.portal&&this.open&&this.portalManager.updatePortalOptions(),n}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 Yt(this),this.listbox.hidden=!1,this.popup.active=!0,requestAnimationFrame((()=>{this.setCurrentOption(this.currentOption)}));const{keyframes:e,options:t}=Wt(this,"select.show",{dir:"ltr"});await Ct(this.popup.popup,e,t),this.currentOption&&Gt(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 Yt(this);const{keyframes:e,options:t}=Wt(this,"select.hide",{dir:"ltr"});await Ct(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,Jt(this,"nile-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,Jt(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()}calculateTotalWidthOfTags(){this.legacyTagFitEnabled?this.fitTagsLegacy():this.chipFittingEnabled&&(this.chipFitFrame&&cancelAnimationFrame(this.chipFitFrame),this.chipFitFrame=requestAnimationFrame((()=>{this.chipFitFrame=0,this.layoutChips()})))}calculateWidthOfSelectTagsDiv(){if(this.shadowRoot){const e=this.shadowRoot.querySelector("div.select__tags");if(e instanceof HTMLElement){return e.offsetWidth-70}}}fitTagsLegacy(){this.maxOptionsVisible!==1/0&&(this.oldMaxOptionsVisible=this.maxOptionsVisible),this.setFittedMaxOptionsVisible(1/0),setTimeout((()=>{const 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,n=0;for(let o=0;o<e.length;o++)if(i+=e[o],i>t){n=o;break}this.setFittedMaxOptionsVisible(n)}),1)}allocateChipWidths(e,t){const i=this.chipMinWidth,n=this.chipMaxWidth;if(e.reduce(((e,t)=>e+t),0)<=t)return e.slice();if(!this.showTooltip)return null;const o=e.map((e=>Math.min(e,n)));if(o.reduce(((e,t)=>e+t),0)<=t)return o;const r=new Array(e.length).fill(0);let s=o.map(((e,t)=>t)),a=t;for(;0!==s.length;){const e=a/s.length,t=s.filter((t=>o[t]<=e));if(0===t.length)break;for(const e of t)r[e]=o[e],a-=o[e];s=s.filter((t=>o[t]>e))}if(s.length>0){const e=a/s.length;if(e<i)return null;const t=Math.floor(e);for(const e of s)r[e]=t}return r}computeChipFit(e,t,i,n){const o=e.length;if(0===o)return{visibleCount:0,widths:[],hiddenCount:0};for(let r=o;r>=1;r--){const s=o-r,a=t-(s>0?i+n:0)-n*(r-1);if(a<=0)continue;const l=this.allocateChipWidths(e.slice(0,r),a);if(l)return{visibleCount:r,widths:l,hiddenCount:s}}const r=t-i-n;return{visibleCount:1,widths:[Math.max(0,Math.min(e[0],this.showTooltip?Math.max(this.chipMinWidth,r):r))],hiddenCount:o-1}}layoutChips(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector(".select__tags");if(!t)return;const i=Array.from(t.querySelectorAll("nile-tag"));if(0===i.length)return void(this.hiddenChipCount=0);if(0===t.clientWidth)return void this.refitWhenMeasurable(t);this.stopMeasurableWatch();const n=t.querySelector(".select__tags-count");for(const e of i)e.style.display="",e.style.width="auto",e.style.maxWidth="none",e.style.minWidth="0",e.style.flex="0 0 auto";const o=i.map((e=>Math.ceil(e.getBoundingClientRect().width))),r=n?Math.ceil(n.getBoundingClientRect().width):this.lastOverflowWidth;n&&(this.lastOverflowWidth=r);const s=getComputedStyle(t),a=parseFloat(s.columnGap||s.gap||"0")||0,l=this.computeChipFit(o,t.clientWidth,r,a);i.forEach(((e,t)=>{if(t<l.visibleCount){const i=Math.min(o[t],Math.max(l.widths[t],this.chipMinWidth));e.style.display="",e.style.width=`${i}px`,e.style.maxWidth=`${i}px`,e.style.flex="0 0 auto"}else e.style.display="none"})),this.lastChipLayout.hidden===l.hiddenCount&&this.lastChipLayout.visible===l.visibleCount||(this.lastChipLayout={hidden:l.hiddenCount,visible:l.visibleCount},this.hiddenChipCount=l.hiddenCount),this.refreshClippedChips()}labelOverflows(e){let t=1/0,i=-1/0;const n=document.createRange();for(const o of e.assignedNodes({flatten:!0})){let e;if(o.nodeType===Node.TEXT_NODE){if(!o.textContent?.trim())continue;n.selectNodeContents(o),e=n.getBoundingClientRect()}else{if(!(o instanceof Element))continue;e=o.getBoundingClientRect()}0!==e.width&&(t=Math.min(t,e.left),i=Math.max(i,e.right))}if(i<t)return!1;const o=e.getBoundingClientRect(),r=getComputedStyle(e),s=o.left+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingLeft),a=1/64;return i>o.right-parseFloat(r.borderRightWidth)-parseFloat(r.paddingRight)+a||t<s-a}isChipClipped(e){if(!e)return!1;const t=e.shadowRoot;if(t){const e=t.querySelector('[part="content"]');if(e&&this.labelOverflows(e))return!0;const i=t.querySelector('[part="prefix_content_wrapper"]');if(i&&i.scrollWidth>i.clientWidth+1)return!0}return e.scrollWidth>e.clientWidth+1}refreshClippedChips(){if(!this.multiple)return;const e=this.shadowRoot;if(!e)return;const t=Array.from(e.querySelectorAll(".select__tags nile-tag")).map((e=>this.isChipClipped(e))),i=t.length===this.clippedChips.length&&t.every(((e,t)=>e===this.clippedChips[t]));i||(this.clippedChips=t)}scheduleClipCheck(){this.clipFrame&&cancelAnimationFrame(this.clipFrame),this.clipFrame=requestAnimationFrame((()=>{this.clipFrame=0,this.refreshClippedChips()}))}chipTooltipDisabled(e){return!this.showTooltip||!this.clippedChips[e]}destroyChipFit(){this.chipFitFrame&&cancelAnimationFrame(this.chipFitFrame),this.chipFitFrame=0,this.clipFrame&&cancelAnimationFrame(this.clipFrame),this.clipFrame=0,this.lastChipLayout={hidden:-1,visible:-1},this.stopMeasurableWatch()}refitWhenMeasurable(e){if(!this.isConnected)return;if(this.measurableWatch?.target===e)return;this.stopMeasurableWatch();const t=new ResizeObserver((e=>{e.some((e=>e.contentRect.width>0))&&(this.stopMeasurableWatch(),this.calculateTotalWidthOfTags())}));t.observe(e),this.measurableWatch={observer:t,target:e}}stopMeasurableWatch(){this.measurableWatch?.observer.disconnect(),this.measurableWatch=void 0}getChipLabel(e){return(e.getTextLabel?.()??"").trim()}handleChipKeyDown(e,t){if(e.key!==gt.BACKSPACE&&e.key!==gt.DELETE)return;if(this.disabled)return;e.preventDefault(),e.stopPropagation();const i=this.selectedOptions.indexOf(t);this.handleTagRemove(new CustomEvent("nile-remove"),t),this.restoreFocusAfterChipRemoval(i)}async restoreFocusAfterChipRemoval(e){if(e<0)return;await this.updateComplete,await new Promise((e=>requestAnimationFrame((()=>e()))));const t=Array.from(this.shadowRoot?.querySelectorAll(".select__tags nile-tag")??[]).filter((e=>"none"!==e.style.display)),i=t[e]??t[t.length-1];i?i.focus({preventScroll:!0}):this.displayInput?.focus({preventScroll:!0})}handleOverflowActivate(e){e.preventDefault(),e.stopPropagation(),this.disabled||(this.open?this.hide():this.show())}handleOverflowKeyDown(e){e.key!==gt.ENTER&&e.key!==gt.SPACE||this.handleOverflowActivate(e)}renderFittedTags(){return R`
6874
6866
  <div part="tags" class="select__tags select__tags--fitted">
6875
- ${this.selectedOptions.map(((e,t)=>{const i=this.getChipLabel(e),n=this.getOptionPrefixNodes(e);return R`
6867
+ ${this.selectedOptions.map(((e,t)=>{const i=this.getChipLabel(e),n=this.getOptionPrefixNodes(e,"chip");return R`
6876
6868
  <nile-lite-tooltip
6877
6869
  class="select__tag-tip"
6878
6870
  .content=${i}
@@ -6916,7 +6908,41 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
6916
6908
  >+${this.hiddenChipCount}</button
6917
6909
  >`:""}
6918
6910
  </div>
6919
- `}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"),n=!!this.label||!!e,o=this.clearable&&!this.disabled&&this.value.length>0,r=this.placeholder&&0===this.value.length,s=!(!this.helpText&&!this.help_text),a=!!this.errorMessage,l=this.selectedOptions[0]?this.getOptionPrefixNodes(this.selectedOptions[0]):[];return R`
6911
+ `}renderLegacyTags(){return R`
6912
+ <div part="tags" class="select__tags">
6913
+ ${this.selectedOptions.map(((e,t)=>t<this.maxOptionsVisible||this.maxOptionsVisible<=0?this.showTooltip?R`<nile-lite-tooltip
6914
+ class="select__tag-tip"
6915
+ .content=${e.getTextLabel()}
6916
+ ?disabled=${this.chipTooltipDisabled(t)}
6917
+ >${this.renderLegacyTag(e,t)}</nile-lite-tooltip
6918
+ >`:this.renderLegacyTag(e,t):t===this.maxOptionsVisible?R`
6919
+ <span class="select__tags-count"
6920
+ >+${this.selectedOptions.length-t} More
6921
+ </span>
6922
+ `:null))}
6923
+ </div>
6924
+ `}renderLegacyTag(e,t){const i=this.getOptionPrefixNodes(e,"chip"),n={select__invisible:t+1>this.oldMaxOptionsVisible&&this.maxOptionsVisible===1/0};return R`
6925
+ <nile-tag
6926
+ class=${Ae(n)}
6927
+ part="tag"
6928
+ exportparts="
6929
+ base:tag__base,
6930
+ content:tag__content,
6931
+ remove-button:tag__remove-button,
6932
+ remove-button__base:tag__remove-button__base,
6933
+ prefix:tag__prefix,
6934
+ prefix_content_wrapper:tag__prefix_content_wrapper
6935
+ "
6936
+ style=${Pe(this.showTooltip?`max-width:${this.chipMaxWidth}px`:void 0)}
6937
+ ?pill=${this.pill}
6938
+ size=${this.size}
6939
+ removable
6940
+ @nile-remove=${t=>this.handleTagRemove(t,e)}
6941
+ >
6942
+ ${i.length?R`<span class="tag__prefix" slot="prefix">${i}</span>`:""}
6943
+ ${e.getTextLabel()}
6944
+ </nile-tag>
6945
+ `}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"),n=!!this.label||!!e,o=this.clearable&&!this.disabled&&this.value.length>0,r=this.placeholder&&0===this.value.length,s=!(!this.helpText&&!this.help_text),a=!!this.errorMessage,l=this.selectedOptions[0]?this.getOptionPrefixNodes(this.selectedOptions[0],"trigger"):[];return R`
6920
6946
  <div
6921
6947
  part="form-control"
6922
6948
  class=${Ae({"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":n,"form-control--has-help-text":s})}
@@ -6990,43 +7016,7 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
6990
7016
  @blur=${this.handleBlur}
6991
7017
  />
6992
7018
 
6993
- ${this.multiple?this.chipFittingEnabled?this.renderFittedTags():R`
6994
- <div part="tags" class="select__tags">
6995
- ${this.selectedOptions.map(((e,t)=>{if(t<this.maxOptionsVisible||this.maxOptionsVisible<=0){const i=this.getOptionPrefixNodes(e);return R`
6996
- <nile-lite-tooltip
6997
- class="select__tag-tip"
6998
- .content=${e.getTextLabel()}
6999
- ?disabled=${this.chipTooltipDisabled(t)}
7000
- >
7001
- <nile-tag
7002
- part="tag"
7003
- exportparts="
7004
- base:tag__base,
7005
- content:tag__content,
7006
- remove-button:tag__remove-button,
7007
- remove-button__base:tag__remove-button__base,
7008
- prefix:tag__prefix,
7009
- prefix_content_wrapper:tag__prefix_content_wrapper
7010
- "
7011
- style="max-width:${this.chipMaxWidth}px"
7012
- ?pill=${this.pill}
7013
- size=${this.size}
7014
- removable
7015
- @nile-remove=${t=>this.handleTagRemove(t,e)}
7016
- >
7017
- ${i.length?R`<span class="tag__prefix" slot="prefix"
7018
- >${i}</span
7019
- >`:""}
7020
- ${e.getTextLabel()}
7021
- </nile-tag>
7022
- </nile-lite-tooltip>
7023
- `}return t===this.maxOptionsVisible?R`
7024
- <span class="select__tags-count"
7025
- >+${this.selectedOptions.length-t} More
7026
- </span>
7027
- `:null}))}
7028
- </div>
7029
- `:""}
7019
+ ${this.multiple?this.chipFittingEnabled?this.renderFittedTags():this.renderLegacyTags():""}
7030
7020
 
7031
7021
  <input
7032
7022
  class="select__value-input"
@@ -7120,7 +7110,10 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
7120
7110
  <slot></slot>
7121
7111
  </div>
7122
7112
 
7123
- ${this.hasSlotController.test("pre-footer")||this.multiple?R`<div part="footer-area" class="select__pre-footer-area">
7113
+ ${this.hasSlotController.test("pre-footer")||this.multiple?R`<div
7114
+ part="footer-area"
7115
+ class=${Ae({"select__pre-footer-area":!0,"select__pre-footer-area--query":!this.noWidthSync||this.portal})}
7116
+ >
7124
7117
  ${this.hasSlotController.test("pre-footer")?R`
7125
7118
  <div part="pre-footer" @click=${this.handlePreFooterClick}>
7126
7119
  <slot
@@ -7175,7 +7168,7 @@ class Ys{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
7175
7168
  >
7176
7169
  `:""}
7177
7170
  </div>
7178
- `}nileInput(e){this.emit("nile-input",e)}nileChange(e){this.emit("nile-change",e)}};oa.styles=js,e([he()],oa.prototype,"clippedChips",void 0),e([pe(".select")],oa.prototype,"popup",void 0),e([pe(".select__combobox")],oa.prototype,"combobox",void 0),e([pe(".select__display-input")],oa.prototype,"displayInput",void 0),e([pe(".select__value-input")],oa.prototype,"valueInput",void 0),e([pe(".select__listbox")],oa.prototype,"listbox",void 0),e([he()],oa.prototype,"hasFocus",void 0),e([he()],oa.prototype,"displayLabel",void 0),e([he()],oa.prototype,"currentOption",void 0),e([he()],oa.prototype,"selectedOptions",void 0),e([he()],oa.prototype,"oldValue",void 0),e([he()],oa.prototype,"hiddenChipCount",void 0),e([de()],oa.prototype,"name",void 0),e([de({converter:{fromAttribute:e=>e.split(" "),toAttribute:e=>e.join(" ")}})],oa.prototype,"value",void 0),e([et()],oa.prototype,"defaultValue",void 0),e([de()],oa.prototype,"size",void 0),e([de()],oa.prototype,"placeholder",void 0),e([he()],oa.prototype,"searchValue",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"searchEnabled",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"legacy",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"tickOnSelect",void 0),e([de({attribute:"internal-search-placeholder"})],oa.prototype,"internalSearchPlaceHolder",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"enableVisibilityEffect",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"blockValueChange",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"disableLocalSearch",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"optionsLoading",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"noWidthSync",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"portal",void 0),e([de({reflect:!0,converter:{fromAttribute:e=>""===e||"true"===e||"false"!==e&&e,toAttribute:e=>"boolean"==typeof e?String(e):e}})],oa.prototype,"multiple",void 0),e([de({attribute:!0,reflect:!0})],oa.prototype,"helpText",void 0),e([de({attribute:"help-text",reflect:!0})],oa.prototype,"help_text",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],oa.prototype,"autoResize",void 0),e([de({attribute:"error-message",reflect:!0})],oa.prototype,"errorMessage",void 0),e([de({type:Boolean})],oa.prototype,"warning",void 0),e([de({type:Boolean})],oa.prototype,"error",void 0),e([de({type:Boolean})],oa.prototype,"success",void 0),e([de({attribute:"max-options-visible",type:Number})],oa.prototype,"maxOptionsVisible",null),e([de({type:Number,reflect:!0,attribute:!0})],oa.prototype,"chipMinWidth",void 0),e([de({type:Number,reflect:!0,attribute:!0})],oa.prototype,"chipMaxWidth",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],oa.prototype,"showTooltip",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"disabled",void 0),e([de({type:Boolean})],oa.prototype,"clearable",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"open",void 0),e([de({type:Boolean})],oa.prototype,"hoist",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"filled",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"pill",void 0),e([de()],oa.prototype,"label",void 0),e([de({reflect:!0})],oa.prototype,"placement",void 0),e([de({reflect:!0})],oa.prototype,"form",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"required",void 0),e([de({type:Boolean})],oa.prototype,"showSelected",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"enableTabClose",void 0),e([de({type:Boolean})],oa.prototype,"showNoResults",void 0),e([de({type:String})],oa.prototype,"noResultsMessage",void 0),e([de({attribute:!1})],oa.prototype,"renderItemConfig",void 0),e([de({type:Array})],oa.prototype,"data",void 0),e([de({type:Boolean})],oa.prototype,"enableVirtualScroll",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"enableGroupHeader",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"autoFocusSearch",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"loading",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"stickyHeader",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"descriptionSearchEnabled",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"enableDescription",void 0),e([de({type:Boolean,reflect:!0,attribute:!0,converter:{fromAttribute:e=>"true"===e||""===e,toAttribute:e=>String(e)}})],oa.prototype,"allowHtmlLabel",void 0),e([Ve("disabled",{waitUntilFirstUpdate:!0})],oa.prototype,"handleDisabledChange",null),e([Ve("value",{waitUntilFirstUpdate:!0})],oa.prototype,"handleValueChange",null),e([Ve("portal",{waitUntilFirstUpdate:!0})],oa.prototype,"handlePortalAppendChange",null),e([Ve("open",{waitUntilFirstUpdate:!0})],oa.prototype,"handleOpenChange",null),oa=e([ce("nile-select")],oa),Rt("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),Rt("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});const ra=s`
7171
+ `}nileInput(e){this.emit("nile-input",e)}nileChange(e){this.emit("nile-change",e)}};oa.styles=js,e([he()],oa.prototype,"clippedChips",void 0),e([pe(".select")],oa.prototype,"popup",void 0),e([pe(".select__combobox")],oa.prototype,"combobox",void 0),e([pe(".select__display-input")],oa.prototype,"displayInput",void 0),e([pe(".select__value-input")],oa.prototype,"valueInput",void 0),e([pe(".select__listbox")],oa.prototype,"listbox",void 0),e([he()],oa.prototype,"hasFocus",void 0),e([he()],oa.prototype,"displayLabel",void 0),e([he()],oa.prototype,"currentOption",void 0),e([he()],oa.prototype,"selectedOptions",void 0),e([he()],oa.prototype,"oldValue",void 0),e([he()],oa.prototype,"hiddenChipCount",void 0),e([he()],oa.prototype,"oldMaxOptionsVisible",void 0),e([de()],oa.prototype,"name",void 0),e([de({converter:{fromAttribute:e=>e.split(" "),toAttribute:e=>e.join(" ")}})],oa.prototype,"value",void 0),e([et()],oa.prototype,"defaultValue",void 0),e([de()],oa.prototype,"size",void 0),e([de()],oa.prototype,"placeholder",void 0),e([he()],oa.prototype,"searchValue",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"searchEnabled",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"legacy",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"tickOnSelect",void 0),e([de({attribute:"internal-search-placeholder"})],oa.prototype,"internalSearchPlaceHolder",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"enableVisibilityEffect",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"blockValueChange",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"disableLocalSearch",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"optionsLoading",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"noWidthSync",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"portal",void 0),e([de({reflect:!0,converter:{fromAttribute:e=>""===e||"true"===e||"false"!==e&&e,toAttribute:e=>"boolean"==typeof e?String(e):e}})],oa.prototype,"multiple",void 0),e([de({attribute:!0,reflect:!0})],oa.prototype,"helpText",void 0),e([de({attribute:"help-text",reflect:!0})],oa.prototype,"help_text",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],oa.prototype,"autoResize",void 0),e([de({attribute:"error-message",reflect:!0})],oa.prototype,"errorMessage",void 0),e([de({type:Boolean})],oa.prototype,"warning",void 0),e([de({type:Boolean})],oa.prototype,"error",void 0),e([de({type:Boolean})],oa.prototype,"success",void 0),e([de({attribute:"max-options-visible",type:Number})],oa.prototype,"maxOptionsVisible",null),e([de({type:Number,attribute:!0})],oa.prototype,"chipMinWidth",void 0),e([de({type:Number,attribute:!0})],oa.prototype,"chipMaxWidth",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],oa.prototype,"showTooltip",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"disabled",void 0),e([de({type:Boolean})],oa.prototype,"clearable",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"open",void 0),e([de({type:Boolean})],oa.prototype,"hoist",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"filled",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"pill",void 0),e([de()],oa.prototype,"label",void 0),e([de({reflect:!0})],oa.prototype,"placement",void 0),e([de({reflect:!0})],oa.prototype,"form",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"required",void 0),e([de({type:Boolean})],oa.prototype,"showSelected",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"enableTabClose",void 0),e([de({type:Boolean})],oa.prototype,"showNoResults",void 0),e([de({type:String})],oa.prototype,"noResultsMessage",void 0),e([de({attribute:!1})],oa.prototype,"renderItemConfig",void 0),e([de({type:Array})],oa.prototype,"data",void 0),e([de({type:Boolean})],oa.prototype,"enableVirtualScroll",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"enableGroupHeader",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"autoFocusSearch",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"loading",void 0),e([de({type:Boolean,reflect:!0})],oa.prototype,"stickyHeader",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"descriptionSearchEnabled",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],oa.prototype,"enableDescription",void 0),e([de({type:Boolean,reflect:!0,attribute:!0,converter:{fromAttribute:e=>"true"===e||""===e,toAttribute:e=>String(e)}})],oa.prototype,"allowHtmlLabel",void 0),e([Ve("disabled",{waitUntilFirstUpdate:!0})],oa.prototype,"handleDisabledChange",null),e([Ve("value",{waitUntilFirstUpdate:!0})],oa.prototype,"handleValueChange",null),e([Ve("portal",{waitUntilFirstUpdate:!0})],oa.prototype,"handlePortalAppendChange",null),e([Ve("open",{waitUntilFirstUpdate:!0})],oa.prototype,"handleOpenChange",null),oa=e([ce("nile-select")],oa),Rt("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),Rt("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});const ra=s`
7179
7172
  :host {
7180
7173
  display: block;
7181
7174
  user-select: none;
@@ -19639,7 +19632,7 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
19639
19632
  ${this._renderTrigger()}
19640
19633
  ${e}
19641
19634
  </nile-popover>
19642
- `:e}};e([de({type:String,attribute:!0,reflect:!0})],NS.prototype,"type",void 0),e([de({type:String,attribute:!0,reflect:!0})],NS.prototype,"value",void 0),e([de({type:String,reflect:!0})],NS.prototype,"swatchTooltip",void 0),e([de({type:Number,reflect:!0})],NS.prototype,"recentColorsCount",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"noFill",void 0),e([de({type:String,reflect:!0})],NS.prototype,"mode",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"showCanvas",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"showHue",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"showInputs",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"showActions",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],NS.prototype,"open",void 0),e([de({attribute:"palette",converter:{fromAttribute:e=>{try{const t=JSON.parse(e);return Array.isArray(t)?t.map((e=>"string"==typeof e?{color:e,name:e}:e&&"string"==typeof e.color?{color:e.color,name:e.name||e.color}:null)).filter(Boolean):[]}catch{return[]}},toAttribute:e=>JSON.stringify(e)}})],NS.prototype,"palette",void 0),e([he()],NS.prototype,"_view",void 0),e([he()],NS.prototype,"_recentColors",void 0),e([he()],NS.prototype,"_hue",void 0),e([he()],NS.prototype,"_sat",void 0),e([he()],NS.prototype,"_val",void 0),e([he()],NS.prototype,"_colorMode",void 0),e([he()],NS.prototype,"_hexInput",void 0),e([he()],NS.prototype,"_r",void 0),e([he()],NS.prototype,"_g",void 0),e([he()],NS.prototype,"_b",void 0),NS=e([ce("nile-color-picker")],NS);function pS(){return function(){if("undefined"==typeof window||"function"!=typeof getComputedStyle)return null;try{return getComputedStyle(document.documentElement).getPropertyValue("--nile-version").trim().replace(/^["']|["']$/g,"")||null}catch{return null}}()??"1.3.4"}if("undefined"!=typeof window){window.nileElementsVersion='"2.0.11"';let e=null;Object.defineProperty(window,"nileVersion",{configurable:!0,get:()=>e??pS(),set:t=>{e=t}}),window.process=window.process||{env:{NODE_ENV:"production"}}}const DS=s`
19635
+ `:e}};e([de({type:String,attribute:!0,reflect:!0})],NS.prototype,"type",void 0),e([de({type:String,attribute:!0,reflect:!0})],NS.prototype,"value",void 0),e([de({type:String,reflect:!0})],NS.prototype,"swatchTooltip",void 0),e([de({type:Number,reflect:!0})],NS.prototype,"recentColorsCount",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"noFill",void 0),e([de({type:String,reflect:!0})],NS.prototype,"mode",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"showCanvas",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"showHue",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"showInputs",void 0),e([de({type:Boolean,reflect:!0})],NS.prototype,"showActions",void 0),e([de({type:Boolean,reflect:!0,attribute:!0})],NS.prototype,"open",void 0),e([de({attribute:"palette",converter:{fromAttribute:e=>{try{const t=JSON.parse(e);return Array.isArray(t)?t.map((e=>"string"==typeof e?{color:e,name:e}:e&&"string"==typeof e.color?{color:e.color,name:e.name||e.color}:null)).filter(Boolean):[]}catch{return[]}},toAttribute:e=>JSON.stringify(e)}})],NS.prototype,"palette",void 0),e([he()],NS.prototype,"_view",void 0),e([he()],NS.prototype,"_recentColors",void 0),e([he()],NS.prototype,"_hue",void 0),e([he()],NS.prototype,"_sat",void 0),e([he()],NS.prototype,"_val",void 0),e([he()],NS.prototype,"_colorMode",void 0),e([he()],NS.prototype,"_hexInput",void 0),e([he()],NS.prototype,"_r",void 0),e([he()],NS.prototype,"_g",void 0),e([he()],NS.prototype,"_b",void 0),NS=e([ce("nile-color-picker")],NS);function pS(){return function(){if("undefined"==typeof window||"function"!=typeof getComputedStyle)return null;try{return getComputedStyle(document.documentElement).getPropertyValue("--nile-version").trim().replace(/^["']|["']$/g,"")||null}catch{return null}}()??"1.3.4"}if("undefined"!=typeof window){window.nileElementsVersion='"2.0.13"';let e=null;Object.defineProperty(window,"nileVersion",{configurable:!0,get:()=>e??pS(),set:t=>{e=t}}),window.process=window.process||{env:{NODE_ENV:"production"}}}const DS=s`
19643
19636
  .utility-control::part(base) {
19644
19637
  width: var(--nile-app-shell-utility-size, 32px);
19645
19638
  height: var(--nile-app-shell-utility-size, 32px);
@@ -19872,21 +19865,21 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
19872
19865
  flex: 1 1 auto;
19873
19866
  }
19874
19867
 
19875
- /* The title block: the header's own heading, the Leading axis and the badge; renders before the top-bar slot. */
19868
+ /* The title block: the back arrow, then the stack (app icon, heading and badge, with the description under them); renders before the top-bar slot. */
19876
19869
  .title-area {
19877
19870
  display: flex;
19878
- /* Top-aligned, not centred: the leading element belongs to the title's row, not the title-plus-description stack. */
19871
+ /* Top-aligned, not centred: the back arrow belongs to the title's row, not the title-plus-description stack. */
19879
19872
  align-items: flex-start;
19880
- gap: var(--nile-spacing-md, var(--ng-spacing-md));
19873
+ /* Figma's Title Area gap: 16px from the arrow to the stack. */
19874
+ gap: var(--nile-spacing-xl, var(--ng-spacing-xl));
19881
19875
  min-width: 0;
19882
19876
  }
19883
19877
 
19884
- /* The leading line box: exactly the page title's line height, centring whatever leading control sits in it. */
19885
- .leading {
19878
+ /* The back arrow's line box: exactly the page title's line height, centring the arrow on the title row. */
19879
+ .back-line {
19886
19880
  flex: 0 0 auto;
19887
19881
  display: inline-flex;
19888
19882
  align-items: center;
19889
- gap: var(--nile-spacing-md, var(--ng-spacing-md));
19890
19883
  min-height: var(--nile-line-height-medium, var(--ng-line-height-text-md));
19891
19884
  }
19892
19885
 
@@ -19925,7 +19918,7 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
19925
19918
  font-size: var(--nile-type-scale-1, var(--ng-font-size-text-xs));
19926
19919
  line-height: var(--nile-line-height-xsmall, var(--ng-line-height-text-xs));
19927
19920
  font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));
19928
- color: var(--nile-colors-dark-500, var(--ng-colors-text-tertiary-600));
19921
+ color: var(--nile-colors-dark-500, var(--ng-colors-text-quaternary-500));
19929
19922
  white-space: nowrap;
19930
19923
  overflow: hidden;
19931
19924
  text-overflow: ellipsis;
@@ -19959,36 +19952,24 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
19959
19952
  white-space: nowrap;
19960
19953
  }
19961
19954
 
19962
- /* Leading=Back: drawn as a breadcrumb label; the shell owns no history, so pressing it only emits nile-header-back. */
19955
+ /* headerBack: an icon-only native button, so the aria-label names it directly; the shell owns no history, so pressing it only emits nile-click { value: 'back' }. */
19963
19956
  .back {
19964
19957
  flex: 0 0 auto;
19965
19958
  display: inline-flex;
19966
19959
  align-items: center;
19967
- gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
19968
19960
  margin: 0;
19969
19961
  padding: 0;
19970
19962
  border: 0;
19971
19963
  background: none;
19972
19964
  cursor: pointer;
19973
- font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
19974
- font-size: var(--nile-type-scale-3, var(--ng-font-size-text-md));
19975
- line-height: var(--nile-line-height-medium, var(--ng-line-height-text-md));
19976
- font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-semibold));
19977
- color: var(--nile-colors-dark-500, var(--ng-colors-text-tertiary-600));
19965
+ color: var(--nile-colors-dark-500, var(--ng-colors-fg-quaternary-400));
19978
19966
  }
19979
19967
 
19980
19968
  .back:hover {
19981
19969
  color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
19982
19970
  }
19983
19971
 
19984
- .crumb-divider {
19985
- flex: 0 0 auto;
19986
- display: inline-flex;
19987
- align-items: center;
19988
- color: var(--nile-colors-dark-500, var(--ng-colors-fg-quaternary-400));
19989
- }
19990
-
19991
- /* Leading=AppIcon: a 20px block before the title; the page slots the mark, the shell owns the box, surface and radius. */
19972
+ /* App icon: a 20px block at the start of the title row, so the description lines up under it; shown whenever the app-icon slot has content. */
19992
19973
  .app-icon {
19993
19974
  position: relative;
19994
19975
  flex: 0 0 auto;
@@ -20031,16 +20012,15 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20031
20012
  padding: 1.4px;
20032
20013
  }
20033
20014
 
20034
- :host(:not([leading='app-icon'])) .app-icon,
20035
- :host(:not([leading='back'])) .back,
20036
- :host(:not([leading='back'])) .crumb-divider {
20015
+ :host(:not([has-app-icon])) .app-icon {
20037
20016
  display: none;
20038
20017
  }
20039
20018
 
20019
+ /* Figma's Header Bar gap: 16px between every header action, the divider and Ask. */
20040
20020
  .top-bar-actions {
20041
20021
  display: flex;
20042
20022
  align-items: center;
20043
- gap: var(--nile-spacing-md, var(--ng-spacing-md));
20023
+ gap: var(--nile-spacing-xl, var(--ng-spacing-xl));
20044
20024
  margin-inline-start: auto;
20045
20025
  }
20046
20026
 
@@ -20049,7 +20029,7 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20049
20029
  display: none;
20050
20030
  }
20051
20031
 
20052
- /* The Ask button: a stock <nile-button variant="primary"> the shell renders itself; the only rule here is its flex behaviour as a top-bar item. */
20032
+ /* The Ask button: a stock <nile-button variant="secondary"> the shell renders itself; the only rule here is its flex behaviour as a top-bar item. */
20053
20033
  .ask {
20054
20034
  flex: 0 0 auto;
20055
20035
  }
@@ -20066,10 +20046,11 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20066
20046
  height: 16px;
20067
20047
  }
20068
20048
 
20049
+ /* 10px after the 32px circle is 16px after the 20px glyph (6px overhang + 10), Figma's toggle-to-divider gap. */
20069
20050
  .nav-toggle-group {
20070
20051
  display: flex;
20071
20052
  align-items: center;
20072
- gap: var(--nile-spacing-lg, var(--ng-spacing-lg));
20053
+ gap: var(--nile-spacing-md-alt, var(--ng-spacing-md-alt));
20073
20054
  }
20074
20055
 
20075
20056
  /* Lands the 20px glyph box, not the 32px utility circle, on the 24px origin: (32 - 20) / 2 = 6. */
@@ -20077,10 +20058,12 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20077
20058
  margin-inline-start: -6px;
20078
20059
  }
20079
20060
 
20061
+ /* Figma's Divider Line: a 16px 1px stroke that takes no layout width, so the items on both sides sit a clean 16px from it. Used after the nav toggle and, as ask-rule, before Ask. */
20080
20062
  .rule {
20081
20063
  flex: 0 0 auto;
20082
20064
  width: var(--nile-border-width-1, var(--ng-border-width-1));
20083
- height: 24px;
20065
+ margin-inline-end: calc(-1 * var(--nile-border-width-1, var(--ng-border-width-1)));
20066
+ height: 16px;
20084
20067
  background: var(
20085
20068
  --nile-colors-neutral-400,
20086
20069
  var(--ng-colors-border-secondary)
@@ -20133,6 +20116,17 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20133
20116
  /* Scoped to the group, not the slot, so bare tab controls are not stretched to an equal share of the strip. */
20134
20117
  ::slotted(nile-nav-tab-group[slot='tabs']) {
20135
20118
  --track-width: 0px;
20119
+ /*
20120
+ * The active indicator (Figma: fg-brand-primary-alt) is NOT set here: the top placement hard-codes
20121
+ * var(--nile-colors-primary-600, var(--ng-colors-text-brand-secondary-700)) inside nile-nav-tab-group's shadow tree, and
20122
+ * remapping either token from here would also recolour nile-nav-tab's focus ring and focus label. Known limitation (spec A-7).
20123
+ */
20124
+ /*
20125
+ * The inactive label: nile-nav-tab paints it var(--nile-colors-dark-500, var(--ng-colors-text-secondary-700)), so the strip
20126
+ * points the NxtGen fallback at text-quaternary-500. Enterprise defines --nile-colors-dark-500 and is untouched. Inside an
20127
+ * underline group nothing else reads text-secondary-700 (only the group's other variants and side placements do).
20128
+ */
20129
+ --ng-colors-text-secondary-700: var(--ng-colors-text-quaternary-500);
20136
20130
  flex: 1 1 auto;
20137
20131
  min-width: 0;
20138
20132
  align-self: flex-end;
@@ -20299,7 +20293,9 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20299
20293
 
20300
20294
  .panel-title {
20301
20295
  margin: 0;
20302
- font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
20296
+ /* Figma's Assistant Title: Text lg/Semibold, 18/28 on NxtGen. Enterprise keeps --nile-type-scale-3, and it defines no --ng-* tokens, so the line-height declaration is invalid there and the title inherits its line height exactly as before. */
20297
+ font-size: var(--nile-type-scale-3, var(--ng-font-size-text-lg));
20298
+ line-height: var(--ng-line-height-text-lg);
20303
20299
  font-weight: var(
20304
20300
  --nile-font-weight-semi-bold,
20305
20301
  var(--ng-font-weight-semibold)
@@ -20390,7 +20386,7 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20390
20386
  size=${t}
20391
20387
  method=${e.startsWith("ng-")?"stroke":"fill"}
20392
20388
  color=${Pe(i)}
20393
- ></nile-glyph>`}let jS=class extends Fe{constructor(){super(...arguments),this.navCollapsed=!1,this.panelOpen=!1,this.noPanel=!1,this.panelLabel="Ask Aquera",this.headingLevel=1,this.leading="none",this.backLabel="Back",this.noNavToggle=!1,this.noPanelShortcut=!1,this.noSkipLink=!1,this.skipLinkLabel="Skip to main content",this.topBarPlacement="content",this.contentAlign="fluid",this.contentContainer=!1,this.flat=!1,this.noPadding=!1,this.askLabel="Ask",this.noAsk=!1,this.panelBack=!1,this.panelBackLabel="Back",this.noTabs=!1,this.fullHeight=!1,this.overlayBreakpoint=0,this.dockedRailBreakpoint=1440,this._panelMode="docked",this._navLocked=!1,this._hasBanner=!1,this._hasSideNav=!1,this._hasTopBar=!1,this._hasTopBarActions=!1,this._hasTabs=!1,this._hasPanel=!1,this._hasPanelFooter=!1,this._panelOwnsChrome=!1,this._hasAside=!1,this._width=0,this._restoredPanelOpen=null,this._onSideNavToggle=e=>{const t=e.detail;t&&"boolean"==typeof t.collapsed&&this._setNavCollapsed(t.collapsed)},this._onKeyDown=e=>{if(this.noPanelShortcut||!this.panelAvailable)return;const t=e.key??"";if((e.metaKey||e.ctrlKey)&&"j"===t.toLowerCase())return e.preventDefault(),void this.togglePanel();"Escape"===t&&this.panelOpen&&"overlay"===this._panelMode&&this.closePanel()}}static get styles(){return[yS]}get panelMode(){return this._panelMode}get navLocked(){return this._navLocked}get panelAvailable(){return this._hasPanel&&!this.noPanel}get tabsVisible(){return this._hasTabs&&!this.noTabs}get askVisible(){return this.panelAvailable&&!this.noAsk}get rail(){return this.navCollapsed||this._navLocked}connectedCallback(){super.connectedCallback(),this._restore(),this._resizeObserver=new ResizeObserver((e=>{const t=e[e.length-1];this._measure(t.contentRect.width)})),this._resizeObserver.observe(this),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=void 0,document.removeEventListener("keydown",this._onKeyDown)}willUpdate(e){(e.has("panelOpen")||e.has("noPanel")||e.has("overlayBreakpoint")||e.has("dockedRailBreakpoint")||e.has("_hasAside")||e.has("_hasSideNav"))&&this._recompute()}updated(e){super.updated(e),this.toggleAttribute("rail",this.rail),this.toggleAttribute("nav-locked",this._navLocked),this.toggleAttribute("has-banner",this._hasBanner),this.toggleAttribute("has-side-nav",this._hasSideNav),this.toggleAttribute("has-top-bar",this._hasTopBar||this._hasTitleBlock||!this.noNavToggle&&this._hasSideNav),this.toggleAttribute("has-description",!!this.description&&!!this.pageTitle),this.toggleAttribute("has-top-bar-actions",this._hasTopBarActions),this.toggleAttribute("has-ask",this.askVisible),this.toggleAttribute("has-tabs",this.tabsVisible),this.toggleAttribute("has-aside",this._hasAside),this.toggleAttribute("has-panel",this.panelAvailable),this.toggleAttribute("has-panel-footer",this._hasPanelFooter),this.setAttribute("panel-mode",this._panelMode),this.setAttribute("panel-chrome",this._panelOwnsChrome?"external":"internal"),this._syncSideNav()}openPanel(){this.panelAvailable&&this._setPanelOpen(!0)}closePanel(){this._setPanelOpen(!1)}togglePanel(e){e??!this.panelOpen?this.openPanel():this.closePanel()}goBackHeader(){this.emit("nile-header-back")}goBackPanel(){this.emit("nile-panel-back")}goBackPage(){this.goBackHeader()}goBack(){this.goBackPanel()}expandNav(){this._setNavCollapsed(!1)}collapseNav(){this._setNavCollapsed(!0)}toggleNav(e){this._setNavCollapsed(e??!this.navCollapsed)}focusMain(){this._main?.focus()}_setPanelOpen(e){this.panelOpen!==e&&(this.panelOpen=e,this._persist(),this.emit("nile-panel-toggle",{open:e,mode:this._panelMode}))}_setNavCollapsed(e){this.navCollapsed!==e&&(this.navCollapsed=e,this._persist(),this.emit("nile-nav-toggle",{collapsed:e,locked:this._navLocked}))}_measure(e){if(e===this._width)return;const t=0===this._width;if(this._width=e,this._recompute(),t&&null!==this._restoredPanelOpen){const e=this._restoredPanelOpen;this._restoredPanelOpen=null,e&&"docked"===this._panelMode&&this.openPanel()}}_geometry(){const e=getComputedStyle(this),t=(t,i)=>{const n=parseFloat(e.getPropertyValue(t));return Number.isFinite(n)?n:i};return{nav:t("--nile-app-shell-side-nav-width",240),rail:t("--nile-app-shell-side-nav-rail-width",70),gutter:t("--nile-app-shell-gutter",4),content:t("--nile-app-shell-content-min-width",640),aside:t("--nile-app-shell-aside-width",320),panel:t("--nile-app-shell-panel-width",480)}}_dockRequirement(e,t){const i=this._hasSideNav?t:0,n=this._hasAside?e.aside+e.gutter:0,o=this._hasSideNav?2:3;return i+e.content+n+e.panel+e.gutter*o}_recompute(){const e=this._width,t=this._geometry(),i=this.overlayBreakpoint>0&&e>0&&e<this.overlayBreakpoint,n=i?"overlay":"docked",o=Math.max(this.dockedRailBreakpoint,this._dockRequirement(t,t.nav)),r=!i&&this.panelOpen&&this.panelAvailable&&e>0&&e<o,s=i||r;n!==this._panelMode&&(this._panelMode=n,this.emit("nile-panel-mode-change",{mode:n})),s!==this._navLocked&&(this._navLocked=s,this.emit("nile-nav-toggle",{collapsed:this.navCollapsed,locked:s}))}_syncSideNav(){this.querySelectorAll('[slot="side-nav"]').forEach((e=>{"NILE-SIDE-BAR"===e.tagName&&e.toggleAttribute("collapsed",this.rail)}))}_storageKey(e){return`nile-app-shell:${this.persistKey}:${e}`}_restore(){if(this.persistKey)try{const e=localStorage.getItem(this._storageKey("nav-collapsed"));null!==e&&(this.navCollapsed="true"===e);const t=localStorage.getItem(this._storageKey("panel-open"));null!==t&&(this._restoredPanelOpen="true"===t)}catch{}}_persist(){if(this.persistKey)try{localStorage.setItem(this._storageKey("nav-collapsed"),String(this.navCollapsed)),"docked"===this._panelMode&&localStorage.setItem(this._storageKey("panel-open"),String(this.panelOpen))}catch{}}_onSlotChange(e,t){const i=t.target.assignedNodes({flatten:!0}),n=i.some((e=>e.nodeType===Node.ELEMENT_NODE||""!==(e.textContent??"").trim()));switch(e){case"banner":this._hasBanner=n;break;case"side-nav":this._hasSideNav=n,this._syncSideNav();break;case"top-bar":this._hasTopBar=n;break;case"top-bar-actions":this._hasTopBarActions=n;break;case"tabs":this._hasTabs=n;break;case"aside":this._hasAside=n;break;case"panel":this._hasPanel=n,this._panelOwnsChrome=i.some((e=>e.nodeType===Node.ELEMENT_NODE&&"NILE-APP-SHELL-PANEL"===e.tagName)),this._recompute();break;case"panel-footer":this._hasPanelFooter=n}}_renderNavToggle(){if(this.noNavToggle||!this._hasSideNav)return"";const e=!this.rail;return R`
20389
+ ></nile-glyph>`}let jS=class extends Fe{constructor(){super(...arguments),this.navCollapsed=!1,this.panelOpen=!1,this.noPanel=!1,this.panelLabel="Ask Aquera",this.headingLevel=1,this.headerBack=!1,this.headerBackLabel="Back",this.noNavToggle=!1,this.noPanelShortcut=!1,this.noSkipLink=!1,this.skipLinkLabel="Skip to main content",this.topBarPlacement="content",this.contentAlign="fluid",this.contentContainer=!1,this.flat=!1,this.noPadding=!1,this.askLabel="Ask",this.noAsk=!1,this.panelBack=!1,this.panelBackLabel="Back",this.noTabs=!1,this.fullHeight=!1,this.overlayBreakpoint=0,this.dockedRailBreakpoint=1440,this._panelMode="docked",this._navLocked=!1,this._hasBanner=!1,this._hasSideNav=!1,this._hasTopBar=!1,this._hasTopBarActions=!1,this._hasTabs=!1,this._hasAppIcon=!1,this._hasPanel=!1,this._hasPanelFooter=!1,this._panelOwnsChrome=!1,this._hasAside=!1,this._width=0,this._restoredPanelOpen=null,this._onSideNavToggle=e=>{const t=e.detail;t&&"boolean"==typeof t.collapsed&&this._setNavCollapsed(t.collapsed)},this._onKeyDown=e=>{if(this.noPanelShortcut||!this.panelAvailable)return;const t=e.key??"";if((e.metaKey||e.ctrlKey)&&"j"===t.toLowerCase())return e.preventDefault(),void this.togglePanel();"Escape"===t&&this.panelOpen&&"overlay"===this._panelMode&&this.closePanel()}}static get styles(){return[yS]}get panelMode(){return this._panelMode}get navLocked(){return this._navLocked}get panelAvailable(){return this._hasPanel&&!this.noPanel}get tabsVisible(){return this._hasTabs&&!this.noTabs}get askVisible(){return this.panelAvailable&&!this.noAsk}get rail(){return this.navCollapsed||this._navLocked}connectedCallback(){super.connectedCallback(),this._restore(),this._resizeObserver=new ResizeObserver((e=>{const t=e[e.length-1];this._measure(t.contentRect.width)})),this._resizeObserver.observe(this),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=void 0,document.removeEventListener("keydown",this._onKeyDown)}willUpdate(e){(e.has("panelOpen")||e.has("noPanel")||e.has("overlayBreakpoint")||e.has("dockedRailBreakpoint")||e.has("_hasAside")||e.has("_hasSideNav"))&&this._recompute()}updated(e){super.updated(e),this.toggleAttribute("rail",this.rail),this.toggleAttribute("nav-locked",this._navLocked),this.toggleAttribute("has-banner",this._hasBanner),this.toggleAttribute("has-side-nav",this._hasSideNav),this.toggleAttribute("has-top-bar",this._hasTopBar||this._hasTitleBlock||!this.noNavToggle&&this._hasSideNav),this.toggleAttribute("has-description",!!this.description&&!!this.pageTitle),this.toggleAttribute("has-top-bar-actions",this._hasTopBarActions),this.toggleAttribute("has-app-icon",this._hasAppIcon),this.toggleAttribute("has-ask",this.askVisible),this.toggleAttribute("has-tabs",this.tabsVisible),this.toggleAttribute("has-aside",this._hasAside),this.toggleAttribute("has-panel",this.panelAvailable),this.toggleAttribute("has-panel-footer",this._hasPanelFooter),this.setAttribute("panel-mode",this._panelMode),this.setAttribute("panel-chrome",this._panelOwnsChrome?"external":"internal"),this._syncSideNav()}openPanel(){this.panelAvailable&&this._setPanelOpen(!0)}closePanel(){this._setPanelOpen(!1)}togglePanel(e){e??!this.panelOpen?this.openPanel():this.closePanel()}goBackHeader(){this.emit("nile-click",{value:"back"})}goBackPanel(){this.emit("nile-panel-back")}goBack(){this.goBackPanel()}expandNav(){this._setNavCollapsed(!1)}collapseNav(){this._setNavCollapsed(!0)}toggleNav(e){this._setNavCollapsed(e??!this.navCollapsed)}focusMain(){this._main?.focus()}_setPanelOpen(e){this.panelOpen!==e&&(this.panelOpen=e,this._persist(),this.emit("nile-panel-toggle",{open:e,mode:this._panelMode}))}_setNavCollapsed(e){this.navCollapsed!==e&&(this.navCollapsed=e,this._persist(),this.emit("nile-nav-toggle",{collapsed:e,locked:this._navLocked}))}_measure(e){if(e===this._width)return;const t=0===this._width;if(this._width=e,this._recompute(),t&&null!==this._restoredPanelOpen){const e=this._restoredPanelOpen;this._restoredPanelOpen=null,e&&"docked"===this._panelMode&&this.openPanel()}}_geometry(){const e=getComputedStyle(this),t=(t,i)=>{const n=parseFloat(e.getPropertyValue(t));return Number.isFinite(n)?n:i};return{nav:t("--nile-app-shell-side-nav-width",240),rail:t("--nile-app-shell-side-nav-rail-width",70),gutter:t("--nile-app-shell-gutter",4),content:t("--nile-app-shell-content-min-width",640),aside:t("--nile-app-shell-aside-width",320),panel:t("--nile-app-shell-panel-width",480)}}_dockRequirement(e,t){const i=this._hasSideNav?t:0,n=this._hasAside?e.aside+e.gutter:0,o=this._hasSideNav?2:3;return i+e.content+n+e.panel+e.gutter*o}_recompute(){const e=this._width,t=this._geometry(),i=this.overlayBreakpoint>0&&e>0&&e<this.overlayBreakpoint,n=i?"overlay":"docked",o=Math.max(this.dockedRailBreakpoint,this._dockRequirement(t,t.nav)),r=!i&&this.panelOpen&&this.panelAvailable&&e>0&&e<o,s=i||r;n!==this._panelMode&&(this._panelMode=n,this.emit("nile-panel-mode-change",{mode:n})),s!==this._navLocked&&(this._navLocked=s,this.emit("nile-nav-toggle",{collapsed:this.navCollapsed,locked:s}))}_syncSideNav(){this.querySelectorAll('[slot="side-nav"]').forEach((e=>{"NILE-SIDE-BAR"===e.tagName&&e.toggleAttribute("collapsed",this.rail)}))}_storageKey(e){return`nile-app-shell:${this.persistKey}:${e}`}_restore(){if(this.persistKey)try{const e=localStorage.getItem(this._storageKey("nav-collapsed"));null!==e&&(this.navCollapsed="true"===e);const t=localStorage.getItem(this._storageKey("panel-open"));null!==t&&(this._restoredPanelOpen="true"===t)}catch{}}_persist(){if(this.persistKey)try{localStorage.setItem(this._storageKey("nav-collapsed"),String(this.navCollapsed)),"docked"===this._panelMode&&localStorage.setItem(this._storageKey("panel-open"),String(this.panelOpen))}catch{}}_onSlotChange(e,t){const i=t.target.assignedNodes({flatten:!0}),n=i.some((e=>e.nodeType===Node.ELEMENT_NODE||""!==(e.textContent??"").trim()));switch(e){case"banner":this._hasBanner=n;break;case"side-nav":this._hasSideNav=n,this._syncSideNav();break;case"top-bar":this._hasTopBar=n;break;case"top-bar-actions":this._hasTopBarActions=n;break;case"tabs":this._hasTabs=n;break;case"app-icon":this._hasAppIcon=n;break;case"aside":this._hasAside=n;break;case"panel":this._hasPanel=n,this._panelOwnsChrome=i.some((e=>e.nodeType===Node.ELEMENT_NODE&&"NILE-APP-SHELL-PANEL"===e.tagName)),this._recompute();break;case"panel-footer":this._hasPanelFooter=n}}_renderNavToggle(){if(this.noNavToggle||!this._hasSideNav)return"";const e=!this.rail;return R`
20394
20390
  <div class="nav-toggle-group">
20395
20391
  <nile-button
20396
20392
  class="nav-toggle utility-control"
@@ -20408,46 +20404,50 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20408
20404
  </nile-button>
20409
20405
  ${this._hasTopBar||this._hasTitleBlock?R`<span class="rule" part="rule"></span>`:""}
20410
20406
  </div>
20411
- `}get _hasTitleBlock(){return!!this.pageTitle||this._hasLeading}get _hasLeading(){return"back"===this.leading||"app-icon"===this.leading}get _headingLevel(){const e=Math.trunc(Number(this.headingLevel));return Number.isFinite(e)?Math.min(6,Math.max(1,e)):1}_renderLeading(){return"app-icon"===this.leading?R`
20412
- <span class="app-icon" part="app-icon">
20413
- <slot name="app-icon"></slot>
20414
- </span>
20415
- `:"back"===this.leading?R`
20407
+ `}get _hasTitleBlock(){return!!this.pageTitle||this.headerBack||this._hasAppIcon}get _headingLevel(){const e=Math.trunc(Number(this.headingLevel));return Number.isFinite(e)?Math.min(6,Math.max(1,e)):1}_renderBack(){return this.headerBack?R`
20408
+ <span class="back-line">
20416
20409
  <button
20417
20410
  class="back"
20418
20411
  part="back"
20419
20412
  type="button"
20413
+ aria-label=${this.headerBackLabel}
20414
+ title=${this.headerBackLabel}
20420
20415
  @click=${()=>this.goBackHeader()}
20421
20416
  >
20422
- ${IS("ng-chevron-left",20,"currentColor")}
20423
- <span>${this.backLabel}</span>
20417
+ ${IS("ng-arrow-narrow-left",20,"currentColor")}
20424
20418
  </button>
20425
- ${this.pageTitle?R`<span class="crumb-divider" aria-hidden="true">
20426
- ${IS("ng-slash",16,"currentColor")}
20427
- </span>`:""}
20428
- `:""}_renderTitleBlock(){return this._hasTitleBlock?R`
20419
+ </span>
20420
+ `:""}_renderAppIconSlot(){return R`<slot
20421
+ name="app-icon"
20422
+ @slotchange=${e=>this._onSlotChange("app-icon",e)}
20423
+ ></slot>`}_renderAppIconProbe(){return R`<span class="app-icon-probe" hidden
20424
+ >${this._renderAppIconSlot()}</span
20425
+ >`}_renderTitleBlock(){return this._hasTitleBlock?this.pageTitle||this._hasAppIcon?R`
20429
20426
  <div class="title-area" part="title-area">
20430
- ${this._hasLeading?R`<span class="leading" part="leading"
20431
- >${this._renderLeading()}</span
20432
- >`:""}
20433
- ${this.pageTitle?R`
20434
- <div class="title-stack">
20435
- <div class="title-row">
20436
- <div
20437
- class="page-title"
20438
- part="page-title"
20439
- role="heading"
20440
- aria-level=${this._headingLevel}
20441
- >${this.pageTitle}</div>
20442
- ${this.badge?R`<span class="badge" part="badge">${this.badge}</span>`:""}
20443
- </div>
20444
- ${this.description?R`<p class="description" part="description">
20445
- ${this.description}
20446
- </p>`:""}
20447
- </div>
20448
- `:""}
20427
+ ${this._renderBack()}
20428
+ <div class="title-stack">
20429
+ <div class="title-row">
20430
+ <span class="app-icon" part="app-icon"
20431
+ >${this._renderAppIconSlot()}</span
20432
+ >
20433
+ ${this.pageTitle?R`<div
20434
+ class="page-title"
20435
+ part="page-title"
20436
+ role="heading"
20437
+ aria-level=${this._headingLevel}
20438
+ >${this.pageTitle}</div>`:""}
20439
+ ${this.pageTitle&&this.badge?R`<span class="badge" part="badge">${this.badge}</span>`:""}
20440
+ </div>
20441
+ ${this.pageTitle&&this.description?R`<p class="description" part="description">
20442
+ ${this.description}
20443
+ </p>`:""}
20444
+ </div>
20449
20445
  </div>
20450
- `:""}_renderTopBar(e){return R`
20446
+ `:R`
20447
+ <div class="title-area" part="title-area">
20448
+ ${this._renderBack()} ${this._renderAppIconProbe()}
20449
+ </div>
20450
+ `:this._renderAppIconProbe()}_renderTopBar(e){return R`
20451
20451
  <div
20452
20452
  class=${"shell"===e?"top-bar shell-top-bar":"top-bar"}
20453
20453
  part=${"shell"===e?"top-bar shell-top-bar":"top-bar"}
@@ -20465,12 +20465,13 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20465
20465
  name="top-bar-actions"
20466
20466
  @slotchange=${e=>this._onSlotChange("top-bar-actions",e)}
20467
20467
  ></slot>
20468
+ ${this.askVisible&&this._hasTopBarActions?R`<span class="rule ask-rule" part="ask-rule"></span>`:""}
20468
20469
  ${this.askVisible?R`
20469
20470
  <nile-button
20470
20471
  class="ask"
20471
20472
  part="ask"
20472
20473
  exportparts="base: ask__base, label: ask__label"
20473
- variant="primary"
20474
+ variant="secondary"
20474
20475
  @click=${()=>this.openPanel()}
20475
20476
  >
20476
20477
  <span slot="prefix" class="ask-mark">
@@ -20595,7 +20596,7 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20595
20596
  `}
20596
20597
  </aside>
20597
20598
  </div>
20598
- `}};e([de({type:Boolean,reflect:!0,attribute:"nav-collapsed"})],jS.prototype,"navCollapsed",void 0),e([de({type:Boolean,reflect:!0,attribute:"panel-open"})],jS.prototype,"panelOpen",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-panel"})],jS.prototype,"noPanel",void 0),e([de({type:String,attribute:"panel-label"})],jS.prototype,"panelLabel",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"pageTitle",void 0),e([de({type:Number,attribute:!0,reflect:!0})],jS.prototype,"headingLevel",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"description",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"badge",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"leading",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"backLabel",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-nav-toggle"})],jS.prototype,"noNavToggle",void 0),e([de({type:Boolean,attribute:"no-panel-shortcut"})],jS.prototype,"noPanelShortcut",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-skip-link"})],jS.prototype,"noSkipLink",void 0),e([de({type:String,attribute:"skip-link-label"})],jS.prototype,"skipLinkLabel",void 0),e([de({type:String,reflect:!0,attribute:"top-bar-placement"})],jS.prototype,"topBarPlacement",void 0),e([de({type:String,reflect:!0,attribute:"content-align"})],jS.prototype,"contentAlign",void 0),e([de({type:Boolean,reflect:!0,attribute:"content-container"})],jS.prototype,"contentContainer",void 0),e([de({type:Boolean,reflect:!0})],jS.prototype,"flat",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-padding"})],jS.prototype,"noPadding",void 0),e([de({type:String,attribute:"ask-label"})],jS.prototype,"askLabel",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-ask"})],jS.prototype,"noAsk",void 0),e([de({type:Boolean,reflect:!0})],jS.prototype,"panelBack",void 0),e([de({type:String})],jS.prototype,"panelBackLabel",void 0),e([de({type:Boolean,reflect:!0})],jS.prototype,"noTabs",void 0),e([de({type:Boolean,reflect:!0,attribute:"full-height"})],jS.prototype,"fullHeight",void 0),e([de({type:Number,attribute:"overlay-breakpoint"})],jS.prototype,"overlayBreakpoint",void 0),e([de({type:Number,attribute:"docked-rail-breakpoint"})],jS.prototype,"dockedRailBreakpoint",void 0),e([de({type:String,attribute:"persist-key"})],jS.prototype,"persistKey",void 0),e([he()],jS.prototype,"_panelMode",void 0),e([he()],jS.prototype,"_navLocked",void 0),e([he()],jS.prototype,"_hasBanner",void 0),e([he()],jS.prototype,"_hasSideNav",void 0),e([he()],jS.prototype,"_hasTopBar",void 0),e([he()],jS.prototype,"_hasTopBarActions",void 0),e([he()],jS.prototype,"_hasTabs",void 0),e([he()],jS.prototype,"_hasPanel",void 0),e([he()],jS.prototype,"_hasPanelFooter",void 0),e([he()],jS.prototype,"_panelOwnsChrome",void 0),e([he()],jS.prototype,"_hasAside",void 0),e([pe(".main")],jS.prototype,"_main",void 0),jS=e([ce("nile-app-shell")],jS);const zS=s`
20599
+ `}};e([de({type:Boolean,reflect:!0,attribute:"nav-collapsed"})],jS.prototype,"navCollapsed",void 0),e([de({type:Boolean,reflect:!0,attribute:"panel-open"})],jS.prototype,"panelOpen",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-panel"})],jS.prototype,"noPanel",void 0),e([de({type:String,attribute:"panel-label"})],jS.prototype,"panelLabel",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"pageTitle",void 0),e([de({type:Number,attribute:!0,reflect:!0})],jS.prototype,"headingLevel",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"description",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"badge",void 0),e([de({type:Boolean,attribute:!0,reflect:!0})],jS.prototype,"headerBack",void 0),e([de({type:String,attribute:!0,reflect:!0})],jS.prototype,"headerBackLabel",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-nav-toggle"})],jS.prototype,"noNavToggle",void 0),e([de({type:Boolean,attribute:"no-panel-shortcut"})],jS.prototype,"noPanelShortcut",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-skip-link"})],jS.prototype,"noSkipLink",void 0),e([de({type:String,attribute:"skip-link-label"})],jS.prototype,"skipLinkLabel",void 0),e([de({type:String,reflect:!0,attribute:"top-bar-placement"})],jS.prototype,"topBarPlacement",void 0),e([de({type:String,reflect:!0,attribute:"content-align"})],jS.prototype,"contentAlign",void 0),e([de({type:Boolean,reflect:!0,attribute:"content-container"})],jS.prototype,"contentContainer",void 0),e([de({type:Boolean,reflect:!0})],jS.prototype,"flat",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-padding"})],jS.prototype,"noPadding",void 0),e([de({type:String,attribute:"ask-label"})],jS.prototype,"askLabel",void 0),e([de({type:Boolean,reflect:!0,attribute:"no-ask"})],jS.prototype,"noAsk",void 0),e([de({type:Boolean,reflect:!0})],jS.prototype,"panelBack",void 0),e([de({type:String})],jS.prototype,"panelBackLabel",void 0),e([de({type:Boolean,reflect:!0})],jS.prototype,"noTabs",void 0),e([de({type:Boolean,reflect:!0,attribute:"full-height"})],jS.prototype,"fullHeight",void 0),e([de({type:Number,attribute:"overlay-breakpoint"})],jS.prototype,"overlayBreakpoint",void 0),e([de({type:Number,attribute:"docked-rail-breakpoint"})],jS.prototype,"dockedRailBreakpoint",void 0),e([de({type:String,attribute:"persist-key"})],jS.prototype,"persistKey",void 0),e([he()],jS.prototype,"_panelMode",void 0),e([he()],jS.prototype,"_navLocked",void 0),e([he()],jS.prototype,"_hasBanner",void 0),e([he()],jS.prototype,"_hasSideNav",void 0),e([he()],jS.prototype,"_hasTopBar",void 0),e([he()],jS.prototype,"_hasTopBarActions",void 0),e([he()],jS.prototype,"_hasTabs",void 0),e([he()],jS.prototype,"_hasAppIcon",void 0),e([he()],jS.prototype,"_hasPanel",void 0),e([he()],jS.prototype,"_hasPanelFooter",void 0),e([he()],jS.prototype,"_panelOwnsChrome",void 0),e([he()],jS.prototype,"_hasAside",void 0),e([pe(".main")],jS.prototype,"_main",void 0),jS=e([ce("nile-app-shell")],jS);const zS=s`
20599
20600
  :host {
20600
20601
  display: inline-flex;
20601
20602
  align-items: center;
@@ -20789,7 +20790,9 @@ nile-rich-text-editor[disabled] .editor figure.rte-image {
20789
20790
 
20790
20791
  .title {
20791
20792
  margin: 0;
20792
- font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
20793
+ /* Figma's Assistant Title: Text lg/Semibold, 18/28 on NxtGen. Enterprise keeps --nile-type-scale-3, and it defines no --ng-* tokens, so the line-height declaration is invalid there and the title inherits its line height exactly as before. */
20794
+ font-size: var(--nile-type-scale-3, var(--ng-font-size-text-lg));
20795
+ line-height: var(--ng-line-height-text-lg);
20793
20796
  font-weight: var(
20794
20797
  --nile-font-weight-semi-bold,
20795
20798
  var(--ng-font-weight-semibold)