@8sheets/data-grid 0.0.0-stage → 1.0.1

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 (292) hide show
  1. package/LICENSE.md +36 -0
  2. package/README.md +52 -2
  3. package/a11y/cell-alt-text.js +1 -0
  4. package/api/overlay.js +1 -0
  5. package/api/serialize.js +1 -0
  6. package/api/skins.js +1 -0
  7. package/api/style-refs.js +1 -0
  8. package/api/watermark-xml.js +2 -0
  9. package/calc/adjust.js +1 -0
  10. package/calc/cell-set.js +1 -0
  11. package/calc/compile.js +1 -0
  12. package/calc/engine.js +1 -0
  13. package/calc/fill-shape.js +2 -0
  14. package/calc/functions/array.js +1 -0
  15. package/calc/functions/database.js +1 -0
  16. package/calc/functions/date.js +1 -0
  17. package/calc/functions/engineering.js +1 -0
  18. package/calc/functions/financial.js +1 -0
  19. package/calc/functions/helpers.js +1 -0
  20. package/calc/functions/index.js +1 -0
  21. package/calc/functions/info.js +1 -0
  22. package/calc/functions/logical.js +1 -0
  23. package/calc/functions/lookup.js +1 -0
  24. package/calc/functions/math.js +1 -0
  25. package/calc/functions/registry.js +1 -0
  26. package/calc/functions/stat.js +1 -0
  27. package/calc/functions/text.js +1 -0
  28. package/calc/parser.js +3 -0
  29. package/calc/values.js +1 -0
  30. package/calcx/ai/client.js +1 -0
  31. package/calcx/ai/functions.js +15 -0
  32. package/calcx/ai/settings.js +1 -0
  33. package/calcx/async.js +1 -0
  34. package/calcx/culture/format-locale.js +1 -0
  35. package/calcx/culture/lcid.js +1 -0
  36. package/calcx/external-read.js +1 -0
  37. package/calcx/external-write.js +3 -0
  38. package/calcx/external.js +1 -0
  39. package/calcx/functions/dynamic.js +1 -0
  40. package/calcx/functions/ets.js +1 -0
  41. package/calcx/functions/index.js +1 -0
  42. package/calcx/functions/misc.js +1 -0
  43. package/calcx/functions/text.js +1 -0
  44. package/calcx/functions/xml.js +1 -0
  45. package/calcx/refresh.js +1 -0
  46. package/cells/auto-merge.js +1 -0
  47. package/cells/axis-limits.js +1 -0
  48. package/cells/axis-ops.js +1 -0
  49. package/cells/background-xml.js +1 -0
  50. package/cells/background.js +1 -0
  51. package/cells/book-css.js +206 -0
  52. package/cells/book-read.js +1 -0
  53. package/cells/book-view.js +1 -0
  54. package/cells/cell-defaults.js +1 -0
  55. package/cells/cell-extras.js +1 -0
  56. package/cells/cell-options-ui.js +1 -0
  57. package/cells/cell-styles-xml.js +1 -0
  58. package/cells/cf-engine.js +1 -0
  59. package/cells/cf-file.js +1 -0
  60. package/cells/cf-paint.js +1 -0
  61. package/cells/consolidate-links.js +1 -0
  62. package/cells/docprops-xml.js +2 -0
  63. package/cells/filter-file.js +1 -0
  64. package/cells/find-engine.js +2 -0
  65. package/cells/find.js +1 -0
  66. package/cells/format-code.js +1 -0
  67. package/cells/format-panes.js +3 -0
  68. package/cells/format-tabs.js +102 -0
  69. package/cells/goto.js +1 -0
  70. package/cells/header-colors.js +1 -0
  71. package/cells/mask.js +1 -0
  72. package/cells/menu-extras.js +1 -0
  73. package/cells/name-box.js +1 -0
  74. package/cells/note-xml.js +1 -0
  75. package/cells/options.js +1 -0
  76. package/cells/outline-column.js +1 -0
  77. package/cells/paint.js +1 -0
  78. package/cells/panes.js +1 -0
  79. package/cells/rich-data-xml.js +2 -0
  80. package/cells/rich-data.js +1 -0
  81. package/cells/rich-runs.js +2 -0
  82. package/cells/rich-values.js +1 -0
  83. package/cells/rich-xml.js +1 -0
  84. package/cells/rounded.js +1 -0
  85. package/cells/sections.js +2 -0
  86. package/cells/selection-modes.js +1 -0
  87. package/cells/style-xml.js +1 -0
  88. package/cells/text-layout.js +8 -0
  89. package/cells/undo-group.js +1 -0
  90. package/cells/validation-alert.js +2 -0
  91. package/cells/view-options.js +1 -0
  92. package/cells/view-xml.js +1 -0
  93. package/celltypes/barcode-tables.js +31 -0
  94. package/celltypes/barcode.js +2 -0
  95. package/celltypes/base.js +1 -0
  96. package/celltypes/cell-buttons.js +1 -0
  97. package/celltypes/cell-types.js +2 -0
  98. package/celltypes/data-object.js +1 -0
  99. package/celltypes/diagonal.js +1 -0
  100. package/celltypes/dropdowns-more.js +13 -0
  101. package/celltypes/dropdowns.js +42 -0
  102. package/celltypes/file-cell.js +2 -0
  103. package/celltypes/glyphs.js +1 -0
  104. package/celltypes/persist.js +2 -0
  105. package/celltypes/range-template.js +2 -0
  106. package/charts/chartex.js +3 -0
  107. package/charts/geo/geo-xml.js +1 -0
  108. package/charts/geo/map-state.js +1 -0
  109. package/charts/patterns.js +1 -0
  110. package/core/address.js +1 -0
  111. package/core/axis.js +1 -0
  112. package/core/base64.js +1 -0
  113. package/core/changes.js +1 -0
  114. package/core/color.js +1 -0
  115. package/core/cond-format.js +1 -0
  116. package/core/custom-views.js +1 -0
  117. package/core/default-names.js +1 -0
  118. package/core/formula-refs.js +1 -0
  119. package/core/formula-store.js +1 -0
  120. package/core/input.js +1 -0
  121. package/core/math.js +1 -0
  122. package/core/numfmt.js +1 -0
  123. package/core/online.js +1 -0
  124. package/core/protection.js +1 -0
  125. package/core/regexp.js +1 -0
  126. package/core/sheet-group.js +1 -0
  127. package/core/sheet.js +1 -0
  128. package/core/sparklines.js +1 -0
  129. package/core/sparse.js +1 -0
  130. package/core/strings.js +1 -0
  131. package/core/styles.js +1 -0
  132. package/core/table-presets.js +7 -0
  133. package/core/tables.js +2 -0
  134. package/core/tsv.js +4 -0
  135. package/core/whatif.js +1 -0
  136. package/core/workbook.js +1 -0
  137. package/datasheets/bind.js +1 -0
  138. package/datasheets/calendar.js +1 -0
  139. package/datasheets/cross.js +1 -0
  140. package/datasheets/data-core.js +1 -0
  141. package/datasheets/data.js +1 -0
  142. package/datasheets/formula.js +1 -0
  143. package/datasheets/gantt-paint.js +1 -0
  144. package/datasheets/gantt-resources.js +1 -0
  145. package/datasheets/gantt-shapes.js +1 -0
  146. package/datasheets/gantt.js +1 -0
  147. package/datasheets/manager.js +1 -0
  148. package/datasheets/path-binding.js +2 -0
  149. package/datasheets/persist-writer.js +2 -0
  150. package/datasheets/persist.js +1 -0
  151. package/datasheets/query-function.js +1 -0
  152. package/datasheets/remote.js +3 -0
  153. package/datasheets/report-entry.js +1 -0
  154. package/datasheets/report.js +1 -0
  155. package/datasheets/rules.js +1 -0
  156. package/datasheets/sort.js +1 -0
  157. package/datasheets/table-sheet.js +1 -0
  158. package/datasheets/view.js +3 -0
  159. package/datasheets/virtual-sheet.js +1 -0
  160. package/datasheets/window.js +1 -0
  161. package/extras/getdata/persist.js +2 -0
  162. package/extras/getdata/rows.js +1 -0
  163. package/extras/getdata/steps.js +1 -0
  164. package/i18n/dom.js +1 -0
  165. package/i18n/en/a11y.js +1 -0
  166. package/i18n/en/cells.js +1 -0
  167. package/i18n/en/charts.js +1 -0
  168. package/i18n/en/common.js +1 -0
  169. package/i18n/en/datasheets.js +1 -0
  170. package/i18n/en/format.js +1 -0
  171. package/i18n/en/misc.js +1 -0
  172. package/i18n/en/pivot.js +1 -0
  173. package/i18n/en/proofing.js +1 -0
  174. package/i18n/en/ribbon.js +1 -0
  175. package/i18n/en/shapes.js +1 -0
  176. package/i18n/en/shell.js +1 -0
  177. package/i18n/en/touch.js +1 -0
  178. package/i18n/en.js +1 -0
  179. package/i18n/index.js +1 -0
  180. package/i18n/key-text.js +1 -0
  181. package/i18n/languages.js +1 -0
  182. package/i18n/pl/a11y.js +1 -0
  183. package/i18n/pl/cells.js +1 -0
  184. package/i18n/pl/charts.js +1 -0
  185. package/i18n/pl/common.js +1 -0
  186. package/i18n/pl/datasheets.js +1 -0
  187. package/i18n/pl/format.js +1 -0
  188. package/i18n/pl/misc.js +1 -0
  189. package/i18n/pl/pivot.js +1 -0
  190. package/i18n/pl/proofing.js +1 -0
  191. package/i18n/pl/ribbon.js +1 -0
  192. package/i18n/pl/shapes.js +1 -0
  193. package/i18n/pl/shell.js +1 -0
  194. package/i18n/pl/touch.js +1 -0
  195. package/i18n/pl.js +1 -0
  196. package/io/client.js +1 -0
  197. package/io/crc32.js +1 -0
  198. package/io/crypto/aes.js +1 -0
  199. package/io/crypto/agile.js +2 -0
  200. package/io/crypto/cfb-read.js +1 -0
  201. package/io/crypto/cfb-write.js +1 -0
  202. package/io/crypto/dataspaces.js +1 -0
  203. package/io/crypto/errors.js +1 -0
  204. package/io/crypto/hash.js +1 -0
  205. package/io/crypto/index.js +1 -0
  206. package/io/crypto/package-read.js +1 -0
  207. package/io/crypto/package-write.js +1 -0
  208. package/io/crypto/spool.js +1 -0
  209. package/io/crypto/standard.js +1 -0
  210. package/io/csv.js +8 -0
  211. package/io/export-blocks.js +1 -0
  212. package/io/foreign-parts.js +1 -0
  213. package/io/foreign-sheets.js +2 -0
  214. package/io/io.worker.js +1 -0
  215. package/io/package-paths.js +1 -0
  216. package/io/plan.js +1 -0
  217. package/io/text-split.js +3 -0
  218. package/io/xlsx-read.js +1 -0
  219. package/io/xlsx-styles.js +2 -0
  220. package/io/xlsx-tail.js +1 -0
  221. package/io/xlsx-write.js +2 -0
  222. package/io/xml-escape.js +1 -0
  223. package/io/xml-scan.js +1 -0
  224. package/io/zip-reader.js +1 -0
  225. package/io/zip-writer.js +1 -0
  226. package/objects/chart-model.js +1 -0
  227. package/objects/dml.js +5 -0
  228. package/objects/drawing-xml.js +1 -0
  229. package/objects/picture-url.js +1 -0
  230. package/package.json +57 -4
  231. package/pivot/engine.js +1 -0
  232. package/pivot/xml.js +2 -0
  233. package/print/page-setup.js +1 -0
  234. package/print/paginate.js +1 -0
  235. package/print/pdf.js +35 -0
  236. package/print/render-page.js +3 -0
  237. package/render/patterns.js +1 -0
  238. package/shapes/form-xml.js +1 -0
  239. package/shapes/watermark.js +1 -0
  240. package/slicers/custom-styles.js +1 -0
  241. package/slicers/date-filters.js +1 -0
  242. package/slicers/format.js +2 -0
  243. package/slicers/pivot-file.js +1 -0
  244. package/slicers/structured.js +1 -0
  245. package/slicers/table-file.js +1 -0
  246. package/slicers/write.js +1 -0
  247. package/sparklines/colors.js +1 -0
  248. package/sparklines/data.js +1 -0
  249. package/sparklines/descriptor.js +1 -0
  250. package/sparklines/excel-paint.js +1 -0
  251. package/sparklines/functions.js +1 -0
  252. package/sparklines/paint-core.js +1 -0
  253. package/sparklines/paint-measure.js +1 -0
  254. package/sparklines/paint-other.js +2 -0
  255. package/sparklines/paint-series.js +1 -0
  256. package/sparklines/paint.js +1 -0
  257. package/sparklines/print.js +1 -0
  258. package/sparklines/rule.js +1 -0
  259. package/table-view/api.js +1 -0
  260. package/table-view/cell-editor.js +1 -0
  261. package/table-view/cell-format.js +1 -0
  262. package/table-view/chrome.js +1 -0
  263. package/table-view/client.js +1 -0
  264. package/table-view/column-drag.js +1 -0
  265. package/table-view/column-input.js +1 -0
  266. package/table-view/column-window.js +1 -0
  267. package/table-view/events.js +1 -0
  268. package/table-view/files.js +1 -0
  269. package/table-view/grid-keys.js +2 -0
  270. package/table-view/index.d.ts +4 -0
  271. package/table-view/index.js +1 -0
  272. package/table-view/labels.js +1 -0
  273. package/table-view/model.js +1 -0
  274. package/table-view/mount.js +1 -0
  275. package/table-view/panel.js +1 -0
  276. package/table-view/pivot.js +1 -0
  277. package/table-view/public.d.ts +841 -0
  278. package/table-view/quick-filter.js +1 -0
  279. package/table-view/reader.worker.js +1 -0
  280. package/table-view/remote.js +1 -0
  281. package/table-view/row-cache.js +1 -0
  282. package/table-view/row-selection.js +1 -0
  283. package/table-view/table-css.js +1207 -0
  284. package/table-view/totals.js +1 -0
  285. package/table-view/version.js +1 -0
  286. package/table-view/worksheet-table.js +1 -0
  287. package/ui/dialogs.js +3 -0
  288. package/ui/dom.js +1 -0
  289. package/ui/icons.js +1 -0
  290. package/ui/menu-base.js +1 -0
  291. package/ui/protection-ui.js +1 -0
  292. package/ui/ui-scale.js +1 -0
@@ -0,0 +1,7 @@
1
+ // Generated by tools/gen-table-styles.mjs from ECMA-376 Part 1, presetTableStyles.xml. Don't edit.
2
+ // Definitions (c) Ecma International, from ECMA-376 Part 1, 5th edition. Used to implement the standard, as Ecma's text copyright policy allows: https://www.ecma-international.org/policies/by-ipr/ecma-text-copyright-policy
3
+ //
4
+ // PRESET_DXFS: differential formats: bold, italic, c font color, f fill, and borders l r t b with
5
+ // v and h for the lines inside an element, each [style, color]. A color is [theme index, tint] or hex.
6
+ // PRESET_STYLES: each built-in style's elements as [type, format, stripe size when not 1].
7
+ const t=[{c:[1],f:[9,.79998],l:["thin",[9,.39998]],r:["thin",[9,.39998]],t:["thin",[9,.39998]],b:["thin",[9,.39998]],v:["thin",[9,.39998]],h:["thin",[9,.39998]]},{bold:1,c:[1]},{bold:1,c:[1],t:["medium",[9]]},{f:[9,.59999]},{c:[1],f:[8,.79998],l:["thin",[8,.39998]],r:["thin",[8,.39998]],t:["thin",[8,.39998]],b:["thin",[8,.39998]],v:["thin",[8,.39998]],h:["thin",[8,.39998]]},{bold:1,c:[1],t:["medium",[8]]},{f:[8,.59999]},{c:[1],f:[7,.79998],l:["thin",[7,.39998]],r:["thin",[7,.39998]],t:["thin",[7,.39998]],b:["thin",[7,.39998]],v:["thin",[7,.39998]],h:["thin",[7,.39998]]},{bold:1,c:[1],t:["medium",[7]]},{f:[7,.59999]},{c:[1],f:[6,.79998],l:["thin",[6,.39998]],r:["thin",[6,.39998]],t:["thin",[6,.39998]],b:["thin",[6,.39998]],v:["thin",[6,.39998]],h:["thin",[6,.39998]]},{bold:1,c:[1],t:["medium",[6]]},{f:[6,.59999]},{c:[1],f:[5,.79998],l:["thin",[5,.39998]],r:["thin",[5,.39998]],t:["thin",[5,.39998]],b:["thin",[5,.39998]],v:["thin",[5,.39998]],h:["thin",[5,.39998]]},{bold:1,c:[1],t:["medium",[5]]},{f:[5,.59999]},{c:[1],f:[4,.79998],l:["thin",[4,.39998]],r:["thin",[4,.39998]],t:["thin",[4,.39998]],b:["thin",[4,.39998]],v:["thin",[4,.39998]],h:["thin",[4,.39998]]},{bold:1,c:[1],t:["medium",[4]]},{f:[4,.59999]},{c:[1],f:[0,-.15],l:["thin",[1]],r:["thin",[1]],t:["thin",[1]],b:["thin",[1]],v:["thin",[1]],h:["thin",[1]]},{bold:1,c:[1],t:["medium",[1]]},{f:[0,-.34999]},{c:[1],t:["medium",[1]],b:["medium",[1]]},{bold:1,c:[0],f:[9],b:["medium",[1]]},{t:["double",[1]]},{bold:1,c:[0],f:[9]},{f:[0,-.15]},{bold:1,c:[0],f:[8],b:["medium",[1]]},{bold:1,c:[0],f:[8]},{bold:1,c:[0],f:[7],b:["medium",[1]]},{bold:1,c:[0],f:[7]},{bold:1,c:[0],f:[6],b:["medium",[1]]},{bold:1,c:[0],f:[6]},{bold:1,c:[0],f:[5],b:["medium",[1]]},{bold:1,c:[0],f:[5]},{bold:1,c:[0],f:[4],b:["medium",[1]]},{bold:1,c:[0],f:[4]},{c:[1],l:["thin",[1]],r:["thin",[1]],t:["medium",[1]],b:["medium",[1]],v:["thin",[1]],h:["thin",[1]]},{bold:1,c:[0],f:[1],b:["medium",[1]]},{bold:1,c:[0],f:[1]},{c:[1],f:[9,.79998],v:["thin",[0]],h:["thin",[0]]},{bold:1,c:[0],f:[9],b:["thick",[0]]},{bold:1,c:[0],f:[9],t:["thick",[0]]},{c:[1],f:[8,.79998],v:["thin",[0]],h:["thin",[0]]},{bold:1,c:[0],f:[8],b:["thick",[0]]},{bold:1,c:[0],f:[8],t:["thick",[0]]},{c:[1],f:[7,.79998],v:["thin",[0]],h:["thin",[0]]},{bold:1,c:[0],f:[7],b:["thick",[0]]},{bold:1,c:[0],f:[7],t:["thick",[0]]},{c:[1],f:[6,.79998],v:["thin",[0]],h:["thin",[0]]},{bold:1,c:[0],f:[6],b:["thick",[0]]},{bold:1,c:[0],f:[6],t:["thick",[0]]},{c:[1],f:[5,.79998],v:["thin",[0]],h:["thin",[0]]},{bold:1,c:[0],f:[5],b:["thick",[0]]},{bold:1,c:[0],f:[5],t:["thick",[0]]},{c:[1],f:[4,.79998],v:["thin",[0]],h:["thin",[0]]},{bold:1,c:[0],f:[4],b:["thick",[0]]},{bold:1,c:[0],f:[4],t:["thick",[0]]},{c:[1],f:[0,-.15],v:["thin",[0]],h:["thin",[0]]},{bold:1,c:[0],f:[1],b:["thick",[0]]},{bold:1,c:[0],f:[1],t:["thick",[0]]},{c:[1],l:["thin",[9,.39998]],r:["thin",[9,.39998]],t:["thin",[9,.39998]],b:["thin",[9,.39998]],h:["thin",[9,.39998]]},{bold:1,c:[1],t:["double",[9]]},{f:[9,.79998]},{c:[1],l:["thin",[8,.39998]],r:["thin",[8,.39998]],t:["thin",[8,.39998]],b:["thin",[8,.39998]],h:["thin",[8,.39998]]},{bold:1,c:[1],t:["double",[8]]},{f:[8,.79998]},{c:[1],l:["thin",[7,.39998]],r:["thin",[7,.39998]],t:["thin",[7,.39998]],b:["thin",[7,.39998]],h:["thin",[7,.39998]]},{bold:1,c:[1],t:["double",[7]]},{f:[7,.79998]},{c:[1],l:["thin",[6,.39998]],r:["thin",[6,.39998]],t:["thin",[6,.39998]],b:["thin",[6,.39998]],h:["thin",[6,.39998]]},{bold:1,c:[1],t:["double",[6]]},{f:[6,.79998]},{c:[1],l:["thin",[5,.39998]],r:["thin",[5,.39998]],t:["thin",[5,.39998]],b:["thin",[5,.39998]],h:["thin",[5,.39998]]},{bold:1,c:[1],t:["double",[5]]},{f:[5,.79998]},{c:[1],l:["thin",[4,.39998]],r:["thin",[4,.39998]],t:["thin",[4,.39998]],b:["thin",[4,.39998]],h:["thin",[4,.39998]]},{bold:1,c:[1],t:["double",[4]]},{f:[4,.79998]},{c:[1],l:["thin",[1]],r:["thin",[1]],t:["thin",[1]],b:["thin",[1]],h:["thin",[1]]},{bold:1,c:[1],t:["double",[1]]},{c:[1],l:["thin",[9]],r:["thin",[9]],t:["thin",[9]],b:["thin",[9]],v:["thin",[9]],h:["thin",[9]]},{bold:1,c:[1],b:["medium",[9]]},{c:[1],l:["thin",[8]],r:["thin",[8]],t:["thin",[8]],b:["thin",[8]],v:["thin",[8]],h:["thin",[8]]},{bold:1,c:[1],b:["medium",[8]]},{c:[1],l:["thin",[7]],r:["thin",[7]],t:["thin",[7]],b:["thin",[7]],v:["thin",[7]],h:["thin",[7]]},{bold:1,c:[1],b:["medium",[7]]},{c:[1],l:["thin",[6]],r:["thin",[6]],t:["thin",[6]],b:["thin",[6]],v:["thin",[6]],h:["thin",[6]]},{bold:1,c:[1],b:["medium",[6]]},{c:[1],l:["thin",[5]],r:["thin",[5]],t:["thin",[5]],b:["thin",[5]],v:["thin",[5]],h:["thin",[5]]},{bold:1,c:[1],b:["medium",[5]]},{c:[1],l:["thin",[4]],r:["thin",[4]],t:["thin",[4]],b:["thin",[4]],v:["thin",[4]],h:["thin",[4]]},{bold:1,c:[1],b:["medium",[4]]},{c:[1],l:["thin",[1]],r:["thin",[1]],t:["thin",[1]],b:["thin",[1]],v:["thin",[1]],h:["thin",[1]]},{bold:1,c:[1],b:["medium",[1]]},{c:[1],l:["thin",[9]],r:["thin",[9]],t:["thin",[9]],b:["thin",[9]]},{t:["thin",[9]]},{l:["thin",[9]]},{c:[1],l:["thin",[8]],r:["thin",[8]],t:["thin",[8]],b:["thin",[8]]},{t:["thin",[8]]},{l:["thin",[8]]},{c:[1],l:["thin",[7]],r:["thin",[7]],t:["thin",[7]],b:["thin",[7]]},{t:["thin",[7]]},{l:["thin",[7]]},{c:[1],l:["thin",[6]],r:["thin",[6]],t:["thin",[6]],b:["thin",[6]]},{t:["thin",[6]]},{l:["thin",[6]]},{c:[1],l:["thin",[5]],r:["thin",[5]],t:["thin",[5]],b:["thin",[5]]},{t:["thin",[5]]},{l:["thin",[5]]},{c:[1],l:["thin",[4]],r:["thin",[4]],t:["thin",[4]],b:["thin",[4]]},{t:["thin",[4]]},{l:["thin",[4]]},{c:[1],l:["thin",[1]],r:["thin",[1]],t:["thin",[1]],b:["thin",[1]]},{t:["thin",[1]]},{l:["thin",[1]]},{c:[9,-.24998],t:["thin",[9]],b:["thin",[9]]},{bold:1,c:[9,-.24998],b:["thin",[9]]},{bold:1,c:[9,-.24998],t:["thin",[9]]},{bold:1,c:[9,-.24998]},{c:[8,-.24998],t:["thin",[8]],b:["thin",[8]]},{bold:1,c:[8,-.24998],b:["thin",[8]]},{bold:1,c:[8,-.24998],t:["thin",[8]]},{bold:1,c:[8,-.24998]},{c:[7,-.24998],t:["thin",[7]],b:["thin",[7]]},{bold:1,c:[7,-.24998],b:["thin",[7]]},{bold:1,c:[7,-.24998],t:["thin",[7]]},{bold:1,c:[7,-.24998]},{c:[6,-.24998],t:["thin",[6]],b:["thin",[6]]},{bold:1,c:[6,-.24998],b:["thin",[6]]},{bold:1,c:[6,-.24998],t:["thin",[6]]},{bold:1,c:[6,-.24998]},{c:[5,-.24998],t:["thin",[5]],b:["thin",[5]]},{bold:1,c:[5,-.24998],b:["thin",[5]]},{bold:1,c:[5,-.24998],t:["thin",[5]]},{bold:1,c:[5,-.24998]},{c:[4,-.24998],t:["thin",[4]],b:["thin",[4]]},{bold:1,c:[4,-.24998],b:["thin",[4]]},{bold:1,c:[4,-.24998],t:["thin",[4]]},{bold:1,c:[4,-.24998]},{c:[1],t:["thin",[1]],b:["thin",[1]]},{bold:1,c:[1],b:["thin",[1]]},{bold:1,c:[1],t:["thin",[1]]},{c:[0],f:[9]},{c:[0],f:[7]},{c:[0],f:[5]},{c:[0],f:[1]},{bold:1,c:[0],f:[1],b:["medium",[0]]},{bold:1,c:[0],f:[9,-.49998],t:["medium",[0]]},{bold:1,c:[0],f:[9,-.24998],r:["medium",[0]]},{bold:1,c:[0],f:[9,-.24998],l:["medium",[0]]},{f:[9,-.24998]},{c:[0],f:[8]},{bold:1,c:[0],f:[8,-.49998],t:["medium",[0]]},{bold:1,c:[0],f:[8,-.24998],r:["medium",[0]]},{bold:1,c:[0],f:[8,-.24998],l:["medium",[0]]},{f:[8,-.24998]},{bold:1,c:[0],f:[7,-.49998],t:["medium",[0]]},{bold:1,c:[0],f:[7,-.24998],r:["medium",[0]]},{bold:1,c:[0],f:[7,-.24998],l:["medium",[0]]},{f:[7,-.24998]},{c:[0],f:[6]},{bold:1,c:[0],f:[6,-.49998],t:["medium",[0]]},{bold:1,c:[0],f:[6,-.24998],r:["medium",[0]]},{bold:1,c:[0],f:[6,-.24998],l:["medium",[0]]},{f:[6,-.24998]},{bold:1,c:[0],f:[5,-.49998],t:["medium",[0]]},{bold:1,c:[0],f:[5,-.24998],r:["medium",[0]]},{bold:1,c:[0],f:[5,-.24998],l:["medium",[0]]},{f:[5,-.24998]},{c:[0],f:[4]},{bold:1,c:[0],f:[4,-.49998],t:["medium",[0]]},{bold:1,c:[0],f:[4,-.24998],r:["medium",[0]]},{bold:1,c:[0],f:[4,-.24998],l:["medium",[0]]},{f:[4,-.24998]},{c:[0],f:[1,.45]},{bold:1,c:[0],f:[1,.15],t:["medium",[0]]},{bold:1,c:[0],f:[1,.24998],r:["medium",[0]]},{bold:1,c:[0],f:[1,.24998],l:["medium",[0]]},{f:[1,.24998]},{c:[9,-.24998],f:[9,.79998],v:["thin",[0]]},{bold:1,c:[9,-.24998],b:["thin",[0]]},{bold:1,c:[9,-.24998],f:[9,.59999]},{c:[8,-.24998],f:[8,.79998],v:["thin",[0]]},{bold:1,c:[8,-.24998],b:["thin",[0]]},{bold:1,c:[8,-.24998],f:[8,.59999]},{c:[7,-.24998],f:[7,.79998],v:["thin",[0]]},{bold:1,c:[7,-.24998],b:["thin",[0]]},{bold:1,c:[7,-.24998],f:[7,.59999]},{c:[6,-.24998],f:[6,.79998],v:["thin",[0]]},{bold:1,c:[6,-.24998],b:["thin",[0]]},{bold:1,c:[6,-.24998],f:[6,.59999]},{c:[5,-.24998],f:[5,.79998],v:["thin",[0]]},{bold:1,c:[5,-.24998],b:["thin",[0]]},{bold:1,c:[5,-.24998],f:[5,.59999]},{c:[4,-.24998],f:[4,.79998],v:["thin",[0]]},{bold:1,c:[4,-.24998],b:["thin",[0]]},{bold:1,c:[4,-.24998],f:[4,.59999]},{c:[1,.49998],f:[0,-.15],v:["thin",[0]]},{bold:1,c:[1,.49998],b:["thin",[0]]},{bold:1,c:[1,.49998]},{bold:1,c:[1,.49998],f:[0,-.24998]},{f:[0,-.24998]},{c:[1],f:[9,.79998],l:["thin",[9,.59999]],r:["thin",[9,.59999]],v:["thin",[9,.59999]]},{f:[9,.79998],t:["thin",[9,.59999]],b:["thin",[9,.59999]]},{f:[9,.79998],l:["thin",[9,.59999]],r:["thin",[9,.59999]]},{c:[1],f:[9,.59999],l:["thin",[9,.39998]],r:["thin",[9,.39998]],t:["thin",[9,.39998]]},{bold:1,c:[1],b:["thin",[9,.59999]]},{t:["thin",[1]],b:["thin",[1]]},{c:[1],f:[8,.79998],l:["thin",[8,.59999]],r:["thin",[8,.59999]],v:["thin",[8,.59999]]},{f:[8,.79998],t:["thin",[8,.59999]],b:["thin",[8,.59999]]},{f:[8,.79998],l:["thin",[8,.59999]],r:["thin",[8,.59999]]},{c:[1],f:[8,.59999],l:["thin",[8,.39998]],r:["thin",[8,.39998]],t:["thin",[8,.39998]]},{bold:1,c:[1],b:["thin",[8,.59999]]},{c:[1],f:[7,.79998],l:["thin",[7,.59999]],r:["thin",[7,.59999]],v:["thin",[7,.59999]]},{f:[7,.79998],t:["thin",[7,.59999]],b:["thin",[7,.59999]]},{f:[7,.79998],l:["thin",[7,.59999]],r:["thin",[7,.59999]]},{c:[1],f:[7,.59999],l:["thin",[7,.39998]],r:["thin",[7,.39998]],t:["thin",[7,.39998]]},{bold:1,c:[1],b:["thin",[7,.59999]]},{c:[1],f:[6,.79998],l:["thin",[6,.59999]],r:["thin",[6,.59999]],v:["thin",[6,.59999]]},{f:[6,.79998],t:["thin",[6,.59999]],b:["thin",[6,.59999]]},{f:[6,.79998],l:["thin",[6,.59999]],r:["thin",[6,.59999]]},{c:[1],f:[6,.59999],l:["thin",[6,.39998]],r:["thin",[6,.39998]],t:["thin",[6,.39998]]},{bold:1,c:[1],b:["thin",[6,.59999]]},{c:[1],f:[5,.79998],l:["thin",[5,.59999]],r:["thin",[5,.59999]],v:["thin",[5,.59999]]},{f:[5,.79998],t:["thin",[5,.59999]],b:["thin",[5,.59999]]},{f:[5,.79998],l:["thin",[5,.59999]],r:["thin",[5,.59999]]},{c:[1],f:[5,.59999],l:["thin",[5,.39998]],r:["thin",[5,.39998]],t:["thin",[5,.39998]]},{bold:1,c:[1],b:["thin",[5,.59999]]},{c:[1],f:[4,.79998],l:["thin",[4,.59999]],r:["thin",[4,.59999]],v:["thin",[4,.59999]]},{f:[4,.79998],t:["thin",[4,.59999]],b:["thin",[4,.59999]]},{f:[4,.79998],l:["thin",[4,.59999]],r:["thin",[4,.59999]]},{c:[1],f:[4,.59999],l:["thin",[4,.39998]],r:["thin",[4,.39998]],t:["thin",[4,.39998]]},{bold:1,c:[1],b:["thin",[4,.59999]]},{c:[1],f:[0,-.04999],l:["thin",[0,-.15]],r:["thin",[0,-.15]],v:["thin",[0,-.15]]},{f:[0,-.15],t:["thin",[0,-.24998]],b:["thin",[0,-.24998]]},{f:[0,-.15],l:["thin",[0,-.24998]],r:["thin",[0,-.24998]]},{c:[1],f:[0,-.24998],l:["thin",[0,-.34999]],r:["thin",[0,-.34999]],t:["thin",[0,-.34999]]},{bold:1,c:[1],b:["thin",[0,-.24998]]},{c:[1]},{bold:1,c:[0],f:[9],t:["medium",[9,-.24998]]},{bold:1,c:[1],t:["thin",[9,-.24998]],b:["medium",[9,-.24998]]},{t:["thin",[9,.39998]],b:["thin",[9,.39998]],h:["thin",[9,.39998]]},{l:["thin",[9,.39998]],r:["thin",[9,.39998]]},{bold:1,c:[1],l:["medium",[9,.59999]],r:["medium",[9,.59999]],t:["medium",[9,.59999]],b:["medium",[9,.59999]]},{bold:1,c:[1],f:[9,.59999]},{bold:1,c:[1],f:[9,.79998]},{bold:1,c:[0],f:[8],t:["medium",[8,-.24998]]},{bold:1,c:[1],t:["thin",[8,-.24998]],b:["medium",[8,-.24998]]},{t:["thin",[8,.39998]],b:["thin",[8,.39998]],h:["thin",[8,.39998]]},{l:["thin",[8,.39998]],r:["thin",[8,.39998]]},{bold:1,c:[1],l:["medium",[8,.59999]],r:["medium",[8,.59999]],t:["medium",[8,.59999]],b:["medium",[8,.59999]]},{bold:1,c:[1],f:[8,.59999]},{bold:1,c:[1],f:[8,.79998]},{bold:1,c:[0],f:[7],t:["medium",[7,-.24998]]},{bold:1,c:[1],t:["thin",[7,-.24998]],b:["medium",[7,-.24998]]},{t:["thin",[7,.39998]],b:["thin",[7,.39998]],h:["thin",[7,.39998]]},{l:["thin",[7,.39998]],r:["thin",[7,.39998]]},{bold:1,c:[1],l:["medium",[7,.59999]],r:["medium",[7,.59999]],t:["medium",[7,.59999]],b:["medium",[7,.59999]]},{bold:1,c:[1],f:[7,.59999]},{bold:1,c:[1],f:[7,.79998]},{bold:1,c:[0],f:[6],t:["medium",[6,-.24998]]},{bold:1,c:[1],t:["thin",[6,-.24998]],b:["medium",[6,-.24998]]},{t:["thin",[6,.39998]],b:["thin",[6,.39998]],h:["thin",[6,.39998]]},{l:["thin",[6,.39998]],r:["thin",[6,.39998]]},{bold:1,c:[1],l:["medium",[6,.59999]],r:["medium",[6,.59999]],t:["medium",[6,.59999]],b:["medium",[6,.59999]]},{bold:1,c:[1],f:[6,.59999]},{bold:1,c:[1],f:[6,.79998]},{bold:1,c:[0],f:[5],t:["medium",[5,-.24998]]},{bold:1,c:[1],t:["thin",[5,-.24998]],b:["medium",[5,-.24998]]},{t:["thin",[5,.39998]],b:["thin",[5,.39998]],h:["thin",[5,.39998]]},{l:["thin",[5,.39998]],r:["thin",[5,.39998]]},{bold:1,c:[1],l:["medium",[5,.59999]],r:["medium",[5,.59999]],t:["medium",[5,.59999]],b:["medium",[5,.59999]]},{bold:1,c:[1],f:[5,.59999]},{bold:1,c:[1],f:[5,.79998]},{bold:1,c:[0],f:[4],t:["medium",[4,-.24998]]},{bold:1,c:[1],t:["thin",[4,-.24998]],b:["medium",[4,-.24998]]},{t:["thin",[4,.39998]],b:["thin",[4,.39998]],h:["thin",[4,.39998]]},{l:["thin",[4,.39998]],r:["thin",[4,.39998]]},{bold:1,c:[1],l:["medium",[4,.59999]],r:["medium",[4,.59999]],t:["medium",[4,.59999]],b:["medium",[4,.59999]]},{bold:1,c:[1],f:[4,.59999]},{bold:1,c:[1],f:[4,.79998]},{bold:1,c:[0],f:[1,.49998],t:["medium",[1,.49998]]},{bold:1,c:[1],t:["thin",[1]],b:["medium",[1,.49998]]},{t:["thin",[0,-.24998]],b:["thin",[0,-.24998]],h:["thin",[0,-.24998]]},{l:["medium",[0,-.15]],r:["medium",[0,-.15]]},{bold:1,c:[1],l:["medium",[0,-.24998]],r:["medium",[0,-.24998]],t:["medium",[0,-.24998]],b:["medium",[0,-.24998]]},{bold:1,c:[1],f:[0,-.24998]},{bold:1,c:[1],f:[0,-.15]},{c:[1],h:["thin",[9,.79998]]},{c:[0],f:[9,-.24998],h:["thin",[9,-.24998]]},{bold:1,c:[1],t:["double",[9,-.24998]]},{t:["thin",[9,-.24998]],b:["thin",[9,-.24998]],h:["thin",[9,-.24998]]},{l:["thin",[9,-.24998]],r:["thin",[9,-.24998]]},{bold:1,c:[0]},{bold:1,c:[0],f:[9,.39998]},{b:["thin",[9,.59999]]},{c:[0],f:[9,.39998],b:["thin",[9,.79998]],h:["thin",[9,.39998]]},{f:[9,.79998],b:["thin",[9]]},{t:["thin",[9,.79998]],b:["thin",[9,.79998]]},{c:[1],h:["thin",[8,.79998]]},{c:[0],f:[8,-.24998],h:["thin",[8,-.24998]]},{bold:1,c:[1],t:["double",[8,-.24998]]},{t:["thin",[8,-.24998]],b:["thin",[8,-.24998]],h:["thin",[8,-.24998]]},{l:["thin",[8,-.24998]],r:["thin",[8,-.24998]]},{bold:1,c:[0],f:[8,.39998]},{b:["thin",[8,.59999]]},{c:[0],f:[8,.39998],b:["thin",[8,.79998]],h:["thin",[8,.39998]]},{f:[8,.79998],b:["thin",[8]]},{t:["thin",[8,.79998]],b:["thin",[8,.79998]]},{c:[1],h:["thin",[7,.79998]]},{c:[0],f:[7,-.24998],h:["thin",[7,-.24998]]},{bold:1,c:[1],t:["double",[7,-.24998]]},{t:["thin",[7,-.24998]],b:["thin",[7,-.24998]],h:["thin",[7,-.24998]]},{l:["thin",[7,-.24998]],r:["thin",[7,-.24998]]},{bold:1,c:[0],f:[7,.39998]},{b:["thin",[7,.59999]]},{c:[0],f:[7,.39998],b:["thin",[7,.79998]],h:["thin",[7,.39998]]},{f:[7,.79998],b:["thin",[7]]},{t:["thin",[7,.79998]],b:["thin",[7,.79998]]},{c:[1],h:["thin",[6,.79998]]},{c:[0],f:[6,-.24998],h:["thin",[6,-.24998]]},{bold:1,c:[1],t:["double",[6,-.24998]]},{t:["thin",[6,-.24998]],b:["thin",[6,-.24998]],h:["thin",[6,-.24998]]},{l:["thin",[6,-.24998]],r:["thin",[6,-.24998]]},{bold:1,c:[0],f:[6,.39998]},{b:["thin",[6,.59999]]},{c:[0],f:[6,.39998],b:["thin",[6,.79998]],h:["thin",[6,.39998]]},{f:[6,.79998],b:["thin",[6]]},{t:["thin",[6,.79998]],b:["thin",[6,.79998]]},{c:[1],h:["thin",[5,.79998]]},{c:[0],f:[5,-.24998],h:["thin",[5,-.24998]]},{bold:1,c:[1],t:["double",[5,-.24998]]},{t:["thin",[5,-.24998]],b:["thin",[5,-.24998]],h:["thin",[5,-.24998]]},{l:["thin",[5,-.24998]],r:["thin",[5,-.24998]]},{bold:1,c:[0],f:[5,.39998]},{b:["thin",[5,.59999]]},{c:[0],f:[5,.39998],b:["thin",[5,.79998]],h:["thin",[5,.39998]]},{f:[5,.79998],b:["thin",[5]]},{t:["thin",[5,.79998]],b:["thin",[5,.79998]]},{c:[1],h:["thin",[4,.79998]]},{c:[0],f:[4,-.24998],h:["thin",[4,-.24998]]},{bold:1,c:[1],t:["double",[4,-.24998]]},{t:["thin",[4,-.24998]],b:["thin",[4,-.24998]],h:["thin",[4,-.24998]]},{l:["thin",[4,-.24998]],r:["thin",[4,-.24998]]},{bold:1,c:[0],f:[4,.39998]},{b:["thin",[4,.59999]]},{c:[0],f:[4,.39998],b:["thin",[4,.79998]],h:["thin",[4,.39998]]},{f:[4,.79998],b:["thin",[4]]},{t:["thin",[4,.79998]],b:["thin",[4,.79998]]},{c:[1],h:["thin",[0,-.15]]},{c:[0],f:[1,.49998],h:["thin",[1,.49998]]},{bold:1,c:[1],t:["double",[1,.49998]]},{t:["thin",[1,.49998]],b:["thin",[1,.49998]],h:["thin",[1,.49998]]},{l:["thin",[1,.49998]],r:["thin",[1,.49998]]},{bold:1,c:[0],f:[0,-.34999]},{b:["thin",[0,-.15]]},{c:[0],f:[0,-.34999],b:["thin",[0,-.15]],h:["thin",[0,-.15]]},{f:[0,-.15],b:["thin",[0,-.15]]},{t:["thin",[0,-.15]],b:["thin",[0,-.15]]},{c:[9,-.24998],l:["thin",[9]],r:["thin",[9]],t:["thin",[9]],b:["thin",[9]],v:["thin",[9]]},{c:[9,-.24998],b:["thin",[9]]},{c:[9,-.24998],t:["thin",[9]]},{c:[9,-.24998]},{f:[9,.79998],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{c:[8,-.24998],l:["thin",[8]],r:["thin",[8]],t:["thin",[8]],b:["thin",[8]],v:["thin",[8]]},{c:[8,-.24998],b:["thin",[8]]},{c:[8,-.24998],t:["thin",[8]]},{c:[8,-.24998]},{f:[8,.79998],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{c:[7,-.24998],l:["thin",[7]],r:["thin",[7]],t:["thin",[7]],b:["thin",[7]],v:["thin",[7]]},{c:[7,-.24998],b:["thin",[7]]},{c:[7,-.24998],t:["thin",[7]]},{c:[7,-.24998]},{f:[7,.79998],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{c:[6,-.24998],l:["thin",[6]],r:["thin",[6]],t:["thin",[6]],b:["thin",[6]],v:["thin",[6]]},{c:[6,-.24998],b:["thin",[6]]},{c:[6,-.24998],t:["thin",[6]]},{c:[6,-.24998]},{f:[6,.79998],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{c:[5,-.24998],l:["thin",[5]],r:["thin",[5]],t:["thin",[5]],b:["thin",[5]],v:["thin",[5]]},{c:[5,-.24998],b:["thin",[5]]},{c:[5,-.24998],t:["thin",[5]]},{c:[5,-.24998]},{f:[5,.79998],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{c:[4,-.24998],l:["thin",[4]],r:["thin",[4]],t:["thin",[4]],b:["thin",[4]],v:["thin",[4]]},{c:[4,-.24998],b:["thin",[4]]},{c:[4,-.24998],t:["thin",[4]]},{c:[4,-.24998]},{f:[4,.79998],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{c:[1],l:["thin",[1,.49998]],r:["thin",[1,.49998]],t:["thin",[1,.49998]],b:["thin",[1,.49998]],v:["thin",[1,.49998]]},{bold:1,c:[1],b:["thin",[1,.49998]]},{bold:1,c:[1],t:["thin",[1,.49998]]},{f:[0,-.15],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{bold:1,c:[1],l:["thin",[0,-.34999]],r:["thin",[0,-.34999]]},{bold:1,c:[1],f:[9,.79998],b:["thin",[9,.39998]]},{bold:1,c:[1],f:[9,.79998],t:["thin",[9,.39998]]},{bold:1,c:[1],t:["thin",[9]],b:["thin",[9]]},{bold:1,c:[1],b:["thin",[9,.39998]]},{f:[9,.79998],b:["thin",[9,.39998]]},{bold:1,c:[1],f:[8,.79998],b:["thin",[8,.39998]]},{bold:1,c:[1],f:[8,.79998],t:["thin",[8,.39998]]},{bold:1,c:[1],t:["thin",[8]],b:["thin",[8]]},{bold:1,c:[1],b:["thin",[8,.39998]]},{f:[8,.79998],b:["thin",[8,.39998]]},{bold:1,c:[1],f:[7,.79998],b:["thin",[7,.39998]]},{bold:1,c:[1],f:[7,.79998],t:["thin",[7,.39998]]},{bold:1,c:[1],t:["thin",[7]],b:["thin",[7]]},{bold:1,c:[1],b:["thin",[7,.39998]]},{f:[7,.79998],b:["thin",[7,.39998]]},{bold:1,c:[1],f:[6,.79998],b:["thin",[6,.39998]]},{bold:1,c:[1],f:[6,.79998],t:["thin",[6,.39998]]},{bold:1,c:[1],t:["thin",[6]],b:["thin",[6]]},{bold:1,c:[1],b:["thin",[6,.39998]]},{f:[6,.79998],b:["thin",[6,.39998]]},{bold:1,c:[1],f:[5,.79998],b:["thin",[5,.39998]]},{bold:1,c:[1],f:[5,.79998],t:["thin",[5,.39998]]},{bold:1,c:[1],t:["thin",[5]],b:["thin",[5]]},{bold:1,c:[1],b:["thin",[5,.39998]]},{f:[5,.79998],b:["thin",[5,.39998]]},{bold:1,c:[1],f:[4,.79998],b:["thin",[4,.39998]]},{bold:1,c:[1],f:[4,.79998],t:["thin",[4,.39998]]},{bold:1,c:[1],t:["thin",[4]],b:["thin",[4]]},{bold:1,c:[1],b:["thin",[4,.39998]]},{f:[4,.79998],b:["thin",[4,.39998]]},{bold:1,c:[1],f:[0,-.15],b:["thin",[0,-.34999]]},{bold:1,c:[1],f:[0,-.15],t:["thin",[0,-.34999]]},{bold:1,c:[1],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{bold:1,c:[1],b:["thin",[0,-.34999]]},{f:[0,-.15],b:["thin",[0,-.34999]]},{c:[9,-.24998],h:["thin",[9,.79998]]},{bold:1,c:[1],l:["medium",[9]],r:["medium",[9]],t:["medium",[9]],b:["medium",[9]],h:["thin",[0]]},{bold:1,c:[1],l:["medium",[9]],r:["medium",[9]],t:["medium",[9]],b:["medium",[9]]},{r:["thin",[9]]},{l:["thin",[9,.59999]],r:["thin",[9,.59999]],t:["thin",[9,.59999]],b:["thin",[9,.59999]]},{l:["thin",[9]],r:["thin",[9]],t:["thin",[9]],b:["thin",[9]]},{bold:1,c:[1],f:[9,.79998],t:["thin",[9,.59999]],b:["thin",[9,.59999]]},{t:["thin",[9,.79998]]},{bold:1,c:[1],f:[9,.79998],b:["thin",[0]]},{c:[8,-.24998],h:["thin",[8,.79998]]},{bold:1,c:[1],l:["medium",[8]],r:["medium",[8]],t:["medium",[8]],b:["medium",[8]],h:["thin",[0]]},{bold:1,c:[1],l:["medium",[8]],r:["medium",[8]],t:["medium",[8]],b:["medium",[8]]},{r:["thin",[8]]},{l:["thin",[8,.59999]],r:["thin",[8,.59999]],t:["thin",[8,.59999]],b:["thin",[8,.59999]]},{l:["thin",[8]],r:["thin",[8]],t:["thin",[8]],b:["thin",[8]]},{bold:1,c:[1],f:[8,.79998],t:["thin",[8,.59999]],b:["thin",[8,.59999]]},{t:["thin",[8,.79998]]},{bold:1,c:[1],f:[8,.79998],b:["thin",[0]]},{c:[7,-.24998],h:["thin",[7,.79998]]},{bold:1,c:[1],l:["medium",[7]],r:["medium",[7]],t:["medium",[7]],b:["medium",[7]],h:["thin",[0]]},{bold:1,c:[1],l:["medium",[7]],r:["medium",[7]],t:["medium",[7]],b:["medium",[7]]},{r:["thin",[7]]},{l:["thin",[7,.59999]],r:["thin",[7,.59999]],t:["thin",[7,.59999]],b:["thin",[7,.59999]]},{l:["thin",[7]],r:["thin",[7]],t:["thin",[7]],b:["thin",[7]]},{bold:1,c:[1],f:[7,.79998],t:["thin",[7,.59999]],b:["thin",[7,.59999]]},{t:["thin",[7,.79998]]},{bold:1,c:[1],f:[7,.79998],b:["thin",[0]]},{c:[6,-.24998],h:["thin",[6,.79998]]},{bold:1,c:[1],l:["medium",[6]],r:["medium",[6]],t:["medium",[6]],b:["medium",[6]],h:["thin",[0]]},{bold:1,c:[1],l:["medium",[6]],r:["medium",[6]],t:["medium",[6]],b:["medium",[6]]},{r:["thin",[6]]},{l:["thin",[6,.59999]],r:["thin",[6,.59999]],t:["thin",[6,.59999]],b:["thin",[6,.59999]]},{l:["thin",[6]],r:["thin",[6]],t:["thin",[6]],b:["thin",[6]]},{bold:1,c:[1],f:[6,.79998],t:["thin",[6,.59999]],b:["thin",[6,.59999]]},{t:["thin",[6,.79998]]},{bold:1,c:[1],f:[6,.79998],b:["thin",[0]]},{c:[5,-.24998],h:["thin",[5,.79998]]},{bold:1,c:[1],l:["medium",[5]],r:["medium",[5]],t:["medium",[5]],b:["medium",[5]],h:["thin",[0]]},{bold:1,c:[1],l:["medium",[5]],r:["medium",[5]],t:["medium",[5]],b:["medium",[5]]},{r:["thin",[5]]},{l:["thin",[5,.59999]],r:["thin",[5,.59999]],t:["thin",[5,.59999]],b:["thin",[5,.59999]]},{l:["thin",[5]],r:["thin",[5]],t:["thin",[5]],b:["thin",[5]]},{bold:1,c:[1],f:[5,.79998],t:["thin",[5,.59999]],b:["thin",[5,.59999]]},{t:["thin",[5,.79998]]},{bold:1,c:[1],f:[5,.79998],b:["thin",[0]]},{c:[4,-.24998],h:["thin",[4,.79998]]},{bold:1,c:[1],l:["medium",[4]],r:["medium",[4]],t:["medium",[4]],b:["medium",[4]],h:["thin",[0]]},{bold:1,c:[1],l:["medium",[4]],r:["medium",[4]],t:["medium",[4]],b:["medium",[4]]},{r:["thin",[4]]},{l:["thin",[4,.59999]],r:["thin",[4,.59999]],t:["thin",[4,.59999]],b:["thin",[4,.59999]]},{l:["thin",[4]],r:["thin",[4]],t:["thin",[4]],b:["thin",[4]]},{bold:1,c:[1],f:[4,.79998],t:["thin",[4,.59999]],b:["thin",[4,.59999]]},{t:["thin",[4,.79998]]},{bold:1,c:[1],f:[4,.79998],b:["thin",[0]]},{bold:1,c:[1],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]],h:["thin",[0]]},{bold:1,c:[1],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{r:["thin",[1,.49998]]},{l:["thin",[0,-.34999]],r:["thin",[0,-.34999]],t:["thin",[0,-.34999]],b:["thin",[0,-.34999]]},{l:["thin",[0,-.45]],r:["thin",[0,-.45]],t:["thin",[0,-.45]],b:["thin",[0,-.45]]},{bold:1,c:[1],f:[0,-.15],t:["thin",[0,-.34999]],b:["thin",[0,-.34999]]},{t:["thin",[0,-.34999]]},{bold:1,c:[1],f:[0,-.15],b:["thin",[0]]},{bold:1,c:[1],f:[0],t:["thin",[9]],b:["thin",[9]]},{f:[9,.79998],l:["thin",[9,.59999]],r:["thin",[9,.59999]],t:["thin",[9,.59999]],b:["thin",[9,.59999]],v:["thin",[9,.59999]],h:["thin",[9,.59999]]},{bold:1,c:[9]},{t:["thin",[9]],b:["thin",[9]]},{bold:1,c:[1],f:[0],t:["thin",[8]],b:["thin",[8]]},{f:[8,.79998],l:["thin",[8,.59999]],r:["thin",[8,.59999]],t:["thin",[8,.59999]],b:["thin",[8,.59999]],v:["thin",[8,.59999]],h:["thin",[8,.59999]]},{bold:1,c:[8]},{t:["thin",[8]],b:["thin",[8]]},{bold:1,c:[1],f:[0],t:["thin",[7]],b:["thin",[7]]},{f:[7,.79998],l:["thin",[7,.59999]],r:["thin",[7,.59999]],t:["thin",[7,.59999]],b:["thin",[7,.59999]],v:["thin",[7,.59999]],h:["thin",[7,.59999]]},{bold:1,c:[7]},{t:["thin",[7]],b:["thin",[7]]},{bold:1,c:[1],f:[0],t:["thin",[6]],b:["thin",[6]]},{f:[6,.79998],l:["thin",[6,.59999]],r:["thin",[6,.59999]],t:["thin",[6,.59999]],b:["thin",[6,.59999]],v:["thin",[6,.59999]],h:["thin",[6,.59999]]},{bold:1,c:[6]},{t:["thin",[6]],b:["thin",[6]]},{bold:1,c:[1],f:[0],t:["thin",[5]],b:["thin",[5]]},{f:[5,.79998],l:["thin",[5,.59999]],r:["thin",[5,.59999]],t:["thin",[5,.59999]],b:["thin",[5,.59999]],v:["thin",[5,.59999]],h:["thin",[5,.59999]]},{bold:1,c:[5]},{t:["thin",[5]],b:["thin",[5]]},{bold:1,c:[1],f:[0],t:["thin",[4]],b:["thin",[4]]},{f:[4,.79998],l:["thin",[4,.59999]],r:["thin",[4,.59999]],t:["thin",[4,.59999]],b:["thin",[4,.59999]],v:["thin",[4,.59999]],h:["thin",[4,.59999]]},{c:[4]},{t:["thin",[4]],b:["thin",[4]]},{bold:1,c:[1],f:[0],t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{f:[0,-.15],t:["thin",[0,-.34999]],b:["thin",[0,-.34999]]},{f:[0,-.15],l:["thin",[0,-.34999]],r:["thin",[0,-.34999]],t:["thin",[0,-.34999]],b:["thin",[0,-.34999]],v:["thin",[0,-.34999]],h:["thin",[0,-.34999]]},{t:["thin",[1,.49998]],b:["thin",[1,.49998]]},{c:[9,.79998],f:[9],v:["thin",[0]]},{f:[9,-.24998],b:["medium",[0]]},{bold:1,c:[0],t:["medium",[0]]},{f:[9,.39998]},{c:[9,.79998]},{c:[8,.79998],f:[8],v:["thin",[0]]},{f:[8,-.24998],b:["medium",[0]]},{f:[8,.39998]},{c:[8,.79998]},{c:[7,.79998],f:[7],v:["thin",[0]]},{f:[7,-.24998],b:["medium",[0]]},{f:[7,.39998]},{c:[7,.79998]},{c:[6,.79998],f:[6],v:["thin",[0]]},{f:[6,-.24998],b:["medium",[0]]},{f:[6,.39998]},{c:[6,.79998]},{c:[5,.79998],f:[5],v:["thin",[0]]},{f:[5,-.24998],b:["medium",[0]]},{f:[5,.39998]},{c:[5,.79998]},{c:[4,.79998],f:[4],v:["thin",[0]]},{f:[4,-.24998],b:["medium",[0]]},{f:[4,.39998]},{c:[4,.79998]},{c:[0,-.15],f:[0,-.49998],v:["thin",[0]]},{f:[1,.49998],b:["medium",[0]]},{f:[1,.49998]},{f:[0,-.45]},{bold:1,c:[0,-.15]},{c:[9,.79998],f:[9]},{t:["thin",[9,.39998]],b:["thin",[9,.39998]]},{f:[9,-.24998],l:["thin",[9,.39998]],r:["thin",[9,.39998]],t:["thin",[9,.39998]],b:["thin",[9,.39998]]},{b:["thin",[9,.39998]]},{bold:1,c:[0],f:[9,-.24998]},{c:[8,.79998],f:[8]},{t:["thin",[8,.39998]],b:["thin",[8,.39998]]},{f:[8,-.24998],l:["thin",[8,.39998]],r:["thin",[8,.39998]],t:["thin",[8,.39998]],b:["thin",[8,.39998]]},{b:["thin",[8,.39998]]},{bold:1,c:[0],f:[8,-.24998]},{c:[7,.79998],f:[7]},{t:["thin",[7,.39998]],b:["thin",[7,.39998]]},{f:[7,-.24998],l:["thin",[7,.39998]],r:["thin",[7,.39998]],t:["thin",[7,.39998]],b:["thin",[7,.39998]]},{b:["thin",[7,.39998]]},{bold:1,c:[0],f:[7,-.24998]},{c:[6,.79998],f:[6]},{t:["thin",[6,.39998]],b:["thin",[6,.39998]]},{f:[6,-.24998],l:["thin",[6,.39998]],r:["thin",[6,.39998]],t:["thin",[6,.39998]],b:["thin",[6,.39998]]},{b:["thin",[6,.39998]]},{bold:1,c:[0],f:[6,-.24998]},{c:[5,.79998],f:[5]},{t:["thin",[5,.39998]],b:["thin",[5,.39998]]},{f:[5,-.24998],l:["thin",[5,.39998]],r:["thin",[5,.39998]],t:["thin",[5,.39998]],b:["thin",[5,.39998]]},{b:["thin",[5,.39998]]},{bold:1,c:[0],f:[5,-.24998]},{c:[4,.79998],f:[4]},{t:["thin",[4,.39998]],b:["thin",[4,.39998]]},{f:[4,-.24998],l:["thin",[4,.39998]],r:["thin",[4,.39998]],t:["thin",[4,.39998]],b:["thin",[4,.39998]]},{b:["thin",[4,.39998]]},{bold:1,c:[0],f:[4,-.24998]},{c:[0,-.15],f:[0,-.45]},{t:["thin",[0,-.34999]],b:["thin",[0,-.34999]]},{l:["thin",[0,-.24998]],r:["thin",[0,-.24998]]},{f:[1,.49998],l:["thin",[0,-.34999]],r:["thin",[0,-.34999]],t:["thin",[0,-.34999]],b:["thin",[0,-.34999]]},{b:["thin",[0,-.34999]]},{bold:1,c:[0],f:[1,.49998],b:["thin",[4,.79998]]},{c:[1],f:[9,.79998],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{bold:1,c:[0],f:[1,.24998]},{t:["thin",[9,.59999]],b:["thin",[9,.59999]]},{t:["medium",[9,.79998]]},{bold:1,c:[1],f:[9,.59999],b:["medium",[9,.79998]]},{l:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{c:[1],f:[8,.79998],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{t:["thin",[8,.59999]],b:["thin",[8,.59999]]},{t:["medium",[8,.79998]]},{bold:1,c:[1],f:[8,.59999],b:["medium",[8,.79998]]},{c:[1],f:[7,.79998],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{t:["thin",[7,.59999]],b:["thin",[7,.59999]]},{t:["medium",[7,.79998]]},{bold:1,c:[1],f:[7,.59999],b:["medium",[7,.79998]]},{c:[1],f:[6,.79998],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{t:["thin",[6,.59999]],b:["thin",[6,.59999]]},{t:["medium",[6,.79998]]},{bold:1,c:[1],f:[6,.59999],b:["medium",[6,.79998]]},{c:[1],f:[5,.79998],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{t:["thin",[5,.59999]],b:["thin",[5,.59999]]},{t:["medium",[5,.79998]]},{bold:1,c:[1],f:[5,.59999],b:["medium",[5,.79998]]},{c:[1],f:[4,.79998],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{t:["thin",[4,.59999]],b:["thin",[4,.59999]]},{t:["medium",[4,.79998]]},{bold:1,c:[1],f:[4,.59999],b:["medium",[4,.79998]]},{c:[1],f:[0,-.15],l:["medium",[1,.49998]],r:["medium",[1,.49998]],t:["medium",[1,.49998]],b:["medium",[1,.49998]]},{t:["thin",[0,-.24998]],b:["thin",[0,-.24998]]},{l:["thin",[0,-.45]],r:["thin",[0,-.45]]},{t:["medium",[0,-.24998]]},{bold:1,c:[1],f:[0,-.24998],b:["medium",[0,-.15]]},{c:[1],f:[9,.59999],h:["thin",[9,.79998]]},{bold:1,c:[0],f:[9,-.49998],b:["thin",[9]],h:["thin",[9,-.49998]]},{bold:1,c:[0],f:[9,-.49998]},{l:["thin",[9,.79998]],r:["thin",[9,.79998]]},{bold:1,c:[1],b:["thin",[9,.79998]]},{bold:1,c:[1],f:[9,.79998],t:["thin",[9,.39998]],b:["thin",[9,.39998]]},{bold:1,c:[0],f:[9,-.49998],h:["thin",[9,-.49998]]},{c:[0],f:[9,-.49998],h:["thin",[9,-.49998]]},{c:[1],f:[8,.59999],h:["thin",[8,.79998]]},{bold:1,c:[0],f:[8,-.49998],b:["thin",[8]],h:["thin",[8,-.49998]]},{bold:1,c:[0],f:[8,-.49998]},{l:["thin",[8,.79998]],r:["thin",[8,.79998]]},{bold:1,c:[1],b:["thin",[8,.79998]]},{bold:1,c:[1],f:[8,.79998],t:["thin",[8,.39998]],b:["thin",[8,.39998]]},{bold:1,c:[0],f:[8,-.49998],h:["thin",[8,-.49998]]},{c:[0],f:[8,-.49998],h:["thin",[8,-.49998]]},{c:[1],f:[7,.59999],h:["thin",[7,.79998]]},{bold:1,c:[0],f:[7,-.49998],b:["thin",[7]],h:["thin",[7,-.49998]]},{bold:1,c:[0],f:[7,-.49998]},{l:["thin",[7,.79998]],r:["thin",[7,.79998]]},{bold:1,c:[1],b:["thin",[7,.79998]]},{bold:1,c:[1],f:[7,.79998],t:["thin",[7,.39998]],b:["thin",[7,.39998]]},{bold:1,c:[0],f:[7,-.49998],h:["thin",[7,-.49998]]},{c:[0],f:[7,-.49998],h:["thin",[7,-.49998]]},{c:[1],f:[6,.59999],h:["thin",[6,.79998]]},{bold:1,c:[0],f:[6,-.49998],b:["thin",[6]],h:["thin",[6,-.49998]]},{bold:1,c:[0],f:[6,-.49998]},{l:["thin",[6,.79998]],r:["thin",[6,.79998]]},{bold:1,c:[1],b:["thin",[6,.79998]]},{bold:1,c:[1],f:[6,.79998],t:["thin",[6,.39998]],b:["thin",[6,.39998]]},{bold:1,c:[0],f:[6,-.49998],h:["thin",[6,-.49998]]},{c:[0],f:[6,-.49998],h:["thin",[6,-.49998]]},{c:[1],f:[5,.59999],h:["thin",[5,.79998]]},{bold:1,c:[0],f:[5,-.49998],b:["thin",[5]],h:["thin",[5,-.49998]]},{bold:1,c:[0],f:[5,-.49998]},{l:["thin",[5,.79998]],r:["thin",[5,.79998]]},{bold:1,c:[1],b:["thin",[5,.79998]]},{bold:1,c:[1],f:[5,.79998],t:["thin",[5,.39998]],b:["thin",[5,.39998]]},{bold:1,c:[0],f:[5,-.49998],h:["thin",[5,-.49998]]},{c:[0],f:[5,-.49998],h:["thin",[5,-.49998]]},{c:[1],f:[4,.59999],h:["thin",[4,.79998]]},{bold:1,c:[0],f:[4,-.49998],b:["thin",[4]],h:["thin",[4,-.49998]]},{bold:1,c:[0],f:[4,-.49998]},{l:["thin",[4,.79998]],r:["thin",[4,.79998]]},{bold:1,c:[1],b:["thin",[4,.79998]]},{bold:1,c:[1],f:[4,.79998],t:["thin",[4,.39998]],b:["thin",[4,.39998]]},{bold:1,c:[0],f:[4,-.49998],h:["thin",[4,-.49998]]},{c:[0],f:[4,-.49998],h:["thin",[4,-.49998]]},{c:[1],f:[0,-.24998],h:["thin",[0,-.15]]},{bold:1,c:[0],f:[1,.49998],b:["thin",[0]],h:["thin",[1,.49998]]},{bold:1,c:[0],f:[1,.49998]},{l:["thin",[0,-.15]],r:["thin",[0,-.15]]},{bold:1,c:[0],f:[1,.49998],h:["thin",[1,.49998]]}],i={PivotStyleLight1:[["wholeTable",350],["headerRow",427],["totalRow",516],["firstRowStripe",517],["firstColumnStripe",518],["firstSubtotalRow",1],["secondSubtotalRow",200],["firstRowSubheading",1],["secondRowSubheading",200],["pageFieldLabels",519],["pageFieldValues",519]],PivotStyleLight2:[["wholeTable",340],["headerRow",422],["totalRow",512],["firstRowStripe",230],["firstColumnStripe",513],["firstSubtotalRow",1],["secondSubtotalRow",514],["firstRowSubheading",1],["secondRowSubheading",514],["pageFieldLabels",515],["pageFieldValues",515]],PivotStyleLight3:[["wholeTable",330],["headerRow",417],["totalRow",508],["firstRowStripe",225],["firstColumnStripe",509],["firstSubtotalRow",1],["secondSubtotalRow",510],["firstRowSubheading",1],["secondRowSubheading",510],["pageFieldLabels",511],["pageFieldValues",511]],PivotStyleLight4:[["wholeTable",320],["headerRow",412],["totalRow",504],["firstRowStripe",220],["firstColumnStripe",505],["firstSubtotalRow",1],["secondSubtotalRow",506],["firstRowSubheading",1],["secondRowSubheading",506],["pageFieldLabels",507],["pageFieldValues",507]],PivotStyleLight5:[["wholeTable",310],["headerRow",407],["totalRow",500],["firstRowStripe",215],["firstColumnStripe",501],["firstSubtotalRow",1],["secondSubtotalRow",502],["firstRowSubheading",1],["secondRowSubheading",502],["pageFieldLabels",503],["pageFieldValues",503]],PivotStyleLight6:[["wholeTable",300],["headerRow",402],["totalRow",496],["firstRowStripe",210],["firstColumnStripe",497],["firstSubtotalRow",1],["secondSubtotalRow",498],["firstRowSubheading",1],["secondRowSubheading",498],["pageFieldLabels",499],["pageFieldValues",499]],PivotStyleLight7:[["wholeTable",289],["headerRow",397],["totalRow",492],["firstRowStripe",204],["firstColumnStripe",493],["firstSubtotalRow",1],["secondSubtotalRow",494],["firstRowSubheading",1],["secondRowSubheading",494],["pageFieldLabels",495],["pageFieldValues",495]],PivotStyleLight8:[["wholeTable",350],["headerRow",484],["totalRow",485],["firstColumn",486],["firstRowStripe",487],["firstColumnStripe",488],["firstSubtotalRow",489],["secondSubtotalRow",1],["secondColumnSubheading",490],["firstRowSubheading",491],["secondRowSubheading",1]],PivotStyleLight9:[["wholeTable",475],["headerRow",476],["totalRow",477],["firstColumn",478],["firstRowStripe",479],["firstColumnStripe",480],["firstSubtotalRow",481],["secondSubtotalRow",1],["secondColumnSubheading",482],["thirdColumnSubheading",482],["firstRowSubheading",483],["secondRowSubheading",1]],PivotStyleLight10:[["wholeTable",466],["headerRow",467],["totalRow",468],["firstColumn",469],["firstRowStripe",470],["firstColumnStripe",471],["firstSubtotalRow",472],["secondSubtotalRow",1],["secondColumnSubheading",473],["thirdColumnSubheading",473],["firstRowSubheading",474],["secondRowSubheading",1]],PivotStyleLight11:[["wholeTable",457],["headerRow",458],["totalRow",459],["firstColumn",460],["firstRowStripe",461],["firstColumnStripe",462],["firstSubtotalRow",463],["secondSubtotalRow",1],["secondColumnSubheading",464],["thirdColumnSubheading",464],["firstRowSubheading",465],["secondRowSubheading",1]],PivotStyleLight12:[["wholeTable",448],["headerRow",449],["totalRow",450],["firstColumn",451],["firstRowStripe",452],["firstColumnStripe",453],["firstSubtotalRow",454],["secondSubtotalRow",1],["secondColumnSubheading",455],["thirdColumnSubheading",455],["firstRowSubheading",456],["secondRowSubheading",1]],PivotStyleLight13:[["wholeTable",439],["headerRow",440],["totalRow",441],["firstColumn",442],["firstRowStripe",443],["firstColumnStripe",444],["firstSubtotalRow",445],["secondSubtotalRow",1],["secondColumnSubheading",446],["thirdColumnSubheading",446],["firstRowSubheading",447],["secondRowSubheading",1]],PivotStyleLight14:[["wholeTable",430],["headerRow",431],["totalRow",432],["firstColumn",433],["firstRowStripe",434],["firstColumnStripe",435],["firstSubtotalRow",436],["secondSubtotalRow",1],["secondColumnSubheading",437],["thirdColumnSubheading",437],["firstRowSubheading",438],["secondRowSubheading",1]],PivotStyleLight15:[["headerRow",425],["totalRow",426],["firstRowStripe",26],["firstColumnStripe",236],["firstSubtotalColumn",26],["firstSubtotalRow",427],["secondSubtotalRow",1],["firstRowSubheading",428],["secondRowSubheading",1],["pageFieldLabels",429],["pageFieldValues",429]],PivotStyleLight16:[["headerRow",420],["totalRow",421],["firstRowStripe",26],["firstColumnStripe",236],["firstSubtotalColumn",26],["firstSubtotalRow",422],["secondSubtotalRow",1],["firstRowSubheading",423],["secondRowSubheading",1],["pageFieldLabels",424],["pageFieldValues",424]],PivotStyleLight17:[["headerRow",415],["totalRow",416],["firstRowStripe",26],["firstColumnStripe",236],["firstSubtotalColumn",26],["firstSubtotalRow",417],["secondSubtotalRow",1],["firstRowSubheading",418],["secondRowSubheading",1],["pageFieldLabels",419],["pageFieldValues",419]],PivotStyleLight18:[["headerRow",410],["totalRow",411],["firstRowStripe",26],["firstColumnStripe",236],["firstSubtotalColumn",26],["firstSubtotalRow",412],["secondSubtotalRow",1],["firstRowSubheading",413],["secondRowSubheading",1],["pageFieldLabels",414],["pageFieldValues",414]],PivotStyleLight19:[["headerRow",405],["totalRow",406],["firstRowStripe",26],["firstColumnStripe",236],["firstSubtotalColumn",26],["firstSubtotalRow",407],["secondSubtotalRow",1],["firstRowSubheading",408],["secondRowSubheading",1],["pageFieldLabels",409],["pageFieldValues",409]],PivotStyleLight20:[["headerRow",400],["totalRow",401],["firstRowStripe",26],["firstColumnStripe",236],["firstSubtotalColumn",26],["firstSubtotalRow",402],["secondSubtotalRow",1],["firstRowSubheading",403],["secondRowSubheading",1],["pageFieldLabels",404],["pageFieldValues",404]],PivotStyleLight21:[["headerRow",395],["totalRow",396],["firstRowStripe",26],["firstColumnStripe",236],["firstSubtotalColumn",26],["firstSubtotalRow",397],["secondSubtotalRow",1],["firstRowSubheading",398],["secondRowSubheading",1],["pageFieldLabels",399],["pageFieldValues",399]],PivotStyleLight22:[["wholeTable",390],["headerRow",391],["totalRow",392],["firstColumn",1],["firstRowStripe",393],["firstColumnStripe",26],["firstSubtotalColumn",394],["firstSubtotalRow",1],["secondSubtotalRow",1],["pageFieldLabels",1]],PivotStyleLight23:[["wholeTable",385],["headerRow",386],["totalRow",387],["firstColumn",388],["firstRowStripe",389],["firstColumnStripe",78],["firstSubtotalColumn",388],["firstSubtotalRow",388],["secondSubtotalRow",388],["pageFieldLabels",388]],PivotStyleLight24:[["wholeTable",380],["headerRow",381],["totalRow",382],["firstColumn",383],["firstRowStripe",384],["firstColumnStripe",75],["firstSubtotalColumn",383],["firstSubtotalRow",383],["secondSubtotalRow",383],["pageFieldLabels",383]],PivotStyleLight25:[["wholeTable",375],["headerRow",376],["totalRow",377],["firstColumn",378],["firstRowStripe",379],["firstColumnStripe",72],["firstSubtotalColumn",378],["firstSubtotalRow",378],["secondSubtotalRow",378],["pageFieldLabels",378]],PivotStyleLight26:[["wholeTable",370],["headerRow",371],["totalRow",372],["firstColumn",373],["firstRowStripe",374],["firstColumnStripe",69],["firstSubtotalColumn",373],["firstSubtotalRow",373],["secondSubtotalRow",373],["pageFieldLabels",373]],PivotStyleLight27:[["wholeTable",365],["headerRow",366],["totalRow",367],["firstColumn",368],["firstRowStripe",369],["firstColumnStripe",66],["firstSubtotalColumn",368],["firstSubtotalRow",368],["secondSubtotalRow",368],["pageFieldLabels",368]],PivotStyleLight28:[["wholeTable",360],["headerRow",361],["totalRow",362],["firstColumn",363],["firstRowStripe",364],["firstColumnStripe",63],["firstSubtotalColumn",363],["firstSubtotalRow",363],["secondSubtotalRow",363],["pageFieldLabels",363]],PivotStyleMedium1:[["wholeTable",350],["headerRow",351],["totalRow",352],["firstRowStripe",353],["firstColumnStripe",354],["firstHeaderCell",294],["firstSubtotalRow",355],["secondSubtotalRow",288],["firstColumnSubheading",356],["firstRowSubheading",357],["secondRowSubheading",358],["pageFieldLabels",359],["pageFieldValues",359]],PivotStyleMedium2:[["wholeTable",340],["headerRow",341],["totalRow",342],["firstRowStripe",343],["firstColumnStripe",344],["firstHeaderCell",294],["firstSubtotalRow",345],["secondSubtotalRow",288],["firstColumnSubheading",346],["firstRowSubheading",347],["secondRowSubheading",348],["pageFieldLabels",349],["pageFieldValues",349]],PivotStyleMedium3:[["wholeTable",330],["headerRow",331],["totalRow",332],["firstRowStripe",333],["firstColumnStripe",334],["firstHeaderCell",294],["firstSubtotalRow",335],["secondSubtotalRow",288],["firstColumnSubheading",336],["firstRowSubheading",337],["secondRowSubheading",338],["pageFieldLabels",339],["pageFieldValues",339]],PivotStyleMedium4:[["wholeTable",320],["headerRow",321],["totalRow",322],["firstRowStripe",323],["firstColumnStripe",324],["firstHeaderCell",294],["firstSubtotalRow",325],["secondSubtotalRow",288],["firstColumnSubheading",326],["firstRowSubheading",327],["secondRowSubheading",328],["pageFieldLabels",329],["pageFieldValues",329]],PivotStyleMedium5:[["wholeTable",310],["headerRow",311],["totalRow",312],["firstRowStripe",313],["firstColumnStripe",314],["firstHeaderCell",294],["firstSubtotalRow",315],["secondSubtotalRow",288],["firstColumnSubheading",316],["firstRowSubheading",317],["secondRowSubheading",318],["pageFieldLabels",319],["pageFieldValues",319]],PivotStyleMedium6:[["wholeTable",300],["headerRow",301],["totalRow",302],["firstRowStripe",303],["firstColumnStripe",304],["firstHeaderCell",294],["firstSubtotalRow",305],["secondSubtotalRow",288],["firstColumnSubheading",306],["firstRowSubheading",307],["secondRowSubheading",308],["pageFieldLabels",309],["pageFieldValues",309]],PivotStyleMedium7:[["wholeTable",289],["headerRow",290],["totalRow",291],["firstRowStripe",292],["firstColumnStripe",293],["firstHeaderCell",294],["firstSubtotalRow",295],["secondSubtotalRow",288],["firstColumnSubheading",296],["firstRowSubheading",297],["secondRowSubheading",298],["pageFieldLabels",299],["pageFieldValues",299]],PivotStyleMedium8:[["wholeTable",239],["headerRow",282],["totalRow",283],["firstRowStripe",284],["firstColumnStripe",285],["firstSubtotalColumn",286],["firstSubtotalRow",287],["secondSubtotalRow",1],["firstRowSubheading",288],["secondRowSubheading",1],["pageFieldLabels",26],["pageFieldValues",26]],PivotStyleMedium9:[["wholeTable",239],["headerRow",275],["totalRow",276],["firstRowStripe",277],["firstColumnStripe",278],["firstSubtotalColumn",279],["firstSubtotalRow",280],["secondSubtotalRow",1],["firstRowSubheading",281],["secondRowSubheading",1],["pageFieldLabels",78],["pageFieldValues",78]],PivotStyleMedium10:[["wholeTable",239],["headerRow",268],["totalRow",269],["firstRowStripe",270],["firstColumnStripe",271],["firstSubtotalColumn",272],["firstSubtotalRow",273],["secondSubtotalRow",1],["firstRowSubheading",274],["secondRowSubheading",1],["pageFieldLabels",75],["pageFieldValues",75]],PivotStyleMedium11:[["wholeTable",239],["headerRow",261],["totalRow",262],["firstRowStripe",263],["firstColumnStripe",264],["firstSubtotalColumn",265],["firstSubtotalRow",266],["secondSubtotalRow",1],["firstRowSubheading",267],["secondRowSubheading",1],["pageFieldLabels",72],["pageFieldValues",72]],PivotStyleMedium12:[["wholeTable",239],["headerRow",254],["totalRow",255],["firstRowStripe",256],["firstColumnStripe",257],["firstSubtotalColumn",258],["firstSubtotalRow",259],["secondSubtotalRow",1],["firstRowSubheading",260],["secondRowSubheading",1],["pageFieldLabels",69],["pageFieldValues",69]],PivotStyleMedium13:[["wholeTable",239],["headerRow",247],["totalRow",248],["firstRowStripe",249],["firstColumnStripe",250],["firstSubtotalColumn",251],["firstSubtotalRow",252],["secondSubtotalRow",1],["firstRowSubheading",253],["secondRowSubheading",1],["pageFieldLabels",66],["pageFieldValues",66]],PivotStyleMedium14:[["wholeTable",239],["headerRow",240],["totalRow",241],["firstRowStripe",242],["firstColumnStripe",243],["firstSubtotalColumn",244],["firstSubtotalRow",245],["secondSubtotalRow",1],["firstRowSubheading",246],["secondRowSubheading",1],["pageFieldLabels",63],["pageFieldValues",63]],PivotStyleMedium15:[["wholeTable",234],["headerRow",146],["totalRow",146],["firstRowStripe",235],["firstColumnStripe",236],["firstSubtotalColumn",237],["firstSubtotalRow",238],["secondSubtotalRow",200],["firstRowSubheading",1],["secondRowSubheading",200],["thirdRowSubheading",1],["pageFieldLabels",208],["pageFieldValues",208]],PivotStyleMedium16:[["wholeTable",229],["headerRow",146],["totalRow",146],["firstRowStripe",230],["firstColumnStripe",231],["firstSubtotalColumn",232],["firstSubtotalRow",233],["secondSubtotalRow",200],["firstRowSubheading",1],["secondRowSubheading",200],["thirdRowSubheading",1],["pageFieldLabels",208],["pageFieldValues",208]],PivotStyleMedium17:[["wholeTable",224],["headerRow",146],["totalRow",146],["firstRowStripe",225],["firstColumnStripe",226],["firstSubtotalColumn",227],["firstSubtotalRow",228],["secondSubtotalRow",200],["firstRowSubheading",1],["secondRowSubheading",200],["thirdRowSubheading",1],["pageFieldLabels",208],["pageFieldValues",208]],PivotStyleMedium18:[["wholeTable",219],["headerRow",146],["totalRow",146],["firstRowStripe",220],["firstColumnStripe",221],["firstSubtotalColumn",222],["firstSubtotalRow",223],["secondSubtotalRow",200],["firstRowSubheading",1],["secondRowSubheading",200],["thirdRowSubheading",1],["pageFieldLabels",208],["pageFieldValues",208]],PivotStyleMedium19:[["wholeTable",214],["headerRow",146],["totalRow",146],["firstRowStripe",215],["firstColumnStripe",216],["firstSubtotalColumn",217],["firstSubtotalRow",218],["secondSubtotalRow",200],["firstRowSubheading",1],["secondRowSubheading",200],["thirdRowSubheading",1],["pageFieldLabels",208],["pageFieldValues",208]],PivotStyleMedium20:[["wholeTable",209],["headerRow",146],["totalRow",146],["firstRowStripe",210],["firstColumnStripe",211],["firstSubtotalColumn",212],["firstSubtotalRow",213],["secondSubtotalRow",200],["firstRowSubheading",1],["secondRowSubheading",200],["thirdRowSubheading",1],["pageFieldLabels",208],["pageFieldValues",208]],PivotStyleMedium21:[["wholeTable",203],["headerRow",146],["totalRow",146],["firstRowStripe",204],["firstColumnStripe",205],["firstSubtotalColumn",206],["firstSubtotalRow",207],["secondSubtotalRow",200],["firstRowSubheading",1],["secondRowSubheading",200],["thirdRowSubheading",1],["pageFieldLabels",208],["pageFieldValues",208]],PivotStyleMedium22:[["wholeTable",198],["headerRow",199],["totalRow",200],["firstColumn",201],["secondRowStripe",202],["secondColumnStripe",202],["firstSubtotalRow",1],["secondSubtotalRow",1],["firstRowSubheading",1],["pageFieldLabels",201]],PivotStyleMedium23:[["wholeTable",195],["headerRow",196],["totalRow",139],["firstColumn",197],["secondRowStripe",18],["secondColumnStripe",18],["firstSubtotalRow",1],["secondSubtotalRow",1],["firstRowSubheading",1],["pageFieldLabels",197]],PivotStyleMedium24:[["wholeTable",192],["headerRow",193],["totalRow",135],["firstColumn",194],["secondRowStripe",15],["secondColumnStripe",15],["firstSubtotalRow",1],["secondSubtotalRow",1],["firstRowSubheading",1],["pageFieldLabels",194]],PivotStyleMedium25:[["wholeTable",189],["headerRow",190],["totalRow",131],["firstColumn",191],["secondRowStripe",12],["secondColumnStripe",12],["firstSubtotalRow",1],["secondSubtotalRow",1],["firstRowSubheading",1],["pageFieldLabels",191]],PivotStyleMedium26:[["wholeTable",186],["headerRow",187],["totalRow",127],["firstColumn",188],["secondRowStripe",9],["secondColumnStripe",9],["firstSubtotalRow",1],["secondSubtotalRow",1],["firstRowSubheading",1],["pageFieldLabels",188]],PivotStyleMedium27:[["wholeTable",183],["headerRow",184],["totalRow",123],["firstColumn",185],["secondRowStripe",6],["secondColumnStripe",6],["firstSubtotalRow",1],["secondSubtotalRow",1],["firstRowSubheading",1],["pageFieldLabels",185]],PivotStyleMedium28:[["wholeTable",180],["headerRow",181],["totalRow",119],["firstColumn",182],["secondRowStripe",3],["secondColumnStripe",3],["firstSubtotalRow",1],["secondSubtotalRow",1],["firstRowSubheading",1],["pageFieldLabels",182]],PivotStyleDark1:[["wholeTable",666],["headerRow",667],["totalRow",668],["secondRowStripe",21],["secondColumnStripe",669],["firstSubtotalRow",428],["firstRowSubheading",489],["secondRowSubheading",1],["pageFieldLabels",670],["pageFieldValues",351]],PivotStyleDark2:[["wholeTable",658],["headerRow",659],["totalRow",660],["secondRowStripe",543],["secondColumnStripe",661],["firstSubtotalRow",662],["firstRowSubheading",663],["secondRowSubheading",1],["pageFieldLabels",664],["pageFieldValues",665]],PivotStyleDark3:[["wholeTable",650],["headerRow",651],["totalRow",652],["secondRowStripe",539],["secondColumnStripe",653],["firstSubtotalRow",654],["firstRowSubheading",655],["secondRowSubheading",1],["pageFieldLabels",656],["pageFieldValues",657]],PivotStyleDark4:[["wholeTable",642],["headerRow",643],["totalRow",644],["secondRowStripe",535],["secondColumnStripe",645],["firstSubtotalRow",646],["firstRowSubheading",647],["secondRowSubheading",1],["pageFieldLabels",648],["pageFieldValues",649]],PivotStyleDark5:[["wholeTable",634],["headerRow",635],["totalRow",636],["secondRowStripe",531],["secondColumnStripe",637],["firstSubtotalRow",638],["firstRowSubheading",639],["secondRowSubheading",1],["pageFieldLabels",640],["pageFieldValues",641]],PivotStyleDark6:[["wholeTable",626],["headerRow",627],["totalRow",628],["secondRowStripe",527],["secondColumnStripe",629],["firstSubtotalRow",630],["firstRowSubheading",631],["secondRowSubheading",1],["pageFieldLabels",632],["pageFieldValues",633]],PivotStyleDark7:[["wholeTable",618],["headerRow",619],["totalRow",620],["secondRowStripe",523],["secondColumnStripe",621],["firstSubtotalRow",622],["firstRowSubheading",623],["secondRowSubheading",1],["pageFieldLabels",624],["pageFieldValues",625]],PivotStyleDark8:[["wholeTable",613],["headerRow",587],["totalRow",587],["secondRowStripe",614],["firstColumnStripe",615],["secondColumnStripe",615],["firstSubtotalRow",287],["secondColumnSubheading",616],["thirdColumnSubheading",616],["firstRowSubheading",617],["secondRowSubheading",1],["pageFieldLabels",591],["pageFieldValues",592]],PivotStyleDark9:[["wholeTable",609],["headerRow",587],["totalRow",587],["secondRowStripe",610],["firstColumnStripe",278],["secondColumnStripe",278],["firstSubtotalRow",280],["secondColumnSubheading",611],["thirdColumnSubheading",611],["firstRowSubheading",612],["secondRowSubheading",1],["pageFieldLabels",591],["pageFieldValues",592]],PivotStyleDark10:[["wholeTable",605],["headerRow",587],["totalRow",587],["secondRowStripe",606],["firstColumnStripe",271],["secondColumnStripe",271],["firstSubtotalRow",273],["secondColumnSubheading",607],["thirdColumnSubheading",607],["firstRowSubheading",608],["secondRowSubheading",1],["pageFieldLabels",591],["pageFieldValues",592]],PivotStyleDark11:[["wholeTable",601],["headerRow",587],["totalRow",587],["secondRowStripe",602],["firstColumnStripe",264],["secondColumnStripe",264],["firstSubtotalRow",266],["secondColumnSubheading",603],["thirdColumnSubheading",603],["firstRowSubheading",604],["secondRowSubheading",1],["pageFieldLabels",591],["pageFieldValues",592]],PivotStyleDark12:[["wholeTable",597],["headerRow",587],["totalRow",587],["secondRowStripe",598],["firstColumnStripe",257],["secondColumnStripe",257],["firstSubtotalRow",259],["secondColumnSubheading",599],["thirdColumnSubheading",599],["firstRowSubheading",600],["secondRowSubheading",1],["pageFieldLabels",591],["pageFieldValues",592]],PivotStyleDark13:[["wholeTable",593],["headerRow",587],["totalRow",587],["secondRowStripe",594],["firstColumnStripe",250],["secondColumnStripe",250],["firstSubtotalRow",252],["secondColumnSubheading",595],["thirdColumnSubheading",595],["firstRowSubheading",596],["secondRowSubheading",1],["pageFieldLabels",591],["pageFieldValues",592]],PivotStyleDark14:[["wholeTable",586],["headerRow",587],["totalRow",587],["secondRowStripe",588],["firstColumnStripe",243],["secondColumnStripe",243],["firstSubtotalRow",245],["secondColumnSubheading",589],["thirdColumnSubheading",589],["firstRowSubheading",590],["secondRowSubheading",1],["pageFieldLabels",591],["pageFieldValues",592]],PivotStyleDark15:[["wholeTable",580],["headerRow",39],["totalRow",39],["firstRowStripe",581],["firstColumnStripe",582],["firstSubtotalColumn",583],["firstSubtotalRow",294],["firstColumnSubheading",584],["firstRowSubheading",585],["secondRowSubheading",294],["pageFieldLabels",294]],PivotStyleDark16:[["wholeTable",575],["headerRow",39],["totalRow",39],["firstRowStripe",576],["firstColumnStripe",278],["firstSubtotalColumn",577],["firstSubtotalRow",294],["firstColumnSubheading",578],["firstRowSubheading",579],["secondRowSubheading",294],["pageFieldLabels",294]],PivotStyleDark17:[["wholeTable",570],["headerRow",39],["totalRow",39],["firstRowStripe",571],["firstColumnStripe",271],["firstSubtotalColumn",572],["firstSubtotalRow",294],["firstColumnSubheading",573],["firstRowSubheading",574],["secondRowSubheading",294],["pageFieldLabels",294]],PivotStyleDark18:[["wholeTable",565],["headerRow",39],["totalRow",39],["firstRowStripe",566],["firstColumnStripe",264],["firstSubtotalColumn",567],["firstSubtotalRow",294],["firstColumnSubheading",568],["firstRowSubheading",569],["secondRowSubheading",294],["pageFieldLabels",294]],PivotStyleDark19:[["wholeTable",560],["headerRow",39],["totalRow",39],["firstRowStripe",561],["firstColumnStripe",257],["firstSubtotalColumn",562],["firstSubtotalRow",294],["firstColumnSubheading",563],["firstRowSubheading",564],["secondRowSubheading",294],["pageFieldLabels",294]],PivotStyleDark20:[["wholeTable",555],["headerRow",39],["totalRow",39],["firstRowStripe",556],["firstColumnStripe",250],["firstSubtotalColumn",557],["firstSubtotalRow",294],["firstColumnSubheading",558],["firstRowSubheading",559],["secondRowSubheading",294],["pageFieldLabels",294]],PivotStyleDark21:[["wholeTable",550],["headerRow",39],["totalRow",39],["firstRowStripe",551],["firstColumnStripe",243],["firstSubtotalColumn",552],["firstSubtotalRow",294],["firstColumnSubheading",553],["firstRowSubheading",554],["secondRowSubheading",294],["pageFieldLabels",294]],PivotStyleDark22:[["wholeTable",545],["headerRow",546],["totalRow",522],["firstColumn",547],["secondRowStripe",548],["secondColumnStripe",548],["firstHeaderCell",294],["firstSubtotalRow",549],["secondSubtotalRow",1],["firstRowSubheading",294],["secondRowSubheading",294],["pageFieldLabels",547]],PivotStyleDark23:[["wholeTable",541],["headerRow",542],["totalRow",522],["firstColumn",174],["secondRowStripe",543],["secondColumnStripe",543],["firstHeaderCell",294],["firstSubtotalRow",544],["secondSubtotalRow",294],["firstRowSubheading",294],["secondRowSubheading",294],["pageFieldLabels",174]],PivotStyleDark24:[["wholeTable",537],["headerRow",538],["totalRow",522],["firstColumn",169],["secondRowStripe",539],["secondColumnStripe",539],["firstHeaderCell",294],["firstSubtotalRow",540],["secondSubtotalRow",294],["firstRowSubheading",294],["secondRowSubheading",294],["pageFieldLabels",169]],PivotStyleDark25:[["wholeTable",533],["headerRow",534],["totalRow",522],["firstColumn",165],["secondRowStripe",535],["secondColumnStripe",535],["firstHeaderCell",294],["firstSubtotalRow",536],["secondSubtotalRow",294],["firstRowSubheading",294],["secondRowSubheading",294],["pageFieldLabels",165]],PivotStyleDark26:[["wholeTable",529],["headerRow",530],["totalRow",522],["firstColumn",160],["secondRowStripe",531],["secondColumnStripe",531],["firstHeaderCell",294],["firstSubtotalRow",532],["secondSubtotalRow",294],["firstRowSubheading",294],["secondRowSubheading",294],["pageFieldLabels",160]],PivotStyleDark27:[["wholeTable",525],["headerRow",526],["totalRow",522],["firstColumn",156],["secondRowStripe",527],["secondColumnStripe",527],["firstHeaderCell",294],["firstSubtotalRow",528],["secondSubtotalRow",294],["firstRowSubheading",294],["secondRowSubheading",294],["pageFieldLabels",156]],PivotStyleDark28:[["wholeTable",520],["headerRow",521],["totalRow",522],["firstColumn",151],["secondRowStripe",523],["secondColumnStripe",523],["firstHeaderCell",294],["firstSubtotalRow",524],["secondSubtotalRow",294],["firstRowSubheading",294],["secondRowSubheading",294],["pageFieldLabels",151]],TableStyleLight1:[["wholeTable",140],["headerRow",141],["totalRow",142],["firstColumn",1],["lastColumn",1],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleLight2:[["wholeTable",136],["headerRow",137],["totalRow",138],["firstColumn",139],["lastColumn",139],["firstRowStripe",78],["firstColumnStripe",78]],TableStyleLight3:[["wholeTable",132],["headerRow",133],["totalRow",134],["firstColumn",135],["lastColumn",135],["firstRowStripe",75],["firstColumnStripe",75]],TableStyleLight4:[["wholeTable",128],["headerRow",129],["totalRow",130],["firstColumn",131],["lastColumn",131],["firstRowStripe",72],["firstColumnStripe",72]],TableStyleLight5:[["wholeTable",124],["headerRow",125],["totalRow",126],["firstColumn",127],["lastColumn",127],["firstRowStripe",69],["firstColumnStripe",69]],TableStyleLight6:[["wholeTable",120],["headerRow",121],["totalRow",122],["firstColumn",123],["lastColumn",123],["firstRowStripe",66],["firstColumnStripe",66]],TableStyleLight7:[["wholeTable",116],["headerRow",117],["totalRow",118],["firstColumn",119],["lastColumn",119],["firstRowStripe",63],["firstColumnStripe",63]],TableStyleLight8:[["wholeTable",113],["headerRow",39],["totalRow",80],["firstColumn",1],["lastColumn",1],["firstRowStripe",114],["secondRowStripe",114],["firstColumnStripe",115],["secondColumnStripe",115]],TableStyleLight9:[["wholeTable",110],["headerRow",36],["totalRow",77],["firstColumn",1],["lastColumn",1],["firstRowStripe",111],["secondRowStripe",111],["firstColumnStripe",112],["secondColumnStripe",112]],TableStyleLight10:[["wholeTable",107],["headerRow",34],["totalRow",74],["firstColumn",1],["lastColumn",1],["firstRowStripe",108],["secondRowStripe",108],["firstColumnStripe",109],["secondColumnStripe",109]],TableStyleLight11:[["wholeTable",104],["headerRow",32],["totalRow",71],["firstColumn",1],["lastColumn",1],["firstRowStripe",105],["secondRowStripe",105],["firstColumnStripe",106],["secondColumnStripe",106]],TableStyleLight12:[["wholeTable",101],["headerRow",30],["totalRow",68],["firstColumn",1],["lastColumn",1],["firstRowStripe",102],["secondRowStripe",102],["firstColumnStripe",103],["secondColumnStripe",103]],TableStyleLight13:[["wholeTable",98],["headerRow",28],["totalRow",65],["firstColumn",1],["lastColumn",1],["firstRowStripe",99],["secondRowStripe",99],["firstColumnStripe",100],["secondColumnStripe",100]],TableStyleLight14:[["wholeTable",95],["headerRow",25],["totalRow",62],["firstColumn",1],["lastColumn",1],["firstRowStripe",96],["secondRowStripe",96],["firstColumnStripe",97],["secondColumnStripe",97]],TableStyleLight15:[["wholeTable",93],["headerRow",94],["totalRow",80],["firstColumn",1],["lastColumn",1],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleLight16:[["wholeTable",91],["headerRow",92],["totalRow",77],["firstColumn",1],["lastColumn",1],["firstRowStripe",78],["firstColumnStripe",78]],TableStyleLight17:[["wholeTable",89],["headerRow",90],["totalRow",74],["firstColumn",1],["lastColumn",1],["firstRowStripe",75],["firstColumnStripe",75]],TableStyleLight18:[["wholeTable",87],["headerRow",88],["totalRow",71],["firstColumn",1],["lastColumn",1],["firstRowStripe",72],["firstColumnStripe",72]],TableStyleLight19:[["wholeTable",85],["headerRow",86],["totalRow",68],["firstColumn",1],["lastColumn",1],["firstRowStripe",69],["firstColumnStripe",69]],TableStyleLight20:[["wholeTable",83],["headerRow",84],["totalRow",65],["firstColumn",1],["lastColumn",1],["firstRowStripe",66],["firstColumnStripe",66]],TableStyleLight21:[["wholeTable",81],["headerRow",82],["totalRow",62],["firstColumn",1],["lastColumn",1],["firstRowStripe",63],["firstColumnStripe",63]],TableStyleMedium1:[["wholeTable",79],["headerRow",39],["totalRow",80],["firstColumn",1],["lastColumn",1],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleMedium2:[["wholeTable",76],["headerRow",36],["totalRow",77],["firstColumn",1],["lastColumn",1],["firstRowStripe",78],["firstColumnStripe",78]],TableStyleMedium3:[["wholeTable",73],["headerRow",34],["totalRow",74],["firstColumn",1],["lastColumn",1],["firstRowStripe",75],["firstColumnStripe",75]],TableStyleMedium4:[["wholeTable",70],["headerRow",32],["totalRow",71],["firstColumn",1],["lastColumn",1],["firstRowStripe",72],["firstColumnStripe",72]],TableStyleMedium5:[["wholeTable",67],["headerRow",30],["totalRow",68],["firstColumn",1],["lastColumn",1],["firstRowStripe",69],["firstColumnStripe",69]],TableStyleMedium6:[["wholeTable",64],["headerRow",28],["totalRow",65],["firstColumn",1],["lastColumn",1],["firstRowStripe",66],["firstColumnStripe",66]],TableStyleMedium7:[["wholeTable",61],["headerRow",25],["totalRow",62],["firstColumn",1],["lastColumn",1],["firstRowStripe",63],["firstColumnStripe",63]],TableStyleMedium8:[["wholeTable",58],["headerRow",59],["totalRow",60],["firstColumn",39],["lastColumn",39],["firstRowStripe",21],["firstColumnStripe",21]],TableStyleMedium9:[["wholeTable",55],["headerRow",56],["totalRow",57],["firstColumn",36],["lastColumn",36],["firstRowStripe",18],["firstColumnStripe",18]],TableStyleMedium10:[["wholeTable",52],["headerRow",53],["totalRow",54],["firstColumn",34],["lastColumn",34],["firstRowStripe",15],["firstColumnStripe",15]],TableStyleMedium11:[["wholeTable",49],["headerRow",50],["totalRow",51],["firstColumn",32],["lastColumn",32],["firstRowStripe",12],["firstColumnStripe",12]],TableStyleMedium12:[["wholeTable",46],["headerRow",47],["totalRow",48],["firstColumn",30],["lastColumn",30],["firstRowStripe",9],["firstColumnStripe",9]],TableStyleMedium13:[["wholeTable",43],["headerRow",44],["totalRow",45],["firstColumn",28],["lastColumn",28],["firstRowStripe",6],["firstColumnStripe",6]],TableStyleMedium14:[["wholeTable",40],["headerRow",41],["totalRow",42],["firstColumn",25],["lastColumn",25],["firstRowStripe",3],["firstColumnStripe",3]],TableStyleMedium15:[["wholeTable",37],["headerRow",38],["totalRow",24],["firstColumn",39],["lastColumn",39],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleMedium16:[["wholeTable",22],["headerRow",35],["totalRow",24],["firstColumn",36],["lastColumn",36],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleMedium17:[["wholeTable",22],["headerRow",33],["totalRow",24],["firstColumn",34],["lastColumn",34],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleMedium18:[["wholeTable",22],["headerRow",31],["totalRow",24],["firstColumn",32],["lastColumn",32],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleMedium19:[["wholeTable",22],["headerRow",29],["totalRow",24],["firstColumn",30],["lastColumn",30],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleMedium20:[["wholeTable",22],["headerRow",27],["totalRow",24],["firstColumn",28],["lastColumn",28],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleMedium21:[["wholeTable",22],["headerRow",23],["totalRow",24],["firstColumn",25],["lastColumn",25],["firstRowStripe",26],["firstColumnStripe",26]],TableStyleMedium22:[["wholeTable",19],["headerRow",1],["totalRow",20],["firstColumn",1],["lastColumn",1],["firstRowStripe",21],["firstColumnStripe",21]],TableStyleMedium23:[["wholeTable",16],["headerRow",1],["totalRow",17],["firstColumn",1],["lastColumn",1],["firstRowStripe",18],["firstColumnStripe",18]],TableStyleMedium24:[["wholeTable",13],["headerRow",1],["totalRow",14],["firstColumn",1],["lastColumn",1],["firstRowStripe",15],["firstColumnStripe",15]],TableStyleMedium25:[["wholeTable",10],["headerRow",1],["totalRow",11],["firstColumn",1],["lastColumn",1],["firstRowStripe",12],["firstColumnStripe",12]],TableStyleMedium26:[["wholeTable",7],["headerRow",1],["totalRow",8],["firstColumn",1],["lastColumn",1],["firstRowStripe",9],["firstColumnStripe",9]],TableStyleMedium27:[["wholeTable",4],["headerRow",1],["totalRow",5],["firstColumn",1],["lastColumn",1],["firstRowStripe",6],["firstColumnStripe",6]],TableStyleMedium28:[["wholeTable",0],["headerRow",1],["totalRow",2],["firstColumn",1],["lastColumn",1],["firstRowStripe",3],["firstColumnStripe",3]],TableStyleDark1:[["wholeTable",175],["headerRow",147],["totalRow",176],["firstColumn",177],["lastColumn",178],["firstRowStripe",179],["firstColumnStripe",179]],TableStyleDark2:[["wholeTable",170],["headerRow",147],["totalRow",171],["firstColumn",172],["lastColumn",173],["firstRowStripe",174],["firstColumnStripe",174]],TableStyleDark3:[["wholeTable",145],["headerRow",147],["totalRow",166],["firstColumn",167],["lastColumn",168],["firstRowStripe",169],["firstColumnStripe",169]],TableStyleDark4:[["wholeTable",161],["headerRow",147],["totalRow",162],["firstColumn",163],["lastColumn",164],["firstRowStripe",165],["firstColumnStripe",165]],TableStyleDark5:[["wholeTable",144],["headerRow",147],["totalRow",157],["firstColumn",158],["lastColumn",159],["firstRowStripe",160],["firstColumnStripe",160]],TableStyleDark6:[["wholeTable",152],["headerRow",147],["totalRow",153],["firstColumn",154],["lastColumn",155],["firstRowStripe",156],["firstColumnStripe",156]],TableStyleDark7:[["wholeTable",143],["headerRow",147],["totalRow",148],["firstColumn",149],["lastColumn",150],["firstRowStripe",151],["firstColumnStripe",151]],TableStyleDark8:[["wholeTable",26],["headerRow",146],["totalRow",80],["firstColumn",1],["lastColumn",1],["firstRowStripe",21],["firstColumnStripe",21]],TableStyleDark9:[["wholeTable",78],["headerRow",145],["totalRow",80],["firstColumn",1],["lastColumn",1],["firstRowStripe",18],["firstColumnStripe",18]],TableStyleDark10:[["wholeTable",72],["headerRow",144],["totalRow",80],["firstColumn",1],["lastColumn",1],["firstRowStripe",12],["firstColumnStripe",12]],TableStyleDark11:[["wholeTable",66],["headerRow",143],["totalRow",80],["firstColumn",1],["lastColumn",1],["firstRowStripe",6],["firstColumnStripe",6]]};export{t as PRESET_DXFS,i as PRESET_STYLES};
package/core/tables.js ADDED
@@ -0,0 +1,2 @@
1
+ import{patchTableColumns as Y,totalsChildXml as N}from"../slicers/table-file.js";import{colName as q,MAX_COLS as G,rangeRef as F,sheetPrefix as J}from"./address.js";import{columnStem as L,freeColumnName as Q,newColumnName as V,nextName as k,tableStem as ee,totalLabel as te}from"./default-names.js";import{FORMULA as D,KIND_MASK as M,STR as T}from"./sheet.js";import{translateFormula as ne}from"./formula-refs.js";import{autoFilterXml as re,sortStateXml as se}from"../cells/filter-file.js";import{PRESET_DXFS as le,PRESET_STYLES as B}from"./table-presets.js";import{resolveColor as oe}from"../io/xlsx-styles.js";import{elementTableColors as ae}from"../slicers/custom-styles.js";import{undoGroup as ce}from"../cells/undo-group.js";import{escapeMarkup as v,xmlAttr as _}from"../io/xml-escape.js";const ie=["FFFFFF","000000","E8E8E8","0E2841","156082","E97132","196B24","0F9ED5","A02B93","4EA72E"],K=new Set;function Oe(t){K.add(t)}function ue(t,e){const n=B[t];if(!n)return null;const s=e&&e.length>=10?e:ie,r=l=>typeof l=="string"?`#${l}`:oe({a:{theme:String(l[0]),tint:l[1]?String(l[1]):void 0}},s),o={},a={};for(const[l,u,f]of n){const c=le[u],i={};c.bold&&(i.bold=!0),c.italic&&(i.italic=!0),c.c&&(i.color=r(c.c)),c.f&&(i.fill=r(c.f));for(const m of["l","r","t","b","v","h"])c[m]&&(i.borders??={},i.borders[m]={style:c[m][0],color:r(c[m][1])});o[l]=i,f&&(a[l]=f)}return{el:o,sizes:a}}const P=new WeakMap,fe={};function me(t,e){if(t&&B[t]&&t.startsWith("TableStyle")){const n=e&&e.length>=10?e:fe;let s=P.get(n);s||P.set(n,s=new Map);let r=s.get(t);if(!r){const{el:o,sizes:a}=ue(t,e),l=u=>a[u]??1;r=ae(o,[l("firstRowStripe"),l("secondRowStripe")],[l("firstColumnStripe"),l("secondColumnStripe")]),s.set(t,r)}return r}for(const n of K){const s=n(t,e);if(s)return s}return null}function Ue(t,e){const n=t.r0+t.headerRows,s=t.sheet?.rows;if(!s||s.hiddenSizes===null||s.hiddenSizes.size===0)return e-n;let r=t._bandRows;if(!r||r.version!==s.version||r.top!==n||r.r1!==t.r1||r.rows!==s){const l=[];for(const u of s.hiddenSizes.keys())u>=n&&u<=t.r1&&l.push(u);l.sort((u,f)=>u-f),r={version:s.version,top:n,r1:t.r1,rows:s,list:l},t._bandRows=r}let o=0,a=r.list.length;for(;o<a;){const l=o+a>>1;r.list[l]<e?o=l+1:a=l}return e-n-o}function de(t){const e=t.engine;return k(ee(),n=>e.tables.has(n.toUpperCase()))}function ze(t,e,n,s,r="TableStyleMedium2"){const o=t.engine,a=[];let l={...n};return t.transact("table",u=>{if(!s){l.r0>0&&!I(e,l.r0-1,l.c0,l.c1)&&(l={...l,r0:l.r0-1});for(let i=l.c0;i<=l.c1;i++)t.setInput(u,l.r0,i,`${L()}${i-l.c0+1}`)}const f=new Set;for(let i=l.c0;i<=l.c1;i++){let m=t.editText(e,l.r0,i).trim()||`${L()}${i-l.c0+1}`,d=m;for(let p=2;f.has(d.toLowerCase());p++)d=`${m}${p}`;f.add(d.toLowerCase()),a.push(d),(d!==m||(e.kind(l.r0,i)&M)!==T)&&(m=d,u.saveCell(l.r0,i),e.setCell(l.r0,i,T,t.strings.add(d)))}const c={name:de(t),sheet:e,...l,headerRows:1,totalsRows:0,columns:a,styleName:r,showRowStripes:!0,showColumnStripes:!1,showFirstColumn:!1,showLastColumn:!1,filter:{r0:l.r0,c0:l.c0,r1:l.r1,c1:l.c1,columns:new Map},isNew:!0,dirty:!0};return o.tables.set(c.name.toUpperCase(),c),()=>(o.tables.delete(c.name.toUpperCase()),o.rebuild(),()=>(o.tables.set(c.name.toUpperCase(),c),o.rebuild(),()=>null))}),o.tables.get(`${[...o.tables.keys()].pop()}`)}function I(t,e,n,s){for(let r=n;r<=s;r++)if(t.kind(e,r)!==0)return!0;return!1}function g(t,e){const n=[];if(t.engine)for(const s of t.engine.tables.values())s.sheet===e&&n.push(s);return n}function Xe(t,e,n,s){for(const r of g(t,e)){const o=n===r.r1+1-0&&r.totalsRows===0&&s>=r.c0&&s<=r.c1,a=s===r.c1+1&&n>=r.r0&&n<=r.r1;if(o)return r.r1=n,r.filter&&(r.filter.r1=n),r.dirty=!0,n-1>=r.r0+r.headerRows&&t.transact("table-row",l=>{for(let u=r.c0;u<=r.c1;u++)u===s||(e.kind(n-1,u)&D)===0||e.kind(n,u)!==0||t.setInput(l,n,u,`=${ne(t.editText(e,n-1,u).slice(1),1,0)}`)}),t.engine.rebuild(),r;if(a){r.c1=s;const l=t.editText(e,r.r0,s).trim()||V(new Set(r.columns.map(u=>u.toLowerCase())));return r.columns.push(l),r.filter&&(r.filter.c1=s),e.kind(r.r0,s)===0&&e.setCell(r.r0,s,T,t.strings.add(l)),r.dirty=!0,r.columnsChanged=!0,t.engine.rebuild(),r}}return null}function Ne(t,e,n){for(const s of g(t,e)){if(n.r0!==s.r1+1||s.totalsRows!==0||n.c0<s.c0||n.c0>s.c1)continue;const r=n.r1;if(g(t,e).some(a=>a!==s&&a.r0<=r&&a.r1>=n.r0&&a.c0<=s.c1&&a.c1>=s.c0))return null;const o={r1:s.r1,filter:s.filter?{...s.filter}:null};return t.transact("table-expand",()=>{const a=f=>{s.r1=f.r1,s.filter=f.filter?{...f.filter}:null,s.dirty=!0,t.engine.rebuild()},l={r1:r,filter:s.filter?{...s.filter,r1:r}:null};a(l);const u=(f,c)=>()=>(a(f),u(c,f));return u(o,l)}),s}return null}function De(t,e,n,s,r,o){if(!r.startsWith("="))return!1;for(const a of g(t,e)){if(s<a.c0||s>a.c1||n<=a.r0||n>a.r1-a.totalsRows)continue;const l=a.r0+a.headerRows,u=a.r1-a.totalsRows;for(let f=l;f<=u;f++)if(f!==n&&e.kind(f,s)!==0)return!1;return u===l?!1:(t.transact("calculated-column",f=>{for(let c=l;c<=u;c++)c!==n&&t.setInput(f,c,s,`=${o(r.slice(1),c-n,0)}`)}),!0)}return!1}const Z=(t,e)=>{const n=t.totals?.[e];return n?n.label!==void 0?` totalsRowLabel="${_(n.label)}"`:` totalsRowFunction="${n.fn}"`:""},j=t=>`<tableStyleInfo name="${_(t.styleName??"TableStyleMedium2")}" showFirstColumn="${t.showFirstColumn?1:0}" showLastColumn="${t.showLastColumn?1:0}" showRowStripes="${t.showRowStripes===!1?0:1}" showColumnStripes="${t.showColumnStripes?1:0}"/>`,pe=t=>F({r0:t.r0,c0:t.c0,r1:t.r1-t.totalsRows,c1:t.c1}),H=t=>t.filter&&t.headerRows>0?re({...t.filter,r0:t.r0,c0:t.c0,r1:t.r1-t.totalsRows,c1:t.c1},!1)+se(t.filter.sortState):"",W=t=>`${t.headerRows===0?' headerRowCount="0"':""}${t.totalsRows?` totalsRowCount="${t.totalsRows}"`:' totalsRowShown="0"'}`;function Be(t,e){const n=t.columns.map((r,o)=>{const a=N(t,o),l=`<tableColumn id="${t.columnIds?.[o]??o+1}" name="${_(r)}"${Z(t,o)}`;return a?`${l}>${a}</tableColumn>`:`${l}/>`}).join(""),s=H(t);return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="${e}" name="${v(t.name)}" displayName="${v(t.name)}" ref="${F(t)}"${W(t)}>${s}<tableColumns count="${t.columns.length}">${n}</tableColumns>${j(t)}</table>`}function Ke(t){return{name:t.name,ref:F(t),filterRef:t.filter&&t.headerRows>0?pe(t):null,filterXml:H(t),counts:W(t),styleInfo:j(t),totals:t.totals?t.columns.map((e,n)=>Z(t,n)):null,totalsChild:t.totals?t.columns.map((e,n)=>N(t,n)):null}}function Pe(t,e){let n=t.replace(/<table\b[^>]*>/,s=>s.replace(/\bname="[^"]*"/,`name="${v(e.name)}"`).replace(/\bdisplayName="[^"]*"/,`displayName="${v(e.name)}"`).replace(/\bref="[^"]*"/,`ref="${e.ref}"`).replace(/\s(?:headerRowCount|totalsRowCount|totalsRowShown)="[^"]*"/g,"").replace(/\s*(\/?)>$/,`${e.counts}$1>`));return n=n.replace(/<autoFilter\b[^>]*\/>|<autoFilter\b[\s\S]*?<\/autoFilter>/,"").replace(/<sortState\b[^>]*\/>|<sortState\b[\s\S]*?<\/sortState>/,""),e.filterXml&&(n=n.replace("<tableColumns",`${e.filterXml}<tableColumns`)),/<tableStyleInfo\b/.test(n)?n=n.replace(/<tableStyleInfo\b[^>]*\/>/,e.styleInfo):n=n.replace("</tableColumns>",`</tableColumns>${e.styleInfo}`),e.totals&&(n=Y(n,e)),n}const he=/[[\]#']/g,E=t=>t.replace(he,"'$&"),we=/^[A-Za-z_\\][A-Za-z0-9_.\\]*$/;function O(t,e){const n=[];for(const s of t.sheets){const r=new Map;for(const[o,a]of s.formulas){const l=a.f??a.sf;if(typeof l!="string")continue;const u=a.f===void 0&&a.base!==void 0;let f=u?r.get(a):void 0;if(f===void 0){const c=e(l,s,Math.floor((u?a.base:o)/G));f=c===l?null:a.f!==void 0?{...a,f:c,tpl:void 0}:{...a,sf:c,tpl:void 0},u&&r.set(a,f)}f!==null&&n.push([s.formulas,o,a,f])}}for(const[s,r]of t.engine.names){const o=e(r.text,null,0);o!==r.text&&n.push([t.engine.names,s,r,{...r,text:o}])}for(const s of t.engine.tables.values())s.totals?.forEach((r,o)=>{if(r?.fn!=="custom"||!r.formula)return;const a=e(r.formula,s.sheet,s.r1);a!==r.formula&&n.push([{set:(l,u)=>{s.totals[l]=u}},o,r,{...r,formula:a}])});return t.formulasEdited=!0,n.some(s=>s[0]===t.engine.names)&&(t.namesChanged=!0),y(n,3),n}const y=(t,e)=>{for(const n of t)n[0].set(n[1],n[e])};function C(t,e,n,s,{rebuild:r=!1}={}){const o=t.engine;t.transact(n,a=>{const l={...e},u=s(a),f={...e};e.dirty=!0,r&&o.rebuild();const c=(i,m,d)=>()=>(Object.assign(e,i),e.dirty=!0,d?.(),r&&o.rebuild(),c(m,i,d));return c(l,f,u)})}function Ze(t,e,n,s){C(t,e,"table-option",()=>{e[n]=s})}function je(t,e,n){n&&e.headerRows===0||C(t,e,"table-filter",()=>{e.filter=n?{r0:e.r0,c0:e.c0,r1:e.r1-e.totalsRows,c1:e.c1,columns:new Map}:null})}function He(t,e,n){const s=t.engine;if(!we.test(n)||/^[A-Za-z]{1,3}[0-9]+$/.test(n)||/^[Rr][Cc]?$|^[Cc]$/.test(n))return"That isn't a valid table name.";const r=n.toUpperCase();if(r===e.name.toUpperCase()&&n===e.name)return null;if(s.tables.has(r)&&s.tables.get(r)!==e)return"Another table already uses that name.";if(s.names.has(r))return"A defined name already uses that name.";const o=e.name;return t.transact("table-name",()=>{const a=new RegExp(`(^|[^A-Za-z0-9_.\\\\])${o.replace(/[.\\]/g,"\\$&")}(?=\\[)`,"gi"),l=O(t,i=>i.replace(a,`$1${n}`)),u=(i,m,d)=>{s.tables.delete(i.toUpperCase()),e.name=m,s.tables.set(m.toUpperCase(),e),e.dirty=!0,y(l,d),s.rebuild()};u(o,n,3);const f=()=>(u(o,n,3),c),c=()=>(u(n,o,2),f);return c}),null}const be={average:101,countNums:102,count:103,max:104,min:105,stdDev:107,sum:109,var:110};function $e(t,e,n){if(!n)return null;if(n.label!==void 0)return n.label;if(n.fn==="custom")return n.formula?`=${n.formula}`:null;const s=be[n.fn];return s?`=SUBTOTAL(${s},${t.name}[${E(t.columns[e])}])`:null}function We(t,e,n){const{sheet:s}=e;if(n===e.totalsRows>0)return null;if(n){const o=e.r1+1;return I(s,o,e.c0,e.c1)?"Clear the row under the table to add a total row.":(C(t,e,"table-totals",a=>{const l=e.c1-e.c0,u=e.totals?.some(Boolean)?e.columns.map((c,i)=>e.totals[i]??null):null;if(u){e.totals=u,u.forEach((c,i)=>{const m=$e(e,i,c);m&&t.setInput(a,o,e.c0+i,m)}),e.totalsRows=1,e.r1=o,e.columnsChanged=e.source!==!0;return}e.totals=e.columns.map(()=>null);const f=te();if(e.totals[0]={label:f},t.setInput(a,o,e.c0,f),l>0){let c=!1;for(let m=e.r0+e.headerRows;m<=e.r1&&!c;m++)c=(s.kind(m,e.c1)&M)===1;const i=c?109:103;e.totals[l]={fn:c?"sum":"count"},t.setInput(a,o,e.c1,`=SUBTOTAL(${i},${e.name}[${E(e.columns[l])}])`)}e.totalsRows=1,e.r1=o,e.columnsChanged=e.source!==!0},{rebuild:!0}),null)}const r=e.r1;return C(t,e,"table-totals",o=>{for(let a=e.c0;a<=e.c1;a++)t.setInput(o,r,a,"");e.totalsRows=0,e.r1=r-1},{rebuild:!0}),null}function Ye(t,e,n){if(n===e.headerRows>0)return null;const{sheet:s}=e;return n?e.r0===0||I(s,e.r0-1,e.c0,e.c1)?"Clear the row above the table to show its headers.":(C(t,e,"table-header",r=>{e.r0-=1,e.headerRows=1,e.columns.forEach((o,a)=>t.setInput(r,e.r0,e.c0+a,o)),e.filter={r0:e.r0,c0:e.c0,r1:e.r1-e.totalsRows,c1:e.c1,columns:new Map}},{rebuild:!0}),null):(C(t,e,"table-header",r=>{for(let o=e.c0;o<=e.c1;o++)t.setInput(r,e.r0,o,"");e.r0+=1,e.headerRows=0,e.filter=null},{rebuild:!0}),null)}function qe(t,e,n){const{sheet:s}=e;if(n.r0!==e.r0)return"The header row must stay in the same row.";if(n.c0!==e.c0)return"The table must keep its first column.";if(n.r1<n.r0+e.headerRows+e.totalsRows)return"The table needs at least one data row.";for(const r of g(t,s))if(r!==e&&r.r0<=n.r1&&r.r1>=n.r0&&r.c0<=n.c1&&r.c1>=n.c0)return"A table can't overlap another table.";return C(t,e,"table-resize",()=>{const r=n.c1-n.c0+1,o=e.columns.slice(0,r);for(let a=o.length;a<r;a++){const l=e.c0+a;let u=e.headerRows?t.editText(s,e.r0,l).trim():"";u||(u=`${L()}${a+1}`),o.push(u)}e.columns=o,e.r1=n.r1,e.c1=n.c1,e.filter&&(e.filter={r0:e.r0,c0:e.c0,r1:e.r1-e.totalsRows,c1:e.c1,columns:new Map}),e.columnsChanged=!0},{rebuild:!0}),null}function Ce(t,e,n){const{sheet:s}=e,r=e.r1-e.r0+1,o=e.c1-e.c0+1,a=new Map,l=(f,c,i,m)=>{const d=(f-e.r0)*o+(c-e.c0);let p=a.get(d);p||a.set(d,p={}),p[i]=m};for(const f of n.areas(e,e.r0,e.r1,e.c0,e.c1)){const c=f.borders;for(let i=Math.max(f.r0,e.r0);i<=Math.min(f.r1,e.r1);i++)for(let m=Math.max(f.c0,e.c0);m<=Math.min(f.c1,e.c1);m++)c.t&&i===f.r0&&l(i,m,"t",c.t),c.b&&i===f.r1&&l(i,m,"b",c.b),c.l&&m===f.c0&&l(i,m,"l",c.l),c.r&&m===f.c1&&l(i,m,"r",c.r),c.h&&i<f.r1&&l(i,m,"b",c.h),c.v&&m<f.c1&&l(i,m,"r",c.v)}const u=new Map;t.transact("format",f=>{for(let c=0;c<r;c++){const i=e.r0+c;for(let m=0;m<o;m++){const d=e.c0+m,p=n.format(e,i,d),h=a.get(c*o+m),w=s.style(i,d),$=t.styles.get(w),b={};if(p.fill&&!$.fill&&(b.fill=p.fill),p.color&&!$.color&&(b.color=p.color),p.bold&&!$.bold&&(b.bold=!0),p.italic&&!$.italic&&(b.italic=!0),h){const R=$.borders??{},z={l:R.l??null,r:R.r??null,t:R.t??null,b:R.b??null};let X=!1;for(const S of["l","r","t","b"])h[S]&&!R[S]&&(z[S]={style:h[S].style,color:h[S].color},X=!0);X&&(b.borders=z)}const A=JSON.stringify(b);if(A==="{}")continue;const U=`${w}|${A}`;let x=u.get(U);x===void 0&&u.set(U,x=t.styles.derive(w,b,A)),x!==w&&(f.saveCell(i,d),s.setStyle(i,d,x))}}})}function Ge(t,e){ce(t,"Convert to Range",()=>ge(t,e))}function ge(t,e){const n=t.engine,{sheet:s}=e,r=me(e.styleName,t.theme),o=t.activeSheet;t.activeSheet=t.sheets.indexOf(s),r?.format&&Ce(t,e,r),t.activeSheet=o;const a=e.name.toUpperCase(),l=new RegExp(`(^|[^A-Za-z0-9_.\\\\])${e.name.replace(/[.\\]/g,"\\$&")}(\\[(?:[^\\[\\]']|'.|\\[(?:[^\\[\\]']|'.)*\\])*\\])`,"gi");t.transact("table-convert",()=>{const u=O(t,(m,d,p)=>m.replace(l,(h,w,$)=>{const b=n.tableSpecToA1(e,$,p);return b===null?h:`${w}${d===s?"":J(s.name)}${b}`})),f=e.source===!0&&e.part?{part:e.part,sheetIndex:t.sheets.indexOf(s)}:null,c=()=>{n.tables.delete(a),f&&(t.removedTables??=[]).push(f),y(u,3),n.rebuild()},i=()=>(n.tables.set(a,e),f&&(t.removedTables=t.removedTables.filter(m=>m!==f)),y(u,2),n.rebuild(),()=>(c(),i));return c(),i})}function Re(t,e,n,s){const r=t.toLowerCase(),o=`${e.toLowerCase()}[`;let a="",l=0;for(let u=r.indexOf(o);u>=0;u=r.indexOf(o,u+1)){const f=u+o.length-1;let c=0,i=f;for(;i<t.length;i++){const p=t[i];if(p==="'")i++;else if(p==="[")c++;else if(p==="]"&&--c===0)break}const m=t.slice(f,i+1),d=m.split(`[${n}]`).join(`[${s}]`);d!==m&&(a+=t.slice(l,f)+d,l=i+1)}return l===0?t:a+t.slice(l)}function Se(t,e,n,s){const r=e.columns[n],o=E(r),a=E(s),l=O(t,i=>i.includes("[")?Re(i,e.name,o,a):i),u=(i,m)=>{e.columns=e.columns.map((d,p)=>p===n?i:d),e.columnsChanged=!0,e.dirty=!0,y(l,m),t.engine?.rebuild()};u(s,3);const f=()=>(u(s,3),c),c=()=>(u(r,2),f);return c}function Je(t,e,n){let s=null;const{sheet:r}=e;for(const o of g(t,r))if(!(o.headerRows===0||o.dataSheet))for(let a=0;a<n.count;a++){if(n.rows[a]!==o.r0||n.cols[a]<o.c0||n.cols[a]>o.c1)continue;const l=n.cols[a],u=l-o.c0,f=r.kind(o.r0,l);let c=f===0?"":String(t.engine.read(r,o.r0,l)??"").trim();const i=new Set(o.columns.filter((h,w)=>w!==u).map(h=>h.toLowerCase()));if(c==="")c=Q(i);else if(i.has(c.toLowerCase())){const h=c;let w=2;for(;i.has(`${h}${w}`.toLowerCase());)w++;c=`${h}${w}`}if(((f&M)!==T||(f&D)!==0||t.strings.get(r.value(o.r0,l))!==c)&&(e.saveCell(o.r0,l),r.setFormula(o.r0,l,null),r.setCell(o.r0,l,T,t.strings.add(c))),o.columns[u]===c)continue;const m=Se(t,o,u,c),d=s,p=(h,w)=>w?()=>p(h(),w()):h;s=p(m,d)}return s}const Qe=[...Array.from({length:21},(t,e)=>`TableStyleLight${e+1}`),...Array.from({length:28},(t,e)=>`TableStyleMedium${e+1}`),...Array.from({length:11},(t,e)=>`TableStyleDark${e+1}`)];export{be as SUBTOTAL_CODE,Qe as TABLE_STYLE_NAMES,Ue as bandRow,q as colName,Ge as convertTableToRange,ze as createTable,De as fillCalculatedColumn,Ne as growTableOver,Xe as maybeExpandTable,de as nextTableName,Pe as patchTableXml,ue as presetElements,He as renameTable,Se as renameTableColumn,qe as resizeTable,Oe as setCustomTableResolver,je as setTableFilterButton,Ye as setTableHeaderRow,Ze as setTableOption,We as setTableTotals,E as structuredColumn,Je as syncTableHeaders,me as tableColors,Ke as tablePatch,Be as tableXml,g as tablesOf,$e as totalInput};
package/core/tsv.js ADDED
@@ -0,0 +1,4 @@
1
+ function f(l){return/[\t\n\r]|^"/.test(l)?`"${l.replace(/"/g,'""')}"`:l}function i(l){const r=[];let s=[],e="",c=!1;const o=l.replace(/\r\n?/g,`
2
+ `),u=o.endsWith(`
3
+ `)?o.slice(0,-1):o;for(let n=0;n<u.length;n++){const t=u[n];c?t==='"'?u[n+1]==='"'?(e+='"',n++):c=!1:e+=t:t==='"'&&e===""?c=!0:t===" "?(s.push(e),e=""):t===`
4
+ `?(s.push(e),r.push(s),s=[],e=""):e+=t}return s.push(e),r.push(s),r}export{i as parseTsv,f as quoteTsv};
package/core/whatif.js ADDED
@@ -0,0 +1 @@
1
+ import{FORMULA as H,KIND_MASK as K,NUM as b,STR as A}from"./sheet.js";import{cellRef as I,MAX_COLS as W,parseRangeRef as F,rangeRef as X}from"./address.js";async function Z(t,n,r,e,a,{maxIter:o=200,tolerance:l=.001}={}){const u=t.engine,g=async d=>{t.transact("goal-seek",S=>{S.saveCell(e.row,e.col),n.setCell(e.row,e.col,b,d)}),await u.whenIdle();const x=u.read(n,r.row,r.col);return typeof x=="number"?x-a:NaN},s=()=>t.undoStack.length,c=s(),f=n.value(e.row,e.col);let p=f,i=await g(p),v=f===0?1:f*1.01,M=await g(v),E={x:p,f:i},L=null,h=null;for(let d=0;d<o&&((Math.abs(M)<Math.abs(E.f)||Number.isNaN(E.f))&&(E={x:v,f:M}),!(Math.abs(M)<=l));d++){i*M<0&&(L=i<0?p:v,h=i<0?v:p);let x=M===i?v*1.5+1:v-M*(v-p)/(M-i);if(L!==null&&(!Number.isFinite(x)||x<Math.min(L,h)||x>Math.max(L,h))&&(x=(L+h)/2),!Number.isFinite(x))break;p=v,i=M,v=x,M=await g(v)}for(;s()>c;)t.undoStack.pop();t.transact("goal-seek",d=>{d.saveCell(e.row,e.col),n.setCell(e.row,e.col,b,f)});const m=t.undoStack.pop();return t.transact("goal-seek",d=>{d.saveCell(e.row,e.col),n.setCell(e.row,e.col,b,E.x)}),await u.whenIdle(),{value:E.x,found:Math.abs(E.f)<=l,result:u.read(n,r.row,r.col)}}const P=t=>{if(t===void 0)return 0;const n=t.indexOf('outlineLevel="');return n<0?0:t.charCodeAt(n+14)-48},U=(t,n)=>t.rowExtras===null?0:P(t.rowExtras.get(n));function j(t,n,r){t.rowExtras||(t.rowExtras=new Map);const e=(t.rowExtras.get(n)??"").replace(/\s*outlineLevel="\d+"/,"").trim(),a=r>0?`${e} outlineLevel="${r}"`.trim():e;a?t.rowExtras.set(n,a):t.rowExtras.delete(n)}const _=(t,n)=>t.colExtras===null?0:P(t.colExtras.get(n));function z(t,n,r){t.colExtras||(t.colExtras=new Map);const e=(t.colExtras.get(n)??"").replace(/\s*outlineLevel="\d+"/,"").trim(),a=r>0?`${e} outlineLevel="${r}"`.trim():e;a?t.colExtras.set(n,a):t.colExtras.delete(n)}function C(t,n,r,e,a){for(let o=r;o<=e;o++)n==="row"?j(t,o,Math.max(0,Math.min(7,U(t,o)+a))):z(t,o,Math.max(0,Math.min(7,_(t,o)+a)));t.outlineVersion=(t.outlineVersion??0)+1,n==="col"&&(t.colsChanged=!0),t.revision++}function tt(t,n){let r=0;const e=n==="row"?t.rowExtras:t.colExtras;if(e)for(const a of e.values()){const o=/outlineLevel="(\d+)"/.exec(a);o&&(r=Math.max(r,Number(o[1])))}return r}function nt(t,n,r){return n==="row"?U(t,r):_(t,r)}function rt(t,n,r){const e=n==="row"?t.rowExtras:t.colExtras,a=n==="row"?t.rows:t.cols;if(e){for(const[o,l]of e){const u=/outlineLevel="(\d+)"/.exec(l);u&&a.setHidden(o,Number(u[1])>=r)}n==="col"&&(t.colsChanged=!0),t.revision++}}function et(t,n,r,e,a,o){const l=[],u={1:"Average",2:"Count",3:"Count",4:"Max",5:"Min",6:"Product",7:"StdDev",8:"StdDevp",9:"Total",10:"Var",11:"Varp"}[a],g=c=>(n.kind(c,e)&K)===A?t.strings.get(n.value(c,e)):String(n.value(c,e));let s=r.r0+1;for(let c=r.r0+1;c<=r.r1+1;c++)(c>r.r1||g(c)!==g(s))&&(l.push({afterRow:c-1,from:s,to:c-1,title:`${g(s)} ${u}`}),s=c);return{groups:l,functionNum:a,sumCols:o,groupCol:e,grandTitle:`Grand ${u}`}}function ot(t,n,r,e,a){const o={r0:r.r0+1,c0:r.c0+1,r1:r.r1,c1:r.c1},l=e&&a,u={t:"dataTable",ref:X(o),dt2D:l?"1":"0",dtr:e?"1":"0",r1:I((e??a).row,(e??a).col)};l&&(u.r2=I(a.row,a.col));const g=t.engine,s={sheet:n,row:o.r0,col:o.c0,info:u};t.transact("data-table",c=>{for(let i=o.r0;i<=o.r1;i++)for(let v=o.c0;v<=o.c1;v++)c.saveCell(i,v),n.setFormula(i,v,null),n.setCell(i,v,b,0);n.setFormula(o.r0,o.c0,u),n.setCell(o.r0,o.c0,H|b,0),t.formulasEdited=!0,g.dataTables.push(s),g.tablesDirty=!0;const f=()=>(g.dataTables=g.dataTables.filter(i=>i!==s),p),p=()=>(g.dataTables.push(s),g.tablesDirty=!0,f);return f})}const q=(t,n,r,e)=>{const a=n.kind(r,e)&K;return a===0?"":a===A?t.strings.get(n.value(r,e)):String(n.value(r,e))};function at(t,n,r,e){const a=[],o=new Set;for(const l of r.split(/[\s,;]+/)){const u=F(l.replace(/\$/g,""));if(u)for(let g=u.r0;g<=u.r1&&a.length<32;g++)for(let s=u.c0;s<=u.c1&&a.length<32;s++){const c=I(g,s);if(o.has(c))continue;o.add(c);const f=e?.cells.find(p=>p.r===c);a.push({r:c,val:f?f.val:q(t,n,g,s)})}}return a}function ct(t,n,r){t.transact("scenario",e=>{for(const{r:a,val:o}of r.cells){const l=F(a);l&&t.setInput(e,l.r0,l.c0,o)}})}function st(t,n,r,e){const a=t.engine,o=[["Scenario Summary","Current Values",...r.map(s=>s.name)]],l=[];for(const s of r)for(const c of s.cells)l.includes(c.r)||l.push(c.r);const u=s=>{const c=F(s);return{row:c.r0,col:c.c0}};o.push(["Changing Cells:"]);for(const s of l){const{row:c,col:f}=u(s);o.push([s,q(t,n,c,f),...r.map(p=>p.cells.find(i=>i.r===s)?.val??"")])}if(e.length>0){o.push(["Result Cells:"]);const s=r.map(c=>a.evaluateWith(n,c.cells.map(f=>({...u(f.r),text:f.val})),()=>e.map(({row:f,col:p})=>a.read(n,f,p))));e.forEach(({row:c,col:f},p)=>{o.push([I(c,f),String(a.read(n,c,f)??""),...s.map(i=>String(i[p]??""))])})}const g=t.addSheet();return t.transact("scenario-summary",s=>{o.forEach((c,f)=>c.forEach((p,i)=>{p!==""&&t.setInput(s,f,i,String(p))}))}),g}const w=t=>t.filter(n=>typeof n=="number"),R=t=>t.reduce((n,r)=>n+r,0),B=t=>R(t)/t.length,O=(t,n)=>{const r=B(t);return R(t.map(e=>(e-r)**2))/n},J={Sum:t=>R(w(t)),Count:t=>t.filter(n=>n!==null&&n!=="").length,Average:t=>w(t).length?B(w(t)):null,Max:t=>w(t).length?Math.max(...w(t)):0,Min:t=>w(t).length?Math.min(...w(t)):0,Product:t=>w(t).length?w(t).reduce((n,r)=>n*r,1):0,"Count Numbers":t=>w(t).length,StdDev:t=>w(t).length>1?Math.sqrt(O(w(t),w(t).length-1)):null,StdDevp:t=>w(t).length?Math.sqrt(O(w(t),w(t).length)):null,Var:t=>w(t).length>1?O(w(t),w(t).length-1):null,Varp:t=>w(t).length?O(w(t),w(t).length):null};function lt(t,n,r,e,a,{topRow:o=!1,leftCol:l=!1}={}){const u=t.engine,g=J[a],s=[],c=[],f=new Map,p=new Map,i=new Map,v=(h,m,d)=>{const x=String(d).toLowerCase();let S=h.get(x);return S===void 0&&(S=m.length,h.set(x,S),m.push(d)),S};for(const{sheet:h,range:m,read:d}of e){const x=d??((y,T)=>u.read(h,y,T)),S=m.r0+(o?1:0),N=m.c0+(l?1:0);for(let y=S;y<=m.r1;y++){const T=l?x(y,m.c0):y-S;if(l&&(T===null||T===""))continue;const k=v(f,s,T);for(let D=N;D<=m.c1;D++){const V=o?x(m.r0,D):D-N;if(o&&(V===null||V===""))continue;const G=v(p,c,V),$=k*16384+G;i.has($)||i.set($,[]),i.get($).push(x(y,D))}}}const M=r.row+(o?1:0),E=r.col+(l?1:0),L=(h,m,d,x)=>{h.saveCell(m,d),n.setFormula(m,d,null),typeof x=="number"?n.setCell(m,d,b,x):n.setCell(m,d,A,t.strings.add(String(x)))};return t.transact("consolidate",h=>{o&&c.forEach((m,d)=>L(h,r.row,E+d,m)),l&&s.forEach((m,d)=>L(h,M+d,r.col,m));for(const[m,d]of i){const x=Math.floor(m/16384),S=m-x*16384,N=g(d);N!==null&&L(h,M+x,E+S,N)}}),{rows:s.length,cols:c.length}}export{J as CONSOLIDATE_FUNCTIONS,W as MAX_COLS,C as changeOutline,lt as consolidate,ot as createDataTable,Z as goalSeek,tt as maxOutlineLevel,nt as outlineLevel,st as scenarioSummary,at as scenarioValues,rt as showOutlineLevel,ct as showScenario,et as subtotalPlan};
@@ -0,0 +1 @@
1
+ import{expandBareTables as K}from"../slicers/structured.js";import{syncTableHeaders as j}from"./tables.js";import{BOOL as F,CHUNK_BITS as I,CHUNK_MASK as J,EMPTY as _,ERR as E,ERRORS as W,FORMULA as k,DIRTY as N,EVALUATING as z,KIND_MASK as Z,NUM as P,Sheet as A,SPILL as Y,STR as R}from"./sheet.js";import{cellRef as X,MAX_COLS as w,MAX_ROWS as B,quoteSheetName as Q,rangeRef as ee,renameSheetInFormula as D,sheetReferencePattern as te}from"./address.js";import{translateFormula as se}from"./formula-refs.js";import{sheetStem as q}from"./default-names.js";import{StringTable as ne}from"./strings.js";import{StyleTable as ie}from"./styles.js";import{parseInput as G}from"./input.js";import{noteChanges as H}from"./changes.js";import{overrideRuns as le}from"../cells/rich-runs.js";import{sheetRenameHooks as re}from"./sparse.js";import{expandStructured as oe,toDisplayFormula as V,toFileFormula as ae}from"../calc/parser.js";const he=200,ce=new Set(["entry","clear","format","borders","fill"]);class ue{constructor(){this.ids=new Int32Array(1024),this.list=[]}set(t,e){if(t>=this.ids.length){let l=this.ids.length*2;for(;l<=t;)l*=2;const n=new Int32Array(l);n.set(this.ids),this.ids=n}const s=this.list.length;(s===0||this.list[s-1]!==e)&&this.list.push(e),this.ids[t]=this.list.length}get(t){const e=t<this.ids.length?this.ids[t]:0;return e===0?void 0:this.list[e-1]}}class b{constructor(){this.capacity=1024,this.count=0,this.rows=new Uint32Array(this.capacity),this.cols=new Uint16Array(this.capacity),this.kinds=new Uint8Array(this.capacity),this.styles=new Uint16Array(this.capacity),this.values=new Float64Array(this.capacity),this.formulas=null,this.vms=null}_grow(){const t=this.capacity*2,e=(s,l)=>{const n=new s(t);return n.set(l),n};this.rows=e(Uint32Array,this.rows),this.cols=e(Uint16Array,this.cols),this.kinds=e(Uint8Array,this.kinds),this.styles=e(Uint16Array,this.styles),this.values=e(Float64Array,this.values),this.capacity=t}push(t,e,s){this.count===this.capacity&&this._grow();const l=this.count++,n=t.kind(e,s)&~(N|z);if(this.rows[l]=e,this.cols[l]=s,this.kinds[l]=n,this.styles[l]=t.cellStyle(e,s),this.values[l]=t.value(e,s),n&k&&(this.formulas===null&&(this.formulas=new ue),this.formulas.set(l,t.formula(e,s))),t.valueMeta!==null){const i=t.valueMeta.get(e*w+s);i!==void 0&&(this.vms??=new Map).set(l,i)}}}class Re{constructor(){this.sheets=[new A(`${q()}1`)],this.activeSheet=0,this.strings=new ne,this.styles=new ie,this.undoStack=[],this.redoStack=[],this.listeners=new Set,this.source=null,this.formulasEdited=!1,this.edits=0,this._dirty=!1,this.engine=null,this.selectedSheets=null}get sheet(){return this.sheets[this.activeSheet]}get dirty(){return this._dirty}set dirty(t){t&&this.edits++,this._dirty=!!t}onChange(t){this.listeners.add(t)}_emit(t){this.dirty=!0;for(const e of this.listeners)e(t)}addSheet(t){const e=q();let s=1,l=t??`${e}${s}`;const n=o=>this.sheets.some(r=>r.name.toLowerCase()===o.toLowerCase());for(;n(l);)l=`${e}${++s}`;const i=new A(l);return this.sheets.push(i),this.activeSheet=this.sheets.length-1,this.engine?.sheetsChanged(),this._emit("sheets"),i}deleteSheet(t){if(this.sheets.filter(s=>!s.hidden).length<=1)return!1;this._shrink3D(t);const[e]=this.sheets.splice(t,1);if(this.selectedSheets?.delete(e),this._forgetSheet(e,t),this.engine)for(const[s,l]of this.engine.tables)l.sheet===e&&this.engine.tables.delete(s);for(this._reindexNames(s=>s===t?-1:s>t?s-1:s),this.activeSheet>=this.sheets.length&&(this.activeSheet=this.sheets.length-1);this.sheets[this.activeSheet].hidden;)this.activeSheet=(this.activeSheet+1)%this.sheets.length;return this.structureEdited=!0,this.engine?.sheetsChanged(),this.engine?.rebuild(),this._emit("sheets"),!0}_forgetSheet(t,e){const s=n=>n.sheet===t||n.sheet===void 0&&n.sheetIndex===e||(n.extra?.parts??[]).some(s),l=n=>{n.sheetIndex>e&&n.sheetIndex--;for(const i of n.extra?.parts??[])l(i)};for(const n of[this.undoStack,this.redoStack]){const i=n.filter(o=>!s(o));i.forEach(l),n.splice(0,n.length,...i)}}moveSheet(t,e){if(t===e)return;const s=this.sheet,[l]=this.sheets.splice(t,1);this.sheets.splice(e,0,l),this.activeSheet=this.sheets.indexOf(s);const n=o=>o===t?e:t<e?o>t&&o<=e?o-1:o:o>=e&&o<t?o+1:o,i=o=>{o.sheetIndex=n(o.sheetIndex);for(const r of o.extra?.parts??[])i(r)};for(const o of this.undoStack)i(o);for(const o of this.redoStack)i(o);this.structureEdited=!0,this._reindexNames(n),this.engine?.orderChanged(),this._emit("sheets")}_copyScopedNames(t,e,s){const{engine:l}=this;if(!l||l.names.size===0)return;const n=`${t}!`;let i=!1;for(const[o,r]of[...l.names])o.startsWith(n)&&(l.names.set(`${t+1}!${o.slice(n.length)}`,{...r,text:D(r.text,e.name,s.name)}),i=!0);i&&(this.namesChanged=!0)}_reindexNames(t){const{engine:e}=this;if(!e||e.names.size===0)return;const s=[];let l=!1;for(const[n,i]of e.names){const o=n.indexOf("!"),r=o<0?0:t(Number(n.slice(0,o)));o>=0&&r!==Number(n.slice(0,o))&&(l=!0),o<0?s.push([n,i]):r>=0&&s.push([`${r}!${n.slice(o+1)}`,i])}if(l){e.names.clear();for(const[n,i]of s)e.names.set(n,i);e.nameTemplates.clear(),this.namesChanged=!0,e.rebuild()}}duplicateSheet(t){const e=this.sheets[t];let l=`${e.name} (2)`,n=2;for(;this.sheets.some(a=>a.name.toLowerCase()===l.toLowerCase());)l=`${e.name} (${++n})`;const i=new A(l);e.columns.forEach((a,u)=>{const m=[];a.forEach((h,y)=>{m[y]={kinds:h.kinds.slice(),values:h.values.slice(),styles:h.styles?h.styles.slice():null}}),i.columns[u]=m}),i.maxRow=e.maxRow,i.maxCol=e.maxCol,i.rows=e.rows.shifted(0,0),i.cols=e.cols.shifted(0,0);const o=new Map;e.formulas.forEachCell((a,u,m)=>{let h=o.get(m);h===void 0&&(h={...m,tpl:void 0},o.set(m,h)),i.setFormula(a,u,h)}),i.merges=e.merges.map(a=>({...a})),i.rowStyles=e.rowStyles?new Map(e.rowStyles):null,i.colStyles=e.colStyles?new Map(e.colStyles):null,i.frozenRows=e.frozenRows,i.frozenCols=e.frozenCols,i.showGridlines=e.showGridlines,i.cellTypes=e.cellTypes?new Map(e.cellTypes):null,i.sparkRules=e.sparkRules,i.cellDropdowns=e.cellDropdowns?new Map(e.cellDropdowns):null,i.cellTags=e.cellTags?new Map(e.cellTags):null,i.cellButtons=e.cellButtons?new Map(e.cellButtons):null,i.cellStates=e.cellStates?e.cellStates.slice():null,i.autoMerges=e.autoMerges?e.autoMerges.map(a=>({...a})):null,i.background=e.background,i.outlineColumn=e.outlineColumn?{...e.outlineColumn}:null,i.frozenTrailingRows=e.frozenTrailingRows,i.frozenTrailingCols=e.frozenTrailingCols,i.hideZeros=e.hideZeros,i.hideHeadings=e.hideHeadings,i.isChartSheet=e.isChartSheet,i.hideOutline=e.hideOutline,i.gridColorId=e.gridColorId,i.areaOffset=e.areaOffset,i.selectionPolicy=e.selectionPolicy,i.selectionUnit=e.selectionUnit,i.gridlineAxes=e.gridlineAxes,i.gridColor=e.gridColor,i.tabStyles=e.tabStyles;const r=x;return i.cf=r(e.cf),i.validations=r(e.validations),i.comments=r(e.comments),i.threads=r(e.threads),i.hyperlinks=e.hyperlinks?e.hyperlinks.map(a=>({...r({...a,_ranges:void 0})})):e.hyperlinks,i.autoFilter=r(e.autoFilter),i.filteredRows=e.filteredRows?new Set(e.filteredRows):e.filteredRows,i.pageSetup=r(e.pageSetup),i.tabColor=e.tabColor,i.protection=r(e.protection),i.rtl=e.rtl,i.zoom=e.zoom,i.valueMeta=e.valueMeta?new Map(e.valueMeta):null,i.colsChanged=!0,i.viewChanged=!0,this.sheets.splice(t+1,0,i),this.activeSheet=t+1,this._reindexNames(a=>a>t?a+1:a),this._copyScopedNames(t,e,i),this.structureEdited=!0,this.engine?.sheetsChanged(),this.engine?.rebuild(),this._emit("sheets"),i}sheetNameProblem(t,e){const s=e.trim().slice(0,31);return!s||/[\\/?*[\]:]/.test(s)||/^'|'$/.test(s)?"rules":s.toLowerCase()==="history"?"reserved":this.sheets.some((l,n)=>n!==t&&l.name.toLowerCase()===s.toLowerCase())?"taken":null}renameSheet(t,e){const s=e.trim().slice(0,31);if(this.sheetNameProblem(t,e)!==null)return!1;const l=this.sheets[t].name;this.sheets[t].name=s,this._renameInFormulas(l,s);for(const n of re)n(this,l,s);return this.engine?.sheetsChanged(),this._emit("sheets"),!0}_shrink3D(t){const e=this.sheets[t].name.toLowerCase(),s=r=>this.sheets.findIndex(a=>a.name.toLowerCase()===r.toLowerCase()),l=r=>r[0]==="'"?r.slice(1,-1).replace(/''/g,"'"):r,n=/((?:'(?:[^']|'')+'|[A-Za-z_\u00C0-\uFFFF][\w.\u00C0-\uFFFF]*)):((?:'(?:[^']|'')+'|[A-Za-z_\u00C0-\uFFFF][\w.\u00C0-\uFFFF]*))!/g,i=r=>r.replace(n,(a,u,m,h)=>{if(r[h-1]==="]")return a;const y=l(u),p=l(m);if(y.toLowerCase()!==e&&p.toLowerCase()!==e)return a;let c=s(y),S=s(p);if(c<0||S<0||(c>S&&([c,S]=[S,c]),c===t&&c++,S===t&&S--,c>S))return a;const f=g=>Q(this.sheets[g].name);return c===S?`${f(c)}!`:`${f(c)}:${f(S)}!`}),o=r=>r.includes(":")&&r.includes("!")?r.split(/("(?:[^"]|"")*")/).map((a,u)=>u%2?a:i(a)).join(""):r;for(const r of this.sheets){const a=new Map;r.formulas.forEachCell((u,m,h)=>{let y=a.get(h);if(y===void 0){const p=h.f??h.sf,c=typeof p=="string"?o(p):p;y=c===p?null:h.f!==void 0?{...h,f:c,tpl:void 0}:{...h,sf:c,tpl:void 0},a.set(h,y)}y!==null&&r.setFormula(u,m,y)})}for(const r of this.engine?.names.values()??[])typeof r.text=="string"&&(r.text=o(r.text));this.engine?.templates.clear()}_renameInFormulas(t,e){const s=te(t);let l=!1;for(const n of this.sheets){const i=new Map;n.formulas.forEachCell((o,r,a)=>{let u=i.get(a);if(u===void 0){const m=a.f??a.sf;if(m===void 0||!s.test(m))s.lastIndex=0,u=null;else{s.lastIndex=0;const h=D(m,t,e);u=a.f!==void 0?{...a,f:h,tpl:void 0}:{...a,sf:h,tpl:void 0}}i.set(a,u)}u!==null&&(n.setFormula(o,r,u),l=!0)})}l&&(this.formulasEdited=!0,this.engine?.templates.clear(),this.engine?.rebuild())}editText(t,e,s){const l=t.kind(e,s);if(this.engine?.dataTables.length){const o=this.engine.dataTableAt(t,e,s);if(o){const{info:r}=o,a=r.dt2D==="1",u=r.dtr==="1";return`{=TABLE(${a||u?r.r1:""},${a?r.r2:u?"":r.r1})}`}}if(l&Y&&this.engine){const o=this.engine.spillMaster(t,e,s);if(o)return this.editText(t,o.row,o.col)}if(l&k){const o=t.formula(e,s);if(o&&o.f!==void 0){const r="="+V(o.f);return o.t==="array"&&!o.cm?`{${r}}`:r}if(o&&o.sf!==void 0){const r=Math.floor(o.base/w),a=o.base-r*w;return"="+V(se(o.sf,e-r,s-a))}}const n=l&Z;if(n===_)return"";const i=t.value(e,s);if(n===E&&t.valueMeta!==null&&!(l&k)){const o=this.richImages?.get(t.valueMeta.get(e*w+s));if(o!==void 0)return o.alt??"";const r=this.richValues?.indexOfVm(t.valueMeta.get(e*w+s))??-1,a=r>=0?this.richValues.view(r):null;if(a!==null)return a.text}return n===R?this.styles.get(t.style(e,s)).quotePrefix?`'${this.strings.get(i)}`:this.strings.get(i):n===F?i?"TRUE":"FALSE":n===E?W[i]??"#N/A":String(i)}transact(t,e){if(this.guard&&!this.guard(t))return;const s=this.selectedSheets,l=s!==null&&s.size>1&&ce.has(t)?this._runGroup(t,e,s):this._runOn(this.sheet,t,e);l!==null&&this._pushUndo(l)}transactOn(t,e,s){const l=this._runOn(t,e,s);l!==null&&this._pushUndo(l)}_runOn(t,e,s){const l=new b,n={sheet:t,log:l,saveCell:(u,m)=>l.push(t,u,m)},i=s(n)??null;e!=="entry"&&this.engine?.presentationChanged(),t.changes!==null&&l.count>0&&H(this,t,l),l.vms!==null&&fe(t,l);const o=l.count>0&&this.engine?.tables.size>0?j(this,n,l):null,r=(u,m)=>h=>r(u(h),m(h)),a=i&&o?r(i,o):i??o;return l.count===0&&a===null?null:(t.revision++,this.engine?.cellsChanged(t,l.rows,l.cols,l.count),{sheetIndex:t===this.sheet?this.activeSheet:this.sheets.indexOf(t),sheet:t,log:l,label:e,extra:a})}_runGroup(t,e,s){const l=[];for(const n of this.sheets){if(!s.has(n)||n.protection&&n!==this.sheet)continue;const i=this._runOn(n,t,e);i!==null&&l.push(i)}return l.length===0?null:{sheetIndex:this.activeSheet,sheet:this.sheet,log:new b,label:t,extra:T(this,l)}}runSlice(t,e,s){const l=this._runOn(t,e,s);return l!==null&&this._emit("cells"),l}pushFolded(t,e,s){t.length!==0&&this._pushUndo({sheetIndex:this.sheets.indexOf(s),sheet:s,log:new b,label:e,extra:T(this,t)})}rollbackSlices(t){for(let e=t.length-1;e>=0;e--)this._restore(t[e]);this._emit("cells")}_pushUndo(t){this.allowUndo===!1?this.undoStack.length=0:(this.undoStack.push(t),this.undoStack.length>(this.historyLimit??he)&&this.undoStack.shift()),this.redoStack.length=0,this._emit("cells")}_restore(t){const e=t.sheet??this.sheets[t.sheetIndex],{log:s}=t,l=new b;for(let o=s.count-1;o>=0;o--){const r=s.rows[o],a=s.cols[o];l.push(e,r,a),e.setCell(r,a,s.kinds[o],s.values[o]),e.setStyle(r,a,s.styles[o]),e.setFormula(r,a,s.kinds[o]&k?s.formulas.get(o):null)}if(s.vms!==null){e.valueMeta=new Map(e.valueMeta??[]);for(const[o,r]of s.vms)e.valueMeta.set(s.rows[o]*w+s.cols[o],r)}let n=null;t.extra&&(n=t.extra(e)),this.engine?.presentationChanged(),e.changes!==null&&s.count>0&&H(this,e,l),e.revision++,this.engine?.cellsChanged(e,s.rows,s.cols,s.count);const i=this.sheets.indexOf(e);return i>=0&&(this.activeSheet=i),{sheetIndex:i>=0?i:t.sheetIndex,sheet:e,log:l,label:t.label,extra:n}}undo(){const t=this.undoStack.pop();return t?(this.redoStack.push(this._restore(t)),this._emit("cells"),!0):!1}redo(){const t=this.redoStack.pop();return t?(this.undoStack.push(this._restore(t)),this._emit("cells"),!0):!1}setInput(t,e,s,l){const{sheet:n}=t;this.recorder?.push(`sheet.setValue(${JSON.stringify(X(e,s))}, ${JSON.stringify(l)});`),t.saveCell(e,s),n.setFormula(e,s,null);const i=n.cellStyle(e,s),r=l!==""&&this.styles.get(n.style(e,s)).numFmt==="@"?{kind:R,text:l[0]==="'"?l.slice(1):l}:G(l),a=l[0]==="'"&&l.length>1;switch((a||i!==0&&this.styles.get(i).quotePrefix)&&n.setStyle(e,s,this.styles.derive(i,{quotePrefix:a})),r.kind){case _:n.setCell(e,s,_,0);break;case P:n.setCell(e,s,P,r.value),r.format&&(n.cellStyle(e,s)===0||this.styles.get(n.cellStyle(e,s)).numFmt==="General")&&n.setStyle(e,s,this.styles.derive(n.cellStyle(e,s),{numFmt:r.format}));break;case F:n.setCell(e,s,F,r.value);break;case k:n.setCell(e,s,k|_,0),n.setFormula(e,s,{f:ae(this._expandTableRefs(K(r.formula,this.engine?.tables),n,e,s),this.engine?.names??null),typed:this.dynamicArrays!==!1}),this.formulasEdited=!0;break;default:n.setCell(e,s,R,this.strings.add(r.text))}}setRichInput(t,e,s,l,n){const{sheet:i}=t;t.saveCell(e,s),i.setFormula(e,s,null),i.setCell(e,s,R,this.strings.addRich(l,n))}_expandTableRefs(t,e,s,l){const n=this.engine;return!n||n.tables.size===0?t:oe(t,()=>{for(const i of n.tables.values())if(i.sheet===e&&s>=i.r0&&s<=i.r1&&l>=i.c0&&l<=i.c1)return i;return null})}clearRange(t,e="contents",{visibleOnly:s=!1}={}){this.sheet.dataRanges?.cleared(t)||this.transact("clear",l=>{const{sheet:n}=l,i=[];if(e!=="contents")for(const{r0:r,c0:a,r1:u,c1:m}of t){const h=r===0&&u===B-1,y=a===0&&m===w-1,p=(c,S,f,g)=>{for(const[C,v]of[...S])C<f||C>g||(i.push([c,C,v]),S.delete(C))};h&&n.colStyles!==null&&p("col",n.colStyles,a,m),y&&n.rowStyles!==null&&p("row",n.rowStyles,r,u)}const o=s&&n.filteredRows?.size>0?n.filteredRows:null;for(const{r0:r,c0:a,r1:u,c1:m}of t){const h=Math.min(m,n.maxCol),y=Math.min(u,n.maxRow);for(let p=a;p<=h;p++)if(n.columns[p]!==void 0)for(let c=r;c<=y;c++){if(n._chunk(c,p)===void 0){c|=1023;continue}if(o!==null&&o.has(c))continue;const f=n.kind(c,p)!==0,g=n.cellStyle(c,p)!==0;if(e==="formats"){if(!g)continue;l.saveCell(c,p),n.setStyle(c,p,0);continue}!f&&!(e==="all"&&g)||(l.saveCell(c,p),n.setCell(c,p,_,0),n.setFormula(c,p,null),e==="all"&&n.setStyle(c,p,0))}}return i.length>0?O([],i):void 0})}applyStyle(t,e){const s=JSON.stringify(e);if(this.recorder)for(const l of t)this.recorder.push(`sheet.setFormat(${JSON.stringify(ee(l))}, ${s});`);this.transact("format",l=>{const{sheet:n}=l;this.strings.rich!==null&&le(this,l,t,e);const i=[],o=new Set,r=[];for(const{r0:a,c0:u,r1:m,c1:h}of t){const y=a===0&&m===B-1,p=u===0&&h===w-1;if(y){n.colStyles===null&&(n.colStyles=new Map);for(let f=u;f<=h;f++){const g=n.colStyles.get(f);r.push(["col",f,g]),n.colStyles.set(f,this.styles.derive(g??0,e,s))}if(p&&n.rowStyles!==null)for(const[f,g]of n.rowStyles)r.push(["row",f,g]),n.rowStyles.set(f,this.styles.derive(g,e,s))}else if(p){n.rowStyles===null&&(n.rowStyles=new Map);for(let f=a;f<=m;f++){const g=n.rowStyles.get(f);r.push(["row",f,g]),n.rowStyles.set(f,this.styles.derive(g??0,e,s))}}const c=y?n.maxRow:m,S=p?n.maxCol:h;for(let f=u;f<=S;f++)for(let g=a>>>I;g<=c>>>I;g++){const C=g<<I,v=Math.max(a,C),L=Math.min(c,C+J);if(v>L)continue;const $=n._ensure(v,f),U=f*2048+g;o.has(U)||(o.add(U),i.push(f,g,$.styles===null?null:$.styles.slice()));for(let M=v;M<=L;M++)n.setStyle(M,f,this.styles.derive(n.style(M,f),e,s))}}return O(i,r)})}}function T(d,t){const e=()=>{const s=[];for(let l=t.length-1;l>=0;l--)s.push(d._restore(t[l]));return T(d,s)};return e.parts=t,e}function fe(d,t){let e=null;for(const s of t.vms.keys()){const l=t.rows[s],n=t.cols[s];(d.kind(l,n)&~(N|z))===t.kinds[s]&&d.value(l,n)===t.values[s]||(e??=new Map(d.valueMeta),e.delete(l*w+n))}e!==null&&(d.valueMeta=e.size>0?e:null)}function x(d){if(d===null||typeof d!="object")return d;if(Array.isArray(d))return d.map(x);if(d instanceof Map)return new Map([...d].map(([e,s])=>[e,x(s)]));if(d instanceof Set)return new Set([...d].map(x));if(ArrayBuffer.isView(d))return d.slice();const t={};for(const[e,s]of Object.entries(d))!e.startsWith("_")&&typeof s!="function"&&(t[e]=x(s));return t}function O(d,t){return e=>{const s=[];for(let n=0;n<d.length;n+=3){const i=d[n],o=d[n+1],r=e.columns[i]?.[o];r!==void 0&&(s.push(i,o,r.styles),r.styles=d[n+2])}const l=[];for(const[n,i,o]of t){const r=n==="col"?"colStyles":"rowStyles",a=e[r]??=new Map;l.push([n,i,a.get(i)]),o===void 0?a.delete(i):a.set(i,o)}return O(s,l)}}export{b as CellLog,ce as GROUP_LABELS,Re as Workbook,T as foldEntries,G as parseInput,O as swapStyles};
@@ -0,0 +1 @@
1
+ import{BOOL as v,CHUNK_BITS as L,CHUNK_MASK as j,EMPTY as S,ERR as B,FORMULA as G,KIND_MASK as F,NUM as b,Sheet as x,STR as f}from"../core/sheet.js";import{MAX_COLS as X,MAX_ROWS as O}from"../core/address.js";import{ERR_BY_INDEX as U,XlError as N}from"../calc/values.js";import{partsToSerial as V}from"../core/numfmt.js";import{DataError as Y}from"./data.js";import{STAGE as $}from"./view.js";import{t as H}from"../i18n/index.js";const c=x.prototype.setCell,D=x.prototype.setStyle,T=x.prototype.setFormula,ot={setCell:c,setStyle:D,setFormula:T};function rt(h,e,t,i,s){s==null||s===""?c.call(h,t,i,S,0):typeof s=="number"?c.call(h,t,i,b,s):typeof s=="boolean"?c.call(h,t,i,v,s?1:0):s instanceof N?c.call(h,t,i,B,s.index):s instanceof Date?c.call(h,t,i,b,V(s.getUTCFullYear(),s.getUTCMonth()+1,s.getUTCDate())):c.call(h,t,i,f,e.add(typeof s=="object"?JSON.stringify(s):String(s)))}function at(h,e,t){switch(e&F){case b:return t;case f:return h.get(t);case v:return t!==0;case B:return U[t]??null;default:return null}}function J(h){h.dataBindings||(h.dataBindings=[],h.routeInput=function(t,i,s,o){for(const n of this.dataBindings)if(n.routeInput&&n.contains(i,s))return n.routeInput(t,i,s,o);return!1},h.setCell=function(t,i,s,o){c.call(this,t,i,s,o);for(const n of this.dataBindings)if(n.contains(t,i)){n.cellWritten(t,i,s,o);break}},h.setFormula=function(t,i,s){if(T.call(this,t,i,s),!!s){for(const o of this.dataBindings)if(o.contains(t,i)){o.formulaWritten(t,i,s);break}}})}function P(h){h.dataBindings&&h.dataBindings.length===0&&(delete h.dataBindings,delete h.setCell,delete h.setFormula,delete h.routeInput)}class z{constructor(e,t,i,s,o={}){this.book=e,this.sheet=t,this.view=s,this.table=s.table,this.range={...i},this.options={header:!0,editable:!0,grow:i.r0===i.r1,...o},this.quiet=0,this.lastRows=0,this._pendingFlush=!1,this.formatStyles=new Map,J(t),t.dataBindings.push(this),this._unsubscribe=s.onChange(n=>this._viewChanged(n)),this.render()}unbind(){this._unsubscribe();const e=this.sheet.dataBindings;e.splice(e.indexOf(this),1),P(this.sheet)}get columnCount(){const{c0:e,c1:t}=this.range;return Math.min(this.view.columns.length,e===t&&this.options.grow?this.view.columns.length:t-e+1)}get headerRows(){return this.options.header?1:0}get dataRows(){const{r0:e,r1:t}=this.range,i=this.options.grow?O-e-this.headerRows:t-e+1-this.headerRows;return Math.max(0,Math.min(i,this.view.count))}contains(e,t){const{r0:i,c0:s}=this.range,o=this.options.grow&&this.options.editable?1:0;return e>=i&&t>=s&&t<s+this.columnCount&&e<i+this.headerRows+Math.max(this.dataRows,this.lastRows)+o}routeInput(e,t,i,s){if(!this.options.editable)return!1;const o=i-this.range.c0,n=this.view.columns[o];if(!n||n.col.type!=="string"||s[0]==="="||this.options.header&&t===this.range.r0)return!1;e.saveCell(t,i);const r=s[0]==="'"?s.slice(1):s,a=r===""?0:this.book.strings.add(r);return e.sheet.setCell(t,i,r===""?S:f,a),!0}_styleFor(e,t=!1){const i=`${t?"b":""}|${e}`;let s=this.formatStyles.get(i);if(s===void 0){const o={};e&&e!=="General"&&(o.numFmt=e),t&&(o.bold=!0),s=Object.keys(o).length>0?this.book.styles.derive(0,o):0,this.formatStyles.set(i,s)}return s}render(){this.quiet++;const{sheet:e,view:t,book:i}=this,{r0:s,c0:o}=this.range,n=this.columnCount;if(this.options.header)for(let l=0;l<n;l++)c.call(e,s,o+l,f,i.strings.add(t.columns[l].caption)),e.cellStyle(s,o+l)===0&&D.call(e,s,o+l,this._styleFor("General",!0));const r=s+this.headerRows,a=this.dataRows;for(let l=0;l<n;l++)this._renderColumn(l,r,0,a);for(let l=a;l<this.lastRows;l++)for(let y=0;y<n;y++)c.call(e,r+l,o+y,S,0);const R=Math.max(a,this.lastRows);this.lastRows=a,this.quiet--,this._notifyEngine(r-this.headerRows,r+R-1,n)}_renderColumn(e,t,i,s){const{sheet:o,view:n}=this,r=n.columns[e],a=r.col;a.stale&&this.table.ensure(a);const R=this.range.c0+e,l=r.format&&r.format!=="General"?this._styleFor(r.format):0,{map:y}=n,{data:M,isString:K}=a,A=a.kinds,W=a.type==="boolean";let u=null,I=-1;for(let g=i;g<i+s;g++){const q=t+g,E=q>>>L;E!==I&&(u=o._ensure(q,R),I=E);const _=q&j,m=y[g];let p=S,w=0;if(m>=0)if(K){const d=M[m];d>=0&&(p=f,w=d)}else if(A!==null)p=A[m],w=M[m];else{const d=M[m];d===d&&(p=W?v:b,w=d)}else{const d=-m-1,k=d>>>1;if(e===0)p=f,w=this.book.strings.add((d&1)===1?n.nodeLevel[k]<0?"Total":`${n.groupCaption(k)} total`:n.groupCaption(k));else{const C=n.summaryFor(k,r.field);C!==void 0&&C===C&&(p=b,w=C)}}u.kinds[_]=p,u.values[_]=w,l!==0&&(u.styles===null||u.styles[_]===0)&&(u.styles===null&&(u.styles=new Uint16Array(u.kinds.length)),u.styles[_]=l)}if(s>0){const g=t+i+s-1;g>o.maxRow&&(o.maxRow=g),R>o.maxCol&&(o.maxCol=R)}}_notifyEngine(e,t,i){const s=this.book.engine;if(this.sheet.revision++,!s||s.deps.get(this.sheet)===void 0||t<e)return;const o=i*2,n=new Uint32Array(o),r=new Uint16Array(o);for(let a=0;a<i;a++)n[a*2]=e,n[a*2+1]=t,r[a*2]=this.range.c0+a,r[a*2+1]=this.range.c0+a;s.cellsChanged(this.sheet,n,r,o)}_viewChanged(e){if(e.type==="cell"){this._renderRecord(e.row),this._notify();return}this.quiet>0||(this._forgetUndo(),this.render(),this._notify())}_forgetUndo(){const{book:e}=this,t=e.sheets.indexOf(this.sheet),i=s=>s.sheetIndex!==t;e.undoStack=e.undoStack.filter(i),e.redoStack=e.redoStack.filter(i)}_notify(){this._pendingFlush||(this._pendingFlush=!0,queueMicrotask(()=>{this._pendingFlush=!1,this.view.summariesStale&&(this.view.refresh(),this.render()),this.options.onRefresh?.()}))}_renderRecord(e){const t=this.view.rowOfRecord(e);if(t<0||t>=this.dataRows)return;const i=this.range.r0+this.headerRows,s=this.columnCount;this.quiet++;for(let o=0;o<s;o++)this._renderColumn(o,i,t,1);this.quiet--,this._notifyEngine(i+t,i+t,s)}cellWritten(e,t,i,s){if(this.quiet>0||!this.options.editable||i&G||this.options.header&&e===this.range.r0&&t-this.range.c0>=this.view.columns.length)return;const o=t-this.range.c0;if(this.options.header&&e===this.range.r0){(i&F)===f&&this.view.columns[o]&&this._rename(this.view.columns[o],this.book.strings.get(s));return}let n;switch(i&F){case b:n=s;break;case f:n=this.book.strings.get(s);break;case v:n=s!==0;break;case B:n=U[s]??null;break;default:n=null}this._pushValue(e,o,n)}formulaWritten(e,t,i){if(this.quiet>0||!this.options.editable)return;const s=i.f??i.sf;if(s===void 0||!this.book.engine)return;const o=t-this.range.c0;let n;try{n=this.book.engine.template(s,e,t).fn(e,t,this.sheet),n&&n.isCell&&(n=this.book.engine.read(n.sheet,n.r0,n.c0))}catch(r){n=r instanceof N?r:null}T.call(this.sheet,e,t,null),this._pushValue(e,o,n)}_rename(e,t){this.quiet++,this.view.setColumn(e.field,{caption:t}),this.quiet--}_pushValue(e,t,i){const s=e-this.range.r0-this.headerRows,o=this.view.columns[t];let n=this.view.recordAt(s);if(o!==void 0&&s===this.view.count&&this.options.grow&&i!==null){this.quiet++;try{n=this.table.addRow({})}finally{this.quiet--}this.lastRows=this.view.count}if(n<0||o===void 0){queueMicrotask(()=>this.render());return}if(o.readOnly){this.options.onRejected?.(H(o.col.computed?"The {field} field is calculated, so it can't be edited.":"The {field} field is read-only, so it can't be edited.",{field:o.caption})),queueMicrotask(()=>this.render());return}this.quiet++;try{this.table.set(n,o.col,i)}catch(r){if(!(r instanceof Y))throw r;this.options.onRejected?.(r.message),queueMicrotask(()=>this.render())}finally{this.quiet--}}shiftRecords(e,t=!1){if(e.axis!=="row"||!this.options.grow)return;const i=this.range.r0+this.headerRows,s=e.at-i;if(!(s<0||s>this.view.count)){this.quiet++;try{const o=this.removedRecords??(this.removedRecords=[]);if(e.n>0&&t&&o.at(-1)?.length===e.n){for(const n of o.pop())this.table.restoreRow(n);this.view.invalidate($.FILTER),this.view.refresh()}else if(e.n>0){const n=this.view.recordAt(s),r=[];for(let a=0;a<e.n;a++)r.push(this.table.addRow({}));n>=0&&this.view.moveRecords(r,n)}else{const n=[];for(let r=s;r<Math.min(this.view.count,s-e.n);r++){const a=this.view.recordAt(r);a>=0&&n.push(a)}for(const r of n)this.table.removeRow(r);o.push(n)}}finally{this.quiet--}this.render()}}redraw(){this.view.refresh(),this.render()}usedRange(){const{r0:e,c0:t}=this.range;return{r0:e,c0:t,r1:e+this.headerRows+Math.max(this.dataRows,1)-1,c1:t+this.columnCount-1}}exportRows(){const e=this.view.columns.slice(0,this.columnCount),t=[];for(let i=0;i<this.view.count;i++){const s=this.view.map[i];if(s<0)continue;const o={};for(const n of e)o[n.caption]=n.col.get(s);t.push(o)}return{captions:e.map(i=>i.caption),rows:t}}shift(e){const t=this.range;e.axis==="row"?e.at<=t.r0?(t.r0+=e.n,t.r1+=e.n):e.at<=t.r1&&(t.r1+=e.n):e.at<=t.c0?(t.c0+=e.n,t.c1+=e.n):e.at<=t.c1&&(t.c1+=e.n),t.r0=Math.max(0,Math.min(t.r0,O-1)),t.c0=Math.max(0,Math.min(t.c0,X-1))}}function ht(h=x){h.prototype.bindTable=function(t,i,s){return new z(i.table.manager.book,this,t,i,s)},h.prototype.unbindTables=function(){for(const t of[...this.dataBindings??[]])t.unbind()}}export{z as TableBinding,J as hookSheet,ht as installSheetApi,ot as rawCells,P as unhookSheet,at as valueOfWrite,rt as writeRaw};
@@ -0,0 +1 @@
1
+ const p=131072,P=1440;function A(a){return a.map(([t,e])=>[Math.round(t*60),Math.round(e*60)]).filter(([t,e])=>e>t)}const y=a=>{if(typeof a=="number")return Math.floor(a);throw new Error("Calendar dates are serial numbers.")};class m{constructor(t={}){const{name:e="Standard",workDays:r=[!1,!0,!0,!0,!0,!0,!1],holidays:n=[],hours:s=null,weekHours:i=null,exceptions:o=[],weeks:u=[],hoursPerDay:h=null,hoursPerWeek:l=null,daysPerMonth:d=20,weekStart:c=1}=t;if(!r.some(Boolean))throw new Error("A calendar needs at least one working weekday.");this.name=e,this.workDays=r,this.hours=s,this.weekHours=i,this.holidays=new Set(n.map(D=>Math.floor(D))),this.exceptions=o,this.weeks=u,this.fullDays=s===null;const f=h??(s===null?8:s.reduce((D,[w,k])=>D+(k-w),0));this.hoursPerDay=f,this.hoursPerWeek=l??f*r.filter(Boolean).length,this.daysPerMonth=d,this.weekStart=c,this.cum=null,this.patternOf=null,this.patterns=null}unitsPer(t){if(this.fullDays)switch(t){case"min":return 1/(this.hoursPerDay*60);case"h":return 1/this.hoursPerDay;case"w":return this.hoursPerWeek/this.hoursPerDay;case"mo":return this.daysPerMonth;default:return 1}switch(t){case"min":return 1;case"h":return 60;case"w":return this.hoursPerWeek*60;case"mo":return this.daysPerMonth*this.hoursPerDay*60;default:return this.hoursPerDay*60}}_dayPatternKey(t,e){if(this.holidays.has(t))return null;for(const r of this.exceptions)if(t>=y(r.from)&&t<=y(r.to??r.from))return r.off||!r.hours?r.off===!1&&!r.hours?this._weekPattern(t,e):null:r.hours;return this._weekPattern(t,e)}_weekPattern(t,e){for(const r of this.weeks)if(t>=y(r.from)&&t<=y(r.to??r.from))return r.workDays&&!r.workDays[e]?null:r.hours??this.hours??"day";return this.workDays[e]?this.weekHours&&this.weekHours[e]?this.weekHours[e]:this.hours??"day":null}_build(){const t=new Int32Array(131074),e=new Uint16Array(131074),r=[null],n=new Map;let s=0;for(let i=1;i<=131072;i++){t[i]=s;const o=this._dayPatternKey(i,(i-1)%7);if(o===null)continue;if(this.fullDays){e[i]=1,s+=1;continue}const u=o==="day"?"day":JSON.stringify(o);let h=n.get(u);if(h===void 0){const l=o==="day"?[[0,1440]]:A(o);h=r.length,r.push({intervals:l,total:l.reduce((d,[c,f])=>d+f-c,0)}),n.set(u,h)}e[i]=h,s+=r[h].total}if(t[131073]=s,this.cum=t,this.patternOf=e,this.patterns=r,this.totalUnits=s,this.fullDays){const i=new Int32Array(s+1);for(let o=1;o<=131072;o++)e[o]!==0&&(i[t[o]]=o);this.toDate=i}}_ready(){this.cum===null&&this._build()}isWorkDay(t){this._ready();const e=Math.floor(t);return e>=1&&e<=131072&&this.patternOf[e]!==0}isWorkTime(t){this._ready();const e=Math.floor(t);if(e<1||e>131072||this.patternOf[e]===0)return!1;if(this.fullDays)return!0;const r=(t-e)*1440;return this.patterns[this.patternOf[e]].intervals.some(([n,s])=>r>=n&&r<s)}intervalsOf(t){this._ready();const e=this.patternOf[Math.floor(t)];return e===0?[]:this.fullDays?[[0,1440]]:this.patterns[e].intervals}indexOf(t){this._ready();const e=Math.floor(t),r=e<1?1:e>131072?131072:e,n=this.cum[r],s=this.patternOf[r],i=e===r?t-r:0;if(s===0||i<=0)return n;if(this.fullDays)return i>0?n+1:n;const o=Math.round(i*1440);let u=0;for(const[h,l]of this.patterns[s].intervals){if(o<=h)break;u+=Math.min(o,l)-h}return n+u}_dayOfUnit(t){const{cum:e}=this;let r=1,n=131072;for(;r<n;){const s=r+n+1>>>1;e[s]<=t?r=s:n=s-1}return r}momentStart(t){this._ready();const e=t<0?0:t>=this.totalUnits?this.totalUnits-1:t;if(this.fullDays)return this.toDate[e];let r=this._dayOfUnit(e);for(;this.patternOf[r]===0&&r>1;)r--;let n=e-this.cum[r];for(const[s,i]of this.patterns[this.patternOf[r]].intervals){if(n<i-s)return r+(s+n)/1440;n-=i-s}return r+1}momentEnd(t){return t<=0?this.momentStart(0):this.momentStart(t-1)+(this.fullDays?1:1/1440)}nextWork(t){return this.momentStart(this.indexOf(t))}prevEnd(t){return this.momentEnd(this.indexOf(t))}add(t,e){const r=this.indexOf(t);return e<=0?this.momentStart(r+e):this.momentEnd(r+e)}sub(t,e){return this.momentStart(this.indexOf(t)-e)}unitsBetween(t,e){return this.indexOf(e)-this.indexOf(t)}dateOf(t){return Math.floor(this.momentStart(t))}addWorkDays(t,e){if(this.fullDays)return this.momentStart(this.indexOf(t)+e);let r=Math.floor(t),n=e;const s=n<0?-1:1;for(;!this.isWorkDay(r);)r+=1;for(;n!==0;)r+=s,this.isWorkDay(r)&&(n-=s);return r}workDaysBetween(t,e){this._ready();const r=Math.floor(t),n=Math.floor(e);if(this.fullDays)return this.indexOf(n+1)-this.indexOf(r);let s=0;for(let i=r;i<=n;i++)this.isWorkDay(i)&&s++;return s}toJSON(){return{name:this.name,workDays:this.workDays,hours:this.hours,weekHours:this.weekHours,holidays:[...this.holidays],exceptions:this.exceptions,weeks:this.weeks,hoursPerDay:this.hoursPerDay,hoursPerWeek:this.hoursPerWeek,daysPerMonth:this.daysPerMonth,weekStart:this.weekStart}}}const S={days:{},standard:{name:"Standard",hours:[[8,12],[13,17]]},nightShift:{name:"Night Shift",workDays:[!1,!0,!0,!0,!0,!0,!0],hours:[[0,3],[4,8],[23,24]],hoursPerDay:8},allHours:{name:"24 Hours",workDays:[!0,!0,!0,!0,!0,!0,!0],hours:[[0,24]],hoursPerDay:24}};function E(a){if(a instanceof m)return a;if(typeof a=="string"){const t=S[a];if(!t)throw new Error(`No calendar named ${a}.`);return new m(t)}return new m(a??{})}export{S as CALENDAR_PRESETS,m as WorkCalendar,E as makeCalendar};
@@ -0,0 +1 @@
1
+ import{getFormatter as M}from"../core/numfmt.js";const E=500,O=64e6;function S(n){return Math.max(1,Math.floor(O/Math.max(1,n.table.capacity)))}const _=n=>{const l=typeof n.cross=="string"?{over:n.cross}:n.cross;return{...l,agg:l.agg??"sum"}};function x(n,l,u){const{table:s}=n,e=l.indexOf(".");if(e>0){const t=s.manager.relationshipTo(s,l.slice(0,e));if(t&&t.to===s&&t.from!==s){const r=l.slice(0,e+1);return{table:t.from,relation:t,over:l.slice(e+1),value:u?.startsWith(r)?u.slice(r.length):u}}}return{table:s,relation:null,over:l,value:u}}const k=(n,l)=>l==null?"(blank)":n.type==="date"&&typeof l=="number"?M(n.format).number(l):String(l);function v(n,l,u){const{table:s}=n,e=s.column(n.over);if(!e)return[];s.ensure(e);const t=l?u(s,l):null,r=new Map;for(let i=0;i<s.rowCount;i++){if(s.alive[i]===0)continue;if(t!==null){const g=t.get(i);if(g!==!0&&!(typeof g=="number"&&g!==0))continue}const a=e.get(i);if(r.has(a)||r.set(a,i),r.size>E)break}const c=[...r.entries()].map(([i,a])=>({value:i,row:a}));return c.sort((i,a)=>i.value===null?1:a.value===null?-1:typeof i.value=="number"&&typeof a.value=="number"?i.value-a.value:String(i.value).localeCompare(String(a.value))),c}function C(n,l,u,s){const{table:e}=n;let t=e.byName.get(l);if(!t){const r=s&&u?u.type:"number";t=e.addHelper({name:l,type:r==="any"?"any":r,format:u?.format??"General",hidden:!0})}return t}function A(n,l,u,s,e,t){return{def:n,col:l,field:l.name,caption:s,format:n.format??u?.format??"General",width:typeof n.width=="number"?n.width:null,pinned:!1,readOnly:!0,align:n.align??null,allowSort:!0,allowFilter:!0,showNullAs:n.showNullAs??null,showEmptyAs:n.showEmptyAs??null,display:null,style:n.style??null,headerStyle:n.headerStyle??null,headerFit:"normal",captionPath:e,cellType:null,validator:null,conditionalFormats:n.conditionalFormats??null,sparkline:n.sparkline??null,...t}}function G(n,l,u){const s=_(l),e=x(n,s.over,l.field),t=e.table.column(e.value),r=e.table.column(e.over);if(!r)return[];const c=e.relation===null,i=n.spec.options.showCrossValueHeader!==!1,a=s.caption??l.caption??t?.caption??l.field,g=(s.attributes??[]).map(p=>typeof p=="string"?{value:p}:p);n._useCrossSource(e.table);const w=v(e,s.filter,u),b=S(n);return w.length>b&&(n.truncatedColumns=w.length-b),w.slice(0,b).map(({value:p,row:m})=>{const f=k(r,p),o=C(n,`__cross:${s.over}|${l.field}|${s.agg}|${p}`,t,c),d=g.map(h=>{const $=e.table.column(h.value);return $?k($,$.get(m)):""}),y=[...i?[a]:[],...d,f];return A(l,o,t,f,y.length>1?y:null,{generated:"cross",fill:{source:e,value:p,agg:s.agg},summaryAgg:s.agg})})}function L(n,l){const u=[];return n.spec.groups.forEach((s,e)=>{for(const t of s.summaries??[]){if(!t.slice&&!t.own)continue;const r=typeof t.slice=="string"?t.slice:t.slice?.field??null,c=typeof t.slice=="object"&&t.slice!==null?t.slice:{},i=t.field?n.table.column(t.field):null,a=t.agg??"sum",g=t.caption??`${a.charAt(0).toUpperCase()}${a.slice(1)} of ${i?.caption??t.field}`,w={format:t.format,style:c.style??t.style,width:c.width??t.width};if(r===null){const o=C(n,`__cross:own|${e}|${t.field}|${a}`,i,!0);u.push(A(w,o,i,g,null,{generated:"summary",summaryOnly:!0,sliceLevel:e,summaryAgg:a,fill:{source:{table:n.table,relation:null,over:null,value:t.field},agg:a}}));continue}const b={table:n.table,relation:null,over:r,value:t.field},p=n.table.column(r);if(!p)continue;const m=v(b,c.filter,l),f=S(n);m.length>f&&(n.truncatedColumns=m.length-f);for(const{value:o}of m.slice(0,f)){const d=k(p,o),y=C(n,`__cross:slice|${e}|${r}|${t.field}|${a}|${o}`,i,!0);u.push(A(w,y,i,d,[g,d],{generated:"slice",summaryOnly:!0,sliceLevel:e,summaryAgg:a,fill:{source:b,value:o,agg:a}}))}}}),u}const F=n=>n.isString?-1:NaN;function N(n,l){if(l.kinds!==null)return{ofRow:t=>l.get(t),ofValue:t=>t};const{data:u}=l,s=l.isString?-1:null,{strings:e}=n.manager;return{ofRow:t=>{const r=u[t];return r!==r||r===s?null:r},ofValue:t=>t===null?null:typeof t=="string"?e.add(t):t===!0?1:t===!1?0:t}}function T(n,l){const{table:u}=n,s=new Map;for(const e of l){if(!e.fill)continue;const{source:t}=e.fill,r=`${t.table.name}|${t.relation?.name??""}|${t.over??""}|${t.value??""}|${e.fill.agg}`;s.has(r)||s.set(r,{source:t,agg:e.fill.agg,list:[]}),s.get(r).list.push(e);const c=e.col;c.data.fill(F(c),0,c.data.length),c.kinds=null,c.revision++,c.rankCache=null}for(const{source:e,agg:t,list:r}of s.values()){const c=e.value?e.table.column(e.value):null;c&&e.table.ensure(c);const i=e.over?e.table.column(e.over):null;i&&e.table.ensure(i);const a=i?N(e.table,i):null,g=new Map;for(const m of r)g.set(a?a.ofValue(m.fill.value):0,m.col);if(e.relation===null){const m=c!==null&&c.kinds===null;for(let f=0;f<u.rowCount;f++){if(u.alive[f]===0)continue;const o=g.get(a?a.ofRow(f):0);if(o!==void 0)if(m&&o.isString===c.isString&&o.kinds===null)o.data[f]=c.data[f];else{const d=c?c.get(f):1;d!=null&&o.put(f,o.coerce(d))}}continue}const w=e.relation.parents(),b=e.table,p=t==="average"?new Map:null;for(let m=0;m<b.rowCount;m++){if(b.alive[m]===0)continue;const f=g.get(a?a.ofRow(m):0);if(f===void 0)continue;const o=w[m];if(o<0||u.alive[o]===0)continue;const d=c?c.get(m):1,y=typeof d=="number"?d:d===!0?1:0,{data:h}=f,$=h[o]===h[o];switch(t){case"count":h[o]=($?h[o]:0)+1;break;case"min":h[o]=$?Math.min(h[o],y):y;break;case"max":h[o]=$?Math.max(h[o],y):y;break;default:h[o]=($?h[o]:0)+y}p&&(p.has(f)||p.set(f,new Int32Array(u.rowCount)),p.get(f)[o]++)}if(p)for(const[m,f]of p)for(let o=0;o<u.rowCount;o++)f[o]>0&&(m.data[o]/=f[o])}}export{G as crossColumnsOf,T as fillGenerated,L as sliceColumnsOf};
@@ -0,0 +1 @@
1
+ import{BOOL as E,EMPTY as b,ERR as D,ERRORS as P,KIND_MASK as T,NUM as k,STR as N}from"../core/sheet.js";import{partsToSerial as H}from"../core/numfmt.js";import{StringTable as L}from"../core/strings.js";import{ERR_BY_CODE as $,ERR_BY_INDEX as V,numberToText as z,textToNumber as j,XlError as x}from"../calc/values.js";import{parseInput as q}from"../core/input.js";import{rankStrings as B}from"./sort.js";import{computeWindow as K}from"./window.js";import{checkValidator as Y,flattenRecord as X,parseSource as W,readField as J,readRemote as Q,sendChanges as I}from"./remote.js";import{t as _}from"../i18n/index.js";const Z=["number","date","boolean","string","any"],tt=new Set(["number","date","boolean"]),u={UNCHANGED:0,INSERTED:1,UPDATED:2,PURGED:3},et=256;class m extends Error{}class O{constructor(t,e,i){if(this.table=t,this.index=i,this.name=e.name,this.caption=e.caption??e.name,this.type=e.type??"any",!Z.includes(this.type))throw new m(`Unknown field type: ${this.type}`);this.format=e.format??(this.type==="date"?"yyyy-mm-dd":"General"),this.readOnly=e.readOnly===!0,this.defaultValue=e.defaultValue??null,this.width=e.width??null,this.hidden=e.hidden===!0,this.formula=e.formula??null,this.lookup=e.lookup??null,this.rollup=e.rollup??null,this.window=e.window??null,this.required=e.required===!0,this.showNullAs=e.showNullAs??null,this.validator=e.validator??null,this.trigger=e.trigger??null,this.computed=this.formula!==null||this.lookup!==null||this.rollup!==null||this.window!==null,this.stale=this.computed,this.deps=[],this.rangeDep=!1,this.compiled=null,this.revision=0,this.rankCache=null,this.styles=null,this.kinds=null,this.data=this.type==="string"?new Int32Array(t.capacity).fill(-1):new Float64Array(t.capacity).fill(NaN)}get isString(){return this.type==="string"}get isNumeric(){return tt.has(this.type)||this.type==="any"&&this.kinds===null}_grow(t){const e=this.data,i=this.isString?new Int32Array(t).fill(-1):new Float64Array(t).fill(NaN);if(i.set(e),this.data=i,this.kinds!==null){const n=new Uint8Array(t);n.set(this.kinds),this.kinds=n}if(this.styles!==null){const n=new Uint16Array(t);n.set(this.styles),this.styles=n}}kind(t){if(this.isString)return this.data[t]<0?b:N;if(this.kinds!==null)return this.kinds[t];const e=this.data[t];return e!==e?b:this.type==="boolean"?E:k}raw(t){return this.data[t]}get(t){switch(this.stale&&this.table.ensure(this),this.kind(t)){case k:return this.data[t];case N:return this.table.manager.strings.get(this.data[t]);case E:return this.data[t]!==0;case D:return V[this.data[t]]??null;default:return null}}put(t,e){const{strings:i}=this.table.manager;if(this.isString){this.data[t]=e===null?-1:i.add(String(e));return}if(this.kinds===null){if(typeof e=="number"){this.data[t]=e;return}if(e===null){this.data[t]=NaN;return}if(this.type==="boolean"){this.data[t]=e?1:0;return}this.kinds=new Uint8Array(this.data.length);const n=this.table.rowCount,{data:s,kinds:r}=this;for(let o=0;o<n;o++)r[o]=s[o]!==s[o]?b:k}e===null?(this.kinds[t]=b,this.data[t]=0):typeof e=="number"?(this.kinds[t]=k,this.data[t]=e):typeof e=="string"?(this.kinds[t]=N,this.data[t]=i.add(e)):typeof e=="boolean"?(this.kinds[t]=E,this.data[t]=e?1:0):e instanceof x?(this.kinds[t]=D,this.data[t]=e.index):(this.kinds[t]=b,this.data[t]=0)}coerce(t){if(t==null)return null;if(t==="")return this.type==="string"?"":null;switch(t instanceof Date&&(t=H(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate())+t.getTime()%864e5/864e5),this.type){case"string":return typeof t=="string"?t:typeof t=="number"?z(t):typeof t=="boolean"?t?"TRUE":"FALSE":t instanceof x?t.code:String(t);case"number":case"date":{if(typeof t=="number")return t;if(typeof t=="boolean")return t?1:0;if(typeof t=="string"){const e=q(t);if(e.kind===k)return e.value;const i=j(t);if(i!=null&&!Number.isNaN(i))return i}throw new m(_(this.type==="date"?`"{value}" isn't a date, which the {field} field needs.`:`"{value}" isn't a number, which the {field} field needs.`,{value:t,field:this.caption}))}case"boolean":if(typeof t=="boolean")return t;if(t===1||t===0)return t===1;if(typeof t=="string"){const e=t.trim().toLowerCase();if(e==="true"||e==="yes")return!0;if(e==="false"||e==="no")return!1}throw new m(_(`"{value}" isn't TRUE or FALSE, which the {field} field needs.`,{value:t,field:this.caption}));default:return t}}ranks(){const{strings:t}=this.table.manager;if(this.rankCache!==null&&this.rankCache.revision===this.revision&&this.rankCache.size===t.size)return this.rankCache;const e=this.table.rowCount,i=new Uint8Array(t.size),{data:n,kinds:s}=this,r=[];if(this.isString)for(let l=0;l<e;l++){const a=n[l];a>=0&&i[a]===0&&(i[a]=1,r.push(a))}else if(s!==null){for(let l=0;l<e;l++)if(s[l]===N){const a=n[l];i[a]===0&&(i[a]=1,r.push(a))}}const{rank:o,count:h}=B(t,r,t.size);return this.rankCache={rank:o,count:h,revision:this.revision,size:t.size},this.rankCache}}class it{constructor(t,e){if(this.manager=t,this.from=t.table(e.from),this.to=t.table(e.to),this.fromField=e.fromField,this.toField=e.toField??e.to_field??this.to.key,this.name=e.name,this.inverse=e.inverse??null,!this.from.column(this.fromField))throw new m(_("No field {field} in {table}",{field:this.fromField,table:this.from.name}));if(!this.toField||!this.to.column(this.toField))throw new m(_("No key field in {table}",{table:this.to.name}));this._parents=null,this._children=null,this._stamp=-1}_currentStamp(){return this.from.structureRevision*4096+this.to.structureRevision}_check(){const t=this._currentStamp();t!==this._stamp&&(this._stamp=t,this._parents=null,this._children=null)}parents(){if(this._check(),this._parents!==null)return this._parents;const t=this.from.column(this.fromField),e=this.to.column(this.toField);this.from.ensure(t),this.to.ensure(e);const i=this.from.rowCount,n=new Int32Array(this.from.capacity).fill(-1);if(t.isString===e.isString&&t.kinds===null&&e.kinds===null){const s=st(e,this.to),{data:r}=t,o=t.isString?-1:NaN;for(let h=0;h<i;h++){const l=r[h];l===o||l!==l||(n[h]=s(l))}}else{const s=new Map;for(let r=this.to.rowCount-1;r>=0;r--)this.to.alive[r]&&s.set(String(e.get(r)),r);for(let r=0;r<i;r++){const o=t.get(r);o!==null&&(n[r]=s.get(String(o))??-1)}}return this._parents=n,n}children(){if(this._check(),this._children!==null)return this._children;const t=this.parents(),e=this.from.rowCount,i=this.to.rowCount,n=new Int32Array(i+2),{alive:s}=this.from;for(let o=0;o<e;o++){const h=t[o];h>=0&&s[o]&&n[h+2]++}for(let o=0;o<i;o++)n[o+2]+=n[o+1];const r=new Int32Array(n[i+1]);for(let o=0;o<e;o++){const h=t[o];h>=0&&s[o]&&(r[n[h+1]++]=o)}return this._children={starts:n,rows:r},this._children}childRows(t){const{starts:e,rows:i}=this.children();return i.subarray(e[t],e[t+1])}}function st(c,t){const{data:e}=c,i=t.rowCount;let n=1/0,s=-1/0,r=!0;for(let h=0;h<i;h++){const l=e[h];l!==l||!t.alive[h]||(l<n&&(n=l),l>s&&(s=l),l!==Math.floor(l)&&(r=!1))}if(r&&s-n<i*4+1024){const h=new Int32Array(s-n+1>0?s-n+1:0).fill(-1);for(let l=i-1;l>=0;l--){const a=e[l];a===a&&t.alive[l]&&(!c.isString||a>=0)&&(h[a-n]=l)}return l=>l>=n&&l<=s&&l===Math.floor(l)?h[l-n]:-1}const o=new Map;for(let h=i-1;h>=0;h--){const l=e[h];l===l&&t.alive[h]&&o.set(l,h)}return h=>o.get(h)??-1}function mt(c,t="children",e="level"){const i=[],n=[];for(let s=c.length-1;s>=0;s--)n.push([c[s],0]);for(;n.length>0;){const[s,r]=n.pop(),{[t]:o,...h}=s;if(i.push({...h,[e]:r}),Array.isArray(o))for(let l=o.length-1;l>=0;l--)n.push([o[l],r+1])}return i}const nt={SUM:"sum",COUNT:"count",COUNTA:"count",AVERAGE:"average",AVG:"average",MIN:"min",MAX:"max"};class M{constructor(t,e,i={}){this.manager=t,this.name=e,this.capacity=Math.max(et,i.capacity??0),this.rowCount=0,this.columns=[],this.byName=new Map,this.alive=new Uint8Array(this.capacity),this.state=new Uint8Array(this.capacity),this.deletedCount=0,this.originals=new Map,this.listeners=new Set,this.revision=0,this.structureRevision=0,this.key=i.key??null,this.tracking=i.tracking!==!1,this.provider=i.provider??null,this.batchDepth=0,this.batchChanged=!1,this.indexes=new Map,this.views=new Map,this.windowDefs=i.windows??{},this.schema=i.schema??null,this.remote=i.remote??null,this.autoSync=i.autoSync===!0,this.batchSync=i.batch===!0,this.rowErrors=new Map,this.fetched=!1,this.fetching=null,this.triggers=[],this.options=i;for(const n of i.fields??[])this.addField(n);i.indexes&&this.createIndexes(i.indexes),i.data&&this.load(i.data)}createIndexes(t){for(const e of t)this.column(e)&&this.indexes.set(e,null)}dropIndexes(t){for(const e of t)this.indexes.delete(e)}clearIndexes(){this.indexes.clear()}getIndexes(){return[...this.indexes.keys()]}searchRows(t,e){const i=this.column(e);if(!i)return[];if(this.ensure(i),this.indexes.has(e)){let r=this.indexes.get(e);if(r===null){r=new Map;const o=this.rowCount;for(let h=0;h<o;h++){if(this.alive[h]===0)continue;const l=i.get(h);if(l===null)continue;const a=r.get(l);a===void 0?r.set(l,[h]):a.push(h)}this.indexes.set(e,r)}return r.get(t)??[]}const n=[],s=this.rowCount;for(let r=0;r<s;r++)this.alive[r]===1&&i.get(r)===t&&n.push(r);return n}search(t,e){return this.searchRows(t,e).map(i=>this.record(i))}_dropIndexOf(t){this.indexes.has(t.name)&&this.indexes.set(t.name,null)}_dropAllIndexes(){for(const t of this.indexes.keys())this.indexes.set(t,null)}ensureOrderColumn(){let t=this.byName.get("__order");if(!t){t=this.addHelper({name:"__order",type:"number",hidden:!0});for(let e=0;e<this.rowCount;e++)t.data[e]=e}return t}column(t){const e=this.byName.get(t);if(e!==void 0)return e;if(typeof t=="string"&&t.includes("."))return this._pathColumn(t)}get fields(){return this.columns.filter(t=>t!==null&&!t.hidden)}addField(t){if(this.byName.has(t.name))throw new m(_("The field {field} already exists in {table}.",{field:t.name,table:this.name}));const e=new O(this,t,this.columns.length);return this.columns.push(e),this.byName.set(e.name,e),e.formula!==null&&this.manager.formulas.bind(e),e.trigger&&this.triggers.push(e),this.computedOrder=null,this.revision++,this._emit({type:"schema"}),e}removeField(t){const e=this.byName.get(t);if(e){this.byName.delete(t),this.columns[e.index]=null,this.computedOrder=null,this.revision++;for(const i of this.columns)i&&i.computed&&(i.stale=!0);this._emit({type:"schema"})}}setFormula(t,e){const i=this.byName.get(t);if(!i)throw new m(`No field ${t} in ${this.name}`);i.formula=e,i.computed=!0,i.stale=!0,this.manager.formulas.bind(i),this.computedOrder=null,this._markDependentsStale(i),this.revision++,this._emit({type:"reload"})}_pathColumn(t){const e=t.indexOf("."),i=t.slice(0,e),n=t.slice(e+1),s=this.manager.relationshipFrom(this,i);if(!s)return;const r=s.to.column(n);if(r)return this.addHelper({name:t,type:r.type==="string"?"string":r.type,format:r.format,caption:r.caption,readOnly:!0,hidden:!0,lookup:{relation:s,field:n}})}addHelper(t){const e=new O(this,t,this.columns.length);return this.columns.push(e),this.byName.set(e.name,e),this.computedOrder=null,e}rollupColumn(t,e){const i=`${t}(${e})`,n=this.byName.get(i);if(n)return n;const s=e.indexOf(".");if(s<0)return;const r=this.manager.relationshipTo(this,e.slice(0,s)),o=nt[t];if(!r||!o)return;const h=e.slice(s+1);if(r.from.column(h))return this.addHelper({name:i,type:"number",readOnly:!0,hidden:!0,rollup:{relation:r,field:h,agg:o}})}ensure(t){t.stale&&(t.stale=!1,t.window!==null?K(t):t.formula!==null?this.manager.formulas.computeAll(t):t.lookup!==null?this._computeLookup(t):t.rollup!==null&&this._computeRollup(t),t.revision++)}ensureAll(){for(const t of this.columns)t!==null&&t.stale&&this.ensure(t)}_computeLookup(t){const{relation:e,field:i}=t.lookup,n=e.parents(),s=e.to.column(i);e.to.ensure(s);const r=this.rowCount,{data:o}=t,h=s.data;if(t.isString&&s.isString)for(let l=0;l<r;l++){const a=n[l];o[l]=a<0?-1:h[a]}else if(!t.isString&&!s.isString&&s.kinds===null){t.kinds=null;for(let l=0;l<r;l++){const a=n[l];o[l]=a<0?NaN:h[a]}}else for(let l=0;l<r;l++){const a=n[l];t.put(l,a<0?null:s.get(a))}}_computeRollup(t){const{relation:e,field:i,agg:n}=t.rollup,s=e.from.column(i);e.from.ensure(s);const{starts:r,rows:o}=e.children(),h=this.rowCount,{data:l}=t,a=s.data,p=s.isNumeric;for(let f=0;f<h;f++){const d=r[f],w=r[f+1];let y=0,g=0,v=1/0,R=-1/0;for(let A=d;A<w;A++){const U=o[A];if(!p){s.kind(U)!==b&&g++;continue}const C=a[U];C===C&&(y+=C,g++,C<v&&(v=C),C>R&&(R=C))}switch(n){case"sum":l[f]=y;break;case"count":l[f]=g;break;case"average":l[f]=g>0?y/g:NaN;break;case"min":l[f]=g>0?v:NaN;break;default:l[f]=g>0?R:NaN}}}_order(){if(this.computedOrder)return this.computedOrder;const t=[],e=new Set,i=n=>{if(!e.has(n)){e.add(n);for(const s of n.deps){const r=this.column(s);r&&r.computed&&i(r)}t.push(n)}};for(const n of this.columns)n&&n.computed&&i(n);return this.computedOrder=t,t}_reserve(t){if(t<=this.capacity)return;let e=this.capacity;for(;e<t;)e*=2;for(const n of this.columns)n!==null&&n._grow(e);const i=n=>{const s=new Uint8Array(e);return s.set(n),s};this.alive=i(this.alive),this.state=i(this.state),this.capacity=e}get liveCount(){return this.rowCount-this.deletedCount}load(t){this.schema&&(t=W(t,this.schema)),Array.isArray(t)&&t.length>0&&this.schema?.spread&&(t=t.map(r=>X(r)));const e=Array.isArray(t)?t:null;if(e!==null&&this.columns.length===0&&e.length>0&&this._inferFields(e),e===null)return this._loadColumns(t);const i=e.length;this._reserve(i);const n=this.columns.filter(r=>r!==null&&!r.computed),s=i>0&&Array.isArray(e[0]);for(const r of n)r.rankCache=null,r.kinds=null,r.data.fill(r.isString?-1:NaN,0,this.capacity);this.rowCount=i;for(let r=0;r<n.length;r++){const o=n[r];for(let h=0;h<i;h++){const l=s?e[h][r]:J(e[h],o.name);l!=null&&o.put(h,o.coerce(l))}}return this._afterLoad(i),i}_loadColumns(t){let e=0;for(const i of Object.values(t))e=Math.max(e,i.length);this._reserve(e),this.rowCount=e;for(const[i,n]of Object.entries(t)){let s=this.byName.get(i);if(!s){const r=n.length>0?n[0]:null;s=this.addField({name:i,type:ArrayBuffer.isView(n)||typeof r=="number"?"number":typeof r=="boolean"?"boolean":"string"}),this._reserve(e)}if(s.rankCache=null,ArrayBuffer.isView(n)&&!s.isString)s.kinds=null,s.data.set(n),n.length<this.capacity&&s.data.fill(NaN,n.length);else if(s.isString&&n instanceof Int32Array)s.data.set(n);else for(let r=0;r<n.length;r++){const o=n[r];o!=null&&s.put(r,s.coerce(o))}}return this._afterLoad(e),e}_afterLoad(t){this._dropAllIndexes(),this.rowErrors.clear(),this.alive.fill(1,0,t),this.alive.fill(0,t),this.state.fill(0),this.originals.clear(),this.deletedCount=0,this.revision++,this.structureRevision++,this._markAllComputedStale(),this.manager._tableChanged(this),this._emit({type:"reload"})}_inferFields(t){const e=t[0];if(Array.isArray(e)){e.forEach((s,r)=>this.addField({name:`Field${r+1}`,type:S(t,r)}));return}const i=new Set,n=Math.min(t.length,200);for(let s=0;s<n;s++)for(const r of Object.keys(t[s]))i.add(r);for(const s of i)this.addField({name:s,type:S(t,s)})}loadSheet(t,e,i,{header:n=!0}={}){const s=[],{strings:r}=t;for(let a=i.c0;a<=i.c1;a++){const f=(e.kind(i.r0,a)&T)===N?r.get(e.value(i.r0,a)):"";s.push(n&&f?f:`Field${a-i.c0+1}`)}const o=n?i.r0+1:i.r0,h=Math.max(0,i.r1-o+1),l=(a,p)=>{const f=e.kind(a,p)&T,d=e.value(a,p);return f===k?d:f===N?r.get(d):f===E?d!==0:f===D?$.get(P[d])??null:null};return s.forEach((a,p)=>{if(this.byName.has(a))return;const f=[];for(let g=o;g<=Math.min(o+199,o+h-1);g++)f.push([l(g,i.c0+p)]);const d=t.styles?.get(e.style(o,i.c0+p)),w=d&&/[ymd]/i.test(String(d.numFmt??"").replace(/"[^"]*"/g,"")),y=S(f,0);this.addField({name:a,type:y==="number"&&w?"date":y,format:d?.numFmt!=="General"?d?.numFmt:void 0})}),this._reserve(h),this.rowCount=h,s.forEach((a,p)=>{const f=this.byName.get(a),d=i.c0+p;f.rankCache=null;for(let w=0;w<h;w++){const y=l(o+w,d);f.put(w,y instanceof x?null:f.coerce(y))}}),this._afterLoad(h),h}addRow(t={},{track:e=!0}={}){const i=this.rowCount;this._reserve(i+1),this.rowCount=i+1,this.alive[i]=1,this.state[i]=e&&this.tracking?u.INSERTED:u.UNCHANGED;for(const s of this.columns){if(s===null||s.computed)continue;let r=t[s.name]!==void 0?t[s.name]:s.defaultValue;typeof r=="string"&&r[0]==="="&&t[s.name]===void 0&&(r=this.manager.formulas.evaluateOnce(this,i,r)),s.put(i,r==null?null:s.coerce(r)),s.rankCache=null}const n=this.byName.get("__order");return n&&(n.data[i]=t.__order??this._nextOrder(n.data)),this._dropAllIndexes(),this._runTriggers(i,!0),this._rowsChanged(i),this._emit({type:"rows",row:i,added:!0}),i}_nextOrder(t){let e=-1;for(let i=0;i<this.rowCount;i++)t[i]>e&&(e=t[i]);return e+1}_runTriggers(t,e){for(const i of this.triggers){if(!e&&i.trigger.when!=="newAndUpdate")continue;const n=this.manager.formulas.evaluateOnce(this,t,i.trigger.formula);i.put(t,n instanceof x?null:i.coerce(n)),i.revision++}}removeRow(t){return this.alive[t]?(this.alive[t]=0,this.deletedCount++,this._dropAllIndexes(),this._rowsChanged(t),this._emit({type:"rows",row:t,removed:!0}),this._autoPush(),!0):!1}restoreRow(t){return this.alive[t]?!1:(this.alive[t]=1,this.deletedCount--,this.state[t]===u.PURGED&&(this.state[t]=u.UNCHANGED),this._rowsChanged(t),this._emit({type:"rows",row:t,added:!0}),!0)}_rowsChanged(t){this.revision++,this.structureRevision++;for(const e of this._order())this._recomputeRowOrAll(e,t);this.manager._tableChanged(this)}_recomputeRowOrAll(t,e){t.stale||(t.formula!==null&&!t.rangeDep&&e<this.rowCount?this.manager.formulas.computeRow(t,e):t.stale=!0)}_markAllComputedStale(){for(const t of this.columns)t!==null&&t.computed&&(t.stale=!0)}_markDependentsStale(t){for(const e of this._order())e!==t&&e.deps.includes(t.name)&&(e.stale=!0,this._markDependentsStale(e))}get(t,e){const i=this.column(e);if(!i)throw new m(`No field ${e} in ${this.name}`);return i.get(t)}set(t,e,i){const n=typeof e=="string"?this.column(e):e;if(!n)throw new m(`No field ${e} in ${this.name}`);if(n.computed)throw new m(_("The {field} field is calculated, so it can't be edited.",{field:n.caption}));if(n.readOnly)throw new m(_("The {field} field is read-only.",{field:n.caption}));const s=n.coerce(i),r=n.get(t);if(G(r,s))return!1;if(n.validator!==null){const o=Y(n,s,t);if(o)throw new m(o)}if(n.required&&(s===null||s===""))throw new m(_("The {field} field can't be blank.",{field:n.caption}));return this.tracking&&this.state[t]!==u.INSERTED&&this._track(t,n,r,s),n.put(t,s),n.revision++,this._dropIndexOf(n),this.triggers.length>0&&this._runTriggers(t,!1),this._afterEdit(t,n),this._autoPush(),!0}_track(t,e,i,n){let s=this.originals.get(t);s===void 0&&(s=new Map,this.originals.set(t,s)),s.has(e.index)?G(s.get(e.index),n)&&s.delete(e.index):s.set(e.index,i),s.size===0?(this.originals.delete(t),this.state[t]=u.UNCHANGED):this.state[t]=u.UPDATED}_afterEdit(t,e){this.revision++;const i=new Set([e.name]);let n=this.manager.isKeyField(this,e.name);for(const s of this._order())s.deps.some(r=>i.has(r))&&(i.add(s.name),s.rangeDep||s.formula===null?s.stale=!0:s.stale||this.manager.formulas.computeRow(s,t),this.manager.isKeyField(this,s.name)&&(n=!0));n&&this.structureRevision++,this.manager._fieldChanged(this,i),this._emit({type:"cell",row:t,col:e})}batch(t){this.batchDepth++;try{return t()}finally{this.batchDepth--,this.batchDepth===0&&this.batchChanged&&(this.batchChanged=!1,this._emit({type:"reload"}))}}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}_emit(t){if(this.batchDepth>0){this.batchChanged=!0;return}for(const e of this.listeners)e(t)}getChanges(){const t=[],e=[],i=[],n=this.rowCount,{state:s,alive:r}=this;for(let o=0;o<n;o++)if(s[o]!==u.PURGED){if(s[o]===u.INSERTED)r[o]&&t.push(Object.defineProperty(this.record(o),"__row",{value:o,enumerable:!1}));else if(!r[o])i.push({row:o,record:this.originalRecord(o)});else if(s[o]===u.UPDATED){const h=this.originals.get(o),l={},a={};for(const[p,f]of h){const d=this.columns[p];l[d.name]=d.get(o),a[d.name]=f}e.push({row:o,record:this.record(o),changes:l,original:a})}}return{inserted:t,updated:e,deleted:i}}get hasChanges(){if(this.originals.size>0)return!0;const{state:t,alive:e}=this;for(let i=0;i<this.rowCount;i++)if(t[i]===u.INSERTED?e[i]===1:t[i]!==u.PURGED&&e[i]===0)return!0;return!1}originalValue(t,e){return this.originals.get(t)?.get(e.index)}isCellEdited(t,e){return this.originals.get(t)?.has(e.index)===!0}record(t){const e={};for(const i of this.columns)i!==null&&!i.hidden&&(e[i.name]=i.get(t));return e}originalRecord(t){const e=this.record(t),i=this.originals.get(t);if(i)for(const[n,s]of i)e[this.columns[n].name]=s;return e}acceptChanges(){this.originals.clear();const t=this.rowCount,{state:e,alive:i}=this;for(let n=0;n<t;n++)e[n]=i[n]?u.UNCHANGED:u.PURGED;this.revision++,this._emit({type:"cells"})}rejectChanges(){this.batch(()=>{for(const[s,r]of this.originals)for(const[o,h]of r){const l=this.columns[o];l.put(s,h),l.revision++}this.originals.clear();const t=this.rowCount,{state:e,alive:i}=this;let n=0;for(let s=0;s<t;s++)e[s]===u.INSERTED?(i[s]=0,e[s]=u.PURGED):e[s]!==u.PURGED&&(i[s]=1,e[s]=u.UNCHANGED),i[s]===0&&n++;this.deletedCount=n,this.structureRevision++,this.revision++,this._markAllComputedStale(),this.manager._tableChanged(this),this.batchChanged=!0})}revertRow(t){const e=this.originals.get(t);if(e){for(const[i,n]of e){const s=this.columns[i];s.put(t,n),s.revision++,this._afterEdit(t,s)}this.originals.delete(t),this.state[t]=u.UNCHANGED}if(this.state[t]===u.INSERTED){this.state[t]=u.PURGED,this.removeRow(t);return}this.alive[t]||this.restoreRow(t),this._emit({type:"cell",row:t})}connect(t){this.remote=t,this.provider=null}fetch(t=!1){return this.fetched&&!t?Promise.resolve(this):this.fetching?this.fetching:!this.remote&&this.options.data===void 0&&!t?(this.fetched=!0,Promise.resolve(this)):this.remote?(this.fetching=Q(this.remote,this.schema).then(e=>(this.load(e),this.fetched=!0,this.fetching=null,this),e=>{throw this.fetching=null,e}),this.fetching):Promise.resolve(this)}pull(){return this.fetch(!0)}_autoPush(){!this.autoSync||!this.remote||this.batchDepth>0||this._pushing||(this._pushing=!0,queueMicrotask(()=>{this._pushing=!1,this.submitChanges().catch(()=>{})}))}async submitChanges(){if(!this.remote)throw new m(_("{table} has no data source to write to.",{table:this.name}));const t=this.getChanges(),e=await I(this,t);return this.rowErrors=e.errors,e.errors.size===0?this.acceptChanges():this._acceptExcept(e.errors),this._emit({type:"cells"}),e.counts}push(){return this.submitChanges()}cancelChanges(){this.rejectChanges()}_acceptExcept(t){const e=this.rowCount,{state:i,alive:n}=this;for(let s=0;s<e;s++)t.has(s)||(this.originals.delete(s),i[s]=n[s]?u.UNCHANGED:u.PURGED);this.revision++}async saveRow(t){if(!this.remote){this.originals.delete(t),this.state[t]=this.alive[t]?u.UNCHANGED:u.PURGED,this._emit({type:"cells"});return}const e=this.getChanges(),i={inserted:e.inserted.filter(s=>s.__row===t),updated:e.updated.filter(s=>s.row===t),deleted:e.deleted.filter(s=>s.row===t)},n=await I(this,i);n.errors.has(t)?this.rowErrors.set(t,n.errors.get(t)):(this.rowErrors.delete(t),this.originals.delete(t),this.state[t]=this.alive[t]?u.UNCHANGED:u.PURGED),this._emit({type:"cells"})}resetRow(t){this.rowErrors.delete(t),this.revertRow(t)}missingRequired(t){const e=[];for(const i of this.columns)i!==null&&i.required&&(i.kind(t)===b||i.get(t)==="")&&e.push(i.caption);return e}}const G=(c,t)=>c===t?!0:c===null||t===null||typeof c=="string"&&typeof t=="string"?!1:typeof c=="boolean"&&typeof t=="number"?(c?1:0)===t:typeof c=="number"&&typeof t=="boolean"?(t?1:0)===c:!1;function S(c,t){let e=null;const i=Math.min(c.length,500);for(let n=0;n<i;n++){const s=c[n][t];if(s==null||s==="")continue;const r=s instanceof Date?"date":typeof s=="number"?"number":typeof s=="boolean"?"boolean":typeof s=="string"?"string":"any";if(e===null)e=r;else if(e!==r)if(e==="date"&&r==="number"||e==="number"&&r==="date")e="number";else return"any"}return e??"string"}let F=null;function pt(c){F=c}class gt{constructor(t=null){this.book=t,this.strings=t?.strings??new L,this.tables=new Map,this.relationships=[],this._formulas=null}get formulas(){if(this._formulas===null){if(F===null)throw new Error("Formula support is not loaded. Import datasheets/data.js first.");this._formulas=new F(this)}return this._formulas}addTable(t,e={}){if(this.tables.has(t))throw new m(`The table ${t} already exists.`);const i=new M(this,t,e);return this.tables.set(t,i),i}table(t){if(t instanceof M)return t;const e=this.tables.get(t);if(!e)throw new m(`No table named ${t}.`);return e}removeTable(t){const e=this.table(t);this.tables.delete(e.name),this.relationships=this.relationships.filter(i=>i.from!==e&&i.to!==e)}addRelationship(t){const e=new it(this,t);return this.relationships.push(e),e}removeRelationship(t){this.relationships=this.relationships.filter(e=>e!==t)}relationshipFrom(t,e){return this.relationships.find(i=>i.from===t&&i.name===e)??null}relationshipTo(t,e){return this.relationships.find(i=>i.to===t&&i.inverse===e)??null}relationshipBetween(t,e){return this.relationships.find(i=>i.from===t&&i.to===e||i.from===e&&i.to===t)??null}isKeyField(t,e){return this.relationships.length===0?!1:this.relationships.some(i=>i.from===t&&i.fromField===e||i.to===t&&i.toField===e)}_tableChanged(t){for(const e of this.tables.values()){let i=!1;for(const n of e.columns)n!==null&&(n.lookup&&(n.lookup.relation.to===t||n.lookup.relation.from===t)||n.rollup&&(n.rollup.relation.from===t||n.rollup.relation.to===t))&&(n.stale||(n.stale=!0,i=!0,e._markDependentsStale(n)));i&&e!==t&&e._emit({type:"reload",derived:!0})}}_fieldChanged(t,e){if(this.relationships.length!==0)for(const i of this.tables.values()){let n=!1;for(const s of i.columns){if(s===null)continue;(s.window&&s.window.table===t&&s.deps.some(o=>e.has(o))||s.lookup&&s.lookup.relation.to===t&&e.has(s.lookup.field)||s.rollup&&s.rollup.relation.from===t&&e.has(s.rollup.field)||s.lookup&&s.lookup.relation.from===t&&e.has(s.lookup.relation.fromField)||s.rollup&&s.rollup.relation.from===t&&e.has(s.rollup.relation.fromField))&&!s.stale&&(s.stale=!0,n=!0,i._markDependentsStale(s))}n&&i!==t&&i._emit({type:"reload",derived:!0})}}}export{O as DataColumn,m as DataError,gt as DataManager,M as DataTable,Z as FIELD_TYPES,u as ROW,it as Relationship,mt as flattenTree,pt as installFormulas,st as keyIndex};
@@ -0,0 +1 @@
1
+ import{FormulaColumns as o}from"./formula.js";import{installFormulas as m}from"./data-core.js";m(o);export*from"./data-core.js";
@@ -0,0 +1 @@
1
+ import{CHUNK_BITS as C,CHUNK_MASK as b,CHUNK_SIZE as A,EMPTY as F,NUM as R,Sheet as L}from"../core/sheet.js";import{colName as M}from"../core/address.js";import{Engine as S}from"../calc/engine.js";import{toFileFormula as $}from"../calc/parser.js";import{Arr as D,ERR as _,Lambda as O,Ref as I,RefList as K,XlError as N}from"../calc/values.js";import{extractWindowCalls as T}from"./window.js";const v=()=>({kinds:new Uint8Array(A),values:new Float64Array(A),styles:null});function E(h,e,t){const s=h.table,{kinds:i,values:u}=e,n=Math.min(A,s.rowCount-t),{data:a,kinds:m,isString:r}=h,f=h.type==="boolean";if(n<=0){i.fill(0);return}if(r)for(let o=0;o<n;o++){const l=a[t+o];i[o]=l<0?0:2,u[o]=l}else if(m!==null)for(let o=0;o<n;o++)i[o]=m[t+o],u[o]=a[t+o];else{const o=f?3:R;for(let l=0;l<n;l++){const d=a[t+l];d!==d?i[l]=F:(i[l]=o,u[l]=d)}}if(n<A&&i.fill(0,n),s.deletedCount>0){const{alive:o}=s;for(let l=0;l<n;l++)o[t+l]===0&&(i[l]=F)}}function V(h,e){let t="",s="";for(let i=0;i<h.length;i++){const u=h[i];if(u==='"'){t+=e(s),s="";let n=i+1;for(;!(n>=h.length);)if(h[n]==='"')if(h[n+1]==='"')n+=2;else break;else n++;t+=h.slice(i,n+1),i=n}else s+=u}return t+e(s)}const H=/\b(SUM|COUNT|COUNTA|AVERAGE|AVG|MIN|MAX)\s*\(\s*\[@?\[?([^[\]@]+)\]?\]\s*\)/gi,B=/\[(@?)\[?([^[\]]+?)\]?\]/g;class Z{constructor(e){this.manager=e,this.engine=null,this.sheets=new Map}_engineFor(){return this.engine===null&&(this.engine=new S({sheets:[],strings:this.manager.strings}),this.engine.legacy=!0),this.engine}_sheet(e){let t=this.sheets.get(e);return t===void 0&&(t=new L(`__data_${e.name}`),this.sheets.set(e,t)),t.maxRow=e.rowCount-1,t.maxCol=e.columns.length-1,t}bind(e){const t=e.table,s=new Set;let i=!1,u=!1;const n=T(String(e.formula).replace(/^=/,""),t,m=>{s.add(m.name),i=!0}),a=V(n,m=>m.replace(H,(r,f,o)=>{const l=o.trim();if(!l.includes("."))return r;const d=t.rollupColumn(f.toUpperCase(),l);return d?(s.add(d.name),`$${M(d.index)}1`):r}).replace(B,(r,f,o)=>{const l=o.trim(),d=t.column(l);if(!d)return u=!0,"#NAME?";s.add(d.name);const y=M(d.index);return f==="@"?`$${y}1`:(i=!0,`$${y}:$${y}`)}));if(e.deps=[...s],e.rangeDep=i,e.stale=!0,e.compiled=null,u){e.compiled={fn:()=>_.NAME,ok:!1};return}try{const r=this._engineFor().template($(a),0,e.index);e.compiled={fn:r.fn,ok:!r.external}}catch{e.compiled={fn:()=>_.NAME,ok:!1}}this._hasCycle(e)&&(e.compiled={fn:()=>_.REF,ok:!1},e.deps=[])}_hasCycle(e){const t=e.table,s=new Set,i=u=>{if(u===e.name)return!0;if(s.has(u))return!1;s.add(u);const n=t.column(u);return n?n.deps.some(i):!1};return e.deps.some(i)}_evaluate(e,t,s,i,u){let n;try{n=e(t,s,i)}catch(a){return a instanceof N?a:_.VALUE}if(n instanceof I||n instanceof K)try{n=u.refAuto(n,t,s)}catch(a){return a instanceof N?a:_.VALUE}return n instanceof D&&(n=n.data[0]),n instanceof O?_.CALC:typeof n=="number"&&!Number.isFinite(n)?_.NUM:n===void 0?null:n}computeAll(e){const t=e.table;e.compiled===null&&this.bind(e);const s=e.deps.map(p=>t.column(p));for(const p of s)t.ensure(p);const i=this._engineFor(),u=this._sheet(t),n=t.rowCount,{fn:a}=e.compiled,m=e.index,r=n+b>>>C,f=u.columns;f.length=0;const o=s.map(()=>v());for(const p of s)f[p.index]=[];if(e.rangeDep)for(const p of s){const x=f[p.index];for(let k=0;k<r;k++){const c=v();E(p,c,k<<C),x[k]=c}}const l=t.alive,d=t.deletedCount>0;e.kinds=null;const y=e.data,w=!e.isString;for(let p=0;p<r;p++){const x=p<<C;if(!e.rangeDep)for(let c=0;c<s.length;c++){const g=f[s[c].index];E(s[c],o[c],x),p>0&&(g[p-1]=void 0),g[p]=o[c]}const k=Math.min(n,x+A);for(let c=x;c<k;c++){if(d&&l[c]===0){e.put(c,null);continue}const g=this._evaluate(a,c,m,u,i);w&&e.kinds===null&&typeof g=="number"?y[c]=g:e.type==="any"||g===null||typeof g=="number"?e.put(c,g):e.put(c,e.type==="any"?g:U(e,g))}}f.length=0}computeRow(e,t){const s=e.table;e.compiled===null&&this.bind(e);const i=e.deps.map(r=>s.column(r));for(const r of i)r.stale&&s.ensure(r);const u=this._engineFor(),n=this._sheet(s),a=n.columns;a.length=0;const m=t>>>C;for(const r of i){const f=v();E(r,f,m<<C),a[r.index]=[],a[r.index][m]=f}if(s.alive[t]===0)e.put(t,null);else{const r=this._evaluate(e.compiled.fn,t,e.index,n,u);e.put(t,typeof r=="number"||r===null||e.type==="any"?r:U(e,r))}e.revision++,a.length=0}evaluateOnce(e,t,s){const i={table:e,index:e.columns.length,formula:s,deps:[],name:"\0temp",compiled:null};this.bind(i);const u=i.deps.map(f=>e.column(f));for(const f of u)e.ensure(f);const n=this._sheet(e),a=n.columns;a.length=0;const m=t>>>C;for(const f of u)if(a[f.index]=[],i.rangeDep){const o=e.rowCount+b>>>C;for(let l=0;l<o;l++){const d=v();E(f,d,l<<C),a[f.index][l]=d}}else{const o=v();E(f,o,m<<C),a[f.index][m]=o}const r=this._evaluate(i.compiled.fn,t,i.index,n,this._engineFor());return a.length=0,r}}function U(h,e){try{return h.coerce(e)}catch{return null}}export{Z as FormulaColumns,E as fillRawChunk};
@@ -0,0 +1 @@
1
+ import{STR as on}from"../core/sheet.js";import{getFormatter as ln}from"../core/numfmt.js";import{formulaHelper as mn}from"./view.js";const B={bar:"#4a90d9",barDone:"#22598f",critical:"#d64545",criticalDone:"#932626",summary:"#404040",milestone:"#2b2b2b",baseline:"#a8a8a8",deadline:"#c42b1c",link:"#6b6b6b",linkCritical:"#c42b1c",today:"#107c41",tier:"#f3f3f3",tierLine:"#d0d0d0",tierInk:"#3b3b3b",label:"#3b3b3b"};function cn(n,i){if(i)return i._panes();const e=n.toScreen(0,0);return[{x:n.hx,y:n.hy,w:n.cssW-n.hx,h:n.cssH-n.hy,originX:n.hx-e.x,originY:n.hy-e.y,frozenC:!1,frozenR:!1,print:!0}]}function tn(n,i,e,l,o,t){const f=Math.min(t,l/2,o/2);n.beginPath(),n.moveTo(i+f,e),n.lineTo(i+l-f,e),n.quadraticCurveTo(i+l,e,i+l,e+f),n.lineTo(i+l,e+o-f),n.quadraticCurveTo(i+l,e+o,i+l-f,e+o),n.lineTo(i+f,e+o),n.quadraticCurveTo(i,e+o,i,e+o-f),n.lineTo(i,e+f),n.quadraticCurveTo(i,e,i+f,e),n.closePath()}function rn(n,i,e,l,o,t,f,r){if(!t||t==="solid")return;n.save(),n.beginPath(),n.rect(i,e,l,o),n.clip(),n.strokeStyle=f,n.fillStyle=f,n.lineWidth=Math.max(1,r*.75);const a=5*r;if(t==="dots")for(let s=i;s<i+l;s+=a)for(let m=e;m<e+o;m+=a)n.fillRect(s,m,Math.max(1,r),Math.max(1,r));else{n.beginPath();for(let s=-o;s<l;s+=a)n.moveTo(i+s,e+o),n.lineTo(i+s+o,e);n.stroke()}n.restore()}function dn(n,i,e,l){let t=n.taskbarStyles[e]??null;const f=n.taskbarRules;for(let r=0;r<f.length;r++){const a=f[r];if(a.type&&a.type!==e)continue;let s=!0;if(a.formula){let m=l[r];m===void 0&&(m=mn(n.table,a.formula),l[r]=m);const S=m.get(i);s=S===!0||typeof S=="number"&&S!==0}s&&(t=t===null?a.style:{...t,...a.style})}return t}function an(n,i,e,l,o,t,f,r){if(!i)return;const a=l+o/2,s=o*.75,m=r?1:-1;n.fillStyle=t,n.beginPath(),i==="diamond"?(n.moveTo(e,a-s),n.lineTo(e+s,a),n.lineTo(e,a+s),n.lineTo(e-s,a)):i==="triangle"?(n.moveTo(e,a-s),n.lineTo(e+m*s,a),n.lineTo(e,a+s)):i==="circle"?n.arc(e,a,s*.8,0,Math.PI*2):n.rect(e-f*1.5,l-f,3*f,o+2*f),n.closePath(),n.fill()}function Mn(n,i,e,l=null){const o=e.schedule;if(!o)return;const{dpr:t}=i,{zoom:f}=i;for(const r of cn(i,l)){n.save(),n.beginPath(),n.rect(r.x*t,r.y*t,r.w*t,r.h*t),n.clip();const a=y=>(r.x+(y-r.originX)*f)*t,s=y=>(r.y+(y-r.originY)*f)*t,m=f*t,{rows:S,cols:k}=e,w=r.originX,u=r.originX+r.w/f,g=r.originY,D=r.originY+r.h/f,h=k.offsetOf(e.timelineStart);if(u>h){const y=r.frozenR?0:Math.max(S.indexAt(g),e.frozenRows),c=r.frozenR?e.frozenRows-1:S.indexAt(D),b=Math.max(g,S.offsetOf(e.frozenRows));(!r.frozenR||r.print)&&fn(n,e,a,s,m,w,u,b,D,r),(!r.frozenR||r.print)&&un(n,e,o,a,s,m,w,u,b,D,y,c),y===0&&!r.print&&(r.frozenR||e.frozenRows===0)&&sn(n,e,a,s,m,w,u),r.print&&g<S.sizeOf(0)&&sn(n,e,a,s,m,w,u),(c>=e.bodyStart||r.frozenR)&&yn(n,e,o,a,s,m,Math.max(y,1),Math.min(c,e.bodyStart+e.view.count-1),w,u),e.nonWorking.mode==="front"&&!r.frozenR&&fn(n,e,a,s,m,w,u,b,D,r,!0),r.frozenR||bn(n,e,o,a,s,m,g,D),e.progressLine.visible&&!r.frozenR&&pn(n,e,o,a,s,m,Math.max(y,1),Math.min(c,e.bodyStart+e.view.count-1))}n.restore()}}function sn(n,i,e,l,o,t,f){const{scale:r,cols:a,colors:s}=i,m=a.offsetOf(i.timelineStart),S=r.tickWidth,k=i.rows.sizeOf(0),w=l(0),u=Math.max(m,t),g=s?.tier??B.tier,D=s?.tierInk??B.tierInk,h=s?.tierLine??B.tierLine;n.fillStyle=g,n.fillRect(e(u),w,(f-u)*o,k*o),n.textBaseline="middle";const y=Math.round(10.5*o);n.font=`${y}px -apple-system, "Helvetica Neue", Arial, sans-serif`;const c=Math.max(0,Math.floor((t-m)/S)),b=Math.min(r.count-1,Math.floor((f-m)/S)),C=r.tiers,O=k/Math.max(1,C.length),T=Math.max(1,Math.round(o*.75));C.forEach((v,W)=>{const P=W*O,{marks:F}=v;let I=0,d=F.length-1;for(;I<d;){const z=I+d+1>>>1;F[z].tick<=c?I=z:d=z-1}n.textAlign=v.bottom?"center":"left";for(let z=I;z<F.length;z++){const A=F[z];if(A.tick>b)break;const Z=z+1<F.length?F[z+1].tick:r.count,q=m+A.tick*S,R=m+Z*S;n.fillStyle=h,n.fillRect(Math.round(e(q)),l(P),T,O*o),n.fillStyle=D,v.bottom?n.fillText(A.label,e((q+R)/2),l(P+O/2)):(n.save(),n.beginPath(),n.rect(e(q),l(P),(R-q)*o,O*o),n.clip(),n.fillText(A.label,e(Math.max(q,t)+4),l(P+O/2)),n.restore())}n.fillStyle=h,n.fillRect(e(u),l(P+O)-T,(f-u)*o,T)})}function fn(n,i,e,l,o,t,f,r,a,s,m=!1){const{scale:S,cols:k,calendar:w,nonWorking:u}=i;if(s.frozenR||u.mode==="none"||u.mode==="front"!==m)return;const{unit:g}=S.bottomTier;if(g!=="day"&&g!=="hour"&&g!=="minute")return;const D=k.offsetOf(i.timelineStart),h=S.tickWidth,y=Math.max(0,Math.floor((t-D)/h)),c=Math.min(S.count-1,Math.floor((f-D)/h));n.fillStyle=u.color;const b=n.globalCompositeOperation;!m&&n.fillRect&&!s.print&&(n.globalCompositeOperation="multiply");for(let C=y;C<=c;C++){const O=S.ticks[C];(g==="day"?w.isWorkDay(O):w.isWorkTime(O+1e-6))||(n.fillRect(e(D+C*h),l(r),h*o,(a-r)*o),u.pattern&&u.pattern!=="solid"&&(n.globalCompositeOperation=b,rn(n,e(D+C*h),l(r),h*o,(a-r)*o,u.pattern,"#b8b8b8",o),!m&&!s.print&&(n.globalCompositeOperation="multiply"),n.fillStyle=u.color))}n.globalCompositeOperation=b}function un(n,i,e,l,o,t,f,r,a,s,m,S){const{scale:k,cols:w,gridlines:u,rows:g}=i,D=Math.max(1,Math.round(t*.75));if(u.interval>0){const h=w.offsetOf(i.timelineStart),y=k.tickWidth,c=Math.max(0,Math.floor((f-h)/y)),b=Math.min(k.count-1,Math.floor((r-h)/y));n.fillStyle=u.intervalColor;for(let C=c-c%u.interval;C<=b;C+=u.interval)n.fillRect(l(h+C*y),o(a),D,(s-a)*t)}if(u.rowInterval>0){n.fillStyle=u.rowColor;const h=Math.max(i.bodyStart,m);for(let y=h-(h-i.bodyStart)%u.rowInterval;y<=S;y+=u.rowInterval)n.fillRect(l(f),o(g.offsetOf(y)),(r-f)*t,D)}}function Y(n,i,e,l,o,t,f){n.strokeStyle=o,n.lineWidth=Math.max(1,t),n.setLineDash(f.map(r=>r*t)),n.beginPath(),n.moveTo(i,e),n.lineTo(i,l),n.stroke(),n.setLineDash([])}function bn(n,i,e,l,o,t,f,r){const{gridlines:a}=i,s=o(f),m=o(r);i.showToday&&a.current!==!1&&Y(n,l(i.xOfDate(i.today)),s,m,B.today,t,[4,3]),a.status&&i.statusDate!==null&&Y(n,l(i.xOfDate(i.statusDate)),s,m,"#7a4fb5",t,[2,2]),a.projectStart&&Y(n,l(i.xOfDate(e.projectStart)),s,m,"#2f6fb3",t,[6,3]),a.projectFinish&&Y(n,l(i.xOfDate(e.projectFinish)),s,m,"#2f6fb3",t,[6,3])}function pn(n,i,e,l,o,t,f,r){const{progressLine:a,rows:s,table:m,fields:S}=i,k=a.reference==="current"?i.today:i.statusDate??i.today,w=i.xOfDate(k),u=m.column(S.progress)?.data,g=[];for(let c=f;c<=r;c++){const b=i.recordAtRow(c);if(b<0||b>=e.rows||e.isSummary[b]===1||e.momentStart[b]===1/0)continue;const C=i.xOfDate(e.momentStart[b]),O=i.xOfDate(e.momentFinish[b]),T=u?u[b]:0,v=T===T?T:0,W=v>=1&&e.momentFinish[b]<=k||v<=0&&e.momentStart[b]>=k;g.push({x:W?w:C+(O-C)*v,y:s.offsetOf(c)+s.sizeOf(c)/2,row:c})}n.strokeStyle=a.color,n.fillStyle=a.color,n.lineWidth=Math.max(1,t*(a.width??1)),n.beginPath();let D=!1,h=null;const y=(c,b)=>{D?n.lineTo(l(c),o(b)):(n.moveTo(l(c),o(b)),D=!0)};for(const c of g){if(a.returnToAnchor){const b=c.y-s.sizeOf(c.row)/2;y(w,b),a.path==="square"&&y(c.x,b),y(c.x,c.y),a.path==="square"&&y(c.x,b+s.sizeOf(c.row)),y(w,b+s.sizeOf(c.row))}else h&&a.path==="square"&&y(h.x,c.y),y(c.x,c.y);h=c}n.stroke();for(const c of g)n.beginPath(),n.arc(l(c.x),o(c.y),2.2*t,0,Math.PI*2),n.fill();g.length>0&&a.showDate!==!1&&(n.font=`${Math.round(10*t)}px -apple-system, "Helvetica Neue", Arial, sans-serif`,n.textAlign="center",n.textBaseline="bottom",n.fillText(ln("d-mmm").number(Math.floor(k)),l(w),o(g[0].y-s.sizeOf(g[0].row)/2)))}const V=(n,i,e,l)=>{if(!e)return"";const o=n.table.column(e);if(!o)return String(e);const t=o.get(i);if(t==null)return"";if(typeof t=="number"){const f=l??o.format;return f&&f!=="General"?ln(f).number(t):String(t)}return typeof t=="object"?t.code:String(t)};function yn(n,i,e,l,o,t,f,r,a,s){const{table:m,view:S,fields:k,rows:w,layoutOptions:u,colors:g}=i,D=m.column(k.progress)?.data,h=m.column(k.name),y=m.column(k.resource),c=i.showBaseline?m.column(k.deadline)?.data:null,b=i.showBaseline?m.column(k.baselineStart)?.data:null,C=i.showBaseline?m.column(k.baselineFinish)?.data:null,O=Math.round(11*t);n.font=`${O}px -apple-system, "Helvetica Neue", Arial, sans-serif`,n.textBaseline="middle",n.textAlign="left";const T=i.bodyStart+S.count-1;i.showLinks&&u.linkMode!=="noLinks"&&Tn(n,i,e,l,o,t,f,Math.min(r,T));const v=[],W=u.roundToDays,P=g?.bar??B.bar,F=g?.barDone??B.barDone;for(let I=f;I<=r&&I<=T;I++){const d=i.recordAtRow(I);if(d<0||d>=e.rows||e.momentStart[d]===1/0)continue;const z=w.offsetOf(I),A=w.sizeOf(I),Z=W?Math.floor(e.momentStart[d]):e.momentStart[d],q=W?Math.ceil(e.momentFinish[d]):e.momentFinish[d],R=i.xOfDate(Z),H=i.xOfDate(q);if(H<a-300||R>s+40)continue;const E=e.isSummary[d]===1,j=!E&&e.duration[d]===0,$=i.showCritical&&e.critical[d]===1,K=m.column(k.manual)?.data[d]===1,p=dn(i,d,E?"summary":j?"milestone":K?"manual":$?"critical":"task",v),_=u.barHeight??A-8-(b?2:0),U=z+(A-_)/2-(b?1:0);if(b&&b[d]===b[d]&&!E){const L=i.xOfDate(b[d]),M=i.xOfDate(C[d]+(m.column(k.baselineFinish)&&e.calOf(d).fullDays?1:0));n.fillStyle=i.taskbarStyles.baseline?.fill??B.baseline,n.fillRect(l(L),o(z+A-4),Math.max(2,(M-L)*t),Math.max(2,2*t))}if(E){const L=p?.fill??($?B.criticalDone:g?.summary??B.summary);n.fillStyle=L;const M=U+1,N=Math.max(3,_*.45);n.fillRect(l(R),o(M),Math.max(2,(H-R)*t),N*t);const J=Math.min(5,Math.max(2,(H-R)/2)),G=N+3;n.beginPath(),n.moveTo(l(R),o(M)),n.lineTo(l(R+J),o(M)),n.lineTo(l(R),o(M+G)),n.closePath(),n.moveTo(l(H),o(M)),n.lineTo(l(H-J),o(M)),n.lineTo(l(H),o(M+G)),n.closePath(),n.fill()}else if(j){const L=z+A/2,M=Math.min(A/2-2,6);n.fillStyle=p?.fill??($?B.critical:B.milestone),n.beginPath(),n.moveTo(l(R),o(L-M)),n.lineTo(l(R+M),o(L)),n.lineTo(l(R),o(L+M)),n.lineTo(l(R-M),o(L)),n.closePath(),n.fill()}else{const L=Math.max(3/t,H-R),M=l(R),N=o(U),J=L*t,G=_*t,x=p?.fill??($?B.critical:K?"#7fa8d1":P);n.fillStyle=x,tn(n,M,N,J,G,2*t),n.fill(),p?.pattern&&rn(n,M,N,J,G,p.pattern,p.patternColor??"#ffffff",t),K&&!p&&(n.strokeStyle=F,n.lineWidth=Math.max(1,t*.75),n.strokeRect(M,N,J,G));const en=D?D[d]:0;en>0&&(n.fillStyle=p?.progressFill??($?B.criticalDone:F),tn(n,M,N,L*Math.min(1,en)*t,G,2*t),n.fill()),p?.startShape&&an(n,p.startShape,M,N,G,p.shapeColor??x,t,!1),p?.endShape&&an(n,p.endShape,M+J,N,G,p.shapeColor??x,t,!0)}if(c&&c[d]===c[d]){const L=i.xOfDate(c[d]+1),M=e.momentFinish[d]>c[d]+1;n.strokeStyle=B.deadline,n.lineWidth=Math.max(1,(M?2:1)*t),n.beginPath(),n.moveTo(l(L),o(z+2)),n.lineTo(l(L),o(z+A-2)),n.stroke(),n.fillStyle=B.deadline,n.beginPath(),n.moveTo(l(L-3),o(z+2)),n.lineTo(l(L+3),o(z+2)),n.lineTo(l(L),o(z+6)),n.closePath(),n.fill()}n.textBaseline="middle";const nn=p?.textColor??B.label,X=j?9:4;if(p&&(p.textRight!==void 0||p.textLeft!==void 0||p.textInside!==void 0||p.textTop!==void 0||p.textBottom!==void 0))n.fillStyle=nn,n.textAlign="left",p.textRight&&n.fillText(V(i,d,p.textRight,u.barDateFormat),l(H+X),o(z+A/2)),p.textInside&&(n.save(),n.beginPath(),n.rect(l(R),o(U),(H-R)*t,_*t),n.clip(),n.fillStyle=p.insideColor??"#ffffff",n.fillText(V(i,d,p.textInside,u.barDateFormat),l(R+3),o(z+A/2)),n.restore()),n.textAlign="right",p.textLeft&&n.fillText(V(i,d,p.textLeft,u.barDateFormat),l(R-X),o(z+A/2)),n.textAlign="center",p.textTop&&(n.textBaseline="bottom",n.fillText(V(i,d,p.textTop,u.barDateFormat),l((R+H)/2),o(U))),p.textBottom&&(n.textBaseline="top",n.fillText(V(i,d,p.textBottom,u.barDateFormat),l((R+H)/2),o(U+_))),n.textAlign="left",n.textBaseline="middle";else if(i.showLabels){const M=(y&&y.kind(d)===on?y.get(d):null)??((E||j)&&h.kind(d)===on?h.get(d):"");M&&(n.fillStyle=nn,n.fillText(M,l(H+X),o(z+A/2)))}}}function Tn(n,i,e,l,o,t,f,r){const{rows:a,layoutOptions:s}=i,m=i.linkIndex(),{outStart:S,outList:k,inStart:w,inList:u,from:g,to:D,type:h}=m,y=new Set;n.lineWidth=Math.max(1,t);const c=s.linkMode==="toEnd",b=O=>{const T=i.rowOfRecord(O);return T<0?null:a.offsetOf(T)+a.sizeOf(T)/2},C=O=>{if(y.has(O))return;y.add(O);const T=g[O],v=D[O],W=b(T),P=b(v);if(W===null||P===null)return;const F=h[O],I=i.xOfDate(F===0||F===2?e.momentFinish[T]:e.momentStart[T]),d=i.xOfDate(F===0||F===1?e.momentStart[v]:e.momentFinish[v]),A=i.showCritical&&e.critical[T]===1&&e.critical[v]===1&&e.isSummary[T]===0&&e.isSummary[v]===0?B.linkCritical:B.link;n.strokeStyle=A,n.fillStyle=A;const q=F===0||F===1?1:-1,R=F===0||F===2?1:-1,H=7;n.beginPath(),n.moveTo(l(I),o(W));const E=I+R*H,j=d-q*H,$=W+(P>W?1:-1)*(a.defaultSize/2);if(!c&&F===0&&d>=I+2){const K=(P>W?-1:1)*Math.min(4,a.defaultSize/2-2),Q=d+3;n.lineTo(l(Q),o(W)),n.lineTo(l(Q),o(P+K-(P>W?3:-3))),n.stroke();const p=P+K,_=P>W?1:-1;n.beginPath(),n.moveTo(l(Q),o(p)),n.lineTo(l(Q-3),o(p-_*4)),n.lineTo(l(Q+3),o(p-_*4)),n.closePath(),n.fill();return}q===1&&j>=E||q===-1&&j<=E?(n.lineTo(l(j),o(W)),n.lineTo(l(j),o(P))):(n.lineTo(l(E),o(W)),n.lineTo(l(E),o($)),n.lineTo(l(j),o($)),n.lineTo(l(j),o(P))),n.lineTo(l(d-q*3),o(P)),n.stroke(),n.beginPath(),n.moveTo(l(d),o(P)),n.lineTo(l(d-q*4),o(P-3)),n.lineTo(l(d-q*4),o(P+3)),n.closePath(),n.fill()};for(let O=f;O<=r;O++){const T=i.recordAtRow(O);if(!(T<0||T>=e.rows)){for(let v=w[T];v<w[T+1];v++)C(u[v]);for(let v=S[T];v<S[T+1];v++)C(k[v])}}}export{B as BAR_COLORS,dn as barStyleOf,Mn as paintGantt,cn as viewAreas};
@@ -0,0 +1 @@
1
+ function F(o){const i=[];if(o==null||o==="")return i;for(const c of String(o).split(/[,;]/)){const t=/^\s*(.+?)\s*(?:\[\s*(\d+(?:\.\d+)?)\s*%?\s*\])?\s*$/.exec(c);t&&t[1]&&i.push({name:t[1],units:t[2]!==void 0?Number(t[2])/100:1})}return i}const A=o=>o.map(i=>i.units===1?i.name:`${i.name}[${Math.round(i.units*100)}%]`).join(", ");function D(o,{resources:i=[],assignments:c=[]}={}){const{table:t}=o,{manager:u}=t,f=t.name;if(o.resourceTable)return o.resourceTable;const w=u.addTable(`${f} Resources`,{key:"id",fields:[{name:"id",caption:"ID",type:"number"},{name:"name",caption:"Resource",type:"string"},{name:"type",caption:"Type",type:"string",defaultValue:"work"},{name:"maxUnits",caption:"Max Units",type:"number",format:"0%",defaultValue:1},{name:"cost",caption:"Cost per Hour",type:"number",format:"#,##0.00"},{name:"costPerUse",caption:"Cost per Use",type:"number",format:"#,##0.00"}],tracking:!0}),l=u.addTable(`${f} Assignments`,{key:"id",fields:[{name:"id",caption:"ID",type:"number"},{name:"taskId",caption:"Task",type:"number"},{name:"resourceId",caption:"Resource",type:"number"},{name:"units",caption:"Units",type:"number",format:"0%",defaultValue:1}],tracking:!0});i.length>0&&w.load(i.map((s,n)=>({id:n+1,...typeof s=="string"?{name:s}:s}))),c.length>0&&l.load(c.map((s,n)=>({id:n+1,units:1,...s}))),u.addRelationship({from:l,fromField:"taskId",to:t,toField:o.fields.id,name:"task",inverse:"assignments"}),u.addRelationship({from:l,fromField:"resourceId",to:w,toField:"id",name:"resource",inverse:"assignments"}),o.resourceTable=w,o.assignmentTable=l;const p=t.column(o.fields.resource);if(c.length===0&&p){const s=[];for(let n=0;n<t.rowCount;n++){if(t.alive[n]===0)continue;const m=p.get(n);typeof m=="string"&&m!==""&&s.push([n,m])}for(const[n,m]of s)$(o,n,m)}return o.resourceNamesChanged?.(),w.onChange(s=>{s.type!=="schema"&&o.resourceNamesChanged?.()}),w}function U(o,i,c){const t=o.resourceTable,u=t.column("name"),f=i.toLowerCase();for(let l=0;l<t.rowCount;l++)if(t.alive[l]===1){const p=u.get(l);if(typeof p=="string"&&p.toLowerCase()===f)return t.get(l,"id")}if(!c)return null;let w=0;for(let l=0;l<t.rowCount;l++)w=Math.max(w,t.get(l,"id")??0);return t.addRow({id:w+1,name:i}),o.resourceNamesChanged?.(),w+1}function $(o,i,c){const t=o.assignmentTable;if(!t)return;const u=o.table.column(o.fields.id).data[i],f=F(c).map(s=>({...s,id:U(o,s.name,!0)})),w=[],l=t.column("taskId").data;for(let s=0;s<t.rowCount;s++)t.alive[s]===1&&l[s]===u&&w.push(s);for(const s of w){const n=t.get(s,"resourceId"),m=f.find(I=>I.id===n);m?(t.get(s,"units")!==m.units&&t.set(s,"units",m.units),m.done=!0):t.removeRow(s)}let p=0;for(let s=0;s<t.rowCount;s++)p=Math.max(p,t.get(s,"id")??0);for(const s of f)s.done||t.addRow({id:++p,taskId:u,resourceId:s.id,units:s.units})}function P(o,i){const c=o.assignmentTable;if(!c)return;const{table:t,fields:u}=o,f=o.resourceTable,w=t.column(u.id).data,l=new Map;for(let e=0;e<f.rowCount;e++)f.alive[e]===1&&l.set(f.get(e,"id"),f.get(e,"name"));const p=new Map;for(let e=0;e<c.rowCount;e++){if(c.alive[e]===0)continue;const a=c.get(e,"taskId");p.has(a)||p.set(a,[]);const d=c.get(e,"resourceId");p.get(a).push({name:l.get(d)??"?",units:c.get(e,"units")??1,resourceId:d})}const s=t.column(u.resource),n=t.column(u.work),m=t.column(u.cost),I=t.column(u.fixedCost),k=new Map;for(let e=0;e<f.rowCount;e++)f.alive[e]===1&&k.set(f.get(e,"id"),{hour:f.get(e,"cost")??0,use:f.get(e,"costPerUse")??0});for(let e=0;e<t.rowCount;e++){if(t.alive[e]===0)continue;const a=p.get(w[e]);if(s&&s.put(e,a?A(a):null),n){const d=i.calOf(e),v=i.duration[e]/d.unitsPer("h");n.data[e]=a&&i.isSummary[e]===0?v*a.reduce((y,g)=>y+g.units,0):NaN}if(m){const d=i.calOf(e),v=i.duration[e]/d.unitsPer("h"),y=I?I.data[e]:NaN;let g=y===y?y:NaN;if(a&&i.isSummary[e]===0)for(const C of a){const r=k.get(C.resourceId);r&&(g=(g===g?g:0)+v*C.units*r.hour+r.use)}m.data[e]=g}}if(n||m){const{parentRow:e,isSummary:a}=i,d=new Int32Array(t.rowCount),v=[];for(let y=0;y<t.rowCount;y++){let g=0;for(let C=e[y];C>=0&&g<=t.rowCount;C=e[C])g++;d[y]=g,(v[g]??=[]).push(y)}for(let y=v.length-1;y>0;y--)for(const g of v[y]??[]){const C=e[g];if(!(C<0||a[C]!==1))for(const r of[n,m]){if(!r)continue;const b=r.data[g];b===b&&(r.data[C]=(r.data[C]!==r.data[C]?0:r.data[C])+b)}}}}function L(o){const i=o.assignmentTable,c=o.resourceTable;if(!i||!c)return 0;const{table:t,fields:u}=o,f=t.column(u.levelStart),w=t.column(u.levelFrom),l=t.column(u.start),p=t.column(u.manual)?.data??null,s=t.column(u.priority)?.data??null,n=t.column(u.id).data,m=new Map;for(let a=0;a<c.rowCount;a++)c.alive[a]===1&&m.set(c.get(a,"id"),c.get(a,"maxUnits")??1);const I=new Map;for(let a=0;a<t.rowCount;a++)t.alive[a]===1&&I.set(n[a],a);const k=new Map;for(let a=0;a<i.rowCount;a++){if(i.alive[a]===0)continue;const d=I.get(i.get(a,"taskId"));d!==void 0&&(k.has(d)||k.set(d,[]),k.get(d).push({id:i.get(a,"resourceId"),units:i.get(a,"units")??1}))}const e=new Set;for(let a=0;a<500;a++){const d=o.schedule,v=[...k.keys()].filter(r=>d.isSummary[r]===0&&!(p&&p[r]===1)&&d.momentStart[r]!==1/0),y=r=>s&&s[r]===s[r]?s[r]:0;v.sort((r,b)=>d.momentStart[r]-d.momentStart[b]||y(b)-y(r)||d.slack[r]-d.slack[b]||n[r]-n[b]);const g=new Map;let C=!1;for(const r of v){const b=d.calOf(r),R=k.get(r);let N=d.momentStart[r];const h=T=>{const x=d.duration[r]===0?T:b.add(T,d.duration[r]),S=[];for(let M=Math.floor(T);M<Math.ceil(x);M++)b.isWorkDay(M)&&S.push(M);return S};for(let T=0;T<3660;T++){const x=h(N).find(S=>R.some(M=>{const O=g.get(M.id)?.get(S)??0;return O>0&&O+M.units>(m.get(M.id)??1)+1e-9}));if(x===void 0)break;N=b.nextWork(x+1)}N!==d.momentStart[r]&&(f.data[r]!==f.data[r]&&(w.data[r]=l.data[r]),f.data[r]=N,C=!0,e.add(r));for(const T of h(N))for(const x of R){g.has(x.id)||g.set(x.id,new Map);const S=g.get(x.id);S.set(T,(S.get(T)??0)+x.units)}}if(!C)break;o.reschedule()}return e.size}function V(o,i){const c=o.schedule,t=o.assignmentTable,u=U(o,i,!1);if(!t||u===null)return{days:new Map,over:[]};const f=new Map,w=o.table.column(o.fields.id).data;for(let n=0;n<o.table.rowCount;n++)o.table.alive[n]===1&&f.set(w[n],n);const l=new Map;for(let n=0;n<t.rowCount;n++){if(t.alive[n]===0||t.get(n,"resourceId")!==u)continue;const m=f.get(t.get(n,"taskId"));if(m===void 0||c.isSummary[m]===1)continue;const I=t.get(n,"units")??1,k=c.calOf(m);for(let e=Math.floor(c.momentStart[m]);e<Math.ceil(c.momentFinish[m]);e++)k.isWorkDay(e)&&l.set(e,(l.get(e)??0)+I)}const p=o.resourceTable;let s=1;for(let n=0;n<p.rowCount;n++)p.alive[n]===1&&p.get(n,"id")===u&&(s=p.get(n,"maxUnits")??1);return{days:l,over:[...l].filter(([,n])=>n>s+1e-9).map(([n])=>n)}}export{D as enableResources,A as formatAssignments,L as levelTasks,F as parseAssignments,V as resourceLoad,P as resourceNamesOf,$ as syncAssignments};
@@ -0,0 +1 @@
1
+ import{barStyleOf as N,BAR_COLORS as h}from"./gantt-paint.js";const D="Plan Bar ",$=3e3,z=t=>({rgb:String(t).replace("#","").toUpperCase()}),L=t=>({type:"solid",color:z(t)}),_={w:0,fill:{type:"none"}},T={lnRef:{idx:0},fillRef:{idx:0},effectRef:{idx:0},fontRef:{color:{scheme:"tx1",mods:[]}}};function V(t){const e=t.schedule,n=[];if(e===null)return n;const{rows:i,table:w,fields:y,layoutOptions:c}=t,l=w.column(y.progress)?.data??null,S=w.column(y.manual),R=w.column(y.resource),E=w.column(y.name),j=c.roundToDays,F=[],O=new Map,H=t.bodyStart+t.view.count-1;for(let o=t.bodyStart;o<=H;o++){const r=t.recordAtRow(o);r>=0&&r<e.rows&&O.set(r,o)}for(const[o,r]of O){if(e.momentStart[o]===1/0)continue;const k=i.offsetOf(r),u=i.sizeOf(r);if(u<=0)continue;const s=j?Math.floor(e.momentStart[o]):e.momentStart[o],I=j?Math.ceil(e.momentFinish[o]):e.momentFinish[o],a=t.xOfDate(s),m=t.xOfDate(I),x=e.isSummary[o]===1,g=!x&&e.duration[o]===0,d=t.showCritical&&e.critical[o]===1,M=S?.data[o]===1,b=N(t,o,x?"summary":g?"milestone":M?"manual":d?"critical":"task",F),p=c.barHeight??u-8,A=k+(u-p)/2;if(x)n.push({kind:"shape",prst:"rect",x:a,y:A+1,w:Math.max(2,m-a),h:Math.max(3,p*.45),fill:b?.fill??h.summary});else if(g){const f=Math.max(6,p);n.push({kind:"shape",prst:"diamond",x:a-f/2,y:k+(u-f)/2,w:f,h:f,fill:b?.fill??h.milestone})}else{const f=b?.fill??(d?h.critical:h.bar);n.push({kind:"shape",prst:"rect",x:a,y:A,w:Math.max(2,m-a),h:p,fill:f});const v=l&&l[o]===l[o]?Math.min(1,l[o]):0;v>0&&n.push({kind:"shape",prst:"rect",x:a,y:A+p*.25,w:Math.max(1,(m-a)*v),h:p*.5,fill:b?.progressFill??(d?h.criticalDone:h.barDone)})}if(t.showLabels!==!1){const f=R?.kind(o)===2?R.get(o):x||g?E?.get(o):null;f&&n.push({kind:"textbox",x:m+(g?8:3),y:k,w:Math.min(240,String(f).length*6.5+12),h:u,text:String(f)})}}if(t.showLinks&&c.linkMode!=="noLinks"){const{from:o,to:r,type:k}=e.links,u=s=>i.offsetOf(s)+i.sizeOf(s)/2;for(let s=0;s<o.length;s++){const I=O.get(o[s]),a=O.get(r[s]);if(I===void 0||a===void 0||e.momentStart[o[s]]===1/0||e.momentStart[r[s]]===1/0)continue;const m=k[s],x=t.xOfDate(m===0||m===2?e.momentFinish[o[s]]:e.momentStart[o[s]]),g=t.xOfDate(m===0||m===1?e.momentStart[r[s]]:e.momentFinish[r[s]]),d=u(I),M=u(a),C=M>d?M-i.sizeOf(a)/2+4:M+i.sizeOf(a)/2-4,b=t.showCritical&&e.critical[o[s]]===1&&e.critical[r[s]]===1?h.linkCritical:h.link,p=Math.max(g+3,x+4);n.push({kind:"connector",x,y:d,w:Math.max(1,p-x),h:0,color:b}),n.push({kind:"connector",x:p,y:Math.min(d,C),w:0,h:Math.abs(C-d),color:b,arrow:!0,flipV:C<d})}}return n}function B(t,e){const n={name:`${D}${e+1}`,id:1e5+e,geom:{prst:t.prst??"rect",av:{}},style:T,moved:!1};if(t.kind==="connector"){const i={w:.75,fill:L(t.color)};return t.arrow&&(i.tail={type:"triangle",w:"med",len:"med"}),{...n,kind:"connector",geom:{prst:"straightConnector1",av:{}},line:i,flipV:t.flipV===!0}}return t.kind==="textbox"?{...n,kind:"textbox",fill:{type:"none"},line:_,text:{bodyPr:{wrap:"none",anchor:"ctr",lIns:0,tIns:0,rIns:0,bIns:0},paras:[{align:"l",runs:[{text:t.text,size:9,color:z("#404040")}]}]}}:{...n,kind:"shape",fill:L(t.fill),line:_,text:{bodyPr:{},paras:[{runs:[]}]}}}function K(t,e){const n=e._state(t),i=n.objects,w=n.dirty,y=V(t);n.objects=i.filter(c=>!P(c));for(let c=0;c<y.length;c++){const l=y[c],S=B(l,c);S.anchor={type:"twoCell",editAs:"twoCell",from:null,to:null},e.setRect(S,{x:l.x,y:l.y,w:l.w,h:l.h},t),n.objects.push(S)}return n.dirty=!0,n.invalidateIndex(),()=>{n.objects=i,n.dirty=w,n.invalidateIndex()}}const P=t=>typeof t.name=="string"&&t.name.startsWith(D);function U(t,e){const n=e.states.get(t);!n||!n.objects.some(P)||(n.objects=n.objects.filter(i=>!P(i)),n.invalidateIndex())}export{$ as SHAPE_MAX_TASKS,D as SHAPE_NAME,K as addPlanShapes,U as dropPlanShapes,P as isPlanShape,V as planShapes};