@luzmo/analytics-components-kit 1.0.1-alpha.39 → 1.0.1-alpha.40

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 (57) hide show
  1. package/components/bliss-DQej6Odb.cjs +20 -0
  2. package/components/bliss-Da17RL_E.js +80 -0
  3. package/components/classic-CW66MgMj.cjs +20 -0
  4. package/components/classic-DSp70wnP.js +86 -0
  5. package/components/classic-dark-DCtf8kpl.cjs +20 -0
  6. package/components/classic-dark-o89nk6Bo.js +77 -0
  7. package/components/default-DBxqR7y5.js +84 -0
  8. package/components/default-DcRD5JRU.cjs +20 -0
  9. package/components/default-dark-1299UcUs.cjs +20 -0
  10. package/components/default-dark-IedybpaJ.js +84 -0
  11. package/components/draggable-data-item-level/index.cjs +1 -1
  12. package/components/draggable-data-item-level/index.js +1 -1
  13. package/components/droppable-slot/index.cjs +1 -1
  14. package/components/droppable-slot/index.js +1 -1
  15. package/components/filter-item/index.cjs +1 -1
  16. package/components/filter-item/index.js +1 -1
  17. package/components/filter-value-picker-hierarchy/index.cjs +1 -1
  18. package/components/filter-value-picker-hierarchy/index.js +1 -2
  19. package/components/filter-value-picker-numeric/index.cjs +1 -1
  20. package/components/filter-value-picker-numeric/index.js +1 -1
  21. package/components/grid/grid.d.ts +5 -1
  22. package/components/grid/index.cjs +46 -45
  23. package/components/grid/index.js +1217 -1193
  24. package/components/index.cjs +1 -1
  25. package/components/index.js +7 -6
  26. package/components/orion-CfUR1e5D.cjs +20 -0
  27. package/components/orion-DiAhsMdg.js +74 -0
  28. package/components/pinky-Cb0md2xU.js +72 -0
  29. package/components/pinky-DptTgIM4.cjs +20 -0
  30. package/components/radiant-C6fqp6jv.js +75 -0
  31. package/components/radiant-Dv7GVveL.cjs +20 -0
  32. package/components/royale-CmXiODck.js +66 -0
  33. package/components/royale-Ooq8M7Ef.cjs +20 -0
  34. package/components/seasonal-9pbLR3XJ.js +80 -0
  35. package/components/seasonal-OSKpFyta.cjs +20 -0
  36. package/components/slot-menu-list/index.cjs +1 -1
  37. package/components/slot-menu-list/index.js +3 -3
  38. package/components/urban-BLQl5Oye.cjs +20 -0
  39. package/components/urban-CZ4PAlar.js +77 -0
  40. package/components/utils-B1rr30GZ.js +60 -0
  41. package/components/utils-CvCeHVBQ.cjs +20 -0
  42. package/components/utils.cjs +1 -1
  43. package/components/utils.js +9 -8
  44. package/components/vivid-B-cgSae_.js +76 -0
  45. package/components/vivid-BpRn83MR.cjs +20 -0
  46. package/item-definitions/marker-map/marker-map-options.config.d.ts +1 -1
  47. package/package.json +1 -1
  48. package/utils/index.d.ts +1 -1
  49. package/utils/themes/index.d.ts +3 -508
  50. package/utils/themes/utils.d.ts +1 -0
  51. package/components/get-css-variable-BEYG097C.js +0 -1446
  52. package/components/get-css-variable-BZxY4IOa.cjs +0 -35
  53. package/components/grid/default-actions.d.ts +0 -14
  54. package/components/index-CcLRp9ao.js +0 -1685
  55. package/components/index-CpGRysX_.js +0 -691
  56. package/components/index-DFHExzGq.cjs +0 -20
  57. package/components/index-GgkqKtE6.cjs +0 -20
@@ -17,18 +17,18 @@
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 Ln=Object.defineProperty;var In=(s,e,t)=>e in s?Ln(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var ii=(s,e,t)=>In(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../property-BCb4Kybn.cjs"),st=require("../state-BxZEcclm.cjs"),jt=require("../query-D5qWDopr.cjs"),Me=require("../luzmo-icons-DAsjNJNI.cjs");require("../index-C2PPSv8E.cjs");require("../index-CnpJUw_z.cjs");require("../index-DSQyBS9Z.cjs");const Mr=require("../base-D76d76ww-tT6yr8eb.cjs");require("../focusable-BxtpnzWp-CkK9AeMt.cjs");const Nn=require("../query-all-CR2wWKRD.cjs"),Tn=require("../item-list.cjs"),ge=require("../set-locale-Cam8nRIW.cjs"),Hn=require("../localized-decorator-SOrjcPab.cjs");require("../index-CAJRL5rT.cjs");const yi=Math.min,qe=Math.max,It=Math.round,xt=Math.floor,ye=s=>({x:s,y:s}),On={left:"right",right:"left",bottom:"top",top:"bottom"},Pn={start:"end",end:"start"};function Ii(s,e){return typeof s=="function"?s(e):s}function Je(s){return s.split("-")[0]}function qt(s){return s.split("-")[1]}function $n(s){return s==="x"?"y":"x"}function kr(s){return s==="y"?"height":"width"}function Oe(s){return["top","bottom"].includes(Je(s))?"y":"x"}function Rr(s){return $n(Oe(s))}function Bn(s,e,t){t===void 0&&(t=!1);const i=qt(s),r=Rr(s),n=kr(r);let o=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(o=Nt(o)),[o,Nt(o)]}function Wn(s){const e=Nt(s);return[vi(s),e,vi(e)]}function vi(s){return s.replace(/start|end/g,e=>Pn[e])}function Fn(s,e,t){const i=["left","right"],r=["right","left"],n=["top","bottom"],o=["bottom","top"];switch(s){case"top":case"bottom":return t?e?r:i:e?i:r;case"left":case"right":return e?n:o;default:return[]}}function Gn(s,e,t,i){const r=qt(s);let n=Fn(Je(s),t==="start",i);return r&&(n=n.map(o=>o+"-"+r),e&&(n=n.concat(n.map(vi)))),n}function Nt(s){return s.replace(/left|right|bottom|top/g,e=>On[e])}function Un(s){return{top:0,right:0,bottom:0,left:0,...s}}function jn(s){return typeof s!="number"?Un(s):{top:s,right:s,bottom:s,left:s}}function Tt(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 Ki(s,e,t){let{reference:i,floating:r}=s;const n=Oe(e),o=Rr(e),a=kr(o),l=Je(e),c=n==="y",d=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,u=i[a]/2-r[a]/2;let g;switch(l){case"top":g={x:d,y:i.y-r.height};break;case"bottom":g={x:d,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:h};break;case"left":g={x:i.x-r.width,y:h};break;default:g={x:i.x,y:i.y}}switch(qt(e)){case"start":g[o]-=u*(t&&c?-1:1);break;case"end":g[o]+=u*(t&&c?-1:1);break}return g}const qn=async(s,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:n=[],platform:o}=t,a=n.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:s,floating:e,strategy:r}),{x:d,y:h}=Ki(c,i,l),u=i,g={},m=0;for(let b=0;b<a.length;b++){const{name:y,fn:w}=a[b],{x:_,y:x,data:R,reset:S}=await w({x:d,y:h,initialPlacement:i,placement:u,strategy:r,middlewareData:g,rects:c,platform:o,elements:{reference:s,floating:e}});d=_??d,h=x??h,g={...g,[y]:{...g[y],...R}},S&&m<=50&&(m++,typeof S=="object"&&(S.placement&&(u=S.placement),S.rects&&(c=S.rects===!0?await o.getElementRects({reference:s,floating:e,strategy:r}):S.rects),{x:d,y:h}=Ki(c,u,l)),b=-1)}return{x:d,y:h,placement:u,strategy:r,middlewareData:g}};async function Vn(s,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:n,rects:o,elements:a,strategy:l}=s,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:u=!1,padding:g=0}=Ii(e,s),m=jn(g),y=a[u?h==="floating"?"reference":"floating":h],w=Tt(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(y)))==null||t?y:y.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),_=h==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,x=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),R=await(n.isElement==null?void 0:n.isElement(x))?await(n.getScale==null?void 0:n.getScale(x))||{x:1,y:1}:{x:1,y:1},S=Tt(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:x,strategy:l}):_);return{top:(w.top-S.top+m.top)/R.y,bottom:(S.bottom-w.bottom+m.bottom)/R.y,left:(w.left-S.left+m.left)/R.x,right:(S.right-w.right+m.right)/R.x}}const Yn=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,i;const{placement:r,middlewareData:n,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:u,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:b=!0,...y}=Ii(s,e);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const w=Je(r),_=Oe(a),x=Je(a)===a,R=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=u||(x||!b?[Nt(a)]:Wn(a)),O=m!=="none";!u&&O&&S.push(...Gn(a,b,m,R));const P=[a,...S],N=await Vn(e,y),G=[];let $=((i=n.flip)==null?void 0:i.overflows)||[];if(d&&G.push(N[w]),h){const I=Bn(r,o,R);G.push(N[I[0]],N[I[1]])}if($=[...$,{placement:r,overflows:G}],!G.every(I=>I<=0)){var ue,W;const I=(((ue=n.flip)==null?void 0:ue.index)||0)+1,me=P[I];if(me&&(!(h==="alignment"?_!==Oe(me):!1)||$.every(Z=>Z.overflows[0]>0&&Oe(Z.placement)===_)))return{data:{index:I,overflows:$},reset:{placement:me}};let V=(W=$.filter(fe=>fe.overflows[0]<=0).sort((fe,Z)=>fe.overflows[1]-Z.overflows[1])[0])==null?void 0:W.placement;if(!V)switch(g){case"bestFit":{var oe;const fe=(oe=$.filter(Z=>{if(O){const ae=Oe(Z.placement);return ae===_||ae==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(ae=>ae>0).reduce((ae,Ie)=>ae+Ie,0)]).sort((Z,ae)=>Z[1]-ae[1])[0])==null?void 0:oe[0];fe&&(V=fe);break}case"initialPlacement":V=a;break}if(r!==V)return{reset:{placement:V}}}return{}}}};async function Xn(s,e){const{placement:t,platform:i,elements:r}=s,n=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Je(t),a=qt(t),l=Oe(t)==="y",c=["left","top"].includes(o)?-1:1,d=n&&l?-1:1,h=Ii(e,s);let{mainAxis:u,crossAxis:g,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof m=="number"&&(g=a==="end"?m*-1:m),l?{x:g*d,y:u*c}:{x:u*c,y:g*d}}const Kn=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,i;const{x:r,y:n,placement:o,middlewareData:a}=e,l=await Xn(e,s);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:n+l.y,data:{...l,placement:o}}}}};function Vt(){return typeof window<"u"}function rt(s){return Sr(s)?(s.nodeName||"").toLowerCase():"#document"}function ie(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function we(s){var e;return(e=(Sr(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function Sr(s){return Vt()?s instanceof Node||s instanceof ie(s).Node:!1}function de(s){return Vt()?s instanceof Element||s instanceof ie(s).Element:!1}function ve(s){return Vt()?s instanceof HTMLElement||s instanceof ie(s).HTMLElement:!1}function Ji(s){return!Vt()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof ie(s).ShadowRoot}function bt(s){const{overflow:e,overflowX:t,overflowY:i,display:r}=ce(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function Jn(s){return["table","td","th"].includes(rt(s))}function Yt(s){return[":popover-open",":modal"].some(e=>{try{return s.matches(e)}catch{return!1}})}function Ni(s){const e=Ti(),t=de(s)?ce(s):s;return["transform","translate","scale","rotate","perspective"].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)||["transform","translate","scale","rotate","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function Zn(s){let e=Re(s);for(;ve(e)&&!Ze(e);){if(Ni(e))return e;if(Yt(e))return null;e=Re(e)}return null}function Ti(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ze(s){return["html","body","#document"].includes(rt(s))}function ce(s){return ie(s).getComputedStyle(s)}function Xt(s){return de(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function Re(s){if(rt(s)==="html")return s;const e=s.assignedSlot||s.parentNode||Ji(s)&&s.host||we(s);return Ji(e)?e.host:e}function Ar(s){const e=Re(s);return Ze(e)?s.ownerDocument?s.ownerDocument.body:s.body:ve(e)&&bt(e)?e:Ar(e)}function ht(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Ar(s),n=r===((i=s.ownerDocument)==null?void 0:i.body),o=ie(r);if(n){const a=wi(o);return e.concat(o,o.visualViewport||[],bt(r)?r:[],a&&t?ht(a):[])}return e.concat(r,ht(r,[],t))}function wi(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function Cr(s){const e=ce(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=ve(s),n=r?s.offsetWidth:t,o=r?s.offsetHeight:i,a=It(t)!==n||It(i)!==o;return a&&(t=n,i=o),{width:t,height:i,$:a}}function Hi(s){return de(s)?s:s.contextElement}function Ve(s){const e=Hi(s);if(!ve(e))return ye(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:n}=Cr(e);let o=(n?It(t.width):t.width)/i,a=(n?It(t.height):t.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Qn=ye(0);function Dr(s){const e=ie(s);return!Ti()||!e.visualViewport?Qn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function eo(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==ie(s)?!1:e}function $e(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=s.getBoundingClientRect(),n=Hi(s);let o=ye(1);e&&(i?de(i)&&(o=Ve(i)):o=Ve(s));const a=eo(n,t,i)?Dr(n):ye(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,d=r.width/o.x,h=r.height/o.y;if(n){const u=ie(n),g=i&&de(i)?ie(i):i;let m=u,b=wi(m);for(;b&&i&&g!==m;){const y=Ve(b),w=b.getBoundingClientRect(),_=ce(b),x=w.left+(b.clientLeft+parseFloat(_.paddingLeft))*y.x,R=w.top+(b.clientTop+parseFloat(_.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,h*=y.y,l+=x,c+=R,m=ie(b),b=wi(m)}}return Tt({width:d,height:h,x:l,y:c})}function Oi(s,e){const t=Xt(s).scrollLeft;return e?e.left+t:$e(we(s)).left+t}function Lr(s,e,t){t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=i.left+e.scrollLeft-(t?0:Oi(s,i)),n=i.top+e.scrollTop;return{x:r,y:n}}function to(s){let{elements:e,rect:t,offsetParent:i,strategy:r}=s;const n=r==="fixed",o=we(i),a=e?Yt(e.floating):!1;if(i===o||a&&n)return t;let l={scrollLeft:0,scrollTop:0},c=ye(1);const d=ye(0),h=ve(i);if((h||!h&&!n)&&((rt(i)!=="body"||bt(o))&&(l=Xt(i)),ve(i))){const g=$e(i);c=Ve(i),d.x=g.x+i.clientLeft,d.y=g.y+i.clientTop}const u=o&&!h&&!n?Lr(o,l,!0):ye(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+u.x,y:t.y*c.y-l.scrollTop*c.y+d.y+u.y}}function io(s){return Array.from(s.getClientRects())}function so(s){const e=we(s),t=Xt(s),i=s.ownerDocument.body,r=qe(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),n=qe(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+Oi(s);const a=-t.scrollTop;return ce(i).direction==="rtl"&&(o+=qe(e.clientWidth,i.clientWidth)-r),{width:r,height:n,x:o,y:a}}function ro(s,e){const t=ie(s),i=we(s),r=t.visualViewport;let n=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){n=r.width,o=r.height;const c=Ti();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:n,height:o,x:a,y:l}}function no(s,e){const t=$e(s,!0,e==="fixed"),i=t.top+s.clientTop,r=t.left+s.clientLeft,n=ve(s)?Ve(s):ye(1),o=s.clientWidth*n.x,a=s.clientHeight*n.y,l=r*n.x,c=i*n.y;return{width:o,height:a,x:l,y:c}}function Zi(s,e,t){let i;if(e==="viewport")i=ro(s,t);else if(e==="document")i=so(we(s));else if(de(e))i=no(e,t);else{const r=Dr(s);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Tt(i)}function Ir(s,e){const t=Re(s);return t===e||!de(t)||Ze(t)?!1:ce(t).position==="fixed"||Ir(t,e)}function oo(s,e){const t=e.get(s);if(t)return t;let i=ht(s,[],!1).filter(a=>de(a)&&rt(a)!=="body"),r=null;const n=ce(s).position==="fixed";let o=n?Re(s):s;for(;de(o)&&!Ze(o);){const a=ce(o),l=Ni(o);!l&&a.position==="fixed"&&(r=null),(n?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||bt(o)&&!l&&Ir(s,o))?i=i.filter(d=>d!==o):r=a,o=Re(o)}return e.set(s,i),i}function ao(s){let{element:e,boundary:t,rootBoundary:i,strategy:r}=s;const o=[...t==="clippingAncestors"?Yt(e)?[]:oo(e,this._c):[].concat(t),i],a=o[0],l=o.reduce((c,d)=>{const h=Zi(e,d,r);return c.top=qe(h.top,c.top),c.right=yi(h.right,c.right),c.bottom=yi(h.bottom,c.bottom),c.left=qe(h.left,c.left),c},Zi(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function lo(s){const{width:e,height:t}=Cr(s);return{width:e,height:t}}function co(s,e,t){const i=ve(e),r=we(e),n=t==="fixed",o=$e(s,!0,n,e);let a={scrollLeft:0,scrollTop:0};const l=ye(0);function c(){l.x=Oi(r)}if(i||!i&&!n)if((rt(e)!=="body"||bt(r))&&(a=Xt(e)),i){const g=$e(e,!0,n,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else r&&c();n&&!i&&r&&c();const d=r&&!i&&!n?Lr(r,a):ye(0),h=o.left+a.scrollLeft-l.x-d.x,u=o.top+a.scrollTop-l.y-d.y;return{x:h,y:u,width:o.width,height:o.height}}function si(s){return ce(s).position==="static"}function Qi(s,e){if(!ve(s)||ce(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return we(s)===t&&(t=t.ownerDocument.body),t}function Nr(s,e){const t=ie(s);if(Yt(s))return t;if(!ve(s)){let r=Re(s);for(;r&&!Ze(r);){if(de(r)&&!si(r))return r;r=Re(r)}return t}let i=Qi(s,e);for(;i&&Jn(i)&&si(i);)i=Qi(i,e);return i&&Ze(i)&&si(i)&&!Ni(i)?t:i||Zn(s)||t}const ho=async function(s){const e=this.getOffsetParent||Nr,t=this.getDimensions,i=await t(s.floating);return{reference:co(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function uo(s){return ce(s).direction==="rtl"}const mo={convertOffsetParentRelativeRectToViewportRelativeRect:to,getDocumentElement:we,getClippingRect:ao,getOffsetParent:Nr,getElementRects:ho,getClientRects:io,getDimensions:lo,getScale:Ve,isElement:de,isRTL:uo};function Tr(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function fo(s,e){let t=null,i;const r=we(s);function n(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),n();const c=s.getBoundingClientRect(),{left:d,top:h,width:u,height:g}=c;if(a||e(),!u||!g)return;const m=xt(h),b=xt(r.clientWidth-(d+u)),y=xt(r.clientHeight-(h+g)),w=xt(d),x={rootMargin:-m+"px "+-b+"px "+-y+"px "+-w+"px",threshold:qe(0,yi(1,l))||1};let R=!0;function S(O){const P=O[0].intersectionRatio;if(P!==l){if(!R)return o();P?o(!1,P):i=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!Tr(c,s.getBoundingClientRect())&&o(),R=!1}try{t=new IntersectionObserver(S,{...x,root:r.ownerDocument})}catch{t=new IntersectionObserver(S,x)}t.observe(s)}return o(!0),n}function es(s,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:n=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=Hi(s),d=r||n?[...c?ht(c):[],...ht(e)]:[];d.forEach(w=>{r&&w.addEventListener("scroll",t,{passive:!0}),n&&w.addEventListener("resize",t)});const h=c&&a?fo(c,t):null;let u=-1,g=null;o&&(g=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(e)})),t()}),c&&!l&&g.observe(c),g.observe(e));let m,b=l?$e(s):null;l&&y();function y(){const w=$e(s);b&&!Tr(b,w)&&t(),b=w,m=requestAnimationFrame(y)}return t(),()=>{var w;d.forEach(_=>{r&&_.removeEventListener("scroll",t),n&&_.removeEventListener("resize",t)}),h==null||h(),(w=g)==null||w.disconnect(),g=null,l&&cancelAnimationFrame(m)}}const ts=Kn,is=Yn,ss=(s,e,t)=>{const i=new Map,r={platform:mo,...t},n={...r.platform,_c:i};return qn(s,e,{...r,platform:n})},Pi=(s,e)=>{let t="The dashboard component encountered an error";typeof(e==null?void 0:e.dashboardId)=="string"&&(t+=` for dashboard with id ${e.dashboardId}`),typeof(e==null?void 0:e.dashboardSlug)=="string"&&(t+=` for dashboard with slug ${e.dashboardSlug}`),typeof(e==null?void 0:e.container)=="string"&&(t+=` in container ${e.container}`),s&&(t+=`:
21
- ${s}`,console.warn(t))},go=s=>{let e=!1,t="";const r=(document.body||document.documentElement).style,n={svg:!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:r.webkitFlexWrap===""||r.flexWrap==="",postMessage:!!window.postMessage},o=["svg","flexbox","postMessage"];for(const d of o)n[d]||(e=!0,s.browserNotSupported=s.browserNotSupported||[],s.browserNotSupported.push(d),t+=`Your browser does not support: ${d}
22
- `);const a=window.navigator.userAgent,l=a.includes("MSIE"),c=a.includes("Trident/");(l||c)&&(e=!0,t="IE is not supported."),e&&Pi(t)},ne={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},Hr=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}],rs={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement...",de:"Initialisiere...",es:"Inicializando..."}},lt=s=>s?s.endsWith("/")?s:`${s}/`:"",Ee=s=>s?s.endsWith("/")?s.slice(0,-1):s:"",po=(s,e,t,i)=>{var a;const r=(l,c)=>{var b;const d=l.users.find(y=>y.id===c.id),h=d&&d.userAccessRight?{flagRead:d.userAccessRight.flagRead,flagUse:d.userAccessRight.flagUse,flagModify:d.userAccessRight.flagModify,flagOwn:d.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},g=l.groups.filter(y=>c.userGroups.includes(y.id)||y.public===!0).map(y=>{if(y.groupAccessRight)return y.groupAccessRight});for(const y of g)!h.flagRead&&y.flagRead&&(h.flagRead=y.flagRead),!h.flagUse&&y.flagUse&&(h.flagUse=y.flagUse),!h.flagModify&&y.flagModify&&(h.flagModify=y.flagModify),!h.flagOwn&&y.flagOwn&&(h.flagOwn=y.flagOwn);const m=((b=l.integrations)==null?void 0:b.length)>0?l.integrations.map(y=>{if(y.integrationAccessRight)return y.integrationAccessRight}):[];for(const y of m)!h.flagRead&&y.flagRead&&(h.flagRead=y.flagRead),!h.flagUse&&y.flagUse&&(h.flagUse=y.flagUse),!h.flagModify&&y.flagModify&&(h.flagModify=y.flagModify);return h},n=(l,c)=>{if(l==null)return"";if(typeof l!="object"||Object.keys(l).length===0)return typeof l=="object"&&Object.keys(l).length===0?"":l;let d;return d=c&&l[c]?l[c]:l[Object.keys(l)[0]],d==null&&(d=""),d},o=[];for(const l of s){const c={accessibleBy:[],accessRights:r(l,t),id:l.id,modifiedAt:l.modified_at,name:n(l.name,i.language),slug:null,tags:l.tags.map(m=>m.tag).sort((m,b)=>m.localeCompare(b))},d=l.integrations.find(m=>m.id===e);(a=d==null?void 0:d.integrationAccessRight)!=null&&a.slug&&(c.slug=d.integrationAccessRight.slug);const h=l.users.map(m=>({model:"User",id:m.id,name:n(m.name,t.locale_id)})),u=l.groups.map(m=>({model:"Group",id:m.id,name:n(m.name,t.locale_id)||{}})),g=l.integrations.map(m=>({model:"Integration",id:m.id,name:n(m.name,t.locale_id)||{}}));c.accessibleBy=[...h,...u,...g],o.push(c)}return o},bo="0.0.0-unknown-luzmo",yo=s=>{const e=/^(%20|\s)*(javascript|data)/im,t=/[^\u0020-\u007E]/gim,i=/^([^:]+):/gm,r=new Set([".","/"]),n=c=>r.has(c[0]);if(!s)return"about:blank";const o=s.replaceAll(t,"").trim();if(n(o))return o;const a=o.match(i);if(!a)return o;const l=a[0];return e.test(l)?"about:blank":o},ns=s=>JSON.parse(JSON.stringify(s)),vo=s=>s&&typeof s=="object",_i=(s,e)=>(Object.entries(e).forEach(([t,i])=>{t in s?s[t]===void 0?s[t]=i:s[t]=vo(i)?_i(s[t],i):s[t]:s[t]=i}),s),We=()=>"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)}),os=s=>{const e=[],{appServer:t,language:i,editorLanguage:r,qeVersion:n,loaderBackground:o,loaderSpinnerColor:a,loaderSpinnerBackground:l,loaderFontColor:c,screenMode:d,key:h,token:u,timezoneId:g,itemEmbedding:m,itemDimensions:b,dashboardId:y,dashboardSlug:w,itemId:_,theme:x,mainColor:R,accentColor:S,editMode:O}=s.params;i&&i!=="auto"&&e.push(`language=${i}`),r&&r!=="auto"&&e.push(`editorLanguage=${r}`),n&&e.push(`qe_version=${n}`),o&&e.push(`ldrbg=${o}`),c&&e.push(`ldrftclr=${c}`),a&&e.push(`ldrspclr=${a}`),l&&e.push(`ldrspbg=${l}`),x&&e.push(`theme=${x}`),R&&e.push(`mainColor=${R}`),S&&e.push(`accentColor=${S}`),d&&d!=="auto"&&e.push("screenMode=&{screenMode}"),g&&e.push("timezoneId="+g),m&&b&&b.width&&e.push("width="+b.width),m&&b&&b.height&&e.push("height="+b.height),O&&e.push("editMode="+O);const P=h&&u?"#"+h+":"+u:"";e.push("version="+(s.libVersion||bo));const N=m?`${t}i/${y||w}/${_}?${encodeURIComponent(e.join("&"))}${P}`:`${t}i/${y||w}?${encodeURIComponent(e.join("&"))}${P}`;return yo(N)},as=s=>{let e;(s.params.error||s.browserNotSupported.length>0)&&(s.params.error=!0,s.browserNotSupported&&(e="Browser is not supported."));const t=rs.initializing[s.params.language]||rs.initializing.en;return s.browserNotSupported||s.params.error?{loadingMsg:t,errorMsg:e}:{loadingMsg:t,errorMsg:""}};function Ne(s,e,t){s.promises[e]&&(s.promises[e].resolve(t),delete s.promises[e])}function Et(s,e,t){s.promises[e]&&(s.promises[e].reject(t),delete s.promises[e])}function Or(s){const e={};return s.params.loaderBackground&&!s.iframeLoaded&&(e.background=s.params.loaderBackground),e}function wo(s){var r;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||ne.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto";return{display:s.iframeLoaded?"none":"",height:`${t?e:s.minHeight}px`}}function _o(s){var t,i;const e=s.params.loaderBackground||ne.loaderBackground;if(s.params.itemEmbedding){s.loaderSize=24,s.borderWidth=4,s.minHeight=200;const r=((t=s.params.itemDimensions)==null?void 0:t.width)||ne.itemDimensions.width,n=((i=s.params.itemDimensions)==null?void 0:i.height)||ne.itemDimensions.height,o=r!=="auto",a=n!=="auto";return{background:e,width:o?`${r}px`:"100%",height:`${a?n:"200"}px`,"min-height":a?"":"200px"}}return{background:e}}function xo(s){const{loaderSpinnerColor:e,loaderSpinnerBackground:t}=ne,i=ds(s.borderWidth,s.params.loaderSpinnerColor||e),r=ds(s.borderWidth,s.params.loaderSpinnerBackground||t),n=`${s.loaderSize}px`;return{"border-top":i,"border-right":i,"border-bottom":r,"border-left":r,width:n,height:n}}function Eo(s){var n;const e=((n=s.params.itemDimensions)==null?void 0:n.height)||ne.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 ls(s){var r,n;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||ne.itemDimensions.height,t=((n=s.params.itemDimensions)==null?void 0:n.width)||ne.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 ds(s,e){return`${s}px solid ${e}`}const zo=(s,e)=>{s!=null&&s.contentWindow&&s.contentWindow.location.replace(e)},cs=(s,e,t)=>{const i=We();return e!=null&&e.contentWindow?(e.contentWindow.postMessage({action:"exportDashboard",format:t||"png",_version:s.libVersion,requestId:i},"*"),new Promise((r,n)=>{s.promises[i]={resolve:r,reject:n},setTimeout(()=>{if(s.promises[i]){const o="exportDashboard request timed out.";s.promises[i].reject(new Error(o)),delete s.promises[i]}},12e5)})):Promise.reject(new Error("Cannot retrieve contentWindow."))},Mo=async s=>{if(await s.updateComplete,(s.currentAuthKey??s.authKey)&&(s.currentAuthToken??s.authToken)){const e=new Promise((t,i)=>{(()=>{try{window.fetch(`${lt(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(n=>n.json()).then(n=>{!n||!n.rows||n.rows.length===0||!n.rows[0].user?i("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com."):(n.rows[0].user.userGroups=n.rows[0].user.groups.map(o=>o.id),delete n.rows[0].user.groups,t({integrationId:n.rows[0].integration_id,user:n.rows[0].user}))})}catch(r){i(r)}})()});return new Promise((t,i)=>void(()=>{try{e.then(r=>{window.fetch(`${lt(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(o=>o.json()).then(o=>{const a=o.rows.length>0?po(o.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.")},ko=(s,e,t)=>{if(e!=null&&e.contentWindow){const i=We();return e.contentWindow.postMessage({action:"getData",id:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,n)=>{s.promises[i]={resolve:r,reject:n},setTimeout(()=>{if(s.promises[i]){const o="getData request timed out.";s.promises[i].reject(new Error(o)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Ro=(s,e)=>{if(e!=null&&e.contentWindow){const t=We();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 n="getFilters request timed out.";s.promises[t].reject(new Error(n)),delete s.promises[t]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},hs=(s,e,t)=>e?(e.contentWindow.postMessage({action:"refreshData",id:t??null,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),So=(s,e)=>e?(e.contentWindow.postMessage({action:"reloadDashboard",_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),Ao=(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.")),Co=(s,e,t)=>{if(e&&e.contentWindow){const i=We();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,n)=>{s.promises[i]={resolve:r,reject:n}}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Do=(s,e,t,i)=>{if(e){const r=We();return e.contentWindow.postMessage({action:"setSelectedData",itemId:t,filters:i,_version:s.libVersion,requestId:r},"*"),new Promise((n,o)=>{s.promises[r]={resolve:n,reject:o},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()},Lo=(s,e,t)=>{if(e){const i=We();return e.contentWindow.postMessage({action:"setPreview",preview:t,requestId:i,_version:s.libVersion},"*"),new Promise((r,n)=>{s.promises[i]={resolve:r,reject:n},setTimeout(()=>{if(s.promises[i]){const o="setPreview request timed out.";s.promises[i].reject(new Error(o)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},dt=s=>{var l,c,d,h,u,g,m,b;if(!s.dimensions){s.params.error=!0,Pi("Got no valid dimensions.",s.params);return}const e=Object.keys(s.dimensions),t=[];let i,r=0,n=0;if(!s.params.switchScreenModeOnResize&&s.currentScreenMode&&(s.params.screenMode=s.currentScreenMode),s.dimensions&&(e==null?void 0:e[0])==="fixed")i="fixed",r=s.dimensions.fixed[0],n=s.dimensions.fixed[1];else{const y=["mobile","tablet","desktop","largeScreen"];if(s.params.itemEmbedding){const[w]=e;let _=ns(w);for(const x of y){const R=e.find(S=>S===x);R?_=ns(R):s.dimensions[x]=s.dimensions[_]}}for(const w of e)if(y.includes(w)){const _=Hr.find(x=>x.mode===w);t.push({..._,height:s.dimensions[w][1]||50})}if(t.map(w=>w.mode).includes(s.params.screenMode)||(s.params.screenMode="auto"),s.params.screenMode==="auto"){t.sort((w,_)=>y.indexOf(w.mode)-y.indexOf(_.mode));for(const w of t){const[_,x]=w.width;s.params.itemEmbedding&&s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"?_<s.params.itemDimensions.width&&(i=w.mode,r=Number.parseInt(s.params.itemDimensions.width,10),n=s.dimensions[i][1]):_<s.containerWidth&&(i=w.mode,s.params.itemEmbedding?(r=(l=s.params.itemDimensions)!=null&&l.width&&((c=s.params.itemDimensions)==null?void 0:c.width)!=="auto"?Number.parseInt(s.params.itemDimensions.width,10):Math.min(s.containerWidth,x),n=(d=s.params.itemDimensions)!=null&&d.height&&((h=s.params.itemDimensions)==null?void 0:h.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),n=s.dimensions[i][1])):(r=Math.max(Math.min(x,s.containerWidth),_),n=w.height))}}else{const{height:w,width:[_,x]}=t.find(R=>R.mode===s.params.screenMode);i=s.params.screenMode,r=Math.max(Math.min(x,s.containerWidth),_),n=w,s.params.itemEmbedding&&((u=s.params.itemDimensions)!=null&&u.width&&((g=s.params.itemDimensions)==null?void 0:g.width)!=="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10)),(m=s.params.itemDimensions)!=null&&m.height&&((b=s.params.itemDimensions)==null?void 0:b.height)!=="auto"&&(n=Number.parseInt(s.params.itemDimensions.height,10)))}if(!i&&t.length>0){const[w]=t;i=w.mode,r=w.width[0],n=w.height}}s.currentScreenMode=i;const o={height:n===0?"100%":`${String(n)}px`,width:r===0?"100%":`${String(r)}px`,opacity:1};["editFull","editLimited"].includes(s.params.editMode)?(o.height="100%",o.width="100%"):s.params.itemEmbedding&&s.params.itemDimensions?(o.height=s.params.itemDimensions.height==="auto"?o.height:`${String(s.params.itemDimensions.height).replace("px","")}px`,o.width=s.params.itemDimensions.width==="auto"?o.width:`${String(s.params.itemDimensions.width).replace("px","")}px`):(o.height=n===0?"100%":`${String(n)}px`,o.width=r===0?"100%":`${String(r)}px`),s.currentScreenMode=i,s.iframeStyle=o},us=s=>{const e=Object.keys(ne),t=[],i=["appServer","language","apiHost"],r=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"],n=["itemDimensions"],o=["mobile","tablet","desktop","largeScreen","fixed","auto"];for(const a of e)s.params[a]===null&&delete s.params[a];s.params=_i(s.params,ne),(!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&&!o.includes(s.params.screenMode)){const a=o.map(l=>`"${l}"`).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 n)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 l of a)!["string","number"].includes(typeof s.params.itemDimensions[l])&&s.params.itemDimensions[l]!==null&&t.push(`itemDimensions ${l} needs to be of type string, number or empty.`)}s.params=_i(s.params,ne),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)&&Pi(t.join(`
23
- `),s.params)},ri={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"},xi="luzmo-embed-container",ot={},Io=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)},ms=s=>({});async function No(s){const e=ot[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(ms(e.from)),e.inited=!0),t(e.lib)};return Io(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(n=>{import(n).then(o=>{if(!e.inited){const a=ms(e.from);o.init(a),e.lib=o,e.lib.init(a),e.inited=!0}t(e.lib)}).catch(i)})})}function To(s,e){if(!(s!=null&&s.default)&&e){const t=Object.create(null);return t.default=s,t.__esModule=!0,t}return s}async function Ho(s,e){return No(s).then(t=>t.get(e).then(i=>i()))}async function Se(s,e="DashboardApp"){const t=s+e;if(ot[t])return ot[t].module;let i=`${Ee(s)}/remoteEntry.mjs`;if(!s.startsWith("http://localhost"))switch(e){case"DashboardApp":case"VizItemApp":{i=`${Ee(s)}/dashboard-app/remoteEntry.mjs`;break}case"IQApp":{i=`${Ee(s)}/iq-components/remoteEntry.mjs`;break}}ot[t]={url:i,format:"esm",from:"vite",module:void 0};const r=await Ho(t,`./${e}`),n=To(r,!0);return ot[t].module=n,n}/**
20
+ "use strict";var In=Object.defineProperty;var Tn=(s,e,t)=>e in s?In(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var ii=(s,e,t)=>Tn(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../property-BCb4Kybn.cjs"),st=require("../state-BxZEcclm.cjs"),qt=require("../query-D5qWDopr.cjs"),Me=require("../luzmo-icons-DAsjNJNI.cjs");require("../index-C2PPSv8E.cjs");require("../index-CnpJUw_z.cjs");require("../index-DSQyBS9Z.cjs");const kr=require("../base-D76d76ww-tT6yr8eb.cjs");require("../focusable-BxtpnzWp-CkK9AeMt.cjs");const Nn=require("../query-all-CR2wWKRD.cjs"),Hn=require("../item-list.cjs"),si=require("../utils-CvCeHVBQ.cjs"),ge=require("../set-locale-Cam8nRIW.cjs"),On=require("../localized-decorator-SOrjcPab.cjs");require("../index-CAJRL5rT.cjs");const vi=Math.min,je=Math.max,It=Math.round,xt=Math.floor,ye=s=>({x:s,y:s}),Pn={left:"right",right:"left",bottom:"top",top:"bottom"},$n={start:"end",end:"start"};function Ti(s,e){return typeof s=="function"?s(e):s}function Je(s){return s.split("-")[0]}function jt(s){return s.split("-")[1]}function Bn(s){return s==="x"?"y":"x"}function Rr(s){return s==="y"?"height":"width"}function Oe(s){return["top","bottom"].includes(Je(s))?"y":"x"}function Sr(s){return Bn(Oe(s))}function Wn(s,e,t){t===void 0&&(t=!1);const i=jt(s),r=Sr(s),n=Rr(r);let o=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(o=Tt(o)),[o,Tt(o)]}function Gn(s){const e=Tt(s);return[wi(s),e,wi(e)]}function wi(s){return s.replace(/start|end/g,e=>$n[e])}function Fn(s,e,t){const i=["left","right"],r=["right","left"],n=["top","bottom"],o=["bottom","top"];switch(s){case"top":case"bottom":return t?e?r:i:e?i:r;case"left":case"right":return e?n:o;default:return[]}}function Un(s,e,t,i){const r=jt(s);let n=Fn(Je(s),t==="start",i);return r&&(n=n.map(o=>o+"-"+r),e&&(n=n.concat(n.map(wi)))),n}function Tt(s){return s.replace(/left|right|bottom|top/g,e=>Pn[e])}function qn(s){return{top:0,right:0,bottom:0,left:0,...s}}function jn(s){return typeof s!="number"?qn(s):{top:s,right:s,bottom:s,left:s}}function Nt(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 Ji(s,e,t){let{reference:i,floating:r}=s;const n=Oe(e),o=Sr(e),a=Rr(o),l=Je(e),d=n==="y",c=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,u=i[a]/2-r[a]/2;let g;switch(l){case"top":g={x:c,y:i.y-r.height};break;case"bottom":g={x:c,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:h};break;case"left":g={x:i.x-r.width,y:h};break;default:g={x:i.x,y:i.y}}switch(jt(e)){case"start":g[o]-=u*(t&&d?-1:1);break;case"end":g[o]+=u*(t&&d?-1:1);break}return g}const Vn=async(s,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:n=[],platform:o}=t,a=n.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:s,floating:e,strategy:r}),{x:c,y:h}=Ji(d,i,l),u=i,g={},m=0;for(let b=0;b<a.length;b++){const{name:y,fn:w}=a[b],{x:_,y:x,data:R,reset:A}=await w({x:c,y:h,initialPlacement:i,placement:u,strategy:r,middlewareData:g,rects:d,platform:o,elements:{reference:s,floating:e}});c=_??c,h=x??h,g={...g,[y]:{...g[y],...R}},A&&m<=50&&(m++,typeof A=="object"&&(A.placement&&(u=A.placement),A.rects&&(d=A.rects===!0?await o.getElementRects({reference:s,floating:e,strategy:r}):A.rects),{x:c,y:h}=Ji(d,u,l)),b=-1)}return{x:c,y:h,placement:u,strategy:r,middlewareData:g}};async function Yn(s,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:n,rects:o,elements:a,strategy:l}=s,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:h="floating",altBoundary:u=!1,padding:g=0}=Ti(e,s),m=jn(g),y=a[u?h==="floating"?"reference":"floating":h],w=Nt(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(y)))==null||t?y:y.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),_=h==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,x=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),R=await(n.isElement==null?void 0:n.isElement(x))?await(n.getScale==null?void 0:n.getScale(x))||{x:1,y:1}:{x:1,y:1},A=Nt(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:x,strategy:l}):_);return{top:(w.top-A.top+m.top)/R.y,bottom:(A.bottom-w.bottom+m.bottom)/R.y,left:(w.left-A.left+m.left)/R.x,right:(A.right-w.right+m.right)/R.x}}const Xn=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,i;const{placement:r,middlewareData:n,rects:o,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:c=!0,crossAxis:h=!0,fallbackPlacements:u,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:b=!0,...y}=Ti(s,e);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const w=Je(r),_=Oe(a),x=Je(a)===a,R=await(l.isRTL==null?void 0:l.isRTL(d.floating)),A=u||(x||!b?[Tt(a)]:Gn(a)),j=m!=="none";!u&&j&&A.push(...Un(a,b,m,R));const W=[a,...A],H=await Yn(e,y),G=[];let O=((i=n.flip)==null?void 0:i.overflows)||[];if(c&&G.push(H[w]),h){const I=Wn(r,o,R);G.push(H[I[0]],H[I[1]])}if(O=[...O,{placement:r,overflows:G}],!G.every(I=>I<=0)){var ue,$;const I=(((ue=n.flip)==null?void 0:ue.index)||0)+1,me=W[I];if(me&&(!(h==="alignment"?_!==Oe(me):!1)||O.every(Z=>Z.overflows[0]>0&&Oe(Z.placement)===_)))return{data:{index:I,overflows:O},reset:{placement:me}};let V=($=O.filter(fe=>fe.overflows[0]<=0).sort((fe,Z)=>fe.overflows[1]-Z.overflows[1])[0])==null?void 0:$.placement;if(!V)switch(g){case"bestFit":{var oe;const fe=(oe=O.filter(Z=>{if(j){const ae=Oe(Z.placement);return ae===_||ae==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(ae=>ae>0).reduce((ae,Ie)=>ae+Ie,0)]).sort((Z,ae)=>Z[1]-ae[1])[0])==null?void 0:oe[0];fe&&(V=fe);break}case"initialPlacement":V=a;break}if(r!==V)return{reset:{placement:V}}}return{}}}};async function Kn(s,e){const{placement:t,platform:i,elements:r}=s,n=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Je(t),a=jt(t),l=Oe(t)==="y",d=["left","top"].includes(o)?-1:1,c=n&&l?-1:1,h=Ti(e,s);let{mainAxis:u,crossAxis:g,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof m=="number"&&(g=a==="end"?m*-1:m),l?{x:g*c,y:u*d}:{x:u*d,y:g*c}}const Jn=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,i;const{x:r,y:n,placement:o,middlewareData:a}=e,l=await Kn(e,s);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:n+l.y,data:{...l,placement:o}}}}};function Vt(){return typeof window<"u"}function rt(s){return Ar(s)?(s.nodeName||"").toLowerCase():"#document"}function ie(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function we(s){var e;return(e=(Ar(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function Ar(s){return Vt()?s instanceof Node||s instanceof ie(s).Node:!1}function de(s){return Vt()?s instanceof Element||s instanceof ie(s).Element:!1}function ve(s){return Vt()?s instanceof HTMLElement||s instanceof ie(s).HTMLElement:!1}function Zi(s){return!Vt()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof ie(s).ShadowRoot}function bt(s){const{overflow:e,overflowX:t,overflowY:i,display:r}=ce(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function Zn(s){return["table","td","th"].includes(rt(s))}function Yt(s){return[":popover-open",":modal"].some(e=>{try{return s.matches(e)}catch{return!1}})}function Ni(s){const e=Hi(),t=de(s)?ce(s):s;return["transform","translate","scale","rotate","perspective"].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)||["transform","translate","scale","rotate","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function Qn(s){let e=Re(s);for(;ve(e)&&!Ze(e);){if(Ni(e))return e;if(Yt(e))return null;e=Re(e)}return null}function Hi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ze(s){return["html","body","#document"].includes(rt(s))}function ce(s){return ie(s).getComputedStyle(s)}function Xt(s){return de(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function Re(s){if(rt(s)==="html")return s;const e=s.assignedSlot||s.parentNode||Zi(s)&&s.host||we(s);return Zi(e)?e.host:e}function Cr(s){const e=Re(s);return Ze(e)?s.ownerDocument?s.ownerDocument.body:s.body:ve(e)&&bt(e)?e:Cr(e)}function ht(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Cr(s),n=r===((i=s.ownerDocument)==null?void 0:i.body),o=ie(r);if(n){const a=_i(o);return e.concat(o,o.visualViewport||[],bt(r)?r:[],a&&t?ht(a):[])}return e.concat(r,ht(r,[],t))}function _i(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function Dr(s){const e=ce(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=ve(s),n=r?s.offsetWidth:t,o=r?s.offsetHeight:i,a=It(t)!==n||It(i)!==o;return a&&(t=n,i=o),{width:t,height:i,$:a}}function Oi(s){return de(s)?s:s.contextElement}function Ve(s){const e=Oi(s);if(!ve(e))return ye(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:n}=Dr(e);let o=(n?It(t.width):t.width)/i,a=(n?It(t.height):t.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const eo=ye(0);function Lr(s){const e=ie(s);return!Hi()||!e.visualViewport?eo:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function to(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==ie(s)?!1:e}function $e(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=s.getBoundingClientRect(),n=Oi(s);let o=ye(1);e&&(i?de(i)&&(o=Ve(i)):o=Ve(s));const a=to(n,t,i)?Lr(n):ye(0);let l=(r.left+a.x)/o.x,d=(r.top+a.y)/o.y,c=r.width/o.x,h=r.height/o.y;if(n){const u=ie(n),g=i&&de(i)?ie(i):i;let m=u,b=_i(m);for(;b&&i&&g!==m;){const y=Ve(b),w=b.getBoundingClientRect(),_=ce(b),x=w.left+(b.clientLeft+parseFloat(_.paddingLeft))*y.x,R=w.top+(b.clientTop+parseFloat(_.paddingTop))*y.y;l*=y.x,d*=y.y,c*=y.x,h*=y.y,l+=x,d+=R,m=ie(b),b=_i(m)}}return Nt({width:c,height:h,x:l,y:d})}function Pi(s,e){const t=Xt(s).scrollLeft;return e?e.left+t:$e(we(s)).left+t}function Ir(s,e,t){t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=i.left+e.scrollLeft-(t?0:Pi(s,i)),n=i.top+e.scrollTop;return{x:r,y:n}}function io(s){let{elements:e,rect:t,offsetParent:i,strategy:r}=s;const n=r==="fixed",o=we(i),a=e?Yt(e.floating):!1;if(i===o||a&&n)return t;let l={scrollLeft:0,scrollTop:0},d=ye(1);const c=ye(0),h=ve(i);if((h||!h&&!n)&&((rt(i)!=="body"||bt(o))&&(l=Xt(i)),ve(i))){const g=$e(i);d=Ve(i),c.x=g.x+i.clientLeft,c.y=g.y+i.clientTop}const u=o&&!h&&!n?Ir(o,l,!0):ye(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+c.x+u.x,y:t.y*d.y-l.scrollTop*d.y+c.y+u.y}}function so(s){return Array.from(s.getClientRects())}function ro(s){const e=we(s),t=Xt(s),i=s.ownerDocument.body,r=je(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),n=je(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+Pi(s);const a=-t.scrollTop;return ce(i).direction==="rtl"&&(o+=je(e.clientWidth,i.clientWidth)-r),{width:r,height:n,x:o,y:a}}function no(s,e){const t=ie(s),i=we(s),r=t.visualViewport;let n=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){n=r.width,o=r.height;const d=Hi();(!d||d&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:n,height:o,x:a,y:l}}function oo(s,e){const t=$e(s,!0,e==="fixed"),i=t.top+s.clientTop,r=t.left+s.clientLeft,n=ve(s)?Ve(s):ye(1),o=s.clientWidth*n.x,a=s.clientHeight*n.y,l=r*n.x,d=i*n.y;return{width:o,height:a,x:l,y:d}}function Qi(s,e,t){let i;if(e==="viewport")i=no(s,t);else if(e==="document")i=ro(we(s));else if(de(e))i=oo(e,t);else{const r=Lr(s);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Nt(i)}function Tr(s,e){const t=Re(s);return t===e||!de(t)||Ze(t)?!1:ce(t).position==="fixed"||Tr(t,e)}function ao(s,e){const t=e.get(s);if(t)return t;let i=ht(s,[],!1).filter(a=>de(a)&&rt(a)!=="body"),r=null;const n=ce(s).position==="fixed";let o=n?Re(s):s;for(;de(o)&&!Ze(o);){const a=ce(o),l=Ni(o);!l&&a.position==="fixed"&&(r=null),(n?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||bt(o)&&!l&&Tr(s,o))?i=i.filter(c=>c!==o):r=a,o=Re(o)}return e.set(s,i),i}function lo(s){let{element:e,boundary:t,rootBoundary:i,strategy:r}=s;const o=[...t==="clippingAncestors"?Yt(e)?[]:ao(e,this._c):[].concat(t),i],a=o[0],l=o.reduce((d,c)=>{const h=Qi(e,c,r);return d.top=je(h.top,d.top),d.right=vi(h.right,d.right),d.bottom=vi(h.bottom,d.bottom),d.left=je(h.left,d.left),d},Qi(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function co(s){const{width:e,height:t}=Dr(s);return{width:e,height:t}}function ho(s,e,t){const i=ve(e),r=we(e),n=t==="fixed",o=$e(s,!0,n,e);let a={scrollLeft:0,scrollTop:0};const l=ye(0);function d(){l.x=Pi(r)}if(i||!i&&!n)if((rt(e)!=="body"||bt(r))&&(a=Xt(e)),i){const g=$e(e,!0,n,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else r&&d();n&&!i&&r&&d();const c=r&&!i&&!n?Ir(r,a):ye(0),h=o.left+a.scrollLeft-l.x-c.x,u=o.top+a.scrollTop-l.y-c.y;return{x:h,y:u,width:o.width,height:o.height}}function ri(s){return ce(s).position==="static"}function es(s,e){if(!ve(s)||ce(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return we(s)===t&&(t=t.ownerDocument.body),t}function Nr(s,e){const t=ie(s);if(Yt(s))return t;if(!ve(s)){let r=Re(s);for(;r&&!Ze(r);){if(de(r)&&!ri(r))return r;r=Re(r)}return t}let i=es(s,e);for(;i&&Zn(i)&&ri(i);)i=es(i,e);return i&&Ze(i)&&ri(i)&&!Ni(i)?t:i||Qn(s)||t}const uo=async function(s){const e=this.getOffsetParent||Nr,t=this.getDimensions,i=await t(s.floating);return{reference:ho(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function mo(s){return ce(s).direction==="rtl"}const fo={convertOffsetParentRelativeRectToViewportRelativeRect:io,getDocumentElement:we,getClippingRect:lo,getOffsetParent:Nr,getElementRects:uo,getClientRects:so,getDimensions:co,getScale:Ve,isElement:de,isRTL:mo};function Hr(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function go(s,e){let t=null,i;const r=we(s);function n(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),n();const d=s.getBoundingClientRect(),{left:c,top:h,width:u,height:g}=d;if(a||e(),!u||!g)return;const m=xt(h),b=xt(r.clientWidth-(c+u)),y=xt(r.clientHeight-(h+g)),w=xt(c),x={rootMargin:-m+"px "+-b+"px "+-y+"px "+-w+"px",threshold:je(0,vi(1,l))||1};let R=!0;function A(j){const W=j[0].intersectionRatio;if(W!==l){if(!R)return o();W?o(!1,W):i=setTimeout(()=>{o(!1,1e-7)},1e3)}W===1&&!Hr(d,s.getBoundingClientRect())&&o(),R=!1}try{t=new IntersectionObserver(A,{...x,root:r.ownerDocument})}catch{t=new IntersectionObserver(A,x)}t.observe(s)}return o(!0),n}function ts(s,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:n=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,d=Oi(s),c=r||n?[...d?ht(d):[],...ht(e)]:[];c.forEach(w=>{r&&w.addEventListener("scroll",t,{passive:!0}),n&&w.addEventListener("resize",t)});const h=d&&a?go(d,t):null;let u=-1,g=null;o&&(g=new ResizeObserver(w=>{let[_]=w;_&&_.target===d&&g&&(g.unobserve(e),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(e)})),t()}),d&&!l&&g.observe(d),g.observe(e));let m,b=l?$e(s):null;l&&y();function y(){const w=$e(s);b&&!Hr(b,w)&&t(),b=w,m=requestAnimationFrame(y)}return t(),()=>{var w;c.forEach(_=>{r&&_.removeEventListener("scroll",t),n&&_.removeEventListener("resize",t)}),h==null||h(),(w=g)==null||w.disconnect(),g=null,l&&cancelAnimationFrame(m)}}const is=Jn,ss=Xn,rs=(s,e,t)=>{const i=new Map,r={platform:fo,...t},n={...r.platform,_c:i};return Vn(s,e,{...r,platform:n})},$i=(s,e)=>{let t="The dashboard component encountered an error";typeof(e==null?void 0:e.dashboardId)=="string"&&(t+=` for dashboard with id ${e.dashboardId}`),typeof(e==null?void 0:e.dashboardSlug)=="string"&&(t+=` for dashboard with slug ${e.dashboardSlug}`),typeof(e==null?void 0:e.container)=="string"&&(t+=` in container ${e.container}`),s&&(t+=`:
21
+ ${s}`,console.warn(t))},po=s=>{let e=!1,t="";const r=(document.body||document.documentElement).style,n={svg:!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:r.webkitFlexWrap===""||r.flexWrap==="",postMessage:!!window.postMessage},o=["svg","flexbox","postMessage"];for(const c of o)n[c]||(e=!0,s.browserNotSupported=s.browserNotSupported||[],s.browserNotSupported.push(c),t+=`Your browser does not support: ${c}
22
+ `);const a=window.navigator.userAgent,l=a.includes("MSIE"),d=a.includes("Trident/");(l||d)&&(e=!0,t="IE is not supported."),e&&$i(t)},ne={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},Or=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}],ns={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement...",de:"Initialisiere...",es:"Inicializando..."}},lt=s=>s?s.endsWith("/")?s:`${s}/`:"",Ee=s=>s?s.endsWith("/")?s.slice(0,-1):s:"",bo=(s,e,t,i)=>{var a;const r=(l,d)=>{var b;const c=l.users.find(y=>y.id===d.id),h=c&&c.userAccessRight?{flagRead:c.userAccessRight.flagRead,flagUse:c.userAccessRight.flagUse,flagModify:c.userAccessRight.flagModify,flagOwn:c.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},g=l.groups.filter(y=>d.userGroups.includes(y.id)||y.public===!0).map(y=>{if(y.groupAccessRight)return y.groupAccessRight});for(const y of g)!h.flagRead&&y.flagRead&&(h.flagRead=y.flagRead),!h.flagUse&&y.flagUse&&(h.flagUse=y.flagUse),!h.flagModify&&y.flagModify&&(h.flagModify=y.flagModify),!h.flagOwn&&y.flagOwn&&(h.flagOwn=y.flagOwn);const m=((b=l.integrations)==null?void 0:b.length)>0?l.integrations.map(y=>{if(y.integrationAccessRight)return y.integrationAccessRight}):[];for(const y of m)!h.flagRead&&y.flagRead&&(h.flagRead=y.flagRead),!h.flagUse&&y.flagUse&&(h.flagUse=y.flagUse),!h.flagModify&&y.flagModify&&(h.flagModify=y.flagModify);return h},n=(l,d)=>{if(l==null)return"";if(typeof l!="object"||Object.keys(l).length===0)return typeof l=="object"&&Object.keys(l).length===0?"":l;let c;return c=d&&l[d]?l[d]:l[Object.keys(l)[0]],c==null&&(c=""),c},o=[];for(const l of s){const d={accessibleBy:[],accessRights:r(l,t),id:l.id,modifiedAt:l.modified_at,name:n(l.name,i.language),slug:null,tags:l.tags.map(m=>m.tag).sort((m,b)=>m.localeCompare(b))},c=l.integrations.find(m=>m.id===e);(a=c==null?void 0:c.integrationAccessRight)!=null&&a.slug&&(d.slug=c.integrationAccessRight.slug);const h=l.users.map(m=>({model:"User",id:m.id,name:n(m.name,t.locale_id)})),u=l.groups.map(m=>({model:"Group",id:m.id,name:n(m.name,t.locale_id)||{}})),g=l.integrations.map(m=>({model:"Integration",id:m.id,name:n(m.name,t.locale_id)||{}}));d.accessibleBy=[...h,...u,...g],o.push(d)}return o},yo="0.0.0-unknown-luzmo",vo=s=>{const e=/^(%20|\s)*(javascript|data)/im,t=/[^\u0020-\u007E]/gim,i=/^([^:]+):/gm,r=new Set([".","/"]),n=d=>r.has(d[0]);if(!s)return"about:blank";const o=s.replaceAll(t,"").trim();if(n(o))return o;const a=o.match(i);if(!a)return o;const l=a[0];return e.test(l)?"about:blank":o},os=s=>JSON.parse(JSON.stringify(s)),wo=s=>s&&typeof s=="object",xi=(s,e)=>(Object.entries(e).forEach(([t,i])=>{t in s?s[t]===void 0?s[t]=i:s[t]=wo(i)?xi(s[t],i):s[t]:s[t]=i}),s),We=()=>"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)}),as=s=>{const e=[],{appServer:t,language:i,editorLanguage:r,qeVersion:n,loaderBackground:o,loaderSpinnerColor:a,loaderSpinnerBackground:l,loaderFontColor:d,screenMode:c,key:h,token:u,timezoneId:g,itemEmbedding:m,itemDimensions:b,dashboardId:y,dashboardSlug:w,itemId:_,theme:x,mainColor:R,accentColor:A,editMode:j}=s.params;i&&i!=="auto"&&e.push(`language=${i}`),r&&r!=="auto"&&e.push(`editorLanguage=${r}`),n&&e.push(`qe_version=${n}`),o&&e.push(`ldrbg=${o}`),d&&e.push(`ldrftclr=${d}`),a&&e.push(`ldrspclr=${a}`),l&&e.push(`ldrspbg=${l}`),x&&e.push(`theme=${x}`),R&&e.push(`mainColor=${R}`),A&&e.push(`accentColor=${A}`),c&&c!=="auto"&&e.push("screenMode=&{screenMode}"),g&&e.push("timezoneId="+g),m&&b&&b.width&&e.push("width="+b.width),m&&b&&b.height&&e.push("height="+b.height),j&&e.push("editMode="+j);const W=h&&u?"#"+h+":"+u:"";e.push("version="+(s.libVersion||yo));const H=m?`${t}i/${y||w}/${_}?${encodeURIComponent(e.join("&"))}${W}`:`${t}i/${y||w}?${encodeURIComponent(e.join("&"))}${W}`;return vo(H)},ls=s=>{let e;(s.params.error||s.browserNotSupported.length>0)&&(s.params.error=!0,s.browserNotSupported&&(e="Browser is not supported."));const t=ns.initializing[s.params.language]||ns.initializing.en;return s.browserNotSupported||s.params.error?{loadingMsg:t,errorMsg:e}:{loadingMsg:t,errorMsg:""}};function Te(s,e,t){s.promises[e]&&(s.promises[e].resolve(t),delete s.promises[e])}function Et(s,e,t){s.promises[e]&&(s.promises[e].reject(t),delete s.promises[e])}function Pr(s){const e={};return s.params.loaderBackground&&!s.iframeLoaded&&(e.background=s.params.loaderBackground),e}function _o(s){var r;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||ne.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto";return{display:s.iframeLoaded?"none":"",height:`${t?e:s.minHeight}px`}}function xo(s){var t,i;const e=s.params.loaderBackground||ne.loaderBackground;if(s.params.itemEmbedding){s.loaderSize=24,s.borderWidth=4,s.minHeight=200;const r=((t=s.params.itemDimensions)==null?void 0:t.width)||ne.itemDimensions.width,n=((i=s.params.itemDimensions)==null?void 0:i.height)||ne.itemDimensions.height,o=r!=="auto",a=n!=="auto";return{background:e,width:o?`${r}px`:"100%",height:`${a?n:"200"}px`,"min-height":a?"":"200px"}}return{background:e}}function Eo(s){const{loaderSpinnerColor:e,loaderSpinnerBackground:t}=ne,i=cs(s.borderWidth,s.params.loaderSpinnerColor||e),r=cs(s.borderWidth,s.params.loaderSpinnerBackground||t),n=`${s.loaderSize}px`;return{"border-top":i,"border-right":i,"border-bottom":r,"border-left":r,width:n,height:n}}function zo(s){var n;const e=((n=s.params.itemDimensions)==null?void 0:n.height)||ne.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 ds(s){var r,n;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||ne.itemDimensions.height,t=((n=s.params.itemDimensions)==null?void 0:n.width)||ne.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 cs(s,e){return`${s}px solid ${e}`}const Mo=(s,e)=>{s!=null&&s.contentWindow&&s.contentWindow.location.replace(e)},hs=(s,e,t)=>{const i=We();return e!=null&&e.contentWindow?(e.contentWindow.postMessage({action:"exportDashboard",format:t||"png",_version:s.libVersion,requestId:i},"*"),new Promise((r,n)=>{s.promises[i]={resolve:r,reject:n},setTimeout(()=>{if(s.promises[i]){const o="exportDashboard request timed out.";s.promises[i].reject(new Error(o)),delete s.promises[i]}},12e5)})):Promise.reject(new Error("Cannot retrieve contentWindow."))},ko=async s=>{if(await s.updateComplete,(s.currentAuthKey??s.authKey)&&(s.currentAuthToken??s.authToken)){const e=new Promise((t,i)=>{(()=>{try{window.fetch(`${lt(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(n=>n.json()).then(n=>{!n||!n.rows||n.rows.length===0||!n.rows[0].user?i("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com."):(n.rows[0].user.userGroups=n.rows[0].user.groups.map(o=>o.id),delete n.rows[0].user.groups,t({integrationId:n.rows[0].integration_id,user:n.rows[0].user}))})}catch(r){i(r)}})()});return new Promise((t,i)=>void(()=>{try{e.then(r=>{window.fetch(`${lt(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(o=>o.json()).then(o=>{const a=o.rows.length>0?bo(o.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.")},Ro=(s,e,t)=>{if(e!=null&&e.contentWindow){const i=We();return e.contentWindow.postMessage({action:"getData",id:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,n)=>{s.promises[i]={resolve:r,reject:n},setTimeout(()=>{if(s.promises[i]){const o="getData request timed out.";s.promises[i].reject(new Error(o)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},So=(s,e)=>{if(e!=null&&e.contentWindow){const t=We();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 n="getFilters request timed out.";s.promises[t].reject(new Error(n)),delete s.promises[t]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},us=(s,e,t)=>e?(e.contentWindow.postMessage({action:"refreshData",id:t??null,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),Ao=(s,e)=>e?(e.contentWindow.postMessage({action:"reloadDashboard",_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),Co=(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.")),Do=(s,e,t)=>{if(e&&e.contentWindow){const i=We();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,n)=>{s.promises[i]={resolve:r,reject:n}}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Lo=(s,e,t,i)=>{if(e){const r=We();return e.contentWindow.postMessage({action:"setSelectedData",itemId:t,filters:i,_version:s.libVersion,requestId:r},"*"),new Promise((n,o)=>{s.promises[r]={resolve:n,reject:o},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()},Io=(s,e,t)=>{if(e){const i=We();return e.contentWindow.postMessage({action:"setPreview",preview:t,requestId:i,_version:s.libVersion},"*"),new Promise((r,n)=>{s.promises[i]={resolve:r,reject:n},setTimeout(()=>{if(s.promises[i]){const o="setPreview request timed out.";s.promises[i].reject(new Error(o)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},dt=s=>{var l,d,c,h,u,g,m,b;if(!s.dimensions){s.params.error=!0,$i("Got no valid dimensions.",s.params);return}const e=Object.keys(s.dimensions),t=[];let i,r=0,n=0;if(!s.params.switchScreenModeOnResize&&s.currentScreenMode&&(s.params.screenMode=s.currentScreenMode),s.dimensions&&(e==null?void 0:e[0])==="fixed")i="fixed",r=s.dimensions.fixed[0],n=s.dimensions.fixed[1];else{const y=["mobile","tablet","desktop","largeScreen"];if(s.params.itemEmbedding){const[w]=e;let _=os(w);for(const x of y){const R=e.find(A=>A===x);R?_=os(R):s.dimensions[x]=s.dimensions[_]}}for(const w of e)if(y.includes(w)){const _=Or.find(x=>x.mode===w);t.push({..._,height:s.dimensions[w][1]||50})}if(t.map(w=>w.mode).includes(s.params.screenMode)||(s.params.screenMode="auto"),s.params.screenMode==="auto"){t.sort((w,_)=>y.indexOf(w.mode)-y.indexOf(_.mode));for(const w of t){const[_,x]=w.width;s.params.itemEmbedding&&s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"?_<s.params.itemDimensions.width&&(i=w.mode,r=Number.parseInt(s.params.itemDimensions.width,10),n=s.dimensions[i][1]):_<s.containerWidth&&(i=w.mode,s.params.itemEmbedding?(r=(l=s.params.itemDimensions)!=null&&l.width&&((d=s.params.itemDimensions)==null?void 0:d.width)!=="auto"?Number.parseInt(s.params.itemDimensions.width,10):Math.min(s.containerWidth,x),n=(c=s.params.itemDimensions)!=null&&c.height&&((h=s.params.itemDimensions)==null?void 0:h.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),n=s.dimensions[i][1])):(r=Math.max(Math.min(x,s.containerWidth),_),n=w.height))}}else{const{height:w,width:[_,x]}=t.find(R=>R.mode===s.params.screenMode);i=s.params.screenMode,r=Math.max(Math.min(x,s.containerWidth),_),n=w,s.params.itemEmbedding&&((u=s.params.itemDimensions)!=null&&u.width&&((g=s.params.itemDimensions)==null?void 0:g.width)!=="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10)),(m=s.params.itemDimensions)!=null&&m.height&&((b=s.params.itemDimensions)==null?void 0:b.height)!=="auto"&&(n=Number.parseInt(s.params.itemDimensions.height,10)))}if(!i&&t.length>0){const[w]=t;i=w.mode,r=w.width[0],n=w.height}}s.currentScreenMode=i;const o={height:n===0?"100%":`${String(n)}px`,width:r===0?"100%":`${String(r)}px`,opacity:1};["editFull","editLimited"].includes(s.params.editMode)?(o.height="100%",o.width="100%"):s.params.itemEmbedding&&s.params.itemDimensions?(o.height=s.params.itemDimensions.height==="auto"?o.height:`${String(s.params.itemDimensions.height).replace("px","")}px`,o.width=s.params.itemDimensions.width==="auto"?o.width:`${String(s.params.itemDimensions.width).replace("px","")}px`):(o.height=n===0?"100%":`${String(n)}px`,o.width=r===0?"100%":`${String(r)}px`),s.currentScreenMode=i,s.iframeStyle=o},ms=s=>{const e=Object.keys(ne),t=[],i=["appServer","language","apiHost"],r=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"],n=["itemDimensions"],o=["mobile","tablet","desktop","largeScreen","fixed","auto"];for(const a of e)s.params[a]===null&&delete s.params[a];s.params=xi(s.params,ne),(!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&&!o.includes(s.params.screenMode)){const a=o.map(l=>`"${l}"`).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 n)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 l of a)!["string","number"].includes(typeof s.params.itemDimensions[l])&&s.params.itemDimensions[l]!==null&&t.push(`itemDimensions ${l} needs to be of type string, number or empty.`)}s.params=xi(s.params,ne),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)&&$i(t.join(`
23
+ `),s.params)},ni={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"},Ei="luzmo-embed-container",ot={},To=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)},fs=s=>({});async function No(s){const e=ot[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(fs(e.from)),e.inited=!0),t(e.lib)};return To(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(n=>{import(n).then(o=>{if(!e.inited){const a=fs(e.from);o.init(a),e.lib=o,e.lib.init(a),e.inited=!0}t(e.lib)}).catch(i)})})}function Ho(s,e){if(!(s!=null&&s.default)&&e){const t=Object.create(null);return t.default=s,t.__esModule=!0,t}return s}async function Oo(s,e){return No(s).then(t=>t.get(e).then(i=>i()))}async function Se(s,e="DashboardApp"){const t=s+e;if(ot[t])return ot[t].module;let i=`${Ee(s)}/remoteEntry.mjs`;if(!s.startsWith("http://localhost"))switch(e){case"DashboardApp":case"VizItemApp":{i=`${Ee(s)}/dashboard-app/remoteEntry.mjs`;break}case"IQApp":{i=`${Ee(s)}/iq-components/remoteEntry.mjs`;break}}ot[t]={url:i,format:"esm",from:"vite",module:void 0};const r=await Oo(t,`./${e}`),n=Ho(r,!0);return ot[t].module=n,n}/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const Oo={ATTRIBUTE:1},Po=s=>(...e)=>({_$litDirective$:s,values:e});let $o=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
27
+ */const Po={ATTRIBUTE:1},$o=s=>(...e)=>({_$litDirective$:s,values:e});let Bo=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
28
28
  * @license
29
29
  * Copyright 2018 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */const Pr="important",Bo=" !"+Pr,Te=Po(class extends $o{constructor(s){var e;if(super(s),s.type!==Oo.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const n=typeof r=="string"&&r.endsWith(Bo);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?Pr:""):t[i]=r}}return f.T}});var Wo=Object.defineProperty,v=(s,e,t,i)=>{for(var r=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=o(e,t,r)||r);return r&&Wo(e,t,r),r},Be="6.4.3",Fo=class{constructor(){this._components=[]}},Ei=new Fo,Go=()=>{typeof window.__luzmoMessageHandler!="function"&&(window.__luzmoMessageHandler=s=>{var t,i;const e=Ei._components.find(r=>s.data.name===r._iframeId);if(e)switch((t=s.data)==null?void 0:t.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??((i=s.data.error)==null?void 0:i.msg));break}case"data":{Ne(e,s.data.requestId,s.data.data);break}case"filters":{Ne(e,s.data.requestId,s.data.filters);break}case"getAccessibleDashboards":{Ne(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?Et(e,s.data.requestId,s.data):(e.dispatchEvent(new CustomEvent("exported",{detail:{data:s.data}})),Ne(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?Et(e,s.data.requestId,s.data):(Ne(e,s.data.requestId,s.data),e.params.editMode=s.data.editMode,e._containerStyle=Or(e),e.dimensions&&dt(e));break}case"calculatedDimensions":{e.dimensions=s.data.dimensions,dt(e);break}case"setSelectedData":case"setFilters":{s.data.error?Et(e,s.data.requestId,s.data):Ne(e,s.data.requestId,s.data);break}case"setPreview":{s.data.error?Et(e,s.data.requestId,s.data):Ne(e,s.data.requestId,s.data);break}}},window.addEventListener("message",window.__luzmoMessageHandler,!1))},Uo=f.i`
31
+ */const $r="important",Wo=" !"+$r,Ne=$o(class extends Bo{constructor(s){var e;if(super(s),s.type!==Po.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const n=typeof r=="string"&&r.endsWith(Wo);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?$r:""):t[i]=r}}return f.T}});var Go=Object.defineProperty,v=(s,e,t,i)=>{for(var r=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=o(e,t,r)||r);return r&&Go(e,t,r),r},Be="6.4.3",Fo=class{constructor(){this._components=[]}},zi=new Fo,Uo=()=>{typeof window.__luzmoMessageHandler!="function"&&(window.__luzmoMessageHandler=s=>{var t,i;const e=zi._components.find(r=>s.data.name===r._iframeId);if(e)switch((t=s.data)==null?void 0:t.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??((i=s.data.error)==null?void 0:i.msg));break}case"data":{Te(e,s.data.requestId,s.data.data);break}case"filters":{Te(e,s.data.requestId,s.data.filters);break}case"getAccessibleDashboards":{Te(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?Et(e,s.data.requestId,s.data):(e.dispatchEvent(new CustomEvent("exported",{detail:{data:s.data}})),Te(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?Et(e,s.data.requestId,s.data):(Te(e,s.data.requestId,s.data),e.params.editMode=s.data.editMode,e._containerStyle=Pr(e),e.dimensions&&dt(e));break}case"calculatedDimensions":{e.dimensions=s.data.dimensions,dt(e);break}case"setSelectedData":case"setFilters":{s.data.error?Et(e,s.data.requestId,s.data):Te(e,s.data.requestId,s.data);break}case"setPreview":{s.data.error?Et(e,s.data.requestId,s.data):Te(e,s.data.requestId,s.data);break}}},window.addEventListener("message",window.__luzmoMessageHandler,!1))},qo=f.i`
32
32
  :host {
33
33
  display: block;
34
34
  height: 100%;
@@ -141,29 +141,29 @@ ${s}`,console.warn(t))},go=s=>{let e=!1,t="";const r=(document.body||document.do
141
141
  position: absolute;
142
142
  transition-duration: 0.3s;
143
143
  }
144
- `,fs="DashboardApp",M=class extends f.r$1{constructor(){super(),this.language="auto",this.editorLanguage="auto",this.screenMode="auto",this.switchScreenModeOnResize=!0,this.editMode="view",this.embedMode="iframe",this.iframeStyle={},this._containerStyle={},this._loaderStyle={},this._lcStyle={},this._loadingCircleStyle={},this._containerLoaderStyle={},this._loaderMsg="",this._itemEmbedding=!1,this.browserError=!1,this.browserErrorMsg="",this.dashboardError=!1,this.browserNotSupported=[],this.libVersion=Be+"-wc-luzmo",this.isLibraryLoaded=!1,this.currentAuthKey=null,this.currentAuthToken=null,this.isInitCalled=!1,this.attributesMap={dashboardId:"dashboard-id",dashboardSlug:"dashboard-slug",itemId:"item-id",language:"language",editorLanguage:"editorLanguage",qeVersion:"qe-version",screenMode:"screen-mode",switchScreenModeOnResize:"switch-screen-mode-on-resize",authKey:"auth-key",authToken:"auth-token",editMode:"edit-mode",theme:"theme",mainColor:"main-color",accentColor:"accent-color",loaderBackground:"loader-background",loaderFontColor:"loader-font-color",loaderSpinnerColor:"loader-spinner-color",loaderSpinnerBackground:"loader-spinner-background",appServer:"app-server",apiHost:"api-host",itemDimensions:"item-dimensions",timezoneId:"timezone-id"},this.loaderSize=32,this.borderWidth=3,this.minHeight=400,this._containerId=We(),this._iframeId=`luzmo-dashboard-${this._containerId}`,this.iframeLoaded=!1,this.promises={},this.params=this._setOptions(),this._onResize=()=>{var s;if((s=this.shadowRoot)!=null&&s.querySelector(".dashboard-container")){if(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,this.params.switchScreenModeOnResize&&this.params.screenMode==="auto")for(const e of Hr)e.width[0]<=window.innerWidth&&window.innerWidth<=e.width[1]&&(this.currentScreenMode=e.mode);this.iframeLoaded?this._calculateDimAfterDashboardLoaded():this.dimensions&&(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,dt(this))}},this._resizeObserver=new ResizeObserver(s=>{window.requestAnimationFrame(()=>{!Array.isArray(s)||s.length===0||this._onResize()})})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect();for(const s of Object.keys(this.promises))this.promises[s].reject(new Error("Dashboard component was removed"))}firstUpdated(){var s;this._loaderMsg=(s=as(this))==null?void 0:s.loadingMsg,this._loaderStyles(),Ei._components.push(this),this.luzmoEmbedContainer&&this._resizeObserver.observe(this.luzmoEmbedContainer)}initComponent(){var s,e;this.params=this._setOptions(),this.isWebComponentViewMode()?Se(this.params.appServer,fs).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete;const t=this.renderRoot.querySelector("dashboard-component");this.dashboardReference=t.cloneNode(!0),t.replaceWith(this.dashboardReference),this.dashboardReference.addEventListener("load",i=>{this.containerWidth=this.dashboardReference.offsetWidth,this.dimensions=i.detail.dimensions,dt(this),window.dispatchEvent(new Event("resize")),this.dispatchEvent(new CustomEvent("load",i))}),this.dashboardReference.addEventListener("itemsRendered",i=>this.dispatchEvent(new CustomEvent("itemsRendered",i))),this.dashboardReference.addEventListener("customEvent",i=>this.dispatchEvent(new CustomEvent("customEvent",i))),this.dashboardReference.addEventListener("changedFilters",i=>this.dispatchEvent(new CustomEvent("changedFilters",i))),this.dashboardReference.addEventListener("dashboardAction",i=>this.dispatchEvent(new CustomEvent("dashboardAction",i))),this.dashboardReference.addEventListener("export",i=>this.dispatchEvent(new CustomEvent("exported",i))),this.setAllAttributes()}):(this.containerWidth=(s=this.container)==null?void 0:s.clientWidth,us(this),go(this),this._setupLoader(),this.params.error||(this._loaderStyles(),Go(),this._iframeUrl=os(this),(e=this.iframe)==null||e.setAttribute("src",this._iframeUrl),this.iframeStyle=ls(this)))}setAllAttributes(){if(this.dashboardReference){for(const s in this.attributesMap)!["authKey","authToken","apiHost","itemDimensions"].includes(s)&&this.params[s]&&this.dashboardReference.setAttribute(this.attributesMap[s],this.params[s]);this.params.itemDimensions&&this.dashboardReference.setAttribute("item-dimensions",JSON.stringify(this.params.itemDimensions)),this.params.apiHost&&this.dashboardReference.setAttribute("api-host",Ee(this.params.apiHost)),this.params.key&&this.dashboardReference.setAttribute("auth-key",this.params.key),this.params.token&&this.dashboardReference.setAttribute("auth-token",this.params.token)}}updated(s){var r;const e=new Set(["dashboardId","dashboardSlug","itemId","language","editorLanguage","qeVersion","theme","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","apiHost","timezoneId","itemDimensions"]),t=["dashboardId","dashboardSlug","itemId"];let i=!1;for(const n of t)i=i||s.get(n)===void 0&&this[n]!==void 0;if(i&&!this.isInitCalled){this.initComponent(),this.isInitCalled=!0;return}if(this.isWebComponentViewMode()){if(this.dashboardReference){for(const[n]of s.entries())if(n==="appSever")Se(s[n],fs).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete,this.dashboardReference=this.renderRoot.querySelector("dashboard-component"),this.setAllAttributes()});else if(this.attributesMap[n]){const o=this.attributesMap[n]??n,a=typeof this[n]=="object"?JSON.stringify(this[n]):((r=this[n])==null?void 0:r.toString())||this[n];this.dashboardReference.setAttribute(o,a)}}}else for(const[n]of s.entries())e.has(n)&&n!=="editMode"?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout(()=>{console.warn("Failed to load dashboard, appServer is likely down or unreachable.")},15*1e3),this.params=this._setOptions(),us(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=os(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=ls(this)):e.has(n)&&n==="editMode"&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}_setOptions(){const s={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(s.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(s.language=this.language),this.editorLanguage&&(s.editorLanguage=this.editorLanguage),this.qeVersion&&(s.qeVersion=this.qeVersion),this.screenMode&&(s.screenMode=this.screenMode),s.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(s.token=this.authToken),this.authKey&&(s.key=this.authKey),this.editMode&&(s.editMode=this.editMode),this.theme&&(s.theme=this.theme),this.mainColor&&(s.mainColor=this.mainColor),this.accentColor&&(s.accentColor=this.accentColor),this.loaderBackground&&(s.loaderBackground=this.loaderBackground),this.loaderFontColor&&(s.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(s.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(s.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(s.timezoneId=this.timezoneId),this.itemDimensions&&(s.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=this.isWebComponentViewMode()?Ee(this.appServer):lt(this.appServer),s.appServer=this.appServer):(this.appServer=lt(ne.appServer),s.appServer=this.appServer),this.apiHost?(this.apiHost=this.isWebComponentViewMode()?Ee(this.apiHost):lt(this.apiHost),s.apiHost=this.apiHost):(this.apiHost=this.appServer.includes("luzmo.com")?this.appServer.replace("app","api"):this.appServer,s.apiHost=this.apiHost),this.currentAuthKey=this.authKey,this.currentAuthToken=this.authToken,s}_updateIframeUrl(){zo(this.iframe,this._iframeUrl)}_setupLoader(){const s=as(this);this._loaderMsg=s.loadingMsg,s.errorMsg&&(this.browserError=!0,this.browserErrorMsg=s.errorMsg,this._displayError())}_displayError(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}_calculateDimAfterDashboardLoaded(){this.dashboardError=!1,this._loaderStyles(),dt(this)}_loaderStyles(){this._containerStyle=Or(this),this._loaderStyle=_o(this),this._loadingCircleStyle=xo(this),this._containerLoaderStyle=wo(this),this._lcStyle=Eo(this)}static get styles(){return[Uo]}render(){let s;const e=f.x`
144
+ `,gs="DashboardApp",M=class extends f.r$1{constructor(){super(),this.language="auto",this.editorLanguage="auto",this.screenMode="auto",this.switchScreenModeOnResize=!0,this.editMode="view",this.embedMode="iframe",this.iframeStyle={},this._containerStyle={},this._loaderStyle={},this._lcStyle={},this._loadingCircleStyle={},this._containerLoaderStyle={},this._loaderMsg="",this._itemEmbedding=!1,this.browserError=!1,this.browserErrorMsg="",this.dashboardError=!1,this.browserNotSupported=[],this.libVersion=Be+"-wc-luzmo",this.isLibraryLoaded=!1,this.currentAuthKey=null,this.currentAuthToken=null,this.isInitCalled=!1,this.attributesMap={dashboardId:"dashboard-id",dashboardSlug:"dashboard-slug",itemId:"item-id",language:"language",editorLanguage:"editorLanguage",qeVersion:"qe-version",screenMode:"screen-mode",switchScreenModeOnResize:"switch-screen-mode-on-resize",authKey:"auth-key",authToken:"auth-token",editMode:"edit-mode",theme:"theme",mainColor:"main-color",accentColor:"accent-color",loaderBackground:"loader-background",loaderFontColor:"loader-font-color",loaderSpinnerColor:"loader-spinner-color",loaderSpinnerBackground:"loader-spinner-background",appServer:"app-server",apiHost:"api-host",itemDimensions:"item-dimensions",timezoneId:"timezone-id"},this.loaderSize=32,this.borderWidth=3,this.minHeight=400,this._containerId=We(),this._iframeId=`luzmo-dashboard-${this._containerId}`,this.iframeLoaded=!1,this.promises={},this.params=this._setOptions(),this._onResize=()=>{var s;if((s=this.shadowRoot)!=null&&s.querySelector(".dashboard-container")){if(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,this.params.switchScreenModeOnResize&&this.params.screenMode==="auto")for(const e of Or)e.width[0]<=window.innerWidth&&window.innerWidth<=e.width[1]&&(this.currentScreenMode=e.mode);this.iframeLoaded?this._calculateDimAfterDashboardLoaded():this.dimensions&&(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,dt(this))}},this._resizeObserver=new ResizeObserver(s=>{window.requestAnimationFrame(()=>{!Array.isArray(s)||s.length===0||this._onResize()})})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect();for(const s of Object.keys(this.promises))this.promises[s].reject(new Error("Dashboard component was removed"))}firstUpdated(){var s;this._loaderMsg=(s=ls(this))==null?void 0:s.loadingMsg,this._loaderStyles(),zi._components.push(this),this.luzmoEmbedContainer&&this._resizeObserver.observe(this.luzmoEmbedContainer)}initComponent(){var s,e;this.params=this._setOptions(),this.isWebComponentViewMode()?Se(this.params.appServer,gs).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete;const t=this.renderRoot.querySelector("dashboard-component");this.dashboardReference=t.cloneNode(!0),t.replaceWith(this.dashboardReference),this.dashboardReference.addEventListener("load",i=>{this.containerWidth=this.dashboardReference.offsetWidth,this.dimensions=i.detail.dimensions,dt(this),window.dispatchEvent(new Event("resize")),this.dispatchEvent(new CustomEvent("load",i))}),this.dashboardReference.addEventListener("itemsRendered",i=>this.dispatchEvent(new CustomEvent("itemsRendered",i))),this.dashboardReference.addEventListener("customEvent",i=>this.dispatchEvent(new CustomEvent("customEvent",i))),this.dashboardReference.addEventListener("changedFilters",i=>this.dispatchEvent(new CustomEvent("changedFilters",i))),this.dashboardReference.addEventListener("dashboardAction",i=>this.dispatchEvent(new CustomEvent("dashboardAction",i))),this.dashboardReference.addEventListener("export",i=>this.dispatchEvent(new CustomEvent("exported",i))),this.setAllAttributes()}):(this.containerWidth=(s=this.container)==null?void 0:s.clientWidth,ms(this),po(this),this._setupLoader(),this.params.error||(this._loaderStyles(),Uo(),this._iframeUrl=as(this),(e=this.iframe)==null||e.setAttribute("src",this._iframeUrl),this.iframeStyle=ds(this)))}setAllAttributes(){if(this.dashboardReference){for(const s in this.attributesMap)!["authKey","authToken","apiHost","itemDimensions"].includes(s)&&this.params[s]&&this.dashboardReference.setAttribute(this.attributesMap[s],this.params[s]);this.params.itemDimensions&&this.dashboardReference.setAttribute("item-dimensions",JSON.stringify(this.params.itemDimensions)),this.params.apiHost&&this.dashboardReference.setAttribute("api-host",Ee(this.params.apiHost)),this.params.key&&this.dashboardReference.setAttribute("auth-key",this.params.key),this.params.token&&this.dashboardReference.setAttribute("auth-token",this.params.token)}}updated(s){var r;const e=new Set(["dashboardId","dashboardSlug","itemId","language","editorLanguage","qeVersion","theme","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","apiHost","timezoneId","itemDimensions"]),t=["dashboardId","dashboardSlug","itemId"];let i=!1;for(const n of t)i=i||s.get(n)===void 0&&this[n]!==void 0;if(i&&!this.isInitCalled){this.initComponent(),this.isInitCalled=!0;return}if(this.isWebComponentViewMode()){if(this.dashboardReference){for(const[n]of s.entries())if(n==="appSever")Se(s[n],gs).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete,this.dashboardReference=this.renderRoot.querySelector("dashboard-component"),this.setAllAttributes()});else if(this.attributesMap[n]){const o=this.attributesMap[n]??n,a=typeof this[n]=="object"?JSON.stringify(this[n]):((r=this[n])==null?void 0:r.toString())||this[n];this.dashboardReference.setAttribute(o,a)}}}else for(const[n]of s.entries())e.has(n)&&n!=="editMode"?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout(()=>{console.warn("Failed to load dashboard, appServer is likely down or unreachable.")},15*1e3),this.params=this._setOptions(),ms(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=as(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=ds(this)):e.has(n)&&n==="editMode"&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}_setOptions(){const s={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(s.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(s.language=this.language),this.editorLanguage&&(s.editorLanguage=this.editorLanguage),this.qeVersion&&(s.qeVersion=this.qeVersion),this.screenMode&&(s.screenMode=this.screenMode),s.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(s.token=this.authToken),this.authKey&&(s.key=this.authKey),this.editMode&&(s.editMode=this.editMode),this.theme&&(s.theme=this.theme),this.mainColor&&(s.mainColor=this.mainColor),this.accentColor&&(s.accentColor=this.accentColor),this.loaderBackground&&(s.loaderBackground=this.loaderBackground),this.loaderFontColor&&(s.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(s.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(s.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(s.timezoneId=this.timezoneId),this.itemDimensions&&(s.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=this.isWebComponentViewMode()?Ee(this.appServer):lt(this.appServer),s.appServer=this.appServer):(this.appServer=lt(ne.appServer),s.appServer=this.appServer),this.apiHost?(this.apiHost=this.isWebComponentViewMode()?Ee(this.apiHost):lt(this.apiHost),s.apiHost=this.apiHost):(this.apiHost=this.appServer.includes("luzmo.com")?this.appServer.replace("app","api"):this.appServer,s.apiHost=this.apiHost),this.currentAuthKey=this.authKey,this.currentAuthToken=this.authToken,s}_updateIframeUrl(){Mo(this.iframe,this._iframeUrl)}_setupLoader(){const s=ls(this);this._loaderMsg=s.loadingMsg,s.errorMsg&&(this.browserError=!0,this.browserErrorMsg=s.errorMsg,this._displayError())}_displayError(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}_calculateDimAfterDashboardLoaded(){this.dashboardError=!1,this._loaderStyles(),dt(this)}_loaderStyles(){this._containerStyle=Pr(this),this._loaderStyle=xo(this),this._loadingCircleStyle=Eo(this),this._containerLoaderStyle=_o(this),this._lcStyle=zo(this)}static get styles(){return[qo]}render(){let s;const e=f.x`
145
145
  <div
146
146
  class="luzmo-container-loader"
147
147
  id="luzmo-container-loader-${this._containerId}"
148
- style=${Te(this._containerLoaderStyle)}
148
+ style=${Ne(this._containerLoaderStyle)}
149
149
  >
150
150
  <div
151
151
  class="luzmo-loader"
152
152
  id="luzmo-loader-${this._containerId}"
153
- style=${Te(this._loaderStyle)}
153
+ style=${Ne(this._loaderStyle)}
154
154
  >
155
155
  <div
156
156
  class="luzmo-lc"
157
- style=${Te(this._lcStyle)}
157
+ style=${Ne(this._lcStyle)}
158
158
  >
159
159
  <div
160
160
  class="luzmo-loading-circle"
161
- style=${Te(this._loadingCircleStyle)}
161
+ style=${Ne(this._loadingCircleStyle)}
162
162
  ></div>
163
163
  ${this._itemEmbedding?"":f.x`
164
164
  <div
165
165
  class="luzmo-loading-message"
166
- style=${Te({color:this.loaderFontColor})}
166
+ style=${Ne({color:this.loaderFontColor})}
167
167
  >
168
168
  ${this._loaderMsg}
169
169
  </div>
@@ -187,7 +187,7 @@ ${s}`,console.warn(t))},go=s=>{let e=!1,t="";const r=(document.body||document.do
187
187
  class="luzmo-embed-dashboard ${this.isWebComponentViewMode()?"":"luzmo-embed-dashboard-ede"}"
188
188
  id="${this._iframeId}"
189
189
  name="${this._iframeId}"
190
- style=${Te(this.iframeStyle)}
190
+ style=${Ne(this.iframeStyle)}
191
191
  src="${this._iframeUrl}"
192
192
  frameborder="0"
193
193
  ></iframe>
@@ -198,16 +198,16 @@ ${s}`,console.warn(t))},go=s=>{let e=!1,t="";const r=(document.body||document.do
198
198
  </div>
199
199
  `:""}
200
200
  `,f.x`
201
- <div class="${xi} ${this.isWebComponentViewMode()?"":`${xi}-ede`}">
201
+ <div class="${Ei} ${this.isWebComponentViewMode()?"":`${Ei}-ede`}">
202
202
  <div
203
203
  class="dashboard-container"
204
- style=${Te(Object.assign({},this._containerStyle,{width:this.iframeStyle.width??"100%",height:this.iframeStyle.height??"100%"}))}
204
+ style=${Ne(Object.assign({},this._containerStyle,{width:this.iframeStyle.width??"100%",height:this.iframeStyle.height??"100%"}))}
205
205
  >
206
206
  ${s}
207
207
  </div>
208
208
  </div>
209
209
 
210
- `}getDashboards(){return new Promise(s=>s(Ei._components))}getData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getData(s):this.isWebComponentViewMode()?Promise.reject():ko(this,this.iframe,s)}getFilters(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getFilters():this.isWebComponentViewMode()?Promise.reject():Ro(this,this.iframe)}setSelectedData(s,e){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setSelectedData(s,e):this.isWebComponentViewMode()?Promise.reject():Do(this,this.iframe,s,e)}setAuthorization(s,e){return this.currentAuthKey=s,this.currentAuthToken=e,this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setAuthorization(s,e):this.isWebComponentViewMode()?Promise.reject():Ao(this,this.iframe,s,e)}refreshData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.refreshData(s):this.isWebComponentViewMode()?Promise.reject():s?hs(this,this.iframe,s):hs(this,this.iframe)}reloadDashboard(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.reloadDashboard():this.isWebComponentViewMode()?Promise.reject():So(this,this.iframe)}exportDashboard(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.exportDashboard(s):this.isWebComponentViewMode()?Promise.reject():s?cs(this,this.iframe,s):cs(this,this.iframe)}getAccessibleDashboards(){return Mo(this)}addFilters(s,e){return this.dashboardReference.addFilters(s,e)}setEditMode(s){return this.dashboardReference&&s==="view"?(this.editMode="view",this.params.editMode="view",this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.dashboardReference&&["editFull","editLimited"].includes(s)?(this.editMode=s,this.params.editMode=s,this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setEditMode(s):this.isWebComponentViewMode()?Promise.reject():Co(this,this.iframe,s)}setPreview(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setPreview(s):Lo(this,this.iframe,s)}isWebComponentViewMode(){return this.embedMode==="webComponent"&&(this.params.editMode==="view"||this.params.editMode===void 0)}};v([jt.e(".dashboard-container")],M.prototype,"container");v([jt.e(`.${xi}`)],M.prototype,"luzmoEmbedContainer");v([jt.e("iframe")],M.prototype,"iframe");v([f.n()],M.prototype,"dashboardId");v([f.n()],M.prototype,"dashboardSlug");v([f.n()],M.prototype,"itemId");v([f.n()],M.prototype,"language");v([f.n()],M.prototype,"editorLanguage");v([f.n()],M.prototype,"qeVersion");v([f.n()],M.prototype,"screenMode");v([f.n({converter:{fromAttribute:s=>s==="true",toAttribute:String}})],M.prototype,"switchScreenModeOnResize");v([f.n()],M.prototype,"editMode");v([f.n()],M.prototype,"theme");v([f.n()],M.prototype,"mainColor");v([f.n()],M.prototype,"accentColor");v([f.n()],M.prototype,"authToken");v([f.n()],M.prototype,"authKey");v([f.n()],M.prototype,"loaderBackground");v([f.n()],M.prototype,"loaderFontColor");v([f.n()],M.prototype,"loaderSpinnerColor");v([f.n()],M.prototype,"loaderSpinnerBackground");v([f.n()],M.prototype,"appServer");v([f.n()],M.prototype,"timezoneId");v([f.n()],M.prototype,"apiHost");v([f.n({type:Object})],M.prototype,"itemDimensions");v([f.n()],M.prototype,"embedMode");v([f.n({attribute:!1})],M.prototype,"_containerId");v([f.n({attribute:!1})],M.prototype,"_iframeId");v([f.n({attribute:!1})],M.prototype,"params");v([f.n({attribute:!1})],M.prototype,"_iframeUrl");v([f.n({attribute:!1})],M.prototype,"iframeLoaded");v([f.n({attribute:!1})],M.prototype,"promises");v([f.n({attribute:!1})],M.prototype,"iframeStyle");v([f.n({attribute:!1})],M.prototype,"_containerStyle");v([f.n({attribute:!1})],M.prototype,"_loaderStyle");v([f.n({attribute:!1})],M.prototype,"_lcStyle");v([f.n({attribute:!1})],M.prototype,"_loadingCircleStyle");v([f.n({attribute:!1})],M.prototype,"_containerLoaderStyle");v([f.n({attribute:!1})],M.prototype,"_loaderMsg");v([f.n({attribute:!1})],M.prototype,"containerWidth");v([f.n({attribute:!1})],M.prototype,"dimensions");v([f.n({attribute:!1})],M.prototype,"currentScreenMode");v([f.n({attribute:!1})],M.prototype,"_itemEmbedding");v([f.n({attribute:!1})],M.prototype,"browserError");v([f.n({attribute:!1})],M.prototype,"browserErrorMsg");v([f.n({attribute:!1})],M.prototype,"dashboardError");v([f.n({attribute:!1})],M.prototype,"browserNotSupported");v([f.n()],M.prototype,"libVersion");v([st.r()],M.prototype,"isLibraryLoaded");v([st.r()],M.prototype,"dashboardReference");v([st.r()],M.prototype,"currentAuthKey");v([st.r()],M.prototype,"currentAuthToken");v([st.r()],M.prototype,"isInitCalled");var jo=class extends M{};customElements.get("luzmo-embed-dashboard")||customElements.define("luzmo-embed-dashboard",jo);var qo="0.1.95",gs="VizItemApp",Ye,q=(Ye=class extends f.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.slots=[],this.version=Be+"-wc-luzmo",this.dashboardContentsVersion=qo,this.libVersion=Be+"-wc-luzmo",this.postInitCallQueue=[]}createRenderRoot(){return this.style.display||(this.style.display="block"),this.style.height||(this.style.height="100%"),this.style.width||(this.style.width="100%"),this}canInitializeVizItem(){return!!(this.type||this.dashboardId&&this.itemId)}getFilters(){return this.chartElement.getFilters()}export(e="png"){return this.chartElement.export(e)}getData(){return this.chartElement.getData()}refreshData(){return this.chartElement.refreshData()}setSelectedData(e){return this.chartElement.setSelectedData(void 0,e)}setAuthorization(e,t){return this.chartElement.setAuthorization(e,t)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e==="selecteddata"&&(this.chartElement?this.setSelectedData(JSON.parse(i??"{}")):this.postInitCallQueue.push([this.setSelectedData,[JSON.parse(i??"{}")]]))}async firstUpdated(e){super.firstUpdated(e),this.canInitializeVizItem()&&(await Se(this.appServer,gs),this.createAndAppendElement())}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("chart-component"),this.chartElement.setAttribute("embedding-mode","chart"),this.chartElement.style.height="100%",this.chartElement.style.width="100%",this.chartElement.style.display="block",this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.chartElement.addEventListener("rendered",e=>{var t;if(((t=this.postInitCallQueue)==null?void 0:t.length)>0)for(const i of this.postInitCallQueue)i[0].bind(this)(...i[1]);else this.selectedData&&this.setSelectedData(this.selectedData);this.dispatchEvent(new CustomEvent("rendered",e))}),this.chartElement.addEventListener("changedFilters",e=>this.dispatchEvent(new CustomEvent("changedFilters",e))),this.chartElement.addEventListener("exported",e=>this.dispatchEvent(new CustomEvent("exported",e))),this.chartElement.addEventListener("customEvent",e=>this.dispatchEvent(new CustomEvent("customEvent",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in ri){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?Ee(t):t;this.chartElement.setAttribute(ri[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=ri[i]??i,n=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,n)}else this.canInitializeVizItem()&&(await Se(this.appServer,gs),this.createAndAppendElement())}render(){return f.x` `}},Ye.styles=f.i`
210
+ `}getDashboards(){return new Promise(s=>s(zi._components))}getData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getData(s):this.isWebComponentViewMode()?Promise.reject():Ro(this,this.iframe,s)}getFilters(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getFilters():this.isWebComponentViewMode()?Promise.reject():So(this,this.iframe)}setSelectedData(s,e){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setSelectedData(s,e):this.isWebComponentViewMode()?Promise.reject():Lo(this,this.iframe,s,e)}setAuthorization(s,e){return this.currentAuthKey=s,this.currentAuthToken=e,this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setAuthorization(s,e):this.isWebComponentViewMode()?Promise.reject():Co(this,this.iframe,s,e)}refreshData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.refreshData(s):this.isWebComponentViewMode()?Promise.reject():s?us(this,this.iframe,s):us(this,this.iframe)}reloadDashboard(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.reloadDashboard():this.isWebComponentViewMode()?Promise.reject():Ao(this,this.iframe)}exportDashboard(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.exportDashboard(s):this.isWebComponentViewMode()?Promise.reject():s?hs(this,this.iframe,s):hs(this,this.iframe)}getAccessibleDashboards(){return ko(this)}addFilters(s,e){return this.dashboardReference.addFilters(s,e)}setEditMode(s){return this.dashboardReference&&s==="view"?(this.editMode="view",this.params.editMode="view",this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.dashboardReference&&["editFull","editLimited"].includes(s)?(this.editMode=s,this.params.editMode=s,this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setEditMode(s):this.isWebComponentViewMode()?Promise.reject():Do(this,this.iframe,s)}setPreview(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setPreview(s):Io(this,this.iframe,s)}isWebComponentViewMode(){return this.embedMode==="webComponent"&&(this.params.editMode==="view"||this.params.editMode===void 0)}};v([qt.e(".dashboard-container")],M.prototype,"container");v([qt.e(`.${Ei}`)],M.prototype,"luzmoEmbedContainer");v([qt.e("iframe")],M.prototype,"iframe");v([f.n()],M.prototype,"dashboardId");v([f.n()],M.prototype,"dashboardSlug");v([f.n()],M.prototype,"itemId");v([f.n()],M.prototype,"language");v([f.n()],M.prototype,"editorLanguage");v([f.n()],M.prototype,"qeVersion");v([f.n()],M.prototype,"screenMode");v([f.n({converter:{fromAttribute:s=>s==="true",toAttribute:String}})],M.prototype,"switchScreenModeOnResize");v([f.n()],M.prototype,"editMode");v([f.n()],M.prototype,"theme");v([f.n()],M.prototype,"mainColor");v([f.n()],M.prototype,"accentColor");v([f.n()],M.prototype,"authToken");v([f.n()],M.prototype,"authKey");v([f.n()],M.prototype,"loaderBackground");v([f.n()],M.prototype,"loaderFontColor");v([f.n()],M.prototype,"loaderSpinnerColor");v([f.n()],M.prototype,"loaderSpinnerBackground");v([f.n()],M.prototype,"appServer");v([f.n()],M.prototype,"timezoneId");v([f.n()],M.prototype,"apiHost");v([f.n({type:Object})],M.prototype,"itemDimensions");v([f.n()],M.prototype,"embedMode");v([f.n({attribute:!1})],M.prototype,"_containerId");v([f.n({attribute:!1})],M.prototype,"_iframeId");v([f.n({attribute:!1})],M.prototype,"params");v([f.n({attribute:!1})],M.prototype,"_iframeUrl");v([f.n({attribute:!1})],M.prototype,"iframeLoaded");v([f.n({attribute:!1})],M.prototype,"promises");v([f.n({attribute:!1})],M.prototype,"iframeStyle");v([f.n({attribute:!1})],M.prototype,"_containerStyle");v([f.n({attribute:!1})],M.prototype,"_loaderStyle");v([f.n({attribute:!1})],M.prototype,"_lcStyle");v([f.n({attribute:!1})],M.prototype,"_loadingCircleStyle");v([f.n({attribute:!1})],M.prototype,"_containerLoaderStyle");v([f.n({attribute:!1})],M.prototype,"_loaderMsg");v([f.n({attribute:!1})],M.prototype,"containerWidth");v([f.n({attribute:!1})],M.prototype,"dimensions");v([f.n({attribute:!1})],M.prototype,"currentScreenMode");v([f.n({attribute:!1})],M.prototype,"_itemEmbedding");v([f.n({attribute:!1})],M.prototype,"browserError");v([f.n({attribute:!1})],M.prototype,"browserErrorMsg");v([f.n({attribute:!1})],M.prototype,"dashboardError");v([f.n({attribute:!1})],M.prototype,"browserNotSupported");v([f.n()],M.prototype,"libVersion");v([st.r()],M.prototype,"isLibraryLoaded");v([st.r()],M.prototype,"dashboardReference");v([st.r()],M.prototype,"currentAuthKey");v([st.r()],M.prototype,"currentAuthToken");v([st.r()],M.prototype,"isInitCalled");var jo=class extends M{};customElements.get("luzmo-embed-dashboard")||customElements.define("luzmo-embed-dashboard",jo);var Vo="0.1.95",ps="VizItemApp",Ye,q=(Ye=class extends f.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.slots=[],this.version=Be+"-wc-luzmo",this.dashboardContentsVersion=Vo,this.libVersion=Be+"-wc-luzmo",this.postInitCallQueue=[]}createRenderRoot(){return this.style.display||(this.style.display="block"),this.style.height||(this.style.height="100%"),this.style.width||(this.style.width="100%"),this}canInitializeVizItem(){return!!(this.type||this.dashboardId&&this.itemId)}getFilters(){return this.chartElement.getFilters()}export(e="png"){return this.chartElement.export(e)}getData(){return this.chartElement.getData()}refreshData(){return this.chartElement.refreshData()}setSelectedData(e){return this.chartElement.setSelectedData(void 0,e)}setAuthorization(e,t){return this.chartElement.setAuthorization(e,t)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e==="selecteddata"&&(this.chartElement?this.setSelectedData(JSON.parse(i??"{}")):this.postInitCallQueue.push([this.setSelectedData,[JSON.parse(i??"{}")]]))}async firstUpdated(e){super.firstUpdated(e),this.canInitializeVizItem()&&(await Se(this.appServer,ps),this.createAndAppendElement())}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("chart-component"),this.chartElement.setAttribute("embedding-mode","chart"),this.chartElement.style.height="100%",this.chartElement.style.width="100%",this.chartElement.style.display="block",this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.chartElement.addEventListener("rendered",e=>{var t;if(((t=this.postInitCallQueue)==null?void 0:t.length)>0)for(const i of this.postInitCallQueue)i[0].bind(this)(...i[1]);else this.selectedData&&this.setSelectedData(this.selectedData);this.dispatchEvent(new CustomEvent("rendered",e))}),this.chartElement.addEventListener("changedFilters",e=>this.dispatchEvent(new CustomEvent("changedFilters",e))),this.chartElement.addEventListener("exported",e=>this.dispatchEvent(new CustomEvent("exported",e))),this.chartElement.addEventListener("customEvent",e=>this.dispatchEvent(new CustomEvent("customEvent",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in ni){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?Ee(t):t;this.chartElement.setAttribute(ni[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=ni[i]??i,n=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,n)}else this.canInitializeVizItem()&&(await Se(this.appServer,ps),this.createAndAppendElement())}render(){return f.x` `}},Ye.styles=f.i`
211
211
  :host {
212
212
  display: block;
213
213
  width: 100%;
@@ -219,27 +219,27 @@ ${s}`,console.warn(t))},go=s=>{let e=!1,t="";const r=(document.body||document.do
219
219
  height: 1000%;
220
220
  display: block;
221
221
  }
222
- `,Ye);v([f.n()],q.prototype,"appServer");v([f.n()],q.prototype,"apiHost");v([f.n({type:Array})],q.prototype,"slots");v([f.n({type:Object})],q.prototype,"options");v([f.n()],q.prototype,"type");v([f.n()],q.prototype,"authKey");v([f.n()],q.prototype,"authToken");v([f.n()],q.prototype,"version");v([f.n()],q.prototype,"contextId");v([f.n({converter:s=>{try{return JSON.parse(s)}catch{return s}}})],q.prototype,"canFilter");v([f.n({type:Array})],q.prototype,"filters");v([f.n()],q.prototype,"dashboardId");v([f.n()],q.prototype,"itemId");v([f.n({type:Object})],q.prototype,"selectedData");v([f.n()],q.prototype,"dashboardContentsVersion");v([f.n()],q.prototype,"libVersion");var Vo=class extends q{};customElements.get("luzmo-embed-viz-item")||customElements.define("luzmo-embed-viz-item",Vo);var ni={aiEndpoint:"ai-endpoint",appServer:"app-server",apiHost:"api-host",options:"options",initialSuggestionsDatasetId:"initialSuggestionsDatasetId",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",aydHost:"ayd-host",availableDatasets:"available-datasets"},zi="luzmo-iq-embed-chat",ps="luzmo-iq-chat-component",Xe,re=(Xe=class extends f.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=Be+"-wc-luzmo",this.libVersion=Be+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202/",this.aydHost="https://ayd.luzmo.com/",this.availableDatasets=[]}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await Se(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement(ps),this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in ni){const t=this[e];if(t){const i=["appServer","apiHost","aydHost"].includes(e)?Ee(t):t;this.chartElement.setAttribute(ni[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=ni[i]??i,n=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,n)}else await Se(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return f.x``}connectedCallback(){super.connectedCallback();const e=document.querySelector(zi);if(!e)return;const t=new MutationObserver(()=>{const i=e.querySelector('*[slot="custom-chat-widget-content"]');if(!i)return;const r=e.querySelector(ps);r&&(r.append(i),t.disconnect())});t.observe(e,{childList:!0,subtree:!0})}},Xe.styles=f.i`
222
+ `,Ye);v([f.n()],q.prototype,"appServer");v([f.n()],q.prototype,"apiHost");v([f.n({type:Array})],q.prototype,"slots");v([f.n({type:Object})],q.prototype,"options");v([f.n()],q.prototype,"type");v([f.n()],q.prototype,"authKey");v([f.n()],q.prototype,"authToken");v([f.n()],q.prototype,"version");v([f.n()],q.prototype,"contextId");v([f.n({converter:s=>{try{return JSON.parse(s)}catch{return s}}})],q.prototype,"canFilter");v([f.n({type:Array})],q.prototype,"filters");v([f.n()],q.prototype,"dashboardId");v([f.n()],q.prototype,"itemId");v([f.n({type:Object})],q.prototype,"selectedData");v([f.n()],q.prototype,"dashboardContentsVersion");v([f.n()],q.prototype,"libVersion");var Yo=class extends q{};customElements.get("luzmo-embed-viz-item")||customElements.define("luzmo-embed-viz-item",Yo);var oi={aiEndpoint:"ai-endpoint",appServer:"app-server",apiHost:"api-host",options:"options",initialSuggestionsDatasetId:"initialSuggestionsDatasetId",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",aydHost:"ayd-host",availableDatasets:"available-datasets"},Mi="luzmo-iq-embed-chat",bs="luzmo-iq-chat-component",Xe,re=(Xe=class extends f.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=Be+"-wc-luzmo",this.libVersion=Be+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202/",this.aydHost="https://ayd.luzmo.com/",this.availableDatasets=[]}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await Se(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement(bs),this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in oi){const t=this[e];if(t){const i=["appServer","apiHost","aydHost"].includes(e)?Ee(t):t;this.chartElement.setAttribute(oi[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=oi[i]??i,n=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,n)}else await Se(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return f.x``}connectedCallback(){super.connectedCallback();const e=document.querySelector(Mi);if(!e)return;const t=new MutationObserver(()=>{const i=e.querySelector('*[slot="custom-chat-widget-content"]');if(!i)return;const r=e.querySelector(bs);r&&(r.append(i),t.disconnect())});t.observe(e,{childList:!0,subtree:!0})}},Xe.styles=f.i`
223
223
  :host {
224
224
  display: block;
225
225
  width: 100%;
226
226
  height: 100%;
227
227
  }
228
- `,Xe);v([f.n()],re.prototype,"appServer");v([f.n()],re.prototype,"apiHost");v([f.n({type:Object})],re.prototype,"options");v([f.n({type:String})],re.prototype,"initialSuggestionsDatasetId");v([f.n()],re.prototype,"aiEndpoint");v([f.n()],re.prototype,"authKey");v([f.n()],re.prototype,"authToken");v([f.n()],re.prototype,"version");v([f.n()],re.prototype,"libVersion");v([f.n()],re.prototype,"remoteEntryServer");v([f.n()],re.prototype,"aydHost");v([f.n({type:Array})],re.prototype,"availableDatasets");customElements.get(zi)||customElements.define(zi,re);var oi={aiEndPoint:"ai-end-point",appServer:"app-server",apiHost:"api-host",options:"options",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",messages:"messages"},bs="luzmo-iq-embed-answer",Ke,he=(Ke=class extends f.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=Be+"-wc-luzmo",this.libVersion=Be+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202"}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await Se(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("luzmo-iq-answer-component"),this.chartElement.addEventListener("addQuestion",e=>this.dispatchEvent(new CustomEvent("addQuestion",e))),this.chartElement.addEventListener("addAnswer",e=>this.dispatchEvent(new CustomEvent("addAnswer",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in oi){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?Ee(t):t;this.chartElement.setAttribute(oi[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=oi[i]??i,n=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,n)}else await Se(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return f.x` `}},Ke.styles=f.i`
228
+ `,Xe);v([f.n()],re.prototype,"appServer");v([f.n()],re.prototype,"apiHost");v([f.n({type:Object})],re.prototype,"options");v([f.n({type:String})],re.prototype,"initialSuggestionsDatasetId");v([f.n()],re.prototype,"aiEndpoint");v([f.n()],re.prototype,"authKey");v([f.n()],re.prototype,"authToken");v([f.n()],re.prototype,"version");v([f.n()],re.prototype,"libVersion");v([f.n()],re.prototype,"remoteEntryServer");v([f.n()],re.prototype,"aydHost");v([f.n({type:Array})],re.prototype,"availableDatasets");customElements.get(Mi)||customElements.define(Mi,re);var ai={aiEndPoint:"ai-end-point",appServer:"app-server",apiHost:"api-host",options:"options",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",messages:"messages"},ys="luzmo-iq-embed-answer",Ke,he=(Ke=class extends f.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=Be+"-wc-luzmo",this.libVersion=Be+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202"}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await Se(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("luzmo-iq-answer-component"),this.chartElement.addEventListener("addQuestion",e=>this.dispatchEvent(new CustomEvent("addQuestion",e))),this.chartElement.addEventListener("addAnswer",e=>this.dispatchEvent(new CustomEvent("addAnswer",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in ai){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?Ee(t):t;this.chartElement.setAttribute(ai[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=ai[i]??i,n=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,n)}else await Se(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return f.x` `}},Ke.styles=f.i`
229
229
  :host {
230
230
  display: block;
231
231
  width: 100%;
232
232
  height: 100%;
233
233
  }
234
- `,Ke);v([f.n()],he.prototype,"appServer");v([f.n()],he.prototype,"apiHost");v([f.n({type:Object})],he.prototype,"options");v([f.n()],he.prototype,"aiEndPoint");v([f.n()],he.prototype,"authKey");v([f.n()],he.prototype,"authToken");v([f.n()],he.prototype,"messages");v([f.n()],he.prototype,"version");v([f.n()],he.prototype,"libVersion");v([f.n()],he.prototype,"remoteEntryServer");customElements.get(bs)||customElements.define(bs,he);var wr,_r;(_r=(wr=f.r$1).disableWarning)==null||_r.call(wr,"change-in-update");function L(s,e){let t=s.length;Array.isArray(s[0])||(s=[s]),Array.isArray(e[0])||(e=e.map(o=>[o]));let i=e[0].length,r=e[0].map((o,a)=>e.map(l=>l[a])),n=s.map(o=>r.map(a=>{let l=0;if(!Array.isArray(o)){for(let c of a)l+=o*c;return l}for(let c=0;c<o.length;c++)l+=o[c]*(a[c]||0);return l}));return t===1&&(n=n[0]),i===1?n.map(o=>o[0]):n}function yt(s){return ke(s)==="string"}function ke(s){return(Object.prototype.toString.call(s).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Ht(s,{precision:e,unit:t}){return Ae(s)?"none":$r(s,e)+(t??"")}function Ae(s){return Number.isNaN(s)||s instanceof Number&&(s==null?void 0:s.none)}function T(s){return Ae(s)?0:s}function $r(s,e){if(s===0)return 0;let t=~~s,i=0;t&&e&&(i=~~Math.log10(Math.abs(t))+1);const r=10**(e-i);return Math.floor(s*r+.5)/r}const Yo={deg:1,grad:.9,rad:180/Math.PI,turn:360};function Br(s){if(!s)return;s=s.trim();const e=/^([a-z]+)\((.+?)\)$/i,t=/^-?[\d.]+$/,i=/%|deg|g?rad|turn$/,r=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let n=s.match(e);if(n){let o=[];return n[2].replace(r,(a,l)=>{let c=l.match(i),d=l;if(c){let h=c[0],u=d.slice(0,-h.length);h==="%"?(d=new Number(u/100),d.type="<percentage>"):(d=new Number(u*Yo[h]),d.type="<angle>",d.unit=h)}else t.test(d)?(d=new Number(d),d.type="<number>"):d==="none"&&(d=new Number(NaN),d.none=!0);a.startsWith("/")&&(d=d instanceof Number?d:new Number(d),d.alpha=!0),typeof d=="object"&&d instanceof Number&&(d.raw=l),o.push(d)}),{name:n[1].toLowerCase(),rawName:n[1],rawArgs:n[2],args:o}}}function Wr(s){return s[s.length-1]}function ut(s,e,t){return isNaN(s)?e:isNaN(e)?s:s+(e-s)*t}function Fr(s,e,t){return(t-s)/(e-s)}function $i(s,e,t){return ut(e[0],e[1],Fr(s[0],s[1],t))}function Gr(s){return s.map(e=>e.split("|").map(t=>{t=t.trim();let i=t.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(i){let r=new String(i[1]);return r.range=[+i[2],+i[3]],r}return t}))}function Ur(s,e,t){return Math.max(Math.min(t,e),s)}function Kt(s,e){return Math.sign(s)===Math.sign(e)?s:-s}function be(s,e){return Kt(Math.abs(s)**e,s)}function Bi(s,e){return e===0?0:s/e}function jr(s,e,t=0,i=s.length){for(;t<i;){const r=t+i>>1;s[r]<e?t=r+1:i=r}return t}var Xo=Object.freeze({__proto__:null,bisectLeft:jr,clamp:Ur,copySign:Kt,interpolate:ut,interpolateInv:Fr,isNone:Ae,isString:yt,last:Wr,mapRange:$i,multiplyMatrices:L,parseCoordGrammar:Gr,parseFunction:Br,serializeNumber:Ht,skipNone:T,spow:be,toPrecision:$r,type:ke,zdiv:Bi});class Ko{add(e,t,i){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(r){this[r]=this[r]||[],t&&this[r][i?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(i){i.call(t&&t.context?t.context:t,t)})}}const Ce=new Ko;var xr,Er,zr,se={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((zr=(Er=(xr=globalThis==null?void 0:globalThis.process)==null?void 0:xr.env)==null?void 0:Er.NODE_ENV)==null?void 0:zr.toLowerCase())!=="test",warn:function(e){var t,i;this.verbose&&((i=(t=globalThis==null?void 0:globalThis.console)==null?void 0:t.warn)==null||i.call(t,e))}};const X={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function Mi(s){return Array.isArray(s)?s:X[s]}function Ot(s,e,t,i={}){if(s=Mi(s),e=Mi(e),!s||!e)throw new TypeError(`Missing white point to convert ${s?"":"from"}${!s&&!e?"/":""}${e?"":"to"}`);if(s===e)return t;let r={W1:s,W2:e,XYZ:t,options:i};if(Ce.run("chromatic-adaptation-start",r),r.M||(r.W1===X.D65&&r.W2===X.D50?r.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:r.W1===X.D50&&r.W2===X.D65&&(r.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),Ce.run("chromatic-adaptation-end",r),r.M)return L(r.M,r.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Jo=new Set(["<number>","<percentage>","<angle>"]);function ys(s,e,t,i){return Object.entries(s.coords).map(([n,o],a)=>{let l=e.coordGrammar[a],c=i[a],d=c==null?void 0:c.type,h;if(c.none?h=l.find(m=>Jo.has(m)):h=l.find(m=>m==d),!h){let m=o.name||n;throw new TypeError(`${d??c.raw} not allowed for ${m} in ${t}()`)}let u=h.range;d==="<percentage>"&&(u||(u=[0,1]));let g=o.range||o.refRange;return u&&g&&(i[a]=$i(u,g,i[a])),h})}function qr(s,{meta:e}={}){var i,r,n,o;let t={str:(i=String(s))==null?void 0:i.trim()};if(Ce.run("parse-start",t),t.color)return t.color;if(t.parsed=Br(t.str),t.parsed){let a=t.parsed.name;if(a==="color"){let l=t.parsed.args.shift(),c=l.startsWith("--")?l.substring(2):`--${l}`,d=[l,c],h=t.parsed.rawArgs.indexOf("/")>0?t.parsed.args.pop():1;for(let m of E.all){let b=m.getFormat("color");if(b&&(d.includes(b.id)||(r=b.ids)!=null&&r.filter(y=>d.includes(y)).length)){const y=Object.keys(m.coords).map((_,x)=>t.parsed.args[x]||0);let w;return b.coordGrammar&&(w=ys(m,b,"color",y)),e&&Object.assign(e,{formatId:"color",types:w}),b.id.startsWith("--")&&!l.startsWith("--")&&se.warn(`${m.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${b.id}) instead of color(${l}).`),l.startsWith("--")&&!b.id.startsWith("--")&&se.warn(`${m.name} is a standard space and supported in the CSS spec. Use color(${b.id}) instead of prefixed color(${l}).`),{spaceId:m.id,coords:y,alpha:h}}}let u="",g=l in E.registry?l:c;if(g in E.registry){let m=(o=(n=E.registry[g].formats)==null?void 0:n.color)==null?void 0:o.id;m&&(u=`Did you mean color(${m})?`)}throw new TypeError(`Cannot parse color(${l}). `+(u||"Missing a plugin?"))}else for(let l of E.all){let c=l.getFormat(a);if(c&&c.type==="function"){let d=1;(c.lastAlpha||Wr(t.parsed.args).alpha)&&(d=t.parsed.args.pop());let h=t.parsed.args,u;return c.coordGrammar&&(u=ys(l,c,a,h)),e&&Object.assign(e,{formatId:c.name,types:u}),{spaceId:l.id,coords:h,alpha:d}}}}else for(let a of E.all)for(let l in a.formats){let c=a.formats[l];if(c.type!=="custom"||c.test&&!c.test(t.str))continue;let d=c.parse(t.str);if(d)return d.alpha??(d.alpha=1),e&&(e.formatId=l),d}throw new TypeError(`Could not parse ${s} as a color. Missing a plugin?`)}function A(s){if(Array.isArray(s))return s.map(A);if(!s)throw new TypeError("Empty color reference");yt(s)&&(s=qr(s));let e=s.space||s.spaceId;return e instanceof E||(s.space=E.get(e)),s.alpha===void 0&&(s.alpha=1),s}const Zo=75e-6,K=class K{constructor(e){var r;this.id=e.id,this.name=e.name,this.base=e.base?K.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let t=e.coords??this.base.coords;for(let n in t)"name"in t[n]||(t[n].name=n);this.coords=t;let i=e.white??this.base.white??"D65";this.white=Mi(i),this.formats=e.formats??{};for(let n in this.formats){let o=this.formats[n];o.type||(o.type="function"),o.name||(o.name=n)}(r=this.formats.color)!=null&&r.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace=e.gamutSpace==="self"?this:K.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(n,o)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:Qo(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),Ce.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=Zo}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let i=Object.values(this.coords);return e.every((r,n)=>{let o=i[n];if(o.type!=="angle"&&o.range){if(Number.isNaN(r))return!0;let[a,l]=o.range;return(a===void 0||r>=a-t)&&(l===void 0||r<=l+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return((t=(e=this.formats)==null?void 0:e.color)==null?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=vs(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=vs(t,this),t):null}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(e,t){if(arguments.length===1){const a=A(e);[e,t]=[a.space,a.coords]}if(e=K.get(e),this.equals(e))return t;t=t.map(a=>Number.isNaN(a)?0:a);let i=this.path,r=e.path,n,o;for(let a=0;a<i.length&&i[a].equals(r[a]);a++)n=i[a],o=a;if(!n)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let a=i.length-1;a>o;a--)t=i[a].toBase(t);for(let a=o+1;a<r.length;a++)t=r[a].fromBase(t);return t}from(e,t){if(arguments.length===1){const i=A(e);[e,t]=[i.space,i.coords]}return e=K.get(e),e.to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let i=this.coords[t],r=i.range||i.refRange;e.push((r==null?void 0:r.min)??0)}return e}static get all(){return[...new Set(Object.values(K.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let i of t.aliases)this.register(i,t);return t}static get(e,...t){if(!e||e instanceof K)return e;if(ke(e)==="string"){let r=K.registry[e.toLowerCase()];if(!r)throw new TypeError(`No color space found with id = "${e}"`);return r}if(t.length)return K.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var l;let i=ke(e),r,n;if(i==="string"?e.includes(".")?[r,n]=e.split("."):[r,n]=[,e]:Array.isArray(e)?[r,n]=e:(r=e.space,n=e.coordId),r=K.get(r),r||(r=t),!r)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=ke(n),i==="number"||i==="string"&&n>=0){let c=Object.entries(r.coords)[n];if(c)return{space:r,id:c[0],index:n,...c[1]}}r=K.get(r);let o=n.toLowerCase(),a=0;for(let c in r.coords){let d=r.coords[c];if(c.toLowerCase()===o||((l=d.name)==null?void 0:l.toLowerCase())===o)return{space:r,id:c,index:a,...d};a++}throw new TypeError(`No "${n}" coordinate found in ${r.name}. Its coordinates are: ${Object.keys(r.coords).join(", ")}`)}};ii(K,"registry",{}),ii(K,"DEFAULT_FORMAT",{type:"functions",name:"color"});let E=K;function Qo(s){let e=[s];for(let t=s;t=t.base;)e.push(t);return e}function vs(s,{coords:e}={}){if(s.coords&&!s.coordGrammar){s.type||(s.type="function"),s.name||(s.name="color"),s.coordGrammar=Gr(s.coords);let t=Object.entries(e).map(([i,r],n)=>{let o=s.coordGrammar[n][0],a=r.range||r.refRange,l=o.range,c="";return o=="<percentage>"?(l=[0,100],c="%"):o=="<angle>"&&(c="deg"),{fromRange:a,toRange:l,suffix:c}});s.serializeCoords=(i,r)=>i.map((n,o)=>{let{fromRange:a,toRange:l,suffix:c}=t[o];return a&&l&&(n=$i(a,l,n)),n=Ht(n,{precision:r,unit:c}),n})}return s}var j=new E({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class J extends E{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=j),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=t=>{let i=L(e.toXYZ_M,t);return this.white!==this.base.white&&(i=Ot(this.white,this.base.white,i)),i}),e.fromBase??(e.fromBase=t=>(t=Ot(this.base.white,this.white,t),L(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function vt(s,e){return s=A(s),!e||s.space.equals(e)?s.coords.slice():(e=E.get(e),e.from(s))}function ee(s,e){s=A(s);let{space:t,index:i}=E.resolveCoord(e,s.space);return vt(s,t)[i]}function Wi(s,e,t){return s=A(s),e=E.get(e),s.coords=e.to(s.space,t),s}Wi.returns="color";function ze(s,e,t){if(s=A(s),arguments.length===2&&ke(arguments[1])==="object"){let i=arguments[1];for(let r in i)ze(s,r,i[r])}else{typeof t=="function"&&(t=t(ee(s,e)));let{space:i,index:r}=E.resolveCoord(e,s.space),n=vt(s,i);n[r]=t,Wi(s,i,n)}return s}ze.returns="color";var Fi=new E({id:"xyz-d50",name:"XYZ D50",white:"D50",base:j,fromBase:s=>Ot(j.white,"D50",s),toBase:s=>Ot("D50",j.white,s)});const ea=216/24389,ws=24/116,zt=24389/27;let ai=X.D50;var te=new E({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ai,base:Fi,fromBase(s){let t=s.map((i,r)=>i/ai[r]).map(i=>i>ea?Math.cbrt(i):(zt*i+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(s){let e=[];return e[1]=(s[0]+16)/116,e[0]=s[1]/500+e[1],e[2]=e[1]-s[2]/200,[e[0]>ws?Math.pow(e[0],3):(116*e[0]-16)/zt,s[0]>8?Math.pow((s[0]+16)/116,3):s[0]/zt,e[2]>ws?Math.pow(e[2],3):(116*e[2]-16)/zt].map((i,r)=>i*ai[r])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function _e(s){return(s%360+360)%360}function ta(s,e){if(s==="raw")return e;let[t,i]=e.map(_e),r=i-t;return s==="increasing"?r<0&&(i+=360):s==="decreasing"?r>0&&(t+=360):s==="longer"?-180<r&&r<180&&(r>0?t+=360:i+=360):s==="shorter"&&(r>180?t+=360:r<-180&&(i+=360)),[t,i]}var mt=new E({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:te,fromBase(s){let[e,t,i]=s,r;const n=.02;return Math.abs(t)<n&&Math.abs(i)<n?r=NaN:r=Math.atan2(i,t)*180/Math.PI,[e,Math.sqrt(t**2+i**2),_e(r)]},toBase(s){let[e,t,i]=s;return t<0&&(t=0),isNaN(i)&&(i=0),[e,t*Math.cos(i*Math.PI/180),t*Math.sin(i*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const _s=25**7,Pt=Math.PI,xs=180/Pt,Fe=Pt/180;function Es(s){const e=s*s;return e*e*e*s}function Vr(s,e,{kL:t=1,kC:i=1,kH:r=1}={}){[s,e]=A([s,e]);let[n,o,a]=te.from(s),l=mt.from(te,[n,o,a])[1],[c,d,h]=te.from(e),u=mt.from(te,[c,d,h])[1];l<0&&(l=0),u<0&&(u=0);let g=(l+u)/2,m=Es(g),b=.5*(1-Math.sqrt(m/(m+_s))),y=(1+b)*o,w=(1+b)*d,_=Math.sqrt(y**2+a**2),x=Math.sqrt(w**2+h**2),R=y===0&&a===0?0:Math.atan2(a,y),S=w===0&&h===0?0:Math.atan2(h,w);R<0&&(R+=2*Pt),S<0&&(S+=2*Pt),R*=xs,S*=xs;let O=c-n,P=x-_,N=S-R,G=R+S,$=Math.abs(N),ue;_*x===0?ue=0:$<=180?ue=N:N>180?ue=N-360:N<-180?ue=N+360:se.warn("the unthinkable has happened");let W=2*Math.sqrt(x*_)*Math.sin(ue*Fe/2),oe=(n+c)/2,I=(_+x)/2,me=Es(I),V;_*x===0?V=G:$<=180?V=G/2:G<360?V=(G+360)/2:V=(G-360)/2;let fe=(oe-50)**2,Z=1+.015*fe/Math.sqrt(20+fe),ae=1+.045*I,Ie=1;Ie-=.17*Math.cos((V-30)*Fe),Ie+=.24*Math.cos(2*V*Fe),Ie+=.32*Math.cos((3*V+6)*Fe),Ie-=.2*Math.cos((4*V-63)*Fe);let Xi=1+.015*I*Ie,An=30*Math.exp(-1*((V-275)/25)**2),Cn=2*Math.sqrt(me/(me+_s)),Dn=-1*Math.sin(2*An*Fe)*Cn,_t=(O/(t*Z))**2;return _t+=(P/(i*ae))**2,_t+=(W/(r*Xi))**2,_t+=Dn*(P/(i*ae))*(W/(r*Xi)),Math.sqrt(_t)}const ia=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],sa=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],ra=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],na=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var Qe=new E({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:j,fromBase(s){let t=L(ia,s).map(i=>Math.cbrt(i));return L(ra,t)},toBase(s){let t=L(na,s).map(i=>i**3);return L(sa,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function ki(s,e){[s,e]=A([s,e]);let[t,i,r]=Qe.from(s),[n,o,a]=Qe.from(e),l=t-n,c=i-o,d=r-a;return Math.sqrt(l**2+c**2+d**2)}const oa=75e-6;function Pe(s,e,{epsilon:t=oa}={}){s=A(s),e||(e=s.space),e=E.get(e);let i=s.coords;return e!==s.space&&(i=e.from(s)),e.inGamut(i,{epsilon:t})}function et(s){return{space:s.space,coords:s.coords.slice(),alpha:s.alpha}}function Yr(s,e,t="lab"){t=E.get(t);let i=t.from(s),r=t.from(e);return Math.sqrt(i.reduce((n,o,a)=>{let l=r[a];return isNaN(o)||isNaN(l)?n:n+(l-o)**2},0))}function aa(s,e){return Yr(s,e,"lab")}const la=Math.PI,zs=la/180;function da(s,e,{l:t=2,c:i=1}={}){[s,e]=A([s,e]);let[r,n,o]=te.from(s),[,a,l]=mt.from(te,[r,n,o]),[c,d,h]=te.from(e),u=mt.from(te,[c,d,h])[1];a<0&&(a=0),u<0&&(u=0);let g=r-c,m=a-u,b=n-d,y=o-h,w=b**2+y**2-m**2,_=.511;r>=16&&(_=.040975*r/(1+.01765*r));let x=.0638*a/(1+.0131*a)+.638,R;Number.isNaN(l)&&(l=0),l>=164&&l<=345?R=.56+Math.abs(.2*Math.cos((l+168)*zs)):R=.36+Math.abs(.4*Math.cos((l+35)*zs));let S=Math.pow(a,4),O=Math.sqrt(S/(S+1900)),P=x*(O*R+1-O),N=(g/(t*_))**2;return N+=(m/(i*x))**2,N+=w/P**2,Math.sqrt(N)}const Ms=203;var Gi=new E({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:j,fromBase(s){return s.map(e=>Math.max(e*Ms,0))},toBase(s){return s.map(e=>Math.max(e/Ms,0))}});const Mt=1.15,kt=.66,ks=2610/2**14,ca=2**14/2610,Rs=3424/2**12,Ss=2413/2**7,As=2392/2**7,ha=1.7*2523/2**5,Cs=2**5/(1.7*2523),Rt=-.56,li=16295499532821565e-27,ua=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],ma=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],fa=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],ga=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var Xr=new E({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Gi,fromBase(s){let[e,t,i]=s,r=Mt*e-(Mt-1)*i,n=kt*t-(kt-1)*e,a=L(ua,[r,n,i]).map(function(u){let g=Rs+Ss*(u/1e4)**ks,m=1+As*(u/1e4)**ks;return(g/m)**ha}),[l,c,d]=L(fa,a);return[(1+Rt)*l/(1+Rt*l)-li,c,d]},toBase(s){let[e,t,i]=s,r=(e+li)/(1+Rt-Rt*(e+li)),o=L(ga,[r,t,i]).map(function(u){let g=Rs-u**Cs,m=As*u**Cs-Ss;return 1e4*(g/m)**ca}),[a,l,c]=L(ma,o),d=(a+(Mt-1)*c)/Mt,h=(l+(kt-1)*d)/kt;return[d,h,c]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),Ri=new E({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:Xr,fromBase(s){let[e,t,i]=s,r;const n=2e-4;return Math.abs(t)<n&&Math.abs(i)<n?r=NaN:r=Math.atan2(i,t)*180/Math.PI,[e,Math.sqrt(t**2+i**2),_e(r)]},toBase(s){return[s[0],s[1]*Math.cos(s[2]*Math.PI/180),s[1]*Math.sin(s[2]*Math.PI/180)]}});function pa(s,e){[s,e]=A([s,e]);let[t,i,r]=Ri.from(s),[n,o,a]=Ri.from(e),l=t-n,c=i-o;Number.isNaN(r)&&Number.isNaN(a)?(r=0,a=0):Number.isNaN(r)?r=a:Number.isNaN(a)&&(a=r);let d=r-a,h=2*Math.sqrt(i*o)*Math.sin(d/2*(Math.PI/180));return Math.sqrt(l**2+c**2+h**2)}const Kr=3424/4096,Jr=2413/128,Zr=2392/128,Ds=2610/16384,ba=2523/32,ya=16384/2610,Ls=32/2523,va=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],wa=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],_a=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],xa=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var Si=new E({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Gi,fromBase(s){let e=L(va,s);return Ea(e)},toBase(s){let e=za(s);return L(xa,e)}});function Ea(s){let e=s.map(function(t){let i=Kr+Jr*(t/1e4)**Ds,r=1+Zr*(t/1e4)**Ds;return(i/r)**ba});return L(wa,e)}function za(s){return L(_a,s).map(function(i){let r=Math.max(i**Ls-Kr,0),n=Jr-Zr*i**Ls;return 1e4*(r/n)**ya})}function Ma(s,e){[s,e]=A([s,e]);let[t,i,r]=Si.from(s),[n,o,a]=Si.from(e);return 720*Math.sqrt((t-n)**2+.25*(i-o)**2+(r-a)**2)}const ka=X.D65,Qr=.42,Is=1/Qr,di=2*Math.PI,en=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],Ra=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],Sa=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Aa={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},He={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Ca=180/Math.PI,Ns=Math.PI/180;function tn(s,e){return s.map(i=>{const r=be(e*Math.abs(i)*.01,Qr);return 400*Kt(r,i)/(r+27.13)})}function Da(s,e){const t=100/e*27.13**Is;return s.map(i=>{const r=Math.abs(i);return Kt(t*be(r/(400-r),Is),i)})}function La(s){let e=_e(s);e<=He.h[0]&&(e+=360);const t=jr(He.h,e)-1,[i,r]=He.h.slice(t,t+2),[n,o]=He.e.slice(t,t+2),a=He.H[t],l=(e-i)/n;return a+100*l/(l+(r-e)/o)}function Ia(s){let e=(s%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[i,r]=He.h.slice(t,t+2),[n,o]=He.e.slice(t,t+2);return _e((e*(o*i-n*r)-100*i*o)/(e*(o-n)-100*o))}function sn(s,e,t,i,r){const n={};n.discounting=r,n.refWhite=s,n.surround=i;const o=s.map(b=>b*100);n.la=e,n.yb=t;const a=o[1],l=L(en,o);i=Aa[n.surround];const c=i[0];n.c=i[1],n.nc=i[2];const h=(1/(5*n.la+1))**4;n.fl=h*n.la+.1*(1-h)*(1-h)*Math.cbrt(5*n.la),n.flRoot=n.fl**.25,n.n=n.yb/a,n.z=1.48+Math.sqrt(n.n),n.nbb=.725*n.n**-.2,n.ncb=n.nbb;const u=Math.max(Math.min(c*(1-1/3.6*Math.exp((-n.la-42)/92)),1),0);n.dRgb=l.map(b=>ut(1,a/b,u)),n.dRgbInv=n.dRgb.map(b=>1/b);const g=l.map((b,y)=>b*n.dRgb[y]),m=tn(g,n.fl);return n.aW=n.nbb*(2*m[0]+m[1]+.05*m[2]),n}const Ts=sn(ka,64/Math.PI*.2,20,"average",!1);function Ai(s,e){if(!(s.J!==void 0^s.Q!==void 0))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(s.C!==void 0^s.M!==void 0^s.s!==void 0))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(s.h!==void 0^s.H!==void 0))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(s.J===0||s.Q===0)return[0,0,0];let t=0;s.h!==void 0?t=_e(s.h)*Ns:t=Ia(s.H)*Ns;const i=Math.cos(t),r=Math.sin(t);let n=0;s.J!==void 0?n=be(s.J,1/2)*.1:s.Q!==void 0&&(n=.25*e.c*s.Q/((e.aW+4)*e.flRoot));let o=0;s.C!==void 0?o=s.C/n:s.M!==void 0?o=s.M/e.flRoot/n:s.s!==void 0&&(o=4e-4*s.s**2*(e.aW+4)/e.c);const a=be(o*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),l=.25*(Math.cos(t+2)+3.8),c=e.aW*be(n,2/e.c/e.z),d=5e4/13*e.nc*e.ncb*l,h=c/e.nbb,u=23*(h+.305)*Bi(a,23*d+a*(11*i+108*r)),g=u*i,m=u*r,b=Da(L(Sa,[h,g,m]).map(y=>y*1/1403),e.fl);return L(Ra,b.map((y,w)=>y*e.dRgbInv[w])).map(y=>y/100)}function rn(s,e){const t=s.map(x=>x*100),i=tn(L(en,t).map((x,R)=>x*e.dRgb[R]),e.fl),r=i[0]+(-12*i[1]+i[2])/11,n=(i[0]+i[1]-2*i[2])/9,o=(Math.atan2(n,r)%di+di)%di,a=.25*(Math.cos(o+2)+3.8),l=5e4/13*e.nc*e.ncb*Bi(a*Math.sqrt(r**2+n**2),i[0]+i[1]+1.05*i[2]+.305),c=be(l,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),d=e.nbb*(2*i[0]+i[1]+.05*i[2]),h=be(d/e.aW,.5*e.c*e.z),u=100*be(h,2),g=4/e.c*h*(e.aW+4)*e.flRoot,m=c*h,b=m*e.flRoot,y=_e(o*Ca),w=La(y),_=50*be(e.c*c/(e.aW+4),1/2);return{J:u,C:m,h:y,s:_,Q:g,M:b,H:w}}var Na=new E({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:j,fromBase(s){const e=rn(s,Ts);return[e.J,e.M,e.h]},toBase(s){return Ai({J:s[0],M:s[1],h:s[2]},Ts)}});const Ta=X.D65,Ha=216/24389,nn=24389/27;function Oa(s){return 116*(s>Ha?Math.cbrt(s):(nn*s+16)/116)-16}function Ci(s){return s>8?Math.pow((s+16)/116,3):s/nn}function Pa(s,e){let[t,i,r]=s,n=[],o=0;if(r===0)return[0,0,0];let a=Ci(r);r>0?o=.00379058511492914*r**2+.608983189401032*r+.9155088574762233:o=9514440756550361e-21*r**2+.08693057439788597*r-21.928975842194614;const l=2e-12,c=15;let d=0,h=1/0;for(;d<=c;){n=Ai({J:o,C:i,h:t},e);const u=Math.abs(n[1]-a);if(u<h){if(u<=l)return n;h=u}o=o-(n[1]-a)*o/(2*n[1]),d+=1}return Ai({J:o,C:i,h:t},e)}function $a(s,e){const t=Oa(s[1]);if(t===0)return[0,0,0];const i=rn(s,Ui);return[_e(i.h),i.C,t]}const Ui=sn(Ta,200/Math.PI*Ci(50),Ci(50)*100,"average",!1);var ft=new E({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:j,fromBase(s){return $a(s)},toBase(s){return Pa(s,Ui)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const Ba=Math.PI/180,Hs=[1,.007,.0228];function Os(s){s[1]<0&&(s=ft.fromBase(ft.toBase(s)));const e=Math.log(Math.max(1+Hs[2]*s[1]*Ui.flRoot,1))/Hs[2],t=s[0]*Ba,i=e*Math.cos(t),r=e*Math.sin(t);return[s[2],i,r]}function Wa(s,e){[s,e]=A([s,e]);let[t,i,r]=Os(ft.from(s)),[n,o,a]=Os(ft.from(e));return Math.sqrt((t-n)**2+(i-o)**2+(r-a)**2)}var tt={deltaE76:aa,deltaECMC:da,deltaE2000:Vr,deltaEJz:pa,deltaEITP:Ma,deltaEOK:ki,deltaEHCT:Wa};function Fa(s){const e=s?Math.floor(Math.log10(Math.abs(s))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const Ps={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function De(s,{method:e=se.gamut_mapping,space:t=void 0,deltaEMethod:i="",jnd:r=2,blackWhiteClamp:n={}}={}){if(s=A(s),yt(arguments[1])?t=arguments[1]:t||(t=s.space),t=E.get(t),Pe(s,t,{epsilon:0}))return s;let o;if(e==="css")o=Ga(s,{space:t});else{if(e!=="clip"&&!Pe(s,t)){Object.prototype.hasOwnProperty.call(Ps,e)&&({method:e,jnd:r,deltaEMethod:i,blackWhiteClamp:n}=Ps[e]);let a=Vr;if(i!==""){for(let c in tt)if("deltae"+i.toLowerCase()===c.toLowerCase()){a=tt[c];break}}let l=De(D(s,t),{method:"clip",space:t});if(a(s,l)>r){if(Object.keys(n).length===3){let _=E.resolveCoord(n.channel),x=ee(D(s,_.space),_.id);if(Ae(x)&&(x=0),x>=n.max)return D({space:"xyz-d65",coords:X.D65},s.space);if(x<=n.min)return D({space:"xyz-d65",coords:[0,0,0]},s.space)}let c=E.resolveCoord(e),d=c.space,h=c.id,u=D(s,d);u.coords.forEach((_,x)=>{Ae(_)&&(u.coords[x]=0)});let m=(c.range||c.refRange)[0],b=Fa(r),y=m,w=ee(u,h);for(;w-y>b;){let _=et(u);_=De(_,{space:t,method:"clip"}),a(u,_)-r<b?y=ee(u,h):w=ee(u,h),ze(u,h,(y+w)/2)}o=D(u,t)}else o=l}else o=D(s,t);if(e==="clip"||!Pe(o,t,{epsilon:0})){let a=Object.values(t.coords).map(l=>l.range||[]);o.coords=o.coords.map((l,c)=>{let[d,h]=a[c];return d!==void 0&&(l=Math.max(d,l)),h!==void 0&&(l=Math.min(l,h)),l})}}return t!==s.space&&(o=D(o,s.space)),s.coords=o.coords,s}De.returns="color";const $s={WHITE:{space:Qe,coords:[1,0,0]},BLACK:{space:Qe,coords:[0,0,0]}};function Ga(s,{space:e}={}){s=A(s),e||(e=s.space),e=E.get(e);const r=E.get("oklch");if(e.isUnbounded)return D(s,e);const n=D(s,r);let o=n.coords[0];if(o>=1){const m=D($s.WHITE,e);return m.alpha=s.alpha,D(m,e)}if(o<=0){const m=D($s.BLACK,e);return m.alpha=s.alpha,D(m,e)}if(Pe(n,e,{epsilon:0}))return D(n,e);function a(m){const b=D(m,e),y=Object.values(e.coords);return b.coords=b.coords.map((w,_)=>{if("range"in y[_]){const[x,R]=y[_].range;return Ur(x,w,R)}return w}),b}let l=0,c=n.coords[1],d=!0,h=et(n),u=a(h),g=ki(u,h);if(g<.02)return u;for(;c-l>1e-4;){const m=(l+c)/2;if(h.coords[1]=m,d&&Pe(h,e,{epsilon:0}))l=m;else if(u=a(h),g=ki(u,h),g<.02){if(.02-g<1e-4)break;d=!1,l=m}else c=m}return u}function D(s,e,{inGamut:t}={}){s=A(s),e=E.get(e);let i=e.from(s),r={space:e,coords:i,alpha:s.alpha};return t&&(r=De(r,t===!0?void 0:t)),r}D.returns="color";function ct(s,{precision:e=se.precision,format:t="default",inGamut:i=!0,...r}={}){var l;let n;s=A(s);let o=t;t=s.space.getFormat(t)??s.space.getFormat("default")??E.DEFAULT_FORMAT;let a=s.coords.slice();if(i||(i=t.toGamut),i&&!Pe(s)&&(a=De(et(s),i===!0?void 0:i).coords),t.type==="custom")if(r.precision=e,t.serialize)n=t.serialize(a,s.alpha,r);else throw new TypeError(`format ${o} can only be used to parse colors, not for serialization`);else{let c=t.name||"color";t.serializeCoords?a=t.serializeCoords(a,e):e!==null&&(a=a.map(g=>Ht(g,{precision:e})));let d=[...a];if(c==="color"){let g=t.id||((l=t.ids)==null?void 0:l[0])||s.space.id;d.unshift(g)}let h=s.alpha;e!==null&&(h=Ht(h,{precision:e}));let u=s.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${h}`;n=`${c}(${d.join(t.commas?", ":" ")}${u})`}return n}const Ua=[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],ja=[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]];var Jt=new J({id:"rec2020-linear",cssId:"--rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:Ua,fromXYZ_M:ja});const St=1.09929682680944,Bs=.018053968510807;var on=new J({id:"rec2020",name:"REC.2020",base:Jt,toBase(s){return s.map(function(e){return e<Bs*4.5?e/4.5:Math.pow((e+St-1)/St,1/.45)})},fromBase(s){return s.map(function(e){return e>=Bs?St*Math.pow(e,.45)-(St-1):4.5*e})}});const qa=[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],Va=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]];var an=new J({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:qa,fromXYZ_M:Va});const Ya=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],B=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]];var ln=new J({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:Ya,fromXYZ_M:B}),Ws={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let Fs=Array(3).fill("<percentage> | <number>[0, 255]"),Gs=Array(3).fill("<number>[0, 255]");var it=new J({id:"srgb",name:"sRGB",base:ln,fromBase:s=>s.map(e=>{let t=e<0?-1:1,i=e*t;return i>.0031308?t*(1.055*i**(1/2.4)-.055):12.92*e}),toBase:s=>s.map(e=>{let t=e<0?-1:1,i=e*t;return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4}),formats:{rgb:{coords:Fs},rgb_number:{name:"rgb",commas:!0,coords:Gs,noAlpha:!0},color:{},rgba:{coords:Fs,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Gs},hex:{type:"custom",toGamut:!0,test:s=>/^#([a-f0-9]{3,4}){1,2}$/i.test(s),parse(s){s.length<=5&&(s=s.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return s.replace(/[a-f0-9]{2}/gi,t=>{e.push(parseInt(t,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(s,e,{collapse:t=!0}={})=>{e<1&&s.push(e),s=s.map(n=>Math.round(n*255));let i=t&&s.every(n=>n%17===0);return"#"+s.map(n=>i?(n/17).toString(16):n.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:s=>/^[a-z]+$/i.test(s),parse(s){s=s.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(s==="transparent"?(e.coords=Ws.black,e.alpha=0):e.coords=Ws[s],e.coords)return e}}}}),dn=new J({id:"p3",cssId:"display-p3",name:"P3",base:an,fromBase:it.fromBase,toBase:it.toBase});se.display_space=it;let Xa;if(typeof CSS<"u"&&CSS.supports)for(let s of[te,on,dn]){let e=s.getMinCoords(),i=ct({space:s,coords:e,alpha:1});if(CSS.supports("color",i)){se.display_space=s;break}}function Ka(s,{space:e=se.display_space,...t}={}){let i=ct(s,t);if(typeof CSS>"u"||CSS.supports("color",i)||!se.display_space)i=new String(i),i.color=s;else{let r=s;if((s.coords.some(Ae)||Ae(s.alpha))&&!(Xa??(Xa=CSS.supports("color","hsl(none 50% 50%)")))&&(r=et(s),r.coords=r.coords.map(T),r.alpha=T(r.alpha),i=ct(r,t),CSS.supports("color",i)))return i=new String(i),i.color=r,i;r=D(r,e),i=new String(ct(r,t)),i.color=r}return i}function Ja(s,e){return s=A(s),e=A(e),s.space===e.space&&s.alpha===e.alpha&&s.coords.every((t,i)=>t===e.coords[i])}function Le(s){return ee(s,[j,"y"])}function cn(s,e){ze(s,[j,"y"],e)}function Za(s){Object.defineProperty(s.prototype,"luminance",{get(){return Le(this)},set(e){cn(this,e)}})}var Qa=Object.freeze({__proto__:null,getLuminance:Le,register:Za,setLuminance:cn});function el(s,e){s=A(s),e=A(e);let t=Math.max(Le(s),0),i=Math.max(Le(e),0);return i>t&&([t,i]=[i,t]),(t+.05)/(i+.05)}const tl=.56,il=.57,sl=.62,rl=.65,Us=.022,nl=1.414,ol=.1,al=5e-4,ll=1.14,js=.027,dl=1.14;function qs(s){return s>=Us?s:s+(Us-s)**nl}function Ge(s){let e=s<0?-1:1,t=Math.abs(s);return e*Math.pow(t,2.4)}function cl(s,e){e=A(e),s=A(s);let t,i,r,n,o,a;e=D(e,"srgb"),[n,o,a]=e.coords;let l=Ge(n)*.2126729+Ge(o)*.7151522+Ge(a)*.072175;s=D(s,"srgb"),[n,o,a]=s.coords;let c=Ge(n)*.2126729+Ge(o)*.7151522+Ge(a)*.072175,d=qs(l),h=qs(c),u=h>d;return Math.abs(h-d)<al?i=0:u?(t=h**tl-d**il,i=t*ll):(t=h**rl-d**sl,i=t*dl),Math.abs(i)<ol?r=0:i>0?r=i-js:r=i+js,r*100}function hl(s,e){s=A(s),e=A(e);let t=Math.max(Le(s),0),i=Math.max(Le(e),0);i>t&&([t,i]=[i,t]);let r=t+i;return r===0?0:(t-i)/r}const ul=5e4;function ml(s,e){s=A(s),e=A(e);let t=Math.max(Le(s),0),i=Math.max(Le(e),0);return i>t&&([t,i]=[i,t]),i===0?ul:(t-i)/i}function fl(s,e){s=A(s),e=A(e);let t=ee(s,[te,"l"]),i=ee(e,[te,"l"]);return Math.abs(t-i)}const gl=216/24389,Vs=24/116,At=24389/27;let ci=X.D65;var Di=new E({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ci,base:j,fromBase(s){let t=s.map((i,r)=>i/ci[r]).map(i=>i>gl?Math.cbrt(i):(At*i+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(s){let e=[];return e[1]=(s[0]+16)/116,e[0]=s[1]/500+e[1],e[2]=e[1]-s[2]/200,[e[0]>Vs?Math.pow(e[0],3):(116*e[0]-16)/At,s[0]>8?Math.pow((s[0]+16)/116,3):s[0]/At,e[2]>Vs?Math.pow(e[2],3):(116*e[2]-16)/At].map((i,r)=>i*ci[r])},formats:{"lab-d65":{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});const hi=Math.pow(5,.5)*.5+.5;function pl(s,e){s=A(s),e=A(e);let t=ee(s,[Di,"l"]),i=ee(e,[Di,"l"]),r=Math.abs(Math.pow(t,hi)-Math.pow(i,hi)),n=Math.pow(r,1/hi)*Math.SQRT2-40;return n<7.5?0:n}var Lt=Object.freeze({__proto__:null,contrastAPCA:cl,contrastDeltaPhi:pl,contrastLstar:fl,contrastMichelson:hl,contrastWCAG21:el,contrastWeber:ml});function bl(s,e,t={}){yt(t)&&(t={algorithm:t});let{algorithm:i,...r}=t;if(!i){let n=Object.keys(Lt).map(o=>o.replace(/^contrast/,"")).join(", ");throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${n}`)}s=A(s),e=A(e);for(let n in Lt)if("contrast"+i.toLowerCase()===n.toLowerCase())return Lt[n](s,e,r);throw new TypeError(`Unknown contrast algorithm: ${i}`)}function Zt(s){let[e,t,i]=vt(s,j),r=e+15*t+3*i;return[4*e/r,9*t/r]}function hn(s){let[e,t,i]=vt(s,j),r=e+t+i;return[e/r,t/r]}function yl(s){Object.defineProperty(s.prototype,"uv",{get(){return Zt(this)}}),Object.defineProperty(s.prototype,"xy",{get(){return hn(this)}})}var vl=Object.freeze({__proto__:null,register:yl,uv:Zt,xy:hn});function at(s,e,t={}){yt(t)&&(t={method:t});let{method:i=se.deltaE,...r}=t;for(let n in tt)if("deltae"+i.toLowerCase()===n.toLowerCase())return tt[n](s,e,r);throw new TypeError(`Unknown deltaE method: ${i}`)}function wl(s,e=.25){let i=[E.get("oklch","lch"),"l"];return ze(s,i,r=>r*(1+e))}function _l(s,e=.25){let i=[E.get("oklch","lch"),"l"];return ze(s,i,r=>r*(1-e))}var xl=Object.freeze({__proto__:null,darken:_l,lighten:wl});function un(s,e,t=.5,i={}){return[s,e]=[A(s),A(e)],ke(t)==="object"&&([t,i]=[.5,t]),wt(s,e,i)(t)}function mn(s,e,t={}){let i;ji(s)&&([i,t]=[s,e],[s,e]=i.rangeArgs.colors);let{maxDeltaE:r,deltaEMethod:n,steps:o=2,maxSteps:a=1e3,...l}=t;i||([s,e]=[A(s),A(e)],i=wt(s,e,l));let c=at(s,e),d=r>0?Math.max(o,Math.ceil(c/r)+1):o,h=[];if(a!==void 0&&(d=Math.min(d,a)),d===1)h=[{p:.5,color:i(.5)}];else{let u=1/(d-1);h=Array.from({length:d},(g,m)=>{let b=m*u;return{p:b,color:i(b)}})}if(r>0){let u=h.reduce((g,m,b)=>{if(b===0)return 0;let y=at(m.color,h[b-1].color,n);return Math.max(g,y)},0);for(;u>r;){u=0;for(let g=1;g<h.length&&h.length<a;g++){let m=h[g-1],b=h[g],y=(b.p+m.p)/2,w=i(y);u=Math.max(u,at(w,m.color),at(w,b.color)),h.splice(g,0,{p:y,color:i(y)}),g++}}}return h=h.map(u=>u.color),h}function wt(s,e,t={}){if(ji(s)){let[l,c]=[s,e];return wt(...l.rangeArgs.colors,{...l.rangeArgs.options,...c})}let{space:i,outputSpace:r,progression:n,premultiplied:o}=t;s=A(s),e=A(e),s=et(s),e=et(e);let a={colors:[s,e],options:t};if(i?i=E.get(i):i=E.registry[se.interpolationSpace]||s.space,r=r?E.get(r):i,s=D(s,i),e=D(e,i),s=De(s),e=De(e),i.coords.h&&i.coords.h.type==="angle"){let l=t.hue=t.hue||"shorter",c=[i,"h"],[d,h]=[ee(s,c),ee(e,c)];isNaN(d)&&!isNaN(h)?d=h:isNaN(h)&&!isNaN(d)&&(h=d),[d,h]=ta(l,[d,h]),ze(s,c,d),ze(e,c,h)}return o&&(s.coords=s.coords.map(l=>l*s.alpha),e.coords=e.coords.map(l=>l*e.alpha)),Object.assign(l=>{l=n?n(l):l;let c=s.coords.map((u,g)=>{let m=e.coords[g];return ut(u,m,l)}),d=ut(s.alpha,e.alpha,l),h={space:i,coords:c,alpha:d};return o&&(h.coords=h.coords.map(u=>u/d)),r!==i&&(h=D(h,r)),h},{rangeArgs:a})}function ji(s){return ke(s)==="function"&&!!s.rangeArgs}se.interpolationSpace="lab";function El(s){s.defineFunction("mix",un,{returns:"color"}),s.defineFunction("range",wt,{returns:"function<color>"}),s.defineFunction("steps",mn,{returns:"array<color>"})}var zl=Object.freeze({__proto__:null,isRange:ji,mix:un,range:wt,register:El,steps:mn}),fn=new E({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:it,fromBase:s=>{let e=Math.max(...s),t=Math.min(...s),[i,r,n]=s,[o,a,l]=[NaN,0,(t+e)/2],c=e-t;if(c!==0){switch(a=l===0||l===1?0:(e-l)/Math.min(l,1-l),e){case i:o=(r-n)/c+(r<n?6:0);break;case r:o=(n-i)/c+2;break;case n:o=(i-r)/c+4}o=o*60}return a<0&&(o+=180,a=Math.abs(a)),o>=360&&(o-=360),[o,a*100,l*100]},toBase:s=>{let[e,t,i]=s;e=e%360,e<0&&(e+=360),t/=100,i/=100;function r(n){let o=(n+e/30)%12,a=t*Math.min(i,1-i);return i-a*Math.max(-1,Math.min(o-3,9-o,1))}return[r(0),r(8),r(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),gn=new E({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:fn,fromBase(s){let[e,t,i]=s;t/=100,i/=100;let r=i+t*Math.min(i,1-i);return[e,r===0?0:200*(1-i/r),100*r]},toBase(s){let[e,t,i]=s;t/=100,i/=100;let r=i*(1-t/2);return[e,r===0||r===1?0:(i-r)/Math.min(r,1-r)*100,r*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),Ml=new E({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:gn,fromBase(s){let[e,t,i]=s;return[e,i*(100-t)/100,100-i]},toBase(s){let[e,t,i]=s;t/=100,i/=100;let r=t+i;if(r>=1){let a=t/r;return[e,0,a*100]}let n=1-i,o=n===0?0:1-t/n;return[e,o*100,n*100]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const kl=[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],Rl=[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]];var pn=new J({id:"a98rgb-linear",cssId:"--a98-rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:kl,fromXYZ_M:Rl}),Sl=new J({id:"a98rgb",cssId:"a98-rgb",name:"Adobe® 98 RGB compatible",base:pn,toBase:s=>s.map(e=>Math.pow(Math.abs(e),563/256)*Math.sign(e)),fromBase:s=>s.map(e=>Math.pow(Math.abs(e),256/563)*Math.sign(e))});const Al=[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],Cl=[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]];var bn=new J({id:"prophoto-linear",cssId:"--prophoto-rgb-linear",name:"Linear ProPhoto",white:"D50",base:Fi,toXYZ_M:Al,fromXYZ_M:Cl});const Dl=1/512,Ll=16/512;var Il=new J({id:"prophoto",cssId:"prophoto-rgb",name:"ProPhoto",base:bn,toBase(s){return s.map(e=>e<Ll?e/16:e**1.8)},fromBase(s){return s.map(e=>e>=Dl?e**(1/1.8):16*e)}}),Nl=new E({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:Qe,fromBase(s){let[e,t,i]=s,r;const n=2e-4;return Math.abs(t)<n&&Math.abs(i)<n?r=NaN:r=Math.atan2(i,t)*180/Math.PI,[e,Math.sqrt(t**2+i**2),_e(r)]},toBase(s){let[e,t,i]=s,r,n;return isNaN(i)?(r=0,n=0):(r=t*Math.cos(i*Math.PI/180),n=t*Math.sin(i*Math.PI/180)),[e,r,n]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}});let yn=X.D65;const Tl=216/24389,Ys=24389/27,[Xs,Ks]=Zt({space:j,coords:yn});var vn=new E({id:"luv",name:"Luv",coords:{l:{refRange:[0,100],name:"Lightness"},u:{refRange:[-215,215]},v:{refRange:[-215,215]}},white:yn,base:j,fromBase(s){let e=[T(s[0]),T(s[1]),T(s[2])],t=e[1],[i,r]=Zt({space:j,coords:e});if(!Number.isFinite(i)||!Number.isFinite(r))return[0,0,0];let n=t<=Tl?Ys*t:116*Math.cbrt(t)-16;return[n,13*n*(i-Xs),13*n*(r-Ks)]},toBase(s){let[e,t,i]=s;if(e===0||Ae(e))return[0,0,0];t=T(t),i=T(i);let r=t/(13*e)+Xs,n=i/(13*e)+Ks,o=e<=8?e/Ys:Math.pow((e+16)/116,3);return[o*(9*r/(4*n)),o,o*((12-3*r-20*n)/(4*n))]},formats:{color:{id:"--luv",coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),qi=new E({id:"lchuv",name:"LChuv",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,220],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:vn,fromBase(s){let[e,t,i]=s,r;const n=.02;return Math.abs(t)<n&&Math.abs(i)<n?r=NaN:r=Math.atan2(i,t)*180/Math.PI,[e,Math.sqrt(t**2+i**2),_e(r)]},toBase(s){let[e,t,i]=s;return t<0&&(t=0),isNaN(i)&&(i=0),[e,t*Math.cos(i*Math.PI/180),t*Math.sin(i*Math.PI/180)]},formats:{color:{id:"--lchuv",coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Hl=216/24389,Ol=24389/27,Js=B[0][0],Zs=B[0][1],ui=B[0][2],Qs=B[1][0],er=B[1][1],mi=B[1][2],tr=B[2][0],ir=B[2][1],fi=B[2][2];function Ue(s,e,t){const i=e/(Math.sin(t)-s*Math.cos(t));return i<0?1/0:i}function $t(s){const e=Math.pow(s+16,3)/1560896,t=e>Hl?e:s/Ol,i=t*(284517*Js-94839*ui),r=t*(838422*ui+769860*Zs+731718*Js),n=t*(632260*ui-126452*Zs),o=t*(284517*Qs-94839*mi),a=t*(838422*mi+769860*er+731718*Qs),l=t*(632260*mi-126452*er),c=t*(284517*tr-94839*fi),d=t*(838422*fi+769860*ir+731718*tr),h=t*(632260*fi-126452*ir);return{r0s:i/n,r0i:r*s/n,r1s:i/(n+126452),r1i:(r-769860)*s/(n+126452),g0s:o/l,g0i:a*s/l,g1s:o/(l+126452),g1i:(a-769860)*s/(l+126452),b0s:c/h,b0i:d*s/h,b1s:c/(h+126452),b1i:(d-769860)*s/(h+126452)}}function sr(s,e){const t=e/360*Math.PI*2,i=Ue(s.r0s,s.r0i,t),r=Ue(s.r1s,s.r1i,t),n=Ue(s.g0s,s.g0i,t),o=Ue(s.g1s,s.g1i,t),a=Ue(s.b0s,s.b0i,t),l=Ue(s.b1s,s.b1i,t);return Math.min(i,r,n,o,a,l)}var Pl=new E({id:"hsluv",name:"HSLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:qi,gamutSpace:it,fromBase(s){let[e,t,i]=[T(s[0]),T(s[1]),T(s[2])],r;if(e>99.9999999)r=0,e=100;else if(e<1e-8)r=0,e=0;else{let n=$t(e),o=sr(n,i);r=t/o*100}return[i,r,e]},toBase(s){let[e,t,i]=[T(s[0]),T(s[1]),T(s[2])],r;if(i>99.9999999)i=100,r=0;else if(i<1e-8)i=0,r=0;else{let n=$t(i);r=sr(n,e)/100*t}return[i,r,e]},formats:{color:{id:"--hsluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});B[0][0];B[0][1];B[0][2];B[1][0];B[1][1];B[1][2];B[2][0];B[2][1];B[2][2];function je(s,e){return Math.abs(e)/Math.sqrt(Math.pow(s,2)+1)}function rr(s){let e=je(s.r0s,s.r0i),t=je(s.r1s,s.r1i),i=je(s.g0s,s.g0i),r=je(s.g1s,s.g1i),n=je(s.b0s,s.b0i),o=je(s.b1s,s.b1i);return Math.min(e,t,i,r,n,o)}var $l=new E({id:"hpluv",name:"HPLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:qi,gamutSpace:"self",fromBase(s){let[e,t,i]=[T(s[0]),T(s[1]),T(s[2])],r;if(e>99.9999999)r=0,e=100;else if(e<1e-8)r=0,e=0;else{let n=$t(e),o=rr(n);r=t/o*100}return[i,r,e]},toBase(s){let[e,t,i]=[T(s[0]),T(s[1]),T(s[2])],r;if(i>99.9999999)i=100,r=0;else if(i<1e-8)i=0,r=0;else{let n=$t(i);r=rr(n)/100*t}return[i,r,e]},formats:{color:{id:"--hpluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const nr=203,or=2610/2**14,Bl=2**14/2610,Wl=2523/2**5,ar=2**5/2523,lr=3424/2**12,dr=2413/2**7,cr=2392/2**7;var Fl=new J({id:"rec2100pq",cssId:"rec2100-pq",name:"REC.2100-PQ",base:Jt,toBase(s){return s.map(function(e){return(Math.max(e**ar-lr,0)/(dr-cr*e**ar))**Bl*1e4/nr})},fromBase(s){return s.map(function(e){let t=Math.max(e*nr/1e4,0),i=lr+dr*t**or,r=1+cr*t**or;return(i/r)**Wl})}});const hr=.17883277,ur=.28466892,mr=.55991073,gi=3.7743;var Gl=new J({id:"rec2100hlg",cssId:"rec2100-hlg",name:"REC.2100-HLG",referred:"scene",base:Jt,toBase(s){return s.map(function(e){return e<=.5?e**2/3*gi:(Math.exp((e-mr)/hr)+ur)/12*gi})},fromBase(s){return s.map(function(e){return e/=gi,e<=1/12?Math.sqrt(3*e):hr*Math.log(12*e-ur)+mr})}});const wn={};Ce.add("chromatic-adaptation-start",s=>{s.options.method&&(s.M=_n(s.W1,s.W2,s.options.method))});Ce.add("chromatic-adaptation-end",s=>{s.M||(s.M=_n(s.W1,s.W2,s.options.method))});function Qt({id:s,toCone_M:e,fromCone_M:t}){wn[s]=arguments[0]}function _n(s,e,t="Bradford"){let i=wn[t],[r,n,o]=L(i.toCone_M,s),[a,l,c]=L(i.toCone_M,e),d=[[a/r,0,0],[0,l/n,0],[0,0,c/o]],h=L(d,i.toCone_M);return L(i.fromCone_M,h)}Qt({id:"von Kries",toCone_M:[[.40024,.7076,-.08081],[-.2263,1.16532,.0457],[0,0,.91822]],fromCone_M:[[1.8599363874558397,-1.1293816185800916,.21989740959619328],[.3611914362417676,.6388124632850422,-6370596838649899e-21],[0,0,1.0890636230968613]]});Qt({id:"Bradford",toCone_M:[[.8951,.2664,-.1614],[-.7502,1.7135,.0367],[.0389,-.0685,1.0296]],fromCone_M:[[.9869929054667121,-.14705425642099013,.15996265166373122],[.4323052697233945,.5183602715367774,.049291228212855594],[-.00852866457517732,.04004282165408486,.96848669578755]]});Qt({id:"CAT02",toCone_M:[[.7328,.4296,-.1624],[-.7036,1.6975,.0061],[.003,.0136,.9834]],fromCone_M:[[1.0961238208355142,-.27886900021828726,.18274517938277307],[.4543690419753592,.4735331543074117,.07209780371722911],[-.009627608738429355,-.00569803121611342,1.0153256399545427]]});Qt({id:"CAT16",toCone_M:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],fromCone_M:[[1.862067855087233,-1.0112546305316845,.14918677544445172],[.3875265432361372,.6214474419314753,-.008973985167612521],[-.01584149884933386,-.03412293802851557,1.0499644368778496]]});Object.assign(X,{A:[1.0985,1,.35585],C:[.98074,1,1.18232],D55:[.95682,1,.92149],D75:[.94972,1,1.22638],E:[1,1,1],F2:[.99186,1,.67393],F7:[.95041,1,1.08747],F11:[1.00962,1,.6435]});X.ACES=[.32168/.33767,1,(1-.32168-.33767)/.33767];const Ul=[[.6624541811085053,.13400420645643313,.1561876870049078],[.27222871678091454,.6740817658111484,.05368951740793705],[-.005574649490394108,.004060733528982826,1.0103391003129971]],jl=[[1.6410233796943257,-.32480329418479,-.23642469523761225],[-.6636628587229829,1.6153315916573379,.016756347685530137],[.011721894328375376,-.008284441996237409,.9883948585390215]];var xn=new J({id:"acescg",cssId:"--acescg",name:"ACEScg",coords:{r:{range:[0,65504],name:"Red"},g:{range:[0,65504],name:"Green"},b:{range:[0,65504],name:"Blue"}},referred:"scene",white:X.ACES,toXYZ_M:Ul,fromXYZ_M:jl});const Ct=2**-16,pi=-.35828683,Dt=(Math.log2(65504)+9.72)/17.52;var ql=new J({id:"acescc",cssId:"--acescc",name:"ACEScc",coords:{r:{range:[pi,Dt],name:"Red"},g:{range:[pi,Dt],name:"Green"},b:{range:[pi,Dt],name:"Blue"}},referred:"scene",base:xn,toBase(s){const e=-.3013698630136986;return s.map(function(t){return t<=e?(2**(t*17.52-9.72)-Ct)*2:t<Dt?2**(t*17.52-9.72):65504})},fromBase(s){return s.map(function(e){return e<=0?(Math.log2(Ct)+9.72)/17.52:e<Ct?(Math.log2(Ct+e*.5)+9.72)/17.52:(Math.log2(e)+9.72)/17.52})}}),fr=Object.freeze({__proto__:null,A98RGB:Sl,A98RGB_Linear:pn,ACEScc:ql,ACEScg:xn,CAM16_JMh:Na,HCT:ft,HPLuv:$l,HSL:fn,HSLuv:Pl,HSV:gn,HWB:Ml,ICTCP:Si,JzCzHz:Ri,Jzazbz:Xr,LCH:mt,LCHuv:qi,Lab:te,Lab_D65:Di,Luv:vn,OKLCH:Nl,OKLab:Qe,P3:dn,P3_Linear:an,ProPhoto:Il,ProPhoto_Linear:bn,REC_2020:on,REC_2020_Linear:Jt,REC_2100_HLG:Gl,REC_2100_PQ:Fl,XYZ_ABS_D65:Gi,XYZ_D50:Fi,XYZ_D65:j,sRGB:it,sRGB_Linear:ln});class C{constructor(...e){let t;e.length===1&&(t=A(e[0]));let i,r,n;t?(i=t.space||t.spaceId,r=t.coords,n=t.alpha):[i,r,n]=e,Object.defineProperty(this,"space",{value:E.get(i),writable:!1,enumerable:!0,configurable:!0}),this.coords=r?r.slice():[0,0,0],this.alpha=n>1||n===void 0?1:n<0?0:n;for(let o=0;o<this.coords.length;o++)this.coords[o]==="NaN"&&(this.coords[o]=NaN);for(let o in this.space.coords)Object.defineProperty(this,o,{get:()=>this.get(o),set:a=>this.set(o,a)})}get spaceId(){return this.space.id}clone(){return new C(this.space,this.coords,this.alpha)}toJSON(){return{spaceId:this.spaceId,coords:this.coords,alpha:this.alpha}}display(...e){let t=Ka(this,...e);return t.color=new C(t.color),t}static get(e,...t){return e instanceof C?e:new C(e,...t)}static defineFunction(e,t,i=t){let{instance:r=!0,returns:n}=i,o=function(...a){let l=t(...a);if(n==="color")l=C.get(l);else if(n==="function<color>"){let c=l;l=function(...d){let h=c(...d);return C.get(h)},Object.assign(l,c)}else n==="array<color>"&&(l=l.map(c=>C.get(c)));return l};e in C||(C[e]=o),r&&(C.prototype[e]=function(...a){return o(this,...a)})}static defineFunctions(e){for(let t in e)C.defineFunction(t,e[t],e[t])}static extend(e){if(e.register)e.register(C);else for(let t in e)C.defineFunction(t,e[t])}}C.defineFunctions({get:ee,getAll:vt,set:ze,setAll:Wi,to:D,equals:Ja,inGamut:Pe,toGamut:De,distance:Yr,toString:ct});Object.assign(C,{util:Xo,hooks:Ce,WHITES:X,Space:E,spaces:E.registry,parse:qr,defaults:se});for(let s of Object.keys(fr))E.register(fr[s]);for(let s in E.registry)Li(s,E.registry[s]);Ce.add("colorspace-init-end",s=>{var e;Li(s.id,s),(e=s.aliases)==null||e.forEach(t=>{Li(t,s)})});function Li(s,e){let t=s.replace(/-/g,"_");Object.defineProperty(C.prototype,t,{get(){let i=this.getAll(s);return typeof Proxy>"u"?i:new Proxy(i,{has:(r,n)=>{try{return E.resolveCoord([e,n]),!0}catch{}return Reflect.has(r,n)},get:(r,n,o)=>{if(n&&typeof n!="symbol"&&!(n in r)){let{index:a}=E.resolveCoord([e,n]);if(a>=0)return r[a]}return Reflect.get(r,n,o)},set:(r,n,o,a)=>{if(n&&typeof n!="symbol"&&!(n in r)||n>=0){let{index:l}=E.resolveCoord([e,n]);if(l>=0)return r[l]=o,this.setAll(s,r),!0}return Reflect.set(r,n,o,a)}})},set(i){this.setAll(s,i)},configurable:!0,enumerable:!0})}C.extend(tt);C.extend({deltaE:at});Object.assign(C,{deltaEMethods:tt});C.extend(xl);C.extend({contrast:bl});C.extend(vl);C.extend(Qa);C.extend(zl);C.extend(Lt);function Vl(s,e,t,i,r){const n=(...o)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(s,o));return n.prototype=e.prototype,n}class p{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const n=i.getElementById(e);return n?[n]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){var t,i;return e.lazyLoad||((i=(t=e.grid)==null?void 0:t.opts)==null?void 0:i.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0:e.grid)&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return p.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const n=e.y>t.y?e.y:t.y,o=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return o<=n?0:(r-i)*(o-n)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,n)=>{const o=t*((r.y??1e4)-(n.y??1e4));return o===0?t*((r.x??1e4)-(n.x??1e4)):o})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&this.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],n=t[i];i[0]==="_"||r===n?delete e[i]:r&&typeof r=="object"&&n!==void 0&&(p.removeInternalAndSame(r,n),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;if(r.top<0||r.bottom>n){const o=r.bottom-n,a=r.top,l=this.getScrollElement(e);if(l!==null){const c=l.scrollTop;r.top<0&&i<0?e.offsetHeight>n?l.scrollTop+=i:l.scrollTop+=Math.abs(a)>Math.abs(i)?i:a:i>0&&(e.offsetHeight>n?l.scrollTop+=i:l.scrollTop+=o>i?i:o),t.top+=l.scrollTop-c}}}static updateScrollResize(e,t,i){const r=this.getScrollElement(t),n=r.clientHeight,o=r===this.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-o,l=a<i,c=a>n-i;l?r.scrollBy({behavior:"smooth",top:a-i}):c&&r.scrollBy({behavior:"smooth",top:i-(n-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=p.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(n=>n===r)&&(i[r]=p.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=p.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(n=>i[n]=e[n]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(n=>i[n]=e[n]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,n=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(n)}static getValuesFromTransformedElement(e){const t=document.createElement("div");p.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class xe{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let n=t;!this._loading&&this._useEntireRowArea(e,t)&&(n={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,n,r.skip));let o=!1;const a={nested:!0,pack:!1};let l=0;for(;i=i||this.collide(e,n,r.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...a};c=this._loading&&p.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&c?p.copyPos(t,e):!i.locked&&c&&r.pack&&(this._packNodes(),t.y=i.y+i.h,p.copyPos(e,t)),o=o||c}else c=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...a});if(!c)return o;i=void 0}return o}collide(e,t=e,i){const r=e._id,n=i==null?void 0:i._id;return this.nodes.find(o=>o._id!==r&&o._id!==n&&p.isIntercepted(o,t))}collideAll(e,t=e,i){const r=e._id,n=i==null?void 0:i._id;return this.nodes.filter(o=>o._id!==r&&o._id!==n&&p.isIntercepted(o,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,n={...t.rect};n.y>r.y?(n.h+=n.y-r.y,n.y=r.y):n.h+=r.y-n.y,n.x>r.x?(n.w+=n.x-r.x,n.x=r.x):n.w+=r.x-n.x;let o,a=.5;for(let l of i){if(l.locked||!l._rect)break;const c=l._rect;let d=Number.MAX_VALUE,h=Number.MAX_VALUE;r.y<c.y?d=(n.y+n.h-c.y)/c.h:r.y+r.h>c.y+c.h&&(d=(c.y+c.h-n.y)/c.h),r.x<c.x?h=(n.x+n.w-c.x)/c.w:r.x+r.w>c.x+c.w&&(h=(c.x+c.w-n.x)/c.w);const u=Math.min(h,d);u>a&&(a=u,o=l)}return t.collide=o,o}cacheRects(e,t,i,r,n,o){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+o,w:a.w*e-o-r,h:a.h*t-i-n}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const n=t.x,o=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=n,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=o):(e.x=n,e.y=o),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=p.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=p.isTouching(e,t)))){if(t.y<e.y){const n=e;e=t,t=n}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=p.isTouching(e,t)))){if(t.x<e.x){const n=e;e=t,t=n}return i()}return!1}}}isAreaEmpty(e,t,i,r){const n={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(n)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const n=this.nodes;return this.nodes=[],n.forEach((o,a,l)=>{let c;o.locked||(o.autoPosition=!0,e==="list"&&a&&(c=l[a-1])),this.addNode(o,!1,c)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=p.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??xe._idSeq++;const i=e.id;if(i){let n=1;for(;this.nodes.find(o=>o.id===e.id&&o!==e);)e.id=i+"_"+n++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return p.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,p.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||p.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id&&this.findCacheLayout(e,this.defaultColumn)===-1){const n={...e};n.autoPosition||n.x===void 0?(delete n.x,delete n.y):n.x=Math.min(this.defaultColumn-1,n.x),n.w=Math.min(this.defaultColumn,n.w||1),this.cacheOneLayout(n,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),p.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!p.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=p.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||p.samePos(e,e._orig)||(p.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const n=r?r.y*i+(r.x+r.w):0;let o=!1;for(let a=n;!o;++a){const l=a%i,c=Math.floor(a/i);if(l+e.w>i)continue;const d={x:l,y:c,w:e.w,h:e.h};t.find(h=>p.isIntercepted(d,h))||((e.x!==l||e.y!==c)&&(e._dirty=!0),e.x=l,e.y=c,delete e.autoPosition,o=!0)}return o}addNode(e,t=!1,i){const r=this.nodes.find(o=>o._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let n;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,n=!0),this.nodes.push(e),t&&this.addedNodes.push(e),n||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new xe({column:this.column,float:this.float,nodes:this.nodes.map(o=>o._id===e._id?(i={...o},i):{...o})});if(!i)return!1;const n=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!n&&!t.resizing&&t.collide){const o=t.collide.el.gridstackNode;if(this.swap(e,o))return this._notify(),!0}return n?(r.nodes.filter(o=>o._dirty).forEach(o=>{const a=this.nodes.find(l=>l._id===o._id);a&&(p.copyPos(a,o),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new xe({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=p.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){var c,d;if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,n=p.copyPos({},e,!0);if(p.copyPos(n,t),this.nodeBoundFix(n,r),p.copyPos(t,n),!t.forceCollide&&p.samePos(e,t))return!1;const o=p.copyPos({},e),a=this.collideAll(e,n,t.skip);let l=!0;if(a.length){const h=e._moving&&!t.nested;let u=h?this.directionCollideCoverage(e,t,a):a[0];if(h&&u&&((d=(c=e.grid)==null?void 0:c.opts)!=null&&d.subGridDynamic)&&!e.grid._isTemp){const g=p.areaIntercept(t.rect,u._rect),m=p.area(t.rect),b=p.area(u._rect);g/(m<b?m:b)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?l=!this._fixCollisions(e,n,u,t):(l=!1,i&&delete t.pack)}return l&&!p.samePos(e,n)&&(e._dirty=!0,p.copyPos(e,n)),t.pack&&this._packNodes()._notify(),!p.samePos(e,o)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){var o;const i=(o=this._layouts)==null?void 0:o.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,n=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=r==null?void 0:r.find(d=>d._id===a._id),c={...a,...l||{}};p.removeInternalForSave(c,!e),t&&t(a,c),n.push(c)}),n}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(n=>{if(!n._orig)return;const o=t.find(a=>a._id===n._id);o&&(o.y>=0&&n.y!==n._orig.y&&(o.y+=n.y-n._orig.y),n.x!==n._orig.x&&(o.x=Math.round(n.x*r)),n.w!==n._orig.w&&(o.w=Math.round(n.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){var a;if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let n=[],o=r?this.nodes:p.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],c=this._layouts.length-1;!l.length&&e!==c&&((a=this._layouts[c])!=null&&a.length)&&(e=c,this._layouts[c].forEach(d=>{const h=o.find(u=>u._id===d._id);h&&(!r&&!d.autoPosition&&(h.x=d.x??h.x,h.y=d.y??h.y),h.w=d.w??h.w,(d.x==null||d.y===void 0)&&(h.autoPosition=!0))})),l.forEach(d=>{const h=o.findIndex(u=>u._id===d._id);if(h!==-1){const u=o[h];if(r){u.w=d.w;return}(d.autoPosition||isNaN(d.x)||isNaN(d.y))&&this.findEmptyPosition(d,n),d.autoPosition||(u.x=d.x??u.x,u.y=d.y??u.y,u.w=d.w??u.w,n.push(u)),o.splice(h,1)}})}if(r)this.compact(i,!1);else{if(o.length)if(typeof i=="function")i(t,e,n,o);else{const l=r||i==="none"?1:t/e,c=i==="move"||i==="moveScale",d=i==="scale"||i==="moveScale";o.forEach(h=>{h.x=t===1?0:c?Math.round(h.x*l):Math.min(h.x,t-1),h.w=t===1||e===1?1:d?Math.round(h.w*l)||1:Math.min(h.w,t),n.push(h)}),o=[]}n=p.sort(n,-1),this._inColumnResize=!0,this.nodes=[],n.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((n,o)=>{if(n._id===void 0){const a=n.id?this.nodes.find(l=>l.id===n.id):void 0;n._id=(a==null?void 0:a._id)??xe._idSeq++}r[o]={x:n.x,y:n.y,w:n.w,_id:n._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??xe._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){var i,r;return((r=(i=this._layouts)==null?void 0:i[t])==null?void 0:r.findIndex(n=>n._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}xe._idSeq=0;const Q={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class k{}const le=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class pe{}function Bt(s,e){s.touches.length>1||(s.cancelable&&s.preventDefault(),p.simulateMouseEvent(s.changedTouches[0],e))}function En(s,e){s.cancelable&&s.preventDefault(),p.simulateMouseEvent(s,e)}function Wt(s){pe.touchHandled||(pe.touchHandled=!0,Bt(s,"mousedown"))}function Ft(s){pe.touchHandled&&Bt(s,"mousemove")}function Gt(s){if(!pe.touchHandled)return;pe.pointerLeaveTimeout&&(window.clearTimeout(pe.pointerLeaveTimeout),delete pe.pointerLeaveTimeout);const e=!!k.dragElement;Bt(s,"mouseup"),e||Bt(s,"click"),pe.touchHandled=!1}function Ut(s){s.pointerType!=="mouse"&&s.target.releasePointerCapture(s.pointerId)}function gr(s){k.dragElement&&s.pointerType!=="mouse"&&En(s,"mouseenter")}function pr(s){k.dragElement&&s.pointerType!=="mouse"&&(pe.pointerLeaveTimeout=window.setTimeout(()=>{delete pe.pointerLeaveTimeout,En(s,"mouseleave")},10))}class ei{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${ei.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),le&&(this.el.addEventListener("touchstart",Wt),this.el.addEventListener("pointerdown",Ut)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),le&&(this.el.removeEventListener("touchstart",Wt),this.el.removeEventListener("pointerdown",Ut)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),le&&(this.el.addEventListener("touchmove",Ft),this.el.addEventListener("touchend",Gt)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),le&&(this.el.removeEventListener("touchmove",Ft),this.el.removeEventListener("touchend",Gt)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}ei.prefix="ui-resizable-";class Vi{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class gt extends Vi{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),n={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=this.temporalRect||n;return{position:{left:(o.left-r.left)*this.rectScale.x,top:(o.top-r.top)*this.rectScale.y},size:{width:o.width*this.rectScale.x,height:o.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),k.overResizeElement===this&&delete k.overResizeElement),this}_mouseOver(e){k.overResizeElement||k.dragElement||(k.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){k.overResizeElement===this&&(delete k.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new ei(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=p.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=p.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=p.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=p.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=p.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=gt._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=p.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return gt._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=e.clientX-i.clientX,o=this.sizeToContent?0:e.clientY-i.clientY;let a,l;t.indexOf("e")>-1?r.width+=n:t.indexOf("w")>-1&&(r.width-=n,r.left+=n,a=!0),t.indexOf("s")>-1?r.height+=o:t.indexOf("n")>-1&&(r.height-=o,r.top+=o,l=!0);const c=this._constrainSize(r.width,r.height,a,l);return Math.round(r.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-c.width),r.width=c.width),Math.round(r.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-c.height),r.height=c.height),r}_constrainSize(e,t,i,r){const n=this.option,o=(i?n.maxWidthMoveLeft:n.maxWidth)||Number.MAX_SAFE_INTEGER,a=n.minWidth/this.rectScale.x||e,l=(r?n.maxHeightMoveUp:n.maxHeight)||Number.MAX_SAFE_INTEGER,c=n.minHeight/this.rectScale.y||t,d=Math.min(o,Math.max(a,e)),h=Math.min(l,Math.max(c,t));return{width:d,height:h}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}gt._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Yl='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class pt extends Vi{constructor(e,t={}){var n;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(n=t==null?void 0:t.handle)==null?void 0:n.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r!=null&&r.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),le&&(e.addEventListener("touchstart",Wt),e.addEventListener("pointerdown",Ut))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),le&&(t.removeEventListener("touchstart",Wt),t.removeEventListener("pointerdown",Ut))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!k.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Yl)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete k.dragElement,delete k.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),le&&(e.currentTarget.addEventListener("touchmove",Ft),e.currentTarget.addEventListener("touchend",Gt)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),k.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=p.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),k.pauseDrag){const r=Number.isInteger(k.pauseDrag)?k.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),r)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,k.dragElement=this;const r=(i=this.el.gridstackNode)==null?void 0:i.grid;r?k.dropElement=r.el.ddElement.ddDroppable:delete k.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=p.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const n=p.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(n,this.ui()),this.triggerEvent("dragstart",n),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),le&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Ft,!0),e.currentTarget.removeEventListener("touchend",Gt,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=k.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete k.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const r=p.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(r),this.triggerEvent("dragstop",r),k.dropElement&&k.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete k.dragElement,delete k.dropElement,delete k.mouseHandled,e.preventDefault()}_keyEvent(e){var r,n;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((n=(r=k.dropElement)==null?void 0:r.el)==null?void 0:n.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!p.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",p.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=p.cloneNode(this.el)),e.parentElement||p.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=pt.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,r=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",pt.originStyleProp.forEach(n=>i.style[n]=this.dragElementOriginStyle[n]||null),setTimeout(()=>i.style.transition=r,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,n=0;i&&(r=this.dragTransform.xOffset,n=this.dragTransform.yOffset);const o=t.getBoundingClientRect();return{left:o.left,top:o.top,offsetLeft:-e.clientX+o.left-r,offsetTop:-e.clientY+o.top-n,width:o.width*this.dragTransform.xScale,height:o.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}pt.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Xl extends Vi{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),le&&(this.el.addEventListener("pointerenter",gr),this.el.addEventListener("pointerleave",pr)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),le&&(this.el.removeEventListener("pointerenter",gr),this.el.removeEventListener("pointerleave",pr)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!k.dragElement||!this._canDrop(k.dragElement.el))return;e.preventDefault(),e.stopPropagation(),k.dropElement&&k.dropElement!==this&&k.dropElement._mouseLeave(e,!0),k.dropElement=this;const t=p.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(k.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var r;if(!k.dragElement||k.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=p.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(k.dragElement)),this.triggerEvent("dropout",i),k.dropElement===this&&(delete k.dropElement,!t)){let n,o=this.el.parentElement;for(;!n&&o;)n=(r=o.ddElement)==null?void 0:r.ddDroppable,o=o.parentElement;n&&n._mouseEnter(e)}}drop(e){e.preventDefault();const t=p.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(k.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class Yi{static init(e){return e.ddElement||(e.ddElement=new Yi(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new pt(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new gt(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Xl(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Kl{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(n=>{if(t==="disable"||t==="enable")n.ddResizable&&n.ddResizable[t]();else if(t==="destroy")n.ddResizable&&n.cleanResizable();else if(t==="option")n.setupResizable({[i]:r});else{const a=n.el.gridstackNode.grid;let l=n.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const c=!a.opts.alwaysShowResizeHandle;n.setupResizable({...a.opts.resizable,handles:l,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(n=>{if(t==="disable"||t==="enable")n.ddDraggable&&n.ddDraggable[t]();else if(t==="destroy")n.ddDraggable&&n.cleanDraggable();else if(t==="option")n.setupDraggable({[i]:r});else{const o=n.el.gridstackNode.grid;n.setupDraggable({...o.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=n=>t._accept(n)),this._getDDElements(e,t).forEach(n=>{t==="disable"||t==="enable"?n.ddDroppable&&n.ddDroppable[t]():t==="destroy"?n.ddDroppable&&n.cleanDroppable():t==="option"?n.setupDroppable({[i]:r}):n.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,n=>{i(n,k.dragElement?k.dragElement.el:n.target,k.dragElement?k.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=p.getElements(e);return r.length?r.map(o=>o.ddElement||(i?Yi.init(o):null)).filter(o=>o):[]}}/*!
234
+ `,Ke);v([f.n()],he.prototype,"appServer");v([f.n()],he.prototype,"apiHost");v([f.n({type:Object})],he.prototype,"options");v([f.n()],he.prototype,"aiEndPoint");v([f.n()],he.prototype,"authKey");v([f.n()],he.prototype,"authToken");v([f.n()],he.prototype,"messages");v([f.n()],he.prototype,"version");v([f.n()],he.prototype,"libVersion");v([f.n()],he.prototype,"remoteEntryServer");customElements.get(ys)||customElements.define(ys,he);var _r,xr;(xr=(_r=f.r$1).disableWarning)==null||xr.call(_r,"change-in-update");function L(s,e){let t=s.length;Array.isArray(s[0])||(s=[s]),Array.isArray(e[0])||(e=e.map(o=>[o]));let i=e[0].length,r=e[0].map((o,a)=>e.map(l=>l[a])),n=s.map(o=>r.map(a=>{let l=0;if(!Array.isArray(o)){for(let d of a)l+=o*d;return l}for(let d=0;d<o.length;d++)l+=o[d]*(a[d]||0);return l}));return t===1&&(n=n[0]),i===1?n.map(o=>o[0]):n}function yt(s){return ke(s)==="string"}function ke(s){return(Object.prototype.toString.call(s).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Ht(s,{precision:e,unit:t}){return Ae(s)?"none":Br(s,e)+(t??"")}function Ae(s){return Number.isNaN(s)||s instanceof Number&&(s==null?void 0:s.none)}function T(s){return Ae(s)?0:s}function Br(s,e){if(s===0)return 0;let t=~~s,i=0;t&&e&&(i=~~Math.log10(Math.abs(t))+1);const r=10**(e-i);return Math.floor(s*r+.5)/r}const Xo={deg:1,grad:.9,rad:180/Math.PI,turn:360};function Wr(s){if(!s)return;s=s.trim();const e=/^([a-z]+)\((.+?)\)$/i,t=/^-?[\d.]+$/,i=/%|deg|g?rad|turn$/,r=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let n=s.match(e);if(n){let o=[];return n[2].replace(r,(a,l)=>{let d=l.match(i),c=l;if(d){let h=d[0],u=c.slice(0,-h.length);h==="%"?(c=new Number(u/100),c.type="<percentage>"):(c=new Number(u*Xo[h]),c.type="<angle>",c.unit=h)}else t.test(c)?(c=new Number(c),c.type="<number>"):c==="none"&&(c=new Number(NaN),c.none=!0);a.startsWith("/")&&(c=c instanceof Number?c:new Number(c),c.alpha=!0),typeof c=="object"&&c instanceof Number&&(c.raw=l),o.push(c)}),{name:n[1].toLowerCase(),rawName:n[1],rawArgs:n[2],args:o}}}function Gr(s){return s[s.length-1]}function ut(s,e,t){return isNaN(s)?e:isNaN(e)?s:s+(e-s)*t}function Fr(s,e,t){return(t-s)/(e-s)}function Bi(s,e,t){return ut(e[0],e[1],Fr(s[0],s[1],t))}function Ur(s){return s.map(e=>e.split("|").map(t=>{t=t.trim();let i=t.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(i){let r=new String(i[1]);return r.range=[+i[2],+i[3]],r}return t}))}function qr(s,e,t){return Math.max(Math.min(t,e),s)}function Kt(s,e){return Math.sign(s)===Math.sign(e)?s:-s}function be(s,e){return Kt(Math.abs(s)**e,s)}function Wi(s,e){return e===0?0:s/e}function jr(s,e,t=0,i=s.length){for(;t<i;){const r=t+i>>1;s[r]<e?t=r+1:i=r}return t}var Ko=Object.freeze({__proto__:null,bisectLeft:jr,clamp:qr,copySign:Kt,interpolate:ut,interpolateInv:Fr,isNone:Ae,isString:yt,last:Gr,mapRange:Bi,multiplyMatrices:L,parseCoordGrammar:Ur,parseFunction:Wr,serializeNumber:Ht,skipNone:T,spow:be,toPrecision:Br,type:ke,zdiv:Wi});class Jo{add(e,t,i){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(r){this[r]=this[r]||[],t&&this[r][i?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(i){i.call(t&&t.context?t.context:t,t)})}}const Ce=new Jo;var Er,zr,Mr,se={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((Mr=(zr=(Er=globalThis==null?void 0:globalThis.process)==null?void 0:Er.env)==null?void 0:zr.NODE_ENV)==null?void 0:Mr.toLowerCase())!=="test",warn:function(e){var t,i;this.verbose&&((i=(t=globalThis==null?void 0:globalThis.console)==null?void 0:t.warn)==null||i.call(t,e))}};const X={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function ki(s){return Array.isArray(s)?s:X[s]}function Ot(s,e,t,i={}){if(s=ki(s),e=ki(e),!s||!e)throw new TypeError(`Missing white point to convert ${s?"":"from"}${!s&&!e?"/":""}${e?"":"to"}`);if(s===e)return t;let r={W1:s,W2:e,XYZ:t,options:i};if(Ce.run("chromatic-adaptation-start",r),r.M||(r.W1===X.D65&&r.W2===X.D50?r.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:r.W1===X.D50&&r.W2===X.D65&&(r.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),Ce.run("chromatic-adaptation-end",r),r.M)return L(r.M,r.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Zo=new Set(["<number>","<percentage>","<angle>"]);function vs(s,e,t,i){return Object.entries(s.coords).map(([n,o],a)=>{let l=e.coordGrammar[a],d=i[a],c=d==null?void 0:d.type,h;if(d.none?h=l.find(m=>Zo.has(m)):h=l.find(m=>m==c),!h){let m=o.name||n;throw new TypeError(`${c??d.raw} not allowed for ${m} in ${t}()`)}let u=h.range;c==="<percentage>"&&(u||(u=[0,1]));let g=o.range||o.refRange;return u&&g&&(i[a]=Bi(u,g,i[a])),h})}function Vr(s,{meta:e}={}){var i,r,n,o;let t={str:(i=String(s))==null?void 0:i.trim()};if(Ce.run("parse-start",t),t.color)return t.color;if(t.parsed=Wr(t.str),t.parsed){let a=t.parsed.name;if(a==="color"){let l=t.parsed.args.shift(),d=l.startsWith("--")?l.substring(2):`--${l}`,c=[l,d],h=t.parsed.rawArgs.indexOf("/")>0?t.parsed.args.pop():1;for(let m of E.all){let b=m.getFormat("color");if(b&&(c.includes(b.id)||(r=b.ids)!=null&&r.filter(y=>c.includes(y)).length)){const y=Object.keys(m.coords).map((_,x)=>t.parsed.args[x]||0);let w;return b.coordGrammar&&(w=vs(m,b,"color",y)),e&&Object.assign(e,{formatId:"color",types:w}),b.id.startsWith("--")&&!l.startsWith("--")&&se.warn(`${m.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${b.id}) instead of color(${l}).`),l.startsWith("--")&&!b.id.startsWith("--")&&se.warn(`${m.name} is a standard space and supported in the CSS spec. Use color(${b.id}) instead of prefixed color(${l}).`),{spaceId:m.id,coords:y,alpha:h}}}let u="",g=l in E.registry?l:d;if(g in E.registry){let m=(o=(n=E.registry[g].formats)==null?void 0:n.color)==null?void 0:o.id;m&&(u=`Did you mean color(${m})?`)}throw new TypeError(`Cannot parse color(${l}). `+(u||"Missing a plugin?"))}else for(let l of E.all){let d=l.getFormat(a);if(d&&d.type==="function"){let c=1;(d.lastAlpha||Gr(t.parsed.args).alpha)&&(c=t.parsed.args.pop());let h=t.parsed.args,u;return d.coordGrammar&&(u=vs(l,d,a,h)),e&&Object.assign(e,{formatId:d.name,types:u}),{spaceId:l.id,coords:h,alpha:c}}}}else for(let a of E.all)for(let l in a.formats){let d=a.formats[l];if(d.type!=="custom"||d.test&&!d.test(t.str))continue;let c=d.parse(t.str);if(c)return c.alpha??(c.alpha=1),e&&(e.formatId=l),c}throw new TypeError(`Could not parse ${s} as a color. Missing a plugin?`)}function S(s){if(Array.isArray(s))return s.map(S);if(!s)throw new TypeError("Empty color reference");yt(s)&&(s=Vr(s));let e=s.space||s.spaceId;return e instanceof E||(s.space=E.get(e)),s.alpha===void 0&&(s.alpha=1),s}const Qo=75e-6,K=class K{constructor(e){var r;this.id=e.id,this.name=e.name,this.base=e.base?K.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let t=e.coords??this.base.coords;for(let n in t)"name"in t[n]||(t[n].name=n);this.coords=t;let i=e.white??this.base.white??"D65";this.white=ki(i),this.formats=e.formats??{};for(let n in this.formats){let o=this.formats[n];o.type||(o.type="function"),o.name||(o.name=n)}(r=this.formats.color)!=null&&r.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace=e.gamutSpace==="self"?this:K.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(n,o)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:ea(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),Ce.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=Qo}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let i=Object.values(this.coords);return e.every((r,n)=>{let o=i[n];if(o.type!=="angle"&&o.range){if(Number.isNaN(r))return!0;let[a,l]=o.range;return(a===void 0||r>=a-t)&&(l===void 0||r<=l+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return((t=(e=this.formats)==null?void 0:e.color)==null?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=ws(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=ws(t,this),t):null}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(e,t){if(arguments.length===1){const a=S(e);[e,t]=[a.space,a.coords]}if(e=K.get(e),this.equals(e))return t;t=t.map(a=>Number.isNaN(a)?0:a);let i=this.path,r=e.path,n,o;for(let a=0;a<i.length&&i[a].equals(r[a]);a++)n=i[a],o=a;if(!n)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let a=i.length-1;a>o;a--)t=i[a].toBase(t);for(let a=o+1;a<r.length;a++)t=r[a].fromBase(t);return t}from(e,t){if(arguments.length===1){const i=S(e);[e,t]=[i.space,i.coords]}return e=K.get(e),e.to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let i=this.coords[t],r=i.range||i.refRange;e.push((r==null?void 0:r.min)??0)}return e}static get all(){return[...new Set(Object.values(K.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let i of t.aliases)this.register(i,t);return t}static get(e,...t){if(!e||e instanceof K)return e;if(ke(e)==="string"){let r=K.registry[e.toLowerCase()];if(!r)throw new TypeError(`No color space found with id = "${e}"`);return r}if(t.length)return K.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var l;let i=ke(e),r,n;if(i==="string"?e.includes(".")?[r,n]=e.split("."):[r,n]=[,e]:Array.isArray(e)?[r,n]=e:(r=e.space,n=e.coordId),r=K.get(r),r||(r=t),!r)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=ke(n),i==="number"||i==="string"&&n>=0){let d=Object.entries(r.coords)[n];if(d)return{space:r,id:d[0],index:n,...d[1]}}r=K.get(r);let o=n.toLowerCase(),a=0;for(let d in r.coords){let c=r.coords[d];if(d.toLowerCase()===o||((l=c.name)==null?void 0:l.toLowerCase())===o)return{space:r,id:d,index:a,...c};a++}throw new TypeError(`No "${n}" coordinate found in ${r.name}. Its coordinates are: ${Object.keys(r.coords).join(", ")}`)}};ii(K,"registry",{}),ii(K,"DEFAULT_FORMAT",{type:"functions",name:"color"});let E=K;function ea(s){let e=[s];for(let t=s;t=t.base;)e.push(t);return e}function ws(s,{coords:e}={}){if(s.coords&&!s.coordGrammar){s.type||(s.type="function"),s.name||(s.name="color"),s.coordGrammar=Ur(s.coords);let t=Object.entries(e).map(([i,r],n)=>{let o=s.coordGrammar[n][0],a=r.range||r.refRange,l=o.range,d="";return o=="<percentage>"?(l=[0,100],d="%"):o=="<angle>"&&(d="deg"),{fromRange:a,toRange:l,suffix:d}});s.serializeCoords=(i,r)=>i.map((n,o)=>{let{fromRange:a,toRange:l,suffix:d}=t[o];return a&&l&&(n=Bi(a,l,n)),n=Ht(n,{precision:r,unit:d}),n})}return s}var U=new E({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class J extends E{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=U),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=t=>{let i=L(e.toXYZ_M,t);return this.white!==this.base.white&&(i=Ot(this.white,this.base.white,i)),i}),e.fromBase??(e.fromBase=t=>(t=Ot(this.base.white,this.white,t),L(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function vt(s,e){return s=S(s),!e||s.space.equals(e)?s.coords.slice():(e=E.get(e),e.from(s))}function ee(s,e){s=S(s);let{space:t,index:i}=E.resolveCoord(e,s.space);return vt(s,t)[i]}function Gi(s,e,t){return s=S(s),e=E.get(e),s.coords=e.to(s.space,t),s}Gi.returns="color";function ze(s,e,t){if(s=S(s),arguments.length===2&&ke(arguments[1])==="object"){let i=arguments[1];for(let r in i)ze(s,r,i[r])}else{typeof t=="function"&&(t=t(ee(s,e)));let{space:i,index:r}=E.resolveCoord(e,s.space),n=vt(s,i);n[r]=t,Gi(s,i,n)}return s}ze.returns="color";var Fi=new E({id:"xyz-d50",name:"XYZ D50",white:"D50",base:U,fromBase:s=>Ot(U.white,"D50",s),toBase:s=>Ot("D50",U.white,s)});const ta=216/24389,_s=24/116,zt=24389/27;let li=X.D50;var te=new E({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:li,base:Fi,fromBase(s){let t=s.map((i,r)=>i/li[r]).map(i=>i>ta?Math.cbrt(i):(zt*i+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(s){let e=[];return e[1]=(s[0]+16)/116,e[0]=s[1]/500+e[1],e[2]=e[1]-s[2]/200,[e[0]>_s?Math.pow(e[0],3):(116*e[0]-16)/zt,s[0]>8?Math.pow((s[0]+16)/116,3):s[0]/zt,e[2]>_s?Math.pow(e[2],3):(116*e[2]-16)/zt].map((i,r)=>i*li[r])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function _e(s){return(s%360+360)%360}function ia(s,e){if(s==="raw")return e;let[t,i]=e.map(_e),r=i-t;return s==="increasing"?r<0&&(i+=360):s==="decreasing"?r>0&&(t+=360):s==="longer"?-180<r&&r<180&&(r>0?t+=360:i+=360):s==="shorter"&&(r>180?t+=360:r<-180&&(i+=360)),[t,i]}var mt=new E({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:te,fromBase(s){let[e,t,i]=s,r;const n=.02;return Math.abs(t)<n&&Math.abs(i)<n?r=NaN:r=Math.atan2(i,t)*180/Math.PI,[e,Math.sqrt(t**2+i**2),_e(r)]},toBase(s){let[e,t,i]=s;return t<0&&(t=0),isNaN(i)&&(i=0),[e,t*Math.cos(i*Math.PI/180),t*Math.sin(i*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const xs=25**7,Pt=Math.PI,Es=180/Pt,Ge=Pt/180;function zs(s){const e=s*s;return e*e*e*s}function Yr(s,e,{kL:t=1,kC:i=1,kH:r=1}={}){[s,e]=S([s,e]);let[n,o,a]=te.from(s),l=mt.from(te,[n,o,a])[1],[d,c,h]=te.from(e),u=mt.from(te,[d,c,h])[1];l<0&&(l=0),u<0&&(u=0);let g=(l+u)/2,m=zs(g),b=.5*(1-Math.sqrt(m/(m+xs))),y=(1+b)*o,w=(1+b)*c,_=Math.sqrt(y**2+a**2),x=Math.sqrt(w**2+h**2),R=y===0&&a===0?0:Math.atan2(a,y),A=w===0&&h===0?0:Math.atan2(h,w);R<0&&(R+=2*Pt),A<0&&(A+=2*Pt),R*=Es,A*=Es;let j=d-n,W=x-_,H=A-R,G=R+A,O=Math.abs(H),ue;_*x===0?ue=0:O<=180?ue=H:H>180?ue=H-360:H<-180?ue=H+360:se.warn("the unthinkable has happened");let $=2*Math.sqrt(x*_)*Math.sin(ue*Ge/2),oe=(n+d)/2,I=(_+x)/2,me=zs(I),V;_*x===0?V=G:O<=180?V=G/2:G<360?V=(G+360)/2:V=(G-360)/2;let fe=(oe-50)**2,Z=1+.015*fe/Math.sqrt(20+fe),ae=1+.045*I,Ie=1;Ie-=.17*Math.cos((V-30)*Ge),Ie+=.24*Math.cos(2*V*Ge),Ie+=.32*Math.cos((3*V+6)*Ge),Ie-=.2*Math.cos((4*V-63)*Ge);let Ki=1+.015*I*Ie,Cn=30*Math.exp(-1*((V-275)/25)**2),Dn=2*Math.sqrt(me/(me+xs)),Ln=-1*Math.sin(2*Cn*Ge)*Dn,_t=(j/(t*Z))**2;return _t+=(W/(i*ae))**2,_t+=($/(r*Ki))**2,_t+=Ln*(W/(i*ae))*($/(r*Ki)),Math.sqrt(_t)}const sa=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],ra=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],na=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],oa=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var Qe=new E({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:U,fromBase(s){let t=L(sa,s).map(i=>Math.cbrt(i));return L(na,t)},toBase(s){let t=L(oa,s).map(i=>i**3);return L(ra,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Ri(s,e){[s,e]=S([s,e]);let[t,i,r]=Qe.from(s),[n,o,a]=Qe.from(e),l=t-n,d=i-o,c=r-a;return Math.sqrt(l**2+d**2+c**2)}const aa=75e-6;function Pe(s,e,{epsilon:t=aa}={}){s=S(s),e||(e=s.space),e=E.get(e);let i=s.coords;return e!==s.space&&(i=e.from(s)),e.inGamut(i,{epsilon:t})}function et(s){return{space:s.space,coords:s.coords.slice(),alpha:s.alpha}}function Xr(s,e,t="lab"){t=E.get(t);let i=t.from(s),r=t.from(e);return Math.sqrt(i.reduce((n,o,a)=>{let l=r[a];return isNaN(o)||isNaN(l)?n:n+(l-o)**2},0))}function la(s,e){return Xr(s,e,"lab")}const da=Math.PI,Ms=da/180;function ca(s,e,{l:t=2,c:i=1}={}){[s,e]=S([s,e]);let[r,n,o]=te.from(s),[,a,l]=mt.from(te,[r,n,o]),[d,c,h]=te.from(e),u=mt.from(te,[d,c,h])[1];a<0&&(a=0),u<0&&(u=0);let g=r-d,m=a-u,b=n-c,y=o-h,w=b**2+y**2-m**2,_=.511;r>=16&&(_=.040975*r/(1+.01765*r));let x=.0638*a/(1+.0131*a)+.638,R;Number.isNaN(l)&&(l=0),l>=164&&l<=345?R=.56+Math.abs(.2*Math.cos((l+168)*Ms)):R=.36+Math.abs(.4*Math.cos((l+35)*Ms));let A=Math.pow(a,4),j=Math.sqrt(A/(A+1900)),W=x*(j*R+1-j),H=(g/(t*_))**2;return H+=(m/(i*x))**2,H+=w/W**2,Math.sqrt(H)}const ks=203;var Ui=new E({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:U,fromBase(s){return s.map(e=>Math.max(e*ks,0))},toBase(s){return s.map(e=>Math.max(e/ks,0))}});const Mt=1.15,kt=.66,Rs=2610/2**14,ha=2**14/2610,Ss=3424/2**12,As=2413/2**7,Cs=2392/2**7,ua=1.7*2523/2**5,Ds=2**5/(1.7*2523),Rt=-.56,di=16295499532821565e-27,ma=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],fa=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],ga=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],pa=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var Kr=new E({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Ui,fromBase(s){let[e,t,i]=s,r=Mt*e-(Mt-1)*i,n=kt*t-(kt-1)*e,a=L(ma,[r,n,i]).map(function(u){let g=Ss+As*(u/1e4)**Rs,m=1+Cs*(u/1e4)**Rs;return(g/m)**ua}),[l,d,c]=L(ga,a);return[(1+Rt)*l/(1+Rt*l)-di,d,c]},toBase(s){let[e,t,i]=s,r=(e+di)/(1+Rt-Rt*(e+di)),o=L(pa,[r,t,i]).map(function(u){let g=Ss-u**Ds,m=Cs*u**Ds-As;return 1e4*(g/m)**ha}),[a,l,d]=L(fa,o),c=(a+(Mt-1)*d)/Mt,h=(l+(kt-1)*c)/kt;return[c,h,d]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),Si=new E({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:Kr,fromBase(s){let[e,t,i]=s,r;const n=2e-4;return Math.abs(t)<n&&Math.abs(i)<n?r=NaN:r=Math.atan2(i,t)*180/Math.PI,[e,Math.sqrt(t**2+i**2),_e(r)]},toBase(s){return[s[0],s[1]*Math.cos(s[2]*Math.PI/180),s[1]*Math.sin(s[2]*Math.PI/180)]}});function ba(s,e){[s,e]=S([s,e]);let[t,i,r]=Si.from(s),[n,o,a]=Si.from(e),l=t-n,d=i-o;Number.isNaN(r)&&Number.isNaN(a)?(r=0,a=0):Number.isNaN(r)?r=a:Number.isNaN(a)&&(a=r);let c=r-a,h=2*Math.sqrt(i*o)*Math.sin(c/2*(Math.PI/180));return Math.sqrt(l**2+d**2+h**2)}const Jr=3424/4096,Zr=2413/128,Qr=2392/128,Ls=2610/16384,ya=2523/32,va=16384/2610,Is=32/2523,wa=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],_a=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],xa=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],Ea=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var Ai=new E({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Ui,fromBase(s){let e=L(wa,s);return za(e)},toBase(s){let e=Ma(s);return L(Ea,e)}});function za(s){let e=s.map(function(t){let i=Jr+Zr*(t/1e4)**Ls,r=1+Qr*(t/1e4)**Ls;return(i/r)**ya});return L(_a,e)}function Ma(s){return L(xa,s).map(function(i){let r=Math.max(i**Is-Jr,0),n=Zr-Qr*i**Is;return 1e4*(r/n)**va})}function ka(s,e){[s,e]=S([s,e]);let[t,i,r]=Ai.from(s),[n,o,a]=Ai.from(e);return 720*Math.sqrt((t-n)**2+.25*(i-o)**2+(r-a)**2)}const Ra=X.D65,en=.42,Ts=1/en,ci=2*Math.PI,tn=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],Sa=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],Aa=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Ca={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},He={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Da=180/Math.PI,Ns=Math.PI/180;function sn(s,e){return s.map(i=>{const r=be(e*Math.abs(i)*.01,en);return 400*Kt(r,i)/(r+27.13)})}function La(s,e){const t=100/e*27.13**Ts;return s.map(i=>{const r=Math.abs(i);return Kt(t*be(r/(400-r),Ts),i)})}function Ia(s){let e=_e(s);e<=He.h[0]&&(e+=360);const t=jr(He.h,e)-1,[i,r]=He.h.slice(t,t+2),[n,o]=He.e.slice(t,t+2),a=He.H[t],l=(e-i)/n;return a+100*l/(l+(r-e)/o)}function Ta(s){let e=(s%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[i,r]=He.h.slice(t,t+2),[n,o]=He.e.slice(t,t+2);return _e((e*(o*i-n*r)-100*i*o)/(e*(o-n)-100*o))}function rn(s,e,t,i,r){const n={};n.discounting=r,n.refWhite=s,n.surround=i;const o=s.map(b=>b*100);n.la=e,n.yb=t;const a=o[1],l=L(tn,o);i=Ca[n.surround];const d=i[0];n.c=i[1],n.nc=i[2];const h=(1/(5*n.la+1))**4;n.fl=h*n.la+.1*(1-h)*(1-h)*Math.cbrt(5*n.la),n.flRoot=n.fl**.25,n.n=n.yb/a,n.z=1.48+Math.sqrt(n.n),n.nbb=.725*n.n**-.2,n.ncb=n.nbb;const u=Math.max(Math.min(d*(1-1/3.6*Math.exp((-n.la-42)/92)),1),0);n.dRgb=l.map(b=>ut(1,a/b,u)),n.dRgbInv=n.dRgb.map(b=>1/b);const g=l.map((b,y)=>b*n.dRgb[y]),m=sn(g,n.fl);return n.aW=n.nbb*(2*m[0]+m[1]+.05*m[2]),n}const Hs=rn(Ra,64/Math.PI*.2,20,"average",!1);function Ci(s,e){if(!(s.J!==void 0^s.Q!==void 0))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(s.C!==void 0^s.M!==void 0^s.s!==void 0))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(s.h!==void 0^s.H!==void 0))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(s.J===0||s.Q===0)return[0,0,0];let t=0;s.h!==void 0?t=_e(s.h)*Ns:t=Ta(s.H)*Ns;const i=Math.cos(t),r=Math.sin(t);let n=0;s.J!==void 0?n=be(s.J,1/2)*.1:s.Q!==void 0&&(n=.25*e.c*s.Q/((e.aW+4)*e.flRoot));let o=0;s.C!==void 0?o=s.C/n:s.M!==void 0?o=s.M/e.flRoot/n:s.s!==void 0&&(o=4e-4*s.s**2*(e.aW+4)/e.c);const a=be(o*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),l=.25*(Math.cos(t+2)+3.8),d=e.aW*be(n,2/e.c/e.z),c=5e4/13*e.nc*e.ncb*l,h=d/e.nbb,u=23*(h+.305)*Wi(a,23*c+a*(11*i+108*r)),g=u*i,m=u*r,b=La(L(Aa,[h,g,m]).map(y=>y*1/1403),e.fl);return L(Sa,b.map((y,w)=>y*e.dRgbInv[w])).map(y=>y/100)}function nn(s,e){const t=s.map(x=>x*100),i=sn(L(tn,t).map((x,R)=>x*e.dRgb[R]),e.fl),r=i[0]+(-12*i[1]+i[2])/11,n=(i[0]+i[1]-2*i[2])/9,o=(Math.atan2(n,r)%ci+ci)%ci,a=.25*(Math.cos(o+2)+3.8),l=5e4/13*e.nc*e.ncb*Wi(a*Math.sqrt(r**2+n**2),i[0]+i[1]+1.05*i[2]+.305),d=be(l,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),c=e.nbb*(2*i[0]+i[1]+.05*i[2]),h=be(c/e.aW,.5*e.c*e.z),u=100*be(h,2),g=4/e.c*h*(e.aW+4)*e.flRoot,m=d*h,b=m*e.flRoot,y=_e(o*Da),w=Ia(y),_=50*be(e.c*d/(e.aW+4),1/2);return{J:u,C:m,h:y,s:_,Q:g,M:b,H:w}}var Na=new E({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:U,fromBase(s){const e=nn(s,Hs);return[e.J,e.M,e.h]},toBase(s){return Ci({J:s[0],M:s[1],h:s[2]},Hs)}});const Ha=X.D65,Oa=216/24389,on=24389/27;function Pa(s){return 116*(s>Oa?Math.cbrt(s):(on*s+16)/116)-16}function Di(s){return s>8?Math.pow((s+16)/116,3):s/on}function $a(s,e){let[t,i,r]=s,n=[],o=0;if(r===0)return[0,0,0];let a=Di(r);r>0?o=.00379058511492914*r**2+.608983189401032*r+.9155088574762233:o=9514440756550361e-21*r**2+.08693057439788597*r-21.928975842194614;const l=2e-12,d=15;let c=0,h=1/0;for(;c<=d;){n=Ci({J:o,C:i,h:t},e);const u=Math.abs(n[1]-a);if(u<h){if(u<=l)return n;h=u}o=o-(n[1]-a)*o/(2*n[1]),c+=1}return Ci({J:o,C:i,h:t},e)}function Ba(s,e){const t=Pa(s[1]);if(t===0)return[0,0,0];const i=nn(s,qi);return[_e(i.h),i.C,t]}const qi=rn(Ha,200/Math.PI*Di(50),Di(50)*100,"average",!1);var ft=new E({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:U,fromBase(s){return Ba(s)},toBase(s){return $a(s,qi)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const Wa=Math.PI/180,Os=[1,.007,.0228];function Ps(s){s[1]<0&&(s=ft.fromBase(ft.toBase(s)));const e=Math.log(Math.max(1+Os[2]*s[1]*qi.flRoot,1))/Os[2],t=s[0]*Wa,i=e*Math.cos(t),r=e*Math.sin(t);return[s[2],i,r]}function Ga(s,e){[s,e]=S([s,e]);let[t,i,r]=Ps(ft.from(s)),[n,o,a]=Ps(ft.from(e));return Math.sqrt((t-n)**2+(i-o)**2+(r-a)**2)}var tt={deltaE76:la,deltaECMC:ca,deltaE2000:Yr,deltaEJz:ba,deltaEITP:ka,deltaEOK:Ri,deltaEHCT:Ga};function Fa(s){const e=s?Math.floor(Math.log10(Math.abs(s))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const $s={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function De(s,{method:e=se.gamut_mapping,space:t=void 0,deltaEMethod:i="",jnd:r=2,blackWhiteClamp:n={}}={}){if(s=S(s),yt(arguments[1])?t=arguments[1]:t||(t=s.space),t=E.get(t),Pe(s,t,{epsilon:0}))return s;let o;if(e==="css")o=Ua(s,{space:t});else{if(e!=="clip"&&!Pe(s,t)){Object.prototype.hasOwnProperty.call($s,e)&&({method:e,jnd:r,deltaEMethod:i,blackWhiteClamp:n}=$s[e]);let a=Yr;if(i!==""){for(let d in tt)if("deltae"+i.toLowerCase()===d.toLowerCase()){a=tt[d];break}}let l=De(D(s,t),{method:"clip",space:t});if(a(s,l)>r){if(Object.keys(n).length===3){let _=E.resolveCoord(n.channel),x=ee(D(s,_.space),_.id);if(Ae(x)&&(x=0),x>=n.max)return D({space:"xyz-d65",coords:X.D65},s.space);if(x<=n.min)return D({space:"xyz-d65",coords:[0,0,0]},s.space)}let d=E.resolveCoord(e),c=d.space,h=d.id,u=D(s,c);u.coords.forEach((_,x)=>{Ae(_)&&(u.coords[x]=0)});let m=(d.range||d.refRange)[0],b=Fa(r),y=m,w=ee(u,h);for(;w-y>b;){let _=et(u);_=De(_,{space:t,method:"clip"}),a(u,_)-r<b?y=ee(u,h):w=ee(u,h),ze(u,h,(y+w)/2)}o=D(u,t)}else o=l}else o=D(s,t);if(e==="clip"||!Pe(o,t,{epsilon:0})){let a=Object.values(t.coords).map(l=>l.range||[]);o.coords=o.coords.map((l,d)=>{let[c,h]=a[d];return c!==void 0&&(l=Math.max(c,l)),h!==void 0&&(l=Math.min(l,h)),l})}}return t!==s.space&&(o=D(o,s.space)),s.coords=o.coords,s}De.returns="color";const Bs={WHITE:{space:Qe,coords:[1,0,0]},BLACK:{space:Qe,coords:[0,0,0]}};function Ua(s,{space:e}={}){s=S(s),e||(e=s.space),e=E.get(e);const r=E.get("oklch");if(e.isUnbounded)return D(s,e);const n=D(s,r);let o=n.coords[0];if(o>=1){const m=D(Bs.WHITE,e);return m.alpha=s.alpha,D(m,e)}if(o<=0){const m=D(Bs.BLACK,e);return m.alpha=s.alpha,D(m,e)}if(Pe(n,e,{epsilon:0}))return D(n,e);function a(m){const b=D(m,e),y=Object.values(e.coords);return b.coords=b.coords.map((w,_)=>{if("range"in y[_]){const[x,R]=y[_].range;return qr(x,w,R)}return w}),b}let l=0,d=n.coords[1],c=!0,h=et(n),u=a(h),g=Ri(u,h);if(g<.02)return u;for(;d-l>1e-4;){const m=(l+d)/2;if(h.coords[1]=m,c&&Pe(h,e,{epsilon:0}))l=m;else if(u=a(h),g=Ri(u,h),g<.02){if(.02-g<1e-4)break;c=!1,l=m}else d=m}return u}function D(s,e,{inGamut:t}={}){s=S(s),e=E.get(e);let i=e.from(s),r={space:e,coords:i,alpha:s.alpha};return t&&(r=De(r,t===!0?void 0:t)),r}D.returns="color";function ct(s,{precision:e=se.precision,format:t="default",inGamut:i=!0,...r}={}){var l;let n;s=S(s);let o=t;t=s.space.getFormat(t)??s.space.getFormat("default")??E.DEFAULT_FORMAT;let a=s.coords.slice();if(i||(i=t.toGamut),i&&!Pe(s)&&(a=De(et(s),i===!0?void 0:i).coords),t.type==="custom")if(r.precision=e,t.serialize)n=t.serialize(a,s.alpha,r);else throw new TypeError(`format ${o} can only be used to parse colors, not for serialization`);else{let d=t.name||"color";t.serializeCoords?a=t.serializeCoords(a,e):e!==null&&(a=a.map(g=>Ht(g,{precision:e})));let c=[...a];if(d==="color"){let g=t.id||((l=t.ids)==null?void 0:l[0])||s.space.id;c.unshift(g)}let h=s.alpha;e!==null&&(h=Ht(h,{precision:e}));let u=s.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${h}`;n=`${d}(${c.join(t.commas?", ":" ")}${u})`}return n}const qa=[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],ja=[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]];var Jt=new J({id:"rec2020-linear",cssId:"--rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:qa,fromXYZ_M:ja});const St=1.09929682680944,Ws=.018053968510807;var an=new J({id:"rec2020",name:"REC.2020",base:Jt,toBase(s){return s.map(function(e){return e<Ws*4.5?e/4.5:Math.pow((e+St-1)/St,1/.45)})},fromBase(s){return s.map(function(e){return e>=Ws?St*Math.pow(e,.45)-(St-1):4.5*e})}});const Va=[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],Ya=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]];var ln=new J({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:Va,fromXYZ_M:Ya});const Xa=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],P=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]];var dn=new J({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:Xa,fromXYZ_M:P}),Gs={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let Fs=Array(3).fill("<percentage> | <number>[0, 255]"),Us=Array(3).fill("<number>[0, 255]");var it=new J({id:"srgb",name:"sRGB",base:dn,fromBase:s=>s.map(e=>{let t=e<0?-1:1,i=e*t;return i>.0031308?t*(1.055*i**(1/2.4)-.055):12.92*e}),toBase:s=>s.map(e=>{let t=e<0?-1:1,i=e*t;return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4}),formats:{rgb:{coords:Fs},rgb_number:{name:"rgb",commas:!0,coords:Us,noAlpha:!0},color:{},rgba:{coords:Fs,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Us},hex:{type:"custom",toGamut:!0,test:s=>/^#([a-f0-9]{3,4}){1,2}$/i.test(s),parse(s){s.length<=5&&(s=s.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return s.replace(/[a-f0-9]{2}/gi,t=>{e.push(parseInt(t,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(s,e,{collapse:t=!0}={})=>{e<1&&s.push(e),s=s.map(n=>Math.round(n*255));let i=t&&s.every(n=>n%17===0);return"#"+s.map(n=>i?(n/17).toString(16):n.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:s=>/^[a-z]+$/i.test(s),parse(s){s=s.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(s==="transparent"?(e.coords=Gs.black,e.alpha=0):e.coords=Gs[s],e.coords)return e}}}}),cn=new J({id:"p3",cssId:"display-p3",name:"P3",base:ln,fromBase:it.fromBase,toBase:it.toBase});se.display_space=it;let Ka;if(typeof CSS<"u"&&CSS.supports)for(let s of[te,an,cn]){let e=s.getMinCoords(),i=ct({space:s,coords:e,alpha:1});if(CSS.supports("color",i)){se.display_space=s;break}}function Ja(s,{space:e=se.display_space,...t}={}){let i=ct(s,t);if(typeof CSS>"u"||CSS.supports("color",i)||!se.display_space)i=new String(i),i.color=s;else{let r=s;if((s.coords.some(Ae)||Ae(s.alpha))&&!(Ka??(Ka=CSS.supports("color","hsl(none 50% 50%)")))&&(r=et(s),r.coords=r.coords.map(T),r.alpha=T(r.alpha),i=ct(r,t),CSS.supports("color",i)))return i=new String(i),i.color=r,i;r=D(r,e),i=new String(ct(r,t)),i.color=r}return i}function Za(s,e){return s=S(s),e=S(e),s.space===e.space&&s.alpha===e.alpha&&s.coords.every((t,i)=>t===e.coords[i])}function Le(s){return ee(s,[U,"y"])}function hn(s,e){ze(s,[U,"y"],e)}function Qa(s){Object.defineProperty(s.prototype,"luminance",{get(){return Le(this)},set(e){hn(this,e)}})}var el=Object.freeze({__proto__:null,getLuminance:Le,register:Qa,setLuminance:hn});function tl(s,e){s=S(s),e=S(e);let t=Math.max(Le(s),0),i=Math.max(Le(e),0);return i>t&&([t,i]=[i,t]),(t+.05)/(i+.05)}const il=.56,sl=.57,rl=.62,nl=.65,qs=.022,ol=1.414,al=.1,ll=5e-4,dl=1.14,js=.027,cl=1.14;function Vs(s){return s>=qs?s:s+(qs-s)**ol}function Fe(s){let e=s<0?-1:1,t=Math.abs(s);return e*Math.pow(t,2.4)}function hl(s,e){e=S(e),s=S(s);let t,i,r,n,o,a;e=D(e,"srgb"),[n,o,a]=e.coords;let l=Fe(n)*.2126729+Fe(o)*.7151522+Fe(a)*.072175;s=D(s,"srgb"),[n,o,a]=s.coords;let d=Fe(n)*.2126729+Fe(o)*.7151522+Fe(a)*.072175,c=Vs(l),h=Vs(d),u=h>c;return Math.abs(h-c)<ll?i=0:u?(t=h**il-c**sl,i=t*dl):(t=h**nl-c**rl,i=t*cl),Math.abs(i)<al?r=0:i>0?r=i-js:r=i+js,r*100}function ul(s,e){s=S(s),e=S(e);let t=Math.max(Le(s),0),i=Math.max(Le(e),0);i>t&&([t,i]=[i,t]);let r=t+i;return r===0?0:(t-i)/r}const ml=5e4;function fl(s,e){s=S(s),e=S(e);let t=Math.max(Le(s),0),i=Math.max(Le(e),0);return i>t&&([t,i]=[i,t]),i===0?ml:(t-i)/i}function gl(s,e){s=S(s),e=S(e);let t=ee(s,[te,"l"]),i=ee(e,[te,"l"]);return Math.abs(t-i)}const pl=216/24389,Ys=24/116,At=24389/27;let hi=X.D65;var Li=new E({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:hi,base:U,fromBase(s){let t=s.map((i,r)=>i/hi[r]).map(i=>i>pl?Math.cbrt(i):(At*i+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(s){let e=[];return e[1]=(s[0]+16)/116,e[0]=s[1]/500+e[1],e[2]=e[1]-s[2]/200,[e[0]>Ys?Math.pow(e[0],3):(116*e[0]-16)/At,s[0]>8?Math.pow((s[0]+16)/116,3):s[0]/At,e[2]>Ys?Math.pow(e[2],3):(116*e[2]-16)/At].map((i,r)=>i*hi[r])},formats:{"lab-d65":{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});const ui=Math.pow(5,.5)*.5+.5;function bl(s,e){s=S(s),e=S(e);let t=ee(s,[Li,"l"]),i=ee(e,[Li,"l"]),r=Math.abs(Math.pow(t,ui)-Math.pow(i,ui)),n=Math.pow(r,1/ui)*Math.SQRT2-40;return n<7.5?0:n}var Lt=Object.freeze({__proto__:null,contrastAPCA:hl,contrastDeltaPhi:bl,contrastLstar:gl,contrastMichelson:ul,contrastWCAG21:tl,contrastWeber:fl});function yl(s,e,t={}){yt(t)&&(t={algorithm:t});let{algorithm:i,...r}=t;if(!i){let n=Object.keys(Lt).map(o=>o.replace(/^contrast/,"")).join(", ");throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${n}`)}s=S(s),e=S(e);for(let n in Lt)if("contrast"+i.toLowerCase()===n.toLowerCase())return Lt[n](s,e,r);throw new TypeError(`Unknown contrast algorithm: ${i}`)}function Zt(s){let[e,t,i]=vt(s,U),r=e+15*t+3*i;return[4*e/r,9*t/r]}function un(s){let[e,t,i]=vt(s,U),r=e+t+i;return[e/r,t/r]}function vl(s){Object.defineProperty(s.prototype,"uv",{get(){return Zt(this)}}),Object.defineProperty(s.prototype,"xy",{get(){return un(this)}})}var wl=Object.freeze({__proto__:null,register:vl,uv:Zt,xy:un});function at(s,e,t={}){yt(t)&&(t={method:t});let{method:i=se.deltaE,...r}=t;for(let n in tt)if("deltae"+i.toLowerCase()===n.toLowerCase())return tt[n](s,e,r);throw new TypeError(`Unknown deltaE method: ${i}`)}function _l(s,e=.25){let i=[E.get("oklch","lch"),"l"];return ze(s,i,r=>r*(1+e))}function xl(s,e=.25){let i=[E.get("oklch","lch"),"l"];return ze(s,i,r=>r*(1-e))}var El=Object.freeze({__proto__:null,darken:xl,lighten:_l});function mn(s,e,t=.5,i={}){return[s,e]=[S(s),S(e)],ke(t)==="object"&&([t,i]=[.5,t]),wt(s,e,i)(t)}function fn(s,e,t={}){let i;ji(s)&&([i,t]=[s,e],[s,e]=i.rangeArgs.colors);let{maxDeltaE:r,deltaEMethod:n,steps:o=2,maxSteps:a=1e3,...l}=t;i||([s,e]=[S(s),S(e)],i=wt(s,e,l));let d=at(s,e),c=r>0?Math.max(o,Math.ceil(d/r)+1):o,h=[];if(a!==void 0&&(c=Math.min(c,a)),c===1)h=[{p:.5,color:i(.5)}];else{let u=1/(c-1);h=Array.from({length:c},(g,m)=>{let b=m*u;return{p:b,color:i(b)}})}if(r>0){let u=h.reduce((g,m,b)=>{if(b===0)return 0;let y=at(m.color,h[b-1].color,n);return Math.max(g,y)},0);for(;u>r;){u=0;for(let g=1;g<h.length&&h.length<a;g++){let m=h[g-1],b=h[g],y=(b.p+m.p)/2,w=i(y);u=Math.max(u,at(w,m.color),at(w,b.color)),h.splice(g,0,{p:y,color:i(y)}),g++}}}return h=h.map(u=>u.color),h}function wt(s,e,t={}){if(ji(s)){let[l,d]=[s,e];return wt(...l.rangeArgs.colors,{...l.rangeArgs.options,...d})}let{space:i,outputSpace:r,progression:n,premultiplied:o}=t;s=S(s),e=S(e),s=et(s),e=et(e);let a={colors:[s,e],options:t};if(i?i=E.get(i):i=E.registry[se.interpolationSpace]||s.space,r=r?E.get(r):i,s=D(s,i),e=D(e,i),s=De(s),e=De(e),i.coords.h&&i.coords.h.type==="angle"){let l=t.hue=t.hue||"shorter",d=[i,"h"],[c,h]=[ee(s,d),ee(e,d)];isNaN(c)&&!isNaN(h)?c=h:isNaN(h)&&!isNaN(c)&&(h=c),[c,h]=ia(l,[c,h]),ze(s,d,c),ze(e,d,h)}return o&&(s.coords=s.coords.map(l=>l*s.alpha),e.coords=e.coords.map(l=>l*e.alpha)),Object.assign(l=>{l=n?n(l):l;let d=s.coords.map((u,g)=>{let m=e.coords[g];return ut(u,m,l)}),c=ut(s.alpha,e.alpha,l),h={space:i,coords:d,alpha:c};return o&&(h.coords=h.coords.map(u=>u/c)),r!==i&&(h=D(h,r)),h},{rangeArgs:a})}function ji(s){return ke(s)==="function"&&!!s.rangeArgs}se.interpolationSpace="lab";function zl(s){s.defineFunction("mix",mn,{returns:"color"}),s.defineFunction("range",wt,{returns:"function<color>"}),s.defineFunction("steps",fn,{returns:"array<color>"})}var Ml=Object.freeze({__proto__:null,isRange:ji,mix:mn,range:wt,register:zl,steps:fn}),gn=new E({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:it,fromBase:s=>{let e=Math.max(...s),t=Math.min(...s),[i,r,n]=s,[o,a,l]=[NaN,0,(t+e)/2],d=e-t;if(d!==0){switch(a=l===0||l===1?0:(e-l)/Math.min(l,1-l),e){case i:o=(r-n)/d+(r<n?6:0);break;case r:o=(n-i)/d+2;break;case n:o=(i-r)/d+4}o=o*60}return a<0&&(o+=180,a=Math.abs(a)),o>=360&&(o-=360),[o,a*100,l*100]},toBase:s=>{let[e,t,i]=s;e=e%360,e<0&&(e+=360),t/=100,i/=100;function r(n){let o=(n+e/30)%12,a=t*Math.min(i,1-i);return i-a*Math.max(-1,Math.min(o-3,9-o,1))}return[r(0),r(8),r(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),pn=new E({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:gn,fromBase(s){let[e,t,i]=s;t/=100,i/=100;let r=i+t*Math.min(i,1-i);return[e,r===0?0:200*(1-i/r),100*r]},toBase(s){let[e,t,i]=s;t/=100,i/=100;let r=i*(1-t/2);return[e,r===0||r===1?0:(i-r)/Math.min(r,1-r)*100,r*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),kl=new E({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:pn,fromBase(s){let[e,t,i]=s;return[e,i*(100-t)/100,100-i]},toBase(s){let[e,t,i]=s;t/=100,i/=100;let r=t+i;if(r>=1){let a=t/r;return[e,0,a*100]}let n=1-i,o=n===0?0:1-t/n;return[e,o*100,n*100]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const Rl=[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],Sl=[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]];var bn=new J({id:"a98rgb-linear",cssId:"--a98-rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:Rl,fromXYZ_M:Sl}),Al=new J({id:"a98rgb",cssId:"a98-rgb",name:"Adobe® 98 RGB compatible",base:bn,toBase:s=>s.map(e=>Math.pow(Math.abs(e),563/256)*Math.sign(e)),fromBase:s=>s.map(e=>Math.pow(Math.abs(e),256/563)*Math.sign(e))});const Cl=[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],Dl=[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]];var yn=new J({id:"prophoto-linear",cssId:"--prophoto-rgb-linear",name:"Linear ProPhoto",white:"D50",base:Fi,toXYZ_M:Cl,fromXYZ_M:Dl});const Ll=1/512,Il=16/512;var Tl=new J({id:"prophoto",cssId:"prophoto-rgb",name:"ProPhoto",base:yn,toBase(s){return s.map(e=>e<Il?e/16:e**1.8)},fromBase(s){return s.map(e=>e>=Ll?e**(1/1.8):16*e)}}),Nl=new E({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:Qe,fromBase(s){let[e,t,i]=s,r;const n=2e-4;return Math.abs(t)<n&&Math.abs(i)<n?r=NaN:r=Math.atan2(i,t)*180/Math.PI,[e,Math.sqrt(t**2+i**2),_e(r)]},toBase(s){let[e,t,i]=s,r,n;return isNaN(i)?(r=0,n=0):(r=t*Math.cos(i*Math.PI/180),n=t*Math.sin(i*Math.PI/180)),[e,r,n]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}});let vn=X.D65;const Hl=216/24389,Xs=24389/27,[Ks,Js]=Zt({space:U,coords:vn});var wn=new E({id:"luv",name:"Luv",coords:{l:{refRange:[0,100],name:"Lightness"},u:{refRange:[-215,215]},v:{refRange:[-215,215]}},white:vn,base:U,fromBase(s){let e=[T(s[0]),T(s[1]),T(s[2])],t=e[1],[i,r]=Zt({space:U,coords:e});if(!Number.isFinite(i)||!Number.isFinite(r))return[0,0,0];let n=t<=Hl?Xs*t:116*Math.cbrt(t)-16;return[n,13*n*(i-Ks),13*n*(r-Js)]},toBase(s){let[e,t,i]=s;if(e===0||Ae(e))return[0,0,0];t=T(t),i=T(i);let r=t/(13*e)+Ks,n=i/(13*e)+Js,o=e<=8?e/Xs:Math.pow((e+16)/116,3);return[o*(9*r/(4*n)),o,o*((12-3*r-20*n)/(4*n))]},formats:{color:{id:"--luv",coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),Vi=new E({id:"lchuv",name:"LChuv",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,220],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:wn,fromBase(s){let[e,t,i]=s,r;const n=.02;return Math.abs(t)<n&&Math.abs(i)<n?r=NaN:r=Math.atan2(i,t)*180/Math.PI,[e,Math.sqrt(t**2+i**2),_e(r)]},toBase(s){let[e,t,i]=s;return t<0&&(t=0),isNaN(i)&&(i=0),[e,t*Math.cos(i*Math.PI/180),t*Math.sin(i*Math.PI/180)]},formats:{color:{id:"--lchuv",coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Ol=216/24389,Pl=24389/27,Zs=P[0][0],Qs=P[0][1],mi=P[0][2],er=P[1][0],tr=P[1][1],fi=P[1][2],ir=P[2][0],sr=P[2][1],gi=P[2][2];function Ue(s,e,t){const i=e/(Math.sin(t)-s*Math.cos(t));return i<0?1/0:i}function $t(s){const e=Math.pow(s+16,3)/1560896,t=e>Ol?e:s/Pl,i=t*(284517*Zs-94839*mi),r=t*(838422*mi+769860*Qs+731718*Zs),n=t*(632260*mi-126452*Qs),o=t*(284517*er-94839*fi),a=t*(838422*fi+769860*tr+731718*er),l=t*(632260*fi-126452*tr),d=t*(284517*ir-94839*gi),c=t*(838422*gi+769860*sr+731718*ir),h=t*(632260*gi-126452*sr);return{r0s:i/n,r0i:r*s/n,r1s:i/(n+126452),r1i:(r-769860)*s/(n+126452),g0s:o/l,g0i:a*s/l,g1s:o/(l+126452),g1i:(a-769860)*s/(l+126452),b0s:d/h,b0i:c*s/h,b1s:d/(h+126452),b1i:(c-769860)*s/(h+126452)}}function rr(s,e){const t=e/360*Math.PI*2,i=Ue(s.r0s,s.r0i,t),r=Ue(s.r1s,s.r1i,t),n=Ue(s.g0s,s.g0i,t),o=Ue(s.g1s,s.g1i,t),a=Ue(s.b0s,s.b0i,t),l=Ue(s.b1s,s.b1i,t);return Math.min(i,r,n,o,a,l)}var $l=new E({id:"hsluv",name:"HSLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Vi,gamutSpace:it,fromBase(s){let[e,t,i]=[T(s[0]),T(s[1]),T(s[2])],r;if(e>99.9999999)r=0,e=100;else if(e<1e-8)r=0,e=0;else{let n=$t(e),o=rr(n,i);r=t/o*100}return[i,r,e]},toBase(s){let[e,t,i]=[T(s[0]),T(s[1]),T(s[2])],r;if(i>99.9999999)i=100,r=0;else if(i<1e-8)i=0,r=0;else{let n=$t(i);r=rr(n,e)/100*t}return[i,r,e]},formats:{color:{id:"--hsluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});P[0][0];P[0][1];P[0][2];P[1][0];P[1][1];P[1][2];P[2][0];P[2][1];P[2][2];function qe(s,e){return Math.abs(e)/Math.sqrt(Math.pow(s,2)+1)}function nr(s){let e=qe(s.r0s,s.r0i),t=qe(s.r1s,s.r1i),i=qe(s.g0s,s.g0i),r=qe(s.g1s,s.g1i),n=qe(s.b0s,s.b0i),o=qe(s.b1s,s.b1i);return Math.min(e,t,i,r,n,o)}var Bl=new E({id:"hpluv",name:"HPLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Vi,gamutSpace:"self",fromBase(s){let[e,t,i]=[T(s[0]),T(s[1]),T(s[2])],r;if(e>99.9999999)r=0,e=100;else if(e<1e-8)r=0,e=0;else{let n=$t(e),o=nr(n);r=t/o*100}return[i,r,e]},toBase(s){let[e,t,i]=[T(s[0]),T(s[1]),T(s[2])],r;if(i>99.9999999)i=100,r=0;else if(i<1e-8)i=0,r=0;else{let n=$t(i);r=nr(n)/100*t}return[i,r,e]},formats:{color:{id:"--hpluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const or=203,ar=2610/2**14,Wl=2**14/2610,Gl=2523/2**5,lr=2**5/2523,dr=3424/2**12,cr=2413/2**7,hr=2392/2**7;var Fl=new J({id:"rec2100pq",cssId:"rec2100-pq",name:"REC.2100-PQ",base:Jt,toBase(s){return s.map(function(e){return(Math.max(e**lr-dr,0)/(cr-hr*e**lr))**Wl*1e4/or})},fromBase(s){return s.map(function(e){let t=Math.max(e*or/1e4,0),i=dr+cr*t**ar,r=1+hr*t**ar;return(i/r)**Gl})}});const ur=.17883277,mr=.28466892,fr=.55991073,pi=3.7743;var Ul=new J({id:"rec2100hlg",cssId:"rec2100-hlg",name:"REC.2100-HLG",referred:"scene",base:Jt,toBase(s){return s.map(function(e){return e<=.5?e**2/3*pi:(Math.exp((e-fr)/ur)+mr)/12*pi})},fromBase(s){return s.map(function(e){return e/=pi,e<=1/12?Math.sqrt(3*e):ur*Math.log(12*e-mr)+fr})}});const _n={};Ce.add("chromatic-adaptation-start",s=>{s.options.method&&(s.M=xn(s.W1,s.W2,s.options.method))});Ce.add("chromatic-adaptation-end",s=>{s.M||(s.M=xn(s.W1,s.W2,s.options.method))});function Qt({id:s,toCone_M:e,fromCone_M:t}){_n[s]=arguments[0]}function xn(s,e,t="Bradford"){let i=_n[t],[r,n,o]=L(i.toCone_M,s),[a,l,d]=L(i.toCone_M,e),c=[[a/r,0,0],[0,l/n,0],[0,0,d/o]],h=L(c,i.toCone_M);return L(i.fromCone_M,h)}Qt({id:"von Kries",toCone_M:[[.40024,.7076,-.08081],[-.2263,1.16532,.0457],[0,0,.91822]],fromCone_M:[[1.8599363874558397,-1.1293816185800916,.21989740959619328],[.3611914362417676,.6388124632850422,-6370596838649899e-21],[0,0,1.0890636230968613]]});Qt({id:"Bradford",toCone_M:[[.8951,.2664,-.1614],[-.7502,1.7135,.0367],[.0389,-.0685,1.0296]],fromCone_M:[[.9869929054667121,-.14705425642099013,.15996265166373122],[.4323052697233945,.5183602715367774,.049291228212855594],[-.00852866457517732,.04004282165408486,.96848669578755]]});Qt({id:"CAT02",toCone_M:[[.7328,.4296,-.1624],[-.7036,1.6975,.0061],[.003,.0136,.9834]],fromCone_M:[[1.0961238208355142,-.27886900021828726,.18274517938277307],[.4543690419753592,.4735331543074117,.07209780371722911],[-.009627608738429355,-.00569803121611342,1.0153256399545427]]});Qt({id:"CAT16",toCone_M:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],fromCone_M:[[1.862067855087233,-1.0112546305316845,.14918677544445172],[.3875265432361372,.6214474419314753,-.008973985167612521],[-.01584149884933386,-.03412293802851557,1.0499644368778496]]});Object.assign(X,{A:[1.0985,1,.35585],C:[.98074,1,1.18232],D55:[.95682,1,.92149],D75:[.94972,1,1.22638],E:[1,1,1],F2:[.99186,1,.67393],F7:[.95041,1,1.08747],F11:[1.00962,1,.6435]});X.ACES=[.32168/.33767,1,(1-.32168-.33767)/.33767];const ql=[[.6624541811085053,.13400420645643313,.1561876870049078],[.27222871678091454,.6740817658111484,.05368951740793705],[-.005574649490394108,.004060733528982826,1.0103391003129971]],jl=[[1.6410233796943257,-.32480329418479,-.23642469523761225],[-.6636628587229829,1.6153315916573379,.016756347685530137],[.011721894328375376,-.008284441996237409,.9883948585390215]];var En=new J({id:"acescg",cssId:"--acescg",name:"ACEScg",coords:{r:{range:[0,65504],name:"Red"},g:{range:[0,65504],name:"Green"},b:{range:[0,65504],name:"Blue"}},referred:"scene",white:X.ACES,toXYZ_M:ql,fromXYZ_M:jl});const Ct=2**-16,bi=-.35828683,Dt=(Math.log2(65504)+9.72)/17.52;var Vl=new J({id:"acescc",cssId:"--acescc",name:"ACEScc",coords:{r:{range:[bi,Dt],name:"Red"},g:{range:[bi,Dt],name:"Green"},b:{range:[bi,Dt],name:"Blue"}},referred:"scene",base:En,toBase(s){const e=-.3013698630136986;return s.map(function(t){return t<=e?(2**(t*17.52-9.72)-Ct)*2:t<Dt?2**(t*17.52-9.72):65504})},fromBase(s){return s.map(function(e){return e<=0?(Math.log2(Ct)+9.72)/17.52:e<Ct?(Math.log2(Ct+e*.5)+9.72)/17.52:(Math.log2(e)+9.72)/17.52})}}),gr=Object.freeze({__proto__:null,A98RGB:Al,A98RGB_Linear:bn,ACEScc:Vl,ACEScg:En,CAM16_JMh:Na,HCT:ft,HPLuv:Bl,HSL:gn,HSLuv:$l,HSV:pn,HWB:kl,ICTCP:Ai,JzCzHz:Si,Jzazbz:Kr,LCH:mt,LCHuv:Vi,Lab:te,Lab_D65:Li,Luv:wn,OKLCH:Nl,OKLab:Qe,P3:cn,P3_Linear:ln,ProPhoto:Tl,ProPhoto_Linear:yn,REC_2020:an,REC_2020_Linear:Jt,REC_2100_HLG:Ul,REC_2100_PQ:Fl,XYZ_ABS_D65:Ui,XYZ_D50:Fi,XYZ_D65:U,sRGB:it,sRGB_Linear:dn});class C{constructor(...e){let t;e.length===1&&(t=S(e[0]));let i,r,n;t?(i=t.space||t.spaceId,r=t.coords,n=t.alpha):[i,r,n]=e,Object.defineProperty(this,"space",{value:E.get(i),writable:!1,enumerable:!0,configurable:!0}),this.coords=r?r.slice():[0,0,0],this.alpha=n>1||n===void 0?1:n<0?0:n;for(let o=0;o<this.coords.length;o++)this.coords[o]==="NaN"&&(this.coords[o]=NaN);for(let o in this.space.coords)Object.defineProperty(this,o,{get:()=>this.get(o),set:a=>this.set(o,a)})}get spaceId(){return this.space.id}clone(){return new C(this.space,this.coords,this.alpha)}toJSON(){return{spaceId:this.spaceId,coords:this.coords,alpha:this.alpha}}display(...e){let t=Ja(this,...e);return t.color=new C(t.color),t}static get(e,...t){return e instanceof C?e:new C(e,...t)}static defineFunction(e,t,i=t){let{instance:r=!0,returns:n}=i,o=function(...a){let l=t(...a);if(n==="color")l=C.get(l);else if(n==="function<color>"){let d=l;l=function(...c){let h=d(...c);return C.get(h)},Object.assign(l,d)}else n==="array<color>"&&(l=l.map(d=>C.get(d)));return l};e in C||(C[e]=o),r&&(C.prototype[e]=function(...a){return o(this,...a)})}static defineFunctions(e){for(let t in e)C.defineFunction(t,e[t],e[t])}static extend(e){if(e.register)e.register(C);else for(let t in e)C.defineFunction(t,e[t])}}C.defineFunctions({get:ee,getAll:vt,set:ze,setAll:Gi,to:D,equals:Za,inGamut:Pe,toGamut:De,distance:Xr,toString:ct});Object.assign(C,{util:Ko,hooks:Ce,WHITES:X,Space:E,spaces:E.registry,parse:Vr,defaults:se});for(let s of Object.keys(gr))E.register(gr[s]);for(let s in E.registry)Ii(s,E.registry[s]);Ce.add("colorspace-init-end",s=>{var e;Ii(s.id,s),(e=s.aliases)==null||e.forEach(t=>{Ii(t,s)})});function Ii(s,e){let t=s.replace(/-/g,"_");Object.defineProperty(C.prototype,t,{get(){let i=this.getAll(s);return typeof Proxy>"u"?i:new Proxy(i,{has:(r,n)=>{try{return E.resolveCoord([e,n]),!0}catch{}return Reflect.has(r,n)},get:(r,n,o)=>{if(n&&typeof n!="symbol"&&!(n in r)){let{index:a}=E.resolveCoord([e,n]);if(a>=0)return r[a]}return Reflect.get(r,n,o)},set:(r,n,o,a)=>{if(n&&typeof n!="symbol"&&!(n in r)||n>=0){let{index:l}=E.resolveCoord([e,n]);if(l>=0)return r[l]=o,this.setAll(s,r),!0}return Reflect.set(r,n,o,a)}})},set(i){this.setAll(s,i)},configurable:!0,enumerable:!0})}C.extend(tt);C.extend({deltaE:at});Object.assign(C,{deltaEMethods:tt});C.extend(El);C.extend({contrast:yl});C.extend(wl);C.extend(el);C.extend(Ml);C.extend(Lt);function Yl(s,e,t,i,r){const n=(...o)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(s,o));return n.prototype=e.prototype,n}class p{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const n=i.getElementById(e);return n?[n]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){var t,i;return e.lazyLoad||((i=(t=e.grid)==null?void 0:t.opts)==null?void 0:i.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0:e.grid)&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return p.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const n=e.y>t.y?e.y:t.y,o=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return o<=n?0:(r-i)*(o-n)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,n)=>{const o=t*((r.y??1e4)-(n.y??1e4));return o===0?t*((r.x??1e4)-(n.x??1e4)):o})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&this.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],n=t[i];i[0]==="_"||r===n?delete e[i]:r&&typeof r=="object"&&n!==void 0&&(p.removeInternalAndSame(r,n),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;if(r.top<0||r.bottom>n){const o=r.bottom-n,a=r.top,l=this.getScrollElement(e);if(l!==null){const d=l.scrollTop;r.top<0&&i<0?e.offsetHeight>n?l.scrollTop+=i:l.scrollTop+=Math.abs(a)>Math.abs(i)?i:a:i>0&&(e.offsetHeight>n?l.scrollTop+=i:l.scrollTop+=o>i?i:o),t.top+=l.scrollTop-d}}}static updateScrollResize(e,t,i){const r=this.getScrollElement(t),n=r.clientHeight,o=r===this.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-o,l=a<i,d=a>n-i;l?r.scrollBy({behavior:"smooth",top:a-i}):d&&r.scrollBy({behavior:"smooth",top:i-(n-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=p.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(n=>n===r)&&(i[r]=p.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=p.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(n=>i[n]=e[n]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(n=>i[n]=e[n]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,n=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(n)}static getValuesFromTransformedElement(e){const t=document.createElement("div");p.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class xe{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let n=t;!this._loading&&this._useEntireRowArea(e,t)&&(n={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,n,r.skip));let o=!1;const a={nested:!0,pack:!1};let l=0;for(;i=i||this.collide(e,n,r.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let d;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const c={...t,y:i.y+i.h,...a};d=this._loading&&p.samePos(e,c)?!0:this.moveNode(e,c),(i.locked||this._loading)&&d?p.copyPos(t,e):!i.locked&&d&&r.pack&&(this._packNodes(),t.y=i.y+i.h,p.copyPos(e,t)),o=o||d}else d=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...a});if(!d)return o;i=void 0}return o}collide(e,t=e,i){const r=e._id,n=i==null?void 0:i._id;return this.nodes.find(o=>o._id!==r&&o._id!==n&&p.isIntercepted(o,t))}collideAll(e,t=e,i){const r=e._id,n=i==null?void 0:i._id;return this.nodes.filter(o=>o._id!==r&&o._id!==n&&p.isIntercepted(o,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,n={...t.rect};n.y>r.y?(n.h+=n.y-r.y,n.y=r.y):n.h+=r.y-n.y,n.x>r.x?(n.w+=n.x-r.x,n.x=r.x):n.w+=r.x-n.x;let o,a=.5;for(let l of i){if(l.locked||!l._rect)break;const d=l._rect;let c=Number.MAX_VALUE,h=Number.MAX_VALUE;r.y<d.y?c=(n.y+n.h-d.y)/d.h:r.y+r.h>d.y+d.h&&(c=(d.y+d.h-n.y)/d.h),r.x<d.x?h=(n.x+n.w-d.x)/d.w:r.x+r.w>d.x+d.w&&(h=(d.x+d.w-n.x)/d.w);const u=Math.min(h,c);u>a&&(a=u,o=l)}return t.collide=o,o}cacheRects(e,t,i,r,n,o){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+o,w:a.w*e-o-r,h:a.h*t-i-n}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const n=t.x,o=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=n,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=o):(e.x=n,e.y=o),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=p.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=p.isTouching(e,t)))){if(t.y<e.y){const n=e;e=t,t=n}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=p.isTouching(e,t)))){if(t.x<e.x){const n=e;e=t,t=n}return i()}return!1}}}isAreaEmpty(e,t,i,r){const n={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(n)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const n=this.nodes;return this.nodes=[],n.forEach((o,a,l)=>{let d;o.locked||(o.autoPosition=!0,e==="list"&&a&&(d=l[a-1])),this.addNode(o,!1,d)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=p.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??xe._idSeq++;const i=e.id;if(i){let n=1;for(;this.nodes.find(o=>o.id===e.id&&o!==e);)e.id=i+"_"+n++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return p.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,p.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||p.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id&&this.findCacheLayout(e,this.defaultColumn)===-1){const n={...e};n.autoPosition||n.x===void 0?(delete n.x,delete n.y):n.x=Math.min(this.defaultColumn-1,n.x),n.w=Math.min(this.defaultColumn,n.w||1),this.cacheOneLayout(n,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),p.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!p.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=p.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||p.samePos(e,e._orig)||(p.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const n=r?r.y*i+(r.x+r.w):0;let o=!1;for(let a=n;!o;++a){const l=a%i,d=Math.floor(a/i);if(l+e.w>i)continue;const c={x:l,y:d,w:e.w,h:e.h};t.find(h=>p.isIntercepted(c,h))||((e.x!==l||e.y!==d)&&(e._dirty=!0),e.x=l,e.y=d,delete e.autoPosition,o=!0)}return o}addNode(e,t=!1,i){const r=this.nodes.find(o=>o._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let n;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,n=!0),this.nodes.push(e),t&&this.addedNodes.push(e),n||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new xe({column:this.column,float:this.float,nodes:this.nodes.map(o=>o._id===e._id?(i={...o},i):{...o})});if(!i)return!1;const n=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!n&&!t.resizing&&t.collide){const o=t.collide.el.gridstackNode;if(this.swap(e,o))return this._notify(),!0}return n?(r.nodes.filter(o=>o._dirty).forEach(o=>{const a=this.nodes.find(l=>l._id===o._id);a&&(p.copyPos(a,o),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new xe({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=p.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){var d,c;if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,n=p.copyPos({},e,!0);if(p.copyPos(n,t),this.nodeBoundFix(n,r),p.copyPos(t,n),!t.forceCollide&&p.samePos(e,t))return!1;const o=p.copyPos({},e),a=this.collideAll(e,n,t.skip);let l=!0;if(a.length){const h=e._moving&&!t.nested;let u=h?this.directionCollideCoverage(e,t,a):a[0];if(h&&u&&((c=(d=e.grid)==null?void 0:d.opts)!=null&&c.subGridDynamic)&&!e.grid._isTemp){const g=p.areaIntercept(t.rect,u._rect),m=p.area(t.rect),b=p.area(u._rect);g/(m<b?m:b)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?l=!this._fixCollisions(e,n,u,t):(l=!1,i&&delete t.pack)}return l&&!p.samePos(e,n)&&(e._dirty=!0,p.copyPos(e,n)),t.pack&&this._packNodes()._notify(),!p.samePos(e,o)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){var o;const i=(o=this._layouts)==null?void 0:o.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,n=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=r==null?void 0:r.find(c=>c._id===a._id),d={...a,...l||{}};p.removeInternalForSave(d,!e),t&&t(a,d),n.push(d)}),n}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(n=>{if(!n._orig)return;const o=t.find(a=>a._id===n._id);o&&(o.y>=0&&n.y!==n._orig.y&&(o.y+=n.y-n._orig.y),n.x!==n._orig.x&&(o.x=Math.round(n.x*r)),n.w!==n._orig.w&&(o.w=Math.round(n.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){var a;if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let n=[],o=r?this.nodes:p.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],d=this._layouts.length-1;!l.length&&e!==d&&((a=this._layouts[d])!=null&&a.length)&&(e=d,this._layouts[d].forEach(c=>{const h=o.find(u=>u._id===c._id);h&&(!r&&!c.autoPosition&&(h.x=c.x??h.x,h.y=c.y??h.y),h.w=c.w??h.w,(c.x==null||c.y===void 0)&&(h.autoPosition=!0))})),l.forEach(c=>{const h=o.findIndex(u=>u._id===c._id);if(h!==-1){const u=o[h];if(r){u.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,n),c.autoPosition||(u.x=c.x??u.x,u.y=c.y??u.y,u.w=c.w??u.w,n.push(u)),o.splice(h,1)}})}if(r)this.compact(i,!1);else{if(o.length)if(typeof i=="function")i(t,e,n,o);else{const l=r||i==="none"?1:t/e,d=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";o.forEach(h=>{h.x=t===1?0:d?Math.round(h.x*l):Math.min(h.x,t-1),h.w=t===1||e===1?1:c?Math.round(h.w*l)||1:Math.min(h.w,t),n.push(h)}),o=[]}n=p.sort(n,-1),this._inColumnResize=!0,this.nodes=[],n.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((n,o)=>{if(n._id===void 0){const a=n.id?this.nodes.find(l=>l.id===n.id):void 0;n._id=(a==null?void 0:a._id)??xe._idSeq++}r[o]={x:n.x,y:n.y,w:n.w,_id:n._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??xe._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){var i,r;return((r=(i=this._layouts)==null?void 0:i[t])==null?void 0:r.findIndex(n=>n._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}xe._idSeq=0;const Q={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class k{}const le=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class pe{}function Bt(s,e){s.touches.length>1||(s.cancelable&&s.preventDefault(),p.simulateMouseEvent(s.changedTouches[0],e))}function zn(s,e){s.cancelable&&s.preventDefault(),p.simulateMouseEvent(s,e)}function Wt(s){pe.touchHandled||(pe.touchHandled=!0,Bt(s,"mousedown"))}function Gt(s){pe.touchHandled&&Bt(s,"mousemove")}function Ft(s){if(!pe.touchHandled)return;pe.pointerLeaveTimeout&&(window.clearTimeout(pe.pointerLeaveTimeout),delete pe.pointerLeaveTimeout);const e=!!k.dragElement;Bt(s,"mouseup"),e||Bt(s,"click"),pe.touchHandled=!1}function Ut(s){s.pointerType!=="mouse"&&s.target.releasePointerCapture(s.pointerId)}function pr(s){k.dragElement&&s.pointerType!=="mouse"&&zn(s,"mouseenter")}function br(s){k.dragElement&&s.pointerType!=="mouse"&&(pe.pointerLeaveTimeout=window.setTimeout(()=>{delete pe.pointerLeaveTimeout,zn(s,"mouseleave")},10))}class ei{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${ei.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),le&&(this.el.addEventListener("touchstart",Wt),this.el.addEventListener("pointerdown",Ut)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),le&&(this.el.removeEventListener("touchstart",Wt),this.el.removeEventListener("pointerdown",Ut)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),le&&(this.el.addEventListener("touchmove",Gt),this.el.addEventListener("touchend",Ft)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),le&&(this.el.removeEventListener("touchmove",Gt),this.el.removeEventListener("touchend",Ft)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}ei.prefix="ui-resizable-";class Yi{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class gt extends Yi{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),n={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=this.temporalRect||n;return{position:{left:(o.left-r.left)*this.rectScale.x,top:(o.top-r.top)*this.rectScale.y},size:{width:o.width*this.rectScale.x,height:o.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),k.overResizeElement===this&&delete k.overResizeElement),this}_mouseOver(e){k.overResizeElement||k.dragElement||(k.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){k.overResizeElement===this&&(delete k.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new ei(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=p.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=p.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=p.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=p.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=p.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=gt._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=p.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return gt._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=e.clientX-i.clientX,o=this.sizeToContent?0:e.clientY-i.clientY;let a,l;t.indexOf("e")>-1?r.width+=n:t.indexOf("w")>-1&&(r.width-=n,r.left+=n,a=!0),t.indexOf("s")>-1?r.height+=o:t.indexOf("n")>-1&&(r.height-=o,r.top+=o,l=!0);const d=this._constrainSize(r.width,r.height,a,l);return Math.round(r.width)!==Math.round(d.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-d.width),r.width=d.width),Math.round(r.height)!==Math.round(d.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-d.height),r.height=d.height),r}_constrainSize(e,t,i,r){const n=this.option,o=(i?n.maxWidthMoveLeft:n.maxWidth)||Number.MAX_SAFE_INTEGER,a=n.minWidth/this.rectScale.x||e,l=(r?n.maxHeightMoveUp:n.maxHeight)||Number.MAX_SAFE_INTEGER,d=n.minHeight/this.rectScale.y||t,c=Math.min(o,Math.max(a,e)),h=Math.min(l,Math.max(d,t));return{width:c,height:h}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}gt._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Xl='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class pt extends Yi{constructor(e,t={}){var n;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(n=t==null?void 0:t.handle)==null?void 0:n.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r!=null&&r.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),le&&(e.addEventListener("touchstart",Wt),e.addEventListener("pointerdown",Ut))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),le&&(t.removeEventListener("touchstart",Wt),t.removeEventListener("pointerdown",Ut))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!k.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Xl)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete k.dragElement,delete k.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),le&&(e.currentTarget.addEventListener("touchmove",Gt),e.currentTarget.addEventListener("touchend",Ft)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),k.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=p.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),k.pauseDrag){const r=Number.isInteger(k.pauseDrag)?k.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),r)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,k.dragElement=this;const r=(i=this.el.gridstackNode)==null?void 0:i.grid;r?k.dropElement=r.el.ddElement.ddDroppable:delete k.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=p.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const n=p.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(n,this.ui()),this.triggerEvent("dragstart",n),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),le&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Gt,!0),e.currentTarget.removeEventListener("touchend",Ft,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=k.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete k.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const r=p.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(r),this.triggerEvent("dragstop",r),k.dropElement&&k.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete k.dragElement,delete k.dropElement,delete k.mouseHandled,e.preventDefault()}_keyEvent(e){var r,n;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((n=(r=k.dropElement)==null?void 0:r.el)==null?void 0:n.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!p.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",p.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=p.cloneNode(this.el)),e.parentElement||p.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=pt.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,r=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",pt.originStyleProp.forEach(n=>i.style[n]=this.dragElementOriginStyle[n]||null),setTimeout(()=>i.style.transition=r,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,n=0;i&&(r=this.dragTransform.xOffset,n=this.dragTransform.yOffset);const o=t.getBoundingClientRect();return{left:o.left,top:o.top,offsetLeft:-e.clientX+o.left-r,offsetTop:-e.clientY+o.top-n,width:o.width*this.dragTransform.xScale,height:o.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}pt.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Kl extends Yi{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),le&&(this.el.addEventListener("pointerenter",pr),this.el.addEventListener("pointerleave",br)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),le&&(this.el.removeEventListener("pointerenter",pr),this.el.removeEventListener("pointerleave",br)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!k.dragElement||!this._canDrop(k.dragElement.el))return;e.preventDefault(),e.stopPropagation(),k.dropElement&&k.dropElement!==this&&k.dropElement._mouseLeave(e,!0),k.dropElement=this;const t=p.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(k.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var r;if(!k.dragElement||k.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=p.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(k.dragElement)),this.triggerEvent("dropout",i),k.dropElement===this&&(delete k.dropElement,!t)){let n,o=this.el.parentElement;for(;!n&&o;)n=(r=o.ddElement)==null?void 0:r.ddDroppable,o=o.parentElement;n&&n._mouseEnter(e)}}drop(e){e.preventDefault();const t=p.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(k.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class Xi{static init(e){return e.ddElement||(e.ddElement=new Xi(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new pt(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new gt(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Kl(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Jl{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(n=>{if(t==="disable"||t==="enable")n.ddResizable&&n.ddResizable[t]();else if(t==="destroy")n.ddResizable&&n.cleanResizable();else if(t==="option")n.setupResizable({[i]:r});else{const a=n.el.gridstackNode.grid;let l=n.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const d=!a.opts.alwaysShowResizeHandle;n.setupResizable({...a.opts.resizable,handles:l,autoHide:d,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(n=>{if(t==="disable"||t==="enable")n.ddDraggable&&n.ddDraggable[t]();else if(t==="destroy")n.ddDraggable&&n.cleanDraggable();else if(t==="option")n.setupDraggable({[i]:r});else{const o=n.el.gridstackNode.grid;n.setupDraggable({...o.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=n=>t._accept(n)),this._getDDElements(e,t).forEach(n=>{t==="disable"||t==="enable"?n.ddDroppable&&n.ddDroppable[t]():t==="destroy"?n.ddDroppable&&n.cleanDroppable():t==="option"?n.setupDroppable({[i]:r}):n.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,n=>{i(n,k.dragElement?k.dragElement.el:n.target,k.dragElement?k.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=p.getElements(e);return r.length?r.map(o=>o.ddElement||(i?Xi.init(o):null)).filter(o=>o):[]}}/*!
235
235
  * GridStack 12.2.1
236
236
  * https://gridstackjs.com/
237
237
  *
238
238
  * Copyright (c) 2021-2024 Alain Dumesny
239
239
  * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
240
- */const Y=new Kl;class z{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=z.getGridElement(t);return i?(i.gridstack||(i.gridstack=new z(i,p.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
240
+ */const Y=new Jl;class z{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=z.getGridElement(t);return i?(i.gridstack||(i.gridstack=new z(i,p.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
241
241
  Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){const i=[];return typeof document>"u"||(z.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new z(r,p.cloneDeep(e))),i.push(r.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
242
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const o=i.gridstack;return t&&(o.opts={...o.opts,...t}),t.children!==void 0&&o.load(t.children),o}return(!e.classList.contains("grid-stack")||z.addRemoveCB)&&(z.addRemoveCB?i=z.addRemoveCB(e,t,!0,!0):i=p.createDiv(["grid-stack",t.class],e)),z.init(t,i)}static registerEngine(e){z.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=p.createDiv([this.opts.placeholderClass,Q.itemClass,this.opts.itemClass]);const e=p.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){var c;this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=p.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);const r=t.columnOpts;if(r){const d=r.breakpoints;!r.columnWidth&&!(d!=null&&d.length)?delete t.columnOpts:(r.columnMax=r.columnMax||12,(d==null?void 0:d.length)>1&&d.sort((h,u)=>(u.w||0)-(h.w||0)))}const n={...p.cloneDeep(Q),column:p.toNumber(e.getAttribute("gs-column"))||Q.column,minRow:i||p.toNumber(e.getAttribute("gs-min-row"))||Q.minRow,maxRow:i||p.toNumber(e.getAttribute("gs-max-row"))||Q.maxRow,staticGrid:p.toBool(e.getAttribute("gs-static"))||Q.staticGrid,sizeToContent:p.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||Q.draggable.handle},removableOptions:{accept:t.itemClass||Q.removableOptions.accept,decline:Q.removableOptions.decline}};e.getAttribute("gs-animate")&&(n.animate=p.toBool(e.getAttribute("gs-animate"))),t=p.defaults(t,n),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const o=this.el.closest("."+Q.itemClass),a=o==null?void 0:o.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else{typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==Q.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);const d=t.cellHeight;delete t.cellHeight,this.cellHeight(d)}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=le),this._setStaticClass();const l=t.engineClass||z.engineClass||xe;if(this.engine=new l({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:d=>{d.forEach(h=>{const u=h.el;u&&(h._removeDOM?(u&&u.remove(),delete h._removeDOM):this._writePosAttr(u,h))}),this._updateContainerHeight()}}),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(d=>this._prepareElement(d)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const d=t.children;delete t.children,d.length&&this.load(d)}this.setAnimation(),t.subGridDynamic&&!k.pauseDrag&&(k.pauseDrag=!0),((c=t.draggable)==null?void 0:c.pause)!==void 0&&(k.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i!=null&&i.el?t=i.el:z.addRemoveCB?t=z.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(n=>n._id===i._id))return t;const r=this._readAttr(t);return p.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=p.createDiv(["grid-stack-item",this.opts.itemClass]),i=p.createDiv(["grid-stack-item-content"],t);return p.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{var n,o;r.isIntersecting&&((n=e.visibleObservable)==null||n.disconnect(),delete e.visibleObservable,z.renderCB(i,e),(o=e.grid)==null||o.prepareDragDrop(e.el))}),window.setTimeout(()=>{var r;return(r=e.visibleObservable)==null?void 0:r.observe(t)})):z.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){var g,m,b;let n=e.gridstackNode;if(n||(n=this.makeWidget(e).gridstackNode),(g=n.subGrid)!=null&&g.el)return n.subGrid;let o,a=this;for(;a&&!o;)o=(m=a.opts)==null?void 0:m.subGridOpts,a=(b=a.parentGridNode)==null?void 0:b.grid;t=p.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...o||{},...t||n.subGridOpts||{}}),n.subGridOpts=t;let l;t.column==="auto"&&(l=!0,t.column=Math.max(n.w||1,(i==null?void 0:i.w)||1),delete t.columnOpts);let c=n.el.querySelector(".grid-stack-item-content"),d,h;if(r&&(this._removeDD(n.el),h={...n,x:0,y:0},p.removeInternalForSave(h),delete h.subGridOpts,n.content&&(h.content=n.content,delete n.content),z.addRemoveCB?d=z.addRemoveCB(this.el,h,!0,!1):(d=p.createDiv(["grid-stack-item"]),d.appendChild(c),c=p.createDiv(["grid-stack-item-content"],n.el)),this.prepareDragDrop(n.el)),i){const y=l?t.column:n.w,w=n.h+i.h,_=n.el.style;_.transition="none",this.update(n.el,{w:y,h:w}),setTimeout(()=>_.transition=null)}const u=n.subGrid=z.addGrid(c,t);return i!=null&&i._moving&&(u._isTemp=!0),l&&(u._autoColumn=!0),r&&u.makeWidget(d,h),i&&(i._moving?window.setTimeout(()=>p.simulateMouseEvent(i._event,"mouseenter",u.el),0):u.makeWidget(n.el,n)),this.resizeToContentCheck(!1,n),u}removeAsSubGrid(e){var i;const t=(i=this.parentGridNode)==null?void 0:i.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(r=>{r.x+=this.parentGridNode.x,r.y+=this.parentGridNode.y,t.makeWidget(r.el,r)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>p.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=z.saveCB){const r=this.engine.save(e,i);if(r.forEach(n=>{var o;if(e&&n.el&&!n.subGrid&&!i){const a=n.el.querySelector(".grid-stack-item-content");n.content=a==null?void 0:a.innerHTML,n.content||delete n.content}else if(!e&&!i&&delete n.content,(o=n.subGrid)!=null&&o.el){const a=n.subGrid.save(e,t,i);n.subGridOpts=t?a:{children:a},delete n.subGrid}delete n.el}),t){const n=p.cloneDeep(this.opts);n.marginBottom===n.marginTop&&n.marginRight===n.marginLeft&&n.marginTop===n.marginRight&&(n.margin=n.marginTop,delete n.marginTop,delete n.marginRight,delete n.marginBottom,delete n.marginLeft),n.rtl===(this.el.style.direction==="rtl")&&(n.rtl="auto"),this._isAutoCellHeight&&(n.cellHeight="auto"),this._autoColumn&&(n.column="auto");const o=n._alwaysShowResizeHandle;return delete n._alwaysShowResizeHandle,o!==void 0?n.alwaysShowResizeHandle=o:delete n.alwaysShowResizeHandle,p.removeInternalAndSame(n,Q),n.children=r,n}return r}load(e,t=z.addRemoveCB||!0){e=p.cloneDeep(e);const i=this.getColumn();e.forEach(d=>{d.w=d.w||1,d.h=d.h||1}),e=p.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(d=>{r=Math.max(r,(d.x||0)+d.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const n=z.addRemoveCB;typeof t=="function"&&(z.addRemoveCB=t);const o=[];this.batchUpdate();const a=!this.engine.nodes.length,l=a&&this.opts.animate;l&&this.setAnimation(!1),!a&&t&&[...this.engine.nodes].forEach(h=>{if(!h.id)return;p.find(e,h.id)||(z.addRemoveCB&&z.addRemoveCB(this.el,h,!1,!1),o.push(h),this.removeWidget(h.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(d=>p.find(e,d.id)?(c.push(d),!1):!0),e.forEach(d=>{var u;const h=p.find(c,d.id);if(h){if(p.shouldSizeToContent(h)&&(d.h=h.h),this.engine.nodeBoundFix(d),(d.autoPosition||d.x===void 0||d.y===void 0)&&(d.w=d.w||h.w,d.h=d.h||h.h,this.engine.findEmptyPosition(d)),this.engine.nodes.push(h),p.samePos(h,d)&&this.engine.nodes.length>1&&(this.moveNode(h,{...d,forceCollide:!0}),p.copyPos(d,h)),this.update(h.el,d),(u=d.subGridOpts)!=null&&u.children){const g=h.el.querySelector(".grid-stack");g&&g.gridstack&&g.gridstack.load(d.subGridOpts.children)}}else t&&this.addWidget(d)}),delete this.engine._loading,this.engine.removedNodes=o,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,n?z.addRemoveCB=n:delete z.addRemoveCB,l&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=p.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const i=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+i}const t=p.parseHeight(e);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){var t;return e&&((t=this.opts.columnOpts)!=null&&t.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var n,o;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((n=e.breakpoints)!=null&&n.length))return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let a=0;for(;a<e.breakpoints.length&&r<=e.breakpoints[a].w;)i=e.breakpoints[a++].c||t}if(i!==t){const a=(o=e.breakpoints)==null?void 0:o.find(l=>l.c===i);return this.column(i,(a==null?void 0:a.layout)||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this._updateColumnVar(),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){var t;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(t=this._placeholder)==null||delete t.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const n=e.left-r.left,o=e.top-r.top,a=i.width/this.getColumn(),l=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(n/a),y:Math.floor(o/l)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=z.getElement(e);if(!i||i.gridstackNode)return i;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let n;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(n=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),n&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(z.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let n=r.gridstackNode;n||(n=this.engine.nodes.find(o=>r===o.el)),n&&(t&&z.addRemoveCB&&z.addRemoveCB(this.el,n,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(n,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&z.addRemoveCB&&z.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){var i;const t=this.opts;return e===t?this:(e.acceptWidgets!==void 0&&(t.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?t.minRow=t.maxRow=t.row=e.row:(e.minRow!==void 0&&(t.minRow=e.minRow),e.maxRow!==void 0&&(t.maxRow=e.maxRow)),(i=e.children)!=null&&i.length&&this.load(e.children),this)}update(e,t){return z.getElements(e).forEach(i=>{var d;const r=i==null?void 0:i.gridstackNode;if(!r)return;const n={...p.copyPos({},r),...p.cloneDeep(t)};this.engine.nodeBoundFix(n),delete n.autoPosition;const o=["x","y","w","h"];let a;if(o.some(h=>n[h]!==void 0&&n[h]!==r[h])&&(a={},o.forEach(h=>{a[h]=n[h]!==void 0?n[h]:r[h],delete n[h]})),!a&&(n.minW||n.minH||n.maxW||n.maxH)&&(a={}),n.content!==void 0){const h=i.querySelector(".grid-stack-item-content");h&&h.textContent!==n.content&&(r.content=n.content,z.renderCB(h,n),(d=r.subGrid)!=null&&d.el&&(h.appendChild(r.subGrid.el),r.subGrid._updateContainerHeight())),delete n.content}let l=!1,c=!1;for(const h in n)h[0]!=="_"&&r[h]!==n[h]&&(r[h]=n[h],l=!0,c=c||!this.opts.staticGrid&&(h==="noResize"||h==="noMove"||h==="locked"));if(p.sanitizeMinMax(r),a){const h=a.w!==void 0&&a.w!==r.w;this.moveNode(r,a),h&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(h,r),delete r._orig}(a||l)&&this._writeAttr(i,r),c&&this.prepareDragDrop(r.el),z.updateCB&&z.updateCB(r)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){var u,g;if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let n=t.h?t.h*r:e.clientHeight,o;if(t.resizeToContentParent&&(o=e.querySelector(t.resizeToContentParent)),o||(o=e.querySelector(z.resizeToContentParent)),!o)return;const a=e.clientHeight-o.clientHeight,l=t.h?t.h*r-a:o.clientHeight;let c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const m=t.subGrid.el.getBoundingClientRect(),b=e.getBoundingClientRect();c+=m.top-b.top}else{if((g=(u=t.subGridOpts)==null?void 0:u.children)!=null&&g.length)return;{const m=o.firstElementChild;if(!m){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${z.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=m.getBoundingClientRect().height||l}}if(l===c)return;n+=c-l;let d=Math.ceil(n/r);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&d>h&&(d=h,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){z.resizeToContentCB?z.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return z.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!p.canBeRotated(r))return;const n={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const a=t.left>0?Math.floor(t.left/this.cellWidth()):0,l=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;n.x=r.x+a-(r.h-(l+1)),n.y=r.y+l-a}Object.keys(n).forEach(a=>{n[a]===void 0&&delete n[a]});const o=r._orig;this.update(i,n),r._orig=o}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=p.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const t=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",t)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const t=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",t)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;return r.el.dispatchEvent(i),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e){const n=p.parseHeight(getComputedStyle(this.el).minHeight);if(n.h>0&&n.unit===r){const o=Math.floor(n.h/i);t<o&&(t=o)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&p.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(Q.itemClass,this.opts.itemClass);const r=p.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),p.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return(!t._moving&&!t._resizing||this._placeholder===e)&&(e.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,e.style.left=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,e.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,e.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null),t.x>0?e.setAttribute("gs-x",String(t.x)):e.removeAttribute("gs-x"),t.y>0?e.setAttribute("gs-y",String(t.y)):e.removeAttribute("gs-y"),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=p.toNumber(e.getAttribute("gs-x")),i.y=p.toNumber(e.getAttribute("gs-y")),i.w=p.toNumber(e.getAttribute("gs-w")),i.h=p.toNumber(e.getAttribute("gs-h")),i.autoPosition=p.toBool(e.getAttribute("gs-auto-position")),i.noResize=p.toBool(e.getAttribute("gs-no-resize")),i.noMove=p.toBool(e.getAttribute("gs-no-move")),i.locked=p.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=p.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=p.toNumber(e.getAttribute("gs-max-w")),i.minW=p.toNumber(e.getAttribute("gs-min-w")),i.maxH=p.toNumber(e.getAttribute("gs-max-h")),i.minH=p.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const n in i){if(!i.hasOwnProperty(n))return;!i[n]&&i[n]!==0&&n!=="gs-size-to-content"&&delete i[n]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=(t=>(t=this.el)==null?void 0:t.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(r=>{r.subGrid&&r.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)p.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>p.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{p.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=p.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return p.getElement(e)}static getElements(e=".grid-stack-item"){return p.getElements(e)}static getGridElement(e){return z.getElement(e)}static getGridElements(e){return p.getElements(e)}_initMargin(){let e,t=0,i=[];typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=p.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(o=>{this.opts[o]===void 0?this.opts[o]=t:(e=p.parseHeight(this.opts[o]),this.opts[o]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const n=this.el.style;return n.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),n.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),n.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),n.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Y}static setupDragIn(e,t,i,r=document){(t==null?void 0:t.pause)!==void 0&&(k.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?p.getElements(e,r):e).forEach((o,a)=>{Y.isDraggable(o)||Y.dragIn(o,t),i!=null&&i[a]&&(o.gridstackNode=i[a])})}movable(e,t){return this.opts.staticGrid?this:(z.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(z.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){var t;const e=(t=this._placeholder)==null?void 0:t.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&z._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Y.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Y.droppable(this.el,"destroy"),this;let e,t;const i=(r,n,o)=>{var u;o=o||n;const a=o.gridstackNode;if(!a)return;if(!((u=a.grid)!=null&&u.el)){o.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const g=o.getBoundingClientRect();o.style.left=g.x+(this.dragTransform.xScale-1)*(r.clientX-g.x)/this.dragTransform.xScale+"px",o.style.top=g.y+(this.dragTransform.yScale-1)*(r.clientY-g.y)/this.dragTransform.yScale+"px",o.style.transformOrigin="0px 0px"}let{top:l,left:c}=o.getBoundingClientRect();const d=this.el.getBoundingClientRect();c-=d.left,l-=d.top;const h={position:{top:l*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(c/t)),a.y=Math.max(0,Math.round(l/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){Y.off(n,"drag");return}a._willFitPos&&(p.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(o,r,h,a,t,e)}else this._dragOrResize(o,r,h,a,t,e)};return Y.droppable(this.el,{accept:r=>{const n=r.gridstackNode||this._readAttr(r,!1);if((n==null?void 0:n.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let o=!0;if(typeof this.opts.acceptWidgets=="function")o=this.opts.acceptWidgets(r);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;o=r.matches(a)}if(o&&n&&this.opts.maxRow){const a={w:n.w,h:n.h,minW:n.minW,minH:n.minH};o=this.engine.willItFit(a)}return o}}).on(this.el,"dropover",(r,n,o)=>{let a=(o==null?void 0:o.gridstackNode)||n.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._temporaryRemoved)return!1;if(a!=null&&a._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a!=null&&a.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(n,o),o=o||n,t=this.cellWidth(),e=this.getCellHeight(!0),!a){const d=o.getAttribute("data-gs-widget")||o.getAttribute("gridstacknode");if(d){try{a=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}o.removeAttribute("data-gs-widget"),o.removeAttribute("gridstacknode")}a||(a=this._readAttr(o)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,o.gridstackNode=a);const l=a.w||Math.round(o.offsetWidth/t)||1,c=a.h||Math.round(o.offsetHeight/e)||1;return a.grid&&a.grid!==this?(n._gridstackNodeOrig||(n._gridstackNodeOrig=a),n.gridstackNode=a={...a,w:l,h:c,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=l,a.h=c,a._temporaryRemoved=!0),z._itemRemoving(a.el,!1),Y.on(n,"drag",i),i(r,n,o),!1}).on(this.el,"dropout",(r,n,o)=>{const a=(o==null?void 0:o.gridstackNode)||n.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(n,o),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(r,n,o)=>{var u,g,m;const a=(o==null?void 0:o.gridstackNode)||n.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._isExternal)return!1;const l=!!this.placeholder.parentElement,c=n!==o;this.placeholder.remove(),delete this.placeholder.gridstackNode,l&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const d=n._gridstackNodeOrig;if(delete n._gridstackNodeOrig,l&&(d!=null&&d.grid)&&d.grid!==this){const b=d.grid;b.engine.removeNodeFromLayoutCache(d),b.engine.removedNodes.push(d),b._triggerRemoveEvent()._triggerChangeEvent(),b.parentGridNode&&!b.engine.nodes.length&&b.opts.subGridDynamic&&b.removeAsSubGrid()}if(!a||(l&&(this.engine.cleanupNode(a),a.grid=this),(u=a.grid)==null||delete u._isTemp,Y.off(n,"drag"),o!==n?(o.remove(),n=o):n.remove(),this._removeDD(n),!l))return!1;const h=(m=(g=a.subGrid)==null?void 0:g.el)==null?void 0:m.gridstack;return p.copyPos(a,this._readAttr(this.placeholder)),p.removePositioningStyles(n),c&&(a.content||a.subGridOpts||z.addRemoveCB)?(delete a.el,n=this.addWidget(a)):(this._prepareElement(n,!0,a),this.el.appendChild(n),this.resizeToContentCheck(!1,a),h&&(h.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},d&&d.grid?d:void 0,a),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!(i!=null&&i.grid)||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Y.isDroppable(e)&&Y.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>z._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>z._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e==null?void 0:e.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,n=i.noResize||this.opts.disableResize,o=this.opts.staticGrid||r&&n;if((t||o)&&(i._initDD&&(this._removeDD(e),delete i._initDD),o&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let a,l;const c=(u,g)=>{this.triggerEvent(u,u.target),a=this.cellWidth(),l=this.getCellHeight(!0),this._onStartMoving(e,u,g,i,a,l)},d=(u,g)=>{this._dragOrResize(e,u,g,i,a,l)},h=u=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._resizing,delete i._event,delete i._lastTried;const g=i.w!==i._orig.w,m=u.target;if(!(!m.gridstackNode||m.gridstackNode.grid!==this)){if(i.el=m,i._isAboutToRemove){const b=e.gridstackNode.grid;b._gsEventHandler[u.type]&&b._gsEventHandler[u.type](u,m),b.engine.nodes.push(i),b.removeWidget(e,!0,!0)}else p.removePositioningStyles(m),i._temporaryRemoved?(p.copyPos(i,i._orig),this._writePosAttr(m,i),this.engine.addNode(i)):this._writePosAttr(m,i),this.triggerEvent(u,m);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),u.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(g,i))}};Y.draggable(e,{start:c,stop:h,drag:d}).resizable(e,{start:c,stop:h,resize:d}),i._initDD=!0}return Y.draggable(e,r?"disable":"enable").resizable(e,n?"disable":"enable"),this}_onStartMoving(e,t,i,r,n,o){var a;if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,(a=r.grid)!=null&&a.el)this.dragTransform=p.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=p.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",r._resizing=t.type==="resizestart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(n,o,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-r.x,c=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;Y.resizable(e,"option","minWidth",n*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",o*Math.min(r.minH||1,c)).resizable(e,"option","maxWidth",n*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",n*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",o*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,c)).resizable(e,"option","maxHeightMoveUp",o*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,n,o){const a={...r._orig};let l,c=this.opts.marginLeft,d=this.opts.marginRight,h=this.opts.marginTop,u=this.opts.marginBottom;const g=Math.round(o*.1),m=Math.round(n*.1);if(c=Math.min(c,m),d=Math.min(d,m),h=Math.min(h,g),u=Math.min(u,g),t.type==="drag"){if(r._temporaryRemoved)return;const y=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&p.updateScrollPosition(e,i.position,y);const w=i.position.left+(i.position.left>r._lastUiPosition.left?-d:c),_=i.position.top+(i.position.top>r._lastUiPosition.top?-u:h);a.x=Math.round(w/n),a.y=Math.round(_/o);const x=this._extraDragRow;if(this.engine.collide(r,a)){const R=this.getRow();let S=Math.max(0,a.y+r.h-R);this.opts.maxRow&&R+S>this.opts.maxRow&&(S=Math.max(0,this.opts.maxRow-R)),this._extraDragRow=S}else this._extraDragRow=0;if(this._extraDragRow!==x&&this._updateContainerHeight(),r.x===a.x&&r.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(p.updateScrollResize(t,e,o),a.w=Math.round((i.size.width-c)/n),a.h=Math.round((i.size.height-h)/o),r.w===a.w&&r.h===a.h)||r._lastTried&&r._lastTried.w===a.w&&r._lastTried.h===a.h)return;const y=i.position.left+c,w=i.position.top+h;a.x=Math.round(y/n),a.y=Math.round(w/o),l=!0}r._event=t,r._lastTried=a;const b={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:r.w*n)-c-d,h:(i.size?i.size.height:r.h*o)-h-u};if(this.engine.moveNodeCheck(r,{...a,cellWidth:n,cellHeight:o,rect:b,resizing:l})){r._lastUiPosition=i.position,this.engine.cacheRects(n,o,h,d,u,c),delete r._skipDown,l&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const y=t.target;r._sidebarOrig||this._writePosAttr(y,r),this.triggerEvent(t,y)}}triggerEvent(e,t){let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;i._gsEventHandler[e.type]&&i._gsEventHandler[e.type](e,t)}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,Y.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&z._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return Vl(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}z.renderCB=(s,e)=>{s&&(e!=null&&e.content)&&(s.textContent=e.content)};z.resizeToContentParent=".grid-stack-item-content";z.Utils=p;z.Engine=xe;z.GDRev="12.2.1";const Jl=`.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}`,U=[];for(let s=0;s<256;++s)U.push((s+256).toString(16).slice(1));function Zl(s,e=0){return(U[s[e+0]]+U[s[e+1]]+U[s[e+2]]+U[s[e+3]]+"-"+U[s[e+4]]+U[s[e+5]]+"-"+U[s[e+6]]+U[s[e+7]]+"-"+U[s[e+8]]+U[s[e+9]]+"-"+U[s[e+10]]+U[s[e+11]]+U[s[e+12]]+U[s[e+13]]+U[s[e+14]]+U[s[e+15]]).toLowerCase()}let bi;const Ql=new Uint8Array(16);function ed(){if(!bi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");bi=crypto.getRandomValues.bind(crypto)}return bi(Ql)}const td=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),br={randomUUID:td};function nt(s,e,t){var r;if(br.randomUUID&&!s)return br.randomUUID();s=s||{};const i=s.random??((r=s.rng)==null?void 0:r.call(s))??ed();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,Zl(i)}const id={icon:Me.R1,label:"Lock",tooltip:"Lock",action:"lock",type:"toggle"},sd={icon:Me.L2,label:"Edit",tooltip:"Edit",action:"edit",type:"toggle"},zn={icon:Me.V1,label:"Edit data",tooltip:"Data",action:"edit-data",type:"toggle"},Mn={icon:Me.M1,label:"Edit options",tooltip:"Options",action:"edit-options",type:"toggle"},yr={icon:Me.a3,label:"Edit filters",tooltip:"Filters",action:"edit-filters",type:"toggle"},kn={icon:Me.e1,label:"Clone",tooltip:"Clone",action:"clone",type:"button"},Rn={icon:Me.C1,label:"Delete",tooltip:"Delete",action:"delete",type:"button"},vr=s=>{if(!s)return;let e=[];return e=structuredClone(s).map(t=>{if(t.type==="group")return t.actions=t.actions??[],t.actions=t.actions.map(i=>{if(typeof i=="string"&&["lock","filters","edit","edit-data","edit-options","edit-filters","delete","clone"].includes(i))return{delete:{...Rn},filters:{...yr},clone:{...kn},edit:{...sd},"edit-data":{...zn},"edit-options":{...Mn},"edit-filters":{...yr},lock:{...id}}[i];if(typeof i=="object")return i.icon=i.icon??Me.i0,i.label=i.label??i.action,i.tooltip=i.tooltip??i.label??i.action,i.type=["toggle","button"].includes(i.type??"")?i.type:"button",i}).filter(Boolean),t}).filter(Boolean),e},Sn=()=>[{type:"group",actions:[{...zn},{...Mn},{...kn}]},{type:"group",actions:[{...Rn}]}],rd=":host{display:block;--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 );--grid-item-actions-flex-direction: column}.action-buttons{display:flex;gap:var(--luzmo-grid-item-action-group-gap, .5rem);flex-direction:var(--luzmo-grid-item-actions-flex-direction, var(--grid-item-actions-flex-direction));outline:none}.action-button[selected]{--luzmo-action-button-background-color-default: var(--luzmo-primary);--luzmo-action-button-background-color-hover: var(--luzmo-primary-hover);--luzmo-action-button-background-color-down: var(--luzmo-primary-down);--luzmo-action-button-background-color-focus: var(--luzmo-primary-focus);--luzmo-action-button-content-color-default: var( --luzmo-primary-inverse-color );--luzmo-action-button-content-color-hover: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-down: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-focus: var(--luzmo-primary-inverse-color)}:host .action-buttons{--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 )}.delete-button{--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-delete-button-background-color-hover, var(--luzmo-negative-color) );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-delete-button-content-color-hover, #fff );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-delete-button-background-color-focus, var(--luzmo-negative-color-focus) );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-delete-button-content-color-focus, #fff );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-delete-button-background-color-down, var(--luzmo-negative-color-down) );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-delete-button-content-color-down, #fff )}:host([placement=top-start]),:host([placement=top]),:host([placement=top-end]),:host([placement=bottom-start]),:host([placement=bottom]),:host([placement=bottom-end]){--grid-item-actions-flex-direction: row}";var nd=Object.defineProperty,od=Object.getOwnPropertyDescriptor,ti=(s,e,t,i)=>{for(var r=i>1?void 0:i?od(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&nd(e,t,r),r};exports.LuzmoGridItemActionsMenu=class extends Mr.It{constructor(){super(...arguments),this.placement="right-start",this.actions=Sn(),this.language="en"}static get styles(){return[f.r(rd)]}get isVertical(){return this.placement.includes("left")||this.placement.includes("right")}_dispatchAction(e){this.dispatchEvent(new CustomEvent("action",{bubbles:!0,composed:!0,detail:{action:e.action,type:e.type,active:e.active}}))}_handleActionClick(e){e.type==="toggle"&&(e.active=!e.active,this.actions.forEach(t=>{var i;(i=t.actions)==null||i.forEach(r=>{e!==r&&r.active&&(r.active=!1)})})),this._dispatchAction(e),this.requestUpdate()}clearActiveToggles(){this.actions=this.actions.map(e=>{var t;return{...e,actions:((t=e.actions)==null?void 0:t.map(i=>(i.type==="toggle"&&(i.active=!1),i)))??[]}})}focus(){var t,i;const e=(t=this.shadowRoot)==null?void 0:t.querySelectorAll("luzmo-action-button[toggles]");e&&((i=e[0])==null||i.focus())}_generateActionButton(e){var i,r,n,o;const t={Data:ge.msg("Data",{desc:"Grid item action tooltip"}),Options:ge.msg("Options",{desc:"Grid item action tooltip"}),Clone:ge.msg("Clone",{desc:"Grid item action tooltip"}),Delete:ge.msg("Delete",{desc:"Grid item action tooltip"}),Edit:ge.msg("Edit",{desc:"Grid item action tooltip"}),Lock:ge.msg("Lock",{desc:"Grid item action tooltip"}),Filters:ge.msg("Filters",{desc:"Grid item action tooltip"})};return f.x`
242
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const o=i.gridstack;return t&&(o.opts={...o.opts,...t}),t.children!==void 0&&o.load(t.children),o}return(!e.classList.contains("grid-stack")||z.addRemoveCB)&&(z.addRemoveCB?i=z.addRemoveCB(e,t,!0,!0):i=p.createDiv(["grid-stack",t.class],e)),z.init(t,i)}static registerEngine(e){z.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=p.createDiv([this.opts.placeholderClass,Q.itemClass,this.opts.itemClass]);const e=p.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){var d;this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=p.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);const r=t.columnOpts;if(r){const c=r.breakpoints;!r.columnWidth&&!(c!=null&&c.length)?delete t.columnOpts:(r.columnMax=r.columnMax||12,(c==null?void 0:c.length)>1&&c.sort((h,u)=>(u.w||0)-(h.w||0)))}const n={...p.cloneDeep(Q),column:p.toNumber(e.getAttribute("gs-column"))||Q.column,minRow:i||p.toNumber(e.getAttribute("gs-min-row"))||Q.minRow,maxRow:i||p.toNumber(e.getAttribute("gs-max-row"))||Q.maxRow,staticGrid:p.toBool(e.getAttribute("gs-static"))||Q.staticGrid,sizeToContent:p.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||Q.draggable.handle},removableOptions:{accept:t.itemClass||Q.removableOptions.accept,decline:Q.removableOptions.decline}};e.getAttribute("gs-animate")&&(n.animate=p.toBool(e.getAttribute("gs-animate"))),t=p.defaults(t,n),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const o=this.el.closest("."+Q.itemClass),a=o==null?void 0:o.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else{typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==Q.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);const c=t.cellHeight;delete t.cellHeight,this.cellHeight(c)}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=le),this._setStaticClass();const l=t.engineClass||z.engineClass||xe;if(this.engine=new l({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:c=>{c.forEach(h=>{const u=h.el;u&&(h._removeDOM?(u&&u.remove(),delete h._removeDOM):this._writePosAttr(u,h))}),this._updateContainerHeight()}}),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(c=>this._prepareElement(c)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const c=t.children;delete t.children,c.length&&this.load(c)}this.setAnimation(),t.subGridDynamic&&!k.pauseDrag&&(k.pauseDrag=!0),((d=t.draggable)==null?void 0:d.pause)!==void 0&&(k.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i!=null&&i.el?t=i.el:z.addRemoveCB?t=z.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(n=>n._id===i._id))return t;const r=this._readAttr(t);return p.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=p.createDiv(["grid-stack-item",this.opts.itemClass]),i=p.createDiv(["grid-stack-item-content"],t);return p.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{var n,o;r.isIntersecting&&((n=e.visibleObservable)==null||n.disconnect(),delete e.visibleObservable,z.renderCB(i,e),(o=e.grid)==null||o.prepareDragDrop(e.el))}),window.setTimeout(()=>{var r;return(r=e.visibleObservable)==null?void 0:r.observe(t)})):z.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){var g,m,b;let n=e.gridstackNode;if(n||(n=this.makeWidget(e).gridstackNode),(g=n.subGrid)!=null&&g.el)return n.subGrid;let o,a=this;for(;a&&!o;)o=(m=a.opts)==null?void 0:m.subGridOpts,a=(b=a.parentGridNode)==null?void 0:b.grid;t=p.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...o||{},...t||n.subGridOpts||{}}),n.subGridOpts=t;let l;t.column==="auto"&&(l=!0,t.column=Math.max(n.w||1,(i==null?void 0:i.w)||1),delete t.columnOpts);let d=n.el.querySelector(".grid-stack-item-content"),c,h;if(r&&(this._removeDD(n.el),h={...n,x:0,y:0},p.removeInternalForSave(h),delete h.subGridOpts,n.content&&(h.content=n.content,delete n.content),z.addRemoveCB?c=z.addRemoveCB(this.el,h,!0,!1):(c=p.createDiv(["grid-stack-item"]),c.appendChild(d),d=p.createDiv(["grid-stack-item-content"],n.el)),this.prepareDragDrop(n.el)),i){const y=l?t.column:n.w,w=n.h+i.h,_=n.el.style;_.transition="none",this.update(n.el,{w:y,h:w}),setTimeout(()=>_.transition=null)}const u=n.subGrid=z.addGrid(d,t);return i!=null&&i._moving&&(u._isTemp=!0),l&&(u._autoColumn=!0),r&&u.makeWidget(c,h),i&&(i._moving?window.setTimeout(()=>p.simulateMouseEvent(i._event,"mouseenter",u.el),0):u.makeWidget(n.el,n)),this.resizeToContentCheck(!1,n),u}removeAsSubGrid(e){var i;const t=(i=this.parentGridNode)==null?void 0:i.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(r=>{r.x+=this.parentGridNode.x,r.y+=this.parentGridNode.y,t.makeWidget(r.el,r)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>p.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=z.saveCB){const r=this.engine.save(e,i);if(r.forEach(n=>{var o;if(e&&n.el&&!n.subGrid&&!i){const a=n.el.querySelector(".grid-stack-item-content");n.content=a==null?void 0:a.innerHTML,n.content||delete n.content}else if(!e&&!i&&delete n.content,(o=n.subGrid)!=null&&o.el){const a=n.subGrid.save(e,t,i);n.subGridOpts=t?a:{children:a},delete n.subGrid}delete n.el}),t){const n=p.cloneDeep(this.opts);n.marginBottom===n.marginTop&&n.marginRight===n.marginLeft&&n.marginTop===n.marginRight&&(n.margin=n.marginTop,delete n.marginTop,delete n.marginRight,delete n.marginBottom,delete n.marginLeft),n.rtl===(this.el.style.direction==="rtl")&&(n.rtl="auto"),this._isAutoCellHeight&&(n.cellHeight="auto"),this._autoColumn&&(n.column="auto");const o=n._alwaysShowResizeHandle;return delete n._alwaysShowResizeHandle,o!==void 0?n.alwaysShowResizeHandle=o:delete n.alwaysShowResizeHandle,p.removeInternalAndSame(n,Q),n.children=r,n}return r}load(e,t=z.addRemoveCB||!0){e=p.cloneDeep(e);const i=this.getColumn();e.forEach(c=>{c.w=c.w||1,c.h=c.h||1}),e=p.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(c=>{r=Math.max(r,(c.x||0)+c.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const n=z.addRemoveCB;typeof t=="function"&&(z.addRemoveCB=t);const o=[];this.batchUpdate();const a=!this.engine.nodes.length,l=a&&this.opts.animate;l&&this.setAnimation(!1),!a&&t&&[...this.engine.nodes].forEach(h=>{if(!h.id)return;p.find(e,h.id)||(z.addRemoveCB&&z.addRemoveCB(this.el,h,!1,!1),o.push(h),this.removeWidget(h.el,!0,!1))}),this.engine._loading=!0;const d=[];return this.engine.nodes=this.engine.nodes.filter(c=>p.find(e,c.id)?(d.push(c),!1):!0),e.forEach(c=>{var u;const h=p.find(d,c.id);if(h){if(p.shouldSizeToContent(h)&&(c.h=h.h),this.engine.nodeBoundFix(c),(c.autoPosition||c.x===void 0||c.y===void 0)&&(c.w=c.w||h.w,c.h=c.h||h.h,this.engine.findEmptyPosition(c)),this.engine.nodes.push(h),p.samePos(h,c)&&this.engine.nodes.length>1&&(this.moveNode(h,{...c,forceCollide:!0}),p.copyPos(c,h)),this.update(h.el,c),(u=c.subGridOpts)!=null&&u.children){const g=h.el.querySelector(".grid-stack");g&&g.gridstack&&g.gridstack.load(c.subGridOpts.children)}}else t&&this.addWidget(c)}),delete this.engine._loading,this.engine.removedNodes=o,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,n?z.addRemoveCB=n:delete z.addRemoveCB,l&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=p.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const i=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+i}const t=p.parseHeight(e);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){var t;return e&&((t=this.opts.columnOpts)!=null&&t.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var n,o;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((n=e.breakpoints)!=null&&n.length))return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let a=0;for(;a<e.breakpoints.length&&r<=e.breakpoints[a].w;)i=e.breakpoints[a++].c||t}if(i!==t){const a=(o=e.breakpoints)==null?void 0:o.find(l=>l.c===i);return this.column(i,(a==null?void 0:a.layout)||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this._updateColumnVar(),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){var t;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(t=this._placeholder)==null||delete t.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const n=e.left-r.left,o=e.top-r.top,a=i.width/this.getColumn(),l=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(n/a),y:Math.floor(o/l)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=z.getElement(e);if(!i||i.gridstackNode)return i;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let n;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(n=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),n&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(z.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let n=r.gridstackNode;n||(n=this.engine.nodes.find(o=>r===o.el)),n&&(t&&z.addRemoveCB&&z.addRemoveCB(this.el,n,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(n,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&z.addRemoveCB&&z.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){var i;const t=this.opts;return e===t?this:(e.acceptWidgets!==void 0&&(t.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?t.minRow=t.maxRow=t.row=e.row:(e.minRow!==void 0&&(t.minRow=e.minRow),e.maxRow!==void 0&&(t.maxRow=e.maxRow)),(i=e.children)!=null&&i.length&&this.load(e.children),this)}update(e,t){return z.getElements(e).forEach(i=>{var c;const r=i==null?void 0:i.gridstackNode;if(!r)return;const n={...p.copyPos({},r),...p.cloneDeep(t)};this.engine.nodeBoundFix(n),delete n.autoPosition;const o=["x","y","w","h"];let a;if(o.some(h=>n[h]!==void 0&&n[h]!==r[h])&&(a={},o.forEach(h=>{a[h]=n[h]!==void 0?n[h]:r[h],delete n[h]})),!a&&(n.minW||n.minH||n.maxW||n.maxH)&&(a={}),n.content!==void 0){const h=i.querySelector(".grid-stack-item-content");h&&h.textContent!==n.content&&(r.content=n.content,z.renderCB(h,n),(c=r.subGrid)!=null&&c.el&&(h.appendChild(r.subGrid.el),r.subGrid._updateContainerHeight())),delete n.content}let l=!1,d=!1;for(const h in n)h[0]!=="_"&&r[h]!==n[h]&&(r[h]=n[h],l=!0,d=d||!this.opts.staticGrid&&(h==="noResize"||h==="noMove"||h==="locked"));if(p.sanitizeMinMax(r),a){const h=a.w!==void 0&&a.w!==r.w;this.moveNode(r,a),h&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(h,r),delete r._orig}(a||l)&&this._writeAttr(i,r),d&&this.prepareDragDrop(r.el),z.updateCB&&z.updateCB(r)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){var u,g;if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let n=t.h?t.h*r:e.clientHeight,o;if(t.resizeToContentParent&&(o=e.querySelector(t.resizeToContentParent)),o||(o=e.querySelector(z.resizeToContentParent)),!o)return;const a=e.clientHeight-o.clientHeight,l=t.h?t.h*r-a:o.clientHeight;let d;if(t.subGrid){d=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const m=t.subGrid.el.getBoundingClientRect(),b=e.getBoundingClientRect();d+=m.top-b.top}else{if((g=(u=t.subGridOpts)==null?void 0:u.children)!=null&&g.length)return;{const m=o.firstElementChild;if(!m){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${z.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}d=m.getBoundingClientRect().height||l}}if(l===d)return;n+=d-l;let c=Math.ceil(n/r);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&c>h&&(c=h,e.classList.add("size-to-content-max")),t.minH&&c<t.minH?c=t.minH:t.maxH&&c>t.maxH&&(c=t.maxH),c!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:c}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){z.resizeToContentCB?z.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return z.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!p.canBeRotated(r))return;const n={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const a=t.left>0?Math.floor(t.left/this.cellWidth()):0,l=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;n.x=r.x+a-(r.h-(l+1)),n.y=r.y+l-a}Object.keys(n).forEach(a=>{n[a]===void 0&&delete n[a]});const o=r._orig;this.update(i,n),r._orig=o}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=p.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const t=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",t)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const t=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",t)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;return r.el.dispatchEvent(i),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e){const n=p.parseHeight(getComputedStyle(this.el).minHeight);if(n.h>0&&n.unit===r){const o=Math.floor(n.h/i);t<o&&(t=o)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&p.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(Q.itemClass,this.opts.itemClass);const r=p.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),p.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return(!t._moving&&!t._resizing||this._placeholder===e)&&(e.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,e.style.left=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,e.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,e.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null),t.x>0?e.setAttribute("gs-x",String(t.x)):e.removeAttribute("gs-x"),t.y>0?e.setAttribute("gs-y",String(t.y)):e.removeAttribute("gs-y"),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=p.toNumber(e.getAttribute("gs-x")),i.y=p.toNumber(e.getAttribute("gs-y")),i.w=p.toNumber(e.getAttribute("gs-w")),i.h=p.toNumber(e.getAttribute("gs-h")),i.autoPosition=p.toBool(e.getAttribute("gs-auto-position")),i.noResize=p.toBool(e.getAttribute("gs-no-resize")),i.noMove=p.toBool(e.getAttribute("gs-no-move")),i.locked=p.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=p.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=p.toNumber(e.getAttribute("gs-max-w")),i.minW=p.toNumber(e.getAttribute("gs-min-w")),i.maxH=p.toNumber(e.getAttribute("gs-max-h")),i.minH=p.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const n in i){if(!i.hasOwnProperty(n))return;!i[n]&&i[n]!==0&&n!=="gs-size-to-content"&&delete i[n]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=(t=>(t=this.el)==null?void 0:t.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(r=>{r.subGrid&&r.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)p.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>p.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{p.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=p.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return p.getElement(e)}static getElements(e=".grid-stack-item"){return p.getElements(e)}static getGridElement(e){return z.getElement(e)}static getGridElements(e){return p.getElements(e)}_initMargin(){let e,t=0,i=[];typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=p.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(o=>{this.opts[o]===void 0?this.opts[o]=t:(e=p.parseHeight(this.opts[o]),this.opts[o]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const n=this.el.style;return n.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),n.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),n.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),n.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Y}static setupDragIn(e,t,i,r=document){(t==null?void 0:t.pause)!==void 0&&(k.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?p.getElements(e,r):e).forEach((o,a)=>{Y.isDraggable(o)||Y.dragIn(o,t),i!=null&&i[a]&&(o.gridstackNode=i[a])})}movable(e,t){return this.opts.staticGrid?this:(z.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(z.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){var t;const e=(t=this._placeholder)==null?void 0:t.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&z._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Y.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Y.droppable(this.el,"destroy"),this;let e,t;const i=(r,n,o)=>{var u;o=o||n;const a=o.gridstackNode;if(!a)return;if(!((u=a.grid)!=null&&u.el)){o.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const g=o.getBoundingClientRect();o.style.left=g.x+(this.dragTransform.xScale-1)*(r.clientX-g.x)/this.dragTransform.xScale+"px",o.style.top=g.y+(this.dragTransform.yScale-1)*(r.clientY-g.y)/this.dragTransform.yScale+"px",o.style.transformOrigin="0px 0px"}let{top:l,left:d}=o.getBoundingClientRect();const c=this.el.getBoundingClientRect();d-=c.left,l-=c.top;const h={position:{top:l*this.dragTransform.xScale,left:d*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(d/t)),a.y=Math.max(0,Math.round(l/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){Y.off(n,"drag");return}a._willFitPos&&(p.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(o,r,h,a,t,e)}else this._dragOrResize(o,r,h,a,t,e)};return Y.droppable(this.el,{accept:r=>{const n=r.gridstackNode||this._readAttr(r,!1);if((n==null?void 0:n.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let o=!0;if(typeof this.opts.acceptWidgets=="function")o=this.opts.acceptWidgets(r);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;o=r.matches(a)}if(o&&n&&this.opts.maxRow){const a={w:n.w,h:n.h,minW:n.minW,minH:n.minH};o=this.engine.willItFit(a)}return o}}).on(this.el,"dropover",(r,n,o)=>{let a=(o==null?void 0:o.gridstackNode)||n.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._temporaryRemoved)return!1;if(a!=null&&a._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a!=null&&a.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(n,o),o=o||n,t=this.cellWidth(),e=this.getCellHeight(!0),!a){const c=o.getAttribute("data-gs-widget")||o.getAttribute("gridstacknode");if(c){try{a=JSON.parse(c)}catch{console.error("Gridstack dropover: Bad JSON format: ",c)}o.removeAttribute("data-gs-widget"),o.removeAttribute("gridstacknode")}a||(a=this._readAttr(o)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,o.gridstackNode=a);const l=a.w||Math.round(o.offsetWidth/t)||1,d=a.h||Math.round(o.offsetHeight/e)||1;return a.grid&&a.grid!==this?(n._gridstackNodeOrig||(n._gridstackNodeOrig=a),n.gridstackNode=a={...a,w:l,h:d,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=l,a.h=d,a._temporaryRemoved=!0),z._itemRemoving(a.el,!1),Y.on(n,"drag",i),i(r,n,o),!1}).on(this.el,"dropout",(r,n,o)=>{const a=(o==null?void 0:o.gridstackNode)||n.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(n,o),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(r,n,o)=>{var u,g,m;const a=(o==null?void 0:o.gridstackNode)||n.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._isExternal)return!1;const l=!!this.placeholder.parentElement,d=n!==o;this.placeholder.remove(),delete this.placeholder.gridstackNode,l&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const c=n._gridstackNodeOrig;if(delete n._gridstackNodeOrig,l&&(c!=null&&c.grid)&&c.grid!==this){const b=c.grid;b.engine.removeNodeFromLayoutCache(c),b.engine.removedNodes.push(c),b._triggerRemoveEvent()._triggerChangeEvent(),b.parentGridNode&&!b.engine.nodes.length&&b.opts.subGridDynamic&&b.removeAsSubGrid()}if(!a||(l&&(this.engine.cleanupNode(a),a.grid=this),(u=a.grid)==null||delete u._isTemp,Y.off(n,"drag"),o!==n?(o.remove(),n=o):n.remove(),this._removeDD(n),!l))return!1;const h=(m=(g=a.subGrid)==null?void 0:g.el)==null?void 0:m.gridstack;return p.copyPos(a,this._readAttr(this.placeholder)),p.removePositioningStyles(n),d&&(a.content||a.subGridOpts||z.addRemoveCB)?(delete a.el,n=this.addWidget(a)):(this._prepareElement(n,!0,a),this.el.appendChild(n),this.resizeToContentCheck(!1,a),h&&(h.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},c&&c.grid?c:void 0,a),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!(i!=null&&i.grid)||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Y.isDroppable(e)&&Y.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>z._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>z._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e==null?void 0:e.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,n=i.noResize||this.opts.disableResize,o=this.opts.staticGrid||r&&n;if((t||o)&&(i._initDD&&(this._removeDD(e),delete i._initDD),o&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let a,l;const d=(u,g)=>{this.triggerEvent(u,u.target),a=this.cellWidth(),l=this.getCellHeight(!0),this._onStartMoving(e,u,g,i,a,l)},c=(u,g)=>{this._dragOrResize(e,u,g,i,a,l)},h=u=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._resizing,delete i._event,delete i._lastTried;const g=i.w!==i._orig.w,m=u.target;if(!(!m.gridstackNode||m.gridstackNode.grid!==this)){if(i.el=m,i._isAboutToRemove){const b=e.gridstackNode.grid;b._gsEventHandler[u.type]&&b._gsEventHandler[u.type](u,m),b.engine.nodes.push(i),b.removeWidget(e,!0,!0)}else p.removePositioningStyles(m),i._temporaryRemoved?(p.copyPos(i,i._orig),this._writePosAttr(m,i),this.engine.addNode(i)):this._writePosAttr(m,i),this.triggerEvent(u,m);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),u.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(g,i))}};Y.draggable(e,{start:d,stop:h,drag:c}).resizable(e,{start:d,stop:h,resize:c}),i._initDD=!0}return Y.draggable(e,r?"disable":"enable").resizable(e,n?"disable":"enable"),this}_onStartMoving(e,t,i,r,n,o){var a;if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,(a=r.grid)!=null&&a.el)this.dragTransform=p.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=p.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",r._resizing=t.type==="resizestart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(n,o,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-r.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;Y.resizable(e,"option","minWidth",n*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",o*Math.min(r.minH||1,d)).resizable(e,"option","maxWidth",n*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",n*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",o*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",o*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,n,o){const a={...r._orig};let l,d=this.opts.marginLeft,c=this.opts.marginRight,h=this.opts.marginTop,u=this.opts.marginBottom;const g=Math.round(o*.1),m=Math.round(n*.1);if(d=Math.min(d,m),c=Math.min(c,m),h=Math.min(h,g),u=Math.min(u,g),t.type==="drag"){if(r._temporaryRemoved)return;const y=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&p.updateScrollPosition(e,i.position,y);const w=i.position.left+(i.position.left>r._lastUiPosition.left?-c:d),_=i.position.top+(i.position.top>r._lastUiPosition.top?-u:h);a.x=Math.round(w/n),a.y=Math.round(_/o);const x=this._extraDragRow;if(this.engine.collide(r,a)){const R=this.getRow();let A=Math.max(0,a.y+r.h-R);this.opts.maxRow&&R+A>this.opts.maxRow&&(A=Math.max(0,this.opts.maxRow-R)),this._extraDragRow=A}else this._extraDragRow=0;if(this._extraDragRow!==x&&this._updateContainerHeight(),r.x===a.x&&r.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(p.updateScrollResize(t,e,o),a.w=Math.round((i.size.width-d)/n),a.h=Math.round((i.size.height-h)/o),r.w===a.w&&r.h===a.h)||r._lastTried&&r._lastTried.w===a.w&&r._lastTried.h===a.h)return;const y=i.position.left+d,w=i.position.top+h;a.x=Math.round(y/n),a.y=Math.round(w/o),l=!0}r._event=t,r._lastTried=a;const b={x:i.position.left+d,y:i.position.top+h,w:(i.size?i.size.width:r.w*n)-d-c,h:(i.size?i.size.height:r.h*o)-h-u};if(this.engine.moveNodeCheck(r,{...a,cellWidth:n,cellHeight:o,rect:b,resizing:l})){r._lastUiPosition=i.position,this.engine.cacheRects(n,o,h,c,u,d),delete r._skipDown,l&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const y=t.target;r._sidebarOrig||this._writePosAttr(y,r),this.triggerEvent(t,y)}}triggerEvent(e,t){let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;i._gsEventHandler[e.type]&&i._gsEventHandler[e.type](e,t)}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,Y.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&z._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return Yl(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}z.renderCB=(s,e)=>{s&&(e!=null&&e.content)&&(s.textContent=e.content)};z.resizeToContentParent=".grid-stack-item-content";z.Utils=p;z.Engine=xe;z.GDRev="12.2.1";const Zl=`.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}`,F=[];for(let s=0;s<256;++s)F.push((s+256).toString(16).slice(1));function Ql(s,e=0){return(F[s[e+0]]+F[s[e+1]]+F[s[e+2]]+F[s[e+3]]+"-"+F[s[e+4]]+F[s[e+5]]+"-"+F[s[e+6]]+F[s[e+7]]+"-"+F[s[e+8]]+F[s[e+9]]+"-"+F[s[e+10]]+F[s[e+11]]+F[s[e+12]]+F[s[e+13]]+F[s[e+14]]+F[s[e+15]]).toLowerCase()}let yi;const ed=new Uint8Array(16);function td(){if(!yi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");yi=crypto.getRandomValues.bind(crypto)}return yi(ed)}const id=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),yr={randomUUID:id};function nt(s,e,t){var r;if(yr.randomUUID&&!s)return yr.randomUUID();s=s||{};const i=s.random??((r=s.rng)==null?void 0:r.call(s))??td();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,Ql(i)}const sd={icon:Me.R1,label:"Lock",tooltip:"Lock",action:"lock",type:"toggle"},rd={icon:Me.L2,label:"Edit",tooltip:"Edit",action:"edit",type:"toggle"},Mn={icon:Me.V1,label:"Edit data",tooltip:"Data",action:"edit-data",type:"toggle"},kn={icon:Me.M1,label:"Edit options",tooltip:"Options",action:"edit-options",type:"toggle"},vr={icon:Me.a3,label:"Edit filters",tooltip:"Filters",action:"edit-filters",type:"toggle"},Rn={icon:Me.e1,label:"Clone",tooltip:"Clone",action:"clone",type:"button"},Sn={icon:Me.C1,label:"Delete",tooltip:"Delete",action:"delete",type:"button"},wr=s=>{if(!s)return;let e=[];return e=structuredClone(s).map(t=>{if(t.type==="group")return t.actions=t.actions??[],t.actions=t.actions.map(i=>{if(typeof i=="string"&&["lock","filters","edit","edit-data","edit-options","edit-filters","delete","clone"].includes(i))return{delete:{...Sn},filters:{...vr},clone:{...Rn},edit:{...rd},"edit-data":{...Mn},"edit-options":{...kn},"edit-filters":{...vr},lock:{...sd}}[i];if(typeof i=="object")return i.icon=i.icon??Me.i0,i.label=i.label??i.action,i.tooltip=i.tooltip??i.label??i.action,i.type=["toggle","button"].includes(i.type??"")?i.type:"button",i}).filter(Boolean),t}).filter(Boolean),e},An=()=>[{type:"group",actions:[{...Mn},{...kn},{...Rn}]},{type:"group",actions:[{...Sn}]}],nd=":host{display:block;--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 );--grid-item-actions-flex-direction: column}.action-buttons{display:flex;gap:var(--luzmo-grid-item-action-group-gap, .5rem);flex-direction:var(--luzmo-grid-item-actions-flex-direction, var(--grid-item-actions-flex-direction));outline:none}.action-button[selected]{--luzmo-action-button-background-color-default: var(--luzmo-primary);--luzmo-action-button-background-color-hover: var(--luzmo-primary-hover);--luzmo-action-button-background-color-down: var(--luzmo-primary-down);--luzmo-action-button-background-color-focus: var(--luzmo-primary-focus);--luzmo-action-button-content-color-default: var( --luzmo-primary-inverse-color );--luzmo-action-button-content-color-hover: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-down: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-focus: var(--luzmo-primary-inverse-color)}:host .action-buttons{--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 )}.delete-button{--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-delete-button-background-color-hover, var(--luzmo-negative-color) );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-delete-button-content-color-hover, #fff );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-delete-button-background-color-focus, var(--luzmo-negative-color-focus) );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-delete-button-content-color-focus, #fff );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-delete-button-background-color-down, var(--luzmo-negative-color-down) );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-delete-button-content-color-down, #fff )}:host([placement=top-start]),:host([placement=top]),:host([placement=top-end]),:host([placement=bottom-start]),:host([placement=bottom]),:host([placement=bottom-end]){--grid-item-actions-flex-direction: row}";var od=Object.defineProperty,ad=Object.getOwnPropertyDescriptor,ti=(s,e,t,i)=>{for(var r=i>1?void 0:i?ad(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&od(e,t,r),r};exports.LuzmoGridItemActionsMenu=class extends kr.It{constructor(){super(...arguments),this.placement="right-start",this.actions=An(),this.language="en"}static get styles(){return[f.r(nd)]}get isVertical(){return this.placement.includes("left")||this.placement.includes("right")}_dispatchAction(e){this.dispatchEvent(new CustomEvent("action",{bubbles:!0,composed:!0,detail:{action:e.action,type:e.type,active:e.active}}))}_handleActionClick(e){e.type==="toggle"&&(e.active=!e.active,this.actions.forEach(t=>{var i;(i=t.actions)==null||i.forEach(r=>{e!==r&&r.active&&(r.active=!1)})})),this._dispatchAction(e),this.requestUpdate()}clearActiveToggles(){this.actions=this.actions.map(e=>{var t;return{...e,actions:((t=e.actions)==null?void 0:t.map(i=>(i.type==="toggle"&&(i.active=!1),i)))??[]}})}focus(){var t,i;const e=(t=this.shadowRoot)==null?void 0:t.querySelectorAll("luzmo-action-button[toggles]");e&&((i=e[0])==null||i.focus())}_generateActionButton(e){var i,r,n,o;const t={Data:ge.msg("Data",{desc:"Grid item action tooltip"}),Options:ge.msg("Options",{desc:"Grid item action tooltip"}),Clone:ge.msg("Clone",{desc:"Grid item action tooltip"}),Delete:ge.msg("Delete",{desc:"Grid item action tooltip"}),Edit:ge.msg("Edit",{desc:"Grid item action tooltip"}),Lock:ge.msg("Lock",{desc:"Grid item action tooltip"}),Filters:ge.msg("Filters",{desc:"Grid item action tooltip"})};return f.x`
243
243
  <luzmo-action-button
244
244
  class="${e.action}-button action-button"
245
245
  .label=${e.label}
@@ -264,11 +264,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
264
264
  >
265
265
  `:f.x``}willUpdate(e){e.has("language")&&this.language!==ge.getLocale()&&([...ge.targetLocales].includes(this.language??"en")||this.language==="en")&&ge.setLocale(this.language)}render(){const e=this.actions.map(t=>this._generateActionGroup(t));return f.x`
266
266
  <div class="action-buttons" tabindex="0">${e}</div>
267
- `}};ti([f.n({type:String,reflect:!0})],exports.LuzmoGridItemActionsMenu.prototype,"placement",2);ti([f.n({type:Array})],exports.LuzmoGridItemActionsMenu.prototype,"actions",2);ti([f.n({type:String})],exports.LuzmoGridItemActionsMenu.prototype,"language",2);exports.LuzmoGridItemActionsMenu=ti([Hn.localized()],exports.LuzmoGridItemActionsMenu);const ad=':host{display:block;width:100%;height:100%}.grid-stack{width:100%;height:100%;position:relative;background:var(--luzmo-grid-background, var(--grid-background, white))}.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-stack-item-content,.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-item-actions-popover{opacity:.5}.grid-stack .grid-stack-item[active]>.ui-resizable-handle,.grid-stack .grid-stack-item[active].ui-resizable-autohide>.ui-resizable-handle{display:block}.grid-stack .grid-stack-item.ui-resizable-resizing,.grid-stack .grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{opacity:var(--luzmo-grid-item-resizing-opacity, 1)!important}.grid-item-drag-handle{position:absolute;top:var(--luzmo-grid-item-drag-handle-position-top, 0);left:var(--luzmo-grid-item-drag-handle-position-left, 0);right:var(--luzmo-grid-item-drag-handle-position-right, auto);bottom:var(--luzmo-grid-item-drag-handle-position-bottom, auto);padding:var(--luzmo-grid-item-drag-handle-padding, .5rem);z-index:var(--luzmo-grid-item-drag-handle-z-index, 3);cursor:var(--luzmo-grid-item-drag-handle-cursor, move)}.grid-stack .grid-stack-item-content{overflow:hidden;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));background:var(--luzmo-grid-item-background, var(--grid-item-background, white));box-shadow:var(--luzmo-grid-item-box-shadow, var(--grid-item-box-shadow, none));border-style:var(--luzmo-grid-item-border-style, var(--grid-item-border-style, solid));border-color:var(--luzmo-grid-item-border-color, var(--grid-item-border-color, #e0e0e0));-webkit-backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);border-width:var(--luzmo-grid-item-border-width, var(--grid-item-border-width, 1px));border-top-width:var(--luzmo-grid-item-border-top-width, var(--grid-item-border-top-width, 1px));border-right-width:var(--luzmo-grid-item-border-right-width, var(--grid-item-border-right-width, 1px));border-bottom-width:var(--luzmo-grid-item-border-bottom-width, var(--grid-item-border-bottom-width, 1px));border-left-width:var(--luzmo-grid-item-border-left-width, var(--grid-item-border-left-width, 1px))}.grid-stack .grid-stack-placeholder>.placeholder-content{border-radius:var(--grid-item-border-radius, 4px)}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{display:block!important;position:absolute!important;z-index:var(--luzmo-grid-resize-handle-z-index, 100);background:var(--luzmo-grid-resize-handle-background, var(--luzmo-background-color));border-radius:var(--luzmo-grid-resize-handle-border-radius, 3px);opacity:var(--luzmo-grid-resize-handle-opacity, 0);transition:var(--luzmo-grid-resize-handle-transition, opacity .2s ease);box-shadow:0 0 6px #0000001a,0 0 2px #000000bf}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{opacity:var(--luzmo-grid-resize-handle-opacity-hover, 1)}:host .grid-stack-item>.ui-resizable-handle:hover{opacity:var(--luzmo-grid-resize-handle-opacity-active, 1);background:var(--luzmo-grid-resize-handle-background-hover, var(--luzmo-background-color-highlight))}:host .grid-stack-item>.ui-resizable-n,:host .grid-stack-item>.ui-resizable-s{height:var(--luzmo-grid-resize-handle-edge-size, 8px);width:var(--luzmo-grid-resize-handle-side-size, 18px);left:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-n{cursor:n-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-top, 0px))}:host .grid-stack-item>.ui-resizable-s{cursor:s-resize;bottom:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-e,:host .grid-stack-item>.ui-resizable-w{width:var(--luzmo-grid-resize-handle-edge-size, 8px);height:var(--luzmo-grid-resize-handle-side-size, 18px);top:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-e{cursor:e-resize;right:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-w{cursor:w-resize;left:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-ne,:host .grid-stack-item>.ui-resizable-nw,:host .grid-stack-item>.ui-resizable-se,:host .grid-stack-item>.ui-resizable-sw{transform:none;background-image:none;width:var(--luzmo-grid-resize-handle-corner-size, 12px);height:var(--luzmo-grid-resize-handle-corner-size, 12px)}:host .grid-stack-item>.ui-resizable-ne{cursor:ne-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));right:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-nw{cursor:nw-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));left:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-se{cursor:se-resize;right:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-right, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-sw{cursor:sw-resize;left:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-left, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-resizing .ui-resizable-handle{opacity:1!important;background:var(--luzmo-grid-resize-handle-background-active, var(--luzmo-background-color-highlight))}.grid-item-actions-popover{position:absolute;outline:none;border:none;padding:0;margin:0;z-index:2;overflow:visible;background:transparent}luzmo-grid-item-actions-menu{padding:var(--luzmo-grid-item-actions-padding, var(--grid-item-actions-padding))}.dimensions-hint-popover{font-size:var(--luzmo-grid-item-dimensions-hint-font-size, var(--luzmo-font-size-xs, 10px));font-family:var(--luzmo-grid-item-dimensions-hint-font-family, var(--luzmo-font-family, inherit));position:absolute;outline:none;border-width:var(--luzmo-grid-item-dimensions-hint-border-width, var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-grid-item-dimensions-hint-border-color, var(--luzmo-border-color));border-radius:var(--luzmo-grid-item-dimensions-hint-border-radius, var(--luzmo-border-radius));padding:var(--luzmo-grid-item-dimensions-hint-padding, var(--luzmo-spacing-1) var(--luzmo-spacing-2));margin:0;z-index:3;overflow:visible;background:var(--luzmo-grid-item-dimensions-hint-background, var(--luzmo-background-color));color:var(--luzmo-grid-item-dimensions-hint-color, var(--luzmo-font-color));pointer-events:none}luzmo-grid-item-actions-menu{--grid-item-actions-padding: 0 .75rem}luzmo-grid-item-actions-menu[placement=top-start],luzmo-grid-item-actions-menu[placement=top],luzmo-grid-item-actions-menu[placement=top-end],luzmo-grid-item-actions-menu[placement=bottom-start],luzmo-grid-item-actions-menu[placement=bottom],luzmo-grid-item-actions-menu[placement=bottom-end]{--grid-item-actions-padding: .75rem 0}.grid-stack-item:focus-visible{outline:none}.grid-stack-item:focus-visible .grid-stack-item-content:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color, var(--luzmo-primary));box-sizing:border-box;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));z-index:2}';var ld=Object.defineProperty,F=(s,e,t,i)=>{for(var r=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=o(e,t,r)||r);return r&&ld(e,t,r),r};class H extends Mr.It{constructor(){super(...arguments),this.appServer="https://app.luzmo.com/",this.apiHost="https://api.luzmo.com",this.language="en",this.contentLanguage="en",this.columns=48,this.rowHeight=16,this.viewMode=!1,this.placementItemActionsMenu="right-start",this.defaultItemActionsMenu=[],this.theme={},this.items=[],this.renderers={},this._initialized=!1,this.defaultRenderer=(e,t)=>f.x`
267
+ `}};ti([f.n({type:String,reflect:!0})],exports.LuzmoGridItemActionsMenu.prototype,"placement",2);ti([f.n({type:Array})],exports.LuzmoGridItemActionsMenu.prototype,"actions",2);ti([f.n({type:String})],exports.LuzmoGridItemActionsMenu.prototype,"language",2);exports.LuzmoGridItemActionsMenu=ti([On.localized()],exports.LuzmoGridItemActionsMenu);const ld=':host{display:block;width:100%;height:100%}.grid-stack{width:100%;height:100%;position:relative;background:var(--luzmo-grid-background, var(--grid-background, var(--luzmo-background-color)))}.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-stack-item-content,.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-item-actions-popover{opacity:.5}.grid-stack .grid-stack-item[active]>.ui-resizable-handle,.grid-stack .grid-stack-item[active].ui-resizable-autohide>.ui-resizable-handle{display:block}.grid-stack .grid-stack-item.ui-resizable-resizing,.grid-stack .grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{opacity:var(--luzmo-grid-item-resizing-opacity, .8)!important}.grid-item-drag-handle{position:absolute;color:var(--luzmo-grid-item-drag-handle-color, #000);top:var(--luzmo-grid-item-drag-handle-position-top, 0);left:var(--luzmo-grid-item-drag-handle-position-left, 0);right:var(--luzmo-grid-item-drag-handle-position-right, auto);bottom:var(--luzmo-grid-item-drag-handle-position-bottom, auto);padding:var(--luzmo-grid-item-drag-handle-padding, .5rem);z-index:var(--luzmo-grid-item-drag-handle-z-index, 3);cursor:var(--luzmo-grid-item-drag-handle-cursor, move)}.grid-stack[dark-background] .grid-item-drag-handle{color:var(--luzmo-grid-item-drag-handle-color, #fff)}.grid-stack .grid-stack-item .grid-stack-item-content{overflow:hidden;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));background:var(--luzmo-grid-item-background, var(--grid-item-background, transparent));box-shadow:var(--luzmo-grid-item-box-shadow, var(--grid-item-box-shadow, none));border-style:var(--luzmo-grid-item-border-style, none);border-color:var(--luzmo-grid-item-border-color, transparent);-webkit-backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none)}.grid-stack .grid-stack-item:not(.has-luzmo-viz-item) .grid-stack-item-content{border-style:var(--luzmo-grid-item-border-style, var(--grid-item-border-style, none));border-color:var(--luzmo-grid-item-border-color, var(--grid-item-border-color, transparent));border-width:var(--luzmo-grid-item-border-width, var(--grid-item-border-width, 0));border-top-width:var(--luzmo-grid-item-border-top-width, var(--grid-item-border-top-width, 0));border-right-width:var(--luzmo-grid-item-border-right-width, var(--grid-item-border-right-width, 0));border-bottom-width:var(--luzmo-grid-item-border-bottom-width, var(--grid-item-border-bottom-width, 0));border-left-width:var(--luzmo-grid-item-border-left-width, var(--grid-item-border-left-width, 0))}.grid-stack .grid-stack-placeholder>.placeholder-content{border-radius:var(--grid-item-border-radius, 4px)}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{display:block!important;position:absolute!important;z-index:var(--luzmo-grid-resize-handle-z-index, 100);background:var(--luzmo-grid-resize-handle-background, #fff);border-radius:var(--luzmo-grid-resize-handle-border-radius, 3px);opacity:var(--luzmo-grid-resize-handle-opacity, 0);transition:var(--luzmo-grid-resize-handle-transition, opacity .2s ease);box-shadow:0 0 6px #0000001a,0 0 2px #000000bf}:host .grid-stack[dark-background]>.grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack[dark-background]>.grid-stack-item:hover>.ui-resizable-handle{background:var(--luzmo-grid-resize-handle-background, #333);box-shadow:0 0 6px #ffffff1a,0 0 2px #ffffffbf}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{opacity:var(--luzmo-grid-resize-handle-opacity-hover, 1)}:host .grid-stack-item>.ui-resizable-handle:hover{opacity:var(--luzmo-grid-resize-handle-opacity-active, 1);background:var(--luzmo-grid-resize-handle-background-hover, var(--luzmo-background-color-highlight))}:host .grid-stack-item>.ui-resizable-n,:host .grid-stack-item>.ui-resizable-s{height:var(--luzmo-grid-resize-handle-edge-size, 8px);width:var(--luzmo-grid-resize-handle-side-size, 18px);left:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-n{cursor:n-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-top, 0px))}:host .grid-stack-item>.ui-resizable-s{cursor:s-resize;bottom:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-e,:host .grid-stack-item>.ui-resizable-w{width:var(--luzmo-grid-resize-handle-edge-size, 8px);height:var(--luzmo-grid-resize-handle-side-size, 18px);top:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-e{cursor:e-resize;right:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-w{cursor:w-resize;left:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-ne,:host .grid-stack-item>.ui-resizable-nw,:host .grid-stack-item>.ui-resizable-se,:host .grid-stack-item>.ui-resizable-sw{transform:none;background-image:none;width:var(--luzmo-grid-resize-handle-corner-size, 12px);height:var(--luzmo-grid-resize-handle-corner-size, 12px)}:host .grid-stack-item>.ui-resizable-ne{cursor:ne-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));right:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-nw{cursor:nw-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));left:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-se{cursor:se-resize;right:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-right, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-sw{cursor:sw-resize;left:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-left, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-resizing .ui-resizable-handle{opacity:1!important;background:var(--luzmo-grid-resize-handle-background-active, var(--luzmo-background-color-highlight))}.grid-item-actions-popover{position:absolute;outline:none;border:none;padding:0;margin:0;z-index:2;overflow:visible;background:transparent}luzmo-grid-item-actions-menu{padding:var(--luzmo-grid-item-actions-padding, var(--grid-item-actions-padding))}.dimensions-hint-popover{font-size:var(--luzmo-grid-item-dimensions-hint-font-size, var(--luzmo-font-size-xs, 10px));font-family:var(--luzmo-grid-item-dimensions-hint-font-family, var(--luzmo-font-family, inherit));position:absolute;outline:none;border-width:var(--luzmo-grid-item-dimensions-hint-border-width, var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-grid-item-dimensions-hint-border-color, var(--luzmo-border-color));border-radius:var(--luzmo-grid-item-dimensions-hint-border-radius, var(--luzmo-border-radius));padding:var(--luzmo-grid-item-dimensions-hint-padding, var(--luzmo-spacing-1) var(--luzmo-spacing-2));margin:0;z-index:3;overflow:visible;background:var(--luzmo-grid-item-dimensions-hint-background, var(--luzmo-background-color));color:var(--luzmo-grid-item-dimensions-hint-color, var(--luzmo-font-color));pointer-events:none}luzmo-grid-item-actions-menu{--grid-item-actions-padding: 0 .75rem}luzmo-grid-item-actions-menu[placement=top-start],luzmo-grid-item-actions-menu[placement=top],luzmo-grid-item-actions-menu[placement=top-end],luzmo-grid-item-actions-menu[placement=bottom-start],luzmo-grid-item-actions-menu[placement=bottom],luzmo-grid-item-actions-menu[placement=bottom-end]{--grid-item-actions-padding: .75rem 0}.grid-stack-item:focus-visible{outline:none}.grid-stack-item:focus-visible .grid-stack-item-content:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color, var(--luzmo-primary));box-sizing:border-box;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));z-index:2}';var dd=Object.defineProperty,B=(s,e,t,i)=>{for(var r=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=o(e,t,r)||r);return r&&dd(e,t,r),r};class N extends kr.It{constructor(){super(...arguments),this.appServer="https://app.luzmo.com/",this.apiHost="https://api.luzmo.com",this.language="en",this.contentLanguage="en",this.columns=48,this.rowHeight=16,this.viewMode=!1,this.placementItemActionsMenu="right-start",this.defaultItemActionsMenu=[],this.theme={},this.items=[],this.renderers={},this._initialized=!1,this.defaultRenderer=(e,t)=>f.x`
268
268
  <div class="grid-item-content">
269
269
  <div class="grid-item-type">${e.type}</div>
270
270
  </div>
271
- `,this._handleMouseout=e=>{if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");if(!i)return;const r=e.relatedTarget;r!=null&&r.closest(".grid-item-actions-popover")||i.hasAttribute("active")||this._removeItemActionsMenuPopover(i)},this._handleKeyDown=e=>{if(!this.viewMode){if(e.key==="Delete"&&this._focusedItemElement)this._handleDeleteItem(new Event("delete"));else if(e.key==="Escape"&&this._focusedItemElement)this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus();else if(e.key==="Enter"&&this._focusedItemElement)e.preventDefault(),e.stopPropagation(),this._activeItemElement&&(this._activeItemElement.removeAttribute("active"),this._gridElement.removeAttribute("has-active-item"),this._removeItemActionsMenuPopover(this._activeItemElement),this._activeItemElement=void 0),this._gridElement.querySelectorAll(".grid-stack-item").forEach(t=>{t!==this._focusedItemElement&&this._removeItemActionsMenuPopover(t)}),this._createItemActionsMenuPopover(this._focusedItemElement),requestAnimationFrame(()=>{var i;const t=(i=this._focusedItemElement)==null?void 0:i.querySelector("luzmo-grid-item-actions-menu");t&&t.focus()});else if(this._focusedItemElement&&this._grid&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();const t=this._focusedItemElement.gridstackNode;if(!t)return;const i=this.columns??48,n={ArrowLeft:{move:{x:t.x-1},resize:{x:t.x-1,w:t.w+1},shrink:{w:t.w-1},canMove:t.x>0,canResize:t.x>0,canShrink:t.w>1},ArrowRight:{move:{x:t.x+1},resize:{w:t.w+1},shrink:{x:t.x+1,w:t.w-1},canMove:t.x<i-t.w,canResize:t.x+t.w<i,canShrink:t.w>1},ArrowUp:{move:{y:t.y-1},resize:{y:t.y-1,h:t.h+1},shrink:{h:t.h-1},canMove:t.y>0,canResize:t.y>0,canShrink:t.h>1},ArrowDown:{move:{y:t.y+1},resize:{h:t.h+1},shrink:{y:t.y+1,h:t.h-1},canMove:!0,canResize:!0,canShrink:t.h>1}}[e.key];let o=null;e.shiftKey&&n.canResize?o=n.resize:(e.ctrlKey||e.metaKey)&&n.canShrink?o=n.shrink:n.canMove&&(o=n.move),o&&this._grid.update(this._focusedItemElement,o)}}},this._handleFocus=e=>{const i=e.target.closest(".grid-stack-item");i&&(this._focusedItemElement&&this._focusedItemElement!==i&&(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement)),this._focusedItemElement=i,i.setAttribute("focused","true"))},this._handleBlur=e=>{if(!this._focusedItemElement)return;const t=e.relatedTarget;t!=null&&t.closest("luzmo-grid-item-actions-menu")||(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus())},this._handleDocumentClick=e=>{const t=e.composedPath(),i=this._gridElement.querySelector(".grid-stack-item[active]");if(!i||t.includes(i))return;const r=i.querySelector(".grid-item-actions-popover");r&&t.includes(r)||this._cleanupActiveItem(i)},this._handleAction=e=>{var n,o;const t=e.detail,i=(n=e.target)==null?void 0:n.closest(".grid-stack-item");if(!i)return;const r=i.getAttribute("gs-id");if(t.type==="toggle"&&t.action===this._activeItemActionToggle&&i===this._activeItemElement){this._activeItemElement=void 0,this._activeItemActionToggle=void 0,(o=this._gridElement)==null||o.removeAttribute("has-active-item"),i.removeAttribute("active"),this._cleanupActiveItem(i);return}if(!["delete","clone"].includes(t.action)){this._gridElement.querySelectorAll(".grid-stack-item").forEach(l=>{l!==i&&this._cleanupActiveItem(l)}),t.type==="toggle"&&(this._activeItemElement=i,this._activeItemActionToggle=t.action,this._gridElement.setAttribute("has-active-item","true"),i.setAttribute("active","true"));const a=this.items.find(l=>l.id===r);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,element:i,id:r,type:a==null?void 0:a.type,slots:a==null?void 0:a.slots,options:a==null?void 0:a.options,filters:a==null?void 0:a.filters},bubbles:!0,composed:!0,cancelable:!0}))}t.action==="delete"?(this._handleDeleteItem(e),this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,deletedId:r},bubbles:!0,composed:!0,cancelable:!0}))):t.action==="clone"&&this._handleCloneItem(e)},this._handleDeleteItem=e=>{var i;const t=((i=e.target)==null?void 0:i.closest(".grid-stack-item"))||this._focusedItemElement;t&&this.removeGridItemById(t.getAttribute("gs-id")||"")},this._handleCloneItem=e=>{const i=e.target.closest(".grid-stack-item");if(!i||!this._grid)return;const r=i.getAttribute("gs-id");if(!r)return;const n=this.items.find(l=>l.id===r);if(!n)return;const o={...structuredClone(n),id:nt()},a=this.addGridItem(o);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:"clone",items:this.items,originalElement:i,element:a,id:o.id,type:o.type,slots:o.slots,options:o.options,filters:o.filters},bubbles:!0,composed:!0}))}}static get styles(){return[f.r(Jl),f.r(ad)]}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this._initializeGrid(),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("keydown",this._handleKeyDown)})}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("keydown",this._handleKeyDown)}updated(e){var o,a,l,c,d,h,u,g;super.updated(e);const t=e.has("contentLanguage"),i=e.has("viewMode"),r=e.has("items"),n=e.has("theme");this._initialized&&this._grid&&r&&(this.items.forEach(m=>{m.id=m.id||nt()}),(o=this._grid)==null||o.setAnimation(!1),(a=this._grid)==null||a.batchUpdate(),(l=this._grid)==null||l.removeAll(!1),this.items.forEach(m=>{var y,w,_,x,R,S,O;const b=[...this._gridItemElements].find(P=>P.getAttribute("luzmo-grid-item-id")===m.id);b&&((R=this._grid)==null||R.makeWidget(b,{x:((y=m==null?void 0:m.position)==null?void 0:y.col)??0,y:((w=m==null?void 0:m.position)==null?void 0:w.row)??0,w:((_=m==null?void 0:m.position)==null?void 0:_.sizeX)??1,h:((x=m==null?void 0:m.position)==null?void 0:x.sizeY)??1,id:m.id}),(S=this._grid)==null||S.batchUpdate(!1),(O=this._grid)==null||O.setAnimation(!0))})),n&&(this._updateThemeProperties(),this._initialized&&this._grid&&((g=this._grid)==null||g.margin([(((d=(c=this.theme)==null?void 0:c.margins)==null?void 0:d[0])??16)/2,(((u=(h=this.theme)==null?void 0:h.margins)==null?void 0:u[1])??16)/2].join(" ")))),t&&this._updateLuzmoVizItemsLanguage(),this._initialized&&this._grid&&i&&this.viewMode!==e.get("viewMode")&&(this.viewMode?(this._grid.disable(),this._activeItemElement&&(this._cleanupActiveItem(this._activeItemElement),this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item"))):this._grid.enable())}_updateLuzmoVizItemsLanguage(){this._gridItemElements.forEach(e=>{const t=e.querySelector("luzmo-embed-viz-item");t&&(t.options={...t.options,locale:this.contentLanguage})})}_handleMouseover(e){if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");i&&this._createItemActionsMenuPopover(i)}_cleanupActiveItem(e){e.removeAttribute("active"),this._activeItemElement===e&&(this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item")),this._removeItemActionsMenuPopover(e)}_cleanup(){for(const e of this._gridItemElements)this._cleanupActiveItem(e);this._grid&&(this._grid.destroy(),this._grid=void 0),this._initialized=!1}_initializeGrid(){var t,i,r,n,o,a,l,c;if(this._initialized||!this._gridElement)return;const e={column:this.columns??48,cellHeight:this.rowHeight??16,marginTop:(((i=(t=this.theme)==null?void 0:t.margins)==null?void 0:i[0])??16)/2,marginLeft:(((n=(r=this.theme)==null?void 0:r.margins)==null?void 0:n[1])??16)/2,marginRight:(((a=(o=this.theme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2,marginBottom:(((c=(l=this.theme)==null?void 0:l.margins)==null?void 0:c[0])??16)/2,animate:!0,auto:!1,float:!1,removable:!1,acceptWidgets:!0,disableDrag:this.viewMode,disableResize:this.viewMode,resizable:{handles:["n","ne","e","se","s","sw","w","nw"].join(", ")},handle:".grid-item-drag-handle"};this._grid=z.init(e,this._gridElement),this._grid.batchUpdate(),this._gridItemElements.forEach(d=>{var m,b,y,w,_;const h=d.getAttribute("luzmo-grid-item-id"),u=this.items.find(x=>x.id===h),g={id:h,x:((m=u==null?void 0:u.position)==null?void 0:m.col)??0,y:((b=u==null?void 0:u.position)==null?void 0:b.row)??0,w:((y=u==null?void 0:u.position)==null?void 0:y.sizeX)??1,h:((w=u==null?void 0:u.position)==null?void 0:w.sizeY)??1};(_=this._grid)==null||_.makeWidget(d,g)}),this._grid.batchUpdate(!1),this._initialized=!0,this._grid.on("resizestart",(d,h)=>{const u=h.getAttribute("gs-w")??"",g=h.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(h,u,g)}),this._grid.on("resize",(d,h)=>{const u=h.getAttribute("gs-w")??"",g=h.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(h,u,g)}),this._grid.on("resizestop",(d,h)=>{this._removeDimensionsHint(h)}),this._grid.on("change",(d,h)=>{h.forEach(u=>{if(!(u!=null&&u.id))return;const g=this.items.findIndex(m=>m.id===u.id);g!==-1&&(this.items[g]={...this.items[g],position:{sizeX:u.w??1,sizeY:u.h??1,row:u.y??0,col:u.x??0}})}),this.dispatchEvent(new CustomEvent("grid-changed",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}),this.dispatchEvent(new CustomEvent("grid-ready",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}_createOrUpdateDimensionsHint(e,t,i){var l,c;const r=e.querySelector(".dimensions-hint-popover");if(r){r.style.display=t.length>0&&i.length>0?"block":"none",r.textContent=`${t} × ${i}`;return}const n=document.createElement("div");n.className="dimensions-hint-popover",n.setAttribute("popover","hint"),n.style.display=t.length>0&&i.length>0?"block":"none",n.textContent=`${t} × ${i}`,e.append(n);const o=10-(((c=(l=this.theme)==null?void 0:l.margins)==null?void 0:c[0])??10),a=es(e,n,async()=>{const{x:d,y:h}=await ss(e,n,{placement:"bottom",middleware:[ts(o),is()]});n.style.left=`${d}px`,n.style.top=`${h}px`});n._cleanup=a,n.matches(":popover-open")||n.showPopover()}_removeDimensionsHint(e){const t=e.querySelector(".dimensions-hint-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}get grid(){return this._grid}get gridItems(){return this.items.map(e=>{var r;const t={item:e,element:this._gridElement.querySelector(`[gs-id="${e.id}"]`)},i=(r=t.element)==null?void 0:r.querySelector("luzmo-embed-viz-item");return i&&(t.luzmoElement=i),t})}registerRenderer(e,t){this.renderers={...this.renderers,[e]:t}}_renderOverlayContent(e){let t=vr(e==null?void 0:e.actionsMenu)??vr(this.defaultItemActionsMenu)??Sn();const i=Tn.itemTypes.find(r=>r.type===(e==null?void 0:e.type));return!(i!=null&&i.containsData)&&!(e!=null&&e.actionsMenu)&&!this.defaultItemActionsMenu&&(t=t.map(r=>{var n;return{...r,actions:(n=r.actions)==null?void 0:n.filter(o=>o.action!=="edit-data")}})),f.x`
271
+ `,this._handleMouseout=e=>{if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");if(!i)return;const r=e.relatedTarget;r!=null&&r.closest(".grid-item-actions-popover")||i.hasAttribute("active")||this._removeItemActionsMenuPopover(i)},this._handleKeyDown=e=>{if(!this.viewMode){if(e.key==="Delete"&&this._focusedItemElement)this._handleDeleteItem(new Event("delete"));else if(e.key==="Escape"&&this._focusedItemElement)this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus();else if(e.key==="Enter"&&this._focusedItemElement)e.preventDefault(),e.stopPropagation(),this._activeItemElement&&(this._activeItemElement.removeAttribute("active"),this._gridElement.removeAttribute("has-active-item"),this._removeItemActionsMenuPopover(this._activeItemElement),this._activeItemElement=void 0),this._gridElement.querySelectorAll(".grid-stack-item").forEach(t=>{t!==this._focusedItemElement&&this._removeItemActionsMenuPopover(t)}),this._createItemActionsMenuPopover(this._focusedItemElement),requestAnimationFrame(()=>{var i;const t=(i=this._focusedItemElement)==null?void 0:i.querySelector("luzmo-grid-item-actions-menu");t&&t.focus()});else if(this._focusedItemElement&&this._grid&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();const t=this._focusedItemElement.gridstackNode;if(!t)return;const i=this.columns??48,n={ArrowLeft:{move:{x:t.x-1},resize:{x:t.x-1,w:t.w+1},shrink:{w:t.w-1},canMove:t.x>0,canResize:t.x>0,canShrink:t.w>1},ArrowRight:{move:{x:t.x+1},resize:{w:t.w+1},shrink:{x:t.x+1,w:t.w-1},canMove:t.x<i-t.w,canResize:t.x+t.w<i,canShrink:t.w>1},ArrowUp:{move:{y:t.y-1},resize:{y:t.y-1,h:t.h+1},shrink:{h:t.h-1},canMove:t.y>0,canResize:t.y>0,canShrink:t.h>1},ArrowDown:{move:{y:t.y+1},resize:{h:t.h+1},shrink:{y:t.y+1,h:t.h-1},canMove:!0,canResize:!0,canShrink:t.h>1}}[e.key];let o=null;e.shiftKey&&n.canResize?o=n.resize:(e.ctrlKey||e.metaKey)&&n.canShrink?o=n.shrink:n.canMove&&(o=n.move),o&&this._grid.update(this._focusedItemElement,o)}}},this._handleFocus=e=>{const i=e.target.closest(".grid-stack-item");i&&(this._focusedItemElement&&this._focusedItemElement!==i&&(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement)),this._focusedItemElement=i,i.setAttribute("focused","true"))},this._handleBlur=e=>{if(!this._focusedItemElement)return;const t=e.relatedTarget;t!=null&&t.closest("luzmo-grid-item-actions-menu")||(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus())},this._handleDocumentClick=e=>{const t=e.composedPath(),i=this._gridElement.querySelector(".grid-stack-item[active]");if(!i||t.includes(i))return;const r=i.querySelector(".grid-item-actions-popover");r&&t.includes(r)||this._cleanupActiveItem(i)},this._handleAction=e=>{var n,o;const t=e.detail,i=(n=e.target)==null?void 0:n.closest(".grid-stack-item");if(!i)return;const r=i.getAttribute("gs-id");if(t.type==="toggle"&&t.action===this._activeItemActionToggle&&i===this._activeItemElement){this._activeItemElement=void 0,this._activeItemActionToggle=void 0,(o=this._gridElement)==null||o.removeAttribute("has-active-item"),i.removeAttribute("active"),this._cleanupActiveItem(i);return}if(!["delete","clone"].includes(t.action)){this._gridElement.querySelectorAll(".grid-stack-item").forEach(l=>{l!==i&&this._cleanupActiveItem(l)}),t.type==="toggle"&&(this._activeItemElement=i,this._activeItemActionToggle=t.action,this._gridElement.setAttribute("has-active-item","true"),i.setAttribute("active","true"));const a=this.items.find(l=>l.id===r);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,element:i,id:r,type:a==null?void 0:a.type,slots:a==null?void 0:a.slots,options:a==null?void 0:a.options,filters:(a==null?void 0:a.filters)??[]},bubbles:!0,composed:!0,cancelable:!0}))}t.action==="delete"?(this._handleDeleteItem(e),this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,deletedId:r},bubbles:!0,composed:!0,cancelable:!0}))):t.action==="clone"&&this._handleCloneItem(e)},this._handleDeleteItem=e=>{var i;const t=((i=e.target)==null?void 0:i.closest(".grid-stack-item"))||this._focusedItemElement;t&&this.removeGridItemById(t.getAttribute("gs-id")||"")},this._handleCloneItem=e=>{const i=e.target.closest(".grid-stack-item");if(!i||!this._grid)return;const r=i.getAttribute("gs-id");if(!r)return;const n=this.items.find(l=>l.id===r);if(!n)return;const o={...structuredClone(n),id:nt()},a=this.addGridItem(o);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:"clone",items:this.items,originalElement:i,element:a,id:o.id,type:o.type,slots:o.slots,options:o.options,filters:o.filters},bubbles:!0,composed:!0}))}}static get styles(){return[f.r(Zl),f.r(ld)]}async _loadTheme(e){var t,i,r,n,o,a,l;(e==null?void 0:e.type)==="custom"?this._fullTheme=structuredClone(e):e!=null&&e.id&&si.systemThemeIds.includes(e.id)&&((t=this._fullTheme)==null?void 0:t.id)!==e.id?(this._fullTheme=await si.getTheme(e.id),this._fullTheme.id=e.id):e!=null&&e.id&&((i=this._fullTheme)==null?void 0:i.id)!==e.id||!e&&this._fullTheme||(this._fullTheme=await si.getTheme("default")),this._initialized&&this._updateThemeProperties(),!this._initialized&&this._gridElement&&this._initializeGrid(),this._grid&&((l=this._grid)==null||l.margin([(((n=(r=this.theme)==null?void 0:r.margins)==null?void 0:n[0])??16)/2,(((a=(o=this.theme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2].join(" "))),this.requestUpdate()}firstUpdated(){document.addEventListener("click",this._handleDocumentClick),this.addEventListener("keydown",this._handleKeyDown),this._loadTheme(this.theme)}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("keydown",this._handleKeyDown)}willUpdate(e){var i,r,n,o,a,l;super.willUpdate(e),e.has("_initialized")&&(this._updateThemeProperties(),this._initialized&&this._grid&&((i=this._fullTheme)!=null&&i.margins)&&((l=this._grid)==null||l.margin([(((n=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:n[0])??16)/2,(((a=(o=this._fullTheme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2].join(" "))))}updated(e){var o,a,l;super.updated(e);const t=e.has("contentLanguage"),i=e.has("viewMode"),r=e.has("items"),n=e.has("theme");this.items.forEach(d=>{d.id=d.id??nt()}),this._initialized&&this._grid&&r&&((o=this._grid)==null||o.setAnimation(!1),(a=this._grid)==null||a.batchUpdate(),(l=this._grid)==null||l.removeAll(!1),this.items.forEach(d=>{var h,u,g,m,b,y,w;const c=[...this._gridItemElements].find(_=>_.getAttribute("luzmo-grid-item-id")===d.id);c&&((b=this._grid)==null||b.makeWidget(c,{x:((h=d==null?void 0:d.position)==null?void 0:h.col)??0,y:((u=d==null?void 0:d.position)==null?void 0:u.row)??0,w:((g=d==null?void 0:d.position)==null?void 0:g.sizeX)??1,h:((m=d==null?void 0:d.position)==null?void 0:m.sizeY)??1,id:d.id}),(y=this._grid)==null||y.batchUpdate(!1),(w=this._grid)==null||w.setAnimation(!0))})),t&&this._updateLuzmoVizItemsLanguage(),this._initialized&&this._grid&&i&&this.viewMode!==e.get("viewMode")&&(this.viewMode?(this._grid.disable(),this._activeItemElement&&(this._cleanupActiveItem(this._activeItemElement),this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item"))):this._grid.enable()),n&&this._loadTheme(this.theme)}_updateLuzmoVizItemsLanguage(){this._gridItemElements.forEach(e=>{const t=e.querySelector("luzmo-embed-viz-item");t&&(t.options={...t.options,locale:this.contentLanguage})})}_handleMouseover(e){if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");i&&this._createItemActionsMenuPopover(i)}_cleanupActiveItem(e){e.removeAttribute("active"),this._activeItemElement===e&&(this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item")),this._removeItemActionsMenuPopover(e)}_cleanup(){for(const e of this._gridItemElements)this._cleanupActiveItem(e);this._grid&&(this._grid.destroy(),this._grid=void 0),this._initialized=!1}_initializeGrid(){var t,i,r,n,o,a,l,d;if(this._initialized||!this._gridElement)return;const e={column:this.columns??48,cellHeight:this.rowHeight??16,marginTop:(((i=(t=this._fullTheme)==null?void 0:t.margins)==null?void 0:i[0])??16)/2,marginLeft:(((n=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:n[1])??16)/2,marginRight:(((a=(o=this._fullTheme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2,marginBottom:(((d=(l=this._fullTheme)==null?void 0:l.margins)==null?void 0:d[0])??16)/2,animate:!0,auto:!1,float:!1,removable:!1,acceptWidgets:!0,disableDrag:this.viewMode,disableResize:this.viewMode,resizable:{handles:["n","ne","e","se","s","sw","w","nw"].join(", ")},handle:".grid-item-drag-handle"};this._grid=z.init(e,this._gridElement),this._grid.batchUpdate(),this._gridItemElements.forEach(c=>{var m,b,y,w,_;const h=c.getAttribute("luzmo-grid-item-id"),u=this.items.find(x=>x.id===h),g={id:h,x:((m=u==null?void 0:u.position)==null?void 0:m.col)??0,y:((b=u==null?void 0:u.position)==null?void 0:b.row)??0,w:((y=u==null?void 0:u.position)==null?void 0:y.sizeX)??1,h:((w=u==null?void 0:u.position)==null?void 0:w.sizeY)??1};(_=this._grid)==null||_.makeWidget(c,g)}),this._grid.batchUpdate(!1),this._initialized=!0,this._grid.on("resizestart",(c,h)=>{const u=h.getAttribute("gs-w")??"",g=h.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(h,u,g)}),this._grid.on("resize",(c,h)=>{const u=h.getAttribute("gs-w")??"",g=h.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(h,u,g)}),this._grid.on("resizestop",(c,h)=>{this._removeDimensionsHint(h)}),this._grid.on("change",(c,h)=>{h.forEach(u=>{if(!(u!=null&&u.id))return;const g=this.items.findIndex(m=>m.id===u.id);g!==-1&&(this.items[g]={...this.items[g],position:{sizeX:u.w??1,sizeY:u.h??1,row:u.y??0,col:u.x??0}})}),this.dispatchEvent(new CustomEvent("grid-changed",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}),this.dispatchEvent(new CustomEvent("grid-ready",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}_createOrUpdateDimensionsHint(e,t,i){var l,d;const r=e.querySelector(".dimensions-hint-popover");if(r){r.style.display=t.length>0&&i.length>0?"block":"none",r.textContent=`${t} × ${i}`;return}const n=document.createElement("div");n.className="dimensions-hint-popover",n.setAttribute("popover","hint"),n.style.display=t.length>0&&i.length>0?"block":"none",n.textContent=`${t} × ${i}`,e.append(n);const o=10-(((d=(l=this.theme)==null?void 0:l.margins)==null?void 0:d[0])??10),a=ts(e,n,async()=>{const{x:c,y:h}=await rs(e,n,{placement:"bottom",middleware:[is(o),ss()]});n.style.left=`${c}px`,n.style.top=`${h}px`});n._cleanup=a,n.matches(":popover-open")||n.showPopover()}_removeDimensionsHint(e){const t=e.querySelector(".dimensions-hint-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}get grid(){return this._grid}get gridItems(){return this.items.map(e=>{var r;const t={item:e,element:this._gridElement.querySelector(`[gs-id="${e.id}"]`)},i=(r=t.element)==null?void 0:r.querySelector("luzmo-embed-viz-item");return i&&(t.luzmoElement=i),t})}registerRenderer(e,t){this.renderers={...this.renderers,[e]:t}}_renderOverlayContent(e){let t=wr(e==null?void 0:e.actionsMenu)??wr(this.defaultItemActionsMenu)??An();const i=Hn.itemTypes.find(r=>r.type===(e==null?void 0:e.type));return!(i!=null&&i.containsData)&&!(e!=null&&e.actionsMenu)&&!this.defaultItemActionsMenu&&(t=t.map(r=>{var n;return{...r,actions:(n=r.actions)==null?void 0:n.filter(o=>o.action!=="edit-data")}})),f.x`
272
272
  <div class="grid-item-actions-popover" popover="manual">
273
273
  <luzmo-grid-item-actions-menu
274
274
  .actions=${t}
@@ -278,9 +278,9 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
278
278
  >
279
279
  </luzmo-grid-item-actions-menu>
280
280
  </div>
281
- `}_createItemActionsMenuPopover(e){let t=e.querySelector(".grid-item-actions-popover");const i=e.querySelector(".grid-stack-item-content"),r=this.getGridItemById(e.getAttribute("gs-id")??"");if(!t){const o=document.createDocumentFragment();f.B(this._renderOverlayContent(r==null?void 0:r.item),o),t=o.querySelector(".grid-item-actions-popover"),e.append(t)}const n=es(i,t,async()=>{var l;const{x:o,y:a}=await ss(i,t,{placement:((l=r==null?void 0:r.item)==null?void 0:l.placementActionsMenu)??this.placementItemActionsMenu??"right-start",middleware:[ts(0),is({crossAxis:!1})]});t.style.left=`${o}px`,t.style.top=`${a}px`});t._cleanup=n,t.matches(":popover-open")||t.showPopover()}_removeItemActionsMenuPopover(e){const t=e.querySelector(".grid-item-actions-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}_updateThemeProperties(){var r,n,o,a,l,c,d,h,u,g,m,b,y,w,_,x,R,S,O,P,N;if(!this.theme)return;const e=this.theme.boxShadow;let t="";if(e){const G=new C(e.color),$={r:Math.round(G.srgb.r*255),g:Math.round(G.srgb.g*255),b:Math.round(G.srgb.b*255)},ue=((r=this.theme.margins)==null?void 0:r[0])??16,W=Math.min(ue/10,2),oe=(I,me)=>me>=1?`rgba(${I.r},${I.g},${I.b},1)`:me<=0?`rgba(${I.r},${I.g},${I.b},0)`:`rgba(${I.r},${I.g},${I.b},${me})`;e.size==="none"?t="none":e.size==="S"?t=`0 ${W*2}px ${W*4}px ${oe($,.16)}, 0 ${W*2}px ${W*4}px ${oe($,.23)}`:e.size==="M"?t=`0 ${W*8}px ${W*16}px ${oe($,.19)}, 0 ${W*4}px ${W*4}px ${oe($,.23)}`:e.size==="L"&&(t=`0 ${W*12}px ${W*24}px ${oe($,.25)}, 0 ${W*8}px ${W*8}px ${oe($,.22)}`)}new Map([["--grid-font-family",(o=(n=this.theme)==null?void 0:n.font)==null?void 0:o.fontFamily],["--grid-background",(a=this.theme)==null?void 0:a.background],["--grid-item-box-shadow",t],["--grid-item-background",(l=this.theme)==null?void 0:l.itemsBackground],["--grid-item-border-color",(d=(c=this.theme)==null?void 0:c.borders)==null?void 0:d["border-color"]],["--grid-item-border-style",(u=(h=this.theme)==null?void 0:h.borders)==null?void 0:u["border-style"]],["--grid-item-border-radius",(m=(g=this.theme)==null?void 0:g.borders)==null?void 0:m["border-radius"]],["--grid-item-border-width",`${(y=(b=this.theme)==null?void 0:b.borders)==null?void 0:y["border-top-width"]}`],["--grid-item-border-top-width",(_=(w=this.theme)==null?void 0:w.borders)==null?void 0:_["border-top-width"]],["--grid-item-border-right-width",(R=(x=this.theme)==null?void 0:x.borders)==null?void 0:R["border-right-width"]],["--grid-item-border-bottom-width",(O=(S=this.theme)==null?void 0:S.borders)==null?void 0:O["border-bottom-width"]],["--grid-item-border-left-width",(N=(P=this.theme)==null?void 0:P.borders)==null?void 0:N["border-left-width"]]]).forEach((G,$)=>{G?this.style.setProperty($,G):this.style.removeProperty($)})}getGridItemById(e){return this.gridItems.find(t=>t.item.id===e)}addGridItem(e){var a,l,c,d,h;const t={...structuredClone(e),id:nt(),position:structuredClone(e==null?void 0:e.position)??{sizeX:1,sizeY:1,col:0,row:0}};this.items.push(t);const i=this._renderItem(t,this.items.length),r=document.createDocumentFragment();f.B(i,r,{host:this}),this._gridElement.append(r);const n=this._gridElement.querySelector(`[luzmo-grid-item-id="${t.id}"]`),o={x:((a=t.position)==null?void 0:a.col)??0,y:((l=t.position)==null?void 0:l.row)??0,w:((c=t.position)==null?void 0:c.sizeX)??1,h:((d=t.position)==null?void 0:d.sizeY)??1,autoPosition:!0,id:t.id};return(h=this._grid)==null||h.makeWidget(n,o),this._activeItemElement&&this._cleanupActiveItem(this._activeItemElement),requestAnimationFrame(()=>{const u=n.getBoundingClientRect();(u.bottom>window.innerHeight||u.top<0)&&n.scrollIntoView({behavior:"smooth",block:"center"})}),n}removeGridItem(e){this.removeGridItemById((e==null?void 0:e.id)??"")}removeGridItemById(e){var r;if(!e)return;const t=(r=this.getGridItemById(e))==null?void 0:r.element;t&&this._grid&&(this._grid.removeWidget(t),this._focusedItemElement=void 0);const i=this.items.findIndex(n=>n.id===e);i!==-1&&this.items.splice(i,1),this._removeItemActionsMenuPopover(t),t&&this._activeItemElement===t&&this._cleanupActiveItem(t)}_renderItem(e,t){const i={...e.options,locale:this.contentLanguage};i.theme||(i.theme=this.theme.id?{id:this.theme.id}:structuredClone(this.theme));const r=!this.viewMode;return f.x`
281
+ `}_createItemActionsMenuPopover(e){let t=e.querySelector(".grid-item-actions-popover");const i=e.querySelector(".grid-stack-item-content"),r=this.getGridItemById(e.getAttribute("gs-id")??"");if(!t){const o=document.createDocumentFragment();f.B(this._renderOverlayContent(r==null?void 0:r.item),o),t=o.querySelector(".grid-item-actions-popover"),e.append(t)}const n=ts(i,t,async()=>{var l;const{x:o,y:a}=await rs(i,t,{placement:((l=r==null?void 0:r.item)==null?void 0:l.placementActionsMenu)??this.placementItemActionsMenu??"right-start",middleware:[is(0),ss({crossAxis:!1})]});t.style.left=`${o}px`,t.style.top=`${a}px`});t._cleanup=n,t.matches(":popover-open")||t.showPopover()}_removeItemActionsMenuPopover(e){const t=e.querySelector(".grid-item-actions-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}_updateThemeProperties(){var r,n,o,a,l,d,c,h,u,g,m,b,y,w,_,x,R,A,j,W,H;if(!this._fullTheme)return;const e=this._fullTheme.boxShadow;let t="";if(e){const G=new C(e.color),O={r:Math.round(G.srgb.r*255),g:Math.round(G.srgb.g*255),b:Math.round(G.srgb.b*255)},ue=((r=this._fullTheme.margins)==null?void 0:r[0])??16,$=Math.min(ue/10,2),oe=(I,me)=>me>=1?`rgba(${I.r},${I.g},${I.b},1)`:me<=0?`rgba(${I.r},${I.g},${I.b},0)`:`rgba(${I.r},${I.g},${I.b},${me})`;e.size==="none"?t="none":e.size==="S"?t=`0 ${$*2}px ${$*4}px ${oe(O,.16)}, 0 ${$*2}px ${$*4}px ${oe(O,.23)}`:e.size==="M"?t=`0 ${$*8}px ${$*16}px ${oe(O,.19)}, 0 ${$*4}px ${$*4}px ${oe(O,.23)}`:e.size==="L"&&(t=`0 ${$*12}px ${$*24}px ${oe(O,.25)}, 0 ${$*8}px ${$*8}px ${oe(O,.22)}`)}new Map([["--grid-font-family",(o=(n=this._fullTheme)==null?void 0:n.font)==null?void 0:o.fontFamily],["--grid-background",(a=this._fullTheme)==null?void 0:a.background],["--grid-item-box-shadow",t],["--grid-item-background",(l=this._fullTheme)==null?void 0:l.itemsBackground],["--grid-item-border-color",(c=(d=this._fullTheme)==null?void 0:d.borders)==null?void 0:c["border-color"]],["--grid-item-border-style",(u=(h=this._fullTheme)==null?void 0:h.borders)==null?void 0:u["border-style"]],["--grid-item-border-radius",(m=(g=this._fullTheme)==null?void 0:g.borders)==null?void 0:m["border-radius"]],["--grid-item-border-width",`${(y=(b=this._fullTheme)==null?void 0:b.borders)==null?void 0:y["border-top-width"]}`],["--grid-item-border-top-width",(_=(w=this._fullTheme)==null?void 0:w.borders)==null?void 0:_["border-top-width"]],["--grid-item-border-right-width",(R=(x=this._fullTheme)==null?void 0:x.borders)==null?void 0:R["border-right-width"]],["--grid-item-border-bottom-width",(j=(A=this._fullTheme)==null?void 0:A.borders)==null?void 0:j["border-bottom-width"]],["--grid-item-border-left-width",(H=(W=this._fullTheme)==null?void 0:W.borders)==null?void 0:H["border-left-width"]]]).forEach((G,O)=>{G?this.style.setProperty(O,G):this.style.removeProperty(O)})}getGridItemById(e){return this.gridItems.find(t=>t.item.id===e)}addGridItem(e){var a,l,d,c,h;const t={...structuredClone(e),id:nt(),position:structuredClone(e==null?void 0:e.position)??{sizeX:1,sizeY:1,col:0,row:0}};this.items.push(t);const i=this._renderItem(t,this.items.length),r=document.createDocumentFragment();f.B(i,r,{host:this}),this._gridElement.append(r);const n=this._gridElement.querySelector(`[luzmo-grid-item-id="${t.id}"]`),o={x:((a=t.position)==null?void 0:a.col)??0,y:((l=t.position)==null?void 0:l.row)??0,w:((d=t.position)==null?void 0:d.sizeX)??1,h:((c=t.position)==null?void 0:c.sizeY)??1,autoPosition:!0,id:t.id};return(h=this._grid)==null||h.makeWidget(n,o),this._activeItemElement&&this._cleanupActiveItem(this._activeItemElement),requestAnimationFrame(()=>{const u=n.getBoundingClientRect();(u.bottom>window.innerHeight||u.top<0)&&n.scrollIntoView({behavior:"smooth",block:"center"})}),n}removeGridItem(e){this.removeGridItemById((e==null?void 0:e.id)??"")}removeGridItemById(e){var r;if(!e)return;const t=(r=this.getGridItemById(e))==null?void 0:r.element;t&&this._grid&&(this._grid.removeWidget(t),this._focusedItemElement=void 0);const i=this.items.findIndex(n=>n.id===e);i!==-1&&this.items.splice(i,1),this._removeItemActionsMenuPopover(t),t&&this._activeItemElement===t&&this._cleanupActiveItem(t)}_renderItem(e,t){var n;const i={...e.options,locale:this.contentLanguage};i.theme||(i.theme=(n=this._fullTheme)!=null&&n.id?{id:this._fullTheme.id}:structuredClone(this._fullTheme));const r=!this.viewMode;return f.x`
282
282
  <div
283
- class="luzmo-grid-item"
283
+ class="luzmo-grid-item has-luzmo-viz-item"
284
284
  luzmo-grid-item-id=${e.id??nt()}
285
285
  tabindex="0"
286
286
  role="row"
@@ -294,28 +294,29 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
294
294
  role="gridcell"
295
295
  aria-label="Grid item ${t+1}"
296
296
  >
297
- ${r?f.x`
298
- <div class="grid-item-drag-handle">
299
- <luzmo-icon .icon=${Me.W} size="s"></luzmo-icon>
300
- </div>
301
- `:f.x``}
302
- <luzmo-embed-viz-item
303
- .appServer=${this.appServer}
304
- .apiHost=${this.apiHost}
305
- .authKey=${this.authKey}
306
- .authToken=${this.authToken}
307
- .type=${e.type}
308
- .slots=${e.slots}
309
- .options=${i}
310
- .filters=${e.filters}
311
- .language=${this.contentLanguage}
312
- .contextId=${e.contextId}
313
- .canFilter=${e.canFilter??"all"}
314
- ></luzmo-embed-viz-item>
297
+ ${this._initialized?f.x` ${r?f.x`
298
+ <div class="grid-item-drag-handle">
299
+ <luzmo-icon .icon=${Me.W} size="s"></luzmo-icon>
300
+ </div>
301
+ `:f.x``}
302
+ <luzmo-embed-viz-item
303
+ .appServer=${this.appServer}
304
+ .apiHost=${this.apiHost}
305
+ .authKey=${this.authKey}
306
+ .authToken=${this.authToken}
307
+ .type=${e.type}
308
+ .slots=${e.slots}
309
+ .options=${i}
310
+ .filters=${e.filters}
311
+ .language=${this.contentLanguage}
312
+ .contextId=${e.contextId}
313
+ .canFilter=${e.canFilter??"all"}
314
+ ></luzmo-embed-viz-item>`:f.x``}
315
315
  </div>
316
316
  </div>
317
- `}render(){const e=this.items.map((t,i)=>(t.id=t.id??nt(),this._renderItem(t,i)));return f.x`
317
+ `}_renderGrid(){var i,r;const e=this.items.map((n,o)=>(n.id=n.id??nt(),this._renderItem(n,o)));let t=!1;return this._initialized&&((i=this._fullTheme)!=null&&i.itemsBackground||(r=this._fullTheme)!=null&&r.background)&&(t=new C(this._fullTheme.itemsBackground??this._fullTheme.background).luminance<.5),f.x`
318
318
  <div
319
+ ?dark-background=${t}
319
320
  class="grid-stack"
320
321
  data-grid-columns=${this.columns??48}
321
322
  role="grid"
@@ -323,4 +324,4 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
323
324
  >
324
325
  ${e}
325
326
  </div>
326
- `}}F([f.n({type:String,attribute:"app-server",reflect:!0})],H.prototype,"appServer");F([f.n({type:String,attribute:"api-host",reflect:!0})],H.prototype,"apiHost");F([f.n({type:String,attribute:"auth-key",reflect:!0})],H.prototype,"authKey");F([f.n({type:String,attribute:"auth-token",reflect:!0})],H.prototype,"authToken");F([f.n({type:Number,attribute:"cache-time",reflect:!0})],H.prototype,"cacheTime");F([f.n({type:String,reflect:!0})],H.prototype,"language");F([f.n({type:String,attribute:"content-language",reflect:!0})],H.prototype,"contentLanguage");F([f.n({type:Number,reflect:!0})],H.prototype,"columns");F([f.n({type:Number,reflect:!0,attribute:"row-height"})],H.prototype,"rowHeight");F([f.n({type:Boolean,reflect:!0,attribute:"view-mode"})],H.prototype,"viewMode");F([f.n({type:String,reflect:!0,attribute:"placement-item-actions-menu"})],H.prototype,"placementItemActionsMenu");F([f.n({type:Array,reflect:!0,attribute:"default-item-actions-menu"})],H.prototype,"defaultItemActionsMenu");F([f.n({type:Object,reflect:!0})],H.prototype,"theme");F([f.n({type:Array,reflect:!1})],H.prototype,"items");F([f.n({type:Object,reflect:!1})],H.prototype,"renderers");F([st.r()],H.prototype,"_initialized");F([jt.e(".grid-stack")],H.prototype,"_gridElement");F([Nn.r(".luzmo-grid-item")],H.prototype,"_gridItemElements");customElements.get("luzmo-grid")||customElements.define("luzmo-grid",H);customElements.get("luzmo-grid-item-actions-menu")||customElements.define("luzmo-grid-item-actions-menu",exports.LuzmoGridItemActionsMenu);exports.LuzmoGrid=H;
327
+ `}render(){return this._renderGrid()}}B([f.n({type:String,attribute:"app-server",reflect:!0})],N.prototype,"appServer");B([f.n({type:String,attribute:"api-host",reflect:!0})],N.prototype,"apiHost");B([f.n({type:String,attribute:"auth-key",reflect:!0})],N.prototype,"authKey");B([f.n({type:String,attribute:"auth-token",reflect:!0})],N.prototype,"authToken");B([f.n({type:Number,attribute:"cache-time",reflect:!0})],N.prototype,"cacheTime");B([f.n({type:String,reflect:!0})],N.prototype,"language");B([f.n({type:String,attribute:"content-language",reflect:!0})],N.prototype,"contentLanguage");B([f.n({type:Number,reflect:!0})],N.prototype,"columns");B([f.n({type:Number,reflect:!0,attribute:"row-height"})],N.prototype,"rowHeight");B([f.n({type:Boolean,reflect:!0,attribute:"view-mode"})],N.prototype,"viewMode");B([f.n({type:String,reflect:!0,attribute:"placement-item-actions-menu"})],N.prototype,"placementItemActionsMenu");B([f.n({type:Array,reflect:!0,attribute:"default-item-actions-menu"})],N.prototype,"defaultItemActionsMenu");B([f.n({type:Object,reflect:!0})],N.prototype,"theme");B([f.n({type:Array,reflect:!1})],N.prototype,"items");B([f.n({type:Object,reflect:!1})],N.prototype,"renderers");B([st.r()],N.prototype,"_initialized");B([qt.e(".grid-stack")],N.prototype,"_gridElement");B([Nn.r(".luzmo-grid-item")],N.prototype,"_gridItemElements");customElements.get("luzmo-grid")||customElements.define("luzmo-grid",N);customElements.get("luzmo-grid-item-actions-menu")||customElements.define("luzmo-grid-item-actions-menu",exports.LuzmoGridItemActionsMenu);exports.LuzmoGrid=N;