@trebco/treb 37.0.0 → 37.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 (528) hide show
  1. package/build/package.json +119 -0
  2. package/build/treb-base-types/src/api_types.d.ts +11 -0
  3. package/build/treb-base-types/src/api_types.js +22 -0
  4. package/build/treb-base-types/src/api_types.js.map +1 -0
  5. package/build/treb-base-types/src/area-utils.d.ts +9 -0
  6. package/build/treb-base-types/src/area-utils.js +50 -0
  7. package/build/treb-base-types/src/area-utils.js.map +1 -0
  8. package/build/treb-base-types/src/area.d.ts +182 -0
  9. package/build/treb-base-types/src/area.js +715 -0
  10. package/build/treb-base-types/src/area.js.map +1 -0
  11. package/build/treb-base-types/src/basic_types.d.ts +20 -0
  12. package/build/treb-base-types/src/basic_types.js +22 -0
  13. package/build/treb-base-types/src/basic_types.js.map +1 -0
  14. package/build/treb-base-types/src/cell.d.ts +167 -0
  15. package/build/treb-base-types/src/cell.js +432 -0
  16. package/build/treb-base-types/src/cell.js.map +1 -0
  17. package/build/treb-base-types/src/cells.d.ts +251 -0
  18. package/build/treb-base-types/src/cells.js +1136 -0
  19. package/build/treb-base-types/src/cells.js.map +1 -0
  20. package/build/treb-base-types/src/color.d.ts +35 -0
  21. package/build/treb-base-types/src/color.js +162 -0
  22. package/build/treb-base-types/src/color.js.map +1 -0
  23. package/build/treb-base-types/src/dom-utilities.d.ts +70 -0
  24. package/build/treb-base-types/src/dom-utilities.js +144 -0
  25. package/build/treb-base-types/src/dom-utilities.js.map +1 -0
  26. package/build/treb-base-types/src/evaluate-options.d.ts +35 -0
  27. package/build/treb-base-types/src/evaluate-options.js +22 -0
  28. package/build/treb-base-types/src/evaluate-options.js.map +1 -0
  29. package/build/treb-base-types/src/font-stack.d.ts +37 -0
  30. package/build/treb-base-types/src/font-stack.js +93 -0
  31. package/build/treb-base-types/src/font-stack.js.map +1 -0
  32. package/build/treb-base-types/src/gradient.d.ts +18 -0
  33. package/build/treb-base-types/src/gradient.js +86 -0
  34. package/build/treb-base-types/src/gradient.js.map +1 -0
  35. package/build/treb-base-types/src/import.d.ts +48 -0
  36. package/build/treb-base-types/src/import.js +22 -0
  37. package/build/treb-base-types/src/import.js.map +1 -0
  38. package/build/treb-base-types/src/index-standalone.d.ts +6 -0
  39. package/build/treb-base-types/src/index-standalone.js +27 -0
  40. package/build/treb-base-types/src/index-standalone.js.map +1 -0
  41. package/build/treb-base-types/src/index.d.ts +22 -0
  42. package/build/treb-base-types/src/index.js +45 -0
  43. package/build/treb-base-types/src/index.js.map +1 -0
  44. package/build/treb-base-types/src/layout.d.ts +22 -0
  45. package/build/treb-base-types/src/layout.js +22 -0
  46. package/build/treb-base-types/src/layout.js.map +1 -0
  47. package/build/treb-base-types/src/localization.d.ts +37 -0
  48. package/build/treb-base-types/src/localization.js +157 -0
  49. package/build/treb-base-types/src/localization.js.map +1 -0
  50. package/build/treb-base-types/src/rectangle.d.ts +51 -0
  51. package/build/treb-base-types/src/rectangle.js +123 -0
  52. package/build/treb-base-types/src/rectangle.js.map +1 -0
  53. package/build/treb-base-types/src/render_text.d.ts +34 -0
  54. package/build/treb-base-types/src/render_text.js +22 -0
  55. package/build/treb-base-types/src/render_text.js.map +1 -0
  56. package/build/treb-base-types/src/style.d.ts +214 -0
  57. package/build/treb-base-types/src/style.js +373 -0
  58. package/build/treb-base-types/src/style.js.map +1 -0
  59. package/build/treb-base-types/src/table.d.ts +58 -0
  60. package/build/treb-base-types/src/table.js +27 -0
  61. package/build/treb-base-types/src/table.js.map +1 -0
  62. package/build/treb-base-types/src/text_part.d.ts +26 -0
  63. package/build/treb-base-types/src/text_part.js +47 -0
  64. package/build/treb-base-types/src/text_part.js.map +1 -0
  65. package/build/treb-base-types/src/theme.d.ts +120 -0
  66. package/build/treb-base-types/src/theme.js +460 -0
  67. package/build/treb-base-types/src/theme.js.map +1 -0
  68. package/build/treb-base-types/src/union.d.ts +73 -0
  69. package/build/treb-base-types/src/union.js +61 -0
  70. package/build/treb-base-types/src/union.js.map +1 -0
  71. package/build/treb-base-types/src/value-type.d.ts +86 -0
  72. package/build/treb-base-types/src/value-type.js +168 -0
  73. package/build/treb-base-types/src/value-type.js.map +1 -0
  74. package/build/treb-base-types/src/worker-proxy.d.ts +95 -0
  75. package/build/treb-base-types/src/worker-proxy.js +221 -0
  76. package/build/treb-base-types/src/worker-proxy.js.map +1 -0
  77. package/build/treb-calculator/src/calculator.d.ts +249 -0
  78. package/build/treb-calculator/src/calculator.js +2755 -0
  79. package/build/treb-calculator/src/calculator.js.map +1 -0
  80. package/build/treb-calculator/src/complex-math.d.ts +75 -0
  81. package/build/treb-calculator/src/complex-math.js +559 -0
  82. package/build/treb-calculator/src/complex-math.js.map +1 -0
  83. package/build/treb-calculator/src/dag/array-vertex.d.ts +71 -0
  84. package/build/treb-calculator/src/dag/array-vertex.js +156 -0
  85. package/build/treb-calculator/src/dag/array-vertex.js.map +1 -0
  86. package/build/treb-calculator/src/dag/calculation_leaf_vertex.d.ts +48 -0
  87. package/build/treb-calculator/src/dag/calculation_leaf_vertex.js +84 -0
  88. package/build/treb-calculator/src/dag/calculation_leaf_vertex.js.map +1 -0
  89. package/build/treb-calculator/src/dag/graph.d.ts +134 -0
  90. package/build/treb-calculator/src/dag/graph.js +842 -0
  91. package/build/treb-calculator/src/dag/graph.js.map +1 -0
  92. package/build/treb-calculator/src/dag/spreadsheet_vertex.d.ts +58 -0
  93. package/build/treb-calculator/src/dag/spreadsheet_vertex.js +232 -0
  94. package/build/treb-calculator/src/dag/spreadsheet_vertex.js.map +1 -0
  95. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.d.ts +20 -0
  96. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js +25 -0
  97. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js.map +1 -0
  98. package/build/treb-calculator/src/dag/state_leaf_vertex.d.ts +43 -0
  99. package/build/treb-calculator/src/dag/state_leaf_vertex.js +81 -0
  100. package/build/treb-calculator/src/dag/state_leaf_vertex.js.map +1 -0
  101. package/build/treb-calculator/src/dag/vertex.d.ts +71 -0
  102. package/build/treb-calculator/src/dag/vertex.js +274 -0
  103. package/build/treb-calculator/src/dag/vertex.js.map +1 -0
  104. package/build/treb-calculator/src/descriptors.d.ts +189 -0
  105. package/build/treb-calculator/src/descriptors.js +22 -0
  106. package/build/treb-calculator/src/descriptors.js.map +1 -0
  107. package/build/treb-calculator/src/expression-calculator.d.ts +127 -0
  108. package/build/treb-calculator/src/expression-calculator.js +1033 -0
  109. package/build/treb-calculator/src/expression-calculator.js.map +1 -0
  110. package/build/treb-calculator/src/function-error.d.ts +35 -0
  111. package/build/treb-calculator/src/function-error.js +85 -0
  112. package/build/treb-calculator/src/function-error.js.map +1 -0
  113. package/build/treb-calculator/src/function-library.d.ts +22 -0
  114. package/build/treb-calculator/src/function-library.js +96 -0
  115. package/build/treb-calculator/src/function-library.js.map +1 -0
  116. package/build/treb-calculator/src/functions/base-functions.d.ts +7 -0
  117. package/build/treb-calculator/src/functions/base-functions.js +2611 -0
  118. package/build/treb-calculator/src/functions/base-functions.js.map +1 -0
  119. package/build/treb-calculator/src/functions/beta.d.ts +17 -0
  120. package/build/treb-calculator/src/functions/beta.js +201 -0
  121. package/build/treb-calculator/src/functions/beta.js.map +1 -0
  122. package/build/treb-calculator/src/functions/checkbox.d.ts +3 -0
  123. package/build/treb-calculator/src/functions/checkbox.js +128 -0
  124. package/build/treb-calculator/src/functions/checkbox.js.map +1 -0
  125. package/build/treb-calculator/src/functions/complex-functions.d.ts +2 -0
  126. package/build/treb-calculator/src/functions/complex-functions.js +217 -0
  127. package/build/treb-calculator/src/functions/complex-functions.js.map +1 -0
  128. package/build/treb-calculator/src/functions/date-utils.d.ts +3 -0
  129. package/build/treb-calculator/src/functions/date-utils.js +59 -0
  130. package/build/treb-calculator/src/functions/date-utils.js.map +1 -0
  131. package/build/treb-calculator/src/functions/finance-functions.d.ts +2 -0
  132. package/build/treb-calculator/src/functions/finance-functions.js +547 -0
  133. package/build/treb-calculator/src/functions/finance-functions.js.map +1 -0
  134. package/build/treb-calculator/src/functions/fp.d.ts +2 -0
  135. package/build/treb-calculator/src/functions/fp.js +463 -0
  136. package/build/treb-calculator/src/functions/fp.js.map +1 -0
  137. package/build/treb-calculator/src/functions/function-utilities.d.ts +2 -0
  138. package/build/treb-calculator/src/functions/function-utilities.js +36 -0
  139. package/build/treb-calculator/src/functions/function-utilities.js.map +1 -0
  140. package/build/treb-calculator/src/functions/gamma.d.ts +20 -0
  141. package/build/treb-calculator/src/functions/gamma.js +142 -0
  142. package/build/treb-calculator/src/functions/gamma.js.map +1 -0
  143. package/build/treb-calculator/src/functions/information-functions.d.ts +2 -0
  144. package/build/treb-calculator/src/functions/information-functions.js +71 -0
  145. package/build/treb-calculator/src/functions/information-functions.js.map +1 -0
  146. package/build/treb-calculator/src/functions/lambda-functions.d.ts +2 -0
  147. package/build/treb-calculator/src/functions/lambda-functions.js +85 -0
  148. package/build/treb-calculator/src/functions/lambda-functions.js.map +1 -0
  149. package/build/treb-calculator/src/functions/matrix-functions.d.ts +2 -0
  150. package/build/treb-calculator/src/functions/matrix-functions.js +144 -0
  151. package/build/treb-calculator/src/functions/matrix-functions.js.map +1 -0
  152. package/build/treb-calculator/src/functions/normal.d.ts +2 -0
  153. package/build/treb-calculator/src/functions/normal.js +32 -0
  154. package/build/treb-calculator/src/functions/normal.js.map +1 -0
  155. package/build/treb-calculator/src/functions/regex-functions.d.ts +2 -0
  156. package/build/treb-calculator/src/functions/regex-functions.js +188 -0
  157. package/build/treb-calculator/src/functions/regex-functions.js.map +1 -0
  158. package/build/treb-calculator/src/functions/sparkline.d.ts +37 -0
  159. package/build/treb-calculator/src/functions/sparkline.js +264 -0
  160. package/build/treb-calculator/src/functions/sparkline.js.map +1 -0
  161. package/build/treb-calculator/src/functions/statistics-functions.d.ts +6 -0
  162. package/build/treb-calculator/src/functions/statistics-functions.js +989 -0
  163. package/build/treb-calculator/src/functions/statistics-functions.js.map +1 -0
  164. package/build/treb-calculator/src/functions/students-t.d.ts +3 -0
  165. package/build/treb-calculator/src/functions/students-t.js +64 -0
  166. package/build/treb-calculator/src/functions/students-t.js.map +1 -0
  167. package/build/treb-calculator/src/functions/text-functions.d.ts +3 -0
  168. package/build/treb-calculator/src/functions/text-functions.js +320 -0
  169. package/build/treb-calculator/src/functions/text-functions.js.map +1 -0
  170. package/build/treb-calculator/src/index.d.ts +2 -0
  171. package/build/treb-calculator/src/index.js +22 -0
  172. package/build/treb-calculator/src/index.js.map +1 -0
  173. package/build/treb-calculator/src/notifier-types.d.ts +26 -0
  174. package/build/treb-calculator/src/notifier-types.js +22 -0
  175. package/build/treb-calculator/src/notifier-types.js.map +1 -0
  176. package/build/treb-calculator/src/primitives.d.ts +15 -0
  177. package/build/treb-calculator/src/primitives.js +398 -0
  178. package/build/treb-calculator/src/primitives.js.map +1 -0
  179. package/build/treb-calculator/src/utilities.d.ts +68 -0
  180. package/build/treb-calculator/src/utilities.js +324 -0
  181. package/build/treb-calculator/src/utilities.js.map +1 -0
  182. package/build/treb-charts/src/chart-functions.d.ts +8 -0
  183. package/build/treb-charts/src/chart-functions.js +209 -0
  184. package/build/treb-charts/src/chart-functions.js.map +1 -0
  185. package/build/treb-charts/src/chart-types.d.ts +233 -0
  186. package/build/treb-charts/src/chart-types.js +57 -0
  187. package/build/treb-charts/src/chart-types.js.map +1 -0
  188. package/build/treb-charts/src/chart-utils.d.ts +106 -0
  189. package/build/treb-charts/src/chart-utils.js +1060 -0
  190. package/build/treb-charts/src/chart-utils.js.map +1 -0
  191. package/build/treb-charts/src/chart.d.ts +23 -0
  192. package/build/treb-charts/src/chart.js +94 -0
  193. package/build/treb-charts/src/chart.js.map +1 -0
  194. package/build/treb-charts/src/default-chart-renderer.d.ts +16 -0
  195. package/build/treb-charts/src/default-chart-renderer.js +533 -0
  196. package/build/treb-charts/src/default-chart-renderer.js.map +1 -0
  197. package/build/treb-charts/src/index.d.ts +5 -0
  198. package/build/treb-charts/src/index.js +24 -0
  199. package/build/treb-charts/src/index.js.map +1 -0
  200. package/build/treb-charts/src/main.d.ts +1 -0
  201. package/build/treb-charts/src/main.js +34 -0
  202. package/build/treb-charts/src/main.js.map +1 -0
  203. package/build/treb-charts/src/quicksort.d.ts +1 -0
  204. package/build/treb-charts/src/quicksort.js +49 -0
  205. package/build/treb-charts/src/quicksort.js.map +1 -0
  206. package/build/treb-charts/src/rectangle.d.ts +18 -0
  207. package/build/treb-charts/src/rectangle.js +41 -0
  208. package/build/treb-charts/src/rectangle.js.map +1 -0
  209. package/build/treb-charts/src/renderer-type.d.ts +24 -0
  210. package/build/treb-charts/src/renderer-type.js +22 -0
  211. package/build/treb-charts/src/renderer-type.js.map +1 -0
  212. package/build/treb-charts/src/renderer.d.ts +127 -0
  213. package/build/treb-charts/src/renderer.js +1518 -0
  214. package/build/treb-charts/src/renderer.js.map +1 -0
  215. package/build/treb-charts/src/util.d.ts +18 -0
  216. package/build/treb-charts/src/util.js +71 -0
  217. package/build/treb-charts/src/util.js.map +1 -0
  218. package/build/treb-data-model/src/annotation.d.ts +167 -0
  219. package/build/treb-data-model/src/annotation.js +120 -0
  220. package/build/treb-data-model/src/annotation.js.map +1 -0
  221. package/build/treb-data-model/src/conditional_format.d.ts +155 -0
  222. package/build/treb-data-model/src/conditional_format.js +62 -0
  223. package/build/treb-data-model/src/conditional_format.js.map +1 -0
  224. package/build/treb-data-model/src/data-validation.d.ts +28 -0
  225. package/build/treb-data-model/src/data-validation.js +22 -0
  226. package/build/treb-data-model/src/data-validation.js.map +1 -0
  227. package/build/treb-data-model/src/data_model.d.ts +173 -0
  228. package/build/treb-data-model/src/data_model.js +637 -0
  229. package/build/treb-data-model/src/data_model.js.map +1 -0
  230. package/build/treb-data-model/src/index.d.ts +13 -0
  231. package/build/treb-data-model/src/index.js +28 -0
  232. package/build/treb-data-model/src/index.js.map +1 -0
  233. package/build/treb-data-model/src/language-model.d.ts +22 -0
  234. package/build/treb-data-model/src/language-model.js +22 -0
  235. package/build/treb-data-model/src/language-model.js.map +1 -0
  236. package/build/treb-data-model/src/named.d.ts +124 -0
  237. package/build/treb-data-model/src/named.js +372 -0
  238. package/build/treb-data-model/src/named.js.map +1 -0
  239. package/build/treb-data-model/src/serialize_options.d.ts +49 -0
  240. package/build/treb-data-model/src/serialize_options.js +22 -0
  241. package/build/treb-data-model/src/serialize_options.js.map +1 -0
  242. package/build/treb-data-model/src/sheet.d.ts +499 -0
  243. package/build/treb-data-model/src/sheet.js +2904 -0
  244. package/build/treb-data-model/src/sheet.js.map +1 -0
  245. package/build/treb-data-model/src/sheet_collection.d.ts +58 -0
  246. package/build/treb-data-model/src/sheet_collection.js +112 -0
  247. package/build/treb-data-model/src/sheet_collection.js.map +1 -0
  248. package/build/treb-data-model/src/sheet_selection.d.ts +42 -0
  249. package/build/treb-data-model/src/sheet_selection.js +39 -0
  250. package/build/treb-data-model/src/sheet_selection.js.map +1 -0
  251. package/build/treb-data-model/src/sheet_types.d.ts +104 -0
  252. package/build/treb-data-model/src/sheet_types.js +22 -0
  253. package/build/treb-data-model/src/sheet_types.js.map +1 -0
  254. package/build/treb-data-model/src/types.d.ts +59 -0
  255. package/build/treb-data-model/src/types.js +22 -0
  256. package/build/treb-data-model/src/types.js.map +1 -0
  257. package/build/treb-embed/src/custom-element/spreadsheet-constructor.d.ts +75 -0
  258. package/build/treb-embed/src/custom-element/spreadsheet-constructor.js +1144 -0
  259. package/build/treb-embed/src/custom-element/spreadsheet-constructor.js.map +1 -0
  260. package/build/treb-embed/src/custom-element/treb-global.d.ts +36 -0
  261. package/build/treb-embed/src/custom-element/treb-global.js +64 -0
  262. package/build/treb-embed/src/custom-element/treb-global.js.map +1 -0
  263. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.d.ts +1 -0
  264. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js +61 -0
  265. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js.map +1 -0
  266. package/build/treb-embed/src/embedded-spreadsheet.d.ts +1358 -0
  267. package/build/treb-embed/src/embedded-spreadsheet.js +5205 -0
  268. package/build/treb-embed/src/embedded-spreadsheet.js.map +1 -0
  269. package/build/treb-embed/src/index.d.ts +12 -0
  270. package/build/treb-embed/src/index.js +34 -0
  271. package/build/treb-embed/src/index.js.map +1 -0
  272. package/build/treb-embed/src/options.d.ts +266 -0
  273. package/build/treb-embed/src/options.js +56 -0
  274. package/build/treb-embed/src/options.js.map +1 -0
  275. package/build/treb-embed/src/plugin.d.ts +9 -0
  276. package/build/treb-embed/src/plugin.js +22 -0
  277. package/build/treb-embed/src/plugin.js.map +1 -0
  278. package/build/treb-embed/src/progress-dialog.d.ts +49 -0
  279. package/build/treb-embed/src/progress-dialog.js +178 -0
  280. package/build/treb-embed/src/progress-dialog.js.map +1 -0
  281. package/build/treb-embed/src/selection-state.d.ts +15 -0
  282. package/build/treb-embed/src/selection-state.js +22 -0
  283. package/build/treb-embed/src/selection-state.js.map +1 -0
  284. package/build/treb-embed/src/spinner.d.ts +8 -0
  285. package/build/treb-embed/src/spinner.js +40 -0
  286. package/build/treb-embed/src/spinner.js.map +1 -0
  287. package/build/treb-embed/src/toolbar-message.d.ts +72 -0
  288. package/build/treb-embed/src/toolbar-message.js +22 -0
  289. package/build/treb-embed/src/toolbar-message.js.map +1 -0
  290. package/build/treb-embed/src/types.d.ts +185 -0
  291. package/build/treb-embed/src/types.js +45 -0
  292. package/build/treb-embed/src/types.js.map +1 -0
  293. package/build/treb-embed/tsconfig.tsbuildinfo +1 -0
  294. package/build/treb-export/src/address-type.d.ts +34 -0
  295. package/build/treb-export/src/address-type.js +53 -0
  296. package/build/treb-export/src/address-type.js.map +1 -0
  297. package/build/treb-export/src/base-template.d.ts +1 -0
  298. package/build/treb-export/src/base-template.js +22 -0
  299. package/build/treb-export/src/base-template.js.map +1 -0
  300. package/build/treb-export/src/column-width.d.ts +2 -0
  301. package/build/treb-export/src/column-width.js +80 -0
  302. package/build/treb-export/src/column-width.js.map +1 -0
  303. package/build/treb-export/src/drawing/bubble-chart-template.d.ts +514 -0
  304. package/build/treb-export/src/drawing/bubble-chart-template.js +544 -0
  305. package/build/treb-export/src/drawing/bubble-chart-template.js.map +1 -0
  306. package/build/treb-export/src/drawing/chart-template-components2.d.ts +365 -0
  307. package/build/treb-export/src/drawing/chart-template-components2.js +386 -0
  308. package/build/treb-export/src/drawing/chart-template-components2.js.map +1 -0
  309. package/build/treb-export/src/drawing/chart.d.ts +26 -0
  310. package/build/treb-export/src/drawing/chart.js +247 -0
  311. package/build/treb-export/src/drawing/chart.js.map +1 -0
  312. package/build/treb-export/src/drawing/column-chart-template2.d.ts +490 -0
  313. package/build/treb-export/src/drawing/column-chart-template2.js +518 -0
  314. package/build/treb-export/src/drawing/column-chart-template2.js.map +1 -0
  315. package/build/treb-export/src/drawing/donut-chart-template2.d.ts +272 -0
  316. package/build/treb-export/src/drawing/donut-chart-template2.js +293 -0
  317. package/build/treb-export/src/drawing/donut-chart-template2.js.map +1 -0
  318. package/build/treb-export/src/drawing/drawing.d.ts +49 -0
  319. package/build/treb-export/src/drawing/drawing.js +193 -0
  320. package/build/treb-export/src/drawing/drawing.js.map +1 -0
  321. package/build/treb-export/src/drawing/embedded-image.d.ts +12 -0
  322. package/build/treb-export/src/drawing/embedded-image.js +54 -0
  323. package/build/treb-export/src/drawing/embedded-image.js.map +1 -0
  324. package/build/treb-export/src/drawing/scatter-chart-template2.d.ts +520 -0
  325. package/build/treb-export/src/drawing/scatter-chart-template2.js +551 -0
  326. package/build/treb-export/src/drawing/scatter-chart-template2.js.map +1 -0
  327. package/build/treb-export/src/export.d.ts +72 -0
  328. package/build/treb-export/src/export.js +2039 -0
  329. package/build/treb-export/src/export.js.map +1 -0
  330. package/build/treb-export/src/import-export-messages.d.ts +31 -0
  331. package/build/treb-export/src/import-export-messages.js +22 -0
  332. package/build/treb-export/src/import-export-messages.js.map +1 -0
  333. package/build/treb-export/src/import.d.ts +33 -0
  334. package/build/treb-export/src/import.js +1258 -0
  335. package/build/treb-export/src/import.js.map +1 -0
  336. package/build/treb-export/src/index.worker.d.ts +1 -0
  337. package/build/treb-export/src/index.worker.js +93 -0
  338. package/build/treb-export/src/index.worker.js.map +1 -0
  339. package/build/treb-export/src/metadata.d.ts +51 -0
  340. package/build/treb-export/src/metadata.js +153 -0
  341. package/build/treb-export/src/metadata.js.map +1 -0
  342. package/build/treb-export/src/ooxml.d.ts +7 -0
  343. package/build/treb-export/src/ooxml.js +41 -0
  344. package/build/treb-export/src/ooxml.js.map +1 -0
  345. package/build/treb-export/src/relationship.d.ts +8 -0
  346. package/build/treb-export/src/relationship.js +27 -0
  347. package/build/treb-export/src/relationship.js.map +1 -0
  348. package/build/treb-export/src/shared-strings.d.ts +11 -0
  349. package/build/treb-export/src/shared-strings.js +105 -0
  350. package/build/treb-export/src/shared-strings.js.map +1 -0
  351. package/build/treb-export/src/template-2.d.ts +1 -0
  352. package/build/treb-export/src/template-2.js +22 -0
  353. package/build/treb-export/src/template-2.js.map +1 -0
  354. package/build/treb-export/src/unescape_xml.d.ts +1 -0
  355. package/build/treb-export/src/unescape_xml.js +61 -0
  356. package/build/treb-export/src/unescape_xml.js.map +1 -0
  357. package/build/treb-export/src/workbook-sheet.d.ts +75 -0
  358. package/build/treb-export/src/workbook-sheet.js +128 -0
  359. package/build/treb-export/src/workbook-sheet.js.map +1 -0
  360. package/build/treb-export/src/workbook-style.d.ts +110 -0
  361. package/build/treb-export/src/workbook-style.js +1134 -0
  362. package/build/treb-export/src/workbook-style.js.map +1 -0
  363. package/build/treb-export/src/workbook-theme.d.ts +13 -0
  364. package/build/treb-export/src/workbook-theme.js +85 -0
  365. package/build/treb-export/src/workbook-theme.js.map +1 -0
  366. package/build/treb-export/src/workbook.d.ts +123 -0
  367. package/build/treb-export/src/workbook.js +644 -0
  368. package/build/treb-export/src/workbook.js.map +1 -0
  369. package/build/treb-export/src/xml-test.d.ts +9 -0
  370. package/build/treb-export/src/xml-test.js +52 -0
  371. package/build/treb-export/src/xml-test.js.map +1 -0
  372. package/build/treb-export/src/xml-utils.d.ts +76 -0
  373. package/build/treb-export/src/xml-utils.js +223 -0
  374. package/build/treb-export/src/xml-utils.js.map +1 -0
  375. package/build/treb-export/src/zip-wrapper.d.ts +22 -0
  376. package/build/treb-export/src/zip-wrapper.js +93 -0
  377. package/build/treb-export/src/zip-wrapper.js.map +1 -0
  378. package/build/treb-format/src/format.d.ts +130 -0
  379. package/build/treb-format/src/format.js +805 -0
  380. package/build/treb-format/src/format.js.map +1 -0
  381. package/build/treb-format/src/format_cache.d.ts +55 -0
  382. package/build/treb-format/src/format_cache.js +166 -0
  383. package/build/treb-format/src/format_cache.js.map +1 -0
  384. package/build/treb-format/src/format_parser.d.ts +70 -0
  385. package/build/treb-format/src/format_parser.js +618 -0
  386. package/build/treb-format/src/format_parser.js.map +1 -0
  387. package/build/treb-format/src/index.d.ts +4 -0
  388. package/build/treb-format/src/index.js +25 -0
  389. package/build/treb-format/src/index.js.map +1 -0
  390. package/build/treb-format/src/number_format_section.d.ts +58 -0
  391. package/build/treb-format/src/number_format_section.js +78 -0
  392. package/build/treb-format/src/number_format_section.js.map +1 -0
  393. package/build/treb-format/src/value_parser.d.ts +48 -0
  394. package/build/treb-format/src/value_parser.js +244 -0
  395. package/build/treb-format/src/value_parser.js.map +1 -0
  396. package/build/treb-grid/src/editors/autocomplete.d.ts +39 -0
  397. package/build/treb-grid/src/editors/autocomplete.js +316 -0
  398. package/build/treb-grid/src/editors/autocomplete.js.map +1 -0
  399. package/build/treb-grid/src/editors/autocomplete_matcher.d.ts +74 -0
  400. package/build/treb-grid/src/editors/autocomplete_matcher.js +212 -0
  401. package/build/treb-grid/src/editors/autocomplete_matcher.js.map +1 -0
  402. package/build/treb-grid/src/editors/editor.d.ts +214 -0
  403. package/build/treb-grid/src/editors/editor.js +879 -0
  404. package/build/treb-grid/src/editors/editor.js.map +1 -0
  405. package/build/treb-grid/src/editors/external_editor.d.ts +11 -0
  406. package/build/treb-grid/src/editors/external_editor.js +118 -0
  407. package/build/treb-grid/src/editors/external_editor.js.map +1 -0
  408. package/build/treb-grid/src/editors/formula_bar.d.ts +85 -0
  409. package/build/treb-grid/src/editors/formula_bar.js +444 -0
  410. package/build/treb-grid/src/editors/formula_bar.js.map +1 -0
  411. package/build/treb-grid/src/editors/overlay_editor.d.ts +85 -0
  412. package/build/treb-grid/src/editors/overlay_editor.js +353 -0
  413. package/build/treb-grid/src/editors/overlay_editor.js.map +1 -0
  414. package/build/treb-grid/src/index.d.ts +12 -0
  415. package/build/treb-grid/src/index.js +28 -0
  416. package/build/treb-grid/src/index.js.map +1 -0
  417. package/build/treb-grid/src/layout/base_layout.d.ts +346 -0
  418. package/build/treb-grid/src/layout/base_layout.js +2050 -0
  419. package/build/treb-grid/src/layout/base_layout.js.map +1 -0
  420. package/build/treb-grid/src/layout/grid_layout.d.ts +19 -0
  421. package/build/treb-grid/src/layout/grid_layout.js +235 -0
  422. package/build/treb-grid/src/layout/grid_layout.js.map +1 -0
  423. package/build/treb-grid/src/layout/mock-layout.d.ts +10 -0
  424. package/build/treb-grid/src/layout/mock-layout.js +37 -0
  425. package/build/treb-grid/src/layout/mock-layout.js.map +1 -0
  426. package/build/treb-grid/src/render/selection-renderer.d.ts +97 -0
  427. package/build/treb-grid/src/render/selection-renderer.js +315 -0
  428. package/build/treb-grid/src/render/selection-renderer.js.map +1 -0
  429. package/build/treb-grid/src/render/svg_header_overlay.d.ts +20 -0
  430. package/build/treb-grid/src/render/svg_header_overlay.js +76 -0
  431. package/build/treb-grid/src/render/svg_header_overlay.js.map +1 -0
  432. package/build/treb-grid/src/render/svg_selection_block.d.ts +27 -0
  433. package/build/treb-grid/src/render/svg_selection_block.js +106 -0
  434. package/build/treb-grid/src/render/svg_selection_block.js.map +1 -0
  435. package/build/treb-grid/src/render/tile_renderer.d.ts +121 -0
  436. package/build/treb-grid/src/render/tile_renderer.js +1609 -0
  437. package/build/treb-grid/src/render/tile_renderer.js.map +1 -0
  438. package/build/treb-grid/src/types/border_constants.d.ts +9 -0
  439. package/build/treb-grid/src/types/border_constants.js +34 -0
  440. package/build/treb-grid/src/types/border_constants.js.map +1 -0
  441. package/build/treb-grid/src/types/clipboard_data.d.ts +11 -0
  442. package/build/treb-grid/src/types/clipboard_data.js +22 -0
  443. package/build/treb-grid/src/types/clipboard_data.js.map +1 -0
  444. package/build/treb-grid/src/types/clipboard_data2.d.ts +46 -0
  445. package/build/treb-grid/src/types/clipboard_data2.js +22 -0
  446. package/build/treb-grid/src/types/clipboard_data2.js.map +1 -0
  447. package/build/treb-grid/src/types/drag_mask.d.ts +10 -0
  448. package/build/treb-grid/src/types/drag_mask.js +78 -0
  449. package/build/treb-grid/src/types/drag_mask.js.map +1 -0
  450. package/build/treb-grid/src/types/external_editor_config.d.ts +33 -0
  451. package/build/treb-grid/src/types/external_editor_config.js +22 -0
  452. package/build/treb-grid/src/types/external_editor_config.js.map +1 -0
  453. package/build/treb-grid/src/types/grid.d.ts +806 -0
  454. package/build/treb-grid/src/types/grid.js +6410 -0
  455. package/build/treb-grid/src/types/grid.js.map +1 -0
  456. package/build/treb-grid/src/types/grid_base.d.ts +442 -0
  457. package/build/treb-grid/src/types/grid_base.js +3523 -0
  458. package/build/treb-grid/src/types/grid_base.js.map +1 -0
  459. package/build/treb-grid/src/types/grid_command.d.ts +408 -0
  460. package/build/treb-grid/src/types/grid_command.js +75 -0
  461. package/build/treb-grid/src/types/grid_command.js.map +1 -0
  462. package/build/treb-grid/src/types/grid_events.d.ts +93 -0
  463. package/build/treb-grid/src/types/grid_events.js +36 -0
  464. package/build/treb-grid/src/types/grid_events.js.map +1 -0
  465. package/build/treb-grid/src/types/grid_options.d.ts +50 -0
  466. package/build/treb-grid/src/types/grid_options.js +34 -0
  467. package/build/treb-grid/src/types/grid_options.js.map +1 -0
  468. package/build/treb-grid/src/types/scale-control.d.ts +21 -0
  469. package/build/treb-grid/src/types/scale-control.js +148 -0
  470. package/build/treb-grid/src/types/scale-control.js.map +1 -0
  471. package/build/treb-grid/src/types/set_range_options.d.ts +24 -0
  472. package/build/treb-grid/src/types/set_range_options.js +22 -0
  473. package/build/treb-grid/src/types/set_range_options.js.map +1 -0
  474. package/build/treb-grid/src/types/tab_bar.d.ts +84 -0
  475. package/build/treb-grid/src/types/tab_bar.js +426 -0
  476. package/build/treb-grid/src/types/tab_bar.js.map +1 -0
  477. package/build/treb-grid/src/types/tile.d.ts +29 -0
  478. package/build/treb-grid/src/types/tile.js +22 -0
  479. package/build/treb-grid/src/types/tile.js.map +1 -0
  480. package/build/treb-grid/src/types/update_flags.d.ts +48 -0
  481. package/build/treb-grid/src/types/update_flags.js +22 -0
  482. package/build/treb-grid/src/types/update_flags.js.map +1 -0
  483. package/build/treb-grid/src/util/fontmetrics.d.ts +21 -0
  484. package/build/treb-grid/src/util/fontmetrics.js +82 -0
  485. package/build/treb-grid/src/util/fontmetrics.js.map +1 -0
  486. package/build/treb-grid/src/util/ua.d.ts +33 -0
  487. package/build/treb-grid/src/util/ua.js +86 -0
  488. package/build/treb-grid/src/util/ua.js.map +1 -0
  489. package/build/treb-parser/src/csv-parser.d.ts +13 -0
  490. package/build/treb-parser/src/csv-parser.js +107 -0
  491. package/build/treb-parser/src/csv-parser.js.map +1 -0
  492. package/build/treb-parser/src/index.d.ts +4 -0
  493. package/build/treb-parser/src/index.js +25 -0
  494. package/build/treb-parser/src/index.js.map +1 -0
  495. package/build/treb-parser/src/md-parser.d.ts +97 -0
  496. package/build/treb-parser/src/md-parser.js +403 -0
  497. package/build/treb-parser/src/md-parser.js.map +1 -0
  498. package/build/treb-parser/src/parser-types.d.ts +345 -0
  499. package/build/treb-parser/src/parser-types.js +53 -0
  500. package/build/treb-parser/src/parser-types.js.map +1 -0
  501. package/build/treb-parser/src/parser.d.ts +422 -0
  502. package/build/treb-parser/src/parser.js +2418 -0
  503. package/build/treb-parser/src/parser.js.map +1 -0
  504. package/build/treb-utils/src/event_source.d.ts +34 -0
  505. package/build/treb-utils/src/event_source.js +110 -0
  506. package/build/treb-utils/src/event_source.js.map +1 -0
  507. package/build/treb-utils/src/ievent_source.d.ts +9 -0
  508. package/build/treb-utils/src/ievent_source.js +22 -0
  509. package/build/treb-utils/src/ievent_source.js.map +1 -0
  510. package/build/treb-utils/src/index.d.ts +6 -0
  511. package/build/treb-utils/src/index.js +30 -0
  512. package/build/treb-utils/src/index.js.map +1 -0
  513. package/build/treb-utils/src/measurement.d.ts +42 -0
  514. package/build/treb-utils/src/measurement.js +145 -0
  515. package/build/treb-utils/src/measurement.js.map +1 -0
  516. package/build/treb-utils/src/scale.d.ts +16 -0
  517. package/build/treb-utils/src/scale.js +106 -0
  518. package/build/treb-utils/src/scale.js.map +1 -0
  519. package/build/treb-utils/src/serialize_html.d.ts +5 -0
  520. package/build/treb-utils/src/serialize_html.js +128 -0
  521. package/build/treb-utils/src/serialize_html.js.map +1 -0
  522. package/build/treb-utils/src/validate_uri.d.ts +20 -0
  523. package/build/treb-utils/src/validate_uri.js +55 -0
  524. package/build/treb-utils/src/validate_uri.js.map +1 -0
  525. package/dist/{chunk-XD5PEZBZ.mjs → chunk-E35ONJUS.mjs} +1 -1
  526. package/dist/treb-export-worker.mjs +2 -2
  527. package/dist/treb-spreadsheet.mjs +4 -4
  528. package/package.json +1 -1
@@ -0,0 +1,106 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2026 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+ /**
22
+ * making this a little more generic so we can use it outside of charts.
23
+ * specifically, for the sheet "histogram table" function. for that, we
24
+ * do need to ensure that the count is not greater than our request.
25
+ *
26
+ * we have a new parameter for that, default behavior should not change.
27
+ */
28
+ export const Scale = (min, max, count = 6.5, limit_count = false, discrete = false) => {
29
+ if (max === min) {
30
+ // we should either have optional behavior here or have this as
31
+ // some sort of wrapper method -- it just seems arbitrary
32
+ max++;
33
+ if (min) {
34
+ min--;
35
+ }
36
+ }
37
+ else {
38
+ // let's fix this specific problem, where you get accumulated fp errors. round to 5 places...
39
+ // const tmp_range = max - min;
40
+ const rounded = Math.round(max * 100000) / 100000;
41
+ if (Math.abs(rounded - max) / (max - min) < 1e-5) {
42
+ max = rounded;
43
+ }
44
+ }
45
+ const range = max - min;
46
+ const log10 = Math.log(range) / Math.log(10); // just avoid the problem (problem being IE11 lack of Math.log10)
47
+ let scale = Math.floor(Math.abs(log10)) * (log10 < 0 ? -1 : 1) - 1;
48
+ // so if you claim you have discrete data, we want the minimum
49
+ // step to be 1. we also have slightly different acceptable steps.
50
+ if (discrete) {
51
+ scale = Math.max(0, scale);
52
+ }
53
+ const steps = discrete ?
54
+ [1, 2, 5, 10, 15, 20, 25, 50, 100] :
55
+ [.1, .25, .5, 1, 2.5, 5, 10, 25, 50, 100];
56
+ let step = -1;
57
+ let delta = 0;
58
+ for (const x of steps) {
59
+ const test_step = x * Math.pow(10, scale);
60
+ const test_min = Math.floor(min / test_step) * test_step;
61
+ const test_max = Math.ceil(max / test_step) * test_step;
62
+ const test_count = (test_max - test_min) / test_step;
63
+ const test_delta = Math.abs(test_count - count);
64
+ if (step < 0 || test_delta < delta) {
65
+ if (!limit_count || (test_count <= count)) {
66
+ delta = test_delta;
67
+ step = test_step;
68
+ }
69
+ }
70
+ /*
71
+ else if (!limit_count && (test_delta < delta)) {
72
+ delta = test_delta;
73
+ step = test_step;
74
+ }
75
+ else if (limit_count && test_delta < delta && test_count <= count) {
76
+ delta = test_delta;
77
+ step = test_step;
78
+ }
79
+ */
80
+ /*
81
+
82
+ if (step < 0 || test_delta < delta){
83
+ delta = test_delta;
84
+ step = test_step;
85
+ }
86
+ else if (step >= 0 && test_delta > delta) {
87
+ if (limit_count) {
88
+ min = Math.floor(min / step) * step;
89
+ max = Math.ceil(max / step) * step;
90
+ const check = Math.round((max - min) / step);
91
+ if (check > count) {
92
+ delta = test_delta;
93
+ step = test_step;
94
+ continue;
95
+ }
96
+ }
97
+ break;
98
+ }
99
+ */
100
+ }
101
+ min = Math.floor(min / step) * step;
102
+ max = Math.ceil(max / step) * step;
103
+ count = Math.round((max - min) / step); // accounts for fp errors
104
+ return { scale, step, count, min, max };
105
+ };
106
+ //# sourceMappingURL=scale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scale.js","sourceRoot":"","sources":["../../../treb-utils/src/scale.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * serialize a node by creating a clone with static styling that can be
3
+ * used stand-alone (intended for svg, but could apply generically).
4
+ */
5
+ export declare const SerializeHTML: (node: Element) => Node;
@@ -0,0 +1,128 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2026 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+ /**
22
+ * defaults are global, since we assume they never change. created on demand.
23
+ */
24
+ let default_properties;
25
+ /**
26
+ * convert CSSStyleDeclaration to map
27
+ */
28
+ const PropertyMap = (source) => {
29
+ const map = new Map();
30
+ // you can iterate this thing, although apparently ts won't allow
31
+ // it because it's not in the spec? should probably play ball
32
+ for (let i = 0; i < source.length; i++) {
33
+ const key = source[i];
34
+ map.set(key, source.getPropertyValue(key));
35
+ }
36
+ return map;
37
+ };
38
+ /**
39
+ * get applied style as text (for attribute)
40
+ */
41
+ const GetAppliedStyle = (node, computed, defaults) => {
42
+ const applied = new Map();
43
+ const computed_map = PropertyMap(computed);
44
+ for (const [key, value] of computed_map.entries()) {
45
+ if (value !== defaults.get(key)) {
46
+ applied.set(key, value);
47
+ }
48
+ }
49
+ const arr = Array.from(applied.entries());
50
+ return (arr.map(([key, value]) => `${key}: ${value}`).join('; ') +
51
+ '; ' + (node.getAttribute('style') || '')).trim().replace(/"/g, '\'');
52
+ };
53
+ /**
54
+ * create a clone of the node with static styles applied
55
+ */
56
+ const RenderNode = (node, defaults) => {
57
+ const clone = node.cloneNode(false);
58
+ const computed = getComputedStyle(node);
59
+ const style = GetAppliedStyle(node, computed, defaults);
60
+ clone.removeAttribute('class');
61
+ clone.setAttribute('style', style);
62
+ let computed_map;
63
+ Array.prototype.forEach.call(node.childNodes, (child) => {
64
+ switch (child.nodeType) {
65
+ case Node.ELEMENT_NODE:
66
+ // here we use the parent as the default style, assuming the child will inherit
67
+ // create on demand, if necessary
68
+ if (!computed_map) {
69
+ computed_map = PropertyMap(computed);
70
+ }
71
+ clone.appendChild(RenderNode(child, computed_map));
72
+ break;
73
+ case Node.TEXT_NODE:
74
+ if (node.textContent) {
75
+ clone.appendChild(document.createTextNode(node.textContent));
76
+ }
77
+ break;
78
+ case Node.COMMENT_NODE:
79
+ // silently drop comments
80
+ break;
81
+ default:
82
+ console.warn('unhandled node type in serialize', child);
83
+ }
84
+ });
85
+ return clone;
86
+ };
87
+ /**
88
+ * serialize a node by creating a clone with static styling that can be
89
+ * used stand-alone (intended for svg, but could apply generically).
90
+ */
91
+ export const SerializeHTML = (node) => {
92
+ if (!default_properties) {
93
+ const defaults = new Map();
94
+ // regarding document, in this case we're creating an iframe
95
+ // specifically for isolation, and adding it to "document".
96
+ // there's no reason to require the context document here (I think).
97
+ const iframe = document.createElement('iframe');
98
+ iframe.style.width = '10px';
99
+ iframe.style.height = '10px';
100
+ iframe.style.position = 'absolute';
101
+ iframe.style.left = '-100px';
102
+ document.body.appendChild(iframe);
103
+ const frame_document = iframe.contentDocument;
104
+ if (frame_document) {
105
+ const div = frame_document.createElement('div');
106
+ frame_document.body.appendChild(div);
107
+ const computed = getComputedStyle(div);
108
+ Array.prototype.forEach.call(computed, key => defaults.set(key, computed[key]));
109
+ }
110
+ document.body.removeChild(iframe);
111
+ default_properties = defaults;
112
+ }
113
+ const rendered = RenderNode(node, default_properties);
114
+ if (rendered instanceof Element && rendered.tagName === 'svg') {
115
+ if (!rendered.hasAttribute('version')) {
116
+ rendered.setAttribute('version', '1.1');
117
+ }
118
+ if (!rendered.hasAttribute('xmlns')) {
119
+ rendered.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
120
+ }
121
+ if (!rendered.hasAttribute('xmlns:xlink')) {
122
+ rendered.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
123
+ }
124
+ }
125
+ return rendered;
126
+ };
127
+ // (self as any).SerializeHTML = SerializeHTML;
128
+ //# sourceMappingURL=serialize_html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize_html.js","sourceRoot":"","sources":["../../../treb-utils/src/serialize_html.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * TODO: possibly add an allow-list for remotes
3
+ */
4
+ export interface ValidURIOptions {
5
+ /** allow data: uri (default true) */
6
+ data: boolean;
7
+ /** allow same-origin (default true) */
8
+ same_origin: boolean;
9
+ /** allow remote (default false) */
10
+ remote: boolean;
11
+ }
12
+ /**
13
+ * check if this resource is a valid URI. by default we only
14
+ * allow data: and same-origin URIs, but you can override that
15
+ * with a flag.
16
+ *
17
+ * this assumes we have a document (and location) so it should
18
+ * only be called from browser context.
19
+ */
20
+ export declare const ValidateURI: (resource: string, options?: Partial<ValidURIOptions>) => string | undefined;
@@ -0,0 +1,55 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2026 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+ const default_uri_options = {
22
+ data: true,
23
+ same_origin: true,
24
+ remote: false,
25
+ };
26
+ /**
27
+ * check if this resource is a valid URI. by default we only
28
+ * allow data: and same-origin URIs, but you can override that
29
+ * with a flag.
30
+ *
31
+ * this assumes we have a document (and location) so it should
32
+ * only be called from browser context.
33
+ */
34
+ export const ValidateURI = (resource, options = {}) => {
35
+ const composite = {
36
+ ...default_uri_options,
37
+ ...options,
38
+ };
39
+ // console.info({composite});
40
+ try {
41
+ const url = new URL(resource, document.location.href);
42
+ if (url.protocol === 'data:') {
43
+ return composite.data ? url.href : undefined;
44
+ }
45
+ if (url.origin === document.location.origin) {
46
+ return composite.same_origin ? url.href : undefined;
47
+ }
48
+ return composite.remote ? url.hash : undefined;
49
+ }
50
+ catch (err) {
51
+ console.error(err);
52
+ }
53
+ return undefined;
54
+ };
55
+ //# sourceMappingURL=validate_uri.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate_uri.js","sourceRoot":"","sources":["../../../treb-utils/src/validate_uri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAmBH,MAAM,mBAAmB,GAAoB;IAC3C,IAAI,EAAE,IAAI;IACV,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,KAAK;CACd,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,UAAoC,EAAE,EAAoB,EAAE;IAExG,MAAM,SAAS,GAAoB;QACjC,GAAG,mBAAmB;QACtB,GAAG,OAAO;KACX,CAAC;IAEF,6BAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEtD,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/C,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC5C,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACtD,CAAC;QAED,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjD,CAAC;IACD,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,SAAS,CAAC;AAEnB,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- /*! TREB v37.0.0. Copyright 2018-2026 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! TREB v37.0.1. Copyright 2018-2026 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
2
2
  var pi=Object.create;var Ke=Object.defineProperty;var mi=Object.getOwnPropertyDescriptor;var _i=Object.getOwnPropertyNames;var bi=Object.getPrototypeOf,yi=Object.prototype.hasOwnProperty;var gr=(f,e)=>()=>(e||f((e={exports:{}}).exports,e),e.exports),gi=(f,e)=>{for(var t in e)Ke(f,t,{get:e[t],enumerable:!0})},wi=(f,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of _i(e))!yi.call(f,r)&&r!==t&&Ke(f,r,{get:()=>e[r],enumerable:!(i=mi(e,r))||i.enumerable});return f};var wr=(f,e,t)=>(t=f!=null?pi(bi(f)):{},wi(e||!f||!f.__esModule?Ke(t,"default",{value:f,enumerable:!0}):t,f));function vi(){return typeof Worker>"u"}var Qe=class{worker;Terminate(){this.worker?.terminate()}async Init(e,t){this.worker=t()}PostMessage(e){this.worker?.postMessage(e)}OnMessage(e){this.worker&&(this.worker.onmessage=e)}OnError(e){this.worker&&(this.worker.onerror=e)}},Ze=class{worker;Terminate(){this.worker?.terminate()}async Init(e){let{Worker:t}=await import("node:worker_threads");this.worker=new t(new URL(e,import.meta.url))}PostMessage(e){this.worker?.postMessage(e)}OnMessage(e){this.worker&&this.worker.on("message",t=>e({data:t}))}OnError(e){this.worker&&this.worker.on("error",t=>e({error:t}))}},Ye,et=class{tx_cache=[];main_thread_to_worker_message_handler;rx_cache=[];worker_to_main_thread_message_handler;Terminate(){this.tx_cache=[],this.rx_cache=[],this.main_thread_to_worker_message_handler=void 0,this.worker_to_main_thread_message_handler=void 0}async Init(e){Ye=this,await import(new URL(e,import.meta.url).toString())}PostMessage(e){if(this.main_thread_to_worker_message_handler){let t=this.main_thread_to_worker_message_handler;Promise.resolve().then(()=>t({data:e}))}else this.tx_cache.push(e)}OnMessage(e){if(this.worker_to_main_thread_message_handler=e,this.rx_cache.length){let t=[...this.rx_cache];this.rx_cache=[],this.FlushCache(t,e)}}OnError(e){}FlushCache(e,t){Promise.resolve().then(async()=>{for(let i of e){let r=t({data:i});r instanceof Promise&&await r}})}addEventListener(e,t){if(this.main_thread_to_worker_message_handler=t,this.tx_cache.length){let i=[...this.tx_cache];this.tx_cache=[],this.FlushCache(i,t)}}postMessage(e){this.worker_to_main_thread_message_handler?this.worker_to_main_thread_message_handler({data:e}):this.rx_cache.push(e)}};function xr(f=!1){return f?new et:vi()?new Ze:new Qe}var Cr=async()=>{let f;if(Ye)f=Ye;else if(typeof self>"u"){let{parentPort:e}=await import("node:worker_threads");f={postMessage:t=>{e?.postMessage(t)},addEventListener:(t,i)=>{e?.on("message",r=>{i({data:r})})}}}else f=self;return f};var L=f=>f!==null&&typeof f=="object"&&"row"in f&&"column"in f,It=f=>f!==null&&typeof f=="object"&&"start"in f&&L(f.start)&&"end"in f&&L(f.end),_=class f{start_;end_;constructor(e,t=e,i=!1){this.end_=this.PatchNull(t),this.start_=this.PatchNull(e),i&&this.Normalize()}static FromColumn(e){return new f({row:1/0,column:e})}static FromRow(e){return new f({row:e,column:1/0})}static ColumnToLabel(e){let t=String.fromCharCode(65+e%26);for(;e>25;)e=Math.floor(e/26)-1,t=String.fromCharCode(65+e%26)+t;return t}static CellAddressToLabel(e,t=!1){if(e.row===1/0&&e.column===1/0)throw new Error("this is going to break something");let i=t?`${e.sheet_id||0}!`:"";return e.row===1/0?i+(e.absolute_column?"$":"")+this.ColumnToLabel(e.column):e.column===1/0?i+(e.absolute_row?"$":"")+(e.row+1):i+(e.absolute_column?"$":"")+this.ColumnToLabel(e.column)+(e.absolute_row?"$":"")+(e.row+1)+(e.spill?"#":"")}static Join(e,...t){let i=new f(e.start,e.end);for(let r of t)r&&(i.ConsumeAddress(r.start),i.ConsumeAddress(r.end));return i}static Bleed(e,t=1){return new f({row:Math.max(0,e.start.row-t),column:Math.max(0,e.start.column-t),sheet_id:e.start.sheet_id},{row:e.end.row+t,column:e.end.column+t})}static PatchArea(e,t){let{before_column:i,column_count:r,before_row:s,row_count:o}=t,n=new f(e.start,e.end),a=e.start.sheet_id;if(r&&i<=n.end.column){if(r>0)i<=n.start.column?n.Shift(0,r):i>n.start.column&&i<=n.end.column?n.ConsumeAddress({row:n.end.row,column:n.end.column+r}):console.warn("AA X case 1",i,r,JSON.stringify(n));else if(r<0)if(i-r<=n.start.column)n.Shift(0,r);else{if(i<=n.start.column&&i-r>n.end.column)return!1;if(i<=n.start.column){let l=i-r-1;n=new f({row:n.start.row,column:l+1+r,sheet_id:a},{row:n.end.row,column:n.end.column+r})}else i<=n.end.column?i-r-1>=n.end.column?n=new f({row:n.start.row,column:n.start.column,sheet_id:a},{row:n.end.row,column:i-1}):n=new f({row:n.start.row,column:n.start.column,sheet_id:a},{row:n.end.row,column:n.start.column+n.columns+r-1}):console.warn("AA X case 2",i,r,JSON.stringify(n))}}if(o&&s<=n.end.row){if(o>0)s<=n.start.row?n.Shift(o,0):s>n.start.row&&s<=n.end.row?n.ConsumeAddress({row:n.end.row+o,column:n.end.column}):console.warn("AA X case 3",s,o,JSON.stringify(n));else if(o<0)if(s-o<=n.start.row)n.Shift(o,0);else{if(s<=n.start.row&&s-o>n.end.row)return!1;if(s<=n.start.row){let l=s-o-1;n=new f({column:n.start.column,row:l+1+o,sheet_id:a},{column:n.end.column,row:n.end.row+o})}else s<=n.end.row?s-o-1>=n.end.row?n=new f({column:n.start.column,row:n.start.row,sheet_id:a},{column:n.end.column,row:s-1}):n=new f({column:n.start.column,row:n.start.row,sheet_id:a},{column:n.end.column,row:n.start.row+n.rows+o-1}):console.warn("AA X case 4",s,o,JSON.stringify(n))}}return n}get start(){return{...this.start_}}set start(e){this.start_=e}get end(){return{...this.end_}}set end(e){this.end_=e}get rows(){return this.start_.row===1/0||this.end_.row===1/0?1/0:this.end_.row-this.start_.row+1}get columns(){return this.start_.column===1/0||this.end_.column===1/0?1/0:this.end_.column-this.start_.column+1}get count(){return this.rows*this.columns}get entire_sheet(){return this.entire_row&&this.entire_column}get entire_column(){return this.start_.row===1/0}get entire_row(){return this.start_.column===1/0}PatchNull(e){let t={...e};return t.row===null&&(t.row=1/0),t.column===null&&(t.column=1/0),t}SetSheetID(e){this.start_.sheet_id=e}Normalize(){let e={...this.start_},t={...this.end_};e.row===1/0||t.row===1/0?e.row=t.row=1/0:e.row>t.row&&(e.row=this.end_.row,e.absolute_row=this.end_.absolute_row,t.row=this.start_.row,t.absolute_row=this.start_.absolute_row),e.column===1/0||t.column===1/0?e.column=t.column=1/0:e.column>t.column&&(e.column=this.end_.column,e.absolute_column=this.end_.absolute_column,t.column=this.start_.column,t.absolute_column=this.start_.absolute_column),this.start_=e,this.end_=t}TopLeft(){let e={row:0,column:0};return this.entire_row||(e.column=this.start.column),this.entire_column||(e.row=this.start.row),e}BottomRight(){let e={row:0,column:0};return this.entire_row||(e.column=this.end.column),this.entire_column||(e.row=this.end.row),e}ContainsRow(e){return this.entire_column||e>=this.start_.row&&e<=this.end_.row}ContainsColumn(e){return this.entire_row||e>=this.start_.column&&e<=this.end_.column}Contains(e){return(this.entire_column||e.row>=this.start_.row&&e.row<=this.end_.row)&&(this.entire_row||e.column>=this.start_.column&&e.column<=this.end_.column)}ContainsArea(e){return this.start.column<=e.start.column&&this.end.column>=e.end.column&&this.start.row<=e.start.row&&this.end.row>=e.end.row}Intersects(e){return!(e.start.column>this.end.column||this.start.column>e.end.column||e.start.row>this.end.row||this.start.row>e.end.row)}Equals(e){return e.start_.row===this.start_.row&&e.start_.column===this.start_.column&&e.end_.row===this.end_.row&&e.end_.column===this.end_.column}Equals2(e){return e.start.row===this.start_.row&&e.start.column===this.start_.column&&e.end.row===this.end_.row&&e.end.column===this.end_.column}Clone(){return new f(this.start,this.end)}get left(){let e=new f(this.start_,this.end_);return e.end_.column=e.start_.column,e}get right(){let e=new f(this.start_,this.end_);return e.start_.column=e.end_.column,e}get top(){let e=new f(this.start_,this.end_);return e.end_.row=e.start_.row,e}get bottom(){let e=new f(this.start_,this.end_);return e.start_.row=e.end_.row,e}Shift(e,t){return this.start_.row+=e,this.start_.column+=t,this.end_.row+=e,this.end_.column+=t,this}ConsumeAddress(e){this.entire_row||(e.column<this.start_.column&&(this.start_.column=e.column),e.column>this.end_.column&&(this.end_.column=e.column)),this.entire_column||(e.row<this.start_.row&&(this.start_.row=e.row),e.row>this.end_.row&&(this.end_.row=e.row))}Reshape(e,t){return this.end_.row=this.start_.row+e-1,this.end_.column=this.start_.column+t-1,this}ConsumeArea(e){this.ConsumeAddress(e.start),this.ConsumeAddress(e.end)}Resize(e,t){return this.end_.row=this.start_.row+e-1,this.end_.column=this.start_.column+t-1,this}[Symbol.iterator](){if(this.entire_row||this.entire_column)throw new Error("don't iterate infinite area");let e=this.start_.row,t=this.start_.column;return{next:()=>{let i={column:t,row:e,sheet_id:this.start_.sheet_id};return t>this.end_.column?{done:!0,value:void 0}:(++e>this.end_.row&&(e=this.start_.row,t++),{value:i})}}}get spreadsheet_label(){let e;return this.entire_sheet?"":this.entire_column?(e=f.ColumnToLabel(this.start_.column),e+=":"+f.ColumnToLabel(this.end_.column),e):this.entire_row?(e=String(this.start_.row+1),e+=":"+(this.end_.row+1),e):(e=f.CellAddressToLabel(this.start_),this.columns>1||this.rows>1?e+":"+f.CellAddressToLabel(this.end_):e)}toJSON(){return{start:{...this.start_},end:{...this.end_}}}};var tt=f=>typeof f=="object"&&!!f&&typeof f.real=="number"&&typeof f.imaginary=="number",it=f=>f.real?f.imaginary?f.imaginary>0?`${f.real} + ${f.imaginary}i`:`${f.real} - ${Math.abs(f.imaginary)}i`:f.real.toString():f.imaginary?f.imaginary+"i":"0",rt=f=>typeof f=="object"&&!!f&&typeof f.value=="number"&&typeof f.unit=="string",xi=f=>typeof f=="object"&&f.type==="function",st=["undefined","formula","string","number","boolean","object","function","error","complex","array","dimensioned_quantity"];var re=f=>{switch(typeof f){case"undefined":return 0;case"number":return 3;case"boolean":return 4;case"object":return f===null?0:xi(f)?6:tt(f)?8:rt(f)?10:5;case"string":return f[0]==="="?1:2;default:return 7}};var $=class{static StringToColumn(e){let t=0;e=e.toUpperCase();for(let i=0;i<e.length;i++)t*=26,t+=e.charCodeAt(i)-64;return t-1}value;type=0;calculated;calculated_type;formatted;rendered_type;style;area;spill;merge_area;table;renderer_data;render_clean=[];note;hyperlink;editing;render_function;click_function;constructor(e,t){typeof e<"u"&&this.Set(e,t)}ValueIsNumber(){return this.type===3}ValueIsFormula(){return this.type===1}ValueIsBoolean(){return this.type===4}ValueIsComplex(){return this.type===8}FlushStyle(){this.formatted=this.rendered_type=this.style=void 0,this.render_clean=[]}FlushArray(){this.area=void 0}FlushCache(){this.calculated=this.calculated_type=this.formatted=this.rendered_type=this.render_function=this.click_function=void 0,this.render_clean=[]}Reset(){this.type=0,this.value=this.spill=this.note=this.hyperlink=this.formatted=this.rendered_type=this.style=this.calculated=this.calculated_type=this.area=this.renderer_data=this.render_function=this.click_function=void 0,this.render_clean=[]}Set(e,t=re(e)){this.value=e,this.type=t,this.spill=this.formatted=this.rendered_type=this.style=this.calculated=this.calculated_type=this.render_function=this.click_function=this.area=void 0,this.render_clean=[]}SetCalculatedValue(e,t=re(e)){e===void 0&&(e=0,t=3),this.calculated!==e&&(this.calculated=e,this.calculated_type=t,this.formatted=this.rendered_type=void 0,this.render_clean=[])}GetValue(){return this.calculated_type?this.calculated:typeof this.value=="string"&&this.value[0]==="'"?this.value.slice(1):this.value}GetValue4(){return this.calculated_type?{type:this.calculated_type,value:this.calculated}:this.type===1?{type:3,value:0}:{type:this.type,value:typeof this.value=="string"&&this.value[0]==="'"?this.value.slice(1):this.value}}SetNote(e){this.note=e,this.render_clean=[]}SetCalculationError(e="ERR"){this.SetCalculatedValue(e,7)}SetArray(e){this.type=0,this.value=this.formatted=this.rendered_type=this.style=this.hyperlink=this.calculated=this.calculated_type=void 0,this.area=e,this.render_clean=[]}SetArrayHead(e,t){this.type=re(t),this.value=t,this.formatted=this.rendered_type=this.style=this.calculated=this.calculated_type=void 0,this.area=e,this.render_clean=[]}};var Ci=f=>!f.cells,ot=f=>!!f[0]&&Ci(f[0]),nt=f=>!!f[0]&&f[0].row!==void 0,Si=st.map((f,e)=>({[f]:e})).reduce((f,e)=>({...f,...e}),{}),Te=class{data=[];rows_=0;columns_=0;get rows(){return this.rows_}get columns(){return this.columns_}EnsureRow(e){this.rows_=Math.max(e+1,this.rows_)}EnsureColumn(e){this.columns_=Math.max(e+1,this.columns_)}InsertColumns(e=0,t=1){this.data=this.data.map(i=>{if(i.length>=e){let r=i.slice(0,e),s=e+t,o=i.slice(e);for(let n=0;n<o.length;n++)r[s++]=o[n];return r}return i}),this.columns_+=t}DeleteColumns(e,t=1){this.data.forEach(i=>i.splice(e,t)),this.columns_-=t}DeleteRows(e,t=1){this.data.splice(e,t),this.rows_-=t}InsertRows(e=0,t=1){let i=[e,0,[]];for(let r=1;r<t;r++)i.push([]);Array.prototype.splice.apply(this.data,i),this.rows_+=t}GetCell(e,t){let{row:i,column:r}=e;if(!this.data[i])if(t)this.data[i]=[],this.rows_=Math.max(this.rows_,i+1);else return;return this.data[i][r]||t&&(this.data[i][r]=new $,this.columns_=Math.max(this.columns_,r+1)),this.data[i][r]}EnsureCell(e){let{row:t,column:i}=e,r=this.data[t];r||(this.data[t]=r=[],this.rows_=Math.max(this.rows_,t+1));let s=r[i];return s||(s=r[i]=new $,this.columns_=Math.max(this.columns_,i+1)),s}FromArray(e=[],t=!1){this.data=[];let i=0,r=0;if(t){r=e.length;for(let s=0;s<r;s++){let o=e[s];i=Math.max(i,o.length);for(let n=0;n<o.length;n++)this.data[n]||(this.data[n]=[]),this.data[n][s]=new $(o[n])}}else{i=e.length;for(let s=0;s<i;s++){let o=[],n=e[s];r=Math.max(r,n.length);for(let a=0;a<n.length;a++)o[a]=new $(n[a]);this.data[s]=o}}this.rows_=i,this.columns_=r}SerializedTypeToValueType(e){if(e)return typeof e=="number"?e:Si[e]||void 0}ValueTypeToSerializedType(e){return e?st[e]:void 0}FromJSON(e=[],t){if(this.data=[],!ot(e)){let r=[];if(nt(e))for(let s of e)for(let o of s.cells)r.push({...o,row:s.row});else for(let s of e)for(let o of s.cells)r.push({...o,column:s.column});e=r}let i=[];for(let r of e){this.data[r.row]||(this.data[r.row]=[]);let s=new $(r.value);if(typeof r.calculated<"u"&&(s.SetCalculatedValue(r.calculated,this.SerializedTypeToValueType(r.calculated_type)),r.spill&&(s.spill=new _(r.spill.start,r.spill.end))),t&&typeof r.style_ref<"u"&&(s.style=t[r.style_ref]),typeof r.note<"u"&&(s.note=r.note),typeof r.hyperlink<"u"&&(s.hyperlink=r.hyperlink),this.data[r.row][r.column]&&this.data[r.row][r.column].area&&(s.area=this.data[r.row][r.column].area),this.data[r.row][r.column]=s,r.area){let o=new _(r.area.start,r.area.end);for(let n=o.start.row;n<=o.end.row;n++)for(let a=o.start.column;a<=o.end.column;a++)this.data[n]||(this.data[n]=[]),this.data[n][a]||(this.data[n][a]=new $),this.data[n][a].area=o}if(r.table&&i.push({...r.table}),r.merge_area){let o=new _(r.merge_area.start,r.merge_area.end);for(let n=o.start.row;n<=o.end.row;n++)for(let a=o.start.column;a<=o.end.column;a++)this.data[n]||(this.data[n]=[]),this.data[n][a]||(this.data[n][a]=new $),this.data[n][a].merge_area=o}}for(let r of i)for(let s=r.area.start.row;s<=r.area.end.row;s++)for(let o=r.area.start.column;o<=r.area.end.column;o++)this.data[s]||(this.data[s]=[]),this.data[s][o]||(this.data[s][o]=new $),this.data[s][o].table=r;this.rows_=this.data.length,this.columns_=this.data.reduce((r,s)=>Math.max(r,s.length),0)}toJSON(e={}){let t=0,i=0,r=this.data.length-1,s;e.subset&&(t=e.subset.start.column,i=e.subset.start.row,r=e.subset.end.row);let o=[],n=-1,a=-1,l={},c={};for(let h=i;h<=r;h++)if(this.data[h]){let d=this.data[h];s=d.length-1,e.subset&&(s=e.subset.end.column);for(let u=t;u<=s;u++){let p=d[u],m=p&&p.merge_area&&p.merge_area.start.row===h&&p.merge_area.start.column===u,b=p&&p.area&&p.area.start.row===h&&p.area.start.column===u,y=p&&p.table&&p.table.area.start.row===h&&p.table.area.start.column===u,x=p?p.type===2&&!p.value:!0;if(p&&(!x||e.preserve_empty_strings)&&(m||p.type||p.calculated_type&&e.expand_arrays||p.calculated_type&&e.calculated_value||p.note||e.decorated_cells&&p.style&&(p.style.fill||p.style.border_bottom||p.style.border_top||p.style.border_left||p.style.border_right))){let R={row:h,column:u,value:p.value};p.note&&(R.note=p.note),p.hyperlink&&(R.hyperlink=p.hyperlink),e.preserve_type&&(R.type=this.ValueTypeToSerializedType(p.type)),e.sheet_id&&(R.sheet_id=e.sheet_id),e.calculated_value&&typeof p.calculated<"u"&&(R.calculated=p.calculated,p.spill&&(R.spill=p.spill.toJSON()),(e.preserve_type||p.calculated_type===7)&&(R.calculated_type=this.ValueTypeToSerializedType(p.calculated_type))),p.table&&y&&e.tables&&(R.table=JSON.parse(JSON.stringify(p.table))),p.area&&b&&(R.area=p.area.toJSON()),p.merge_area&&(R.merge_area=p.merge_area.toJSON()),e.cell_style_refs&&e.cell_style_refs[u]&&e.cell_style_refs[u][h]&&(R.style_ref=e.cell_style_refs[u][h],e.cell_style_refs[u][h]=0),l[h]=h,c[u]=u,n=Math.max(h,n),a=Math.max(u,a),o.push(R)}}}if(e.nested){let h=Object.keys(l),d=Object.keys(c);if(h.length<=d.length&&h.length){let u={},p=[];for(let m of o){let{row:b,...y}=m;u[m.row]||(u[m.row]=[]),u[m.row].push(y)}for(let m of h){let b=Number(m);p.push({row:b,cells:u[b]})}return{data:p,rows:n,columns:a+1}}else if(d.length){let u={},p=[];for(let m of o){let{column:b,...y}=m;u[m.column]||(u[m.column]=[]),u[m.column].push(y)}for(let m of d){let b=Number(m);p.push({column:b,cells:u[b]})}return{data:p,rows:n,columns:a+1}}}return{data:o,rows:n+1,columns:a+1}}GetAll(e=!1){return this.GetRange({row:0,column:0},{row:this.rows_-1,column:this.columns_-1},e)}Normalize(e,t){return e={...e,row:e.row==1/0?0:e.row,column:e.column==1/0?0:e.column},t&&(t={...t,row:t.row==1/0?this.rows_-1:t.row,column:t.column==1/0?this.columns_-1:t.column}),{from:e,to:t}}RawValue(e,t=e){if({from:e,to:t}=this.Normalize(e,t),e.row===t.row&&e.column===t.column)return this.data[e.row]&&this.data[e.row][e.column]?this.data[e.row][e.column].value:void 0;let i=[],r=this.data.slice(e.row,t.row+1),s=e.column,o=t.column+1;for(let n of r){let a=[];for(let l=s,c=0;l<o;l++,c++){let h=n[l];a.push(h?h.value:void 0)}i.push(a)}return i}GetRange(e,t,i=!1){if({from:e,to:t}=this.Normalize(e,t),!t||e===t||e.column===t.column&&e.row===t.row)return this.data[e.row]&&this.data[e.row][e.column]?this.data[e.row][e.column].GetValue():void 0;let r=[];if(i)for(let s=e.column;s<=t.column;s++){let o=[];for(let n=e.row;n<=t.row;n++)this.data[n]&&this.data[n][s]?o.push(this.data[n][s].GetValue()):o.push(void 0);r.push(o)}else for(let s=e.row;s<=t.row;s++){let o=[];for(let n=e.column;n<=t.column;n++)this.data[s]&&this.data[s][n]?o.push(this.data[s][n].GetValue()):o.push(void 0);r.push(o)}return r}GetRange4(e,t=e,i=!1){if({from:e,to:t}=this.Normalize(e,t),e.row===t.row&&e.column===t.column)return this.data[e.row]&&this.data[e.row][e.column]?this.data[e.row][e.column].GetValue4():{value:void 0,type:0};let r=[];if(i)for(let s=e.column;s<=t.column;s++){let o=[];for(let n=e.row;n<=t.row;n++)this.data[n]&&this.data[n][s]?o.push(this.data[n][s].GetValue4()):o.push({type:0});r.push(o)}else for(let s=e.row;s<=t.row;s++){let o=[];for(let n=e.column;n<=t.column;n++)this.data[s]&&this.data[s][n]?o.push(this.data[s][n].GetValue4()):o.push({type:0});r.push(o)}return{type:9,value:r}}SetArea(e,t){if(ArrayBuffer.isView(t))throw new Error("ABIV");if(Array.isArray(t))for(let i=e.start.row,r=0;i<=e.end.row;i++,r++){this.data[i]||(this.data[i]=[]);let s=this.data[i];if(t[r])for(let o=e.start.column,n=0;o<=e.end.column;o++,n++)s[o]||(s[o]=new $),s[o].Set(t[r][n])}else{let i=re(t);for(let r=e.start.row;r<=e.end.row;r++){this.data[r]||(this.data[r]=[]);let s=this.data[r];for(let o=e.start.column;o<=e.end.column;o++)s[o]||(s[o]=new $),s[o].Set(t,i)}}this.rows_=Math.max(this.rows_,e.end.row+1),this.columns_=Math.max(this.columns_,e.end.column+1)}*IterateRC(e,t=!1){if(!e&&t&&(e=new _({row:0,column:0},{row:this.rows_-1,column:this.columns-1})),e)if(t)for(let i=e.start.row;i<=e.end.row;i++){this.data[i]||(this.data[i]=[]);let r=this.data[i];for(let s=e.start.column;s<=e.end.column;s++)r[s]||(r[s]=new $),yield{cell:r[s],row:i,column:s}}else for(let i=e.start.row;i<=e.end.row;i++){let r=this.data[i];if(r)for(let s=e.start.column;s<=e.end.column;s++){let o=r[s];o&&(yield{cell:o,row:i,column:s})}}else for(let[i,r]of this.data.entries())if(r)for(let[s,o]of r.entries())o&&(yield{cell:o,row:i,column:s})}*Iterate(e,t=!1){if(!e&&t&&(e=new _({row:0,column:0},{row:this.rows_-1,column:this.columns-1})),e){L(e)&&(e=new _(e)),(e.entire_column||e.entire_row)&&(e=new _(e.start,e.end),e.start.column===1/0&&(e.start.column=0,e.end.column=this.columns_-1),e.start.row===1/0&&(e.start.row=0,e.end.row=this.rows_-1));let i=e.start,r=e.end;if(t)for(let s=i.row;s<=r.row;s++){this.data[s]||(this.data[s]=[]);let o=this.data[s];for(let n=i.column;n<=r.column;n++)o[n]||(o[n]=new $),yield o[n]}else for(let s=i.row;s<=r.row;s++)if(this.data[s]){let o=this.data[s];for(let n=i.column;n<=r.column;n++)o[n]&&(yield o[n])}}else for(let i of this.data)if(i)for(let r of i)r&&(yield r)}FlushCellStyles(){for(let e of this.data)if(e)for(let t of e)t&&t.FlushStyle()}FlushCachedValues(){for(let e of this.data)if(e)for(let t of e)t&&t.FlushCache()}};var M=class{static locale="en-us";static decimal_separator=".";static argument_separator=",";static grouping_separator=",";static date_components={short_days:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],long_days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],short_months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],long_months:["January","February","March","April","May","June","July","August","September","October","November","December"]};static UpdateLocale(e){if(e)this.locale=e;else if(typeof self<"u"){let r=self?.document?.location;if(r&&r.search&&/locale=([^?&]+?)(?:\?|$|&)/.test(r.search)){let s=r.search.match(/locale=(.*?)(?:\?|$|&)/);s&&(this.locale=s[1]),console.info("override locale",this.locale)}else typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]?this.locale=navigator.languages[0]:this.locale=navigator.language)}this.locale==="C"&&(console.warn("Locale not set, defaulting to en-us"),this.locale="en-us");let t=new Intl.NumberFormat(this.locale,{minimumFractionDigits:1}).format(3.3).replace(/\d/g,"");this.decimal_separator=t===","?",":".",this.decimal_separator===","?(this.argument_separator=";",this.grouping_separator=" "):(this.argument_separator=",",this.grouping_separator=",");let i=new Date(2e3,0,2,12,0,0,0);this.UpdateDateComponent(0,0,i),i=new Date(2e3,1,7,12,0,0,0),this.UpdateDateComponent(1,1,i),i=new Date(2e3,2,7,12,0,0,0),this.UpdateDateComponent(2,2,i),i=new Date(2e3,3,5,12,0,0,0),this.UpdateDateComponent(3,3,i),i=new Date(2e3,4,4,12,0,0,0),this.UpdateDateComponent(4,4,i),i=new Date(2e3,5,2,12,0,0,0),this.UpdateDateComponent(5,5,i),i=new Date(2e3,6,1,12,0,0,0),this.UpdateDateComponent(6,6,i),i=new Date(2e3,7,1,12,0,0,0),this.UpdateDateComponent(7,-1,i),i=new Date(2e3,8,1,12,0,0,0),this.UpdateDateComponent(8,-1,i),i=new Date(2e3,9,1,12,0,0,0),this.UpdateDateComponent(9,-1,i),i=new Date(2e3,10,1,12,0,0,0),this.UpdateDateComponent(10,-1,i),i=new Date(2e3,11,1,12,0,0,0),this.UpdateDateComponent(11,-1,i)}static UpdateDateComponent(e,t,i){t>=0&&(this.date_components.short_days[t]=i.toLocaleString(this.locale,{weekday:"short"}),this.date_components.long_days[t]=i.toLocaleString(this.locale,{weekday:"long"})),e>=0&&(this.date_components.short_months[e]=i.toLocaleString(this.locale,{month:"short"}),this.date_components.long_months[e]=i.toLocaleString(this.locale,{month:"long"}))}};M.UpdateLocale();var F=class f{constructor(e=0,t=0,i=0,r=0){this.left=e;this.top=t;this.width=i;this.height=r}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static Create(e){return new f(e.left||0,e.top||0,e.width||0,e.height||0)}static IsRectangle(e){return!!e&&typeof e=="object"&&typeof e.left=="number"&&typeof e.top=="number"&&typeof e.width=="number"&&typeof e.height=="number"}Shift(e=0,t=0){return new f(this.left+e,this.top+t,this.width,this.height)}Scale(e=1,t=e){return new f(this.left*e,this.top*t,this.width*e,this.height*t)}Expand(e=0,t=0){return new f(this.left,this.top,this.width+e,this.height+t)}Combine(e){return new f(Math.min(this.left,e.left),Math.min(this.top,e.top),Math.max(this.right,e.right)-Math.min(this.left,e.left),Math.max(this.bottom,e.bottom)-Math.min(this.top,e.top))}Contains(e,t,i=0){return e>=this.left-i&&e<=this.left+this.width+i&&t>=this.top-i&&t<=this.top+this.height+i}ContextFill(e){e.fillRect(this.left,this.top,this.width,this.height)}ContextStroke(e){e.strokeRect(this.left,this.top,this.width,this.height)}Clamp(e,t){return e=Math.min(Math.max(e,this.left),this.right),t=Math.min(Math.max(t,this.top),this.bottom),{x:e,y:t}}ApplyStyle(e){e.style.top=this.top+"px",e.style.left=this.left+"px",e.style.width=this.width+"px",e.style.height=this.height+"px"}toJSON(){return{top:this.top,left:this.left,width:this.width,height:this.height}}};var Ai=JSON.stringify({}),Ti={Background:0,Text:1,Background2:2,Text2:3,Accent:4,Accent2:5,Accent3:6,Accent4:7,Accent5:8,Accent6:9},at=f=>typeof f.theme=="number"?f.theme:Ti[f.theme]||0,H=f=>!!f&&typeof f.text=="string",ke=f=>!!f&&typeof f.theme<"u",Mt=f=>!!f&&(typeof f.text=="string"||typeof f.theme<"u"),D={DefaultProperties:{horizontal_align:"",vertical_align:"",number_format:"General",nan:"NaN",font_size:{unit:"em",value:1},bold:!1,italic:!1,underline:!1,strike:!1,text:{theme:1},border_top:0,border_left:0,border_right:0,border_bottom:0},CompositeBorders:f=>({top:{width:f.border_top||0,color:f.border_top_fill||{}},left:{width:f.border_left||0,color:f.border_left_fill||{}},right:{width:f.border_right||0,color:f.border_right_fill||{}},bottom:{width:f.border_bottom||0,color:f.border_bottom_fill||{}}}),Serialize:f=>{let e=JSON.parse(JSON.stringify(f));return e.border_bottom_fill&&!e.border_bottom&&(e.border_bottom_fill=void 0),e.border_top_fill&&!e.border_top&&(e.border_top_fill=void 0),e.border_left_fill&&!e.border_left&&(e.border_left_fill=void 0),e.border_right_fill&&!e.border_right&&(e.border_right_fill=void 0),JSON.stringify(e)},Merge:(f,e,t=!0)=>{let i=t?{...f,...e}:{...e};return JSON.parse(JSON.stringify(i))},Composite:f=>JSON.parse(JSON.stringify(f.reduce((e,t)=>({...e,...t}),{}))),Empty:f=>JSON.stringify(f)===Ai,ParseFontSize:(f="",e="em")=>{let t=f.match(/(-*[\d.]+)\s*(\S*)/);if(t){let i=Number(t[1]);if(!i||isNaN(i)||i<0)return{};let r=t[2].toLowerCase()||e;if(r==="pt"||r==="em"||r==="%"||r==="px")return{font_size:{unit:r,value:i}}}return{}},RelativeFontSize:(f,e)=>{let t=12,i=12;switch(f.font_size?.unit){case"pt":if(!f.font_size.value)return 1;i=f.font_size.value;break;case"px":if(!f.font_size.value)return 1;i=Math.round(f.font_size.value*300/4)/100;break;case"em":return f.font_size.value||1;case"%":return(f.font_size.value||100)/100;default:return 1}switch(e.font_size?.unit){case"pt":if(!e.font_size.value)return 1;t=e.font_size.value;break;case"px":if(!e.font_size.value)return 1;t=Math.round(e.font_size.value*300/4)/100;break;default:return 1}return i/t},FontSize:(f,e=!0)=>{let t=f.font_size?.value;switch(f.font_size?.unit){case"pt":return(t||12)+"pt";case"px":return e?Math.round((t||16)*300/4)/100+"pt":(t||16)+"px";case"em":return(t||1)+"em";case"%":return(t||100)+"%"}return""},CompositeFontSize:(f,e,t=1,i=!1)=>{let r={...f};return e.unit==="pt"||e.unit==="px"?r={...e}:(r.value=e.value*f.value,e.unit==="%"&&(r.value/=100)),r.unit==="px"&&i&&(r.value=Math.round((r.value||16)*300/4)/100),r.value*=t,r},CompositeFont:(f,e,t,i)=>{let r,s,o,n=[];e.bold&&n.push("bold"),e.italic&&n.push("italic");let a=e.font_face||"stack:default";if(a.startsWith("stack:")){let l=i.font_stacks[a.substring(6)||"default"];l||(l=i.font_stacks.default),l&&(s=e.font_size,o=D.CompositeFontSize(l.size,e.font_size||{unit:"pt",value:10},t),n.push(o.value.toFixed(2)+o.unit),n.push(l.font||""),r=l.variants)}else o=D.CompositeFontSize(f,e.font_size||{unit:"pt",value:10},t),n.push(o.value.toFixed(2)+o.unit),n.push(a||"");return{font:n.join(" "),variants:r,base:f,size:e.font_size,scale:t,stack_size:s,font_size:o}}};var Re=f=>!!f&&Array.isArray(f)&&Array.isArray(f[0]),Pr=(f,e)=>(typeof e>"u"&&(e=re(f)),{value:f,type:e}),Or=f=>f.imaginary?{type:8,value:f}:{type:3,value:f.real};var N={Darken:(f,e,t,i,r=!1)=>{let{h:s,s:o,l:n}=N.RGBToHSL(f,e,t);return r?n-=n*i/100:n-=i/100,n=Math.max(0,Math.min(1,n)),N.HSLToRGB(s,o,n)},Lighten:(f,e,t,i,r=!1)=>{let{h:s,s:o,l:n}=N.RGBToHSL(f,e,t);return r?n+=n*i/100:n+=i/100,n=Math.max(0,Math.min(1,n)),N.HSLToRGB(s,o,n)},RGBToHSL:(f,e,t)=>{f/=255,e/=255,t/=255;let i=Math.max(f,e,t),r=Math.min(f,e,t),s=0,o=0,n=(i+r)/2;if(i===r)s=o=0;else{let a=i-r;switch(o=n>.5?a/(2-i-r):a/(i+r),i){case f:s=(e-t)/a+(e<t?6:0);break;case e:s=(t-f)/a+2;break;case t:s=(f-e)/a+4;break}s/=6}return{h:s*360,s:o,l:n}},HSLToRGB:(f,e,t)=>{let i,r,s;if(e===0)i=r=s=t;else{f=f/360;let o=t<.5?t*(1+e):t+e-t*e,n=2*t-o;i=N.HueToRGB(n,o,f+.3333333333333333),r=N.HueToRGB(n,o,f),s=N.HueToRGB(n,o,f-.3333333333333333)}return{r:Math.round(i*255),g:Math.round(r*255),b:Math.round(s*255)}},HueToRGB:(f,e,t)=>(t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?f+(e-f)*6*t:t<.5?e:t<.6666666666666666?f+(e-f)*(.6666666666666666-t)*6:f),GetLuminance:([f,e,t])=>{let i=[f,e,t].map(r=>(r/=255,r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)));return .2126*i[0]+.7152*i[1]+.0722*i[2]},WeightedLuminance:([f,e,t],i=[1,1,1])=>{let r=[f,e,t].map(s=>(s/=255,s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4)));return .2126*r[0]*i[0]+.7152*r[1]*i[1]+.0722*r[2]*i[2]},GetContrastRatio:f=>(f.sort((e,t)=>t-e),(f[0]+.05)/(f[1]+.05)),GetTextColor:(f,e,t)=>{let i=[.4,.3,.3],r=N.WeightedLuminance(f,i),s=N.WeightedLuminance(e,i),o=N.WeightedLuminance(t,i),n=N.GetContrastRatio([s,r]),a=N.GetContrastRatio([o,r]);return n>a?e:t}};var ki="http://www.w3.org/2000/svg",z=class f{static instances=[];static GetInstance(e){for(let i of this.instances)if(i.doc===e)return i;let t=new f(e);return this.instances.push(t),t}doc;view;get HTMLElement(){return this.view?.HTMLElement}constructor(e){e&&(this.doc=e,this.view=e?.defaultView)}GetSelection(){return this.view?.getSelection()}Div(e,t,i){return this.Create("div",e,t,i)}ClassNames(e,t){e.classList.add(...(Array.isArray(t)?t:[t]).reduce((i,r)=>[...i,...r.split(/\s+/g)],[]))}SVG(e,t,i){let r=this.doc.createElementNS(ki,e);return t&&this.ClassNames(r,t),i&&i.appendChild(r),r}Text(e){return this.doc.createTextNode(e)}Fragment(){return this.doc.createDocumentFragment()}Create(e,t,i,r){let s=this.doc.createElement(e);if(t&&this.ClassNames(s,t),r){if(r.attrs)for(let[o,n]of Object.entries(r.attrs))s.setAttribute(o,n);if(r.data)for(let[o,n]of Object.entries(r.data))s.dataset[o]=n;if(r.text&&(s.textContent=r.text),r.html&&(s.innerHTML=r.html),r.events)for(let[o,n]of Object.entries(r.events))s.addEventListener(o,n);if(r.style)for(let[o,n]of Object.entries(r.style))s.style[o]=n}return i&&i.appendChild(s),s}};var Ri=1e3,Q=class{constructor(e=!1,t){this.verbose=e;this.log_id=t}queue=[];dispatched=!1;subscribers=[];Publish(e){this.verbose&&console.info(`es publish (${this.log_id})`,e),Array.isArray(e)?this.queue.push(...e):this.queue.push(e),this.dispatched||(this.dispatched=!0,Promise.resolve().then(()=>{let t=this.queue.slice(0);this.dispatched=!1,this.queue=[];for(let i of t)for(let r of this.subscribers)r.subscriber(i)}))}Subscribe(e){let t=Ri++;return this.subscribers.push({subscriber:e,token:t}),t}Cancel(e){this.subscribers=this.subscribers.filter(t=>t.token!==e)}CancelAll(){this.subscribers=[]}};var W=class{static color_measurement_canvas;static text_measurement_node;static color_cache={};static MeasureColorARGB(e){let t=this.MeasureColor(e),i="FF";for(let r=0;r<3;r++){let s=t[r].toString(16);s.length===0?i+="00":s.length===1?i+=`0${s}`:i+=s}return i.toUpperCase()}static MeasureColor(e){let t=this.color_cache[e];if(t)return t;this.color_measurement_canvas||(this.color_measurement_canvas=document.createElement("canvas"),this.color_measurement_canvas.width=1,this.color_measurement_canvas.height=1);let i=this.color_measurement_canvas.getContext("2d",{willReadFrequently:!0});return i?(i.fillStyle="#fff",i.fillRect(0,0,1,1),i.fillStyle=e,i.fillRect(0,0,1,1),t=new Uint8ClampedArray(i.getImageData(0,0,1,1).data),this.color_cache[e]=t,t):new Uint8ClampedArray(3)}static EnsureMeasurementNode(){if(!this.text_measurement_node){let e=document.querySelector(".treb-chart-measurement-node");e?this.text_measurement_node=e:(this.text_measurement_node=document.createElement("div"),this.text_measurement_node.classList.add("treb-chart-measurement-node"),this.text_measurement_node.style.margin="0px",this.text_measurement_node.style.padding="0px",this.text_measurement_node.style.height="initial",this.text_measurement_node.style.width="initial",this.text_measurement_node.style.whiteSpace="nowrap",this.text_measurement_node.style.position="fixed",this.text_measurement_node.style.border="0px",this.text_measurement_node.style.border="1px solid red",this.text_measurement_node.style.boxSizing="content-box",this.text_measurement_node.style.top=this.text_measurement_node.style.left="-1000px",document.body.appendChild(this.text_measurement_node))}}static FontLoaded(e,t=!1,i=400){let r=`${t?"italic":""} ${i} 20pt ${e}`,s=this.MeasureText(`${r}, sans-serif`,"check font"),o=this.MeasureText(`${r}, serif`,"check font"),n=this.MeasureText(`${r}, monospace`,"check font");return s.width===o.width&&o.width===n.width}static MeasureText(e,t,i=0){this.EnsureMeasurementNode(),this.text_measurement_node.style.font=e,/\n/.test(t)?(t=t.replace(/\n/g,"<BR/>"),this.text_measurement_node.innerHTML=t):this.text_measurement_node.textContent=t,this.text_measurement_node.style.lineHeight="1em",i?this.text_measurement_node.style.transform=`rotate(${i}deg)`:this.text_measurement_node.style.transform="";let r=this.text_measurement_node.getBoundingClientRect();return{width:r.width,height:r.height}}};var lt,Lt=f=>{let e=new Map;for(let t=0;t<f.length;t++){let i=f[t];e.set(i,f.getPropertyValue(i))}return e},Ei=(f,e,t)=>{let i=new Map,r=Lt(e);for(let[o,n]of r.entries())n!==t.get(o)&&i.set(o,n);return(Array.from(i.entries()).map(([o,n])=>`${o}: ${n}`).join("; ")+"; "+(f.getAttribute("style")||"")).trim().replace(/"/g,"'")},Ut=(f,e)=>{let t=f.cloneNode(!1),i=getComputedStyle(f),r=Ei(f,i,e);t.removeAttribute("class"),t.setAttribute("style",r);let s;return Array.prototype.forEach.call(f.childNodes,o=>{switch(o.nodeType){case Node.ELEMENT_NODE:s||(s=Lt(i)),t.appendChild(Ut(o,s));break;case Node.TEXT_NODE:f.textContent&&t.appendChild(document.createTextNode(f.textContent));break;case Node.COMMENT_NODE:break;default:console.warn("unhandled node type in serialize",o)}}),t},Ft=f=>{if(!lt){let t=new Map,i=document.createElement("iframe");i.style.width="10px",i.style.height="10px",i.style.position="absolute",i.style.left="-100px",document.body.appendChild(i);let r=i.contentDocument;if(r){let s=r.createElement("div");r.body.appendChild(s);let o=getComputedStyle(s);Array.prototype.forEach.call(o,n=>t.set(n,o[n]))}document.body.removeChild(i),lt=t}let e=Ut(f,lt);return e instanceof Element&&e.tagName==="svg"&&(e.hasAttribute("version")||e.setAttribute("version","1.1"),e.hasAttribute("xmlns")||e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.hasAttribute("xmlns:xlink")||e.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink")),e};var Di={data:!0,same_origin:!0,remote:!1},zt=(f,e={})=>{let t={...Di,...e};try{let i=new URL(f,document.location.href);return i.protocol==="data:"?t.data?i.href:void 0:i.origin===document.location.origin?t.same_origin?i.href:void 0:t.remote?i.hash:void 0}catch(i){console.error(i)}};var jr=(f,e,t=6.5,i=!1,r=!1)=>{if(e===f)e++,f&&f--;else{let h=Math.round(e*1e5)/1e5;Math.abs(h-e)/(e-f)<1e-5&&(e=h)}let s=e-f,o=Math.log(s)/Math.log(10),n=Math.floor(Math.abs(o))*(o<0?-1:1)-1;r&&(n=Math.max(0,n));let a=r?[1,2,5,10,15,20,25,50,100]:[.1,.25,.5,1,2.5,5,10,25,50,100],l=-1,c=0;for(let h of a){let d=h*Math.pow(10,n),u=Math.floor(f/d)*d,m=(Math.ceil(e/d)*d-u)/d,b=Math.abs(m-t);(l<0||b<c)&&(!i||m<=t)&&(c=b,l=d)}return f=Math.floor(f/l)*l,e=Math.ceil(e/l)*l,t=Math.round((e-f)/l),{scale:n,step:l,count:t,min:f,max:e}};var Nt={spreadsheet_semantics:!0,dimensioned_quantities:!1,fractions:!0,decimal_mark:".",argument_separator:",",boolean_true:"TRUE",boolean_false:"FALSE"};var ue=/[\s-+=<>!()]/,Bt=/['*\\]/,ct=34,ht=39,Ii=160,Pt=32,Mi=9,Li=10,Ui=13,te=48,_e=57,dt=46,ut=43,be=45,Ot=40,ft=41,ye=44,Fi=37,pt=95,Ee=36,zi=123,Ni=125,ge=91,Vt=93,Pi=63,Oi=33,Gt=59,mt=35,Vi=64,de=65,we=97,Gi=69,Hi=101,De=90,Ie=122,Bi=105,_t=192,bt=382,yt={"==":6,"!=":6,"<>":6,"=":6,"<":7,">":7,"<=":7,">=":7,"+":9,"-":9,"&":9,"*":10,"/":10,"^":11,":":13},$i={"@":50,"-":100,"+":100},Ji=[...Object.keys(yt),"@"].sort((f,e)=>e.length-f.length),Me=class{get argument_separator(){return this.flags.argument_separator}get decimal_mark(){return this.flags.decimal_mark}flags={...Nt};r1c1_regex=/[rR]((?:\[[-+]{0,1}\d+\]|\d*))[cC]((?:\[[-+]{0,1}\d+\]|\d*))$/;argument_separator_char=ye;decimal_mark_char=dt;imaginary_char=Bi;imaginary_number="i";id_counter=0;expression="";data=[];index=0;length=0;valid=!0;error_position;error;dependencies={addresses:{},ranges:{}};address_refcount={};full_reference_list=[];parser_state_cache=[];SetLocaleSettings(e,t){if(typeof t>"u"&&(t=e===","?";":","),t===e)throw new Error("invalid locale setting");this.flags.argument_separator=t,this.flags.decimal_mark=e}Save(){this.parser_state_cache.push(JSON.stringify(this.flags))}Restore(){let e=this.parser_state_cache.shift();if(e)try{this.flags=JSON.parse(e)}catch(t){console.error(t)}else console.warn("No parser state to restore")}Walk2(e,t){let i=t(e);if(typeof i=="object")return i;switch(e.type){case"address":case"missing":case"literal":case"complex":case"identifier":case"operator":case"structured-reference":break;case"dimensioned":i&&(e.expression=this.Walk2(e.expression,t),e.unit=this.Walk2(e.unit,t));break;case"range":t(e)&&(e.start=this.Walk2(e.start,t),e.end=this.Walk2(e.end,t));break;case"binary":t(e)&&(e.left=this.Walk2(e.left,t),e.right=this.Walk2(e.right,t));break;case"unary":t(e)&&(e.operand=this.Walk2(e.operand,t));break;case"group":t(e)&&(e.elements=e.elements.map(r=>this.Walk2(r,t)));break;case"implicit-call":t(e)&&(e.call=this.Walk2(e.call,t),e.args=e.args.map(r=>this.Walk2(r,t)));break;case"call":t(e)&&(e.args=e.args.map(r=>this.Walk2(r,t)));break}return e}Walk(e,t){switch(e.type){case"address":case"missing":case"literal":case"complex":case"identifier":case"operator":case"structured-reference":t(e);return;case"dimensioned":t(e)&&(this.Walk(e.expression,t),this.Walk(e.unit,t));return;case"range":t(e)&&(this.Walk(e.start,t),this.Walk(e.end,t));return;case"binary":t(e)&&(this.Walk(e.left,t),this.Walk(e.right,t));return;case"unary":t(e)&&this.Walk(e.operand,t);return;case"group":if(t(e))for(let i of e.elements)this.Walk(i,t);return;case"implicit-call":if(t(e)){this.Walk(e.call,t);for(let i of e.args)this.Walk(i,t)}return;case"call":if(t(e))for(let i of e.args)this.Walk(i,t)}}Transpose(e){let t=e.length,i=[],r=0;for(let s=0;s<t;s++)Array.isArray(e[s])&&(r=Math.max(r,e[s].length));for(let s=0;s<r;s++){i[s]=[];for(let o=0;o<t;o++)i[s][o]=e[o]?e[o][s]:void 0}return i}Render(e,t={}){let i=t.offset||{rows:0,columns:0},r=t.missing??"(missing)",{convert_decimal:s,convert_argument_separator:o,long_structured_references:n,table_name:a}=t,l=this.flags.argument_separator+" ";o===","?l=", ":o===";"&&(l="; ");let c=s===","?",":".",h=this.flags.decimal_mark===","?/,/:/\./,d=this.flags.decimal_mark===","?/,/g:/\./g;switch(e.type){case"address":return t.pass_through_addresses?e.label:t.r1c1?this.R1C1Label(e,t):this.AddressLabel(e,i);case"range":return t.pass_through_addresses?e.label:t.r1c1?this.R1C1Label(e.start,t)+":"+this.R1C1Label(e.end,t):this.AddressLabel(e.start,i)+":"+this.AddressLabel(e.end,i);case"missing":return r;case"array":return"{"+this.Transpose(e.values).map(u=>u.map(p=>typeof p=="string"?'"'+p+'"':p).join(", ")).join("; ")+"}";case"binary":{let u=e.operator===":"||e.operator==="^"?"":" ";return this.Render(e.left,t)+u+e.operator+u+this.Render(e.right,t)}case"unary":return e.operator+this.Render(e.operand,t);case"complex":if(e.text)return s?e.text.replace(d,c):e.text;{let u=Math.abs(e.imaginary).toString();if((s===","||this.flags.decimal_mark===",")&&(u=u.replace(/\./,",")),e.real){let p=e.real.toString();(s===","||this.flags.decimal_mark===",")&&(p=p.replace(/\./,","));let m=Math.abs(e.imaginary);return`${p}${e.imaginary<0?" - ":" + "}${m===1?"":u}i`}else return e.imaginary===-1?"-i":e.imaginary===1?"i":`${e.imaginary<0?"-":""}${u}i`}break;case"literal":if(typeof e.value=="string")return'"'+e.value.replace(/"/g,'""')+'"';if(typeof e.value=="boolean")return e.value?t.boolean_true||this.flags.boolean_true||"true":t.boolean_false||this.flags.boolean_false||"false";if(s&&typeof e.value=="number")if(e.text){let u=e.text;return s===","&&this.flags.decimal_mark==="."&&(u=u.replace(/,/g,"")),u.replace(h,c)}else return e.value.toString().replace(/\./,c);else if(e.text)return e.text;return e.value.toString();case"identifier":return e.name;case"operator":return"["+e.operator+"]";case"group":return e.explicit?"("+e.elements.map(u=>this.Render(u,t)).join(l)+")":e.elements.map(u=>this.Render(u,t)).join(l);case"implicit-call":return this.Render(e.call,t)+"("+e.args.map(u=>this.Render(u,t)).join(l)+")";case"call":return e.name+"("+e.args.map(u=>this.Render(u,t)).join(l)+")";case"dimensioned":return this.Render(e.expression)+" "+this.Render(e.unit);case"structured-reference":{let u=e.column;/[^A-Za-z]/.test(u)&&(u="["+u+"]");let p=e.table;switch(!p&&n&&a&&(p=a),e.scope){case"all":return`${p}[[#all],${u}]`;case"row":return n?`${p}[[#this row],${u}]`:`${p}[@${u}]`;case"column":return`${p}[${u}]`}throw new Error("unhandled scope in structured reference")}}return"??"}Parse(e){e=e.trim(),e[0]==="="&&(e=e.substr(1).trim()),this.expression=e,this.data=[],this.length=e.length,this.index=0,this.valid=!0,this.error_position=void 0,this.error=void 0,this.dependencies.addresses={},this.dependencies.ranges={},this.address_refcount={},this.full_reference_list=[],this.id_counter=0,this.flags.argument_separator===";"?this.argument_separator_char=Gt:this.argument_separator_char=ye,this.flags.decimal_mark===","?this.decimal_mark_char=ye:this.decimal_mark_char=dt;for(let r=0;r<this.length;r++)this.data[r]=e.charCodeAt(r);let t=this.ParseGeneric(),i={};for(let r of Object.keys(this.dependencies.addresses))this.address_refcount[r]&&(i[r]=this.dependencies.addresses[r]);return this.dependencies.addresses=i,{expression:t||void 0,valid:this.valid,error:this.error,error_position:this.error_position,dependencies:this.dependencies,separator:this.flags.argument_separator,decimal_mark:this.flags.decimal_mark,full_reference_list:this.full_reference_list.slice(0)}}ColumnLabel(e){if(e===1/0)return"";let t=String.fromCharCode(65+e%26);for(;e>25;)e=Math.floor(e/26)-1,t=String.fromCharCode(65+e%26)+t;return t}R1C1Label(e,t){let i=!!t.r1c1_force_relative,r=t.r1c1_base,s="";e.sheet&&(s=(ue.test(e.sheet)?"'"+e.sheet+"'":e.sheet)+"!");let o="",n="";if(i&&t.r1c1_proper_semantics&&r){if(e.absolute_row)o=(e.row+1).toString();else{let a=e.row-r.row;a&&(o=`[${a}]`)}if(e.absolute_column)n=(e.column+1).toString();else{let a=e.column-r.column;a&&(n=`[${a}]`)}}else if(i&&r){let a=e.row-r.row,l=e.column-r.column;a&&(o=`[${a}]`),l&&(n=`[${l}]`)}else o=e.offset_row?`[${e.row}]`:(e.row+1).toString(),n=e.offset_column?`[${e.column}]`:(e.column+1).toString();return s+=`R${o}C${n}`,s}AddressLabel(e,t){let i=e.column;!e.absolute_column&&e.column!==1/0&&(i+=t.columns);let r=e.row;if(!e.absolute_row&&e.row!==1/0&&(r+=t.rows),r<0||i<0||r===1/0&&i===1/0)return"#REF";let s="";return e.sheet&&(s=(ue.test(e.sheet)?"'"+e.sheet+"'":e.sheet)+"!"),r===1/0?s+(e.absolute_column?"$":"")+this.ColumnLabel(i):i===1/0?s+(e.absolute_row?"$":"")+(r+1):s+(e.absolute_column?"$":"")+this.ColumnLabel(i)+(e.absolute_row?"$":"")+(r+1)+(e.spill?"#":"")}ParseGeneric(e=[0],t=!1){let i=[];for(;this.index<this.length;){let r=this.ParseNext(i.length===0);if(typeof r=="number"){if(e.some(s=>r===s))break;if(r===Ot){this.index++;let s=this.ParseGeneric([ft],!0);this.index++,i.push({type:"group",id:this.id_counter++,elements:s?[s]:[],explicit:!0})}else{let s=this.ConsumeOperator();s?i.push(s):t&&r===this.argument_separator_char?(i.push({type:"group-separator",position:this.index,id:this.id_counter++}),this.index++):(this.error=`unexpected character [1]: ${String.fromCharCode(r)}, 0x${r.toString(16)}`,this.valid=!1,this.index++)}}else i.push(r)}if(i.length){if(i=this.BinaryToRange2(i),this.flags.fractions){let r=[],s=n=>n.type==="literal"&&typeof n.value=="number"&&n.value%1===0,o=0;for(;o<i.length-3;o++)if(s(i[o])&&s(i[o+1])&&i[o+2].type==="operator"&&i[o+2].operator==="/"&&s(i[o+3])){let n=i[o],a=i[o+1],l=i[o+3],c=(n.value<0?-1:1)*(a.value/l.value);o+=3,r.push({id:i[o].id,type:"literal",text:this.expression.substring(n.position,l.position+1),value:n.value+c,position:n.position})}else r.push(i[o]);for(;o<i.length;o++)r.push(i[o]);i=r}if(i=i.map(r=>r.type==="identifier"&&r.name===this.imaginary_number?{type:"complex",real:0,imaginary:1,position:r.position,text:r.name,id:this.id_counter++}:r),this.flags.dimensioned_quantities){let r=[],s;for(let o=0;o<i.length;o++){let n=i[o];if(!s)s=n;else if(n.type==="identifier"&&(s.type==="literal"||s.type==="group"||s.type==="call")){let a=n;for(;i[o+1]?.type==="identifier";)a.name+=" "+i[++o].name;r.push({type:"dimensioned",expression:s,unit:n,id:this.id_counter++}),s=void 0}else r.push(s),s=n}s&&r.push(s),i=r}}return i.length===0?null:i.length===1?i[0]:this.BinaryToComplex(this.ArrangeUnits(i))}UnitToAddress(e){if(e.type==="literal"){if(typeof e.value=="number"&&e.value>0&&!/\./.test(e.text||""))return{type:"address",position:e.position,label:e.value.toString(),row:e.value-1,id:this.id_counter++,column:1/0}}else{let t,i=e.name,r=i.split("!");if(r.length>1&&(t=r.slice(0,r.length-1).join("!"),i=i.substr(t.length+1),t[0]==="'"))if(t.length>1&&t[t.length-1]==="'")t=t.substr(1,t.length-2);else return;let s=i[0]==="$";i=(s?i.substr(1):i).toUpperCase();let o=Number(i);if(isNaN(o)){if(/[A-Z]{1,3}/.test(i)){let n=-1;for(let a=0;a<i.length;a++){let l=i[a].charCodeAt(0);n=26*(1+n)+(l-de)}return{type:"address",position:e.position,absolute_column:s,label:e.name,column:n,id:this.id_counter++,row:1/0,sheet:t}}}else if(o>0&&o!==1/0&&!/\./.test(i))return{type:"address",position:e.position,absolute_row:s,label:e.name,row:o-1,id:this.id_counter++,column:1/0,sheet:t}}}BinaryToRange2(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i],s=e[i+1],o=e[i+2],n,a="",l;if(r&&s&&o&&s.type==="operator"&&s.operator===":"){if(r.type==="address"&&o.type==="address"){let c=r.position+r.label.length,h=o.position;n={type:"range",id:this.id_counter++,position:r.position,start:r,end:o,label:r.label+this.expression.substring(c,h)+o.label},a=n.start.label+":"+n.end.label,this.address_refcount[n.start.label]--,this.address_refcount[n.end.label]--;let d=[r.position,o.position];this.full_reference_list=this.full_reference_list.filter(u=>u.position!==d[0]&&u.position!==d[1])}else if((r.type==="literal"||r.type==="identifier")&&(o.type==="literal"||o.type==="identifier")){let c=this.UnitToAddress(r);if(!c&&r.type==="literal"&&typeof r.value=="number"&&r.value<0){let d={...r,text:(r.text||"").replace(/^-/,""),position:r.position+1,value:-r.value};c=this.UnitToAddress(d),c&&(l={type:"operator",operator:"-",position:r.position,id:this.id_counter++})}let h=this.UnitToAddress(o);c&&h&&(c.column===1/0&&h.column===1/0||c.row===1/0&&h.row===1/0)&&(a=c.label+":"+h.label,n={type:"range",id:this.id_counter++,position:c.position,start:c,end:h,label:a})}}n?(l&&t.push(l),t.push(n),this.dependencies.ranges[a]=n,this.full_reference_list.push(n),i+=2):t.push(r)}return t}BinaryToComplex(e){if(e.type==="binary")if((e.operator==="+"||e.operator==="-")&&e.left.type==="literal"&&typeof e.left.value=="number"&&e.right.type==="complex"&&!e.right.composited){let t="";t=this.expression.substring(e.left.position,e.right.position+(e.right.text?.length||0));let i=e.right.imaginary;return e.operator==="-"&&(i=-i),{type:"complex",position:e.left.position,text:t,id:this.id_counter++,imaginary:i,real:e.left.value,composited:!0}}else e.left=this.BinaryToComplex(e.left),e.right=this.BinaryToComplex(e.right);else if(e.type==="unary"&&(e.operator==="-"||e.operator==="+")&&e.operand.type==="complex"&&e.operand.text===this.imaginary_number)return{...e.operand,position:e.position,text:this.expression.substring(e.position,e.operand.position+(e.operand.text||"").length),imaginary:e.operand.imaginary*(e.operator==="-"?-1:1)};return e}ArrangeUnits(e){if(e.length===0)return{type:"missing",id:this.id_counter++};if(e.length===1)return e[0];let t=[];for(let i=0;i<e.length;i++){let r=e[i];if(r.type!=="group-separator"){if(r.type==="operator")if(t.length===0||t[t.length-1].type==="operator")if($i[r.operator]){let s=this.BinaryToComplex(this.ArrangeUnits(e.slice(i+1)));if(!this.valid)return{type:"group",id:this.id_counter++,elements:e,explicit:!1};s.type==="binary"?(s.left={type:"unary",id:this.id_counter++,operator:r.operator,operand:s.left,position:r.position},r=s):r={type:"unary",id:this.id_counter++,operator:r.operator,operand:s,position:r.position},i=e.length}else return this.error=`unexpected character [2]: ${r.operator}`,this.error_position=r.position,this.valid=!1,{type:"group",id:this.id_counter++,elements:e,explicit:!1};else{t.push(r);continue}if(t.length<2){if(t.length===1){let s=t[0].type;if(r.type==="group"&&r.explicit&&(s==="address"||s==="call"||s==="identifier"||s==="implicit-call")){let o=r.elements;o.length===1&&o[0].type==="group"&&!o[0].explicit&&(o=o[0].elements),t[0]={type:"implicit-call",call:t[0],args:o,id:this.id_counter++,position:t[0].position};continue}}t.push(r)}else if(t[t.length-1].type==="operator"){let s=t[t.length-2],o=t[t.length-1],n=o.operator,a={type:"binary",id:this.id_counter++,left:s,operator:n,position:o.position,right:r};s.type==="binary"&&yt[n]>yt[s.operator]&&(a.left=s.left,a.operator=s.operator,a.position=s.position,a.right={type:"binary",id:this.id_counter++,left:s.right,right:r,operator:n,position:o.position}),t.splice(-2,2,a)}else t.push(r)}}return t.length>1?{type:"group",id:this.id_counter++,elements:t,explicit:!1}:t[0]}ParseNext(e=!0){this.ConsumeWhiteSpace();let t=this.data[this.index];if(t===ct)return{type:"literal",id:this.id_counter++,position:this.index,value:this.ConsumeString()};if(t>=te&&t<=_e||t===this.decimal_mark_char)return this.ConsumeNumber();if(t===zi)return this.ConsumeArray();if(e&&(t===be||t===ut)){let i=this.data[this.index+1];if(i>=te&&i<=_e||i===this.decimal_mark_char)return this.ConsumeNumber()}else if(t>=de&&t<=De||t>=we&&t<=Ie||t===pt||t===mt||t===ht||t===Ee||t===ge||t>=_t&&t<=bt)return this.ConsumeToken(t);return t}ConsumeArray(){let e={type:"array",id:this.id_counter++,values:[],position:this.index};this.index++;let t=0,i=0;for(;this.index<this.length;){let r=this.ParseNext(),s=this.index;if(typeof r=="number")switch(this.index++,r){case Gt:i++,t=0;break;case ye:t++;break;case Ni:return e;default:this.valid&&(this.error="invalid character in array literal",this.error_position=s,this.valid=!1);break}else r.type==="literal"?(e.values[t]||(e.values[t]=[]),e.values[t][i]=r.value):this.valid&&(this.error="invalid value in array literal",this.error_position=s,this.valid=!1)}return e}ConsumeOperator(){for(let e of Ji)if(this.expression.substr(this.index,e.length)===e){let t=this.index;return this.index+=e.length,{type:"operator",id:this.id_counter++,operator:e,position:t}}return null}ConsumeArguments(){this.index++;let e=0,t=[];for(;this.index<this.length;){let i=this.ParseGeneric([this.argument_separator_char,ft]);i!==null&&t.push(i);let r=this.data[this.index];if(r===this.argument_separator_char){this.index++,e++;for(let s=t.length;s<e;s++)t.push({type:"missing",id:this.id_counter++})}else if(r===ft)return this.index++,t}return t}ConsumeToken(e){let t=[e],i=this.index,r=e===ht,s=0,o=!1;for(e===ge&&(s=1,o=!0),++this.index;this.index<this.length;this.index++){let h=this.data[this.index];if(h>=de&&h<=De||h>=we&&h<=Ie||h>=_t&&h<=bt||h===pt||h===Ee||h===dt||h===Oi||r||h>=te&&h<=_e||h===ge||s>0&&h===Vt||h===be&&this.flags.r1c1&&s===1||s>0&&h===Vi&&this.data[this.index-1]===ge||s===1&&(h===ye||h===Pt)||s>1||h===Pi&&s===0)t.push(h),h===ge&&(s++,o=!0),h===Vt&&s--,h===ht&&(r=!1);else break}this.data[this.index]===mt&&t.push(this.data[this.index++]);let n=t.map(h=>String.fromCharCode(h)).join("");if(r)return this.error="unbalanced single quote",this.error_position=i,this.valid=!1,{type:"identifier",id:this.id_counter++,name:n,position:i};if(s)return this.error="unbalanced square bracket",this.error_position=i,this.valid=!1,{type:"identifier",id:this.id_counter++,name:n,position:i};if(this.ConsumeWhiteSpace(),this.flags.spreadsheet_semantics){let h=this.ConsumeAddress(n,i);if(h)return h}if(this.data[this.index]===Ot){let h=this.ConsumeArguments();return{type:"call",id:this.id_counter++,name:n,args:h,position:i,end:this.index}}if(this.flags.spreadsheet_semantics&&o){let h=this.ConsumeStructuredReference(n,i);if(h)return h}let l=n.toLowerCase();if(l==="true"||this.flags.boolean_true&&l===this.flags.boolean_true.toLowerCase())return{type:"literal",id:this.id_counter++,value:!0,position:i};if(l==="false"||this.flags.boolean_false&&l===this.flags.boolean_false.toLowerCase())return{type:"literal",id:this.id_counter++,value:!1,position:i};let c={type:"identifier",id:this.id_counter++,name:n,position:i};return this.full_reference_list.push(c),c}ConsumeStructuredReference(e,t){let i=e.length,r=e,s="",o=0;for(;o<i;o++){if(e[o]==="["){e=e.substring(o);break}s+=e[o]}if(e[0]!=="["||e[e.length-1]!=="]")return;e=e.substring(1,e.length-1);let n=e.split(",").map(h=>h.trim()),a="column",l="";if(n.length>2)return;n.length===2?(/\[#this row\]/i.test(n[0])?a="row":/\[#all\]/i.test(n[0])&&(a="all"),l=n[1]):(l=n[0],l[0]==="@"&&(a="row",l=l.substring(1,l.length))),l[0]==="["&&l[l.length-1]==="]"&&(l=l.substring(1,l.length-1));let c={type:"structured-reference",id:this.id_counter++,label:r,position:t,scope:a,column:l,table:s};return this.full_reference_list.push(c),c}ConsumeAddress(e,t){let i=t,r=e.length,s,o=e.split("!");if(o.length>1&&(s=o.slice(0,o.length-1).join("!"),t+=s.length+1),this.flags.r1c1){let h=o[o.length-1].match(this.r1c1_regex);if(h){let d={type:"address",id:this.id_counter++,label:e,row:0,column:0,position:i,sheet:s,r1c1:!0};return h[1][0]==="["?(d.offset_row=!0,d.row=Number(h[1].substring(1,h[1].length-1))):h[1]?(d.row=Number(h[1])-1,this.flags.r1c1_proper_semantics&&(d.absolute_row=!0)):(d.offset_row=!0,d.row=0),h[2][0]==="["?(d.offset_column=!0,d.column=Number(h[2].substring(1,h[2].length-1))):h[2]?(d.column=Number(h[2])-1,this.flags.r1c1_proper_semantics&&(d.absolute_column=!0)):(d.offset_column=!0,d.column=0),d}}let n=this.ConsumeAddressColumn(t);if(!n)return null;t=n.position;let a=this.ConsumeAddressRow(t);if(!a||(t=a.position,n.column===8508&&a.row===9))return null;let l=s?s+e.substr(s.length,t-i).toUpperCase():e.substr(0,t-i).toUpperCase();s&&s[0]==="'"&&(s=s.substr(1,s.length-2));let c={type:"address",id:this.id_counter++,label:l,row:a.row,column:n.column,absolute_row:a.absolute,absolute_column:n.absolute,position:i,sheet:s,spill:a.spill};return r!==t-i?null:(this.dependencies.addresses[c.label]=c,this.address_refcount[c.label]=(this.address_refcount[c.label]||0)+1,this.full_reference_list.push(c),c)}ConsumeAddressRow(e){let t=this.data[e]===Ee;t&&e++;let i=e,r=0;for(;;e++){let o=this.data[e];if(o>=te&&o<=_e)r*=10,r+=o-te;else break}if(i===e||r===0)return!1;let s=!1;return this.data[e]===mt&&(e++,s=!0),{absolute:t,row:r-1,position:e,spill:s}}ConsumeAddressColumn(e){let t=-1,i=0,r=this.data[e]===Ee;for(r&&e++;;e++,i++){if(i>=4)return!1;let s=this.data[e];if(s>=de&&s<=De)t=26*(1+t)+(s-de);else if(s>=we&&s<=Ie)t=26*(1+t)+(s-we);else break}return t<0?!1:{absolute:r,column:t,position:e}}ConsumeNumber(){let e=this.index,t=0,i=!1,r=!1,s=0,o=0,n=0,a="integer",l=0,c=!1,h=this.index;for(;this.index<this.length;this.index++,l++){let u=this.data[this.index];if(u===this.decimal_mark_char)if(a==="integer")a="fraction";else break;else if(u===Fi){s/=100,n/=100,this.index++;break}else if(u===ut||u===be)if(l===0)u===be&&(r=!0);else break;else if(u===Gi||u===Hi)if(a==="integer"||a==="fraction")a="exponent",this.index<this.length-1&&(this.data[this.index+1]===ut?this.index++:this.data[this.index+1]===be&&(this.index++,i=!0));else break;else if(u===this.imaginary_char){let p=this.data[this.index+1];if(p>=de&&p<=De||p>=we&&p<=Ie||p>=_t&&p<=bt||p===pt)break;if(a==="integer"||a==="fraction"){this.index++,c=!0;break}}else if(u>=te&&u<=_e)switch(a){case"integer":s=s*10+(u-te);break;case"fraction":n=n*10+(u-te),o++;break;case"exponent":t=t*10+(u-te);break}else break}let d=s+n/Math.pow(10,o);return a==="exponent"&&(d=d*Math.pow(10,(i?-1:1)*t)),c?{type:"complex",id:this.id_counter++,position:e,imaginary:r?-d:d,real:0,text:this.expression.substring(h,this.index)||""}:{type:"literal",id:this.id_counter++,position:e,value:r?-d:d,text:this.expression.substring(h,this.index)||""}}ConsumeString(){this.index++;let e=[];for(;this.index<this.length;this.index++){let t=this.data[this.index];if(t===ct&&(this.index++,this.index>=this.length||this.data[this.index]!==ct))break;e.push(t)}return e.map(t=>String.fromCharCode(t)).join("")}ConsumeWhiteSpace(){for(;this.index<this.length;){let e=this.data[this.index];if(e===Pt||e===Mi||e===Li||e===Ui||e===Ii)this.index++;else return}}};var $t=(f,e=",")=>{let t=0,i=[],r="",s=[],o=f.length;if(/[\r\n"]/.test(e))throw new Error("invalid delimiter");for(let n=0;n<o;n++){let a=f[n];if(!(n===0&&a.charCodeAt(0)===65279))if(t===0)switch(a){case e:i.push(r),r="";break;case"\r":break;case`
3
3
  `:i.push(r),r="",s.push(i),i=[];break;case'"':r.length===0?t=1:r+=a;break;default:r+=a;break}else a==='"'?n+1<o&&f[n+1]==='"'?(r+='"',n++):t=0:r+=a}return(i.length||r.length)&&(i.push(r),s.push(i)),s};var oe=class f{static _instance=new f;constructor(){}static get instance(){return this._instance}HTML(e,t={}){t={br:!0,...t};let i=[];for(let r of e){let s=[];for(let o of r)o.pre&&s.push("<pre>"),o.emphasis&&s.push("<em>"),o.strong&&s.push("<strong>"),o.strike&&s.push("<strike>"),s.push(o.text),o.strike&&s.push("</strike>"),o.strong&&s.push("</strong>"),o.emphasis&&s.push("</em>"),o.pre&&s.push("</pre>");i.push(s.join(""))}return i.join(t.br?`<br/>
4
4
  `:`