castled-js-sdk 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (660) hide show
  1. package/.env.example +8 -0
  2. package/.eslintignore +15 -0
  3. package/.eslintrc.json +41 -0
  4. package/.github/ISSUE_TEMPLATE/bug_report.md +50 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
  6. package/.github/pull_request_template.md +22 -0
  7. package/.github/workflows/build-and-quality-checks.yml +50 -0
  8. package/.github/workflows/deploy-beta.yml +55 -0
  9. package/.github/workflows/deploy-cdn.yml +113 -0
  10. package/.github/workflows/deploy-npm.yml +80 -0
  11. package/.github/workflows/deploy-sanity-suite.yml +46 -0
  12. package/.github/workflows/test.yml +39 -0
  13. package/.husky/commit-msg +4 -0
  14. package/.husky/pre-commit +4 -0
  15. package/.nvmrc +1 -0
  16. package/.prettierignore +10 -0
  17. package/.prettierrc +7 -0
  18. package/.size-limit.js +30 -0
  19. package/.versionrc +12 -0
  20. package/LICENSE +67 -0
  21. package/README.md +102 -22
  22. package/__mocks__/BraveBrowser.js +9 -0
  23. package/__mocks__/fixtures.js +130 -0
  24. package/__mocks__/msw.handlers.js +34 -0
  25. package/__mocks__/msw.server.js +6 -0
  26. package/__tests__/camelcase.test.js +29 -0
  27. package/__tests__/data-residency.test.js +238 -0
  28. package/__tests__/features/core/metrics/errorReporting/ErrorReportingService.test.js +80 -0
  29. package/__tests__/integrations/BingAds/__mocks__/data.js +17 -0
  30. package/__tests__/integrations/BingAds/browser.test.js +148 -0
  31. package/__tests__/integrations/BingAds/utils.test.js +138 -0
  32. package/__tests__/integrations/Braze/Braze.test.js +462 -0
  33. package/__tests__/integrations/FacebookPixel/FacebookPixel.test.js +347 -0
  34. package/__tests__/integrations/FacebookPixel/utils.test.js +688 -0
  35. package/__tests__/integrations/Fullstory/fullstory.test.js +147 -0
  36. package/__tests__/integrations/GA4/__mocks__/data.js +1480 -0
  37. package/__tests__/integrations/GA4/browser.test.js +94 -0
  38. package/__tests__/integrations/GA4/utils.test.js +337 -0
  39. package/__tests__/integrations/GoogleAds/__mocks__/data.js +235 -0
  40. package/__tests__/integrations/GoogleAds/browser.test.js +202 -0
  41. package/__tests__/integrations/GoogleAds/utils.test.js +110 -0
  42. package/__tests__/integrations/LaunchDarkly/__mocks__/data.js +61 -0
  43. package/__tests__/integrations/LaunchDarkly/browser.test.js +148 -0
  44. package/__tests__/integrations/LaunchDarkly/utils.test.js +36 -0
  45. package/__tests__/integrations/Lemnisk/lemnisk.test.js +156 -0
  46. package/__tests__/integrations/Mixpanel/browser.test.js +60 -0
  47. package/__tests__/integrations/PinterestTag/__mocks__/data.js +24 -0
  48. package/__tests__/integrations/PinterestTag/utils.test.js +19 -0
  49. package/__tests__/integrations/TikTokAds/tiktokads.test.js +231 -0
  50. package/__tests__/ketchConsent.test.js +49 -0
  51. package/__tests__/oneTrustCookieConsent.test.js +89 -0
  52. package/__tests__/script.test.js +167 -0
  53. package/__tests__/service-worker/__mocks__/fixtures.js +79 -0
  54. package/__tests__/service-worker/__mocks__/msw.server.js +12 -0
  55. package/__tests__/service-worker/index.test.js +109 -0
  56. package/__tests__/transformationHandler.test.js +169 -0
  57. package/__tests__/utils/IntegrationsData.test.js +105 -0
  58. package/__tests__/utils/ObjectUtils.test.js +227 -0
  59. package/__tests__/utils/cdnPaths.test.js +63 -0
  60. package/__tests__/utils/clientHint.test.js +87 -0
  61. package/__tests__/utils/commonUtils.test.js +271 -0
  62. package/__tests__/utils/errorHandler.test.js +60 -0
  63. package/__tests__/utils/eventProcessorUtils.test.js +266 -0
  64. package/__tests__/utils/navigator.test.js +38 -0
  65. package/__tests__/utils/preProcessQueue.test.js +78 -0
  66. package/__tests__/utils/screenDetails.test.js +19 -0
  67. package/__tests__/utils/utils.test.js +348 -0
  68. package/assets/integrations/AdobeAnalytics/adobe-analytics-heartbeat.js +12384 -0
  69. package/assets/integrations/AdobeAnalytics/adobe-analytics-js.js +5046 -0
  70. package/babel.config.json +34 -0
  71. package/commitlint.config.js +3 -0
  72. package/examples/SampleEventsTest.Html +133 -0
  73. package/examples/TC/TC_001.js +4 -0
  74. package/examples/TC/TC_002.js +4 -0
  75. package/examples/TC/TC_003.js +4 -0
  76. package/examples/TC/TC_004.js +4 -0
  77. package/examples/TC/TC_005.js +4 -0
  78. package/examples/chrome-extension/USAGE.md +131 -0
  79. package/examples/chrome-extension/background-script/LICENSE +21 -0
  80. package/examples/chrome-extension/background-script/README.md +101 -0
  81. package/examples/chrome-extension/background-script/foreground.js +7 -0
  82. package/examples/chrome-extension/background-script/logo/logo-128.png +0 -0
  83. package/examples/chrome-extension/background-script/logo/logo-16.png +0 -0
  84. package/examples/chrome-extension/background-script/logo/logo-48.png +0 -0
  85. package/examples/chrome-extension/background-script/logo/logo.svg +138 -0
  86. package/examples/chrome-extension/background-script/manifest.json +37 -0
  87. package/examples/chrome-extension/background-script/popup/popup.css +11 -0
  88. package/examples/chrome-extension/background-script/popup/popup.html +11 -0
  89. package/examples/chrome-extension/background-script/rudderAnalytics.js +5345 -0
  90. package/examples/chrome-extension/background-script/service-worker.js +32 -0
  91. package/examples/chrome-extension/background-script/settings/settings.css +8 -0
  92. package/examples/chrome-extension/background-script/settings/settings.html +12 -0
  93. package/examples/chrome-extension/background-script-websockets/LICENSE +21 -0
  94. package/examples/chrome-extension/background-script-websockets/README.md +101 -0
  95. package/examples/chrome-extension/background-script-websockets/foreground.js +7 -0
  96. package/examples/chrome-extension/background-script-websockets/logo/logo-128.png +0 -0
  97. package/examples/chrome-extension/background-script-websockets/logo/logo-16.png +0 -0
  98. package/examples/chrome-extension/background-script-websockets/logo/logo-48.png +0 -0
  99. package/examples/chrome-extension/background-script-websockets/logo/logo.svg +138 -0
  100. package/examples/chrome-extension/background-script-websockets/manifest.json +37 -0
  101. package/examples/chrome-extension/background-script-websockets/popup/popup.css +11 -0
  102. package/examples/chrome-extension/background-script-websockets/popup/popup.html +11 -0
  103. package/{service-worker/index.es.js → examples/chrome-extension/background-script-websockets/rudderAnalytics.js} +1283 -1274
  104. package/examples/chrome-extension/background-script-websockets/service-worker.js +60 -0
  105. package/examples/chrome-extension/background-script-websockets/settings/settings.css +8 -0
  106. package/examples/chrome-extension/background-script-websockets/settings/settings.html +12 -0
  107. package/examples/chrome-extension/content-script/LICENSE +21 -0
  108. package/examples/chrome-extension/content-script/README.md +101 -0
  109. package/examples/chrome-extension/content-script/foreground.js +65 -0
  110. package/examples/chrome-extension/content-script/logo/logo-128.png +0 -0
  111. package/examples/chrome-extension/content-script/logo/logo-16.png +0 -0
  112. package/examples/chrome-extension/content-script/logo/logo-48.png +0 -0
  113. package/examples/chrome-extension/content-script/logo/logo.svg +138 -0
  114. package/examples/chrome-extension/content-script/manifest.json +39 -0
  115. package/examples/chrome-extension/content-script/popup/popup.css +11 -0
  116. package/examples/chrome-extension/content-script/popup/popup.html +11 -0
  117. package/examples/chrome-extension/content-script/service-worker-utils.js +17 -0
  118. package/examples/chrome-extension/content-script/service-worker.js +12 -0
  119. package/examples/chrome-extension/content-script/settings/settings.css +8 -0
  120. package/examples/chrome-extension/content-script/settings/settings.html +12 -0
  121. package/examples/chrome-extension/websocket-server/server.mjs +19 -0
  122. package/examples/html/autotrack-test.html +96 -0
  123. package/examples/html/ecomm_test.html +358 -0
  124. package/examples/html/script-test.html +968 -0
  125. package/examples/html/segment.html +177 -0
  126. package/examples/html/test_poster.jpg +0 -0
  127. package/examples/umd/index.js +11 -0
  128. package/examples/umd/package.json +42 -0
  129. package/examples/umd/rollup.config.js +36 -0
  130. package/examples/umd/tests/test.html +5 -0
  131. package/examples/v1.1/tc1.html +139 -0
  132. package/examples/v1.1/tc2.1.html +140 -0
  133. package/examples/v1.1/tc2.2.html +139 -0
  134. package/examples/v1.1/tc2.3.html +143 -0
  135. package/examples/v1.1/tc3.1.html +139 -0
  136. package/examples/v1.1/tc3.2.html +142 -0
  137. package/examples/v1.1/tc3.3.html +142 -0
  138. package/examples/v1.1/tc3.4.html +144 -0
  139. package/examples/v1.1/tc3.5.html +142 -0
  140. package/examples/v1.1/tc4.html +142 -0
  141. package/examples/v1.1/tc5.html +150 -0
  142. package/github-release.config.js +5 -0
  143. package/jest/jest.global-setup.js +3 -0
  144. package/jest/jest.polyfills.js +10 -0
  145. package/jest/jest.setup-dom.js +49 -0
  146. package/jest.config.js +196 -0
  147. package/package.json +198 -39
  148. package/packages/npm/README.md +125 -0
  149. package/packages/npm/package.json +50 -0
  150. package/patches/@segment+localstorage-retry+1.3.0.patch +73 -0
  151. package/patches/@segment+top-domain+3.0.1.patch +34 -0
  152. package/public/index.html +136 -0
  153. package/public/list_integration_sdks.html +390 -0
  154. package/rollup-configs/rollup.integrations.config.js +29 -0
  155. package/rollup-configs/rollup.sdk.browser.js +32 -0
  156. package/rollup-configs/rollup.sdk.npm.js +43 -0
  157. package/rollup-configs/rollup.utilities.js +120 -0
  158. package/rollup-configs/rollup.worker.config.js +37 -0
  159. package/sanity-suite/.babelrc +33 -0
  160. package/sanity-suite/.env.example +6 -0
  161. package/sanity-suite/__mocks__/alias1.json +137 -0
  162. package/sanity-suite/__mocks__/alias2.json +97 -0
  163. package/sanity-suite/__mocks__/alias5.json +103 -0
  164. package/sanity-suite/__mocks__/alias6.json +137 -0
  165. package/sanity-suite/__mocks__/group1.json +120 -0
  166. package/sanity-suite/__mocks__/group2.json +86 -0
  167. package/sanity-suite/__mocks__/group4.json +101 -0
  168. package/sanity-suite/__mocks__/group5.json +67 -0
  169. package/sanity-suite/__mocks__/group6.json +66 -0
  170. package/sanity-suite/__mocks__/identify1.json +136 -0
  171. package/sanity-suite/__mocks__/identify2.json +102 -0
  172. package/sanity-suite/__mocks__/identify3.json +99 -0
  173. package/sanity-suite/__mocks__/identify4.json +65 -0
  174. package/sanity-suite/__mocks__/identify5.json +102 -0
  175. package/sanity-suite/__mocks__/identify6.json +103 -0
  176. package/sanity-suite/__mocks__/identify7.json +102 -0
  177. package/sanity-suite/__mocks__/identify8.json +103 -0
  178. package/sanity-suite/__mocks__/page1.json +119 -0
  179. package/sanity-suite/__mocks__/page2.json +86 -0
  180. package/sanity-suite/__mocks__/page4.json +112 -0
  181. package/sanity-suite/__mocks__/page5.json +79 -0
  182. package/sanity-suite/__mocks__/page6.json +77 -0
  183. package/sanity-suite/__mocks__/page7.json +77 -0
  184. package/sanity-suite/__mocks__/page8.json +75 -0
  185. package/sanity-suite/__mocks__/page9.json +155 -0
  186. package/sanity-suite/__mocks__/sourceConfig1.json +988 -0
  187. package/sanity-suite/__mocks__/track1.json +150 -0
  188. package/sanity-suite/__mocks__/track2.json +118 -0
  189. package/sanity-suite/__mocks__/track4.json +134 -0
  190. package/sanity-suite/__mocks__/track5.json +102 -0
  191. package/sanity-suite/__mocks__/track6.json +81 -0
  192. package/sanity-suite/__mocks__/track7.json +81 -0
  193. package/sanity-suite/package-lock.json +7951 -0
  194. package/sanity-suite/package.json +67 -0
  195. package/sanity-suite/public/eventFiltering/index-cdn.html +112 -0
  196. package/sanity-suite/public/eventFiltering/index-local.html +109 -0
  197. package/sanity-suite/public/eventFiltering/index-npm.html +92 -0
  198. package/sanity-suite/public/index-cdn.html +112 -0
  199. package/sanity-suite/public/index-local.html +109 -0
  200. package/sanity-suite/public/index-npm.html +92 -0
  201. package/sanity-suite/public/preloadBuffer/index-cdn.html +112 -0
  202. package/sanity-suite/public/preloadBuffer/index-local.html +109 -0
  203. package/sanity-suite/public/preloadBuffer/index-npm.html +92 -0
  204. package/sanity-suite/rollup.config.js +199 -0
  205. package/sanity-suite/src/index-npm.js +65 -0
  206. package/sanity-suite/src/index.js +5 -0
  207. package/sanity-suite/src/testBook/ResultAssertions.js +51 -0
  208. package/sanity-suite/src/testBook/TestBook.js +345 -0
  209. package/sanity-suite/src/testBook/ignoredProperties.js +150 -0
  210. package/sanity-suite/src/testBook/index.js +11 -0
  211. package/sanity-suite/src/testBookSuites/alias.js +287 -0
  212. package/sanity-suite/src/testBookSuites/group.js +240 -0
  213. package/sanity-suite/src/testBookSuites/identify.js +455 -0
  214. package/sanity-suite/src/testBookSuites/index.js +31 -0
  215. package/sanity-suite/src/testBookSuites/page.js +258 -0
  216. package/sanity-suite/src/testBookSuites/sourceConfig.js +84 -0
  217. package/sanity-suite/src/testBookSuites/track.js +451 -0
  218. package/scripts/integrationBuildScript.js +77 -0
  219. package/scripts/run_tests.sh +6 -0
  220. package/src/core/analytics.js +1668 -0
  221. package/src/features/core/cookieConsent/CookieConsentFactory.js +32 -0
  222. package/src/features/core/cookieConsent/OneTrust/browser.js +102 -0
  223. package/src/features/core/cookieConsent/OneTrust/index.js +3 -0
  224. package/src/features/core/cookieConsent/ketch/browser.js +114 -0
  225. package/src/features/core/cookieConsent/ketch/index.js +1 -0
  226. package/src/features/core/deviceModeTransformation/transformationHandler.js +189 -0
  227. package/src/features/core/deviceModeTransformation/util.js +23 -0
  228. package/src/features/core/metrics/errorReporting/ErrorReportingService.js +116 -0
  229. package/src/features/core/metrics/errorReporting/providers/Bugsnag.js +240 -0
  230. package/src/features/core/session/index.js +207 -0
  231. package/src/integrations/ActiveCampaign/browser.js +52 -0
  232. package/src/integrations/ActiveCampaign/constants.js +14 -0
  233. package/src/integrations/ActiveCampaign/index.js +3 -0
  234. package/src/integrations/ActiveCampaign/nativeSdkLoader.js +24 -0
  235. package/src/integrations/AdobeAnalytics/browser.js +276 -0
  236. package/src/integrations/AdobeAnalytics/constants.js +14 -0
  237. package/src/integrations/AdobeAnalytics/eCommHandle.js +56 -0
  238. package/src/integrations/AdobeAnalytics/heartbeatHandle.js +266 -0
  239. package/src/integrations/AdobeAnalytics/index.js +1 -0
  240. package/src/integrations/AdobeAnalytics/util.js +678 -0
  241. package/src/integrations/Adroll/browser.js +125 -0
  242. package/src/integrations/Adroll/constants.js +10 -0
  243. package/src/integrations/Adroll/index.js +1 -0
  244. package/src/integrations/Adroll/util.js +48 -0
  245. package/src/integrations/Amplitude/browser.js +352 -0
  246. package/src/integrations/Amplitude/constants.js +9 -0
  247. package/src/integrations/Amplitude/index.js +1 -0
  248. package/src/integrations/Amplitude/nativeSdkLoader.js +112 -0
  249. package/src/integrations/Amplitude/test/test_amplitude.html +157 -0
  250. package/src/integrations/Amplitude/utils.js +25 -0
  251. package/src/integrations/Appcues/browser.js +79 -0
  252. package/src/integrations/Appcues/constants.js +9 -0
  253. package/src/integrations/Appcues/index.js +1 -0
  254. package/src/integrations/Axeptio/browser.js +61 -0
  255. package/src/integrations/Axeptio/constants.js +8 -0
  256. package/src/integrations/Axeptio/index.js +1 -0
  257. package/src/integrations/Axeptio/nativeSdkLoader.js +14 -0
  258. package/src/integrations/Axeptio/utils.js +16 -0
  259. package/src/integrations/BingAds/browser.js +79 -0
  260. package/src/integrations/BingAds/constants.js +12 -0
  261. package/src/integrations/BingAds/index.js +1 -0
  262. package/src/integrations/BingAds/nativeSdkLoader.js +30 -0
  263. package/src/integrations/BingAds/utils.js +101 -0
  264. package/src/integrations/Braze/browser.js +284 -0
  265. package/src/integrations/Braze/constants.js +11 -0
  266. package/src/integrations/Braze/index.js +1 -0
  267. package/src/integrations/Braze/nativeSdkLoader.js +35 -0
  268. package/src/integrations/Braze/utils.js +51 -0
  269. package/src/integrations/Bugsnag/browser.js +60 -0
  270. package/src/integrations/Bugsnag/constants.js +8 -0
  271. package/src/integrations/Bugsnag/index.js +1 -0
  272. package/src/integrations/Chartbeat/browser.js +148 -0
  273. package/src/integrations/Chartbeat/constants.js +10 -0
  274. package/src/integrations/Chartbeat/index.js +1 -0
  275. package/src/integrations/Chartbeat/nativeSdkLoader.js +7 -0
  276. package/src/integrations/Clevertap/browser.js +206 -0
  277. package/src/integrations/Clevertap/constants.js +8 -0
  278. package/src/integrations/Clevertap/index.js +1 -0
  279. package/src/integrations/Comscore/browser.js +130 -0
  280. package/src/integrations/Comscore/constants.js +11 -0
  281. package/src/integrations/Comscore/index.js +1 -0
  282. package/src/integrations/Comscore/nativeSdkLoader.js +10 -0
  283. package/src/integrations/ConvertFlow/browser.js +59 -0
  284. package/src/integrations/ConvertFlow/constants.js +15 -0
  285. package/src/integrations/ConvertFlow/index.js +1 -0
  286. package/src/integrations/ConvertFlow/utils.js +107 -0
  287. package/src/integrations/Criteo/browser.js +155 -0
  288. package/src/integrations/Criteo/constants.js +11 -0
  289. package/src/integrations/Criteo/index.js +1 -0
  290. package/src/integrations/Criteo/utils.js +343 -0
  291. package/src/integrations/CustomerIO/browser.js +74 -0
  292. package/src/integrations/CustomerIO/constants.js +10 -0
  293. package/src/integrations/CustomerIO/index.js +1 -0
  294. package/src/integrations/CustomerIO/nativeSdkLoader.js +31 -0
  295. package/src/integrations/DCMFloodlight/browser.js +240 -0
  296. package/src/integrations/DCMFloodlight/constants.js +15 -0
  297. package/src/integrations/DCMFloodlight/index.js +1 -0
  298. package/src/integrations/DCMFloodlight/utils.js +336 -0
  299. package/src/integrations/Drip/browser.js +169 -0
  300. package/src/integrations/Drip/constants.js +8 -0
  301. package/src/integrations/Drip/index.js +1 -0
  302. package/src/integrations/Drip/nativeSdkLoader.js +10 -0
  303. package/src/integrations/Drip/utils.js +29 -0
  304. package/src/integrations/Engage/browser.js +124 -0
  305. package/src/integrations/Engage/constants.js +16 -0
  306. package/src/integrations/Engage/index.js +1 -0
  307. package/src/integrations/Engage/nativeSdkLoader.js +25 -0
  308. package/src/integrations/Engage/utils.js +69 -0
  309. package/src/integrations/FacebookPixel/browser.js +313 -0
  310. package/src/integrations/FacebookPixel/constants.js +77 -0
  311. package/src/integrations/FacebookPixel/index.js +1 -0
  312. package/src/integrations/FacebookPixel/utils.js +310 -0
  313. package/src/integrations/Fullstory/browser.js +169 -0
  314. package/src/integrations/Fullstory/constants.js +13 -0
  315. package/src/integrations/Fullstory/index.js +1 -0
  316. package/src/integrations/Fullstory/nativeSdkLoader.js +69 -0
  317. package/src/integrations/GA/browser.js +816 -0
  318. package/src/integrations/GA/constants.js +10 -0
  319. package/src/integrations/GA/index.js +1 -0
  320. package/src/integrations/GA/index.test.js +184 -0
  321. package/src/integrations/GA360/browser.js +58 -0
  322. package/src/integrations/GA360/constants.js +14 -0
  323. package/src/integrations/GA360/index.js +1 -0
  324. package/src/integrations/GA4/browser.js +264 -0
  325. package/src/integrations/GA4/config.js +296 -0
  326. package/src/integrations/GA4/constants.js +15 -0
  327. package/src/integrations/GA4/index.js +1 -0
  328. package/src/integrations/GA4/utils.js +329 -0
  329. package/src/integrations/GoogleAds/browser.js +212 -0
  330. package/src/integrations/GoogleAds/constants.js +11 -0
  331. package/src/integrations/GoogleAds/index.js +1 -0
  332. package/src/integrations/GoogleAds/nativeSdkLoader.js +26 -0
  333. package/src/integrations/GoogleAds/utils.js +117 -0
  334. package/src/integrations/GoogleOptimize/browser.js +79 -0
  335. package/src/integrations/GoogleOptimize/constants.js +13 -0
  336. package/src/integrations/GoogleOptimize/index.js +1 -0
  337. package/src/integrations/GoogleTagManager/browser.js +95 -0
  338. package/src/integrations/GoogleTagManager/constants.js +10 -0
  339. package/src/integrations/GoogleTagManager/index.js +1 -0
  340. package/src/integrations/GoogleTagManager/nativeSdkLoader.js +21 -0
  341. package/src/integrations/Heap/browser.js +67 -0
  342. package/src/integrations/Heap/constants.js +9 -0
  343. package/src/integrations/Heap/index.js +1 -0
  344. package/src/integrations/Heap/nativeSdkLoader.js +40 -0
  345. package/src/integrations/Heap/util.js +23 -0
  346. package/src/integrations/Hotjar/browser.js +86 -0
  347. package/src/integrations/Hotjar/constants.js +10 -0
  348. package/src/integrations/Hotjar/index.js +1 -0
  349. package/src/integrations/Hotjar/nativeSdkLoader.js +21 -0
  350. package/src/integrations/HubSpot/browser.js +96 -0
  351. package/src/integrations/HubSpot/constants.js +11 -0
  352. package/src/integrations/HubSpot/index.js +1 -0
  353. package/src/integrations/INTERCOM/browser.js +107 -0
  354. package/src/integrations/INTERCOM/constants.js +8 -0
  355. package/src/integrations/INTERCOM/index.js +1 -0
  356. package/src/integrations/INTERCOM/nativeSdkLoader.js +46 -0
  357. package/src/integrations/INTERCOM/utils.js +68 -0
  358. package/src/integrations/Iterable/browser.js +185 -0
  359. package/src/integrations/Iterable/constants.js +8 -0
  360. package/src/integrations/Iterable/index.js +1 -0
  361. package/src/integrations/Iterable/utils.js +111 -0
  362. package/src/integrations/June/browser.js +98 -0
  363. package/src/integrations/June/constants.js +8 -0
  364. package/src/integrations/June/index.js +1 -0
  365. package/src/integrations/Keen/browser.js +153 -0
  366. package/src/integrations/Keen/constants.js +10 -0
  367. package/src/integrations/Keen/index.js +1 -0
  368. package/src/integrations/Kissmetrics/browser.js +254 -0
  369. package/src/integrations/Kissmetrics/constants.js +8 -0
  370. package/src/integrations/Kissmetrics/index.js +1 -0
  371. package/src/integrations/Kissmetrics/nativeSdkLoader.js +23 -0
  372. package/src/integrations/Klaviyo/browser.js +195 -0
  373. package/src/integrations/Klaviyo/constants.js +8 -0
  374. package/src/integrations/Klaviyo/index.js +1 -0
  375. package/src/integrations/Klaviyo/util.js +91 -0
  376. package/src/integrations/LaunchDarkly/browser.js +74 -0
  377. package/src/integrations/LaunchDarkly/constants.js +11 -0
  378. package/src/integrations/LaunchDarkly/index.js +1 -0
  379. package/src/integrations/LaunchDarkly/utils.js +24 -0
  380. package/src/integrations/Lemnisk/browser.js +85 -0
  381. package/src/integrations/Lemnisk/constants.js +13 -0
  382. package/src/integrations/Lemnisk/index.js +1 -0
  383. package/src/integrations/Lemnisk/nativeSdkLoader.js +34 -0
  384. package/src/integrations/LinkedInInsightTag/browser.js +71 -0
  385. package/src/integrations/LinkedInInsightTag/constants.js +16 -0
  386. package/src/integrations/LinkedInInsightTag/index.js +1 -0
  387. package/src/integrations/LiveChat/browser.js +82 -0
  388. package/src/integrations/LiveChat/constants.js +12 -0
  389. package/src/integrations/LiveChat/index.js +1 -0
  390. package/src/integrations/LiveChat/nativeSdkLoader.js +40 -0
  391. package/src/integrations/LiveChat/util.js +71 -0
  392. package/src/integrations/Lotame/LotameStorage.js +21 -0
  393. package/src/integrations/Lotame/browser.js +172 -0
  394. package/src/integrations/Lotame/constants.js +8 -0
  395. package/src/integrations/Lotame/index.js +1 -0
  396. package/src/integrations/Lytics/browser.js +87 -0
  397. package/src/integrations/Lytics/constants.js +8 -0
  398. package/src/integrations/Lytics/index.js +1 -0
  399. package/src/integrations/Lytics/nativeSdkLoader.js +77 -0
  400. package/src/integrations/Lytics/test/script-test-lytics.html +250 -0
  401. package/src/integrations/Matomo/browser.js +188 -0
  402. package/src/integrations/Matomo/constants.js +8 -0
  403. package/src/integrations/Matomo/index.js +1 -0
  404. package/src/integrations/Matomo/nativeSdkLoader.js +20 -0
  405. package/src/integrations/Matomo/util.js +417 -0
  406. package/src/integrations/MicrosoftClarity/browser.js +70 -0
  407. package/src/integrations/MicrosoftClarity/constants.js +14 -0
  408. package/src/integrations/MicrosoftClarity/index.js +1 -0
  409. package/src/integrations/MicrosoftClarity/nativeSdkLoader.js +22 -0
  410. package/src/integrations/Mixpanel/browser.js +326 -0
  411. package/src/integrations/Mixpanel/constants.js +11 -0
  412. package/src/integrations/Mixpanel/index.js +1 -0
  413. package/src/integrations/Mixpanel/nativeSdkLoader.js +71 -0
  414. package/src/integrations/Mixpanel/util.js +178 -0
  415. package/src/integrations/MoEngage/browser.js +133 -0
  416. package/src/integrations/MoEngage/constants.js +12 -0
  417. package/src/integrations/MoEngage/index.js +1 -0
  418. package/src/integrations/MoEngage/nativeSdkLoader.js +66 -0
  419. package/src/integrations/MoEngage/test/script-test-moengage.html +216 -0
  420. package/src/integrations/Mouseflow/browser.js +98 -0
  421. package/src/integrations/Mouseflow/constants.js +14 -0
  422. package/src/integrations/Mouseflow/index.js +1 -0
  423. package/src/integrations/Mouseflow/utils.js +27 -0
  424. package/src/integrations/Olark/browser.js +94 -0
  425. package/src/integrations/Olark/constants.js +8 -0
  426. package/src/integrations/Olark/index.js +1 -0
  427. package/src/integrations/Olark/nativeSdkLoader.js +31 -0
  428. package/src/integrations/Olark/utils.js +51 -0
  429. package/src/integrations/Optimizely/browser.js +230 -0
  430. package/src/integrations/Optimizely/constants.js +8 -0
  431. package/src/integrations/Optimizely/index.js +1 -0
  432. package/src/integrations/Optimizely/utils.js +23 -0
  433. package/src/integrations/Pendo/browser.js +119 -0
  434. package/src/integrations/Pendo/constants.js +8 -0
  435. package/src/integrations/Pendo/index.js +1 -0
  436. package/src/integrations/Pendo/nativeSdkLoader.js +32 -0
  437. package/src/integrations/PinterestTag/browser.js +241 -0
  438. package/src/integrations/PinterestTag/constants.js +19 -0
  439. package/src/integrations/PinterestTag/index.js +1 -0
  440. package/src/integrations/PinterestTag/nativeSdkLoader.js +19 -0
  441. package/src/integrations/PinterestTag/propertyMappingConfig.js +57 -0
  442. package/src/integrations/PinterestTag/test/input.js +180 -0
  443. package/src/integrations/PinterestTag/test/output.js +129 -0
  444. package/src/integrations/PinterestTag/utils.js +47 -0
  445. package/src/integrations/Podsights/browser.js +178 -0
  446. package/src/integrations/Podsights/constants.js +206 -0
  447. package/src/integrations/Podsights/index.js +1 -0
  448. package/src/integrations/Podsights/utils.js +65 -0
  449. package/src/integrations/PostAffiliatePro/browser.js +133 -0
  450. package/src/integrations/PostAffiliatePro/constants.js +13 -0
  451. package/src/integrations/PostAffiliatePro/index.js +1 -0
  452. package/src/integrations/PostAffiliatePro/utils.js +40 -0
  453. package/src/integrations/Posthog/browser.js +154 -0
  454. package/src/integrations/Posthog/constants.js +12 -0
  455. package/src/integrations/Posthog/index.js +1 -0
  456. package/src/integrations/Posthog/nativeSdkLoader.js +48 -0
  457. package/src/integrations/Posthog/test/test_posthog.html +77 -0
  458. package/src/integrations/Posthog/utils.js +36 -0
  459. package/src/integrations/ProfitWell/browser.js +72 -0
  460. package/src/integrations/ProfitWell/constants.js +12 -0
  461. package/src/integrations/ProfitWell/index.js +1 -0
  462. package/src/integrations/ProfitWell/nativeSdkLoader.js +25 -0
  463. package/src/integrations/Qualaroo/browser.js +116 -0
  464. package/src/integrations/Qualaroo/constants.js +8 -0
  465. package/src/integrations/Qualaroo/index.js +1 -0
  466. package/src/integrations/Qualaroo/utils.js +83 -0
  467. package/src/integrations/Qualtrics/browser.js +89 -0
  468. package/src/integrations/Qualtrics/constants.js +8 -0
  469. package/src/integrations/Qualtrics/index.js +1 -0
  470. package/src/integrations/Qualtrics/nativeSdkLoader.js +79 -0
  471. package/src/integrations/QuantumMetric/browser.js +63 -0
  472. package/src/integrations/QuantumMetric/constants.js +13 -0
  473. package/src/integrations/QuantumMetric/index.js +1 -0
  474. package/src/integrations/QuoraPixel/browser.js +64 -0
  475. package/src/integrations/QuoraPixel/constants.js +15 -0
  476. package/src/integrations/QuoraPixel/index.js +1 -0
  477. package/src/integrations/QuoraPixel/nativeSdkLoader.js +21 -0
  478. package/src/integrations/RedditPixel/browser.js +98 -0
  479. package/src/integrations/RedditPixel/constants.js +13 -0
  480. package/src/integrations/RedditPixel/index.js +1 -0
  481. package/src/integrations/RedditPixel/nativeSdkLoader.js +21 -0
  482. package/src/integrations/Refiner/browser.js +119 -0
  483. package/src/integrations/Refiner/constants.js +8 -0
  484. package/src/integrations/Refiner/index.js +1 -0
  485. package/src/integrations/Refiner/nativeSdkLoader.js +20 -0
  486. package/src/integrations/Refiner/utils.js +44 -0
  487. package/src/integrations/Rockerbox/browser.js +89 -0
  488. package/src/integrations/Rockerbox/constants.js +12 -0
  489. package/src/integrations/Rockerbox/index.js +1 -0
  490. package/src/integrations/Rockerbox/nativeSdkLoader.js +32 -0
  491. package/src/integrations/RollBar/browser.js +92 -0
  492. package/src/integrations/RollBar/constants.js +13 -0
  493. package/src/integrations/RollBar/index.js +1 -0
  494. package/src/integrations/RollBar/nativeSdkLoader.js +383 -0
  495. package/src/integrations/Satismeter/browser.js +94 -0
  496. package/src/integrations/Satismeter/constants.js +9 -0
  497. package/src/integrations/Satismeter/index.js +1 -0
  498. package/src/integrations/Satismeter/nativeSdkLoader.js +23 -0
  499. package/src/integrations/Satismeter/util.js +54 -0
  500. package/src/integrations/Sendinblue/browser.js +111 -0
  501. package/src/integrations/Sendinblue/constants.js +25 -0
  502. package/src/integrations/Sendinblue/index.js +1 -0
  503. package/src/integrations/Sendinblue/nativeSdkLoader.js +36 -0
  504. package/src/integrations/Sendinblue/utils.js +112 -0
  505. package/src/integrations/Sentry/browser.js +118 -0
  506. package/src/integrations/Sentry/constants.js +8 -0
  507. package/src/integrations/Sentry/index.js +1 -0
  508. package/src/integrations/Sentry/utils.js +80 -0
  509. package/src/integrations/Shynet/browser.js +97 -0
  510. package/src/integrations/Shynet/constants.js +15 -0
  511. package/src/integrations/Shynet/index.js +1 -0
  512. package/src/integrations/SnapEngage/browser.js +75 -0
  513. package/src/integrations/SnapEngage/constants.js +12 -0
  514. package/src/integrations/SnapEngage/index.js +1 -0
  515. package/src/integrations/SnapEngage/nativeSdkLoader.js +24 -0
  516. package/src/integrations/SnapEngage/util.js +63 -0
  517. package/src/integrations/SnapPixel/browser.js +232 -0
  518. package/src/integrations/SnapPixel/constants.js +13 -0
  519. package/src/integrations/SnapPixel/index.js +1 -0
  520. package/src/integrations/SnapPixel/nativeSdkLoader.js +20 -0
  521. package/src/integrations/SnapPixel/util.js +211 -0
  522. package/src/integrations/TVSquared/browser.js +96 -0
  523. package/src/integrations/TVSquared/constants.js +14 -0
  524. package/src/integrations/TVSquared/index.js +1 -0
  525. package/src/integrations/TVSquared/utils.js +40 -0
  526. package/src/integrations/TiktokAds/browser.js +103 -0
  527. package/src/integrations/TiktokAds/constants.js +86 -0
  528. package/src/integrations/TiktokAds/index.js +1 -0
  529. package/src/integrations/TiktokAds/nativeSdkLoader.js +52 -0
  530. package/src/integrations/TiktokAds/util.js +71 -0
  531. package/src/integrations/VWO/browser.js +131 -0
  532. package/src/integrations/VWO/constants.js +13 -0
  533. package/src/integrations/VWO/index.js +1 -0
  534. package/src/integrations/VWO/nativeSdkLoader.js +64 -0
  535. package/src/integrations/Vero/browser.js +165 -0
  536. package/src/integrations/Vero/constants.js +8 -0
  537. package/src/integrations/Vero/index.js +1 -0
  538. package/src/integrations/Woopra/browser.js +83 -0
  539. package/src/integrations/Woopra/constants.js +8 -0
  540. package/src/integrations/Woopra/index.js +1 -0
  541. package/src/integrations/Woopra/nativeSdkLoader.js +43 -0
  542. package/src/integrations/YandexMetrica/browser.js +143 -0
  543. package/src/integrations/YandexMetrica/constants.js +10 -0
  544. package/src/integrations/YandexMetrica/index.js +1 -0
  545. package/src/integrations/YandexMetrica/nativeSdkLoader.js +35 -0
  546. package/src/integrations/YandexMetrica/utils.js +138 -0
  547. package/src/integrations/index.js +155 -0
  548. package/src/service-worker/index.js +466 -0
  549. package/src/utils/EventRepository.js +78 -0
  550. package/src/utils/HtElement.js +33 -0
  551. package/src/utils/HtElementBuilder.js +29 -0
  552. package/src/utils/IntegrationsData.js +61 -0
  553. package/src/utils/JSFileLoader.js +66 -0
  554. package/src/utils/ObjectUtils.js +68 -0
  555. package/src/utils/PreProcessQueue.js +66 -0
  556. package/src/utils/RudderApp.js +9 -0
  557. package/src/utils/RudderContext.js +21 -0
  558. package/src/utils/RudderInfo.js +41 -0
  559. package/src/utils/RudderMessage.js +28 -0
  560. package/src/utils/ScriptLoader.js +53 -0
  561. package/src/utils/beaconQueue.js +133 -0
  562. package/src/utils/camelcase.js +48 -0
  563. package/src/utils/cdnPaths.js +43 -0
  564. package/src/utils/clientHint.js +28 -0
  565. package/src/utils/client_server_name.js +78 -0
  566. package/src/utils/commonUtils.js +207 -0
  567. package/src/utils/config_to_integration_names.js +80 -0
  568. package/src/utils/constants.js +82 -0
  569. package/src/utils/errorHandler.js +88 -0
  570. package/src/utils/eventProcessorUtils.js +53 -0
  571. package/src/utils/integration_cname.js +156 -0
  572. package/src/utils/linker/base64decoder.js +31 -0
  573. package/src/utils/linker/crc32.js +42 -0
  574. package/src/utils/linker/index.js +134 -0
  575. package/src/utils/linker/userLib.js +20 -0
  576. package/src/utils/logUtil.js +51 -0
  577. package/src/utils/logger.js +106 -0
  578. package/src/utils/navigator.js +32 -0
  579. package/src/utils/notifyError.js +16 -0
  580. package/src/utils/pageProperties.js +74 -0
  581. package/src/utils/screenDetails.js +23 -0
  582. package/src/utils/storage/cookie.js +93 -0
  583. package/src/utils/storage/index.js +3 -0
  584. package/src/utils/storage/storage.js +459 -0
  585. package/src/utils/storage/store.js +72 -0
  586. package/src/utils/storage/v3DecryptionUtils.js +19 -0
  587. package/src/utils/utils.js +966 -0
  588. package/src/utils/xhrModule.js +111 -0
  589. package/stats/AdobeAnalytics.html +4044 -0
  590. package/stats/Adroll.html +4044 -0
  591. package/stats/Amplitude.html +4044 -0
  592. package/stats/Appcues.html +4044 -0
  593. package/stats/BingAds.html +4044 -0
  594. package/stats/Braze.html +4044 -0
  595. package/stats/Bugsnag.html +4044 -0
  596. package/stats/Chartbeat.html +4044 -0
  597. package/stats/Clevertap.html +4044 -0
  598. package/stats/Comscore.html +4044 -0
  599. package/stats/ConvertFlow.html +4044 -0
  600. package/stats/Criteo.html +4044 -0
  601. package/stats/CustomerIO.html +4044 -0
  602. package/stats/DCMFloodlight.html +4044 -0
  603. package/stats/Drip.html +4044 -0
  604. package/stats/Engage.html +4044 -0
  605. package/stats/FacebookPixel.html +4044 -0
  606. package/stats/Fullstory.html +4044 -0
  607. package/stats/GA.html +4044 -0
  608. package/stats/GA360.html +4044 -0
  609. package/stats/GA4.html +4044 -0
  610. package/stats/GoogleAds.html +4044 -0
  611. package/stats/GoogleOptimize.html +4044 -0
  612. package/stats/GoogleTagManager.html +4044 -0
  613. package/stats/Heap.html +4044 -0
  614. package/stats/Hotjar.html +4044 -0
  615. package/stats/HubSpot.html +4044 -0
  616. package/stats/INTERCOM.html +4044 -0
  617. package/stats/Iterable.html +4044 -0
  618. package/stats/June.html +4044 -0
  619. package/stats/Keen.html +4044 -0
  620. package/stats/Kissmetrics.html +4044 -0
  621. package/stats/Klaviyo.html +4044 -0
  622. package/stats/LaunchDarkly.html +4044 -0
  623. package/stats/LinkedInInsightTag.html +4044 -0
  624. package/stats/LiveChat.html +4044 -0
  625. package/stats/Lotame.html +4044 -0
  626. package/stats/Lytics.html +4044 -0
  627. package/stats/Matomo.html +4044 -0
  628. package/stats/Mixpanel.html +4044 -0
  629. package/stats/MoEngage.html +4044 -0
  630. package/stats/Mouseflow.html +4044 -0
  631. package/stats/Optimizely.html +4044 -0
  632. package/stats/Pendo.html +4044 -0
  633. package/stats/PinterestTag.html +4044 -0
  634. package/stats/Podsights.html +4044 -0
  635. package/stats/PostAffiliatePro.html +4044 -0
  636. package/stats/Posthog.html +4044 -0
  637. package/stats/ProfitWell.html +4044 -0
  638. package/stats/Qualaroo.html +4044 -0
  639. package/stats/Qualtrics.html +4044 -0
  640. package/stats/QuantumMetric.html +4044 -0
  641. package/stats/QuoraPixel.html +4044 -0
  642. package/stats/RedditPixel.html +4044 -0
  643. package/stats/Refiner.html +4044 -0
  644. package/stats/Rockerbox.html +4044 -0
  645. package/stats/RollBar.html +4044 -0
  646. package/stats/Sentry.html +4044 -0
  647. package/stats/Shynet.html +4044 -0
  648. package/stats/SnapEngage.html +4044 -0
  649. package/stats/SnapPixel.html +4044 -0
  650. package/stats/TVSquared.html +4044 -0
  651. package/stats/VWO.html +4044 -0
  652. package/stats/Vero.html +4044 -0
  653. package/stats/Woopra.html +4044 -0
  654. package/stats/YandexMetrica.html +4044 -0
  655. package/stats/rudder-analytics.html +4044 -0
  656. package/index.es.js +0 -1
  657. package/index.js +0 -1
  658. package/service-worker/index.js +0 -5346
  659. /package/{index.d.ts → packages/npm/index.d.ts} +0 -0
  660. /package/{service-worker → src/service-worker}/index.d.ts +0 -0
@@ -0,0 +1,4044 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />
8
+ <title>Rollup Visualizer - Vero</title>
9
+ <style>
10
+ :root {
11
+ --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
12
+ "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
13
+ --background-color: #2b2d42;
14
+ --text-color: #edf2f4;
15
+ }
16
+
17
+ html {
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ *,
22
+ *:before,
23
+ *:after {
24
+ box-sizing: inherit;
25
+ }
26
+
27
+ html {
28
+ background-color: var(--background-color);
29
+ color: var(--text-color);
30
+ font-family: var(--font-family);
31
+ }
32
+
33
+ body {
34
+ padding: 0;
35
+ margin: 0;
36
+ }
37
+
38
+ html,
39
+ body {
40
+ height: 100%;
41
+ width: 100%;
42
+ overflow: hidden;
43
+ }
44
+
45
+ body {
46
+ display: flex;
47
+ flex-direction: column;
48
+ }
49
+
50
+ svg {
51
+ vertical-align: middle;
52
+ width: 100%;
53
+ height: 100%;
54
+ max-height: 100vh;
55
+ }
56
+
57
+ main {
58
+ flex-grow: 1;
59
+ height: 100vh;
60
+ padding: 20px;
61
+ }
62
+
63
+ .tooltip {
64
+ position: absolute;
65
+ z-index: 1070;
66
+ border: 2px solid;
67
+ border-radius: 5px;
68
+ padding: 5px;
69
+ white-space: nowrap;
70
+ font-size: 0.875rem;
71
+ background-color: var(--background-color);
72
+ color: var(--text-color);
73
+ }
74
+
75
+ .tooltip-hidden {
76
+ visibility: hidden;
77
+ opacity: 0;
78
+ }
79
+
80
+ .sidebar {
81
+ position: fixed;
82
+ top: 0;
83
+ left: 0;
84
+ right: 0;
85
+ display: flex;
86
+ flex-direction: row;
87
+ font-size: 0.7rem;
88
+ align-items: center;
89
+ margin: 0 50px;
90
+ height: 20px;
91
+ }
92
+
93
+ .size-selectors {
94
+ display: flex;
95
+ flex-direction: row;
96
+ align-items: center;
97
+ }
98
+
99
+ .size-selector {
100
+ display: flex;
101
+ flex-direction: row;
102
+ align-items: center;
103
+ justify-content: center;
104
+ margin-right: 1rem;
105
+ }
106
+ .size-selector input {
107
+ margin: 0 0.3rem 0 0;
108
+ }
109
+
110
+ .filters {
111
+ flex: 1;
112
+ display: flex;
113
+ flex-direction: row;
114
+ align-items: center;
115
+ }
116
+
117
+ .module-filters {
118
+ display: flex;
119
+ }
120
+
121
+ .module-filter {
122
+ display: flex;
123
+ flex-direction: row;
124
+ align-items: center;
125
+ justify-content: center;
126
+ flex: 1;
127
+ }
128
+ .module-filter input {
129
+ flex: 1;
130
+ height: 1rem;
131
+ padding: 0.01rem;
132
+ font-size: 0.7rem;
133
+ margin-left: 0.3rem;
134
+ }
135
+ .module-filter + .module-filter {
136
+ margin-left: 0.5rem;
137
+ }
138
+ </style>
139
+ </head>
140
+ <body>
141
+ <main></main>
142
+ <script>
143
+ /*<!--*/
144
+ var drawChart = (function (exports) {
145
+ 'use strict';
146
+
147
+ var n,l$1,u$1,t$1,o$2,r$1,f$1={},e$1=[],c$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$1(n,l){for(var u in l)n[u]=l[u];return n}function a$1(n){var l=n.parentNode;l&&l.removeChild(n);}function h$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$1(l,f,t,o,null)}function v$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function p$1(n){return n.children}function d$1(n,l){this.props=n,this.context=l;}function _$2(n,l){if(null==l)return n.__?_$2(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$2(n):null}function k$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$1(n)}}function b$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!g$1.__r++||o$2!==l$1.debounceRendering)&&((o$2=l$1.debounceRendering)||setTimeout)(g$1);}function g$1(){for(var n;g$1.__r=t$1.length;)n=t$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$1({},t)).__v=t.__v+1,j$1(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$2(t):o,t.__h),z$1(u,t),t.__e!=o&&k$1(t)));});}function w$1(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$1,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(p$1,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$1(n,k,d=d||f$1,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$1(k,s,n):s=A$1(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$2(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h]);}function m$1(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$1(i,l,u):A$1(u,i,i,t,i.__e,l));return l}function A$1(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$1(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$1.test(l)?u:u+"px";}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$1(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d$1(g,x),h.constructor=T,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$1({},h.__s)),s$1(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$1.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s$1(s$1({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p$1&&null==a.key?a.props.children:a,w$1(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l$1.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),h=(y=i.props||f$1).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$1(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$1(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$2(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$1(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1));}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$1(n.__e),n.__=n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$1(i,u=(!o&&t||i).__k=h$1(p$1,null,[u]),r||f$1,f$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$1(e,u);}function B$2(n,l){var u={__c:l="__cC"+r$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b$1);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,d$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$1({},this.state),"function"==typeof n&&(n=n(s$1({},u),this.props)),n&&s$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$1(this));},d$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$1(this));},d$1.prototype.render=p$1,t$1=[],g$1.__r=0,r$1=0;
148
+
149
+ var _$1=0;function o$1(o,e,n,t,f){var l,s,u={};for(s in e)"ref"==s?l=e[s]:u[s]=e[s];var a={type:o,props:u,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--_$1,__source:f,__self:t};if("function"==typeof o&&(l=o.defaultProps))for(s in l)void 0===u[s]&&(u[s]=l[s]);return l$1.vnode&&l$1.vnode(a),a}
150
+
151
+ function count$1(node) {
152
+ var sum = 0,
153
+ children = node.children,
154
+ i = children && children.length;
155
+ if (!i) sum = 1;
156
+ else while (--i >= 0) sum += children[i].value;
157
+ node.value = sum;
158
+ }
159
+
160
+ function node_count() {
161
+ return this.eachAfter(count$1);
162
+ }
163
+
164
+ function node_each(callback, that) {
165
+ let index = -1;
166
+ for (const node of this) {
167
+ callback.call(that, node, ++index, this);
168
+ }
169
+ return this;
170
+ }
171
+
172
+ function node_eachBefore(callback, that) {
173
+ var node = this, nodes = [node], children, i, index = -1;
174
+ while (node = nodes.pop()) {
175
+ callback.call(that, node, ++index, this);
176
+ if (children = node.children) {
177
+ for (i = children.length - 1; i >= 0; --i) {
178
+ nodes.push(children[i]);
179
+ }
180
+ }
181
+ }
182
+ return this;
183
+ }
184
+
185
+ function node_eachAfter(callback, that) {
186
+ var node = this, nodes = [node], next = [], children, i, n, index = -1;
187
+ while (node = nodes.pop()) {
188
+ next.push(node);
189
+ if (children = node.children) {
190
+ for (i = 0, n = children.length; i < n; ++i) {
191
+ nodes.push(children[i]);
192
+ }
193
+ }
194
+ }
195
+ while (node = next.pop()) {
196
+ callback.call(that, node, ++index, this);
197
+ }
198
+ return this;
199
+ }
200
+
201
+ function node_find(callback, that) {
202
+ let index = -1;
203
+ for (const node of this) {
204
+ if (callback.call(that, node, ++index, this)) {
205
+ return node;
206
+ }
207
+ }
208
+ }
209
+
210
+ function node_sum(value) {
211
+ return this.eachAfter(function(node) {
212
+ var sum = +value(node.data) || 0,
213
+ children = node.children,
214
+ i = children && children.length;
215
+ while (--i >= 0) sum += children[i].value;
216
+ node.value = sum;
217
+ });
218
+ }
219
+
220
+ function node_sort(compare) {
221
+ return this.eachBefore(function(node) {
222
+ if (node.children) {
223
+ node.children.sort(compare);
224
+ }
225
+ });
226
+ }
227
+
228
+ function node_path(end) {
229
+ var start = this,
230
+ ancestor = leastCommonAncestor(start, end),
231
+ nodes = [start];
232
+ while (start !== ancestor) {
233
+ start = start.parent;
234
+ nodes.push(start);
235
+ }
236
+ var k = nodes.length;
237
+ while (end !== ancestor) {
238
+ nodes.splice(k, 0, end);
239
+ end = end.parent;
240
+ }
241
+ return nodes;
242
+ }
243
+
244
+ function leastCommonAncestor(a, b) {
245
+ if (a === b) return a;
246
+ var aNodes = a.ancestors(),
247
+ bNodes = b.ancestors(),
248
+ c = null;
249
+ a = aNodes.pop();
250
+ b = bNodes.pop();
251
+ while (a === b) {
252
+ c = a;
253
+ a = aNodes.pop();
254
+ b = bNodes.pop();
255
+ }
256
+ return c;
257
+ }
258
+
259
+ function node_ancestors() {
260
+ var node = this, nodes = [node];
261
+ while (node = node.parent) {
262
+ nodes.push(node);
263
+ }
264
+ return nodes;
265
+ }
266
+
267
+ function node_descendants() {
268
+ return Array.from(this);
269
+ }
270
+
271
+ function node_leaves() {
272
+ var leaves = [];
273
+ this.eachBefore(function(node) {
274
+ if (!node.children) {
275
+ leaves.push(node);
276
+ }
277
+ });
278
+ return leaves;
279
+ }
280
+
281
+ function node_links() {
282
+ var root = this, links = [];
283
+ root.each(function(node) {
284
+ if (node !== root) { // Don’t include the root’s parent, if any.
285
+ links.push({source: node.parent, target: node});
286
+ }
287
+ });
288
+ return links;
289
+ }
290
+
291
+ function* node_iterator() {
292
+ var node = this, current, next = [node], children, i, n;
293
+ do {
294
+ current = next.reverse(), next = [];
295
+ while (node = current.pop()) {
296
+ yield node;
297
+ if (children = node.children) {
298
+ for (i = 0, n = children.length; i < n; ++i) {
299
+ next.push(children[i]);
300
+ }
301
+ }
302
+ }
303
+ } while (next.length);
304
+ }
305
+
306
+ function hierarchy(data, children) {
307
+ if (data instanceof Map) {
308
+ data = [undefined, data];
309
+ if (children === undefined) children = mapChildren;
310
+ } else if (children === undefined) {
311
+ children = objectChildren;
312
+ }
313
+
314
+ var root = new Node$1(data),
315
+ node,
316
+ nodes = [root],
317
+ child,
318
+ childs,
319
+ i,
320
+ n;
321
+
322
+ while (node = nodes.pop()) {
323
+ if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
324
+ node.children = childs;
325
+ for (i = n - 1; i >= 0; --i) {
326
+ nodes.push(child = childs[i] = new Node$1(childs[i]));
327
+ child.parent = node;
328
+ child.depth = node.depth + 1;
329
+ }
330
+ }
331
+ }
332
+
333
+ return root.eachBefore(computeHeight);
334
+ }
335
+
336
+ function node_copy() {
337
+ return hierarchy(this).eachBefore(copyData);
338
+ }
339
+
340
+ function objectChildren(d) {
341
+ return d.children;
342
+ }
343
+
344
+ function mapChildren(d) {
345
+ return Array.isArray(d) ? d[1] : null;
346
+ }
347
+
348
+ function copyData(node) {
349
+ if (node.data.value !== undefined) node.value = node.data.value;
350
+ node.data = node.data.data;
351
+ }
352
+
353
+ function computeHeight(node) {
354
+ var height = 0;
355
+ do node.height = height;
356
+ while ((node = node.parent) && (node.height < ++height));
357
+ }
358
+
359
+ function Node$1(data) {
360
+ this.data = data;
361
+ this.depth =
362
+ this.height = 0;
363
+ this.parent = null;
364
+ }
365
+
366
+ Node$1.prototype = hierarchy.prototype = {
367
+ constructor: Node$1,
368
+ count: node_count,
369
+ each: node_each,
370
+ eachAfter: node_eachAfter,
371
+ eachBefore: node_eachBefore,
372
+ find: node_find,
373
+ sum: node_sum,
374
+ sort: node_sort,
375
+ path: node_path,
376
+ ancestors: node_ancestors,
377
+ descendants: node_descendants,
378
+ leaves: node_leaves,
379
+ links: node_links,
380
+ copy: node_copy,
381
+ [Symbol.iterator]: node_iterator
382
+ };
383
+
384
+ function required(f) {
385
+ if (typeof f !== "function") throw new Error;
386
+ return f;
387
+ }
388
+
389
+ function constantZero() {
390
+ return 0;
391
+ }
392
+
393
+ function constant$1(x) {
394
+ return function() {
395
+ return x;
396
+ };
397
+ }
398
+
399
+ function roundNode(node) {
400
+ node.x0 = Math.round(node.x0);
401
+ node.y0 = Math.round(node.y0);
402
+ node.x1 = Math.round(node.x1);
403
+ node.y1 = Math.round(node.y1);
404
+ }
405
+
406
+ function treemapDice(parent, x0, y0, x1, y1) {
407
+ var nodes = parent.children,
408
+ node,
409
+ i = -1,
410
+ n = nodes.length,
411
+ k = parent.value && (x1 - x0) / parent.value;
412
+
413
+ while (++i < n) {
414
+ node = nodes[i], node.y0 = y0, node.y1 = y1;
415
+ node.x0 = x0, node.x1 = x0 += node.value * k;
416
+ }
417
+ }
418
+
419
+ Object.create(Node$1.prototype);
420
+
421
+ function treemapSlice(parent, x0, y0, x1, y1) {
422
+ var nodes = parent.children,
423
+ node,
424
+ i = -1,
425
+ n = nodes.length,
426
+ k = parent.value && (y1 - y0) / parent.value;
427
+
428
+ while (++i < n) {
429
+ node = nodes[i], node.x0 = x0, node.x1 = x1;
430
+ node.y0 = y0, node.y1 = y0 += node.value * k;
431
+ }
432
+ }
433
+
434
+ var phi = (1 + Math.sqrt(5)) / 2;
435
+
436
+ function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
437
+ var rows = [],
438
+ nodes = parent.children,
439
+ row,
440
+ nodeValue,
441
+ i0 = 0,
442
+ i1 = 0,
443
+ n = nodes.length,
444
+ dx, dy,
445
+ value = parent.value,
446
+ sumValue,
447
+ minValue,
448
+ maxValue,
449
+ newRatio,
450
+ minRatio,
451
+ alpha,
452
+ beta;
453
+
454
+ while (i0 < n) {
455
+ dx = x1 - x0, dy = y1 - y0;
456
+
457
+ // Find the next non-empty node.
458
+ do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);
459
+ minValue = maxValue = sumValue;
460
+ alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
461
+ beta = sumValue * sumValue * alpha;
462
+ minRatio = Math.max(maxValue / beta, beta / minValue);
463
+
464
+ // Keep adding nodes while the aspect ratio maintains or improves.
465
+ for (; i1 < n; ++i1) {
466
+ sumValue += nodeValue = nodes[i1].value;
467
+ if (nodeValue < minValue) minValue = nodeValue;
468
+ if (nodeValue > maxValue) maxValue = nodeValue;
469
+ beta = sumValue * sumValue * alpha;
470
+ newRatio = Math.max(maxValue / beta, beta / minValue);
471
+ if (newRatio > minRatio) { sumValue -= nodeValue; break; }
472
+ minRatio = newRatio;
473
+ }
474
+
475
+ // Position and record the row orientation.
476
+ rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});
477
+ if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
478
+ else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
479
+ value -= sumValue, i0 = i1;
480
+ }
481
+
482
+ return rows;
483
+ }
484
+
485
+ var squarify = (function custom(ratio) {
486
+
487
+ function squarify(parent, x0, y0, x1, y1) {
488
+ squarifyRatio(ratio, parent, x0, y0, x1, y1);
489
+ }
490
+
491
+ squarify.ratio = function(x) {
492
+ return custom((x = +x) > 1 ? x : 1);
493
+ };
494
+
495
+ return squarify;
496
+ })(phi);
497
+
498
+ function treemap() {
499
+ var tile = squarify,
500
+ round = false,
501
+ dx = 1,
502
+ dy = 1,
503
+ paddingStack = [0],
504
+ paddingInner = constantZero,
505
+ paddingTop = constantZero,
506
+ paddingRight = constantZero,
507
+ paddingBottom = constantZero,
508
+ paddingLeft = constantZero;
509
+
510
+ function treemap(root) {
511
+ root.x0 =
512
+ root.y0 = 0;
513
+ root.x1 = dx;
514
+ root.y1 = dy;
515
+ root.eachBefore(positionNode);
516
+ paddingStack = [0];
517
+ if (round) root.eachBefore(roundNode);
518
+ return root;
519
+ }
520
+
521
+ function positionNode(node) {
522
+ var p = paddingStack[node.depth],
523
+ x0 = node.x0 + p,
524
+ y0 = node.y0 + p,
525
+ x1 = node.x1 - p,
526
+ y1 = node.y1 - p;
527
+ if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
528
+ if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
529
+ node.x0 = x0;
530
+ node.y0 = y0;
531
+ node.x1 = x1;
532
+ node.y1 = y1;
533
+ if (node.children) {
534
+ p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
535
+ x0 += paddingLeft(node) - p;
536
+ y0 += paddingTop(node) - p;
537
+ x1 -= paddingRight(node) - p;
538
+ y1 -= paddingBottom(node) - p;
539
+ if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
540
+ if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
541
+ tile(node, x0, y0, x1, y1);
542
+ }
543
+ }
544
+
545
+ treemap.round = function(x) {
546
+ return arguments.length ? (round = !!x, treemap) : round;
547
+ };
548
+
549
+ treemap.size = function(x) {
550
+ return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];
551
+ };
552
+
553
+ treemap.tile = function(x) {
554
+ return arguments.length ? (tile = required(x), treemap) : tile;
555
+ };
556
+
557
+ treemap.padding = function(x) {
558
+ return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
559
+ };
560
+
561
+ treemap.paddingInner = function(x) {
562
+ return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$1(+x), treemap) : paddingInner;
563
+ };
564
+
565
+ treemap.paddingOuter = function(x) {
566
+ return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
567
+ };
568
+
569
+ treemap.paddingTop = function(x) {
570
+ return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$1(+x), treemap) : paddingTop;
571
+ };
572
+
573
+ treemap.paddingRight = function(x) {
574
+ return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$1(+x), treemap) : paddingRight;
575
+ };
576
+
577
+ treemap.paddingBottom = function(x) {
578
+ return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$1(+x), treemap) : paddingBottom;
579
+ };
580
+
581
+ treemap.paddingLeft = function(x) {
582
+ return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$1(+x), treemap) : paddingLeft;
583
+ };
584
+
585
+ return treemap;
586
+ }
587
+
588
+ var treemapResquarify = (function custom(ratio) {
589
+
590
+ function resquarify(parent, x0, y0, x1, y1) {
591
+ if ((rows = parent._squarify) && (rows.ratio === ratio)) {
592
+ var rows,
593
+ row,
594
+ nodes,
595
+ i,
596
+ j = -1,
597
+ n,
598
+ m = rows.length,
599
+ value = parent.value;
600
+
601
+ while (++j < m) {
602
+ row = rows[j], nodes = row.children;
603
+ for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;
604
+ if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1);
605
+ else treemapSlice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1);
606
+ value -= row.value;
607
+ }
608
+ } else {
609
+ parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);
610
+ rows.ratio = ratio;
611
+ }
612
+ }
613
+
614
+ resquarify.ratio = function(x) {
615
+ return custom((x = +x) > 1 ? x : 1);
616
+ };
617
+
618
+ return resquarify;
619
+ })(phi);
620
+
621
+ const isModuleTree = (mod) => "children" in mod;
622
+
623
+ let count = 0;
624
+ class Id {
625
+ constructor(id) {
626
+ this._id = id;
627
+ const url = new URL(window.location.href);
628
+ url.hash = id;
629
+ this._href = url.toString();
630
+ }
631
+ get id() {
632
+ return this._id;
633
+ }
634
+ get href() {
635
+ return this._href;
636
+ }
637
+ toString() {
638
+ return `url(${this.href})`;
639
+ }
640
+ }
641
+ function generateUniqueId(name) {
642
+ count += 1;
643
+ const id = ["O", name, count].filter(Boolean).join("-");
644
+ return new Id(id);
645
+ }
646
+
647
+ const LABELS = {
648
+ renderedLength: "Rendered",
649
+ gzipLength: "Gzip",
650
+ brotliLength: "Brotli",
651
+ };
652
+ const getAvailableSizeOptions = (options) => {
653
+ const availableSizeProperties = ["renderedLength"];
654
+ if (options.gzip) {
655
+ availableSizeProperties.push("gzipLength");
656
+ }
657
+ if (options.brotli) {
658
+ availableSizeProperties.push("brotliLength");
659
+ }
660
+ return availableSizeProperties;
661
+ };
662
+
663
+ var t,r,u,i,o=0,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function p(n){return o=1,y(B$1,n)}function y(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.u)){r.u=!0;var f=r.shouldComponentUpdate;r.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h(u,i){var o=d(t++,3);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o));}function s(u,i){var o=d(t++,4);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o));}function _(n){return o=5,F(function(){return {current:n}},[])}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){"function"!=typeof n.type||n.__m||null===n.__?n.__m||(n.__m=n.__&&n.__.__m?n.__.__m:""):n.__m=(n.__&&n.__.__m?n.__.__m:"")+(n.__&&n.__.__k?n.__.__k.indexOf(n):0),r=null,e&&e(n);},l$1.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[])),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));}function k(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function w(n){var t=r;n.__c=n.__(),r=t;}function z(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B$1(n,t){return "function"==typeof t?t(n):t}
664
+
665
+ const SideBar = ({ availableSizeProperties, sizeProperty, setSizeProperty, onExcludeChange, onIncludeChange, }) => {
666
+ const [includeValue, setIncludeValue] = p("");
667
+ const [excludeValue, setExcludeValue] = p("");
668
+ const handleSizePropertyChange = (sizeProp) => () => {
669
+ if (sizeProp !== sizeProperty) {
670
+ setSizeProperty(sizeProp);
671
+ }
672
+ };
673
+ const handleIncludeChange = (event) => {
674
+ const value = event.currentTarget.value;
675
+ setIncludeValue(value);
676
+ onIncludeChange(value);
677
+ };
678
+ const handleExcludeChange = (event) => {
679
+ const value = event.currentTarget.value;
680
+ setExcludeValue(value);
681
+ onExcludeChange(value);
682
+ };
683
+ return (o$1("aside", Object.assign({ className: "sidebar" }, { children: [o$1("div", Object.assign({ className: "size-selectors" }, { children: availableSizeProperties.length > 1 &&
684
+ availableSizeProperties.map((sizeProp) => {
685
+ const id = `selector-${sizeProp}`;
686
+ return (o$1("div", Object.assign({ className: "size-selector" }, { children: [o$1("input", { type: "radio", id: id, checked: sizeProp === sizeProperty, onChange: handleSizePropertyChange(sizeProp) }), o$1("label", Object.assign({ htmlFor: id }, { children: LABELS[sizeProp] }))] }), sizeProp));
687
+ }) })), o$1("div", Object.assign({ className: "module-filters" }, { children: [o$1("div", Object.assign({ className: "module-filter" }, { children: [o$1("label", Object.assign({ htmlFor: "module-filter-exclude" }, { children: "Exclude" })), o$1("input", { type: "text", id: "module-filter-exclude", value: excludeValue, onInput: handleExcludeChange, placeholder: "RegExp" })] })), o$1("div", Object.assign({ className: "module-filter" }, { children: [o$1("label", Object.assign({ htmlFor: "module-filter-include" }, { children: "Include" })), o$1("input", { type: "text", id: "module-filter-include", value: includeValue, onInput: handleIncludeChange, placeholder: "RegExp" })] }))] }))] })));
688
+ };
689
+
690
+ const throttleFilter = (callback, limit) => {
691
+ let waiting = false;
692
+ return (val) => {
693
+ if (!waiting) {
694
+ callback(val);
695
+ waiting = true;
696
+ setTimeout(() => {
697
+ waiting = false;
698
+ }, limit);
699
+ }
700
+ };
701
+ };
702
+ const useFilter = () => {
703
+ const [includeFilter, setIncludeFilter] = p("");
704
+ const [excludeFilter, setExcludeFilter] = p("");
705
+ const setIncludeFilterTrottled = F(() => throttleFilter(setIncludeFilter, 200), []);
706
+ const setExcludeFilterTrottled = F(() => throttleFilter(setExcludeFilter, 200), []);
707
+ const isModuleIncluded = F(() => {
708
+ if (includeFilter === "") {
709
+ return () => true;
710
+ }
711
+ try {
712
+ const re = new RegExp(includeFilter);
713
+ return ({ id }) => re.test(id);
714
+ }
715
+ catch (err) {
716
+ return () => false;
717
+ }
718
+ }, [includeFilter]);
719
+ const isModuleExcluded = F(() => {
720
+ if (excludeFilter === "") {
721
+ return () => false;
722
+ }
723
+ try {
724
+ const re = new RegExp(excludeFilter);
725
+ return ({ id }) => re.test(id);
726
+ }
727
+ catch (err) {
728
+ return () => false;
729
+ }
730
+ }, [excludeFilter]);
731
+ const isDefaultInclude = includeFilter === "";
732
+ const getModuleFilterMultiplier = F(() => {
733
+ return (data) => {
734
+ if (isDefaultInclude) {
735
+ return isModuleExcluded(data) ? 0 : 1;
736
+ }
737
+ return isModuleExcluded(data) && !isModuleIncluded(data) ? 0 : 1;
738
+ };
739
+ }, [isDefaultInclude, isModuleExcluded, isModuleIncluded]);
740
+ return {
741
+ getModuleFilterMultiplier,
742
+ includeFilter,
743
+ excludeFilter,
744
+ setExcludeFilter: setExcludeFilterTrottled,
745
+ setIncludeFilter: setIncludeFilterTrottled,
746
+ };
747
+ };
748
+
749
+ function ascending(a, b) {
750
+ return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
751
+ }
752
+
753
+ function descending(a, b) {
754
+ return a == null || b == null ? NaN
755
+ : b < a ? -1
756
+ : b > a ? 1
757
+ : b >= a ? 0
758
+ : NaN;
759
+ }
760
+
761
+ function bisector(f) {
762
+ let compare1, compare2, delta;
763
+
764
+ // If an accessor is specified, promote it to a comparator. In this case we
765
+ // can test whether the search value is (self-) comparable. We can’t do this
766
+ // for a comparator (except for specific, known comparators) because we can’t
767
+ // tell if the comparator is symmetric, and an asymmetric comparator can’t be
768
+ // used to test whether a single value is comparable.
769
+ if (f.length !== 2) {
770
+ compare1 = ascending;
771
+ compare2 = (d, x) => ascending(f(d), x);
772
+ delta = (d, x) => f(d) - x;
773
+ } else {
774
+ compare1 = f === ascending || f === descending ? f : zero$1;
775
+ compare2 = f;
776
+ delta = f;
777
+ }
778
+
779
+ function left(a, x, lo = 0, hi = a.length) {
780
+ if (lo < hi) {
781
+ if (compare1(x, x) !== 0) return hi;
782
+ do {
783
+ const mid = (lo + hi) >>> 1;
784
+ if (compare2(a[mid], x) < 0) lo = mid + 1;
785
+ else hi = mid;
786
+ } while (lo < hi);
787
+ }
788
+ return lo;
789
+ }
790
+
791
+ function right(a, x, lo = 0, hi = a.length) {
792
+ if (lo < hi) {
793
+ if (compare1(x, x) !== 0) return hi;
794
+ do {
795
+ const mid = (lo + hi) >>> 1;
796
+ if (compare2(a[mid], x) <= 0) lo = mid + 1;
797
+ else hi = mid;
798
+ } while (lo < hi);
799
+ }
800
+ return lo;
801
+ }
802
+
803
+ function center(a, x, lo = 0, hi = a.length) {
804
+ const i = left(a, x, lo, hi - 1);
805
+ return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
806
+ }
807
+
808
+ return {left, center, right};
809
+ }
810
+
811
+ function zero$1() {
812
+ return 0;
813
+ }
814
+
815
+ function number$1(x) {
816
+ return x === null ? NaN : +x;
817
+ }
818
+
819
+ const ascendingBisect = bisector(ascending);
820
+ const bisectRight = ascendingBisect.right;
821
+ bisector(number$1).center;
822
+
823
+ class InternMap extends Map {
824
+ constructor(entries, key = keyof) {
825
+ super();
826
+ Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
827
+ if (entries != null) for (const [key, value] of entries) this.set(key, value);
828
+ }
829
+ get(key) {
830
+ return super.get(intern_get(this, key));
831
+ }
832
+ has(key) {
833
+ return super.has(intern_get(this, key));
834
+ }
835
+ set(key, value) {
836
+ return super.set(intern_set(this, key), value);
837
+ }
838
+ delete(key) {
839
+ return super.delete(intern_delete(this, key));
840
+ }
841
+ }
842
+
843
+ function intern_get({_intern, _key}, value) {
844
+ const key = _key(value);
845
+ return _intern.has(key) ? _intern.get(key) : value;
846
+ }
847
+
848
+ function intern_set({_intern, _key}, value) {
849
+ const key = _key(value);
850
+ if (_intern.has(key)) return _intern.get(key);
851
+ _intern.set(key, value);
852
+ return value;
853
+ }
854
+
855
+ function intern_delete({_intern, _key}, value) {
856
+ const key = _key(value);
857
+ if (_intern.has(key)) {
858
+ value = _intern.get(key);
859
+ _intern.delete(key);
860
+ }
861
+ return value;
862
+ }
863
+
864
+ function keyof(value) {
865
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
866
+ }
867
+
868
+ function identity$2(x) {
869
+ return x;
870
+ }
871
+
872
+ function group(values, ...keys) {
873
+ return nest(values, identity$2, identity$2, keys);
874
+ }
875
+
876
+ function nest(values, map, reduce, keys) {
877
+ return (function regroup(values, i) {
878
+ if (i >= keys.length) return reduce(values);
879
+ const groups = new InternMap();
880
+ const keyof = keys[i++];
881
+ let index = -1;
882
+ for (const value of values) {
883
+ const key = keyof(value, ++index, values);
884
+ const group = groups.get(key);
885
+ if (group) group.push(value);
886
+ else groups.set(key, [value]);
887
+ }
888
+ for (const [key, values] of groups) {
889
+ groups.set(key, regroup(values, i));
890
+ }
891
+ return map(groups);
892
+ })(values, 0);
893
+ }
894
+
895
+ var e10 = Math.sqrt(50),
896
+ e5 = Math.sqrt(10),
897
+ e2 = Math.sqrt(2);
898
+
899
+ function ticks(start, stop, count) {
900
+ var reverse,
901
+ i = -1,
902
+ n,
903
+ ticks,
904
+ step;
905
+
906
+ stop = +stop, start = +start, count = +count;
907
+ if (start === stop && count > 0) return [start];
908
+ if (reverse = stop < start) n = start, start = stop, stop = n;
909
+ if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
910
+
911
+ if (step > 0) {
912
+ let r0 = Math.round(start / step), r1 = Math.round(stop / step);
913
+ if (r0 * step < start) ++r0;
914
+ if (r1 * step > stop) --r1;
915
+ ticks = new Array(n = r1 - r0 + 1);
916
+ while (++i < n) ticks[i] = (r0 + i) * step;
917
+ } else {
918
+ step = -step;
919
+ let r0 = Math.round(start * step), r1 = Math.round(stop * step);
920
+ if (r0 / step < start) ++r0;
921
+ if (r1 / step > stop) --r1;
922
+ ticks = new Array(n = r1 - r0 + 1);
923
+ while (++i < n) ticks[i] = (r0 + i) / step;
924
+ }
925
+
926
+ if (reverse) ticks.reverse();
927
+
928
+ return ticks;
929
+ }
930
+
931
+ function tickIncrement(start, stop, count) {
932
+ var step = (stop - start) / Math.max(0, count),
933
+ power = Math.floor(Math.log(step) / Math.LN10),
934
+ error = step / Math.pow(10, power);
935
+ return power >= 0
936
+ ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
937
+ : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
938
+ }
939
+
940
+ function tickStep(start, stop, count) {
941
+ var step0 = Math.abs(stop - start) / Math.max(0, count),
942
+ step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
943
+ error = step0 / step1;
944
+ if (error >= e10) step1 *= 10;
945
+ else if (error >= e5) step1 *= 5;
946
+ else if (error >= e2) step1 *= 2;
947
+ return stop < start ? -step1 : step1;
948
+ }
949
+
950
+ const TOP_PADDING = 20;
951
+ const PADDING = 2;
952
+
953
+ const Node = ({ node, onMouseOver, onClick, selected }) => {
954
+ const { getModuleColor } = q(StaticContext);
955
+ const { backgroundColor, fontColor } = getModuleColor(node);
956
+ const { x0, x1, y1, y0, data, children = null } = node;
957
+ const textRef = _(null);
958
+ const textRectRef = _();
959
+ const width = x1 - x0;
960
+ const height = y1 - y0;
961
+ const textProps = {
962
+ "font-size": "0.7em",
963
+ "dominant-baseline": "middle",
964
+ "text-anchor": "middle",
965
+ x: width / 2,
966
+ };
967
+ if (children != null) {
968
+ textProps.y = (TOP_PADDING + PADDING) / 2;
969
+ }
970
+ else {
971
+ textProps.y = height / 2;
972
+ }
973
+ s(() => {
974
+ if (width == 0 || height == 0 || !textRef.current) {
975
+ return;
976
+ }
977
+ if (textRectRef.current == null) {
978
+ textRectRef.current = textRef.current.getBoundingClientRect();
979
+ }
980
+ let scale = 1;
981
+ if (children != null) {
982
+ scale = Math.min((width * 0.9) / textRectRef.current.width, Math.min(height, TOP_PADDING + PADDING) / textRectRef.current.height);
983
+ scale = Math.min(1, scale);
984
+ textRef.current.setAttribute("y", String(Math.min(TOP_PADDING + PADDING, height) / 2 / scale));
985
+ textRef.current.setAttribute("x", String(width / 2 / scale));
986
+ }
987
+ else {
988
+ scale = Math.min((width * 0.9) / textRectRef.current.width, (height * 0.9) / textRectRef.current.height);
989
+ scale = Math.min(1, scale);
990
+ textRef.current.setAttribute("y", String(height / 2 / scale));
991
+ textRef.current.setAttribute("x", String(width / 2 / scale));
992
+ }
993
+ textRef.current.setAttribute("transform", `scale(${scale.toFixed(2)})`);
994
+ }, [children, height, width]);
995
+ if (width == 0 || height == 0) {
996
+ return null;
997
+ }
998
+ return (o$1("g", Object.assign({ className: "node", transform: `translate(${x0},${y0})`, onClick: (event) => {
999
+ event.stopPropagation();
1000
+ onClick(node);
1001
+ }, onMouseOver: (event) => {
1002
+ event.stopPropagation();
1003
+ onMouseOver(node);
1004
+ } }, { children: [o$1("rect", { fill: backgroundColor, rx: 2, ry: 2, width: x1 - x0, height: y1 - y0, stroke: selected ? "#fff" : undefined, "stroke-width": selected ? 2 : undefined }), o$1("text", Object.assign({ ref: textRef, fill: fontColor, onClick: (event) => {
1005
+ var _a;
1006
+ if (((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) !== "") {
1007
+ event.stopPropagation();
1008
+ }
1009
+ } }, textProps, { children: data.name }))] })));
1010
+ };
1011
+
1012
+ const TreeMap = ({ root, onNodeHover, selectedNode, onNodeClick, }) => {
1013
+ const { width, height, getModuleIds } = q(StaticContext);
1014
+ console.time("layering");
1015
+ // this will make groups by height
1016
+ const nestedData = F(() => {
1017
+ const nestedDataMap = group(root.descendants(), (d) => d.height);
1018
+ const nestedData = Array.from(nestedDataMap, ([key, values]) => ({
1019
+ key,
1020
+ values,
1021
+ }));
1022
+ nestedData.sort((a, b) => b.key - a.key);
1023
+ return nestedData;
1024
+ }, [root]);
1025
+ console.timeEnd("layering");
1026
+ return (o$1("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}` }, { children: nestedData.map(({ key, values }) => {
1027
+ return (o$1("g", Object.assign({ className: "layer" }, { children: values.map((node) => {
1028
+ return (o$1(Node, { node: node, onMouseOver: onNodeHover, selected: selectedNode === node, onClick: onNodeClick }, getModuleIds(node.data).nodeUid.id));
1029
+ }) }), key));
1030
+ }) })));
1031
+ };
1032
+
1033
+ var bytes$1 = {exports: {}};
1034
+
1035
+ /*!
1036
+ * bytes
1037
+ * Copyright(c) 2012-2014 TJ Holowaychuk
1038
+ * Copyright(c) 2015 Jed Watson
1039
+ * MIT Licensed
1040
+ */
1041
+
1042
+ /**
1043
+ * Module exports.
1044
+ * @public
1045
+ */
1046
+
1047
+ bytes$1.exports = bytes;
1048
+ var format_1 = bytes$1.exports.format = format$1;
1049
+ bytes$1.exports.parse = parse;
1050
+
1051
+ /**
1052
+ * Module variables.
1053
+ * @private
1054
+ */
1055
+
1056
+ var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
1057
+
1058
+ var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
1059
+
1060
+ var map$1 = {
1061
+ b: 1,
1062
+ kb: 1 << 10,
1063
+ mb: 1 << 20,
1064
+ gb: 1 << 30,
1065
+ tb: Math.pow(1024, 4),
1066
+ pb: Math.pow(1024, 5),
1067
+ };
1068
+
1069
+ var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
1070
+
1071
+ /**
1072
+ * Convert the given value in bytes into a string or parse to string to an integer in bytes.
1073
+ *
1074
+ * @param {string|number} value
1075
+ * @param {{
1076
+ * case: [string],
1077
+ * decimalPlaces: [number]
1078
+ * fixedDecimals: [boolean]
1079
+ * thousandsSeparator: [string]
1080
+ * unitSeparator: [string]
1081
+ * }} [options] bytes options.
1082
+ *
1083
+ * @returns {string|number|null}
1084
+ */
1085
+
1086
+ function bytes(value, options) {
1087
+ if (typeof value === 'string') {
1088
+ return parse(value);
1089
+ }
1090
+
1091
+ if (typeof value === 'number') {
1092
+ return format$1(value, options);
1093
+ }
1094
+
1095
+ return null;
1096
+ }
1097
+
1098
+ /**
1099
+ * Format the given value in bytes into a string.
1100
+ *
1101
+ * If the value is negative, it is kept as such. If it is a float,
1102
+ * it is rounded.
1103
+ *
1104
+ * @param {number} value
1105
+ * @param {object} [options]
1106
+ * @param {number} [options.decimalPlaces=2]
1107
+ * @param {number} [options.fixedDecimals=false]
1108
+ * @param {string} [options.thousandsSeparator=]
1109
+ * @param {string} [options.unit=]
1110
+ * @param {string} [options.unitSeparator=]
1111
+ *
1112
+ * @returns {string|null}
1113
+ * @public
1114
+ */
1115
+
1116
+ function format$1(value, options) {
1117
+ if (!Number.isFinite(value)) {
1118
+ return null;
1119
+ }
1120
+
1121
+ var mag = Math.abs(value);
1122
+ var thousandsSeparator = (options && options.thousandsSeparator) || '';
1123
+ var unitSeparator = (options && options.unitSeparator) || '';
1124
+ var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
1125
+ var fixedDecimals = Boolean(options && options.fixedDecimals);
1126
+ var unit = (options && options.unit) || '';
1127
+
1128
+ if (!unit || !map$1[unit.toLowerCase()]) {
1129
+ if (mag >= map$1.pb) {
1130
+ unit = 'PB';
1131
+ } else if (mag >= map$1.tb) {
1132
+ unit = 'TB';
1133
+ } else if (mag >= map$1.gb) {
1134
+ unit = 'GB';
1135
+ } else if (mag >= map$1.mb) {
1136
+ unit = 'MB';
1137
+ } else if (mag >= map$1.kb) {
1138
+ unit = 'KB';
1139
+ } else {
1140
+ unit = 'B';
1141
+ }
1142
+ }
1143
+
1144
+ var val = value / map$1[unit.toLowerCase()];
1145
+ var str = val.toFixed(decimalPlaces);
1146
+
1147
+ if (!fixedDecimals) {
1148
+ str = str.replace(formatDecimalsRegExp, '$1');
1149
+ }
1150
+
1151
+ if (thousandsSeparator) {
1152
+ str = str.split('.').map(function (s, i) {
1153
+ return i === 0
1154
+ ? s.replace(formatThousandsRegExp, thousandsSeparator)
1155
+ : s
1156
+ }).join('.');
1157
+ }
1158
+
1159
+ return str + unitSeparator + unit;
1160
+ }
1161
+
1162
+ /**
1163
+ * Parse the string value into an integer in bytes.
1164
+ *
1165
+ * If no unit is given, it is assumed the value is in bytes.
1166
+ *
1167
+ * @param {number|string} val
1168
+ *
1169
+ * @returns {number|null}
1170
+ * @public
1171
+ */
1172
+
1173
+ function parse(val) {
1174
+ if (typeof val === 'number' && !isNaN(val)) {
1175
+ return val;
1176
+ }
1177
+
1178
+ if (typeof val !== 'string') {
1179
+ return null;
1180
+ }
1181
+
1182
+ // Test if the string passed is valid
1183
+ var results = parseRegExp.exec(val);
1184
+ var floatValue;
1185
+ var unit = 'b';
1186
+
1187
+ if (!results) {
1188
+ // Nothing could be extracted from the given string
1189
+ floatValue = parseInt(val, 10);
1190
+ unit = 'b';
1191
+ } else {
1192
+ // Retrieve the value and the unit
1193
+ floatValue = parseFloat(results[1]);
1194
+ unit = results[4].toLowerCase();
1195
+ }
1196
+
1197
+ if (isNaN(floatValue)) {
1198
+ return null;
1199
+ }
1200
+
1201
+ return Math.floor(map$1[unit] * floatValue);
1202
+ }
1203
+
1204
+ const Tooltip_marginX = 10;
1205
+ const Tooltip_marginY = 30;
1206
+ const SOURCEMAP_RENDERED = (o$1("span", { children: [" ", o$1("b", { children: LABELS.renderedLength }), " is a number of characters in the file after individual and ", o$1("br", {}), " ", "whole bundle transformations according to sourcemap."] }));
1207
+ const RENDRED = (o$1("span", { children: [o$1("b", { children: LABELS.renderedLength }), " is a byte size of individual file after transformations and treeshake."] }));
1208
+ const COMPRESSED = (o$1("span", { children: [o$1("b", { children: LABELS.gzipLength }), " and ", o$1("b", { children: LABELS.brotliLength }), " is a byte size of individual file after individual transformations,", o$1("br", {}), " treeshake and compression."] }));
1209
+ const Tooltip = ({ node, visible, root, sizeProperty, }) => {
1210
+ const { availableSizeProperties, getModuleSize, data } = q(StaticContext);
1211
+ const ref = _(null);
1212
+ const [style, setStyle] = p({});
1213
+ const content = F(() => {
1214
+ if (!node)
1215
+ return null;
1216
+ const mainSize = getModuleSize(node.data, sizeProperty);
1217
+ const percentageNum = (100 * mainSize) / getModuleSize(root.data, sizeProperty);
1218
+ const percentage = percentageNum.toFixed(2);
1219
+ const percentageString = percentage + "%";
1220
+ const path = node
1221
+ .ancestors()
1222
+ .reverse()
1223
+ .map((d) => d.data.name)
1224
+ .join("/");
1225
+ let dataNode = null;
1226
+ if (!isModuleTree(node.data)) {
1227
+ const mainUid = data.nodeParts[node.data.uid].mainUid;
1228
+ dataNode = data.nodeMetas[mainUid];
1229
+ }
1230
+ return (o$1(p$1, { children: [o$1("div", { children: path }), availableSizeProperties.map((sizeProp) => {
1231
+ if (sizeProp === sizeProperty) {
1232
+ return (o$1("div", { children: [o$1("b", { children: [LABELS[sizeProp], ": ", format_1(mainSize)] }), " ", "(", percentageString, ")"] }, sizeProp));
1233
+ }
1234
+ else {
1235
+ return (o$1("div", { children: [LABELS[sizeProp], ": ", format_1(getModuleSize(node.data, sizeProp))] }, sizeProp));
1236
+ }
1237
+ }), o$1("br", {}), dataNode && dataNode.importedBy.length > 0 && (o$1("div", { children: [o$1("div", { children: [o$1("b", { children: "Imported By" }), ":"] }), dataNode.importedBy.map(({ uid }) => {
1238
+ const id = data.nodeMetas[uid].id;
1239
+ return o$1("div", { children: id }, id);
1240
+ })] })), o$1("br", {}), o$1("small", { children: data.options.sourcemap ? SOURCEMAP_RENDERED : RENDRED }), (data.options.gzip || data.options.brotli) && (o$1(p$1, { children: [o$1("br", {}), o$1("small", { children: COMPRESSED })] }))] }));
1241
+ }, [availableSizeProperties, data, getModuleSize, node, root.data, sizeProperty]);
1242
+ const updatePosition = (mouseCoords) => {
1243
+ if (!ref.current)
1244
+ return;
1245
+ const pos = {
1246
+ left: mouseCoords.x + Tooltip_marginX,
1247
+ top: mouseCoords.y + Tooltip_marginY,
1248
+ };
1249
+ const boundingRect = ref.current.getBoundingClientRect();
1250
+ if (pos.left + boundingRect.width > window.innerWidth) {
1251
+ // Shifting horizontally
1252
+ pos.left = window.innerWidth - boundingRect.width;
1253
+ }
1254
+ if (pos.top + boundingRect.height > window.innerHeight) {
1255
+ // Flipping vertically
1256
+ pos.top = mouseCoords.y - Tooltip_marginY - boundingRect.height;
1257
+ }
1258
+ setStyle(pos);
1259
+ };
1260
+ h(() => {
1261
+ const handleMouseMove = (event) => {
1262
+ updatePosition({
1263
+ x: event.pageX,
1264
+ y: event.pageY,
1265
+ });
1266
+ };
1267
+ document.addEventListener("mousemove", handleMouseMove, true);
1268
+ return () => {
1269
+ document.removeEventListener("mousemove", handleMouseMove, true);
1270
+ };
1271
+ }, []);
1272
+ return (o$1("div", Object.assign({ className: `tooltip ${visible ? "" : "tooltip-hidden"}`, ref: ref, style: style }, { children: content })));
1273
+ };
1274
+
1275
+ const Chart = ({ root, sizeProperty, selectedNode, setSelectedNode, }) => {
1276
+ const [showTooltip, setShowTooltip] = p(false);
1277
+ const [tooltipNode, setTooltipNode] = p(undefined);
1278
+ h(() => {
1279
+ const handleMouseOut = () => {
1280
+ setShowTooltip(false);
1281
+ };
1282
+ document.addEventListener("mouseover", handleMouseOut);
1283
+ return () => {
1284
+ document.removeEventListener("mouseover", handleMouseOut);
1285
+ };
1286
+ }, []);
1287
+ return (o$1(p$1, { children: [o$1(TreeMap, { root: root, onNodeHover: (node) => {
1288
+ setTooltipNode(node);
1289
+ setShowTooltip(true);
1290
+ }, selectedNode: selectedNode, onNodeClick: (node) => {
1291
+ setSelectedNode(selectedNode === node ? undefined : node);
1292
+ } }), o$1(Tooltip, { visible: showTooltip, node: tooltipNode, root: root, sizeProperty: sizeProperty })] }));
1293
+ };
1294
+
1295
+ const Main = () => {
1296
+ const { availableSizeProperties, rawHierarchy, getModuleSize, layout, data } = q(StaticContext);
1297
+ const [sizeProperty, setSizeProperty] = p(availableSizeProperties[0]);
1298
+ const [selectedNode, setSelectedNode] = p(undefined);
1299
+ const { getModuleFilterMultiplier, setExcludeFilter, setIncludeFilter } = useFilter();
1300
+ console.time("getNodeSizeMultiplier");
1301
+ const getNodeSizeMultiplier = F(() => {
1302
+ const rootSize = getModuleSize(rawHierarchy.data, sizeProperty);
1303
+ const selectedSize = selectedNode ? getModuleSize(selectedNode.data, sizeProperty) : 1;
1304
+ const multiplier = rootSize * 0.2 > selectedSize ? (rootSize * 0.2) / selectedSize : 3;
1305
+ if (selectedNode === undefined) {
1306
+ return () => 1;
1307
+ }
1308
+ else if (isModuleTree(selectedNode.data)) {
1309
+ const leaves = new Set(selectedNode.leaves().map((d) => d.data));
1310
+ return (node) => {
1311
+ if (leaves.has(node)) {
1312
+ return multiplier;
1313
+ }
1314
+ return 1;
1315
+ };
1316
+ }
1317
+ else {
1318
+ return (node) => {
1319
+ if (node === selectedNode.data) {
1320
+ return multiplier;
1321
+ }
1322
+ return 1;
1323
+ };
1324
+ }
1325
+ }, [getModuleSize, rawHierarchy.data, selectedNode, sizeProperty]);
1326
+ console.timeEnd("getNodeSizeMultiplier");
1327
+ console.time("root hierarchy compute");
1328
+ // root here always be the same as rawHierarchy even after layouting
1329
+ const root = F(() => {
1330
+ const rootWithSizesAndSorted = rawHierarchy
1331
+ .sum((node) => {
1332
+ if (isModuleTree(node))
1333
+ return 0;
1334
+ const ownSize = getModuleSize(node, sizeProperty);
1335
+ const zoomMultiplier = getNodeSizeMultiplier(node);
1336
+ const filterMultiplier = getModuleFilterMultiplier(data.nodeMetas[data.nodeParts[node.uid].mainUid]);
1337
+ return ownSize * zoomMultiplier * filterMultiplier;
1338
+ })
1339
+ .sort((a, b) => getModuleSize(a.data, sizeProperty) - getModuleSize(b.data, sizeProperty));
1340
+ return layout(rootWithSizesAndSorted);
1341
+ }, [
1342
+ data,
1343
+ getModuleFilterMultiplier,
1344
+ getModuleSize,
1345
+ getNodeSizeMultiplier,
1346
+ layout,
1347
+ rawHierarchy,
1348
+ sizeProperty,
1349
+ ]);
1350
+ console.timeEnd("root hierarchy compute");
1351
+ return (o$1(p$1, { children: [o$1(SideBar, { sizeProperty: sizeProperty, availableSizeProperties: availableSizeProperties, setSizeProperty: setSizeProperty, onExcludeChange: setExcludeFilter, onIncludeChange: setIncludeFilter }), o$1(Chart, { root: root, sizeProperty: sizeProperty, selectedNode: selectedNode, setSelectedNode: setSelectedNode })] }));
1352
+ };
1353
+
1354
+ function initRange(domain, range) {
1355
+ switch (arguments.length) {
1356
+ case 0: break;
1357
+ case 1: this.range(domain); break;
1358
+ default: this.range(range).domain(domain); break;
1359
+ }
1360
+ return this;
1361
+ }
1362
+
1363
+ function initInterpolator(domain, interpolator) {
1364
+ switch (arguments.length) {
1365
+ case 0: break;
1366
+ case 1: {
1367
+ if (typeof domain === "function") this.interpolator(domain);
1368
+ else this.range(domain);
1369
+ break;
1370
+ }
1371
+ default: {
1372
+ this.domain(domain);
1373
+ if (typeof interpolator === "function") this.interpolator(interpolator);
1374
+ else this.range(interpolator);
1375
+ break;
1376
+ }
1377
+ }
1378
+ return this;
1379
+ }
1380
+
1381
+ function define(constructor, factory, prototype) {
1382
+ constructor.prototype = factory.prototype = prototype;
1383
+ prototype.constructor = constructor;
1384
+ }
1385
+
1386
+ function extend(parent, definition) {
1387
+ var prototype = Object.create(parent.prototype);
1388
+ for (var key in definition) prototype[key] = definition[key];
1389
+ return prototype;
1390
+ }
1391
+
1392
+ function Color() {}
1393
+
1394
+ var darker = 0.7;
1395
+ var brighter = 1 / darker;
1396
+
1397
+ var reI = "\\s*([+-]?\\d+)\\s*",
1398
+ reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
1399
+ reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
1400
+ reHex = /^#([0-9a-f]{3,8})$/,
1401
+ reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
1402
+ reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
1403
+ reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
1404
+ reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
1405
+ reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
1406
+ reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
1407
+
1408
+ var named = {
1409
+ aliceblue: 0xf0f8ff,
1410
+ antiquewhite: 0xfaebd7,
1411
+ aqua: 0x00ffff,
1412
+ aquamarine: 0x7fffd4,
1413
+ azure: 0xf0ffff,
1414
+ beige: 0xf5f5dc,
1415
+ bisque: 0xffe4c4,
1416
+ black: 0x000000,
1417
+ blanchedalmond: 0xffebcd,
1418
+ blue: 0x0000ff,
1419
+ blueviolet: 0x8a2be2,
1420
+ brown: 0xa52a2a,
1421
+ burlywood: 0xdeb887,
1422
+ cadetblue: 0x5f9ea0,
1423
+ chartreuse: 0x7fff00,
1424
+ chocolate: 0xd2691e,
1425
+ coral: 0xff7f50,
1426
+ cornflowerblue: 0x6495ed,
1427
+ cornsilk: 0xfff8dc,
1428
+ crimson: 0xdc143c,
1429
+ cyan: 0x00ffff,
1430
+ darkblue: 0x00008b,
1431
+ darkcyan: 0x008b8b,
1432
+ darkgoldenrod: 0xb8860b,
1433
+ darkgray: 0xa9a9a9,
1434
+ darkgreen: 0x006400,
1435
+ darkgrey: 0xa9a9a9,
1436
+ darkkhaki: 0xbdb76b,
1437
+ darkmagenta: 0x8b008b,
1438
+ darkolivegreen: 0x556b2f,
1439
+ darkorange: 0xff8c00,
1440
+ darkorchid: 0x9932cc,
1441
+ darkred: 0x8b0000,
1442
+ darksalmon: 0xe9967a,
1443
+ darkseagreen: 0x8fbc8f,
1444
+ darkslateblue: 0x483d8b,
1445
+ darkslategray: 0x2f4f4f,
1446
+ darkslategrey: 0x2f4f4f,
1447
+ darkturquoise: 0x00ced1,
1448
+ darkviolet: 0x9400d3,
1449
+ deeppink: 0xff1493,
1450
+ deepskyblue: 0x00bfff,
1451
+ dimgray: 0x696969,
1452
+ dimgrey: 0x696969,
1453
+ dodgerblue: 0x1e90ff,
1454
+ firebrick: 0xb22222,
1455
+ floralwhite: 0xfffaf0,
1456
+ forestgreen: 0x228b22,
1457
+ fuchsia: 0xff00ff,
1458
+ gainsboro: 0xdcdcdc,
1459
+ ghostwhite: 0xf8f8ff,
1460
+ gold: 0xffd700,
1461
+ goldenrod: 0xdaa520,
1462
+ gray: 0x808080,
1463
+ green: 0x008000,
1464
+ greenyellow: 0xadff2f,
1465
+ grey: 0x808080,
1466
+ honeydew: 0xf0fff0,
1467
+ hotpink: 0xff69b4,
1468
+ indianred: 0xcd5c5c,
1469
+ indigo: 0x4b0082,
1470
+ ivory: 0xfffff0,
1471
+ khaki: 0xf0e68c,
1472
+ lavender: 0xe6e6fa,
1473
+ lavenderblush: 0xfff0f5,
1474
+ lawngreen: 0x7cfc00,
1475
+ lemonchiffon: 0xfffacd,
1476
+ lightblue: 0xadd8e6,
1477
+ lightcoral: 0xf08080,
1478
+ lightcyan: 0xe0ffff,
1479
+ lightgoldenrodyellow: 0xfafad2,
1480
+ lightgray: 0xd3d3d3,
1481
+ lightgreen: 0x90ee90,
1482
+ lightgrey: 0xd3d3d3,
1483
+ lightpink: 0xffb6c1,
1484
+ lightsalmon: 0xffa07a,
1485
+ lightseagreen: 0x20b2aa,
1486
+ lightskyblue: 0x87cefa,
1487
+ lightslategray: 0x778899,
1488
+ lightslategrey: 0x778899,
1489
+ lightsteelblue: 0xb0c4de,
1490
+ lightyellow: 0xffffe0,
1491
+ lime: 0x00ff00,
1492
+ limegreen: 0x32cd32,
1493
+ linen: 0xfaf0e6,
1494
+ magenta: 0xff00ff,
1495
+ maroon: 0x800000,
1496
+ mediumaquamarine: 0x66cdaa,
1497
+ mediumblue: 0x0000cd,
1498
+ mediumorchid: 0xba55d3,
1499
+ mediumpurple: 0x9370db,
1500
+ mediumseagreen: 0x3cb371,
1501
+ mediumslateblue: 0x7b68ee,
1502
+ mediumspringgreen: 0x00fa9a,
1503
+ mediumturquoise: 0x48d1cc,
1504
+ mediumvioletred: 0xc71585,
1505
+ midnightblue: 0x191970,
1506
+ mintcream: 0xf5fffa,
1507
+ mistyrose: 0xffe4e1,
1508
+ moccasin: 0xffe4b5,
1509
+ navajowhite: 0xffdead,
1510
+ navy: 0x000080,
1511
+ oldlace: 0xfdf5e6,
1512
+ olive: 0x808000,
1513
+ olivedrab: 0x6b8e23,
1514
+ orange: 0xffa500,
1515
+ orangered: 0xff4500,
1516
+ orchid: 0xda70d6,
1517
+ palegoldenrod: 0xeee8aa,
1518
+ palegreen: 0x98fb98,
1519
+ paleturquoise: 0xafeeee,
1520
+ palevioletred: 0xdb7093,
1521
+ papayawhip: 0xffefd5,
1522
+ peachpuff: 0xffdab9,
1523
+ peru: 0xcd853f,
1524
+ pink: 0xffc0cb,
1525
+ plum: 0xdda0dd,
1526
+ powderblue: 0xb0e0e6,
1527
+ purple: 0x800080,
1528
+ rebeccapurple: 0x663399,
1529
+ red: 0xff0000,
1530
+ rosybrown: 0xbc8f8f,
1531
+ royalblue: 0x4169e1,
1532
+ saddlebrown: 0x8b4513,
1533
+ salmon: 0xfa8072,
1534
+ sandybrown: 0xf4a460,
1535
+ seagreen: 0x2e8b57,
1536
+ seashell: 0xfff5ee,
1537
+ sienna: 0xa0522d,
1538
+ silver: 0xc0c0c0,
1539
+ skyblue: 0x87ceeb,
1540
+ slateblue: 0x6a5acd,
1541
+ slategray: 0x708090,
1542
+ slategrey: 0x708090,
1543
+ snow: 0xfffafa,
1544
+ springgreen: 0x00ff7f,
1545
+ steelblue: 0x4682b4,
1546
+ tan: 0xd2b48c,
1547
+ teal: 0x008080,
1548
+ thistle: 0xd8bfd8,
1549
+ tomato: 0xff6347,
1550
+ turquoise: 0x40e0d0,
1551
+ violet: 0xee82ee,
1552
+ wheat: 0xf5deb3,
1553
+ white: 0xffffff,
1554
+ whitesmoke: 0xf5f5f5,
1555
+ yellow: 0xffff00,
1556
+ yellowgreen: 0x9acd32
1557
+ };
1558
+
1559
+ define(Color, color, {
1560
+ copy(channels) {
1561
+ return Object.assign(new this.constructor, this, channels);
1562
+ },
1563
+ displayable() {
1564
+ return this.rgb().displayable();
1565
+ },
1566
+ hex: color_formatHex, // Deprecated! Use color.formatHex.
1567
+ formatHex: color_formatHex,
1568
+ formatHex8: color_formatHex8,
1569
+ formatHsl: color_formatHsl,
1570
+ formatRgb: color_formatRgb,
1571
+ toString: color_formatRgb
1572
+ });
1573
+
1574
+ function color_formatHex() {
1575
+ return this.rgb().formatHex();
1576
+ }
1577
+
1578
+ function color_formatHex8() {
1579
+ return this.rgb().formatHex8();
1580
+ }
1581
+
1582
+ function color_formatHsl() {
1583
+ return hslConvert(this).formatHsl();
1584
+ }
1585
+
1586
+ function color_formatRgb() {
1587
+ return this.rgb().formatRgb();
1588
+ }
1589
+
1590
+ function color(format) {
1591
+ var m, l;
1592
+ format = (format + "").trim().toLowerCase();
1593
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
1594
+ : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
1595
+ : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
1596
+ : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
1597
+ : null) // invalid hex
1598
+ : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
1599
+ : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
1600
+ : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
1601
+ : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
1602
+ : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
1603
+ : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
1604
+ : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
1605
+ : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
1606
+ : null;
1607
+ }
1608
+
1609
+ function rgbn(n) {
1610
+ return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
1611
+ }
1612
+
1613
+ function rgba(r, g, b, a) {
1614
+ if (a <= 0) r = g = b = NaN;
1615
+ return new Rgb(r, g, b, a);
1616
+ }
1617
+
1618
+ function rgbConvert(o) {
1619
+ if (!(o instanceof Color)) o = color(o);
1620
+ if (!o) return new Rgb;
1621
+ o = o.rgb();
1622
+ return new Rgb(o.r, o.g, o.b, o.opacity);
1623
+ }
1624
+
1625
+ function rgb$1(r, g, b, opacity) {
1626
+ return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
1627
+ }
1628
+
1629
+ function Rgb(r, g, b, opacity) {
1630
+ this.r = +r;
1631
+ this.g = +g;
1632
+ this.b = +b;
1633
+ this.opacity = +opacity;
1634
+ }
1635
+
1636
+ define(Rgb, rgb$1, extend(Color, {
1637
+ brighter(k) {
1638
+ k = k == null ? brighter : Math.pow(brighter, k);
1639
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
1640
+ },
1641
+ darker(k) {
1642
+ k = k == null ? darker : Math.pow(darker, k);
1643
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
1644
+ },
1645
+ rgb() {
1646
+ return this;
1647
+ },
1648
+ clamp() {
1649
+ return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
1650
+ },
1651
+ displayable() {
1652
+ return (-0.5 <= this.r && this.r < 255.5)
1653
+ && (-0.5 <= this.g && this.g < 255.5)
1654
+ && (-0.5 <= this.b && this.b < 255.5)
1655
+ && (0 <= this.opacity && this.opacity <= 1);
1656
+ },
1657
+ hex: rgb_formatHex, // Deprecated! Use color.formatHex.
1658
+ formatHex: rgb_formatHex,
1659
+ formatHex8: rgb_formatHex8,
1660
+ formatRgb: rgb_formatRgb,
1661
+ toString: rgb_formatRgb
1662
+ }));
1663
+
1664
+ function rgb_formatHex() {
1665
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
1666
+ }
1667
+
1668
+ function rgb_formatHex8() {
1669
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
1670
+ }
1671
+
1672
+ function rgb_formatRgb() {
1673
+ const a = clampa(this.opacity);
1674
+ return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
1675
+ }
1676
+
1677
+ function clampa(opacity) {
1678
+ return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
1679
+ }
1680
+
1681
+ function clampi(value) {
1682
+ return Math.max(0, Math.min(255, Math.round(value) || 0));
1683
+ }
1684
+
1685
+ function hex(value) {
1686
+ value = clampi(value);
1687
+ return (value < 16 ? "0" : "") + value.toString(16);
1688
+ }
1689
+
1690
+ function hsla(h, s, l, a) {
1691
+ if (a <= 0) h = s = l = NaN;
1692
+ else if (l <= 0 || l >= 1) h = s = NaN;
1693
+ else if (s <= 0) h = NaN;
1694
+ return new Hsl(h, s, l, a);
1695
+ }
1696
+
1697
+ function hslConvert(o) {
1698
+ if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
1699
+ if (!(o instanceof Color)) o = color(o);
1700
+ if (!o) return new Hsl;
1701
+ if (o instanceof Hsl) return o;
1702
+ o = o.rgb();
1703
+ var r = o.r / 255,
1704
+ g = o.g / 255,
1705
+ b = o.b / 255,
1706
+ min = Math.min(r, g, b),
1707
+ max = Math.max(r, g, b),
1708
+ h = NaN,
1709
+ s = max - min,
1710
+ l = (max + min) / 2;
1711
+ if (s) {
1712
+ if (r === max) h = (g - b) / s + (g < b) * 6;
1713
+ else if (g === max) h = (b - r) / s + 2;
1714
+ else h = (r - g) / s + 4;
1715
+ s /= l < 0.5 ? max + min : 2 - max - min;
1716
+ h *= 60;
1717
+ } else {
1718
+ s = l > 0 && l < 1 ? 0 : h;
1719
+ }
1720
+ return new Hsl(h, s, l, o.opacity);
1721
+ }
1722
+
1723
+ function hsl(h, s, l, opacity) {
1724
+ return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
1725
+ }
1726
+
1727
+ function Hsl(h, s, l, opacity) {
1728
+ this.h = +h;
1729
+ this.s = +s;
1730
+ this.l = +l;
1731
+ this.opacity = +opacity;
1732
+ }
1733
+
1734
+ define(Hsl, hsl, extend(Color, {
1735
+ brighter(k) {
1736
+ k = k == null ? brighter : Math.pow(brighter, k);
1737
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
1738
+ },
1739
+ darker(k) {
1740
+ k = k == null ? darker : Math.pow(darker, k);
1741
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
1742
+ },
1743
+ rgb() {
1744
+ var h = this.h % 360 + (this.h < 0) * 360,
1745
+ s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
1746
+ l = this.l,
1747
+ m2 = l + (l < 0.5 ? l : 1 - l) * s,
1748
+ m1 = 2 * l - m2;
1749
+ return new Rgb(
1750
+ hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
1751
+ hsl2rgb(h, m1, m2),
1752
+ hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
1753
+ this.opacity
1754
+ );
1755
+ },
1756
+ clamp() {
1757
+ return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
1758
+ },
1759
+ displayable() {
1760
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s))
1761
+ && (0 <= this.l && this.l <= 1)
1762
+ && (0 <= this.opacity && this.opacity <= 1);
1763
+ },
1764
+ formatHsl() {
1765
+ const a = clampa(this.opacity);
1766
+ return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
1767
+ }
1768
+ }));
1769
+
1770
+ function clamph(value) {
1771
+ value = (value || 0) % 360;
1772
+ return value < 0 ? value + 360 : value;
1773
+ }
1774
+
1775
+ function clampt(value) {
1776
+ return Math.max(0, Math.min(1, value || 0));
1777
+ }
1778
+
1779
+ /* From FvD 13.37, CSS Color Module Level 3 */
1780
+ function hsl2rgb(h, m1, m2) {
1781
+ return (h < 60 ? m1 + (m2 - m1) * h / 60
1782
+ : h < 180 ? m2
1783
+ : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
1784
+ : m1) * 255;
1785
+ }
1786
+
1787
+ const radians = Math.PI / 180;
1788
+ const degrees = 180 / Math.PI;
1789
+
1790
+ // https://observablehq.com/@mbostock/lab-and-rgb
1791
+ const K = 18,
1792
+ Xn = 0.96422,
1793
+ Yn = 1,
1794
+ Zn = 0.82521,
1795
+ t0$1 = 4 / 29,
1796
+ t1$1 = 6 / 29,
1797
+ t2 = 3 * t1$1 * t1$1,
1798
+ t3 = t1$1 * t1$1 * t1$1;
1799
+
1800
+ function labConvert(o) {
1801
+ if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
1802
+ if (o instanceof Hcl) return hcl2lab(o);
1803
+ if (!(o instanceof Rgb)) o = rgbConvert(o);
1804
+ var r = rgb2lrgb(o.r),
1805
+ g = rgb2lrgb(o.g),
1806
+ b = rgb2lrgb(o.b),
1807
+ y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
1808
+ if (r === g && g === b) x = z = y; else {
1809
+ x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
1810
+ z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
1811
+ }
1812
+ return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
1813
+ }
1814
+
1815
+ function lab(l, a, b, opacity) {
1816
+ return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
1817
+ }
1818
+
1819
+ function Lab(l, a, b, opacity) {
1820
+ this.l = +l;
1821
+ this.a = +a;
1822
+ this.b = +b;
1823
+ this.opacity = +opacity;
1824
+ }
1825
+
1826
+ define(Lab, lab, extend(Color, {
1827
+ brighter(k) {
1828
+ return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
1829
+ },
1830
+ darker(k) {
1831
+ return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
1832
+ },
1833
+ rgb() {
1834
+ var y = (this.l + 16) / 116,
1835
+ x = isNaN(this.a) ? y : y + this.a / 500,
1836
+ z = isNaN(this.b) ? y : y - this.b / 200;
1837
+ x = Xn * lab2xyz(x);
1838
+ y = Yn * lab2xyz(y);
1839
+ z = Zn * lab2xyz(z);
1840
+ return new Rgb(
1841
+ lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
1842
+ lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
1843
+ lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
1844
+ this.opacity
1845
+ );
1846
+ }
1847
+ }));
1848
+
1849
+ function xyz2lab(t) {
1850
+ return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$1;
1851
+ }
1852
+
1853
+ function lab2xyz(t) {
1854
+ return t > t1$1 ? t * t * t : t2 * (t - t0$1);
1855
+ }
1856
+
1857
+ function lrgb2rgb(x) {
1858
+ return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
1859
+ }
1860
+
1861
+ function rgb2lrgb(x) {
1862
+ return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
1863
+ }
1864
+
1865
+ function hclConvert(o) {
1866
+ if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
1867
+ if (!(o instanceof Lab)) o = labConvert(o);
1868
+ if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
1869
+ var h = Math.atan2(o.b, o.a) * degrees;
1870
+ return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
1871
+ }
1872
+
1873
+ function hcl(h, c, l, opacity) {
1874
+ return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
1875
+ }
1876
+
1877
+ function Hcl(h, c, l, opacity) {
1878
+ this.h = +h;
1879
+ this.c = +c;
1880
+ this.l = +l;
1881
+ this.opacity = +opacity;
1882
+ }
1883
+
1884
+ function hcl2lab(o) {
1885
+ if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
1886
+ var h = o.h * radians;
1887
+ return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
1888
+ }
1889
+
1890
+ define(Hcl, hcl, extend(Color, {
1891
+ brighter(k) {
1892
+ return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
1893
+ },
1894
+ darker(k) {
1895
+ return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
1896
+ },
1897
+ rgb() {
1898
+ return hcl2lab(this).rgb();
1899
+ }
1900
+ }));
1901
+
1902
+ var A = -0.14861,
1903
+ B = +1.78277,
1904
+ C = -0.29227,
1905
+ D = -0.90649,
1906
+ E = +1.97294,
1907
+ ED = E * D,
1908
+ EB = E * B,
1909
+ BC_DA = B * C - D * A;
1910
+
1911
+ function cubehelixConvert(o) {
1912
+ if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
1913
+ if (!(o instanceof Rgb)) o = rgbConvert(o);
1914
+ var r = o.r / 255,
1915
+ g = o.g / 255,
1916
+ b = o.b / 255,
1917
+ l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
1918
+ bl = b - l,
1919
+ k = (E * (g - l) - C * bl) / D,
1920
+ s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
1921
+ h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;
1922
+ return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
1923
+ }
1924
+
1925
+ function cubehelix$1(h, s, l, opacity) {
1926
+ return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
1927
+ }
1928
+
1929
+ function Cubehelix(h, s, l, opacity) {
1930
+ this.h = +h;
1931
+ this.s = +s;
1932
+ this.l = +l;
1933
+ this.opacity = +opacity;
1934
+ }
1935
+
1936
+ define(Cubehelix, cubehelix$1, extend(Color, {
1937
+ brighter(k) {
1938
+ k = k == null ? brighter : Math.pow(brighter, k);
1939
+ return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
1940
+ },
1941
+ darker(k) {
1942
+ k = k == null ? darker : Math.pow(darker, k);
1943
+ return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
1944
+ },
1945
+ rgb() {
1946
+ var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,
1947
+ l = +this.l,
1948
+ a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
1949
+ cosh = Math.cos(h),
1950
+ sinh = Math.sin(h);
1951
+ return new Rgb(
1952
+ 255 * (l + a * (A * cosh + B * sinh)),
1953
+ 255 * (l + a * (C * cosh + D * sinh)),
1954
+ 255 * (l + a * (E * cosh)),
1955
+ this.opacity
1956
+ );
1957
+ }
1958
+ }));
1959
+
1960
+ var constant = x => () => x;
1961
+
1962
+ function linear$1(a, d) {
1963
+ return function(t) {
1964
+ return a + t * d;
1965
+ };
1966
+ }
1967
+
1968
+ function exponential(a, b, y) {
1969
+ return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
1970
+ return Math.pow(a + t * b, y);
1971
+ };
1972
+ }
1973
+
1974
+ function hue(a, b) {
1975
+ var d = b - a;
1976
+ return d ? linear$1(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);
1977
+ }
1978
+
1979
+ function gamma(y) {
1980
+ return (y = +y) === 1 ? nogamma : function(a, b) {
1981
+ return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
1982
+ };
1983
+ }
1984
+
1985
+ function nogamma(a, b) {
1986
+ var d = b - a;
1987
+ return d ? linear$1(a, d) : constant(isNaN(a) ? b : a);
1988
+ }
1989
+
1990
+ var rgb = (function rgbGamma(y) {
1991
+ var color = gamma(y);
1992
+
1993
+ function rgb(start, end) {
1994
+ var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r),
1995
+ g = color(start.g, end.g),
1996
+ b = color(start.b, end.b),
1997
+ opacity = nogamma(start.opacity, end.opacity);
1998
+ return function(t) {
1999
+ start.r = r(t);
2000
+ start.g = g(t);
2001
+ start.b = b(t);
2002
+ start.opacity = opacity(t);
2003
+ return start + "";
2004
+ };
2005
+ }
2006
+
2007
+ rgb.gamma = rgbGamma;
2008
+
2009
+ return rgb;
2010
+ })(1);
2011
+
2012
+ function numberArray(a, b) {
2013
+ if (!b) b = [];
2014
+ var n = a ? Math.min(b.length, a.length) : 0,
2015
+ c = b.slice(),
2016
+ i;
2017
+ return function(t) {
2018
+ for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
2019
+ return c;
2020
+ };
2021
+ }
2022
+
2023
+ function isNumberArray(x) {
2024
+ return ArrayBuffer.isView(x) && !(x instanceof DataView);
2025
+ }
2026
+
2027
+ function genericArray(a, b) {
2028
+ var nb = b ? b.length : 0,
2029
+ na = a ? Math.min(nb, a.length) : 0,
2030
+ x = new Array(na),
2031
+ c = new Array(nb),
2032
+ i;
2033
+
2034
+ for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]);
2035
+ for (; i < nb; ++i) c[i] = b[i];
2036
+
2037
+ return function(t) {
2038
+ for (i = 0; i < na; ++i) c[i] = x[i](t);
2039
+ return c;
2040
+ };
2041
+ }
2042
+
2043
+ function date(a, b) {
2044
+ var d = new Date;
2045
+ return a = +a, b = +b, function(t) {
2046
+ return d.setTime(a * (1 - t) + b * t), d;
2047
+ };
2048
+ }
2049
+
2050
+ function interpolateNumber(a, b) {
2051
+ return a = +a, b = +b, function(t) {
2052
+ return a * (1 - t) + b * t;
2053
+ };
2054
+ }
2055
+
2056
+ function object(a, b) {
2057
+ var i = {},
2058
+ c = {},
2059
+ k;
2060
+
2061
+ if (a === null || typeof a !== "object") a = {};
2062
+ if (b === null || typeof b !== "object") b = {};
2063
+
2064
+ for (k in b) {
2065
+ if (k in a) {
2066
+ i[k] = interpolate(a[k], b[k]);
2067
+ } else {
2068
+ c[k] = b[k];
2069
+ }
2070
+ }
2071
+
2072
+ return function(t) {
2073
+ for (k in i) c[k] = i[k](t);
2074
+ return c;
2075
+ };
2076
+ }
2077
+
2078
+ var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
2079
+ reB = new RegExp(reA.source, "g");
2080
+
2081
+ function zero(b) {
2082
+ return function() {
2083
+ return b;
2084
+ };
2085
+ }
2086
+
2087
+ function one(b) {
2088
+ return function(t) {
2089
+ return b(t) + "";
2090
+ };
2091
+ }
2092
+
2093
+ function string(a, b) {
2094
+ var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
2095
+ am, // current match in a
2096
+ bm, // current match in b
2097
+ bs, // string preceding current number in b, if any
2098
+ i = -1, // index in s
2099
+ s = [], // string constants and placeholders
2100
+ q = []; // number interpolators
2101
+
2102
+ // Coerce inputs to strings.
2103
+ a = a + "", b = b + "";
2104
+
2105
+ // Interpolate pairs of numbers in a & b.
2106
+ while ((am = reA.exec(a))
2107
+ && (bm = reB.exec(b))) {
2108
+ if ((bs = bm.index) > bi) { // a string precedes the next number in b
2109
+ bs = b.slice(bi, bs);
2110
+ if (s[i]) s[i] += bs; // coalesce with previous string
2111
+ else s[++i] = bs;
2112
+ }
2113
+ if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
2114
+ if (s[i]) s[i] += bm; // coalesce with previous string
2115
+ else s[++i] = bm;
2116
+ } else { // interpolate non-matching numbers
2117
+ s[++i] = null;
2118
+ q.push({i: i, x: interpolateNumber(am, bm)});
2119
+ }
2120
+ bi = reB.lastIndex;
2121
+ }
2122
+
2123
+ // Add remains of b.
2124
+ if (bi < b.length) {
2125
+ bs = b.slice(bi);
2126
+ if (s[i]) s[i] += bs; // coalesce with previous string
2127
+ else s[++i] = bs;
2128
+ }
2129
+
2130
+ // Special optimization for only a single match.
2131
+ // Otherwise, interpolate each of the numbers and rejoin the string.
2132
+ return s.length < 2 ? (q[0]
2133
+ ? one(q[0].x)
2134
+ : zero(b))
2135
+ : (b = q.length, function(t) {
2136
+ for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
2137
+ return s.join("");
2138
+ });
2139
+ }
2140
+
2141
+ function interpolate(a, b) {
2142
+ var t = typeof b, c;
2143
+ return b == null || t === "boolean" ? constant(b)
2144
+ : (t === "number" ? interpolateNumber
2145
+ : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string)
2146
+ : b instanceof color ? rgb
2147
+ : b instanceof Date ? date
2148
+ : isNumberArray(b) ? numberArray
2149
+ : Array.isArray(b) ? genericArray
2150
+ : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
2151
+ : interpolateNumber)(a, b);
2152
+ }
2153
+
2154
+ function interpolateRound(a, b) {
2155
+ return a = +a, b = +b, function(t) {
2156
+ return Math.round(a * (1 - t) + b * t);
2157
+ };
2158
+ }
2159
+
2160
+ var epsilon2 = 1e-12;
2161
+
2162
+ function cosh(x) {
2163
+ return ((x = Math.exp(x)) + 1 / x) / 2;
2164
+ }
2165
+
2166
+ function sinh(x) {
2167
+ return ((x = Math.exp(x)) - 1 / x) / 2;
2168
+ }
2169
+
2170
+ function tanh(x) {
2171
+ return ((x = Math.exp(2 * x)) - 1) / (x + 1);
2172
+ }
2173
+
2174
+ ((function zoomRho(rho, rho2, rho4) {
2175
+
2176
+ // p0 = [ux0, uy0, w0]
2177
+ // p1 = [ux1, uy1, w1]
2178
+ function zoom(p0, p1) {
2179
+ var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
2180
+ ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
2181
+ dx = ux1 - ux0,
2182
+ dy = uy1 - uy0,
2183
+ d2 = dx * dx + dy * dy,
2184
+ i,
2185
+ S;
2186
+
2187
+ // Special case for u0 ≅ u1.
2188
+ if (d2 < epsilon2) {
2189
+ S = Math.log(w1 / w0) / rho;
2190
+ i = function(t) {
2191
+ return [
2192
+ ux0 + t * dx,
2193
+ uy0 + t * dy,
2194
+ w0 * Math.exp(rho * t * S)
2195
+ ];
2196
+ };
2197
+ }
2198
+
2199
+ // General case.
2200
+ else {
2201
+ var d1 = Math.sqrt(d2),
2202
+ b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
2203
+ b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
2204
+ r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
2205
+ r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
2206
+ S = (r1 - r0) / rho;
2207
+ i = function(t) {
2208
+ var s = t * S,
2209
+ coshr0 = cosh(r0),
2210
+ u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
2211
+ return [
2212
+ ux0 + u * dx,
2213
+ uy0 + u * dy,
2214
+ w0 * coshr0 / cosh(rho * s + r0)
2215
+ ];
2216
+ };
2217
+ }
2218
+
2219
+ i.duration = S * 1000 * rho / Math.SQRT2;
2220
+
2221
+ return i;
2222
+ }
2223
+
2224
+ zoom.rho = function(_) {
2225
+ var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
2226
+ return zoomRho(_1, _2, _4);
2227
+ };
2228
+
2229
+ return zoom;
2230
+ }))(Math.SQRT2, 2, 4);
2231
+
2232
+ function cubehelix(hue) {
2233
+ return (function cubehelixGamma(y) {
2234
+ y = +y;
2235
+
2236
+ function cubehelix(start, end) {
2237
+ var h = hue((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h),
2238
+ s = nogamma(start.s, end.s),
2239
+ l = nogamma(start.l, end.l),
2240
+ opacity = nogamma(start.opacity, end.opacity);
2241
+ return function(t) {
2242
+ start.h = h(t);
2243
+ start.s = s(t);
2244
+ start.l = l(Math.pow(t, y));
2245
+ start.opacity = opacity(t);
2246
+ return start + "";
2247
+ };
2248
+ }
2249
+
2250
+ cubehelix.gamma = cubehelixGamma;
2251
+
2252
+ return cubehelix;
2253
+ })(1);
2254
+ }
2255
+
2256
+ cubehelix(hue);
2257
+ cubehelix(nogamma);
2258
+
2259
+ function constants(x) {
2260
+ return function() {
2261
+ return x;
2262
+ };
2263
+ }
2264
+
2265
+ function number(x) {
2266
+ return +x;
2267
+ }
2268
+
2269
+ var unit = [0, 1];
2270
+
2271
+ function identity$1(x) {
2272
+ return x;
2273
+ }
2274
+
2275
+ function normalize(a, b) {
2276
+ return (b -= (a = +a))
2277
+ ? function(x) { return (x - a) / b; }
2278
+ : constants(isNaN(b) ? NaN : 0.5);
2279
+ }
2280
+
2281
+ function clamper(a, b) {
2282
+ var t;
2283
+ if (a > b) t = a, a = b, b = t;
2284
+ return function(x) { return Math.max(a, Math.min(b, x)); };
2285
+ }
2286
+
2287
+ // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
2288
+ // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
2289
+ function bimap(domain, range, interpolate) {
2290
+ var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
2291
+ if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
2292
+ else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
2293
+ return function(x) { return r0(d0(x)); };
2294
+ }
2295
+
2296
+ function polymap(domain, range, interpolate) {
2297
+ var j = Math.min(domain.length, range.length) - 1,
2298
+ d = new Array(j),
2299
+ r = new Array(j),
2300
+ i = -1;
2301
+
2302
+ // Reverse descending domains.
2303
+ if (domain[j] < domain[0]) {
2304
+ domain = domain.slice().reverse();
2305
+ range = range.slice().reverse();
2306
+ }
2307
+
2308
+ while (++i < j) {
2309
+ d[i] = normalize(domain[i], domain[i + 1]);
2310
+ r[i] = interpolate(range[i], range[i + 1]);
2311
+ }
2312
+
2313
+ return function(x) {
2314
+ var i = bisectRight(domain, x, 1, j) - 1;
2315
+ return r[i](d[i](x));
2316
+ };
2317
+ }
2318
+
2319
+ function copy$1(source, target) {
2320
+ return target
2321
+ .domain(source.domain())
2322
+ .range(source.range())
2323
+ .interpolate(source.interpolate())
2324
+ .clamp(source.clamp())
2325
+ .unknown(source.unknown());
2326
+ }
2327
+
2328
+ function transformer$1() {
2329
+ var domain = unit,
2330
+ range = unit,
2331
+ interpolate$1 = interpolate,
2332
+ transform,
2333
+ untransform,
2334
+ unknown,
2335
+ clamp = identity$1,
2336
+ piecewise,
2337
+ output,
2338
+ input;
2339
+
2340
+ function rescale() {
2341
+ var n = Math.min(domain.length, range.length);
2342
+ if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]);
2343
+ piecewise = n > 2 ? polymap : bimap;
2344
+ output = input = null;
2345
+ return scale;
2346
+ }
2347
+
2348
+ function scale(x) {
2349
+ return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x)));
2350
+ }
2351
+
2352
+ scale.invert = function(y) {
2353
+ return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
2354
+ };
2355
+
2356
+ scale.domain = function(_) {
2357
+ return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
2358
+ };
2359
+
2360
+ scale.range = function(_) {
2361
+ return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
2362
+ };
2363
+
2364
+ scale.rangeRound = function(_) {
2365
+ return range = Array.from(_), interpolate$1 = interpolateRound, rescale();
2366
+ };
2367
+
2368
+ scale.clamp = function(_) {
2369
+ return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1;
2370
+ };
2371
+
2372
+ scale.interpolate = function(_) {
2373
+ return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1;
2374
+ };
2375
+
2376
+ scale.unknown = function(_) {
2377
+ return arguments.length ? (unknown = _, scale) : unknown;
2378
+ };
2379
+
2380
+ return function(t, u) {
2381
+ transform = t, untransform = u;
2382
+ return rescale();
2383
+ };
2384
+ }
2385
+
2386
+ function continuous() {
2387
+ return transformer$1()(identity$1, identity$1);
2388
+ }
2389
+
2390
+ function formatDecimal(x) {
2391
+ return Math.abs(x = Math.round(x)) >= 1e21
2392
+ ? x.toLocaleString("en").replace(/,/g, "")
2393
+ : x.toString(10);
2394
+ }
2395
+
2396
+ // Computes the decimal coefficient and exponent of the specified number x with
2397
+ // significant digits p, where x is positive and p is in [1, 21] or undefined.
2398
+ // For example, formatDecimalParts(1.23) returns ["123", 0].
2399
+ function formatDecimalParts(x, p) {
2400
+ if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
2401
+ var i, coefficient = x.slice(0, i);
2402
+
2403
+ // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
2404
+ // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
2405
+ return [
2406
+ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
2407
+ +x.slice(i + 1)
2408
+ ];
2409
+ }
2410
+
2411
+ function exponent(x) {
2412
+ return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
2413
+ }
2414
+
2415
+ function formatGroup(grouping, thousands) {
2416
+ return function(value, width) {
2417
+ var i = value.length,
2418
+ t = [],
2419
+ j = 0,
2420
+ g = grouping[0],
2421
+ length = 0;
2422
+
2423
+ while (i > 0 && g > 0) {
2424
+ if (length + g + 1 > width) g = Math.max(1, width - length);
2425
+ t.push(value.substring(i -= g, i + g));
2426
+ if ((length += g + 1) > width) break;
2427
+ g = grouping[j = (j + 1) % grouping.length];
2428
+ }
2429
+
2430
+ return t.reverse().join(thousands);
2431
+ };
2432
+ }
2433
+
2434
+ function formatNumerals(numerals) {
2435
+ return function(value) {
2436
+ return value.replace(/[0-9]/g, function(i) {
2437
+ return numerals[+i];
2438
+ });
2439
+ };
2440
+ }
2441
+
2442
+ // [[fill]align][sign][symbol][0][width][,][.precision][~][type]
2443
+ var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
2444
+
2445
+ function formatSpecifier(specifier) {
2446
+ if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
2447
+ var match;
2448
+ return new FormatSpecifier({
2449
+ fill: match[1],
2450
+ align: match[2],
2451
+ sign: match[3],
2452
+ symbol: match[4],
2453
+ zero: match[5],
2454
+ width: match[6],
2455
+ comma: match[7],
2456
+ precision: match[8] && match[8].slice(1),
2457
+ trim: match[9],
2458
+ type: match[10]
2459
+ });
2460
+ }
2461
+
2462
+ formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
2463
+
2464
+ function FormatSpecifier(specifier) {
2465
+ this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
2466
+ this.align = specifier.align === undefined ? ">" : specifier.align + "";
2467
+ this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
2468
+ this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
2469
+ this.zero = !!specifier.zero;
2470
+ this.width = specifier.width === undefined ? undefined : +specifier.width;
2471
+ this.comma = !!specifier.comma;
2472
+ this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
2473
+ this.trim = !!specifier.trim;
2474
+ this.type = specifier.type === undefined ? "" : specifier.type + "";
2475
+ }
2476
+
2477
+ FormatSpecifier.prototype.toString = function() {
2478
+ return this.fill
2479
+ + this.align
2480
+ + this.sign
2481
+ + this.symbol
2482
+ + (this.zero ? "0" : "")
2483
+ + (this.width === undefined ? "" : Math.max(1, this.width | 0))
2484
+ + (this.comma ? "," : "")
2485
+ + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
2486
+ + (this.trim ? "~" : "")
2487
+ + this.type;
2488
+ };
2489
+
2490
+ // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
2491
+ function formatTrim(s) {
2492
+ out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
2493
+ switch (s[i]) {
2494
+ case ".": i0 = i1 = i; break;
2495
+ case "0": if (i0 === 0) i0 = i; i1 = i; break;
2496
+ default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
2497
+ }
2498
+ }
2499
+ return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
2500
+ }
2501
+
2502
+ var prefixExponent;
2503
+
2504
+ function formatPrefixAuto(x, p) {
2505
+ var d = formatDecimalParts(x, p);
2506
+ if (!d) return x + "";
2507
+ var coefficient = d[0],
2508
+ exponent = d[1],
2509
+ i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
2510
+ n = coefficient.length;
2511
+ return i === n ? coefficient
2512
+ : i > n ? coefficient + new Array(i - n + 1).join("0")
2513
+ : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
2514
+ : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
2515
+ }
2516
+
2517
+ function formatRounded(x, p) {
2518
+ var d = formatDecimalParts(x, p);
2519
+ if (!d) return x + "";
2520
+ var coefficient = d[0],
2521
+ exponent = d[1];
2522
+ return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
2523
+ : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
2524
+ : coefficient + new Array(exponent - coefficient.length + 2).join("0");
2525
+ }
2526
+
2527
+ var formatTypes = {
2528
+ "%": (x, p) => (x * 100).toFixed(p),
2529
+ "b": (x) => Math.round(x).toString(2),
2530
+ "c": (x) => x + "",
2531
+ "d": formatDecimal,
2532
+ "e": (x, p) => x.toExponential(p),
2533
+ "f": (x, p) => x.toFixed(p),
2534
+ "g": (x, p) => x.toPrecision(p),
2535
+ "o": (x) => Math.round(x).toString(8),
2536
+ "p": (x, p) => formatRounded(x * 100, p),
2537
+ "r": formatRounded,
2538
+ "s": formatPrefixAuto,
2539
+ "X": (x) => Math.round(x).toString(16).toUpperCase(),
2540
+ "x": (x) => Math.round(x).toString(16)
2541
+ };
2542
+
2543
+ function identity(x) {
2544
+ return x;
2545
+ }
2546
+
2547
+ var map = Array.prototype.map,
2548
+ prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
2549
+
2550
+ function formatLocale$1(locale) {
2551
+ var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
2552
+ currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
2553
+ currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
2554
+ decimal = locale.decimal === undefined ? "." : locale.decimal + "",
2555
+ numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
2556
+ percent = locale.percent === undefined ? "%" : locale.percent + "",
2557
+ minus = locale.minus === undefined ? "−" : locale.minus + "",
2558
+ nan = locale.nan === undefined ? "NaN" : locale.nan + "";
2559
+
2560
+ function newFormat(specifier) {
2561
+ specifier = formatSpecifier(specifier);
2562
+
2563
+ var fill = specifier.fill,
2564
+ align = specifier.align,
2565
+ sign = specifier.sign,
2566
+ symbol = specifier.symbol,
2567
+ zero = specifier.zero,
2568
+ width = specifier.width,
2569
+ comma = specifier.comma,
2570
+ precision = specifier.precision,
2571
+ trim = specifier.trim,
2572
+ type = specifier.type;
2573
+
2574
+ // The "n" type is an alias for ",g".
2575
+ if (type === "n") comma = true, type = "g";
2576
+
2577
+ // The "" type, and any invalid type, is an alias for ".12~g".
2578
+ else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
2579
+
2580
+ // If zero fill is specified, padding goes after sign and before digits.
2581
+ if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
2582
+
2583
+ // Compute the prefix and suffix.
2584
+ // For SI-prefix, the suffix is lazily computed.
2585
+ var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
2586
+ suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
2587
+
2588
+ // What format function should we use?
2589
+ // Is this an integer type?
2590
+ // Can this type generate exponential notation?
2591
+ var formatType = formatTypes[type],
2592
+ maybeSuffix = /[defgprs%]/.test(type);
2593
+
2594
+ // Set the default precision if not specified,
2595
+ // or clamp the specified precision to the supported range.
2596
+ // For significant precision, it must be in [1, 21].
2597
+ // For fixed precision, it must be in [0, 20].
2598
+ precision = precision === undefined ? 6
2599
+ : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
2600
+ : Math.max(0, Math.min(20, precision));
2601
+
2602
+ function format(value) {
2603
+ var valuePrefix = prefix,
2604
+ valueSuffix = suffix,
2605
+ i, n, c;
2606
+
2607
+ if (type === "c") {
2608
+ valueSuffix = formatType(value) + valueSuffix;
2609
+ value = "";
2610
+ } else {
2611
+ value = +value;
2612
+
2613
+ // Determine the sign. -0 is not less than 0, but 1 / -0 is!
2614
+ var valueNegative = value < 0 || 1 / value < 0;
2615
+
2616
+ // Perform the initial formatting.
2617
+ value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
2618
+
2619
+ // Trim insignificant zeros.
2620
+ if (trim) value = formatTrim(value);
2621
+
2622
+ // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
2623
+ if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
2624
+
2625
+ // Compute the prefix and suffix.
2626
+ valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
2627
+ valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
2628
+
2629
+ // Break the formatted value into the integer “value” part that can be
2630
+ // grouped, and fractional or exponential “suffix” part that is not.
2631
+ if (maybeSuffix) {
2632
+ i = -1, n = value.length;
2633
+ while (++i < n) {
2634
+ if (c = value.charCodeAt(i), 48 > c || c > 57) {
2635
+ valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
2636
+ value = value.slice(0, i);
2637
+ break;
2638
+ }
2639
+ }
2640
+ }
2641
+ }
2642
+
2643
+ // If the fill character is not "0", grouping is applied before padding.
2644
+ if (comma && !zero) value = group(value, Infinity);
2645
+
2646
+ // Compute the padding.
2647
+ var length = valuePrefix.length + value.length + valueSuffix.length,
2648
+ padding = length < width ? new Array(width - length + 1).join(fill) : "";
2649
+
2650
+ // If the fill character is "0", grouping is applied after padding.
2651
+ if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
2652
+
2653
+ // Reconstruct the final output based on the desired alignment.
2654
+ switch (align) {
2655
+ case "<": value = valuePrefix + value + valueSuffix + padding; break;
2656
+ case "=": value = valuePrefix + padding + value + valueSuffix; break;
2657
+ case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
2658
+ default: value = padding + valuePrefix + value + valueSuffix; break;
2659
+ }
2660
+
2661
+ return numerals(value);
2662
+ }
2663
+
2664
+ format.toString = function() {
2665
+ return specifier + "";
2666
+ };
2667
+
2668
+ return format;
2669
+ }
2670
+
2671
+ function formatPrefix(specifier, value) {
2672
+ var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
2673
+ e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
2674
+ k = Math.pow(10, -e),
2675
+ prefix = prefixes[8 + e / 3];
2676
+ return function(value) {
2677
+ return f(k * value) + prefix;
2678
+ };
2679
+ }
2680
+
2681
+ return {
2682
+ format: newFormat,
2683
+ formatPrefix: formatPrefix
2684
+ };
2685
+ }
2686
+
2687
+ var locale$1;
2688
+ var format;
2689
+ var formatPrefix;
2690
+
2691
+ defaultLocale$1({
2692
+ thousands: ",",
2693
+ grouping: [3],
2694
+ currency: ["$", ""]
2695
+ });
2696
+
2697
+ function defaultLocale$1(definition) {
2698
+ locale$1 = formatLocale$1(definition);
2699
+ format = locale$1.format;
2700
+ formatPrefix = locale$1.formatPrefix;
2701
+ return locale$1;
2702
+ }
2703
+
2704
+ function precisionFixed(step) {
2705
+ return Math.max(0, -exponent(Math.abs(step)));
2706
+ }
2707
+
2708
+ function precisionPrefix(step, value) {
2709
+ return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
2710
+ }
2711
+
2712
+ function precisionRound(step, max) {
2713
+ step = Math.abs(step), max = Math.abs(max) - step;
2714
+ return Math.max(0, exponent(max) - exponent(step)) + 1;
2715
+ }
2716
+
2717
+ function tickFormat(start, stop, count, specifier) {
2718
+ var step = tickStep(start, stop, count),
2719
+ precision;
2720
+ specifier = formatSpecifier(specifier == null ? ",f" : specifier);
2721
+ switch (specifier.type) {
2722
+ case "s": {
2723
+ var value = Math.max(Math.abs(start), Math.abs(stop));
2724
+ if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
2725
+ return formatPrefix(specifier, value);
2726
+ }
2727
+ case "":
2728
+ case "e":
2729
+ case "g":
2730
+ case "p":
2731
+ case "r": {
2732
+ if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
2733
+ break;
2734
+ }
2735
+ case "f":
2736
+ case "%": {
2737
+ if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
2738
+ break;
2739
+ }
2740
+ }
2741
+ return format(specifier);
2742
+ }
2743
+
2744
+ function linearish(scale) {
2745
+ var domain = scale.domain;
2746
+
2747
+ scale.ticks = function(count) {
2748
+ var d = domain();
2749
+ return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
2750
+ };
2751
+
2752
+ scale.tickFormat = function(count, specifier) {
2753
+ var d = domain();
2754
+ return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
2755
+ };
2756
+
2757
+ scale.nice = function(count) {
2758
+ if (count == null) count = 10;
2759
+
2760
+ var d = domain();
2761
+ var i0 = 0;
2762
+ var i1 = d.length - 1;
2763
+ var start = d[i0];
2764
+ var stop = d[i1];
2765
+ var prestep;
2766
+ var step;
2767
+ var maxIter = 10;
2768
+
2769
+ if (stop < start) {
2770
+ step = start, start = stop, stop = step;
2771
+ step = i0, i0 = i1, i1 = step;
2772
+ }
2773
+
2774
+ while (maxIter-- > 0) {
2775
+ step = tickIncrement(start, stop, count);
2776
+ if (step === prestep) {
2777
+ d[i0] = start;
2778
+ d[i1] = stop;
2779
+ return domain(d);
2780
+ } else if (step > 0) {
2781
+ start = Math.floor(start / step) * step;
2782
+ stop = Math.ceil(stop / step) * step;
2783
+ } else if (step < 0) {
2784
+ start = Math.ceil(start * step) / step;
2785
+ stop = Math.floor(stop * step) / step;
2786
+ } else {
2787
+ break;
2788
+ }
2789
+ prestep = step;
2790
+ }
2791
+
2792
+ return scale;
2793
+ };
2794
+
2795
+ return scale;
2796
+ }
2797
+
2798
+ function linear() {
2799
+ var scale = continuous();
2800
+
2801
+ scale.copy = function() {
2802
+ return copy$1(scale, linear());
2803
+ };
2804
+
2805
+ initRange.apply(scale, arguments);
2806
+
2807
+ return linearish(scale);
2808
+ }
2809
+
2810
+ var t0 = new Date,
2811
+ t1 = new Date;
2812
+
2813
+ function newInterval(floori, offseti, count, field) {
2814
+
2815
+ function interval(date) {
2816
+ return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
2817
+ }
2818
+
2819
+ interval.floor = function(date) {
2820
+ return floori(date = new Date(+date)), date;
2821
+ };
2822
+
2823
+ interval.ceil = function(date) {
2824
+ return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
2825
+ };
2826
+
2827
+ interval.round = function(date) {
2828
+ var d0 = interval(date),
2829
+ d1 = interval.ceil(date);
2830
+ return date - d0 < d1 - date ? d0 : d1;
2831
+ };
2832
+
2833
+ interval.offset = function(date, step) {
2834
+ return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
2835
+ };
2836
+
2837
+ interval.range = function(start, stop, step) {
2838
+ var range = [], previous;
2839
+ start = interval.ceil(start);
2840
+ step = step == null ? 1 : Math.floor(step);
2841
+ if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
2842
+ do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
2843
+ while (previous < start && start < stop);
2844
+ return range;
2845
+ };
2846
+
2847
+ interval.filter = function(test) {
2848
+ return newInterval(function(date) {
2849
+ if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
2850
+ }, function(date, step) {
2851
+ if (date >= date) {
2852
+ if (step < 0) while (++step <= 0) {
2853
+ while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
2854
+ } else while (--step >= 0) {
2855
+ while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
2856
+ }
2857
+ }
2858
+ });
2859
+ };
2860
+
2861
+ if (count) {
2862
+ interval.count = function(start, end) {
2863
+ t0.setTime(+start), t1.setTime(+end);
2864
+ floori(t0), floori(t1);
2865
+ return Math.floor(count(t0, t1));
2866
+ };
2867
+
2868
+ interval.every = function(step) {
2869
+ step = Math.floor(step);
2870
+ return !isFinite(step) || !(step > 0) ? null
2871
+ : !(step > 1) ? interval
2872
+ : interval.filter(field
2873
+ ? function(d) { return field(d) % step === 0; }
2874
+ : function(d) { return interval.count(0, d) % step === 0; });
2875
+ };
2876
+ }
2877
+
2878
+ return interval;
2879
+ }
2880
+
2881
+ var millisecond = newInterval(function() {
2882
+ // noop
2883
+ }, function(date, step) {
2884
+ date.setTime(+date + step);
2885
+ }, function(start, end) {
2886
+ return end - start;
2887
+ });
2888
+
2889
+ // An optimized implementation for this simple case.
2890
+ millisecond.every = function(k) {
2891
+ k = Math.floor(k);
2892
+ if (!isFinite(k) || !(k > 0)) return null;
2893
+ if (!(k > 1)) return millisecond;
2894
+ return newInterval(function(date) {
2895
+ date.setTime(Math.floor(date / k) * k);
2896
+ }, function(date, step) {
2897
+ date.setTime(+date + step * k);
2898
+ }, function(start, end) {
2899
+ return (end - start) / k;
2900
+ });
2901
+ };
2902
+ millisecond.range;
2903
+
2904
+ const durationSecond = 1000;
2905
+ const durationMinute = durationSecond * 60;
2906
+ const durationHour = durationMinute * 60;
2907
+ const durationDay = durationHour * 24;
2908
+ const durationWeek = durationDay * 7;
2909
+
2910
+ var second = newInterval(function(date) {
2911
+ date.setTime(date - date.getMilliseconds());
2912
+ }, function(date, step) {
2913
+ date.setTime(+date + step * durationSecond);
2914
+ }, function(start, end) {
2915
+ return (end - start) / durationSecond;
2916
+ }, function(date) {
2917
+ return date.getUTCSeconds();
2918
+ });
2919
+ second.range;
2920
+
2921
+ var minute = newInterval(function(date) {
2922
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
2923
+ }, function(date, step) {
2924
+ date.setTime(+date + step * durationMinute);
2925
+ }, function(start, end) {
2926
+ return (end - start) / durationMinute;
2927
+ }, function(date) {
2928
+ return date.getMinutes();
2929
+ });
2930
+ minute.range;
2931
+
2932
+ var hour = newInterval(function(date) {
2933
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
2934
+ }, function(date, step) {
2935
+ date.setTime(+date + step * durationHour);
2936
+ }, function(start, end) {
2937
+ return (end - start) / durationHour;
2938
+ }, function(date) {
2939
+ return date.getHours();
2940
+ });
2941
+ hour.range;
2942
+
2943
+ var day = newInterval(
2944
+ date => date.setHours(0, 0, 0, 0),
2945
+ (date, step) => date.setDate(date.getDate() + step),
2946
+ (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
2947
+ date => date.getDate() - 1
2948
+ );
2949
+ day.range;
2950
+
2951
+ function weekday(i) {
2952
+ return newInterval(function(date) {
2953
+ date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
2954
+ date.setHours(0, 0, 0, 0);
2955
+ }, function(date, step) {
2956
+ date.setDate(date.getDate() + step * 7);
2957
+ }, function(start, end) {
2958
+ return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
2959
+ });
2960
+ }
2961
+
2962
+ var sunday = weekday(0);
2963
+ var monday = weekday(1);
2964
+ var tuesday = weekday(2);
2965
+ var wednesday = weekday(3);
2966
+ var thursday = weekday(4);
2967
+ var friday = weekday(5);
2968
+ var saturday = weekday(6);
2969
+
2970
+ sunday.range;
2971
+ monday.range;
2972
+ tuesday.range;
2973
+ wednesday.range;
2974
+ thursday.range;
2975
+ friday.range;
2976
+ saturday.range;
2977
+
2978
+ var month = newInterval(function(date) {
2979
+ date.setDate(1);
2980
+ date.setHours(0, 0, 0, 0);
2981
+ }, function(date, step) {
2982
+ date.setMonth(date.getMonth() + step);
2983
+ }, function(start, end) {
2984
+ return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
2985
+ }, function(date) {
2986
+ return date.getMonth();
2987
+ });
2988
+ month.range;
2989
+
2990
+ var year = newInterval(function(date) {
2991
+ date.setMonth(0, 1);
2992
+ date.setHours(0, 0, 0, 0);
2993
+ }, function(date, step) {
2994
+ date.setFullYear(date.getFullYear() + step);
2995
+ }, function(start, end) {
2996
+ return end.getFullYear() - start.getFullYear();
2997
+ }, function(date) {
2998
+ return date.getFullYear();
2999
+ });
3000
+
3001
+ // An optimized implementation for this simple case.
3002
+ year.every = function(k) {
3003
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
3004
+ date.setFullYear(Math.floor(date.getFullYear() / k) * k);
3005
+ date.setMonth(0, 1);
3006
+ date.setHours(0, 0, 0, 0);
3007
+ }, function(date, step) {
3008
+ date.setFullYear(date.getFullYear() + step * k);
3009
+ });
3010
+ };
3011
+ year.range;
3012
+
3013
+ var utcMinute = newInterval(function(date) {
3014
+ date.setUTCSeconds(0, 0);
3015
+ }, function(date, step) {
3016
+ date.setTime(+date + step * durationMinute);
3017
+ }, function(start, end) {
3018
+ return (end - start) / durationMinute;
3019
+ }, function(date) {
3020
+ return date.getUTCMinutes();
3021
+ });
3022
+ utcMinute.range;
3023
+
3024
+ var utcHour = newInterval(function(date) {
3025
+ date.setUTCMinutes(0, 0, 0);
3026
+ }, function(date, step) {
3027
+ date.setTime(+date + step * durationHour);
3028
+ }, function(start, end) {
3029
+ return (end - start) / durationHour;
3030
+ }, function(date) {
3031
+ return date.getUTCHours();
3032
+ });
3033
+ utcHour.range;
3034
+
3035
+ var utcDay = newInterval(function(date) {
3036
+ date.setUTCHours(0, 0, 0, 0);
3037
+ }, function(date, step) {
3038
+ date.setUTCDate(date.getUTCDate() + step);
3039
+ }, function(start, end) {
3040
+ return (end - start) / durationDay;
3041
+ }, function(date) {
3042
+ return date.getUTCDate() - 1;
3043
+ });
3044
+ utcDay.range;
3045
+
3046
+ function utcWeekday(i) {
3047
+ return newInterval(function(date) {
3048
+ date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
3049
+ date.setUTCHours(0, 0, 0, 0);
3050
+ }, function(date, step) {
3051
+ date.setUTCDate(date.getUTCDate() + step * 7);
3052
+ }, function(start, end) {
3053
+ return (end - start) / durationWeek;
3054
+ });
3055
+ }
3056
+
3057
+ var utcSunday = utcWeekday(0);
3058
+ var utcMonday = utcWeekday(1);
3059
+ var utcTuesday = utcWeekday(2);
3060
+ var utcWednesday = utcWeekday(3);
3061
+ var utcThursday = utcWeekday(4);
3062
+ var utcFriday = utcWeekday(5);
3063
+ var utcSaturday = utcWeekday(6);
3064
+
3065
+ utcSunday.range;
3066
+ utcMonday.range;
3067
+ utcTuesday.range;
3068
+ utcWednesday.range;
3069
+ utcThursday.range;
3070
+ utcFriday.range;
3071
+ utcSaturday.range;
3072
+
3073
+ var utcMonth = newInterval(function(date) {
3074
+ date.setUTCDate(1);
3075
+ date.setUTCHours(0, 0, 0, 0);
3076
+ }, function(date, step) {
3077
+ date.setUTCMonth(date.getUTCMonth() + step);
3078
+ }, function(start, end) {
3079
+ return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
3080
+ }, function(date) {
3081
+ return date.getUTCMonth();
3082
+ });
3083
+ utcMonth.range;
3084
+
3085
+ var utcYear = newInterval(function(date) {
3086
+ date.setUTCMonth(0, 1);
3087
+ date.setUTCHours(0, 0, 0, 0);
3088
+ }, function(date, step) {
3089
+ date.setUTCFullYear(date.getUTCFullYear() + step);
3090
+ }, function(start, end) {
3091
+ return end.getUTCFullYear() - start.getUTCFullYear();
3092
+ }, function(date) {
3093
+ return date.getUTCFullYear();
3094
+ });
3095
+
3096
+ // An optimized implementation for this simple case.
3097
+ utcYear.every = function(k) {
3098
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
3099
+ date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
3100
+ date.setUTCMonth(0, 1);
3101
+ date.setUTCHours(0, 0, 0, 0);
3102
+ }, function(date, step) {
3103
+ date.setUTCFullYear(date.getUTCFullYear() + step * k);
3104
+ });
3105
+ };
3106
+ utcYear.range;
3107
+
3108
+ function localDate(d) {
3109
+ if (0 <= d.y && d.y < 100) {
3110
+ var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
3111
+ date.setFullYear(d.y);
3112
+ return date;
3113
+ }
3114
+ return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
3115
+ }
3116
+
3117
+ function utcDate(d) {
3118
+ if (0 <= d.y && d.y < 100) {
3119
+ var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
3120
+ date.setUTCFullYear(d.y);
3121
+ return date;
3122
+ }
3123
+ return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
3124
+ }
3125
+
3126
+ function newDate(y, m, d) {
3127
+ return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};
3128
+ }
3129
+
3130
+ function formatLocale(locale) {
3131
+ var locale_dateTime = locale.dateTime,
3132
+ locale_date = locale.date,
3133
+ locale_time = locale.time,
3134
+ locale_periods = locale.periods,
3135
+ locale_weekdays = locale.days,
3136
+ locale_shortWeekdays = locale.shortDays,
3137
+ locale_months = locale.months,
3138
+ locale_shortMonths = locale.shortMonths;
3139
+
3140
+ var periodRe = formatRe(locale_periods),
3141
+ periodLookup = formatLookup(locale_periods),
3142
+ weekdayRe = formatRe(locale_weekdays),
3143
+ weekdayLookup = formatLookup(locale_weekdays),
3144
+ shortWeekdayRe = formatRe(locale_shortWeekdays),
3145
+ shortWeekdayLookup = formatLookup(locale_shortWeekdays),
3146
+ monthRe = formatRe(locale_months),
3147
+ monthLookup = formatLookup(locale_months),
3148
+ shortMonthRe = formatRe(locale_shortMonths),
3149
+ shortMonthLookup = formatLookup(locale_shortMonths);
3150
+
3151
+ var formats = {
3152
+ "a": formatShortWeekday,
3153
+ "A": formatWeekday,
3154
+ "b": formatShortMonth,
3155
+ "B": formatMonth,
3156
+ "c": null,
3157
+ "d": formatDayOfMonth,
3158
+ "e": formatDayOfMonth,
3159
+ "f": formatMicroseconds,
3160
+ "g": formatYearISO,
3161
+ "G": formatFullYearISO,
3162
+ "H": formatHour24,
3163
+ "I": formatHour12,
3164
+ "j": formatDayOfYear,
3165
+ "L": formatMilliseconds,
3166
+ "m": formatMonthNumber,
3167
+ "M": formatMinutes,
3168
+ "p": formatPeriod,
3169
+ "q": formatQuarter,
3170
+ "Q": formatUnixTimestamp,
3171
+ "s": formatUnixTimestampSeconds,
3172
+ "S": formatSeconds,
3173
+ "u": formatWeekdayNumberMonday,
3174
+ "U": formatWeekNumberSunday,
3175
+ "V": formatWeekNumberISO,
3176
+ "w": formatWeekdayNumberSunday,
3177
+ "W": formatWeekNumberMonday,
3178
+ "x": null,
3179
+ "X": null,
3180
+ "y": formatYear,
3181
+ "Y": formatFullYear,
3182
+ "Z": formatZone,
3183
+ "%": formatLiteralPercent
3184
+ };
3185
+
3186
+ var utcFormats = {
3187
+ "a": formatUTCShortWeekday,
3188
+ "A": formatUTCWeekday,
3189
+ "b": formatUTCShortMonth,
3190
+ "B": formatUTCMonth,
3191
+ "c": null,
3192
+ "d": formatUTCDayOfMonth,
3193
+ "e": formatUTCDayOfMonth,
3194
+ "f": formatUTCMicroseconds,
3195
+ "g": formatUTCYearISO,
3196
+ "G": formatUTCFullYearISO,
3197
+ "H": formatUTCHour24,
3198
+ "I": formatUTCHour12,
3199
+ "j": formatUTCDayOfYear,
3200
+ "L": formatUTCMilliseconds,
3201
+ "m": formatUTCMonthNumber,
3202
+ "M": formatUTCMinutes,
3203
+ "p": formatUTCPeriod,
3204
+ "q": formatUTCQuarter,
3205
+ "Q": formatUnixTimestamp,
3206
+ "s": formatUnixTimestampSeconds,
3207
+ "S": formatUTCSeconds,
3208
+ "u": formatUTCWeekdayNumberMonday,
3209
+ "U": formatUTCWeekNumberSunday,
3210
+ "V": formatUTCWeekNumberISO,
3211
+ "w": formatUTCWeekdayNumberSunday,
3212
+ "W": formatUTCWeekNumberMonday,
3213
+ "x": null,
3214
+ "X": null,
3215
+ "y": formatUTCYear,
3216
+ "Y": formatUTCFullYear,
3217
+ "Z": formatUTCZone,
3218
+ "%": formatLiteralPercent
3219
+ };
3220
+
3221
+ var parses = {
3222
+ "a": parseShortWeekday,
3223
+ "A": parseWeekday,
3224
+ "b": parseShortMonth,
3225
+ "B": parseMonth,
3226
+ "c": parseLocaleDateTime,
3227
+ "d": parseDayOfMonth,
3228
+ "e": parseDayOfMonth,
3229
+ "f": parseMicroseconds,
3230
+ "g": parseYear,
3231
+ "G": parseFullYear,
3232
+ "H": parseHour24,
3233
+ "I": parseHour24,
3234
+ "j": parseDayOfYear,
3235
+ "L": parseMilliseconds,
3236
+ "m": parseMonthNumber,
3237
+ "M": parseMinutes,
3238
+ "p": parsePeriod,
3239
+ "q": parseQuarter,
3240
+ "Q": parseUnixTimestamp,
3241
+ "s": parseUnixTimestampSeconds,
3242
+ "S": parseSeconds,
3243
+ "u": parseWeekdayNumberMonday,
3244
+ "U": parseWeekNumberSunday,
3245
+ "V": parseWeekNumberISO,
3246
+ "w": parseWeekdayNumberSunday,
3247
+ "W": parseWeekNumberMonday,
3248
+ "x": parseLocaleDate,
3249
+ "X": parseLocaleTime,
3250
+ "y": parseYear,
3251
+ "Y": parseFullYear,
3252
+ "Z": parseZone,
3253
+ "%": parseLiteralPercent
3254
+ };
3255
+
3256
+ // These recursive directive definitions must be deferred.
3257
+ formats.x = newFormat(locale_date, formats);
3258
+ formats.X = newFormat(locale_time, formats);
3259
+ formats.c = newFormat(locale_dateTime, formats);
3260
+ utcFormats.x = newFormat(locale_date, utcFormats);
3261
+ utcFormats.X = newFormat(locale_time, utcFormats);
3262
+ utcFormats.c = newFormat(locale_dateTime, utcFormats);
3263
+
3264
+ function newFormat(specifier, formats) {
3265
+ return function(date) {
3266
+ var string = [],
3267
+ i = -1,
3268
+ j = 0,
3269
+ n = specifier.length,
3270
+ c,
3271
+ pad,
3272
+ format;
3273
+
3274
+ if (!(date instanceof Date)) date = new Date(+date);
3275
+
3276
+ while (++i < n) {
3277
+ if (specifier.charCodeAt(i) === 37) {
3278
+ string.push(specifier.slice(j, i));
3279
+ if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
3280
+ else pad = c === "e" ? " " : "0";
3281
+ if (format = formats[c]) c = format(date, pad);
3282
+ string.push(c);
3283
+ j = i + 1;
3284
+ }
3285
+ }
3286
+
3287
+ string.push(specifier.slice(j, i));
3288
+ return string.join("");
3289
+ };
3290
+ }
3291
+
3292
+ function newParse(specifier, Z) {
3293
+ return function(string) {
3294
+ var d = newDate(1900, undefined, 1),
3295
+ i = parseSpecifier(d, specifier, string += "", 0),
3296
+ week, day$1;
3297
+ if (i != string.length) return null;
3298
+
3299
+ // If a UNIX timestamp is specified, return it.
3300
+ if ("Q" in d) return new Date(d.Q);
3301
+ if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0));
3302
+
3303
+ // If this is utcParse, never use the local timezone.
3304
+ if (Z && !("Z" in d)) d.Z = 0;
3305
+
3306
+ // The am-pm flag is 0 for AM, and 1 for PM.
3307
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
3308
+
3309
+ // If the month was not specified, inherit from the quarter.
3310
+ if (d.m === undefined) d.m = "q" in d ? d.q : 0;
3311
+
3312
+ // Convert day-of-week and week-of-year to day-of-year.
3313
+ if ("V" in d) {
3314
+ if (d.V < 1 || d.V > 53) return null;
3315
+ if (!("w" in d)) d.w = 1;
3316
+ if ("Z" in d) {
3317
+ week = utcDate(newDate(d.y, 0, 1)), day$1 = week.getUTCDay();
3318
+ week = day$1 > 4 || day$1 === 0 ? utcMonday.ceil(week) : utcMonday(week);
3319
+ week = utcDay.offset(week, (d.V - 1) * 7);
3320
+ d.y = week.getUTCFullYear();
3321
+ d.m = week.getUTCMonth();
3322
+ d.d = week.getUTCDate() + (d.w + 6) % 7;
3323
+ } else {
3324
+ week = localDate(newDate(d.y, 0, 1)), day$1 = week.getDay();
3325
+ week = day$1 > 4 || day$1 === 0 ? monday.ceil(week) : monday(week);
3326
+ week = day.offset(week, (d.V - 1) * 7);
3327
+ d.y = week.getFullYear();
3328
+ d.m = week.getMonth();
3329
+ d.d = week.getDate() + (d.w + 6) % 7;
3330
+ }
3331
+ } else if ("W" in d || "U" in d) {
3332
+ if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
3333
+ day$1 = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
3334
+ d.m = 0;
3335
+ d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$1 + 5) % 7 : d.w + d.U * 7 - (day$1 + 6) % 7;
3336
+ }
3337
+
3338
+ // If a time zone is specified, all fields are interpreted as UTC and then
3339
+ // offset according to the specified time zone.
3340
+ if ("Z" in d) {
3341
+ d.H += d.Z / 100 | 0;
3342
+ d.M += d.Z % 100;
3343
+ return utcDate(d);
3344
+ }
3345
+
3346
+ // Otherwise, all fields are in local time.
3347
+ return localDate(d);
3348
+ };
3349
+ }
3350
+
3351
+ function parseSpecifier(d, specifier, string, j) {
3352
+ var i = 0,
3353
+ n = specifier.length,
3354
+ m = string.length,
3355
+ c,
3356
+ parse;
3357
+
3358
+ while (i < n) {
3359
+ if (j >= m) return -1;
3360
+ c = specifier.charCodeAt(i++);
3361
+ if (c === 37) {
3362
+ c = specifier.charAt(i++);
3363
+ parse = parses[c in pads ? specifier.charAt(i++) : c];
3364
+ if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
3365
+ } else if (c != string.charCodeAt(j++)) {
3366
+ return -1;
3367
+ }
3368
+ }
3369
+
3370
+ return j;
3371
+ }
3372
+
3373
+ function parsePeriod(d, string, i) {
3374
+ var n = periodRe.exec(string.slice(i));
3375
+ return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
3376
+ }
3377
+
3378
+ function parseShortWeekday(d, string, i) {
3379
+ var n = shortWeekdayRe.exec(string.slice(i));
3380
+ return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
3381
+ }
3382
+
3383
+ function parseWeekday(d, string, i) {
3384
+ var n = weekdayRe.exec(string.slice(i));
3385
+ return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
3386
+ }
3387
+
3388
+ function parseShortMonth(d, string, i) {
3389
+ var n = shortMonthRe.exec(string.slice(i));
3390
+ return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
3391
+ }
3392
+
3393
+ function parseMonth(d, string, i) {
3394
+ var n = monthRe.exec(string.slice(i));
3395
+ return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
3396
+ }
3397
+
3398
+ function parseLocaleDateTime(d, string, i) {
3399
+ return parseSpecifier(d, locale_dateTime, string, i);
3400
+ }
3401
+
3402
+ function parseLocaleDate(d, string, i) {
3403
+ return parseSpecifier(d, locale_date, string, i);
3404
+ }
3405
+
3406
+ function parseLocaleTime(d, string, i) {
3407
+ return parseSpecifier(d, locale_time, string, i);
3408
+ }
3409
+
3410
+ function formatShortWeekday(d) {
3411
+ return locale_shortWeekdays[d.getDay()];
3412
+ }
3413
+
3414
+ function formatWeekday(d) {
3415
+ return locale_weekdays[d.getDay()];
3416
+ }
3417
+
3418
+ function formatShortMonth(d) {
3419
+ return locale_shortMonths[d.getMonth()];
3420
+ }
3421
+
3422
+ function formatMonth(d) {
3423
+ return locale_months[d.getMonth()];
3424
+ }
3425
+
3426
+ function formatPeriod(d) {
3427
+ return locale_periods[+(d.getHours() >= 12)];
3428
+ }
3429
+
3430
+ function formatQuarter(d) {
3431
+ return 1 + ~~(d.getMonth() / 3);
3432
+ }
3433
+
3434
+ function formatUTCShortWeekday(d) {
3435
+ return locale_shortWeekdays[d.getUTCDay()];
3436
+ }
3437
+
3438
+ function formatUTCWeekday(d) {
3439
+ return locale_weekdays[d.getUTCDay()];
3440
+ }
3441
+
3442
+ function formatUTCShortMonth(d) {
3443
+ return locale_shortMonths[d.getUTCMonth()];
3444
+ }
3445
+
3446
+ function formatUTCMonth(d) {
3447
+ return locale_months[d.getUTCMonth()];
3448
+ }
3449
+
3450
+ function formatUTCPeriod(d) {
3451
+ return locale_periods[+(d.getUTCHours() >= 12)];
3452
+ }
3453
+
3454
+ function formatUTCQuarter(d) {
3455
+ return 1 + ~~(d.getUTCMonth() / 3);
3456
+ }
3457
+
3458
+ return {
3459
+ format: function(specifier) {
3460
+ var f = newFormat(specifier += "", formats);
3461
+ f.toString = function() { return specifier; };
3462
+ return f;
3463
+ },
3464
+ parse: function(specifier) {
3465
+ var p = newParse(specifier += "", false);
3466
+ p.toString = function() { return specifier; };
3467
+ return p;
3468
+ },
3469
+ utcFormat: function(specifier) {
3470
+ var f = newFormat(specifier += "", utcFormats);
3471
+ f.toString = function() { return specifier; };
3472
+ return f;
3473
+ },
3474
+ utcParse: function(specifier) {
3475
+ var p = newParse(specifier += "", true);
3476
+ p.toString = function() { return specifier; };
3477
+ return p;
3478
+ }
3479
+ };
3480
+ }
3481
+
3482
+ var pads = {"-": "", "_": " ", "0": "0"},
3483
+ numberRe = /^\s*\d+/, // note: ignores next directive
3484
+ percentRe = /^%/,
3485
+ requoteRe = /[\\^$*+?|[\]().{}]/g;
3486
+
3487
+ function pad(value, fill, width) {
3488
+ var sign = value < 0 ? "-" : "",
3489
+ string = (sign ? -value : value) + "",
3490
+ length = string.length;
3491
+ return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
3492
+ }
3493
+
3494
+ function requote(s) {
3495
+ return s.replace(requoteRe, "\\$&");
3496
+ }
3497
+
3498
+ function formatRe(names) {
3499
+ return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
3500
+ }
3501
+
3502
+ function formatLookup(names) {
3503
+ return new Map(names.map((name, i) => [name.toLowerCase(), i]));
3504
+ }
3505
+
3506
+ function parseWeekdayNumberSunday(d, string, i) {
3507
+ var n = numberRe.exec(string.slice(i, i + 1));
3508
+ return n ? (d.w = +n[0], i + n[0].length) : -1;
3509
+ }
3510
+
3511
+ function parseWeekdayNumberMonday(d, string, i) {
3512
+ var n = numberRe.exec(string.slice(i, i + 1));
3513
+ return n ? (d.u = +n[0], i + n[0].length) : -1;
3514
+ }
3515
+
3516
+ function parseWeekNumberSunday(d, string, i) {
3517
+ var n = numberRe.exec(string.slice(i, i + 2));
3518
+ return n ? (d.U = +n[0], i + n[0].length) : -1;
3519
+ }
3520
+
3521
+ function parseWeekNumberISO(d, string, i) {
3522
+ var n = numberRe.exec(string.slice(i, i + 2));
3523
+ return n ? (d.V = +n[0], i + n[0].length) : -1;
3524
+ }
3525
+
3526
+ function parseWeekNumberMonday(d, string, i) {
3527
+ var n = numberRe.exec(string.slice(i, i + 2));
3528
+ return n ? (d.W = +n[0], i + n[0].length) : -1;
3529
+ }
3530
+
3531
+ function parseFullYear(d, string, i) {
3532
+ var n = numberRe.exec(string.slice(i, i + 4));
3533
+ return n ? (d.y = +n[0], i + n[0].length) : -1;
3534
+ }
3535
+
3536
+ function parseYear(d, string, i) {
3537
+ var n = numberRe.exec(string.slice(i, i + 2));
3538
+ return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
3539
+ }
3540
+
3541
+ function parseZone(d, string, i) {
3542
+ var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
3543
+ return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
3544
+ }
3545
+
3546
+ function parseQuarter(d, string, i) {
3547
+ var n = numberRe.exec(string.slice(i, i + 1));
3548
+ return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
3549
+ }
3550
+
3551
+ function parseMonthNumber(d, string, i) {
3552
+ var n = numberRe.exec(string.slice(i, i + 2));
3553
+ return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
3554
+ }
3555
+
3556
+ function parseDayOfMonth(d, string, i) {
3557
+ var n = numberRe.exec(string.slice(i, i + 2));
3558
+ return n ? (d.d = +n[0], i + n[0].length) : -1;
3559
+ }
3560
+
3561
+ function parseDayOfYear(d, string, i) {
3562
+ var n = numberRe.exec(string.slice(i, i + 3));
3563
+ return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
3564
+ }
3565
+
3566
+ function parseHour24(d, string, i) {
3567
+ var n = numberRe.exec(string.slice(i, i + 2));
3568
+ return n ? (d.H = +n[0], i + n[0].length) : -1;
3569
+ }
3570
+
3571
+ function parseMinutes(d, string, i) {
3572
+ var n = numberRe.exec(string.slice(i, i + 2));
3573
+ return n ? (d.M = +n[0], i + n[0].length) : -1;
3574
+ }
3575
+
3576
+ function parseSeconds(d, string, i) {
3577
+ var n = numberRe.exec(string.slice(i, i + 2));
3578
+ return n ? (d.S = +n[0], i + n[0].length) : -1;
3579
+ }
3580
+
3581
+ function parseMilliseconds(d, string, i) {
3582
+ var n = numberRe.exec(string.slice(i, i + 3));
3583
+ return n ? (d.L = +n[0], i + n[0].length) : -1;
3584
+ }
3585
+
3586
+ function parseMicroseconds(d, string, i) {
3587
+ var n = numberRe.exec(string.slice(i, i + 6));
3588
+ return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
3589
+ }
3590
+
3591
+ function parseLiteralPercent(d, string, i) {
3592
+ var n = percentRe.exec(string.slice(i, i + 1));
3593
+ return n ? i + n[0].length : -1;
3594
+ }
3595
+
3596
+ function parseUnixTimestamp(d, string, i) {
3597
+ var n = numberRe.exec(string.slice(i));
3598
+ return n ? (d.Q = +n[0], i + n[0].length) : -1;
3599
+ }
3600
+
3601
+ function parseUnixTimestampSeconds(d, string, i) {
3602
+ var n = numberRe.exec(string.slice(i));
3603
+ return n ? (d.s = +n[0], i + n[0].length) : -1;
3604
+ }
3605
+
3606
+ function formatDayOfMonth(d, p) {
3607
+ return pad(d.getDate(), p, 2);
3608
+ }
3609
+
3610
+ function formatHour24(d, p) {
3611
+ return pad(d.getHours(), p, 2);
3612
+ }
3613
+
3614
+ function formatHour12(d, p) {
3615
+ return pad(d.getHours() % 12 || 12, p, 2);
3616
+ }
3617
+
3618
+ function formatDayOfYear(d, p) {
3619
+ return pad(1 + day.count(year(d), d), p, 3);
3620
+ }
3621
+
3622
+ function formatMilliseconds(d, p) {
3623
+ return pad(d.getMilliseconds(), p, 3);
3624
+ }
3625
+
3626
+ function formatMicroseconds(d, p) {
3627
+ return formatMilliseconds(d, p) + "000";
3628
+ }
3629
+
3630
+ function formatMonthNumber(d, p) {
3631
+ return pad(d.getMonth() + 1, p, 2);
3632
+ }
3633
+
3634
+ function formatMinutes(d, p) {
3635
+ return pad(d.getMinutes(), p, 2);
3636
+ }
3637
+
3638
+ function formatSeconds(d, p) {
3639
+ return pad(d.getSeconds(), p, 2);
3640
+ }
3641
+
3642
+ function formatWeekdayNumberMonday(d) {
3643
+ var day = d.getDay();
3644
+ return day === 0 ? 7 : day;
3645
+ }
3646
+
3647
+ function formatWeekNumberSunday(d, p) {
3648
+ return pad(sunday.count(year(d) - 1, d), p, 2);
3649
+ }
3650
+
3651
+ function dISO(d) {
3652
+ var day = d.getDay();
3653
+ return (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
3654
+ }
3655
+
3656
+ function formatWeekNumberISO(d, p) {
3657
+ d = dISO(d);
3658
+ return pad(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
3659
+ }
3660
+
3661
+ function formatWeekdayNumberSunday(d) {
3662
+ return d.getDay();
3663
+ }
3664
+
3665
+ function formatWeekNumberMonday(d, p) {
3666
+ return pad(monday.count(year(d) - 1, d), p, 2);
3667
+ }
3668
+
3669
+ function formatYear(d, p) {
3670
+ return pad(d.getFullYear() % 100, p, 2);
3671
+ }
3672
+
3673
+ function formatYearISO(d, p) {
3674
+ d = dISO(d);
3675
+ return pad(d.getFullYear() % 100, p, 2);
3676
+ }
3677
+
3678
+ function formatFullYear(d, p) {
3679
+ return pad(d.getFullYear() % 10000, p, 4);
3680
+ }
3681
+
3682
+ function formatFullYearISO(d, p) {
3683
+ var day = d.getDay();
3684
+ d = (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
3685
+ return pad(d.getFullYear() % 10000, p, 4);
3686
+ }
3687
+
3688
+ function formatZone(d) {
3689
+ var z = d.getTimezoneOffset();
3690
+ return (z > 0 ? "-" : (z *= -1, "+"))
3691
+ + pad(z / 60 | 0, "0", 2)
3692
+ + pad(z % 60, "0", 2);
3693
+ }
3694
+
3695
+ function formatUTCDayOfMonth(d, p) {
3696
+ return pad(d.getUTCDate(), p, 2);
3697
+ }
3698
+
3699
+ function formatUTCHour24(d, p) {
3700
+ return pad(d.getUTCHours(), p, 2);
3701
+ }
3702
+
3703
+ function formatUTCHour12(d, p) {
3704
+ return pad(d.getUTCHours() % 12 || 12, p, 2);
3705
+ }
3706
+
3707
+ function formatUTCDayOfYear(d, p) {
3708
+ return pad(1 + utcDay.count(utcYear(d), d), p, 3);
3709
+ }
3710
+
3711
+ function formatUTCMilliseconds(d, p) {
3712
+ return pad(d.getUTCMilliseconds(), p, 3);
3713
+ }
3714
+
3715
+ function formatUTCMicroseconds(d, p) {
3716
+ return formatUTCMilliseconds(d, p) + "000";
3717
+ }
3718
+
3719
+ function formatUTCMonthNumber(d, p) {
3720
+ return pad(d.getUTCMonth() + 1, p, 2);
3721
+ }
3722
+
3723
+ function formatUTCMinutes(d, p) {
3724
+ return pad(d.getUTCMinutes(), p, 2);
3725
+ }
3726
+
3727
+ function formatUTCSeconds(d, p) {
3728
+ return pad(d.getUTCSeconds(), p, 2);
3729
+ }
3730
+
3731
+ function formatUTCWeekdayNumberMonday(d) {
3732
+ var dow = d.getUTCDay();
3733
+ return dow === 0 ? 7 : dow;
3734
+ }
3735
+
3736
+ function formatUTCWeekNumberSunday(d, p) {
3737
+ return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);
3738
+ }
3739
+
3740
+ function UTCdISO(d) {
3741
+ var day = d.getUTCDay();
3742
+ return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
3743
+ }
3744
+
3745
+ function formatUTCWeekNumberISO(d, p) {
3746
+ d = UTCdISO(d);
3747
+ return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
3748
+ }
3749
+
3750
+ function formatUTCWeekdayNumberSunday(d) {
3751
+ return d.getUTCDay();
3752
+ }
3753
+
3754
+ function formatUTCWeekNumberMonday(d, p) {
3755
+ return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);
3756
+ }
3757
+
3758
+ function formatUTCYear(d, p) {
3759
+ return pad(d.getUTCFullYear() % 100, p, 2);
3760
+ }
3761
+
3762
+ function formatUTCYearISO(d, p) {
3763
+ d = UTCdISO(d);
3764
+ return pad(d.getUTCFullYear() % 100, p, 2);
3765
+ }
3766
+
3767
+ function formatUTCFullYear(d, p) {
3768
+ return pad(d.getUTCFullYear() % 10000, p, 4);
3769
+ }
3770
+
3771
+ function formatUTCFullYearISO(d, p) {
3772
+ var day = d.getUTCDay();
3773
+ d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
3774
+ return pad(d.getUTCFullYear() % 10000, p, 4);
3775
+ }
3776
+
3777
+ function formatUTCZone() {
3778
+ return "+0000";
3779
+ }
3780
+
3781
+ function formatLiteralPercent() {
3782
+ return "%";
3783
+ }
3784
+
3785
+ function formatUnixTimestamp(d) {
3786
+ return +d;
3787
+ }
3788
+
3789
+ function formatUnixTimestampSeconds(d) {
3790
+ return Math.floor(+d / 1000);
3791
+ }
3792
+
3793
+ var locale;
3794
+ var utcFormat;
3795
+ var utcParse;
3796
+
3797
+ defaultLocale({
3798
+ dateTime: "%x, %X",
3799
+ date: "%-m/%-d/%Y",
3800
+ time: "%-I:%M:%S %p",
3801
+ periods: ["AM", "PM"],
3802
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
3803
+ shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
3804
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
3805
+ shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
3806
+ });
3807
+
3808
+ function defaultLocale(definition) {
3809
+ locale = formatLocale(definition);
3810
+ locale.format;
3811
+ locale.parse;
3812
+ utcFormat = locale.utcFormat;
3813
+ utcParse = locale.utcParse;
3814
+ return locale;
3815
+ }
3816
+
3817
+ var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
3818
+
3819
+ function formatIsoNative(date) {
3820
+ return date.toISOString();
3821
+ }
3822
+
3823
+ Date.prototype.toISOString
3824
+ ? formatIsoNative
3825
+ : utcFormat(isoSpecifier);
3826
+
3827
+ function parseIsoNative(string) {
3828
+ var date = new Date(string);
3829
+ return isNaN(date) ? null : date;
3830
+ }
3831
+
3832
+ +new Date("2000-01-01T00:00:00.000Z")
3833
+ ? parseIsoNative
3834
+ : utcParse(isoSpecifier);
3835
+
3836
+ function transformer() {
3837
+ var x0 = 0,
3838
+ x1 = 1,
3839
+ t0,
3840
+ t1,
3841
+ k10,
3842
+ transform,
3843
+ interpolator = identity$1,
3844
+ clamp = false,
3845
+ unknown;
3846
+
3847
+ function scale(x) {
3848
+ return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));
3849
+ }
3850
+
3851
+ scale.domain = function(_) {
3852
+ return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
3853
+ };
3854
+
3855
+ scale.clamp = function(_) {
3856
+ return arguments.length ? (clamp = !!_, scale) : clamp;
3857
+ };
3858
+
3859
+ scale.interpolator = function(_) {
3860
+ return arguments.length ? (interpolator = _, scale) : interpolator;
3861
+ };
3862
+
3863
+ function range(interpolate) {
3864
+ return function(_) {
3865
+ var r0, r1;
3866
+ return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];
3867
+ };
3868
+ }
3869
+
3870
+ scale.range = range(interpolate);
3871
+
3872
+ scale.rangeRound = range(interpolateRound);
3873
+
3874
+ scale.unknown = function(_) {
3875
+ return arguments.length ? (unknown = _, scale) : unknown;
3876
+ };
3877
+
3878
+ return function(t) {
3879
+ transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);
3880
+ return scale;
3881
+ };
3882
+ }
3883
+
3884
+ function copy(source, target) {
3885
+ return target
3886
+ .domain(source.domain())
3887
+ .interpolator(source.interpolator())
3888
+ .clamp(source.clamp())
3889
+ .unknown(source.unknown());
3890
+ }
3891
+
3892
+ function sequential() {
3893
+ var scale = linearish(transformer()(identity$1));
3894
+
3895
+ scale.copy = function() {
3896
+ return copy(scale, sequential());
3897
+ };
3898
+
3899
+ return initInterpolator.apply(scale, arguments);
3900
+ }
3901
+
3902
+ const COLOR_BASE = "#cecece";
3903
+
3904
+ // https://www.w3.org/TR/WCAG20/#relativeluminancedef
3905
+ const rc = 0.2126;
3906
+ const gc = 0.7152;
3907
+ const bc = 0.0722;
3908
+ // low-gamma adjust coefficient
3909
+ const lowc = 1 / 12.92;
3910
+ function adjustGamma(p) {
3911
+ return Math.pow((p + 0.055) / 1.055, 2.4);
3912
+ }
3913
+ function relativeLuminance(o) {
3914
+ const rsrgb = o.r / 255;
3915
+ const gsrgb = o.g / 255;
3916
+ const bsrgb = o.b / 255;
3917
+ const r = rsrgb <= 0.03928 ? rsrgb * lowc : adjustGamma(rsrgb);
3918
+ const g = gsrgb <= 0.03928 ? gsrgb * lowc : adjustGamma(gsrgb);
3919
+ const b = bsrgb <= 0.03928 ? bsrgb * lowc : adjustGamma(bsrgb);
3920
+ return r * rc + g * gc + b * bc;
3921
+ }
3922
+ const createRainbowColor = (root) => {
3923
+ const colorParentMap = new Map();
3924
+ colorParentMap.set(root, COLOR_BASE);
3925
+ if (root.children != null) {
3926
+ const colorScale = sequential([0, root.children.length], (n) => hsl(360 * n, 0.3, 0.85));
3927
+ root.children.forEach((c, id) => {
3928
+ colorParentMap.set(c, colorScale(id).toString());
3929
+ });
3930
+ }
3931
+ const colorMap = new Map();
3932
+ const lightScale = linear().domain([0, root.height]).range([0.9, 0.3]);
3933
+ const getBackgroundColor = (node) => {
3934
+ const parents = node.ancestors();
3935
+ const colorStr = parents.length === 1
3936
+ ? colorParentMap.get(parents[0])
3937
+ : colorParentMap.get(parents[parents.length - 2]);
3938
+ const hslColor = hsl(colorStr);
3939
+ hslColor.l = lightScale(node.depth);
3940
+ return hslColor;
3941
+ };
3942
+ return (node) => {
3943
+ if (!colorMap.has(node)) {
3944
+ const backgroundColor = getBackgroundColor(node);
3945
+ const l = relativeLuminance(backgroundColor.rgb());
3946
+ const fontColor = l > 0.19 ? "#000" : "#fff";
3947
+ colorMap.set(node, {
3948
+ backgroundColor: backgroundColor.toString(),
3949
+ fontColor,
3950
+ });
3951
+ }
3952
+ return colorMap.get(node);
3953
+ };
3954
+ };
3955
+
3956
+ const StaticContext = B$2({});
3957
+ const drawChart = (parentNode, data, width, height) => {
3958
+ const availableSizeProperties = getAvailableSizeOptions(data.options);
3959
+ console.time("layout create");
3960
+ const layout = treemap()
3961
+ .size([width, height])
3962
+ .paddingOuter(PADDING)
3963
+ .paddingTop(TOP_PADDING)
3964
+ .paddingInner(PADDING)
3965
+ .round(true)
3966
+ .tile(treemapResquarify);
3967
+ console.timeEnd("layout create");
3968
+ console.time("rawHierarchy create");
3969
+ const rawHierarchy = hierarchy(data.tree);
3970
+ console.timeEnd("rawHierarchy create");
3971
+ const nodeSizesCache = new Map();
3972
+ const nodeIdsCache = new Map();
3973
+ const getModuleSize = (node, sizeKey) => { var _a, _b; return (_b = (_a = nodeSizesCache.get(node)) === null || _a === void 0 ? void 0 : _a[sizeKey]) !== null && _b !== void 0 ? _b : 0; };
3974
+ console.time("rawHierarchy eachAfter cache");
3975
+ rawHierarchy.eachAfter((node) => {
3976
+ var _a;
3977
+ const nodeData = node.data;
3978
+ nodeIdsCache.set(nodeData, {
3979
+ nodeUid: generateUniqueId("node"),
3980
+ clipUid: generateUniqueId("clip"),
3981
+ });
3982
+ const sizes = { renderedLength: 0, gzipLength: 0, brotliLength: 0 };
3983
+ if (isModuleTree(nodeData)) {
3984
+ for (const sizeKey of availableSizeProperties) {
3985
+ sizes[sizeKey] = nodeData.children.reduce((acc, child) => getModuleSize(child, sizeKey) + acc, 0);
3986
+ }
3987
+ }
3988
+ else {
3989
+ for (const sizeKey of availableSizeProperties) {
3990
+ sizes[sizeKey] = (_a = data.nodeParts[nodeData.uid][sizeKey]) !== null && _a !== void 0 ? _a : 0;
3991
+ }
3992
+ }
3993
+ nodeSizesCache.set(nodeData, sizes);
3994
+ });
3995
+ console.timeEnd("rawHierarchy eachAfter cache");
3996
+ const getModuleIds = (node) => nodeIdsCache.get(node);
3997
+ console.time("color");
3998
+ const getModuleColor = createRainbowColor(rawHierarchy);
3999
+ console.timeEnd("color");
4000
+ P(o$1(StaticContext.Provider, Object.assign({ value: {
4001
+ data,
4002
+ availableSizeProperties,
4003
+ width,
4004
+ height,
4005
+ getModuleSize,
4006
+ getModuleIds,
4007
+ getModuleColor,
4008
+ rawHierarchy,
4009
+ layout,
4010
+ } }, { children: o$1(Main, {}) })), parentNode);
4011
+ };
4012
+
4013
+ exports.StaticContext = StaticContext;
4014
+ exports.default = drawChart;
4015
+
4016
+ Object.defineProperty(exports, '__esModule', { value: true });
4017
+
4018
+ return exports;
4019
+
4020
+ })({});
4021
+ //# sourceMappingURL=treemap.js.map
4022
+
4023
+ /*-->*/
4024
+ </script>
4025
+ <script>
4026
+ /*<!--*/
4027
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"Vero.min.js","children":[{"name":"src","children":[{"name":"integrations/Vero","children":[{"uid":"4e91-1","name":"constants.js"},{"uid":"4e91-19","name":"browser.js"}]},{"name":"utils","children":[{"uid":"4e91-3","name":"logUtil.js"},{"uid":"4e91-15","name":"commonUtils.js"},{"uid":"4e91-17","name":"ScriptLoader.js"}]}]},{"name":"node_modules","children":[{"name":"lodash.isundefined/index.js","uid":"4e91-5"},{"name":"lodash.isempty/index.js","uid":"4e91-7"},{"name":"lodash.pickby/index.js","uid":"4e91-9"},{"name":"lodash.pick/index.js","uid":"4e91-11"},{"name":"lodash.tostring/index.js","uid":"4e91-13"}]}]}],"isRoot":true},"nodeParts":{"4e91-1":{"renderedLength":216,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-0"},"4e91-3":{"renderedLength":1291,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-2"},"4e91-5":{"renderedLength":871,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-4"},"4e91-7":{"renderedLength":17396,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-6"},"4e91-9":{"renderedLength":72413,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-8"},"4e91-11":{"renderedLength":14106,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-10"},"4e91-13":{"renderedLength":1067,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-12"},"4e91-15":{"renderedLength":258,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-14"},"4e91-17":{"renderedLength":1998,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-16"},"4e91-19":{"renderedLength":5336,"gzipLength":0,"brotliLength":0,"mainUid":"4e91-18"}},"nodeMetas":{"4e91-0":{"id":"/src/integrations/Vero/constants.js","moduleParts":{"Vero.min.js":"4e91-1"},"imported":[{"uid":"4e91-21"}],"importedBy":[{"uid":"4e91-18"}]},"4e91-2":{"id":"/src/utils/logUtil.js","moduleParts":{"Vero.min.js":"4e91-3"},"imported":[],"importedBy":[{"uid":"4e91-18"}]},"4e91-4":{"id":"/node_modules/lodash.isundefined/index.js","moduleParts":{"Vero.min.js":"4e91-5"},"imported":[{"uid":"4e91-22"}],"importedBy":[{"uid":"4e91-14"}]},"4e91-6":{"id":"/node_modules/lodash.isempty/index.js","moduleParts":{"Vero.min.js":"4e91-7"},"imported":[{"uid":"4e91-22"},{"uid":"4e91-23"}],"importedBy":[{"uid":"4e91-14"}]},"4e91-8":{"id":"/node_modules/lodash.pickby/index.js","moduleParts":{"Vero.min.js":"4e91-9"},"imported":[{"uid":"4e91-22"},{"uid":"4e91-24"}],"importedBy":[{"uid":"4e91-14"}]},"4e91-10":{"id":"/node_modules/lodash.pick/index.js","moduleParts":{"Vero.min.js":"4e91-11"},"imported":[{"uid":"4e91-22"}],"importedBy":[{"uid":"4e91-14"}]},"4e91-12":{"id":"/node_modules/lodash.tostring/index.js","moduleParts":{"Vero.min.js":"4e91-13"},"imported":[{"uid":"4e91-22"}],"importedBy":[{"uid":"4e91-14"}]},"4e91-14":{"id":"/src/utils/commonUtils.js","moduleParts":{"Vero.min.js":"4e91-15"},"imported":[{"uid":"4e91-21"},{"uid":"4e91-4"},{"uid":"4e91-6"},{"uid":"4e91-8"},{"uid":"4e91-10"},{"uid":"4e91-12"}],"importedBy":[{"uid":"4e91-18"}]},"4e91-16":{"id":"/src/utils/ScriptLoader.js","moduleParts":{"Vero.min.js":"4e91-17"},"imported":[],"importedBy":[{"uid":"4e91-18"}]},"4e91-18":{"id":"/src/integrations/Vero/browser.js","moduleParts":{"Vero.min.js":"4e91-19"},"imported":[{"uid":"4e91-21"},{"uid":"4e91-0"},{"uid":"4e91-2"},{"uid":"4e91-14"},{"uid":"4e91-16"}],"importedBy":[{"uid":"4e91-20"}]},"4e91-20":{"id":"/src/integrations/Vero/index.js","moduleParts":{},"imported":[{"uid":"4e91-18"}],"importedBy":[],"isEntry":true},"4e91-21":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"4e91-18"},{"uid":"4e91-0"},{"uid":"4e91-14"}]},"4e91-22":{"id":"\u0000commonjsHelpers.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"4e91-4"},{"uid":"4e91-6"},{"uid":"4e91-8"},{"uid":"4e91-10"},{"uid":"4e91-12"}]},"4e91-23":{"id":"\u0000/node_modules/lodash.isempty/index.js?commonjs-module","moduleParts":{},"imported":[],"importedBy":[{"uid":"4e91-6"}]},"4e91-24":{"id":"\u0000/node_modules/lodash.pickby/index.js?commonjs-module","moduleParts":{},"imported":[],"importedBy":[{"uid":"4e91-8"}]}},"env":{"rollup":"2.79.1"},"options":{"gzip":false,"brotli":false,"sourcemap":true}};
4028
+
4029
+ const run = () => {
4030
+ const width = window.innerWidth;
4031
+ const height = window.innerHeight;
4032
+
4033
+ const chartNode = document.querySelector("main");
4034
+ drawChart.default(chartNode, data, width, height);
4035
+ };
4036
+
4037
+ window.addEventListener('resize', run);
4038
+
4039
+ document.addEventListener('DOMContentLoaded', run);
4040
+ /*-->*/
4041
+ </script>
4042
+ </body>
4043
+ </html>
4044
+