@dcs-tech/ui 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +496 -0
  2. package/README.md +56 -5
  3. package/dist/{ChartImageMenu-AsfvmdTH.js → ChartImageMenu-3OfqNFyt.js} +557 -546
  4. package/dist/{ChartView-CW3m4Z_1.js → ChartView-n4G5_2ro.js} +35 -31
  5. package/dist/{SummaryChart-CxRjK_HU.js → SummaryChart-i6fOdrDM.js} +2 -2
  6. package/dist/{SummaryImage-DeYs2Jgj.js → SummaryImage-CCt5ozD9.js} +2 -2
  7. package/dist/{SummarySeeAll-CrmROhBv.js → SummarySeeAll-BY8knsRe.js} +5 -5
  8. package/dist/assets/fileTask.worker--Q3rI3Bn.js +1 -0
  9. package/dist/{columnValue-DwUqueZ6.js → columnValue-74XDBcVF.js} +219 -192
  10. package/dist/{exportContext-BKFnNQ0q.js → exportContext-C52ZuHd8.js} +2 -2
  11. package/dist/{exportEngine-CZ22cX7a.js → exportEngine-BmDly7iw.js} +3 -3
  12. package/dist/file-worker.js +1 -1
  13. package/dist/{fileActions-COf5Q4Eg.js → fileActions-CFNO14Aj.js} +1 -1
  14. package/dist/{geometry-yZmKN662.js → geometry-DG134nYI.js} +379 -273
  15. package/dist/index.js +12808 -9621
  16. package/dist/{labels-CnqqTrne.js → labels-BPItSeRU.js} +2 -0
  17. package/dist/{runFileTask--4YjQH7Y.js → runFileTask-BIZTFnZP.js} +55 -39
  18. package/dist/scrollArea-D84Cwm4o.js +310 -0
  19. package/dist/style.css +1 -1
  20. package/dist/{summaryChartData-CARqGRUl.js → summaryChartData-BiQYJbYZ.js} +8 -2
  21. package/dist/types/components/Alert/Alert.d.ts +16 -0
  22. package/dist/types/components/Alert/index.d.ts +2 -0
  23. package/dist/types/components/Card/Card.d.ts +4 -3
  24. package/dist/types/components/Card/index.d.ts +1 -1
  25. package/dist/types/components/Charts/Funnel.d.ts +2 -1
  26. package/dist/types/components/Charts/chartImage.d.ts +1 -0
  27. package/dist/types/components/ChipInput/ChipTags.d.ts +3 -0
  28. package/dist/types/components/CommandPalette/CommandPaletteTrigger.d.ts +9 -0
  29. package/dist/types/components/CommandPalette/index.d.ts +2 -0
  30. package/dist/types/components/DataTable/TablePagination.d.ts +1 -1
  31. package/dist/types/components/DataTable/TableToolbar.d.ts +2 -1
  32. package/dist/types/components/DataTable/TableView.d.ts +1 -0
  33. package/dist/types/components/DataTable/cards/cardFields.d.ts +1 -0
  34. package/dist/types/components/DataTable/defaults.d.ts +4 -0
  35. package/dist/types/components/DataTable/index.d.ts +1 -1
  36. package/dist/types/components/DataTable/labels.d.ts +2 -0
  37. package/dist/types/components/DataTable/types.d.ts +19 -2
  38. package/dist/types/components/DataTable/ui-local/TableReorderList.d.ts +13 -0
  39. package/dist/types/components/DataTable/ui.d.ts +2 -1
  40. package/dist/types/components/DataTable/useTable.d.ts +1 -0
  41. package/dist/types/components/DatePicker/PeriodGrid.d.ts +13 -0
  42. package/dist/types/components/DatePicker/PeriodPicker.d.ts +19 -0
  43. package/dist/types/components/DatePicker/index.d.ts +1 -1
  44. package/dist/types/components/Dialog/dialogSlots.d.ts +9 -0
  45. package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +8 -0
  46. package/dist/types/components/FieldWrapper/index.d.ts +1 -1
  47. package/dist/types/components/Fields/index.d.ts +1 -1
  48. package/dist/types/components/Image/ImageEditor.d.ts +21 -0
  49. package/dist/types/components/Image/ImagePicker.d.ts +10 -1
  50. package/dist/types/components/Image/imageRender.d.ts +33 -0
  51. package/dist/types/components/Image/index.d.ts +3 -1
  52. package/dist/types/components/Image/prepareImage.d.ts +4 -3
  53. package/dist/types/components/Link/Link.d.ts +22 -0
  54. package/dist/types/components/Link/index.d.ts +2 -0
  55. package/dist/types/components/NavList/NavList.d.ts +13 -0
  56. package/dist/types/components/NavList/index.d.ts +2 -0
  57. package/dist/types/components/PageProgress/PageProgress.d.ts +10 -0
  58. package/dist/types/components/PageProgress/index.d.ts +2 -0
  59. package/dist/types/components/Pagination/Pagination.d.ts +19 -0
  60. package/dist/types/components/Pagination/index.d.ts +2 -0
  61. package/dist/types/components/Popover/Popover.d.ts +1 -1
  62. package/dist/types/components/Popover/floatingPosition.d.ts +4 -0
  63. package/dist/types/components/ReorderList/ReorderGroup.d.ts +16 -0
  64. package/dist/types/components/ReorderList/ReorderList.d.ts +55 -0
  65. package/dist/types/components/ReorderList/crossListDrag.d.ts +61 -0
  66. package/dist/types/components/ReorderList/index.d.ts +5 -0
  67. package/dist/types/components/ReorderList/useReorderDrag.d.ts +28 -0
  68. package/dist/types/components/Tooltip/useTooltip.d.ts +4 -0
  69. package/dist/types/components/UIProvider/UILabelsContext.d.ts +86 -0
  70. package/dist/types/core/hooks/index.d.ts +1 -0
  71. package/dist/types/core/hooks/useMeasuredState.d.ts +1 -0
  72. package/dist/types/core/logic/alert.logic.d.ts +3 -0
  73. package/dist/types/core/logic/commandPalette.logic.d.ts +2 -0
  74. package/dist/types/core/logic/datePicker.logic.d.ts +12 -0
  75. package/dist/types/core/logic/fieldWrapper.logic.d.ts +6 -1
  76. package/dist/types/core/logic/imageEditor.logic.d.ts +132 -0
  77. package/dist/types/core/logic/imageTransform.logic.d.ts +57 -0
  78. package/dist/types/core/logic/index.d.ts +9 -0
  79. package/dist/types/core/logic/inertProps.d.ts +3 -0
  80. package/dist/types/core/logic/pageProgress.logic.d.ts +3 -0
  81. package/dist/types/core/logic/pagination.logic.d.ts +7 -0
  82. package/dist/types/core/logic/periodPicker.logic.d.ts +86 -0
  83. package/dist/types/core/logic/reorder.logic.d.ts +49 -0
  84. package/dist/types/core/types/chipinput.types.d.ts +3 -1
  85. package/dist/types/core/types/collapsible.types.d.ts +3 -0
  86. package/dist/types/core/types/datePicker.types.d.ts +7 -0
  87. package/dist/types/core/types/field.types.d.ts +6 -3
  88. package/dist/types/core/types/fieldWrapper.types.d.ts +2 -0
  89. package/dist/types/core/types/fields.types.d.ts +6 -1
  90. package/dist/types/core/types/form.types.d.ts +1 -0
  91. package/dist/types/core/types/format.types.d.ts +2 -0
  92. package/dist/types/core/types/input.types.d.ts +2 -0
  93. package/dist/types/core/types/navigation.types.d.ts +1 -0
  94. package/dist/types/core/types/select.types.d.ts +2 -6
  95. package/dist/types/core/types/suggest.types.d.ts +2 -0
  96. package/dist/types/index.d.ts +25 -7
  97. package/package.json +3 -2
  98. package/dist/assets/fileTask.worker-BHT1olUk.js +0 -1
  99. package/dist/scrollArea-Dd2dNMV4.js +0 -236
  100. package/dist/types/components/DataTable/ui-local/DragAndDropList/DragAndDropList.d.ts +0 -4
  101. package/dist/types/components/DataTable/ui-local/DragAndDropList/index.d.ts +0 -3
  102. package/dist/types/components/DataTable/ui-local/DragAndDropList/types.d.ts +0 -70
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { A as e, C as t, Cn as n, D as r, E as i, En as a, F as o, G as s, J as c, K as l, L as u, M as d, N as f, O as p, R as m, S as h, T as g, Tn as _, W as v, X as y, Y as b, Z as x, _ as S, b as C, c as w, ct as T, d as E, f as D, ft as O, g as k, h as A, i as j, j as M, k as N, l as P, m as F, o as I, ot as L, p as R, q as z, r as B, s as V, t as H, u as ee, v as U, vt as te, w as ne, y as re, z as ie } from "./geometry-yZmKN662.js";
2
+ import { A as e, C as t, Cn as n, D as r, E as i, En as a, F as o, G as s, J as c, K as l, L as u, M as d, N as f, O as p, R as m, S as h, T as g, Tn as _, W as v, X as y, Y as b, Z as x, _ as S, b as C, c as w, ct as T, d as E, f as D, ft as O, g as k, h as A, i as j, j as M, k as N, l as P, m as F, o as I, ot as L, p as R, q as z, r as B, s as V, t as H, u as ee, v as U, vt as te, w as ne, y as re, z as ie } from "./geometry-DG134nYI.js";
3
3
  import { useCallback as W, useEffect as ae, useLayoutEffect as G, useMemo as oe, useRef as K, useState as q } from "react";
4
4
  import { Fragment as se, jsx as J, jsxs as Y } from "react/jsx-runtime";
5
5
  import { createPortal as ce } from "react-dom";
@@ -933,8 +933,8 @@ function Le({ slices: n, ariaLabel: r, title: i, size: a, compact: o = !1, varia
933
933
  });
934
934
  }
935
935
  // src/components/Charts/Funnel.tsx
936
- function Re({ steps: e, ariaLabel: t, title: n, compact: r = !1, onSelect: i, selected: a = null, ...o }) {
937
- let { nf: u, L: d } = x(o), f = (t) => !!i && e[t].selectable !== !1, p = Q({
936
+ function Re({ steps: e, ariaLabel: t, title: n, compact: r = !1, showChange: i = !0, onSelect: a, selected: o = null, ...u }) {
937
+ let { nf: d, L: f } = x(u), p = (t) => !!a && e[t].selectable !== !1, m = Q({
938
938
  count: e.length,
939
939
  pick: (e, t, n, r) => de(t, xe(r).map((e) => e ? {
940
940
  start: e.top,
@@ -947,38 +947,41 @@ function Re({ steps: e, ariaLabel: t, title: n, compact: r = !1, onSelect: i, se
947
947
  ArrowLeft: 0,
948
948
  ArrowRight: 0
949
949
  },
950
- start: a === null ? null : e.findIndex((e) => e.key === a),
951
- onPick: i ? (t) => f(t) && i(e[t]) : void 0
950
+ start: o === null ? null : e.findIndex((e) => e.key === o),
951
+ onPick: a ? (t) => p(t) && a(e[t]) : void 0
952
952
  });
953
953
  if (!e.some((e) => e.value > 0)) return /* @__PURE__ */ J(l, {
954
954
  title: n,
955
955
  children: /* @__PURE__ */ J(v, {
956
956
  ariaLabel: t,
957
- text: d.empty,
957
+ text: f.empty,
958
958
  compact: r
959
959
  })
960
960
  });
961
- let m = ne(e), h = p.active === null ? null : m[p.active] ?? null, g = h?.step.key ?? a, _ = (e) => `${e.step.label}: ${u(e.step.value)}${e.drop === null ? "" : `, ${d.funnelDrop} ${b(e.drop)}`}`;
961
+ let h = ne(e).map((e) => i ? e : {
962
+ ...e,
963
+ drop: null
964
+ }), g = m.active === null ? null : h[m.active] ?? null, _ = g?.step.key ?? o, y = (e) => `${e.step.label}: ${d(e.step.value)}${e.drop === null ? "" : `, ${f.funnelDrop} ${b(e.drop)}`}`;
962
965
  return /* @__PURE__ */ Y(l, {
963
966
  title: n,
964
967
  children: [
965
968
  /* @__PURE__ */ J("ol", {
966
- className: z(`chart-funnel chart-plot chart-plot--rows${i ? " chart-plot--pick" : ""}`, r),
967
- role: i ? void 0 : "img",
968
- "aria-label": !i && h ? _(h) : t,
969
- ...p.plotProps,
970
- children: m.map(({ step: e, width: t, drop: n }, r) => /* @__PURE__ */ J("li", {
971
- "data-hit": p.pickable ? void 0 : r,
972
- className: `chart-funnel-item${r === p.active ? " chart-funnel-item--active" : ""}`,
973
- "aria-hidden": !p.pickable || void 0,
969
+ className: z(`chart-funnel${i ? "" : " chart-funnel--no-change"} chart-plot chart-plot--rows${a ? " chart-plot--pick" : ""}`, r),
970
+ role: a ? void 0 : "img",
971
+ "aria-label": !a && g ? y(g) : t,
972
+ ...m.plotProps,
973
+ children: h.map(({ step: e, width: t, drop: n }, r) => /* @__PURE__ */ J("li", {
974
+ "data-hit": m.pickable ? void 0 : r,
975
+ className: `chart-funnel-item${r === m.active ? " chart-funnel-item--active" : ""}`,
976
+ "aria-hidden": !m.pickable || void 0,
974
977
  children: /* @__PURE__ */ Y("span", {
975
- ...p.pickable ? p.item(r, {
976
- pressed: a === e.key,
977
- disabled: !f(r)
978
+ ...m.pickable ? m.item(r, {
979
+ pressed: o === e.key,
980
+ disabled: !p(r)
978
981
  }) : {},
979
- "aria-label": p.pickable ? `${e.label}: ${u(e.value)}${n === null ? "" : `, ${b(n)}`}` : void 0,
980
- "aria-description": p.pickable && n !== null ? d.funnelDrop : void 0,
981
- className: `chart-funnel-row${g !== null && g !== e.key ? " chart-faded" : ""}`,
982
+ "aria-label": m.pickable ? `${e.label}: ${d(e.value)}${n === null ? "" : `, ${b(n)}`}` : void 0,
983
+ "aria-description": m.pickable && n !== null ? f.funnelDrop : void 0,
984
+ className: `chart-funnel-row${_ !== null && _ !== e.key ? " chart-faded" : ""}`,
982
985
  children: [
983
986
  /* @__PURE__ */ J("span", {
984
987
  className: "chart-funnel-label",
@@ -995,14 +998,14 @@ function Re({ steps: e, ariaLabel: t, title: n, compact: r = !1, onSelect: i, se
995
998
  background: L(e.slot),
996
999
  color: te(e.slot)
997
1000
  },
998
- children: t >= .18 ? u(e.value) : ""
1001
+ children: t >= .18 ? d(e.value) : ""
999
1002
  }), t < .18 && /* @__PURE__ */ J("span", {
1000
1003
  className: "chart-funnel-outside",
1001
- children: u(e.value)
1004
+ children: d(e.value)
1002
1005
  })]
1003
1006
  }),
1004
1007
  " ",
1005
- /* @__PURE__ */ J("span", {
1008
+ i && /* @__PURE__ */ J("span", {
1006
1009
  className: "chart-funnel-drop",
1007
1010
  "data-change": n === null ? void 0 : n > 0 ? "drop" : n < 0 ? "rise" : "flat",
1008
1011
  children: n === null ? "" : b(n)
@@ -1011,15 +1014,15 @@ function Re({ steps: e, ariaLabel: t, title: n, compact: r = !1, onSelect: i, se
1011
1014
  })
1012
1015
  }, e.key))
1013
1016
  }),
1014
- /* @__PURE__ */ J(s, { text: h ? _(h) : "" }),
1015
- p.tooltip(h && /* @__PURE__ */ J($, {
1017
+ /* @__PURE__ */ J(s, { text: g ? y(g) : "" }),
1018
+ m.tooltip(g && /* @__PURE__ */ J($, {
1016
1019
  rows: [{
1017
- key: h.step.key,
1018
- color: L(h.step.slot),
1019
- label: h.step.label,
1020
- value: u(h.step.value)
1020
+ key: g.step.key,
1021
+ color: L(g.step.slot),
1022
+ label: g.step.label,
1023
+ value: d(g.step.value)
1021
1024
  }],
1022
- note: [p.active > 0 ? `${d.funnelOfFirst}: ${c(h.ofFirst)}` : "", h.drop === null ? "" : `${d.funnelDrop}: ${b(h.drop)}`].filter(Boolean).join(" · ") || void 0
1025
+ note: [i && m.active > 0 ? `${f.funnelOfFirst}: ${c(g.ofFirst)}` : "", g.drop === null ? "" : `${f.funnelDrop}: ${b(g.drop)}`].filter(Boolean).join(" · ") || void 0
1023
1026
  }))
1024
1027
  ]
1025
1028
  });
@@ -1664,6 +1667,7 @@ function qe({ chart: e, ariaLabel: t, compact: n = !1, height: r, size: i, onSel
1664
1667
  });
1665
1668
  case "funnel": return /* @__PURE__ */ J(Re, {
1666
1669
  steps: e.steps,
1670
+ showChange: e.showChange,
1667
1671
  onSelect: f,
1668
1672
  selected: o,
1669
1673
  ...d
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { t as e } from "./ChartView-CW3m4Z_1.js";
3
- import { n as t } from "./summaryChartData-CARqGRUl.js";
2
+ import { t as e } from "./ChartView-n4G5_2ro.js";
3
+ import { n as t } from "./summaryChartData-BiQYJbYZ.js";
4
4
  import { jsx as n } from "react/jsx-runtime";
5
5
  // src/components/DataTable/summary/SummaryChart.tsx
6
6
  var r = {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { t as e } from "./ChartImageMenu-AsfvmdTH.js";
3
- import { n as t } from "./summaryChartData-CARqGRUl.js";
2
+ import { t as e } from "./ChartImageMenu-3OfqNFyt.js";
3
+ import { n as t } from "./summaryChartData-BiQYJbYZ.js";
4
4
  import { jsx as n } from "react/jsx-runtime";
5
5
  // src/components/DataTable/summary/SummaryImage.tsx
6
6
  function r({ item: r, report: i, context: a, branding: o, format: s, locale: c, labels: l }) {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { t as e } from "./ChartImageMenu-AsfvmdTH.js";
3
- import { t } from "./ChartView-CW3m4Z_1.js";
4
- import { J as n, Tt as r, U as i, ot as a } from "./geometry-yZmKN662.js";
5
- import { n as o, o as s, s as c } from "./scrollArea-Dd2dNMV4.js";
6
- import { r as l, t as u } from "./summaryChartData-CARqGRUl.js";
2
+ import { t as e } from "./ChartImageMenu-3OfqNFyt.js";
3
+ import { t } from "./ChartView-n4G5_2ro.js";
4
+ import { J as n, Tt as r, U as i, ot as a } from "./geometry-DG134nYI.js";
5
+ import { n as o, o as s, s as c } from "./scrollArea-D84Cwm4o.js";
6
+ import { r as l, t as u } from "./summaryChartData-BiQYJbYZ.js";
7
7
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
8
8
  // src/components/DataTable/summary/SummarySeeAll.tsx
9
9
  function m({ item: m, all: h, onClose: g, onSelect: _, image: v, labels: y }) {
@@ -0,0 +1 @@
1
+ const e=()=>new DOMException(`Aborted`,`AbortError`);async function t(t,n){if(n.signal?.aborted)throw e();switch(t.kind){case`xlsx`:return d(t.workbook,n);case`pdf`:return h(t,n);default:throw Error(`Unknown file task: ${t.kind}`)}}const n=globalThis;async function r(){let e=await import(`exceljs`),t=[e.default?.default,e.default,e,n.ExcelJS].find(e=>e&&typeof e.Workbook==`function`);if(!t)throw Error(`ExcelJS did not load`);return t}let i=null;function a(){return i||=o().catch(e=>{throw i=null,e}),i}async function o(){let e=await import(`pdfmake/build/pdfmake.js`),t=[e.default?.default,e.default,e,n.pdfMake].find(e=>e&&typeof e.createPdf==`function`);if(!t)throw Error(`pdfmake did not load`);let r,i=`pdfMake`in n,a=i?n.pdfMake:n.pdfMake={},o=a?.addVirtualFileSystem;a&&(a.addVirtualFileSystem=e=>{r=e,o?.call(a,e)});let s;try{s=await import(`pdfmake/build/vfs_fonts.js`)}finally{i?a&&(o?a.addVirtualFileSystem=o:delete a.addVirtualFileSystem):delete n.pdfMake}return{pdfMake:t,vfs:[s?.default,s,s?.pdfMake?.vfs,s?.default?.pdfMake?.vfs,r,t.vfs,n.pdfMake?.vfs].find(e=>e&&e[`Roboto-Regular.ttf`])}}const s=e=>ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e,c=e=>`FF`+e.replace(`#`,``).toUpperCase();function l(e,t){if(t&&((t.bold!==void 0||t.italic!==void 0||t.size||t.color)&&(e.font={...e.font??{},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.size?{size:t.size}:{},...t.color?{color:{argb:c(t.color)}}:{}}),t.fill&&(e.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:c(t.fill)}}),t.align&&(e.alignment={horizontal:t.align,vertical:`middle`}),t.numFmt&&(typeof e.value==`number`||e.value instanceof Date)&&(e.numFmt=t.numFmt),t.borderTop||t.borderBottom)){let n=e=>({style:e.style,...e.color?{color:{argb:c(e.color)}}:{}});e.border={...t.borderTop?{top:n(t.borderTop)}:{},...t.borderBottom?{bottom:n(t.borderBottom)}:{}}}}function u(e,t,n){let r=e.addRow(t.values);t.style?.bold&&(r.font={bold:!0}),t.merge&&n>1&&e.mergeCells(r.number,1,r.number,n);let i=t.merge?1:Math.max(t.values.length,0);for(let e=0;e<i;e++){let n=r.getCell(e+1);l(n,t.style),l(n,t.cells?.[e])}}async function d(t,n){let i=new(await(r())).Workbook,a=Math.max(1,t.sheets.reduce((e,t)=>e+t.rows.length,0)),o=Math.max(1,Math.floor(a/50)),d=0;for(let r of t.sheets){let t=i.addWorksheet(r.name),s=r.columns.length;t.columns=r.columns.map((e,t)=>({key:String(t),width:e.width}));for(let e of r.before??[])u(t,e,s);let f=t.addRow(r.columns.map(e=>e.header));f.font={bold:r.headerStyle?.bold??!0},f.eachCell((e,t)=>{let n=r.columns[t-1]?.align;n&&(e.alignment={horizontal:n,vertical:`middle`}),l(e,r.headerStyle)});let p=f.number;r.freeze?t.views=[{state:`frozen`,ySplit:r.freeze.rows??0,xSplit:r.freeze.cols??0}]:r.freezeHeader!==!1&&(t.views=[{state:`frozen`,ySplit:p}]),r.rows.forEach((i,s)=>{let u=t.addRow(i),f=r.cellStyles?.[s],p=r.stripe&&s%2==1;if(r.columns.forEach((e,t)=>{let n=u.getCell(t+1);e.numFmt&&(typeof n.value==`number`||n.value instanceof Date)&&(n.numFmt=e.numFmt),e.align&&(n.alignment={horizontal:e.align,vertical:`middle`}),p&&(n.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:c(r.stripe)}}),l(n,e.style),l(n,f?.[t])}),++d%o===0){if(n.signal?.aborted)throw e();n.progress(d/a*.9)}}),r.autoFilter&&r.rows.length>0&&(t.autoFilter={from:{row:p,column:1},to:{row:p,column:s}});for(let e of r.after??[])u(t,e,s)}let f=await i.xlsx.writeBuffer();return n.progress(1),s(f)}const f={Roboto:{normal:`Roboto-Regular.ttf`,bold:`Roboto-Medium.ttf`,italics:`Roboto-Italic.ttf`,bolditalics:`Roboto-MediumItalic.ttf`}};function p(e){let t=e.hLineWidth??1,n=e.edgeLineWidth??t;return{hLineWidth:(e,r)=>e===0||e===(r.table.headerRows??0)||e===r.table.body.length?n:t,vLineWidth:()=>e.vLineWidth??1,...e.hLineColor?{hLineColor:()=>e.hLineColor}:{},...e.vLineColor?{vLineColor:()=>e.vLineColor}:{},...e.paddingX===void 0?{}:{paddingLeft:()=>e.paddingX,paddingRight:()=>e.paddingX},...e.paddingY===void 0?{}:{paddingTop:()=>e.paddingY,paddingBottom:()=>e.paddingY}}}function m(e){return(t,n)=>({text:e.text.replace(/\{page\}/g,String(t)).replace(/\{pages\}/g,String(n)),...e.font?{font:e.font}:{},alignment:e.alignment??`center`,fontSize:e.fontSize??8,...e.color?{color:e.color}:{},...e.margin?{margin:e.margin}:{}})}async function h(t,n){let r=n.pdfFonts?{fonts:{...n.pdfFonts.fonts,...t.fonts?.fonts},vfs:n.pdfFonts.vfs||t.fonts?.vfs?{...n.pdfFonts.vfs,...t.fonts?.vfs}:void 0}:t.fonts,i=t.footer?{...t.document,footer:m(t.footer)}:t.document,o=t.tableLayouts?Object.fromEntries(Object.entries(t.tableLayouts).map(([e,t])=>[e,p(t)])):void 0,{pdfMake:s,vfs:c}=await a();if(n.progress(.1),n.signal?.aborted)throw e();let l={...f,...r?.fonts??{}},u=r?.vfs?{...c??{},...r.vfs}:c,d=await new Promise((e,t)=>{try{let n=s.createPdf(i,o,l,u).getStream(),r=[];n.on(`data`,e=>r.push(e)),n.on(`error`,t),n.on(`end`,()=>{let t=new Uint8Array(r.reduce((e,t)=>e+t.byteLength,0)),n=0;for(let e of r)t.set(e,n),n+=e.byteLength;e(t.buffer)}),n.end()}catch(e){t(e)}});return n.progress(1),d}let g;const _=self;_.onmessage=async e=>{if(e.data.type===`init`){g=e.data.pdfFonts;return}let{id:n,task:r}=e.data;try{let e=await t(r,{progress:e=>_.postMessage({type:`progress`,id:n,fraction:e}),pdfFonts:g});_.postMessage({type:`done`,id:n,buffer:e},[e])}catch(e){_.postMessage({type:`error`,id:n,message:e instanceof Error?e.message:String(e)})}};