@limetech/lime-elements 38.23.5 → 38.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/limel-action-bar_2.cjs.entry.js +1 -1
  4. package/dist/cjs/limel-ai-avatar.cjs.entry.js +1 -1
  5. package/dist/cjs/limel-badge.cjs.entry.js +42 -0
  6. package/dist/cjs/limel-badge.cjs.entry.js.map +1 -0
  7. package/dist/cjs/limel-callout.cjs.entry.js +1 -1
  8. package/dist/cjs/limel-chart.cjs.entry.js +1 -1
  9. package/dist/cjs/limel-chip_2.cjs.entry.js +1 -1
  10. package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
  11. package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
  12. package/dist/cjs/limel-file.cjs.entry.js +1 -1
  13. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
  14. package/dist/cjs/limel-linear-progress.cjs.entry.js +1 -1
  15. package/dist/cjs/{limel-portal_2.cjs.entry.js → limel-portal_3.cjs.entry.js} +107 -11
  16. package/dist/cjs/limel-portal_3.cjs.entry.js.map +1 -0
  17. package/dist/cjs/limel-profile-picture.cjs.entry.js +536 -0
  18. package/dist/cjs/limel-profile-picture.cjs.entry.js.map +1 -0
  19. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
  20. package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
  21. package/dist/cjs/limel-table.cjs.entry.js +1 -1
  22. package/dist/cjs/loader.cjs.js +1 -1
  23. package/dist/cjs/{translations-2746c4c6.js → translations-7499f391.js} +25 -1
  24. package/dist/cjs/translations-7499f391.js.map +1 -0
  25. package/dist/collection/collection-manifest.json +1 -0
  26. package/dist/collection/components/profile-picture/profile-picture.css +255 -0
  27. package/dist/collection/components/profile-picture/profile-picture.js +554 -0
  28. package/dist/collection/components/profile-picture/profile-picture.js.map +1 -0
  29. package/dist/collection/translations/da.js +3 -0
  30. package/dist/collection/translations/da.js.map +1 -1
  31. package/dist/collection/translations/de.js +3 -0
  32. package/dist/collection/translations/de.js.map +1 -1
  33. package/dist/collection/translations/en.js +3 -0
  34. package/dist/collection/translations/en.js.map +1 -1
  35. package/dist/collection/translations/fi.js +3 -0
  36. package/dist/collection/translations/fi.js.map +1 -1
  37. package/dist/collection/translations/fr.js +3 -0
  38. package/dist/collection/translations/fr.js.map +1 -1
  39. package/dist/collection/translations/nl.js +3 -0
  40. package/dist/collection/translations/nl.js.map +1 -1
  41. package/dist/collection/translations/no.js +3 -0
  42. package/dist/collection/translations/no.js.map +1 -1
  43. package/dist/collection/translations/sv.js +3 -0
  44. package/dist/collection/translations/sv.js.map +1 -1
  45. package/dist/collection/util/image-resize.js +305 -0
  46. package/dist/collection/util/image-resize.js.map +1 -0
  47. package/dist/esm/lime-elements.js +1 -1
  48. package/dist/esm/limel-action-bar_2.entry.js +1 -1
  49. package/dist/esm/limel-ai-avatar.entry.js +1 -1
  50. package/dist/esm/limel-badge.entry.js +38 -0
  51. package/dist/esm/limel-badge.entry.js.map +1 -0
  52. package/dist/esm/limel-callout.entry.js +1 -1
  53. package/dist/esm/limel-chart.entry.js +1 -1
  54. package/dist/esm/limel-chip_2.entry.js +1 -1
  55. package/dist/esm/limel-collapsible-section.entry.js +1 -1
  56. package/dist/esm/limel-file-viewer.entry.js +1 -1
  57. package/dist/esm/limel-file.entry.js +1 -1
  58. package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
  59. package/dist/esm/limel-linear-progress.entry.js +1 -1
  60. package/dist/esm/{limel-portal_2.entry.js → limel-portal_3.entry.js} +107 -12
  61. package/dist/esm/limel-portal_3.entry.js.map +1 -0
  62. package/dist/esm/limel-profile-picture.entry.js +532 -0
  63. package/dist/esm/limel-profile-picture.entry.js.map +1 -0
  64. package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
  65. package/dist/esm/limel-snackbar.entry.js +1 -1
  66. package/dist/esm/limel-table.entry.js +1 -1
  67. package/dist/esm/loader.js +1 -1
  68. package/dist/esm/{translations-0c3c0779.js → translations-1d617679.js} +25 -1
  69. package/dist/esm/translations-1d617679.js.map +1 -0
  70. package/dist/lime-elements/lime-elements.esm.js +1 -1
  71. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  72. package/dist/lime-elements/{p-6edfe426.entry.js → p-011f5d81.entry.js} +2 -2
  73. package/dist/lime-elements/p-18a3c28a.entry.js +2 -0
  74. package/dist/lime-elements/p-18a3c28a.entry.js.map +1 -0
  75. package/dist/lime-elements/{p-8a7bc823.entry.js → p-20d1913a.entry.js} +2 -2
  76. package/dist/lime-elements/{p-244e13f5.entry.js → p-3f698d18.entry.js} +2 -2
  77. package/dist/lime-elements/{p-9abbe61a.entry.js → p-441c1eab.entry.js} +2 -2
  78. package/dist/lime-elements/{p-b957a3ca.entry.js → p-4558a60e.entry.js} +2 -2
  79. package/dist/lime-elements/p-58777116.js +2 -0
  80. package/dist/lime-elements/p-58777116.js.map +1 -0
  81. package/dist/lime-elements/{p-d7e93894.entry.js → p-597e6f79.entry.js} +2 -2
  82. package/dist/lime-elements/{p-208f87d2.entry.js → p-78abbc50.entry.js} +2 -2
  83. package/dist/lime-elements/p-7e3a4f49.entry.js +2 -0
  84. package/dist/lime-elements/p-7e3a4f49.entry.js.map +1 -0
  85. package/dist/lime-elements/{p-e4d64dd2.entry.js → p-8ae75f4a.entry.js} +2 -2
  86. package/dist/lime-elements/{p-5018673b.entry.js → p-99de518a.entry.js} +2 -2
  87. package/dist/lime-elements/p-b5a96409.entry.js +2 -0
  88. package/dist/lime-elements/p-b5a96409.entry.js.map +1 -0
  89. package/dist/lime-elements/{p-2173d6d5.entry.js → p-bd619d56.entry.js} +2 -2
  90. package/dist/lime-elements/{p-65d5d2fb.entry.js → p-bd6878ee.entry.js} +2 -2
  91. package/dist/lime-elements/{p-5bf57c21.entry.js → p-ce29c097.entry.js} +2 -2
  92. package/dist/lime-elements/{p-00aee6b6.entry.js → p-e7201ebd.entry.js} +2 -2
  93. package/dist/types/components/profile-picture/profile-picture.d.ts +126 -0
  94. package/dist/types/components.d.ts +203 -0
  95. package/dist/types/translations/da.d.ts +3 -0
  96. package/dist/types/translations/de.d.ts +3 -0
  97. package/dist/types/translations/en.d.ts +3 -0
  98. package/dist/types/translations/fi.d.ts +3 -0
  99. package/dist/types/translations/fr.d.ts +3 -0
  100. package/dist/types/translations/nl.d.ts +3 -0
  101. package/dist/types/translations/no.d.ts +3 -0
  102. package/dist/types/translations/sv.d.ts +3 -0
  103. package/dist/types/util/image-resize.d.ts +138 -0
  104. package/package.json +1 -1
  105. package/dist/cjs/limel-badge_2.cjs.entry.js +0 -138
  106. package/dist/cjs/limel-badge_2.cjs.entry.js.map +0 -1
  107. package/dist/cjs/limel-portal_2.cjs.entry.js.map +0 -1
  108. package/dist/cjs/translations-2746c4c6.js.map +0 -1
  109. package/dist/esm/limel-badge_2.entry.js +0 -133
  110. package/dist/esm/limel-badge_2.entry.js.map +0 -1
  111. package/dist/esm/limel-portal_2.entry.js.map +0 -1
  112. package/dist/esm/translations-0c3c0779.js.map +0 -1
  113. package/dist/lime-elements/p-29b1f083.entry.js +0 -2
  114. package/dist/lime-elements/p-29b1f083.entry.js.map +0 -1
  115. package/dist/lime-elements/p-c8825e88.js +0 -2
  116. package/dist/lime-elements/p-c8825e88.js.map +0 -1
  117. package/dist/lime-elements/p-fe7243c1.entry.js +0 -2
  118. package/dist/lime-elements/p-fe7243c1.entry.js.map +0 -1
  119. /package/dist/lime-elements/{p-6edfe426.entry.js.map → p-011f5d81.entry.js.map} +0 -0
  120. /package/dist/lime-elements/{p-8a7bc823.entry.js.map → p-20d1913a.entry.js.map} +0 -0
  121. /package/dist/lime-elements/{p-244e13f5.entry.js.map → p-3f698d18.entry.js.map} +0 -0
  122. /package/dist/lime-elements/{p-9abbe61a.entry.js.map → p-441c1eab.entry.js.map} +0 -0
  123. /package/dist/lime-elements/{p-b957a3ca.entry.js.map → p-4558a60e.entry.js.map} +0 -0
  124. /package/dist/lime-elements/{p-d7e93894.entry.js.map → p-597e6f79.entry.js.map} +0 -0
  125. /package/dist/lime-elements/{p-208f87d2.entry.js.map → p-78abbc50.entry.js.map} +0 -0
  126. /package/dist/lime-elements/{p-e4d64dd2.entry.js.map → p-8ae75f4a.entry.js.map} +0 -0
  127. /package/dist/lime-elements/{p-5018673b.entry.js.map → p-99de518a.entry.js.map} +0 -0
  128. /package/dist/lime-elements/{p-2173d6d5.entry.js.map → p-bd619d56.entry.js.map} +0 -0
  129. /package/dist/lime-elements/{p-65d5d2fb.entry.js.map → p-bd6878ee.entry.js.map} +0 -0
  130. /package/dist/lime-elements/{p-5bf57c21.entry.js.map → p-ce29c097.entry.js.map} +0 -0
  131. /package/dist/lime-elements/{p-00aee6b6.entry.js.map → p-e7201ebd.entry.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{r as t,c as e,h as i,H as r}from"./p-288f0842.js";import{i as o}from"./p-b8c91b22.js";import{g as s}from"./p-d251f404.js";import{t as n}from"./p-58777116.js";import{c as a}from"./p-ad52787a.js";import"./p-89524e09.js";async function l(t,e){const{width:i,height:r,fit:o="cover",type:s="image/jpeg",quality:n=.85,rename:a=(t=>v(t,s))}=e;const l=await f(t);const{sx:c,sy:b,sw:p,sh:g,dx:w,dy:y,dw:k,dh:x}=m(l.width,l.height,i,r,o);const j=d(i,r);const z=h(j);z.clearRect(0,0,i,r);z.drawImage(l,c,b,p,g,w,y,k,x);const F=await u(j,s,n);const C=a(t.name);return new File([F],C,{type:s})}function c(){try{return typeof globalThis.OffscreenCanvas==="function"}catch(t){return false}}function d(t,e){if(c()){return new globalThis.OffscreenCanvas(t,e)}const i=document.createElement("canvas");i.width=t;i.height=e;return i}function h(t){const e=t.getContext("2d",{alpha:true});if(!e){throw new Error("2D canvas context not available")}return e}function u(t,e,i){if("convertToBlob"in t){return t.convertToBlob({type:e,quality:i})}return new Promise(((r,o)=>{t.toBlob((t=>{if(!t){o(new Error("Failed to create blob from canvas"));return}r(t)}),e,i)}))}async function f(t){var e,i;if(typeof globalThis.createImageBitmap==="function"){try{return await globalThis.createImageBitmap(t,{imageOrientation:"from-image"})}catch(t){const r=((i=(e=globalThis.process)===null||e===void 0?void 0:e.env)===null||i===void 0?void 0:i.NODE_ENV)!=="production";if(r&&typeof console!=="undefined"&&typeof console.debug==="function"){console.debug("createImageBitmap failed, falling back to HTMLImageElement:",t)}}}return await b(t)}async function b(t){var e;const i=URL.createObjectURL(t);try{const t=new Image;t.decoding="sync";t.src=i;await((e=t.decode)===null||e===void 0?void 0:e.call(t).catch((()=>undefined)));if(!t.complete){await new Promise(((e,i)=>{const r=()=>{t.removeEventListener("load",o);t.removeEventListener("error",s)};const o=()=>{r();e()};const s=t=>{r();i(t)};t.addEventListener("load",o);t.addEventListener("error",s)}))}return t}finally{URL.revokeObjectURL(i)}}function m(t,e,i,r,o){const s=t/e;const n=i/r;if(o==="cover"){let o;let a;if(s>n){a=e;o=e*n}else{o=t;a=t/n}const l=(t-o)/2;const c=(e-a)/2;return{sx:l,sy:c,sw:o,sh:a,dx:0,dy:0,dw:i,dh:r}}let a;let l;if(s>n){a=i;l=i/s}else{l=r;a=r*s}const c=(i-a)/2;const d=(r-l)/2;return{sx:0,sy:0,sw:t,sh:e,dx:c,dy:d,dw:a,dh:l}}function v(t,e){const i=e==="image/png"?"png":"jpg";const r=t.lastIndexOf(".");const o=r>0?t.slice(0,r):t;return`${o}.${i}`}const p="@charset \"UTF-8\";:host(limel-profile-picture){position:relative;display:inline-flex;min-width:1.5rem;min-height:1.5rem;border-radius:var(--profile-picture-border-radius, 100vw);background-color:rgb(var(--contrast-400))}*{box-sizing:border-box}limel-file-dropzone,limel-file-input,button.avatar{display:flex;align-items:center;justify-content:center;width:100%;height:100%}button{all:unset;display:block}button:focus{outline:none}button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.avatar{overflow:hidden;border-radius:var(--profile-picture-border-radius, 100vw)}:host(:not([disabled]):not([disabled=true])) button.avatar{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:transparent}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{will-change:color, background-color, box-shadow, transform}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover{box-shadow:var(--button-shadow-hovered)}:host(:not([disabled]):not([disabled=true])) button.avatar:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host([invalid]:not([invalid=false])) button.avatar{box-shadow:var(--shadow-error-state)}button.remove{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:rgb(var(--contrast-900));cursor:pointer;height:1.25rem;width:1.25rem;border-radius:50%;background-repeat:no-repeat;background-position:center;background-size:0.75rem;background-image:url(\"data:image/svg+xml; utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><defs/><path fill='rgb(255,255,255)' d='M7.219 5.781L5.78 7.22 14.563 16 5.78 24.781 7.22 26.22 16 17.437l8.781 8.782 1.438-1.438L17.437 16l8.782-8.781L24.78 5.78 16 14.563z'/></svg>\");position:absolute;top:0;left:0;opacity:0}button.remove:hover,button.remove:focus,button.remove:focus-visible{will-change:color, background-color, box-shadow, transform}button.remove:hover,button.remove:focus-visible{transform:translate3d(0, 0.01rem, 0);color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}button.remove:hover{box-shadow:var(--button-shadow-hovered)}button.remove:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}button.remove:hover,button.remove:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host(:hover) button.remove,:host(:focus) button.remove,:host(:focus-visible) button.remove,:host(:focus-within) button.remove,:host(:active) button.remove{animation:show 0.4s ease-in-out forwards}@keyframes show{0%{transform:scale(0.9);opacity:0}100%{transform:scale(1);opacity:1}}button.avatar,img,limel-icon{border-radius:var(--profile-picture-border-radius, 100vw)}limel-icon{width:calc(100% - 1rem);min-width:1rem;max-width:4rem;color:var(--limel-theme-text-secondary-on-background-color);margin:auto}img{object-fit:var(--limel-profile-picture-object-fit);width:100%;height:100%}:host(.has-image-error) img{border:1px dashed rgb(var(--contrast-600));background:url(\"data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill='rgba(186,186,192,0.16)' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>\");background-size:0.5rem}limel-spinner{position:absolute;inset:0;margin:auto}limel-popover{position:absolute;inset:auto 0 0 auto;display:block;width:2.25rem;height:2.25rem}";const g=class{constructor(r){t(this,r);this.change=e(this,"change",7);this.filesRejected=e(this,"filesRejected",7);this.removeButtonId=a();this.browseButtonId=a();this.renderHelperText=()=>{if(!this.helperText){return}return i("limel-tooltip",{elementId:this.browseButtonId,label:this.helperText})};this.handleNewFiles=async t=>{var e,i;t.stopPropagation();if(this.disabled){return}const r=(e=t.detail)===null||e===void 0?void 0:e[0];if(!r){return}if(!o(r,this.accept)){this.filesRejected.emit([r]);return}this.revokeObjectUrl();this.imageError=false;let s=r;if(this.resize&&r.fileContent instanceof File){try{const t=await l(r.fileContent,Object.assign(Object.assign({},this.resize),{fit:(i=this.resize.fit)!==null&&i!==void 0?i:this.imageFit}));s=Object.assign(Object.assign({},r),{filename:t.name,size:t.size,contentType:t.type,fileContent:t})}catch(t){s=r}}if(!s.href&&s.fileContent instanceof File){this.objectUrl=URL.createObjectURL(s.fileContent)}this.change.emit(s)};this.handleRejectedFiles=t=>{t.stopPropagation();this.filesRejected.emit(t.detail)};this.handleClear=t=>{t.stopPropagation();this.revokeObjectUrl();this.imageError=false;this.change.emit(undefined)};this.onImageError=()=>{this.imageError=true};this.openPopover=t=>{t.stopPropagation();this.isErrorMessagePopoverOpen=true};this.onPopoverClose=t=>{t.stopPropagation();this.isErrorMessagePopoverOpen=false};this.getTranslation=t=>n.get(t,this.language);this.language="en";this.label=undefined;this.icon="user";this.helperText=undefined;this.disabled=false;this.readonly=false;this.required=false;this.invalid=false;this.loading=false;this.value=undefined;this.imageFit="cover";this.accept="image/jpeg,image/png,image/heic,.jpg,.jpeg,.png,.heic";this.resize=undefined;this.objectUrl=undefined;this.imageError=false;this.isErrorMessagePopoverOpen=false}disconnectedCallback(){this.revokeObjectUrl()}handleValueChange(){this.revokeObjectUrl();this.imageError=false;const t=this.value;if(t&&typeof t!=="string"&&!t.href&&t.fileContent instanceof File){this.objectUrl=URL.createObjectURL(t.fileContent)}}render(){const t={"has-image-error":this.imageError};if(this.readonly){return i(r,{class:t},this.renderAvatar())}return i(r,{class:t},i("limel-file-dropzone",{disabled:this.disabled,accept:this.accept,onFilesSelected:this.handleNewFiles,onFilesRejected:this.handleRejectedFiles},i("limel-file-input",{accept:this.accept,disabled:this.disabled,"aria-required":this.required?"true":undefined,"aria-invalid":this.invalid?"true":undefined},this.renderBrowseButton())),this.renderClearButton(),this.renderSpinner(),this.renderErrorMessage(),this.renderHelperText())}get hasValue(){if(typeof this.value==="string"){return!!this.value}if(this.value&&(this.value.href||this.value.fileContent)){return true}return!!this.objectUrl}renderBrowseButton(){return i("button",{id:this.browseButtonId,type:"button",class:"avatar",disabled:this.disabled,"aria-label":this.label,"aria-busy":this.loading?"true":"false","aria-live":"polite"},this.renderAvatar())}renderAvatar(){const t=this.getImageSrc();if(t){return i("img",{src:t,alt:"",style:{"--limel-profile-picture-object-fit":this.imageFit},loading:"lazy",onError:this.onImageError})}return this.renderIcon()}renderIcon(){var t,e;const r=s(this.icon);return i("limel-icon",{name:r,style:{color:`${(t=this.icon)===null||t===void 0?void 0:t.color}`,"background-color":`${(e=this.icon)===null||e===void 0?void 0:e.backgroundColor}`}})}renderClearButton(){if(!this.hasValue||this.disabled){return}return[i("button",{class:"remove",type:"button",id:this.removeButtonId,onClick:this.handleClear}),i("limel-tooltip",{label:this.getTranslation("profile-picture.remove"),elementId:this.removeButtonId})]}renderSpinner(){if(!this.loading){return}return i("limel-spinner",null)}getUnsupportedPreviewContext(){const t=this.value;const e=!this.getImageSrc();const i=!!(t&&typeof t!=="string"&&t.fileContent instanceof File&&!t.href);const r=!!this.resize;return{hasNoSrc:e,hasLocalFile:i,isResizeConfigured:r}}shouldShowErrorMessage(){const{hasNoSrc:t,hasLocalFile:e,isResizeConfigured:i}=this.getUnsupportedPreviewContext();return(t||this.imageError)&&e&&i}renderErrorMessage(){if(!this.shouldShowErrorMessage()){return}const t={name:"error",color:"rgb(var(--color-orange-dark))"};const e={maxWidth:"20rem",borderRadius:"0.75rem"};return i("limel-popover",{open:this.isErrorMessagePopoverOpen,onClick:this.openPopover,onClose:this.onPopoverClose},i("limel-icon-button",{slot:"trigger",elevated:true,icon:t,"aria-live":"polite",label:this.getTranslation("profile-picture.unsupported-preview.title")}),i("limel-callout",{type:"warning",style:e,heading:this.getTranslation("profile-picture.unsupported-preview.title")},this.getTranslation("profile-picture.unsupported-preview.description")))}getImageSrc(){if(!this.value){return this.objectUrl}if(typeof this.value==="string"){return this.value}if(this.value.href){return this.value.href}if(this.value.fileContent instanceof File){return this.objectUrl}return undefined}revokeObjectUrl(){if(this.objectUrl){URL.revokeObjectURL(this.objectUrl);this.objectUrl=undefined}}static get watchers(){return{value:["handleValueChange"]}}};g.style=p;export{g as limel_profile_picture};
2
+ //# sourceMappingURL=p-7e3a4f49.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["async","resizeImage","file","options","width","height","fit","type","quality","rename","name","renameWithType","source","loadSource","sx","sy","sw","sh","dx","dy","dw","dh","computeRects","canvas","createCanvas","ctx","get2dContext","clearRect","drawImage","blob","canvasToBlob","File","supportsOffscreen","globalThis","OffscreenCanvas","_a","document","createElement","getContext","alpha","Error","convertToBlob","Promise","resolve","reject","toBlob","createImageBitmap","imageOrientation","error","isDev","_b","process","env","NODE_ENV","console","debug","loadImageElement","url","URL","createObjectURL","img","Image","decoding","src","decode","call","catch","undefined","complete","cleanup","removeEventListener","onLoad","onError","e","addEventListener","revokeObjectURL","tw","th","sRatio","tRatio","cropW","cropH","drawW","drawH","ext","idx","lastIndexOf","base","slice","profilePictureCss","ProfilePicture","this","removeButtonId","createRandomString","browseButtonId","renderHelperText","helperText","h","elementId","label","handleNewFiles","event","stopPropagation","disabled","detail","isTypeAccepted","accept","filesRejected","emit","revokeObjectUrl","imageError","out","resize","fileContent","processed","Object","assign","imageFit","filename","size","contentType","_c","href","objectUrl","change","handleRejectedFiles","handleClear","onImageError","openPopover","isErrorMessagePopoverOpen","onPopoverClose","getTranslation","key","translate","get","language","disconnectedCallback","handleValueChange","currentValue","value","render","hostClassNames","readonly","Host","class","renderAvatar","onFilesSelected","onFilesRejected","required","invalid","renderBrowseButton","renderClearButton","renderSpinner","renderErrorMessage","hasValue","id","loading","getImageSrc","alt","style","renderIcon","icon","getIconName","color","backgroundColor","onClick","getUnsupportedPreviewContext","hasNoSrc","hasLocalFile","isResizeConfigured","shouldShowErrorMessage","errorIcon","errorMessageStyles","maxWidth","borderRadius","open","onClose","slot","elevated","heading"],"sources":["./src/util/image-resize.ts","./src/components/profile-picture/profile-picture.scss?tag=limel-profile-picture&encapsulation=shadow","./src/components/profile-picture/profile-picture.tsx"],"sourcesContent":["/**\n * Image resize utilities\n *\n * Overview\n * --------\n * This module provides a small, dependency-free utility to resize images on the client\n * (in the browser) before uploading. It works by decoding an input `File` to an\n * `ImageBitmap` (or falling back to an `HTMLImageElement`), drawing it onto a\n * `Canvas`/`OffscreenCanvas` with the requested strategy (cover/contain), and\n * then exporting the result to a new `File` with your preferred MIME type and\n * quality.\n *\n * Why resize client-side?\n * - Faster perceived uploads and lower bandwidth usage\n * - Consistent avatar sizes and formats (e.g., JPEG 400x400)\n * - No server-side transformation required for common cases\n *\n * Fit strategies\n * - `cover` (default): The image is scaled to cover the target rectangle, and\n * the excess parts are center-cropped. Good for avatars.\n * - `contain`: The image is scaled to fit entirely within the target rectangle\n * without cropping, letterboxing if needed. Good when you must preserve the\n * entire image.\n *\n * Decoding & EXIF orientation\n * EXIF orientation is a piece of metadata stored inside image files\n * (usually JPEGs) that tells image renderer software how the image should be displayed\n * i.e., whether it should be rotated or flipped. This meta data is normally added\n * to photos by digital cameras and phones.\n * - When available, `createImageBitmap(file, { imageOrientation: 'from-image' })`\n * is used to automatically respect EXIF orientation.\n * - If not available or it fails (e.g., unsupported format), we fall back to\n * decoding via an `HTMLImageElement`.\n *\n * OffscreenCanvas\n * - If the environment supports `OffscreenCanvas`, it will be used for the draw\n * and encode operations for better performance in some cases. Otherwise, a\n * regular `HTMLCanvasElement` is used.\n *\n * HEIC/HEIF notes\n * - All major browsers except Safari lack native HEIC/HEIF decoding.\n * In such cases the `resizeImage` function will throw when decoding fails.\n * The caller should catch and fall back\n * to using the original file or handle conversion on the server.\n * - If we need guaranteed client-side HEIC->JPEG conversion, we must add a small\n * library or WASM module; this utility intentionally avoids extra dependencies.\n *\n * Output type & quality\n * - Default output is `image/jpeg` with `quality=0.85`, which is typically\n * appropriate for avatars. You can switch to `image/png` to preserve\n * transparency.\n * - The output filename extension is adjusted to match the chosen MIME type by\n * default (e.g., `.jpg` or `.png`). You can override naming via the `rename`\n * option.\n *\n * Error handling\n * - Throws if canvas/context cannot be created or if canvas->blob conversion fails.\n * - Decoding failures (unsupported type) will throw; caller can try/catch and\n * fall back to the original file.\n *\n * Performance tips\n * - Keep target sizes reasonable (e.g., 256–1024 px) to avoid long processing\n * times on modest devices.\n * - JPEG with quality 0.8–0.9 often strikes a good balance between size and\n * perceived quality for photos/avatars.\n *\n * Usage examples\n * --------------\n * Basic usage:\n * ```ts\n * import { resizeImage } from '@limetech/lime-elements/util/image-resize';\n *\n * const processed = await resizeImage(file, {\n * width: 400,\n * height: 400,\n * fit: 'cover', // default; center-crops\n * type: 'image/jpeg', // default\n * quality: 0.85, // default\n * });\n * // Upload `processed` instead of the original file\n * ```\n *\n * With custom naming:\n * ```ts\n * const processed = await resizeImage(file, {\n * width: 800,\n * height: 800,\n * fit: 'contain',\n * type: 'image/png',\n * rename: (name) => name.replace(/\\.[^.]+$/, '') + '_resized.png',\n * });\n * ```\n *\n * In a Stencil component (simplified):\n * ```tsx\n * private async handleFilesSelected(file: File) {\n * try {\n * const resized = await resizeImage(file, { width: 400, height: 400 });\n * // build your FileInfo and emit\n * } catch {\n * // fall back to original\n * }\n * }\n * ```\n */\n// (Removed exported ResizeFit to avoid forcing a public symbol.)\n\n/**\n * Options for client-side image resizing.\n * @beta\n */\nexport type ResizeOptions = {\n /** Target width in CSS pixels. */\n width: number;\n /** Target height in CSS pixels. */\n height: number;\n /** Fit strategy; defaults to 'cover'. */\n fit?: 'cover' | 'contain';\n /** Output MIME type; 'image/jpeg' by default. */\n type?: 'image/jpeg' | 'image/png';\n /** JPEG quality (0..1); used only for 'image/jpeg'. Defaults to 0.85. */\n quality?: number;\n /** Optional renaming function. Defaults to changing extension to match MIME. */\n rename?: (originalName: string) => string;\n};\n\ntype SourceLike = ImageBitmap | HTMLImageElement;\n\n/**\n * Resize an image file on the client using Canvas/OffscreenCanvas.\n * Returns a new File with the requested format and dimensions.\n *\n * Contract\n * - Input: image `File`\n * - Output: resized image as a new `File` with updated `type`, name, and size\n * - Errors: may throw on decode failure or canvas export failure\n *\n * @beta\n * @param file - The image file to resize.\n * @param options - Configuration for the resize operation.\n */\nexport async function resizeImage(\n file: File,\n options: ResizeOptions\n): Promise<File> {\n const {\n width,\n height,\n fit = 'cover',\n type = 'image/jpeg',\n quality = 0.85,\n rename = (name: string) => renameWithType(name, type),\n } = options;\n\n const source = await loadSource(file);\n const { sx, sy, sw, sh, dx, dy, dw, dh } = computeRects(\n source.width as number,\n source.height as number,\n width,\n height,\n fit\n );\n\n const canvas = createCanvas(width, height);\n const ctx = get2dContext(canvas);\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(source, sx, sy, sw, sh, dx, dy, dw, dh);\n\n const blob = await canvasToBlob(canvas, type, quality);\n const name = rename(file.name);\n return new File([blob], name, { type });\n}\n\n/** Whether OffscreenCanvas is available in the current environment. */\nfunction supportsOffscreen(): boolean {\n try {\n return typeof (globalThis as any).OffscreenCanvas === 'function';\n } catch {\n return false;\n }\n}\n\n/**\n * Create either an OffscreenCanvas or a regular canvas for drawing.\n * @param width - Target width\n * @param height - Target height\n */\nfunction createCanvas(\n width: number,\n height: number\n): HTMLCanvasElement | OffscreenCanvas {\n if (supportsOffscreen()) {\n return new (globalThis as any).OffscreenCanvas(width, height);\n }\n\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n return canvas;\n}\n\n/**\n * Get the 2D rendering context, throwing a descriptive error if unavailable.\n * @param canvas - The canvas to get context from\n */\nfunction get2dContext(canvas: HTMLCanvasElement | OffscreenCanvas) {\n const ctx = (canvas as any).getContext('2d', { alpha: true });\n if (!ctx) {\n throw new Error('2D canvas context not available');\n }\n\n return ctx as CanvasRenderingContext2D;\n}\n\n/**\n * Convert the canvas content to a Blob, supporting both canvas types.\n * @param canvas - The source canvas\n * @param type - Output MIME type\n * @param quality - JPEG quality (0..1)\n */\nfunction canvasToBlob(\n canvas: HTMLCanvasElement | OffscreenCanvas,\n type: string,\n quality: number\n): Promise<Blob> {\n if ('convertToBlob' in canvas) {\n return (canvas as OffscreenCanvas).convertToBlob({ type, quality });\n }\n\n return new Promise((resolve, reject) => {\n (canvas as HTMLCanvasElement).toBlob(\n (blob) => {\n if (!blob) {\n reject(new Error('Failed to create blob from canvas'));\n return;\n }\n resolve(blob);\n },\n type,\n quality\n );\n });\n}\n\n/**\n * Load the image into a decodable source (ImageBitmap preferred).\n * @param file - The input file to decode\n */\n\nasync function loadSource(file: File): Promise<SourceLike> {\n if (typeof (globalThis as any).createImageBitmap === 'function') {\n try {\n return await (globalThis as any).createImageBitmap(file, {\n imageOrientation: 'from-image',\n } as any);\n } catch (error) {\n // Log for debugging in development, but continue with fallback\n const isDev =\n (globalThis as any).process?.env?.NODE_ENV !== 'production';\n\n if (\n isDev &&\n typeof console !== 'undefined' &&\n typeof console.debug === 'function'\n ) {\n console.debug(\n 'createImageBitmap failed, falling back to HTMLImageElement:',\n error\n );\n }\n }\n }\n\n return await loadImageElement(file);\n}\n\n/**\n * Decode an image file via HTMLImageElement when ImageBitmap is unavailable.\n * @param file - The input file to decode\n */\nasync function loadImageElement(file: File): Promise<HTMLImageElement> {\n const url = URL.createObjectURL(file);\n try {\n const img = new Image();\n img.decoding = 'sync';\n img.src = url;\n await img.decode?.().catch(() => undefined);\n if (!img.complete) {\n await new Promise<void>((resolve, reject) => {\n const cleanup = () => {\n img.removeEventListener('load', onLoad);\n img.removeEventListener('error', onError);\n };\n\n const onLoad = () => {\n cleanup();\n resolve();\n };\n const onError = (e: Event) => {\n cleanup();\n reject(e);\n };\n\n img.addEventListener('load', onLoad);\n img.addEventListener('error', onError);\n });\n }\n return img;\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n\n/**\n * Compute source and destination rectangles for drawImage based on the fit mode.\n *\n * Returns sx, sy, sw, sh for the source crop/area and dx, dy, dw, dh for the\n * destination rectangle on the target canvas.\n *\n * @param sw - Source width\n * @param sh - Source height\n * @param tw - Target width\n * @param th - Target height\n * @param fit - Fit mode (cover/contain)\n */\nfunction computeRects(\n sw: number,\n sh: number,\n tw: number,\n th: number,\n fit: 'cover' | 'contain'\n) {\n const sRatio = sw / sh;\n const tRatio = tw / th;\n\n if (fit === 'cover') {\n // scale source to cover target, then center-crop\n let cropW: number;\n let cropH: number;\n if (sRatio > tRatio) {\n // source is wider than target: crop width\n cropH = sh;\n cropW = sh * tRatio;\n } else {\n // source is taller than target: crop height\n cropW = sw;\n cropH = sw / tRatio;\n }\n const sx = (sw - cropW) / 2;\n const sy = (sh - cropH) / 2;\n return { sx, sy, sw: cropW, sh: cropH, dx: 0, dy: 0, dw: tw, dh: th };\n }\n\n // contain: fit inside, letterbox if needed\n let drawW: number;\n let drawH: number;\n if (sRatio > tRatio) {\n drawW = tw;\n drawH = tw / sRatio;\n } else {\n drawH = th;\n drawW = th * sRatio;\n }\n const dx = (tw - drawW) / 2;\n const dy = (th - drawH) / 2;\n\n return { sx: 0, sy: 0, sw, sh, dx, dy, dw: drawW, dh: drawH };\n}\n\n/**\n * Update filename extension to match the desired MIME type.\n * @param name - Original filename\n * @param type - Output MIME type\n */\nfunction renameWithType(name: string, type: string): string {\n const ext = type === 'image/png' ? 'png' : 'jpg';\n const idx = name.lastIndexOf('.');\n const base = idx > 0 ? name.slice(0, idx) : name;\n return `${base}.${ext}`;\n}\n","@use '../../style/mixins';\n\n/**\n* @prop --profile-picture-border-radius: Border radius of the profile picture. Defaults to `100vw` to render a circular shape.\n*/\n\n:host(limel-profile-picture) {\n position: relative;\n\n display: inline-flex;\n min-width: 1.5rem;\n min-height: 1.5rem;\n\n border-radius: var(--profile-picture-border-radius, 100vw);\n background-color: rgb(var(--contrast-400));\n}\n\n* {\n box-sizing: border-box;\n}\n\nlimel-file-dropzone,\nlimel-file-input,\nbutton.avatar {\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n}\n\nbutton {\n all: unset;\n display: block;\n @include mixins.visualize-keyboard-focus();\n\n &.avatar {\n overflow: hidden;\n border-radius: var(--profile-picture-border-radius, 100vw);\n\n :host(:not([disabled]):not([disabled='true'])) & {\n @include mixins.is-flat-clickable();\n }\n\n :host([invalid]:not([invalid='false'])) & {\n box-shadow: var(--shadow-error-state);\n }\n }\n\n &.remove {\n @include mixins.clear-all-button();\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n\n :host(:hover) &,\n :host(:focus) &,\n :host(:focus-visible) &,\n :host(:focus-within) &,\n :host(:active) & {\n animation: show 0.4s ease-in-out forwards;\n }\n }\n}\n\n@keyframes show {\n 0% {\n transform: scale(0.9);\n opacity: 0;\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n}\n\nbutton.avatar,\nimg,\nlimel-icon {\n border-radius: var(--profile-picture-border-radius, 100vw);\n}\n\nlimel-icon {\n width: calc(100% - 1rem);\n min-width: 1rem;\n max-width: 4rem;\n color: var(--limel-theme-text-secondary-on-background-color);\n margin: auto;\n}\n\nimg {\n object-fit: var(--limel-profile-picture-object-fit);\n width: 100%;\n height: 100%;\n\n :host(.has-image-error) & {\n border: 1px dashed rgb(var(--contrast-600));\n background: url(\"data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill='rgba(186,186,192,0.16)' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>\");\n background-size: 0.5rem;\n }\n}\n\nlimel-spinner {\n position: absolute;\n inset: 0;\n margin: auto;\n}\n\nlimel-popover {\n position: absolute;\n inset: auto 0 0 auto;\n display: block;\n width: 2.25rem;\n height: 2.25rem;\n}\n","import {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { FileInfo } from '../../global/shared-types/file.types';\nimport { isTypeAccepted } from '../../util/files';\nimport { Icon } from '../../global/shared-types/icon.types';\nimport { getIconName } from '../icon/get-icon-props';\nimport translate from '../../global/translations';\nimport { Languages } from '../date-picker/date.types';\nimport { createRandomString } from '../../util/random-string';\nimport { resizeImage, ResizeOptions } from '../../util/image-resize';\n\n/**\n * This component displays a profile picture, while allowing the user\n * to change it via a file input or drag-and-drop.\n *\n * It supports client-side image resizing and conversion,\n * as well as a simple lazy-loading mechanism.\n *\n * @exampleComponent limel-example-profile-picture-basic\n * @exampleComponent limel-example-profile-picture-helper-text\n * @exampleComponent limel-example-profile-picture-icon\n * @exampleComponent limel-example-profile-picture-with-value\n * @exampleComponent limel-example-profile-picture-loading\n * @exampleComponent limel-example-profile-picture-image-fit\n * @exampleComponent limel-example-profile-picture-composite\n * @exampleComponent limel-example-profile-picture-resize-contain\n * @exampleComponent limel-example-profile-picture-resize-cover\n * @exampleComponent limel-example-profile-picture-resize-fallback\n * @exampleComponent limel-example-profile-picture-styling\n * @beta\n */\n@Component({\n tag: 'limel-profile-picture',\n shadow: true,\n styleUrl: 'profile-picture.scss',\n})\nexport class ProfilePicture {\n /**\n * Defines the language for translations.\n * Will translate the translatable strings on the components.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\n /**\n * Accessible label for the the browse button.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Placeholder icon of the component, displayed when no image is present.\n */\n @Prop()\n public icon: string | Icon = 'user';\n\n /**\n * Helper text shown as a tooltip on hover or focus.\n */\n @Prop()\n public helperText?: string;\n\n /**\n * Disables user interaction.\n * Prevents uploading new pictures or removing existing ones.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Readonly prevents changing the value but allows interaction like focus.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Marks the control as required.\n */\n @Prop({ reflect: true })\n public required = false;\n\n /**\n * Marks the control as invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * Set to `true` to put the component in the `loading` state,\n * and render an indeterminate progress indicator inside.\n * This does _not_ disable the interactivity of the component!\n */\n @Prop({ reflect: true })\n public loading = false;\n\n /**\n * Current image to display. Either a URL string or a `FileInfo` with an href.\n */\n @Prop()\n public value?: string | FileInfo;\n\n /**\n * How the image should fit within the container.\n * - `cover` will fill the container and crop excess parts.\n * - `contain` will scale the image to fit within the container without cropping.\n */\n @Prop({ reflect: true })\n public imageFit: 'cover' | 'contain' = 'cover';\n\n /**\n * A comma-separated list of accepted file types.\n */\n @Prop({ reflect: true })\n public accept: string =\n 'image/jpeg,image/png,image/heic,.jpg,.jpeg,.png,.heic';\n\n /**\n * Optional client-side resize before emitting the file.\n * If provided, the selected image will be resized on the client device.\n * :::note\n * HEIC may not decode in all browsers; when decoding fails, the original\n * file will be emitted. See the examples for more info.\n * :::\n */\n @Prop()\n public resize?: ResizeOptions;\n\n /**\n * Emitted when the picture changes (first FileInfo only).\n */\n @Event()\n public change: EventEmitter<FileInfo | undefined>;\n\n /**\n * Emitted when a file is rejected by accept filter.\n */\n @Event()\n public filesRejected: EventEmitter<FileInfo[]>;\n\n @State()\n private objectUrl?: string;\n\n @State()\n private imageError = false;\n\n @State()\n private isErrorMessagePopoverOpen = false;\n\n private removeButtonId = createRandomString();\n private browseButtonId = createRandomString();\n\n public disconnectedCallback() {\n this.revokeObjectUrl();\n }\n\n @Watch('value')\n protected handleValueChange() {\n // Clear previously created object URL when value changes\n this.revokeObjectUrl();\n this.imageError = false;\n\n // If a new File without href is provided, create an object URL for preview\n const currentValue = this.value;\n if (\n currentValue &&\n typeof currentValue !== 'string' &&\n !currentValue.href &&\n currentValue.fileContent instanceof File\n ) {\n this.objectUrl = URL.createObjectURL(currentValue.fileContent);\n }\n }\n\n public render() {\n const hostClassNames = {\n 'has-image-error': this.imageError,\n };\n\n if (this.readonly) {\n return <Host class={hostClassNames}>{this.renderAvatar()}</Host>;\n }\n\n return (\n <Host class={hostClassNames}>\n <limel-file-dropzone\n disabled={this.disabled}\n accept={this.accept}\n onFilesSelected={this.handleNewFiles}\n onFilesRejected={this.handleRejectedFiles}\n >\n <limel-file-input\n accept={this.accept}\n disabled={this.disabled}\n aria-required={this.required ? 'true' : undefined}\n aria-invalid={this.invalid ? 'true' : undefined}\n >\n {this.renderBrowseButton()}\n </limel-file-input>\n </limel-file-dropzone>\n {this.renderClearButton()}\n {this.renderSpinner()}\n {this.renderErrorMessage()}\n {this.renderHelperText()}\n </Host>\n );\n }\n\n private get hasValue(): boolean {\n if (typeof this.value === 'string') {\n return !!this.value;\n }\n\n if (this.value && (this.value.href || this.value.fileContent)) {\n return true;\n }\n\n return !!this.objectUrl;\n }\n\n private renderBrowseButton() {\n return (\n <button\n id={this.browseButtonId}\n type=\"button\"\n class=\"avatar\"\n disabled={this.disabled}\n aria-label={this.label}\n aria-busy={this.loading ? 'true' : 'false'}\n aria-live=\"polite\"\n >\n {this.renderAvatar()}\n </button>\n );\n }\n\n private renderAvatar() {\n const src = this.getImageSrc();\n\n if (src) {\n return (\n <img\n src={src}\n alt=\"\"\n style={{\n '--limel-profile-picture-object-fit': this.imageFit,\n }}\n loading=\"lazy\"\n onError={this.onImageError}\n />\n );\n }\n\n return this.renderIcon();\n }\n\n private renderIcon() {\n const icon = getIconName(this.icon);\n\n return (\n <limel-icon\n name={icon}\n style={{\n color: `${(this.icon as Icon)?.color}`,\n 'background-color': `${\n (this.icon as Icon)?.backgroundColor\n }`,\n }}\n />\n );\n }\n\n private renderClearButton() {\n if (!this.hasValue || this.disabled) {\n return;\n }\n\n return [\n <button\n class=\"remove\"\n type=\"button\"\n id={this.removeButtonId}\n onClick={this.handleClear}\n />,\n <limel-tooltip\n label={this.getTranslation('profile-picture.remove')}\n elementId={this.removeButtonId}\n />,\n ];\n }\n\n private renderSpinner() {\n if (!this.loading) {\n return;\n }\n\n return <limel-spinner />;\n }\n\n private renderHelperText = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <limel-tooltip\n elementId={this.browseButtonId}\n label={this.helperText}\n />\n );\n };\n\n // Collects derived flags used for deciding whether to show the unsupported preview message\n private getUnsupportedPreviewContext() {\n const currentValue = this.value;\n const hasNoSrc = !this.getImageSrc();\n const hasLocalFile = !!(\n currentValue &&\n typeof currentValue !== 'string' &&\n currentValue.fileContent instanceof File &&\n !currentValue.href\n );\n const isResizeConfigured = !!this.resize;\n\n return { hasNoSrc, hasLocalFile, isResizeConfigured };\n }\n\n private shouldShowErrorMessage(): boolean {\n const { hasNoSrc, hasLocalFile, isResizeConfigured } =\n this.getUnsupportedPreviewContext();\n\n return (\n (hasNoSrc || this.imageError) && hasLocalFile && isResizeConfigured\n );\n }\n\n // Shows a non-intrusive note when there is a File without href and no object URL, which\n // can happen if the browser failed to decode the source (e.g., HEIC in Chromium).\n private renderErrorMessage() {\n if (!this.shouldShowErrorMessage()) {\n return;\n }\n\n const errorIcon = {\n name: 'error',\n color: 'rgb(var(--color-orange-dark))',\n };\n const errorMessageStyles = {\n maxWidth: '20rem',\n borderRadius: '0.75rem',\n };\n return (\n <limel-popover\n open={this.isErrorMessagePopoverOpen}\n onClick={this.openPopover}\n onClose={this.onPopoverClose}\n >\n <limel-icon-button\n slot=\"trigger\"\n elevated={true}\n icon={errorIcon}\n aria-live=\"polite\"\n label={this.getTranslation(\n 'profile-picture.unsupported-preview.title'\n )}\n />\n <limel-callout\n type=\"warning\"\n style={errorMessageStyles}\n heading={this.getTranslation(\n 'profile-picture.unsupported-preview.title'\n )}\n >\n {this.getTranslation(\n 'profile-picture.unsupported-preview.description'\n )}\n </limel-callout>\n </limel-popover>\n );\n }\n\n private handleNewFiles = async (event: CustomEvent<FileInfo[]>) => {\n event.stopPropagation();\n if (this.disabled) {\n return;\n }\n\n const file = event.detail?.[0];\n if (!file) {\n return;\n }\n\n if (!isTypeAccepted(file, this.accept)) {\n this.filesRejected.emit([file]);\n return;\n }\n\n this.revokeObjectUrl();\n this.imageError = false;\n\n let out = file;\n\n // Optional client-side resize\n if (this.resize && file.fileContent instanceof File) {\n try {\n const processed = await resizeImage(file.fileContent, {\n ...this.resize,\n fit: this.resize.fit ?? this.imageFit,\n });\n out = {\n ...file,\n filename: processed.name,\n size: processed.size,\n contentType: processed.type,\n fileContent: processed,\n };\n } catch {\n // Fall back to original file if resize fails\n out = file;\n }\n }\n // Create an object URL for immediate preview if no href present\n if (!out.href && out.fileContent instanceof File) {\n this.objectUrl = URL.createObjectURL(out.fileContent);\n }\n this.change.emit(out);\n };\n\n private handleRejectedFiles = (event: CustomEvent<FileInfo[]>) => {\n event.stopPropagation();\n this.filesRejected.emit(event.detail);\n };\n\n private getImageSrc(): string | undefined {\n if (!this.value) {\n return this.objectUrl; // Could be set from last selection before parent consumes\n }\n\n if (typeof this.value === 'string') {\n return this.value;\n }\n\n if (this.value.href) {\n return this.value.href;\n }\n\n if (this.value.fileContent instanceof File) {\n return this.objectUrl;\n }\n\n return undefined;\n }\n\n private revokeObjectUrl() {\n if (this.objectUrl) {\n URL.revokeObjectURL(this.objectUrl);\n this.objectUrl = undefined;\n }\n }\n\n private handleClear = (event: Event) => {\n event.stopPropagation();\n this.revokeObjectUrl();\n this.imageError = false;\n this.change.emit(undefined);\n };\n\n private onImageError = () => {\n this.imageError = true;\n };\n\n private openPopover = (event: MouseEvent) => {\n event.stopPropagation();\n this.isErrorMessagePopoverOpen = true;\n };\n\n private onPopoverClose = (event: CustomEvent) => {\n event.stopPropagation();\n this.isErrorMessagePopoverOpen = false;\n };\n\n private getTranslation = (key: string) => {\n return translate.get(key, this.language);\n };\n}\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{r as e,h as r,H as i,g as t}from"./p-288f0842.js";import{t as s}from"./p-c8825e88.js";const a=':host(limel-linear-progress){isolation:isolate;position:relative;overflow:hidden;display:flex;width:100%;height:0.25rem;border-radius:0.25rem;background-color:var(--background-color, rgb(var(--contrast-800), 0.5))}.progress{height:100%;width:var(--percentage, 0%);border-radius:0.25rem;background-color:var(--lime-primary-color, var(--limel-theme-primary-color))}:host(limel-linear-progress[indeterminate]) .progress{background-color:transparent;width:100%}:host(limel-linear-progress[indeterminate]) .progress:before,:host(limel-linear-progress[indeterminate]) .progress:after{will-change:left, right, opacity;content:"";position:absolute;inset:0;height:100%;border-radius:0.25rem;opacity:0;background-color:var(--lime-primary-color, var(--limel-theme-primary-color))}:host(limel-linear-progress[indeterminate]) .progress:before{animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite}:host(limel-linear-progress[indeterminate]) .progress:after{animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite 1.15s}@keyframes indeterminate{0%{left:-35%;right:100%;opacity:0}10%,80%{opacity:1}60%{left:100%;right:-90%}100%{left:100%;right:-90%;opacity:0}}@keyframes indeterminate-short{0%{left:-200%;right:100%;opacity:0}10%,80%{opacity:1}60%{left:107%;right:-8%}100%{left:107%;right:-8%;opacity:0}}';const o=100;const n=class{constructor(r){e(this,r);this.language="en";this.value=0;this.indeterminate=false;this.accessibleLabel=undefined}render(){if(!this.isFinite(this.value)){return}const e=s.get("loading",this.language);const t=s.get("progress-bar",this.language);const a=this.indeterminate?undefined:this.value;const n=this.indeterminate?e:undefined;return r(i,{role:"progressbar","aria-label":this.accessibleLabel||t,"aria-live":"polite","aria-valuemin":"0","aria-valuemax":"1","aria-valuenow":a,"aria-valuetext":n,style:{"--percentage":`${this.value*o}%`}},r("div",{class:"progress"}))}watchValue(e){if(!this.isFinite(e)){return}this.updateProgress(e)}updateProgress(e){if(this.host){this.host.style.setProperty("--percentage",`${e*o}%`)}}isFinite(e){return Number.isFinite(e)}get host(){return t(this)}static get watchers(){return{value:["watchValue"]}}};n.style=a;export{n as limel_linear_progress};
2
- //# sourceMappingURL=p-e4d64dd2.entry.js.map
1
+ import{r as e,h as r,H as i,g as t}from"./p-288f0842.js";import{t as s}from"./p-58777116.js";const a=':host(limel-linear-progress){isolation:isolate;position:relative;overflow:hidden;display:flex;width:100%;height:0.25rem;border-radius:0.25rem;background-color:var(--background-color, rgb(var(--contrast-800), 0.5))}.progress{height:100%;width:var(--percentage, 0%);border-radius:0.25rem;background-color:var(--lime-primary-color, var(--limel-theme-primary-color))}:host(limel-linear-progress[indeterminate]) .progress{background-color:transparent;width:100%}:host(limel-linear-progress[indeterminate]) .progress:before,:host(limel-linear-progress[indeterminate]) .progress:after{will-change:left, right, opacity;content:"";position:absolute;inset:0;height:100%;border-radius:0.25rem;opacity:0;background-color:var(--lime-primary-color, var(--limel-theme-primary-color))}:host(limel-linear-progress[indeterminate]) .progress:before{animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite}:host(limel-linear-progress[indeterminate]) .progress:after{animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite 1.15s}@keyframes indeterminate{0%{left:-35%;right:100%;opacity:0}10%,80%{opacity:1}60%{left:100%;right:-90%}100%{left:100%;right:-90%;opacity:0}}@keyframes indeterminate-short{0%{left:-200%;right:100%;opacity:0}10%,80%{opacity:1}60%{left:107%;right:-8%}100%{left:107%;right:-8%;opacity:0}}';const o=100;const n=class{constructor(r){e(this,r);this.language="en";this.value=0;this.indeterminate=false;this.accessibleLabel=undefined}render(){if(!this.isFinite(this.value)){return}const e=s.get("loading",this.language);const t=s.get("progress-bar",this.language);const a=this.indeterminate?undefined:this.value;const n=this.indeterminate?e:undefined;return r(i,{role:"progressbar","aria-label":this.accessibleLabel||t,"aria-live":"polite","aria-valuemin":"0","aria-valuemax":"1","aria-valuenow":a,"aria-valuetext":n,style:{"--percentage":`${this.value*o}%`}},r("div",{class:"progress"}))}watchValue(e){if(!this.isFinite(e)){return}this.updateProgress(e)}updateProgress(e){if(this.host){this.host.style.setProperty("--percentage",`${e*o}%`)}}isFinite(e){return Number.isFinite(e)}get host(){return t(this)}static get watchers(){return{value:["watchValue"]}}};n.style=a;export{n as limel_linear_progress};
2
+ //# sourceMappingURL=p-8ae75f4a.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as t,c as e,h as r}from"./p-288f0842.js";import{t as a}from"./p-c8825e88.js";import{c as i}from"./p-ad52787a.js";const o='@charset "UTF-8";:host(limel-chart){--chart-axis-line-color:var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );box-sizing:border-box;isolation:isolate;display:flex;width:100%;height:100%;min-width:0;min-height:0;padding:var(--limel-chart-padding)}table{all:unset;border-collapse:collapse;border-spacing:0;empty-cells:show;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}table colgroup,table thead,table tbody,table tr,table th,table td{all:unset}table caption,table colgroup,table thead,table tfoot,table th,table td{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}*,*:before,*:after{box-sizing:border-box}.chart{position:relative;flex-grow:1;width:100%;height:100%;min-height:0;min-width:0}.chart:has(.item:hover) .item,.chart:has(.item:focus-visible) .item{opacity:0.4}.item{transition:background-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.4s ease;cursor:help}.item:focus{outline:none}.item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.item:focus-visible,.item:hover{opacity:1 !important}.item[role=button]{cursor:pointer}limel-spinner{margin:auto}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart,:host(limel-chart[type=line]) .chart,:host(limel-chart[type=area]) .chart{display:flex;background-color:var(--chart-background-color, transparent)}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item,:host(limel-chart[type=line]) .item,:host(limel-chart[type=area]) .item{position:relative;mix-blend-mode:hard-light}:host(limel-chart[type=bar][orientation=landscape]),:host(limel-chart[type=dot][orientation=landscape]),:host(limel-chart[type=line][orientation=landscape]),:host(limel-chart[type=area][orientation=landscape]){--limel-chart-padding:0.5rem 0.5rem 0.5rem 2rem}:host(limel-chart[type=bar][orientation=landscape]) .chart,:host(limel-chart[type=dot][orientation=landscape]) .chart,:host(limel-chart[type=line][orientation=landscape]) .chart,:host(limel-chart[type=area][orientation=landscape]) .chart{flex-direction:row;align-items:flex-end;overflow:auto hidden;padding:0 0.125rem}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item,:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{min-width:0.5rem;width:inherit}:host(limel-chart[type=bar][orientation=portrait]),:host(limel-chart[type=dot][orientation=portrait]),:host(limel-chart[type=line][orientation=portrait]),:host(limel-chart[type=area][orientation=portrait]){--limel-chart-padding:0.5rem 0.5rem 1rem 0.5rem}:host(limel-chart[type=bar][orientation=portrait]) .chart,:host(limel-chart[type=dot][orientation=portrait]) .chart,:host(limel-chart[type=line][orientation=portrait]) .chart,:host(limel-chart[type=area][orientation=portrait]) .chart{flex-direction:column;overflow:hidden auto;padding:0.125rem 0}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item,:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{min-height:0.5rem;height:inherit}:host(limel-chart[type=pie]) table,:host(limel-chart[type=doughnut]) table,:host(limel-chart[type=ring]) table{min-height:2rem;min-width:2rem}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .chart,:host(limel-chart[type=ring]) .item{aspect-ratio:1;display:flex;margin:auto}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=ring]) .chart{justify-content:center;align-items:center}:host(limel-chart[type=pie]) .chart:before,:host(limel-chart[type=doughnut]) .chart:before,:host(limel-chart[type=ring]) .chart:before{aspect-ratio:1;content:"";position:absolute;z-index:0;inset:0;margin:auto;border-radius:50%;max-width:100%;max-height:100%;background-color:var(--chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .item{max-width:100%;max-height:100%;border-radius:50%;position:absolute;inset:0}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart{gap:0.5rem}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item{display:flex;align-items:center;justify-content:center;border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=bar]) .item{background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item:before,:host(limel-chart[type=dot]) .item:after{content:"";position:absolute;margin:auto;width:0.5rem;height:0.5rem;border-radius:50%}:host(limel-chart[type=dot]) .item::after{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item.has-start-value:before{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item{height:calc(var(--limel-chart-item-size) * 1%);bottom:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=landscape]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=landscape]) .item.has-negative-value-only{height:calc(var(--limel-chart-item-size) * -1%);transform-origin:bottom;transform:rotateX(180deg)}:host(limel-chart[type=dot][orientation=landscape]) .item.has-start-value,:host(limel-chart[type=dot][orientation=landscape]) .item:hover,:host(limel-chart[type=dot][orientation=landscape]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=dot][orientation=landscape]) .item:before{inset:auto 0 0 0;transform:translateY(50%)}:host(limel-chart[type=dot][orientation=landscape]) .item::after{inset:0 0 auto 0;transform:translateY(-50%)}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item{width:calc(var(--limel-chart-item-size) * 1%);left:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=portrait]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=portrait]) .item.has-negative-value-only{width:calc(var(--limel-chart-item-size) * -1%);transform-origin:left;transform:rotateY(180deg)}:host(limel-chart[type=dot][orientation=portrait]) .item.has-start-value,:host(limel-chart[type=dot][orientation=portrait]) .item:hover,:host(limel-chart[type=dot][orientation=portrait]) .item:focus-visible{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/100% 1px no-repeat}:host(limel-chart[type=dot][orientation=portrait]) .item:before{inset:0 auto 0 0;transform:translateX(-50%)}:host(limel-chart[type=dot][orientation=portrait]) .item:after{inset:0 0 0 auto;transform:translateX(50%)}:host(limel-chart[type=area]) .item,:host(limel-chart[type=line]) .item{position:relative}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=line]) .item:after{margin:auto;width:0.5rem;height:0.5rem;border-radius:50%;border:1px solid rgb(var(--contrast-100))}:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:before{inset:0}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:after,:host(limel-chart[type=line]) .item:before{transition:border-color 0.2s ease, opacity 0.4s ease;content:"";position:absolute;background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after,:host(limel-chart[type=line]) .item:hover:after,:host(limel-chart[type=line]) .item:focus-visible:after{border-color:transparent}:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{height:100%}:host(limel-chart[type=line][orientation=landscape]) .item:after,:host(limel-chart[type=area][orientation=landscape]) .item:after{transform:translateX(-50%) translateY(50%);left:0;bottom:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{width:100%}:host(limel-chart[type=line][orientation=portrait]) .item:after,:host(limel-chart[type=area][orientation=portrait]) .item:after{transform:translateX(-50%) translateY(-50%);left:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=area]) .item:after{opacity:0}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after{opacity:1}:host(limel-chart[type=area]) .item:hover:before,:host(limel-chart[type=area]) .item:focus-visible:before{opacity:0.7}:host(limel-chart[type=area][orientation=landscape]){}:host(limel-chart[type=area][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - var(--limel-chart-item-offset)) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%), 100% calc((100 - var(--limel-chart-next-item-offset)) * 1%))}:host(limel-chart[type=area][orientation=portrait]){}:host(limel-chart[type=area][orientation=portrait]) .item:before{clip-path:polygon(calc(var(--limel-chart-item-offset) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%, calc(var(--limel-chart-next-item-offset) * 1%) 100%)}:host(limel-chart[type=line]){--limel-chart-line-thickness:0.125rem}:host(limel-chart[type=line]) .item:hover:before{opacity:0.4}:host(limel-chart[type=line][orientation=landscape]){}:host(limel-chart[type=line][orientation=landscape]) .item:hover{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) left/1px 100% no-repeat}:host(limel-chart[type=line][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%))}:host(limel-chart[type=line][orientation=portrait]){}:host(limel-chart[type=line][orientation=portrait]) .item:hover{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) top/100% 1px no-repeat}:host(limel-chart[type=line][orientation=portrait]) .item:before{clip-path:polygon(calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1% + var(--limel-chart-line-thickness)) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1% + var(--limel-chart-line-thickness)) 100%, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%)}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{background:conic-gradient(transparent 0 calc(var(--limel-chart-item-offset) * 1%), var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) calc(var(--limel-chart-item-offset) * 1%) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), transparent calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%))}:host(limel-chart[type=pie]) .item:focus,:host(limel-chart[type=pie]) .item:focus-visible,:host(limel-chart[type=doughnut]) .item:focus,:host(limel-chart[type=doughnut]) .item:focus-visible{outline:none}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{pointer-events:none}:host(limel-chart[type=doughnut]) .chart:after{aspect-ratio:1;content:"";position:absolute;inset:0;margin:auto;max-width:60%;max-height:60%;border-radius:50%;background-color:rgb(var(--contrast-100))}:host(limel-chart[type=ring]) .chart:after{content:"";position:absolute;inset:0;aspect-ratio:1;border-radius:50%;max-height:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));max-width:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));background-color:var(--limel-chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=ring]) .chart:has(.item:hover) .item,:host(limel-chart[type=ring]) .chart:has(.item:focus-visible) .item{opacity:1;filter:grayscale(1)}:host(limel-chart[type=ring]) .chart:after,:host(limel-chart[type=ring]) .item{margin:auto;border:1px solid var(--limel-chart-background-color, rgb(var(--contrast-400)))}:host(limel-chart[type=ring]) .item{background:conic-gradient(var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) 0 calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), var(--chart-background-color, rgb(var(--contrast-200))) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%));max-width:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1));max-height:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1))}:host(limel-chart[type=ring]) .item:focus-visible,:host(limel-chart[type=ring]) .item:hover{filter:grayscale(0) !important}:host(limel-chart[type=stacked-bar]) .chart{display:flex;border-radius:0.25rem;overflow:hidden;background-color:var(--chart-background-color, rgb(var(--contrast-800), 0.2))}:host(limel-chart[type=stacked-bar]) .item{display:flex;border-radius:var(--chart-item-border-radius, 0);background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=stacked-bar]) .item:last-of-type:not(:focus-visible){box-shadow:none !important}:host(limel-chart[type=stacked-bar][orientation=landscape]) .chart{flex-direction:row}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item{min-height:0.5rem;width:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item:not(:focus-visible){box-shadow:-1px 0 0 0 var(--chart-item-divider-color, rgb(var(--color-white), 0.6)) inset}:host(limel-chart[type=stacked-bar][orientation=portrait]) .chart{flex-direction:column-reverse}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item{min-width:0.5rem;height:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item:not(:focus-visible){box-shadow:0 -1px 0 0 rgb(var(--color-white), 0.6) inset}:host(limel-chart[type=nps]){--limel-chart-nps-gauge-angel:220deg}:host(limel-chart[type=nps]) table{min-height:4rem;min-width:4rem}:host(limel-chart[type=nps]) .chart{position:relative;display:flex;justify-content:center;align-items:center;aspect-ratio:1;margin:auto;width:unset;height:unset;max-width:100%;max-height:100%;rotate:calc(var(--limel-chart-nps-gauge-angel) / 2 * -1);transform:translate(-15%, -5%)}:host(limel-chart[type=nps]) .chart:before,:host(limel-chart[type=nps]) .chart:after{content:"";aspect-ratio:1;position:absolute;border-radius:50%;z-index:-1;min-height:0;min-width:0}:host(limel-chart[type=nps]) .chart:before{height:100%;max-height:100%;background:conic-gradient(rgb(var(--color-coral-default)) 0deg calc(var(--limel-chart-nps-gauge-angel) / 2), rgb(var(--color-amber-light)) calc(var(--limel-chart-nps-gauge-angel) / 2) calc(var(--limel-chart-nps-gauge-angel) * 0.65), rgb(var(--color-lime-light)) calc(var(--limel-chart-nps-gauge-angel) * 0.65) calc(var(--limel-chart-nps-gauge-angel) * 0.85), rgb(var(--color-lime-default)) calc(var(--limel-chart-nps-gauge-angel) * 0.85) var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .chart:after{height:calc(100% - min(3rem, 20%) * 2);max-height:calc(100% - min(3rem, 20%) * 2);background:conic-gradient(var(--chart-background-color, rgb(var(--contrast-100))) 0deg var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .item{display:flex;align-items:flex-start;justify-content:center;border-radius:0.5rem;position:absolute;height:calc(50% - min(3rem, 20%) + 0.5rem);width:0.5rem;transform:translateY(-50%) rotate(calc((var(--limel-chart-item-value) + 100) / 200 * var(--limel-chart-nps-gauge-angel)));transform-origin:bottom}:host(limel-chart[type=nps]) .item:hover,:host(limel-chart[type=nps]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=nps]) .item:before,:host(limel-chart[type=nps]) .item:after{content:"";position:absolute}:host(limel-chart[type=nps]) .item:before{transform:translateY(-60%);width:0.4rem;border-radius:1rem;border-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));border-style:solid;border-bottom-width:1.75rem;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent}:host(limel-chart[type=nps]) .item:after{border-radius:50%;background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));aspect-ratio:1;height:clamp(0.75rem, 10%, 1.25rem);border:0.125rem solid rgb(var(--contrast-100), 0.8);box-shadow:var(--shadow-depth-8)}.axises{position:absolute;display:flex;justify-content:space-between;min-height:100%;min-width:100%;height:100%;width:100%}.axis-line{transition:opacity 0.4s ease;position:relative;opacity:0.2;font-size:0.625rem;border-color:var(--limel-chart-axis-line-color)}.axis-line:hover{opacity:0.6;transition-duration:0.2s}.axis-line.zero-line{opacity:0.6;z-index:1}.axis-line limel-badge{--badge-background-color:transparent;--badge-text-color:currentColor;position:absolute;text-align:right;min-width:2rem}:host(limel-chart[orientation=landscape]) .axises{flex-direction:column-reverse}:host(limel-chart[orientation=landscape]) .axis-line{border-bottom:1px solid;transform:translateY(50%)}:host(limel-chart[orientation=landscape]) .axis-line limel-badge{bottom:0;left:-2rem;transform:translateY(50%)}:host(limel-chart[orientation=portrait]) .axises{flex-direction:row}:host(limel-chart[orientation=portrait]) .axis-line{border-left:1px solid;transform:translateX(-50%)}:host(limel-chart[orientation=portrait]) .axis-line limel-badge{bottom:-1rem;right:-1rem}';const l=100;const n=10;const h=class{constructor(r){t(this,r);this.interact=e(this,"interact",7);this.handleClick=t=>{const e=this.getClickableItem(t.currentTarget);if(!e){return}t.stopPropagation();this.interact.emit(e)};this.handleKeyDown=t=>{if(t.key!=="Enter"&&t.key!==" "){return}const e=this.getClickableItem(t.currentTarget);if(!e){return}t.preventDefault();this.interact.emit(e)};this.language="en";this.accessibleLabel=undefined;this.accessibleItemsLabel=undefined;this.items=undefined;this.type="stacked-bar";this.orientation="landscape";this.maxValue=undefined;this.axisIncrement=undefined;this.loading=false}componentWillLoad(){this.recalculateRangeData()}render(){if(this.loading){return r("limel-spinner",{limeBranded:false})}return r("table",{"aria-busy":this.loading?"true":"false","aria-live":"polite",style:{"--limel-chart-number-of-items":this.items.length.toString()}},this.renderCaption(),this.renderTableHeader(),this.renderAxises(),r("tbody",{class:"chart"},this.renderItems()))}renderCaption(){if(!this.accessibleLabel){return}return r("caption",null,this.accessibleLabel)}renderTableHeader(){return r("thead",null,r("tr",null,r("th",{scope:"col"},this.accessibleItemsLabel),r("th",{scope:"col"},a.get("value",this.language))))}renderAxises(){if(!["bar","dot","area","line"].includes(this.type)){return}const{minValue:t,maxValue:e}=this.range;const a=[];const i=Math.floor(t/this.axisIncrement)*this.axisIncrement;const o=Math.ceil(e/this.axisIncrement)*this.axisIncrement;for(let t=i;t<=o;t+=this.axisIncrement){a.push(r("div",{class:{"axis-line":true,"zero-line":t===0},role:"presentation"},r("limel-badge",{label:t})))}return r("div",{class:"axises",role:"presentation"},a)}renderItems(){var t;if(!((t=this.items)===null||t===void 0?void 0:t.length)){return}let e=0;return this.items.map(((t,a)=>{const o=i();const l=this.calculateSizeAndOffset(t);const n=l.size;let h=l.offset;if(this.type==="pie"||this.type==="doughnut"){h=e;e+=n}return r("tr",{style:this.getItemStyle(t,a,n,h),class:this.getItemClass(t),key:o,id:o,"data-index":a,tabIndex:0,role:t.clickable?"button":null,onClick:this.handleClick,onKeyDown:this.handleKeyDown},r("th",null,this.getItemText(t)),r("td",null,this.getFormattedValue(t)),this.renderTooltip(t,o,n))}))}getItemStyle(t,e,r,a){const i={"--limel-chart-item-offset":`${a}`,"--limel-chart-item-size":`${r}`,"--limel-chart-item-index":`${e}`,"--limel-chart-item-value":`${t.value}`};if(t.color){i["--limel-chart-item-color"]=t.color}if(this.type==="line"||this.type==="area"){const t=this.calculateSizeAndOffset(this.items[e+1]);i["--limel-chart-next-item-size"]=`${t.size}`;i["--limel-chart-next-item-offset"]=`${t.offset}`}return i}getItemClass(t){return{item:true,"has-start-value":Array.isArray(t.value),"has-negative-value-only":this.getMaximumValue(t)<0&&!this.isRangeItem(t)}}calculateSizeAndOffset(t){const{minValue:e,totalRange:r}=this.range;if(!t){return{size:0,offset:0}}let a=0;if(this.isRangeItem(t)){a=this.getMinimumValue(t)}const i=(a-e)/r*l;const o=(this.getMaximumValue(t)-e)/r*l;return{size:o-i,offset:i}}getFormattedValue(t){const{value:e,formattedValue:r}=t;if(r){return r}if(Array.isArray(e)){return`${e[0]} — ${e[1]}`}return`${e}`}getItemText(t){return t.text}renderTooltip(t,e,a){const i=this.getItemText(t);const o=2;const l=this.getFormattedValue(t);const n={label:i,helperLabel:l,elementId:e};if(this.type!=="bar"&&this.type!=="dot"&&this.type!=="nps"){n.label=`${i} (${a.toFixed(o)}%)`}return r("limel-tooltip",Object.assign({},n,{openDirection:this.orientation==="portrait"?"right":"top"}))}calculateRange(){var t;if(this.range){return this.range}const e=Math.min(0,...this.items.map(this.getMinimumValue));const r=Math.max(...this.items.map(this.getMaximumValue));const a=this.items.reduce(((t,e)=>t+this.getMaximumValue(e)),0);let i=(t=this.maxValue)!==null&&t!==void 0?t:r;if((this.type==="pie"||this.type==="doughnut")&&!this.maxValue){i=a}if(!this.axisIncrement){this.axisIncrement=this.calculateAxisIncrement(this.items)}const o=Math.ceil(i/this.axisIncrement)*this.axisIncrement;const l=Math.floor(e/this.axisIncrement)*this.axisIncrement;const n=o-l;return{minValue:l,maxValue:o,totalRange:n}}calculateAxisIncrement(t,e=n){const r=Math.max(...t.map((t=>{const e=t.value;if(Array.isArray(e)){return Math.max(...e)}return e})));const a=r/e;const i=10**Math.floor(Math.log10(a));return Math.ceil(a/i)*i}getMinimumValue(t){const e=t.value;return Array.isArray(e)?Math.min(...e):e}getMaximumValue(t){const e=t.value;return Array.isArray(e)?Math.max(...e):e}isRangeItem(t){return Array.isArray(t.value)}handleChange(){this.range=null;this.recalculateRangeData()}recalculateRangeData(){this.range=this.calculateRange()}getClickableItem(t){const e=t.dataset.index;if(e===undefined){return}const r=this.items[Number(e)];if(!r.clickable){return}return r}static get watchers(){return{items:["handleChange"],axisIncrement:["handleChange"],maxValue:["handleChange"]}}};h.style=o;export{h as limel_chart};
2
- //# sourceMappingURL=p-5018673b.entry.js.map
1
+ import{r as t,c as e,h as r}from"./p-288f0842.js";import{t as a}from"./p-58777116.js";import{c as i}from"./p-ad52787a.js";const o='@charset "UTF-8";:host(limel-chart){--chart-axis-line-color:var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );box-sizing:border-box;isolation:isolate;display:flex;width:100%;height:100%;min-width:0;min-height:0;padding:var(--limel-chart-padding)}table{all:unset;border-collapse:collapse;border-spacing:0;empty-cells:show;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}table colgroup,table thead,table tbody,table tr,table th,table td{all:unset}table caption,table colgroup,table thead,table tfoot,table th,table td{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}*,*:before,*:after{box-sizing:border-box}.chart{position:relative;flex-grow:1;width:100%;height:100%;min-height:0;min-width:0}.chart:has(.item:hover) .item,.chart:has(.item:focus-visible) .item{opacity:0.4}.item{transition:background-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.4s ease;cursor:help}.item:focus{outline:none}.item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.item:focus-visible,.item:hover{opacity:1 !important}.item[role=button]{cursor:pointer}limel-spinner{margin:auto}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart,:host(limel-chart[type=line]) .chart,:host(limel-chart[type=area]) .chart{display:flex;background-color:var(--chart-background-color, transparent)}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item,:host(limel-chart[type=line]) .item,:host(limel-chart[type=area]) .item{position:relative;mix-blend-mode:hard-light}:host(limel-chart[type=bar][orientation=landscape]),:host(limel-chart[type=dot][orientation=landscape]),:host(limel-chart[type=line][orientation=landscape]),:host(limel-chart[type=area][orientation=landscape]){--limel-chart-padding:0.5rem 0.5rem 0.5rem 2rem}:host(limel-chart[type=bar][orientation=landscape]) .chart,:host(limel-chart[type=dot][orientation=landscape]) .chart,:host(limel-chart[type=line][orientation=landscape]) .chart,:host(limel-chart[type=area][orientation=landscape]) .chart{flex-direction:row;align-items:flex-end;overflow:auto hidden;padding:0 0.125rem}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item,:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{min-width:0.5rem;width:inherit}:host(limel-chart[type=bar][orientation=portrait]),:host(limel-chart[type=dot][orientation=portrait]),:host(limel-chart[type=line][orientation=portrait]),:host(limel-chart[type=area][orientation=portrait]){--limel-chart-padding:0.5rem 0.5rem 1rem 0.5rem}:host(limel-chart[type=bar][orientation=portrait]) .chart,:host(limel-chart[type=dot][orientation=portrait]) .chart,:host(limel-chart[type=line][orientation=portrait]) .chart,:host(limel-chart[type=area][orientation=portrait]) .chart{flex-direction:column;overflow:hidden auto;padding:0.125rem 0}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item,:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{min-height:0.5rem;height:inherit}:host(limel-chart[type=pie]) table,:host(limel-chart[type=doughnut]) table,:host(limel-chart[type=ring]) table{min-height:2rem;min-width:2rem}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .chart,:host(limel-chart[type=ring]) .item{aspect-ratio:1;display:flex;margin:auto}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=ring]) .chart{justify-content:center;align-items:center}:host(limel-chart[type=pie]) .chart:before,:host(limel-chart[type=doughnut]) .chart:before,:host(limel-chart[type=ring]) .chart:before{aspect-ratio:1;content:"";position:absolute;z-index:0;inset:0;margin:auto;border-radius:50%;max-width:100%;max-height:100%;background-color:var(--chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .item{max-width:100%;max-height:100%;border-radius:50%;position:absolute;inset:0}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart{gap:0.5rem}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item{display:flex;align-items:center;justify-content:center;border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=bar]) .item{background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item:before,:host(limel-chart[type=dot]) .item:after{content:"";position:absolute;margin:auto;width:0.5rem;height:0.5rem;border-radius:50%}:host(limel-chart[type=dot]) .item::after{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item.has-start-value:before{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item{height:calc(var(--limel-chart-item-size) * 1%);bottom:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=landscape]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=landscape]) .item.has-negative-value-only{height:calc(var(--limel-chart-item-size) * -1%);transform-origin:bottom;transform:rotateX(180deg)}:host(limel-chart[type=dot][orientation=landscape]) .item.has-start-value,:host(limel-chart[type=dot][orientation=landscape]) .item:hover,:host(limel-chart[type=dot][orientation=landscape]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=dot][orientation=landscape]) .item:before{inset:auto 0 0 0;transform:translateY(50%)}:host(limel-chart[type=dot][orientation=landscape]) .item::after{inset:0 0 auto 0;transform:translateY(-50%)}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item{width:calc(var(--limel-chart-item-size) * 1%);left:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=portrait]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=portrait]) .item.has-negative-value-only{width:calc(var(--limel-chart-item-size) * -1%);transform-origin:left;transform:rotateY(180deg)}:host(limel-chart[type=dot][orientation=portrait]) .item.has-start-value,:host(limel-chart[type=dot][orientation=portrait]) .item:hover,:host(limel-chart[type=dot][orientation=portrait]) .item:focus-visible{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/100% 1px no-repeat}:host(limel-chart[type=dot][orientation=portrait]) .item:before{inset:0 auto 0 0;transform:translateX(-50%)}:host(limel-chart[type=dot][orientation=portrait]) .item:after{inset:0 0 0 auto;transform:translateX(50%)}:host(limel-chart[type=area]) .item,:host(limel-chart[type=line]) .item{position:relative}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=line]) .item:after{margin:auto;width:0.5rem;height:0.5rem;border-radius:50%;border:1px solid rgb(var(--contrast-100))}:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:before{inset:0}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:after,:host(limel-chart[type=line]) .item:before{transition:border-color 0.2s ease, opacity 0.4s ease;content:"";position:absolute;background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after,:host(limel-chart[type=line]) .item:hover:after,:host(limel-chart[type=line]) .item:focus-visible:after{border-color:transparent}:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{height:100%}:host(limel-chart[type=line][orientation=landscape]) .item:after,:host(limel-chart[type=area][orientation=landscape]) .item:after{transform:translateX(-50%) translateY(50%);left:0;bottom:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{width:100%}:host(limel-chart[type=line][orientation=portrait]) .item:after,:host(limel-chart[type=area][orientation=portrait]) .item:after{transform:translateX(-50%) translateY(-50%);left:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=area]) .item:after{opacity:0}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after{opacity:1}:host(limel-chart[type=area]) .item:hover:before,:host(limel-chart[type=area]) .item:focus-visible:before{opacity:0.7}:host(limel-chart[type=area][orientation=landscape]){}:host(limel-chart[type=area][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - var(--limel-chart-item-offset)) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%), 100% calc((100 - var(--limel-chart-next-item-offset)) * 1%))}:host(limel-chart[type=area][orientation=portrait]){}:host(limel-chart[type=area][orientation=portrait]) .item:before{clip-path:polygon(calc(var(--limel-chart-item-offset) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%, calc(var(--limel-chart-next-item-offset) * 1%) 100%)}:host(limel-chart[type=line]){--limel-chart-line-thickness:0.125rem}:host(limel-chart[type=line]) .item:hover:before{opacity:0.4}:host(limel-chart[type=line][orientation=landscape]){}:host(limel-chart[type=line][orientation=landscape]) .item:hover{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) left/1px 100% no-repeat}:host(limel-chart[type=line][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%))}:host(limel-chart[type=line][orientation=portrait]){}:host(limel-chart[type=line][orientation=portrait]) .item:hover{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) top/100% 1px no-repeat}:host(limel-chart[type=line][orientation=portrait]) .item:before{clip-path:polygon(calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1% + var(--limel-chart-line-thickness)) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1% + var(--limel-chart-line-thickness)) 100%, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%)}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{background:conic-gradient(transparent 0 calc(var(--limel-chart-item-offset) * 1%), var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) calc(var(--limel-chart-item-offset) * 1%) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), transparent calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%))}:host(limel-chart[type=pie]) .item:focus,:host(limel-chart[type=pie]) .item:focus-visible,:host(limel-chart[type=doughnut]) .item:focus,:host(limel-chart[type=doughnut]) .item:focus-visible{outline:none}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{pointer-events:none}:host(limel-chart[type=doughnut]) .chart:after{aspect-ratio:1;content:"";position:absolute;inset:0;margin:auto;max-width:60%;max-height:60%;border-radius:50%;background-color:rgb(var(--contrast-100))}:host(limel-chart[type=ring]) .chart:after{content:"";position:absolute;inset:0;aspect-ratio:1;border-radius:50%;max-height:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));max-width:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));background-color:var(--limel-chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=ring]) .chart:has(.item:hover) .item,:host(limel-chart[type=ring]) .chart:has(.item:focus-visible) .item{opacity:1;filter:grayscale(1)}:host(limel-chart[type=ring]) .chart:after,:host(limel-chart[type=ring]) .item{margin:auto;border:1px solid var(--limel-chart-background-color, rgb(var(--contrast-400)))}:host(limel-chart[type=ring]) .item{background:conic-gradient(var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) 0 calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), var(--chart-background-color, rgb(var(--contrast-200))) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%));max-width:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1));max-height:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1))}:host(limel-chart[type=ring]) .item:focus-visible,:host(limel-chart[type=ring]) .item:hover{filter:grayscale(0) !important}:host(limel-chart[type=stacked-bar]) .chart{display:flex;border-radius:0.25rem;overflow:hidden;background-color:var(--chart-background-color, rgb(var(--contrast-800), 0.2))}:host(limel-chart[type=stacked-bar]) .item{display:flex;border-radius:var(--chart-item-border-radius, 0);background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=stacked-bar]) .item:last-of-type:not(:focus-visible){box-shadow:none !important}:host(limel-chart[type=stacked-bar][orientation=landscape]) .chart{flex-direction:row}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item{min-height:0.5rem;width:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item:not(:focus-visible){box-shadow:-1px 0 0 0 var(--chart-item-divider-color, rgb(var(--color-white), 0.6)) inset}:host(limel-chart[type=stacked-bar][orientation=portrait]) .chart{flex-direction:column-reverse}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item{min-width:0.5rem;height:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item:not(:focus-visible){box-shadow:0 -1px 0 0 rgb(var(--color-white), 0.6) inset}:host(limel-chart[type=nps]){--limel-chart-nps-gauge-angel:220deg}:host(limel-chart[type=nps]) table{min-height:4rem;min-width:4rem}:host(limel-chart[type=nps]) .chart{position:relative;display:flex;justify-content:center;align-items:center;aspect-ratio:1;margin:auto;width:unset;height:unset;max-width:100%;max-height:100%;rotate:calc(var(--limel-chart-nps-gauge-angel) / 2 * -1);transform:translate(-15%, -5%)}:host(limel-chart[type=nps]) .chart:before,:host(limel-chart[type=nps]) .chart:after{content:"";aspect-ratio:1;position:absolute;border-radius:50%;z-index:-1;min-height:0;min-width:0}:host(limel-chart[type=nps]) .chart:before{height:100%;max-height:100%;background:conic-gradient(rgb(var(--color-coral-default)) 0deg calc(var(--limel-chart-nps-gauge-angel) / 2), rgb(var(--color-amber-light)) calc(var(--limel-chart-nps-gauge-angel) / 2) calc(var(--limel-chart-nps-gauge-angel) * 0.65), rgb(var(--color-lime-light)) calc(var(--limel-chart-nps-gauge-angel) * 0.65) calc(var(--limel-chart-nps-gauge-angel) * 0.85), rgb(var(--color-lime-default)) calc(var(--limel-chart-nps-gauge-angel) * 0.85) var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .chart:after{height:calc(100% - min(3rem, 20%) * 2);max-height:calc(100% - min(3rem, 20%) * 2);background:conic-gradient(var(--chart-background-color, rgb(var(--contrast-100))) 0deg var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .item{display:flex;align-items:flex-start;justify-content:center;border-radius:0.5rem;position:absolute;height:calc(50% - min(3rem, 20%) + 0.5rem);width:0.5rem;transform:translateY(-50%) rotate(calc((var(--limel-chart-item-value) + 100) / 200 * var(--limel-chart-nps-gauge-angel)));transform-origin:bottom}:host(limel-chart[type=nps]) .item:hover,:host(limel-chart[type=nps]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=nps]) .item:before,:host(limel-chart[type=nps]) .item:after{content:"";position:absolute}:host(limel-chart[type=nps]) .item:before{transform:translateY(-60%);width:0.4rem;border-radius:1rem;border-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));border-style:solid;border-bottom-width:1.75rem;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent}:host(limel-chart[type=nps]) .item:after{border-radius:50%;background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));aspect-ratio:1;height:clamp(0.75rem, 10%, 1.25rem);border:0.125rem solid rgb(var(--contrast-100), 0.8);box-shadow:var(--shadow-depth-8)}.axises{position:absolute;display:flex;justify-content:space-between;min-height:100%;min-width:100%;height:100%;width:100%}.axis-line{transition:opacity 0.4s ease;position:relative;opacity:0.2;font-size:0.625rem;border-color:var(--limel-chart-axis-line-color)}.axis-line:hover{opacity:0.6;transition-duration:0.2s}.axis-line.zero-line{opacity:0.6;z-index:1}.axis-line limel-badge{--badge-background-color:transparent;--badge-text-color:currentColor;position:absolute;text-align:right;min-width:2rem}:host(limel-chart[orientation=landscape]) .axises{flex-direction:column-reverse}:host(limel-chart[orientation=landscape]) .axis-line{border-bottom:1px solid;transform:translateY(50%)}:host(limel-chart[orientation=landscape]) .axis-line limel-badge{bottom:0;left:-2rem;transform:translateY(50%)}:host(limel-chart[orientation=portrait]) .axises{flex-direction:row}:host(limel-chart[orientation=portrait]) .axis-line{border-left:1px solid;transform:translateX(-50%)}:host(limel-chart[orientation=portrait]) .axis-line limel-badge{bottom:-1rem;right:-1rem}';const l=100;const n=10;const h=class{constructor(r){t(this,r);this.interact=e(this,"interact",7);this.handleClick=t=>{const e=this.getClickableItem(t.currentTarget);if(!e){return}t.stopPropagation();this.interact.emit(e)};this.handleKeyDown=t=>{if(t.key!=="Enter"&&t.key!==" "){return}const e=this.getClickableItem(t.currentTarget);if(!e){return}t.preventDefault();this.interact.emit(e)};this.language="en";this.accessibleLabel=undefined;this.accessibleItemsLabel=undefined;this.items=undefined;this.type="stacked-bar";this.orientation="landscape";this.maxValue=undefined;this.axisIncrement=undefined;this.loading=false}componentWillLoad(){this.recalculateRangeData()}render(){if(this.loading){return r("limel-spinner",{limeBranded:false})}return r("table",{"aria-busy":this.loading?"true":"false","aria-live":"polite",style:{"--limel-chart-number-of-items":this.items.length.toString()}},this.renderCaption(),this.renderTableHeader(),this.renderAxises(),r("tbody",{class:"chart"},this.renderItems()))}renderCaption(){if(!this.accessibleLabel){return}return r("caption",null,this.accessibleLabel)}renderTableHeader(){return r("thead",null,r("tr",null,r("th",{scope:"col"},this.accessibleItemsLabel),r("th",{scope:"col"},a.get("value",this.language))))}renderAxises(){if(!["bar","dot","area","line"].includes(this.type)){return}const{minValue:t,maxValue:e}=this.range;const a=[];const i=Math.floor(t/this.axisIncrement)*this.axisIncrement;const o=Math.ceil(e/this.axisIncrement)*this.axisIncrement;for(let t=i;t<=o;t+=this.axisIncrement){a.push(r("div",{class:{"axis-line":true,"zero-line":t===0},role:"presentation"},r("limel-badge",{label:t})))}return r("div",{class:"axises",role:"presentation"},a)}renderItems(){var t;if(!((t=this.items)===null||t===void 0?void 0:t.length)){return}let e=0;return this.items.map(((t,a)=>{const o=i();const l=this.calculateSizeAndOffset(t);const n=l.size;let h=l.offset;if(this.type==="pie"||this.type==="doughnut"){h=e;e+=n}return r("tr",{style:this.getItemStyle(t,a,n,h),class:this.getItemClass(t),key:o,id:o,"data-index":a,tabIndex:0,role:t.clickable?"button":null,onClick:this.handleClick,onKeyDown:this.handleKeyDown},r("th",null,this.getItemText(t)),r("td",null,this.getFormattedValue(t)),this.renderTooltip(t,o,n))}))}getItemStyle(t,e,r,a){const i={"--limel-chart-item-offset":`${a}`,"--limel-chart-item-size":`${r}`,"--limel-chart-item-index":`${e}`,"--limel-chart-item-value":`${t.value}`};if(t.color){i["--limel-chart-item-color"]=t.color}if(this.type==="line"||this.type==="area"){const t=this.calculateSizeAndOffset(this.items[e+1]);i["--limel-chart-next-item-size"]=`${t.size}`;i["--limel-chart-next-item-offset"]=`${t.offset}`}return i}getItemClass(t){return{item:true,"has-start-value":Array.isArray(t.value),"has-negative-value-only":this.getMaximumValue(t)<0&&!this.isRangeItem(t)}}calculateSizeAndOffset(t){const{minValue:e,totalRange:r}=this.range;if(!t){return{size:0,offset:0}}let a=0;if(this.isRangeItem(t)){a=this.getMinimumValue(t)}const i=(a-e)/r*l;const o=(this.getMaximumValue(t)-e)/r*l;return{size:o-i,offset:i}}getFormattedValue(t){const{value:e,formattedValue:r}=t;if(r){return r}if(Array.isArray(e)){return`${e[0]} — ${e[1]}`}return`${e}`}getItemText(t){return t.text}renderTooltip(t,e,a){const i=this.getItemText(t);const o=2;const l=this.getFormattedValue(t);const n={label:i,helperLabel:l,elementId:e};if(this.type!=="bar"&&this.type!=="dot"&&this.type!=="nps"){n.label=`${i} (${a.toFixed(o)}%)`}return r("limel-tooltip",Object.assign({},n,{openDirection:this.orientation==="portrait"?"right":"top"}))}calculateRange(){var t;if(this.range){return this.range}const e=Math.min(0,...this.items.map(this.getMinimumValue));const r=Math.max(...this.items.map(this.getMaximumValue));const a=this.items.reduce(((t,e)=>t+this.getMaximumValue(e)),0);let i=(t=this.maxValue)!==null&&t!==void 0?t:r;if((this.type==="pie"||this.type==="doughnut")&&!this.maxValue){i=a}if(!this.axisIncrement){this.axisIncrement=this.calculateAxisIncrement(this.items)}const o=Math.ceil(i/this.axisIncrement)*this.axisIncrement;const l=Math.floor(e/this.axisIncrement)*this.axisIncrement;const n=o-l;return{minValue:l,maxValue:o,totalRange:n}}calculateAxisIncrement(t,e=n){const r=Math.max(...t.map((t=>{const e=t.value;if(Array.isArray(e)){return Math.max(...e)}return e})));const a=r/e;const i=10**Math.floor(Math.log10(a));return Math.ceil(a/i)*i}getMinimumValue(t){const e=t.value;return Array.isArray(e)?Math.min(...e):e}getMaximumValue(t){const e=t.value;return Array.isArray(e)?Math.max(...e):e}isRangeItem(t){return Array.isArray(t.value)}handleChange(){this.range=null;this.recalculateRangeData()}recalculateRangeData(){this.range=this.calculateRange()}getClickableItem(t){const e=t.dataset.index;if(e===undefined){return}const r=this.items[Number(e)];if(!r.clickable){return}return r}static get watchers(){return{items:["handleChange"],axisIncrement:["handleChange"],maxValue:["handleChange"]}}};h.style=o;export{h as limel_chart};
2
+ //# sourceMappingURL=p-99de518a.entry.js.map
@@ -0,0 +1,2 @@
1
+ import{r as t,h as r,g as e}from"./p-288f0842.js";import{c as n}from"./p-ad52787a.js";var i="top";var a="bottom";var o="right";var s="left";var u="auto";var f=[i,a,o,s];var v="start";var c="end";var l="clippingParents";var h="viewport";var d="popper";var p="reference";var b=f.reduce((function(t,r){return t.concat([r+"-"+v,r+"-"+c])}),[]);var m=[].concat(f,[u]).reduce((function(t,r){return t.concat([r,r+"-"+v,r+"-"+c])}),[]);var y="beforeRead";var g="read";var x="afterRead";var w="beforeMain";var O="main";var j="afterMain";var k="beforeWrite";var C="write";var M="afterWrite";var P=[y,g,x,w,O,j,k,C,M];function A(t){return t?(t.nodeName||"").toLowerCase():null}function L(t){if(t==null){return window}if(t.toString()!=="[object Window]"){var r=t.ownerDocument;return r?r.defaultView||window:window}return t}function S(t){var r=L(t).Element;return t instanceof r||t instanceof Element}function W(t){var r=L(t).HTMLElement;return t instanceof r||t instanceof HTMLElement}function q(t){if(typeof ShadowRoot==="undefined"){return false}var r=L(t).ShadowRoot;return t instanceof r||t instanceof ShadowRoot}function z(t){var r=t.state;Object.keys(r.elements).forEach((function(t){var e=r.styles[t]||{};var n=r.attributes[t]||{};var i=r.elements[t];if(!W(i)||!A(i)){return}Object.assign(i.style,e);Object.keys(n).forEach((function(t){var r=n[t];if(r===false){i.removeAttribute(t)}else{i.setAttribute(t,r===true?"":r)}}))}))}function E(t){var r=t.state;var e={popper:{position:r.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(r.elements.popper.style,e.popper);r.styles=e;if(r.elements.arrow){Object.assign(r.elements.arrow.style,e.arrow)}return function(){Object.keys(r.elements).forEach((function(t){var n=r.elements[t];var i=r.attributes[t]||{};var a=Object.keys(r.styles.hasOwnProperty(t)?r.styles[t]:e[t]);var o=a.reduce((function(t,r){t[r]="";return t}),{});if(!W(n)||!A(n)){return}Object.assign(n.style,o);Object.keys(i).forEach((function(t){n.removeAttribute(t)}))}))}}const R={name:"applyStyles",enabled:true,phase:"write",fn:z,effect:E,requires:["computeStyles"]};function T(t){return t.split("-")[0]}var B=Math.max;var H=Math.min;var I=Math.round;function _(){var t=navigator.userAgentData;if(t!=null&&t.brands&&Array.isArray(t.brands)){return t.brands.map((function(t){return t.brand+"/"+t.version})).join(" ")}return navigator.userAgent}function D(){return!/^((?!chrome|android).)*safari/i.test(_())}function F(t,r,e){if(r===void 0){r=false}if(e===void 0){e=false}var n=t.getBoundingClientRect();var i=1;var a=1;if(r&&W(t)){i=t.offsetWidth>0?I(n.width)/t.offsetWidth||1:1;a=t.offsetHeight>0?I(n.height)/t.offsetHeight||1:1}var o=S(t)?L(t):window,s=o.visualViewport;var u=!D()&&e;var f=(n.left+(u&&s?s.offsetLeft:0))/i;var v=(n.top+(u&&s?s.offsetTop:0))/a;var c=n.width/i;var l=n.height/a;return{width:c,height:l,top:v,right:f+c,bottom:v+l,left:f,x:f,y:v}}function V(t){var r=F(t);var e=t.offsetWidth;var n=t.offsetHeight;if(Math.abs(r.width-e)<=1){e=r.width}if(Math.abs(r.height-n)<=1){n=r.height}return{x:t.offsetLeft,y:t.offsetTop,width:e,height:n}}function $(t,r){var e=r.getRootNode&&r.getRootNode();if(t.contains(r)){return true}else if(e&&q(e)){var n=r;do{if(n&&t.isSameNode(n)){return true}n=n.parentNode||n.host}while(n)}return false}function N(t){return L(t).getComputedStyle(t)}function U(t){return["table","td","th"].indexOf(A(t))>=0}function G(t){return((S(t)?t.ownerDocument:t.document)||window.document).documentElement}function J(t){if(A(t)==="html"){return t}return t.assignedSlot||t.parentNode||(q(t)?t.host:null)||G(t)}function K(t){if(!W(t)||N(t).position==="fixed"){return null}return t.offsetParent}function Q(t){var r=/firefox/i.test(_());var e=/Trident/i.test(_());if(e&&W(t)){var n=N(t);if(n.position==="fixed"){return null}}var i=J(t);if(q(i)){i=i.host}while(W(i)&&["html","body"].indexOf(A(i))<0){var a=N(i);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||r&&a.willChange==="filter"||r&&a.filter&&a.filter!=="none"){return i}else{i=i.parentNode}}return null}function X(t){var r=L(t);var e=K(t);while(e&&U(e)&&N(e).position==="static"){e=K(e)}if(e&&(A(e)==="html"||A(e)==="body"&&N(e).position==="static")){return r}return e||Q(t)||r}function Y(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Z(t,r,e){return B(t,H(r,e))}function tt(t,r,e){var n=Z(t,r,e);return n>e?e:n}function rt(){return{top:0,right:0,bottom:0,left:0}}function et(t){return Object.assign({},rt(),t)}function nt(t,r){return r.reduce((function(r,e){r[e]=t;return r}),{})}var it=function t(r,e){r=typeof r==="function"?r(Object.assign({},e.rects,{placement:e.placement})):r;return et(typeof r!=="number"?r:nt(r,f))};function at(t){var r;var e=t.state,n=t.name,u=t.options;var f=e.elements.arrow;var v=e.modifiersData.popperOffsets;var c=T(e.placement);var l=Y(c);var h=[s,o].indexOf(c)>=0;var d=h?"height":"width";if(!f||!v){return}var p=it(u.padding,e);var b=V(f);var m=l==="y"?i:s;var y=l==="y"?a:o;var g=e.rects.reference[d]+e.rects.reference[l]-v[l]-e.rects.popper[d];var x=v[l]-e.rects.reference[l];var w=X(f);var O=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0;var j=g/2-x/2;var k=p[m];var C=O-b[d]-p[y];var M=O/2-b[d]/2+j;var P=Z(k,M,C);var A=l;e.modifiersData[n]=(r={},r[A]=P,r.centerOffset=P-M,r)}function ot(t){var r=t.state,e=t.options;var n=e.element,i=n===void 0?"[data-popper-arrow]":n;if(i==null){return}if(typeof i==="string"){i=r.elements.popper.querySelector(i);if(!i){return}}if(!$(r.elements.popper,i)){return}r.elements.arrow=i}const st={name:"arrow",enabled:true,phase:"main",fn:at,effect:ot,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ut(t){return t.split("-")[1]}var ft={top:"auto",right:"auto",bottom:"auto",left:"auto"};function vt(t,r){var e=t.x,n=t.y;var i=r.devicePixelRatio||1;return{x:I(e*i)/i||0,y:I(n*i)/i||0}}function ct(t){var r;var e=t.popper,n=t.popperRect,u=t.placement,f=t.variation,v=t.offsets,l=t.position,h=t.gpuAcceleration,d=t.adaptive,p=t.roundOffsets,b=t.isFixed;var m=v.x,y=m===void 0?0:m,g=v.y,x=g===void 0?0:g;var w=typeof p==="function"?p({x:y,y:x}):{x:y,y:x};y=w.x;x=w.y;var O=v.hasOwnProperty("x");var j=v.hasOwnProperty("y");var k=s;var C=i;var M=window;if(d){var P=X(e);var A="clientHeight";var S="clientWidth";if(P===L(e)){P=G(e);if(N(P).position!=="static"&&l==="absolute"){A="scrollHeight";S="scrollWidth"}}P=P;if(u===i||(u===s||u===o)&&f===c){C=a;var W=b&&P===M&&M.visualViewport?M.visualViewport.height:P[A];x-=W-n.height;x*=h?1:-1}if(u===s||(u===i||u===a)&&f===c){k=o;var q=b&&P===M&&M.visualViewport?M.visualViewport.width:P[S];y-=q-n.width;y*=h?1:-1}}var z=Object.assign({position:l},d&&ft);var E=p===true?vt({x:y,y:x},L(e)):{x:y,y:x};y=E.x;x=E.y;if(h){var R;return Object.assign({},z,(R={},R[C]=j?"0":"",R[k]=O?"0":"",R.transform=(M.devicePixelRatio||1)<=1?"translate("+y+"px, "+x+"px)":"translate3d("+y+"px, "+x+"px, 0)",R))}return Object.assign({},z,(r={},r[C]=j?x+"px":"",r[k]=O?y+"px":"",r.transform="",r))}function lt(t){var r=t.state,e=t.options;var n=e.gpuAcceleration,i=n===void 0?true:n,a=e.adaptive,o=a===void 0?true:a,s=e.roundOffsets,u=s===void 0?true:s;var f={placement:T(r.placement),variation:ut(r.placement),popper:r.elements.popper,popperRect:r.rects.popper,gpuAcceleration:i,isFixed:r.options.strategy==="fixed"};if(r.modifiersData.popperOffsets!=null){r.styles.popper=Object.assign({},r.styles.popper,ct(Object.assign({},f,{offsets:r.modifiersData.popperOffsets,position:r.options.strategy,adaptive:o,roundOffsets:u})))}if(r.modifiersData.arrow!=null){r.styles.arrow=Object.assign({},r.styles.arrow,ct(Object.assign({},f,{offsets:r.modifiersData.arrow,position:"absolute",adaptive:false,roundOffsets:u})))}r.attributes.popper=Object.assign({},r.attributes.popper,{"data-popper-placement":r.placement})}const ht={name:"computeStyles",enabled:true,phase:"beforeWrite",fn:lt,data:{}};var dt={passive:true};function pt(t){var r=t.state,e=t.instance,n=t.options;var i=n.scroll,a=i===void 0?true:i,o=n.resize,s=o===void 0?true:o;var u=L(r.elements.popper);var f=[].concat(r.scrollParents.reference,r.scrollParents.popper);if(a){f.forEach((function(t){t.addEventListener("scroll",e.update,dt)}))}if(s){u.addEventListener("resize",e.update,dt)}return function(){if(a){f.forEach((function(t){t.removeEventListener("scroll",e.update,dt)}))}if(s){u.removeEventListener("resize",e.update,dt)}}}const bt={name:"eventListeners",enabled:true,phase:"write",fn:function t(){},effect:pt,data:{}};var mt={left:"right",right:"left",bottom:"top",top:"bottom"};function yt(t){return t.replace(/left|right|bottom|top/g,(function(t){return mt[t]}))}var gt={start:"end",end:"start"};function xt(t){return t.replace(/start|end/g,(function(t){return gt[t]}))}function wt(t){var r=L(t);var e=r.pageXOffset;var n=r.pageYOffset;return{scrollLeft:e,scrollTop:n}}function Ot(t){return F(G(t)).left+wt(t).scrollLeft}function jt(t,r){var e=L(t);var n=G(t);var i=e.visualViewport;var a=n.clientWidth;var o=n.clientHeight;var s=0;var u=0;if(i){a=i.width;o=i.height;var f=D();if(f||!f&&r==="fixed"){s=i.offsetLeft;u=i.offsetTop}}return{width:a,height:o,x:s+Ot(t),y:u}}function kt(t){var r;var e=G(t);var n=wt(t);var i=(r=t.ownerDocument)==null?void 0:r.body;var a=B(e.scrollWidth,e.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0);var o=B(e.scrollHeight,e.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);var s=-n.scrollLeft+Ot(t);var u=-n.scrollTop;if(N(i||e).direction==="rtl"){s+=B(e.clientWidth,i?i.clientWidth:0)-a}return{width:a,height:o,x:s,y:u}}function Ct(t){var r=N(t),e=r.overflow,n=r.overflowX,i=r.overflowY;return/auto|scroll|overlay|hidden/.test(e+i+n)}function Mt(t){if(["html","body","#document"].indexOf(A(t))>=0){return t.ownerDocument.body}if(W(t)&&Ct(t)){return t}return Mt(J(t))}function Pt(t,r){var e;if(r===void 0){r=[]}var n=Mt(t);var i=n===((e=t.ownerDocument)==null?void 0:e.body);var a=L(n);var o=i?[a].concat(a.visualViewport||[],Ct(n)?n:[]):n;var s=r.concat(o);return i?s:s.concat(Pt(J(o)))}function At(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Lt(t,r){var e=F(t,false,r==="fixed");e.top=e.top+t.clientTop;e.left=e.left+t.clientLeft;e.bottom=e.top+t.clientHeight;e.right=e.left+t.clientWidth;e.width=t.clientWidth;e.height=t.clientHeight;e.x=e.left;e.y=e.top;return e}function St(t,r,e){return r===h?At(jt(t,e)):S(r)?Lt(r,e):At(kt(G(t)))}function Wt(t){var r=Pt(J(t));var e=["absolute","fixed"].indexOf(N(t).position)>=0;var n=e&&W(t)?X(t):t;if(!S(n)){return[]}return r.filter((function(t){return S(t)&&$(t,n)&&A(t)!=="body"}))}function qt(t,r,e,n){var i=r==="clippingParents"?Wt(t):[].concat(r);var a=[].concat(i,[e]);var o=a[0];var s=a.reduce((function(r,e){var i=St(t,e,n);r.top=B(i.top,r.top);r.right=H(i.right,r.right);r.bottom=H(i.bottom,r.bottom);r.left=B(i.left,r.left);return r}),St(t,o,n));s.width=s.right-s.left;s.height=s.bottom-s.top;s.x=s.left;s.y=s.top;return s}function zt(t){var r=t.reference,e=t.element,n=t.placement;var u=n?T(n):null;var f=n?ut(n):null;var l=r.x+r.width/2-e.width/2;var h=r.y+r.height/2-e.height/2;var d;switch(u){case i:d={x:l,y:r.y-e.height};break;case a:d={x:l,y:r.y+r.height};break;case o:d={x:r.x+r.width,y:h};break;case s:d={x:r.x-e.width,y:h};break;default:d={x:r.x,y:r.y}}var p=u?Y(u):null;if(p!=null){var b=p==="y"?"height":"width";switch(f){case v:d[p]=d[p]-(r[b]/2-e[b]/2);break;case c:d[p]=d[p]+(r[b]/2-e[b]/2);break}}return d}function Et(t,r){if(r===void 0){r={}}var e=r,n=e.placement,s=n===void 0?t.placement:n,u=e.strategy,v=u===void 0?t.strategy:u,c=e.boundary,b=c===void 0?l:c,m=e.rootBoundary,y=m===void 0?h:m,g=e.elementContext,x=g===void 0?d:g,w=e.altBoundary,O=w===void 0?false:w,j=e.padding,k=j===void 0?0:j;var C=et(typeof k!=="number"?k:nt(k,f));var M=x===d?p:d;var P=t.rects.popper;var A=t.elements[O?M:x];var L=qt(S(A)?A:A.contextElement||G(t.elements.popper),b,y,v);var W=F(t.elements.reference);var q=zt({reference:W,element:P,strategy:"absolute",placement:s});var z=At(Object.assign({},P,q));var E=x===d?z:W;var R={top:L.top-E.top+C.top,bottom:E.bottom-L.bottom+C.bottom,left:L.left-E.left+C.left,right:E.right-L.right+C.right};var T=t.modifiersData.offset;if(x===d&&T){var B=T[s];Object.keys(R).forEach((function(t){var r=[o,a].indexOf(t)>=0?1:-1;var e=[i,a].indexOf(t)>=0?"y":"x";R[t]+=B[e]*r}))}return R}function Rt(t,r){if(r===void 0){r={}}var e=r,n=e.placement,i=e.boundary,a=e.rootBoundary,o=e.padding,s=e.flipVariations,u=e.allowedAutoPlacements,v=u===void 0?m:u;var c=ut(n);var l=c?s?b:b.filter((function(t){return ut(t)===c})):f;var h=l.filter((function(t){return v.indexOf(t)>=0}));if(h.length===0){h=l}var d=h.reduce((function(r,e){r[e]=Et(t,{placement:e,boundary:i,rootBoundary:a,padding:o})[T(e)];return r}),{});return Object.keys(d).sort((function(t,r){return d[t]-d[r]}))}function Tt(t){if(T(t)===u){return[]}var r=yt(t);return[xt(t),r,xt(r)]}function Bt(t){var r=t.state,e=t.options,n=t.name;if(r.modifiersData[n]._skip){return}var f=e.mainAxis,c=f===void 0?true:f,l=e.altAxis,h=l===void 0?true:l,d=e.fallbackPlacements,p=e.padding,b=e.boundary,m=e.rootBoundary,y=e.altBoundary,g=e.flipVariations,x=g===void 0?true:g,w=e.allowedAutoPlacements;var O=r.options.placement;var j=T(O);var k=j===O;var C=d||(k||!x?[yt(O)]:Tt(O));var M=[O].concat(C).reduce((function(t,e){return t.concat(T(e)===u?Rt(r,{placement:e,boundary:b,rootBoundary:m,padding:p,flipVariations:x,allowedAutoPlacements:w}):e)}),[]);var P=r.rects.reference;var A=r.rects.popper;var L=new Map;var S=true;var W=M[0];for(var q=0;q<M.length;q++){var z=M[q];var E=T(z);var R=ut(z)===v;var B=[i,a].indexOf(E)>=0;var H=B?"width":"height";var I=Et(r,{placement:z,boundary:b,rootBoundary:m,altBoundary:y,padding:p});var _=B?R?o:s:R?a:i;if(P[H]>A[H]){_=yt(_)}var D=yt(_);var F=[];if(c){F.push(I[E]<=0)}if(h){F.push(I[_]<=0,I[D]<=0)}if(F.every((function(t){return t}))){W=z;S=false;break}L.set(z,F)}if(S){var V=x?3:1;var $=function t(r){var e=M.find((function(t){var e=L.get(t);if(e){return e.slice(0,r).every((function(t){return t}))}}));if(e){W=e;return"break"}};for(var N=V;N>0;N--){var U=$(N);if(U==="break")break}}if(r.placement!==W){r.modifiersData[n]._skip=true;r.placement=W;r.reset=true}}const Ht={name:"flip",enabled:true,phase:"main",fn:Bt,requiresIfExists:["offset"],data:{_skip:false}};function It(t,r,e){if(e===void 0){e={x:0,y:0}}return{top:t.top-r.height-e.y,right:t.right-r.width+e.x,bottom:t.bottom-r.height+e.y,left:t.left-r.width-e.x}}function _t(t){return[i,o,a,s].some((function(r){return t[r]>=0}))}function Dt(t){var r=t.state,e=t.name;var n=r.rects.reference;var i=r.rects.popper;var a=r.modifiersData.preventOverflow;var o=Et(r,{elementContext:"reference"});var s=Et(r,{altBoundary:true});var u=It(o,n);var f=It(s,i,a);var v=_t(u);var c=_t(f);r.modifiersData[e]={referenceClippingOffsets:u,popperEscapeOffsets:f,isReferenceHidden:v,hasPopperEscaped:c};r.attributes.popper=Object.assign({},r.attributes.popper,{"data-popper-reference-hidden":v,"data-popper-escaped":c})}const Ft={name:"hide",enabled:true,phase:"main",requiresIfExists:["preventOverflow"],fn:Dt};function Vt(t,r,e){var n=T(t);var a=[s,i].indexOf(n)>=0?-1:1;var u=typeof e==="function"?e(Object.assign({},r,{placement:t})):e,f=u[0],v=u[1];f=f||0;v=(v||0)*a;return[s,o].indexOf(n)>=0?{x:v,y:f}:{x:f,y:v}}function $t(t){var r=t.state,e=t.options,n=t.name;var i=e.offset,a=i===void 0?[0,0]:i;var o=m.reduce((function(t,e){t[e]=Vt(e,r.rects,a);return t}),{});var s=o[r.placement],u=s.x,f=s.y;if(r.modifiersData.popperOffsets!=null){r.modifiersData.popperOffsets.x+=u;r.modifiersData.popperOffsets.y+=f}r.modifiersData[n]=o}const Nt={name:"offset",enabled:true,phase:"main",requires:["popperOffsets"],fn:$t};function Ut(t){var r=t.state,e=t.name;r.modifiersData[e]=zt({reference:r.rects.reference,element:r.rects.popper,strategy:"absolute",placement:r.placement})}const Gt={name:"popperOffsets",enabled:true,phase:"read",fn:Ut,data:{}};function Jt(t){return t==="x"?"y":"x"}function Kt(t){var r=t.state,e=t.options,n=t.name;var u=e.mainAxis,f=u===void 0?true:u,c=e.altAxis,l=c===void 0?false:c,h=e.boundary,d=e.rootBoundary,p=e.altBoundary,b=e.padding,m=e.tether,y=m===void 0?true:m,g=e.tetherOffset,x=g===void 0?0:g;var w=Et(r,{boundary:h,rootBoundary:d,padding:b,altBoundary:p});var O=T(r.placement);var j=ut(r.placement);var k=!j;var C=Y(O);var M=Jt(C);var P=r.modifiersData.popperOffsets;var A=r.rects.reference;var L=r.rects.popper;var S=typeof x==="function"?x(Object.assign({},r.rects,{placement:r.placement})):x;var W=typeof S==="number"?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S);var q=r.modifiersData.offset?r.modifiersData.offset[r.placement]:null;var z={x:0,y:0};if(!P){return}if(f){var E;var R=C==="y"?i:s;var I=C==="y"?a:o;var _=C==="y"?"height":"width";var D=P[C];var F=D+w[R];var $=D-w[I];var N=y?-L[_]/2:0;var U=j===v?A[_]:L[_];var G=j===v?-L[_]:-A[_];var J=r.elements.arrow;var K=y&&J?V(J):{width:0,height:0};var Q=r.modifiersData["arrow#persistent"]?r.modifiersData["arrow#persistent"].padding:rt();var et=Q[R];var nt=Q[I];var it=Z(0,A[_],K[_]);var at=k?A[_]/2-N-it-et-W.mainAxis:U-it-et-W.mainAxis;var ot=k?-A[_]/2+N+it+nt+W.mainAxis:G+it+nt+W.mainAxis;var st=r.elements.arrow&&X(r.elements.arrow);var ft=st?C==="y"?st.clientTop||0:st.clientLeft||0:0;var vt=(E=q==null?void 0:q[C])!=null?E:0;var ct=D+at-vt-ft;var lt=D+ot-vt;var ht=Z(y?H(F,ct):F,D,y?B($,lt):$);P[C]=ht;z[C]=ht-D}if(l){var dt;var pt=C==="x"?i:s;var bt=C==="x"?a:o;var mt=P[M];var yt=M==="y"?"height":"width";var gt=mt+w[pt];var xt=mt-w[bt];var wt=[i,s].indexOf(O)!==-1;var Ot=(dt=q==null?void 0:q[M])!=null?dt:0;var jt=wt?gt:mt-A[yt]-L[yt]-Ot+W.altAxis;var kt=wt?mt+A[yt]+L[yt]-Ot-W.altAxis:xt;var Ct=y&&wt?tt(jt,mt,kt):Z(y?jt:gt,mt,y?kt:xt);P[M]=Ct;z[M]=Ct-mt}r.modifiersData[n]=z}const Qt={name:"preventOverflow",enabled:true,phase:"main",fn:Kt,requiresIfExists:["offset"]};function Xt(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Yt(t){if(t===L(t)||!W(t)){return wt(t)}else{return Xt(t)}}function Zt(t){var r=t.getBoundingClientRect();var e=I(r.width)/t.offsetWidth||1;var n=I(r.height)/t.offsetHeight||1;return e!==1||n!==1}function tr(t,r,e){if(e===void 0){e=false}var n=W(r);var i=W(r)&&Zt(r);var a=G(r);var o=F(t,i,e);var s={scrollLeft:0,scrollTop:0};var u={x:0,y:0};if(n||!n&&!e){if(A(r)!=="body"||Ct(a)){s=Yt(r)}if(W(r)){u=F(r,true);u.x+=r.clientLeft;u.y+=r.clientTop}else if(a){u.x=Ot(a)}}return{x:o.left+s.scrollLeft-u.x,y:o.top+s.scrollTop-u.y,width:o.width,height:o.height}}function rr(t){var r=new Map;var e=new Set;var n=[];t.forEach((function(t){r.set(t.name,t)}));function i(t){e.add(t.name);var a=[].concat(t.requires||[],t.requiresIfExists||[]);a.forEach((function(t){if(!e.has(t)){var n=r.get(t);if(n){i(n)}}}));n.push(t)}t.forEach((function(t){if(!e.has(t.name)){i(t)}}));return n}function er(t){var r=rr(t);return P.reduce((function(t,e){return t.concat(r.filter((function(t){return t.phase===e})))}),[])}function nr(t){var r;return function(){if(!r){r=new Promise((function(e){Promise.resolve().then((function(){r=undefined;e(t())}))}))}return r}}function ir(t){var r=t.reduce((function(t,r){var e=t[r.name];t[r.name]=e?Object.assign({},e,r,{options:Object.assign({},e.options,r.options),data:Object.assign({},e.data,r.data)}):r;return t}),{});return Object.keys(r).map((function(t){return r[t]}))}var ar={placement:"bottom",modifiers:[],strategy:"absolute"};function or(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++){r[e]=arguments[e]}return!r.some((function(t){return!(t&&typeof t.getBoundingClientRect==="function")}))}function sr(t){if(t===void 0){t={}}var r=t,e=r.defaultModifiers,n=e===void 0?[]:e,i=r.defaultOptions,a=i===void 0?ar:i;return function t(r,e,i){if(i===void 0){i=a}var o={placement:"bottom",orderedModifiers:[],options:Object.assign({},ar,a),modifiersData:{},elements:{reference:r,popper:e},attributes:{},styles:{}};var s=[];var u=false;var f={state:o,setOptions:function t(i){var s=typeof i==="function"?i(o.options):i;c();o.options=Object.assign({},a,o.options,s);o.scrollParents={reference:S(r)?Pt(r):r.contextElement?Pt(r.contextElement):[],popper:Pt(e)};var u=er(ir([].concat(n,o.options.modifiers)));o.orderedModifiers=u.filter((function(t){return t.enabled}));v();return f.update()},forceUpdate:function t(){if(u){return}var r=o.elements,e=r.reference,n=r.popper;if(!or(e,n)){return}o.rects={reference:tr(e,X(n),o.options.strategy==="fixed"),popper:V(n)};o.reset=false;o.placement=o.options.placement;o.orderedModifiers.forEach((function(t){return o.modifiersData[t.name]=Object.assign({},t.data)}));for(var i=0;i<o.orderedModifiers.length;i++){if(o.reset===true){o.reset=false;i=-1;continue}var a=o.orderedModifiers[i],s=a.fn,v=a.options,c=v===void 0?{}:v,l=a.name;if(typeof s==="function"){o=s({state:o,options:c,name:l,instance:f})||o}}},update:nr((function(){return new Promise((function(t){f.forceUpdate();t(o)}))})),destroy:function t(){c();u=true}};if(!or(r,e)){return f}f.setOptions(i).then((function(t){if(!u&&i.onFirstUpdate){i.onFirstUpdate(t)}}));function v(){o.orderedModifiers.forEach((function(t){var r=t.name,e=t.options,n=e===void 0?{}:e,i=t.effect;if(typeof i==="function"){var a=i({state:o,name:r,instance:f,options:n});var u=function t(){};s.push(a||u)}}))}function c(){s.forEach((function(t){return t()}));s=[]}return f}}var ur=[bt,Gt,ht,R,Nt,Ht,Qt,st,Ft];var fr=sr({defaultModifiers:ur});const vr=":host(limel-portal){display:block;position:absolute;top:0;bottom:0;width:100%;pointer-events:none}:host([hidden]){display:none}slot{display:none}";const cr="is-visible";const lr="is-hiding";const hr=300;const dr=class{constructor(r){t(this,r);this.loaded=false;this.openDirection="bottom";this.position="absolute";this.containerId=undefined;this.containerStyle={};this.inheritParentWidth=false;this.visible=false;this.anchor=null;this.parents=new WeakMap}disconnectedCallback(){this.removeContainer();this.destroyPopper();if(this.observer&&this.container){this.observer.unobserve(this.container)}this.container=null}connectedCallback(){if(!this.loaded){return}if(this.visible){this.init()}}componentDidLoad(){this.loaded=true;this.connectedCallback()}init(){if(!this.host.isConnected){return}this.createContainer();this.hideContainer();this.attachContainer();this.styleContainer();if(this.visible){this.createPopper();this.showContainer()}if("ResizeObserver"in window){this.observer=new ResizeObserver((()=>{if(this.popperInstance){this.styleContainer();this.popperInstance.update()}}));this.observer.observe(this.container)}}render(){return r("slot",null)}onVisible(){if(!this.container&&this.visible){this.init();return}if(!this.visible){this.animateHideAndCleanup();return}this.styleContainer();this.createPopper();requestAnimationFrame((()=>{this.showContainer()}))}createContainer(){const t=this.host.shadowRoot.querySelector("slot");const r=t.assignedElements&&t.assignedElements()||[];this.container=document.createElement("div");this.container.setAttribute("id",this.containerId);this.container.setAttribute("class","limel-portal--container");Object.assign(this.container,{portalSource:this.host});r.forEach((t=>{this.parents.set(t,t.parentElement);this.container.append(t)}))}attachContainer(){this.getParent().append(this.container)}removeContainer(){if(!this.container){return}[...this.container.children].forEach((t=>{const r=this.parents.get(t);if(!r){return}r.append(t)}));this.container.remove()}hideContainer(){if(!this.container){return}this.container.classList.remove(cr)}showContainer(){this.container.classList.add(cr)}animateHideAndCleanup(){if(!this.container){return}this.container.classList.add(lr);this.styleContainer();setTimeout((()=>{this.container.classList.remove(lr);if(!this.visible){this.container.classList.remove(cr);this.destroyPopper()}}),hr)}styleContainer(){this.setContainerWidth();this.setContainerHeight();this.setContainerStyles()}setContainerWidth(){const t=this.host.getBoundingClientRect().width;if(this.inheritParentWidth){const r=this.getContentWidth(this.container);let e=r;if(t>0){e=t}this.container.style.width=`${e}px`}}getContentWidth(t){if(!t){return null}const r=t.getBoundingClientRect().width;if(r!==0){return r}const e=t.querySelector("*");return this.getContentWidth(e)}setContainerStyles(){for(const t of Object.keys(this.containerStyle)){this.container.style[t]=this.containerStyle[t]}}createPopper(){const t=this.createPopperConfig();this.popperInstance=fr(this.anchor||this.host,this.container,t)}destroyPopper(){var t;(t=this.popperInstance)===null||t===void 0?void 0:t.destroy();this.popperInstance=null}createPopperConfig(){const t=this.getPlacement(this.openDirection);const r=this.getFlipPlacement(this.openDirection);return{strategy:this.position,placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:[r]}}]}}getPlacement(t){const r={"left-start":"left-start",left:"left","left-end":"left-end","right-start":"right-start",right:"right","right-end":"right-end","top-start":"top-start",top:"top","top-end":"top-end","bottom-start":"bottom-start",bottom:"bottom","bottom-end":"bottom-end"};return r[t]}getFlipPlacement(t){const r={"left-start":"right-start",left:"right","left-end":"right-end","right-start":"left-start",right:"left","right-end":"left-end","top-start":"bottom-start",top:"bottom","top-end":"bottom-end","bottom-start":"top-start",bottom:"top","bottom-end":"top-end"};return r[t]}setContainerHeight(){const t=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);const{top:r,bottom:e}=this.host.getBoundingClientRect();const n=Math.max(r,0);const i=Math.max(t-e,0);const a=16;const o=Math.max(n,i)-a;this.container.style.maxHeight=`${o}px`}getParent(){let t=this.anchor||this.host;while(t){const r=t.closest(".limel-portal--parent");if(r){return r}t=t.getRootNode().host}return document.body}get host(){return e(this)}static get watchers(){return{visible:["onVisible"]}}};dr.style=vr;function pr(t,r){let e=r;do{e=e.parentNode}while(e&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&e.nodeType!==Node.DOCUMENT_NODE);return e===null||e===void 0?void 0:e.getElementById(t)}const br=500;class mr{constructor(t,r,e=br){this.timerHandle=null;this.showCallback=t;this.hideCallback=r;this.delayForShowing=e}showAfterDelay(){if(!this.timerHandle){this.timerHandle=setTimeout(this.showCallback,this.delayForShowing)}}hide(){clearTimeout(this.timerHandle);this.timerHandle=null;this.hideCallback()}}const yr=":host(limel-tooltip){position:absolute;pointer-events:none}";const gr=50;const xr=class{constructor(r){t(this,r);this.showTooltip=()=>{this.tooltipTimer.showAfterDelay()};this.hideTooltip=()=>{this.tooltipTimer.hide()};this.elementId=undefined;this.label=undefined;this.helperLabel=undefined;this.maxlength=gr;this.openDirection="top";this.open=undefined;this.portalId=n();this.tooltipId=n();this.tooltipTimer=new mr((()=>this.open=true),(()=>this.open=false))}connectedCallback(){this.ownerElement=pr(this.elementId,this.host);this.setOwnerAriaLabel();this.addListeners()}disconnectedCallback(){this.removeListeners()}render(){const t=getComputedStyle(this.host).getPropertyValue("--tooltip-z-index");return r("div",{class:"trigger-anchor"},r("limel-portal",{openDirection:this.openDirection,visible:this.open,containerId:this.portalId,containerStyle:{"z-index":t,"pointer-events":"none"},anchor:this.ownerElement},r("limel-tooltip-content",{label:this.label,helperLabel:this.helperLabel,maxlength:this.maxlength,role:"tooltip","aria-hidden":!this.open,id:this.tooltipId})))}setOwnerAriaLabel(){var t;(t=this.ownerElement)===null||t===void 0?void 0:t.setAttribute("aria-describedby",this.tooltipId)}addListeners(){var t,r,e,n;(t=this.ownerElement)===null||t===void 0?void 0:t.addEventListener("mouseover",this.showTooltip);(r=this.ownerElement)===null||r===void 0?void 0:r.addEventListener("mouseout",this.hideTooltip);(e=this.ownerElement)===null||e===void 0?void 0:e.addEventListener("focus",this.showTooltip);(n=this.ownerElement)===null||n===void 0?void 0:n.addEventListener("blur",this.hideTooltip)}removeListeners(){var t,r,e,n;(t=this.ownerElement)===null||t===void 0?void 0:t.removeEventListener("mouseover",this.showTooltip);(r=this.ownerElement)===null||r===void 0?void 0:r.removeEventListener("mouseout",this.hideTooltip);(e=this.ownerElement)===null||e===void 0?void 0:e.removeEventListener("focus",this.showTooltip);(n=this.ownerElement)===null||n===void 0?void 0:n.removeEventListener("blur",this.hideTooltip)}get host(){return e(this)}};xr.style=yr;const wr=":host(limel-tooltip-content){display:flex;border-radius:0.25rem;padding:0.25rem 0.5rem;background-color:rgb(var(--contrast-1300));box-shadow:var(--shadow-depth-16)}text{font-size:var(--limel-theme-default-font-size);line-height:1.25;display:flex;column-gap:1rem}text.has-column-layout{display:table-cell;width:fit-content;max-width:min(var(--tooltip-max-width-of-text), 80vw)}text.has-column-layout .label{padding-bottom:0.5rem}text.has-column-layout .helper-label{padding-bottom:0.25rem}.label{color:rgb(var(--contrast-200))}.helper-label{color:rgb(var(--contrast-800))}.helper-label:empty{display:none}";const Or=class{constructor(r){t(this,r);this.label=undefined;this.helperLabel=undefined;this.maxlength=undefined}render(){let t=false;if(this.helperLabel&&this.maxlength){t=this.label.length+this.helperLabel.length>this.maxlength}const e={};if(this.maxlength){e.style={"--tooltip-max-width-of-text":`${this.maxlength}`+"ch"}}return[r("text",Object.assign({class:{"has-column-layout":t}},e),r("div",{class:"label"},this.label),r("div",{class:"helper-label"},this.helperLabel))]}};Or.style=wr;export{dr as limel_portal,xr as limel_tooltip,Or as limel_tooltip_content};
2
+ //# sourceMappingURL=p-b5a96409.entry.js.map