@luzmo/analytics-components-kit 1.0.1-alpha.97 → 1.0.1-alpha.99

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 (116) hide show
  1. package/angular/README.md +2 -2
  2. package/angular/components/ai-interaction-textarea.component.ts +8 -0
  3. package/angular/components/{filter-data-item-picker.component.ts → data-items-select.component.ts} +34 -17
  4. package/angular/components/edit-filters/index.ts +1 -0
  5. package/angular/components/edit-filters/types.ts +10 -0
  6. package/angular/components/edit-filters.component.ts +41 -0
  7. package/angular/components/slot-contents-picker.component.ts +8 -6
  8. package/angular/esm/components/ai-interaction-textarea.component.d.ts +5 -1
  9. package/angular/esm/components/ai-interaction-textarea.component.js +22 -2
  10. package/angular/esm/components/data-items-select.component.d.ts +33 -0
  11. package/angular/esm/components/{filter-data-item-picker.component.js → data-items-select.component.js} +41 -26
  12. package/angular/esm/components/edit-filters/index.d.ts +1 -0
  13. package/angular/esm/components/edit-filters/index.js +1 -0
  14. package/angular/esm/components/edit-filters/types.d.ts +8 -0
  15. package/angular/esm/components/edit-filters/types.js +1 -0
  16. package/angular/esm/components/edit-filters.component.d.ts +21 -0
  17. package/angular/esm/components/edit-filters.component.js +89 -0
  18. package/angular/esm/components/slot-contents-picker.component.d.ts +7 -6
  19. package/angular/esm/components/slot-contents-picker.component.js +11 -6
  20. package/angular/esm/index.d.ts +5 -5
  21. package/angular/esm/index.js +6 -6
  22. package/angular/esm/types.d.ts +9 -0
  23. package/angular/index.ts +6 -6
  24. package/angular/types.ts +17 -0
  25. package/angular/utils/filters/expressions.d.ts +1 -1
  26. package/components/ai-interaction-textarea/ai-interaction-textarea.d.ts +21 -0
  27. package/components/ai-interaction-textarea/index.cjs +17 -15
  28. package/components/ai-interaction-textarea/index.js +90 -65
  29. package/components/{filter-data-item-picker/filter-data-item-picker.d.ts → data-items-select/data-items-select.d.ts} +36 -21
  30. package/components/data-items-select/index.cjs +39 -0
  31. package/components/data-items-select/index.d.ts +6 -0
  32. package/components/{filter-data-item-picker → data-items-select}/index.js +127 -109
  33. package/components/dataset-selector-list/index.cjs +1 -1
  34. package/components/dataset-selector-list/index.js +3 -3
  35. package/components/dataset-selector-row/index.cjs +1 -1
  36. package/components/dataset-selector-row/index.js +1 -1
  37. package/components/{de-COKGBX9L.cjs → de-DOYL4txr.cjs} +1 -1
  38. package/components/{de-DU0DlXuf.js → de-SDzGVifr.js} +10 -1
  39. package/components/display-settings-binning/index.cjs +1 -1
  40. package/components/display-settings-binning/index.js +1 -1
  41. package/components/display-settings-datetime/index.cjs +1 -1
  42. package/components/display-settings-datetime/index.js +1 -1
  43. package/components/display-settings-grand-totals/index.cjs +1 -1
  44. package/components/display-settings-grand-totals/index.js +1 -1
  45. package/components/display-settings-numeric/index.cjs +1 -1
  46. package/components/display-settings-numeric/index.js +1 -1
  47. package/components/display-settings-period-over-period/index.cjs +1 -1
  48. package/components/display-settings-period-over-period/index.js +1 -1
  49. package/components/draggable-data-item/index.cjs +1 -1
  50. package/components/draggable-data-item/index.js +1 -1
  51. package/components/draggable-data-item-level/index.cjs +1 -1
  52. package/components/draggable-data-item-level/index.js +1 -1
  53. package/components/droppable-slot/index.cjs +9 -9
  54. package/components/droppable-slot/index.js +82 -158
  55. package/components/edit-filters/edit-filters.d.ts +79 -0
  56. package/components/edit-filters/index.cjs +144 -0
  57. package/components/edit-filters/index.d.ts +8 -0
  58. package/components/edit-filters/index.js +341 -0
  59. package/components/edit-filters/types.d.ts +8 -0
  60. package/components/{es-BxR1uGKR.js → es-B1TeapPZ.js} +10 -1
  61. package/components/{es-CaKfa7fn.cjs → es-DcQvrHgz.cjs} +1 -1
  62. package/components/filter-expression-picker/index.cjs +1 -1
  63. package/components/filter-expression-picker/index.js +1 -1
  64. package/components/filter-item/filter-item.d.ts +1 -1
  65. package/components/filter-item/index.cjs +7 -5
  66. package/components/filter-item/index.js +78 -68
  67. package/components/filter-value-picker/index.cjs +1 -1
  68. package/components/filter-value-picker/index.js +1 -1
  69. package/components/filter-value-picker-datetime/index.cjs +2 -2
  70. package/components/filter-value-picker-datetime/index.js +4 -4
  71. package/components/filter-value-picker-hierarchy/index.cjs +1 -1
  72. package/components/filter-value-picker-hierarchy/index.js +2 -2
  73. package/components/filter-value-picker-numeric/index.cjs +2 -1
  74. package/components/filter-value-picker-numeric/index.js +3 -2
  75. package/components/{fr-DiZbjx_a.cjs → fr-D6QmA3Ve.cjs} +1 -1
  76. package/components/{fr-CvltYxR_.js → fr-sZFBmltf.js} +10 -1
  77. package/components/{get-css-variable-Pzks_rOx.cjs → get-css-variable-C0B_Sxqf.cjs} +1 -1
  78. package/components/{get-css-variable-Bb7TxJdX.js → get-css-variable-DgTBQV3c.js} +2 -1
  79. package/components/grid/index.cjs +1 -1
  80. package/components/grid/index.js +1 -1
  81. package/components/{index-DNPULp4A.js → index-BikhVAa1.js} +1 -1
  82. package/components/{index-CFL6gmIu.cjs → index-CAbDIHYI.cjs} +1 -1
  83. package/components/{index-BNAmjOkm.cjs → index-DM58h73U.cjs} +3 -3
  84. package/components/{index-DdyZ2g5L.js → index-DR5275fa.js} +48 -18
  85. package/components/index.cjs +1 -1
  86. package/components/index.js +105 -106
  87. package/components/{nl-CLs7FmRK.js → nl-BYXZ-qNp.js} +10 -1
  88. package/components/{nl-Bot6bJ4g.cjs → nl-D7oNsLn0.cjs} +1 -1
  89. package/components/{set-locale-hKTMz37h.js → set-locale-B5562CBM.js} +1 -1
  90. package/components/{set-locale-BRRalqne.cjs → set-locale-B8iQGfk0.cjs} +1 -1
  91. package/components/slot-contents-picker/index.cjs +31 -27
  92. package/components/slot-contents-picker/index.js +137 -124
  93. package/components/slot-contents-picker/slot-contents-picker.d.ts +26 -5
  94. package/components/slot-menu/index.cjs +6 -6
  95. package/components/slot-menu/index.js +76 -76
  96. package/components/slot-menu-list/index.cjs +1 -1
  97. package/components/slot-menu-list/index.js +1 -1
  98. package/components/slot-store-CRfN0nD3.js +98 -0
  99. package/components/slot-store-Dd_cPNXk.cjs +20 -0
  100. package/components/utils.cjs +1 -1
  101. package/components/utils.js +1 -1
  102. package/components/viz-item-menu/index.cjs +6 -6
  103. package/components/viz-item-menu/index.js +27 -28
  104. package/custom-elements.json +1922 -1631
  105. package/index.d.ts +1 -1
  106. package/package.json +12 -12
  107. package/types.d.ts +9 -0
  108. package/utils/filters/expressions.d.ts +1 -1
  109. package/angular/components/filter-group.component.ts +0 -29
  110. package/angular/esm/components/filter-data-item-picker.component.d.ts +0 -30
  111. package/angular/esm/components/filter-group.component.d.ts +0 -12
  112. package/angular/esm/components/filter-group.component.js +0 -56
  113. package/components/filter-data-item-picker/index.cjs +0 -47
  114. package/components/filter-data-item-picker/index.d.ts +0 -7
  115. package/components/filter-group/filter-group.d.ts +0 -26
  116. package/components/filter-group/index.d.ts +0 -7
@@ -96,6 +96,7 @@ const e = {
96
96
  s8665d029b5cb8b24: "Totaux généraux",
97
97
  s8a56a8c8bd19c9c7: "manquant",
98
98
  s8d0259032729869d: "Seconde",
99
+ s8de2a5b227e80c95: "(x) périodes ou plus",
99
100
  s965c503c3e42fdfe: "Activé",
100
101
  s9689e928323dc124: "dernière (période) complète",
101
102
  s981f232bd33ec927: "Taux",
@@ -113,10 +114,12 @@ const e = {
113
114
  sa6f2645578b2d2bc: "Année",
114
115
  sa7effa06c0f6784c: "supérieur à",
115
116
  sa8beb6b1182241ac: "Filtres",
117
+ sa91d4991fca9514e: "plus de",
116
118
  sac8256732f2ee1e5: "Données",
117
119
  sac8b59943205b14f: "prochaine (période) complète",
118
120
  sac94bb71f7737997: "Médiane",
119
121
  sacae74732f544fca: "Jours",
122
+ saf2a19f4eaf00f68: "ou plus",
120
123
  saf63b34c8601a6e1: ">",
121
124
  sb1f654608a3eea75: "Jour de la semaine",
122
125
  sb3b793ff5cc1bc39: "prochaines (x) périodes",
@@ -146,6 +149,7 @@ const e = {
146
149
  se0955919920ee87d: "Jour",
147
150
  se211e3d21bbf3bff: "Mesure",
148
151
  se2b7530e30fa607d: "Comparaison de période",
152
+ se2d6ee866b592a9f: "plus de (x) périodes",
149
153
  se415bbea6c976fb1: "Grouper par",
150
154
  se5316cbaa025f028: "suivant",
151
155
  se715be190539325a: "il y a",
@@ -166,7 +170,12 @@ const e = {
166
170
  sfad9ed343e97551c: "Valeur passée",
167
171
  sfb9e6d0c6baa99f5: "Correspond au plage de dates visible dans le graphique ou la table",
168
172
  sfbac36245480ddbc: "Séparateur",
169
- sfda1c9d0be35cec8: "trimestre en cours"
173
+ sfda1c9d0be35cec8: "trimestre en cours",
174
+ s7c95876637f6a9d7: "Filter",
175
+ s92ab9b834d8fd1fc: "Subgroup",
176
+ s79f7983c97f2aaed: "Add filter group",
177
+ s8ba2b22eee9bb57e: "Add filter",
178
+ s98b1cb8fb62909ec: "Group"
170
179
  };
171
180
  export {
172
181
  e as templates
@@ -19,6 +19,6 @@
19
19
  * */
20
20
  "use strict";function Pe(e){if(Array.isArray(e))return e}function je(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n,i,a,o,l=[],u=!0,c=!1;try{if(a=(t=t.call(e)).next,r!==0)for(;!(u=(n=a.call(t)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(f){c=!0,i=f}finally{try{if(!u&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return l}}function Z(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function be(e,r){if(e){if(typeof e=="string")return Z(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Z(e,r):void 0}}function xe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
21
21
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function he(e,r){return Pe(e)||je(e,r)||be(e,r)||xe()}var $={},W={},ne;function we(){if(ne)return W;ne=1,Object.defineProperty(W,"__esModule",{value:!0}),W.bind=void 0;function e(r,t){var n=t.type,i=t.listener,a=t.options;return r.addEventListener(n,i,a),function(){r.removeEventListener(n,i,a)}}return W.bind=e,W}var M={},ae;function Ie(){if(ae)return M;ae=1;var e=M&&M.__assign||function(){return e=Object.assign||function(a){for(var o,l=1,u=arguments.length;l<u;l++){o=arguments[l];for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(a[c]=o[c])}return a},e.apply(this,arguments)};Object.defineProperty(M,"__esModule",{value:!0}),M.bindAll=void 0;var r=we();function t(a){if(!(typeof a>"u"))return typeof a=="boolean"?{capture:a}:a}function n(a,o){if(o==null)return a;var l=e(e({},a),{options:e(e({},t(o)),t(a.options))});return l}function i(a,o,l){var u=o.map(function(c){var f=n(c,l);return(0,r.bind)(a,f)});return function(){u.forEach(function(f){return f()})}}return M.bindAll=i,M}var ie;function Ce(){return ie||(ie=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=e.bind=void 0;var r=we();Object.defineProperty(e,"bind",{enumerable:!0,get:function(){return r.bind}});var t=Ie();Object.defineProperty(e,"bindAll",{enumerable:!0,get:function(){return t.bindAll}})})($)),$}var H=Ce();function L(e){"@babel/helpers - typeof";return L=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},L(e)}function Fe(e,r){if(L(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r);if(L(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Me(e){var r=Fe(e,"string");return L(r)=="symbol"?r:r+""}function X(e,r,t){return(r=Me(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var De=2147483647,Oe="data-pdnd-honey-pot";function oe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function ue(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?oe(Object(t),!0).forEach(function(n){X(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):oe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}var U=2,le=U/2;function He(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function Ke(e){return{x:e.x-le,y:e.y-le}}function Re(e){return{x:Math.max(e.x,0),y:Math.max(e.y,0)}}function We(e){return{x:Math.min(e.x,window.innerWidth-U),y:Math.min(e.y,window.innerHeight-U)}}function ce(e){var r=e.client,t=We(Re(Ke(He(r))));return DOMRect.fromRect({x:t.x,y:t.y,width:U,height:U})}function de(e){var r=e.clientRect;return{left:"".concat(r.left,"px"),top:"".concat(r.top,"px"),width:"".concat(r.width,"px"),height:"".concat(r.height,"px")}}function ke(e){var r=e.client,t=e.clientRect;return r.x>=t.x&&r.x<=t.x+t.width&&r.y>=t.y&&r.y<=t.y+t.height}function Ne(e){var r=e.initial,t=document.createElement("div");t.setAttribute(Oe,"true");var n=ce({client:r});Object.assign(t.style,ue(ue({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},de({clientRect:n})),{},{pointerEvents:"auto",zIndex:De})),document.body.appendChild(t);var i=H.bind(window,{type:"pointermove",listener:function(o){var l={x:o.clientX,y:o.clientY};n=ce({client:l}),Object.assign(t.style,de({clientRect:n}))},options:{capture:!0}});return function(o){var l=o.current;if(i(),ke({client:l,clientRect:n})){t.remove();return}function u(){c(),t.remove()}var c=H.bindAll(window,[{type:"pointerdown",listener:u},{type:"pointermove",listener:u},{type:"focusin",listener:u},{type:"focusout",listener:u},{type:"dragstart",listener:u},{type:"dragenter",listener:u},{type:"dragover",listener:u}],{capture:!0})}}function Le(){var e=null;function r(){return e=null,H.bind(window,{type:"pointermove",listener:function(i){e={x:i.clientX,y:i.clientY}},options:{capture:!0}})}function t(){var n=null;return function(a){var o=a.eventName,l=a.payload;if(o==="onDragStart"){var u,c=l.location.initial.input,f=(u=e)!==null&&u!==void 0?u:{x:c.clientX,y:c.clientY};n=Ne({initial:f})}if(o==="onDrop"){var p,v=l.location.current.input;(p=n)===null||p===void 0||p({current:{x:v.clientX,y:v.clientY}}),n=null,e=null}}}return{bindEvents:r,getOnPostDispatch:t}}function Ue(e){if(Array.isArray(e))return Z(e)}function Be(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
22
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Te(e){return Ue(e)||Be(e)||be(e)||Xe()}function Se(e){return e instanceof Element&&e.hasAttribute(Oe)}function Ye(e){var r=document.elementsFromPoint(e.x,e.y),t=he(r,2),n=t[0],i=t[1];return n?Se(n)?i??null:n:null}function ee(e){var r=null;return function(){if(!r){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=e.apply(this,i);r={result:o}}return r.result}}var $e=ee(function(){return navigator.userAgent.includes("Firefox")}),Y=ee(function(){var r=navigator,t=r.userAgent;return t.includes("AppleWebKit")&&!t.includes("Chrome")}),J={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};function qe(e){var r=e.dragLeave;return Y()?r.hasOwnProperty(J.isLeavingWindow):!1}(function(){if(typeof window>"u"||!Y())return;function r(){return{enterCount:0,isOverWindow:!1}}var t=r();function n(){t=r()}H.bindAll(window,[{type:"dragstart",listener:function(){t.enterCount=0,t.isOverWindow=!0}},{type:"drop",listener:n},{type:"dragend",listener:n},{type:"dragenter",listener:function(a){!t.isOverWindow&&t.enterCount===0&&(a[J.isEnteringWindow]=!0),t.isOverWindow=!0,t.enterCount++}},{type:"dragleave",listener:function(a){t.enterCount--,t.isOverWindow&&t.enterCount===0&&(a[J.isLeavingWindow]=!0,t.isOverWindow=!1)}}],{capture:!0})})();function ze(e){return"nodeName"in e}function Ve(e){return ze(e)&&e.ownerDocument!==document}function Ge(e){var r=e.dragLeave,t=r.type,n=r.relatedTarget;return t!=="dragleave"?!1:Y()?qe({dragLeave:r}):n==null?!0:$e()?Ve(n):n instanceof HTMLIFrameElement}function Ze(e){var r=e.onDragEnd;return[{type:"pointermove",listener:(function(){var t=0;return function(){if(t<20){t++;return}r()}})()},{type:"pointerdown",listener:r}]}function k(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var Je=function(r){var t=[],n=null,i=function(){for(var o=arguments.length,l=new Array(o),u=0;u<o;u++)l[u]=arguments[u];t=l,!n&&(n=requestAnimationFrame(function(){n=null,r.apply(void 0,t)}))};return i.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},i},q=Je(function(e){return e()}),B=(function(){var e=null;function r(n){var i=requestAnimationFrame(function(){e=null,n()});e={frameId:i,fn:n}}function t(){e&&(cancelAnimationFrame(e.frameId),e.fn(),e=null)}return{schedule:r,flush:t}})();function Qe(e){var r=e.source,t=e.initial,n=e.dispatchEvent,i={dropTargets:[]};function a(l){n(l),i={dropTargets:l.payload.location.current.dropTargets}}var o={start:function(u){var c=u.nativeSetDragImage,f={current:t,previous:i,initial:t};a({eventName:"onGenerateDragPreview",payload:{source:r,location:f,nativeSetDragImage:c}}),B.schedule(function(){a({eventName:"onDragStart",payload:{source:r,location:f}})})},dragUpdate:function(u){var c=u.current;B.flush(),q.cancel(),a({eventName:"onDropTargetChange",payload:{source:r,location:{initial:t,previous:i,current:c}}})},drag:function(u){var c=u.current;q(function(){B.flush();var f={initial:t,previous:i,current:c};a({eventName:"onDrag",payload:{source:r,location:f}})})},drop:function(u){var c=u.current,f=u.updatedSourcePayload;B.flush(),q.cancel(),a({eventName:"onDrop",payload:{source:f??r,location:{current:c,previous:i,initial:t}}})}};return o}var Q={isActive:!1};function Ae(){return!Q.isActive}function _e(e){return e.dataTransfer?e.dataTransfer.setDragImage.bind(e.dataTransfer):null}function et(e){var r=e.current,t=e.next;if(r.length!==t.length)return!0;for(var n=0;n<r.length;n++)if(r[n].element!==t[n].element)return!0;return!1}function tt(e){var r=e.event,t=e.dragType,n=e.getDropTargetsOver,i=e.dispatchEvent;if(!Ae())return;var a=rt({event:r,dragType:t,getDropTargetsOver:n});Q.isActive=!0;var o={current:a};z({event:r,current:a.dropTargets});var l=Qe({source:t.payload,dispatchEvent:i,initial:a});function u(d){var s=et({current:o.current.dropTargets,next:d.dropTargets});o.current=d,s&&l.dragUpdate({current:o.current})}function c(d){var s=k(d),g=Se(d.target)?Ye({x:s.clientX,y:s.clientY}):d.target,y=n({target:g,event:d,input:s,source:t.payload,current:o.current.dropTargets});y.length&&(d.cancelable&&d.preventDefault(),z({event:d,current:y})),u({dropTargets:y,input:s})}function f(){o.current.dropTargets.length&&u({dropTargets:[],input:o.current.input}),l.drop({current:o.current,updatedSourcePayload:null}),p()}function p(){Q.isActive=!1,v()}var v=H.bindAll(window,[{type:"dragover",listener:function(s){c(s),l.drag({current:o.current})}},{type:"dragenter",listener:c},{type:"dragleave",listener:function(s){Ge({dragLeave:s})&&(u({input:o.current.input,dropTargets:[]}),t.startedFrom==="external"&&f())}},{type:"drop",listener:function(s){if(o.current={dropTargets:o.current.dropTargets,input:k(s)},!o.current.dropTargets.length){f();return}s.cancelable&&s.preventDefault(),z({event:s,current:o.current.dropTargets}),l.drop({current:o.current,updatedSourcePayload:t.type==="external"?t.getDropPayload(s):null}),p()}},{type:"dragend",listener:function(s){o.current={dropTargets:o.current.dropTargets,input:k(s)},f()}}].concat(Te(Ze({onDragEnd:f}))),{capture:!0});l.start({nativeSetDragImage:_e(r)})}function z(e){var r,t=e.event,n=e.current,i=(r=n[0])===null||r===void 0?void 0:r.dropEffect;i!=null&&t.dataTransfer&&(t.dataTransfer.dropEffect=i)}function rt(e){var r=e.event,t=e.dragType,n=e.getDropTargetsOver,i=k(r);if(t.startedFrom==="external")return{input:i,dropTargets:[]};var a=n({input:i,source:t.payload,target:r.target,event:r,current:[]});return{input:i,dropTargets:a}}var se={canStart:Ae,start:tt},_=new Map;function nt(e){var r=e.typeKey,t=e.mount,n=_.get(r);if(n)return n.usageCount++,n;var i={typeKey:r,unmount:t(),usageCount:1};return _.set(r,i),i}function at(e){var r=nt(e);return function(){r.usageCount--,!(r.usageCount>0)&&(r.unmount(),_.delete(e.typeKey))}}function te(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return function(){r.forEach(function(i){return i()})}}function Ee(e,r){var t=r.attribute,n=r.value;return e.setAttribute(t,n),function(){return e.removeAttribute(t)}}function fe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function F(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?fe(Object(t),!0).forEach(function(n){X(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):fe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function V(e,r){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=it(e))||r){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
22
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Te(e){return Ue(e)||Be(e)||be(e)||Xe()}function Se(e){return e instanceof Element&&e.hasAttribute(Oe)}function Ye(e){var r=document.elementsFromPoint(e.x,e.y),t=he(r,2),n=t[0],i=t[1];return n?Se(n)?i??null:n:null}function ee(e){var r=null;return function(){if(!r){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=e.apply(this,i);r={result:o}}return r.result}}var $e=ee(function(){return navigator.userAgent.includes("Firefox")}),Y=ee(function(){var r=navigator,t=r.userAgent;return t.includes("AppleWebKit")&&!t.includes("Chrome")}),J={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};function qe(e){var r=e.dragLeave;return Y()?r.hasOwnProperty(J.isLeavingWindow):!1}(function(){if(typeof window>"u"||!Y())return;function r(){return{enterCount:0,isOverWindow:!1}}var t=r();function n(){t=r()}H.bindAll(window,[{type:"dragstart",listener:function(){t.enterCount=0,t.isOverWindow=!0}},{type:"drop",listener:n},{type:"dragend",listener:n},{type:"dragenter",listener:function(a){!t.isOverWindow&&t.enterCount===0&&(a[J.isEnteringWindow]=!0),t.isOverWindow=!0,t.enterCount++}},{type:"dragleave",listener:function(a){t.enterCount--,t.isOverWindow&&t.enterCount===0&&(a[J.isLeavingWindow]=!0,t.isOverWindow=!1)}}],{capture:!0})})();function ze(e){return"nodeName"in e}function Ve(e){return ze(e)&&e.ownerDocument!==document}function Ge(e){var r=e.dragLeave,t=r.type,n=r.relatedTarget;return t!=="dragleave"?!1:Y()?qe({dragLeave:r}):n==null?!0:$e()?Ve(n):n instanceof HTMLIFrameElement}function Ze(e){var r=e.onDragEnd;return[{type:"pointermove",listener:(function(){var t=0;return function(){if(t<20){t++;return}r()}})()},{type:"pointerdown",listener:r}]}function k(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var Je=function(r){var t=[],n=null,i=function(){for(var o=arguments.length,l=new Array(o),u=0;u<o;u++)l[u]=arguments[u];t=l,!n&&(n=requestAnimationFrame(function(){n=null,r.apply(void 0,t)}))};return i.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},i},q=Je(function(e){return e()}),B=(function(){var e=null;function r(n){var i=requestAnimationFrame(function(){e=null,n()});e={frameId:i,fn:n}}function t(){e&&(cancelAnimationFrame(e.frameId),e.fn(),e=null)}return{schedule:r,flush:t}})();function Qe(e){var r=e.source,t=e.initial,n=e.dispatchEvent,i={dropTargets:[]};function a(l){n(l),i={dropTargets:l.payload.location.current.dropTargets}}var o={start:function(u){var c=u.nativeSetDragImage,f={current:t,previous:i,initial:t};a({eventName:"onGenerateDragPreview",payload:{source:r,location:f,nativeSetDragImage:c}}),B.schedule(function(){a({eventName:"onDragStart",payload:{source:r,location:f}})})},dragUpdate:function(u){var c=u.current;B.flush(),q.cancel(),a({eventName:"onDropTargetChange",payload:{source:r,location:{initial:t,previous:i,current:c}}})},drag:function(u){var c=u.current;q(function(){B.flush();var f={initial:t,previous:i,current:c};a({eventName:"onDrag",payload:{source:r,location:f}})})},drop:function(u){var c=u.current,f=u.updatedSourcePayload;B.flush(),q.cancel(),a({eventName:"onDrop",payload:{source:f??r,location:{current:c,previous:i,initial:t}}})}};return o}var Q={isActive:!1};function Ae(){return!Q.isActive}function _e(e){return e.dataTransfer?e.dataTransfer.setDragImage.bind(e.dataTransfer):null}function et(e){var r=e.current,t=e.next;if(r.length!==t.length)return!0;for(var n=0;n<r.length;n++)if(r[n].element!==t[n].element)return!0;return!1}function tt(e){var r=e.event,t=e.dragType,n=e.getDropTargetsOver,i=e.dispatchEvent;if(!Ae())return;var a=rt({event:r,dragType:t,getDropTargetsOver:n});Q.isActive=!0;var o={current:a};z({event:r,current:a.dropTargets});var l=Qe({source:t.payload,dispatchEvent:i,initial:a});function u(d){var s=et({current:o.current.dropTargets,next:d.dropTargets});o.current=d,s&&l.dragUpdate({current:o.current})}function c(d){var s=k(d),g=Se(d.target)?Ye({x:s.clientX,y:s.clientY}):d.target,y=n({target:g,event:d,input:s,source:t.payload,current:o.current.dropTargets});y.length&&(d.cancelable&&d.preventDefault(),z({event:d,current:y})),u({dropTargets:y,input:s})}function f(){o.current.dropTargets.length&&u({dropTargets:[],input:o.current.input}),l.drop({current:o.current,updatedSourcePayload:null}),p()}function p(){Q.isActive=!1,v()}var v=H.bindAll(window,[{type:"dragover",listener:function(s){c(s),l.drag({current:o.current})}},{type:"dragenter",listener:c},{type:"dragleave",listener:function(s){Ge({dragLeave:s})&&(u({input:o.current.input,dropTargets:[]}),t.startedFrom==="external"&&f())}},{type:"drop",listener:function(s){if(o.current={dropTargets:o.current.dropTargets,input:k(s)},!o.current.dropTargets.length){f();return}s.cancelable&&s.preventDefault(),z({event:s,current:o.current.dropTargets}),l.drop({current:o.current,updatedSourcePayload:t.type==="external"?t.getDropPayload(s):null}),p()}},{type:"dragend",listener:function(s){o.current={dropTargets:o.current.dropTargets,input:k(s)},f()}}].concat(Te(Ze({onDragEnd:f}))),{capture:!0,passive:!1});l.start({nativeSetDragImage:_e(r)})}function z(e){var r,t=e.event,n=e.current,i=(r=n[0])===null||r===void 0?void 0:r.dropEffect;i!=null&&t.dataTransfer&&(t.dataTransfer.dropEffect=i)}function rt(e){var r=e.event,t=e.dragType,n=e.getDropTargetsOver,i=k(r);if(t.startedFrom==="external")return{input:i,dropTargets:[]};var a=n({input:i,source:t.payload,target:r.target,event:r,current:[]});return{input:i,dropTargets:a}}var se={canStart:Ae,start:tt},_=new Map;function nt(e){var r=e.typeKey,t=e.mount,n=_.get(r);if(n)return n.usageCount++,n;var i={typeKey:r,unmount:t(),usageCount:1};return _.set(r,i),i}function at(e){var r=nt(e);return function(){r.usageCount--,!(r.usageCount>0)&&(r.unmount(),_.delete(e.typeKey))}}function te(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return function(){r.forEach(function(i){return i()})}}function Ee(e,r){var t=r.attribute,n=r.value;return e.setAttribute(t,n),function(){return e.removeAttribute(t)}}function fe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function F(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?fe(Object(t),!0).forEach(function(n){X(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):fe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function V(e,r){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=it(e))||r){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
23
23
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var c=t.next();return o=c.done,c},e:function(c){l=!0,a=c},f:function(){try{o||t.return==null||t.return()}finally{if(l)throw a}}}}function it(e,r){if(e){if(typeof e=="string")return ve(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ve(e,r):void 0}}function ve(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function G(e){return e.slice(0).reverse()}function ot(e){var r=e.typeKey,t=e.defaultDropEffect,n=new WeakMap,i="data-drop-target-for-".concat(r),a="[".concat(i,"]");function o(d){return n.set(d.element,d),function(){return n.delete(d.element)}}function l(d){return te(Ee(d.element,{attribute:i,value:"true"}),o(d))}function u(d){var s,g,y,T,w=d.source,D=d.target,m=d.input,S=d.event,b=d.result,h=b===void 0?[]:b;if(S===void 0)return h;const E=S.composedPath();if(D=E.find(K=>K instanceof Element?K.hasAttribute("data-drop-target-for-element"):!1),D=D??E[0],!(D instanceof Element))return D instanceof Node?u({source:w,target:D.parentElement,input:m,result:h}):h;var j=D.closest(a);if(j==null)return h;var O=n.get(j);if(O==null)return h;var P={input:m,source:w,element:O.element};if(O.canDrop&&!O.canDrop(P))return u({source:w,target:O.element.parentElement,input:m,result:h});var x=(s=(g=O.getData)===null||g===void 0?void 0:g.call(O,P))!==null&&s!==void 0?s:{},A=(y=(T=O.getDropEffect)===null||T===void 0?void 0:T.call(O,P))!==null&&y!==void 0?y:t,I={data:x,element:O.element,dropEffect:A,isActiveDueToStickiness:!1};return u({source:w,target:O.element.parentElement,input:m,result:[].concat(Te(h),[I])})}function c(d){var s=d.eventName,g=d.payload,y=V(g.location.current.dropTargets),T;try{for(y.s();!(T=y.n()).done;){var w,D=T.value,m=n.get(D.element),S=F(F({},g),{},{self:D});m==null||(w=m[s])===null||w===void 0||w.call(m,S)}}catch(b){y.e(b)}finally{y.f()}}var f={onGenerateDragPreview:c,onDrag:c,onDragStart:c,onDrop:c,onDropTargetChange:function(s){var g=s.payload,y=new Set(g.location.current.dropTargets.map(function(R){return R.element})),T=new Set,w=V(g.location.previous.dropTargets),D;try{for(w.s();!(D=w.n()).done;){var m,S=D.value;T.add(S.element);var b=n.get(S.element),h=y.has(S.element),E=F(F({},g),{},{self:S});if(b==null||(m=b.onDropTargetChange)===null||m===void 0||m.call(b,E),!h){var j;b==null||(j=b.onDragLeave)===null||j===void 0||j.call(b,E)}}}catch(R){w.e(R)}finally{w.f()}var O=V(g.location.current.dropTargets),P;try{for(O.s();!(P=O.n()).done;){var x,A,I=P.value;if(!T.has(I.element)){var K=F(F({},g),{},{self:I}),C=n.get(I.element);C==null||(x=C.onDropTargetChange)===null||x===void 0||x.call(C,K),C==null||(A=C.onDragEnter)===null||A===void 0||A.call(C,K)}}}catch(R){O.e(R)}finally{O.f()}}};function p(d){f[d.eventName](d)}function v(d){var s=d.source,g=d.target,y=d.input,T=d.event,w=d.current,D=u({source:s,target:g,event:T,input:y});if(D.length>=w.length)return D;for(var m=G(w),S=G(D),b=[],h=0;h<m.length;h++){var E,j=m[h],O=S[h];if(O!=null){b.push(O);continue}var P=b[h-1],x=m[h-1];if(P?.element!==x?.element)break;var A=n.get(j.element);if(!A)break;var I={input:y,source:s,element:A.element};if(A.canDrop&&!A.canDrop(I)||!((E=A.getIsSticky)!==null&&E!==void 0&&E.call(A,I)))break;b.push(F(F({},j),{},{isActiveDueToStickiness:!0}))}return G(b)}return{dropTargetForConsumers:l,getIsOver:v,dispatchEvent:p}}function ut(e,r){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=lt(e))||r){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
24
24
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var c=t.next();return o=c.done,c},e:function(c){l=!0,a=c},f:function(){try{o||t.return==null||t.return()}finally{if(l)throw a}}}}function lt(e,r){if(e){if(typeof e=="string")return pe(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?pe(e,r):void 0}}function pe(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function ge(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function ct(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?ge(Object(t),!0).forEach(function(n){X(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ge(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function dt(){var e=new Set,r=null;function t(a){r&&(!a.canMonitor||a.canMonitor(r.canMonitorArgs))&&r.active.add(a)}function n(a){var o=ct({},a);return e.add(o),t(o),function(){e.delete(o),r&&r.active.delete(o)}}function i(a){var o=a.eventName,l=a.payload;if(o==="onGenerateDragPreview"){r={canMonitorArgs:{initial:l.location.initial,source:l.source},active:new Set};var u=ut(e),c;try{for(u.s();!(c=u.n()).done;){var f=c.value;t(f)}}catch(y){u.e(y)}finally{u.f()}}if(r){for(var p=Array.from(r.active),v=0,d=p;v<d.length;v++){var s=d[v];if(r.active.has(s)){var g;(g=s[o])===null||g===void 0||g.call(s,l)}}o==="onDrop"&&(r.active.clear(),r=null)}}return{dispatchEvent:i,monitorForConsumers:n}}function st(e){var r=e.typeKey,t=e.mount,n=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,o=dt(),l=ot({typeKey:r,defaultDropEffect:a});function u(p){n?.(p),l.dispatchEvent(p),o.dispatchEvent(p),i?.(p)}function c(p){var v=p.event,d=p.dragType;se.start({event:v,dragType:d,getDropTargetsOver:l.getIsOver,dispatchEvent:u})}function f(){function p(){var v={canStart:se.canStart,start:c};return t(v)}return at({typeKey:r,mount:p})}return{registerUsage:f,dropTarget:l.dropTargetForConsumers,monitor:o.monitorForConsumers}}var ft=ee(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),vt="pdnd:android-fallback",ye="text/plain",pt="text/uri-list",gt="application/vnd.pdnd",N=new WeakMap;function yt(e){return N.set(e.element,e),function(){N.delete(e.element)}}var me=Le(),re=st({typeKey:"element",defaultDropEffect:"move",mount:function(r){return te(me.bindEvents(),H.bind(document,{type:"dragstart",listener:function(n){var i,a,o,l,u,c;if(!r.canStart(n)||n.defaultPrevented||!n.dataTransfer)return;const p=n.composedPath().find(h=>h instanceof HTMLElement&&N.has(h));if(!p)return null;const v=N.get(p);if(!v)return null;var d=k(n),s={element:v.element,dragHandle:(i=v.dragHandle)!==null&&i!==void 0?i:null,input:d};if(v.canDrag&&!v.canDrag(s))return n.preventDefault(),null;if(v.dragHandle){const E=(p.shadowRoot||document).elementFromPoint(d.clientX,d.clientY);if(!v.dragHandle.contains(E))return n.preventDefault(),null}var g=(a=(o=v.getInitialDataForExternal)===null||o===void 0?void 0:o.call(v,s))!==null&&a!==void 0?a:null;if(g)for(var y=0,T=Object.entries(g);y<T.length;y++){var w=he(T[y],2),D=w[0],m=w[1];n.dataTransfer.setData(D,m??"")}ft()&&!n.dataTransfer.types.includes(ye)&&!n.dataTransfer.types.includes(pt)&&n.dataTransfer.setData(ye,vt),n.dataTransfer.setData(gt,"");var S={element:v.element,dragHandle:(l=v.dragHandle)!==null&&l!==void 0?l:null,data:(u=(c=v.getInitialData)===null||c===void 0?void 0:c.call(v,s))!==null&&u!==void 0?u:{}},b={type:"element",payload:S,startedFrom:"internal"};r.start({event:n,dragType:b})}}))},dispatchEventToSource:function(r){var t,n,i=r.eventName,a=r.payload;(t=N.get(a.source.element))===null||t===void 0||(n=t[i])===null||n===void 0||n.call(t,a)},onPostDispatch:me.getOnPostDispatch()}),mt=re.dropTarget,bt=re.monitor;function ht(e){return te(re.registerUsage(),yt(e),Ee(e.element,{attribute:"draggable",value:"true"}))}function wt(){return{x:0,y:0}}function Dt(e){var r=e.render,t=e.nativeSetDragImage,n=e.getOffset,i=n===void 0?wt:n,a=document.createElement("div");Object.assign(a.style,{position:"fixed",top:0,left:0,zIndex:De,pointerEvents:"none"}),document.body.append(a);var o=r({container:a});queueMicrotask(function(){var c=i({container:a});if(Y()){var f=a.getBoundingClientRect();if(f.width===0)return;a.style.left="-".concat(f.width-1e-4,"px")}t?.(a,c.x,c.y)});function l(){u(),o?.(),document.body.removeChild(a)}var u=bt({onDragStart:l,onDrop:l})}const Ot=(e,r)=>{let t=getComputedStyle(e).getPropertyValue(r);for(;!t&&e.parentElement;)e=e.parentElement,t=getComputedStyle(e).getPropertyValue(r);return t.trim()};exports._defineProperty=X;exports.draggable=ht;exports.dropTargetForElements=mt;exports.getCssVariableValue=Ot;exports.setCustomNativeDragPreview=Dt;
@@ -801,7 +801,8 @@ function tt(e) {
801
801
  // all "drop" events in the bubble phase on the `document.body`.
802
802
  // This meant that we never saw the "drop" event.
803
803
  {
804
- capture: !0
804
+ capture: !0,
805
+ passive: !1
805
806
  }
806
807
  );
807
808
  l.start({
@@ -17,7 +17,7 @@
17
17
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
18
  * SOFTWARE.
19
19
  * */
20
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("lit"),m=require("lit/decorators.js"),re=require("lit/directives/style-map.js"),Y=require("@luzmo/icons");require("@luzmo/lucero/action-button");require("@luzmo/lucero/action-group");require("@luzmo/lucero/icon");const Xt=require("@luzmo/lucero/utils"),bt=require("../color-Czp4Im5q.cjs"),gi=require("../item-list.cjs"),Ke=require("../index-Vdyb9z2D.cjs"),Z=require("@lit/localize");require("@luzmo/lucero/tooltip");const Xe=require("../set-locale-BRRalqne.cjs"),C=[];for(let s=0;s<256;++s)C.push((s+256).toString(16).slice(1));function fi(s,e=0){return(C[s[e+0]]+C[s[e+1]]+C[s[e+2]]+C[s[e+3]]+"-"+C[s[e+4]]+C[s[e+5]]+"-"+C[s[e+6]]+C[s[e+7]]+"-"+C[s[e+8]]+C[s[e+9]]+"-"+C[s[e+10]]+C[s[e+11]]+C[s[e+12]]+C[s[e+13]]+C[s[e+14]]+C[s[e+15]]).toLowerCase()}let Ye;const yi=new Uint8Array(16);function bi(){if(!Ye){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ye=crypto.getRandomValues.bind(crypto)}return Ye(yi)}const vi=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vt={randomUUID:vi};function wi(s,e,t){s=s||{};const i=s.random??s.rng?.()??bi();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,fi(i)}function _e(s,e,t){return vt.randomUUID&&!s?vt.randomUUID():wi(s)}const tt=Math.min,ce=Math.max,Ie=Math.round,De=Math.floor,V=s=>({x:s,y:s}),_i={left:"right",right:"left",bottom:"top",top:"bottom"},Ei={start:"end",end:"start"};function lt(s,e){return typeof s=="function"?s(e):s}function fe(s){return s.split("-")[0]}function $e(s){return s.split("-")[1]}function zi(s){return s==="x"?"y":"x"}function Yt(s){return s==="y"?"height":"width"}const xi=new Set(["top","bottom"]);function ne(s){return xi.has(fe(s))?"y":"x"}function Jt(s){return zi(ne(s))}function ki(s,e,t){t===void 0&&(t=!1);const i=$e(s),r=Jt(s),o=Yt(r);let n=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Te(n)),[n,Te(n)]}function Si(s){const e=Te(s);return[it(s),e,it(e)]}function it(s){return s.replace(/start|end/g,e=>Ei[e])}const wt=["left","right"],_t=["right","left"],Ri=["top","bottom"],Ai=["bottom","top"];function Mi(s,e,t){switch(s){case"top":case"bottom":return t?e?_t:wt:e?wt:_t;case"left":case"right":return e?Ri:Ai;default:return[]}}function Di(s,e,t,i){const r=$e(s);let o=Mi(fe(s),t==="start",i);return r&&(o=o.map(n=>n+"-"+r),e&&(o=o.concat(o.map(it)))),o}function Te(s){return s.replace(/left|right|bottom|top/g,e=>_i[e])}function Ci(s){return{top:0,right:0,bottom:0,left:0,...s}}function Ii(s){return typeof s!="number"?Ci(s):{top:s,right:s,bottom:s,left:s}}function Le(s){const{x:e,y:t,width:i,height:r}=s;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function Et(s,e,t){let{reference:i,floating:r}=s;const o=ne(e),n=Jt(e),a=Yt(n),h=fe(e),l=o==="y",d=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,p=i[a]/2-r[a]/2;let f;switch(h){case"top":f={x:d,y:i.y-r.height};break;case"bottom":f={x:d,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:u};break;case"left":f={x:i.x-r.width,y:u};break;default:f={x:i.x,y:i.y}}switch($e(e)){case"start":f[n]-=p*(t&&l?-1:1);break;case"end":f[n]+=p*(t&&l?-1:1);break}return f}const Ti=async(s,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),h=await(n.isRTL==null?void 0:n.isRTL(e));let l=await n.getElementRects({reference:s,floating:e,strategy:r}),{x:d,y:u}=Et(l,i,h),p=i,f={},y=0;for(let E=0;E<a.length;E++){const{name:x,fn:z}=a[E],{x:S,y:R,data:A,reset:k}=await z({x:d,y:u,initialPlacement:i,placement:p,strategy:r,middlewareData:f,rects:l,platform:n,elements:{reference:s,floating:e}});d=S??d,u=R??u,f={...f,[x]:{...f[x],...A}},k&&y<=50&&(y++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(l=k.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:r}):k.rects),{x:d,y:u}=Et(l,p,h)),E=-1)}return{x:d,y:u,placement:p,strategy:r,middlewareData:f}};async function Li(s,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:o,rects:n,elements:a,strategy:h}=s,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:f=0}=lt(e,s),y=Ii(f),x=a[p?u==="floating"?"reference":"floating":u],z=Le(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(x)))==null||t?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:h})),S=u==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),A=await(o.isElement==null?void 0:o.isElement(R))?await(o.getScale==null?void 0:o.getScale(R))||{x:1,y:1}:{x:1,y:1},k=Le(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:S,offsetParent:R,strategy:h}):S);return{top:(z.top-k.top+y.top)/A.y,bottom:(k.bottom-z.bottom+y.bottom)/A.y,left:(z.left-k.left+y.left)/A.x,right:(k.right-z.right+y.right)/A.x}}const Hi=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,i;const{placement:r,middlewareData:o,rects:n,initialPlacement:a,platform:h,elements:l}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:E=!0,...x}=lt(s,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const z=fe(r),S=ne(a),R=fe(a)===a,A=await(h.isRTL==null?void 0:h.isRTL(l.floating)),k=p||(R||!E?[Te(a)]:Si(a)),J=y!=="none";!p&&J&&k.push(...Di(a,E,y,A));const j=[a,...k],ve=await Li(e,x),Me=[];let he=((i=o.flip)==null?void 0:i.overflows)||[];if(d&&Me.push(ve[z]),u){const ie=ki(r,n,A);Me.push(ve[ie[0]],ve[ie[1]])}if(he=[...he,{placement:r,overflows:Me}],!Me.every(ie=>ie<=0)){var gt,ft;const ie=(((gt=o.flip)==null?void 0:gt.index)||0)+1,je=j[ie];if(je&&(!(u==="alignment"?S!==ne(je):!1)||he.every(P=>ne(P.placement)===S?P.overflows[0]>0:!0)))return{data:{index:ie,overflows:he},reset:{placement:je}};let we=(ft=he.filter(se=>se.overflows[0]<=0).sort((se,P)=>se.overflows[1]-P.overflows[1])[0])==null?void 0:ft.placement;if(!we)switch(f){case"bestFit":{var yt;const se=(yt=he.filter(P=>{if(J){const Q=ne(P.placement);return Q===S||Q==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(Q=>Q>0).reduce((Q,pi)=>Q+pi,0)]).sort((P,Q)=>P[1]-Q[1])[0])==null?void 0:yt[0];se&&(we=se);break}case"initialPlacement":we=a;break}if(r!==we)return{reset:{placement:we}}}return{}}}},Ni=new Set(["left","top"]);async function Oi(s,e){const{placement:t,platform:i,elements:r}=s,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=fe(t),a=$e(t),h=ne(t)==="y",l=Ni.has(n)?-1:1,d=o&&h?-1:1,u=lt(e,s);let{mainAxis:p,crossAxis:f,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof y=="number"&&(f=a==="end"?y*-1:y),h?{x:f*d,y:p*l}:{x:p*l,y:f*d}}const Pi=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,i;const{x:r,y:o,placement:n,middlewareData:a}=e,h=await Oi(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+h.x,y:o+h.y,data:{...h,placement:n}}}}};function Be(){return typeof window<"u"}function be(s){return Qt(s)?(s.nodeName||"").toLowerCase():"#document"}function H(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function q(s){var e;return(e=(Qt(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function Qt(s){return Be()?s instanceof Node||s instanceof H(s).Node:!1}function $(s){return Be()?s instanceof Element||s instanceof H(s).Element:!1}function G(s){return Be()?s instanceof HTMLElement||s instanceof H(s).HTMLElement:!1}function zt(s){return!Be()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof H(s).ShadowRoot}const Wi=new Set(["inline","contents"]);function Ae(s){const{overflow:e,overflowX:t,overflowY:i,display:r}=B(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!Wi.has(r)}const $i=new Set(["table","td","th"]);function Bi(s){return $i.has(be(s))}const Ui=[":popover-open",":modal"];function Ue(s){return Ui.some(e=>{try{return s.matches(e)}catch{return!1}})}const Fi=["transform","translate","scale","rotate","perspective"],Vi=["transform","translate","scale","rotate","perspective","filter"],Gi=["paint","layout","strict","content"];function dt(s){const e=ht(),t=$(s)?B(s):s;return Fi.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Vi.some(i=>(t.willChange||"").includes(i))||Gi.some(i=>(t.contain||"").includes(i))}function qi(s){let e=ee(s);for(;G(e)&&!ye(e);){if(dt(e))return e;if(Ue(e))return null;e=ee(e)}return null}function ht(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ji=new Set(["html","body","#document"]);function ye(s){return ji.has(be(s))}function B(s){return H(s).getComputedStyle(s)}function Fe(s){return $(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function ee(s){if(be(s)==="html")return s;const e=s.assignedSlot||s.parentNode||zt(s)&&s.host||q(s);return zt(e)?e.host:e}function Zt(s){const e=ee(s);return ye(e)?s.ownerDocument?s.ownerDocument.body:s.body:G(e)&&Ae(e)?e:Zt(e)}function ke(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Zt(s),o=r===((i=s.ownerDocument)==null?void 0:i.body),n=H(r);if(o){const a=st(n);return e.concat(n,n.visualViewport||[],Ae(r)?r:[],a&&t?ke(a):[])}return e.concat(r,ke(r,[],t))}function st(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function ei(s){const e=B(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=G(s),o=r?s.offsetWidth:t,n=r?s.offsetHeight:i,a=Ie(t)!==o||Ie(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function ct(s){return $(s)?s:s.contextElement}function ue(s){const e=ct(s);if(!G(e))return V(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:o}=ei(e);let n=(o?Ie(t.width):t.width)/i,a=(o?Ie(t.height):t.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Ki=V(0);function ti(s){const e=H(s);return!ht()||!e.visualViewport?Ki:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Xi(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==H(s)?!1:e}function ae(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=s.getBoundingClientRect(),o=ct(s);let n=V(1);e&&(i?$(i)&&(n=ue(i)):n=ue(s));const a=Xi(o,t,i)?ti(o):V(0);let h=(r.left+a.x)/n.x,l=(r.top+a.y)/n.y,d=r.width/n.x,u=r.height/n.y;if(o){const p=H(o),f=i&&$(i)?H(i):i;let y=p,E=st(y);for(;E&&i&&f!==y;){const x=ue(E),z=E.getBoundingClientRect(),S=B(E),R=z.left+(E.clientLeft+parseFloat(S.paddingLeft))*x.x,A=z.top+(E.clientTop+parseFloat(S.paddingTop))*x.y;h*=x.x,l*=x.y,d*=x.x,u*=x.y,h+=R,l+=A,y=H(E),E=st(y)}}return Le({width:d,height:u,x:h,y:l})}function Ve(s,e){const t=Fe(s).scrollLeft;return e?e.left+t:ae(q(s)).left+t}function ii(s,e){const t=s.getBoundingClientRect(),i=t.left+e.scrollLeft-Ve(s,t),r=t.top+e.scrollTop;return{x:i,y:r}}function Yi(s){let{elements:e,rect:t,offsetParent:i,strategy:r}=s;const o=r==="fixed",n=q(i),a=e?Ue(e.floating):!1;if(i===n||a&&o)return t;let h={scrollLeft:0,scrollTop:0},l=V(1);const d=V(0),u=G(i);if((u||!u&&!o)&&((be(i)!=="body"||Ae(n))&&(h=Fe(i)),G(i))){const f=ae(i);l=ue(i),d.x=f.x+i.clientLeft,d.y=f.y+i.clientTop}const p=n&&!u&&!o?ii(n,h):V(0);return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-h.scrollLeft*l.x+d.x+p.x,y:t.y*l.y-h.scrollTop*l.y+d.y+p.y}}function Ji(s){return Array.from(s.getClientRects())}function Qi(s){const e=q(s),t=Fe(s),i=s.ownerDocument.body,r=ce(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=ce(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Ve(s);const a=-t.scrollTop;return B(i).direction==="rtl"&&(n+=ce(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:n,y:a}}const xt=25;function Zi(s,e){const t=H(s),i=q(s),r=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,h=0;if(r){o=r.width,n=r.height;const d=ht();(!d||d&&e==="fixed")&&(a=r.offsetLeft,h=r.offsetTop)}const l=Ve(i);if(l<=0){const d=i.ownerDocument,u=d.body,p=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(i.clientWidth-u.clientWidth-f);y<=xt&&(o-=y)}else l<=xt&&(o+=l);return{width:o,height:n,x:a,y:h}}const es=new Set(["absolute","fixed"]);function ts(s,e){const t=ae(s,!0,e==="fixed"),i=t.top+s.clientTop,r=t.left+s.clientLeft,o=G(s)?ue(s):V(1),n=s.clientWidth*o.x,a=s.clientHeight*o.y,h=r*o.x,l=i*o.y;return{width:n,height:a,x:h,y:l}}function kt(s,e,t){let i;if(e==="viewport")i=Zi(s,t);else if(e==="document")i=Qi(q(s));else if($(e))i=ts(e,t);else{const r=ti(s);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Le(i)}function si(s,e){const t=ee(s);return t===e||!$(t)||ye(t)?!1:B(t).position==="fixed"||si(t,e)}function is(s,e){const t=e.get(s);if(t)return t;let i=ke(s,[],!1).filter(a=>$(a)&&be(a)!=="body"),r=null;const o=B(s).position==="fixed";let n=o?ee(s):s;for(;$(n)&&!ye(n);){const a=B(n),h=dt(n);!h&&a.position==="fixed"&&(r=null),(o?!h&&!r:!h&&a.position==="static"&&!!r&&es.has(r.position)||Ae(n)&&!h&&si(s,n))?i=i.filter(d=>d!==n):r=a,n=ee(n)}return e.set(s,i),i}function ss(s){let{element:e,boundary:t,rootBoundary:i,strategy:r}=s;const n=[...t==="clippingAncestors"?Ue(e)?[]:is(e,this._c):[].concat(t),i],a=n[0],h=n.reduce((l,d)=>{const u=kt(e,d,r);return l.top=ce(u.top,l.top),l.right=tt(u.right,l.right),l.bottom=tt(u.bottom,l.bottom),l.left=ce(u.left,l.left),l},kt(e,a,r));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function rs(s){const{width:e,height:t}=ei(s);return{width:e,height:t}}function os(s,e,t){const i=G(e),r=q(e),o=t==="fixed",n=ae(s,!0,o,e);let a={scrollLeft:0,scrollTop:0};const h=V(0);function l(){h.x=Ve(r)}if(i||!i&&!o)if((be(e)!=="body"||Ae(r))&&(a=Fe(e)),i){const f=ae(e,!0,o,e);h.x=f.x+e.clientLeft,h.y=f.y+e.clientTop}else r&&l();o&&!i&&r&&l();const d=r&&!i&&!o?ii(r,a):V(0),u=n.left+a.scrollLeft-h.x-d.x,p=n.top+a.scrollTop-h.y-d.y;return{x:u,y:p,width:n.width,height:n.height}}function Je(s){return B(s).position==="static"}function St(s,e){if(!G(s)||B(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return q(s)===t&&(t=t.ownerDocument.body),t}function ri(s,e){const t=H(s);if(Ue(s))return t;if(!G(s)){let r=ee(s);for(;r&&!ye(r);){if($(r)&&!Je(r))return r;r=ee(r)}return t}let i=St(s,e);for(;i&&Bi(i)&&Je(i);)i=St(i,e);return i&&ye(i)&&Je(i)&&!dt(i)?t:i||qi(s)||t}const ns=async function(s){const e=this.getOffsetParent||ri,t=this.getDimensions,i=await t(s.floating);return{reference:os(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function as(s){return B(s).direction==="rtl"}const ls={convertOffsetParentRelativeRectToViewportRelativeRect:Yi,getDocumentElement:q,getClippingRect:ss,getOffsetParent:ri,getElementRects:ns,getClientRects:Ji,getDimensions:rs,getScale:ue,isElement:$,isRTL:as};function oi(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function ds(s,e){let t=null,i;const r=q(s);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,h){a===void 0&&(a=!1),h===void 0&&(h=1),o();const l=s.getBoundingClientRect(),{left:d,top:u,width:p,height:f}=l;if(a||e(),!p||!f)return;const y=De(u),E=De(r.clientWidth-(d+p)),x=De(r.clientHeight-(u+f)),z=De(d),R={rootMargin:-y+"px "+-E+"px "+-x+"px "+-z+"px",threshold:ce(0,tt(1,h))||1};let A=!0;function k(J){const j=J[0].intersectionRatio;if(j!==h){if(!A)return n();j?n(!1,j):i=setTimeout(()=>{n(!1,1e-7)},1e3)}j===1&&!oi(l,s.getBoundingClientRect())&&n(),A=!1}try{t=new IntersectionObserver(k,{...R,root:r.ownerDocument})}catch{t=new IntersectionObserver(k,R)}t.observe(s)}return n(!0),o}function Rt(s,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:h=!1}=i,l=ct(s),d=r||o?[...l?ke(l):[],...ke(e)]:[];d.forEach(z=>{r&&z.addEventListener("scroll",t,{passive:!0}),o&&z.addEventListener("resize",t)});const u=l&&a?ds(l,t):null;let p=-1,f=null;n&&(f=new ResizeObserver(z=>{let[S]=z;S&&S.target===l&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var R;(R=f)==null||R.observe(e)})),t()}),l&&!h&&f.observe(l),f.observe(e));let y,E=h?ae(s):null;h&&x();function x(){const z=ae(s);E&&!oi(E,z)&&t(),E=z,y=requestAnimationFrame(x)}return t(),()=>{var z;d.forEach(S=>{r&&S.removeEventListener("scroll",t),o&&S.removeEventListener("resize",t)}),u?.(),(z=f)==null||z.disconnect(),f=null,h&&cancelAnimationFrame(y)}}const At=Pi,Mt=Hi,Dt=(s,e,t)=>{const i=new Map,r={platform:ls,...t},o={...r.platform,_c:i};return Ti(s,e,{...r,platform:o})},ut=(s,e)=>{let t="The dashboard component encountered an error";typeof e?.dashboardId=="string"&&(t+=` for dashboard with id ${e.dashboardId}`),typeof e?.dashboardSlug=="string"&&(t+=` for dashboard with slug ${e.dashboardSlug}`),typeof e?.container=="string"&&(t+=` in container ${e.container}`),s&&(t+=`:
20
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("lit"),m=require("lit/decorators.js"),re=require("lit/directives/style-map.js"),Y=require("@luzmo/icons");require("@luzmo/lucero/action-button");require("@luzmo/lucero/action-group");require("@luzmo/lucero/icon");const Xt=require("@luzmo/lucero/utils"),bt=require("../color-Czp4Im5q.cjs"),gi=require("../item-list.cjs"),Ke=require("../index-Vdyb9z2D.cjs"),Z=require("@lit/localize");require("@luzmo/lucero/tooltip");const Xe=require("../set-locale-B8iQGfk0.cjs"),C=[];for(let s=0;s<256;++s)C.push((s+256).toString(16).slice(1));function fi(s,e=0){return(C[s[e+0]]+C[s[e+1]]+C[s[e+2]]+C[s[e+3]]+"-"+C[s[e+4]]+C[s[e+5]]+"-"+C[s[e+6]]+C[s[e+7]]+"-"+C[s[e+8]]+C[s[e+9]]+"-"+C[s[e+10]]+C[s[e+11]]+C[s[e+12]]+C[s[e+13]]+C[s[e+14]]+C[s[e+15]]).toLowerCase()}let Ye;const yi=new Uint8Array(16);function bi(){if(!Ye){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ye=crypto.getRandomValues.bind(crypto)}return Ye(yi)}const vi=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vt={randomUUID:vi};function wi(s,e,t){s=s||{};const i=s.random??s.rng?.()??bi();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,fi(i)}function _e(s,e,t){return vt.randomUUID&&!s?vt.randomUUID():wi(s)}const tt=Math.min,ce=Math.max,Ie=Math.round,De=Math.floor,V=s=>({x:s,y:s}),_i={left:"right",right:"left",bottom:"top",top:"bottom"},Ei={start:"end",end:"start"};function lt(s,e){return typeof s=="function"?s(e):s}function fe(s){return s.split("-")[0]}function $e(s){return s.split("-")[1]}function zi(s){return s==="x"?"y":"x"}function Yt(s){return s==="y"?"height":"width"}const xi=new Set(["top","bottom"]);function ne(s){return xi.has(fe(s))?"y":"x"}function Jt(s){return zi(ne(s))}function ki(s,e,t){t===void 0&&(t=!1);const i=$e(s),r=Jt(s),o=Yt(r);let n=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Te(n)),[n,Te(n)]}function Si(s){const e=Te(s);return[it(s),e,it(e)]}function it(s){return s.replace(/start|end/g,e=>Ei[e])}const wt=["left","right"],_t=["right","left"],Ri=["top","bottom"],Ai=["bottom","top"];function Mi(s,e,t){switch(s){case"top":case"bottom":return t?e?_t:wt:e?wt:_t;case"left":case"right":return e?Ri:Ai;default:return[]}}function Di(s,e,t,i){const r=$e(s);let o=Mi(fe(s),t==="start",i);return r&&(o=o.map(n=>n+"-"+r),e&&(o=o.concat(o.map(it)))),o}function Te(s){return s.replace(/left|right|bottom|top/g,e=>_i[e])}function Ci(s){return{top:0,right:0,bottom:0,left:0,...s}}function Ii(s){return typeof s!="number"?Ci(s):{top:s,right:s,bottom:s,left:s}}function Le(s){const{x:e,y:t,width:i,height:r}=s;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function Et(s,e,t){let{reference:i,floating:r}=s;const o=ne(e),n=Jt(e),a=Yt(n),h=fe(e),l=o==="y",d=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,p=i[a]/2-r[a]/2;let f;switch(h){case"top":f={x:d,y:i.y-r.height};break;case"bottom":f={x:d,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:u};break;case"left":f={x:i.x-r.width,y:u};break;default:f={x:i.x,y:i.y}}switch($e(e)){case"start":f[n]-=p*(t&&l?-1:1);break;case"end":f[n]+=p*(t&&l?-1:1);break}return f}const Ti=async(s,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),h=await(n.isRTL==null?void 0:n.isRTL(e));let l=await n.getElementRects({reference:s,floating:e,strategy:r}),{x:d,y:u}=Et(l,i,h),p=i,f={},y=0;for(let E=0;E<a.length;E++){const{name:x,fn:z}=a[E],{x:S,y:R,data:A,reset:k}=await z({x:d,y:u,initialPlacement:i,placement:p,strategy:r,middlewareData:f,rects:l,platform:n,elements:{reference:s,floating:e}});d=S??d,u=R??u,f={...f,[x]:{...f[x],...A}},k&&y<=50&&(y++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(l=k.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:r}):k.rects),{x:d,y:u}=Et(l,p,h)),E=-1)}return{x:d,y:u,placement:p,strategy:r,middlewareData:f}};async function Li(s,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:o,rects:n,elements:a,strategy:h}=s,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:f=0}=lt(e,s),y=Ii(f),x=a[p?u==="floating"?"reference":"floating":u],z=Le(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(x)))==null||t?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:h})),S=u==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),A=await(o.isElement==null?void 0:o.isElement(R))?await(o.getScale==null?void 0:o.getScale(R))||{x:1,y:1}:{x:1,y:1},k=Le(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:S,offsetParent:R,strategy:h}):S);return{top:(z.top-k.top+y.top)/A.y,bottom:(k.bottom-z.bottom+y.bottom)/A.y,left:(z.left-k.left+y.left)/A.x,right:(k.right-z.right+y.right)/A.x}}const Hi=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,i;const{placement:r,middlewareData:o,rects:n,initialPlacement:a,platform:h,elements:l}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:E=!0,...x}=lt(s,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const z=fe(r),S=ne(a),R=fe(a)===a,A=await(h.isRTL==null?void 0:h.isRTL(l.floating)),k=p||(R||!E?[Te(a)]:Si(a)),J=y!=="none";!p&&J&&k.push(...Di(a,E,y,A));const j=[a,...k],ve=await Li(e,x),Me=[];let he=((i=o.flip)==null?void 0:i.overflows)||[];if(d&&Me.push(ve[z]),u){const ie=ki(r,n,A);Me.push(ve[ie[0]],ve[ie[1]])}if(he=[...he,{placement:r,overflows:Me}],!Me.every(ie=>ie<=0)){var gt,ft;const ie=(((gt=o.flip)==null?void 0:gt.index)||0)+1,je=j[ie];if(je&&(!(u==="alignment"?S!==ne(je):!1)||he.every(P=>ne(P.placement)===S?P.overflows[0]>0:!0)))return{data:{index:ie,overflows:he},reset:{placement:je}};let we=(ft=he.filter(se=>se.overflows[0]<=0).sort((se,P)=>se.overflows[1]-P.overflows[1])[0])==null?void 0:ft.placement;if(!we)switch(f){case"bestFit":{var yt;const se=(yt=he.filter(P=>{if(J){const Q=ne(P.placement);return Q===S||Q==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(Q=>Q>0).reduce((Q,pi)=>Q+pi,0)]).sort((P,Q)=>P[1]-Q[1])[0])==null?void 0:yt[0];se&&(we=se);break}case"initialPlacement":we=a;break}if(r!==we)return{reset:{placement:we}}}return{}}}},Ni=new Set(["left","top"]);async function Oi(s,e){const{placement:t,platform:i,elements:r}=s,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=fe(t),a=$e(t),h=ne(t)==="y",l=Ni.has(n)?-1:1,d=o&&h?-1:1,u=lt(e,s);let{mainAxis:p,crossAxis:f,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof y=="number"&&(f=a==="end"?y*-1:y),h?{x:f*d,y:p*l}:{x:p*l,y:f*d}}const Pi=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,i;const{x:r,y:o,placement:n,middlewareData:a}=e,h=await Oi(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+h.x,y:o+h.y,data:{...h,placement:n}}}}};function Be(){return typeof window<"u"}function be(s){return Qt(s)?(s.nodeName||"").toLowerCase():"#document"}function H(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function q(s){var e;return(e=(Qt(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function Qt(s){return Be()?s instanceof Node||s instanceof H(s).Node:!1}function $(s){return Be()?s instanceof Element||s instanceof H(s).Element:!1}function G(s){return Be()?s instanceof HTMLElement||s instanceof H(s).HTMLElement:!1}function zt(s){return!Be()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof H(s).ShadowRoot}const Wi=new Set(["inline","contents"]);function Ae(s){const{overflow:e,overflowX:t,overflowY:i,display:r}=B(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!Wi.has(r)}const $i=new Set(["table","td","th"]);function Bi(s){return $i.has(be(s))}const Ui=[":popover-open",":modal"];function Ue(s){return Ui.some(e=>{try{return s.matches(e)}catch{return!1}})}const Fi=["transform","translate","scale","rotate","perspective"],Vi=["transform","translate","scale","rotate","perspective","filter"],Gi=["paint","layout","strict","content"];function dt(s){const e=ht(),t=$(s)?B(s):s;return Fi.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Vi.some(i=>(t.willChange||"").includes(i))||Gi.some(i=>(t.contain||"").includes(i))}function qi(s){let e=ee(s);for(;G(e)&&!ye(e);){if(dt(e))return e;if(Ue(e))return null;e=ee(e)}return null}function ht(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ji=new Set(["html","body","#document"]);function ye(s){return ji.has(be(s))}function B(s){return H(s).getComputedStyle(s)}function Fe(s){return $(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function ee(s){if(be(s)==="html")return s;const e=s.assignedSlot||s.parentNode||zt(s)&&s.host||q(s);return zt(e)?e.host:e}function Zt(s){const e=ee(s);return ye(e)?s.ownerDocument?s.ownerDocument.body:s.body:G(e)&&Ae(e)?e:Zt(e)}function ke(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Zt(s),o=r===((i=s.ownerDocument)==null?void 0:i.body),n=H(r);if(o){const a=st(n);return e.concat(n,n.visualViewport||[],Ae(r)?r:[],a&&t?ke(a):[])}return e.concat(r,ke(r,[],t))}function st(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function ei(s){const e=B(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=G(s),o=r?s.offsetWidth:t,n=r?s.offsetHeight:i,a=Ie(t)!==o||Ie(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function ct(s){return $(s)?s:s.contextElement}function ue(s){const e=ct(s);if(!G(e))return V(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:o}=ei(e);let n=(o?Ie(t.width):t.width)/i,a=(o?Ie(t.height):t.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Ki=V(0);function ti(s){const e=H(s);return!ht()||!e.visualViewport?Ki:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Xi(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==H(s)?!1:e}function ae(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=s.getBoundingClientRect(),o=ct(s);let n=V(1);e&&(i?$(i)&&(n=ue(i)):n=ue(s));const a=Xi(o,t,i)?ti(o):V(0);let h=(r.left+a.x)/n.x,l=(r.top+a.y)/n.y,d=r.width/n.x,u=r.height/n.y;if(o){const p=H(o),f=i&&$(i)?H(i):i;let y=p,E=st(y);for(;E&&i&&f!==y;){const x=ue(E),z=E.getBoundingClientRect(),S=B(E),R=z.left+(E.clientLeft+parseFloat(S.paddingLeft))*x.x,A=z.top+(E.clientTop+parseFloat(S.paddingTop))*x.y;h*=x.x,l*=x.y,d*=x.x,u*=x.y,h+=R,l+=A,y=H(E),E=st(y)}}return Le({width:d,height:u,x:h,y:l})}function Ve(s,e){const t=Fe(s).scrollLeft;return e?e.left+t:ae(q(s)).left+t}function ii(s,e){const t=s.getBoundingClientRect(),i=t.left+e.scrollLeft-Ve(s,t),r=t.top+e.scrollTop;return{x:i,y:r}}function Yi(s){let{elements:e,rect:t,offsetParent:i,strategy:r}=s;const o=r==="fixed",n=q(i),a=e?Ue(e.floating):!1;if(i===n||a&&o)return t;let h={scrollLeft:0,scrollTop:0},l=V(1);const d=V(0),u=G(i);if((u||!u&&!o)&&((be(i)!=="body"||Ae(n))&&(h=Fe(i)),G(i))){const f=ae(i);l=ue(i),d.x=f.x+i.clientLeft,d.y=f.y+i.clientTop}const p=n&&!u&&!o?ii(n,h):V(0);return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-h.scrollLeft*l.x+d.x+p.x,y:t.y*l.y-h.scrollTop*l.y+d.y+p.y}}function Ji(s){return Array.from(s.getClientRects())}function Qi(s){const e=q(s),t=Fe(s),i=s.ownerDocument.body,r=ce(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=ce(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Ve(s);const a=-t.scrollTop;return B(i).direction==="rtl"&&(n+=ce(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:n,y:a}}const xt=25;function Zi(s,e){const t=H(s),i=q(s),r=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,h=0;if(r){o=r.width,n=r.height;const d=ht();(!d||d&&e==="fixed")&&(a=r.offsetLeft,h=r.offsetTop)}const l=Ve(i);if(l<=0){const d=i.ownerDocument,u=d.body,p=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(i.clientWidth-u.clientWidth-f);y<=xt&&(o-=y)}else l<=xt&&(o+=l);return{width:o,height:n,x:a,y:h}}const es=new Set(["absolute","fixed"]);function ts(s,e){const t=ae(s,!0,e==="fixed"),i=t.top+s.clientTop,r=t.left+s.clientLeft,o=G(s)?ue(s):V(1),n=s.clientWidth*o.x,a=s.clientHeight*o.y,h=r*o.x,l=i*o.y;return{width:n,height:a,x:h,y:l}}function kt(s,e,t){let i;if(e==="viewport")i=Zi(s,t);else if(e==="document")i=Qi(q(s));else if($(e))i=ts(e,t);else{const r=ti(s);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Le(i)}function si(s,e){const t=ee(s);return t===e||!$(t)||ye(t)?!1:B(t).position==="fixed"||si(t,e)}function is(s,e){const t=e.get(s);if(t)return t;let i=ke(s,[],!1).filter(a=>$(a)&&be(a)!=="body"),r=null;const o=B(s).position==="fixed";let n=o?ee(s):s;for(;$(n)&&!ye(n);){const a=B(n),h=dt(n);!h&&a.position==="fixed"&&(r=null),(o?!h&&!r:!h&&a.position==="static"&&!!r&&es.has(r.position)||Ae(n)&&!h&&si(s,n))?i=i.filter(d=>d!==n):r=a,n=ee(n)}return e.set(s,i),i}function ss(s){let{element:e,boundary:t,rootBoundary:i,strategy:r}=s;const n=[...t==="clippingAncestors"?Ue(e)?[]:is(e,this._c):[].concat(t),i],a=n[0],h=n.reduce((l,d)=>{const u=kt(e,d,r);return l.top=ce(u.top,l.top),l.right=tt(u.right,l.right),l.bottom=tt(u.bottom,l.bottom),l.left=ce(u.left,l.left),l},kt(e,a,r));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function rs(s){const{width:e,height:t}=ei(s);return{width:e,height:t}}function os(s,e,t){const i=G(e),r=q(e),o=t==="fixed",n=ae(s,!0,o,e);let a={scrollLeft:0,scrollTop:0};const h=V(0);function l(){h.x=Ve(r)}if(i||!i&&!o)if((be(e)!=="body"||Ae(r))&&(a=Fe(e)),i){const f=ae(e,!0,o,e);h.x=f.x+e.clientLeft,h.y=f.y+e.clientTop}else r&&l();o&&!i&&r&&l();const d=r&&!i&&!o?ii(r,a):V(0),u=n.left+a.scrollLeft-h.x-d.x,p=n.top+a.scrollTop-h.y-d.y;return{x:u,y:p,width:n.width,height:n.height}}function Je(s){return B(s).position==="static"}function St(s,e){if(!G(s)||B(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return q(s)===t&&(t=t.ownerDocument.body),t}function ri(s,e){const t=H(s);if(Ue(s))return t;if(!G(s)){let r=ee(s);for(;r&&!ye(r);){if($(r)&&!Je(r))return r;r=ee(r)}return t}let i=St(s,e);for(;i&&Bi(i)&&Je(i);)i=St(i,e);return i&&ye(i)&&Je(i)&&!dt(i)?t:i||qi(s)||t}const ns=async function(s){const e=this.getOffsetParent||ri,t=this.getDimensions,i=await t(s.floating);return{reference:os(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function as(s){return B(s).direction==="rtl"}const ls={convertOffsetParentRelativeRectToViewportRelativeRect:Yi,getDocumentElement:q,getClippingRect:ss,getOffsetParent:ri,getElementRects:ns,getClientRects:Ji,getDimensions:rs,getScale:ue,isElement:$,isRTL:as};function oi(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function ds(s,e){let t=null,i;const r=q(s);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,h){a===void 0&&(a=!1),h===void 0&&(h=1),o();const l=s.getBoundingClientRect(),{left:d,top:u,width:p,height:f}=l;if(a||e(),!p||!f)return;const y=De(u),E=De(r.clientWidth-(d+p)),x=De(r.clientHeight-(u+f)),z=De(d),R={rootMargin:-y+"px "+-E+"px "+-x+"px "+-z+"px",threshold:ce(0,tt(1,h))||1};let A=!0;function k(J){const j=J[0].intersectionRatio;if(j!==h){if(!A)return n();j?n(!1,j):i=setTimeout(()=>{n(!1,1e-7)},1e3)}j===1&&!oi(l,s.getBoundingClientRect())&&n(),A=!1}try{t=new IntersectionObserver(k,{...R,root:r.ownerDocument})}catch{t=new IntersectionObserver(k,R)}t.observe(s)}return n(!0),o}function Rt(s,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:h=!1}=i,l=ct(s),d=r||o?[...l?ke(l):[],...ke(e)]:[];d.forEach(z=>{r&&z.addEventListener("scroll",t,{passive:!0}),o&&z.addEventListener("resize",t)});const u=l&&a?ds(l,t):null;let p=-1,f=null;n&&(f=new ResizeObserver(z=>{let[S]=z;S&&S.target===l&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var R;(R=f)==null||R.observe(e)})),t()}),l&&!h&&f.observe(l),f.observe(e));let y,E=h?ae(s):null;h&&x();function x(){const z=ae(s);E&&!oi(E,z)&&t(),E=z,y=requestAnimationFrame(x)}return t(),()=>{var z;d.forEach(S=>{r&&S.removeEventListener("scroll",t),o&&S.removeEventListener("resize",t)}),u?.(),(z=f)==null||z.disconnect(),f=null,h&&cancelAnimationFrame(y)}}const At=Pi,Mt=Hi,Dt=(s,e,t)=>{const i=new Map,r={platform:ls,...t},o={...r.platform,_c:i};return Ti(s,e,{...r,platform:o})},ut=(s,e)=>{let t="The dashboard component encountered an error";typeof e?.dashboardId=="string"&&(t+=` for dashboard with id ${e.dashboardId}`),typeof e?.dashboardSlug=="string"&&(t+=` for dashboard with slug ${e.dashboardSlug}`),typeof e?.container=="string"&&(t+=` in container ${e.container}`),s&&(t+=`:
21
21
  ${s}`,console.warn(t))},hs=s=>{let e=!1,t="";const r=(document.body||document.documentElement).style,o={svg:!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:r.webkitFlexWrap===""||r.flexWrap==="",postMessage:!!window.postMessage},n=["svg","flexbox","postMessage"];for(const d of n)o[d]||(e=!0,s.browserNotSupported=s.browserNotSupported||[],s.browserNotSupported.push(d),t+=`Your browser does not support: ${d}
22
22
  `);const a=window.navigator.userAgent,h=a.includes("MSIE"),l=a.includes("Trident/");(h||l)&&(e=!0,t="IE is not supported."),e&&ut(t)},O={appServer:"https://app.luzmo.com/",apiHost:"https://api.luzmo.com/",dashboardId:null,dashboardSlug:null,container:null,key:null,token:null,language:"auto",editorLanguage:"auto",qeVersion:null,editMode:null,screenMode:null,switchScreenModeOnResize:!0,itemId:null,theme:"",mainColor:"",accentColor:"",itemDimensions:{width:"auto",height:"auto"},loaderBackground:"#f9f9f9",loaderFontColor:"#5a5a5a",loaderSpinnerColor:"rgba(255, 165, 0, 0.7)",loaderSpinnerBackground:"rgba(169, 169, 169, 0.14)",timezoneId:null,contextId:null},ni=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}],Ct={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement...",de:"Initialisiere...",es:"Inicializando..."}},ze=s=>s?s.endsWith("/")?s:`${s}/`:"",X=s=>s?s.endsWith("/")?s.slice(0,-1):s:"",cs=(s,e,t,i)=>{const r=(a,h)=>{const l=a.users.find(y=>y.id===h.id),d=l&&l.userAccessRight?{flagRead:l.userAccessRight.flagRead,flagUse:l.userAccessRight.flagUse,flagModify:l.userAccessRight.flagModify,flagOwn:l.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},p=a.groups.filter(y=>h.userGroups.includes(y.id)||y.public===!0).map(y=>{if(y.groupAccessRight)return y.groupAccessRight});for(const y of p)!d.flagRead&&y.flagRead&&(d.flagRead=y.flagRead),!d.flagUse&&y.flagUse&&(d.flagUse=y.flagUse),!d.flagModify&&y.flagModify&&(d.flagModify=y.flagModify),!d.flagOwn&&y.flagOwn&&(d.flagOwn=y.flagOwn);const f=a.integrations?.length>0?a.integrations.map(y=>{if(y.integrationAccessRight)return y.integrationAccessRight}):[];for(const y of f)!d.flagRead&&y.flagRead&&(d.flagRead=y.flagRead),!d.flagUse&&y.flagUse&&(d.flagUse=y.flagUse),!d.flagModify&&y.flagModify&&(d.flagModify=y.flagModify);return d},o=(a,h)=>{if(a==null)return"";if(typeof a!="object"||Object.keys(a).length===0)return typeof a=="object"&&Object.keys(a).length===0?"":a;let l;return l=h&&a[h]?a[h]:a[Object.keys(a)[0]],l==null&&(l=""),l},n=[];for(const a of s){const h={accessibleBy:[],accessRights:r(a,t),id:a.id,modifiedAt:a.modified_at,name:o(a.name,i.language),slug:null,tags:a.tags.map(f=>f.tag).sort((f,y)=>f.localeCompare(y))},l=a.integrations.find(f=>f.id===e);l?.integrationAccessRight?.slug&&(h.slug=l.integrationAccessRight.slug);const d=a.users.map(f=>({model:"User",id:f.id,name:o(f.name,t.locale_id)})),u=a.groups.map(f=>({model:"Group",id:f.id,name:o(f.name,t.locale_id)||{}})),p=a.integrations.map(f=>({model:"Integration",id:f.id,name:o(f.name,t.locale_id)||{}}));h.accessibleBy=[...d,...u,...p],n.push(h)}return n},us="0.0.0-unknown-luzmo",ms=s=>{const e=/^(%20|\s)*(javascript|data)/im,t=/[^\u0020-\u007E]/gim,i=/^([^:]+):/gm,r=new Set([".","/"]),o=l=>r.has(l[0]);if(!s)return"about:blank";const n=s.replaceAll(t,"").trim();if(o(n))return n;const a=n.match(i);if(!a)return n;const h=a[0];return e.test(h)?"about:blank":n},It=s=>JSON.parse(JSON.stringify(s)),ps=s=>s&&typeof s=="object",rt=(s,e)=>(Object.entries(e).forEach(([t,i])=>{t in s?s[t]===void 0?s[t]=i:s[t]=ps(i)?rt(s[t],i):s[t]:s[t]=i}),s),de=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,function(s){const e=Math.random()*16|0;return(s=="x"?e:e&3|8).toString(16)}),Tt=s=>{const e=[],{appServer:t,language:i,editorLanguage:r,qeVersion:o,loaderBackground:n,loaderSpinnerColor:a,loaderSpinnerBackground:h,loaderFontColor:l,screenMode:d,key:u,token:p,timezoneId:f,itemEmbedding:y,itemDimensions:E,dashboardId:x,dashboardSlug:z,itemId:S,theme:R,mainColor:A,accentColor:k,editMode:J}=s.params;i&&i!=="auto"&&e.push(`language=${i}`),r&&r!=="auto"&&e.push(`editorLanguage=${r}`),o&&e.push(`qe_version=${o}`),n&&e.push(`ldrbg=${n}`),l&&e.push(`ldrftclr=${l}`),a&&e.push(`ldrspclr=${a}`),h&&e.push(`ldrspbg=${h}`),R&&e.push(`theme=${R}`),A&&e.push(`mainColor=${A}`),k&&e.push(`accentColor=${k}`),d&&d!=="auto"&&e.push("screenMode=&{screenMode}"),f&&e.push("timezoneId="+f),y&&E&&E.width&&e.push("width="+E.width),y&&E&&E.height&&e.push("height="+E.height),J&&e.push("editMode="+J);const j=u&&p?"#"+u+":"+p:"";e.push("version="+(s.libVersion||us));const ve=y?`${t}i/${x||z}/${S}?${encodeURIComponent(e.join("&"))}${j}`:`${t}i/${x||z}?${encodeURIComponent(e.join("&"))}${j}`;return ms(ve)},Lt=s=>{let e;(s.params.error||s.browserNotSupported.length>0)&&(s.params.error=!0,s.browserNotSupported&&(e="Browser is not supported."));const t=Ct.initializing[s.params.language]||Ct.initializing.en;return s.browserNotSupported||s.params.error?{loadingMsg:t,errorMsg:e}:{loadingMsg:t,errorMsg:""}};function oe(s,e,t){s.promises[e]&&(s.promises[e].resolve(t),delete s.promises[e])}function Ce(s,e,t){s.promises[e]&&(s.promises[e].reject(t),delete s.promises[e])}function ai(s){const e={};return s.params.loaderBackground&&!s.iframeLoaded&&(e.background=s.params.loaderBackground),e}function gs(s){const e=s.params.itemDimensions?.height||O.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto";return{display:s.iframeLoaded?"none":"",height:`${t?e:s.minHeight}px`}}function fs(s){const e=s.params.loaderBackground||O.loaderBackground;if(s.params.itemEmbedding){s.loaderSize=24,s.borderWidth=4,s.minHeight=200;const t=s.params.itemDimensions?.width||O.itemDimensions.width,i=s.params.itemDimensions?.height||O.itemDimensions.height,r=t!=="auto",o=i!=="auto";return{background:e,width:r?`${t}px`:"100%",height:`${o?i:"200"}px`,"min-height":o?"":"200px"}}return{background:e}}function ys(s){const{loaderSpinnerColor:e,loaderSpinnerBackground:t}=O,i=Nt(s.borderWidth,s.params.loaderSpinnerColor||e),r=Nt(s.borderWidth,s.params.loaderSpinnerBackground||t),o=`${s.loaderSize}px`;return{"border-top":i,"border-right":i,"border-bottom":r,"border-left":r,width:o,height:o}}function bs(s){const e=s.params.itemDimensions?.height||O.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto",i=o=>`${(o-s.loaderSize-32)/2}px`;return{padding:`${s.params.itemId?i(t?Number.parseInt(`${e}`,10):s.minHeight):"128px"} 16px`}}function Ht(s){const e=s.params.itemDimensions?.height||O.itemDimensions.height,t=s.params.itemDimensions?.width||O.itemDimensions.width;s.params.itemEmbedding&&e!=="auto"?s.iframeHeight=`${e}px`:s.params.itemEmbedding?s.iframeHeight="200px":["editFull","editLimited"].includes(s.params.editMode)?s.iframeHeight="100%":s.iframeHeight="400px",s.iframeWidth=s.params.itemEmbedding&&t!=="auto"?`${t}px`:"100%";const i={height:s.iframeHeight,width:s.iframeWidth};return s.iframeLoaded?i.opacity=1:s.error?(i.opacity=1,i.width="100%",i.height="400px"):i.opacity=0,i}function Nt(s,e){return`${s}px solid ${e}`}const vs=(s,e)=>{s?.contentWindow&&s.contentWindow.location.replace(e)},Ot=(s,e,t)=>{const i=de();return e?.contentWindow?(e.contentWindow.postMessage({action:"exportDashboard",format:t||"png",_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="exportDashboard request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},12e5)})):Promise.reject(new Error("Cannot retrieve contentWindow."))},ws=async s=>{if(await s.updateComplete,(s.currentAuthKey??s.authKey)&&(s.currentAuthToken??s.authToken)){const e=new Promise((t,i)=>{(()=>{try{window.fetch(`${ze(s.params.apiHost)}0.1.0/authorization`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{id:s.authKey},attributes:["id","integration_id"],include:[{model:"User",attributes:["id","name","locale_id"],include:[{model:"Group"}]}]}})}).then(o=>o.json()).then(o=>{!o||!o.rows||o.rows.length===0||!o.rows[0].user?i("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com."):(o.rows[0].user.userGroups=o.rows[0].user.groups.map(n=>n.id),delete o.rows[0].user.groups,t({integrationId:o.rows[0].integration_id,user:o.rows[0].user}))})}catch(r){i(r)}})()});return new Promise((t,i)=>void(()=>{try{e.then(r=>{window.fetch(`${ze(s.params.apiHost)}0.1.0/securable`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{type:"dashboard",is_variant:!1},attributes:["id","name","modified_at"],order:[["modified_at","desc"]],include:[{model:"Tag",attributes:["tag"]},{model:"User",attributes:["id","name"]},{model:"Group",attributes:["id","name","public"]},{model:"Integration",attributes:["id","name"]}]}})}).then(n=>n.json()).then(n=>{const a=n.rows.length>0?cs(n.rows,r.integrationId,r.user,s):[];t(a)})}).catch(r=>{i(r)})}catch(r){i(r)}})())}throw new Error("No authKey or authToken found in the luzmo-dashboard component.")},_s=(s,e,t)=>{if(e?.contentWindow){const i=de();return e.contentWindow.postMessage({action:"getData",id:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="getData request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Es=(s,e)=>{if(e?.contentWindow){const t=de();return e.contentWindow.postMessage({action:"getFilters",_version:s.libVersion,requestId:t},"*"),new Promise((i,r)=>{s.promises[t]={resolve:i,reject:r},setTimeout(()=>{if(s.promises[t]){const o="getFilters request timed out.";s.promises[t].reject(new Error(o)),delete s.promises[t]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Pt=(s,e,t)=>e?(e.contentWindow.postMessage({action:"refreshData",id:t??null,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),zs=(s,e)=>e?(e.contentWindow.postMessage({action:"reloadDashboard",_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),xs=(s,e,t,i,r)=>e?(e.contentWindow.postMessage({action:"sendExportEmail",type:t||"once",subject:i,message:r,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),ks=(s,e,t,i)=>e?(e.contentWindow.postMessage({action:"setAuthorization",key:t,token:i,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),Ss=(s,e,t)=>{if(e&&e.contentWindow){const i=de();return s.params.editMode===t?Promise.reject(new Error("editMode parameter is currently already set to "+t)):t!=="editFull"&&t!=="editLimited"&&t!=="view"?Promise.reject(new Error("The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'.")):(e.contentWindow.postMessage({action:"setEditMode",editMode:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o}}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Rs=(s,e,t)=>{if(e){const i=de();return e.contentWindow.postMessage({action:"setPreview",preview:t,requestId:i,_version:s.libVersion},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="setPreview request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},As=(s,e,t,i)=>{if(e){const r=de();return e.contentWindow.postMessage({action:"setSelectedData",itemId:t,filters:i,_version:s.libVersion,requestId:r},"*"),new Promise((o,n)=>{s.promises[r]={resolve:o,reject:n},setTimeout(()=>{if(s.promises[r]){const a="setSelectedData request timed out.";s.promises[r].reject(new Error(a)),delete s.promises[r]}},2e3)})}return Promise.reject()},xe=s=>{if(!s.dimensions){s.params.error=!0,ut("Got no valid dimensions.",s.params);return}const e=Object.keys(s.dimensions),t=[];let i,r=0,o=0;if(!s.params.switchScreenModeOnResize&&s.currentScreenMode&&(s.params.screenMode=s.currentScreenMode),s.dimensions&&e?.[0]==="fixed")i="fixed",r=s.dimensions.fixed[0],o=s.dimensions.fixed[1];else{const h=["mobile","tablet","desktop","largeScreen"];if(s.params.itemEmbedding){const[l]=e;let d=It(l);for(const u of h){const p=e.find(f=>f===u);p?d=It(p):s.dimensions[u]=s.dimensions[d]}}for(const l of e)if(h.includes(l)){const d=ni.find(u=>u.mode===l);t.push({...d,height:s.dimensions[l][1]||50})}if(t.map(l=>l.mode).includes(s.params.screenMode)||(s.params.screenMode="auto"),s.params.screenMode==="auto"){t.sort((l,d)=>h.indexOf(l.mode)-h.indexOf(d.mode));for(const l of t){const[d,u]=l.width;s.params.itemEmbedding&&s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"?d<s.params.itemDimensions.width&&(i=l.mode,r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1]):d<s.containerWidth&&(i=l.mode,s.params.itemEmbedding?(r=s.params.itemDimensions?.width&&s.params.itemDimensions?.width!=="auto"?Number.parseInt(s.params.itemDimensions.width,10):Math.min(s.containerWidth,u),o=s.params.itemDimensions?.height&&s.params.itemDimensions?.height!=="auto"?Number.parseInt(s.params.itemDimensions.height,10):s.dimensions[i][1],s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1])):(r=Math.max(Math.min(u,s.containerWidth),d),o=l.height))}}else{const{height:l,width:[d,u]}=t.find(p=>p.mode===s.params.screenMode);i=s.params.screenMode,r=Math.max(Math.min(u,s.containerWidth),d),o=l,s.params.itemEmbedding&&(s.params.itemDimensions?.width&&s.params.itemDimensions?.width!=="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10)),s.params.itemDimensions?.height&&s.params.itemDimensions?.height!=="auto"&&(o=Number.parseInt(s.params.itemDimensions.height,10)))}if(!i&&t.length>0){const[l]=t;i=l.mode,r=l.width[0],o=l.height}}s.currentScreenMode=i;const n={height:o===0?"100%":`${String(o)}px`,width:r===0?"100%":`${String(r)}px`,opacity:1};["editFull","editLimited"].includes(s.params.editMode)?(n.height="100%",n.width="100%"):s.params.itemEmbedding&&s.params.itemDimensions?(n.height=s.params.itemDimensions.height==="auto"?n.height:`${String(s.params.itemDimensions.height).replace("px","")}px`,n.width=s.params.itemDimensions.width==="auto"?n.width:`${String(s.params.itemDimensions.width).replace("px","")}px`):(n.height=o===0?"100%":`${String(o)}px`,n.width=r===0?"100%":`${String(r)}px`),s.currentScreenMode=i,s.iframeStyle=n},Wt=s=>{const e=Object.keys(O),t=[],i=["appServer","language","apiHost"],r=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"],o=["itemDimensions"],n=["mobile","tablet","desktop","largeScreen","fixed","auto"];for(const a of e)s.params[a]===null&&delete s.params[a];s.params=rt(s.params,O),(!s.params.dashboardId||typeof s.params.dashboardId!="string")&&(!s.params.dashboardSlug||typeof s.params.dashboardSlug!="string")&&(delete s.params.dashboardId,delete s.params.dashboardSlug);for(const a of i)typeof s.params[a]!="string"&&(delete s.params[a],t.push(`${a} needs to be of type string.`));for(const a of r)typeof s.params[a]!="string"&&s.params[a]!==null&&s.params[a]!==void 0&&(delete s.params[a],t.push(`${a} needs to be of type string or empty.`));if(s.params.screenMode&&!n.includes(s.params.screenMode)){const a=n.map(h=>`"${h}"`).join(", ");t.push(`"screenMode" needs should be one of these types: ${a}`),s.params.screenMode="auto"}s.params.itemId&&(s.params.itemEmbedding=!0);for(const a of o)typeof s.params[a]!="object"&&s.params[a]!==null&&(delete s.params[a],t.push(`${a} needs to be of type object or empty.`));if(typeof s.params.switchScreenModeOnResize!="boolean"&&(t.push("switchScreenModeOnResize needs to be of type boolean."),s.params.switchScreenModeOnResize=!0),s.params.itemDimensions){const a=["width","height"];for(const h of a)!["string","number"].includes(typeof s.params.itemDimensions[h])&&s.params.itemDimensions[h]!==null&&t.push(`itemDimensions ${h} needs to be of type string, number or empty.`)}s.params=rt(s.params,O),s.params.screenMode&&s.params.screenMode!=="auto"&&(s.params.switchScreenModeOnResize=!1),s.params.itemDimensions.width!=="auto"&&(s.params.itemDimensions.width=Number.parseInt(`${s.params.itemDimensions.width}`.replace("px",""),10)||"auto"),s.params.itemDimensions.height!=="auto"&&(s.params.itemDimensions.height=Number.parseInt(`${s.params.itemDimensions.height}`.replace("px",""),10)||"auto"),s.params.itemEmbedding=!!s.params.itemId,(s.params.error||t.length>0)&&ut(t.join(`
23
23
  `),s.params)},Qe={type:"type",slots:"slots",options:"options",appServer:"app-server",apiHost:"api-host",authKey:"auth-key",authToken:"auth-token",contextId:"context-id",canFilter:"can-filter",filters:"filters",dashboardId:"dashboard-id",itemId:"item-id",dashboardContentsVersion:"dashboard-contents-version",libVersion:"lib-version"},ot="luzmo-embed-container",Ee={},Ms=async(s,e)=>{const t=typeof s=="function"?await s():s,i=document.createElement("script");i.type="text/javascript",i.addEventListener("load",e),i.src=t,document.querySelectorAll("head")[0].append(i)},$t=s=>({});async function Ds(s){const e=Ee[s];if(e.inited)return e.lib;if(e.format==="var")return new Promise(t=>{const i=()=>{e.inited||(e.lib=window[s],e.lib.init($t(e.from)),e.inited=!0),t(e.lib)};return Ms(e.url,i)});if(["esm","systemjs"].includes(e.format))return new Promise((t,i)=>{(typeof e.url=="function"?e.url:()=>Promise.resolve(e.url))().then(o=>{import(o).then(n=>{if(!e.inited){const a=$t(e.from);n.init(a),e.lib=n,e.lib.init(a),e.inited=!0}t(e.lib)}).catch(i)})})}function Cs(s,e){if(!s?.default&&e){const t=Object.create(null);return t.default=s,t.__esModule=!0,t}return s}async function Is(s,e){return Ds(s).then(t=>t.get(e).then(i=>i()))}async function te(s,e="DashboardApp"){const t=s+e;if(Ee[t])return Ee[t].module;let i=`${X(s)}/remoteEntry.mjs`;if(!s.startsWith("http://localhost"))switch(e){case"DashboardApp":case"VizItemApp":{i=`${X(s)}/dashboard-app/remoteEntry.mjs`;break}case"IQApp":{i=`${X(s)}/iq-components/remoteEntry.mjs`;break}}Ee[t]={url:i,format:"esm",from:"vite",module:void 0};const r=await Is(t,`./${e}`),o=Cs(r,!0);return Ee[t].module=o,o}var Ts=Object.defineProperty,g=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&Ts(e,t,r),r},le="6.7.0",Ls=class{constructor(){this._dashboardComponents=[]}},nt=new Ls,Hs=()=>{typeof window.__luzmoMessageHandler!="function"&&(window.__luzmoMessageHandler=s=>{const e=nt._dashboardComponents.find(t=>s.data.name===t._iframeId);if(e)switch(s.data?.type){case"load":{e.dispatchEvent(new CustomEvent("load",{detail:{data:s.data}})),e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e.dimensions=s.data.dimensions,e._calculateDimAfterDashboardLoaded();break}case"error":{e.dashboardError=!0,e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e._displayError(),console.error("Dashboard error:",s.data.errorMsg??s.data.error?.msg);break}case"data":{oe(e,s.data.requestId,s.data.data);break}case"filters":{oe(e,s.data.requestId,s.data.filters);break}case"getAccessibleDashboards":{oe(e,s.data.requestId,s.data.accessibleDashboards);break}case"dashboardAction":{e.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:s.data}}));break}case"export":{s.data.error?Ce(e,s.data.requestId,s.data):(e.dispatchEvent(new CustomEvent("exported",{detail:{data:s.data}})),oe(e,s.data.requestId,s.data));break}case"changedFilters":{e.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:s.data}}));break}case"customEvent":{e.dispatchEvent(new CustomEvent("customEvent",{detail:{data:s.data}}));break}case"chartsRendered":case"itemsRendered":{s.data.type="itemsRendered",e.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:s.data}}));break}case"setEditMode":{s.data.error?Ce(e,s.data.requestId,s.data):(oe(e,s.data.requestId,s.data),e.params.editMode=s.data.editMode,e._containerStyle=ai(e),e.dimensions&&xe(e));break}case"calculatedDimensions":{e.dimensions=s.data.dimensions,xe(e);break}case"setSelectedData":case"setFilters":{s.data.error?Ce(e,s.data.requestId,s.data):oe(e,s.data.requestId,s.data);break}case"setPreview":{s.data.error?Ce(e,s.data.requestId,s.data):oe(e,s.data.requestId,s.data);break}}},window.addEventListener("message",window.__luzmoMessageHandler,!1))},Ns=_.css`
@@ -30,7 +30,7 @@ import { itemTypes as Di } from "../item-list.js";
30
30
  import { s as Ci, g as xt } from "../index-CgnTl6Sc.js";
31
31
  import { localized as Ii, msg as se } from "@lit/localize";
32
32
  import "@luzmo/lucero/tooltip";
33
- import { g as Ti, t as Li, s as Hi } from "../set-locale-hKTMz37h.js";
33
+ import { g as Ti, t as Li, s as Hi } from "../set-locale-B5562CBM.js";
34
34
  (function() {
35
35
  if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
36
36
  const e = document.createElement("style");
@@ -1411,7 +1411,7 @@ class C {
1411
1411
  * @param config - API configuration
1412
1412
  */
1413
1413
  configure(e = {}) {
1414
- if (e.apiVersion && (this.apiVersion = e.apiVersion), e.apiUrl && (this.apiUrl = e.apiUrl), e.authKey && (this.authKey = e.authKey), e.authToken && (this.authToken = e.authToken), e.staleTime || e.gcTime || e.retry) {
1414
+ if (e.apiVersion && (this.apiVersion = e.apiVersion), e.apiUrl && (this.apiUrl = e.apiUrl), e.authKey !== void 0 && (this.authKey = e.authKey), e.authToken !== void 0 && (this.authToken = e.authToken), e.staleTime || e.gcTime || e.retry) {
1415
1415
  const s = {};
1416
1416
  e.staleTime && (s.staleTime = e.staleTime), e.gcTime && (s.gcTime = e.gcTime), e.retry && (s.retry = e.retry), this.queryClient.setDefaultOptions({
1417
1417
  queries: {
@@ -17,4 +17,4 @@
17
17
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
18
  * SOFTWARE.
19
19
  * */
20
- "use strict";var T=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},X={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Y=class{#t=X;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},Q=new Y;function tt(t){setTimeout(t,0)}var M=typeof window>"u"||"Deno"in globalThis;function v(){}function et(t,e){return typeof t=="function"?t(e):t}function st(t){return typeof t=="number"&&t>=0&&t!==1/0}function it(t,e){return Math.max(t+(e||0)-Date.now(),0)}function E(t,e){return typeof t=="function"?t(e):t}function rt(t,e){return typeof t=="function"?t(e):t}function U(t,e){const{type:s="all",exact:i,fetchStatus:n,predicate:a,queryKey:o,stale:r}=t;if(o){if(i){if(e.queryHash!==j(o,e.options))return!1}else if(!F(e.queryKey,o))return!1}if(s!=="all"){const u=e.isActive();if(s==="active"&&!u||s==="inactive"&&u)return!1}return!(typeof r=="boolean"&&e.isStale()!==r||n&&n!==e.state.fetchStatus||a&&!a(e))}function x(t,e){const{exact:s,status:i,predicate:n,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if(P(e.options.mutationKey)!==P(a))return!1}else if(!F(e.options.mutationKey,a))return!1}return!(i&&e.state.status!==i||n&&!n(e))}function j(t,e){return(e?.queryKeyHashFn||P)(t)}function P(t){return JSON.stringify(t,(e,s)=>R(s)?Object.keys(s).sort().reduce((i,n)=>(i[n]=s[n],i),{}):s)}function F(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>F(t[s],e[s])):!1}var nt=Object.prototype.hasOwnProperty;function $(t,e){if(t===e)return t;const s=L(t)&&L(e);if(!s&&!(R(t)&&R(e)))return e;const n=(s?t:Object.keys(t)).length,a=s?e:Object.keys(e),o=a.length,r=s?new Array(o):{};let u=0;for(let h=0;h<o;h++){const d=s?h:a[h],l=t[d],m=e[d];if(l===m){r[d]=l,(s?h<n:nt.call(t,d))&&u++;continue}if(l===null||m===null||typeof l!="object"||typeof m!="object"){r[d]=m;continue}const b=$(l,m);r[d]=b,b===l&&u++}return n===o&&u===n?t:r}function L(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function R(t){if(!H(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!H(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function H(t){return Object.prototype.toString.call(t)==="[object Object]"}function at(t){return new Promise(e=>{Q.setTimeout(e,t)})}function ot(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?$(t,e):e}function ut(t,e,s=0){const i=[...t,e];return s&&i.length>s?i.slice(1):i}function ht(t,e,s=0){const i=[e,...t];return s&&i.length>s?i.slice(0,-1):i}var I=Symbol();function B(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===I?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var ct=class extends T{#t;#e;#s;constructor(){super(),this.#s=t=>{if(!M&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},J=new ct;function lt(){let t,e;const s=new Promise((n,a)=>{t=n,e=a});s.status="pending",s.catch(()=>{});function i(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{i({status:"fulfilled",value:n}),t(n)},s.reject=n=>{i({status:"rejected",reason:n}),e(n)},s}var dt=tt;function ft(){let t=[],e=0,s=r=>{r()},i=r=>{r()},n=dt;const a=r=>{e?t.push(r):n(()=>{s(r)})},o=()=>{const r=t;t=[],r.length&&n(()=>{i(()=>{r.forEach(u=>{s(u)})})})};return{batch:r=>{let u;e++;try{u=r()}finally{e--,e||o()}return u},batchCalls:r=>(...u)=>{a(()=>{r(...u)})},schedule:a,setNotifyFunction:r=>{s=r},setBatchNotifyFunction:r=>{i=r},setScheduler:r=>{n=r}}}var y=ft(),yt=class extends T{#t=!0;#e;#s;constructor(){super(),this.#s=t=>{if(!M&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#t}},D=new yt;function pt(t){return Math.min(1e3*2**t,3e4)}function z(t){return(t??"online")==="online"?D.isOnline():!0}var K=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function W(t){let e=!1,s=0,i;const n=lt(),a=()=>n.status!=="pending",o=c=>{if(!a()){const p=new K(c);m(p),t.onCancel?.(p)}},r=()=>{e=!0},u=()=>{e=!1},h=()=>J.isFocused()&&(t.networkMode==="always"||D.isOnline())&&t.canRun(),d=()=>z(t.networkMode)&&t.canRun(),l=c=>{a()||(i?.(),n.resolve(c))},m=c=>{a()||(i?.(),n.reject(c))},b=()=>new Promise(c=>{i=p=>{(a()||h())&&c(p)},t.onPause?.()}).then(()=>{i=void 0,a()||t.onContinue?.()}),f=()=>{if(a())return;let c;const p=s===0?t.initialPromise:void 0;try{c=p??t.fn()}catch(g){c=Promise.reject(g)}Promise.resolve(c).then(l).catch(g=>{if(a())return;const w=t.retry??(M?0:3),O=t.retryDelay??pt,q=typeof O=="function"?O(s,g):O,S=w===!0||typeof w=="number"&&s<w||typeof w=="function"&&w(s,g);if(e||!S){m(g);return}s++,t.onFail?.(s,g),at(q).then(()=>h()?void 0:b()).then(()=>{e?m(g):f()})})};return{promise:n,status:()=>n.status,cancel:o,continue:()=>(i?.(),n),cancelRetry:r,continueRetry:u,canStart:d,start:()=>(d()?f():b().then(f),n)}}var Z=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),st(this.gcTime)&&(this.#t=Q.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(M?1/0:300*1e3))}clearGcTimeout(){this.#t&&(Q.clearTimeout(this.#t),this.#t=void 0)}},mt=class extends Z{#t;#e;#s;#r;#i;#a;#o;constructor(t){super(),this.#o=!1,this.#a=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#s=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=N(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#a,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=N(this.options);e.data!==void 0&&(this.setState(G(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#s.remove(this)}setData(t,e){const s=ot(this.state.data,t,this.options);return this.#n({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#n({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(v).catch(v):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>rt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===I||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>E(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!it(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#n({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){const r=this.observers.find(u=>u.options.queryFn);r&&this.setOptions(r.options)}const s=new AbortController,i=r=>{Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(this.#o=!0,s.signal)})},n=()=>{const r=B(this.options,e),h=(()=>{const d={client:this.#r,queryKey:this.queryKey,meta:this.meta};return i(d),d})();return this.#o=!1,this.options.persister?this.options.persister(r,h,this):r(h)},o=(()=>{const r={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:n};return i(r),r})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#n({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=W({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:r=>{r instanceof K&&r.revert&&this.setState({...this.#e,fetchStatus:"idle"}),s.abort()},onFail:(r,u)=>{this.#n({type:"failed",failureCount:r,error:u})},onPause:()=>{this.#n({type:"pause"})},onContinue:()=>{this.#n({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const r=await this.#i.start();if(r===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(r),this.#s.config.onSuccess?.(r,this),this.#s.config.onSettled?.(r,this.state.error,this),r}catch(r){if(r instanceof K){if(r.silent)return this.#i.promise;if(r.revert){if(this.state.data===void 0)throw r;return this.state.data}}throw this.#n({type:"error",error:r}),this.#s.config.onError?.(r,this),this.#s.config.onSettled?.(this.state.data,r,this),r}finally{this.scheduleGc()}}#n(t){const e=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...vt(s.data,this.options),fetchMeta:t.meta??null};case"success":const i={...s,...G(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?i:void 0,i;case"error":const n=t.error;return{...s,error:n,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=e(this.state),y.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:t})})}};function vt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:z(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function G(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function N(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,i=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}function V(t){return{onFetch:(e,s)=>{const i=e.options,n=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let r={pages:[],pageParams:[]},u=0;const h=async()=>{let d=!1;const l=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(e.signal.aborted?d=!0:e.signal.addEventListener("abort",()=>{d=!0}),e.signal)})},m=B(e.options,e.fetchOptions),b=async(f,c,p)=>{if(d)return Promise.reject();if(c==null&&f.pages.length)return Promise.resolve(f);const w=(()=>{const k={client:e.client,queryKey:e.queryKey,pageParam:c,direction:p?"backward":"forward",meta:e.options.meta};return l(k),k})(),O=await m(w),{maxPages:q}=e.options,S=p?ht:ut;return{pages:S(f.pages,O,q),pageParams:S(f.pageParams,c,q)}};if(n&&a.length){const f=n==="backward",c=f?gt:_,p={pages:a,pageParams:o},g=c(i,p);r=await b(p,g,f)}else{const f=t??a.length;do{const c=u===0?o[0]??i.initialPageParam:_(i,r);if(u>0&&c==null)break;r=await b(r,c),u++}while(u<f)}return r};e.options.persister?e.fetchFn=()=>e.options.persister?.(h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=h}}}function _(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function gt(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var bt=class extends Z{#t;#e;#s;#r;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||wt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=W({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(a,o)=>{this.#i({type:"failed",failureCount:a,error:o})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const i=this.state.status==="pending",n=!this.#r.canStart();try{if(i)e();else{this.#i({type:"pending",variables:t,isPaused:n}),await this.#s.config.onMutate?.(t,this,s);const o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#i({type:"pending",context:o,variables:t,isPaused:n})}const a=await this.#r.start();return await this.#s.config.onSuccess?.(a,t,this.state.context,this,s),await this.options.onSuccess?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(a,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(a,null,t,this.state.context,s),this.#i({type:"success",data:a}),a}catch(a){try{throw await this.#s.config.onError?.(a,t,this.state.context,this,s),await this.options.onError?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(void 0,a,t,this.state.context,s),a}finally{this.#i({type:"error",error:a})}}finally{this.#s.runNext(this)}}#i(t){const e=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),y.batch(()=>{this.#e.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function wt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ct=class extends T{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#s=0}#t;#e;#s;build(t,e,s){const i=new bt({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#t.add(t);const e=A(t);if(typeof e=="string"){const s=this.#e.get(e);s?s.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const e=A(t);if(typeof e=="string"){const s=this.#e.get(e);if(s)if(s.length>1){const i=s.indexOf(t);i!==-1&&s.splice(i,1)}else s[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=A(t);if(typeof e=="string"){const i=this.#e.get(e)?.find(n=>n.state.status==="pending");return!i||i===t}else return!0}runNext(t){const e=A(t);return typeof e=="string"?this.#e.get(e)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){y.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const e={exact:!0,...t};return this.getAll().find(s=>x(e,s))}findAll(t={}){return this.getAll().filter(e=>x(t,e))}notify(t){y.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return y.batch(()=>Promise.all(t.map(e=>e.continue().catch(v))))}};function A(t){return t.options.scope?.id}var Ot=class extends T{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,s){const i=e.queryKey,n=e.queryHash??j(i,e);let a=this.get(n);return a||(a=new mt({client:t,queryKey:i,queryHash:n,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){y.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(s=>U(e,s))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(s=>U(t,s)):e}notify(t){y.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){y.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){y.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=class{#t;#e;#s;#r;#i;#a;#o;#n;constructor(t={}){this.#t=t.queryCache||new Ot,this.#e=t.mutationCache||new Ct,this.#s=t.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=J.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#n=D.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#n?.(),this.#n=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#t.build(this,e),i=s.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(E(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:s})=>{const i=s.data;return[e,i]})}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#t.get(i.queryHash)?.state.data,o=et(e,a);if(o!==void 0)return this.#t.build(this,i).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return y.batch(()=>this.#t.findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){const e=this.#t;y.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=this.#t;return y.batch(()=>(s.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=y.batch(()=>this.#t.findAll(t).map(n=>n.cancel(s)));return Promise.all(i).then(v).catch(v)}invalidateQueries(t,e={}){return y.batch(()=>(this.#t.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=y.batch(()=>this.#t.findAll(t).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(v)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(v)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=this.#t.build(this,e);return s.isStaleByTime(E(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(v).catch(v)}fetchInfiniteQuery(t){return t.behavior=V(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(v).catch(v)}ensureInfiniteQueryData(t){return t.behavior=V(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return D.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(P(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],s={};return e.forEach(i=>{F(t,i.queryKey)&&Object.assign(s,i.defaultOptions)}),s}setMutationDefaults(t,e){this.#i.set(P(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],s={};return e.forEach(i=>{F(t,i.mutationKey)&&Object.assign(s,i.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=j(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===I&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}};class C{constructor(e={}){this.availableDatasets=[],this.apiUrl=e.apiUrl||"https://api.luzmo.com",this.apiVersion=e.apiVersion||"0.1.0",this.authKey=e.authKey||"",this.authToken=e.authToken||"",this.queryClient=new Pt({defaultOptions:{queries:{staleTime:e.staleTime||300*1e3,gcTime:e.gcTime||600*1e3,retry:e.retry||3,retryDelay:e.retryDelay||(s=>Math.min(1e3*2**s,3e4))}}}),this.initNetworkListeners()}configure(e={}){if(e.apiVersion&&(this.apiVersion=e.apiVersion),e.apiUrl&&(this.apiUrl=e.apiUrl),e.authKey&&(this.authKey=e.authKey),e.authToken&&(this.authToken=e.authToken),e.staleTime||e.gcTime||e.retry){const s={};e.staleTime&&(s.staleTime=e.staleTime),e.gcTime&&(s.gcTime=e.gcTime),e.retry&&(s.retry=e.retry),this.queryClient.setDefaultOptions({queries:{...this.queryClient.getDefaultOptions().queries,...s}})}}initNetworkListeners(){typeof window<"u"&&window.addEventListener("online",()=>{console.warn("Network connection restored, refreshing data..."),this.refreshAll()})}getHeaders(e={}){return{"Content-Type":"application/json",...e}}async fetchApi(e,s,i={}){const n=`${this.apiUrl}/${this.apiVersion}${e}`,o={method:i.method||"POST",headers:this.getHeaders(i.headers),mode:"cors",...i};s!==void 0&&(s.key=this.authKey,s.token=this.authToken,o.body=JSON.stringify(s));try{const r=await fetch(n,o);if(!r.ok){const u=await r.json().catch(()=>null);throw r.status===401||r.status===403?new Error("Authentication failed. Please check your API token."):r.status===404?new Error(`Resource not found: ${e}`):r.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(u?.message||`API request failed with status ${r.status}`)}return await r.json()}catch(r){throw console.error(`API request to ${e} failed:`,r),r instanceof Error&&(r.endpoint=e,r.timestamp=new Date().toISOString()),r}}async fetchAllDatasets(e={}){const s=e.offset||0,i=e.limit||50,n=["datasets",s,i];return await this.queryClient.fetchQuery({queryKey:n,queryFn:async()=>{const a={action:"get",version:this.apiVersion,find:{where:{type:"dataset"},limit:i,offset:s}},o=await this.fetchApi("/securable",a);return{data:o?.rows??[],pagination:{offset:s,limit:i,total:o?.count??0,pages:Math.ceil((o?.count??0)/i)}}}})}async searchDatasets(e,s){if(!e)return{data:[]};const i=["datasets","search",e,s];return await this.queryClient.fetchQuery({queryKey:i,queryFn:async()=>{const n={action:"get",version:this.apiVersion,find:{where:{type:"dataset"}}};e?.length>0&&(n.find.search={match_types:["name"],keyphrase:e}),s?.offset&&(n.find.offset=s?.offset),s?.limit&&(n.find.limit=s?.limit);const a=await this.fetchApi("/securable",n),o={data:a?.rows??[]};return s?.limit&&(o.pagination={offset:s?.offset??0,limit:s?.limit,total:a?.count??0,pages:Math.ceil((a?.count??0)/s?.limit)}),o}})}async fetchDatasetsWithColumnsAndFormulas(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const s=["datasets",e,this.authKey,this.authToken];return await this.queryClient.fetchQuery({queryKey:s,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{where:{type:"dataset",id:{in:e}},attributes:["name","id","description"],include:[{model:"Column",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],separate:!0,order:[["order","asc"]],include:[{model:"Column",attributes:["id","securable_id","hierarchy_enabled","currency_id"],as:"Joins"},{model:"HierarchyLevel",attributes:["id","level","name"],as:"HierarchyLevels"},{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]},{model:"Formula",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],include:[{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]}]}};return(await this.fetchApi("/securable",i))?.rows??[]}})}async fetchData(e){if(!e)throw new Error("Query is required");const s=["data",e];return await this.queryClient.fetchQuery({queryKey:s,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{queries:[e]}},n=await this.fetchApi("/data",i);return{data:n?.data||[],performance:n?.performance||{}}}})}refreshAll(){this.queryClient.refetchQueries()}invalidateDatasetData(e){e?(this.queryClient.invalidateQueries({queryKey:["dataset",e]}),this.queryClient.invalidateQueries({queryKey:["columns",e]})):this.queryClient.invalidateQueries({queryKey:["datasets"]})}invalidateAll(){this.queryClient.clear()}static getInstance(e={}){return C.instance?Object.keys(e).length>0&&C.instance.configure(e):C.instance=new C(e),C.instance}async fetchDatasetsRecursive(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const s=[...new Set(e)],i=new Set,n=new Map,a=o=>{o&&!i.has(o)&&!s.includes(o)&&s.push(o)};for(;s.length>0;){const o=[];for(;s.length>0&&o.length<50;){const r=s.shift();i.has(r)||o.push(r)}if(o.length!==0)try{(await this.fetchDatasetsWithColumnsAndFormulas(o)).forEach(u=>{const h=this.postProcessDatasetMetadata(u);i.add(h.id),this.queryClient.setQueryData(["dataset",h.id],h),(h.outgoingJoins??[]).map(l=>l.securable_id).filter(l=>!!l&&l!==h.id).forEach(l=>{a(l)}),n.set(h.id,h),this.availableDatasets.some(l=>l.id===h.id)||this.availableDatasets.push({id:h.id,name:h.name,columns:h.columns})})}catch(r){console.error("Error fetching datasets recursively:",r)}}return[...n.values()]}postProcessDatasetMetadata(e){const s=[],i=(e.columns??[]).map(n=>{const a=n.joins??(Array.isArray(n.joins)?n.joins:[]);Array.isArray(a)&&a.length>0&&s.push(...a);const{joins:o,...r}=n;return{...r,joins:a}});return{...e,columns:i,formulas:e.formulas??[],outgoingJoins:s,dateLoaded:new Date}}getAvailableDatasets(){return this.availableDatasets}getLinkedDatasetsIds(e){const s=this.queryClient.getQueryData(["dataset",e]);return s?(s.outgoingJoins??[]).map(i=>i.securable_id).filter(i=>!!i&&i!==e):[]}}const Ft=C.getInstance();exports.dataBroker=Ft;
20
+ "use strict";var T=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},X={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Y=class{#t=X;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},Q=new Y;function tt(t){setTimeout(t,0)}var M=typeof window>"u"||"Deno"in globalThis;function v(){}function et(t,e){return typeof t=="function"?t(e):t}function st(t){return typeof t=="number"&&t>=0&&t!==1/0}function it(t,e){return Math.max(t+(e||0)-Date.now(),0)}function E(t,e){return typeof t=="function"?t(e):t}function rt(t,e){return typeof t=="function"?t(e):t}function U(t,e){const{type:s="all",exact:i,fetchStatus:n,predicate:a,queryKey:o,stale:r}=t;if(o){if(i){if(e.queryHash!==j(o,e.options))return!1}else if(!F(e.queryKey,o))return!1}if(s!=="all"){const u=e.isActive();if(s==="active"&&!u||s==="inactive"&&u)return!1}return!(typeof r=="boolean"&&e.isStale()!==r||n&&n!==e.state.fetchStatus||a&&!a(e))}function x(t,e){const{exact:s,status:i,predicate:n,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if(P(e.options.mutationKey)!==P(a))return!1}else if(!F(e.options.mutationKey,a))return!1}return!(i&&e.state.status!==i||n&&!n(e))}function j(t,e){return(e?.queryKeyHashFn||P)(t)}function P(t){return JSON.stringify(t,(e,s)=>R(s)?Object.keys(s).sort().reduce((i,n)=>(i[n]=s[n],i),{}):s)}function F(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>F(t[s],e[s])):!1}var nt=Object.prototype.hasOwnProperty;function $(t,e){if(t===e)return t;const s=L(t)&&L(e);if(!s&&!(R(t)&&R(e)))return e;const n=(s?t:Object.keys(t)).length,a=s?e:Object.keys(e),o=a.length,r=s?new Array(o):{};let u=0;for(let h=0;h<o;h++){const d=s?h:a[h],l=t[d],m=e[d];if(l===m){r[d]=l,(s?h<n:nt.call(t,d))&&u++;continue}if(l===null||m===null||typeof l!="object"||typeof m!="object"){r[d]=m;continue}const b=$(l,m);r[d]=b,b===l&&u++}return n===o&&u===n?t:r}function L(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function R(t){if(!H(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!H(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function H(t){return Object.prototype.toString.call(t)==="[object Object]"}function at(t){return new Promise(e=>{Q.setTimeout(e,t)})}function ot(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?$(t,e):e}function ut(t,e,s=0){const i=[...t,e];return s&&i.length>s?i.slice(1):i}function ht(t,e,s=0){const i=[e,...t];return s&&i.length>s?i.slice(0,-1):i}var I=Symbol();function B(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===I?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var ct=class extends T{#t;#e;#s;constructor(){super(),this.#s=t=>{if(!M&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},J=new ct;function lt(){let t,e;const s=new Promise((n,a)=>{t=n,e=a});s.status="pending",s.catch(()=>{});function i(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{i({status:"fulfilled",value:n}),t(n)},s.reject=n=>{i({status:"rejected",reason:n}),e(n)},s}var dt=tt;function ft(){let t=[],e=0,s=r=>{r()},i=r=>{r()},n=dt;const a=r=>{e?t.push(r):n(()=>{s(r)})},o=()=>{const r=t;t=[],r.length&&n(()=>{i(()=>{r.forEach(u=>{s(u)})})})};return{batch:r=>{let u;e++;try{u=r()}finally{e--,e||o()}return u},batchCalls:r=>(...u)=>{a(()=>{r(...u)})},schedule:a,setNotifyFunction:r=>{s=r},setBatchNotifyFunction:r=>{i=r},setScheduler:r=>{n=r}}}var y=ft(),yt=class extends T{#t=!0;#e;#s;constructor(){super(),this.#s=t=>{if(!M&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#t}},D=new yt;function pt(t){return Math.min(1e3*2**t,3e4)}function z(t){return(t??"online")==="online"?D.isOnline():!0}var K=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function W(t){let e=!1,s=0,i;const n=lt(),a=()=>n.status!=="pending",o=c=>{if(!a()){const p=new K(c);m(p),t.onCancel?.(p)}},r=()=>{e=!0},u=()=>{e=!1},h=()=>J.isFocused()&&(t.networkMode==="always"||D.isOnline())&&t.canRun(),d=()=>z(t.networkMode)&&t.canRun(),l=c=>{a()||(i?.(),n.resolve(c))},m=c=>{a()||(i?.(),n.reject(c))},b=()=>new Promise(c=>{i=p=>{(a()||h())&&c(p)},t.onPause?.()}).then(()=>{i=void 0,a()||t.onContinue?.()}),f=()=>{if(a())return;let c;const p=s===0?t.initialPromise:void 0;try{c=p??t.fn()}catch(g){c=Promise.reject(g)}Promise.resolve(c).then(l).catch(g=>{if(a())return;const w=t.retry??(M?0:3),O=t.retryDelay??pt,q=typeof O=="function"?O(s,g):O,S=w===!0||typeof w=="number"&&s<w||typeof w=="function"&&w(s,g);if(e||!S){m(g);return}s++,t.onFail?.(s,g),at(q).then(()=>h()?void 0:b()).then(()=>{e?m(g):f()})})};return{promise:n,status:()=>n.status,cancel:o,continue:()=>(i?.(),n),cancelRetry:r,continueRetry:u,canStart:d,start:()=>(d()?f():b().then(f),n)}}var Z=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),st(this.gcTime)&&(this.#t=Q.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(M?1/0:300*1e3))}clearGcTimeout(){this.#t&&(Q.clearTimeout(this.#t),this.#t=void 0)}},mt=class extends Z{#t;#e;#s;#r;#i;#a;#o;constructor(t){super(),this.#o=!1,this.#a=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#s=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=N(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#a,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=N(this.options);e.data!==void 0&&(this.setState(G(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#s.remove(this)}setData(t,e){const s=ot(this.state.data,t,this.options);return this.#n({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#n({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(v).catch(v):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>rt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===I||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>E(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!it(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#n({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){const r=this.observers.find(u=>u.options.queryFn);r&&this.setOptions(r.options)}const s=new AbortController,i=r=>{Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(this.#o=!0,s.signal)})},n=()=>{const r=B(this.options,e),h=(()=>{const d={client:this.#r,queryKey:this.queryKey,meta:this.meta};return i(d),d})();return this.#o=!1,this.options.persister?this.options.persister(r,h,this):r(h)},o=(()=>{const r={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:n};return i(r),r})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#n({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=W({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:r=>{r instanceof K&&r.revert&&this.setState({...this.#e,fetchStatus:"idle"}),s.abort()},onFail:(r,u)=>{this.#n({type:"failed",failureCount:r,error:u})},onPause:()=>{this.#n({type:"pause"})},onContinue:()=>{this.#n({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const r=await this.#i.start();if(r===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(r),this.#s.config.onSuccess?.(r,this),this.#s.config.onSettled?.(r,this.state.error,this),r}catch(r){if(r instanceof K){if(r.silent)return this.#i.promise;if(r.revert){if(this.state.data===void 0)throw r;return this.state.data}}throw this.#n({type:"error",error:r}),this.#s.config.onError?.(r,this),this.#s.config.onSettled?.(this.state.data,r,this),r}finally{this.scheduleGc()}}#n(t){const e=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...vt(s.data,this.options),fetchMeta:t.meta??null};case"success":const i={...s,...G(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?i:void 0,i;case"error":const n=t.error;return{...s,error:n,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=e(this.state),y.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:t})})}};function vt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:z(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function G(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function N(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,i=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}function V(t){return{onFetch:(e,s)=>{const i=e.options,n=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let r={pages:[],pageParams:[]},u=0;const h=async()=>{let d=!1;const l=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(e.signal.aborted?d=!0:e.signal.addEventListener("abort",()=>{d=!0}),e.signal)})},m=B(e.options,e.fetchOptions),b=async(f,c,p)=>{if(d)return Promise.reject();if(c==null&&f.pages.length)return Promise.resolve(f);const w=(()=>{const k={client:e.client,queryKey:e.queryKey,pageParam:c,direction:p?"backward":"forward",meta:e.options.meta};return l(k),k})(),O=await m(w),{maxPages:q}=e.options,S=p?ht:ut;return{pages:S(f.pages,O,q),pageParams:S(f.pageParams,c,q)}};if(n&&a.length){const f=n==="backward",c=f?gt:_,p={pages:a,pageParams:o},g=c(i,p);r=await b(p,g,f)}else{const f=t??a.length;do{const c=u===0?o[0]??i.initialPageParam:_(i,r);if(u>0&&c==null)break;r=await b(r,c),u++}while(u<f)}return r};e.options.persister?e.fetchFn=()=>e.options.persister?.(h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=h}}}function _(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function gt(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var bt=class extends Z{#t;#e;#s;#r;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||wt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=W({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(a,o)=>{this.#i({type:"failed",failureCount:a,error:o})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const i=this.state.status==="pending",n=!this.#r.canStart();try{if(i)e();else{this.#i({type:"pending",variables:t,isPaused:n}),await this.#s.config.onMutate?.(t,this,s);const o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#i({type:"pending",context:o,variables:t,isPaused:n})}const a=await this.#r.start();return await this.#s.config.onSuccess?.(a,t,this.state.context,this,s),await this.options.onSuccess?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(a,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(a,null,t,this.state.context,s),this.#i({type:"success",data:a}),a}catch(a){try{throw await this.#s.config.onError?.(a,t,this.state.context,this,s),await this.options.onError?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(void 0,a,t,this.state.context,s),a}finally{this.#i({type:"error",error:a})}}finally{this.#s.runNext(this)}}#i(t){const e=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),y.batch(()=>{this.#e.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function wt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ct=class extends T{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#s=0}#t;#e;#s;build(t,e,s){const i=new bt({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#t.add(t);const e=A(t);if(typeof e=="string"){const s=this.#e.get(e);s?s.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const e=A(t);if(typeof e=="string"){const s=this.#e.get(e);if(s)if(s.length>1){const i=s.indexOf(t);i!==-1&&s.splice(i,1)}else s[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=A(t);if(typeof e=="string"){const i=this.#e.get(e)?.find(n=>n.state.status==="pending");return!i||i===t}else return!0}runNext(t){const e=A(t);return typeof e=="string"?this.#e.get(e)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){y.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const e={exact:!0,...t};return this.getAll().find(s=>x(e,s))}findAll(t={}){return this.getAll().filter(e=>x(t,e))}notify(t){y.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return y.batch(()=>Promise.all(t.map(e=>e.continue().catch(v))))}};function A(t){return t.options.scope?.id}var Ot=class extends T{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,s){const i=e.queryKey,n=e.queryHash??j(i,e);let a=this.get(n);return a||(a=new mt({client:t,queryKey:i,queryHash:n,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){y.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(s=>U(e,s))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(s=>U(t,s)):e}notify(t){y.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){y.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){y.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=class{#t;#e;#s;#r;#i;#a;#o;#n;constructor(t={}){this.#t=t.queryCache||new Ot,this.#e=t.mutationCache||new Ct,this.#s=t.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=J.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#n=D.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#n?.(),this.#n=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#t.build(this,e),i=s.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(E(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:s})=>{const i=s.data;return[e,i]})}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#t.get(i.queryHash)?.state.data,o=et(e,a);if(o!==void 0)return this.#t.build(this,i).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return y.batch(()=>this.#t.findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){const e=this.#t;y.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=this.#t;return y.batch(()=>(s.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=y.batch(()=>this.#t.findAll(t).map(n=>n.cancel(s)));return Promise.all(i).then(v).catch(v)}invalidateQueries(t,e={}){return y.batch(()=>(this.#t.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=y.batch(()=>this.#t.findAll(t).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(v)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(v)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=this.#t.build(this,e);return s.isStaleByTime(E(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(v).catch(v)}fetchInfiniteQuery(t){return t.behavior=V(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(v).catch(v)}ensureInfiniteQueryData(t){return t.behavior=V(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return D.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(P(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],s={};return e.forEach(i=>{F(t,i.queryKey)&&Object.assign(s,i.defaultOptions)}),s}setMutationDefaults(t,e){this.#i.set(P(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],s={};return e.forEach(i=>{F(t,i.mutationKey)&&Object.assign(s,i.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=j(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===I&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}};class C{constructor(e={}){this.availableDatasets=[],this.apiUrl=e.apiUrl||"https://api.luzmo.com",this.apiVersion=e.apiVersion||"0.1.0",this.authKey=e.authKey||"",this.authToken=e.authToken||"",this.queryClient=new Pt({defaultOptions:{queries:{staleTime:e.staleTime||300*1e3,gcTime:e.gcTime||600*1e3,retry:e.retry||3,retryDelay:e.retryDelay||(s=>Math.min(1e3*2**s,3e4))}}}),this.initNetworkListeners()}configure(e={}){if(e.apiVersion&&(this.apiVersion=e.apiVersion),e.apiUrl&&(this.apiUrl=e.apiUrl),e.authKey!==void 0&&(this.authKey=e.authKey),e.authToken!==void 0&&(this.authToken=e.authToken),e.staleTime||e.gcTime||e.retry){const s={};e.staleTime&&(s.staleTime=e.staleTime),e.gcTime&&(s.gcTime=e.gcTime),e.retry&&(s.retry=e.retry),this.queryClient.setDefaultOptions({queries:{...this.queryClient.getDefaultOptions().queries,...s}})}}initNetworkListeners(){typeof window<"u"&&window.addEventListener("online",()=>{console.warn("Network connection restored, refreshing data..."),this.refreshAll()})}getHeaders(e={}){return{"Content-Type":"application/json",...e}}async fetchApi(e,s,i={}){const n=`${this.apiUrl}/${this.apiVersion}${e}`,o={method:i.method||"POST",headers:this.getHeaders(i.headers),mode:"cors",...i};s!==void 0&&(s.key=this.authKey,s.token=this.authToken,o.body=JSON.stringify(s));try{const r=await fetch(n,o);if(!r.ok){const u=await r.json().catch(()=>null);throw r.status===401||r.status===403?new Error("Authentication failed. Please check your API token."):r.status===404?new Error(`Resource not found: ${e}`):r.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(u?.message||`API request failed with status ${r.status}`)}return await r.json()}catch(r){throw console.error(`API request to ${e} failed:`,r),r instanceof Error&&(r.endpoint=e,r.timestamp=new Date().toISOString()),r}}async fetchAllDatasets(e={}){const s=e.offset||0,i=e.limit||50,n=["datasets",s,i];return await this.queryClient.fetchQuery({queryKey:n,queryFn:async()=>{const a={action:"get",version:this.apiVersion,find:{where:{type:"dataset"},limit:i,offset:s}},o=await this.fetchApi("/securable",a);return{data:o?.rows??[],pagination:{offset:s,limit:i,total:o?.count??0,pages:Math.ceil((o?.count??0)/i)}}}})}async searchDatasets(e,s){if(!e)return{data:[]};const i=["datasets","search",e,s];return await this.queryClient.fetchQuery({queryKey:i,queryFn:async()=>{const n={action:"get",version:this.apiVersion,find:{where:{type:"dataset"}}};e?.length>0&&(n.find.search={match_types:["name"],keyphrase:e}),s?.offset&&(n.find.offset=s?.offset),s?.limit&&(n.find.limit=s?.limit);const a=await this.fetchApi("/securable",n),o={data:a?.rows??[]};return s?.limit&&(o.pagination={offset:s?.offset??0,limit:s?.limit,total:a?.count??0,pages:Math.ceil((a?.count??0)/s?.limit)}),o}})}async fetchDatasetsWithColumnsAndFormulas(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const s=["datasets",e,this.authKey,this.authToken];return await this.queryClient.fetchQuery({queryKey:s,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{where:{type:"dataset",id:{in:e}},attributes:["name","id","description"],include:[{model:"Column",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],separate:!0,order:[["order","asc"]],include:[{model:"Column",attributes:["id","securable_id","hierarchy_enabled","currency_id"],as:"Joins"},{model:"HierarchyLevel",attributes:["id","level","name"],as:"HierarchyLevels"},{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]},{model:"Formula",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],include:[{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]}]}};return(await this.fetchApi("/securable",i))?.rows??[]}})}async fetchData(e){if(!e)throw new Error("Query is required");const s=["data",e];return await this.queryClient.fetchQuery({queryKey:s,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{queries:[e]}},n=await this.fetchApi("/data",i);return{data:n?.data||[],performance:n?.performance||{}}}})}refreshAll(){this.queryClient.refetchQueries()}invalidateDatasetData(e){e?(this.queryClient.invalidateQueries({queryKey:["dataset",e]}),this.queryClient.invalidateQueries({queryKey:["columns",e]})):this.queryClient.invalidateQueries({queryKey:["datasets"]})}invalidateAll(){this.queryClient.clear()}static getInstance(e={}){return C.instance?Object.keys(e).length>0&&C.instance.configure(e):C.instance=new C(e),C.instance}async fetchDatasetsRecursive(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const s=[...new Set(e)],i=new Set,n=new Map,a=o=>{o&&!i.has(o)&&!s.includes(o)&&s.push(o)};for(;s.length>0;){const o=[];for(;s.length>0&&o.length<50;){const r=s.shift();i.has(r)||o.push(r)}if(o.length!==0)try{(await this.fetchDatasetsWithColumnsAndFormulas(o)).forEach(u=>{const h=this.postProcessDatasetMetadata(u);i.add(h.id),this.queryClient.setQueryData(["dataset",h.id],h),(h.outgoingJoins??[]).map(l=>l.securable_id).filter(l=>!!l&&l!==h.id).forEach(l=>{a(l)}),n.set(h.id,h),this.availableDatasets.some(l=>l.id===h.id)||this.availableDatasets.push({id:h.id,name:h.name,columns:h.columns})})}catch(r){console.error("Error fetching datasets recursively:",r)}}return[...n.values()]}postProcessDatasetMetadata(e){const s=[],i=(e.columns??[]).map(n=>{const a=n.joins??(Array.isArray(n.joins)?n.joins:[]);Array.isArray(a)&&a.length>0&&s.push(...a);const{joins:o,...r}=n;return{...r,joins:a}});return{...e,columns:i,formulas:e.formulas??[],outgoingJoins:s,dateLoaded:new Date}}getAvailableDatasets(){return this.availableDatasets}getLinkedDatasetsIds(e){const s=this.queryClient.getQueryData(["dataset",e]);return s?(s.outgoingJoins??[]).map(i=>i.securable_id).filter(i=>!!i&&i!==e):[]}}const Ft=C.getInstance();exports.dataBroker=Ft;
@@ -17,11 +17,11 @@
17
17
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
18
  * SOFTWARE.
19
19
  * */
20
- "use strict";require("@luzmo/lucero/field-label");require("@luzmo/lucero/menu");require("@luzmo/lucero/select");const c=require("lit"),e=require("@lit/localize"),m=require("@luzmo/lucero/utils"),n=require("lit/decorators.js"),h=require("./set-locale-BRRalqne.cjs"),f=()=>[{id:"? = ?",key:"? = ?",expression:"? = ?",name:e.msg("equals",{desc:"Filter expression for equals comparison"}),description:e.msg("equals",{desc:"Filter expression for equals comparison"}),tiny:e.msg("eq",{desc:"Short form of equals comparison"}),type:["numeric","hierarchy"],subtype:["ip_address"]},{id:"? != ?",key:"? != ?",expression:"? != ?",name:e.msg("not equals",{desc:"Filter expression for not equals comparison"}),description:e.msg("not equals",{desc:"Filter expression for not equals comparison"}),tiny:e.msg("not eq",{desc:"Short form of not equals comparison"}),type:["numeric","hierarchy"],subtype:["ip_address"]},{id:"? in ?",key:"? in ?",expression:"? in ?",name:e.msg("is in",{desc:"Filter expression for in comparison"}),description:e.msg("is in",{desc:"Filter expression for in comparison"}),tiny:e.msg("is in",{desc:"Filter expression for in comparison"}),type:["numeric","hierarchy"],subtype:["ip_address"]},{id:"? not in ?",key:"? not in ?",expression:"? not in ?",name:e.msg("is not in",{desc:"Filter expression for not in comparison"}),description:e.msg("is not in",{desc:"Filter expression for not in comparison"}),tiny:e.msg("is not in",{desc:"Filter expression for not in comparison"}),type:["numeric","hierarchy"],subtype:["ip_address"]},{id:"? like ?",key:"? like ?",expression:"? like ?",name:e.msg("contains",{desc:"Filter expression for contains comparison"}),description:e.msg("contains",{desc:"Filter expression for contains comparison"}),tiny:e.msg("cont",{desc:"Short form of contains comparison in filter expression"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? not like ?",key:"? not like ?",expression:"? not like ?",name:e.msg("does not contain",{desc:"Filter expression for does not contain comparison"}),description:e.msg("does not contain",{desc:"Filter expression for does not contain comparison"}),tiny:e.msg("not cont",{desc:"Short form of does not contain comparison in filter expression"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? starts with ?",key:"? starts with ?",expression:"? starts with ?",name:e.msg("starts with",{desc:"Filter expression for starts with comparison"}),description:e.msg("starts with",{desc:"Filter expression for starts with comparison"}),tiny:e.msg("starts with",{desc:"Filter expression for starts with comparison"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? not starts with ?",key:"? not starts with ?",expression:"? not starts with ?",name:e.msg("does not start with",{desc:"Filter expression for does not start with comparison"}),description:e.msg("does not start with",{desc:"Filter expression for does not start with comparison"}),tiny:e.msg("not starts with",{desc:"Short form of does not start with comparison in filter expression"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? ends with ?",key:"? ends with ?",expression:"? ends with ?",name:e.msg("ends with",{desc:"Filter expression for ends with comparison"}),description:e.msg("ends with",{desc:"Filter expression for ends with comparison"}),tiny:e.msg("ends with",{desc:"Filter expression for ends with comparison"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? not ends with ?",key:"? not ends with ?",expression:"? not ends with ?",name:e.msg("does not end with",{desc:"Filter expression for does not end with comparison"}),description:e.msg("does not end with",{desc:"Filter expression for does not end with comparison"}),tiny:e.msg("not ends with",{desc:"Short form of does not end with comparison in filter expression"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? < ?",key:"? < ?",expression:"? < ?",name:e.msg("less than",{desc:"Filter expression for less than comparison"}),description:e.msg("less than",{desc:"Filter expression for less than comparison"}),tiny:e.msg("less than",{desc:"Filter expression for less than comparison"}),type:["numeric","datetime"],subtype:["ip_address"]},{id:"? <= ?",key:"? <= ?",expression:"? <= ?",name:e.msg("less than or equal",{desc:"Filter expression for less than or equal comparison"}),description:e.msg("less than or equal",{desc:"Filter expression for less than or equal comparison"}),tiny:e.msg("<=",{desc:"Short form of less than or equal comparison in filter expression"}),type:["numeric","datetime"],subtype:["ip_address"]},{id:"? > ?",key:"? > ?",expression:"? > ?",name:e.msg("greater than",{desc:"Filter expression for greater than comparison"}),description:e.msg("greater than",{desc:"Filter expression for greater than comparison"}),tiny:e.msg(">",{desc:"Short form of greater than comparison in filter expression"}),type:["numeric","datetime"],subtype:["ip_address"]},{id:"? >= ?",key:"? >= ?",expression:"? >= ?",name:e.msg("greater than or equal",{desc:"Filter expression for greater than or equal comparison"}),description:e.msg("greater than or equal",{desc:"Filter expression for greater than or equal comparison"}),tiny:e.msg(">=",{desc:"Short form of greater than or equal comparison in filter expression"}),type:["numeric","datetime"],subtype:["ip_address"]},{id:"? between ?",key:"? between ?",expression:"? between ?",name:e.msg("is between",{desc:"Filter expression for between comparison"}),description:e.msg("is between",{desc:"Filter expression for between comparison"}),tiny:e.msg("between",{desc:"Short form of between comparison in filter expression"}),type:[],subtype:["ip_address"]},{id:"last_now",key:"last_now",expression:"last_now",name:e.msg("last (x) periods",{desc:"Filter expression for last (x) periods"}),description:e.msg("last (x) periods",{desc:"Filter expression for last (x) periods"}),tiny:e.msg("last",{desc:"Short form of last (x) periods in filter expression"}),type:["datetime"]},{id:"last_available",key:"last_available",expression:"last_available",name:e.msg("last (x) available periods",{desc:"Filter expression for last (x) available periods"}),description:e.msg("last (x) available periods",{desc:"Filter expression for last (x) available periods"}),tiny:e.msg("last available",{desc:"Short form of last (x) available periods in filter expression"}),type:["datetime"]},{id:"last_completed",key:"last_completed",expression:"last_completed",name:e.msg("last completed period",{desc:"Filter expression for last completed period"}),description:e.msg("last completed (period)",{desc:"Filter expression for last completed period"}),tiny:e.msg("last completed",{desc:"Short form of last completed period in filter expression"}),type:["datetime"]},{id:"next_now",key:"next_now",expression:"next_now",name:e.msg("next (x) periods",{desc:"Filter expression for next (x) periods"}),description:e.msg("next (x) periods",{desc:"Filter expression for next (x) periods"}),tiny:e.msg("next",{desc:"Short form of next (x) periods in filter expression"}),type:["datetime"]},{id:"next_full",key:"next_full",expression:"next_full",name:e.msg("next full (period)",{desc:"Filter expression for next full period"}),description:e.msg("next full (period)",{desc:"Filter expression for next full period"}),tiny:e.msg("next full",{desc:"Short form of next full period in filter expression"}),type:["datetime"]},{id:"WTD",key:"to_date",expression:"to_date",unit:4,name:e.msg("week to date",{desc:"Filter expression for week to date"}),description:e.msg("week to date",{desc:"Filter expression for week to date"}),tiny:e.msg("WTD",{desc:"Short form of week to date in filter expression"}),type:["datetime"]},{id:"MTD",key:"to_date",expression:"to_date",unit:3,name:e.msg("month to date",{desc:"Filter expression for month to date"}),description:e.msg("month to date",{desc:"Filter expression for month to date"}),tiny:e.msg("MTD",{desc:"Short form of month to date in filter expression"}),type:["datetime"]},{id:"QTD",key:"to_date",expression:"to_date",unit:2,name:e.msg("quarter to date",{desc:"Filter expression for quarter to date"}),description:e.msg("quarter to date",{desc:"Filter expression for quarter to date"}),tiny:e.msg("QTD",{desc:"Short form of quarter to date in filter expression"}),type:["datetime"]},{id:"YTD",key:"to_date",expression:"to_date",unit:1,name:e.msg("year to date",{desc:"Filter expression for year to date"}),description:e.msg("year to date",{desc:"Filter expression for year to date"}),tiny:e.msg("YTD",{desc:"Short form of year to date in filter expression"}),type:["datetime"]},{id:"? is null",key:"? is null",expression:"? is null",name:e.msg("is missing",{desc:"Filter expression for is missing"}),description:e.msg("is missing",{desc:"Filter expression for is missing"}),tiny:e.msg("missing",{desc:"Short form of is missing in filter expression"}),type:["numeric","datetime","hierarchy","spatial"],subtype:["ip_address"]},{id:"? is not null",key:"? is not null",expression:"? is not null",name:e.msg("is not missing",{desc:"Filter expression for is not missing"}),description:e.msg("is not missing",{desc:"Filter expression for is not missing"}),tiny:e.msg("not missing",{desc:"Short form of is not missing in filter expression"}),type:["numeric","datetime","hierarchy","spatial"],subtype:["ip_address"]}],u=(a,s,o)=>{const t=new Set(["? in ?","? not in ?"]);return!a&&!s?f():f().filter(i=>(a&&i.type.includes(a)||s&&i.subtype?.includes(s))&&!(o&&t.has(i.key)))},g=":host{font-family:var(--luzmo-font-family)}:host{--var: blue}";var F=Object.defineProperty,b=Object.getOwnPropertyDescriptor,r=(a,s,o,t)=>{for(var i=t>1?void 0:t?b(s,o):s,p=a.length-1,l;p>=0;p--)(l=a[p])&&(i=(t?l(s,o,i):l(i))||i);return t&&i&&F(s,o,i),i};exports.LuzmoFilterExpressionPicker=class extends m.SizedMixin(m.LuzmoElement,{validSizes:Object.values(m.ElementSizes)}){constructor(){super(...arguments),this.language="en",this.hasLabel=!1,this.allowEmpty=!1,this.placeholder="",this.disabled=!1,this.invalid=!1,this.isFormula=!1,this._expressionConfigurations=f()}static get styles(){return[c.unsafeCSS(g)]}_sendChangeEvent(){if(this.disabled)return;const s={expression:this.filter?.expression};this.filter?.parameters?.[1]?.unit&&(s.unit=this.filter?.parameters?.[1]?.unit),this.dispatchEvent(new CustomEvent("expression-selected",{bubbles:!0,composed:!0,cancelable:!0,detail:s}))}setExpression(s){this._richExpression=s?.detail?.value?.[0];const o=this._expressionConfigurations.find(i=>i.id===this._richExpression),t=structuredClone(this.filter);t.expression=o?.expression,o?.unit&&(this._unit=o.unit,t?.parameters[0]&&(t.parameters[1]={unit:this._unit})),this.filter=t,this._sendChangeEvent()}willUpdate(s){const o=s.has("language"),t=s.has("filter"),i=s.has("type"),p=s.has("subtype"),l=s.has("isFormula");o&&this.language!==h.getLocale()&&([...h.targetLocales].includes(this.language??"en")||this.language==="en")&&h.setLocale(this.language);const x=u(this.type,this.subtype,this.isFormula),y=["YTD","QTD","MTD","WTD"];if(this.filter?.expression==="to_date"){const d=this.filter?.parameters[1]?.unit??1;this._unit=d,this._richExpression=y[d-1]??"YTD"}else this._richExpression=this.filter?.expression;(i||p||l||t)&&this.filter&&!this.disabled&&!x?.find(d=>d.expression===this.filter?.expression)?(this.invalid=!0,console.warn(`Warning: ${this.filter?.expression} is not valid given the type: ${this.type} and subtype: ${this.subtype}`)):this.invalid=!1,!this.filter?.expression&&!this.allowEmpty&&(this._richExpression=x?.[0]?.id,this.filter={...this.filter,expression:this._richExpression},this._sendChangeEvent())}render(){const s=u(this.type,this.subtype,this.isFormula)?.map(i=>({value:i.id,label:i.description,shortLabel:i.tiny})),o=this.disabled||!this.filter?.expression&&!this.allowEmpty,t=c.html`<luzmo-field-label
20
+ "use strict";require("@luzmo/lucero/field-label");require("@luzmo/lucero/menu");require("@luzmo/lucero/select");const m=require("lit"),e=require("@lit/localize"),c=require("@luzmo/lucero/utils"),n=require("lit/decorators.js"),h=require("./set-locale-B8iQGfk0.cjs"),f=()=>[{id:"? = ?",key:"? = ?",expression:"? = ?",name:e.msg("equals",{desc:"Filter expression for equals comparison"}),description:e.msg("equals",{desc:"Filter expression for equals comparison"}),tiny:e.msg("eq",{desc:"Short form of equals comparison"}),type:["numeric","hierarchy"],subtype:["ip_address"]},{id:"? != ?",key:"? != ?",expression:"? != ?",name:e.msg("not equals",{desc:"Filter expression for not equals comparison"}),description:e.msg("not equals",{desc:"Filter expression for not equals comparison"}),tiny:e.msg("not eq",{desc:"Short form of not equals comparison"}),type:["numeric","hierarchy"],subtype:["ip_address"]},{id:"? in ?",key:"? in ?",expression:"? in ?",name:e.msg("is in",{desc:"Filter expression for in comparison"}),description:e.msg("is in",{desc:"Filter expression for in comparison"}),tiny:e.msg("is in",{desc:"Filter expression for in comparison"}),type:["numeric","hierarchy"],subtype:["ip_address"]},{id:"? not in ?",key:"? not in ?",expression:"? not in ?",name:e.msg("is not in",{desc:"Filter expression for not in comparison"}),description:e.msg("is not in",{desc:"Filter expression for not in comparison"}),tiny:e.msg("is not in",{desc:"Filter expression for not in comparison"}),type:["numeric","hierarchy"],subtype:["ip_address"]},{id:"? like ?",key:"? like ?",expression:"? like ?",name:e.msg("contains",{desc:"Filter expression for contains comparison"}),description:e.msg("contains",{desc:"Filter expression for contains comparison"}),tiny:e.msg("cont",{desc:"Short form of contains comparison in filter expression"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? not like ?",key:"? not like ?",expression:"? not like ?",name:e.msg("does not contain",{desc:"Filter expression for does not contain comparison"}),description:e.msg("does not contain",{desc:"Filter expression for does not contain comparison"}),tiny:e.msg("not cont",{desc:"Short form of does not contain comparison in filter expression"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? starts with ?",key:"? starts with ?",expression:"? starts with ?",name:e.msg("starts with",{desc:"Filter expression for starts with comparison"}),description:e.msg("starts with",{desc:"Filter expression for starts with comparison"}),tiny:e.msg("starts with",{desc:"Filter expression for starts with comparison"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? not starts with ?",key:"? not starts with ?",expression:"? not starts with ?",name:e.msg("does not start with",{desc:"Filter expression for does not start with comparison"}),description:e.msg("does not start with",{desc:"Filter expression for does not start with comparison"}),tiny:e.msg("not starts with",{desc:"Short form of does not start with comparison in filter expression"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? ends with ?",key:"? ends with ?",expression:"? ends with ?",name:e.msg("ends with",{desc:"Filter expression for ends with comparison"}),description:e.msg("ends with",{desc:"Filter expression for ends with comparison"}),tiny:e.msg("ends with",{desc:"Filter expression for ends with comparison"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? not ends with ?",key:"? not ends with ?",expression:"? not ends with ?",name:e.msg("does not end with",{desc:"Filter expression for does not end with comparison"}),description:e.msg("does not end with",{desc:"Filter expression for does not end with comparison"}),tiny:e.msg("not ends with",{desc:"Short form of does not end with comparison in filter expression"}),type:["hierarchy"],subtype:["ip_address"]},{id:"? < ?",key:"? < ?",expression:"? < ?",name:e.msg("less than",{desc:"Filter expression for less than comparison"}),description:e.msg("less than",{desc:"Filter expression for less than comparison"}),tiny:e.msg("less than",{desc:"Filter expression for less than comparison"}),type:["numeric","datetime"],subtype:["ip_address"]},{id:"? <= ?",key:"? <= ?",expression:"? <= ?",name:e.msg("less than or equal",{desc:"Filter expression for less than or equal comparison"}),description:e.msg("less than or equal",{desc:"Filter expression for less than or equal comparison"}),tiny:e.msg("<=",{desc:"Short form of less than or equal comparison in filter expression"}),type:["numeric","datetime"],subtype:["ip_address"]},{id:"? > ?",key:"? > ?",expression:"? > ?",name:e.msg("greater than",{desc:"Filter expression for greater than comparison"}),description:e.msg("greater than",{desc:"Filter expression for greater than comparison"}),tiny:e.msg(">",{desc:"Short form of greater than comparison in filter expression"}),type:["numeric","datetime"],subtype:["ip_address"]},{id:"? >= ?",key:"? >= ?",expression:"? >= ?",name:e.msg("greater than or equal",{desc:"Filter expression for greater than or equal comparison"}),description:e.msg("greater than or equal",{desc:"Filter expression for greater than or equal comparison"}),tiny:e.msg(">=",{desc:"Short form of greater than or equal comparison in filter expression"}),type:["numeric","datetime"],subtype:["ip_address"]},{id:"? between ?",key:"? between ?",expression:"? between ?",name:e.msg("is between",{desc:"Filter expression for between comparison"}),description:e.msg("is between",{desc:"Filter expression for between comparison"}),tiny:e.msg("between",{desc:"Short form of between comparison in filter expression"}),type:[],subtype:["ip_address"]},{id:"last_now",key:"last_now",expression:"last_now",name:e.msg("last (x) periods",{desc:"Filter expression for last (x) periods"}),description:e.msg("last (x) periods",{desc:"Filter expression for last (x) periods"}),tiny:e.msg("last",{desc:"Short form of last (x) periods in filter expression"}),type:["datetime"]},{id:"last_available",key:"last_available",expression:"last_available",name:e.msg("last (x) available periods",{desc:"Filter expression for last (x) available periods"}),description:e.msg("last (x) available periods",{desc:"Filter expression for last (x) available periods"}),tiny:e.msg("last available",{desc:"Short form of last (x) available periods in filter expression"}),type:["datetime"]},{id:"last_completed",key:"last_completed",expression:"last_completed",name:e.msg("last completed period",{desc:"Filter expression for last completed period"}),description:e.msg("last completed (period)",{desc:"Filter expression for last completed period"}),tiny:e.msg("last completed",{desc:"Short form of last completed period in filter expression"}),type:["datetime"]},{id:"next_now",key:"next_now",expression:"next_now",name:e.msg("next (x) periods",{desc:"Filter expression for next (x) periods"}),description:e.msg("next (x) periods",{desc:"Filter expression for next (x) periods"}),tiny:e.msg("next",{desc:"Short form of next (x) periods in filter expression"}),type:["datetime"]},{id:"more_than_ago",key:"more_than_ago",expression:"more_than_ago",name:e.msg("more than (x) periods ago",{desc:"Filter expression for more than (x) periods ago"}),description:e.msg("more than (x) periods ago",{desc:"Filter expression for more than (x) periods ago"}),tiny:e.msg("more than ago",{desc:"Short form of more than (x) periods ago in filter expression"}),type:["datetime"]},{id:"or_more_ago",key:"or_more_ago",expression:"or_more_ago",name:e.msg("(x) periods or more ago",{desc:"Filter expression for (x) periods or more ago"}),description:e.msg("(x) periods or more ago",{desc:"Filter expression for (x) periods or more ago"}),tiny:e.msg("or more ago",{desc:"Short form of (x) periods or more ago in filter expression"}),type:["datetime"]},{id:"next_full",key:"next_full",expression:"next_full",name:e.msg("next full (period)",{desc:"Filter expression for next full period"}),description:e.msg("next full (period)",{desc:"Filter expression for next full period"}),tiny:e.msg("next full",{desc:"Short form of next full period in filter expression"}),type:["datetime"]},{id:"WTD",key:"to_date",expression:"to_date",unit:4,name:e.msg("week to date",{desc:"Filter expression for week to date"}),description:e.msg("week to date",{desc:"Filter expression for week to date"}),tiny:e.msg("WTD",{desc:"Short form of week to date in filter expression"}),type:["datetime"]},{id:"MTD",key:"to_date",expression:"to_date",unit:3,name:e.msg("month to date",{desc:"Filter expression for month to date"}),description:e.msg("month to date",{desc:"Filter expression for month to date"}),tiny:e.msg("MTD",{desc:"Short form of month to date in filter expression"}),type:["datetime"]},{id:"QTD",key:"to_date",expression:"to_date",unit:2,name:e.msg("quarter to date",{desc:"Filter expression for quarter to date"}),description:e.msg("quarter to date",{desc:"Filter expression for quarter to date"}),tiny:e.msg("QTD",{desc:"Short form of quarter to date in filter expression"}),type:["datetime"]},{id:"YTD",key:"to_date",expression:"to_date",unit:1,name:e.msg("year to date",{desc:"Filter expression for year to date"}),description:e.msg("year to date",{desc:"Filter expression for year to date"}),tiny:e.msg("YTD",{desc:"Short form of year to date in filter expression"}),type:["datetime"]},{id:"? is null",key:"? is null",expression:"? is null",name:e.msg("is missing",{desc:"Filter expression for is missing"}),description:e.msg("is missing",{desc:"Filter expression for is missing"}),tiny:e.msg("missing",{desc:"Short form of is missing in filter expression"}),type:["numeric","datetime","hierarchy","spatial"],subtype:["ip_address"]},{id:"? is not null",key:"? is not null",expression:"? is not null",name:e.msg("is not missing",{desc:"Filter expression for is not missing"}),description:e.msg("is not missing",{desc:"Filter expression for is not missing"}),tiny:e.msg("not missing",{desc:"Short form of is not missing in filter expression"}),type:["numeric","datetime","hierarchy","spatial"],subtype:["ip_address"]}],x=(a,s,o)=>{const t=new Set(["? in ?","? not in ?"]);return!a&&!s?f():f().filter(i=>(a&&i.type.includes(a)||s&&i.subtype?.includes(s))&&!(o&&t.has(i.key)))},g=":host{font-family:var(--luzmo-font-family)}:host{--var: blue}";var F=Object.defineProperty,b=Object.getOwnPropertyDescriptor,r=(a,s,o,t)=>{for(var i=t>1?void 0:t?b(s,o):s,p=a.length-1,l;p>=0;p--)(l=a[p])&&(i=(t?l(s,o,i):l(i))||i);return t&&i&&F(s,o,i),i};exports.LuzmoFilterExpressionPicker=class extends c.SizedMixin(c.LuzmoElement,{validSizes:Object.values(c.ElementSizes)}){constructor(){super(...arguments),this.language="en",this.hasLabel=!1,this.allowEmpty=!1,this.placeholder="",this.disabled=!1,this.invalid=!1,this.isFormula=!1,this._expressionConfigurations=f()}static get styles(){return[m.unsafeCSS(g)]}_sendChangeEvent(){if(this.disabled)return;const s={expression:this.filter?.expression};this.filter?.parameters?.[1]?.unit&&(s.unit=this.filter?.parameters?.[1]?.unit),this.dispatchEvent(new CustomEvent("expression-selected",{bubbles:!0,composed:!0,cancelable:!0,detail:s}))}setExpression(s){this._richExpression=s?.detail?.value?.[0];const o=this._expressionConfigurations.find(i=>i.id===this._richExpression),t=structuredClone(this.filter);t.expression=o?.expression,o?.unit&&(this._unit=o.unit,t?.parameters[0]&&(t.parameters[1]={unit:this._unit})),this.filter=t,this._sendChangeEvent()}willUpdate(s){const o=s.has("language"),t=s.has("filter"),i=s.has("type"),p=s.has("subtype"),l=s.has("isFormula");o&&this.language!==h.getLocale()&&([...h.targetLocales].includes(this.language??"en")||this.language==="en")&&h.setLocale(this.language);const u=x(this.type,this.subtype,this.isFormula),y=["YTD","QTD","MTD","WTD"];if(this.filter?.expression==="to_date"){const d=this.filter?.parameters[1]?.unit??1;this._unit=d,this._richExpression=y[d-1]??"YTD"}else this._richExpression=this.filter?.expression;(i||p||l||t)&&this.filter&&!this.disabled&&!u?.find(d=>d.expression===this.filter?.expression)?(this.invalid=!0,console.warn(`Warning: ${this.filter?.expression} is not valid given the type: ${this.type} and subtype: ${this.subtype}`)):this.invalid=!1,!this.filter?.expression&&!this.allowEmpty&&(this._richExpression=u?.[0]?.id,this.filter={...this.filter,expression:this._richExpression},this._sendChangeEvent())}render(){const s=x(this.type,this.subtype,this.isFormula)?.map(i=>({value:i.id,label:i.description,shortLabel:i.tiny})),o=this.disabled||!this.filter?.expression&&!this.allowEmpty,t=m.html`<luzmo-field-label
21
21
  for="expression"
22
22
  size=${this.size}
23
23
  >${this.label??e.msg("Select an expression",{desc:"Label for expression picker"})}</luzmo-field-label
24
- >`;return c.html`${this.hasLabel?t:""}
24
+ >`;return m.html`${this.hasLabel?t:""}
25
25
  <luzmo-select
26
26
  label=${this.placeholder??e.msg("Select...")}
27
27
  id="expression"
@@ -35,4 +35,4 @@
35
35
  .value=${[this._richExpression]}
36
36
  @change=${this.setExpression}
37
37
  >
38
- </luzmo-select>`}};r([n.property({type:String,reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"language",2);r([n.property({type:String,reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"filter",2);r([n.property({type:Boolean,attribute:"has-label",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"hasLabel",2);r([n.property({type:String,reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"label",2);r([n.property({type:Boolean,attribute:"allow-empty",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"allowEmpty",2);r([n.property({type:String,attribute:"placeholder",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"placeholder",2);r([n.property({type:Boolean,attribute:"disabled",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"disabled",2);r([n.property({type:String,attribute:"type",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"type",2);r([n.property({type:String,attribute:"subtype",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"subtype",2);r([n.property({type:Boolean,attribute:"invalid",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"invalid",2);r([n.property({type:Boolean,attribute:"is-formula",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"isFormula",2);r([n.state()],exports.LuzmoFilterExpressionPicker.prototype,"_richExpression",2);r([n.state()],exports.LuzmoFilterExpressionPicker.prototype,"_unit",2);exports.LuzmoFilterExpressionPicker=r([e.localized()],exports.LuzmoFilterExpressionPicker);customElements.get("luzmo-filter-expression-picker")||customElements.define("luzmo-filter-expression-picker",exports.LuzmoFilterExpressionPicker);exports.getValidExpressions=u;
38
+ </luzmo-select>`}};r([n.property({type:String,reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"language",2);r([n.property({type:String,reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"filter",2);r([n.property({type:Boolean,attribute:"has-label",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"hasLabel",2);r([n.property({type:String,reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"label",2);r([n.property({type:Boolean,attribute:"allow-empty",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"allowEmpty",2);r([n.property({type:String,attribute:"placeholder",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"placeholder",2);r([n.property({type:Boolean,attribute:"disabled",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"disabled",2);r([n.property({type:String,attribute:"type",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"type",2);r([n.property({type:String,attribute:"subtype",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"subtype",2);r([n.property({type:Boolean,attribute:"invalid",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"invalid",2);r([n.property({type:Boolean,attribute:"is-formula",reflect:!0})],exports.LuzmoFilterExpressionPicker.prototype,"isFormula",2);r([n.state()],exports.LuzmoFilterExpressionPicker.prototype,"_richExpression",2);r([n.state()],exports.LuzmoFilterExpressionPicker.prototype,"_unit",2);exports.LuzmoFilterExpressionPicker=r([e.localized()],exports.LuzmoFilterExpressionPicker);customElements.get("luzmo-filter-expression-picker")||customElements.define("luzmo-filter-expression-picker",exports.LuzmoFilterExpressionPicker);exports.getValidExpressions=x;