monobill-mintui 0.5.95 → 0.5.97

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.
@@ -174,6 +174,17 @@ declare class MintChart extends HTMLElement {
174
174
  */
175
175
  private _calculateRotatedLabelHeight;
176
176
  private _renderGrid;
177
+ /**
178
+ * Monotone cubic in x (D3 curveMonotoneX / Steffen slopes): smooth without overshoot,
179
+ * similar to smoothed line/area UIs (e.g. amCharts smoothed series).
180
+ * Ported from d3-shape monotone.js.
181
+ */
182
+ private _buildMonotoneXLinePathD;
183
+ private _stripLeadingMoveTo;
184
+ /** Closed area: baseline → top (monotone when curve-tension > 0) → baseline. */
185
+ private _buildAreaFillPathD;
186
+ /** Open stroke path through `points` (line / area top edge). */
187
+ private _buildSmoothLinePathD;
177
188
  private _renderLineChart;
178
189
  /**
179
190
  * Scale x value for bar charts - treats positions as if there's a blank at start and end
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/components/chart/Chart.ts"],"names":[],"mappings":"AAGA,KAAK,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;AAEhD,UAAU,cAAc;IACtB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,cAAc,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAClD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAC5B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAClD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;CAC5D;AAED,cAAM,SAAU,SAAQ,WAAW;IACjC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,eAAe,CAA2B;IAClD,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAKf;IACD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,sBAAsB,CAAsB;IACpD,OAAO,CAAC,qBAAqB,CAA0C;IACvE,OAAO,CAAC,iBAAiB,CAA0C;IACnE,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,WAAW,CAA6C;IAChE,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,oBAAoB,CAA4B;IACxD,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,qBAAqB,CAAiB;IAC9C,OAAO,CAAC,4BAA4B,CAAyC;IAC7E,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,yBAAyB,CAAyC;IAC1E,OAAO,CAAC,0BAA0B,CAAoC;IACtE,OAAO,CAAC,aAAa,CAA+H;IACpJ,OAAO,CAAC,aAAa,CAAkG;IACvH,OAAO,CAAC,cAAc,CAA2F;IACjH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAM;IAC5C,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,YAAY,CAAuB;IAG3C,OAAO,CAAC,cAAc,CASrB;;IAMD,iBAAiB,IAAI,IAAI;IA0BzB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAiCzB,OAAO,CAAC,kBAAkB;IA6D1B,OAAO,CAAC,sBAAsB;IAc9B,oBAAoB,IAAI,IAAI;IAkH5B,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,oBAAoB;IAsC5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IA2B9F,IAAI,IAAI,IAAI,SAAS,CAGpB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,EAExB;IAED,IAAI,IAAI,IAAI,SAAS,GAAG,IAAI,CAE3B;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,EAiBxC;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,MAAM,CAU3B;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAE/B;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,CAU5B;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAEhC;IAED;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,MAAM;IA8Jd,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,cAAc;IAkEtB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,mBAAmB,CAAY;IAEvC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAoCpC,OAAO,CAAC,eAAe;IAwFvB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,WAAW;IA8DnB,OAAO,CAAC,UAAU;IAoClB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAKzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,qBAAqB;IAS7B,sFAAsF;IACtF,OAAO,CAAC,oBAAoB;IAI5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAYpB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA2ClC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAogB1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA8C9B,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IA4DpC,OAAO,CAAC,WAAW;IAyUnB,OAAO,CAAC,gBAAgB;IA8ExB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,eAAe;IAuHvB,OAAO,CAAC,gBAAgB;IAsGxB,OAAO,CAAC,eAAe;IAgTvB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAsD9B,OAAO,CAAC,aAAa;IAkMrB;;;;OAIG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF;;;OAGG;IACU,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/G;;;;OAIG;IACU,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB3F;;;OAGG;IACU,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7D;;;OAGG;IACU,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB/D;;;;;OAKG;IACU,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB5G;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBtI;;;;OAIG;IACU,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/G;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;;OAIG;IACU,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgB/D;;;;OAIG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI/D;;;OAGG;IACU,aAAa,CAAC,QAAQ,GAAE,MAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAqH1E;AAMD,eAAe,SAAS,CAAA"}
1
+ {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/components/chart/Chart.ts"],"names":[],"mappings":"AAGA,KAAK,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;AAEhD,UAAU,cAAc;IACtB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,cAAc,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAClD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAC5B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAClD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;CAC5D;AAED,cAAM,SAAU,SAAQ,WAAW;IACjC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,eAAe,CAA2B;IAClD,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAKf;IACD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,sBAAsB,CAAsB;IACpD,OAAO,CAAC,qBAAqB,CAA0C;IACvE,OAAO,CAAC,iBAAiB,CAA0C;IACnE,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,WAAW,CAA6C;IAChE,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,oBAAoB,CAA4B;IACxD,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,qBAAqB,CAAiB;IAC9C,OAAO,CAAC,4BAA4B,CAAyC;IAC7E,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,yBAAyB,CAAyC;IAC1E,OAAO,CAAC,0BAA0B,CAAoC;IACtE,OAAO,CAAC,aAAa,CAA+H;IACpJ,OAAO,CAAC,aAAa,CAAkG;IACvH,OAAO,CAAC,cAAc,CAA2F;IACjH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAM;IAC5C,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,YAAY,CAAuB;IAG3C,OAAO,CAAC,cAAc,CASrB;;IAMD,iBAAiB,IAAI,IAAI;IA0BzB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAiCzB,OAAO,CAAC,kBAAkB;IA6D1B,OAAO,CAAC,sBAAsB;IAc9B,oBAAoB,IAAI,IAAI;IAkH5B,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,oBAAoB;IAsC5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IA2B9F,IAAI,IAAI,IAAI,SAAS,CAGpB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,EAExB;IAED,IAAI,IAAI,IAAI,SAAS,GAAG,IAAI,CAE3B;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,EAiBxC;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,MAAM,CAU3B;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAE/B;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,CAU5B;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAEhC;IAED;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,MAAM;IA8Jd,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,cAAc;IAkEtB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,mBAAmB,CAAY;IAEvC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAoCpC,OAAO,CAAC,eAAe;IAwFvB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,WAAW;IA8DnB,OAAO,CAAC,UAAU;IAoClB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAKzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,qBAAqB;IAS7B,sFAAsF;IACtF,OAAO,CAAC,oBAAoB;IAI5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAYpB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA2ClC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAogB1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA8C9B,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IA4DpC,OAAO,CAAC,WAAW;IAyUnB;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAmHhC,OAAO,CAAC,mBAAmB;IAI3B,gFAAgF;IAChF,OAAO,CAAC,mBAAmB;IAqB3B,gEAAgE;IAChE,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,gBAAgB;IAwExB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,eAAe;IAuHvB,OAAO,CAAC,gBAAgB;IAgFxB,OAAO,CAAC,eAAe;IAgTvB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAsD9B,OAAO,CAAC,aAAa;IAkMrB;;;;OAIG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF;;;OAGG;IACU,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/G;;;;OAIG;IACU,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB3F;;;OAGG;IACU,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7D;;;OAGG;IACU,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB/D;;;;;OAKG;IACU,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB5G;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBtI;;;;OAIG;IACU,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/G;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;;OAIG;IACU,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgB/D;;;;OAIG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI/D;;;OAGG;IACU,aAAa,CAAC,QAAQ,GAAE,MAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAqH1E;AAMD,eAAe,SAAS,CAAA"}
@@ -11,6 +11,9 @@ declare class MintSideNavigation extends HTMLElement {
11
11
  private _escapeHandler;
12
12
  private _mediaQuery;
13
13
  private _mediaListener;
14
+ private _accordionHandler;
15
+ /** Close the mobile drawer after the user follows a real link (capture phase). */
16
+ private _onMobileNavNavigateClick;
14
17
  connectedCallback(): void;
15
18
  disconnectedCallback(): void;
16
19
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
@@ -18,6 +21,9 @@ declare class MintSideNavigation extends HTMLElement {
18
21
  private _detachEscapeListener;
19
22
  private _attachMediaListener;
20
23
  private _detachMediaListener;
24
+ /** Only one expandable `mint-sidenav-link` group open at a time within this sidebar. */
25
+ private _attachAccordionListener;
26
+ private _detachAccordionListener;
21
27
  getUserName(): string;
22
28
  getUserStatus(): string;
23
29
  private _isOpen;
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/SideNavigation.ts"],"names":[],"mappings":"AAEA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,4BAA4B,CAAA;AAEnC,cAAM,kBAAmB,SAAQ,WAAW;IAC1C,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,cAAc,CAA4C;IAClE,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,cAAc,CAAyE;IAE/F,iBAAiB,IAAI,IAAI;IAezB,oBAAoB,IAAI,IAAI;IAK5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,oBAAoB;IAQ5B,WAAW,IAAI,MAAM;IAIrB,aAAa,IAAI,MAAM;IAIvB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,UAAU;IA6DlB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,YAAY;IAiBpB,MAAM,IAAI,IAAI;CAQf;AAMD,eAAe,kBAAkB,CAAA"}
1
+ {"version":3,"file":"SideNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/SideNavigation.ts"],"names":[],"mappings":"AAEA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,4BAA4B,CAAA;AAEnC,cAAM,kBAAmB,SAAQ,WAAW;IAC1C,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,cAAc,CAA4C;IAClE,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,cAAc,CAAyE;IAC/F,OAAO,CAAC,iBAAiB,CAAoC;IAE7D,kFAAkF;IAClF,OAAO,CAAC,yBAAyB,CAmBhC;IAED,iBAAiB,IAAI,IAAI;IAgBzB,oBAAoB,IAAI,IAAI;IAM5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,oBAAoB;IAQ5B,wFAAwF;IACxF,OAAO,CAAC,wBAAwB;IAmBhC,OAAO,CAAC,wBAAwB;IAOhC,WAAW,IAAI,MAAM;IAIrB,aAAa,IAAI,MAAM;IAIvB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,UAAU;IA6DlB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,YAAY;IAiBpB,MAAM,IAAI,IAAI;CAQf;AAMD,eAAe,kBAAkB,CAAA"}
@@ -9,6 +9,8 @@ declare class MintSidenavLink extends HTMLElement {
9
9
  private _refreshDropdownAncestor;
10
10
  private _isActive;
11
11
  private _isExpanded;
12
+ /** Parent row with submenu: show child links when expanded or when this parent is active. */
13
+ private _isSubmenuPanelVisible;
12
14
  private _isSubmenuItem;
13
15
  private _getLabel;
14
16
  private _getIcon;
@@ -17,6 +19,8 @@ declare class MintSidenavLink extends HTMLElement {
17
19
  private _hasSubmenu;
18
20
  private _createRow;
19
21
  private _buildSimpleLink;
22
+ private _emitAccordionExpand;
23
+ private _setExpanded;
20
24
  private _buildDropdownLink;
21
25
  render(): void;
22
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavigationLink.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/SideNavigationLink.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAA;AAEtB,cAAM,eAAgB,SAAQ,WAAW;IACvC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,QAAQ,CAAqD;IACrE,OAAO,CAAC,iBAAiB,CAA2B;IAEpD,iBAAiB,IAAI,IAAI;IAKzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAS9F,gGAAgG;IAChG,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,kBAAkB;IA8C1B,MAAM,IAAI,IAAI;CAOf;AAMD,eAAe,eAAe,CAAA"}
1
+ {"version":3,"file":"SideNavigationLink.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/SideNavigationLink.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAA;AAEtB,cAAM,eAAgB,SAAQ,WAAW;IACvC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,QAAQ,CAAqD;IACrE,OAAO,CAAC,iBAAiB,CAA2B;IAEpD,iBAAiB,IAAI,IAAI;IAKzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAS9F,gGAAgG;IAChG,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,WAAW;IAInB,6FAA6F;IAC7F,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,kBAAkB;IAuE1B,MAAM,IAAI,IAAI;CAOf;AAMD,eAAe,eAAe,CAAA"}
package/dist/index.cjs CHANGED
@@ -94,7 +94,7 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
94
94
  max-height: 100% !important;
95
95
  }
96
96
  }
97
- `,document.head.appendChild(e)}}};customElements.get(`mint-off-canvas`)||customElements.define(`mint-off-canvas`,M);var N=class extends HTMLElement{static get observedAttributes(){return[`active`,`disabled`,`target`]}constructor(){super(),this._clickHandler=null}connectedCallback(){this.render(),this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getTarget(){return this.getAttribute(`target`)||``}isActive(){let e=this.getAttribute(`active`);return e!==null&&e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.setAttribute(`active`,`false`)}render(){let e=this.isActive(),t=this.isDisabled();this.className=``,this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`inline-block`,`cursor-pointer`,`px-4`,`py-1.5`,`text-sm`,`font-medium`,`rounded-lg`,`border`,`text-gray-700`,`dark:text-gray-300`);let n=this.closest(`mint-tab-list`)?.getAttribute(`position`)||`top`,r=n===`left`||n===`right`;t?(this.classList.add(`opacity-60`,`cursor-not-allowed`,`pointer-events-none`,`bg-gray-50`,`dark:bg-mint-elevated`,`border-gray-300`,`dark:border-mint-divider`,`text-gray-400`,`dark:text-gray-500`),this.classList.remove(`cursor-pointer`)):e?(this.classList.add(`bg-white`,`dark:bg-mint-elevated`,`border-gray-200`,`dark:border-mint-divider`,`text-gray-900`,`dark:text-gray-100`,`shadow-sm`,`relative`,`z-10`),r?n===`left`?this.classList.add(`mr-[-1px]`):this.classList.add(`ml-[-1px]`):this.classList.add(`mb-[-1px]`)):this.classList.add(`bg-gray-100`,`dark:bg-mint-elevated`,`border-gray-200`,`dark:border-mint-divider`,`text-gray-600`,`dark:text-gray-400`,`hover:bg-gray-50`,`dark:hover:bg-mint-hover`)}setupEventListeners(){this.isDisabled()||this._clickHandler||(this._clickHandler=this.handleClick.bind(this),this.addEventListener(`click`,this._clickHandler))}removeEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null)}handleClick(e){if(this.isDisabled()){e.preventDefault(),e.stopPropagation();return}e.__mintTabsSynthetic||(e.stopPropagation(),this.dispatchEvent(new CustomEvent(`tab-click`,{detail:{tab:this,target:this.getTarget()},bubbles:!0,cancelable:!0,composed:!0})))}};customElements.get(`mint-tab`)||customElements.define(`mint-tab`,N);var P=class extends HTMLElement{static get observedAttributes(){return[`position`]}constructor(){super()}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getPosition(){return this.getAttribute(`position`)||`top`}render(){let e=this.getPosition();this.classList.remove(`flex`,`inline-flex`,`flex-row`,`flex-col`,`gap-1`,`gap-2`,`pb-0`,`pr-0`,`pl-0`,`mb-0`,`mr-0`,`ml-0`,`self-start`),this.classList.add(`box-border`,`m-0`,`p-1`,`border`,`bg-gray-100`,`dark:bg-mint-elevated`,`dark:border-mint-divider`,`border-gray-200`,`w-auto`,`rounded-lg`,`gap-2`),e===`top`?this.classList.add(`inline-flex`,`flex-row`,`mb-0`,`self-start`):e===`left`?this.classList.add(`flex`,`flex-col`,`mr-0`):e===`right`&&this.classList.add(`flex`,`flex-col`,`ml-0`)}};customElements.get(`mint-tab-list`)||customElements.define(`mint-tab-list`,P);var F=class extends HTMLElement{static get observedAttributes(){return[`id`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.checkInitialVisibility()}attributeChangedCallback(e,t,n){t!==n&&e===`id`&&(this.render(),this.checkInitialVisibility())}getId(){return this.getAttribute(`id`)||``}show(){this.style.display=`block`}hide(){this.style.display=`none`}checkInitialVisibility(){let e=this.closest(`mint-tabs`);if(!e){this.style.display=`none`;return}let t=e.querySelectorAll(`mint-tab`),n=!1;t.forEach(e=>{let t=e.getAttribute(`active`),r=e.getAttribute(`target`),i=this.getId();t===`true`&&r===i&&(n=!0)}),!n&&t.length>0&&t[0].getAttribute(`target`)===this.getId()&&!e.querySelector(`mint-tab[active="true"]`)&&(n=!0),n?this.style.display=`block`:this.style.display=`none`}render(){}};customElements.get(`mint-tab-content`)||customElements.define(`mint-tab-content`,F);var I=class extends HTMLElement{constructor(){super(),this._tabClickHandler=null,this._mutationObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`),this.render(),this.setupEventListeners(),this.setupMutationObserver(),this.initializeActiveTab()}disconnectedCallback(){this.removeEventListeners(),this._mutationObserver&&=(this._mutationObserver.disconnect(),null)}render(){let e=this.querySelector(`mint-tab-list`);if(this.querySelectorAll(`mint-tab-content`),!e){console.warn(`mint-tabs: mint-tab-list is required`);return}let t=e.getAttribute(`position`)||`top`;this.classList.remove(`flex`,`flex-row`,`flex-col`,`gap-4`,`gap-6`),t===`left`||t===`right`?(this.classList.add(`flex`,`flex-row`,`items-start`),t===`left`?(e.classList.add(`mr-4`,`flex-shrink-0`),e.classList.remove(`ml-4`)):(e.classList.add(`ml-4`,`flex-shrink-0`,`order-2`),e.classList.remove(`mr-4`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.add(`order-1`)}))):(this.classList.add(`flex`,`flex-col`),e.classList.remove(`mr-4`,`ml-4`,`flex-shrink-0`,`order-2`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.remove(`order-1`)}))}initializeActiveTab(){requestAnimationFrame(()=>{let e=this.querySelectorAll(`mint-tab`),t=null;if(e.forEach(e=>{e.getAttribute(`active`)===`true`&&(t=e)}),!t&&e.length>0&&(t=e[0],t.setAttribute(`active`,`true`)),t){let e=t.getAttribute(`target`);e?this.showContent(e):this.hideAllContent()}else this.hideAllContent();this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.checkInitialVisibility&&t.checkInitialVisibility()})})}hideAllContent(){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`})}showContent(e){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`});let t=this.querySelector(`mint-tab-content[id="${e}"]`);t&&(t.show?t.show():t.style.display=`block`)}setupEventListeners(){this._tabClickHandler||(this._tabClickHandler=this.handleTabClick.bind(this),this.addEventListener(`tab-click`,this._tabClickHandler))}removeEventListeners(){this._tabClickHandler&&=(this.removeEventListener(`tab-click`,this._tabClickHandler),null)}setupMutationObserver(){this._mutationObserver=new MutationObserver(()=>{this.render()});let e=this.querySelector(`mint-tab-list`);e&&this._mutationObserver.observe(e,{attributes:!0,attributeFilter:[`position`]})}handleTabClick(e){let t=e.detail?.tab,n=e.detail?.target;if(!t)return;let r=t.closest(`mint-tab-list`);r&&(r.querySelectorAll(`mint-tab`).forEach(e=>{let n=e;e===t?n.active=!0:n.active=!1}),n&&this.showContent(n))}};customElements.get(`mint-tabs`)||customElements.define(`mint-tabs`,I);var L=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.3,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#2563eb`,`#3b82f6`,`#0d9488`,`#7c3aed`,`#d97706`,`#059669`,`#dc2626`,`#c026d3`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`);let e=this._getReactiveValue(this.data);e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_getReactiveValue(e){if(!e||typeof e!=`object`)return e;if(`_value`in e||`__v_isRef`in e){if(e.value!==void 0)return e.value;if(`_value`in e)return e._value}return`__v_raw`in e||`__v_isReactive`in e||`__ob__`in e,e}_setupDataObserver(){let e=null,t=0,n=()=>{if(!this.isConnected)return;let t=this._getReactiveValue(this.data),n=null;t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(n=t),n!==e&&n&&(e=n,this._chartData=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n()})});let r=setInterval(()=>{if(!this.isConnected){clearInterval(r);return}if(n(),t++,t>50){clearInterval(r);let e=setInterval(()=>{if(!this.isConnected){clearInterval(e);return}n()},1e3);this._dataCheckInterval=e}},100);this._dataCheckInterval=r}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){t!==n&&(e===`data`&&this.data&&typeof this.data==`object`&&(this._chartData=this.data),(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()}))}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._renderScheduled||(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let e=this._getReactiveValue(this.data);if(e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let t=this.getBoundingClientRect(),n=t.width||this.parentElement?.clientWidth||800,r=t.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,n,n),this._height=this._calculateDimension(this._heightValue,r,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let i=this.getAttribute(`curve-tension`);if(i!==null){let e=parseFloat(i);this._curveTension=isNaN(e)?.3:Math.max(0,Math.min(1,e))}else this._curveTension=.3;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}switch(this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._chartContainer&&this._svg&&this._chartContainer.appendChild(this._svg),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine()}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.min(5,r),a=0;for(let t=0;t<=i;t++){let n=this._getYRange(),r=n.max-(n.max-n.min)/i*t,o=this._formatYAxisValue(r),s=e.measureText(o);a=Math.max(a,s.width)}return Math.ceil(a)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_escapeHtmlForTooltip(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}_tooltipXHeadingHtml(e){return`<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=this._tooltipXHeadingHtml(e),i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
97
+ `,document.head.appendChild(e)}}};customElements.get(`mint-off-canvas`)||customElements.define(`mint-off-canvas`,M);var N=class extends HTMLElement{static get observedAttributes(){return[`active`,`disabled`,`target`]}constructor(){super(),this._clickHandler=null}connectedCallback(){this.render(),this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getTarget(){return this.getAttribute(`target`)||``}isActive(){let e=this.getAttribute(`active`);return e!==null&&e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.setAttribute(`active`,`false`)}render(){let e=this.isActive(),t=this.isDisabled();this.className=``,this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`inline-block`,`cursor-pointer`,`px-4`,`py-1.5`,`text-sm`,`font-medium`,`rounded-lg`,`border`,`text-gray-700`,`dark:text-gray-300`);let n=this.closest(`mint-tab-list`)?.getAttribute(`position`)||`top`,r=n===`left`||n===`right`;t?(this.classList.add(`opacity-60`,`cursor-not-allowed`,`pointer-events-none`,`bg-gray-50`,`dark:bg-mint-elevated`,`border-gray-300`,`dark:border-mint-divider`,`text-gray-400`,`dark:text-gray-500`),this.classList.remove(`cursor-pointer`)):e?(this.classList.add(`bg-white`,`dark:bg-mint-elevated`,`border-gray-200`,`dark:border-mint-divider`,`text-gray-900`,`dark:text-gray-100`,`shadow-sm`,`relative`,`z-10`),r?n===`left`?this.classList.add(`mr-[-1px]`):this.classList.add(`ml-[-1px]`):this.classList.add(`mb-[-1px]`)):this.classList.add(`bg-gray-100`,`dark:bg-mint-elevated`,`border-gray-200`,`dark:border-mint-divider`,`text-gray-600`,`dark:text-gray-400`,`hover:bg-gray-50`,`dark:hover:bg-mint-hover`)}setupEventListeners(){this.isDisabled()||this._clickHandler||(this._clickHandler=this.handleClick.bind(this),this.addEventListener(`click`,this._clickHandler))}removeEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null)}handleClick(e){if(this.isDisabled()){e.preventDefault(),e.stopPropagation();return}e.__mintTabsSynthetic||(e.stopPropagation(),this.dispatchEvent(new CustomEvent(`tab-click`,{detail:{tab:this,target:this.getTarget()},bubbles:!0,cancelable:!0,composed:!0})))}};customElements.get(`mint-tab`)||customElements.define(`mint-tab`,N);var P=class extends HTMLElement{static get observedAttributes(){return[`position`]}constructor(){super()}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getPosition(){return this.getAttribute(`position`)||`top`}render(){let e=this.getPosition();this.classList.remove(`flex`,`inline-flex`,`flex-row`,`flex-col`,`gap-1`,`gap-2`,`pb-0`,`pr-0`,`pl-0`,`mb-0`,`mr-0`,`ml-0`,`self-start`),this.classList.add(`box-border`,`m-0`,`p-1`,`border`,`bg-gray-100`,`dark:bg-mint-elevated`,`dark:border-mint-divider`,`border-gray-200`,`w-auto`,`rounded-lg`,`gap-2`),e===`top`?this.classList.add(`inline-flex`,`flex-row`,`mb-0`,`self-start`):e===`left`?this.classList.add(`flex`,`flex-col`,`mr-0`):e===`right`&&this.classList.add(`flex`,`flex-col`,`ml-0`)}};customElements.get(`mint-tab-list`)||customElements.define(`mint-tab-list`,P);var F=class extends HTMLElement{static get observedAttributes(){return[`id`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.checkInitialVisibility()}attributeChangedCallback(e,t,n){t!==n&&e===`id`&&(this.render(),this.checkInitialVisibility())}getId(){return this.getAttribute(`id`)||``}show(){this.style.display=`block`}hide(){this.style.display=`none`}checkInitialVisibility(){let e=this.closest(`mint-tabs`);if(!e){this.style.display=`none`;return}let t=e.querySelectorAll(`mint-tab`),n=!1;t.forEach(e=>{let t=e.getAttribute(`active`),r=e.getAttribute(`target`),i=this.getId();t===`true`&&r===i&&(n=!0)}),!n&&t.length>0&&t[0].getAttribute(`target`)===this.getId()&&!e.querySelector(`mint-tab[active="true"]`)&&(n=!0),n?this.style.display=`block`:this.style.display=`none`}render(){}};customElements.get(`mint-tab-content`)||customElements.define(`mint-tab-content`,F);var I=class extends HTMLElement{constructor(){super(),this._tabClickHandler=null,this._mutationObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`),this.render(),this.setupEventListeners(),this.setupMutationObserver(),this.initializeActiveTab()}disconnectedCallback(){this.removeEventListeners(),this._mutationObserver&&=(this._mutationObserver.disconnect(),null)}render(){let e=this.querySelector(`mint-tab-list`);if(this.querySelectorAll(`mint-tab-content`),!e){console.warn(`mint-tabs: mint-tab-list is required`);return}let t=e.getAttribute(`position`)||`top`;this.classList.remove(`flex`,`flex-row`,`flex-col`,`gap-4`,`gap-6`),t===`left`||t===`right`?(this.classList.add(`flex`,`flex-row`,`items-start`),t===`left`?(e.classList.add(`mr-4`,`flex-shrink-0`),e.classList.remove(`ml-4`)):(e.classList.add(`ml-4`,`flex-shrink-0`,`order-2`),e.classList.remove(`mr-4`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.add(`order-1`)}))):(this.classList.add(`flex`,`flex-col`),e.classList.remove(`mr-4`,`ml-4`,`flex-shrink-0`,`order-2`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.remove(`order-1`)}))}initializeActiveTab(){requestAnimationFrame(()=>{let e=this.querySelectorAll(`mint-tab`),t=null;if(e.forEach(e=>{e.getAttribute(`active`)===`true`&&(t=e)}),!t&&e.length>0&&(t=e[0],t.setAttribute(`active`,`true`)),t){let e=t.getAttribute(`target`);e?this.showContent(e):this.hideAllContent()}else this.hideAllContent();this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.checkInitialVisibility&&t.checkInitialVisibility()})})}hideAllContent(){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`})}showContent(e){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`});let t=this.querySelector(`mint-tab-content[id="${e}"]`);t&&(t.show?t.show():t.style.display=`block`)}setupEventListeners(){this._tabClickHandler||(this._tabClickHandler=this.handleTabClick.bind(this),this.addEventListener(`tab-click`,this._tabClickHandler))}removeEventListeners(){this._tabClickHandler&&=(this.removeEventListener(`tab-click`,this._tabClickHandler),null)}setupMutationObserver(){this._mutationObserver=new MutationObserver(()=>{this.render()});let e=this.querySelector(`mint-tab-list`);e&&this._mutationObserver.observe(e,{attributes:!0,attributeFilter:[`position`]})}handleTabClick(e){let t=e.detail?.tab,n=e.detail?.target;if(!t)return;let r=t.closest(`mint-tab-list`);r&&(r.querySelectorAll(`mint-tab`).forEach(e=>{let n=e;e===t?n.active=!0:n.active=!1}),n&&this.showContent(n))}};customElements.get(`mint-tabs`)||customElements.define(`mint-tabs`,I);var L=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.5,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#2563eb`,`#3b82f6`,`#0d9488`,`#7c3aed`,`#d97706`,`#059669`,`#dc2626`,`#c026d3`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`);let e=this._getReactiveValue(this.data);e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_getReactiveValue(e){if(!e||typeof e!=`object`)return e;if(`_value`in e||`__v_isRef`in e){if(e.value!==void 0)return e.value;if(`_value`in e)return e._value}return`__v_raw`in e||`__v_isReactive`in e||`__ob__`in e,e}_setupDataObserver(){let e=null,t=0,n=()=>{if(!this.isConnected)return;let t=this._getReactiveValue(this.data),n=null;t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(n=t),n!==e&&n&&(e=n,this._chartData=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n()})});let r=setInterval(()=>{if(!this.isConnected){clearInterval(r);return}if(n(),t++,t>50){clearInterval(r);let e=setInterval(()=>{if(!this.isConnected){clearInterval(e);return}n()},1e3);this._dataCheckInterval=e}},100);this._dataCheckInterval=r}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){t!==n&&(e===`data`&&this.data&&typeof this.data==`object`&&(this._chartData=this.data),(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()}))}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._renderScheduled||(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let e=this._getReactiveValue(this.data);if(e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let t=this.getBoundingClientRect(),n=t.width||this.parentElement?.clientWidth||800,r=t.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,n,n),this._height=this._calculateDimension(this._heightValue,r,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let i=this.getAttribute(`curve-tension`);if(i!==null){let e=parseFloat(i);this._curveTension=isNaN(e)?.5:Math.max(0,Math.min(1,e))}else this._curveTension=.5;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}switch(this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._chartContainer&&this._svg&&this._chartContainer.appendChild(this._svg),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine()}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.min(5,r),a=0;for(let t=0;t<=i;t++){let n=this._getYRange(),r=n.max-(n.max-n.min)/i*t,o=this._formatYAxisValue(r),s=e.measureText(o);a=Math.max(a,s.width)}return Math.ceil(a)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_escapeHtmlForTooltip(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}_tooltipXHeadingHtml(e){return`<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=this._tooltipXHeadingHtml(e),i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
98
98
  <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
99
99
  <span>${e.name}: ${e.formattedValue}</span>
100
100
  </div>`}),this._cachedTooltipContent.set(e,a)),this._updateTooltipPosition(n,r),this._lastTooltipContent!==a&&this._showTooltipAt(n,r,a);return}}if(this._activeXValue===s){this._updateTooltipPosition(n,r);return}let c=this._getAllDatasetsAtX(s);if(c.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=s,this._showPlotPointsForX(s),this._showVerticalLineAtX(s,t);let l=this._cachedTooltipContent.get(s);if(!l){if(l=this._tooltipXHeadingHtml(s),c.forEach(e=>{l+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
@@ -115,10 +115,10 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
115
115
  </div>`}),this._cachedTooltipContent.set(e,i)),this._updateTooltipPosition(r.clientX,r.clientY),this._lastTooltipContent!==i&&this._showTooltipAt(r.clientX,r.clientY,i);return}}let o=this._findNearestXValue(i);if(!o){this._pinnedXValue===null&&(this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null);return}if(this._activeXValue===o){this._updateTooltipPosition(r.clientX,r.clientY);return}let s=this._getAllDatasetsAtX(o);if(s.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=o,this._showPlotPointsForX(o),this._showVerticalLineAtX(o,t);let c=this._cachedTooltipContent.get(o);if(!c){if(c=this._tooltipXHeadingHtml(o),s.forEach(e=>{c+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
116
116
  <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
117
117
  <span>${e.name}: ${e.formattedValue}</span>
118
- </div>`}),this._cachedTooltipContent.size>=e.MAX_CACHE_SIZE){let e=this._cachedTooltipContent.keys().next().value;e!==void 0&&this._cachedTooltipContent.delete(e)}this._cachedTooltipContent.set(o,c)}this._showTooltipAt(r.clientX,r.clientY,c)}))},l=()=>{this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._pinnedXValue===null&&setTimeout(()=>{this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null},500)};this._chartClickOutsideHandler||(this._chartClickOutsideHandler=e=>{if(this._pinnedXValue===null)return;let t=e.target;this._svg&&!this._svg.contains(t)&&(this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null)},document.addEventListener(`click`,this._chartClickOutsideHandler,!0)),this._svg.addEventListener(`mousemove`,i),this._svg.addEventListener(`mouseleave`,a),this._svg.addEventListener(`click`,o),this._svg.addEventListener(`touchstart`,s,{passive:!0}),this._svg.addEventListener(`touchmove`,c,{passive:!0}),this._svg.addEventListener(`touchend`,l),this._chartTooltipMouseMove=i,this._chartTooltipMouseLeave=a,this._chartTooltipClick=o,this._chartTooltipTouchStart=s,this._chartTooltipTouchMove=c,this._chartTooltipTouchEnd=l}_updateTooltipPosition(e,t){if(!this._tooltip||this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)return;let n=this._tooltip.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=e+10,o=t-n.height-8;a+n.width>r&&(a=e-n.width-10),a<0&&(a=10),o<0&&(o=t+20),o+n.height>i&&(o=t-n.height-8,o<0&&(o=10));let s=`${a}px`,c=`${o}px`;this._tooltip.style.left!==s&&(this._tooltip.style.left=s),this._tooltip.style.top!==c&&(this._tooltip.style.top=c)}_scaleX(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=t.width/Math.max(1,n.length-1);return t.x+r*i}_scaleY(e,t){let n=this._getYRange();if(n.max===n.min)return t.y+t.height/2;let r=(e-n.min)/(n.max-n.min);return t.y+t.height-r*t.height}_getDatasetColor(e,t,n){return n===void 0?e.color||this._defaultColors[t%this._defaultColors.length]:e.color||this._defaultColors[n%this._defaultColors.length]}_getContrastColor(e){let t=e.replace(`#`,``),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return(.299*n+.587*r+.114*i)/255>.5?`#000000`:`#ffffff`}_calculateRotatedLabelHeight(){if(this._rotatedLabelHeight=0,!this._chartData||!this._showGrid)return;let e=this._getXValues();if(e.length<=1)return;let t={width:this._width-(this._showGrid?60:0)-0,height:this._height-(this._showLegend?Math.max(this._legendHeight,60):0)-0,x:this._showGrid?60:0,y:0},n=this._chartType===`bar`,r=[];e.forEach(e=>{let i=n?this._scaleXForBarChart(e,t):this._scaleX(e,t);r.push(i)});let i=document.createElement(`canvas`).getContext(`2d`);if(!i)return;i.font=`12px system-ui, -apple-system, sans-serif`;let a=[];e.forEach(e=>{let t=this._formatXAxisValue(e),n=i.measureText(t);a.push(n.width)});let o=!0;for(let t=1;t<e.length;t++){let e=r[t]-r[t-1],n=a[t-1]/2+a[t]/2+10;if(e<Math.max(n,80)){o=!1;break}}if(!o){let e=(Math.max(...a)+12*1.2)*.707;this._rotatedLabelHeight=Math.ceil(e)+10}}_renderGrid(e){if(!this._svg||!this._showGrid)return;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-grid`);let n=this._getYRange(),r=Math.floor(e.height/35),i=Math.min(5,r);for(let r=0;r<=i;r++){let a=e.y+e.height/i*r,o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,e.x.toString()),o.setAttribute(`y1`,a.toString()),o.setAttribute(`x2`,(e.x+e.width).toString()),o.setAttribute(`y2`,a.toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let s=n.max-(n.max-n.min)/i*r,c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),l=a+4;r===0&&(l=a+12),c.setAttribute(`x`,`5`),c.setAttribute(`y`,l.toString()),c.setAttribute(`text-anchor`,`start`),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),c.textContent=this._formatYAxisValue(s),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}let a=this._getXValues();if(a.length===0){this._svg.appendChild(t);return}let o=this._chartType===`bar`,s=[];a.forEach(t=>{let n=o?this._scaleXForBarChart(t,e):this._scaleX(t,e);s.push(n)});let c=document.createElement(`canvas`).getContext(`2d`),l=!1,u=Array(a.length).fill(!0);if(c&&a.length>1){c.font=`12px system-ui, -apple-system, sans-serif`;let e=[];a.forEach(t=>{let n=this._formatXAxisValue(t),r=c.measureText(n);e.push(r.width)});let t=!0;for(let n=1;n<a.length;n++){let r=s[n]-s[n-1],i=e[n-1]/2+e[n]/2+10;if(r<Math.max(i,80)){t=!1;break}}if(!t){l=!0;let t=12*1.2;if(this._rotatedLabelHeight===0){let n=(Math.max(...e)+t)*.707;this._rotatedLabelHeight=Math.ceil(n)+10}let n=t*1.5,r=!0;for(let e=1;e<a.length;e++)if(s[e]-s[e-1]<n){r=!1;break}if(!r){let e=n;u=Array(a.length).fill(!1);let t=-1/0;a.length>0&&(u[0]=!0,t=s[0]);for(let n=1;n<a.length-1;n++){let r=s[n];r-t>=e&&(u[n]=!0,t=r)}if(a.length>1){let n=s[a.length-1];if(n-t>=e)u[a.length-1]=!0;else{for(;n-t<e;){let e=!1;for(let n=a.length-2;n>=0;n--)if(u[n]){if(u[n]=!1,n>0){for(let r=n-1;r>=0;r--)if(u[r]){t=s[r],e=!0;break}e||(t=s[0])}else t=s[0];e=!0;break}if(!e)break}n-t>=e&&(u[a.length-1]=!0)}}}}}else u=Array(a.length).fill(!1),a.length>0&&(u[0]=!0),a.length>1&&(u[a.length-1]=!0),this._rotatedLabelHeight=0;l||(this._rotatedLabelHeight=0),a.forEach((n,r)=>{if(u[r]){let i=s[r],o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,i.toString()),o.setAttribute(`y1`,e.y.toString()),o.setAttribute(`x2`,i.toString()),o.setAttribute(`y2`,(e.y+e.height).toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),u=i,d=`middle`;if(!l){if(r===0){let t=e.x;u=Math.max(i,t),d=`start`}else if(r===a.length-1){let t=e.x+e.width;u=Math.min(i,t),d=`end`}}else if(d=`end`,r===a.length-1){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`12px system-ui, -apple-system, sans-serif`;let r=this._formatXAxisValue(n),a=t.measureText(r).width*.707,o=e.x+e.width+100;u=Math.min(i,o-a)}}c.setAttribute(`x`,u.toString());let f=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,p=f;this._showLegend&&(p=f+20+Math.max(this._legendHeight,60));let m=(this._height-e.y-e.height)/p,h=(l?30:20)*m,g=e.y+e.height+h;c.setAttribute(`y`,g.toString()),c.setAttribute(`text-anchor`,d),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),l&&c.setAttribute(`transform`,`rotate(-45 ${u} ${g})`),c.textContent=this._formatXAxisValue(n),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}}),this._svg.appendChild(t)}_renderLineChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),o=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(o.length===0)return;let s=[`M ${o[0].x} ${o[0].y}`];for(let e=1;e<o.length;e++)s.push(`L ${o[e].x} ${o[e].y}`);a.setAttribute(`d`,s.join(` `)),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,i),a.setAttribute(`stroke-width`,`2`),a.setAttribute(`stroke-linecap`,`round`),a.setAttribute(`stroke-linejoin`,`round`),n.appendChild(a),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_scaleXForBarChart(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=n.length+1,a=t.width/i;return t.x+(r+1)*a}_renderBarChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment(),r=this._getXValues(),i=this._chartData.datasets.filter((e,t)=>this._isDatasetVisible(e,t)).length,a=r.length;if(a===0)return;let o=[];r.forEach(t=>{o.push(this._scaleXForBarChart(t,e))}),o.sort((e,t)=>e-t);let s=e.width;if(a>1)for(let e=0;e<o.length-1;e++){let t=o[e+1]-o[e];t>0&&t<s&&(s=t)}else s=e.width*.5;let c=s*.7,l=.2,u=c/((1+l)*i-l),d=u*l,f=(u+d)*i-d;if(f>c){let e=c/f;u*=e,d=u*l,f=(u+d)*i-d}let p=0;this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=-f/2+(u+d)*p;p++,t.data.forEach(o=>{let s=this._scaleXForBarChart(o.x,e),c=this._scaleY(o.y,e),l=e.y+e.height-c,d=s+a,f=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);f.setAttribute(`x`,d.toString()),f.setAttribute(`y`,c.toString()),f.setAttribute(`width`,u.toString()),f.setAttribute(`height`,l.toString()),f.setAttribute(`fill`,i),f.setAttribute(`rx`,`2`),f.setAttribute(`class`,`chart-bar`),f.setAttribute(`data-dataset`,r.toString()),f.setAttribute(`data-x`,String(o.x)),f.setAttribute(`data-y`,o.y.toString()),f.setAttribute(`data-name`,t.name),f.style.cursor=`pointer`,this._showTooltip&&f.addEventListener(`mouseenter`,e=>{let t=this._getAllDatasetsAtX(o.x),n=this._tooltipXHeadingHtml(o.x);t.forEach(e=>{n+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
118
+ </div>`}),this._cachedTooltipContent.size>=e.MAX_CACHE_SIZE){let e=this._cachedTooltipContent.keys().next().value;e!==void 0&&this._cachedTooltipContent.delete(e)}this._cachedTooltipContent.set(o,c)}this._showTooltipAt(r.clientX,r.clientY,c)}))},l=()=>{this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._pinnedXValue===null&&setTimeout(()=>{this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null},500)};this._chartClickOutsideHandler||(this._chartClickOutsideHandler=e=>{if(this._pinnedXValue===null)return;let t=e.target;this._svg&&!this._svg.contains(t)&&(this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null)},document.addEventListener(`click`,this._chartClickOutsideHandler,!0)),this._svg.addEventListener(`mousemove`,i),this._svg.addEventListener(`mouseleave`,a),this._svg.addEventListener(`click`,o),this._svg.addEventListener(`touchstart`,s,{passive:!0}),this._svg.addEventListener(`touchmove`,c,{passive:!0}),this._svg.addEventListener(`touchend`,l),this._chartTooltipMouseMove=i,this._chartTooltipMouseLeave=a,this._chartTooltipClick=o,this._chartTooltipTouchStart=s,this._chartTooltipTouchMove=c,this._chartTooltipTouchEnd=l}_updateTooltipPosition(e,t){if(!this._tooltip||this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)return;let n=this._tooltip.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=e+10,o=t-n.height-8;a+n.width>r&&(a=e-n.width-10),a<0&&(a=10),o<0&&(o=t+20),o+n.height>i&&(o=t-n.height-8,o<0&&(o=10));let s=`${a}px`,c=`${o}px`;this._tooltip.style.left!==s&&(this._tooltip.style.left=s),this._tooltip.style.top!==c&&(this._tooltip.style.top=c)}_scaleX(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=t.width/Math.max(1,n.length-1);return t.x+r*i}_scaleY(e,t){let n=this._getYRange();if(n.max===n.min)return t.y+t.height/2;let r=(e-n.min)/(n.max-n.min);return t.y+t.height-r*t.height}_getDatasetColor(e,t,n){return n===void 0?e.color||this._defaultColors[t%this._defaultColors.length]:e.color||this._defaultColors[n%this._defaultColors.length]}_getContrastColor(e){let t=e.replace(`#`,``),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return(.299*n+.587*r+.114*i)/255>.5?`#000000`:`#ffffff`}_calculateRotatedLabelHeight(){if(this._rotatedLabelHeight=0,!this._chartData||!this._showGrid)return;let e=this._getXValues();if(e.length<=1)return;let t={width:this._width-(this._showGrid?60:0)-0,height:this._height-(this._showLegend?Math.max(this._legendHeight,60):0)-0,x:this._showGrid?60:0,y:0},n=this._chartType===`bar`,r=[];e.forEach(e=>{let i=n?this._scaleXForBarChart(e,t):this._scaleX(e,t);r.push(i)});let i=document.createElement(`canvas`).getContext(`2d`);if(!i)return;i.font=`12px system-ui, -apple-system, sans-serif`;let a=[];e.forEach(e=>{let t=this._formatXAxisValue(e),n=i.measureText(t);a.push(n.width)});let o=!0;for(let t=1;t<e.length;t++){let e=r[t]-r[t-1],n=a[t-1]/2+a[t]/2+10;if(e<Math.max(n,80)){o=!1;break}}if(!o){let e=(Math.max(...a)+12*1.2)*.707;this._rotatedLabelHeight=Math.ceil(e)+10}}_renderGrid(e){if(!this._svg||!this._showGrid)return;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-grid`);let n=this._getYRange(),r=Math.floor(e.height/35),i=Math.min(5,r);for(let r=0;r<=i;r++){let a=e.y+e.height/i*r,o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,e.x.toString()),o.setAttribute(`y1`,a.toString()),o.setAttribute(`x2`,(e.x+e.width).toString()),o.setAttribute(`y2`,a.toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let s=n.max-(n.max-n.min)/i*r,c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),l=a+4;r===0&&(l=a+12),c.setAttribute(`x`,`5`),c.setAttribute(`y`,l.toString()),c.setAttribute(`text-anchor`,`start`),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),c.textContent=this._formatYAxisValue(s),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}let a=this._getXValues();if(a.length===0){this._svg.appendChild(t);return}let o=this._chartType===`bar`,s=[];a.forEach(t=>{let n=o?this._scaleXForBarChart(t,e):this._scaleX(t,e);s.push(n)});let c=document.createElement(`canvas`).getContext(`2d`),l=!1,u=Array(a.length).fill(!0);if(c&&a.length>1){c.font=`12px system-ui, -apple-system, sans-serif`;let e=[];a.forEach(t=>{let n=this._formatXAxisValue(t),r=c.measureText(n);e.push(r.width)});let t=!0;for(let n=1;n<a.length;n++){let r=s[n]-s[n-1],i=e[n-1]/2+e[n]/2+10;if(r<Math.max(i,80)){t=!1;break}}if(!t){l=!0;let t=12*1.2;if(this._rotatedLabelHeight===0){let n=(Math.max(...e)+t)*.707;this._rotatedLabelHeight=Math.ceil(n)+10}let n=t*1.5,r=!0;for(let e=1;e<a.length;e++)if(s[e]-s[e-1]<n){r=!1;break}if(!r){let e=n;u=Array(a.length).fill(!1);let t=-1/0;a.length>0&&(u[0]=!0,t=s[0]);for(let n=1;n<a.length-1;n++){let r=s[n];r-t>=e&&(u[n]=!0,t=r)}if(a.length>1){let n=s[a.length-1];if(n-t>=e)u[a.length-1]=!0;else{for(;n-t<e;){let e=!1;for(let n=a.length-2;n>=0;n--)if(u[n]){if(u[n]=!1,n>0){for(let r=n-1;r>=0;r--)if(u[r]){t=s[r],e=!0;break}e||(t=s[0])}else t=s[0];e=!0;break}if(!e)break}n-t>=e&&(u[a.length-1]=!0)}}}}}else u=Array(a.length).fill(!1),a.length>0&&(u[0]=!0),a.length>1&&(u[a.length-1]=!0),this._rotatedLabelHeight=0;l||(this._rotatedLabelHeight=0),a.forEach((n,r)=>{if(u[r]){let i=s[r],o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,i.toString()),o.setAttribute(`y1`,e.y.toString()),o.setAttribute(`x2`,i.toString()),o.setAttribute(`y2`,(e.y+e.height).toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),u=i,d=`middle`;if(!l){if(r===0){let t=e.x;u=Math.max(i,t),d=`start`}else if(r===a.length-1){let t=e.x+e.width;u=Math.min(i,t),d=`end`}}else if(d=`end`,r===a.length-1){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`12px system-ui, -apple-system, sans-serif`;let r=this._formatXAxisValue(n),a=t.measureText(r).width*.707,o=e.x+e.width+100;u=Math.min(i,o-a)}}c.setAttribute(`x`,u.toString());let f=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,p=f;this._showLegend&&(p=f+20+Math.max(this._legendHeight,60));let m=(this._height-e.y-e.height)/p,h=(l?30:20)*m,g=e.y+e.height+h;c.setAttribute(`y`,g.toString()),c.setAttribute(`text-anchor`,d),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),l&&c.setAttribute(`transform`,`rotate(-45 ${u} ${g})`),c.textContent=this._formatXAxisValue(n),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}}),this._svg.appendChild(t)}_buildMonotoneXLinePathD(e){let t=e=>e<0?-1:1,n=(e,n,r,i,a,o)=>{let s=r-e,c=a-r,l=(i-n)/(s||c<0&&-0),u=(o-i)/(c||s<0&&-0),d=(l*c+u*s)/(s+c||1e-12);return(t(l)+t(u))*Math.min(Math.abs(l),Math.abs(u),.5*Math.abs(d))||0},r=(e,t,n,r,i)=>{let a=n-e;return a?(3*((r-t)/a)-i)/2:i},i=(e,t,n,r,i,a,o)=>{let s=(r-t)/3;e.push(`C ${t+s} ${n+s*a} ${r-s} ${i-s*o} ${r} ${i}`)},a=[];for(let t of e){let e=a[a.length-1];(!e||e.x!==t.x||e.y!==t.y)&&a.push(t)}if(a.length===0)return``;if(a.length===1)return`M ${a[0].x} ${a[0].y}`;let o=[],s=NaN,c=NaN,l=NaN,u=NaN,d=NaN,f=0;for(let e of a){let t=e.x,a=e.y;if(!(t===l&&a===u))switch(f){case 0:o.push(`M ${t} ${a}`),s=t,c=a,l=t,u=a,f=1;break;case 1:l=t,u=a,f=2;break;case 2:{let e=n(s,c,l,u,t,a);i(o,s,c,l,u,r(s,c,l,u,e),e),s=l,c=u,l=t,u=a,d=e,f=3;break}default:{let e=n(s,c,l,u,t,a);i(o,s,c,l,u,d,e),s=l,c=u,l=t,u=a,d=e}}}return f===2?o.push(`L ${l} ${u}`):f===3&&i(o,s,c,l,u,d,r(s,c,l,u,d)),o.join(` `)}_stripLeadingMoveTo(e){return e.replace(/^M\s+[\d.-]+\s+[\d.-]+\s*/i,``).trim()}_buildAreaFillPathD(e,t){if(e.length===0)return``;let n=e[e.length-1];if(e.length===1)return`M ${e[0].x} ${t} L ${e[0].x} ${e[0].y} L ${e[0].x} ${t} Z`;if(this._curveTension<=0){let r=[`M ${e[0].x} ${t}`,`L ${e[0].x} ${e[0].y}`];for(let t=1;t<e.length;t++)r.push(`L ${e[t].x} ${e[t].y}`);return r.push(`L ${n.x} ${t}`,`Z`),r.join(` `)}let r=this._buildMonotoneXLinePathD(e),i=this._stripLeadingMoveTo(r);return`M ${e[0].x} ${t} L ${e[0].x} ${e[0].y} ${i} L ${n.x} ${t} Z`}_buildSmoothLinePathD(e){if(e.length===0)return``;if(e.length===1)return`M ${e[0].x} ${e[0].y}`;if(this._curveTension<=0){let t=[`M ${e[0].x} ${e[0].y}`];for(let n=1;n<e.length;n++)t.push(`L ${e[n].x} ${e[n].y}`);return t.join(` `)}return this._buildMonotoneXLinePathD(e)}_renderLineChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),o=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));o.length!==0&&(a.setAttribute(`d`,this._buildSmoothLinePathD(o)),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,i),a.setAttribute(`stroke-width`,`2`),a.setAttribute(`stroke-linecap`,`round`),a.setAttribute(`stroke-linejoin`,`round`),n.appendChild(a),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)}))}),t.appendChild(n),this._svg.appendChild(t)}_scaleXForBarChart(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=n.length+1,a=t.width/i;return t.x+(r+1)*a}_renderBarChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment(),r=this._getXValues(),i=this._chartData.datasets.filter((e,t)=>this._isDatasetVisible(e,t)).length,a=r.length;if(a===0)return;let o=[];r.forEach(t=>{o.push(this._scaleXForBarChart(t,e))}),o.sort((e,t)=>e-t);let s=e.width;if(a>1)for(let e=0;e<o.length-1;e++){let t=o[e+1]-o[e];t>0&&t<s&&(s=t)}else s=e.width*.5;let c=s*.7,l=.2,u=c/((1+l)*i-l),d=u*l,f=(u+d)*i-d;if(f>c){let e=c/f;u*=e,d=u*l,f=(u+d)*i-d}let p=0;this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=-f/2+(u+d)*p;p++,t.data.forEach(o=>{let s=this._scaleXForBarChart(o.x,e),c=this._scaleY(o.y,e),l=e.y+e.height-c,d=s+a,f=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);f.setAttribute(`x`,d.toString()),f.setAttribute(`y`,c.toString()),f.setAttribute(`width`,u.toString()),f.setAttribute(`height`,l.toString()),f.setAttribute(`fill`,i),f.setAttribute(`rx`,`2`),f.setAttribute(`class`,`chart-bar`),f.setAttribute(`data-dataset`,r.toString()),f.setAttribute(`data-x`,String(o.x)),f.setAttribute(`data-y`,o.y.toString()),f.setAttribute(`data-name`,t.name),f.style.cursor=`pointer`,this._showTooltip&&f.addEventListener(`mouseenter`,e=>{let t=this._getAllDatasetsAtX(o.x),n=this._tooltipXHeadingHtml(o.x);t.forEach(e=>{n+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
119
119
  <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
120
120
  <span>${e.name}: ${e.formattedValue}</span>
121
- </div>`}),this._showTooltipAt(e.clientX,e.clientY,n)}),n.appendChild(f)})}),t.appendChild(n),this._svg.appendChild(t)}_renderAreaChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(a.length===0)return;let o=e.y+e.height,s=[`M ${a[0].x} ${o}`,`L ${a[0].x} ${a[0].y}`];for(let e=1;e<a.length;e++)s.push(`L ${a[e].x} ${a[e].y}`);let c=a[a.length-1];s.push(`L ${c.x} ${o}`,`Z`);let l=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);l.setAttribute(`d`,s.join(` `)),l.setAttribute(`fill`,i),l.setAttribute(`fill-opacity`,`0.3`),n.appendChild(l);let u=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(a.length===0)return;let d=[`M ${a[0].x} ${a[0].y}`];for(let e=1;e<a.length;e++)d.push(`L ${a[e].x} ${a[e].y}`);u.setAttribute(`d`,d.join(` `)),u.setAttribute(`fill`,`none`),u.setAttribute(`stroke`,i),u.setAttribute(`stroke-width`,`2`),n.appendChild(u),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_renderPieChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds(),t=e.x+e.width/2,n=e.y+e.height/2,r=Math.min(e.width,e.height)/2-20,i=this._chartData.datasets[0];if(!i||!i.data||i.data.length===0)return;let a=i.data.reduce((e,t)=>e+t.y,0);if(a===0)return;let o=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);o.setAttribute(`class`,`chart-data`),this._pieChartGroup=o,this._pieChartClickOutsideHandler||(this._pieChartClickOutsideHandler=e=>{if(!this._pieChartTooltipShown)return;let t=e.target;this._pieChartGroup&&!this._pieChartGroup.contains(t)&&(this._pieChartTooltipShown=!1,this._hideTooltip())},document.addEventListener(`click`,this._pieChartClickOutsideHandler,!0));let s=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);s.setAttribute(`cx`,t.toString()),s.setAttribute(`cy`,n.toString()),s.setAttribute(`r`,r.toString()),s.setAttribute(`fill`,`transparent`),s.setAttribute(`pointer-events`,`none`),o.appendChild(s);let c=-Math.PI/2;i.data.forEach((e,s)=>{let l=e.y,u=l/a*100,d=l/a*2*Math.PI,f=e.color||this._getDatasetColor(i,0,s),p=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);p.setAttribute(`class`,`chart-pie-slice-group`),p.setAttribute(`data-index`,s.toString()),p.style.cursor=`pointer`,p.style.transition=`transform 0.2s ease-out`;let m=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),h=r+2,g=t+h*Math.cos(c),_=n+h*Math.sin(c),v=t+h*Math.cos(c+d),y=n+h*Math.sin(c+d),b=d>Math.PI?1:0,x=[`M ${t} ${n}`,`L ${g} ${_}`,`A ${h} ${h} 0 ${b} 1 ${v} ${y}`,`Z`].join(` `);m.setAttribute(`d`,x),m.setAttribute(`fill`,f),m.setAttribute(`class`,`chart-pie-slice`),m.setAttribute(`data-index`,s.toString()),m.setAttribute(`data-x`,String(e.x)),m.setAttribute(`data-y`,e.y.toString()),m.setAttribute(`data-name`,i.name),m.setAttribute(`data-percentage`,u.toFixed(1)),p.appendChild(m);let S=c+d/2,C=Math.cos(S)*10,w=Math.sin(S)*10,T=null,E=null,D=!1;if(p.__chartInstance=this,p.addEventListener(`mouseenter`,function(){if(E!==null&&(clearTimeout(E),E=null),!D){T!==null&&clearTimeout(T);let e=window.setTimeout(()=>{D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`),T=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},150);T=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`mouseleave`,function(){if(T!==null&&(clearTimeout(T),T=null),D){E!==null&&clearTimeout(E);let e=window.setTimeout(()=>{D=!1,this.setAttribute(`transform`,`translate(0, 0)`),E=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},200);E=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,function(){T!==null&&(clearTimeout(T),T=null),E!==null&&(clearTimeout(E),E=null),D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`)}),this._showTooltip){let t=null,n=null,r=!1;p.addEventListener(`mouseenter`,a=>{if(n!==null&&(clearTimeout(n),n=null),!r){t!==null&&clearTimeout(t);let n=window.setTimeout(()=>{r=!0,this._pieChartTooltipShown=!0;let o=this._formatValue(l,i),s=`${this._tooltipXHeadingHtml(e.x)}${i.name}: ${o}<br/>${u.toFixed(1)}%`;this._showTooltipAt(a.clientX,a.clientY,s),t=null,this._pieChartTimeouts.delete(n)},150);t=n,this._pieChartTimeouts.add(n)}}),p.addEventListener(`mouseleave`,()=>{if(t!==null&&(clearTimeout(t),t=null),r){n!==null&&clearTimeout(n);let e=window.setTimeout(()=>{r=!1,this._pieChartTooltipShown=!1,this._hideTooltip(),n=null,this._pieChartTimeouts.delete(e)},200);n=e,this._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,a=>{a.stopPropagation(),t!==null&&(clearTimeout(t),t=null),n!==null&&(clearTimeout(n),n=null),r=!0,this._pieChartTooltipShown=!0;let o=this._formatValue(l,i),s=`${this._tooltipXHeadingHtml(e.x)}${i.name}: ${o}<br/>${u.toFixed(1)}%`;this._showTooltipAt(a.clientX,a.clientY,s)})}if(u>5){let e=c+d/2,i=r*.7,a=t+i*Math.cos(e),o=n+i*Math.sin(e),s=this._getContrastColor(f),l=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);l.setAttribute(`x`,a.toString()),l.setAttribute(`y`,o.toString()),l.setAttribute(`text-anchor`,`middle`),l.setAttribute(`dominant-baseline`,`middle`),l.setAttribute(`fill`,s),l.setAttribute(`font-size`,`12`),l.setAttribute(`font-weight`,`500`),l.textContent=`${u.toFixed(1)}%`,p.appendChild(l)}o.appendChild(p),c+=d}),this._svg.appendChild(o)}_calculateLegendHeight(){if(!this._chartData)return 0;let e=this._width-40,t=[];this._chartType===`pie`&&this._chartData.datasets.length>0?this._chartData.datasets[0].data.forEach(e=>{t.push({name:String(e.x),row:0})}):this._chartData.datasets.forEach(e=>{t.push({name:e.name,row:0})});let n=0,r=[];return t.forEach(t=>{let i=20+Math.min(t.name.length*7.5,150);r[n]||(r[n]=[]),r[n].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+i>e&&r[n].length>0&&(n++,r[n]=[]),t.row=n,r[n].push(t)}),r.length*36}_renderLegend(){if(!this._chartData||!this._svg)return{height:0};let e=this._svg.querySelector(`.chart-legend`);e&&e.remove();let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);if(t.setAttribute(`class`,`chart-legend`),!this._chartData)return{height:0};let n=this._chartData,r=this._width-40,i=[];if(this._chartType===`pie`&&n.datasets.length>0){let e=n.datasets[0];e.data.forEach((t,n)=>{let r=t.color||this._getDatasetColor(e,0,n),a=String(t.x);i.push({name:a,color:r,x:0,textX:0,row:0})})}else n.datasets.forEach((e,t)=>{if(!this._isDatasetVisible(e,t))return;let n=this._getDatasetColor(e,t);i.push({name:e.name,color:n,x:0,textX:0,row:0})});let a=0,o=[];i.forEach(e=>{let t=20+Math.min(e.name.length*7.5,150);o[a]||(o[a]=[]),o[a].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+t>r&&o[a].length>0&&(a++,o[a]=[]),e.row=a,o[a].push(e)}),o.forEach(e=>{let t=e.reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150)),0)+(e.length-1)*32,n=(this._width-t)/2;e.forEach(e=>{let t=Math.min(e.name.length*7.5,150);e.x=n,e.textX=n+6+8,n+=20+t+32})}),o.length*36;let s=this._getChartBounds(),c=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,l=c;this._showLegend&&(l=c+20+Math.max(this._legendHeight,60));let u=this._height-s.y-s.height,d=l>0?u/l:1,f=(this._rotatedLabelHeight>0?30:20)*d,p=12*d,m=this._rotatedLabelHeight*d,h=s.y+s.height+f+(this._rotatedLabelHeight>0?m:p)+20*d;return i.forEach(e=>{let n=h+e.row*36+16/2,r=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);r.setAttribute(`cx`,e.x.toString()),r.setAttribute(`cy`,n.toString()),r.setAttribute(`r`,`6`),r.setAttribute(`fill`,e.color),t.appendChild(r);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`foreignObject`);i.setAttribute(`x`,e.textX.toString()),i.setAttribute(`y`,(n-12).toString()),i.setAttribute(`width`,`150`),i.setAttribute(`height`,`24`);let a=document.createElement(`div`);a.style.cssText=`
121
+ </div>`}),this._showTooltipAt(e.clientX,e.clientY,n)}),n.appendChild(f)})}),t.appendChild(n),this._svg.appendChild(t)}_renderAreaChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(a.length===0)return;let o=e.y+e.height,s=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);s.setAttribute(`d`,this._buildAreaFillPathD(a,o)),s.setAttribute(`fill`,i),s.setAttribute(`fill-opacity`,`0.3`),n.appendChild(s);let c=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);c.setAttribute(`d`,this._buildSmoothLinePathD(a)),c.setAttribute(`fill`,`none`),c.setAttribute(`stroke`,i),c.setAttribute(`stroke-width`,`2`),c.setAttribute(`stroke-linecap`,`round`),c.setAttribute(`stroke-linejoin`,`round`),n.appendChild(c),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_renderPieChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds(),t=e.x+e.width/2,n=e.y+e.height/2,r=Math.min(e.width,e.height)/2-20,i=this._chartData.datasets[0];if(!i||!i.data||i.data.length===0)return;let a=i.data.reduce((e,t)=>e+t.y,0);if(a===0)return;let o=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);o.setAttribute(`class`,`chart-data`),this._pieChartGroup=o,this._pieChartClickOutsideHandler||(this._pieChartClickOutsideHandler=e=>{if(!this._pieChartTooltipShown)return;let t=e.target;this._pieChartGroup&&!this._pieChartGroup.contains(t)&&(this._pieChartTooltipShown=!1,this._hideTooltip())},document.addEventListener(`click`,this._pieChartClickOutsideHandler,!0));let s=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);s.setAttribute(`cx`,t.toString()),s.setAttribute(`cy`,n.toString()),s.setAttribute(`r`,r.toString()),s.setAttribute(`fill`,`transparent`),s.setAttribute(`pointer-events`,`none`),o.appendChild(s);let c=-Math.PI/2;i.data.forEach((e,s)=>{let l=e.y,u=l/a*100,d=l/a*2*Math.PI,f=e.color||this._getDatasetColor(i,0,s),p=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);p.setAttribute(`class`,`chart-pie-slice-group`),p.setAttribute(`data-index`,s.toString()),p.style.cursor=`pointer`,p.style.transition=`transform 0.2s ease-out`;let m=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),h=r+2,g=t+h*Math.cos(c),_=n+h*Math.sin(c),v=t+h*Math.cos(c+d),y=n+h*Math.sin(c+d),b=d>Math.PI?1:0,x=[`M ${t} ${n}`,`L ${g} ${_}`,`A ${h} ${h} 0 ${b} 1 ${v} ${y}`,`Z`].join(` `);m.setAttribute(`d`,x),m.setAttribute(`fill`,f),m.setAttribute(`class`,`chart-pie-slice`),m.setAttribute(`data-index`,s.toString()),m.setAttribute(`data-x`,String(e.x)),m.setAttribute(`data-y`,e.y.toString()),m.setAttribute(`data-name`,i.name),m.setAttribute(`data-percentage`,u.toFixed(1)),p.appendChild(m);let S=c+d/2,C=Math.cos(S)*10,w=Math.sin(S)*10,T=null,E=null,D=!1;if(p.__chartInstance=this,p.addEventListener(`mouseenter`,function(){if(E!==null&&(clearTimeout(E),E=null),!D){T!==null&&clearTimeout(T);let e=window.setTimeout(()=>{D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`),T=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},150);T=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`mouseleave`,function(){if(T!==null&&(clearTimeout(T),T=null),D){E!==null&&clearTimeout(E);let e=window.setTimeout(()=>{D=!1,this.setAttribute(`transform`,`translate(0, 0)`),E=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},200);E=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,function(){T!==null&&(clearTimeout(T),T=null),E!==null&&(clearTimeout(E),E=null),D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`)}),this._showTooltip){let t=null,n=null,r=!1;p.addEventListener(`mouseenter`,a=>{if(n!==null&&(clearTimeout(n),n=null),!r){t!==null&&clearTimeout(t);let n=window.setTimeout(()=>{r=!0,this._pieChartTooltipShown=!0;let o=this._formatValue(l,i),s=`${this._tooltipXHeadingHtml(e.x)}${i.name}: ${o}<br/>${u.toFixed(1)}%`;this._showTooltipAt(a.clientX,a.clientY,s),t=null,this._pieChartTimeouts.delete(n)},150);t=n,this._pieChartTimeouts.add(n)}}),p.addEventListener(`mouseleave`,()=>{if(t!==null&&(clearTimeout(t),t=null),r){n!==null&&clearTimeout(n);let e=window.setTimeout(()=>{r=!1,this._pieChartTooltipShown=!1,this._hideTooltip(),n=null,this._pieChartTimeouts.delete(e)},200);n=e,this._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,a=>{a.stopPropagation(),t!==null&&(clearTimeout(t),t=null),n!==null&&(clearTimeout(n),n=null),r=!0,this._pieChartTooltipShown=!0;let o=this._formatValue(l,i),s=`${this._tooltipXHeadingHtml(e.x)}${i.name}: ${o}<br/>${u.toFixed(1)}%`;this._showTooltipAt(a.clientX,a.clientY,s)})}if(u>5){let e=c+d/2,i=r*.7,a=t+i*Math.cos(e),o=n+i*Math.sin(e),s=this._getContrastColor(f),l=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);l.setAttribute(`x`,a.toString()),l.setAttribute(`y`,o.toString()),l.setAttribute(`text-anchor`,`middle`),l.setAttribute(`dominant-baseline`,`middle`),l.setAttribute(`fill`,s),l.setAttribute(`font-size`,`12`),l.setAttribute(`font-weight`,`500`),l.textContent=`${u.toFixed(1)}%`,p.appendChild(l)}o.appendChild(p),c+=d}),this._svg.appendChild(o)}_calculateLegendHeight(){if(!this._chartData)return 0;let e=this._width-40,t=[];this._chartType===`pie`&&this._chartData.datasets.length>0?this._chartData.datasets[0].data.forEach(e=>{t.push({name:String(e.x),row:0})}):this._chartData.datasets.forEach(e=>{t.push({name:e.name,row:0})});let n=0,r=[];return t.forEach(t=>{let i=20+Math.min(t.name.length*7.5,150);r[n]||(r[n]=[]),r[n].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+i>e&&r[n].length>0&&(n++,r[n]=[]),t.row=n,r[n].push(t)}),r.length*36}_renderLegend(){if(!this._chartData||!this._svg)return{height:0};let e=this._svg.querySelector(`.chart-legend`);e&&e.remove();let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);if(t.setAttribute(`class`,`chart-legend`),!this._chartData)return{height:0};let n=this._chartData,r=this._width-40,i=[];if(this._chartType===`pie`&&n.datasets.length>0){let e=n.datasets[0];e.data.forEach((t,n)=>{let r=t.color||this._getDatasetColor(e,0,n),a=String(t.x);i.push({name:a,color:r,x:0,textX:0,row:0})})}else n.datasets.forEach((e,t)=>{if(!this._isDatasetVisible(e,t))return;let n=this._getDatasetColor(e,t);i.push({name:e.name,color:n,x:0,textX:0,row:0})});let a=0,o=[];i.forEach(e=>{let t=20+Math.min(e.name.length*7.5,150);o[a]||(o[a]=[]),o[a].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+t>r&&o[a].length>0&&(a++,o[a]=[]),e.row=a,o[a].push(e)}),o.forEach(e=>{let t=e.reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150)),0)+(e.length-1)*32,n=(this._width-t)/2;e.forEach(e=>{let t=Math.min(e.name.length*7.5,150);e.x=n,e.textX=n+6+8,n+=20+t+32})}),o.length*36;let s=this._getChartBounds(),c=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,l=c;this._showLegend&&(l=c+20+Math.max(this._legendHeight,60));let u=this._height-s.y-s.height,d=l>0?u/l:1,f=(this._rotatedLabelHeight>0?30:20)*d,p=12*d,m=this._rotatedLabelHeight*d,h=s.y+s.height+f+(this._rotatedLabelHeight>0?m:p)+20*d;return i.forEach(e=>{let n=h+e.row*36+16/2,r=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);r.setAttribute(`cx`,e.x.toString()),r.setAttribute(`cy`,n.toString()),r.setAttribute(`r`,`6`),r.setAttribute(`fill`,e.color),t.appendChild(r);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`foreignObject`);i.setAttribute(`x`,e.textX.toString()),i.setAttribute(`y`,(n-12).toString()),i.setAttribute(`width`,`150`),i.setAttribute(`height`,`24`);let a=document.createElement(`div`);a.style.cssText=`
122
122
  font-size: 12px;
123
123
  font-family: system-ui, -apple-system, sans-serif;
124
124
  color: ${document.documentElement.classList.contains(`dark`)?`#d1d5db`:`#374151`};
@@ -130,4 +130,4 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
130
130
  display: flex;
131
131
  align-items: center;
132
132
  height: 100%;
133
- `,a.textContent=e.name,i.appendChild(a),t.appendChild(i)}),this._svg.appendChild(t),{height:this._legendHeight+50}}async addDataPoint(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data.push(t),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async batchAddDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,point:r}of e)this._chartData.datasets[n]&&(this._chartData.datasets[n].data.push(r),t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async updateDatasetData(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data=t,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async addDataset(e){return this._chartData?(this._chartData.datasets.push(e),e.id&&this._datasetVisibility.set(e.id,e.visible!==!1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))):(console.error(`Chart data not initialized`),Promise.reject(Error(`Chart data not initialized`)))}async removeDataset(e){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets.splice(e,1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async updateDataPoint(e,t,n){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):this._chartData.datasets[e].data[t]?(this._chartData.datasets[e].data[t]=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))):(console.error(`Data point at index ${t} does not exist`),Promise.reject(Error(`Data point at index ${t} does not exist`)))}async batchUpdateDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,pointIndex:r,point:i}of e)this._chartData.datasets[n]?.data[r]&&(this._chartData.datasets[n].data[r]=i,t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async removeDataPoint(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data.splice(t,1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async batchRemoveDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,pointIndex:r}of e)this._chartData.datasets[n]?.data[r]&&(this._chartData.datasets[n].data.splice(r,1),t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async showDataset(e){return this._datasetVisibility.set(e,!0),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))}async hideDataset(e){return this._datasetVisibility.set(e,!1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))}async toggleDataset(e){let t=!(this._datasetVisibility.get(e)??!0);return this._datasetVisibility.set(e,t),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),await new Promise(e=>requestAnimationFrame(()=>e())),t}isDatasetVisible(e){return this._datasetVisibility.get(e)}async downloadAsPNG(e=`chart.png`){if(!this._svg)return console.error(`Chart SVG not found`),Promise.reject(Error(`Chart SVG not found`));let t=this._svg.cloneNode(!0),n=this._width,r=this._height;t.querySelectorAll(`text`).forEach(e=>{let t=e.getAttribute(`font-family`);(!t||t.includes(`system-ui`)||t.includes(`apple-system`))&&e.setAttribute(`font-family`,`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`)}),t.setAttribute(`width`,n.toString()),t.setAttribute(`height`,r.toString()),t.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),t.querySelectorAll(`foreignObject`).forEach(e=>{let t=e.querySelector(`div`);if(t){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),r=e.getAttribute(`x`)||`0`,i=e.getAttribute(`y`)||`0`;n.setAttribute(`x`,r),n.setAttribute(`y`,(parseFloat(i)+12).toString()),n.setAttribute(`fill`,t.style.color||`#374151`),n.setAttribute(`font-size`,`12`),n.setAttribute(`font-family`,t.style.fontFamily||`system-ui, -apple-system, sans-serif`),n.textContent=t.textContent||``,e.parentNode&&e.parentNode.replaceChild(n,e)}});let i=new XMLSerializer().serializeToString(t),a=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(i),o=new Image;return o.crossOrigin=`anonymous`,new Promise((t,i)=>{o.onload=()=>{setTimeout(()=>{let a=document.createElement(`canvas`);a.width=n+60,a.height=r+60;let s=a.getContext(`2d`);if(!s){console.error(`Could not get canvas context`),i(Error(`Could not get canvas context`));return}s.fillStyle=document.documentElement.classList.contains(`dark`)?`#111827`:`#ffffff`,s.fillRect(0,0,a.width,a.height),s.drawImage(o,30,30),a.toBlob(n=>{if(!n){console.error(`Could not create blob from canvas`),i(Error(`Could not create blob from canvas`));return}let r=URL.createObjectURL(n),a=document.createElement(`a`);a.href=r,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r),t()},`image/png`)},0)},o.onerror=()=>{console.error(`Error loading SVG image`),i(Error(`Error loading SVG image`))},o.src=a})}};customElements.get(`mint-chart`)||customElements.define(`mint-chart`,L);var R=class extends HTMLElement{constructor(...e){super(...e),this._trigger=null,this._submenuContainer=null}static get observedAttributes(){return[`label`,`icon`,`href`,`active`,`expanded`,`submenu-item`]}connectedCallback(){this.classList.add(`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`active`&&this._isSubmenuItem()&&this._refreshDropdownAncestor())}_refreshDropdownAncestor(){let e=this.parentElement;for(;e;){if(e.tagName===`MINT-SIDENAV-LINK`&&e!==this){e.render();break}e=e.parentElement}}_isActive(){return this.getAttribute(`active`)===`true`}_isExpanded(){return this.getAttribute(`expanded`)===`true`}_isSubmenuItem(){return this.getAttribute(`submenu-item`)===`true`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}_getBaseClasses(){let e=this._isActive()?`border-black/20 bg-black/5 text-black dark:border-white/20 dark:bg-white/10 dark:text-white`:`border-transparent text-gray-700 hover:bg-black/5 dark:text-gray-200 dark:hover:bg-white/10`;return[`w-full`,`cursor-pointer`,`rounded-lg`,`border`,`block`,this._isSubmenuItem()?`px-2 py-1.5`:`px-3 py-2`,`text-left`,`text-sm`,e].join(` `)}_hasSubmenu(){return this.querySelectorAll(`:scope > [slot="submenu"]`).length>0?!0:!!this._submenuContainer&&this._submenuContainer.children.length>0}_createRow(e,t){let n=document.createElement(`span`);if(this._isSubmenuItem(),n.className=`inline-flex w-full items-center justify-start gap-2`,t){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,t),e.className=`h-4 w-4 shrink-0`,n.appendChild(e)}let r=document.createElement(`span`);return r.className=`inline truncate`,r.textContent=e,n.appendChild(r),n}_buildSimpleLink(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=e?document.createElement(`a`):document.createElement(`button`);e?(r.setAttribute(`href`,e),r.setAttribute(`role`,`link`)):r.setAttribute(`type`,`button`),r.className=this._getBaseClasses(),r.setAttribute(`aria-label`,t||`Side navigation link`),r.appendChild(this._createRow(t,n)),this.replaceChildren(r),this._trigger=r}_buildDropdownLink(){let e=this._getLabel(),t=this._getIcon(),n=Array.from(this.querySelectorAll(`:scope > [slot="submenu"]`)),r=n.length>0?n:this._submenuContainer?Array.from(this._submenuContainer.children):[],i=document.createElement(`div`);i.className=`w-full`;let a=document.createElement(`button`);a.type=`button`,a.className=`${this._getBaseClasses()} block w-full`,a.setAttribute(`aria-expanded`,String(this._isExpanded())),a.appendChild(this._createRow(e,t)),a.onclick=()=>{this.setAttribute(`expanded`,this._isExpanded()?`false`:`true`)},this._submenuContainer=document.createElement(`div`),this._submenuContainer.className=[`mt-1`,`ml-5`,`border-l`,`border-gray-200`,`pl-2`,`space-y-1`,`dark:border-mint-divider`,this._isExpanded()?`block`:`hidden`].join(` `),r.forEach(e=>{e.setAttribute(`submenu-item`,`true`),e.setAttribute(`slot`,`submenu`),this._submenuContainer?.appendChild(e)}),i.appendChild(a),i.appendChild(this._submenuContainer),this.replaceChildren(i),this._trigger=a}render(){this._hasSubmenu()&&!this._isSubmenuItem()?this._buildDropdownLink():this._buildSimpleLink()}};customElements.get(`mint-sidenav-link`)||customElements.define(`mint-sidenav-link`,R);var z=class extends HTMLElement{constructor(...e){super(...e),this._container=null,this._title=null,this._titleLabel=null,this._titleCaret=null,this._list=null,this._titleClickHandler=null,this._listenerCounts=new Map}static get observedAttributes(){return[`name`]}get onMintNameClick(){return this._onMintNameClick}set onMintNameClick(e){this._onMintNameClick=e,this.render()}addEventListener(e,t,n){super.addEventListener(e,t,n),this._trackListener(e,1)}removeEventListener(e,t,n){super.removeEventListener(e,t,n),this._trackListener(e,-1)}connectedCallback(){this.classList.add(`block`),this.render()}disconnectedCallback(){this._title&&this._titleClickHandler&&(this._title.removeEventListener(`click`,this._titleClickHandler),this._title.removeEventListener(`keydown`,this._titleClickHandler))}attributeChangedCallback(e,t,n){t!==n&&this.render()}_getName(){return this.getAttribute(`name`)||``}_trackListener(e,t){if(e!==`mint-name-click`)return;let n=this._listenerCounts.get(e)||0,r=Math.max(0,n+t);this._listenerCounts.set(e,r),this.render()}_isNameInteractive(){return(this._listenerCounts.get(`mint-name-click`)||0)>0||typeof this._onMintNameClick==`function`}_emitNameClick(e){let t=new CustomEvent(`mint-name-click`,{detail:{name:this._getName(),originalEvent:e},bubbles:!0,composed:!0});this.dispatchEvent(t),typeof this._onMintNameClick==`function`&&this._onMintNameClick(t)}render(){this._container||(this._container=document.createElement(`section`),this._container.className=`mb-4`,this.appendChild(this._container)),this._title||(this._title=document.createElement(`button`),this._title.setAttribute(`type`,`button`),this._title.className=`mb-2 w-full`,this._titleLabel=document.createElement(`mint-text`),this._titleLabel.setAttribute(`size`,`small`),this._titleLabel.setAttribute(`bold`,`true`),this._titleCaret=document.createElement(`mint-icon`),this._titleCaret.setAttribute(`name`,`caret-right`),this._titleCaret.className=`ml-auto inline-flex h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400`,this._title.appendChild(this._titleLabel),this._title.appendChild(this._titleCaret),this._titleClickHandler=e=>{this._isNameInteractive()&&(e instanceof KeyboardEvent&&e.key!==`Enter`&&e.key!==` `||(e instanceof KeyboardEvent&&e.key===` `&&e.preventDefault(),this._emitNameClick(e)))},this._title.addEventListener(`click`,this._titleClickHandler),this._title.addEventListener(`keydown`,this._titleClickHandler),this._container.appendChild(this._title));let e=this._getName(),t=e.trim().length>0,n=this._isNameInteractive();this._titleLabel&&(this._titleLabel.textContent=e,this._titleLabel.className=`uppercase tracking-wide text-gray-500 dark:text-gray-400`),this._title&&(this._title.className=n?[`mb-2`,`w-full`,`inline-flex`,`items-center`,`gap-2`,`rounded-lg`,`border`,`border-transparent`,`px-3`,`py-2`,`text-left`,`hover:bg-black/5`,`dark:hover:bg-white/10`,`cursor-pointer`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-black/20`,`dark:focus-visible:ring-white/20`].join(` `):`mb-2 w-full inline-flex items-center gap-2 rounded-lg border border-transparent px-3 py-2 text-left cursor-default`,this._title.tabIndex=n?0:-1,this._title.disabled=!n,this._title.setAttribute(`aria-disabled`,String(!n))),this._titleCaret&&(this._titleCaret.style.display=n?``:`none`,this._titleCaret.setAttribute(`aria-hidden`,String(!n))),t?this._title.parentElement!==this._container&&this._container?.insertBefore(this._title,this._list):this._title.parentElement===this._container&&this._container?.removeChild(this._title),this._list||(this._list=document.createElement(`div`),this._list.className=`space-y-1`,this._container.appendChild(this._list)),Array.from(this.children).filter(e=>e!==this._container&&e.tagName===`MINT-SIDENAV-LINK`).forEach(e=>{this._list&&e.parentElement!==this._list&&this._list.appendChild(e)})}};customElements.get(`mint-sidenav-links`)||customElements.define(`mint-sidenav-links`,z);var B=class extends HTMLElement{static get observedAttributes(){return[`separated`]}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isSeparated(){return this.getAttribute(`separated`)===`true`}render(){this.className=this._isSeparated()?`block w-full mt-2 border-t border-gray-200 pt-2 px-2 pb-2 dark:border-mint-divider`:`block w-full p-2`}};customElements.get(`mint-sidenav-action-links`)||customElements.define(`mint-sidenav-action-links`,B);var V=class extends HTMLElement{constructor(...e){super(...e),this._wrapper=null,this._trigger=null,this._popover=null,this._triggerId=``}static get observedAttributes(){return[`title`,`subtitle`]}connectedCallback(){this.classList.add(`block`),this._triggerId=this.id?`${this.id}-trigger`:`mint-sidenav-action-menu-${Math.random().toString(36).slice(2,9)}`,this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_getTitle(){return this.getAttribute(`title`)||``}_getSubtitle(){return this.getAttribute(`subtitle`)||``}_createDefaultGroup(){let e=document.createElement(`mint-sidenav-action-links`),t=document.createElement(`div`);return t.appendChild(e),t}render(){let e=Array.from(this.children).filter(e=>e!==this._wrapper&&e.getAttribute(`slot`)===`action-links`);this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative`,this.appendChild(this._wrapper)),this._wrapper.innerHTML=``,this._trigger=document.createElement(`button`),this._trigger.type=`button`,this._trigger.id=this._triggerId,this._trigger.className=`flex w-full cursor-pointer items-center gap-3 rounded-xl border border-gray-200 bg-gray-50 px-3 py-2 text-left hover:bg-gray-100 dark:border-mint-divider dark:bg-white/5 dark:hover:bg-white/10`;let t=document.createElement(`div`);t.className=`inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gray-700 text-xs font-semibold text-white dark:bg-mint-nav`,t.textContent=this._getTitle().split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase();let n=document.createElement(`div`);n.className=`min-w-0 flex-1`;let r=document.createElement(`mint-text`);r.setAttribute(`size`,`body`),r.setAttribute(`bold`,`true`),r.className=`truncate text-gray-900 dark:text-gray-100`,r.textContent=this._getTitle();let i=document.createElement(`mint-text`);i.setAttribute(`size`,`small`),i.setAttribute(`variant`,`muted`),i.className=`truncate`,i.textContent=this._getSubtitle(),n.appendChild(r),n.appendChild(i),this._trigger.appendChild(t),this._trigger.appendChild(n),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`right`),this._popover.setAttribute(`padding`,`0`);let a=document.createElement(`div`);a.className=`w-64`,e.length>0?e.forEach(e=>{e.setAttribute(`hidden`,`true`);let t=e.cloneNode(!0);t.removeAttribute(`hidden`),t.removeAttribute(`slot`),a.appendChild(t)}):a.appendChild(this._createDefaultGroup()),this._popover.appendChild(a),this._wrapper.appendChild(this._trigger),this._wrapper.appendChild(this._popover)}};customElements.get(`mint-sidenav-action-menu`)||customElements.define(`mint-sidenav-action-menu`,V);var H=class extends HTMLElement{constructor(...e){super(...e),this._backdrop=null,this._container=null,this._header=null,this._content=null,this._footer=null,this._escapeHandler=null,this._mediaQuery=null,this._mediaListener=null}static get observedAttributes(){return[`user-name`,`user-status`,`open`,`drawer-top-class`]}connectedCallback(){this.classList.add(`relative`,`block`,`shrink-0`,`w-0`,`overflow-visible`,`min-[1100px]:w-[17rem]`,`min-[1100px]:shrink-0`),this._attachEscapeListener(),this._attachMediaListener(),this.render()}disconnectedCallback(){this._detachEscapeListener(),this._detachMediaListener()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_attachEscapeListener(){this._escapeHandler||(this._escapeHandler=e=>{e.key===`Escape`&&this.getAttribute(`open`)===`true`&&this.removeAttribute(`open`)},document.addEventListener(`keydown`,this._escapeHandler))}_detachEscapeListener(){this._escapeHandler&&=(document.removeEventListener(`keydown`,this._escapeHandler),null)}_attachMediaListener(){this._mediaListener||(this._mediaQuery=window.matchMedia(`(min-width: 1100px)`),this._mediaListener=()=>{this._mediaQuery?.matches&&this.removeAttribute(`open`)},this._mediaQuery.addEventListener(`change`,this._mediaListener))}_detachMediaListener(){this._mediaQuery&&this._mediaListener&&this._mediaQuery.removeEventListener(`change`,this._mediaListener),this._mediaQuery=null,this._mediaListener=null}getUserName(){return this.getAttribute(`user-name`)||`Acme Inc`}getUserStatus(){return this.getAttribute(`user-status`)||`Enterprise`}_isOpen(){return this.getAttribute(`open`)===`true`}_ensureBackdrop(){this._backdrop||(this._backdrop=document.createElement(`div`),this._backdrop.setAttribute(`aria-hidden`,`true`),this._backdrop.addEventListener(`click`,()=>this.removeAttribute(`open`)),this.insertBefore(this._backdrop,this.firstChild))}_ensureContainer(){this._container||(this._container=document.createElement(`aside`),this.appendChild(this._container))}_syncShell(){let e=`max-[1099.98px]:top-14`,t=this._isOpen();if(this._backdrop&&(this._backdrop.className=[`fixed`,e,`left-0`,`right-0`,`bottom-0`,`z-40`,`bg-black/50`,`transition-opacity`,`duration-200`,`min-[1100px]:hidden`,t?`pointer-events-auto opacity-100`:`pointer-events-none opacity-0`].join(` `)),this._container){let n=t?`max-[1099.98px]:translate-x-0`:`max-[1099.98px]:-translate-x-full`;this._container.className=[`flex`,`min-h-0`,`flex-col`,`border-r`,`border-gray-200`,`bg-white`,`p-2`,`dark:border-mint-divider`,`dark:bg-mint-nav`,`w-[4.75rem]`,`max-[1099.98px]:fixed`,e,`max-[1099.98px]:bottom-0`,`max-[1099.98px]:left-0`,`max-[1099.98px]:z-50`,`max-[1099.98px]:h-auto`,`max-[1099.98px]:w-[17rem]`,`max-[1099.98px]:max-w-[85vw]`,`max-[1099.98px]:shadow-xl`,`max-[1099.98px]:transition-transform`,`max-[1099.98px]:duration-200`,`max-[1099.98px]:ease-out`,n,`min-[1100px]:fixed`,`min-[1100px]:left-0`,`min-[1100px]:top-14`,`min-[1100px]:bottom-0`,`min-[1100px]:z-[60]`,`min-[1100px]:w-[17rem]`,`min-[1100px]:p-3`,`min-[1100px]:shadow-none`].join(` `)}}_buildUserHeader(){if(!this._container)return;this._header||(this._header=document.createElement(`div`),this._header.className=`mb-4`,this._container.appendChild(this._header));let e=Array.from(this.querySelectorAll(`[slot="action-header"]`)).find(e=>e!==this._backdrop&&e!==this._container);if(e){this._header.replaceChildren(e);return}let t=document.createElement(`mint-sidenav-action-menu`);t.setAttribute(`title`,this.getUserName()),t.setAttribute(`subtitle`,this.getUserStatus()),this._header.replaceChildren(t)}_replaceSlottedChildren(e,t){let n=Array.from(this.querySelectorAll(`[slot="${t}"]`)).filter(e=>e!==this._container&&e!==this._backdrop);e.replaceChildren(...n)}_buildContent(){this._container&&(this._content||(this._content=document.createElement(`div`),this._content.className=`min-h-0 grow overflow-y-auto`,this._container.appendChild(this._content)),this._replaceSlottedChildren(this._content,`links`))}_buildFooter(){if(!this._container)return;this._footer||(this._footer=document.createElement(`div`),this._footer.className=`mt-auto border-t border-gray-200 py-3 dark:border-mint-divider`,this._container.appendChild(this._footer));let e=document.createElement(`div`);e.className=`space-y-1`,this._replaceSlottedChildren(e,`bottom-links`),this._footer.innerHTML=``,this._footer.appendChild(e)}render(){this._ensureBackdrop(),this._ensureContainer(),this._syncShell(),this._buildUserHeader(),this._buildContent(),this._buildFooter()}};customElements.get(`mint-side-navigation`)||customElements.define(`mint-side-navigation`,H);var U=class extends HTMLElement{constructor(...e){super(...e),this._bar=null,this._menuButton=null,this._logoLink=null,this._menuClickHandler=null,this._darkModeObserver=null,this._resizeHandler=null,this._desktopSearchInput=null,this._desktopSearchShell=null,this._mobileSearchButton=null,this._searchPanel=null,this._searchPanelInput=null,this._searchResultsWrap=null,this._searchStateWrap=null,this._searchDebounceId=null,this._searchAbortController=null,this._searchOpen=!1,this._searchQuery=``,this._globalKeydownHandler=null,this._docClickHandler=null}static get observedAttributes(){return[`logo-src`,`logo-src-light`,`logo-src-dark`,`logo-src-mobile`,`logo-src-mobile-light`,`logo-src-mobile-dark`,`logo-href`,`logo-alt`,`menu-target`,`search-endpoint`,`search-param`,`search-placeholder`]}connectedCallback(){this.classList.add(`relative`,`block`,`h-14`,`w-full`,`shrink-0`),this._observeDarkMode(),this._attachResizeListener(),this._attachGlobalHandlers(),this.render()}disconnectedCallback(){this._menuButton&&this._menuClickHandler&&(this._menuButton.removeEventListener(`click`,this._menuClickHandler),this._menuClickHandler=null),this._disconnectDarkModeObserver(),this._detachResizeListener(),this._detachGlobalHandlers(),this._cancelSearchDebounce(),this._abortSearch()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isDarkMode(){return document.documentElement.classList.contains(`dark`)}_isMobileViewport(){return window.matchMedia(`(max-width: 1099.98px)`).matches}_getLogoSrc(){let e=this.getAttribute(`logo-src`)||``,t=this.getAttribute(`logo-src-light`)||``,n=this.getAttribute(`logo-src-dark`)||``,r=this.getAttribute(`logo-src-mobile`)||``,i=this.getAttribute(`logo-src-mobile-light`)||``,a=this.getAttribute(`logo-src-mobile-dark`)||``,o=this._isDarkMode(),s=this._isMobileViewport();return s&&o?a||r||n||t||e:s&&!o?i||r||t||n||e:o?n||t||e:t||n||e}_getLogoHref(){return this.getAttribute(`logo-href`)||`/`}_getLogoAlt(){return this.getAttribute(`logo-alt`)||`Home`}_getMenuTargetId(){return(this.getAttribute(`menu-target`)||``).replace(/^#/,``)}_getSearchEndpoint(){return(this.getAttribute(`search-endpoint`)||``).trim()}_getSearchParam(){return(this.getAttribute(`search-param`)||`q`).trim()||`q`}_getSearchPlaceholder(){return this.getAttribute(`search-placeholder`)||`Search`}_isSearchEnabled(){return!!this._getSearchEndpoint()}_attachGlobalHandlers(){this._globalKeydownHandler||(this._globalKeydownHandler=e=>{let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&t===`k`){e.preventDefault(),this._openSearch(!0);return}t===`escape`&&this._searchOpen&&this._closeSearch()},document.addEventListener(`keydown`,this._globalKeydownHandler)),this._docClickHandler||(this._docClickHandler=e=>{if(!this._searchOpen)return;let t=e.target;t&&(this.contains(t)||this._closeSearch())},document.addEventListener(`click`,this._docClickHandler))}_detachGlobalHandlers(){this._globalKeydownHandler&&=(document.removeEventListener(`keydown`,this._globalKeydownHandler),null),this._docClickHandler&&=(document.removeEventListener(`click`,this._docClickHandler),null)}_cancelSearchDebounce(){this._searchDebounceId!==null&&(window.clearTimeout(this._searchDebounceId),this._searchDebounceId=null)}_abortSearch(){this._searchAbortController&&=(this._searchAbortController.abort(),null)}_openSearch(e=!1){if(this._isSearchEnabled()&&(this._searchOpen=!0,this._syncSearchPanelVisibility(),e)){let e=this._isMobileViewport()?this._searchPanelInput:this._desktopSearchInput;e?.focus(),e?.select()}}_closeSearch(){this._searchOpen=!1,this._syncSearchPanelVisibility()}_syncSearchPanelVisibility(){this._searchPanel&&(this._searchPanel.classList.toggle(`hidden`,!this._searchOpen),this._syncDesktopSearchOpenState(),this._positionSearchPanel())}_syncDesktopSearchOpenState(){this._desktopSearchShell&&(this._desktopSearchShell.classList.toggle(`rounded-b-none`,this._searchOpen),this._desktopSearchShell.classList.toggle(`border-b-transparent`,this._searchOpen))}_positionSearchPanel(){if(!this._searchPanel)return;if(this._isMobileViewport()||!this._desktopSearchShell){this._searchPanel.style.left=``,this._searchPanel.style.right=``,this._searchPanel.style.top=``,this._searchPanel.style.width=``,this._searchPanel.style.maxWidth=``,this._searchPanel.style.transform=``;return}let e=this._desktopSearchShell.getBoundingClientRect();this._searchPanel.style.left=`${e.left}px`,this._searchPanel.style.right=`auto`,this._searchPanel.style.top=`${e.bottom-1}px`,this._searchPanel.style.width=`${e.width}px`,this._searchPanel.style.maxWidth=`${e.width}px`,this._searchPanel.style.transform=`none`}_setSearchQuery(e){this._searchQuery=e,this._desktopSearchInput&&this._desktopSearchInput.value!==e&&(this._desktopSearchInput.value=e),this._searchPanelInput&&this._searchPanelInput.value!==e&&(this._searchPanelInput.value=e)}_normalizeResults(e){return(e=>{if(Array.isArray(e))return e;if(!e||typeof e!=`object`)return[];let t=e;for(let e of[`results`,`items`,`data`,`products`]){let n=t[e];if(Array.isArray(n))return n}return[]})(e).map(e=>{let t=e||{};return{title:String(t.title||t.name||t.label||t.email||t.id||``).trim()||`Untitled`,subtitle:String(t.description||t.category||t.username||``).trim()}}).slice(0,8)}_renderSearchState(e){this._searchStateWrap&&(this._searchStateWrap.textContent=e,this._searchStateWrap.classList.remove(`hidden`),this._searchResultsWrap&&(this._searchResultsWrap.innerHTML=``))}_renderSearchResults(e){if(!(!this._searchResultsWrap||!this._searchStateWrap)){if(this._searchResultsWrap.innerHTML=``,e.length===0){this._renderSearchState(`No results found`);return}this._searchStateWrap.classList.add(`hidden`);for(let t of e){let e=document.createElement(`button`);e.type=`button`,e.className=`flex w-full cursor-pointer items-start gap-3 rounded-lg px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-white/10`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`mt-0.5 h-4 w-4 text-gray-500 dark:text-gray-400`;let r=document.createElement(`div`);r.className=`min-w-0`;let i=document.createElement(`div`);if(i.className=`truncate text-sm font-semibold text-gray-900 dark:text-gray-100`,i.textContent=t.title,r.appendChild(i),t.subtitle){let e=document.createElement(`div`);e.className=`truncate text-xs text-gray-500 dark:text-gray-400`,e.textContent=t.subtitle,r.appendChild(e)}e.appendChild(n),e.appendChild(r),e.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`search-select`,{detail:{query:this._searchQuery,result:t},bubbles:!0,composed:!0})),this._closeSearch()}),this._searchResultsWrap.appendChild(e)}}}_fetchSearchResults(e){let t=this._getSearchEndpoint();if(!t)return;let n=e.trim();if(!n){this._renderSearchState(`Start typing to search`);return}this._abortSearch(),this._searchAbortController=new AbortController,this._renderSearchState(`Searching...`);let r=t.includes(`{query}`)?t.replace(`{query}`,encodeURIComponent(n)):`${t}${t.includes(`?`)?`&`:`?`}${encodeURIComponent(this._getSearchParam())}=${encodeURIComponent(n)}`;fetch(r,{signal:this._searchAbortController.signal}).then(e=>{if(!e.ok)throw Error(`Request failed: ${e.status}`);return e.json()}).then(e=>{let t=this._normalizeResults(e);this._renderSearchResults(t)}).catch(e=>{e?.name!==`AbortError`&&this._renderSearchState(`Unable to load results`)})}_scheduleSearch(e){this._setSearchQuery(e),this._cancelSearchDebounce(),this._searchDebounceId=window.setTimeout(()=>this._fetchSearchResults(e),220)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>this.render()),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_disconnectDarkModeObserver(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_attachResizeListener(){this._resizeHandler||(this._resizeHandler=()=>{this.render(),this._positionSearchPanel()},window.addEventListener(`resize`,this._resizeHandler,{passive:!0}))}_detachResizeListener(){this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}_toggleMenuTarget(){let e=this._getMenuTargetId();if(!e)return;let t=document.getElementById(e);!t||t.tagName!==`MINT-SIDE-NAVIGATION`||(t.getAttribute(`open`)===`true`?t.removeAttribute(`open`):t.setAttribute(`open`,`true`))}render(){if(this._bar||(this._bar=document.createElement(`div`),this._bar.className=`fixed inset-x-0 top-0 z-50 flex h-14 w-full items-center gap-2 border-b border-gray-200 bg-white px-3 dark:border-mint-divider dark:bg-mint-nav`,this.appendChild(this._bar)),!this._menuButton){this._menuButton=document.createElement(`button`),this._menuButton.type=`button`,this._menuButton.className=`inline-flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent text-gray-700 hover:bg-black/5 min-[1100px]:hidden dark:text-gray-200 dark:hover:bg-white/10`,this._menuButton.setAttribute(`aria-label`,`Open navigation menu`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`menu`),e.className=`h-5 w-5`,this._menuButton.appendChild(e),this._menuClickHandler=()=>this._toggleMenuTarget(),this._menuButton.addEventListener(`click`,this._menuClickHandler),this._bar.appendChild(this._menuButton)}let e=!!this._getMenuTargetId();this._menuButton.classList.toggle(`hidden`,!e),this._logoLink||(this._logoLink=document.createElement(`a`),this._logoLink.className=`flex h-8 w-40 shrink-0 items-center`,this._bar.appendChild(this._logoLink)),this._logoLink.href=this._getLogoHref(),this._logoLink.setAttribute(`aria-label`,this._getLogoAlt());let t=this._getLogoSrc();if(t){let e=document.createElement(`img`);e.className=`h-full w-full object-contain [aspect-ratio:5/1]`,e.decoding=`async`,e.src=t,e.alt=this._getLogoAlt(),this._logoLink.replaceChildren(e),this._logoLink.classList.remove(`pointer-events-none`,`opacity-40`)}else{this._logoLink.replaceChildren(),this._logoLink.classList.add(`pointer-events-none`,`opacity-40`);let e=document.createElement(`span`);e.className=`text-sm font-semibold text-gray-400 dark:text-gray-500`,e.textContent=`Logo`,this._logoLink.appendChild(e)}let n=Array.from(this.querySelectorAll(`[slot="center"]`)),r=n.length>0,i=this._isSearchEnabled()&&!r,a=this._bar.querySelector(`[data-mint-topnav-center]`);if(a||(a=document.createElement(`div`),a.setAttribute(`data-mint-topnav-center`,`true`),this._bar.appendChild(a)),a.className=r?`min-w-0 flex-1 px-2 min-[1100px]:flex min-[1100px]:justify-center min-[1100px]:px-4`:`max-[1099.98px]:hidden min-[1100px]:flex min-[1100px]:min-w-0 min-[1100px]:flex-1 min-[1100px]:justify-center min-[1100px]:px-4`,a.classList.toggle(`min-[1100px]:hidden`,!i&&!r),r&&(a.replaceChildren(...n),this._closeSearch()),i&&!this._desktopSearchInput){let e=document.createElement(`div`);e.className=`relative w-full max-w-xl rounded-xl border border-gray-300 bg-gray-50 px-3 py-2 dark:border-mint-divider dark:bg-mint-hover`,this._desktopSearchShell=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`search`),t.className=`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400`,this._desktopSearchInput=document.createElement(`input`),this._desktopSearchInput.type=`search`,this._desktopSearchInput.className=`w-full bg-transparent pl-6 pr-20 text-sm text-gray-900 outline-none placeholder:text-gray-500 dark:text-gray-100 dark:placeholder:text-gray-400`,this._desktopSearchInput.placeholder=this._getSearchPlaceholder(),this._desktopSearchInput.addEventListener(`focus`,()=>this._openSearch(!1)),this._desktopSearchInput.addEventListener(`input`,e=>this._scheduleSearch(e.target.value));let n=document.createElement(`span`);n.className=`absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-500 dark:text-gray-400`,n.textContent=`⌘K`,e.appendChild(t),e.appendChild(this._desktopSearchInput),e.appendChild(n),a.appendChild(e)}i&&this._desktopSearchInput&&(this._desktopSearchInput.placeholder=this._getSearchPlaceholder(),this._desktopSearchShell=this._desktopSearchInput.closest(`div`),this._syncDesktopSearchOpenState());let o=this._bar.querySelector(`[data-mint-topnav-mobile-spacer]`);o||(o=document.createElement(`div`),o.setAttribute(`data-mint-topnav-mobile-spacer`,`true`),o.className=`min-w-0 flex-1 min-[1100px]:hidden`,this._bar.appendChild(o));let s=Array.from(this.querySelectorAll(`[slot="actions"]`)),c=this._bar.querySelector(`[data-mint-topnav-actions]`);if(c||(c=document.createElement(`div`),c.setAttribute(`data-mint-topnav-actions`,`true`),c.className=`flex shrink-0 items-center gap-2`,this._bar.appendChild(c)),i&&!this._mobileSearchButton){this._mobileSearchButton=document.createElement(`button`),this._mobileSearchButton.type=`button`,this._mobileSearchButton.className=`inline-flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent text-gray-700 hover:bg-black/5 min-[1100px]:hidden dark:text-gray-200 dark:hover:bg-white/10`,this._mobileSearchButton.setAttribute(`aria-label`,`Open search`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`search`),e.className=`h-5 w-5`,this._mobileSearchButton.appendChild(e),this._mobileSearchButton.addEventListener(`click`,()=>this._openSearch(!0)),c.insertBefore(this._mobileSearchButton,c.firstChild)}if(this._mobileSearchButton&&this._mobileSearchButton.classList.toggle(`hidden`,!i),c.replaceChildren(...s),i&&this._mobileSearchButton&&!s.includes(this._mobileSearchButton)&&c.insertBefore(this._mobileSearchButton,c.firstChild),i&&!this._searchPanel){this._searchPanel=document.createElement(`div`),this._searchPanel.className=`fixed left-0 right-0 top-14 z-[90] hidden p-3 min-[1100px]:p-0`;let e=document.createElement(`div`);e.className=`mx-auto w-full rounded-2xl border border-gray-200 bg-white shadow-xl dark:border-mint-divider dark:bg-mint-elevated min-[1100px]:rounded-t-none`;let t=document.createElement(`div`);t.className=`relative border-b border-gray-200 p-3 dark:border-mint-divider min-[1100px]:hidden`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`absolute left-6 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400`,this._searchPanelInput=document.createElement(`input`),this._searchPanelInput.type=`search`,this._searchPanelInput.className=`w-full rounded-lg border border-gray-300 bg-gray-50 py-2 pl-10 pr-3 text-sm text-gray-900 outline-none dark:border-mint-divider dark:bg-mint-hover dark:text-gray-100`,this._searchPanelInput.placeholder=this._getSearchPlaceholder(),this._searchPanelInput.addEventListener(`input`,e=>this._scheduleSearch(e.target.value)),t.appendChild(n),t.appendChild(this._searchPanelInput);let r=document.createElement(`div`);r.className=`flex flex-wrap gap-2 px-3 py-3`,[`Apps`,`Customers`,`Orders`,`Products`,`Sales channels`].forEach(e=>{let t=document.createElement(`span`);t.className=`rounded-full bg-gray-100 px-3 py-1 text-xs font-semibold text-gray-600 dark:bg-mint-hover dark:text-gray-300`,t.textContent=e,r.appendChild(t)}),this._searchStateWrap=document.createElement(`div`),this._searchStateWrap.className=`px-4 pb-4 text-sm text-gray-500 dark:text-gray-400`,this._searchStateWrap.textContent=`Start typing to search`,this._searchResultsWrap=document.createElement(`div`),this._searchResultsWrap.className=`max-h-[52vh] overflow-y-auto px-2 pb-2`,e.appendChild(t),e.appendChild(r),e.appendChild(this._searchStateWrap),e.appendChild(this._searchResultsWrap),this._searchPanel.appendChild(e),this.appendChild(this._searchPanel)}this._searchPanelInput&&(this._searchPanelInput.placeholder=this._getSearchPlaceholder()),this._syncSearchPanelVisibility(),this._positionSearchPanel()}};customElements.get(`mint-top-navigation`)||customElements.define(`mint-top-navigation`,U);var W=class e extends HTMLElement{constructor(...e){super(...e),this._shell=null,this._desktopInput=null,this._panel=null,this._panelInner=null,this._panelInput=null,this._panelFiltersWrap=null,this._panelFiltersMainRow=null,this._panelFiltersChips=null,this._panelFiltersShowAllWrap=null,this._panelFiltersShowAllBtn=null,this._panelFiltersMorePanel=null,this._filtersMoreOpen=!1,this._filterOverflowObserver=null,this._filterOverflowZeroWidthRetries=0,this._desktopFilterWrap=null,this._mobileFilterWrap=null,this._resultsWrap=null,this._stateWrap=null,this._customResultsWrap=null,this._query=``,this._searchOpen=!1,this._selectedFilters=[],this._selectedFilterBackspaceArmed=!1,this._debounceId=null,this._abortController=null,this._docPointerDownHandler=null,this._globalKeydownHandler=null,this._focusOutHandler=null,this._resizeHandler=null,this._desktopShortcutHint=null,this._panelSearchBar=null}static{this._filterMorePanelSeq=0}static{this._filterChipsOverflowMask=`linear-gradient(to right, #000 0%, #000 max(0%, calc(100% - 3.5rem)), transparent 100%)`}static get observedAttributes(){return[`endpoint`,`search-param`,`placeholder`,`filters`,`filter-param`,`open-shortcut`,`open-shortcut-hint`,`collapse-on-mobile`]}connectedCallback(){this.classList.add(`relative`,`block`,`w-full`,`max-w-xl`),this._attachGlobalHandlers(),this._attachFocusOutHandler(),this._attachResizeHandler(),this.render()}disconnectedCallback(){this._docPointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._docPointerDownHandler,!0),null),this._globalKeydownHandler&&=(document.removeEventListener(`keydown`,this._globalKeydownHandler),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null),this._focusOutHandler&&=(this.removeEventListener(`focusout`,this._focusOutHandler,!0),null),this._cancelDebounce(),this._abortSearch(),this._filterOverflowObserver&&=(this._filterOverflowObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_getEndpoint(){return(this.getAttribute(`endpoint`)||``).trim()}_getSearchParam(){return(this.getAttribute(`search-param`)||`q`).trim()||`q`}_getPlaceholder(){return this.getAttribute(`placeholder`)||`Search`}_getFilterParam(){return(this.getAttribute(`filter-param`)||``).trim()}_getFilterOptions(){return(this.getAttribute(`filters`)||``).split(`,`).map(e=>e.trim()).filter(Boolean)}_hasSelectedFilters(){return this._selectedFilters.length>0}_getFilterChipOverflowReservePx(){let e=Math.max(1,this._getFilterOptions().length),t=this._hasSelectedFilters()?28:56;return Math.min(200,t+e*34)}_getFilterParamValue(){return this._selectedFilters.join(`,`)}_getFilterChipLabelText(){return this._selectedFilters.join(`, `)}_getCondensedFilterChipLabel(e=22){if(!this._hasSelectedFilters())return``;let[t=``]=this._selectedFilters,n=this._selectedFilters.length-1,r=Math.max(8,e-2),i=t;if(n<=0)return i.length<=r?i:`${i.slice(0,Math.max(1,r-3))}...`;let a=`${t}, and ${n} more`;return a.length<=r?a:`${a.slice(0,Math.max(1,r-3))}...`}_isMobileViewport(){return window.matchMedia(`(max-width: 1099.98px)`).matches}_collapseOnMobile(){let e=this.getAttribute(`collapse-on-mobile`);if(e===null)return!1;let t=e.trim().toLowerCase();return!(t===`false`||t===`0`||t===`off`||t===`none`)}_primarySearchInput(){return this._isMobileViewport()&&this._collapseOnMobile()?this._panelInput:this._desktopInput}_isApplePlatform(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/i.test(navigator.platform)||/Mac OS/i.test(navigator.userAgent)}_parseOpenShortcut(){let e=(this.getAttribute(`open-shortcut`)??`mod+k`).trim().toLowerCase();if(!e||e===`none`||e===`false`||e===`off`)return{disabled:!0,wantMod:!1,wantMeta:!1,wantCtrl:!1,wantAlt:!1,wantShift:!1,key:``};let t=e.split(`+`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return{disabled:!0,wantMod:!1,wantMeta:!1,wantCtrl:!1,wantAlt:!1,wantShift:!1,key:``};let n=t[t.length-1],r=new Set(t.slice(0,-1).map(e=>e.toLowerCase()));return{disabled:!1,wantMod:r.has(`mod`),wantMeta:r.has(`meta`)||r.has(`cmd`)||r.has(`super`),wantCtrl:r.has(`ctrl`)||r.has(`control`),wantAlt:r.has(`alt`),wantShift:r.has(`shift`),key:n.toLowerCase()}}_eventKeyMatchesShortcutKey(e,t){let n=t.toLowerCase();return(e.key.length,e.key.toLowerCase())===n}_openShortcutMatches(e){let t=this._parseOpenShortcut();return t.disabled||!t.key||e.repeat||!this._eventKeyMatchesShortcutKey(e,t.key)||t.wantShift!==e.shiftKey||t.wantAlt!==e.altKey?!1:t.wantMod||t.wantMeta||t.wantCtrl?!(t.wantMod&&!(e.metaKey||e.ctrlKey)||t.wantMeta&&!e.metaKey||t.wantCtrl&&!e.ctrlKey):!!t.wantAlt}_getOpenShortcutHintText(){let e=this.getAttribute(`open-shortcut-hint`);if(e===`none`||e===`false`)return``;if(e!==null&&e.trim()!==``)return e.trim();let t=this._parseOpenShortcut();if(t.disabled)return``;let n=this._isApplePlatform(),r=[];t.wantMod&&r.push(n?`⌘`:`Ctrl`),t.wantMeta&&!t.wantMod&&r.push(n?`⌘`:`Meta`),t.wantCtrl&&!t.wantMod&&r.push(`Ctrl`),t.wantAlt&&r.push(`Alt`),t.wantShift&&r.push(`Shift`);let i=t.key.length===1?t.key.toUpperCase():t.key;return i?t.wantMod&&!t.wantMeta&&!t.wantCtrl&&!t.wantAlt&&!t.wantShift&&t.key.length===1?`${n?`⌘`:`Ctrl+`}${i}`:[...r,i].join(`+`):``}_attachGlobalHandlers(){this._globalKeydownHandler||(this._globalKeydownHandler=e=>{if(this._openShortcutMatches(e)){e.preventDefault(),this._openSearch(!0);return}if(e.key.toLowerCase()===`escape`&&this._searchOpen){if(this._filtersMoreOpen){this._filtersMoreOpen=!1,this.render(),requestAnimationFrame(()=>this._focusActiveInput());return}this._closeSearch()}},document.addEventListener(`keydown`,this._globalKeydownHandler)),this._docPointerDownHandler||(this._docPointerDownHandler=e=>{if(!this._searchOpen)return;let t=e.composedPath();this._filtersMoreOpen&&this._panelFiltersWrap&&!t.includes(this._panelFiltersWrap)&&(this._filtersMoreOpen=!1,this.render(),requestAnimationFrame(()=>this._focusActiveInput())),!(this._shell&&t.includes(this._shell)||this._panelInner&&t.includes(this._panelInner))&&this._closeSearch()},document.addEventListener(`pointerdown`,this._docPointerDownHandler,!0))}_attachResizeHandler(){this._resizeHandler||(this._resizeHandler=()=>{this._syncPanelVisibility(),this._syncFilterOverflow()},window.addEventListener(`resize`,this._resizeHandler,{passive:!0}))}_attachFocusOutHandler(){this._focusOutHandler||(this._focusOutHandler=e=>{if(!this._searchOpen)return;let t=e.relatedTarget;t&&(this._shell&&this._shell.contains(t)||this._panelInner&&this._panelInner.contains(t)||this._closeSearch())},this.addEventListener(`focusout`,this._focusOutHandler,!0))}_emitSearchOpenChange(){this.dispatchEvent(new CustomEvent(`search-open-change`,{detail:{open:this._searchOpen},bubbles:!0,composed:!0}))}_openSearch(e=!1){this._getEndpoint()&&(this._searchOpen||(this._searchOpen=!0,this._syncPanelVisibility(),this._emitSearchOpenChange(),e&&this._primarySearchInput()?.focus()))}_closeSearch(){this._searchOpen&&(this._searchOpen=!1,this._filtersMoreOpen=!1,this._syncPanelVisibility(),this._emitSearchOpenChange())}_syncPanelVisibility(){if(!this._panel)return;let e=this._panelLayoutBaseClass();this._panel.className=this._searchOpen?e:`${e} hidden`,this._shell&&(this._shell.classList.toggle(`rounded-b-none`,this._searchOpen),this._shell.classList.toggle(`border-b-transparent`,this._searchOpen)),this._positionPanel(),this._searchOpen&&this._scheduleFilterOverflowSync()}_panelLayoutBaseClass(){return!this._isMobileViewport()||!this._collapseOnMobile()?`absolute left-0 right-0 top-full z-[90] p-0 -mt-[9px]`:`fixed left-0 right-0 top-12 z-[90] p-3`}_positionPanel(){this._panel&&(!this._isMobileViewport()||!this._collapseOnMobile())&&(this._panel.style.left=``,this._panel.style.right=``,this._panel.style.top=``,this._panel.style.width=``,this._panel.style.maxWidth=``,this._panel.style.transform=``)}_setQuery(e){let t=this._query;this._query=e,e!==t&&(this._selectedFilterBackspaceArmed=!1),this._desktopInput&&(this._desktopInput.value=e),this._panelInput&&(this._panelInput.value=e)}_cancelDebounce(){this._debounceId!==null&&(window.clearTimeout(this._debounceId),this._debounceId=null)}_abortSearch(){this._abortController&&=(this._abortController.abort(),null)}_normalizeResults(e){return(e=>{if(Array.isArray(e))return e;if(!e||typeof e!=`object`)return[];let t=e;for(let e of[`results`,`items`,`data`,`products`]){let n=t[e];if(Array.isArray(n))return n}return[]})(e).map(e=>{let t=e||{};return{title:String(t.title||t.name||t.label||t.email||t.id||``).trim()||`Untitled`,subtitle:String(t.description||t.category||t.username||``).trim(),parent:String(t.parent||t.type||t.entity||t.kind||t.category||``).trim()||void 0}}).slice(0,8)}_emitResultsChange(e,t){let n=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-results-change`,{detail:{query:this._query,filter:n,filters:[...this._selectedFilters],results:e,raw:t??null},bubbles:!0,composed:!0}))}_emitFilterChange(){let e=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-filter-change`,{detail:{query:this._query,filter:e,filters:[...this._selectedFilters]},bubbles:!0,composed:!0}))}_renderState(e){if(this._customResultsWrap&&this._customResultsWrap.childElementCount>0){this._stateWrap&&this._stateWrap.classList.add(`hidden`),this._resultsWrap&&this._resultsWrap.classList.add(`hidden`);return}this._stateWrap&&(this._stateWrap.textContent=e,this._stateWrap.classList.remove(`hidden`),this._resultsWrap&&(this._resultsWrap.classList.remove(`hidden`),this._resultsWrap.innerHTML=``))}_renderResults(e){if(this._customResultsWrap&&this._customResultsWrap.childElementCount>0){this._stateWrap&&this._stateWrap.classList.add(`hidden`),this._resultsWrap&&this._resultsWrap.classList.add(`hidden`);return}if(!(!this._resultsWrap||!this._stateWrap)){if(this._resultsWrap.innerHTML=``,e.length===0){this._renderState(`No results found`);return}this._stateWrap.classList.add(`hidden`);for(let t of e){let e=document.createElement(`button`);e.type=`button`,e.className=`flex w-full cursor-pointer items-start gap-3 rounded-lg px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-white/10`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`mt-0.5 h-4 w-4 text-gray-500 dark:text-gray-400`;let r=document.createElement(`div`);r.className=`min-w-0`;let i=document.createElement(`div`);if(i.className=`truncate text-sm font-semibold text-gray-900 dark:text-gray-100`,i.textContent=t.title,r.appendChild(i),t.subtitle){let e=document.createElement(`div`);e.className=`truncate text-xs text-gray-500 dark:text-gray-400`,e.textContent=t.subtitle,r.appendChild(e)}e.appendChild(n),e.appendChild(r),e.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`){t.preventDefault(),this._moveFocusInResults(e,1);return}if(t.key===`ArrowUp`){t.preventDefault(),this._moveFocusInResults(e,-1);return}}),e.addEventListener(`click`,()=>{let e=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-select`,{detail:{query:this._query,filter:e,filters:[...this._selectedFilters],result:t},bubbles:!0,composed:!0})),this._closeSearch()}),this._resultsWrap.appendChild(e)}}}_fetchSearchResults(e){let t=this._getEndpoint();if(!t)return;let n=e.trim();if(!n){this._emitResultsChange([]),this._renderState(`Start typing to search`);return}this._abortSearch(),this._abortController=new AbortController,this._renderState(`Searching...`);let r=new URLSearchParams;r.set(this._getSearchParam(),n);let i=this._getFilterParam();i&&this._hasSelectedFilters()&&r.set(i,this._getFilterParamValue());let a=t.includes(`{query}`)?t.replace(`{query}`,encodeURIComponent(n)):`${t}${t.includes(`?`)?`&`:`?`}${r.toString()}`;fetch(a,{signal:this._abortController.signal}).then(e=>{if(!e.ok)throw Error(`Request failed: ${e.status}`);return e.json()}).then(e=>{let t=this._normalizeResults(e);this._emitResultsChange(t,e),this._renderResults(t)}).catch(e=>{e?.name!==`AbortError`&&(this._emitResultsChange([]),this._renderState(`Unable to load results`))})}_scheduleSearch(e){this._setQuery(e),this._cancelDebounce(),this._debounceId=window.setTimeout(()=>this._fetchSearchResults(e),220)}_getNativeInputValue(e){if(!e)return``;let t=e.querySelector(`input, textarea`);return t?t.value||``:e.value||``}_getCurrentInputValue(){let e=document.activeElement;return e&&this._desktopInput&&this._desktopInput.contains(e)?this._getNativeInputValue(this._desktopInput):e&&this._panelInput&&this._panelInput.contains(e)?this._getNativeInputValue(this._panelInput):this._getNativeInputValue(this._primarySearchInput())}_applyFilterSelectionChange(){let e=this._getCurrentInputValue();if(this._setQuery(e),this._emitFilterChange(),this.render(),e.trim()){this._scheduleSearch(e);return}this._cancelDebounce(),this._abortSearch(),this._emitResultsChange([]),this._renderState(`Start typing to search`)}_clearAllSelectedFilters(){this._selectedFilters=[],this._selectedFilterBackspaceArmed=!1,this._applyFilterSelectionChange()}_popLastSelectedFilter(){this._selectedFilters.length!==0&&(this._selectedFilters.pop(),this._selectedFilterBackspaceArmed=!1,this._applyFilterSelectionChange())}_focusActiveInput(){let e=this._primarySearchInput();e&&requestAnimationFrame(()=>{e.focus()})}_focusHideFiltersControl(){let e=this._panelFiltersShowAllBtn;e&&(e.querySelector(`button`)??e).focus()}_getFilterChipElements(){return this._panelFiltersWrap?Array.from(this._panelFiltersWrap.querySelectorAll(`mint-chip`)):[]}_ensurePanelFiltersShell(){!this._panelFiltersWrap||this._panelFiltersMainRow||(this._panelFiltersWrap.replaceChildren(),this._panelFiltersWrap.className=`relative flex shrink-0 flex-col gap-2 px-3 pb-3 pt-5 min-w-0`,this._panelFiltersMainRow=document.createElement(`div`),this._panelFiltersMainRow.className=`flex min-w-0 w-full flex-nowrap items-center gap-2`,this._panelFiltersChips=document.createElement(`div`),this._panelFiltersChips.className=`flex min-w-0 flex-1 flex-nowrap items-center gap-2 overflow-x-hidden`,this._panelFiltersMorePanel=document.createElement(`div`),this._panelFiltersMorePanel.id=`mint-search-filter-more-${e._filterMorePanelSeq++}`,this._panelFiltersMorePanel.className=`hidden absolute left-0 right-0 top-full z-[95] mt-1 flex max-h-[40vh] flex-wrap gap-2 overflow-y-auto rounded-lg border border-gray-200 bg-white p-2 shadow-lg dark:border-mint-divider dark:bg-mint-elevated`,this._panelFiltersShowAllWrap=document.createElement(`div`),this._panelFiltersShowAllWrap.className=`relative flex min-h-0 min-w-0 shrink-0 items-center hidden`,this._panelFiltersShowAllBtn=document.createElement(`mint-button`),this._panelFiltersShowAllBtn.setAttribute(`type`,`button`),this._panelFiltersShowAllBtn.setAttribute(`variant`,`ghost`),this._panelFiltersShowAllBtn.setAttribute(`tone`,`neutral`),this._panelFiltersShowAllBtn.setAttribute(`size`,`small`),this._panelFiltersShowAllBtn.classList.add(`shrink-0`,`whitespace-nowrap`),this._panelFiltersShowAllBtn.setAttribute(`aria-expanded`,`false`),this._panelFiltersShowAllBtn.setAttribute(`aria-controls`,this._panelFiltersMorePanel.id),this._panelFiltersShowAllBtn.addEventListener(`click`,e=>{e.stopPropagation();let t=this._filtersMoreOpen;this._filtersMoreOpen=!this._filtersMoreOpen,this.render(),t&&requestAnimationFrame(()=>this._focusActiveInput())}),this._panelFiltersShowAllWrap.append(this._panelFiltersShowAllBtn),this._panelFiltersMainRow.append(this._panelFiltersChips,this._panelFiltersShowAllWrap),this._setPanelFiltersShowAllLabel(`Show all`),this._panelFiltersWrap.append(this._panelFiltersMainRow,this._panelFiltersMorePanel),typeof ResizeObserver<`u`&&!this._filterOverflowObserver&&(this._filterOverflowObserver=new ResizeObserver(()=>this._syncFilterOverflow()),this._filterOverflowObserver.observe(this._panelFiltersChips),this._filterOverflowObserver.observe(this._panelFiltersMainRow)))}_setPanelFiltersShowAllLabel(e){let t=this._panelFiltersShowAllBtn;if(!t)return;for(let e of Array.from(t.childNodes))e.nodeType===Node.TEXT_NODE&&e.remove();let n=t.querySelector(`button .mint-button-content`)||t.querySelector(`.mint-button-content`);if(n){n.textContent=e;return}let r=t.querySelector(`:scope > button`);if(r){r.replaceChildren(document.createTextNode(e)),t.render?.();return}t.firstElementChild||t.appendChild(document.createTextNode(e))}_scheduleFilterOverflowSync(){requestAnimationFrame(()=>{requestAnimationFrame(()=>this._syncFilterOverflow())})}_setFilterChipsEdgeFade(t){let n=this._panelFiltersChips;n&&(t?(n.style.maskImage=e._filterChipsOverflowMask,n.style.webkitMaskImage=e._filterChipsOverflowMask):(n.style.maskImage=``,n.style.webkitMaskImage=``))}_syncFilterOverflow(){if(!this._panelFiltersChips||!this._panelFiltersShowAllWrap||!this._panelFiltersShowAllBtn)return;if(this._filtersMoreOpen){this._panelFiltersShowAllWrap.classList.remove(`hidden`),this._filterOverflowZeroWidthRetries=0,this._setFilterChipsEdgeFade(!1);return}let e=this._panelFiltersChips.clientWidth;if(e===0&&this._searchOpen){this._filterOverflowZeroWidthRetries<10&&(this._filterOverflowZeroWidthRetries+=1,this._scheduleFilterOverflowSync()),this._setFilterChipsEdgeFade(!1);return}this._filterOverflowZeroWidthRetries=0;let t=this._panelFiltersChips.scrollWidth+this._getFilterChipOverflowReservePx()>e;this._panelFiltersShowAllWrap.classList.toggle(`hidden`,!t),this._setFilterChipsEdgeFade(t)}_getResultFocusableElements(){let e=this._customResultsWrap&&!this._customResultsWrap.classList.contains(`hidden`)?this._customResultsWrap:this._resultsWrap;return e?Array.from(e.querySelectorAll(`button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])`)):[]}_focusFirstChipOrResult(e=!1){let t=this._getFilterChipElements(),n=this._getResultFocusableElements();if(!e){(t[0]||n[0])?.focus();return}(n[n.length-1]||t[t.length-1])?.focus()}_moveFocusInResults(e,t){let n=this._getResultFocusableElements();if(n.length===0)return;let r=n.indexOf(e);if(r===-1)return;let i=n[r+t];if(i){i.focus();return}if(t===-1){let e=this._getFilterChipElements(),t=e[e.length-1];t?t.focus():this._focusActiveInput()}}_renderSelectedFilter(){let e=e=>{if(!e||(e.innerHTML=``,!this._hasSelectedFilters()))return;let t=document.createElement(`mint-chip`);t.setAttribute(`dismissable`,``),t.title=this._getFilterChipLabelText();let n=this._getCondensedFilterChipLabel();t.classList.add(`max-w-[min(20rem,85vw)]`,`whitespace-nowrap`,`overflow-hidden`,`text-ellipsis`,`text-xs`,`px-2`,`py-0.5`),t.style.fontSize=`0.75rem`,t.style.padding=`0.125rem 0.375rem`,t.style.height=`1.375rem`,t.style.lineHeight=`1`,t.style.whiteSpace=`nowrap`,t.style.overflow=`hidden`,t.style.textOverflow=`ellipsis`,this._selectedFilterBackspaceArmed&&t.classList.add(`ring-2`,`ring-brand-400`,`dark:ring-brand-300`),t.textContent=n,t.addEventListener(`dismiss`,e=>{e.stopPropagation(),this._clearAllSelectedFilters()}),e.appendChild(t)};e(this._desktopFilterWrap),e(this._mobileFilterWrap)}_bindInputHandlers(e){let t=()=>{this._scheduleSearch(this._getNativeInputValue(e))};e.addEventListener(`focusin`,()=>this._openSearch(!1)),e.addEventListener(`input`,t),e.addEventListener(`search`,t),e.addEventListener(`change`,t),e.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`){this._searchOpen||this._openSearch(!1),t.preventDefault(),this._focusFirstChipOrResult(!1);return}if(t.key===`ArrowUp`){this._searchOpen||this._openSearch(!1),t.preventDefault(),this._focusFirstChipOrResult(!0);return}if(t.key===`Tab`&&!t.shiftKey&&this._searchOpen){let e=this._getFilterChipElements(),n=this._getResultFocusableElements();if(e.length>0||n.length>0){t.preventDefault(),this._focusFirstChipOrResult(!1);return}}if(t.key!==`Backspace`)return;let n=this._getNativeInputValue(e);if(n!==this._query&&this._setQuery(n),!(n.length>0)&&this._hasSelectedFilters()){if(!this._selectedFilterBackspaceArmed){t.preventDefault(),this._selectedFilterBackspaceArmed=!0,this._renderSelectedFilter();return}t.preventDefault(),this._popLastSelectedFilter()}})}openSearch(e=!0){this._openSearch(e)}closeSearch(){this._closeSearch()}toggleSearch(e=!0){if(this._searchOpen){this._closeSearch();return}this._openSearch(e)}isSearchOpen(){return this._searchOpen}render(){let e=this._getEndpoint();if(this.classList.toggle(`hidden`,!e),!e)return;if(!this._shell){this._shell=document.createElement(`div`),this._shell.className=`relative z-[91] flex h-10 w-full`,this._desktopFilterWrap=document.createElement(`div`),this._desktopFilterWrap.className=`inline-flex shrink-0 max-w-[8.5rem]`,this._desktopFilterWrap.setAttribute(`slot`,`prepend`),this._desktopInput=document.createElement(`mint-input`),this._desktopInput.setAttribute(`type`,`search`),this._desktopInput.setAttribute(`icon`,`search`),this._desktopInput.className=`h-full min-w-0 flex-1`;let e=document.createElement(`span`);e.className=`shrink-0 text-xs text-gray-500 dark:text-gray-400`,e.setAttribute(`slot`,`append`),this._desktopShortcutHint=e,this._bindInputHandlers(this._desktopInput),this._desktopInput.appendChild(this._desktopFilterWrap),this._desktopInput.appendChild(e),this._shell.appendChild(this._desktopInput),this.appendChild(this._shell)}if(!this._panel){this._panel=document.createElement(`div`),this._panel.className=`absolute left-0 right-0 top-full z-[90] hidden p-0 -mt-[9px]`;let e=document.createElement(`div`);e.className=`mx-auto flex max-h-[calc(100dvh-4rem)] w-full flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl dark:border-mint-divider dark:bg-mint-elevated min-[1100px]:rounded-t-none min-[1100px]:border-t-0`,this._panelInner=e;let t=document.createElement(`div`);this._panelSearchBar=t,t.className=`hidden`,this._mobileFilterWrap=document.createElement(`div`),this._mobileFilterWrap.className=`inline-flex shrink-0 max-w-[8.5rem]`,this._mobileFilterWrap.setAttribute(`slot`,`prepend`),this._panelInput=document.createElement(`mint-input`),this._panelInput.setAttribute(`type`,`search`),this._panelInput.className=`min-w-0 flex-1`,this._bindInputHandlers(this._panelInput),this._panelInput.appendChild(this._mobileFilterWrap),t.appendChild(this._panelInput),this._customResultsWrap=document.createElement(`div`),this._customResultsWrap.className=`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,this._stateWrap=document.createElement(`div`),this._stateWrap.className=`px-4 pb-4 text-sm text-gray-500 dark:text-gray-400`,this._stateWrap.textContent=`Start typing to search`,this._resultsWrap=document.createElement(`div`),this._resultsWrap.className=`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,e.appendChild(t),this._panelFiltersWrap=document.createElement(`div`),e.appendChild(this._panelFiltersWrap),this._ensurePanelFiltersShell(),e.appendChild(this._customResultsWrap),e.appendChild(this._stateWrap),e.appendChild(this._resultsWrap),this._panel.appendChild(e),this.appendChild(this._panel)}let t=this._hasSelectedFilters()?``:this._getPlaceholder();if(this._desktopInput&&this._desktopInput.setAttribute(`placeholder`,t),this._panelInput&&this._panelInput.setAttribute(`placeholder`,t),this._desktopShortcutHint){let e=this._getOpenShortcutHintText();this._desktopShortcutHint.textContent=e,this._desktopShortcutHint.classList.toggle(`hidden`,!e)}if(this._panelFiltersWrap){this._ensurePanelFiltersShell();let e=this._getFilterOptions();this._selectedFilters=this._selectedFilters.filter(t=>e.includes(t));let t=e.length>0;t||(this._filtersMoreOpen=!1),this._panelFiltersWrap.classList.toggle(`hidden`,!t),this._stateWrap?.classList.toggle(`pt-4`,!t),this._resultsWrap?.classList.toggle(`pt-4`,!t),this._customResultsWrap?.classList.toggle(`pt-5`,!t),this._panelFiltersChips&&this._panelFiltersChips.replaceChildren(),this._panelFiltersMorePanel&&this._panelFiltersMorePanel.replaceChildren();let n=this._filtersMoreOpen&&this._panelFiltersMorePanel?this._panelFiltersMorePanel:this._panelFiltersChips;for(let t of e){if(!n)break;let r=document.createElement(`mint-chip`),i=this._selectedFilters.includes(t);if(i&&r.classList.add(`ring-2`,`ring-inset`,`ring-brand-400`,`dark:ring-brand-300`),r.classList.add(`cursor-pointer`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-inset`,`focus-visible:ring-brand-400`,`inline-flex`,`items-center`,`gap-1`,`shrink-0`,`whitespace-nowrap`),i){let e=document.createElement(`span`);e.textContent=t;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`close`),n.className=`h-4 w-4 ml-2 shrink-0`,n.setAttribute(`aria-hidden`,`true`),r.append(e,n)}else r.textContent=t;r.tabIndex=0,r.setAttribute(`role`,`button`),r.setAttribute(`aria-label`,i?`Remove filter ${t}`:`Filter by ${t}`),r.dataset.mintSearchFilter=t,r.addEventListener(`pointerdown`,e=>{e.preventDefault()});let a=n=>{n&&n.stopPropagation();let r=this._filtersMoreOpen,i=this._selectedFilters.indexOf(t);i>=0?this._selectedFilters.splice(i,1):this._selectedFilters.push(t),this._selectedFilterBackspaceArmed=!1;let a=e.length>0&&this._selectedFilters.length===e.length,o=this._selectedFilters.length===0;r&&(a||o)&&(this._filtersMoreOpen=!1),this._emitFilterChange(),this._renderSelectedFilter(),this.render(),this._query.trim()&&this._scheduleSearch(this._query),r?a||o?this._focusActiveInput():requestAnimationFrame(()=>{this._getFilterChipElements().find(e=>e.dataset.mintSearchFilter===t)?.focus()}):this._focusActiveInput()};r.addEventListener(`click`,e=>a(e)),r.addEventListener(`keydown`,e=>{let t=this._getFilterChipElements(),n=t.indexOf(r);if(e.key===`Enter`||e.key===` `){e.preventDefault(),a(e);return}if(e.key===`ArrowRight`){e.preventDefault();let r=t[n+1];r&&r.focus();return}if(e.key===`ArrowLeft`){e.preventDefault();let r=t[n-1];r?r.focus():this._filtersMoreOpen?this._focusHideFiltersControl():this._focusActiveInput();return}if(e.key===`ArrowDown`){e.preventDefault(),this._getResultFocusableElements()[0]?.focus();return}if(e.key===`ArrowUp`){e.preventDefault(),this._filtersMoreOpen?this._focusHideFiltersControl():this._focusActiveInput();return}}),n.appendChild(r)}this._panelFiltersChips&&this._panelFiltersChips.classList.toggle(`hidden`,this._filtersMoreOpen),this._panelFiltersMorePanel&&this._panelFiltersMorePanel.classList.toggle(`hidden`,!this._filtersMoreOpen),this._panelFiltersShowAllBtn&&(this._setPanelFiltersShowAllLabel(this._filtersMoreOpen?`Hide filters`:`Show all`),this._panelFiltersShowAllBtn.setAttribute(`aria-expanded`,this._filtersMoreOpen?`true`:`false`)),this._panelInner&&(this._filtersMoreOpen&&t?(this._panelInner.classList.remove(`overflow-hidden`),this._panelInner.classList.add(`overflow-visible`)):(this._panelInner.classList.remove(`overflow-visible`),this._panelInner.classList.add(`overflow-hidden`))),this._scheduleFilterOverflowSync()}if(this._customResultsWrap){Array.from(this.children).filter(e=>e===this._shell||e===this._panel?!1:e.getAttribute(`slot`)===`results`).forEach(e=>this._customResultsWrap.appendChild(e));let e=this._customResultsWrap.childElementCount>0;this._customResultsWrap.classList.toggle(`hidden`,!e),e?(this._stateWrap?.classList.add(`hidden`),this._resultsWrap?.classList.add(`hidden`)):this._resultsWrap?.classList.remove(`hidden`)}this._renderSelectedFilter(),this._syncResponsiveChrome(),this._syncPanelVisibility()}_syncResponsiveChrome(){let e=this._collapseOnMobile();this._shell&&(this._shell.className=e?`relative z-[91] hidden h-10 w-full min-[1100px]:flex`:`relative z-[91] flex h-10 w-full`),this._panelSearchBar&&(this._panelSearchBar.className=e?`flex shrink-0 items-center gap-2 border-b border-gray-200 p-3 dark:border-mint-divider min-[1100px]:hidden`:`hidden`)}};customElements.get(`mint-search`)||customElements.define(`mint-search`,W);var G=class extends HTMLElement{constructor(...e){super(...e),this._lastScrollY=0,this._scrollHandler=null}connectedCallback(){this.classList.add(`fixed`,`bottom-0`,`left-0`,`right-0`,`z-30`,`flex`,`w-full`,`items-stretch`,`justify-around`,`gap-1`,`border-t`,`border-gray-200`,`bg-white`,`px-1`,`pt-1`,`pb-[env(safe-area-inset-bottom,0px)]`,`min-[1100px]:hidden`,`transition-transform`,`duration-200`,`ease-out`,`translate-y-0`,`dark:border-mint-divider`,`dark:bg-mint-nav`),this.setAttribute(`role`,`navigation`),this.setAttribute(`aria-label`,`Primary`),this._lastScrollY=window.scrollY,this._attachScrollListener()}disconnectedCallback(){this._detachScrollListener()}_attachScrollListener(){this._scrollHandler||(this._scrollHandler=()=>{let e=window.scrollY;if(e<=8){this.classList.remove(`translate-y-full`),this.classList.add(`translate-y-0`),this._lastScrollY=e;return}let t=e-this._lastScrollY;Math.abs(t)<4||(t>0?(this.classList.remove(`translate-y-0`),this.classList.add(`translate-y-full`)):(this.classList.remove(`translate-y-full`),this.classList.add(`translate-y-0`)),this._lastScrollY=e)},window.addEventListener(`scroll`,this._scrollHandler,{passive:!0}))}_detachScrollListener(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}};customElements.get(`mint-bottom-navigation`)||customElements.define(`mint-bottom-navigation`,G);var K=class extends HTMLElement{constructor(...e){super(...e),this._root=null}static get observedAttributes(){return[`icon`,`label`,`href`,`active`]}connectedCallback(){this.classList.add(`contents`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isActive(){return this.getAttribute(`active`)===`true`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}render(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=this._isActive(),i=r?`text-gray-900 dark:text-gray-100`:`text-gray-600 hover:bg-black/5 dark:text-gray-300 dark:hover:bg-white/10`,a;e?(a=document.createElement(`a`),a.href=e):(a=document.createElement(`button`),a.type=`button`),a.className=`flex min-w-0 flex-1 flex-col items-center justify-center gap-1 rounded-lg px-1 py-2 text-center text-[11px] font-medium leading-tight ${i}`,a.setAttribute(`aria-current`,r?`page`:`false`),a.setAttribute(`aria-label`,t||`Navigation item`);let o=document.createElement(`span`);if(o.className=`inline-flex h-6 w-6 items-center justify-center`,n){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,n),e.className=r?`h-6 w-6`:`h-6 w-6 opacity-90`,o.appendChild(e)}let s=document.createElement(`span`);s.className=`block w-full truncate`,s.textContent=t,a.appendChild(o),a.appendChild(s),this.replaceChildren(a),this._root=a}};customElements.get(`mint-bottom-nav-item`)||customElements.define(`mint-bottom-nav-item`,K),exports.Alert=E,exports.BackButton=l,exports.BottomNavItem=K,exports.BottomNavigation=G,exports.Button=r,exports.default=r,exports.Card=s,exports.Chart=L,exports.Checkbox=m,exports.Chip=C,exports.Choice=g,exports.Clickable=T,exports.DatePicker=v,exports.Dropzone=b,exports.Form=x,exports.Grid=d,exports.Icon=n,exports.Input=_,exports.Link=c,exports.Modal=f,exports.OffCanvas=M,exports.Page=u,exports.Popover=p,exports.ResourceTable=D,exports.Search=W,exports.Select=y,exports.SideNavigation=H,exports.SideNavigationActionLinks=B,exports.SideNavigationActionMenu=V,exports.SideNavigationLink=R,exports.SideNavigationLinks=z,exports.Spinner=t,exports.Stack=o,exports.Switch=i,exports.Tab=N,exports.TabContent=F,exports.TabList=P,exports.Table=S,exports.Tabs=I,exports.Tags=w,exports.Text=a,exports.TopNavigation=U;
133
+ `,a.textContent=e.name,i.appendChild(a),t.appendChild(i)}),this._svg.appendChild(t),{height:this._legendHeight+50}}async addDataPoint(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data.push(t),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async batchAddDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,point:r}of e)this._chartData.datasets[n]&&(this._chartData.datasets[n].data.push(r),t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async updateDatasetData(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data=t,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async addDataset(e){return this._chartData?(this._chartData.datasets.push(e),e.id&&this._datasetVisibility.set(e.id,e.visible!==!1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))):(console.error(`Chart data not initialized`),Promise.reject(Error(`Chart data not initialized`)))}async removeDataset(e){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets.splice(e,1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async updateDataPoint(e,t,n){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):this._chartData.datasets[e].data[t]?(this._chartData.datasets[e].data[t]=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))):(console.error(`Data point at index ${t} does not exist`),Promise.reject(Error(`Data point at index ${t} does not exist`)))}async batchUpdateDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,pointIndex:r,point:i}of e)this._chartData.datasets[n]?.data[r]&&(this._chartData.datasets[n].data[r]=i,t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async removeDataPoint(e,t){return!this._chartData||!this._chartData.datasets[e]?(console.error(`Dataset at index ${e} does not exist`),Promise.reject(Error(`Dataset at index ${e} does not exist`))):(this._chartData.datasets[e].data.splice(t,1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e())))}async batchRemoveDataPoints(e){if(!this._chartData)return Promise.resolve();let t=!1;for(let{datasetIndex:n,pointIndex:r}of e)this._chartData.datasets[n]?.data[r]&&(this._chartData.datasets[n].data.splice(r,1),t=!0);return t&&(this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender()),new Promise(e=>requestAnimationFrame(()=>e()))}async showDataset(e){return this._datasetVisibility.set(e,!0),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))}async hideDataset(e){return this._datasetVisibility.set(e,!1),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),new Promise(e=>requestAnimationFrame(()=>e()))}async toggleDataset(e){let t=!(this._datasetVisibility.get(e)??!0);return this._datasetVisibility.set(e,t),this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent.clear(),this._scheduleRender(),await new Promise(e=>requestAnimationFrame(()=>e())),t}isDatasetVisible(e){return this._datasetVisibility.get(e)}async downloadAsPNG(e=`chart.png`){if(!this._svg)return console.error(`Chart SVG not found`),Promise.reject(Error(`Chart SVG not found`));let t=this._svg.cloneNode(!0),n=this._width,r=this._height;t.querySelectorAll(`text`).forEach(e=>{let t=e.getAttribute(`font-family`);(!t||t.includes(`system-ui`)||t.includes(`apple-system`))&&e.setAttribute(`font-family`,`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`)}),t.setAttribute(`width`,n.toString()),t.setAttribute(`height`,r.toString()),t.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),t.querySelectorAll(`foreignObject`).forEach(e=>{let t=e.querySelector(`div`);if(t){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),r=e.getAttribute(`x`)||`0`,i=e.getAttribute(`y`)||`0`;n.setAttribute(`x`,r),n.setAttribute(`y`,(parseFloat(i)+12).toString()),n.setAttribute(`fill`,t.style.color||`#374151`),n.setAttribute(`font-size`,`12`),n.setAttribute(`font-family`,t.style.fontFamily||`system-ui, -apple-system, sans-serif`),n.textContent=t.textContent||``,e.parentNode&&e.parentNode.replaceChild(n,e)}});let i=new XMLSerializer().serializeToString(t),a=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(i),o=new Image;return o.crossOrigin=`anonymous`,new Promise((t,i)=>{o.onload=()=>{setTimeout(()=>{let a=document.createElement(`canvas`);a.width=n+60,a.height=r+60;let s=a.getContext(`2d`);if(!s){console.error(`Could not get canvas context`),i(Error(`Could not get canvas context`));return}s.fillStyle=document.documentElement.classList.contains(`dark`)?`#111827`:`#ffffff`,s.fillRect(0,0,a.width,a.height),s.drawImage(o,30,30),a.toBlob(n=>{if(!n){console.error(`Could not create blob from canvas`),i(Error(`Could not create blob from canvas`));return}let r=URL.createObjectURL(n),a=document.createElement(`a`);a.href=r,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r),t()},`image/png`)},0)},o.onerror=()=>{console.error(`Error loading SVG image`),i(Error(`Error loading SVG image`))},o.src=a})}};customElements.get(`mint-chart`)||customElements.define(`mint-chart`,L);var R=class extends HTMLElement{constructor(...e){super(...e),this._trigger=null,this._submenuContainer=null}static get observedAttributes(){return[`label`,`icon`,`href`,`active`,`expanded`,`submenu-item`]}connectedCallback(){this.classList.add(`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`active`&&this._isSubmenuItem()&&this._refreshDropdownAncestor())}_refreshDropdownAncestor(){let e=this.parentElement;for(;e;){if(e.tagName===`MINT-SIDENAV-LINK`&&e!==this){e.render();break}e=e.parentElement}}_isActive(){return this.getAttribute(`active`)===`true`}_isExpanded(){return this.getAttribute(`expanded`)===`true`}_isSubmenuPanelVisible(){return this._isExpanded()||this._isActive()}_isSubmenuItem(){return this.getAttribute(`submenu-item`)===`true`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}_getBaseClasses(){let e=this._isActive()?`border-black/20 bg-black/5 text-black dark:border-white/20 dark:bg-white/10 dark:text-white`:`border-transparent text-gray-700 hover:bg-black/5 dark:text-gray-200 dark:hover:bg-white/10`;return[`w-full`,`cursor-pointer`,`rounded-lg`,`border`,`block`,this._isSubmenuItem()?`px-2 py-1.5`:`px-3 py-2`,`text-left`,`text-sm`,e].join(` `)}_hasSubmenu(){return this.querySelectorAll(`:scope > [slot="submenu"]`).length>0?!0:!!this._submenuContainer&&this._submenuContainer.children.length>0}_createRow(e,t){let n=document.createElement(`span`);if(this._isSubmenuItem(),n.className=`inline-flex w-full items-center justify-start gap-2`,t){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,t),e.className=`h-4 w-4 shrink-0`,n.appendChild(e)}let r=document.createElement(`span`);return r.className=`inline truncate`,r.textContent=e,n.appendChild(r),n}_buildSimpleLink(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=e?document.createElement(`a`):document.createElement(`button`);e?(r.setAttribute(`href`,e),r.setAttribute(`role`,`link`)):r.setAttribute(`type`,`button`),r.className=this._getBaseClasses(),r.setAttribute(`aria-label`,t||`Side navigation link`),r.appendChild(this._createRow(t,n)),this.replaceChildren(r),this._trigger=r}_emitAccordionExpand(){this.dispatchEvent(new CustomEvent(`mint-sidenav-accordion`,{bubbles:!0,composed:!0,detail:{source:this}}))}_setExpanded(e,t){this.setAttribute(`expanded`,String(e)),e&&t&&this._emitAccordionExpand()}_buildDropdownLink(){let e=this._getLabel(),t=this._getIcon(),n=this._getHref(),r=Array.from(this.querySelectorAll(`:scope > [slot="submenu"]`)),i=r.length>0?r:this._submenuContainer?Array.from(this._submenuContainer.children):[],a=document.createElement(`div`);a.className=`w-full`,this._submenuContainer=document.createElement(`div`),this._submenuContainer.id=`mint-sidenav-submenu-${Math.random().toString(36).slice(2,11)}`;let o=this._submenuContainer.id;if(this._submenuContainer.className=[`mint-sidenav-submenu`,`mt-1`,`ml-5`,`border-l`,`border-gray-200`,`pl-2`,`space-y-1`,`dark:border-mint-divider`,this._isSubmenuPanelVisible()?`block`:`hidden`].join(` `),i.forEach(e=>{e.setAttribute(`submenu-item`,`true`),e.setAttribute(`slot`,`submenu`),this._submenuContainer?.appendChild(e)}),n){let r=document.createElement(`a`);r.setAttribute(`href`,n),r.className=`${this._getBaseClasses()} block w-full`,r.setAttribute(`aria-expanded`,String(this._isSubmenuPanelVisible())),r.setAttribute(`aria-controls`,o),this._isActive()?r.setAttribute(`aria-current`,`page`):r.removeAttribute(`aria-current`),r.appendChild(this._createRow(e,t)),r.addEventListener(`click`,()=>{this._setExpanded(!0,!0)}),a.appendChild(r),this._trigger=r}else{let n=document.createElement(`button`);n.type=`button`,n.className=`${this._getBaseClasses()} block w-full`,n.setAttribute(`aria-expanded`,String(this._isSubmenuPanelVisible())),n.setAttribute(`aria-controls`,o),n.appendChild(this._createRow(e,t)),n.onclick=()=>{let e=!this._isExpanded();this._setExpanded(e,e)},a.appendChild(n),this._trigger=n}a.appendChild(this._submenuContainer),this.replaceChildren(a)}render(){this._hasSubmenu()&&!this._isSubmenuItem()?this._buildDropdownLink():this._buildSimpleLink()}};customElements.get(`mint-sidenav-link`)||customElements.define(`mint-sidenav-link`,R);var z=class extends HTMLElement{constructor(...e){super(...e),this._container=null,this._title=null,this._titleLabel=null,this._titleCaret=null,this._list=null,this._titleClickHandler=null,this._listenerCounts=new Map}static get observedAttributes(){return[`name`]}get onMintNameClick(){return this._onMintNameClick}set onMintNameClick(e){this._onMintNameClick=e,this.render()}addEventListener(e,t,n){super.addEventListener(e,t,n),this._trackListener(e,1)}removeEventListener(e,t,n){super.removeEventListener(e,t,n),this._trackListener(e,-1)}connectedCallback(){this.classList.add(`block`),this.render()}disconnectedCallback(){this._title&&this._titleClickHandler&&(this._title.removeEventListener(`click`,this._titleClickHandler),this._title.removeEventListener(`keydown`,this._titleClickHandler))}attributeChangedCallback(e,t,n){t!==n&&this.render()}_getName(){return this.getAttribute(`name`)||``}_trackListener(e,t){if(e!==`mint-name-click`)return;let n=this._listenerCounts.get(e)||0,r=Math.max(0,n+t);this._listenerCounts.set(e,r),this.render()}_isNameInteractive(){return(this._listenerCounts.get(`mint-name-click`)||0)>0||typeof this._onMintNameClick==`function`}_emitNameClick(e){let t=new CustomEvent(`mint-name-click`,{detail:{name:this._getName(),originalEvent:e},bubbles:!0,composed:!0});this.dispatchEvent(t),typeof this._onMintNameClick==`function`&&this._onMintNameClick(t)}render(){this._container||(this._container=document.createElement(`section`),this._container.className=`mb-4`,this.appendChild(this._container)),this._title||(this._title=document.createElement(`button`),this._title.setAttribute(`type`,`button`),this._title.className=`mb-2 w-full`,this._titleLabel=document.createElement(`mint-text`),this._titleLabel.setAttribute(`size`,`small`),this._titleLabel.setAttribute(`bold`,`true`),this._titleCaret=document.createElement(`mint-icon`),this._titleCaret.setAttribute(`name`,`caret-right`),this._titleCaret.className=`ml-auto inline-flex h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400`,this._title.appendChild(this._titleLabel),this._title.appendChild(this._titleCaret),this._titleClickHandler=e=>{this._isNameInteractive()&&(e instanceof KeyboardEvent&&e.key!==`Enter`&&e.key!==` `||(e instanceof KeyboardEvent&&e.key===` `&&e.preventDefault(),this._emitNameClick(e)))},this._title.addEventListener(`click`,this._titleClickHandler),this._title.addEventListener(`keydown`,this._titleClickHandler),this._container.appendChild(this._title));let e=this._getName(),t=e.trim().length>0,n=this._isNameInteractive();this._titleLabel&&(this._titleLabel.textContent=e,this._titleLabel.className=`uppercase tracking-wide text-gray-500 dark:text-gray-400`),this._title&&(this._title.className=n?[`mb-2`,`w-full`,`inline-flex`,`items-center`,`gap-2`,`rounded-lg`,`border`,`border-transparent`,`px-3`,`py-2`,`text-left`,`hover:bg-black/5`,`dark:hover:bg-white/10`,`cursor-pointer`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-black/20`,`dark:focus-visible:ring-white/20`].join(` `):`mb-2 w-full inline-flex items-center gap-2 rounded-lg border border-transparent px-3 py-2 text-left cursor-default`,this._title.tabIndex=n?0:-1,this._title.disabled=!n,this._title.setAttribute(`aria-disabled`,String(!n))),this._titleCaret&&(this._titleCaret.style.display=n?``:`none`,this._titleCaret.setAttribute(`aria-hidden`,String(!n))),t?this._title.parentElement!==this._container&&this._container?.insertBefore(this._title,this._list):this._title.parentElement===this._container&&this._container?.removeChild(this._title),this._list||(this._list=document.createElement(`div`),this._list.className=`space-y-1`,this._container.appendChild(this._list)),Array.from(this.children).filter(e=>e!==this._container&&e.tagName===`MINT-SIDENAV-LINK`).forEach(e=>{this._list&&e.parentElement!==this._list&&this._list.appendChild(e)})}};customElements.get(`mint-sidenav-links`)||customElements.define(`mint-sidenav-links`,z);var B=class extends HTMLElement{static get observedAttributes(){return[`separated`]}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isSeparated(){return this.getAttribute(`separated`)===`true`}render(){this.className=this._isSeparated()?`block w-full mt-2 border-t border-gray-200 pt-2 px-2 pb-2 dark:border-mint-divider`:`block w-full p-2`}};customElements.get(`mint-sidenav-action-links`)||customElements.define(`mint-sidenav-action-links`,B);var V=class extends HTMLElement{constructor(...e){super(...e),this._wrapper=null,this._trigger=null,this._popover=null,this._triggerId=``}static get observedAttributes(){return[`title`,`subtitle`]}connectedCallback(){this.classList.add(`block`),this._triggerId=this.id?`${this.id}-trigger`:`mint-sidenav-action-menu-${Math.random().toString(36).slice(2,9)}`,this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_getTitle(){return this.getAttribute(`title`)||``}_getSubtitle(){return this.getAttribute(`subtitle`)||``}_createDefaultGroup(){let e=document.createElement(`mint-sidenav-action-links`),t=document.createElement(`div`);return t.appendChild(e),t}render(){let e=Array.from(this.children).filter(e=>e!==this._wrapper&&e.getAttribute(`slot`)===`action-links`);this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative`,this.appendChild(this._wrapper)),this._wrapper.innerHTML=``,this._trigger=document.createElement(`button`),this._trigger.type=`button`,this._trigger.id=this._triggerId,this._trigger.className=`flex w-full cursor-pointer items-center gap-3 rounded-xl border border-gray-200 bg-gray-50 px-3 py-2 text-left hover:bg-gray-100 dark:border-mint-divider dark:bg-white/5 dark:hover:bg-white/10`;let t=document.createElement(`div`);t.className=`inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gray-700 text-xs font-semibold text-white dark:bg-mint-nav`,t.textContent=this._getTitle().split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase();let n=document.createElement(`div`);n.className=`min-w-0 flex-1`;let r=document.createElement(`mint-text`);r.setAttribute(`size`,`body`),r.setAttribute(`bold`,`true`),r.className=`truncate text-gray-900 dark:text-gray-100`,r.textContent=this._getTitle();let i=document.createElement(`mint-text`);i.setAttribute(`size`,`small`),i.setAttribute(`variant`,`muted`),i.className=`truncate`,i.textContent=this._getSubtitle(),n.appendChild(r),n.appendChild(i),this._trigger.appendChild(t),this._trigger.appendChild(n),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`right`),this._popover.setAttribute(`padding`,`0`);let a=document.createElement(`div`);a.className=`w-64`,e.length>0?e.forEach(e=>{e.setAttribute(`hidden`,`true`);let t=e.cloneNode(!0);t.removeAttribute(`hidden`),t.removeAttribute(`slot`),a.appendChild(t)}):a.appendChild(this._createDefaultGroup()),this._popover.appendChild(a),this._wrapper.appendChild(this._trigger),this._wrapper.appendChild(this._popover)}};customElements.get(`mint-sidenav-action-menu`)||customElements.define(`mint-sidenav-action-menu`,V);var H=class extends HTMLElement{constructor(...e){super(...e),this._backdrop=null,this._container=null,this._header=null,this._content=null,this._footer=null,this._escapeHandler=null,this._mediaQuery=null,this._mediaListener=null,this._accordionHandler=null,this._onMobileNavNavigateClick=e=>{if(this._mediaQuery?.matches)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`a[href]`);if(!(n instanceof HTMLAnchorElement)||!this._container?.contains(n))return;let r=n.getAttribute(`href`);!r||r===`#`||r.trim().toLowerCase().startsWith(`javascript:`)||this._isOpen()&&this.removeAttribute(`open`)}}static get observedAttributes(){return[`user-name`,`user-status`,`open`,`drawer-top-class`]}connectedCallback(){this.classList.add(`relative`,`block`,`shrink-0`,`w-0`,`overflow-visible`,`min-[1100px]:w-[17rem]`,`min-[1100px]:shrink-0`),this._attachEscapeListener(),this._attachMediaListener(),this._attachAccordionListener(),this.render()}disconnectedCallback(){this._detachEscapeListener(),this._detachMediaListener(),this._detachAccordionListener()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_attachEscapeListener(){this._escapeHandler||(this._escapeHandler=e=>{e.key===`Escape`&&this.getAttribute(`open`)===`true`&&this.removeAttribute(`open`)},document.addEventListener(`keydown`,this._escapeHandler))}_detachEscapeListener(){this._escapeHandler&&=(document.removeEventListener(`keydown`,this._escapeHandler),null)}_attachMediaListener(){this._mediaListener||(this._mediaQuery=window.matchMedia(`(min-width: 1100px)`),this._mediaListener=()=>{this._mediaQuery?.matches&&this.removeAttribute(`open`)},this._mediaQuery.addEventListener(`change`,this._mediaListener))}_detachMediaListener(){this._mediaQuery&&this._mediaListener&&this._mediaQuery.removeEventListener(`change`,this._mediaListener),this._mediaQuery=null,this._mediaListener=null}_attachAccordionListener(){this._accordionHandler||(this._accordionHandler=e=>{let t=e.detail?.source;!(t instanceof HTMLElement)||t.tagName!==`MINT-SIDENAV-LINK`||this.contains(t)&&this.querySelectorAll(`mint-sidenav-link`).forEach(e=>{e!==t&&e.querySelector(`:scope .mint-sidenav-submenu`)&&e.setAttribute(`expanded`,`false`)})},this.addEventListener(`mint-sidenav-accordion`,this._accordionHandler))}_detachAccordionListener(){this._accordionHandler&&=(this.removeEventListener(`mint-sidenav-accordion`,this._accordionHandler),null)}getUserName(){return this.getAttribute(`user-name`)||`Acme Inc`}getUserStatus(){return this.getAttribute(`user-status`)||`Enterprise`}_isOpen(){return this.getAttribute(`open`)===`true`}_ensureBackdrop(){this._backdrop||(this._backdrop=document.createElement(`div`),this._backdrop.setAttribute(`aria-hidden`,`true`),this._backdrop.addEventListener(`click`,()=>this.removeAttribute(`open`)),this.insertBefore(this._backdrop,this.firstChild))}_ensureContainer(){this._container||(this._container=document.createElement(`aside`),this._container.addEventListener(`click`,this._onMobileNavNavigateClick,!0),this.appendChild(this._container))}_syncShell(){let e=`max-[1099.98px]:top-14`,t=this._isOpen();if(this._backdrop&&(this._backdrop.className=[`fixed`,e,`left-0`,`right-0`,`bottom-0`,`z-40`,`bg-black/50`,`transition-opacity`,`duration-200`,`min-[1100px]:hidden`,t?`pointer-events-auto opacity-100`:`pointer-events-none opacity-0`].join(` `)),this._container){let n=t?`max-[1099.98px]:translate-x-0`:`max-[1099.98px]:-translate-x-full`;this._container.className=[`flex`,`min-h-0`,`flex-col`,`border-r`,`border-gray-200`,`bg-white`,`p-2`,`dark:border-mint-divider`,`dark:bg-mint-nav`,`w-[4.75rem]`,`max-[1099.98px]:fixed`,e,`max-[1099.98px]:bottom-0`,`max-[1099.98px]:left-0`,`max-[1099.98px]:z-50`,`max-[1099.98px]:h-auto`,`max-[1099.98px]:w-[17rem]`,`max-[1099.98px]:max-w-[85vw]`,`max-[1099.98px]:shadow-xl`,`max-[1099.98px]:transition-transform`,`max-[1099.98px]:duration-200`,`max-[1099.98px]:ease-out`,n,`min-[1100px]:fixed`,`min-[1100px]:left-0`,`min-[1100px]:top-14`,`min-[1100px]:bottom-0`,`min-[1100px]:z-[60]`,`min-[1100px]:w-[17rem]`,`min-[1100px]:p-3`,`min-[1100px]:shadow-none`].join(` `)}}_buildUserHeader(){if(!this._container)return;this._header||(this._header=document.createElement(`div`),this._header.className=`mb-4`,this._container.appendChild(this._header));let e=Array.from(this.querySelectorAll(`[slot="action-header"]`)).find(e=>e!==this._backdrop&&e!==this._container);if(e){this._header.replaceChildren(e);return}let t=document.createElement(`mint-sidenav-action-menu`);t.setAttribute(`title`,this.getUserName()),t.setAttribute(`subtitle`,this.getUserStatus()),this._header.replaceChildren(t)}_replaceSlottedChildren(e,t){let n=Array.from(this.querySelectorAll(`[slot="${t}"]`)).filter(e=>e!==this._container&&e!==this._backdrop);e.replaceChildren(...n)}_buildContent(){this._container&&(this._content||(this._content=document.createElement(`div`),this._content.className=`min-h-0 grow overflow-y-auto`,this._container.appendChild(this._content)),this._replaceSlottedChildren(this._content,`links`))}_buildFooter(){if(!this._container)return;this._footer||(this._footer=document.createElement(`div`),this._footer.className=`mt-auto border-t border-gray-200 py-3 dark:border-mint-divider`,this._container.appendChild(this._footer));let e=document.createElement(`div`);e.className=`space-y-1`,this._replaceSlottedChildren(e,`bottom-links`),this._footer.innerHTML=``,this._footer.appendChild(e)}render(){this._ensureBackdrop(),this._ensureContainer(),this._syncShell(),this._buildUserHeader(),this._buildContent(),this._buildFooter()}};customElements.get(`mint-side-navigation`)||customElements.define(`mint-side-navigation`,H);var U=class extends HTMLElement{constructor(...e){super(...e),this._bar=null,this._menuButton=null,this._logoLink=null,this._menuClickHandler=null,this._darkModeObserver=null,this._resizeHandler=null,this._desktopSearchInput=null,this._desktopSearchShell=null,this._mobileSearchButton=null,this._searchPanel=null,this._searchPanelInput=null,this._searchResultsWrap=null,this._searchStateWrap=null,this._searchDebounceId=null,this._searchAbortController=null,this._searchOpen=!1,this._searchQuery=``,this._globalKeydownHandler=null,this._docClickHandler=null}static get observedAttributes(){return[`logo-src`,`logo-src-light`,`logo-src-dark`,`logo-src-mobile`,`logo-src-mobile-light`,`logo-src-mobile-dark`,`logo-href`,`logo-alt`,`menu-target`,`search-endpoint`,`search-param`,`search-placeholder`]}connectedCallback(){this.classList.add(`relative`,`block`,`h-14`,`w-full`,`shrink-0`),this._observeDarkMode(),this._attachResizeListener(),this._attachGlobalHandlers(),this.render()}disconnectedCallback(){this._menuButton&&this._menuClickHandler&&(this._menuButton.removeEventListener(`click`,this._menuClickHandler),this._menuClickHandler=null),this._disconnectDarkModeObserver(),this._detachResizeListener(),this._detachGlobalHandlers(),this._cancelSearchDebounce(),this._abortSearch()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isDarkMode(){return document.documentElement.classList.contains(`dark`)}_isMobileViewport(){return window.matchMedia(`(max-width: 1099.98px)`).matches}_getLogoSrc(){let e=this.getAttribute(`logo-src`)||``,t=this.getAttribute(`logo-src-light`)||``,n=this.getAttribute(`logo-src-dark`)||``,r=this.getAttribute(`logo-src-mobile`)||``,i=this.getAttribute(`logo-src-mobile-light`)||``,a=this.getAttribute(`logo-src-mobile-dark`)||``,o=this._isDarkMode(),s=this._isMobileViewport();return s&&o?a||r||n||t||e:s&&!o?i||r||t||n||e:o?n||t||e:t||n||e}_getLogoHref(){return this.getAttribute(`logo-href`)||`/`}_getLogoAlt(){return this.getAttribute(`logo-alt`)||`Home`}_getMenuTargetId(){return(this.getAttribute(`menu-target`)||``).replace(/^#/,``)}_getSearchEndpoint(){return(this.getAttribute(`search-endpoint`)||``).trim()}_getSearchParam(){return(this.getAttribute(`search-param`)||`q`).trim()||`q`}_getSearchPlaceholder(){return this.getAttribute(`search-placeholder`)||`Search`}_isSearchEnabled(){return!!this._getSearchEndpoint()}_attachGlobalHandlers(){this._globalKeydownHandler||(this._globalKeydownHandler=e=>{let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&t===`k`){e.preventDefault(),this._openSearch(!0);return}t===`escape`&&this._searchOpen&&this._closeSearch()},document.addEventListener(`keydown`,this._globalKeydownHandler)),this._docClickHandler||(this._docClickHandler=e=>{if(!this._searchOpen)return;let t=e.target;t&&(this.contains(t)||this._closeSearch())},document.addEventListener(`click`,this._docClickHandler))}_detachGlobalHandlers(){this._globalKeydownHandler&&=(document.removeEventListener(`keydown`,this._globalKeydownHandler),null),this._docClickHandler&&=(document.removeEventListener(`click`,this._docClickHandler),null)}_cancelSearchDebounce(){this._searchDebounceId!==null&&(window.clearTimeout(this._searchDebounceId),this._searchDebounceId=null)}_abortSearch(){this._searchAbortController&&=(this._searchAbortController.abort(),null)}_openSearch(e=!1){if(this._isSearchEnabled()&&(this._searchOpen=!0,this._syncSearchPanelVisibility(),e)){let e=this._isMobileViewport()?this._searchPanelInput:this._desktopSearchInput;e?.focus(),e?.select()}}_closeSearch(){this._searchOpen=!1,this._syncSearchPanelVisibility()}_syncSearchPanelVisibility(){this._searchPanel&&(this._searchPanel.classList.toggle(`hidden`,!this._searchOpen),this._syncDesktopSearchOpenState(),this._positionSearchPanel())}_syncDesktopSearchOpenState(){this._desktopSearchShell&&(this._desktopSearchShell.classList.toggle(`rounded-b-none`,this._searchOpen),this._desktopSearchShell.classList.toggle(`border-b-transparent`,this._searchOpen))}_positionSearchPanel(){if(!this._searchPanel)return;if(this._isMobileViewport()||!this._desktopSearchShell){this._searchPanel.style.left=``,this._searchPanel.style.right=``,this._searchPanel.style.top=``,this._searchPanel.style.width=``,this._searchPanel.style.maxWidth=``,this._searchPanel.style.transform=``;return}let e=this._desktopSearchShell.getBoundingClientRect();this._searchPanel.style.left=`${e.left}px`,this._searchPanel.style.right=`auto`,this._searchPanel.style.top=`${e.bottom-1}px`,this._searchPanel.style.width=`${e.width}px`,this._searchPanel.style.maxWidth=`${e.width}px`,this._searchPanel.style.transform=`none`}_setSearchQuery(e){this._searchQuery=e,this._desktopSearchInput&&this._desktopSearchInput.value!==e&&(this._desktopSearchInput.value=e),this._searchPanelInput&&this._searchPanelInput.value!==e&&(this._searchPanelInput.value=e)}_normalizeResults(e){return(e=>{if(Array.isArray(e))return e;if(!e||typeof e!=`object`)return[];let t=e;for(let e of[`results`,`items`,`data`,`products`]){let n=t[e];if(Array.isArray(n))return n}return[]})(e).map(e=>{let t=e||{};return{title:String(t.title||t.name||t.label||t.email||t.id||``).trim()||`Untitled`,subtitle:String(t.description||t.category||t.username||``).trim()}}).slice(0,8)}_renderSearchState(e){this._searchStateWrap&&(this._searchStateWrap.textContent=e,this._searchStateWrap.classList.remove(`hidden`),this._searchResultsWrap&&(this._searchResultsWrap.innerHTML=``))}_renderSearchResults(e){if(!(!this._searchResultsWrap||!this._searchStateWrap)){if(this._searchResultsWrap.innerHTML=``,e.length===0){this._renderSearchState(`No results found`);return}this._searchStateWrap.classList.add(`hidden`);for(let t of e){let e=document.createElement(`button`);e.type=`button`,e.className=`flex w-full cursor-pointer items-start gap-3 rounded-lg px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-white/10`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`mt-0.5 h-4 w-4 text-gray-500 dark:text-gray-400`;let r=document.createElement(`div`);r.className=`min-w-0`;let i=document.createElement(`div`);if(i.className=`truncate text-sm font-semibold text-gray-900 dark:text-gray-100`,i.textContent=t.title,r.appendChild(i),t.subtitle){let e=document.createElement(`div`);e.className=`truncate text-xs text-gray-500 dark:text-gray-400`,e.textContent=t.subtitle,r.appendChild(e)}e.appendChild(n),e.appendChild(r),e.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`search-select`,{detail:{query:this._searchQuery,result:t},bubbles:!0,composed:!0})),this._closeSearch()}),this._searchResultsWrap.appendChild(e)}}}_fetchSearchResults(e){let t=this._getSearchEndpoint();if(!t)return;let n=e.trim();if(!n){this._renderSearchState(`Start typing to search`);return}this._abortSearch(),this._searchAbortController=new AbortController,this._renderSearchState(`Searching...`);let r=t.includes(`{query}`)?t.replace(`{query}`,encodeURIComponent(n)):`${t}${t.includes(`?`)?`&`:`?`}${encodeURIComponent(this._getSearchParam())}=${encodeURIComponent(n)}`;fetch(r,{signal:this._searchAbortController.signal}).then(e=>{if(!e.ok)throw Error(`Request failed: ${e.status}`);return e.json()}).then(e=>{let t=this._normalizeResults(e);this._renderSearchResults(t)}).catch(e=>{e?.name!==`AbortError`&&this._renderSearchState(`Unable to load results`)})}_scheduleSearch(e){this._setSearchQuery(e),this._cancelSearchDebounce(),this._searchDebounceId=window.setTimeout(()=>this._fetchSearchResults(e),220)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>this.render()),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_disconnectDarkModeObserver(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_attachResizeListener(){this._resizeHandler||(this._resizeHandler=()=>{this.render(),this._positionSearchPanel()},window.addEventListener(`resize`,this._resizeHandler,{passive:!0}))}_detachResizeListener(){this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}_toggleMenuTarget(){let e=this._getMenuTargetId();if(!e)return;let t=document.getElementById(e);!t||t.tagName!==`MINT-SIDE-NAVIGATION`||(t.getAttribute(`open`)===`true`?t.removeAttribute(`open`):t.setAttribute(`open`,`true`))}render(){if(this._bar||(this._bar=document.createElement(`div`),this._bar.className=`fixed inset-x-0 top-0 z-50 flex h-14 w-full items-center gap-2 border-b border-gray-200 bg-white px-3 dark:border-mint-divider dark:bg-mint-nav`,this.appendChild(this._bar)),!this._menuButton){this._menuButton=document.createElement(`button`),this._menuButton.type=`button`,this._menuButton.className=`inline-flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent text-gray-700 hover:bg-black/5 min-[1100px]:hidden dark:text-gray-200 dark:hover:bg-white/10`,this._menuButton.setAttribute(`aria-label`,`Open navigation menu`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`menu`),e.className=`h-5 w-5`,this._menuButton.appendChild(e),this._menuClickHandler=()=>this._toggleMenuTarget(),this._menuButton.addEventListener(`click`,this._menuClickHandler),this._bar.appendChild(this._menuButton)}let e=!!this._getMenuTargetId();this._menuButton.classList.toggle(`hidden`,!e),this._logoLink||(this._logoLink=document.createElement(`a`),this._logoLink.className=`flex h-8 w-40 shrink-0 items-center`,this._bar.appendChild(this._logoLink)),this._logoLink.href=this._getLogoHref(),this._logoLink.setAttribute(`aria-label`,this._getLogoAlt());let t=this._getLogoSrc();if(t){let e=document.createElement(`img`);e.className=`h-full w-full object-contain [aspect-ratio:5/1]`,e.decoding=`async`,e.src=t,e.alt=this._getLogoAlt(),this._logoLink.replaceChildren(e),this._logoLink.classList.remove(`pointer-events-none`,`opacity-40`)}else{this._logoLink.replaceChildren(),this._logoLink.classList.add(`pointer-events-none`,`opacity-40`);let e=document.createElement(`span`);e.className=`text-sm font-semibold text-gray-400 dark:text-gray-500`,e.textContent=`Logo`,this._logoLink.appendChild(e)}let n=Array.from(this.querySelectorAll(`[slot="center"]`)),r=n.length>0,i=this._isSearchEnabled()&&!r,a=this._bar.querySelector(`[data-mint-topnav-center]`);if(a||(a=document.createElement(`div`),a.setAttribute(`data-mint-topnav-center`,`true`),this._bar.appendChild(a)),a.className=r?`min-w-0 flex-1 px-2 min-[1100px]:flex min-[1100px]:justify-center min-[1100px]:px-4`:`max-[1099.98px]:hidden min-[1100px]:flex min-[1100px]:min-w-0 min-[1100px]:flex-1 min-[1100px]:justify-center min-[1100px]:px-4`,a.classList.toggle(`min-[1100px]:hidden`,!i&&!r),r&&(a.replaceChildren(...n),this._closeSearch()),i&&!this._desktopSearchInput){let e=document.createElement(`div`);e.className=`relative w-full max-w-xl rounded-xl border border-gray-300 bg-gray-50 px-3 py-2 dark:border-mint-divider dark:bg-mint-hover`,this._desktopSearchShell=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`search`),t.className=`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400`,this._desktopSearchInput=document.createElement(`input`),this._desktopSearchInput.type=`search`,this._desktopSearchInput.className=`w-full bg-transparent pl-6 pr-20 text-sm text-gray-900 outline-none placeholder:text-gray-500 dark:text-gray-100 dark:placeholder:text-gray-400`,this._desktopSearchInput.placeholder=this._getSearchPlaceholder(),this._desktopSearchInput.addEventListener(`focus`,()=>this._openSearch(!1)),this._desktopSearchInput.addEventListener(`input`,e=>this._scheduleSearch(e.target.value));let n=document.createElement(`span`);n.className=`absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-500 dark:text-gray-400`,n.textContent=`⌘K`,e.appendChild(t),e.appendChild(this._desktopSearchInput),e.appendChild(n),a.appendChild(e)}i&&this._desktopSearchInput&&(this._desktopSearchInput.placeholder=this._getSearchPlaceholder(),this._desktopSearchShell=this._desktopSearchInput.closest(`div`),this._syncDesktopSearchOpenState());let o=this._bar.querySelector(`[data-mint-topnav-mobile-spacer]`);o||(o=document.createElement(`div`),o.setAttribute(`data-mint-topnav-mobile-spacer`,`true`),o.className=`min-w-0 flex-1 min-[1100px]:hidden`,this._bar.appendChild(o));let s=Array.from(this.querySelectorAll(`[slot="actions"]`)),c=this._bar.querySelector(`[data-mint-topnav-actions]`);if(c||(c=document.createElement(`div`),c.setAttribute(`data-mint-topnav-actions`,`true`),c.className=`flex shrink-0 items-center gap-2`,this._bar.appendChild(c)),i&&!this._mobileSearchButton){this._mobileSearchButton=document.createElement(`button`),this._mobileSearchButton.type=`button`,this._mobileSearchButton.className=`inline-flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent text-gray-700 hover:bg-black/5 min-[1100px]:hidden dark:text-gray-200 dark:hover:bg-white/10`,this._mobileSearchButton.setAttribute(`aria-label`,`Open search`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`search`),e.className=`h-5 w-5`,this._mobileSearchButton.appendChild(e),this._mobileSearchButton.addEventListener(`click`,()=>this._openSearch(!0)),c.insertBefore(this._mobileSearchButton,c.firstChild)}if(this._mobileSearchButton&&this._mobileSearchButton.classList.toggle(`hidden`,!i),c.replaceChildren(...s),i&&this._mobileSearchButton&&!s.includes(this._mobileSearchButton)&&c.insertBefore(this._mobileSearchButton,c.firstChild),i&&!this._searchPanel){this._searchPanel=document.createElement(`div`),this._searchPanel.className=`fixed left-0 right-0 top-14 z-[90] hidden p-3 min-[1100px]:p-0`;let e=document.createElement(`div`);e.className=`mx-auto w-full rounded-2xl border border-gray-200 bg-white shadow-xl dark:border-mint-divider dark:bg-mint-elevated min-[1100px]:rounded-t-none`;let t=document.createElement(`div`);t.className=`relative border-b border-gray-200 p-3 dark:border-mint-divider min-[1100px]:hidden`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`absolute left-6 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400`,this._searchPanelInput=document.createElement(`input`),this._searchPanelInput.type=`search`,this._searchPanelInput.className=`w-full rounded-lg border border-gray-300 bg-gray-50 py-2 pl-10 pr-3 text-sm text-gray-900 outline-none dark:border-mint-divider dark:bg-mint-hover dark:text-gray-100`,this._searchPanelInput.placeholder=this._getSearchPlaceholder(),this._searchPanelInput.addEventListener(`input`,e=>this._scheduleSearch(e.target.value)),t.appendChild(n),t.appendChild(this._searchPanelInput);let r=document.createElement(`div`);r.className=`flex flex-wrap gap-2 px-3 py-3`,[`Apps`,`Customers`,`Orders`,`Products`,`Sales channels`].forEach(e=>{let t=document.createElement(`span`);t.className=`rounded-full bg-gray-100 px-3 py-1 text-xs font-semibold text-gray-600 dark:bg-mint-hover dark:text-gray-300`,t.textContent=e,r.appendChild(t)}),this._searchStateWrap=document.createElement(`div`),this._searchStateWrap.className=`px-4 pb-4 text-sm text-gray-500 dark:text-gray-400`,this._searchStateWrap.textContent=`Start typing to search`,this._searchResultsWrap=document.createElement(`div`),this._searchResultsWrap.className=`max-h-[52vh] overflow-y-auto px-2 pb-2`,e.appendChild(t),e.appendChild(r),e.appendChild(this._searchStateWrap),e.appendChild(this._searchResultsWrap),this._searchPanel.appendChild(e),this.appendChild(this._searchPanel)}this._searchPanelInput&&(this._searchPanelInput.placeholder=this._getSearchPlaceholder()),this._syncSearchPanelVisibility(),this._positionSearchPanel()}};customElements.get(`mint-top-navigation`)||customElements.define(`mint-top-navigation`,U);var W=class e extends HTMLElement{constructor(...e){super(...e),this._shell=null,this._desktopInput=null,this._panel=null,this._panelInner=null,this._panelInput=null,this._panelFiltersWrap=null,this._panelFiltersMainRow=null,this._panelFiltersChips=null,this._panelFiltersShowAllWrap=null,this._panelFiltersShowAllBtn=null,this._panelFiltersMorePanel=null,this._filtersMoreOpen=!1,this._filterOverflowObserver=null,this._filterOverflowZeroWidthRetries=0,this._desktopFilterWrap=null,this._mobileFilterWrap=null,this._resultsWrap=null,this._stateWrap=null,this._customResultsWrap=null,this._query=``,this._searchOpen=!1,this._selectedFilters=[],this._selectedFilterBackspaceArmed=!1,this._debounceId=null,this._abortController=null,this._docPointerDownHandler=null,this._globalKeydownHandler=null,this._focusOutHandler=null,this._resizeHandler=null,this._desktopShortcutHint=null,this._panelSearchBar=null}static{this._filterMorePanelSeq=0}static{this._filterChipsOverflowMask=`linear-gradient(to right, #000 0%, #000 max(0%, calc(100% - 3.5rem)), transparent 100%)`}static get observedAttributes(){return[`endpoint`,`search-param`,`placeholder`,`filters`,`filter-param`,`open-shortcut`,`open-shortcut-hint`,`collapse-on-mobile`]}connectedCallback(){this.classList.add(`relative`,`block`,`w-full`,`max-w-xl`),this._attachGlobalHandlers(),this._attachFocusOutHandler(),this._attachResizeHandler(),this.render()}disconnectedCallback(){this._docPointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._docPointerDownHandler,!0),null),this._globalKeydownHandler&&=(document.removeEventListener(`keydown`,this._globalKeydownHandler),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null),this._focusOutHandler&&=(this.removeEventListener(`focusout`,this._focusOutHandler,!0),null),this._cancelDebounce(),this._abortSearch(),this._filterOverflowObserver&&=(this._filterOverflowObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}_getEndpoint(){return(this.getAttribute(`endpoint`)||``).trim()}_getSearchParam(){return(this.getAttribute(`search-param`)||`q`).trim()||`q`}_getPlaceholder(){return this.getAttribute(`placeholder`)||`Search`}_getFilterParam(){return(this.getAttribute(`filter-param`)||``).trim()}_getFilterOptions(){return(this.getAttribute(`filters`)||``).split(`,`).map(e=>e.trim()).filter(Boolean)}_hasSelectedFilters(){return this._selectedFilters.length>0}_getFilterChipOverflowReservePx(){let e=Math.max(1,this._getFilterOptions().length),t=this._hasSelectedFilters()?28:56;return Math.min(200,t+e*34)}_getFilterParamValue(){return this._selectedFilters.join(`,`)}_getFilterChipLabelText(){return this._selectedFilters.join(`, `)}_getCondensedFilterChipLabel(e=22){if(!this._hasSelectedFilters())return``;let[t=``]=this._selectedFilters,n=this._selectedFilters.length-1,r=Math.max(8,e-2),i=t;if(n<=0)return i.length<=r?i:`${i.slice(0,Math.max(1,r-3))}...`;let a=`${t}, and ${n} more`;return a.length<=r?a:`${a.slice(0,Math.max(1,r-3))}...`}_isMobileViewport(){return window.matchMedia(`(max-width: 1099.98px)`).matches}_collapseOnMobile(){let e=this.getAttribute(`collapse-on-mobile`);if(e===null)return!1;let t=e.trim().toLowerCase();return!(t===`false`||t===`0`||t===`off`||t===`none`)}_primarySearchInput(){return this._isMobileViewport()&&this._collapseOnMobile()?this._panelInput:this._desktopInput}_isApplePlatform(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/i.test(navigator.platform)||/Mac OS/i.test(navigator.userAgent)}_parseOpenShortcut(){let e=(this.getAttribute(`open-shortcut`)??`mod+k`).trim().toLowerCase();if(!e||e===`none`||e===`false`||e===`off`)return{disabled:!0,wantMod:!1,wantMeta:!1,wantCtrl:!1,wantAlt:!1,wantShift:!1,key:``};let t=e.split(`+`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return{disabled:!0,wantMod:!1,wantMeta:!1,wantCtrl:!1,wantAlt:!1,wantShift:!1,key:``};let n=t[t.length-1],r=new Set(t.slice(0,-1).map(e=>e.toLowerCase()));return{disabled:!1,wantMod:r.has(`mod`),wantMeta:r.has(`meta`)||r.has(`cmd`)||r.has(`super`),wantCtrl:r.has(`ctrl`)||r.has(`control`),wantAlt:r.has(`alt`),wantShift:r.has(`shift`),key:n.toLowerCase()}}_eventKeyMatchesShortcutKey(e,t){let n=t.toLowerCase();return(e.key.length,e.key.toLowerCase())===n}_openShortcutMatches(e){let t=this._parseOpenShortcut();return t.disabled||!t.key||e.repeat||!this._eventKeyMatchesShortcutKey(e,t.key)||t.wantShift!==e.shiftKey||t.wantAlt!==e.altKey?!1:t.wantMod||t.wantMeta||t.wantCtrl?!(t.wantMod&&!(e.metaKey||e.ctrlKey)||t.wantMeta&&!e.metaKey||t.wantCtrl&&!e.ctrlKey):!!t.wantAlt}_getOpenShortcutHintText(){let e=this.getAttribute(`open-shortcut-hint`);if(e===`none`||e===`false`)return``;if(e!==null&&e.trim()!==``)return e.trim();let t=this._parseOpenShortcut();if(t.disabled)return``;let n=this._isApplePlatform(),r=[];t.wantMod&&r.push(n?`⌘`:`Ctrl`),t.wantMeta&&!t.wantMod&&r.push(n?`⌘`:`Meta`),t.wantCtrl&&!t.wantMod&&r.push(`Ctrl`),t.wantAlt&&r.push(`Alt`),t.wantShift&&r.push(`Shift`);let i=t.key.length===1?t.key.toUpperCase():t.key;return i?t.wantMod&&!t.wantMeta&&!t.wantCtrl&&!t.wantAlt&&!t.wantShift&&t.key.length===1?`${n?`⌘`:`Ctrl+`}${i}`:[...r,i].join(`+`):``}_attachGlobalHandlers(){this._globalKeydownHandler||(this._globalKeydownHandler=e=>{if(this._openShortcutMatches(e)){e.preventDefault(),this._openSearch(!0);return}if(e.key.toLowerCase()===`escape`&&this._searchOpen){if(this._filtersMoreOpen){this._filtersMoreOpen=!1,this.render(),requestAnimationFrame(()=>this._focusActiveInput());return}this._closeSearch()}},document.addEventListener(`keydown`,this._globalKeydownHandler)),this._docPointerDownHandler||(this._docPointerDownHandler=e=>{if(!this._searchOpen)return;let t=e.composedPath();this._filtersMoreOpen&&this._panelFiltersWrap&&!t.includes(this._panelFiltersWrap)&&(this._filtersMoreOpen=!1,this.render(),requestAnimationFrame(()=>this._focusActiveInput())),!(this._shell&&t.includes(this._shell)||this._panelInner&&t.includes(this._panelInner))&&this._closeSearch()},document.addEventListener(`pointerdown`,this._docPointerDownHandler,!0))}_attachResizeHandler(){this._resizeHandler||(this._resizeHandler=()=>{this._syncPanelVisibility(),this._syncFilterOverflow()},window.addEventListener(`resize`,this._resizeHandler,{passive:!0}))}_attachFocusOutHandler(){this._focusOutHandler||(this._focusOutHandler=e=>{if(!this._searchOpen)return;let t=e.relatedTarget;t&&(this._shell&&this._shell.contains(t)||this._panelInner&&this._panelInner.contains(t)||this._closeSearch())},this.addEventListener(`focusout`,this._focusOutHandler,!0))}_emitSearchOpenChange(){this.dispatchEvent(new CustomEvent(`search-open-change`,{detail:{open:this._searchOpen},bubbles:!0,composed:!0}))}_openSearch(e=!1){this._getEndpoint()&&(this._searchOpen||(this._searchOpen=!0,this._syncPanelVisibility(),this._emitSearchOpenChange(),e&&this._primarySearchInput()?.focus()))}_closeSearch(){this._searchOpen&&(this._searchOpen=!1,this._filtersMoreOpen=!1,this._syncPanelVisibility(),this._emitSearchOpenChange())}_syncPanelVisibility(){if(!this._panel)return;let e=this._panelLayoutBaseClass();this._panel.className=this._searchOpen?e:`${e} hidden`,this._shell&&(this._shell.classList.toggle(`rounded-b-none`,this._searchOpen),this._shell.classList.toggle(`border-b-transparent`,this._searchOpen)),this._positionPanel(),this._searchOpen&&this._scheduleFilterOverflowSync()}_panelLayoutBaseClass(){return!this._isMobileViewport()||!this._collapseOnMobile()?`absolute left-0 right-0 top-full z-[90] p-0 -mt-[9px]`:`fixed left-0 right-0 top-12 z-[90] p-3`}_positionPanel(){this._panel&&(!this._isMobileViewport()||!this._collapseOnMobile())&&(this._panel.style.left=``,this._panel.style.right=``,this._panel.style.top=``,this._panel.style.width=``,this._panel.style.maxWidth=``,this._panel.style.transform=``)}_setQuery(e){let t=this._query;this._query=e,e!==t&&(this._selectedFilterBackspaceArmed=!1),this._desktopInput&&(this._desktopInput.value=e),this._panelInput&&(this._panelInput.value=e)}_cancelDebounce(){this._debounceId!==null&&(window.clearTimeout(this._debounceId),this._debounceId=null)}_abortSearch(){this._abortController&&=(this._abortController.abort(),null)}_normalizeResults(e){return(e=>{if(Array.isArray(e))return e;if(!e||typeof e!=`object`)return[];let t=e;for(let e of[`results`,`items`,`data`,`products`]){let n=t[e];if(Array.isArray(n))return n}return[]})(e).map(e=>{let t=e||{};return{title:String(t.title||t.name||t.label||t.email||t.id||``).trim()||`Untitled`,subtitle:String(t.description||t.category||t.username||``).trim(),parent:String(t.parent||t.type||t.entity||t.kind||t.category||``).trim()||void 0}}).slice(0,8)}_emitResultsChange(e,t){let n=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-results-change`,{detail:{query:this._query,filter:n,filters:[...this._selectedFilters],results:e,raw:t??null},bubbles:!0,composed:!0}))}_emitFilterChange(){let e=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-filter-change`,{detail:{query:this._query,filter:e,filters:[...this._selectedFilters]},bubbles:!0,composed:!0}))}_renderState(e){if(this._customResultsWrap&&this._customResultsWrap.childElementCount>0){this._stateWrap&&this._stateWrap.classList.add(`hidden`),this._resultsWrap&&this._resultsWrap.classList.add(`hidden`);return}this._stateWrap&&(this._stateWrap.textContent=e,this._stateWrap.classList.remove(`hidden`),this._resultsWrap&&(this._resultsWrap.classList.remove(`hidden`),this._resultsWrap.innerHTML=``))}_renderResults(e){if(this._customResultsWrap&&this._customResultsWrap.childElementCount>0){this._stateWrap&&this._stateWrap.classList.add(`hidden`),this._resultsWrap&&this._resultsWrap.classList.add(`hidden`);return}if(!(!this._resultsWrap||!this._stateWrap)){if(this._resultsWrap.innerHTML=``,e.length===0){this._renderState(`No results found`);return}this._stateWrap.classList.add(`hidden`);for(let t of e){let e=document.createElement(`button`);e.type=`button`,e.className=`flex w-full cursor-pointer items-start gap-3 rounded-lg px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-white/10`;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`search`),n.className=`mt-0.5 h-4 w-4 text-gray-500 dark:text-gray-400`;let r=document.createElement(`div`);r.className=`min-w-0`;let i=document.createElement(`div`);if(i.className=`truncate text-sm font-semibold text-gray-900 dark:text-gray-100`,i.textContent=t.title,r.appendChild(i),t.subtitle){let e=document.createElement(`div`);e.className=`truncate text-xs text-gray-500 dark:text-gray-400`,e.textContent=t.subtitle,r.appendChild(e)}e.appendChild(n),e.appendChild(r),e.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`){t.preventDefault(),this._moveFocusInResults(e,1);return}if(t.key===`ArrowUp`){t.preventDefault(),this._moveFocusInResults(e,-1);return}}),e.addEventListener(`click`,()=>{let e=this._hasSelectedFilters()?this._getFilterParamValue():null;this.dispatchEvent(new CustomEvent(`search-select`,{detail:{query:this._query,filter:e,filters:[...this._selectedFilters],result:t},bubbles:!0,composed:!0})),this._closeSearch()}),this._resultsWrap.appendChild(e)}}}_fetchSearchResults(e){let t=this._getEndpoint();if(!t)return;let n=e.trim();if(!n){this._emitResultsChange([]),this._renderState(`Start typing to search`);return}this._abortSearch(),this._abortController=new AbortController,this._renderState(`Searching...`);let r=new URLSearchParams;r.set(this._getSearchParam(),n);let i=this._getFilterParam();i&&this._hasSelectedFilters()&&r.set(i,this._getFilterParamValue());let a=t.includes(`{query}`)?t.replace(`{query}`,encodeURIComponent(n)):`${t}${t.includes(`?`)?`&`:`?`}${r.toString()}`;fetch(a,{signal:this._abortController.signal}).then(e=>{if(!e.ok)throw Error(`Request failed: ${e.status}`);return e.json()}).then(e=>{let t=this._normalizeResults(e);this._emitResultsChange(t,e),this._renderResults(t)}).catch(e=>{e?.name!==`AbortError`&&(this._emitResultsChange([]),this._renderState(`Unable to load results`))})}_scheduleSearch(e){this._setQuery(e),this._cancelDebounce(),this._debounceId=window.setTimeout(()=>this._fetchSearchResults(e),220)}_getNativeInputValue(e){if(!e)return``;let t=e.querySelector(`input, textarea`);return t?t.value||``:e.value||``}_getCurrentInputValue(){let e=document.activeElement;return e&&this._desktopInput&&this._desktopInput.contains(e)?this._getNativeInputValue(this._desktopInput):e&&this._panelInput&&this._panelInput.contains(e)?this._getNativeInputValue(this._panelInput):this._getNativeInputValue(this._primarySearchInput())}_applyFilterSelectionChange(){let e=this._getCurrentInputValue();if(this._setQuery(e),this._emitFilterChange(),this.render(),e.trim()){this._scheduleSearch(e);return}this._cancelDebounce(),this._abortSearch(),this._emitResultsChange([]),this._renderState(`Start typing to search`)}_clearAllSelectedFilters(){this._selectedFilters=[],this._selectedFilterBackspaceArmed=!1,this._applyFilterSelectionChange()}_popLastSelectedFilter(){this._selectedFilters.length!==0&&(this._selectedFilters.pop(),this._selectedFilterBackspaceArmed=!1,this._applyFilterSelectionChange())}_focusActiveInput(){let e=this._primarySearchInput();e&&requestAnimationFrame(()=>{e.focus()})}_focusHideFiltersControl(){let e=this._panelFiltersShowAllBtn;e&&(e.querySelector(`button`)??e).focus()}_getFilterChipElements(){return this._panelFiltersWrap?Array.from(this._panelFiltersWrap.querySelectorAll(`mint-chip`)):[]}_ensurePanelFiltersShell(){!this._panelFiltersWrap||this._panelFiltersMainRow||(this._panelFiltersWrap.replaceChildren(),this._panelFiltersWrap.className=`relative flex shrink-0 flex-col gap-2 px-3 pb-3 pt-5 min-w-0`,this._panelFiltersMainRow=document.createElement(`div`),this._panelFiltersMainRow.className=`flex min-w-0 w-full flex-nowrap items-center gap-2`,this._panelFiltersChips=document.createElement(`div`),this._panelFiltersChips.className=`flex min-w-0 flex-1 flex-nowrap items-center gap-2 overflow-x-hidden`,this._panelFiltersMorePanel=document.createElement(`div`),this._panelFiltersMorePanel.id=`mint-search-filter-more-${e._filterMorePanelSeq++}`,this._panelFiltersMorePanel.className=`hidden absolute left-0 right-0 top-full z-[95] mt-1 flex max-h-[40vh] flex-wrap gap-2 overflow-y-auto rounded-lg border border-gray-200 bg-white p-2 shadow-lg dark:border-mint-divider dark:bg-mint-elevated`,this._panelFiltersShowAllWrap=document.createElement(`div`),this._panelFiltersShowAllWrap.className=`relative flex min-h-0 min-w-0 shrink-0 items-center hidden`,this._panelFiltersShowAllBtn=document.createElement(`mint-button`),this._panelFiltersShowAllBtn.setAttribute(`type`,`button`),this._panelFiltersShowAllBtn.setAttribute(`variant`,`ghost`),this._panelFiltersShowAllBtn.setAttribute(`tone`,`neutral`),this._panelFiltersShowAllBtn.setAttribute(`size`,`small`),this._panelFiltersShowAllBtn.classList.add(`shrink-0`,`whitespace-nowrap`),this._panelFiltersShowAllBtn.setAttribute(`aria-expanded`,`false`),this._panelFiltersShowAllBtn.setAttribute(`aria-controls`,this._panelFiltersMorePanel.id),this._panelFiltersShowAllBtn.addEventListener(`click`,e=>{e.stopPropagation();let t=this._filtersMoreOpen;this._filtersMoreOpen=!this._filtersMoreOpen,this.render(),t&&requestAnimationFrame(()=>this._focusActiveInput())}),this._panelFiltersShowAllWrap.append(this._panelFiltersShowAllBtn),this._panelFiltersMainRow.append(this._panelFiltersChips,this._panelFiltersShowAllWrap),this._setPanelFiltersShowAllLabel(`Show all`),this._panelFiltersWrap.append(this._panelFiltersMainRow,this._panelFiltersMorePanel),typeof ResizeObserver<`u`&&!this._filterOverflowObserver&&(this._filterOverflowObserver=new ResizeObserver(()=>this._syncFilterOverflow()),this._filterOverflowObserver.observe(this._panelFiltersChips),this._filterOverflowObserver.observe(this._panelFiltersMainRow)))}_setPanelFiltersShowAllLabel(e){let t=this._panelFiltersShowAllBtn;if(!t)return;for(let e of Array.from(t.childNodes))e.nodeType===Node.TEXT_NODE&&e.remove();let n=t.querySelector(`button .mint-button-content`)||t.querySelector(`.mint-button-content`);if(n){n.textContent=e;return}let r=t.querySelector(`:scope > button`);if(r){r.replaceChildren(document.createTextNode(e)),t.render?.();return}t.firstElementChild||t.appendChild(document.createTextNode(e))}_scheduleFilterOverflowSync(){requestAnimationFrame(()=>{requestAnimationFrame(()=>this._syncFilterOverflow())})}_setFilterChipsEdgeFade(t){let n=this._panelFiltersChips;n&&(t?(n.style.maskImage=e._filterChipsOverflowMask,n.style.webkitMaskImage=e._filterChipsOverflowMask):(n.style.maskImage=``,n.style.webkitMaskImage=``))}_syncFilterOverflow(){if(!this._panelFiltersChips||!this._panelFiltersShowAllWrap||!this._panelFiltersShowAllBtn)return;if(this._filtersMoreOpen){this._panelFiltersShowAllWrap.classList.remove(`hidden`),this._filterOverflowZeroWidthRetries=0,this._setFilterChipsEdgeFade(!1);return}let e=this._panelFiltersChips.clientWidth;if(e===0&&this._searchOpen){this._filterOverflowZeroWidthRetries<10&&(this._filterOverflowZeroWidthRetries+=1,this._scheduleFilterOverflowSync()),this._setFilterChipsEdgeFade(!1);return}this._filterOverflowZeroWidthRetries=0;let t=this._panelFiltersChips.scrollWidth+this._getFilterChipOverflowReservePx()>e;this._panelFiltersShowAllWrap.classList.toggle(`hidden`,!t),this._setFilterChipsEdgeFade(t)}_getResultFocusableElements(){let e=this._customResultsWrap&&!this._customResultsWrap.classList.contains(`hidden`)?this._customResultsWrap:this._resultsWrap;return e?Array.from(e.querySelectorAll(`button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])`)):[]}_focusFirstChipOrResult(e=!1){let t=this._getFilterChipElements(),n=this._getResultFocusableElements();if(!e){(t[0]||n[0])?.focus();return}(n[n.length-1]||t[t.length-1])?.focus()}_moveFocusInResults(e,t){let n=this._getResultFocusableElements();if(n.length===0)return;let r=n.indexOf(e);if(r===-1)return;let i=n[r+t];if(i){i.focus();return}if(t===-1){let e=this._getFilterChipElements(),t=e[e.length-1];t?t.focus():this._focusActiveInput()}}_renderSelectedFilter(){let e=e=>{if(!e||(e.innerHTML=``,!this._hasSelectedFilters()))return;let t=document.createElement(`mint-chip`);t.setAttribute(`dismissable`,``),t.title=this._getFilterChipLabelText();let n=this._getCondensedFilterChipLabel();t.classList.add(`max-w-[min(20rem,85vw)]`,`whitespace-nowrap`,`overflow-hidden`,`text-ellipsis`,`text-xs`,`px-2`,`py-0.5`),t.style.fontSize=`0.75rem`,t.style.padding=`0.125rem 0.375rem`,t.style.height=`1.375rem`,t.style.lineHeight=`1`,t.style.whiteSpace=`nowrap`,t.style.overflow=`hidden`,t.style.textOverflow=`ellipsis`,this._selectedFilterBackspaceArmed&&t.classList.add(`ring-2`,`ring-brand-400`,`dark:ring-brand-300`),t.textContent=n,t.addEventListener(`dismiss`,e=>{e.stopPropagation(),this._clearAllSelectedFilters()}),e.appendChild(t)};e(this._desktopFilterWrap),e(this._mobileFilterWrap)}_bindInputHandlers(e){let t=()=>{this._scheduleSearch(this._getNativeInputValue(e))};e.addEventListener(`focusin`,()=>this._openSearch(!1)),e.addEventListener(`input`,t),e.addEventListener(`search`,t),e.addEventListener(`change`,t),e.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`){this._searchOpen||this._openSearch(!1),t.preventDefault(),this._focusFirstChipOrResult(!1);return}if(t.key===`ArrowUp`){this._searchOpen||this._openSearch(!1),t.preventDefault(),this._focusFirstChipOrResult(!0);return}if(t.key===`Tab`&&!t.shiftKey&&this._searchOpen){let e=this._getFilterChipElements(),n=this._getResultFocusableElements();if(e.length>0||n.length>0){t.preventDefault(),this._focusFirstChipOrResult(!1);return}}if(t.key!==`Backspace`)return;let n=this._getNativeInputValue(e);if(n!==this._query&&this._setQuery(n),!(n.length>0)&&this._hasSelectedFilters()){if(!this._selectedFilterBackspaceArmed){t.preventDefault(),this._selectedFilterBackspaceArmed=!0,this._renderSelectedFilter();return}t.preventDefault(),this._popLastSelectedFilter()}})}openSearch(e=!0){this._openSearch(e)}closeSearch(){this._closeSearch()}toggleSearch(e=!0){if(this._searchOpen){this._closeSearch();return}this._openSearch(e)}isSearchOpen(){return this._searchOpen}render(){let e=this._getEndpoint();if(this.classList.toggle(`hidden`,!e),!e)return;if(!this._shell){this._shell=document.createElement(`div`),this._shell.className=`relative z-[91] flex h-10 w-full`,this._desktopFilterWrap=document.createElement(`div`),this._desktopFilterWrap.className=`inline-flex shrink-0 max-w-[8.5rem]`,this._desktopFilterWrap.setAttribute(`slot`,`prepend`),this._desktopInput=document.createElement(`mint-input`),this._desktopInput.setAttribute(`type`,`search`),this._desktopInput.setAttribute(`icon`,`search`),this._desktopInput.className=`h-full min-w-0 flex-1`;let e=document.createElement(`span`);e.className=`shrink-0 text-xs text-gray-500 dark:text-gray-400`,e.setAttribute(`slot`,`append`),this._desktopShortcutHint=e,this._bindInputHandlers(this._desktopInput),this._desktopInput.appendChild(this._desktopFilterWrap),this._desktopInput.appendChild(e),this._shell.appendChild(this._desktopInput),this.appendChild(this._shell)}if(!this._panel){this._panel=document.createElement(`div`),this._panel.className=`absolute left-0 right-0 top-full z-[90] hidden p-0 -mt-[9px]`;let e=document.createElement(`div`);e.className=`mx-auto flex max-h-[calc(100dvh-4rem)] w-full flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl dark:border-mint-divider dark:bg-mint-elevated min-[1100px]:rounded-t-none min-[1100px]:border-t-0`,this._panelInner=e;let t=document.createElement(`div`);this._panelSearchBar=t,t.className=`hidden`,this._mobileFilterWrap=document.createElement(`div`),this._mobileFilterWrap.className=`inline-flex shrink-0 max-w-[8.5rem]`,this._mobileFilterWrap.setAttribute(`slot`,`prepend`),this._panelInput=document.createElement(`mint-input`),this._panelInput.setAttribute(`type`,`search`),this._panelInput.className=`min-w-0 flex-1`,this._bindInputHandlers(this._panelInput),this._panelInput.appendChild(this._mobileFilterWrap),t.appendChild(this._panelInput),this._customResultsWrap=document.createElement(`div`),this._customResultsWrap.className=`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,this._stateWrap=document.createElement(`div`),this._stateWrap.className=`px-4 pb-4 text-sm text-gray-500 dark:text-gray-400`,this._stateWrap.textContent=`Start typing to search`,this._resultsWrap=document.createElement(`div`),this._resultsWrap.className=`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,e.appendChild(t),this._panelFiltersWrap=document.createElement(`div`),e.appendChild(this._panelFiltersWrap),this._ensurePanelFiltersShell(),e.appendChild(this._customResultsWrap),e.appendChild(this._stateWrap),e.appendChild(this._resultsWrap),this._panel.appendChild(e),this.appendChild(this._panel)}let t=this._hasSelectedFilters()?``:this._getPlaceholder();if(this._desktopInput&&this._desktopInput.setAttribute(`placeholder`,t),this._panelInput&&this._panelInput.setAttribute(`placeholder`,t),this._desktopShortcutHint){let e=this._getOpenShortcutHintText();this._desktopShortcutHint.textContent=e,this._desktopShortcutHint.classList.toggle(`hidden`,!e)}if(this._panelFiltersWrap){this._ensurePanelFiltersShell();let e=this._getFilterOptions();this._selectedFilters=this._selectedFilters.filter(t=>e.includes(t));let t=e.length>0;t||(this._filtersMoreOpen=!1),this._panelFiltersWrap.classList.toggle(`hidden`,!t),this._stateWrap?.classList.toggle(`pt-4`,!t),this._resultsWrap?.classList.toggle(`pt-4`,!t),this._customResultsWrap?.classList.toggle(`pt-5`,!t),this._panelFiltersChips&&this._panelFiltersChips.replaceChildren(),this._panelFiltersMorePanel&&this._panelFiltersMorePanel.replaceChildren();let n=this._filtersMoreOpen&&this._panelFiltersMorePanel?this._panelFiltersMorePanel:this._panelFiltersChips;for(let t of e){if(!n)break;let r=document.createElement(`mint-chip`),i=this._selectedFilters.includes(t);if(i&&r.classList.add(`ring-2`,`ring-inset`,`ring-brand-400`,`dark:ring-brand-300`),r.classList.add(`cursor-pointer`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-inset`,`focus-visible:ring-brand-400`,`inline-flex`,`items-center`,`gap-1`,`shrink-0`,`whitespace-nowrap`),i){let e=document.createElement(`span`);e.textContent=t;let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`close`),n.className=`h-4 w-4 ml-2 shrink-0`,n.setAttribute(`aria-hidden`,`true`),r.append(e,n)}else r.textContent=t;r.tabIndex=0,r.setAttribute(`role`,`button`),r.setAttribute(`aria-label`,i?`Remove filter ${t}`:`Filter by ${t}`),r.dataset.mintSearchFilter=t,r.addEventListener(`pointerdown`,e=>{e.preventDefault()});let a=n=>{n&&n.stopPropagation();let r=this._filtersMoreOpen,i=this._selectedFilters.indexOf(t);i>=0?this._selectedFilters.splice(i,1):this._selectedFilters.push(t),this._selectedFilterBackspaceArmed=!1;let a=e.length>0&&this._selectedFilters.length===e.length,o=this._selectedFilters.length===0;r&&(a||o)&&(this._filtersMoreOpen=!1),this._emitFilterChange(),this._renderSelectedFilter(),this.render(),this._query.trim()&&this._scheduleSearch(this._query),r?a||o?this._focusActiveInput():requestAnimationFrame(()=>{this._getFilterChipElements().find(e=>e.dataset.mintSearchFilter===t)?.focus()}):this._focusActiveInput()};r.addEventListener(`click`,e=>a(e)),r.addEventListener(`keydown`,e=>{let t=this._getFilterChipElements(),n=t.indexOf(r);if(e.key===`Enter`||e.key===` `){e.preventDefault(),a(e);return}if(e.key===`ArrowRight`){e.preventDefault();let r=t[n+1];r&&r.focus();return}if(e.key===`ArrowLeft`){e.preventDefault();let r=t[n-1];r?r.focus():this._filtersMoreOpen?this._focusHideFiltersControl():this._focusActiveInput();return}if(e.key===`ArrowDown`){e.preventDefault(),this._getResultFocusableElements()[0]?.focus();return}if(e.key===`ArrowUp`){e.preventDefault(),this._filtersMoreOpen?this._focusHideFiltersControl():this._focusActiveInput();return}}),n.appendChild(r)}this._panelFiltersChips&&this._panelFiltersChips.classList.toggle(`hidden`,this._filtersMoreOpen),this._panelFiltersMorePanel&&this._panelFiltersMorePanel.classList.toggle(`hidden`,!this._filtersMoreOpen),this._panelFiltersShowAllBtn&&(this._setPanelFiltersShowAllLabel(this._filtersMoreOpen?`Hide filters`:`Show all`),this._panelFiltersShowAllBtn.setAttribute(`aria-expanded`,this._filtersMoreOpen?`true`:`false`)),this._panelInner&&(this._filtersMoreOpen&&t?(this._panelInner.classList.remove(`overflow-hidden`),this._panelInner.classList.add(`overflow-visible`)):(this._panelInner.classList.remove(`overflow-visible`),this._panelInner.classList.add(`overflow-hidden`))),this._scheduleFilterOverflowSync()}if(this._customResultsWrap){Array.from(this.children).filter(e=>e===this._shell||e===this._panel?!1:e.getAttribute(`slot`)===`results`).forEach(e=>this._customResultsWrap.appendChild(e));let e=this._customResultsWrap.childElementCount>0;this._customResultsWrap.classList.toggle(`hidden`,!e),e?(this._stateWrap?.classList.add(`hidden`),this._resultsWrap?.classList.add(`hidden`)):this._resultsWrap?.classList.remove(`hidden`)}this._renderSelectedFilter(),this._syncResponsiveChrome(),this._syncPanelVisibility()}_syncResponsiveChrome(){let e=this._collapseOnMobile();this._shell&&(this._shell.className=e?`relative z-[91] hidden h-10 w-full min-[1100px]:flex`:`relative z-[91] flex h-10 w-full`),this._panelSearchBar&&(this._panelSearchBar.className=e?`flex shrink-0 items-center gap-2 border-b border-gray-200 p-3 dark:border-mint-divider min-[1100px]:hidden`:`hidden`)}};customElements.get(`mint-search`)||customElements.define(`mint-search`,W);var G=class extends HTMLElement{constructor(...e){super(...e),this._lastScrollY=0,this._scrollHandler=null}connectedCallback(){this.classList.add(`fixed`,`bottom-0`,`left-0`,`right-0`,`z-30`,`flex`,`w-full`,`items-stretch`,`justify-around`,`gap-1`,`border-t`,`border-gray-200`,`bg-white`,`px-1`,`pt-1`,`pb-[env(safe-area-inset-bottom,0px)]`,`min-[1100px]:hidden`,`transition-transform`,`duration-200`,`ease-out`,`translate-y-0`,`dark:border-mint-divider`,`dark:bg-mint-nav`),this.setAttribute(`role`,`navigation`),this.setAttribute(`aria-label`,`Primary`),this._lastScrollY=window.scrollY,this._attachScrollListener()}disconnectedCallback(){this._detachScrollListener()}_attachScrollListener(){this._scrollHandler||(this._scrollHandler=()=>{let e=window.scrollY;if(e<=8){this.classList.remove(`translate-y-full`),this.classList.add(`translate-y-0`),this._lastScrollY=e;return}let t=e-this._lastScrollY;Math.abs(t)<4||(t>0?(this.classList.remove(`translate-y-0`),this.classList.add(`translate-y-full`)):(this.classList.remove(`translate-y-full`),this.classList.add(`translate-y-0`)),this._lastScrollY=e)},window.addEventListener(`scroll`,this._scrollHandler,{passive:!0}))}_detachScrollListener(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}};customElements.get(`mint-bottom-navigation`)||customElements.define(`mint-bottom-navigation`,G);var K=class extends HTMLElement{constructor(...e){super(...e),this._root=null}static get observedAttributes(){return[`icon`,`label`,`href`,`active`]}connectedCallback(){this.classList.add(`contents`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isActive(){return this.getAttribute(`active`)===`true`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}render(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=this._isActive(),i=r?`text-gray-900 dark:text-gray-100`:`text-gray-600 hover:bg-black/5 dark:text-gray-300 dark:hover:bg-white/10`,a;e?(a=document.createElement(`a`),a.href=e):(a=document.createElement(`button`),a.type=`button`),a.className=`flex min-w-0 flex-1 flex-col items-center justify-center gap-1 rounded-lg px-1 py-2 text-center text-[11px] font-medium leading-tight ${i}`,a.setAttribute(`aria-current`,r?`page`:`false`),a.setAttribute(`aria-label`,t||`Navigation item`);let o=document.createElement(`span`);if(o.className=`inline-flex h-6 w-6 items-center justify-center`,n){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,n),e.className=r?`h-6 w-6`:`h-6 w-6 opacity-90`,o.appendChild(e)}let s=document.createElement(`span`);s.className=`block w-full truncate`,s.textContent=t,a.appendChild(o),a.appendChild(s),this.replaceChildren(a),this._root=a}};customElements.get(`mint-bottom-nav-item`)||customElements.define(`mint-bottom-nav-item`,K),exports.Alert=E,exports.BackButton=l,exports.BottomNavItem=K,exports.BottomNavigation=G,exports.Button=r,exports.default=r,exports.Card=s,exports.Chart=L,exports.Checkbox=m,exports.Chip=C,exports.Choice=g,exports.Clickable=T,exports.DatePicker=v,exports.Dropzone=b,exports.Form=x,exports.Grid=d,exports.Icon=n,exports.Input=_,exports.Link=c,exports.Modal=f,exports.OffCanvas=M,exports.Page=u,exports.Popover=p,exports.ResourceTable=D,exports.Search=W,exports.Select=y,exports.SideNavigation=H,exports.SideNavigationActionLinks=B,exports.SideNavigationActionMenu=V,exports.SideNavigationLink=R,exports.SideNavigationLinks=z,exports.Spinner=t,exports.Stack=o,exports.Switch=i,exports.Tab=N,exports.TabContent=F,exports.TabList=P,exports.Table=S,exports.Tabs=I,exports.Tags=w,exports.Text=a,exports.TopNavigation=U;
package/dist/index.js CHANGED
@@ -7958,7 +7958,7 @@ var L = class e extends HTMLElement {
7958
7958
  right: 20,
7959
7959
  bottom: 60,
7960
7960
  left: 60
7961
- }, this._showLegend = !0, this._showGrid = !0, this._showTooltip = !0, this._curveTension = .3, this._dataObserver = null, this._darkModeObserver = null, this._tooltipHideTimeout = null, this._lastTooltipContent = "", this._activeXValue = null, this._pinnedXValue = null, this._tooltipAnimationFrame = null, this._cachedTooltipContent = /* @__PURE__ */ new Map(), this._cachedXPositions = /* @__PURE__ */ new Map(), this._verticalLine = null, this._plotPoints = /* @__PURE__ */ new Map(), this._resizeObserver = null, this._windowResizeHandler = null, this._pieChartTimeouts = /* @__PURE__ */ new Set(), this._pieChartTooltipShown = !1, this._pieChartClickOutsideHandler = null, this._pieChartGroup = null, this._chartClickOutsideHandler = null, this._chartTooltipScrollHandler = null, this._cachedBounds = {
7961
+ }, this._showLegend = !0, this._showGrid = !0, this._showTooltip = !0, this._curveTension = .5, this._dataObserver = null, this._darkModeObserver = null, this._tooltipHideTimeout = null, this._lastTooltipContent = "", this._activeXValue = null, this._pinnedXValue = null, this._tooltipAnimationFrame = null, this._cachedTooltipContent = /* @__PURE__ */ new Map(), this._cachedXPositions = /* @__PURE__ */ new Map(), this._verticalLine = null, this._plotPoints = /* @__PURE__ */ new Map(), this._resizeObserver = null, this._windowResizeHandler = null, this._pieChartTimeouts = /* @__PURE__ */ new Set(), this._pieChartTooltipShown = !1, this._pieChartClickOutsideHandler = null, this._pieChartGroup = null, this._chartClickOutsideHandler = null, this._chartTooltipScrollHandler = null, this._cachedBounds = {
7962
7962
  bounds: null,
7963
7963
  dataHash: ""
7964
7964
  }, this._cachedYRange = {
@@ -8156,8 +8156,8 @@ var L = class e extends HTMLElement {
8156
8156
  let i = this.getAttribute("curve-tension");
8157
8157
  if (i !== null) {
8158
8158
  let e = parseFloat(i);
8159
- this._curveTension = isNaN(e) ? .3 : Math.max(0, Math.min(1, e));
8160
- } else this._curveTension = .3;
8159
+ this._curveTension = isNaN(e) ? .5 : Math.max(0, Math.min(1, e));
8160
+ } else this._curveTension = .5;
8161
8161
  if (!this._chartData || !this._chartData.datasets || this._chartData.datasets.length === 0) {
8162
8162
  this.innerHTML = "<div class=\"p-4 text-gray-500\">No chart data provided</div>";
8163
8163
  return;
@@ -8799,6 +8799,71 @@ var L = class e extends HTMLElement {
8799
8799
  }
8800
8800
  }), this._svg.appendChild(t);
8801
8801
  }
8802
+ _buildMonotoneXLinePathD(e) {
8803
+ let t = (e) => e < 0 ? -1 : 1, n = (e, n, r, i, a, o) => {
8804
+ let s = r - e, c = a - r, l = (i - n) / (s || c < 0 && -0), u = (o - i) / (c || s < 0 && -0), d = (l * c + u * s) / (s + c || 1e-12);
8805
+ return (t(l) + t(u)) * Math.min(Math.abs(l), Math.abs(u), .5 * Math.abs(d)) || 0;
8806
+ }, r = (e, t, n, r, i) => {
8807
+ let a = n - e;
8808
+ return a ? (3 * ((r - t) / a) - i) / 2 : i;
8809
+ }, i = (e, t, n, r, i, a, o) => {
8810
+ let s = (r - t) / 3;
8811
+ e.push(`C ${t + s} ${n + s * a} ${r - s} ${i - s * o} ${r} ${i}`);
8812
+ }, a = [];
8813
+ for (let t of e) {
8814
+ let e = a[a.length - 1];
8815
+ (!e || e.x !== t.x || e.y !== t.y) && a.push(t);
8816
+ }
8817
+ if (a.length === 0) return "";
8818
+ if (a.length === 1) return `M ${a[0].x} ${a[0].y}`;
8819
+ let o = [], s = NaN, c = NaN, l = NaN, u = NaN, d = NaN, f = 0;
8820
+ for (let e of a) {
8821
+ let t = e.x, a = e.y;
8822
+ if (!(t === l && a === u)) switch (f) {
8823
+ case 0:
8824
+ o.push(`M ${t} ${a}`), s = t, c = a, l = t, u = a, f = 1;
8825
+ break;
8826
+ case 1:
8827
+ l = t, u = a, f = 2;
8828
+ break;
8829
+ case 2: {
8830
+ let e = n(s, c, l, u, t, a);
8831
+ i(o, s, c, l, u, r(s, c, l, u, e), e), s = l, c = u, l = t, u = a, d = e, f = 3;
8832
+ break;
8833
+ }
8834
+ default: {
8835
+ let e = n(s, c, l, u, t, a);
8836
+ i(o, s, c, l, u, d, e), s = l, c = u, l = t, u = a, d = e;
8837
+ }
8838
+ }
8839
+ }
8840
+ return f === 2 ? o.push(`L ${l} ${u}`) : f === 3 && i(o, s, c, l, u, d, r(s, c, l, u, d)), o.join(" ");
8841
+ }
8842
+ _stripLeadingMoveTo(e) {
8843
+ return e.replace(/^M\s+[\d.-]+\s+[\d.-]+\s*/i, "").trim();
8844
+ }
8845
+ _buildAreaFillPathD(e, t) {
8846
+ if (e.length === 0) return "";
8847
+ let n = e[e.length - 1];
8848
+ if (e.length === 1) return `M ${e[0].x} ${t} L ${e[0].x} ${e[0].y} L ${e[0].x} ${t} Z`;
8849
+ if (this._curveTension <= 0) {
8850
+ let r = [`M ${e[0].x} ${t}`, `L ${e[0].x} ${e[0].y}`];
8851
+ for (let t = 1; t < e.length; t++) r.push(`L ${e[t].x} ${e[t].y}`);
8852
+ return r.push(`L ${n.x} ${t}`, "Z"), r.join(" ");
8853
+ }
8854
+ let r = this._buildMonotoneXLinePathD(e), i = this._stripLeadingMoveTo(r);
8855
+ return `M ${e[0].x} ${t} L ${e[0].x} ${e[0].y} ${i} L ${n.x} ${t} Z`;
8856
+ }
8857
+ _buildSmoothLinePathD(e) {
8858
+ if (e.length === 0) return "";
8859
+ if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
8860
+ if (this._curveTension <= 0) {
8861
+ let t = [`M ${e[0].x} ${e[0].y}`];
8862
+ for (let n = 1; n < e.length; n++) t.push(`L ${e[n].x} ${e[n].y}`);
8863
+ return t.join(" ");
8864
+ }
8865
+ return this._buildMonotoneXLinePathD(e);
8866
+ }
8802
8867
  _renderLineChart() {
8803
8868
  if (!this._svg || !this._chartData) return;
8804
8869
  let e = this._getChartBounds();
@@ -8812,17 +8877,14 @@ var L = class e extends HTMLElement {
8812
8877
  x: this._scaleX(t.x, e),
8813
8878
  y: this._scaleY(t.y, e)
8814
8879
  }));
8815
- if (o.length === 0) return;
8816
- let s = [`M ${o[0].x} ${o[0].y}`];
8817
- for (let e = 1; e < o.length; e++) s.push(`L ${o[e].x} ${o[e].y}`);
8818
- a.setAttribute("d", s.join(" ")), a.setAttribute("fill", "none"), a.setAttribute("stroke", i), a.setAttribute("stroke-width", "2"), a.setAttribute("stroke-linecap", "round"), a.setAttribute("stroke-linejoin", "round"), n.appendChild(a), t.data.forEach((a) => {
8880
+ o.length !== 0 && (a.setAttribute("d", this._buildSmoothLinePathD(o)), a.setAttribute("fill", "none"), a.setAttribute("stroke", i), a.setAttribute("stroke-width", "2"), a.setAttribute("stroke-linecap", "round"), a.setAttribute("stroke-linejoin", "round"), n.appendChild(a), t.data.forEach((a) => {
8819
8881
  let o = document.createElementNS("http://www.w3.org/2000/svg", "circle"), s = this._scaleX(a.x, e), c = this._scaleY(a.y, e);
8820
8882
  o.setAttribute("cx", s.toString()), o.setAttribute("cy", c.toString()), o.setAttribute("r", "4"), o.setAttribute("fill", i);
8821
8883
  let l = document.documentElement.classList.contains("dark");
8822
8884
  o.setAttribute("stroke", l ? "#1f2937" : "#fff"), o.setAttribute("stroke-width", "2"), o.setAttribute("class", "chart-point"), o.setAttribute("data-dataset", r.toString()), o.setAttribute("data-x", String(a.x)), o.setAttribute("data-y", a.y.toString()), o.setAttribute("data-name", t.name), o.style.opacity = "0", o.style.pointerEvents = "none";
8823
8885
  let u = String(a.x);
8824
8886
  this._plotPoints.has(u) || this._plotPoints.set(u, []), this._plotPoints.get(u).push(o), n.appendChild(o);
8825
- });
8887
+ }));
8826
8888
  }), t.appendChild(n), this._svg.appendChild(t);
8827
8889
  }
8828
8890
  _scaleXForBarChart(e, t) {
@@ -8888,17 +8950,10 @@ var L = class e extends HTMLElement {
8888
8950
  y: this._scaleY(t.y, e)
8889
8951
  }));
8890
8952
  if (a.length === 0) return;
8891
- let o = e.y + e.height, s = [`M ${a[0].x} ${o}`, `L ${a[0].x} ${a[0].y}`];
8892
- for (let e = 1; e < a.length; e++) s.push(`L ${a[e].x} ${a[e].y}`);
8893
- let c = a[a.length - 1];
8894
- s.push(`L ${c.x} ${o}`, "Z");
8895
- let l = document.createElementNS("http://www.w3.org/2000/svg", "path");
8896
- l.setAttribute("d", s.join(" ")), l.setAttribute("fill", i), l.setAttribute("fill-opacity", "0.3"), n.appendChild(l);
8897
- let u = document.createElementNS("http://www.w3.org/2000/svg", "path");
8898
- if (a.length === 0) return;
8899
- let d = [`M ${a[0].x} ${a[0].y}`];
8900
- for (let e = 1; e < a.length; e++) d.push(`L ${a[e].x} ${a[e].y}`);
8901
- u.setAttribute("d", d.join(" ")), u.setAttribute("fill", "none"), u.setAttribute("stroke", i), u.setAttribute("stroke-width", "2"), n.appendChild(u), t.data.forEach((a) => {
8953
+ let o = e.y + e.height, s = document.createElementNS("http://www.w3.org/2000/svg", "path");
8954
+ s.setAttribute("d", this._buildAreaFillPathD(a, o)), s.setAttribute("fill", i), s.setAttribute("fill-opacity", "0.3"), n.appendChild(s);
8955
+ let c = document.createElementNS("http://www.w3.org/2000/svg", "path");
8956
+ c.setAttribute("d", this._buildSmoothLinePathD(a)), c.setAttribute("fill", "none"), c.setAttribute("stroke", i), c.setAttribute("stroke-width", "2"), c.setAttribute("stroke-linecap", "round"), c.setAttribute("stroke-linejoin", "round"), n.appendChild(c), t.data.forEach((a) => {
8902
8957
  let o = document.createElementNS("http://www.w3.org/2000/svg", "circle"), s = this._scaleX(a.x, e), c = this._scaleY(a.y, e);
8903
8958
  o.setAttribute("cx", s.toString()), o.setAttribute("cy", c.toString()), o.setAttribute("r", "4"), o.setAttribute("fill", i);
8904
8959
  let l = document.documentElement.classList.contains("dark");
@@ -9197,6 +9252,9 @@ var R = class extends HTMLElement {
9197
9252
  _isExpanded() {
9198
9253
  return this.getAttribute("expanded") === "true";
9199
9254
  }
9255
+ _isSubmenuPanelVisible() {
9256
+ return this._isExpanded() || this._isActive();
9257
+ }
9200
9258
  _isSubmenuItem() {
9201
9259
  return this.getAttribute("submenu-item") === "true";
9202
9260
  }
@@ -9239,13 +9297,22 @@ var R = class extends HTMLElement {
9239
9297
  let e = this._getHref(), t = this._getLabel(), n = this._getIcon(), r = e ? document.createElement("a") : document.createElement("button");
9240
9298
  e ? (r.setAttribute("href", e), r.setAttribute("role", "link")) : r.setAttribute("type", "button"), r.className = this._getBaseClasses(), r.setAttribute("aria-label", t || "Side navigation link"), r.appendChild(this._createRow(t, n)), this.replaceChildren(r), this._trigger = r;
9241
9299
  }
9300
+ _emitAccordionExpand() {
9301
+ this.dispatchEvent(new CustomEvent("mint-sidenav-accordion", {
9302
+ bubbles: !0,
9303
+ composed: !0,
9304
+ detail: { source: this }
9305
+ }));
9306
+ }
9307
+ _setExpanded(e, t) {
9308
+ this.setAttribute("expanded", String(e)), e && t && this._emitAccordionExpand();
9309
+ }
9242
9310
  _buildDropdownLink() {
9243
- let e = this._getLabel(), t = this._getIcon(), n = Array.from(this.querySelectorAll(":scope > [slot=\"submenu\"]")), r = n.length > 0 ? n : this._submenuContainer ? Array.from(this._submenuContainer.children) : [], i = document.createElement("div");
9244
- i.className = "w-full";
9245
- let a = document.createElement("button");
9246
- a.type = "button", a.className = `${this._getBaseClasses()} block w-full`, a.setAttribute("aria-expanded", String(this._isExpanded())), a.appendChild(this._createRow(e, t)), a.onclick = () => {
9247
- this.setAttribute("expanded", this._isExpanded() ? "false" : "true");
9248
- }, this._submenuContainer = document.createElement("div"), this._submenuContainer.className = [
9311
+ let e = this._getLabel(), t = this._getIcon(), n = this._getHref(), r = Array.from(this.querySelectorAll(":scope > [slot=\"submenu\"]")), i = r.length > 0 ? r : this._submenuContainer ? Array.from(this._submenuContainer.children) : [], a = document.createElement("div");
9312
+ a.className = "w-full", this._submenuContainer = document.createElement("div"), this._submenuContainer.id = `mint-sidenav-submenu-${Math.random().toString(36).slice(2, 11)}`;
9313
+ let o = this._submenuContainer.id;
9314
+ if (this._submenuContainer.className = [
9315
+ "mint-sidenav-submenu",
9249
9316
  "mt-1",
9250
9317
  "ml-5",
9251
9318
  "border-l",
@@ -9253,10 +9320,22 @@ var R = class extends HTMLElement {
9253
9320
  "pl-2",
9254
9321
  "space-y-1",
9255
9322
  "dark:border-mint-divider",
9256
- this._isExpanded() ? "block" : "hidden"
9257
- ].join(" "), r.forEach((e) => {
9323
+ this._isSubmenuPanelVisible() ? "block" : "hidden"
9324
+ ].join(" "), i.forEach((e) => {
9258
9325
  e.setAttribute("submenu-item", "true"), e.setAttribute("slot", "submenu"), this._submenuContainer?.appendChild(e);
9259
- }), i.appendChild(a), i.appendChild(this._submenuContainer), this.replaceChildren(i), this._trigger = a;
9326
+ }), n) {
9327
+ let r = document.createElement("a");
9328
+ r.setAttribute("href", n), r.className = `${this._getBaseClasses()} block w-full`, r.setAttribute("aria-expanded", String(this._isSubmenuPanelVisible())), r.setAttribute("aria-controls", o), this._isActive() ? r.setAttribute("aria-current", "page") : r.removeAttribute("aria-current"), r.appendChild(this._createRow(e, t)), r.addEventListener("click", () => {
9329
+ this._setExpanded(!0, !0);
9330
+ }), a.appendChild(r), this._trigger = r;
9331
+ } else {
9332
+ let n = document.createElement("button");
9333
+ n.type = "button", n.className = `${this._getBaseClasses()} block w-full`, n.setAttribute("aria-expanded", String(this._isSubmenuPanelVisible())), n.setAttribute("aria-controls", o), n.appendChild(this._createRow(e, t)), n.onclick = () => {
9334
+ let e = !this._isExpanded();
9335
+ this._setExpanded(e, e);
9336
+ }, a.appendChild(n), this._trigger = n;
9337
+ }
9338
+ a.appendChild(this._submenuContainer), this.replaceChildren(a);
9260
9339
  }
9261
9340
  render() {
9262
9341
  this._hasSubmenu() && !this._isSubmenuItem() ? this._buildDropdownLink() : this._buildSimpleLink();
@@ -9414,7 +9493,15 @@ customElements.get("mint-sidenav-action-menu") || customElements.define("mint-si
9414
9493
  //#region src/components/side-navigation/SideNavigation.ts
9415
9494
  var H = class extends HTMLElement {
9416
9495
  constructor(...e) {
9417
- super(...e), this._backdrop = null, this._container = null, this._header = null, this._content = null, this._footer = null, this._escapeHandler = null, this._mediaQuery = null, this._mediaListener = null;
9496
+ super(...e), this._backdrop = null, this._container = null, this._header = null, this._content = null, this._footer = null, this._escapeHandler = null, this._mediaQuery = null, this._mediaListener = null, this._accordionHandler = null, this._onMobileNavNavigateClick = (e) => {
9497
+ if (this._mediaQuery?.matches) return;
9498
+ let t = e.target;
9499
+ if (!(t instanceof Element)) return;
9500
+ let n = t.closest("a[href]");
9501
+ if (!(n instanceof HTMLAnchorElement) || !this._container?.contains(n)) return;
9502
+ let r = n.getAttribute("href");
9503
+ !r || r === "#" || r.trim().toLowerCase().startsWith("javascript:") || this._isOpen() && this.removeAttribute("open");
9504
+ };
9418
9505
  }
9419
9506
  static get observedAttributes() {
9420
9507
  return [
@@ -9425,10 +9512,10 @@ var H = class extends HTMLElement {
9425
9512
  ];
9426
9513
  }
9427
9514
  connectedCallback() {
9428
- this.classList.add("relative", "block", "shrink-0", "w-0", "overflow-visible", "min-[1100px]:w-[17rem]", "min-[1100px]:shrink-0"), this._attachEscapeListener(), this._attachMediaListener(), this.render();
9515
+ this.classList.add("relative", "block", "shrink-0", "w-0", "overflow-visible", "min-[1100px]:w-[17rem]", "min-[1100px]:shrink-0"), this._attachEscapeListener(), this._attachMediaListener(), this._attachAccordionListener(), this.render();
9429
9516
  }
9430
9517
  disconnectedCallback() {
9431
- this._detachEscapeListener(), this._detachMediaListener();
9518
+ this._detachEscapeListener(), this._detachMediaListener(), this._detachAccordionListener();
9432
9519
  }
9433
9520
  attributeChangedCallback(e, t, n) {
9434
9521
  t !== n && this.render();
@@ -9449,6 +9536,17 @@ var H = class extends HTMLElement {
9449
9536
  _detachMediaListener() {
9450
9537
  this._mediaQuery && this._mediaListener && this._mediaQuery.removeEventListener("change", this._mediaListener), this._mediaQuery = null, this._mediaListener = null;
9451
9538
  }
9539
+ _attachAccordionListener() {
9540
+ this._accordionHandler || (this._accordionHandler = (e) => {
9541
+ let t = e.detail?.source;
9542
+ !(t instanceof HTMLElement) || t.tagName !== "MINT-SIDENAV-LINK" || this.contains(t) && this.querySelectorAll("mint-sidenav-link").forEach((e) => {
9543
+ e !== t && e.querySelector(":scope .mint-sidenav-submenu") && e.setAttribute("expanded", "false");
9544
+ });
9545
+ }, this.addEventListener("mint-sidenav-accordion", this._accordionHandler));
9546
+ }
9547
+ _detachAccordionListener() {
9548
+ this._accordionHandler &&= (this.removeEventListener("mint-sidenav-accordion", this._accordionHandler), null);
9549
+ }
9452
9550
  getUserName() {
9453
9551
  return this.getAttribute("user-name") || "Acme Inc";
9454
9552
  }
@@ -9462,7 +9560,7 @@ var H = class extends HTMLElement {
9462
9560
  this._backdrop || (this._backdrop = document.createElement("div"), this._backdrop.setAttribute("aria-hidden", "true"), this._backdrop.addEventListener("click", () => this.removeAttribute("open")), this.insertBefore(this._backdrop, this.firstChild));
9463
9561
  }
9464
9562
  _ensureContainer() {
9465
- this._container || (this._container = document.createElement("aside"), this.appendChild(this._container));
9563
+ this._container || (this._container = document.createElement("aside"), this._container.addEventListener("click", this._onMobileNavNavigateClick, !0), this.appendChild(this._container));
9466
9564
  }
9467
9565
  _syncShell() {
9468
9566
  let e = "max-[1099.98px]:top-14", t = this._isOpen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monobill-mintui",
3
- "version": "0.5.95",
3
+ "version": "0.5.97",
4
4
  "description": "A modern framework-agnostic UI kit built as Web Components. Requires Tailwind CSS.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",