drizzle-cube 0.4.28 → 0.4.30

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 (382) hide show
  1. package/dist/adapters/anthropic-BIva8k1r.cjs +1 -0
  2. package/dist/adapters/anthropic-B_rg0BhK.js +140 -0
  3. package/dist/adapters/dist-Boc63-1q.cjs +2 -0
  4. package/dist/adapters/dist-De5fzUEM.js +581 -0
  5. package/dist/adapters/express/index.cjs +2 -10
  6. package/dist/adapters/express/index.js +232 -342
  7. package/dist/adapters/fastify/index.cjs +2 -10
  8. package/dist/adapters/fastify/index.js +275 -424
  9. package/dist/adapters/google-CT4kgmBf.js +154 -0
  10. package/dist/adapters/google-Dgo9-Kb5.cjs +2 -0
  11. package/dist/adapters/handler-B8vuFQYP.cjs +25 -0
  12. package/dist/adapters/handler-D-2-6uLM.js +2951 -0
  13. package/dist/adapters/hono/index.cjs +2 -10
  14. package/dist/adapters/hono/index.js +307 -402
  15. package/dist/adapters/mcp-prompts-BAutSQYA.js +344 -0
  16. package/dist/adapters/mcp-prompts-DsAkafVn.cjs +5 -0
  17. package/dist/adapters/mcp-transport-CuugoG8t.js +7821 -0
  18. package/dist/adapters/mcp-transport-Dpp6hdZe.cjs +253 -0
  19. package/dist/adapters/nextjs/index.cjs +1 -9
  20. package/dist/adapters/nextjs/index.js +377 -600
  21. package/dist/adapters/openai-CjBvA6mK.js +4114 -0
  22. package/dist/adapters/openai-DhLE0A9Z.cjs +1 -0
  23. package/dist/adapters/openai-Zjw4Zo4R.js +153 -0
  24. package/dist/adapters/openai-eJBw3LfQ.cjs +16 -0
  25. package/dist/adapters/types.cjs +0 -1
  26. package/dist/adapters/types.js +0 -1
  27. package/dist/adapters/utils-ChhNGUOF.js +5396 -0
  28. package/dist/adapters/utils-CwJplXR5.cjs +15 -0
  29. package/dist/adapters/utils.cjs +1 -19
  30. package/dist/adapters/utils.js +2 -21333
  31. package/dist/client/charts.js +15 -186
  32. package/dist/client/chunks/DashboardEditModal-C076pscL.js +6678 -0
  33. package/dist/client/chunks/DashboardEditModal-C076pscL.js.map +1 -0
  34. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js +2631 -0
  35. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js.map +1 -0
  36. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js +270 -0
  37. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js.map +1 -0
  38. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js +56 -0
  39. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js.map +1 -0
  40. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js +193 -0
  41. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js.map +1 -0
  42. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js +25 -0
  43. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js.map +1 -0
  44. package/dist/client/chunks/analysis-builder-DF0XntqC.js +6111 -0
  45. package/dist/client/chunks/analysis-builder-DF0XntqC.js.map +1 -0
  46. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js +3114 -0
  47. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js.map +1 -0
  48. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js +803 -0
  49. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js.map +1 -0
  50. package/dist/client/chunks/chart-area-CRJc3KOu.js +449 -0
  51. package/dist/client/chunks/chart-area-CRJc3KOu.js.map +1 -0
  52. package/dist/client/chunks/chart-bar-DD2PjJ5n.js +270 -0
  53. package/dist/client/chunks/chart-bar-DD2PjJ5n.js.map +1 -0
  54. package/dist/client/chunks/chart-box-plot-BcqleldJ.js +377 -0
  55. package/dist/client/chunks/chart-box-plot-BcqleldJ.js.map +1 -0
  56. package/dist/client/chunks/chart-bubble-BmQkVk4K.js +273 -0
  57. package/dist/client/chunks/chart-bubble-BmQkVk4K.js.map +1 -0
  58. package/dist/client/chunks/chart-candlestick-C3Rep469.js +306 -0
  59. package/dist/client/chunks/chart-candlestick-C3Rep469.js.map +1 -0
  60. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js +51 -0
  61. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js.map +1 -0
  62. package/dist/client/chunks/chart-config-area-D_ZufYzg.js +93 -0
  63. package/dist/client/chunks/chart-config-area-D_ZufYzg.js.map +1 -0
  64. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js +87 -0
  65. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js.map +1 -0
  66. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js +35 -0
  67. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js.map +1 -0
  68. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js +82 -0
  69. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js.map +1 -0
  70. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js +72 -0
  71. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js.map +1 -0
  72. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js +30 -0
  73. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js.map +1 -0
  74. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js +93 -0
  75. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js.map +1 -0
  76. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js +64 -0
  77. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js.map +1 -0
  78. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js +91 -0
  79. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js.map +1 -0
  80. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js +94 -0
  81. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js.map +1 -0
  82. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js +75 -0
  83. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js.map +1 -0
  84. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js +47 -0
  85. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js.map +1 -0
  86. package/dist/client/chunks/chart-config-line-B3NgLF7K.js +104 -0
  87. package/dist/client/chunks/chart-config-line-B3NgLF7K.js.map +1 -0
  88. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js +117 -0
  89. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js.map +1 -0
  90. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js +82 -0
  91. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js.map +1 -0
  92. package/dist/client/chunks/chart-config-pie-wY0B52PC.js +68 -0
  93. package/dist/client/chunks/chart-config-pie-wY0B52PC.js.map +1 -0
  94. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js +49 -0
  95. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js.map +1 -0
  96. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js +38 -0
  97. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js.map +1 -0
  98. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js +66 -0
  99. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js.map +1 -0
  100. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js +61 -0
  101. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js.map +1 -0
  102. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js +45 -0
  103. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js.map +1 -0
  104. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js +51 -0
  105. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js.map +1 -0
  106. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js +59 -0
  107. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js.map +1 -0
  108. package/dist/client/chunks/chart-data-table-DehW1C1G.js +4088 -0
  109. package/dist/client/chunks/chart-data-table-DehW1C1G.js.map +1 -0
  110. package/dist/client/chunks/chart-funnel-BjkpnG5g.js +447 -0
  111. package/dist/client/chunks/chart-funnel-BjkpnG5g.js.map +1 -0
  112. package/dist/client/chunks/chart-gauge-BWW_HEfg.js +424 -0
  113. package/dist/client/chunks/chart-gauge-BWW_HEfg.js.map +1 -0
  114. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js +236 -0
  115. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js.map +1 -0
  116. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js +343 -0
  117. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js.map +1 -0
  118. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js +326 -0
  119. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js.map +1 -0
  120. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js +149 -0
  121. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js.map +1 -0
  122. package/dist/client/chunks/chart-line-DOIMkP0b.js +431 -0
  123. package/dist/client/chunks/chart-line-DOIMkP0b.js.map +1 -0
  124. package/dist/client/chunks/chart-markdown-DXxc43w1.js +3457 -0
  125. package/dist/client/chunks/chart-markdown-DXxc43w1.js.map +1 -0
  126. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js +179 -0
  127. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js.map +1 -0
  128. package/dist/client/chunks/chart-pie-BU_FgwDc.js +172 -0
  129. package/dist/client/chunks/chart-pie-BU_FgwDc.js.map +1 -0
  130. package/dist/client/chunks/chart-radar-DlufwnAX.js +154 -0
  131. package/dist/client/chunks/chart-radar-DlufwnAX.js.map +1 -0
  132. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js +148 -0
  133. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js.map +1 -0
  134. package/dist/client/chunks/chart-sankey-FChb26UX.js +222 -0
  135. package/dist/client/chunks/chart-sankey-FChb26UX.js.map +1 -0
  136. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js +255 -0
  137. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js.map +1 -0
  138. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js +221 -0
  139. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js.map +1 -0
  140. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js +298 -0
  141. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js.map +1 -0
  142. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js +237 -0
  143. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js.map +1 -0
  144. package/dist/client/chunks/charts-core-CUVzf4cV.js +215 -0
  145. package/dist/client/chunks/charts-core-CUVzf4cV.js.map +1 -0
  146. package/dist/client/chunks/charts-loader-AGpph8_I.js +259 -0
  147. package/dist/client/chunks/charts-loader-AGpph8_I.js.map +1 -0
  148. package/dist/client/chunks/core-D1TOj17W.js +845 -0
  149. package/dist/client/chunks/core-D1TOj17W.js.map +1 -0
  150. package/dist/client/chunks/dist-DDBeV_JI.js +847 -0
  151. package/dist/client/chunks/dist-DDBeV_JI.js.map +1 -0
  152. package/dist/client/chunks/javascript-BBwTSo6e.js +438 -0
  153. package/dist/client/chunks/javascript-BBwTSo6e.js.map +1 -0
  154. package/dist/client/chunks/json-BpTrLZSh.js +38 -0
  155. package/dist/client/chunks/json-BpTrLZSh.js.map +1 -0
  156. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js +149 -0
  157. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js.map +1 -0
  158. package/dist/client/chunks/providers-DX3Vw5kc.js +7 -0
  159. package/dist/client/chunks/providers-DX3Vw5kc.js.map +1 -0
  160. package/dist/client/chunks/retention-UEXlSdZ-.js +132 -0
  161. package/dist/client/chunks/retention-UEXlSdZ-.js.map +1 -0
  162. package/dist/client/chunks/rolldown-runtime-lc2dmIiU.js +20 -0
  163. package/dist/client/chunks/schema-visualization-ZugB4Io9.js +1073 -0
  164. package/dist/client/chunks/schema-visualization-ZugB4Io9.js.map +1 -0
  165. package/dist/client/chunks/sql-B0chxcEK.js +120 -0
  166. package/dist/client/chunks/sql-B0chxcEK.js.map +1 -0
  167. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js +30 -0
  168. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js.map +1 -0
  169. package/dist/client/chunks/useDebounce-BQjNWndQ.js +1394 -0
  170. package/dist/client/chunks/useDebounce-BQjNWndQ.js.map +1 -0
  171. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js +66 -0
  172. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js.map +1 -0
  173. package/dist/client/chunks/useExplainAI-c_bHxZe5.js +203 -0
  174. package/dist/client/chunks/useExplainAI-c_bHxZe5.js.map +1 -0
  175. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js +37 -0
  176. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js.map +1 -0
  177. package/dist/client/chunks/utils-A54Ny29G.js +128 -0
  178. package/dist/client/chunks/utils-A54Ny29G.js.map +1 -0
  179. package/dist/client/chunks/vendor-CoPBRumI.js +828 -0
  180. package/dist/client/chunks/vendor-CoPBRumI.js.map +1 -0
  181. package/dist/client/components.js +4 -18
  182. package/dist/client/hooks.js +6 -58
  183. package/dist/client/icons.js +2 -15
  184. package/dist/client/index.js +1061 -1295
  185. package/dist/client/index.js.map +1 -1
  186. package/dist/client/providers.js +3 -9
  187. package/dist/client/styles.css +2 -1
  188. package/dist/client/types.d.ts +1 -0
  189. package/dist/client/utils.js +7 -74
  190. package/dist/client-bundle-stats.html +1 -1
  191. package/dist/server/anthropic-BsNspi1r.js +140 -0
  192. package/dist/server/anthropic-DsCEX6Fm.cjs +1 -0
  193. package/dist/server/dist-CMWZC51B.js +581 -0
  194. package/dist/server/dist-DxegvyZF.cjs +2 -0
  195. package/dist/server/google-BXwMolCu.js +154 -0
  196. package/dist/server/google-DzQWXFwF.cjs +2 -0
  197. package/dist/server/index.cjs +109 -127
  198. package/dist/server/index.d.ts +13 -4
  199. package/dist/server/index.js +15089 -34349
  200. package/dist/server/openai-BPhmb8mi.js +4114 -0
  201. package/dist/server/openai-CLsoLaue.cjs +1 -0
  202. package/dist/server/openai-D1kZ5sdM.js +153 -0
  203. package/dist/server/openai-DkOKbVLC.cjs +16 -0
  204. package/package.json +5 -5
  205. package/dist/adapters/anthropic-BTkjgFpT.cjs +0 -1
  206. package/dist/adapters/anthropic-CTu9E801.js +0 -126
  207. package/dist/adapters/google-BAK9pnQf.cjs +0 -2
  208. package/dist/adapters/google-DficVAsJ.js +0 -146
  209. package/dist/adapters/handler-BV2_dul8.js +0 -2713
  210. package/dist/adapters/handler-LMRPeTNJ.cjs +0 -39
  211. package/dist/adapters/index-BgCeQBuN.cjs +0 -2
  212. package/dist/adapters/index-C3PskWTr.js +0 -5353
  213. package/dist/adapters/index-C45_meK_.js +0 -719
  214. package/dist/adapters/index-ht4NPca9.cjs +0 -23
  215. package/dist/adapters/mcp-transport-B6ZudTSk.js +0 -11010
  216. package/dist/adapters/mcp-transport-DCiSGtp1.cjs +0 -257
  217. package/dist/adapters/openai-BvA6eLs8.cjs +0 -1
  218. package/dist/adapters/openai-mcE24du8.js +0 -131
  219. package/dist/client/charts.js.map +0 -1
  220. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js +0 -256
  221. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js.map +0 -1
  222. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js +0 -48
  223. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js.map +0 -1
  224. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js +0 -178
  225. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js.map +0 -1
  226. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js +0 -29
  227. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js.map +0 -1
  228. package/dist/client/chunks/analysis-builder-DMFoAkjT.js +0 -6203
  229. package/dist/client/chunks/analysis-builder-DMFoAkjT.js.map +0 -1
  230. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js +0 -3140
  231. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js.map +0 -1
  232. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js +0 -347
  233. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js.map +0 -1
  234. package/dist/client/chunks/chart-area-CqKRIUpj.js +0 -234
  235. package/dist/client/chunks/chart-area-CqKRIUpj.js.map +0 -1
  236. package/dist/client/chunks/chart-bar-Bl5jvrU_.js +0 -267
  237. package/dist/client/chunks/chart-bar-Bl5jvrU_.js.map +0 -1
  238. package/dist/client/chunks/chart-box-plot-CzMb00z_.js +0 -322
  239. package/dist/client/chunks/chart-box-plot-CzMb00z_.js.map +0 -1
  240. package/dist/client/chunks/chart-bubble-BF8Z52eW.js +0 -249
  241. package/dist/client/chunks/chart-bubble-BF8Z52eW.js.map +0 -1
  242. package/dist/client/chunks/chart-candlestick-ByWS945g.js +0 -269
  243. package/dist/client/chunks/chart-candlestick-ByWS945g.js.map +0 -1
  244. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js +0 -50
  245. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js.map +0 -1
  246. package/dist/client/chunks/chart-config-area-CK_GVApT.js +0 -77
  247. package/dist/client/chunks/chart-config-area-CK_GVApT.js.map +0 -1
  248. package/dist/client/chunks/chart-config-bar-C8uzktxl.js +0 -71
  249. package/dist/client/chunks/chart-config-bar-C8uzktxl.js.map +0 -1
  250. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js +0 -38
  251. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js.map +0 -1
  252. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js +0 -71
  253. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js.map +0 -1
  254. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js +0 -70
  255. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js.map +0 -1
  256. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js +0 -28
  257. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js.map +0 -1
  258. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js +0 -92
  259. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js.map +0 -1
  260. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js +0 -64
  261. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js.map +0 -1
  262. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js +0 -77
  263. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js.map +0 -1
  264. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js +0 -97
  265. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js.map +0 -1
  266. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js +0 -75
  267. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js.map +0 -1
  268. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js +0 -47
  269. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js.map +0 -1
  270. package/dist/client/chunks/chart-config-line-JNagi9tf.js +0 -88
  271. package/dist/client/chunks/chart-config-line-JNagi9tf.js.map +0 -1
  272. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js +0 -97
  273. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js.map +0 -1
  274. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js +0 -70
  275. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js.map +0 -1
  276. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js +0 -39
  277. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js.map +0 -1
  278. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js +0 -44
  279. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js.map +0 -1
  280. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js +0 -37
  281. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js.map +0 -1
  282. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js +0 -61
  283. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js.map +0 -1
  284. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js +0 -53
  285. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js.map +0 -1
  286. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js +0 -50
  287. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js.map +0 -1
  288. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js +0 -47
  289. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js.map +0 -1
  290. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js +0 -60
  291. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js.map +0 -1
  292. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js +0 -293
  293. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js.map +0 -1
  294. package/dist/client/chunks/chart-funnel-WmuoWlCq.js +0 -259
  295. package/dist/client/chunks/chart-funnel-WmuoWlCq.js.map +0 -1
  296. package/dist/client/chunks/chart-gauge-Cot4By-w.js +0 -374
  297. package/dist/client/chunks/chart-gauge-Cot4By-w.js.map +0 -1
  298. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js +0 -231
  299. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js.map +0 -1
  300. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js +0 -351
  301. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js.map +0 -1
  302. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js +0 -476
  303. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js.map +0 -1
  304. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js +0 -165
  305. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js.map +0 -1
  306. package/dist/client/chunks/chart-line-3Nf-EPqJ.js +0 -450
  307. package/dist/client/chunks/chart-line-3Nf-EPqJ.js.map +0 -1
  308. package/dist/client/chunks/chart-markdown-BT_-MBq1.js +0 -2721
  309. package/dist/client/chunks/chart-markdown-BT_-MBq1.js.map +0 -1
  310. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js +0 -114
  311. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js.map +0 -1
  312. package/dist/client/chunks/chart-pie-DblG6w7g.js +0 -137
  313. package/dist/client/chunks/chart-pie-DblG6w7g.js.map +0 -1
  314. package/dist/client/chunks/chart-radar-BHZbeeTg.js +0 -129
  315. package/dist/client/chunks/chart-radar-BHZbeeTg.js.map +0 -1
  316. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js +0 -119
  317. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js.map +0 -1
  318. package/dist/client/chunks/chart-sankey-E8vYKjQF.js +0 -189
  319. package/dist/client/chunks/chart-sankey-E8vYKjQF.js.map +0 -1
  320. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js +0 -202
  321. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js.map +0 -1
  322. package/dist/client/chunks/chart-sunburst-BgnTKolT.js +0 -188
  323. package/dist/client/chunks/chart-sunburst-BgnTKolT.js.map +0 -1
  324. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js +0 -284
  325. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js.map +0 -1
  326. package/dist/client/chunks/chart-waterfall-BeIhCm83.js +0 -191
  327. package/dist/client/chunks/chart-waterfall-BeIhCm83.js.map +0 -1
  328. package/dist/client/chunks/charts-core-BUUO36OM.js +0 -692
  329. package/dist/client/chunks/charts-core-BUUO36OM.js.map +0 -1
  330. package/dist/client/chunks/charts-loader-goTYnavu.js +0 -258
  331. package/dist/client/chunks/charts-loader-goTYnavu.js.map +0 -1
  332. package/dist/client/chunks/components-BFgYvFq6.js +0 -10066
  333. package/dist/client/chunks/components-BFgYvFq6.js.map +0 -1
  334. package/dist/client/chunks/core-Y9e-sNfb.js +0 -1068
  335. package/dist/client/chunks/core-Y9e-sNfb.js.map +0 -1
  336. package/dist/client/chunks/flow-utils-CjQZG5qq.js +0 -16
  337. package/dist/client/chunks/flow-utils-CjQZG5qq.js.map +0 -1
  338. package/dist/client/chunks/funnel-utils-CyonoNeC.js +0 -135
  339. package/dist/client/chunks/funnel-utils-CyonoNeC.js.map +0 -1
  340. package/dist/client/chunks/icons-CwvgmdIP.js +0 -1636
  341. package/dist/client/chunks/icons-CwvgmdIP.js.map +0 -1
  342. package/dist/client/chunks/index-CApFCBF9.js +0 -81
  343. package/dist/client/chunks/index-CApFCBF9.js.map +0 -1
  344. package/dist/client/chunks/index-_2PSgbkC.js +0 -1046
  345. package/dist/client/chunks/index-_2PSgbkC.js.map +0 -1
  346. package/dist/client/chunks/javascript-DII1YQGr.js +0 -659
  347. package/dist/client/chunks/javascript-DII1YQGr.js.map +0 -1
  348. package/dist/client/chunks/json-C_6Prymp.js +0 -39
  349. package/dist/client/chunks/json-C_6Prymp.js.map +0 -1
  350. package/dist/client/chunks/providers-Ds7DRmnO.js +0 -554
  351. package/dist/client/chunks/providers-Ds7DRmnO.js.map +0 -1
  352. package/dist/client/chunks/retention-CzCo8262.js +0 -120
  353. package/dist/client/chunks/retention-CzCo8262.js.map +0 -1
  354. package/dist/client/chunks/schema-visualization-B97a1Ybu.js +0 -772
  355. package/dist/client/chunks/schema-visualization-B97a1Ybu.js.map +0 -1
  356. package/dist/client/chunks/sql-IeKX8fQ8.js +0 -616
  357. package/dist/client/chunks/sql-IeKX8fQ8.js.map +0 -1
  358. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js +0 -34
  359. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js.map +0 -1
  360. package/dist/client/chunks/theme-Dp3hFed1.js +0 -112
  361. package/dist/client/chunks/theme-Dp3hFed1.js.map +0 -1
  362. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js +0 -1231
  363. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js.map +0 -1
  364. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js +0 -182
  365. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js.map +0 -1
  366. package/dist/client/chunks/vendor-B2EH3V58.js +0 -2892
  367. package/dist/client/chunks/vendor-B2EH3V58.js.map +0 -1
  368. package/dist/client/components.js.map +0 -1
  369. package/dist/client/hooks.js.map +0 -1
  370. package/dist/client/icons.js.map +0 -1
  371. package/dist/client/providers.js.map +0 -1
  372. package/dist/client/utils.js.map +0 -1
  373. package/dist/server/anthropic-BTkjgFpT.cjs +0 -1
  374. package/dist/server/anthropic-CTu9E801.js +0 -126
  375. package/dist/server/google-BAK9pnQf.cjs +0 -2
  376. package/dist/server/google-DficVAsJ.js +0 -146
  377. package/dist/server/index-BgCeQBuN.cjs +0 -2
  378. package/dist/server/index-C3PskWTr.js +0 -5353
  379. package/dist/server/index-C45_meK_.js +0 -719
  380. package/dist/server/index-ht4NPca9.cjs +0 -23
  381. package/dist/server/openai-BvA6eLs8.cjs +0 -1
  382. package/dist/server/openai-mcE24du8.js +0 -131
@@ -1,1046 +0,0 @@
1
- function Q(e, t) {
2
- return e[13] = 1, e[14] = t >> 8, e[15] = t & 255, e[16] = t >> 8, e[17] = t & 255, e;
3
- }
4
- const Z = 112, ee = 72, te = 89, re = 115;
5
- let L;
6
- function Ce() {
7
- const e = new Int32Array(256);
8
- for (let t = 0; t < 256; t++) {
9
- let r = t;
10
- for (let n = 0; n < 8; n++)
11
- r = r & 1 ? 3988292384 ^ r >>> 1 : r >>> 1;
12
- e[t] = r;
13
- }
14
- return e;
15
- }
16
- function ve(e) {
17
- let t = -1;
18
- L || (L = Ce());
19
- for (let r = 0; r < e.length; r++)
20
- t = L[(t ^ e[r]) & 255] ^ t >>> 8;
21
- return t ^ -1;
22
- }
23
- function Ne(e) {
24
- const t = e.length - 1;
25
- for (let r = t; r >= 4; r--)
26
- if (e[r - 4] === 9 && e[r - 3] === Z && e[r - 2] === ee && e[r - 1] === te && e[r] === re)
27
- return r - 3;
28
- return 0;
29
- }
30
- function ne(e, t, r = !1) {
31
- const n = new Uint8Array(13);
32
- t *= 39.3701, n[0] = Z, n[1] = ee, n[2] = te, n[3] = re, n[4] = t >>> 24, n[5] = t >>> 16, n[6] = t >>> 8, n[7] = t & 255, n[8] = n[4], n[9] = n[5], n[10] = n[6], n[11] = n[7], n[12] = 1;
33
- const s = ve(n), a = new Uint8Array(4);
34
- if (a[0] = s >>> 24, a[1] = s >>> 16, a[2] = s >>> 8, a[3] = s & 255, r) {
35
- const i = Ne(e);
36
- return e.set(n, i), e.set(a, i + 13), e;
37
- } else {
38
- const i = new Uint8Array(4);
39
- i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 9;
40
- const o = new Uint8Array(54);
41
- return o.set(e, 0), o.set(i, 33), o.set(n, 37), o.set(a, 50), o;
42
- }
43
- }
44
- const Te = "AAlwSFlz", Ae = "AAAJcEhZ", De = "AAAACXBI";
45
- function Ie(e) {
46
- let t = e.indexOf(Te);
47
- return t === -1 && (t = e.indexOf(Ae)), t === -1 && (t = e.indexOf(De)), t;
48
- }
49
- const oe = "[modern-screenshot]", T = typeof window < "u", Re = T && "Worker" in window, ae = T && "atob" in window, ke = T && "btoa" in window, W = T ? window.navigator?.userAgent : "", se = W.includes("Chrome"), U = W.includes("AppleWebKit") && !se, j = W.includes("Firefox"), Fe = (e) => e && "__CONTEXT__" in e, xe = (e) => e.constructor.name === "CSSFontFaceRule", Pe = (e) => e.constructor.name === "CSSImportRule", Ue = (e) => e.constructor.name === "CSSLayerBlockRule", E = (e) => e.nodeType === 1, F = (e) => typeof e.className == "object", ie = (e) => e.tagName === "image", _e = (e) => e.tagName === "use", I = (e) => E(e) && typeof e.style < "u" && !F(e), $e = (e) => e.nodeType === 8, Be = (e) => e.nodeType === 3, D = (e) => e.tagName === "IMG", _ = (e) => e.tagName === "VIDEO", Le = (e) => e.tagName === "CANVAS", Oe = (e) => e.tagName === "TEXTAREA", Me = (e) => e.tagName === "INPUT", We = (e) => e.tagName === "STYLE", je = (e) => e.tagName === "SCRIPT", qe = (e) => e.tagName === "SELECT", Ve = (e) => e.tagName === "SLOT", He = (e) => e.tagName === "IFRAME", ze = (...e) => console.warn(oe, ...e);
50
- function Xe(e) {
51
- const t = e?.createElement?.("canvas");
52
- return t && (t.height = t.width = 1), !!t && "toDataURL" in t && !!t.toDataURL("image/webp").includes("image/webp");
53
- }
54
- const O = (e) => e.startsWith("data:");
55
- function le(e, t) {
56
- if (e.match(/^[a-z]+:\/\//i))
57
- return e;
58
- if (T && e.match(/^\/\//))
59
- return window.location.protocol + e;
60
- if (e.match(/^[a-z]+:/i) || !T)
61
- return e;
62
- const r = $().implementation.createHTMLDocument(), n = r.createElement("base"), s = r.createElement("a");
63
- return r.head.appendChild(n), r.body.appendChild(s), t && (n.href = t), s.href = e, s.href;
64
- }
65
- function $(e) {
66
- return (e && E(e) ? e?.ownerDocument : e) ?? window.document;
67
- }
68
- const B = "http://www.w3.org/2000/svg";
69
- function ce(e, t, r) {
70
- const n = $(r).createElementNS(B, "svg");
71
- return n.setAttributeNS(null, "width", e.toString()), n.setAttributeNS(null, "height", t.toString()), n.setAttributeNS(null, "viewBox", `0 0 ${e} ${t}`), n;
72
- }
73
- function ue(e, t) {
74
- let r = new XMLSerializer().serializeToString(e);
75
- return t && (r = r.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu, "")), `data:image/svg+xml;charset=utf-8,${encodeURIComponent(r)}`;
76
- }
77
- async function Ge(e, t = "image/png", r = 1) {
78
- try {
79
- return await new Promise((n, s) => {
80
- e.toBlob((a) => {
81
- a ? n(a) : s(new Error("Blob is null"));
82
- }, t, r);
83
- });
84
- } catch (n) {
85
- if (ae)
86
- return Ye(e.toDataURL(t, r));
87
- throw n;
88
- }
89
- }
90
- function Ye(e) {
91
- const [t, r] = e.split(","), n = t.match(/data:(.+);/)?.[1] ?? void 0, s = window.atob(r), a = s.length, i = new Uint8Array(a);
92
- for (let o = 0; o < a; o += 1)
93
- i[o] = s.charCodeAt(o);
94
- return new Blob([i], { type: n });
95
- }
96
- function fe(e, t) {
97
- return new Promise((r, n) => {
98
- const s = new FileReader();
99
- s.onload = () => r(s.result), s.onerror = () => n(s.error), s.onabort = () => n(new Error(`Failed read blob to ${t}`)), t === "dataUrl" ? s.readAsDataURL(e) : t === "arrayBuffer" && s.readAsArrayBuffer(e);
100
- });
101
- }
102
- const Je = (e) => fe(e, "dataUrl"), Ke = (e) => fe(e, "arrayBuffer");
103
- function A(e, t) {
104
- const r = $(t).createElement("img");
105
- return r.decoding = "sync", r.loading = "eager", r.src = e, r;
106
- }
107
- function R(e, t) {
108
- return new Promise((r) => {
109
- const { timeout: n, ownerDocument: s, onError: a, onWarn: i } = t ?? {}, o = typeof e == "string" ? A(e, $(s)) : e;
110
- let u = null, c = null;
111
- function l() {
112
- r(o), u && clearTimeout(u), c?.();
113
- }
114
- if (n && (u = setTimeout(l, n)), _(o)) {
115
- const f = o.currentSrc || o.src;
116
- if (!f)
117
- return o.poster ? R(o.poster, t).then(r) : l();
118
- if (o.readyState >= 2)
119
- return l();
120
- const g = l, m = (p) => {
121
- i?.(
122
- "Failed video load",
123
- f,
124
- p
125
- ), a?.(p), l();
126
- };
127
- c = () => {
128
- o.removeEventListener("loadeddata", g), o.removeEventListener("error", m);
129
- }, o.addEventListener("loadeddata", g, { once: !0 }), o.addEventListener("error", m, { once: !0 });
130
- } else {
131
- const f = ie(o) ? o.href.baseVal : o.currentSrc || o.src;
132
- if (!f)
133
- return l();
134
- const g = async () => {
135
- if (D(o) && "decode" in o)
136
- try {
137
- await o.decode();
138
- } catch (p) {
139
- i?.(
140
- "Failed to decode image, trying to render anyway",
141
- o.dataset.originalSrc || f,
142
- p
143
- );
144
- }
145
- l();
146
- }, m = (p) => {
147
- i?.(
148
- "Failed image load",
149
- o.dataset.originalSrc || f,
150
- p
151
- ), l();
152
- };
153
- if (D(o) && o.complete)
154
- return g();
155
- c = () => {
156
- o.removeEventListener("load", g), o.removeEventListener("error", m);
157
- }, o.addEventListener("load", g, { once: !0 }), o.addEventListener("error", m, { once: !0 });
158
- }
159
- });
160
- }
161
- async function Qe(e, t) {
162
- I(e) && (D(e) || _(e) ? await R(e, t) : await Promise.all(
163
- ["img", "video"].flatMap((r) => Array.from(e.querySelectorAll(r)).map((n) => R(n, t)))
164
- ));
165
- }
166
- const de = /* @__PURE__ */ (function() {
167
- let t = 0;
168
- const r = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
169
- return () => (t += 1, `u${r()}${t}`);
170
- })();
171
- function ge(e) {
172
- return e?.split(",").map((t) => t.trim().replace(/"|'/g, "").toLowerCase()).filter(Boolean);
173
- }
174
- let z = 0;
175
- function Ze(e) {
176
- const t = `${oe}[#${z}]`;
177
- return z++, {
178
- // eslint-disable-next-line no-console
179
- time: (r) => e && console.time(`${t} ${r}`),
180
- // eslint-disable-next-line no-console
181
- timeEnd: (r) => e && console.timeEnd(`${t} ${r}`),
182
- warn: (...r) => e && ze(...r)
183
- };
184
- }
185
- function et(e) {
186
- return {
187
- cache: e ? "no-cache" : "force-cache"
188
- };
189
- }
190
- async function C(e, t) {
191
- return Fe(e) ? e : tt(e, { ...t, autoDestruct: !0 });
192
- }
193
- async function tt(e, t) {
194
- const { scale: r = 1, workerUrl: n, workerNumber: s = 1 } = t || {}, a = !!t?.debug, i = t?.features ?? !0, o = e.ownerDocument ?? (T ? window.document : void 0), u = e.ownerDocument?.defaultView ?? (T ? window : void 0), c = /* @__PURE__ */ new Map(), l = {
195
- // Options
196
- width: 0,
197
- height: 0,
198
- quality: 1,
199
- type: "image/png",
200
- scale: r,
201
- backgroundColor: null,
202
- style: null,
203
- filter: null,
204
- maximumCanvasSize: 0,
205
- timeout: 3e4,
206
- progress: null,
207
- debug: a,
208
- fetch: {
209
- requestInit: et(t?.fetch?.bypassingCache),
210
- placeholderImage: "data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
211
- bypassingCache: !1,
212
- ...t?.fetch
213
- },
214
- fetchFn: null,
215
- font: {},
216
- drawImageInterval: 100,
217
- workerUrl: null,
218
- workerNumber: s,
219
- onCloneEachNode: null,
220
- onCloneNode: null,
221
- onEmbedNode: null,
222
- onCreateForeignObjectSvg: null,
223
- includeStyleProperties: null,
224
- autoDestruct: !1,
225
- ...t,
226
- // InternalContext
227
- __CONTEXT__: !0,
228
- log: Ze(a),
229
- node: e,
230
- ownerDocument: o,
231
- ownerWindow: u,
232
- dpi: r === 1 ? null : 96 * r,
233
- svgStyleElement: me(o),
234
- svgDefsElement: o?.createElementNS(B, "defs"),
235
- svgStyles: /* @__PURE__ */ new Map(),
236
- defaultComputedStyles: /* @__PURE__ */ new Map(),
237
- workers: [
238
- ...Array.from({
239
- length: Re && n && s ? s : 0
240
- })
241
- ].map(() => {
242
- try {
243
- const m = new Worker(n);
244
- return m.onmessage = async (p) => {
245
- const { url: d, result: w } = p.data;
246
- w ? c.get(d)?.resolve?.(w) : c.get(d)?.reject?.(new Error(`Error receiving message from worker: ${d}`));
247
- }, m.onmessageerror = (p) => {
248
- const { url: d } = p.data;
249
- c.get(d)?.reject?.(new Error(`Error receiving message from worker: ${d}`));
250
- }, m;
251
- } catch (m) {
252
- return l.log.warn("Failed to new Worker", m), null;
253
- }
254
- }).filter(Boolean),
255
- fontFamilies: /* @__PURE__ */ new Map(),
256
- fontCssTexts: /* @__PURE__ */ new Map(),
257
- acceptOfImage: `${[
258
- Xe(o) && "image/webp",
259
- "image/svg+xml",
260
- "image/*",
261
- "*/*"
262
- ].filter(Boolean).join(",")};q=0.8`,
263
- requests: c,
264
- drawImageCount: 0,
265
- tasks: [],
266
- features: i,
267
- isEnable: (m) => m === "restoreScrollPosition" ? typeof i == "boolean" ? !1 : i[m] ?? !1 : typeof i == "boolean" ? i : i[m] ?? !0,
268
- shadowRoots: []
269
- };
270
- l.log.time("wait until load"), await Qe(e, { timeout: l.timeout, onWarn: l.log.warn }), l.log.timeEnd("wait until load");
271
- const { width: f, height: g } = rt(e, l);
272
- return l.width = f, l.height = g, l;
273
- }
274
- function me(e) {
275
- if (!e)
276
- return;
277
- const t = e.createElement("style"), r = t.ownerDocument.createTextNode(`
278
- .______background-clip--text {
279
- background-clip: text;
280
- -webkit-background-clip: text;
281
- }
282
- `);
283
- return t.appendChild(r), t;
284
- }
285
- function rt(e, t) {
286
- let { width: r, height: n } = t;
287
- if (E(e) && (!r || !n)) {
288
- const s = e.getBoundingClientRect();
289
- r = r || s.width || Number(e.getAttribute("width")) || 0, n = n || s.height || Number(e.getAttribute("height")) || 0;
290
- }
291
- return { width: r, height: n };
292
- }
293
- async function nt(e, t) {
294
- const {
295
- log: r,
296
- timeout: n,
297
- drawImageCount: s,
298
- drawImageInterval: a
299
- } = t;
300
- r.time("image to canvas");
301
- const i = await R(e, { timeout: n, onWarn: t.log.warn }), { canvas: o, context2d: u } = ot(e.ownerDocument, t), c = () => {
302
- try {
303
- u?.drawImage(i, 0, 0, o.width, o.height);
304
- } catch (l) {
305
- t.log.warn("Failed to drawImage", l);
306
- }
307
- };
308
- if (c(), t.isEnable("fixSvgXmlDecode"))
309
- for (let l = 0; l < s; l++)
310
- await new Promise((f) => {
311
- setTimeout(() => {
312
- u?.clearRect(0, 0, o.width, o.height), c(), f();
313
- }, l + a);
314
- });
315
- return t.drawImageCount = 0, r.timeEnd("image to canvas"), o;
316
- }
317
- function ot(e, t) {
318
- const { width: r, height: n, scale: s, backgroundColor: a, maximumCanvasSize: i } = t, o = e.createElement("canvas");
319
- o.width = Math.floor(r * s), o.height = Math.floor(n * s), o.style.width = `${r}px`, o.style.height = `${n}px`, i && (o.width > i || o.height > i) && (o.width > i && o.height > i ? o.width > o.height ? (o.height *= i / o.width, o.width = i) : (o.width *= i / o.height, o.height = i) : o.width > i ? (o.height *= i / o.width, o.width = i) : (o.width *= i / o.height, o.height = i));
320
- const u = o.getContext("2d");
321
- return u && a && (u.fillStyle = a, u.fillRect(0, 0, o.width, o.height)), { canvas: o, context2d: u };
322
- }
323
- function he(e, t) {
324
- if (e.ownerDocument)
325
- try {
326
- const a = e.toDataURL();
327
- if (a !== "data:,")
328
- return A(a, e.ownerDocument);
329
- } catch (a) {
330
- t.log.warn("Failed to clone canvas", a);
331
- }
332
- const r = e.cloneNode(!1), n = e.getContext("2d"), s = r.getContext("2d");
333
- try {
334
- return n && s && s.putImageData(
335
- n.getImageData(0, 0, e.width, e.height),
336
- 0,
337
- 0
338
- ), r;
339
- } catch (a) {
340
- t.log.warn("Failed to clone canvas", a);
341
- }
342
- return r;
343
- }
344
- function at(e, t) {
345
- try {
346
- if (e?.contentDocument?.body)
347
- return q(e.contentDocument.body, t);
348
- } catch (r) {
349
- t.log.warn("Failed to clone iframe", r);
350
- }
351
- return e.cloneNode(!1);
352
- }
353
- function st(e) {
354
- const t = e.cloneNode(!1);
355
- return e.currentSrc && e.currentSrc !== e.src && (t.src = e.currentSrc, t.srcset = ""), t.loading === "lazy" && (t.loading = "eager"), t;
356
- }
357
- async function it(e, t) {
358
- if (e.ownerDocument && !e.currentSrc && e.poster)
359
- return A(e.poster, e.ownerDocument);
360
- const r = e.cloneNode(!1);
361
- r.crossOrigin = "anonymous", e.currentSrc && e.currentSrc !== e.src && (r.src = e.currentSrc);
362
- const n = r.ownerDocument;
363
- if (n) {
364
- let s = !0;
365
- if (await R(r, { onError: () => s = !1, onWarn: t.log.warn }), !s)
366
- return e.poster ? A(e.poster, e.ownerDocument) : r;
367
- r.currentTime = e.currentTime, await new Promise((i) => {
368
- r.addEventListener("seeked", i, { once: !0 });
369
- });
370
- const a = n.createElement("canvas");
371
- a.width = e.offsetWidth, a.height = e.offsetHeight;
372
- try {
373
- const i = a.getContext("2d");
374
- i && i.drawImage(r, 0, 0, a.width, a.height);
375
- } catch (i) {
376
- return t.log.warn("Failed to clone video", i), e.poster ? A(e.poster, e.ownerDocument) : r;
377
- }
378
- return he(a, t);
379
- }
380
- return r;
381
- }
382
- function lt(e, t) {
383
- return Le(e) ? he(e, t) : He(e) ? at(e, t) : D(e) ? st(e) : _(e) ? it(e, t) : e.cloneNode(!1);
384
- }
385
- function ct(e) {
386
- let t = e.sandbox;
387
- if (!t) {
388
- const { ownerDocument: r } = e;
389
- try {
390
- r && (t = r.createElement("iframe"), t.id = `__SANDBOX__${de()}`, t.width = "0", t.height = "0", t.style.visibility = "hidden", t.style.position = "fixed", r.body.appendChild(t), t.srcdoc = '<!DOCTYPE html><meta charset="UTF-8"><title></title><body>', e.sandbox = t);
391
- } catch (n) {
392
- e.log.warn("Failed to getSandBox", n);
393
- }
394
- }
395
- return t;
396
- }
397
- const ut = [
398
- "width",
399
- "height",
400
- "-webkit-text-fill-color"
401
- ], ft = [
402
- "stroke",
403
- "fill"
404
- ];
405
- function we(e, t, r) {
406
- const { defaultComputedStyles: n } = r, s = e.nodeName.toLowerCase(), a = F(e) && s !== "svg", i = a ? ft.map((d) => [d, e.getAttribute(d)]).filter(([, d]) => d !== null) : [], o = [
407
- a && "svg",
408
- s,
409
- i.map((d, w) => `${d}=${w}`).join(","),
410
- t
411
- ].filter(Boolean).join(":");
412
- if (n.has(o))
413
- return n.get(o);
414
- const c = ct(r)?.contentWindow;
415
- if (!c)
416
- return /* @__PURE__ */ new Map();
417
- const l = c?.document;
418
- let f, g;
419
- a ? (f = l.createElementNS(B, "svg"), g = f.ownerDocument.createElementNS(f.namespaceURI, s), i.forEach(([d, w]) => {
420
- g.setAttributeNS(null, d, w);
421
- }), f.appendChild(g)) : f = g = l.createElement(s), g.textContent = " ", l.body.appendChild(f);
422
- const m = c.getComputedStyle(g, t), p = /* @__PURE__ */ new Map();
423
- for (let d = m.length, w = 0; w < d; w++) {
424
- const h = m.item(w);
425
- ut.includes(h) || p.set(h, m.getPropertyValue(h));
426
- }
427
- return l.body.removeChild(f), n.set(o, p), p;
428
- }
429
- function pe(e, t, r) {
430
- const n = /* @__PURE__ */ new Map(), s = [], a = /* @__PURE__ */ new Map();
431
- if (r)
432
- for (const o of r)
433
- i(o);
434
- else
435
- for (let o = e.length, u = 0; u < o; u++) {
436
- const c = e.item(u);
437
- i(c);
438
- }
439
- for (let o = s.length, u = 0; u < o; u++)
440
- a.get(s[u])?.forEach((c, l) => n.set(l, c));
441
- function i(o) {
442
- const u = e.getPropertyValue(o), c = e.getPropertyPriority(o), l = o.lastIndexOf("-"), f = l > -1 ? o.substring(0, l) : void 0;
443
- if (f) {
444
- let g = a.get(f);
445
- g || (g = /* @__PURE__ */ new Map(), a.set(f, g)), g.set(o, [u, c]);
446
- }
447
- t.get(o) === u && !c || (f ? s.push(f) : n.set(o, [u, c]));
448
- }
449
- return n;
450
- }
451
- function dt(e, t, r, n) {
452
- const { ownerWindow: s, includeStyleProperties: a, currentParentNodeStyle: i } = n, o = t.style, u = s.getComputedStyle(e), c = we(e, null, n);
453
- i?.forEach((f, g) => {
454
- c.delete(g);
455
- });
456
- const l = pe(u, c, a);
457
- l.delete("transition-property"), l.delete("all"), l.delete("d"), l.delete("content"), r && (l.delete("margin-top"), l.delete("margin-right"), l.delete("margin-bottom"), l.delete("margin-left"), l.delete("margin-block-start"), l.delete("margin-block-end"), l.delete("margin-inline-start"), l.delete("margin-inline-end"), l.set("box-sizing", ["border-box", ""])), l.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text"), se && (l.has("font-kerning") || l.set("font-kerning", ["normal", ""]), (l.get("overflow-x")?.[0] === "hidden" || l.get("overflow-y")?.[0] === "hidden") && l.get("text-overflow")?.[0] === "ellipsis" && e.scrollWidth === e.clientWidth && l.set("text-overflow", ["clip", ""]));
458
- for (let f = o.length, g = 0; g < f; g++)
459
- o.removeProperty(o.item(g));
460
- return l.forEach(([f, g], m) => {
461
- o.setProperty(m, f, g);
462
- }), l;
463
- }
464
- function gt(e, t) {
465
- (Oe(e) || Me(e) || qe(e)) && t.setAttribute("value", e.value);
466
- }
467
- const mt = [
468
- "::before",
469
- "::after"
470
- // '::placeholder', TODO
471
- ], ht = [
472
- "::-webkit-scrollbar",
473
- "::-webkit-scrollbar-button",
474
- // '::-webkit-scrollbar:horizontal', TODO
475
- "::-webkit-scrollbar-thumb",
476
- "::-webkit-scrollbar-track",
477
- "::-webkit-scrollbar-track-piece",
478
- // '::-webkit-scrollbar:vertical', TODO
479
- "::-webkit-scrollbar-corner",
480
- "::-webkit-resizer"
481
- ];
482
- function wt(e, t, r, n, s) {
483
- const { ownerWindow: a, svgStyleElement: i, svgStyles: o, currentNodeStyle: u } = n;
484
- if (!i || !a)
485
- return;
486
- function c(l) {
487
- const f = a.getComputedStyle(e, l);
488
- let g = f.getPropertyValue("content");
489
- if (!g || g === "none")
490
- return;
491
- s?.(g), g = g.replace(/(')|(")|(counter\(.+\))/g, "");
492
- const m = [de()], p = we(e, l, n);
493
- u?.forEach((y, S) => {
494
- p.delete(S);
495
- });
496
- const d = pe(f, p, n.includeStyleProperties);
497
- d.delete("content"), d.delete("-webkit-locale"), d.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text");
498
- const w = [
499
- `content: '${g}';`
500
- ];
501
- if (d.forEach(([y, S], N) => {
502
- w.push(`${N}: ${y}${S ? " !important" : ""};`);
503
- }), w.length === 1)
504
- return;
505
- try {
506
- t.className = [t.className, ...m].join(" ");
507
- } catch (y) {
508
- n.log.warn("Failed to copyPseudoClass", y);
509
- return;
510
- }
511
- const h = w.join(`
512
- `);
513
- let b = o.get(h);
514
- b || (b = [], o.set(h, b)), b.push(`.${m[0]}${l}`);
515
- }
516
- mt.forEach(c), r && ht.forEach(c);
517
- }
518
- const X = /* @__PURE__ */ new Set([
519
- "symbol"
520
- // test/fixtures/svg.symbol.html
521
- ]);
522
- async function G(e, t, r, n, s) {
523
- if (E(r) && (We(r) || je(r)) || n.filter && !n.filter(r))
524
- return;
525
- X.has(t.nodeName) || X.has(r.nodeName) ? n.currentParentNodeStyle = void 0 : n.currentParentNodeStyle = n.currentNodeStyle;
526
- const a = await q(r, n, !1, s);
527
- n.isEnable("restoreScrollPosition") && pt(e, a), t.appendChild(a);
528
- }
529
- async function Y(e, t, r, n) {
530
- let s = e.firstChild;
531
- E(e) && e.shadowRoot && (s = e.shadowRoot?.firstChild, r.shadowRoots.push(e.shadowRoot));
532
- for (let a = s; a; a = a.nextSibling)
533
- if (!$e(a))
534
- if (E(a) && Ve(a) && typeof a.assignedNodes == "function") {
535
- const i = a.assignedNodes();
536
- for (let o = 0; o < i.length; o++)
537
- await G(e, t, i[o], r, n);
538
- } else
539
- await G(e, t, a, r, n);
540
- }
541
- function pt(e, t) {
542
- if (!I(e) || !I(t))
543
- return;
544
- const { scrollTop: r, scrollLeft: n } = e;
545
- if (!r && !n)
546
- return;
547
- const { transform: s } = t.style, a = new DOMMatrix(s), { a: i, b: o, c: u, d: c } = a;
548
- a.a = 1, a.b = 0, a.c = 0, a.d = 1, a.translateSelf(-n, -r), a.a = i, a.b = o, a.c = u, a.d = c, t.style.transform = a.toString();
549
- }
550
- function yt(e, t) {
551
- const { backgroundColor: r, width: n, height: s, style: a } = t, i = e.style;
552
- if (r && i.setProperty("background-color", r, "important"), n && i.setProperty("width", `${n}px`, "important"), s && i.setProperty("height", `${s}px`, "important"), a)
553
- for (const o in a) i[o] = a[o];
554
- }
555
- const bt = /^[\w-:]+$/;
556
- async function q(e, t, r = !1, n) {
557
- const { ownerDocument: s, ownerWindow: a, fontFamilies: i, onCloneEachNode: o } = t;
558
- if (s && Be(e))
559
- return n && /\S/.test(e.data) && n(e.data), s.createTextNode(e.data);
560
- if (s && a && E(e) && (I(e) || F(e))) {
561
- const c = await lt(e, t);
562
- if (t.isEnable("removeAbnormalAttributes")) {
563
- const d = c.getAttributeNames();
564
- for (let w = d.length, h = 0; h < w; h++) {
565
- const b = d[h];
566
- bt.test(b) || c.removeAttribute(b);
567
- }
568
- }
569
- const l = t.currentNodeStyle = dt(e, c, r, t);
570
- r && yt(c, t);
571
- let f = !1;
572
- if (t.isEnable("copyScrollbar")) {
573
- const d = [
574
- l.get("overflow-x")?.[0],
575
- l.get("overflow-y")?.[0]
576
- ];
577
- f = d.includes("scroll") || (d.includes("auto") || d.includes("overlay")) && (e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth);
578
- }
579
- const g = l.get("text-transform")?.[0], m = ge(l.get("font-family")?.[0]), p = m ? (d) => {
580
- g === "uppercase" ? d = d.toUpperCase() : g === "lowercase" ? d = d.toLowerCase() : g === "capitalize" && (d = d[0].toUpperCase() + d.substring(1)), m.forEach((w) => {
581
- let h = i.get(w);
582
- h || i.set(w, h = /* @__PURE__ */ new Set()), d.split("").forEach((b) => h.add(b));
583
- });
584
- } : void 0;
585
- return wt(
586
- e,
587
- c,
588
- f,
589
- t,
590
- p
591
- ), gt(e, c), _(e) || await Y(
592
- e,
593
- c,
594
- t,
595
- p
596
- ), await o?.(c), c;
597
- }
598
- const u = e.cloneNode(!1);
599
- return await Y(e, u, t), await o?.(u), u;
600
- }
601
- function St(e) {
602
- if (e.ownerDocument = void 0, e.ownerWindow = void 0, e.svgStyleElement = void 0, e.svgDefsElement = void 0, e.svgStyles.clear(), e.defaultComputedStyles.clear(), e.sandbox) {
603
- try {
604
- e.sandbox.remove();
605
- } catch (t) {
606
- e.log.warn("Failed to destroyContext", t);
607
- }
608
- e.sandbox = void 0;
609
- }
610
- e.workers = [], e.fontFamilies.clear(), e.fontCssTexts.clear(), e.requests.clear(), e.tasks = [], e.shadowRoots = [];
611
- }
612
- function Et(e) {
613
- const { url: t, timeout: r, responseType: n, ...s } = e, a = new AbortController(), i = r ? setTimeout(() => a.abort(), r) : void 0;
614
- return fetch(t, { signal: a.signal, ...s }).then((o) => {
615
- if (!o.ok)
616
- throw new Error("Failed fetch, not 2xx response", { cause: o });
617
- switch (n) {
618
- case "arrayBuffer":
619
- return o.arrayBuffer();
620
- case "dataUrl":
621
- return o.blob().then(Je);
622
- default:
623
- return o.text();
624
- }
625
- }).finally(() => clearTimeout(i));
626
- }
627
- function k(e, t) {
628
- const { url: r, requestType: n = "text", responseType: s = "text", imageDom: a } = t;
629
- let i = r;
630
- const {
631
- timeout: o,
632
- acceptOfImage: u,
633
- requests: c,
634
- fetchFn: l,
635
- fetch: {
636
- requestInit: f,
637
- bypassingCache: g,
638
- placeholderImage: m
639
- },
640
- font: p,
641
- workers: d,
642
- fontFamilies: w
643
- } = e;
644
- n === "image" && (U || j) && e.drawImageCount++;
645
- let h = c.get(r);
646
- if (!h) {
647
- g && g instanceof RegExp && g.test(i) && (i += (/\?/.test(i) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
648
- const b = n.startsWith("font") && p && p.minify, y = /* @__PURE__ */ new Set();
649
- b && n.split(";")[1].split(",").forEach((P) => {
650
- w.has(P) && w.get(P).forEach((H) => y.add(H));
651
- });
652
- const S = b && y.size, N = {
653
- url: i,
654
- timeout: o,
655
- responseType: S ? "arrayBuffer" : s,
656
- headers: n === "image" ? { accept: u } : void 0,
657
- ...f
658
- };
659
- h = {
660
- type: n,
661
- resolve: void 0,
662
- reject: void 0,
663
- response: null
664
- }, h.response = (async () => {
665
- if (l && n === "image") {
666
- const v = await l(r);
667
- if (v)
668
- return v;
669
- }
670
- return !U && r.startsWith("http") && d.length ? new Promise((v, P) => {
671
- d[c.size & d.length - 1].postMessage({ rawUrl: r, ...N }), h.resolve = v, h.reject = P;
672
- }) : Et(N);
673
- })().catch((v) => {
674
- if (c.delete(r), n === "image" && m)
675
- return e.log.warn("Failed to fetch image base64, trying to use placeholder image", i), typeof m == "string" ? m : m(a);
676
- throw v;
677
- }), c.set(r, h);
678
- }
679
- return h.response;
680
- }
681
- async function ye(e, t, r, n) {
682
- if (!be(e))
683
- return e;
684
- for (const [s, a] of Ct(e, t))
685
- try {
686
- const i = await k(
687
- r,
688
- {
689
- url: a,
690
- requestType: n ? "image" : "text",
691
- responseType: "dataUrl"
692
- }
693
- );
694
- e = e.replace(vt(s), `$1${i}$3`);
695
- } catch (i) {
696
- r.log.warn("Failed to fetch css data url", s, i);
697
- }
698
- return e;
699
- }
700
- function be(e) {
701
- return /url\((['"]?)([^'"]+?)\1\)/.test(e);
702
- }
703
- const Se = /url\((['"]?)([^'"]+?)\1\)/g;
704
- function Ct(e, t) {
705
- const r = [];
706
- return e.replace(Se, (n, s, a) => (r.push([a, le(a, t)]), n)), r.filter(([n]) => !O(n));
707
- }
708
- function vt(e) {
709
- const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
710
- return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
711
- }
712
- const Nt = [
713
- "background-image",
714
- "border-image-source",
715
- "-webkit-border-image",
716
- "-webkit-mask-image",
717
- "list-style-image"
718
- ];
719
- function Tt(e, t) {
720
- return Nt.map((r) => {
721
- const n = e.getPropertyValue(r);
722
- return !n || n === "none" ? null : ((U || j) && t.drawImageCount++, ye(n, null, t, !0).then((s) => {
723
- !s || n === s || e.setProperty(
724
- r,
725
- s,
726
- e.getPropertyPriority(r)
727
- );
728
- }));
729
- }).filter(Boolean);
730
- }
731
- function At(e, t) {
732
- if (D(e)) {
733
- const r = e.currentSrc || e.src;
734
- if (!O(r))
735
- return [
736
- k(t, {
737
- url: r,
738
- imageDom: e,
739
- requestType: "image",
740
- responseType: "dataUrl"
741
- }).then((n) => {
742
- n && (e.srcset = "", e.dataset.originalSrc = r, e.src = n || "");
743
- })
744
- ];
745
- (U || j) && t.drawImageCount++;
746
- } else if (F(e) && !O(e.href.baseVal)) {
747
- const r = e.href.baseVal;
748
- return [
749
- k(t, {
750
- url: r,
751
- imageDom: e,
752
- requestType: "image",
753
- responseType: "dataUrl"
754
- }).then((n) => {
755
- n && (e.dataset.originalSrc = r, e.href.baseVal = n || "");
756
- })
757
- ];
758
- }
759
- return [];
760
- }
761
- function Dt(e, t) {
762
- const { ownerDocument: r, svgDefsElement: n } = t, s = e.getAttribute("href") ?? e.getAttribute("xlink:href");
763
- if (!s)
764
- return [];
765
- const [a, i] = s.split("#");
766
- if (i) {
767
- const o = `#${i}`, u = t.shadowRoots.reduce(
768
- (c, l) => c ?? l.querySelector(`svg ${o}`),
769
- r?.querySelector(`svg ${o}`)
770
- );
771
- if (a && e.setAttribute("href", o), n?.querySelector(o))
772
- return [];
773
- if (u)
774
- return n?.appendChild(u.cloneNode(!0)), [];
775
- if (a)
776
- return [
777
- k(t, {
778
- url: a,
779
- responseType: "text"
780
- }).then((c) => {
781
- n?.insertAdjacentHTML("beforeend", c);
782
- })
783
- ];
784
- }
785
- return [];
786
- }
787
- function Ee(e, t) {
788
- const { tasks: r } = t;
789
- E(e) && ((D(e) || ie(e)) && r.push(...At(e, t)), _e(e) && r.push(...Dt(e, t))), I(e) && r.push(...Tt(e.style, t)), e.childNodes.forEach((n) => {
790
- Ee(n, t);
791
- });
792
- }
793
- async function It(e, t) {
794
- const {
795
- ownerDocument: r,
796
- svgStyleElement: n,
797
- fontFamilies: s,
798
- fontCssTexts: a,
799
- tasks: i,
800
- font: o
801
- } = t;
802
- if (!(!r || !n || !s.size))
803
- if (o && o.cssText) {
804
- const u = K(o.cssText, t);
805
- n.appendChild(r.createTextNode(`${u}
806
- `));
807
- } else {
808
- const u = Array.from(r.styleSheets).filter((l) => {
809
- try {
810
- return "cssRules" in l && !!l.cssRules.length;
811
- } catch (f) {
812
- return t.log.warn(`Error while reading CSS rules from ${l.href}`, f), !1;
813
- }
814
- });
815
- await Promise.all(
816
- u.flatMap((l) => Array.from(l.cssRules).map(async (f, g) => {
817
- if (Pe(f)) {
818
- let m = g + 1;
819
- const p = f.href;
820
- let d = "";
821
- try {
822
- d = await k(t, {
823
- url: p,
824
- requestType: "text",
825
- responseType: "text"
826
- });
827
- } catch (h) {
828
- t.log.warn(`Error fetch remote css import from ${p}`, h);
829
- }
830
- const w = d.replace(
831
- Se,
832
- (h, b, y) => h.replace(y, le(y, p))
833
- );
834
- for (const h of kt(w))
835
- try {
836
- l.insertRule(
837
- h,
838
- h.startsWith("@import") ? m += 1 : l.cssRules.length
839
- );
840
- } catch (b) {
841
- t.log.warn("Error inserting rule from remote css import", { rule: h, error: b });
842
- }
843
- }
844
- }))
845
- );
846
- const c = [];
847
- u.forEach((l) => {
848
- M(l.cssRules, c);
849
- }), c.filter((l) => xe(l) && be(l.style.getPropertyValue("src")) && ge(l.style.getPropertyValue("font-family"))?.some((f) => s.has(f))).forEach((l) => {
850
- const f = l, g = a.get(f.cssText);
851
- g ? n.appendChild(r.createTextNode(`${g}
852
- `)) : i.push(
853
- ye(
854
- f.cssText,
855
- f.parentStyleSheet ? f.parentStyleSheet.href : null,
856
- t
857
- ).then((m) => {
858
- m = K(m, t), a.set(f.cssText, m), n.appendChild(r.createTextNode(`${m}
859
- `));
860
- })
861
- );
862
- });
863
- }
864
- }
865
- const Rt = /(\/\*[\s\S]*?\*\/)/g, J = /((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;
866
- function kt(e) {
867
- if (e == null)
868
- return [];
869
- const t = [];
870
- let r = e.replace(Rt, "");
871
- for (; ; ) {
872
- const a = J.exec(r);
873
- if (!a)
874
- break;
875
- t.push(a[0]);
876
- }
877
- r = r.replace(J, "");
878
- const n = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, s = new RegExp(
879
- // eslint-disable-next-line
880
- "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",
881
- "gi"
882
- );
883
- for (; ; ) {
884
- let a = n.exec(r);
885
- if (a)
886
- s.lastIndex = n.lastIndex;
887
- else if (a = s.exec(r), a)
888
- n.lastIndex = s.lastIndex;
889
- else
890
- break;
891
- t.push(a[0]);
892
- }
893
- return t;
894
- }
895
- const Ft = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, xt = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
896
- function K(e, t) {
897
- const { font: r } = t, n = r ? r?.preferredFormat : void 0;
898
- return n ? e.replace(xt, (s) => {
899
- for (; ; ) {
900
- const [a, , i] = Ft.exec(s) || [];
901
- if (!i)
902
- return "";
903
- if (i === n)
904
- return `src: ${a};`;
905
- }
906
- }) : e;
907
- }
908
- function M(e, t = []) {
909
- for (const r of Array.from(e))
910
- Ue(r) ? t.push(...M(r.cssRules)) : "cssRules" in r ? M(r.cssRules, t) : t.push(r);
911
- return t;
912
- }
913
- async function Pt(e, t) {
914
- const r = await C(e, t);
915
- if (E(r.node) && F(r.node))
916
- return r.node;
917
- const {
918
- ownerDocument: n,
919
- log: s,
920
- tasks: a,
921
- svgStyleElement: i,
922
- svgDefsElement: o,
923
- svgStyles: u,
924
- font: c,
925
- progress: l,
926
- autoDestruct: f,
927
- onCloneNode: g,
928
- onEmbedNode: m,
929
- onCreateForeignObjectSvg: p
930
- } = r;
931
- s.time("clone node");
932
- const d = await q(r.node, r, !0);
933
- if (i && n) {
934
- let S = "";
935
- u.forEach((N, v) => {
936
- S += `${N.join(`,
937
- `)} {
938
- ${v}
939
- }
940
- `;
941
- }), i.appendChild(n.createTextNode(S));
942
- }
943
- s.timeEnd("clone node"), await g?.(d), c !== !1 && E(d) && (s.time("embed web font"), await It(d, r), s.timeEnd("embed web font")), s.time("embed node"), Ee(d, r);
944
- const w = a.length;
945
- let h = 0;
946
- const b = async () => {
947
- for (; ; ) {
948
- const S = a.pop();
949
- if (!S)
950
- break;
951
- try {
952
- await S;
953
- } catch (N) {
954
- r.log.warn("Failed to run task", N);
955
- }
956
- l?.(++h, w);
957
- }
958
- };
959
- l?.(h, w), await Promise.all([...Array.from({ length: 4 })].map(b)), s.timeEnd("embed node"), await m?.(d);
960
- const y = Ut(d, r);
961
- return o && y.insertBefore(o, y.children[0]), i && y.insertBefore(i, y.children[0]), f && St(r), await p?.(y), y;
962
- }
963
- function Ut(e, t) {
964
- const { width: r, height: n } = t, s = ce(r, n, e.ownerDocument), a = s.ownerDocument.createElementNS(s.namespaceURI, "foreignObject");
965
- return a.setAttributeNS(null, "x", "0%"), a.setAttributeNS(null, "y", "0%"), a.setAttributeNS(null, "width", "100%"), a.setAttributeNS(null, "height", "100%"), a.append(e), s.appendChild(a), s;
966
- }
967
- async function V(e, t) {
968
- const r = await C(e, t), n = await Pt(r), s = ue(n, r.isEnable("removeControlCharacter"));
969
- r.autoDestruct || (r.svgStyleElement = me(r.ownerDocument), r.svgDefsElement = r.ownerDocument?.createElementNS(B, "defs"), r.svgStyles.clear());
970
- const a = A(s, n.ownerDocument);
971
- return await nt(a, r);
972
- }
973
- async function $t(e, t) {
974
- const r = await C(e, t), { log: n, type: s, quality: a, dpi: i } = r, o = await V(r);
975
- n.time("canvas to blob");
976
- const u = await Ge(o, s, a);
977
- if (["image/png", "image/jpeg"].includes(s) && i) {
978
- const c = await Ke(u.slice(0, 33));
979
- let l = new Uint8Array(c);
980
- return s === "image/png" ? l = ne(l, i) : s === "image/jpeg" && (l = Q(l, i)), n.timeEnd("canvas to blob"), new Blob([l, u.slice(33)], { type: s });
981
- }
982
- return n.timeEnd("canvas to blob"), u;
983
- }
984
- async function x(e, t) {
985
- const r = await C(e, t), { log: n, quality: s, type: a, dpi: i } = r, o = await V(r);
986
- n.time("canvas to data url");
987
- let u = o.toDataURL(a, s);
988
- if (["image/png", "image/jpeg"].includes(a) && i && ae && ke) {
989
- const [c, l] = u.split(",");
990
- let f = 0, g = !1;
991
- if (a === "image/png") {
992
- const y = Ie(l);
993
- y >= 0 ? (f = Math.ceil((y + 28) / 3) * 4, g = !0) : f = 33 / 3 * 4;
994
- } else a === "image/jpeg" && (f = 18 / 3 * 4);
995
- const m = l.substring(0, f), p = l.substring(f), d = window.atob(m), w = new Uint8Array(d.length);
996
- for (let y = 0; y < w.length; y++)
997
- w[y] = d.charCodeAt(y);
998
- const h = a === "image/png" ? ne(w, i, g) : Q(w, i), b = window.btoa(String.fromCharCode(...h));
999
- u = [c, ",", b, p].join("");
1000
- }
1001
- return n.timeEnd("canvas to data url"), u;
1002
- }
1003
- async function _t(e, t) {
1004
- const r = await C(e, t), { width: n, height: s, ownerDocument: a } = r, i = await x(r), o = ce(n, s, a), u = o.ownerDocument.createElementNS(o.namespaceURI, "image");
1005
- return u.setAttributeNS(null, "href", i), u.setAttributeNS(null, "height", "100%"), u.setAttributeNS(null, "width", "100%"), o.appendChild(u), ue(o, r.isEnable("removeControlCharacter"));
1006
- }
1007
- async function Bt(e, t) {
1008
- const r = await C(e, t), { ownerDocument: n, width: s, height: a, scale: i, type: o } = r, u = o === "image/svg+xml" ? await _t(r) : await x(r), c = A(u, n);
1009
- return c.width = Math.floor(s * i), c.height = Math.floor(a * i), c.style.width = `${s}px`, c.style.height = `${a}px`, c;
1010
- }
1011
- async function Lt(e, t) {
1012
- return x(
1013
- await C(e, { ...t, type: "image/jpeg" })
1014
- );
1015
- }
1016
- async function Ot(e, t) {
1017
- const r = await C(e, t), n = await V(r);
1018
- return n.getContext("2d").getImageData(0, 0, n.width, n.height).data;
1019
- }
1020
- async function Mt(e, t) {
1021
- return x(
1022
- await C(e, { ...t, type: "image/png" })
1023
- );
1024
- }
1025
- async function Wt(e, t) {
1026
- return x(
1027
- await C(e, { ...t, type: "image/webp" })
1028
- );
1029
- }
1030
- export {
1031
- tt as createContext,
1032
- St as destroyContext,
1033
- $t as domToBlob,
1034
- V as domToCanvas,
1035
- x as domToDataUrl,
1036
- Pt as domToForeignObjectSvg,
1037
- Bt as domToImage,
1038
- Lt as domToJpeg,
1039
- Ot as domToPixel,
1040
- Mt as domToPng,
1041
- _t as domToSvg,
1042
- Wt as domToWebp,
1043
- R as loadMedia,
1044
- Qe as waitUntilLoad
1045
- };
1046
- //# sourceMappingURL=index-_2PSgbkC.js.map