金币系统前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4957 lines
5.7 MiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  7. <title>Rollup Visualizer</title>
  8. <style>
  9. :root {
  10. --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
  11. "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
  12. "Noto Color Emoji";
  13. --background-color: #2b2d42;
  14. --text-color: #edf2f4;
  15. }
  16. html {
  17. box-sizing: border-box;
  18. }
  19. *,
  20. *:before,
  21. *:after {
  22. box-sizing: inherit;
  23. }
  24. html {
  25. background-color: var(--background-color);
  26. color: var(--text-color);
  27. font-family: var(--font-family);
  28. }
  29. body {
  30. padding: 0;
  31. margin: 0;
  32. }
  33. html,
  34. body {
  35. height: 100%;
  36. width: 100%;
  37. overflow: hidden;
  38. }
  39. body {
  40. display: flex;
  41. flex-direction: column;
  42. }
  43. svg {
  44. vertical-align: middle;
  45. width: 100%;
  46. height: 100%;
  47. max-height: 100vh;
  48. }
  49. main {
  50. flex-grow: 1;
  51. height: 100vh;
  52. padding: 20px;
  53. }
  54. .tooltip {
  55. position: absolute;
  56. z-index: 1070;
  57. border: 2px solid;
  58. border-radius: 5px;
  59. padding: 5px;
  60. font-size: 0.875rem;
  61. background-color: var(--background-color);
  62. color: var(--text-color);
  63. }
  64. .tooltip-hidden {
  65. visibility: hidden;
  66. opacity: 0;
  67. }
  68. .sidebar {
  69. position: fixed;
  70. top: 0;
  71. left: 0;
  72. right: 0;
  73. display: flex;
  74. flex-direction: row;
  75. font-size: 0.7rem;
  76. align-items: center;
  77. margin: 0 50px;
  78. height: 20px;
  79. }
  80. .size-selectors {
  81. display: flex;
  82. flex-direction: row;
  83. align-items: center;
  84. }
  85. .size-selector {
  86. display: flex;
  87. flex-direction: row;
  88. align-items: center;
  89. justify-content: center;
  90. margin-right: 1rem;
  91. }
  92. .size-selector input {
  93. margin: 0 0.3rem 0 0;
  94. }
  95. .filters {
  96. flex: 1;
  97. display: flex;
  98. flex-direction: row;
  99. align-items: center;
  100. }
  101. .module-filters {
  102. display: flex;
  103. flex-grow: 1;
  104. }
  105. .module-filter {
  106. display: flex;
  107. flex-direction: row;
  108. align-items: center;
  109. justify-content: center;
  110. flex: 1;
  111. }
  112. .module-filter input {
  113. flex: 1;
  114. height: 1rem;
  115. padding: 0.01rem;
  116. font-size: 0.7rem;
  117. margin-left: 0.3rem;
  118. }
  119. .module-filter + .module-filter {
  120. margin-left: 0.5rem;
  121. }
  122. .node {
  123. cursor: pointer;
  124. }
  125. </style>
  126. </head>
  127. <body>
  128. <main></main>
  129. <script>
  130. /*<!--*/
  131. var drawChart = (function (exports) {
  132. 'use strict';
  133. var n,l$1,u$2,i$1,r$1,o$1,e$1,f$2,c$1,s$1,a$1,h$1,p$1={},v$1=[],y$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d$1=Array.isArray;function w$1(n,l){for(var u in l)n[u]=l[u];return n}function _$1(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function g(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===e[o]&&(e[o]=l.defaultProps[o]);return m$1(l,e,i,r,null)}function m$1(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u$2:o,__i:-1,__u:0};return null==o&&null!=l$1.vnode&&l$1.vnode(e),e}function k$1(n){return n.children}function x$1(n,l){this.props=n,this.context=l;}function C$1(n,l){if(null==l)return n.__?C$1(n.__,n.__i+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?C$1(n):null}function S(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 S(n)}}function M(n){(!n.__d&&(n.__d=!0)&&i$1.push(n)&&!P.__r++||r$1!==l$1.debounceRendering)&&((r$1=l$1.debounceRendering)||o$1)(P);}function P(){var n,u,t,r,o,f,c,s;for(i$1.sort(e$1);n=i$1.shift();)n.__d&&(u=i$1.length,r=void 0,f=(o=(t=n).__v).__e,c=[],s=[],t.__P&&((r=w$1({},o)).__v=o.__v+1,l$1.vnode&&l$1.vnode(r),j$1(t.__P,r,o,t.__n,t.__P.namespaceURI,32&o.__u?[f]:null,c,null==f?C$1(o):f,!!(32&o.__u),s),r.__v=o.__v,r.__.__k[r.__i]=r,z$1(c,r,s),r.__e!=f&&S(r)),i$1.length>u&&i$1.sort(e$1));P.__r=0;}function $(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,d,w,_,g=t&&t.__k||v$1,m=l.length;for(f=I(u,l,g,f,m),a=0;a<m;a++)null!=(y=u.__k[a])&&(h=-1===y.__i?p$1:g[y.__i]||p$1,y.__i=a,_=j$1(n,y,h,i,r,o,e,f,c,s),d=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&V(h.ref,null,y),s.push(y.ref,y.__c||d,y)),null==w&&null!=d&&(w=d),4&y.__u||h.__k===y.__k?f=A$1(y,f,n):"function"==typeof y.type&&void 0!==_?f=_:d&&(f=d.nextSibling),y.__u&=-7);return u.__e=w,f}function I(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m$1(null,o,null,null,null):d$1(o)?m$1(k$1,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?m$1(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!==(c=o.__i=L(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null===e.__v?(-1==c&&h--,"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=C$1(e)),q$1(e,e));return t}function A$1(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=A$1(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!u.contains(l)&&(l=C$1(n)),u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function L(n,l,u,t){var i,r,o=n.key,e=n.type,f=l[u];if(null===f||f&&o==f.key&&e===f.type&&0==(2&f.__u))return u;if(t>(null!=f&&0==(2&f.__u)?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;){if(i>=0){if((f=l[i])&&0==(2&f.__u)&&o==f.key&&e===f.type)return i;i--;}if(r<l.length){if((f=l[r])&&0==(2&f.__u)&&o==f.key&&e===f.type)return r;r++;}}return -1}function T$1(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y$1.test(l)?u:u+"px";}function F(n,l,u,t,i){var r;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T$1(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||T$1(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f$2,"$1")),l=l.toLowerCase()in n||"onFocusOut"==l||"onFocusIn"==l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c$1,n.addEventListener(l,r?a$1:s$1,r)):n.removeEventListener(l,r?a$1:s$1,r);el
  134. var f$1=0;function u$1(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f$1,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return l$1.vnode&&l$1.vnode(l),l}
  135. function count$1(node) {
  136. var sum = 0,
  137. children = node.children,
  138. i = children && children.length;
  139. if (!i) sum = 1;
  140. else while (--i >= 0) sum += children[i].value;
  141. node.value = sum;
  142. }
  143. function node_count() {
  144. return this.eachAfter(count$1);
  145. }
  146. function node_each(callback, that) {
  147. let index = -1;
  148. for (const node of this) {
  149. callback.call(that, node, ++index, this);
  150. }
  151. return this;
  152. }
  153. function node_eachBefore(callback, that) {
  154. var node = this, nodes = [node], children, i, index = -1;
  155. while (node = nodes.pop()) {
  156. callback.call(that, node, ++index, this);
  157. if (children = node.children) {
  158. for (i = children.length - 1; i >= 0; --i) {
  159. nodes.push(children[i]);
  160. }
  161. }
  162. }
  163. return this;
  164. }
  165. function node_eachAfter(callback, that) {
  166. var node = this, nodes = [node], next = [], children, i, n, index = -1;
  167. while (node = nodes.pop()) {
  168. next.push(node);
  169. if (children = node.children) {
  170. for (i = 0, n = children.length; i < n; ++i) {
  171. nodes.push(children[i]);
  172. }
  173. }
  174. }
  175. while (node = next.pop()) {
  176. callback.call(that, node, ++index, this);
  177. }
  178. return this;
  179. }
  180. function node_find(callback, that) {
  181. let index = -1;
  182. for (const node of this) {
  183. if (callback.call(that, node, ++index, this)) {
  184. return node;
  185. }
  186. }
  187. }
  188. function node_sum(value) {
  189. return this.eachAfter(function(node) {
  190. var sum = +value(node.data) || 0,
  191. children = node.children,
  192. i = children && children.length;
  193. while (--i >= 0) sum += children[i].value;
  194. node.value = sum;
  195. });
  196. }
  197. function node_sort(compare) {
  198. return this.eachBefore(function(node) {
  199. if (node.children) {
  200. node.children.sort(compare);
  201. }
  202. });
  203. }
  204. function node_path(end) {
  205. var start = this,
  206. ancestor = leastCommonAncestor(start, end),
  207. nodes = [start];
  208. while (start !== ancestor) {
  209. start = start.parent;
  210. nodes.push(start);
  211. }
  212. var k = nodes.length;
  213. while (end !== ancestor) {
  214. nodes.splice(k, 0, end);
  215. end = end.parent;
  216. }
  217. return nodes;
  218. }
  219. function leastCommonAncestor(a, b) {
  220. if (a === b) return a;
  221. var aNodes = a.ancestors(),
  222. bNodes = b.ancestors(),
  223. c = null;
  224. a = aNodes.pop();
  225. b = bNodes.pop();
  226. while (a === b) {
  227. c = a;
  228. a = aNodes.pop();
  229. b = bNodes.pop();
  230. }
  231. return c;
  232. }
  233. function node_ancestors() {
  234. var node = this, nodes = [node];
  235. while (node = node.parent) {
  236. nodes.push(node);
  237. }
  238. return nodes;
  239. }
  240. function node_descendants() {
  241. return Array.from(this);
  242. }
  243. function node_leaves() {
  244. var leaves = [];
  245. this.eachBefore(function(node) {
  246. if (!node.children) {
  247. leaves.push(node);
  248. }
  249. });
  250. return leaves;
  251. }
  252. function node_links() {
  253. var root = this, links = [];
  254. root.each(function(node) {
  255. if (node !== root) { // Don’t include the root’s parent, if any.
  256. links.push({source: node.parent, target: node});
  257. }
  258. });
  259. return links;
  260. }
  261. function* node_iterator() {
  262. var node = this, current, next = [node], children, i, n;
  263. do {
  264. current = next.reverse(), next = [];
  265. while (node = current.pop()) {
  266. yield node;
  267. if (children = node.children) {
  268. for (i = 0, n = children.length; i < n; ++i) {
  269. next.push(children[i]);
  270. }
  271. }
  272. }
  273. } while (next.length);
  274. }
  275. function hierarchy(data, children) {
  276. if (data instanceof Map) {
  277. data = [undefined, data];
  278. if (children === undefined) children = mapChildren;
  279. } else if (children === undefined) {
  280. children = objectChildren;
  281. }
  282. var root = new Node$1(data),
  283. node,
  284. nodes = [root],
  285. child,
  286. childs,
  287. i,
  288. n;
  289. while (node = nodes.pop()) {
  290. if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
  291. node.children = childs;
  292. for (i = n - 1; i >= 0; --i) {
  293. nodes.push(child = childs[i] = new Node$1(childs[i]));
  294. child.parent = node;
  295. child.depth = node.depth + 1;
  296. }
  297. }
  298. }
  299. return root.eachBefore(computeHeight);
  300. }
  301. function node_copy() {
  302. return hierarchy(this).eachBefore(copyData);
  303. }
  304. function objectChildren(d) {
  305. return d.children;
  306. }
  307. function mapChildren(d) {
  308. return Array.isArray(d) ? d[1] : null;
  309. }
  310. function copyData(node) {
  311. if (node.data.value !== undefined) node.value = node.data.value;
  312. node.data = node.data.data;
  313. }
  314. function computeHeight(node) {
  315. var height = 0;
  316. do node.height = height;
  317. while ((node = node.parent) && (node.height < ++height));
  318. }
  319. function Node$1(data) {
  320. this.data = data;
  321. this.depth =
  322. this.height = 0;
  323. this.parent = null;
  324. }
  325. Node$1.prototype = hierarchy.prototype = {
  326. constructor: Node$1,
  327. count: node_count,
  328. each: node_each,
  329. eachAfter: node_eachAfter,
  330. eachBefore: node_eachBefore,
  331. find: node_find,
  332. sum: node_sum,
  333. sort: node_sort,
  334. path: node_path,
  335. ancestors: node_ancestors,
  336. descendants: node_descendants,
  337. leaves: node_leaves,
  338. links: node_links,
  339. copy: node_copy,
  340. [Symbol.iterator]: node_iterator
  341. };
  342. function required(f) {
  343. if (typeof f !== "function") throw new Error;
  344. return f;
  345. }
  346. function constantZero() {
  347. return 0;
  348. }
  349. function constant$1(x) {
  350. return function() {
  351. return x;
  352. };
  353. }
  354. function roundNode(node) {
  355. node.x0 = Math.round(node.x0);
  356. node.y0 = Math.round(node.y0);
  357. node.x1 = Math.round(node.x1);
  358. node.y1 = Math.round(node.y1);
  359. }
  360. function treemapDice(parent, x0, y0, x1, y1) {
  361. var nodes = parent.children,
  362. node,
  363. i = -1,
  364. n = nodes.length,
  365. k = parent.value && (x1 - x0) / parent.value;
  366. while (++i < n) {
  367. node = nodes[i], node.y0 = y0, node.y1 = y1;
  368. node.x0 = x0, node.x1 = x0 += node.value * k;
  369. }
  370. }
  371. function treemapSlice(parent, x0, y0, x1, y1) {
  372. var nodes = parent.children,
  373. node,
  374. i = -1,
  375. n = nodes.length,
  376. k = parent.value && (y1 - y0) / parent.value;
  377. while (++i < n) {
  378. node = nodes[i], node.x0 = x0, node.x1 = x1;
  379. node.y0 = y0, node.y1 = y0 += node.value * k;
  380. }
  381. }
  382. var phi = (1 + Math.sqrt(5)) / 2;
  383. function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
  384. var rows = [],
  385. nodes = parent.children,
  386. row,
  387. nodeValue,
  388. i0 = 0,
  389. i1 = 0,
  390. n = nodes.length,
  391. dx, dy,
  392. value = parent.value,
  393. sumValue,
  394. minValue,
  395. maxValue,
  396. newRatio,
  397. minRatio,
  398. alpha,
  399. beta;
  400. while (i0 < n) {
  401. dx = x1 - x0, dy = y1 - y0;
  402. // Find the next non-empty node.
  403. do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);
  404. minValue = maxValue = sumValue;
  405. alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
  406. beta = sumValue * sumValue * alpha;
  407. minRatio = Math.max(maxValue / beta, beta / minValue);
  408. // Keep adding nodes while the aspect ratio maintains or improves.
  409. for (; i1 < n; ++i1) {
  410. sumValue += nodeValue = nodes[i1].value;
  411. if (nodeValue < minValue) minValue = nodeValue;
  412. if (nodeValue > maxValue) maxValue = nodeValue;
  413. beta = sumValue * sumValue * alpha;
  414. newRatio = Math.max(maxValue / beta, beta / minValue);
  415. if (newRatio > minRatio) { sumValue -= nodeValue; break; }
  416. minRatio = newRatio;
  417. }
  418. // Position and record the row orientation.
  419. rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});
  420. if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
  421. else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
  422. value -= sumValue, i0 = i1;
  423. }
  424. return rows;
  425. }
  426. var squarify = (function custom(ratio) {
  427. function squarify(parent, x0, y0, x1, y1) {
  428. squarifyRatio(ratio, parent, x0, y0, x1, y1);
  429. }
  430. squarify.ratio = function(x) {
  431. return custom((x = +x) > 1 ? x : 1);
  432. };
  433. return squarify;
  434. })(phi);
  435. function treemap() {
  436. var tile = squarify,
  437. round = false,
  438. dx = 1,
  439. dy = 1,
  440. paddingStack = [0],
  441. paddingInner = constantZero,
  442. paddingTop = constantZero,
  443. paddingRight = constantZero,
  444. paddingBottom = constantZero,
  445. paddingLeft = constantZero;
  446. function treemap(root) {
  447. root.x0 =
  448. root.y0 = 0;
  449. root.x1 = dx;
  450. root.y1 = dy;
  451. root.eachBefore(positionNode);
  452. paddingStack = [0];
  453. if (round) root.eachBefore(roundNode);
  454. return root;
  455. }
  456. function positionNode(node) {
  457. var p = paddingStack[node.depth],
  458. x0 = node.x0 + p,
  459. y0 = node.y0 + p,
  460. x1 = node.x1 - p,
  461. y1 = node.y1 - p;
  462. if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
  463. if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
  464. node.x0 = x0;
  465. node.y0 = y0;
  466. node.x1 = x1;
  467. node.y1 = y1;
  468. if (node.children) {
  469. p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
  470. x0 += paddingLeft(node) - p;
  471. y0 += paddingTop(node) - p;
  472. x1 -= paddingRight(node) - p;
  473. y1 -= paddingBottom(node) - p;
  474. if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
  475. if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
  476. tile(node, x0, y0, x1, y1);
  477. }
  478. }
  479. treemap.round = function(x) {
  480. return arguments.length ? (round = !!x, treemap) : round;
  481. };
  482. treemap.size = function(x) {
  483. return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];
  484. };
  485. treemap.tile = function(x) {
  486. return arguments.length ? (tile = required(x), treemap) : tile;
  487. };
  488. treemap.padding = function(x) {
  489. return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
  490. };
  491. treemap.paddingInner = function(x) {
  492. return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$1(+x), treemap) : paddingInner;
  493. };
  494. treemap.paddingOuter = function(x) {
  495. return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
  496. };
  497. treemap.paddingTop = function(x) {
  498. return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$1(+x), treemap) : paddingTop;
  499. };
  500. treemap.paddingRight = function(x) {
  501. return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$1(+x), treemap) : paddingRight;
  502. };
  503. treemap.paddingBottom = function(x) {
  504. return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$1(+x), treemap) : paddingBottom;
  505. };
  506. treemap.paddingLeft = function(x) {
  507. return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$1(+x), treemap) : paddingLeft;
  508. };
  509. return treemap;
  510. }
  511. var treemapResquarify = (function custom(ratio) {
  512. function resquarify(parent, x0, y0, x1, y1) {
  513. if ((rows = parent._squarify) && (rows.ratio === ratio)) {
  514. var rows,
  515. row,
  516. nodes,
  517. i,
  518. j = -1,
  519. n,
  520. m = rows.length,
  521. value = parent.value;
  522. while (++j < m) {
  523. row = rows[j], nodes = row.children;
  524. for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;
  525. if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1);
  526. else treemapSlice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1);
  527. value -= row.value;
  528. }
  529. } else {
  530. parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);
  531. rows.ratio = ratio;
  532. }
  533. }
  534. resquarify.ratio = function(x) {
  535. return custom((x = +x) > 1 ? x : 1);
  536. };
  537. return resquarify;
  538. })(phi);
  539. const isModuleTree = (mod) => "children" in mod;
  540. let count = 0;
  541. class Id {
  542. constructor(id) {
  543. this._id = id;
  544. const url = new URL(window.location.href);
  545. url.hash = id;
  546. this._href = url.toString();
  547. }
  548. get id() {
  549. return this._id;
  550. }
  551. get href() {
  552. return this._href;
  553. }
  554. toString() {
  555. return `url(${this.href})`;
  556. }
  557. }
  558. function generateUniqueId(name) {
  559. count += 1;
  560. const id = ["O", name, count].filter(Boolean).join("-");
  561. return new Id(id);
  562. }
  563. const LABELS = {
  564. renderedLength: "Rendered",
  565. gzipLength: "Gzip",
  566. brotliLength: "Brotli",
  567. };
  568. const getAvailableSizeOptions = (options) => {
  569. const availableSizeProperties = ["renderedLength"];
  570. if (options.gzip) {
  571. availableSizeProperties.push("gzipLength");
  572. }
  573. if (options.brotli) {
  574. availableSizeProperties.push("brotliLength");
  575. }
  576. return availableSizeProperties;
  577. };
  578. var t,r,u,i,o=0,f=[],c=l$1,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function d(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function h(n){return o=1,p(D,n)}function p(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[D(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)){var f=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 !c||c.call(this,n,t,r);var i=o.__c.props!==n;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),c&&c.call(this,n,t,r)||i};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r.shouldComponentUpdate=f;}return o.__N||o.__}function y(n,u){var i=d(t++,3);!c.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__H.__h.push(i));}function _(n,u){var i=d(t++,4);!c.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__h.push(i));}function A(n){return o=5,T(function(){return {current:n}},[])}function T(n,r){var u=d(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q(n,t){return o=8,T(function(){return n},t)}function x(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 j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[];}catch(t){n.__H.__h=[],c.__e(t,n.__v);}}c.__b=function(n){r=null,e&&e(n);},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t);},c.__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.i=n.__N=void 0;})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r;},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0;})),u=r=null;},c.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return !n.__||B(n)});}catch(r){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],c.__e(r,n.__v);}}),l&&l(n,t);},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n);}catch(n){t=n;}}),r.__H=void 0,t&&c.__e(t,r.__v));};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);k&&(t=requestAnimationFrame(r));}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function B(n){var t=r;n.__c=n.__(),r=t;}function C(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return "function"==typeof t?t(n):t}
  579. const PLACEHOLDER = "*/**/file.js";
  580. const SideBar = ({ availableSizeProperties, sizeProperty, setSizeProperty, onExcludeChange, onIncludeChange, }) => {
  581. const [includeValue, setIncludeValue] = h("");
  582. const [excludeValue, setExcludeValue] = h("");
  583. const handleSizePropertyChange = (sizeProp) => () => {
  584. if (sizeProp !== sizeProperty) {
  585. setSizeProperty(sizeProp);
  586. }
  587. };
  588. const handleIncludeChange = (event) => {
  589. const value = event.currentTarget.value;
  590. setIncludeValue(value);
  591. onIncludeChange(value);
  592. };
  593. const handleExcludeChange = (event) => {
  594. const value = event.currentTarget.value;
  595. setExcludeValue(value);
  596. onExcludeChange(value);
  597. };
  598. return (u$1("aside", { className: "sidebar", children: [u$1("div", { className: "size-selectors", children: availableSizeProperties.length > 1 &&
  599. availableSizeProperties.map((sizeProp) => {
  600. const id = `selector-${sizeProp}`;
  601. return (u$1("div", { className: "size-selector", children: [u$1("input", { type: "radio", id: id, checked: sizeProp === sizeProperty, onChange: handleSizePropertyChange(sizeProp) }), u$1("label", { htmlFor: id, children: LABELS[sizeProp] })] }, sizeProp));
  602. }) }), u$1("div", { className: "module-filters", children: [u$1("div", { className: "module-filter", children: [u$1("label", { htmlFor: "module-filter-exclude", children: "Exclude" }), u$1("input", { type: "text", id: "module-filter-exclude", value: excludeValue, onInput: handleExcludeChange, placeholder: PLACEHOLDER })] }), u$1("div", { className: "module-filter", children: [u$1("label", { htmlFor: "module-filter-include", children: "Include" }), u$1("input", { type: "text", id: "module-filter-include", value: includeValue, onInput: handleIncludeChange, placeholder: PLACEHOLDER })] })] })] }));
  603. };
  604. function getDefaultExportFromCjs (x) {
  605. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  606. }
  607. var utils = {};
  608. var constants$1;
  609. var hasRequiredConstants;
  610. function requireConstants () {
  611. if (hasRequiredConstants) return constants$1;
  612. hasRequiredConstants = 1;
  613. const WIN_SLASH = '\\\\/';
  614. const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
  615. /**
  616. * Posix glob regex
  617. */
  618. const DOT_LITERAL = '\\.';
  619. const PLUS_LITERAL = '\\+';
  620. const QMARK_LITERAL = '\\?';
  621. const SLASH_LITERAL = '\\/';
  622. const ONE_CHAR = '(?=.)';
  623. const QMARK = '[^/]';
  624. const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
  625. const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
  626. const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
  627. const NO_DOT = `(?!${DOT_LITERAL})`;
  628. const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
  629. const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
  630. const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
  631. const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
  632. const STAR = `${QMARK}*?`;
  633. const SEP = '/';
  634. const POSIX_CHARS = {
  635. DOT_LITERAL,
  636. PLUS_LITERAL,
  637. QMARK_LITERAL,
  638. SLASH_LITERAL,
  639. ONE_CHAR,
  640. QMARK,
  641. END_ANCHOR,
  642. DOTS_SLASH,
  643. NO_DOT,
  644. NO_DOTS,
  645. NO_DOT_SLASH,
  646. NO_DOTS_SLASH,
  647. QMARK_NO_DOT,
  648. STAR,
  649. START_ANCHOR,
  650. SEP
  651. };
  652. /**
  653. * Windows glob regex
  654. */
  655. const WINDOWS_CHARS = {
  656. ...POSIX_CHARS,
  657. SLASH_LITERAL: `[${WIN_SLASH}]`,
  658. QMARK: WIN_NO_SLASH,
  659. STAR: `${WIN_NO_SLASH}*?`,
  660. DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
  661. NO_DOT: `(?!${DOT_LITERAL})`,
  662. NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  663. NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
  664. NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  665. QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
  666. START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
  667. END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
  668. SEP: '\\'
  669. };
  670. /**
  671. * POSIX Bracket Regex
  672. */
  673. const POSIX_REGEX_SOURCE = {
  674. alnum: 'a-zA-Z0-9',
  675. alpha: 'a-zA-Z',
  676. ascii: '\\x00-\\x7F',
  677. blank: ' \\t',
  678. cntrl: '\\x00-\\x1F\\x7F',
  679. digit: '0-9',
  680. graph: '\\x21-\\x7E',
  681. lower: 'a-z',
  682. print: '\\x20-\\x7E ',
  683. punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
  684. space: ' \\t\\r\\n\\v\\f',
  685. upper: 'A-Z',
  686. word: 'A-Za-z0-9_',
  687. xdigit: 'A-Fa-f0-9'
  688. };
  689. constants$1 = {
  690. MAX_LENGTH: 1024 * 64,
  691. POSIX_REGEX_SOURCE,
  692. // regular expressions
  693. REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
  694. REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
  695. REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
  696. REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
  697. REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
  698. REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
  699. // Replace globs with equivalent patterns to reduce parsing time.
  700. REPLACEMENTS: {
  701. '***': '*',
  702. '**/**': '**',
  703. '**/**/**': '**'
  704. },
  705. // Digits
  706. CHAR_0: 48, /* 0 */
  707. CHAR_9: 57, /* 9 */
  708. // Alphabet chars.
  709. CHAR_UPPERCASE_A: 65, /* A */
  710. CHAR_LOWERCASE_A: 97, /* a */
  711. CHAR_UPPERCASE_Z: 90, /* Z */
  712. CHAR_LOWERCASE_Z: 122, /* z */
  713. CHAR_LEFT_PARENTHESES: 40, /* ( */
  714. CHAR_RIGHT_PARENTHESES: 41, /* ) */
  715. CHAR_ASTERISK: 42, /* * */
  716. // Non-alphabetic chars.
  717. CHAR_AMPERSAND: 38, /* & */
  718. CHAR_AT: 64, /* @ */
  719. CHAR_BACKWARD_SLASH: 92, /* \ */
  720. CHAR_CARRIAGE_RETURN: 13, /* \r */
  721. CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
  722. CHAR_COLON: 58, /* : */
  723. CHAR_COMMA: 44, /* , */
  724. CHAR_DOT: 46, /* . */
  725. CHAR_DOUBLE_QUOTE: 34, /* " */
  726. CHAR_EQUAL: 61, /* = */
  727. CHAR_EXCLAMATION_MARK: 33, /* ! */
  728. CHAR_FORM_FEED: 12, /* \f */
  729. CHAR_FORWARD_SLASH: 47, /* / */
  730. CHAR_GRAVE_ACCENT: 96, /* ` */
  731. CHAR_HASH: 35, /* # */
  732. CHAR_HYPHEN_MINUS: 45, /* - */
  733. CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
  734. CHAR_LEFT_CURLY_BRACE: 123, /* { */
  735. CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
  736. CHAR_LINE_FEED: 10, /* \n */
  737. CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
  738. CHAR_PERCENT: 37, /* % */
  739. CHAR_PLUS: 43, /* + */
  740. CHAR_QUESTION_MARK: 63, /* ? */
  741. CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
  742. CHAR_RIGHT_CURLY_BRACE: 125, /* } */
  743. CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
  744. CHAR_SEMICOLON: 59, /* ; */
  745. CHAR_SINGLE_QUOTE: 39, /* ' */
  746. CHAR_SPACE: 32, /* */
  747. CHAR_TAB: 9, /* \t */
  748. CHAR_UNDERSCORE: 95, /* _ */
  749. CHAR_VERTICAL_LINE: 124, /* | */
  750. CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
  751. /**
  752. * Create EXTGLOB_CHARS
  753. */
  754. extglobChars(chars) {
  755. return {
  756. '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
  757. '?': { type: 'qmark', open: '(?:', close: ')?' },
  758. '+': { type: 'plus', open: '(?:', close: ')+' },
  759. '*': { type: 'star', open: '(?:', close: ')*' },
  760. '@': { type: 'at', open: '(?:', close: ')' }
  761. };
  762. },
  763. /**
  764. * Create GLOB_CHARS
  765. */
  766. globChars(win32) {
  767. return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
  768. }
  769. };
  770. return constants$1;
  771. }
  772. /*global navigator*/
  773. var hasRequiredUtils;
  774. function requireUtils () {
  775. if (hasRequiredUtils) return utils;
  776. hasRequiredUtils = 1;
  777. (function (exports) {
  778. const {
  779. REGEX_BACKSLASH,
  780. REGEX_REMOVE_BACKSLASH,
  781. REGEX_SPECIAL_CHARS,
  782. REGEX_SPECIAL_CHARS_GLOBAL
  783. } = /*@__PURE__*/ requireConstants();
  784. exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
  785. exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
  786. exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
  787. exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
  788. exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
  789. exports.isWindows = () => {
  790. if (typeof navigator !== 'undefined' && navigator.platform) {
  791. const platform = navigator.platform.toLowerCase();
  792. return platform === 'win32' || platform === 'windows';
  793. }
  794. if (typeof process !== 'undefined' && process.platform) {
  795. return process.platform === 'win32';
  796. }
  797. return false;
  798. };
  799. exports.removeBackslashes = str => {
  800. return str.replace(REGEX_REMOVE_BACKSLASH, match => {
  801. return match === '\\' ? '' : match;
  802. });
  803. };
  804. exports.escapeLast = (input, char, lastIdx) => {
  805. const idx = input.lastIndexOf(char, lastIdx);
  806. if (idx === -1) return input;
  807. if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
  808. return `${input.slice(0, idx)}\\${input.slice(idx)}`;
  809. };
  810. exports.removePrefix = (input, state = {}) => {
  811. let output = input;
  812. if (output.startsWith('./')) {
  813. output = output.slice(2);
  814. state.prefix = './';
  815. }
  816. return output;
  817. };
  818. exports.wrapOutput = (input, state = {}, options = {}) => {
  819. const prepend = options.contains ? '' : '^';
  820. const append = options.contains ? '' : '$';
  821. let output = `${prepend}(?:${input})${append}`;
  822. if (state.negated === true) {
  823. output = `(?:^(?!${output}).*$)`;
  824. }
  825. return output;
  826. };
  827. exports.basename = (path, { windows } = {}) => {
  828. const segs = path.split(windows ? /[\\/]/ : '/');
  829. const last = segs[segs.length - 1];
  830. if (last === '') {
  831. return segs[segs.length - 2];
  832. }
  833. return last;
  834. };
  835. } (utils));
  836. return utils;
  837. }
  838. var scan_1;
  839. var hasRequiredScan;
  840. function requireScan () {
  841. if (hasRequiredScan) return scan_1;
  842. hasRequiredScan = 1;
  843. const utils = /*@__PURE__*/ requireUtils();
  844. const {
  845. CHAR_ASTERISK, /* * */
  846. CHAR_AT, /* @ */
  847. CHAR_BACKWARD_SLASH, /* \ */
  848. CHAR_COMMA, /* , */
  849. CHAR_DOT, /* . */
  850. CHAR_EXCLAMATION_MARK, /* ! */
  851. CHAR_FORWARD_SLASH, /* / */
  852. CHAR_LEFT_CURLY_BRACE, /* { */
  853. CHAR_LEFT_PARENTHESES, /* ( */
  854. CHAR_LEFT_SQUARE_BRACKET, /* [ */
  855. CHAR_PLUS, /* + */
  856. CHAR_QUESTION_MARK, /* ? */
  857. CHAR_RIGHT_CURLY_BRACE, /* } */
  858. CHAR_RIGHT_PARENTHESES, /* ) */
  859. CHAR_RIGHT_SQUARE_BRACKET /* ] */
  860. } = /*@__PURE__*/ requireConstants();
  861. const isPathSeparator = code => {
  862. return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
  863. };
  864. const depth = token => {
  865. if (token.isPrefix !== true) {
  866. token.depth = token.isGlobstar ? Infinity : 1;
  867. }
  868. };
  869. /**
  870. * Quickly scans a glob pattern and returns an object with a handful of
  871. * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
  872. * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
  873. * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
  874. *
  875. * ```js
  876. * const pm = require('picomatch');
  877. * console.log(pm.scan('foo/bar/*.js'));
  878. * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
  879. * ```
  880. * @param {String} `str`
  881. * @param {Object} `options`
  882. * @return {Object} Returns an object with tokens and regex source string.
  883. * @api public
  884. */
  885. const scan = (input, options) => {
  886. const opts = options || {};
  887. const length = input.length - 1;
  888. const scanToEnd = opts.parts === true || opts.scanToEnd === true;
  889. const slashes = [];
  890. const tokens = [];
  891. const parts = [];
  892. let str = input;
  893. let index = -1;
  894. let start = 0;
  895. let lastIndex = 0;
  896. let isBrace = false;
  897. let isBracket = false;
  898. let isGlob = false;
  899. let isExtglob = false;
  900. let isGlobstar = false;
  901. let braceEscaped = false;
  902. let backslashes = false;
  903. let negated = false;
  904. let negatedExtglob = false;
  905. let finished = false;
  906. let braces = 0;
  907. let prev;
  908. let code;
  909. let token = { value: '', depth: 0, isGlob: false };
  910. const eos = () => index >= length;
  911. const peek = () => str.charCodeAt(index + 1);
  912. const advance = () => {
  913. prev = code;
  914. return str.charCodeAt(++index);
  915. };
  916. while (index < length) {
  917. code = advance();
  918. let next;
  919. if (code === CHAR_BACKWARD_SLASH) {
  920. backslashes = token.backslashes = true;
  921. code = advance();
  922. if (code === CHAR_LEFT_CURLY_BRACE) {
  923. braceEscaped = true;
  924. }
  925. continue;
  926. }
  927. if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
  928. braces++;
  929. while (eos() !== true && (code = advance())) {
  930. if (code === CHAR_BACKWARD_SLASH) {
  931. backslashes = token.backslashes = true;
  932. advance();
  933. continue;
  934. }
  935. if (code === CHAR_LEFT_CURLY_BRACE) {
  936. braces++;
  937. continue;
  938. }
  939. if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
  940. isBrace = token.isBrace = true;
  941. isGlob = token.isGlob = true;
  942. finished = true;
  943. if (scanToEnd === true) {
  944. continue;
  945. }
  946. break;
  947. }
  948. if (braceEscaped !== true && code === CHAR_COMMA) {
  949. isBrace = token.isBrace = true;
  950. isGlob = token.isGlob = true;
  951. finished = true;
  952. if (scanToEnd === true) {
  953. continue;
  954. }
  955. break;
  956. }
  957. if (code === CHAR_RIGHT_CURLY_BRACE) {
  958. braces--;
  959. if (braces === 0) {
  960. braceEscaped = false;
  961. isBrace = token.isBrace = true;
  962. finished = true;
  963. break;
  964. }
  965. }
  966. }
  967. if (scanToEnd === true) {
  968. continue;
  969. }
  970. break;
  971. }
  972. if (code === CHAR_FORWARD_SLASH) {
  973. slashes.push(index);
  974. tokens.push(token);
  975. token = { value: '', depth: 0, isGlob: false };
  976. if (finished === true) continue;
  977. if (prev === CHAR_DOT && index === (start + 1)) {
  978. start += 2;
  979. continue;
  980. }
  981. lastIndex = index + 1;
  982. continue;
  983. }
  984. if (opts.noext !== true) {
  985. const isExtglobChar = code === CHAR_PLUS
  986. || code === CHAR_AT
  987. || code === CHAR_ASTERISK
  988. || code === CHAR_QUESTION_MARK
  989. || code === CHAR_EXCLAMATION_MARK;
  990. if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
  991. isGlob = token.isGlob = true;
  992. isExtglob = token.isExtglob = true;
  993. finished = true;
  994. if (code === CHAR_EXCLAMATION_MARK && index === start) {
  995. negatedExtglob = true;
  996. }
  997. if (scanToEnd === true) {
  998. while (eos() !== true && (code = advance())) {
  999. if (code === CHAR_BACKWARD_SLASH) {
  1000. backslashes = token.backslashes = true;
  1001. code = advance();
  1002. continue;
  1003. }
  1004. if (code === CHAR_RIGHT_PARENTHESES) {
  1005. isGlob = token.isGlob = true;
  1006. finished = true;
  1007. break;
  1008. }
  1009. }
  1010. continue;
  1011. }
  1012. break;
  1013. }
  1014. }
  1015. if (code === CHAR_ASTERISK) {
  1016. if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
  1017. isGlob = token.isGlob = true;
  1018. finished = true;
  1019. if (scanToEnd === true) {
  1020. continue;
  1021. }
  1022. break;
  1023. }
  1024. if (code === CHAR_QUESTION_MARK) {
  1025. isGlob = token.isGlob = true;
  1026. finished = true;
  1027. if (scanToEnd === true) {
  1028. continue;
  1029. }
  1030. break;
  1031. }
  1032. if (code === CHAR_LEFT_SQUARE_BRACKET) {
  1033. while (eos() !== true && (next = advance())) {
  1034. if (next === CHAR_BACKWARD_SLASH) {
  1035. backslashes = token.backslashes = true;
  1036. advance();
  1037. continue;
  1038. }
  1039. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  1040. isBracket = token.isBracket = true;
  1041. isGlob = token.isGlob = true;
  1042. finished = true;
  1043. break;
  1044. }
  1045. }
  1046. if (scanToEnd === true) {
  1047. continue;
  1048. }
  1049. break;
  1050. }
  1051. if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
  1052. negated = token.negated = true;
  1053. start++;
  1054. continue;
  1055. }
  1056. if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
  1057. isGlob = token.isGlob = true;
  1058. if (scanToEnd === true) {
  1059. while (eos() !== true && (code = advance())) {
  1060. if (code === CHAR_LEFT_PARENTHESES) {
  1061. backslashes = token.backslashes = true;
  1062. code = advance();
  1063. continue;
  1064. }
  1065. if (code === CHAR_RIGHT_PARENTHESES) {
  1066. finished = true;
  1067. break;
  1068. }
  1069. }
  1070. continue;
  1071. }
  1072. break;
  1073. }
  1074. if (isGlob === true) {
  1075. finished = true;
  1076. if (scanToEnd === true) {
  1077. continue;
  1078. }
  1079. break;
  1080. }
  1081. }
  1082. if (opts.noext === true) {
  1083. isExtglob = false;
  1084. isGlob = false;
  1085. }
  1086. let base = str;
  1087. let prefix = '';
  1088. let glob = '';
  1089. if (start > 0) {
  1090. prefix = str.slice(0, start);
  1091. str = str.slice(start);
  1092. lastIndex -= start;
  1093. }
  1094. if (base && isGlob === true && lastIndex > 0) {
  1095. base = str.slice(0, lastIndex);
  1096. glob = str.slice(lastIndex);
  1097. } else if (isGlob === true) {
  1098. base = '';
  1099. glob = str;
  1100. } else {
  1101. base = str;
  1102. }
  1103. if (base && base !== '' && base !== '/' && base !== str) {
  1104. if (isPathSeparator(base.charCodeAt(base.length - 1))) {
  1105. base = base.slice(0, -1);
  1106. }
  1107. }
  1108. if (opts.unescape === true) {
  1109. if (glob) glob = utils.removeBackslashes(glob);
  1110. if (base && backslashes === true) {
  1111. base = utils.removeBackslashes(base);
  1112. }
  1113. }
  1114. const state = {
  1115. prefix,
  1116. input,
  1117. start,
  1118. base,
  1119. glob,
  1120. isBrace,
  1121. isBracket,
  1122. isGlob,
  1123. isExtglob,
  1124. isGlobstar,
  1125. negated,
  1126. negatedExtglob
  1127. };
  1128. if (opts.tokens === true) {
  1129. state.maxDepth = 0;
  1130. if (!isPathSeparator(code)) {
  1131. tokens.push(token);
  1132. }
  1133. state.tokens = tokens;
  1134. }
  1135. if (opts.parts === true || opts.tokens === true) {
  1136. let prevIndex;
  1137. for (let idx = 0; idx < slashes.length; idx++) {
  1138. const n = prevIndex ? prevIndex + 1 : start;
  1139. const i = slashes[idx];
  1140. const value = input.slice(n, i);
  1141. if (opts.tokens) {
  1142. if (idx === 0 && start !== 0) {
  1143. tokens[idx].isPrefix = true;
  1144. tokens[idx].value = prefix;
  1145. } else {
  1146. tokens[idx].value = value;
  1147. }
  1148. depth(tokens[idx]);
  1149. state.maxDepth += tokens[idx].depth;
  1150. }
  1151. if (idx !== 0 || value !== '') {
  1152. parts.push(value);
  1153. }
  1154. prevIndex = i;
  1155. }
  1156. if (prevIndex && prevIndex + 1 < input.length) {
  1157. const value = input.slice(prevIndex + 1);
  1158. parts.push(value);
  1159. if (opts.tokens) {
  1160. tokens[tokens.length - 1].value = value;
  1161. depth(tokens[tokens.length - 1]);
  1162. state.maxDepth += tokens[tokens.length - 1].depth;
  1163. }
  1164. }
  1165. state.slashes = slashes;
  1166. state.parts = parts;
  1167. }
  1168. return state;
  1169. };
  1170. scan_1 = scan;
  1171. return scan_1;
  1172. }
  1173. var parse_1;
  1174. var hasRequiredParse;
  1175. function requireParse () {
  1176. if (hasRequiredParse) return parse_1;
  1177. hasRequiredParse = 1;
  1178. const constants = /*@__PURE__*/ requireConstants();
  1179. const utils = /*@__PURE__*/ requireUtils();
  1180. /**
  1181. * Constants
  1182. */
  1183. const {
  1184. MAX_LENGTH,
  1185. POSIX_REGEX_SOURCE,
  1186. REGEX_NON_SPECIAL_CHARS,
  1187. REGEX_SPECIAL_CHARS_BACKREF,
  1188. REPLACEMENTS
  1189. } = constants;
  1190. /**
  1191. * Helpers
  1192. */
  1193. const expandRange = (args, options) => {
  1194. if (typeof options.expandRange === 'function') {
  1195. return options.expandRange(...args, options);
  1196. }
  1197. args.sort();
  1198. const value = `[${args.join('-')}]`;
  1199. try {
  1200. /* eslint-disable-next-line no-new */
  1201. new RegExp(value);
  1202. } catch (ex) {
  1203. return args.map(v => utils.escapeRegex(v)).join('..');
  1204. }
  1205. return value;
  1206. };
  1207. /**
  1208. * Create the message for a syntax error
  1209. */
  1210. const syntaxError = (type, char) => {
  1211. return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
  1212. };
  1213. /**
  1214. * Parse the given input string.
  1215. * @param {String} input
  1216. * @param {Object} options
  1217. * @return {Object}
  1218. */
  1219. const parse = (input, options) => {
  1220. if (typeof input !== 'string') {
  1221. throw new TypeError('Expected a string');
  1222. }
  1223. input = REPLACEMENTS[input] || input;
  1224. const opts = { ...options };
  1225. const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  1226. let len = input.length;
  1227. if (len > max) {
  1228. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  1229. }
  1230. const bos = { type: 'bos', value: '', output: opts.prepend || '' };
  1231. const tokens = [bos];
  1232. const capture = opts.capture ? '' : '?:';
  1233. // create constants based on platform, for windows or posix
  1234. const PLATFORM_CHARS = constants.globChars(opts.windows);
  1235. const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
  1236. const {
  1237. DOT_LITERAL,
  1238. PLUS_LITERAL,
  1239. SLASH_LITERAL,
  1240. ONE_CHAR,
  1241. DOTS_SLASH,
  1242. NO_DOT,
  1243. NO_DOT_SLASH,
  1244. NO_DOTS_SLASH,
  1245. QMARK,
  1246. QMARK_NO_DOT,
  1247. STAR,
  1248. START_ANCHOR
  1249. } = PLATFORM_CHARS;
  1250. const globstar = opts => {
  1251. return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  1252. };
  1253. const nodot = opts.dot ? '' : NO_DOT;
  1254. const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
  1255. let star = opts.bash === true ? globstar(opts) : STAR;
  1256. if (opts.capture) {
  1257. star = `(${star})`;
  1258. }
  1259. // minimatch options support
  1260. if (typeof opts.noext === 'boolean') {
  1261. opts.noextglob = opts.noext;
  1262. }
  1263. const state = {
  1264. input,
  1265. index: -1,
  1266. start: 0,
  1267. dot: opts.dot === true,
  1268. consumed: '',
  1269. output: '',
  1270. prefix: '',
  1271. backtrack: false,
  1272. negated: false,
  1273. brackets: 0,
  1274. braces: 0,
  1275. parens: 0,
  1276. quotes: 0,
  1277. globstar: false,
  1278. tokens
  1279. };
  1280. input = utils.removePrefix(input, state);
  1281. len = input.length;
  1282. const extglobs = [];
  1283. const braces = [];
  1284. const stack = [];
  1285. let prev = bos;
  1286. let value;
  1287. /**
  1288. * Tokenizing helpers
  1289. */
  1290. const eos = () => state.index === len - 1;
  1291. const peek = state.peek = (n = 1) => input[state.index + n];
  1292. const advance = state.advance = () => input[++state.index] || '';
  1293. const remaining = () => input.slice(state.index + 1);
  1294. const consume = (value = '', num = 0) => {
  1295. state.consumed += value;
  1296. state.index += num;
  1297. };
  1298. const append = token => {
  1299. state.output += token.output != null ? token.output : token.value;
  1300. consume(token.value);
  1301. };
  1302. const negate = () => {
  1303. let count = 1;
  1304. while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
  1305. advance();
  1306. state.start++;
  1307. count++;
  1308. }
  1309. if (count % 2 === 0) {
  1310. return false;
  1311. }
  1312. state.negated = true;
  1313. state.start++;
  1314. return true;
  1315. };
  1316. const increment = type => {
  1317. state[type]++;
  1318. stack.push(type);
  1319. };
  1320. const decrement = type => {
  1321. state[type]--;
  1322. stack.pop();
  1323. };
  1324. /**
  1325. * Push tokens onto the tokens array. This helper speeds up
  1326. * tokenizing by 1) helping us avoid backtracking as much as possible,
  1327. * and 2) helping us avoid creating extra tokens when consecutive
  1328. * characters are plain text. This improves performance and simplifies
  1329. * lookbehinds.
  1330. */
  1331. const push = tok => {
  1332. if (prev.type === 'globstar') {
  1333. const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
  1334. const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
  1335. if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
  1336. state.output = state.output.slice(0, -prev.output.length);
  1337. prev.type = 'star';
  1338. prev.value = '*';
  1339. prev.output = star;
  1340. state.output += prev.output;
  1341. }
  1342. }
  1343. if (extglobs.length && tok.type !== 'paren') {
  1344. extglobs[extglobs.length - 1].inner += tok.value;
  1345. }
  1346. if (tok.value || tok.output) append(tok);
  1347. if (prev && prev.type === 'text' && tok.type === 'text') {
  1348. prev.output = (prev.output || prev.value) + tok.value;
  1349. prev.value += tok.value;
  1350. return;
  1351. }
  1352. tok.prev = prev;
  1353. tokens.push(tok);
  1354. prev = tok;
  1355. };
  1356. const extglobOpen = (type, value) => {
  1357. const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
  1358. token.prev = prev;
  1359. token.parens = state.parens;
  1360. token.output = state.output;
  1361. const output = (opts.capture ? '(' : '') + token.open;
  1362. increment('parens');
  1363. push({ type, value, output: state.output ? '' : ONE_CHAR });
  1364. push({ type: 'paren', extglob: true, value: advance(), output });
  1365. extglobs.push(token);
  1366. };
  1367. const extglobClose = token => {
  1368. let output = token.close + (opts.capture ? ')' : '');
  1369. let rest;
  1370. if (token.type === 'negate') {
  1371. let extglobStar = star;
  1372. if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
  1373. extglobStar = globstar(opts);
  1374. }
  1375. if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
  1376. output = token.close = `)$))${extglobStar}`;
  1377. }
  1378. if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
  1379. // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
  1380. // In this case, we need to parse the string and use it in the output of the original pattern.
  1381. // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
  1382. //
  1383. // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
  1384. const expression = parse(rest, { ...options, fastpaths: false }).output;
  1385. output = token.close = `)${expression})${extglobStar})`;
  1386. }
  1387. if (token.prev.type === 'bos') {
  1388. state.negatedExtglob = true;
  1389. }
  1390. }
  1391. push({ type: 'paren', extglob: true, value, output });
  1392. decrement('parens');
  1393. };
  1394. /**
  1395. * Fast paths
  1396. */
  1397. if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
  1398. let backslashes = false;
  1399. let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
  1400. if (first === '\\') {
  1401. backslashes = true;
  1402. return m;
  1403. }
  1404. if (first === '?') {
  1405. if (esc) {
  1406. return esc + first + (rest ? QMARK.repeat(rest.length) : '');
  1407. }
  1408. if (index === 0) {
  1409. return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
  1410. }
  1411. return QMARK.repeat(chars.length);
  1412. }
  1413. if (first === '.') {
  1414. return DOT_LITERAL.repeat(chars.length);
  1415. }
  1416. if (first === '*') {
  1417. if (esc) {
  1418. return esc + first + (rest ? star : '');
  1419. }
  1420. return star;
  1421. }
  1422. return esc ? m : `\\${m}`;
  1423. });
  1424. if (backslashes === true) {
  1425. if (opts.unescape === true) {
  1426. output = output.replace(/\\/g, '');
  1427. } else {
  1428. output = output.replace(/\\+/g, m => {
  1429. return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
  1430. });
  1431. }
  1432. }
  1433. if (output === input && opts.contains === true) {
  1434. state.output = input;
  1435. return state;
  1436. }
  1437. state.output = utils.wrapOutput(output, state, options);
  1438. return state;
  1439. }
  1440. /**
  1441. * Tokenize input until we reach end-of-string
  1442. */
  1443. while (!eos()) {
  1444. value = advance();
  1445. if (value === '\u0000') {
  1446. continue;
  1447. }
  1448. /**
  1449. * Escaped characters
  1450. */
  1451. if (value === '\\') {
  1452. const next = peek();
  1453. if (next === '/' && opts.bash !== true) {
  1454. continue;
  1455. }
  1456. if (next === '.' || next === ';') {
  1457. continue;
  1458. }
  1459. if (!next) {
  1460. value += '\\';
  1461. push({ type: 'text', value });
  1462. continue;
  1463. }
  1464. // collapse slashes to reduce potential for exploits
  1465. const match = /^\\+/.exec(remaining());
  1466. let slashes = 0;
  1467. if (match && match[0].length > 2) {
  1468. slashes = match[0].length;
  1469. state.index += slashes;
  1470. if (slashes % 2 !== 0) {
  1471. value += '\\';
  1472. }
  1473. }
  1474. if (opts.unescape === true) {
  1475. value = advance();
  1476. } else {
  1477. value += advance();
  1478. }
  1479. if (state.brackets === 0) {
  1480. push({ type: 'text', value });
  1481. continue;
  1482. }
  1483. }
  1484. /**
  1485. * If we're inside a regex character class, continue
  1486. * until we reach the closing bracket.
  1487. */
  1488. if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
  1489. if (opts.posix !== false && value === ':') {
  1490. const inner = prev.value.slice(1);
  1491. if (inner.includes('[')) {
  1492. prev.posix = true;
  1493. if (inner.includes(':')) {
  1494. const idx = prev.value.lastIndexOf('[');
  1495. const pre = prev.value.slice(0, idx);
  1496. const rest = prev.value.slice(idx + 2);
  1497. const posix = POSIX_REGEX_SOURCE[rest];
  1498. if (posix) {
  1499. prev.value = pre + posix;
  1500. state.backtrack = true;
  1501. advance();
  1502. if (!bos.output && tokens.indexOf(prev) === 1) {
  1503. bos.output = ONE_CHAR;
  1504. }
  1505. continue;
  1506. }
  1507. }
  1508. }
  1509. }
  1510. if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
  1511. value = `\\${value}`;
  1512. }
  1513. if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
  1514. value = `\\${value}`;
  1515. }
  1516. if (opts.posix === true && value === '!' && prev.value === '[') {
  1517. value = '^';
  1518. }
  1519. prev.value += value;
  1520. append({ value });
  1521. continue;
  1522. }
  1523. /**
  1524. * If we're inside a quoted string, continue
  1525. * until we reach the closing double quote.
  1526. */
  1527. if (state.quotes === 1 && value !== '"') {
  1528. value = utils.escapeRegex(value);
  1529. prev.value += value;
  1530. append({ value });
  1531. continue;
  1532. }
  1533. /**
  1534. * Double quotes
  1535. */
  1536. if (value === '"') {
  1537. state.quotes = state.quotes === 1 ? 0 : 1;
  1538. if (opts.keepQuotes === true) {
  1539. push({ type: 'text', value });
  1540. }
  1541. continue;
  1542. }
  1543. /**
  1544. * Parentheses
  1545. */
  1546. if (value === '(') {
  1547. increment('parens');
  1548. push({ type: 'paren', value });
  1549. continue;
  1550. }
  1551. if (value === ')') {
  1552. if (state.parens === 0 && opts.strictBrackets === true) {
  1553. throw new SyntaxError(syntaxError('opening', '('));
  1554. }
  1555. const extglob = extglobs[extglobs.length - 1];
  1556. if (extglob && state.parens === extglob.parens + 1) {
  1557. extglobClose(extglobs.pop());
  1558. continue;
  1559. }
  1560. push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
  1561. decrement('parens');
  1562. continue;
  1563. }
  1564. /**
  1565. * Square brackets
  1566. */
  1567. if (value === '[') {
  1568. if (opts.nobracket === true || !remaining().includes(']')) {
  1569. if (opts.nobracket !== true && opts.strictBrackets === true) {
  1570. throw new SyntaxError(syntaxError('closing', ']'));
  1571. }
  1572. value = `\\${value}`;
  1573. } else {
  1574. increment('brackets');
  1575. }
  1576. push({ type: 'bracket', value });
  1577. continue;
  1578. }
  1579. if (value === ']') {
  1580. if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
  1581. push({ type: 'text', value, output: `\\${value}` });
  1582. continue;
  1583. }
  1584. if (state.brackets === 0) {
  1585. if (opts.strictBrackets === true) {
  1586. throw new SyntaxError(syntaxError('opening', '['));
  1587. }
  1588. push({ type: 'text', value, output: `\\${value}` });
  1589. continue;
  1590. }
  1591. decrement('brackets');
  1592. const prevValue = prev.value.slice(1);
  1593. if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
  1594. value = `/${value}`;
  1595. }
  1596. prev.value += value;
  1597. append({ value });
  1598. // when literal brackets are explicitly disabled
  1599. // assume we should match with a regex character class
  1600. if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
  1601. continue;
  1602. }
  1603. const escaped = utils.escapeRegex(prev.value);
  1604. state.output = state.output.slice(0, -prev.value.length);
  1605. // when literal brackets are explicitly enabled
  1606. // assume we should escape the brackets to match literal characters
  1607. if (opts.literalBrackets === true) {
  1608. state.output += escaped;
  1609. prev.value = escaped;
  1610. continue;
  1611. }
  1612. // when the user specifies nothing, try to match both
  1613. prev.value = `(${capture}${escaped}|${prev.value})`;
  1614. state.output += prev.value;
  1615. continue;
  1616. }
  1617. /**
  1618. * Braces
  1619. */
  1620. if (value === '{' && opts.nobrace !== true) {
  1621. increment('braces');
  1622. const open = {
  1623. type: 'brace',
  1624. value,
  1625. output: '(',
  1626. outputIndex: state.output.length,
  1627. tokensIndex: state.tokens.length
  1628. };
  1629. braces.push(open);
  1630. push(open);
  1631. continue;
  1632. }
  1633. if (value === '}') {
  1634. const brace = braces[braces.length - 1];
  1635. if (opts.nobrace === true || !brace) {
  1636. push({ type: 'text', value, output: value });
  1637. continue;
  1638. }
  1639. let output = ')';
  1640. if (brace.dots === true) {
  1641. const arr = tokens.slice();
  1642. const range = [];
  1643. for (let i = arr.length - 1; i >= 0; i--) {
  1644. tokens.pop();
  1645. if (arr[i].type === 'brace') {
  1646. break;
  1647. }
  1648. if (arr[i].type !== 'dots') {
  1649. range.unshift(arr[i].value);
  1650. }
  1651. }
  1652. output = expandRange(range, opts);
  1653. state.backtrack = true;
  1654. }
  1655. if (brace.comma !== true && brace.dots !== true) {
  1656. const out = state.output.slice(0, brace.outputIndex);
  1657. const toks = state.tokens.slice(brace.tokensIndex);
  1658. brace.value = brace.output = '\\{';
  1659. value = output = '\\}';
  1660. state.output = out;
  1661. for (const t of toks) {
  1662. state.output += (t.output || t.value);
  1663. }
  1664. }
  1665. push({ type: 'brace', value, output });
  1666. decrement('braces');
  1667. braces.pop();
  1668. continue;
  1669. }
  1670. /**
  1671. * Pipes
  1672. */
  1673. if (value === '|') {
  1674. if (extglobs.length > 0) {
  1675. extglobs[extglobs.length - 1].conditions++;
  1676. }
  1677. push({ type: 'text', value });
  1678. continue;
  1679. }
  1680. /**
  1681. * Commas
  1682. */
  1683. if (value === ',') {
  1684. let output = value;
  1685. const brace = braces[braces.length - 1];
  1686. if (brace && stack[stack.length - 1] === 'braces') {
  1687. brace.comma = true;
  1688. output = '|';
  1689. }
  1690. push({ type: 'comma', value, output });
  1691. continue;
  1692. }
  1693. /**
  1694. * Slashes
  1695. */
  1696. if (value === '/') {
  1697. // if the beginning of the glob is "./", advance the start
  1698. // to the current index, and don't add the "./" characters
  1699. // to the state. This greatly simplifies lookbehinds when
  1700. // checking for BOS characters like "!" and "." (not "./")
  1701. if (prev.type === 'dot' && state.index === state.start + 1) {
  1702. state.start = state.index + 1;
  1703. state.consumed = '';
  1704. state.output = '';
  1705. tokens.pop();
  1706. prev = bos; // reset "prev" to the first token
  1707. continue;
  1708. }
  1709. push({ type: 'slash', value, output: SLASH_LITERAL });
  1710. continue;
  1711. }
  1712. /**
  1713. * Dots
  1714. */
  1715. if (value === '.') {
  1716. if (state.braces > 0 && prev.type === 'dot') {
  1717. if (prev.value === '.') prev.output = DOT_LITERAL;
  1718. const brace = braces[braces.length - 1];
  1719. prev.type = 'dots';
  1720. prev.output += value;
  1721. prev.value += value;
  1722. brace.dots = true;
  1723. continue;
  1724. }
  1725. if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
  1726. push({ type: 'text', value, output: DOT_LITERAL });
  1727. continue;
  1728. }
  1729. push({ type: 'dot', value, output: DOT_LITERAL });
  1730. continue;
  1731. }
  1732. /**
  1733. * Question marks
  1734. */
  1735. if (value === '?') {
  1736. const isGroup = prev && prev.value === '(';
  1737. if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
  1738. extglobOpen('qmark', value);
  1739. continue;
  1740. }
  1741. if (prev && prev.type === 'paren') {
  1742. const next = peek();
  1743. let output = value;
  1744. if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
  1745. output = `\\${value}`;
  1746. }
  1747. push({ type: 'text', value, output });
  1748. continue;
  1749. }
  1750. if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
  1751. push({ type: 'qmark', value, output: QMARK_NO_DOT });
  1752. continue;
  1753. }
  1754. push({ type: 'qmark', value, output: QMARK });
  1755. continue;
  1756. }
  1757. /**
  1758. * Exclamation
  1759. */
  1760. if (value === '!') {
  1761. if (opts.noextglob !== true && peek() === '(') {
  1762. if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
  1763. extglobOpen('negate', value);
  1764. continue;
  1765. }
  1766. }
  1767. if (opts.nonegate !== true && state.index === 0) {
  1768. negate();
  1769. continue;
  1770. }
  1771. }
  1772. /**
  1773. * Plus
  1774. */
  1775. if (value === '+') {
  1776. if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
  1777. extglobOpen('plus', value);
  1778. continue;
  1779. }
  1780. if ((prev && prev.value === '(') || opts.regex === false) {
  1781. push({ type: 'plus', value, output: PLUS_LITERAL });
  1782. continue;
  1783. }
  1784. if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
  1785. push({ type: 'plus', value });
  1786. continue;
  1787. }
  1788. push({ type: 'plus', value: PLUS_LITERAL });
  1789. continue;
  1790. }
  1791. /**
  1792. * Plain text
  1793. */
  1794. if (value === '@') {
  1795. if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
  1796. push({ type: 'at', extglob: true, value, output: '' });
  1797. continue;
  1798. }
  1799. push({ type: 'text', value });
  1800. continue;
  1801. }
  1802. /**
  1803. * Plain text
  1804. */
  1805. if (value !== '*') {
  1806. if (value === '$' || value === '^') {
  1807. value = `\\${value}`;
  1808. }
  1809. const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
  1810. if (match) {
  1811. value += match[0];
  1812. state.index += match[0].length;
  1813. }
  1814. push({ type: 'text', value });
  1815. continue;
  1816. }
  1817. /**
  1818. * Stars
  1819. */
  1820. if (prev && (prev.type === 'globstar' || prev.star === true)) {
  1821. prev.type = 'star';
  1822. prev.star = true;
  1823. prev.value += value;
  1824. prev.output = star;
  1825. state.backtrack = true;
  1826. state.globstar = true;
  1827. consume(value);
  1828. continue;
  1829. }
  1830. let rest = remaining();
  1831. if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
  1832. extglobOpen('star', value);
  1833. continue;
  1834. }
  1835. if (prev.type === 'star') {
  1836. if (opts.noglobstar === true) {
  1837. consume(value);
  1838. continue;
  1839. }
  1840. const prior = prev.prev;
  1841. const before = prior.prev;
  1842. const isStart = prior.type === 'slash' || prior.type === 'bos';
  1843. const afterStar = before && (before.type === 'star' || before.type === 'globstar');
  1844. if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
  1845. push({ type: 'star', value, output: '' });
  1846. continue;
  1847. }
  1848. const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
  1849. const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
  1850. if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
  1851. push({ type: 'star', value, output: '' });
  1852. continue;
  1853. }
  1854. // strip consecutive `/**/`
  1855. while (rest.slice(0, 3) === '/**') {
  1856. const after = input[state.index + 4];
  1857. if (after && after !== '/') {
  1858. break;
  1859. }
  1860. rest = rest.slice(3);
  1861. consume('/**', 3);
  1862. }
  1863. if (prior.type === 'bos' && eos()) {
  1864. prev.type = 'globstar';
  1865. prev.value += value;
  1866. prev.output = globstar(opts);
  1867. state.output = prev.output;
  1868. state.globstar = true;
  1869. consume(value);
  1870. continue;
  1871. }
  1872. if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
  1873. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  1874. prior.output = `(?:${prior.output}`;
  1875. prev.type = 'globstar';
  1876. prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
  1877. prev.value += value;
  1878. state.globstar = true;
  1879. state.output += prior.output + prev.output;
  1880. consume(value);
  1881. continue;
  1882. }
  1883. if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
  1884. const end = rest[1] !== void 0 ? '|$' : '';
  1885. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  1886. prior.output = `(?:${prior.output}`;
  1887. prev.type = 'globstar';
  1888. prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
  1889. prev.value += value;
  1890. state.output += prior.output + prev.output;
  1891. state.globstar = true;
  1892. consume(value + advance());
  1893. push({ type: 'slash', value: '/', output: '' });
  1894. continue;
  1895. }
  1896. if (prior.type === 'bos' && rest[0] === '/') {
  1897. prev.type = 'globstar';
  1898. prev.value += value;
  1899. prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
  1900. state.output = prev.output;
  1901. state.globstar = true;
  1902. consume(value + advance());
  1903. push({ type: 'slash', value: '/', output: '' });
  1904. continue;
  1905. }
  1906. // remove single star from output
  1907. state.output = state.output.slice(0, -prev.output.length);
  1908. // reset previous token to globstar
  1909. prev.type = 'globstar';
  1910. prev.output = globstar(opts);
  1911. prev.value += value;
  1912. // reset output with globstar
  1913. state.output += prev.output;
  1914. state.globstar = true;
  1915. consume(value);
  1916. continue;
  1917. }
  1918. const token = { type: 'star', value, output: star };
  1919. if (opts.bash === true) {
  1920. token.output = '.*?';
  1921. if (prev.type === 'bos' || prev.type === 'slash') {
  1922. token.output = nodot + token.output;
  1923. }
  1924. push(token);
  1925. continue;
  1926. }
  1927. if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
  1928. token.output = value;
  1929. push(token);
  1930. continue;
  1931. }
  1932. if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
  1933. if (prev.type === 'dot') {
  1934. state.output += NO_DOT_SLASH;
  1935. prev.output += NO_DOT_SLASH;
  1936. } else if (opts.dot === true) {
  1937. state.output += NO_DOTS_SLASH;
  1938. prev.output += NO_DOTS_SLASH;
  1939. } else {
  1940. state.output += nodot;
  1941. prev.output += nodot;
  1942. }
  1943. if (peek() !== '*') {
  1944. state.output += ONE_CHAR;
  1945. prev.output += ONE_CHAR;
  1946. }
  1947. }
  1948. push(token);
  1949. }
  1950. while (state.brackets > 0) {
  1951. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
  1952. state.output = utils.escapeLast(state.output, '[');
  1953. decrement('brackets');
  1954. }
  1955. while (state.parens > 0) {
  1956. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
  1957. state.output = utils.escapeLast(state.output, '(');
  1958. decrement('parens');
  1959. }
  1960. while (state.braces > 0) {
  1961. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
  1962. state.output = utils.escapeLast(state.output, '{');
  1963. decrement('braces');
  1964. }
  1965. if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
  1966. push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
  1967. }
  1968. // rebuild the output if we had to backtrack at any point
  1969. if (state.backtrack === true) {
  1970. state.output = '';
  1971. for (const token of state.tokens) {
  1972. state.output += token.output != null ? token.output : token.value;
  1973. if (token.suffix) {
  1974. state.output += token.suffix;
  1975. }
  1976. }
  1977. }
  1978. return state;
  1979. };
  1980. /**
  1981. * Fast paths for creating regular expressions for common glob patterns.
  1982. * This can significantly speed up processing and has very little downside
  1983. * impact when none of the fast paths match.
  1984. */
  1985. parse.fastpaths = (input, options) => {
  1986. const opts = { ...options };
  1987. const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  1988. const len = input.length;
  1989. if (len > max) {
  1990. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  1991. }
  1992. input = REPLACEMENTS[input] || input;
  1993. // create constants based on platform, for windows or posix
  1994. const {
  1995. DOT_LITERAL,
  1996. SLASH_LITERAL,
  1997. ONE_CHAR,
  1998. DOTS_SLASH,
  1999. NO_DOT,
  2000. NO_DOTS,
  2001. NO_DOTS_SLASH,
  2002. STAR,
  2003. START_ANCHOR
  2004. } = constants.globChars(opts.windows);
  2005. const nodot = opts.dot ? NO_DOTS : NO_DOT;
  2006. const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
  2007. const capture = opts.capture ? '' : '?:';
  2008. const state = { negated: false, prefix: '' };
  2009. let star = opts.bash === true ? '.*?' : STAR;
  2010. if (opts.capture) {
  2011. star = `(${star})`;
  2012. }
  2013. const globstar = opts => {
  2014. if (opts.noglobstar === true) return star;
  2015. return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  2016. };
  2017. const create = str => {
  2018. switch (str) {
  2019. case '*':
  2020. return `${nodot}${ONE_CHAR}${star}`;
  2021. case '.*':
  2022. return `${DOT_LITERAL}${ONE_CHAR}${star}`;
  2023. case '*.*':
  2024. return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  2025. case '*/*':
  2026. return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
  2027. case '**':
  2028. return nodot + globstar(opts);
  2029. case '**/*':
  2030. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
  2031. case '**/*.*':
  2032. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  2033. case '**/.*':
  2034. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
  2035. default: {
  2036. const match = /^(.*?)\.(\w+)$/.exec(str);
  2037. if (!match) return;
  2038. const source = create(match[1]);
  2039. if (!source) return;
  2040. return source + DOT_LITERAL + match[2];
  2041. }
  2042. }
  2043. };
  2044. const output = utils.removePrefix(input, state);
  2045. let source = create(output);
  2046. if (source && opts.strictSlashes !== true) {
  2047. source += `${SLASH_LITERAL}?`;
  2048. }
  2049. return source;
  2050. };
  2051. parse_1 = parse;
  2052. return parse_1;
  2053. }
  2054. var picomatch_1$1;
  2055. var hasRequiredPicomatch$1;
  2056. function requirePicomatch$1 () {
  2057. if (hasRequiredPicomatch$1) return picomatch_1$1;
  2058. hasRequiredPicomatch$1 = 1;
  2059. const scan = /*@__PURE__*/ requireScan();
  2060. const parse = /*@__PURE__*/ requireParse();
  2061. const utils = /*@__PURE__*/ requireUtils();
  2062. const constants = /*@__PURE__*/ requireConstants();
  2063. const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
  2064. /**
  2065. * Creates a matcher function from one or more glob patterns. The
  2066. * returned function takes a string to match as its first argument,
  2067. * and returns true if the string is a match. The returned matcher
  2068. * function also takes a boolean as the second argument that, when true,
  2069. * returns an object with additional information.
  2070. *
  2071. * ```js
  2072. * const picomatch = require('picomatch');
  2073. * // picomatch(glob[, options]);
  2074. *
  2075. * const isMatch = picomatch('*.!(*a)');
  2076. * console.log(isMatch('a.a')); //=> false
  2077. * console.log(isMatch('a.b')); //=> true
  2078. * ```
  2079. * @name picomatch
  2080. * @param {String|Array} `globs` One or more glob patterns.
  2081. * @param {Object=} `options`
  2082. * @return {Function=} Returns a matcher function.
  2083. * @api public
  2084. */
  2085. const picomatch = (glob, options, returnState = false) => {
  2086. if (Array.isArray(glob)) {
  2087. const fns = glob.map(input => picomatch(input, options, returnState));
  2088. const arrayMatcher = str => {
  2089. for (const isMatch of fns) {
  2090. const state = isMatch(str);
  2091. if (state) return state;
  2092. }
  2093. return false;
  2094. };
  2095. return arrayMatcher;
  2096. }
  2097. const isState = isObject(glob) && glob.tokens && glob.input;
  2098. if (glob === '' || (typeof glob !== 'string' && !isState)) {
  2099. throw new TypeError('Expected pattern to be a non-empty string');
  2100. }
  2101. const opts = options || {};
  2102. const posix = opts.windows;
  2103. const regex = isState
  2104. ? picomatch.compileRe(glob, options)
  2105. : picomatch.makeRe(glob, options, false, true);
  2106. const state = regex.state;
  2107. delete regex.state;
  2108. let isIgnored = () => false;
  2109. if (opts.ignore) {
  2110. const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
  2111. isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
  2112. }
  2113. const matcher = (input, returnObject = false) => {
  2114. const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
  2115. const result = { glob, state, regex, posix, input, output, match, isMatch };
  2116. if (typeof opts.onResult === 'function') {
  2117. opts.onResult(result);
  2118. }
  2119. if (isMatch === false) {
  2120. result.isMatch = false;
  2121. return returnObject ? result : false;
  2122. }
  2123. if (isIgnored(input)) {
  2124. if (typeof opts.onIgnore === 'function') {
  2125. opts.onIgnore(result);
  2126. }
  2127. result.isMatch = false;
  2128. return returnObject ? result : false;
  2129. }
  2130. if (typeof opts.onMatch === 'function') {
  2131. opts.onMatch(result);
  2132. }
  2133. return returnObject ? result : true;
  2134. };
  2135. if (returnState) {
  2136. matcher.state = state;
  2137. }
  2138. return matcher;
  2139. };
  2140. /**
  2141. * Test `input` with the given `regex`. This is used by the main
  2142. * `picomatch()` function to test the input string.
  2143. *
  2144. * ```js
  2145. * const picomatch = require('picomatch');
  2146. * // picomatch.test(input, regex[, options]);
  2147. *
  2148. * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
  2149. * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
  2150. * ```
  2151. * @param {String} `input` String to test.
  2152. * @param {RegExp} `regex`
  2153. * @return {Object} Returns an object with matching info.
  2154. * @api public
  2155. */
  2156. picomatch.test = (input, regex, options, { glob, posix } = {}) => {
  2157. if (typeof input !== 'string') {
  2158. throw new TypeError('Expected input to be a string');
  2159. }
  2160. if (input === '') {
  2161. return { isMatch: false, output: '' };
  2162. }
  2163. const opts = options || {};
  2164. const format = opts.format || (posix ? utils.toPosixSlashes : null);
  2165. let match = input === glob;
  2166. let output = (match && format) ? format(input) : input;
  2167. if (match === false) {
  2168. output = format ? format(input) : input;
  2169. match = output === glob;
  2170. }
  2171. if (match === false || opts.capture === true) {
  2172. if (opts.matchBase === true || opts.basename === true) {
  2173. match = picomatch.matchBase(input, regex, options, posix);
  2174. } else {
  2175. match = regex.exec(output);
  2176. }
  2177. }
  2178. return { isMatch: Boolean(match), match, output };
  2179. };
  2180. /**
  2181. * Match the basename of a filepath.
  2182. *
  2183. * ```js
  2184. * const picomatch = require('picomatch');
  2185. * // picomatch.matchBase(input, glob[, options]);
  2186. * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
  2187. * ```
  2188. * @param {String} `input` String to test.
  2189. * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
  2190. * @return {Boolean}
  2191. * @api public
  2192. */
  2193. picomatch.matchBase = (input, glob, options) => {
  2194. const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
  2195. return regex.test(utils.basename(input));
  2196. };
  2197. /**
  2198. * Returns true if **any** of the given glob `patterns` match the specified `string`.
  2199. *
  2200. * ```js
  2201. * const picomatch = require('picomatch');
  2202. * // picomatch.isMatch(string, patterns[, options]);
  2203. *
  2204. * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
  2205. * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
  2206. * ```
  2207. * @param {String|Array} str The string to test.
  2208. * @param {String|Array} patterns One or more glob patterns to use for matching.
  2209. * @param {Object} [options] See available [options](#options).
  2210. * @return {Boolean} Returns true if any patterns match `str`
  2211. * @api public
  2212. */
  2213. picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  2214. /**
  2215. * Parse a glob pattern to create the source string for a regular
  2216. * expression.
  2217. *
  2218. * ```js
  2219. * const picomatch = require('picomatch');
  2220. * const result = picomatch.parse(pattern[, options]);
  2221. * ```
  2222. * @param {String} `pattern`
  2223. * @param {Object} `options`
  2224. * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
  2225. * @api public
  2226. */
  2227. picomatch.parse = (pattern, options) => {
  2228. if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
  2229. return parse(pattern, { ...options, fastpaths: false });
  2230. };
  2231. /**
  2232. * Scan a glob pattern to separate the pattern into segments.
  2233. *
  2234. * ```js
  2235. * const picomatch = require('picomatch');
  2236. * // picomatch.scan(input[, options]);
  2237. *
  2238. * const result = picomatch.scan('!./foo/*.js');
  2239. * console.log(result);
  2240. * { prefix: '!./',
  2241. * input: '!./foo/*.js',
  2242. * start: 3,
  2243. * base: 'foo',
  2244. * glob: '*.js',
  2245. * isBrace: false,
  2246. * isBracket: false,
  2247. * isGlob: true,
  2248. * isExtglob: false,
  2249. * isGlobstar: false,
  2250. * negated: true }
  2251. * ```
  2252. * @param {String} `input` Glob pattern to scan.
  2253. * @param {Object} `options`
  2254. * @return {Object} Returns an object with
  2255. * @api public
  2256. */
  2257. picomatch.scan = (input, options) => scan(input, options);
  2258. /**
  2259. * Compile a regular expression from the `state` object returned by the
  2260. * [parse()](#parse) method.
  2261. *
  2262. * @param {Object} `state`
  2263. * @param {Object} `options`
  2264. * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
  2265. * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
  2266. * @return {RegExp}
  2267. * @api public
  2268. */
  2269. picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
  2270. if (returnOutput === true) {
  2271. return state.output;
  2272. }
  2273. const opts = options || {};
  2274. const prepend = opts.contains ? '' : '^';
  2275. const append = opts.contains ? '' : '$';
  2276. let source = `${prepend}(?:${state.output})${append}`;
  2277. if (state && state.negated === true) {
  2278. source = `^(?!${source}).*$`;
  2279. }
  2280. const regex = picomatch.toRegex(source, options);
  2281. if (returnState === true) {
  2282. regex.state = state;
  2283. }
  2284. return regex;
  2285. };
  2286. /**
  2287. * Create a regular expression from a parsed glob pattern.
  2288. *
  2289. * ```js
  2290. * const picomatch = require('picomatch');
  2291. * const state = picomatch.parse('*.js');
  2292. * // picomatch.compileRe(state[, options]);
  2293. *
  2294. * console.log(picomatch.compileRe(state));
  2295. * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
  2296. * ```
  2297. * @param {String} `state` The object returned from the `.parse` method.
  2298. * @param {Object} `options`
  2299. * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
  2300. * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
  2301. * @return {RegExp} Returns a regex created from the given pattern.
  2302. * @api public
  2303. */
  2304. picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
  2305. if (!input || typeof input !== 'string') {
  2306. throw new TypeError('Expected a non-empty string');
  2307. }
  2308. let parsed = { negated: false, fastpaths: true };
  2309. if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
  2310. parsed.output = parse.fastpaths(input, options);
  2311. }
  2312. if (!parsed.output) {
  2313. parsed = parse(input, options);
  2314. }
  2315. return picomatch.compileRe(parsed, options, returnOutput, returnState);
  2316. };
  2317. /**
  2318. * Create a regular expression from the given regex source string.
  2319. *
  2320. * ```js
  2321. * const picomatch = require('picomatch');
  2322. * // picomatch.toRegex(source[, options]);
  2323. *
  2324. * const { output } = picomatch.parse('*.js');
  2325. * console.log(picomatch.toRegex(output));
  2326. * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
  2327. * ```
  2328. * @param {String} `source` Regular expression source string.
  2329. * @param {Object} `options`
  2330. * @return {RegExp}
  2331. * @api public
  2332. */
  2333. picomatch.toRegex = (source, options) => {
  2334. try {
  2335. const opts = options || {};
  2336. return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
  2337. } catch (err) {
  2338. if (options && options.debug === true) throw err;
  2339. return /$^/;
  2340. }
  2341. };
  2342. /**
  2343. * Picomatch constants.
  2344. * @return {Object}
  2345. */
  2346. picomatch.constants = constants;
  2347. /**
  2348. * Expose "picomatch"
  2349. */
  2350. picomatch_1$1 = picomatch;
  2351. return picomatch_1$1;
  2352. }
  2353. var picomatch_1;
  2354. var hasRequiredPicomatch;
  2355. function requirePicomatch () {
  2356. if (hasRequiredPicomatch) return picomatch_1;
  2357. hasRequiredPicomatch = 1;
  2358. const pico = /*@__PURE__*/ requirePicomatch$1();
  2359. const utils = /*@__PURE__*/ requireUtils();
  2360. function picomatch(glob, options, returnState = false) {
  2361. // default to os.platform()
  2362. if (options && (options.windows === null || options.windows === undefined)) {
  2363. // don't mutate the original options object
  2364. options = { ...options, windows: utils.isWindows() };
  2365. }
  2366. return pico(glob, options, returnState);
  2367. }
  2368. Object.assign(picomatch, pico);
  2369. picomatch_1 = picomatch;
  2370. return picomatch_1;
  2371. }
  2372. var picomatchExports = /*@__PURE__*/ requirePicomatch();
  2373. var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
  2374. function isArray(arg) {
  2375. return Array.isArray(arg);
  2376. }
  2377. function ensureArray(thing) {
  2378. if (isArray(thing))
  2379. return thing;
  2380. if (thing == null)
  2381. return [];
  2382. return [thing];
  2383. }
  2384. const globToTest = (glob) => {
  2385. const pattern = glob;
  2386. const fn = pm(pattern, { dot: true });
  2387. return {
  2388. test: (what) => {
  2389. const result = fn(what);
  2390. return result;
  2391. },
  2392. };
  2393. };
  2394. const testTrue = {
  2395. test: () => true,
  2396. };
  2397. const getMatcher = (filter) => {
  2398. const bundleTest = "bundle" in filter && filter.bundle != null ? globToTest(filter.bundle) : testTrue;
  2399. const fileTest = "file" in filter && filter.file != null ? globToTest(filter.file) : testTrue;
  2400. return { bundleTest, fileTest };
  2401. };
  2402. const createFilter = (include, exclude) => {
  2403. const includeMatchers = ensureArray(include).map(getMatcher);
  2404. const excludeMatchers = ensureArray(exclude).map(getMatcher);
  2405. return (bundleId, id) => {
  2406. for (let i = 0; i < excludeMatchers.length; ++i) {
  2407. const { bundleTest, fileTest } = excludeMatchers[i];
  2408. if (bundleTest.test(bundleId) && fileTest.test(id))
  2409. return false;
  2410. }
  2411. for (let i = 0; i < includeMatchers.length; ++i) {
  2412. const { bundleTest, fileTest } = includeMatchers[i];
  2413. if (bundleTest.test(bundleId) && fileTest.test(id))
  2414. return true;
  2415. }
  2416. return !includeMatchers.length;
  2417. };
  2418. };
  2419. const throttleFilter = (callback, limit) => {
  2420. let waiting = false;
  2421. return (val) => {
  2422. if (!waiting) {
  2423. callback(val);
  2424. waiting = true;
  2425. setTimeout(() => {
  2426. waiting = false;
  2427. }, limit);
  2428. }
  2429. };
  2430. };
  2431. const prepareFilter = (filt) => {
  2432. if (filt === "")
  2433. return [];
  2434. return (filt
  2435. .split(",")
  2436. // remove spaces before and after
  2437. .map((entry) => entry.trim())
  2438. // unquote "
  2439. .map((entry) => entry.startsWith('"') && entry.endsWith('"') ? entry.substring(1, entry.length - 1) : entry)
  2440. // unquote '
  2441. .map((entry) => entry.startsWith("'") && entry.endsWith("'") ? entry.substring(1, entry.length - 1) : entry)
  2442. // remove empty strings
  2443. .filter((entry) => entry)
  2444. // parse bundle:file
  2445. .map((entry) => entry.split(":"))
  2446. // normalize entry just in case
  2447. .flatMap((entry) => {
  2448. if (entry.length === 0)
  2449. return [];
  2450. let bundle = null;
  2451. let file = null;
  2452. if (entry.length === 1 && entry[0]) {
  2453. file = entry[0];
  2454. return [{ file, bundle }];
  2455. }
  2456. bundle = entry[0] || null;
  2457. file = entry.slice(1).join(":") || null;
  2458. return [{ bundle, file }];
  2459. }));
  2460. };
  2461. const useFilter = () => {
  2462. const [includeFilter, setIncludeFilter] = h("");
  2463. const [excludeFilter, setExcludeFilter] = h("");
  2464. const setIncludeFilterTrottled = T(() => throttleFilter(setIncludeFilter, 200), []);
  2465. const setExcludeFilterTrottled = T(() => throttleFilter(setExcludeFilter, 200), []);
  2466. const isIncluded = T(() => createFilter(prepareFilter(includeFilter), prepareFilter(excludeFilter)), [includeFilter, excludeFilter]);
  2467. const getModuleFilterMultiplier = q((bundleId, data) => {
  2468. return isIncluded(bundleId, data.id) ? 1 : 0;
  2469. }, [isIncluded]);
  2470. return {
  2471. getModuleFilterMultiplier,
  2472. includeFilter,
  2473. excludeFilter,
  2474. setExcludeFilter: setExcludeFilterTrottled,
  2475. setIncludeFilter: setIncludeFilterTrottled,
  2476. };
  2477. };
  2478. function ascending(a, b) {
  2479. return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
  2480. }
  2481. function descending(a, b) {
  2482. return a == null || b == null ? NaN
  2483. : b < a ? -1
  2484. : b > a ? 1
  2485. : b >= a ? 0
  2486. : NaN;
  2487. }
  2488. function bisector(f) {
  2489. let compare1, compare2, delta;
  2490. // If an accessor is specified, promote it to a comparator. In this case we
  2491. // can test whether the search value is (self-) comparable. We can’t do this
  2492. // for a comparator (except for specific, known comparators) because we can’t
  2493. // tell if the comparator is symmetric, and an asymmetric comparator can’t be
  2494. // used to test whether a single value is comparable.
  2495. if (f.length !== 2) {
  2496. compare1 = ascending;
  2497. compare2 = (d, x) => ascending(f(d), x);
  2498. delta = (d, x) => f(d) - x;
  2499. } else {
  2500. compare1 = f === ascending || f === descending ? f : zero$1;
  2501. compare2 = f;
  2502. delta = f;
  2503. }
  2504. function left(a, x, lo = 0, hi = a.length) {
  2505. if (lo < hi) {
  2506. if (compare1(x, x) !== 0) return hi;
  2507. do {
  2508. const mid = (lo + hi) >>> 1;
  2509. if (compare2(a[mid], x) < 0) lo = mid + 1;
  2510. else hi = mid;
  2511. } while (lo < hi);
  2512. }
  2513. return lo;
  2514. }
  2515. function right(a, x, lo = 0, hi = a.length) {
  2516. if (lo < hi) {
  2517. if (compare1(x, x) !== 0) return hi;
  2518. do {
  2519. const mid = (lo + hi) >>> 1;
  2520. if (compare2(a[mid], x) <= 0) lo = mid + 1;
  2521. else hi = mid;
  2522. } while (lo < hi);
  2523. }
  2524. return lo;
  2525. }
  2526. function center(a, x, lo = 0, hi = a.length) {
  2527. const i = left(a, x, lo, hi - 1);
  2528. return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
  2529. }
  2530. return {left, center, right};
  2531. }
  2532. function zero$1() {
  2533. return 0;
  2534. }
  2535. function number$1(x) {
  2536. return x === null ? NaN : +x;
  2537. }
  2538. const ascendingBisect = bisector(ascending);
  2539. const bisectRight = ascendingBisect.right;
  2540. bisector(number$1).center;
  2541. class InternMap extends Map {
  2542. constructor(entries, key = keyof) {
  2543. super();
  2544. Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
  2545. if (entries != null) for (const [key, value] of entries) this.set(key, value);
  2546. }
  2547. get(key) {
  2548. return super.get(intern_get(this, key));
  2549. }
  2550. has(key) {
  2551. return super.has(intern_get(this, key));
  2552. }
  2553. set(key, value) {
  2554. return super.set(intern_set(this, key), value);
  2555. }
  2556. delete(key) {
  2557. return super.delete(intern_delete(this, key));
  2558. }
  2559. }
  2560. function intern_get({_intern, _key}, value) {
  2561. const key = _key(value);
  2562. return _intern.has(key) ? _intern.get(key) : value;
  2563. }
  2564. function intern_set({_intern, _key}, value) {
  2565. const key = _key(value);
  2566. if (_intern.has(key)) return _intern.get(key);
  2567. _intern.set(key, value);
  2568. return value;
  2569. }
  2570. function intern_delete({_intern, _key}, value) {
  2571. const key = _key(value);
  2572. if (_intern.has(key)) {
  2573. value = _intern.get(key);
  2574. _intern.delete(key);
  2575. }
  2576. return value;
  2577. }
  2578. function keyof(value) {
  2579. return value !== null && typeof value === "object" ? value.valueOf() : value;
  2580. }
  2581. function identity$2(x) {
  2582. return x;
  2583. }
  2584. function group(values, ...keys) {
  2585. return nest(values, identity$2, identity$2, keys);
  2586. }
  2587. function nest(values, map, reduce, keys) {
  2588. return (function regroup(values, i) {
  2589. if (i >= keys.length) return reduce(values);
  2590. const groups = new InternMap();
  2591. const keyof = keys[i++];
  2592. let index = -1;
  2593. for (const value of values) {
  2594. const key = keyof(value, ++index, values);
  2595. const group = groups.get(key);
  2596. if (group) group.push(value);
  2597. else groups.set(key, [value]);
  2598. }
  2599. for (const [key, values] of groups) {
  2600. groups.set(key, regroup(values, i));
  2601. }
  2602. return map(groups);
  2603. })(values, 0);
  2604. }
  2605. const e10 = Math.sqrt(50),
  2606. e5 = Math.sqrt(10),
  2607. e2 = Math.sqrt(2);
  2608. function tickSpec(start, stop, count) {
  2609. const step = (stop - start) / Math.max(0, count),
  2610. power = Math.floor(Math.log10(step)),
  2611. error = step / Math.pow(10, power),
  2612. factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
  2613. let i1, i2, inc;
  2614. if (power < 0) {
  2615. inc = Math.pow(10, -power) / factor;
  2616. i1 = Math.round(start * inc);
  2617. i2 = Math.round(stop * inc);
  2618. if (i1 / inc < start) ++i1;
  2619. if (i2 / inc > stop) --i2;
  2620. inc = -inc;
  2621. } else {
  2622. inc = Math.pow(10, power) * factor;
  2623. i1 = Math.round(start / inc);
  2624. i2 = Math.round(stop / inc);
  2625. if (i1 * inc < start) ++i1;
  2626. if (i2 * inc > stop) --i2;
  2627. }
  2628. if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);
  2629. return [i1, i2, inc];
  2630. }
  2631. function ticks(start, stop, count) {
  2632. stop = +stop, start = +start, count = +count;
  2633. if (!(count > 0)) return [];
  2634. if (start === stop) return [start];
  2635. const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
  2636. if (!(i2 >= i1)) return [];
  2637. const n = i2 - i1 + 1, ticks = new Array(n);
  2638. if (reverse) {
  2639. if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;
  2640. else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;
  2641. } else {
  2642. if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;
  2643. else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;
  2644. }
  2645. return ticks;
  2646. }
  2647. function tickIncrement(start, stop, count) {
  2648. stop = +stop, start = +start, count = +count;
  2649. return tickSpec(start, stop, count)[2];
  2650. }
  2651. function tickStep(start, stop, count) {
  2652. stop = +stop, start = +start, count = +count;
  2653. const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
  2654. return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
  2655. }
  2656. const TOP_PADDING = 20;
  2657. const PADDING = 2;
  2658. const Node = ({ node, onMouseOver, onClick, selected }) => {
  2659. const { getModuleColor } = x(StaticContext);
  2660. const { backgroundColor, fontColor } = getModuleColor(node);
  2661. const { x0, x1, y1, y0, data, children = null } = node;
  2662. const textRef = A(null);
  2663. const textRectRef = A();
  2664. const width = x1 - x0;
  2665. const height = y1 - y0;
  2666. const textProps = {
  2667. "font-size": "0.7em",
  2668. "dominant-baseline": "middle",
  2669. "text-anchor": "middle",
  2670. x: width / 2,
  2671. };
  2672. if (children != null) {
  2673. textProps.y = (TOP_PADDING + PADDING) / 2;
  2674. }
  2675. else {
  2676. textProps.y = height / 2;
  2677. }
  2678. _(() => {
  2679. if (width == 0 || height == 0 || !textRef.current) {
  2680. return;
  2681. }
  2682. if (textRectRef.current == null) {
  2683. textRectRef.current = textRef.current.getBoundingClientRect();
  2684. }
  2685. let scale = 1;
  2686. if (children != null) {
  2687. scale = Math.min((width * 0.9) / textRectRef.current.width, Math.min(height, TOP_PADDING + PADDING) / textRectRef.current.height);
  2688. scale = Math.min(1, scale);
  2689. textRef.current.setAttribute("y", String(Math.min(TOP_PADDING + PADDING, height) / 2 / scale));
  2690. textRef.current.setAttribute("x", String(width / 2 / scale));
  2691. }
  2692. else {
  2693. scale = Math.min((width * 0.9) / textRectRef.current.width, (height * 0.9) / textRectRef.current.height);
  2694. scale = Math.min(1, scale);
  2695. textRef.current.setAttribute("y", String(height / 2 / scale));
  2696. textRef.current.setAttribute("x", String(width / 2 / scale));
  2697. }
  2698. textRef.current.setAttribute("transform", `scale(${scale.toFixed(2)})`);
  2699. }, [children, height, width]);
  2700. if (width == 0 || height == 0) {
  2701. return null;
  2702. }
  2703. return (u$1("g", { className: "node", transform: `translate(${x0},${y0})`, onClick: (event) => {
  2704. event.stopPropagation();
  2705. onClick(node);
  2706. }, onMouseOver: (event) => {
  2707. event.stopPropagation();
  2708. onMouseOver(node);
  2709. }, children: [u$1("rect", { fill: backgroundColor, rx: 2, ry: 2, width: x1 - x0, height: y1 - y0, stroke: selected ? "#fff" : undefined, "stroke-width": selected ? 2 : undefined }), u$1("text", Object.assign({ ref: textRef, fill: fontColor, onClick: (event) => {
  2710. var _a;
  2711. if (((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) !== "") {
  2712. event.stopPropagation();
  2713. }
  2714. } }, textProps, { children: data.name }))] }));
  2715. };
  2716. const TreeMap = ({ root, onNodeHover, selectedNode, onNodeClick, }) => {
  2717. const { width, height, getModuleIds } = x(StaticContext);
  2718. console.time("layering");
  2719. // this will make groups by height
  2720. const nestedData = T(() => {
  2721. const nestedDataMap = group(root.descendants(), (d) => d.height);
  2722. const nestedData = Array.from(nestedDataMap, ([key, values]) => ({
  2723. key,
  2724. values,
  2725. }));
  2726. nestedData.sort((a, b) => b.key - a.key);
  2727. return nestedData;
  2728. }, [root]);
  2729. console.timeEnd("layering");
  2730. return (u$1("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}`, children: nestedData.map(({ key, values }) => {
  2731. return (u$1("g", { className: "layer", children: values.map((node) => {
  2732. return (u$1(Node, { node: node, onMouseOver: onNodeHover, selected: selectedNode === node, onClick: onNodeClick }, getModuleIds(node.data).nodeUid.id));
  2733. }) }, key));
  2734. }) }));
  2735. };
  2736. var bytes = {exports: {}};
  2737. /*!
  2738. * bytes
  2739. * Copyright(c) 2012-2014 TJ Holowaychuk
  2740. * Copyright(c) 2015 Jed Watson
  2741. * MIT Licensed
  2742. */
  2743. var hasRequiredBytes;
  2744. function requireBytes () {
  2745. if (hasRequiredBytes) return bytes.exports;
  2746. hasRequiredBytes = 1;
  2747. /**
  2748. * Module exports.
  2749. * @public
  2750. */
  2751. bytes.exports = bytes$1;
  2752. bytes.exports.format = format;
  2753. bytes.exports.parse = parse;
  2754. /**
  2755. * Module variables.
  2756. * @private
  2757. */
  2758. var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
  2759. var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
  2760. var map = {
  2761. b: 1,
  2762. kb: 1 << 10,
  2763. mb: 1 << 20,
  2764. gb: 1 << 30,
  2765. tb: Math.pow(1024, 4),
  2766. pb: Math.pow(1024, 5),
  2767. };
  2768. var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
  2769. /**
  2770. * Convert the given value in bytes into a string or parse to string to an integer in bytes.
  2771. *
  2772. * @param {string|number} value
  2773. * @param {{
  2774. * case: [string],
  2775. * decimalPlaces: [number]
  2776. * fixedDecimals: [boolean]
  2777. * thousandsSeparator: [string]
  2778. * unitSeparator: [string]
  2779. * }} [options] bytes options.
  2780. *
  2781. * @returns {string|number|null}
  2782. */
  2783. function bytes$1(value, options) {
  2784. if (typeof value === 'string') {
  2785. return parse(value);
  2786. }
  2787. if (typeof value === 'number') {
  2788. return format(value, options);
  2789. }
  2790. return null;
  2791. }
  2792. /**
  2793. * Format the given value in bytes into a string.
  2794. *
  2795. * If the value is negative, it is kept as such. If it is a float,
  2796. * it is rounded.
  2797. *
  2798. * @param {number} value
  2799. * @param {object} [options]
  2800. * @param {number} [options.decimalPlaces=2]
  2801. * @param {number} [options.fixedDecimals=false]
  2802. * @param {string} [options.thousandsSeparator=]
  2803. * @param {string} [options.unit=]
  2804. * @param {string} [options.unitSeparator=]
  2805. *
  2806. * @returns {string|null}
  2807. * @public
  2808. */
  2809. function format(value, options) {
  2810. if (!Number.isFinite(value)) {
  2811. return null;
  2812. }
  2813. var mag = Math.abs(value);
  2814. var thousandsSeparator = (options && options.thousandsSeparator) || '';
  2815. var unitSeparator = (options && options.unitSeparator) || '';
  2816. var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
  2817. var fixedDecimals = Boolean(options && options.fixedDecimals);
  2818. var unit = (options && options.unit) || '';
  2819. if (!unit || !map[unit.toLowerCase()]) {
  2820. if (mag >= map.pb) {
  2821. unit = 'PB';
  2822. } else if (mag >= map.tb) {
  2823. unit = 'TB';
  2824. } else if (mag >= map.gb) {
  2825. unit = 'GB';
  2826. } else if (mag >= map.mb) {
  2827. unit = 'MB';
  2828. } else if (mag >= map.kb) {
  2829. unit = 'KB';
  2830. } else {
  2831. unit = 'B';
  2832. }
  2833. }
  2834. var val = value / map[unit.toLowerCase()];
  2835. var str = val.toFixed(decimalPlaces);
  2836. if (!fixedDecimals) {
  2837. str = str.replace(formatDecimalsRegExp, '$1');
  2838. }
  2839. if (thousandsSeparator) {
  2840. str = str.split('.').map(function (s, i) {
  2841. return i === 0
  2842. ? s.replace(formatThousandsRegExp, thousandsSeparator)
  2843. : s
  2844. }).join('.');
  2845. }
  2846. return str + unitSeparator + unit;
  2847. }
  2848. /**
  2849. * Parse the string value into an integer in bytes.
  2850. *
  2851. * If no unit is given, it is assumed the value is in bytes.
  2852. *
  2853. * @param {number|string} val
  2854. *
  2855. * @returns {number|null}
  2856. * @public
  2857. */
  2858. function parse(val) {
  2859. if (typeof val === 'number' && !isNaN(val)) {
  2860. return val;
  2861. }
  2862. if (typeof val !== 'string') {
  2863. return null;
  2864. }
  2865. // Test if the string passed is valid
  2866. var results = parseRegExp.exec(val);
  2867. var floatValue;
  2868. var unit = 'b';
  2869. if (!results) {
  2870. // Nothing could be extracted from the given string
  2871. floatValue = parseInt(val, 10);
  2872. unit = 'b';
  2873. } else {
  2874. // Retrieve the value and the unit
  2875. floatValue = parseFloat(results[1]);
  2876. unit = results[4].toLowerCase();
  2877. }
  2878. if (isNaN(floatValue)) {
  2879. return null;
  2880. }
  2881. return Math.floor(map[unit] * floatValue);
  2882. }
  2883. return bytes.exports;
  2884. }
  2885. var bytesExports = requireBytes();
  2886. const Tooltip_marginX = 10;
  2887. const Tooltip_marginY = 30;
  2888. const SOURCEMAP_RENDERED = (u$1("span", { children: [" ", u$1("b", { children: LABELS.renderedLength }), " is a number of characters in the file after individual and ", u$1("br", {}), " ", "whole bundle transformations according to sourcemap."] }));
  2889. const RENDRED = (u$1("span", { children: [u$1("b", { children: LABELS.renderedLength }), " is a byte size of individual file after transformations and treeshake."] }));
  2890. const COMPRESSED = (u$1("span", { children: [u$1("b", { children: LABELS.gzipLength }), " and ", u$1("b", { children: LABELS.brotliLength }), " is a byte size of individual file after individual transformations,", u$1("br", {}), " treeshake and compression."] }));
  2891. const Tooltip = ({ node, visible, root, sizeProperty, }) => {
  2892. const { availableSizeProperties, getModuleSize, data } = x(StaticContext);
  2893. const ref = A(null);
  2894. const [style, setStyle] = h({});
  2895. const content = T(() => {
  2896. if (!node)
  2897. return null;
  2898. const mainSize = getModuleSize(node.data, sizeProperty);
  2899. const percentageNum = (100 * mainSize) / getModuleSize(root.data, sizeProperty);
  2900. const percentage = percentageNum.toFixed(2);
  2901. const percentageString = percentage + "%";
  2902. const path = node
  2903. .ancestors()
  2904. .reverse()
  2905. .map((d) => d.data.name)
  2906. .join("/");
  2907. let dataNode = null;
  2908. if (!isModuleTree(node.data)) {
  2909. const mainUid = data.nodeParts[node.data.uid].metaUid;
  2910. dataNode = data.nodeMetas[mainUid];
  2911. }
  2912. return (u$1(k$1, { children: [u$1("div", { children: path }), availableSizeProperties.map((sizeProp) => {
  2913. if (sizeProp === sizeProperty) {
  2914. return (u$1("div", { children: [u$1("b", { children: [LABELS[sizeProp], ": ", bytesExports.format(mainSize)] }), " ", "(", percentageString, ")"] }, sizeProp));
  2915. }
  2916. else {
  2917. return (u$1("div", { children: [LABELS[sizeProp], ": ", bytesExports.format(getModuleSize(node.data, sizeProp))] }, sizeProp));
  2918. }
  2919. }), u$1("br", {}), dataNode && dataNode.importedBy.length > 0 && (u$1("div", { children: [u$1("div", { children: [u$1("b", { children: "Imported By" }), ":"] }), dataNode.importedBy.map(({ uid }) => {
  2920. const id = data.nodeMetas[uid].id;
  2921. return u$1("div", { children: id }, id);
  2922. })] })), u$1("br", {}), u$1("small", { children: data.options.sourcemap ? SOURCEMAP_RENDERED : RENDRED }), (data.options.gzip || data.options.brotli) && (u$1(k$1, { children: [u$1("br", {}), u$1("small", { children: COMPRESSED })] }))] }));
  2923. }, [availableSizeProperties, data, getModuleSize, node, root.data, sizeProperty]);
  2924. const updatePosition = (mouseCoords) => {
  2925. if (!ref.current)
  2926. return;
  2927. const pos = {
  2928. left: mouseCoords.x + Tooltip_marginX,
  2929. top: mouseCoords.y + Tooltip_marginY,
  2930. };
  2931. const boundingRect = ref.current.getBoundingClientRect();
  2932. if (pos.left + boundingRect.width > window.innerWidth) {
  2933. // Shifting horizontally
  2934. pos.left = Math.max(0, window.innerWidth - boundingRect.width);
  2935. }
  2936. if (pos.top + boundingRect.height > window.innerHeight) {
  2937. // Flipping vertically
  2938. pos.top = Math.max(0, mouseCoords.y - Tooltip_marginY - boundingRect.height);
  2939. }
  2940. setStyle(pos);
  2941. };
  2942. y(() => {
  2943. const handleMouseMove = (event) => {
  2944. updatePosition({
  2945. x: event.pageX,
  2946. y: event.pageY,
  2947. });
  2948. };
  2949. document.addEventListener("mousemove", handleMouseMove, true);
  2950. return () => {
  2951. document.removeEventListener("mousemove", handleMouseMove, true);
  2952. };
  2953. }, []);
  2954. return (u$1("div", { className: `tooltip ${visible ? "" : "tooltip-hidden"}`, ref: ref, style: style, children: content }));
  2955. };
  2956. const Chart = ({ root, sizeProperty, selectedNode, setSelectedNode, }) => {
  2957. const [showTooltip, setShowTooltip] = h(false);
  2958. const [tooltipNode, setTooltipNode] = h(undefined);
  2959. y(() => {
  2960. const handleMouseOut = () => {
  2961. setShowTooltip(false);
  2962. };
  2963. document.addEventListener("mouseover", handleMouseOut);
  2964. return () => {
  2965. document.removeEventListener("mouseover", handleMouseOut);
  2966. };
  2967. }, []);
  2968. return (u$1(k$1, { children: [u$1(TreeMap, { root: root, onNodeHover: (node) => {
  2969. setTooltipNode(node);
  2970. setShowTooltip(true);
  2971. }, selectedNode: selectedNode, onNodeClick: (node) => {
  2972. setSelectedNode(selectedNode === node ? undefined : node);
  2973. } }), u$1(Tooltip, { visible: showTooltip, node: tooltipNode, root: root, sizeProperty: sizeProperty })] }));
  2974. };
  2975. const Main = () => {
  2976. const { availableSizeProperties, rawHierarchy, getModuleSize, layout, data } = x(StaticContext);
  2977. const [sizeProperty, setSizeProperty] = h(availableSizeProperties[0]);
  2978. const [selectedNode, setSelectedNode] = h(undefined);
  2979. const { getModuleFilterMultiplier, setExcludeFilter, setIncludeFilter } = useFilter();
  2980. console.time("getNodeSizeMultiplier");
  2981. const getNodeSizeMultiplier = T(() => {
  2982. const selectedMultiplier = 1; // selectedSize < rootSize * increaseFactor ? (rootSize * increaseFactor) / selectedSize : rootSize / selectedSize;
  2983. const nonSelectedMultiplier = 0; // 1 / selectedMultiplier
  2984. if (selectedNode === undefined) {
  2985. return () => 1;
  2986. }
  2987. else if (isModuleTree(selectedNode.data)) {
  2988. const leaves = new Set(selectedNode.leaves().map((d) => d.data));
  2989. return (node) => {
  2990. if (leaves.has(node)) {
  2991. return selectedMultiplier;
  2992. }
  2993. return nonSelectedMultiplier;
  2994. };
  2995. }
  2996. else {
  2997. return (node) => {
  2998. if (node === selectedNode.data) {
  2999. return selectedMultiplier;
  3000. }
  3001. return nonSelectedMultiplier;
  3002. };
  3003. }
  3004. }, [getModuleSize, rawHierarchy.data, selectedNode, sizeProperty]);
  3005. console.timeEnd("getNodeSizeMultiplier");
  3006. console.time("root hierarchy compute");
  3007. // root here always be the same as rawHierarchy even after layouting
  3008. const root = T(() => {
  3009. const rootWithSizesAndSorted = rawHierarchy
  3010. .sum((node) => {
  3011. var _a;
  3012. if (isModuleTree(node))
  3013. return 0;
  3014. const meta = data.nodeMetas[data.nodeParts[node.uid].metaUid];
  3015. /* eslint-disable typescript/no-non-null-asserted-optional-chain typescript/no-extra-non-null-assertion */
  3016. const bundleId = (_a = Object.entries(meta.moduleParts).find(([, uid]) => uid == node.uid)) === null || _a === void 0 ? void 0 : _a[0];
  3017. const ownSize = getModuleSize(node, sizeProperty);
  3018. const zoomMultiplier = getNodeSizeMultiplier(node);
  3019. const filterMultiplier = getModuleFilterMultiplier(bundleId, meta);
  3020. return ownSize * zoomMultiplier * filterMultiplier;
  3021. })
  3022. .sort((a, b) => getModuleSize(a.data, sizeProperty) - getModuleSize(b.data, sizeProperty));
  3023. return layout(rootWithSizesAndSorted);
  3024. }, [
  3025. data,
  3026. getModuleFilterMultiplier,
  3027. getModuleSize,
  3028. getNodeSizeMultiplier,
  3029. layout,
  3030. rawHierarchy,
  3031. sizeProperty,
  3032. ]);
  3033. console.timeEnd("root hierarchy compute");
  3034. return (u$1(k$1, { children: [u$1(SideBar, { sizeProperty: sizeProperty, availableSizeProperties: availableSizeProperties, setSizeProperty: setSizeProperty, onExcludeChange: setExcludeFilter, onIncludeChange: setIncludeFilter }), u$1(Chart, { root: root, sizeProperty: sizeProperty, selectedNode: selectedNode, setSelectedNode: setSelectedNode })] }));
  3035. };
  3036. function initRange(domain, range) {
  3037. switch (arguments.length) {
  3038. case 0: break;
  3039. case 1: this.range(domain); break;
  3040. default: this.range(range).domain(domain); break;
  3041. }
  3042. return this;
  3043. }
  3044. function initInterpolator(domain, interpolator) {
  3045. switch (arguments.length) {
  3046. case 0: break;
  3047. case 1: {
  3048. if (typeof domain === "function") this.interpolator(domain);
  3049. else this.range(domain);
  3050. break;
  3051. }
  3052. default: {
  3053. this.domain(domain);
  3054. if (typeof interpolator === "function") this.interpolator(interpolator);
  3055. else this.range(interpolator);
  3056. break;
  3057. }
  3058. }
  3059. return this;
  3060. }
  3061. function define(constructor, factory, prototype) {
  3062. constructor.prototype = factory.prototype = prototype;
  3063. prototype.constructor = constructor;
  3064. }
  3065. function extend(parent, definition) {
  3066. var prototype = Object.create(parent.prototype);
  3067. for (var key in definition) prototype[key] = definition[key];
  3068. return prototype;
  3069. }
  3070. function Color() {}
  3071. var darker = 0.7;
  3072. var brighter = 1 / darker;
  3073. var reI = "\\s*([+-]?\\d+)\\s*",
  3074. reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
  3075. reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
  3076. reHex = /^#([0-9a-f]{3,8})$/,
  3077. reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
  3078. reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
  3079. reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
  3080. reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
  3081. reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
  3082. reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
  3083. var named = {
  3084. aliceblue: 0xf0f8ff,
  3085. antiquewhite: 0xfaebd7,
  3086. aqua: 0x00ffff,
  3087. aquamarine: 0x7fffd4,
  3088. azure: 0xf0ffff,
  3089. beige: 0xf5f5dc,
  3090. bisque: 0xffe4c4,
  3091. black: 0x000000,
  3092. blanchedalmond: 0xffebcd,
  3093. blue: 0x0000ff,
  3094. blueviolet: 0x8a2be2,
  3095. brown: 0xa52a2a,
  3096. burlywood: 0xdeb887,
  3097. cadetblue: 0x5f9ea0,
  3098. chartreuse: 0x7fff00,
  3099. chocolate: 0xd2691e,
  3100. coral: 0xff7f50,
  3101. cornflowerblue: 0x6495ed,
  3102. cornsilk: 0xfff8dc,
  3103. crimson: 0xdc143c,
  3104. cyan: 0x00ffff,
  3105. darkblue: 0x00008b,
  3106. darkcyan: 0x008b8b,
  3107. darkgoldenrod: 0xb8860b,
  3108. darkgray: 0xa9a9a9,
  3109. darkgreen: 0x006400,
  3110. darkgrey: 0xa9a9a9,
  3111. darkkhaki: 0xbdb76b,
  3112. darkmagenta: 0x8b008b,
  3113. darkolivegreen: 0x556b2f,
  3114. darkorange: 0xff8c00,
  3115. darkorchid: 0x9932cc,
  3116. darkred: 0x8b0000,
  3117. darksalmon: 0xe9967a,
  3118. darkseagreen: 0x8fbc8f,
  3119. darkslateblue: 0x483d8b,
  3120. darkslategray: 0x2f4f4f,
  3121. darkslategrey: 0x2f4f4f,
  3122. darkturquoise: 0x00ced1,
  3123. darkviolet: 0x9400d3,
  3124. deeppink: 0xff1493,
  3125. deepskyblue: 0x00bfff,
  3126. dimgray: 0x696969,
  3127. dimgrey: 0x696969,
  3128. dodgerblue: 0x1e90ff,
  3129. firebrick: 0xb22222,
  3130. floralwhite: 0xfffaf0,
  3131. forestgreen: 0x228b22,
  3132. fuchsia: 0xff00ff,
  3133. gainsboro: 0xdcdcdc,
  3134. ghostwhite: 0xf8f8ff,
  3135. gold: 0xffd700,
  3136. goldenrod: 0xdaa520,
  3137. gray: 0x808080,
  3138. green: 0x008000,
  3139. greenyellow: 0xadff2f,
  3140. grey: 0x808080,
  3141. honeydew: 0xf0fff0,
  3142. hotpink: 0xff69b4,
  3143. indianred: 0xcd5c5c,
  3144. indigo: 0x4b0082,
  3145. ivory: 0xfffff0,
  3146. khaki: 0xf0e68c,
  3147. lavender: 0xe6e6fa,
  3148. lavenderblush: 0xfff0f5,
  3149. lawngreen: 0x7cfc00,
  3150. lemonchiffon: 0xfffacd,
  3151. lightblue: 0xadd8e6,
  3152. lightcoral: 0xf08080,
  3153. lightcyan: 0xe0ffff,
  3154. lightgoldenrodyellow: 0xfafad2,
  3155. lightgray: 0xd3d3d3,
  3156. lightgreen: 0x90ee90,
  3157. lightgrey: 0xd3d3d3,
  3158. lightpink: 0xffb6c1,
  3159. lightsalmon: 0xffa07a,
  3160. lightseagreen: 0x20b2aa,
  3161. lightskyblue: 0x87cefa,
  3162. lightslategray: 0x778899,
  3163. lightslategrey: 0x778899,
  3164. lightsteelblue: 0xb0c4de,
  3165. lightyellow: 0xffffe0,
  3166. lime: 0x00ff00,
  3167. limegreen: 0x32cd32,
  3168. linen: 0xfaf0e6,
  3169. magenta: 0xff00ff,
  3170. maroon: 0x800000,
  3171. mediumaquamarine: 0x66cdaa,
  3172. mediumblue: 0x0000cd,
  3173. mediumorchid: 0xba55d3,
  3174. mediumpurple: 0x9370db,
  3175. mediumseagreen: 0x3cb371,
  3176. mediumslateblue: 0x7b68ee,
  3177. mediumspringgreen: 0x00fa9a,
  3178. mediumturquoise: 0x48d1cc,
  3179. mediumvioletred: 0xc71585,
  3180. midnightblue: 0x191970,
  3181. mintcream: 0xf5fffa,
  3182. mistyrose: 0xffe4e1,
  3183. moccasin: 0xffe4b5,
  3184. navajowhite: 0xffdead,
  3185. navy: 0x000080,
  3186. oldlace: 0xfdf5e6,
  3187. olive: 0x808000,
  3188. olivedrab: 0x6b8e23,
  3189. orange: 0xffa500,
  3190. orangered: 0xff4500,
  3191. orchid: 0xda70d6,
  3192. palegoldenrod: 0xeee8aa,
  3193. palegreen: 0x98fb98,
  3194. paleturquoise: 0xafeeee,
  3195. palevioletred: 0xdb7093,
  3196. papayawhip: 0xffefd5,
  3197. peachpuff: 0xffdab9,
  3198. peru: 0xcd853f,
  3199. pink: 0xffc0cb,
  3200. plum: 0xdda0dd,
  3201. powderblue: 0xb0e0e6,
  3202. purple: 0x800080,
  3203. rebeccapurple: 0x663399,
  3204. red: 0xff0000,
  3205. rosybrown: 0xbc8f8f,
  3206. royalblue: 0x4169e1,
  3207. saddlebrown: 0x8b4513,
  3208. salmon: 0xfa8072,
  3209. sandybrown: 0xf4a460,
  3210. seagreen: 0x2e8b57,
  3211. seashell: 0xfff5ee,
  3212. sienna: 0xa0522d,
  3213. silver: 0xc0c0c0,
  3214. skyblue: 0x87ceeb,
  3215. slateblue: 0x6a5acd,
  3216. slategray: 0x708090,
  3217. slategrey: 0x708090,
  3218. snow: 0xfffafa,
  3219. springgreen: 0x00ff7f,
  3220. steelblue: 0x4682b4,
  3221. tan: 0xd2b48c,
  3222. teal: 0x008080,
  3223. thistle: 0xd8bfd8,
  3224. tomato: 0xff6347,
  3225. turquoise: 0x40e0d0,
  3226. violet: 0xee82ee,
  3227. wheat: 0xf5deb3,
  3228. white: 0xffffff,
  3229. whitesmoke: 0xf5f5f5,
  3230. yellow: 0xffff00,
  3231. yellowgreen: 0x9acd32
  3232. };
  3233. define(Color, color, {
  3234. copy(channels) {
  3235. return Object.assign(new this.constructor, this, channels);
  3236. },
  3237. displayable() {
  3238. return this.rgb().displayable();
  3239. },
  3240. hex: color_formatHex, // Deprecated! Use color.formatHex.
  3241. formatHex: color_formatHex,
  3242. formatHex8: color_formatHex8,
  3243. formatHsl: color_formatHsl,
  3244. formatRgb: color_formatRgb,
  3245. toString: color_formatRgb
  3246. });
  3247. function color_formatHex() {
  3248. return this.rgb().formatHex();
  3249. }
  3250. function color_formatHex8() {
  3251. return this.rgb().formatHex8();
  3252. }
  3253. function color_formatHsl() {
  3254. return hslConvert(this).formatHsl();
  3255. }
  3256. function color_formatRgb() {
  3257. return this.rgb().formatRgb();
  3258. }
  3259. function color(format) {
  3260. var m, l;
  3261. format = (format + "").trim().toLowerCase();
  3262. return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
  3263. : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
  3264. : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
  3265. : 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
  3266. : null) // invalid hex
  3267. : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
  3268. : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
  3269. : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
  3270. : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
  3271. : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
  3272. : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
  3273. : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
  3274. : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
  3275. : null;
  3276. }
  3277. function rgbn(n) {
  3278. return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
  3279. }
  3280. function rgba(r, g, b, a) {
  3281. if (a <= 0) r = g = b = NaN;
  3282. return new Rgb(r, g, b, a);
  3283. }
  3284. function rgbConvert(o) {
  3285. if (!(o instanceof Color)) o = color(o);
  3286. if (!o) return new Rgb;
  3287. o = o.rgb();
  3288. return new Rgb(o.r, o.g, o.b, o.opacity);
  3289. }
  3290. function rgb$1(r, g, b, opacity) {
  3291. return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
  3292. }
  3293. function Rgb(r, g, b, opacity) {
  3294. this.r = +r;
  3295. this.g = +g;
  3296. this.b = +b;
  3297. this.opacity = +opacity;
  3298. }
  3299. define(Rgb, rgb$1, extend(Color, {
  3300. brighter(k) {
  3301. k = k == null ? brighter : Math.pow(brighter, k);
  3302. return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  3303. },
  3304. darker(k) {
  3305. k = k == null ? darker : Math.pow(darker, k);
  3306. return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  3307. },
  3308. rgb() {
  3309. return this;
  3310. },
  3311. clamp() {
  3312. return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
  3313. },
  3314. displayable() {
  3315. return (-0.5 <= this.r && this.r < 255.5)
  3316. && (-0.5 <= this.g && this.g < 255.5)
  3317. && (-0.5 <= this.b && this.b < 255.5)
  3318. && (0 <= this.opacity && this.opacity <= 1);
  3319. },
  3320. hex: rgb_formatHex, // Deprecated! Use color.formatHex.
  3321. formatHex: rgb_formatHex,
  3322. formatHex8: rgb_formatHex8,
  3323. formatRgb: rgb_formatRgb,
  3324. toString: rgb_formatRgb
  3325. }));
  3326. function rgb_formatHex() {
  3327. return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
  3328. }
  3329. function rgb_formatHex8() {
  3330. return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
  3331. }
  3332. function rgb_formatRgb() {
  3333. const a = clampa(this.opacity);
  3334. return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
  3335. }
  3336. function clampa(opacity) {
  3337. return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
  3338. }
  3339. function clampi(value) {
  3340. return Math.max(0, Math.min(255, Math.round(value) || 0));
  3341. }
  3342. function hex(value) {
  3343. value = clampi(value);
  3344. return (value < 16 ? "0" : "") + value.toString(16);
  3345. }
  3346. function hsla(h, s, l, a) {
  3347. if (a <= 0) h = s = l = NaN;
  3348. else if (l <= 0 || l >= 1) h = s = NaN;
  3349. else if (s <= 0) h = NaN;
  3350. return new Hsl(h, s, l, a);
  3351. }
  3352. function hslConvert(o) {
  3353. if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
  3354. if (!(o instanceof Color)) o = color(o);
  3355. if (!o) return new Hsl;
  3356. if (o instanceof Hsl) return o;
  3357. o = o.rgb();
  3358. var r = o.r / 255,
  3359. g = o.g / 255,
  3360. b = o.b / 255,
  3361. min = Math.min(r, g, b),
  3362. max = Math.max(r, g, b),
  3363. h = NaN,
  3364. s = max - min,
  3365. l = (max + min) / 2;
  3366. if (s) {
  3367. if (r === max) h = (g - b) / s + (g < b) * 6;
  3368. else if (g === max) h = (b - r) / s + 2;
  3369. else h = (r - g) / s + 4;
  3370. s /= l < 0.5 ? max + min : 2 - max - min;
  3371. h *= 60;
  3372. } else {
  3373. s = l > 0 && l < 1 ? 0 : h;
  3374. }
  3375. return new Hsl(h, s, l, o.opacity);
  3376. }
  3377. function hsl(h, s, l, opacity) {
  3378. return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
  3379. }
  3380. function Hsl(h, s, l, opacity) {
  3381. this.h = +h;
  3382. this.s = +s;
  3383. this.l = +l;
  3384. this.opacity = +opacity;
  3385. }
  3386. define(Hsl, hsl, extend(Color, {
  3387. brighter(k) {
  3388. k = k == null ? brighter : Math.pow(brighter, k);
  3389. return new Hsl(this.h, this.s, this.l * k, this.opacity);
  3390. },
  3391. darker(k) {
  3392. k = k == null ? darker : Math.pow(darker, k);
  3393. return new Hsl(this.h, this.s, this.l * k, this.opacity);
  3394. },
  3395. rgb() {
  3396. var h = this.h % 360 + (this.h < 0) * 360,
  3397. s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
  3398. l = this.l,
  3399. m2 = l + (l < 0.5 ? l : 1 - l) * s,
  3400. m1 = 2 * l - m2;
  3401. return new Rgb(
  3402. hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
  3403. hsl2rgb(h, m1, m2),
  3404. hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
  3405. this.opacity
  3406. );
  3407. },
  3408. clamp() {
  3409. return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
  3410. },
  3411. displayable() {
  3412. return (0 <= this.s && this.s <= 1 || isNaN(this.s))
  3413. && (0 <= this.l && this.l <= 1)
  3414. && (0 <= this.opacity && this.opacity <= 1);
  3415. },
  3416. formatHsl() {
  3417. const a = clampa(this.opacity);
  3418. return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
  3419. }
  3420. }));
  3421. function clamph(value) {
  3422. value = (value || 0) % 360;
  3423. return value < 0 ? value + 360 : value;
  3424. }
  3425. function clampt(value) {
  3426. return Math.max(0, Math.min(1, value || 0));
  3427. }
  3428. /* From FvD 13.37, CSS Color Module Level 3 */
  3429. function hsl2rgb(h, m1, m2) {
  3430. return (h < 60 ? m1 + (m2 - m1) * h / 60
  3431. : h < 180 ? m2
  3432. : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
  3433. : m1) * 255;
  3434. }
  3435. var constant = x => () => x;
  3436. function linear$1(a, d) {
  3437. return function(t) {
  3438. return a + t * d;
  3439. };
  3440. }
  3441. function exponential(a, b, y) {
  3442. return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
  3443. return Math.pow(a + t * b, y);
  3444. };
  3445. }
  3446. function gamma(y) {
  3447. return (y = +y) === 1 ? nogamma : function(a, b) {
  3448. return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
  3449. };
  3450. }
  3451. function nogamma(a, b) {
  3452. var d = b - a;
  3453. return d ? linear$1(a, d) : constant(isNaN(a) ? b : a);
  3454. }
  3455. var rgb = (function rgbGamma(y) {
  3456. var color = gamma(y);
  3457. function rgb(start, end) {
  3458. var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r),
  3459. g = color(start.g, end.g),
  3460. b = color(start.b, end.b),
  3461. opacity = nogamma(start.opacity, end.opacity);
  3462. return function(t) {
  3463. start.r = r(t);
  3464. start.g = g(t);
  3465. start.b = b(t);
  3466. start.opacity = opacity(t);
  3467. return start + "";
  3468. };
  3469. }
  3470. rgb.gamma = rgbGamma;
  3471. return rgb;
  3472. })(1);
  3473. function numberArray(a, b) {
  3474. if (!b) b = [];
  3475. var n = a ? Math.min(b.length, a.length) : 0,
  3476. c = b.slice(),
  3477. i;
  3478. return function(t) {
  3479. for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
  3480. return c;
  3481. };
  3482. }
  3483. function isNumberArray(x) {
  3484. return ArrayBuffer.isView(x) && !(x instanceof DataView);
  3485. }
  3486. function genericArray(a, b) {
  3487. var nb = b ? b.length : 0,
  3488. na = a ? Math.min(nb, a.length) : 0,
  3489. x = new Array(na),
  3490. c = new Array(nb),
  3491. i;
  3492. for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]);
  3493. for (; i < nb; ++i) c[i] = b[i];
  3494. return function(t) {
  3495. for (i = 0; i < na; ++i) c[i] = x[i](t);
  3496. return c;
  3497. };
  3498. }
  3499. function date(a, b) {
  3500. var d = new Date;
  3501. return a = +a, b = +b, function(t) {
  3502. return d.setTime(a * (1 - t) + b * t), d;
  3503. };
  3504. }
  3505. function interpolateNumber(a, b) {
  3506. return a = +a, b = +b, function(t) {
  3507. return a * (1 - t) + b * t;
  3508. };
  3509. }
  3510. function object(a, b) {
  3511. var i = {},
  3512. c = {},
  3513. k;
  3514. if (a === null || typeof a !== "object") a = {};
  3515. if (b === null || typeof b !== "object") b = {};
  3516. for (k in b) {
  3517. if (k in a) {
  3518. i[k] = interpolate(a[k], b[k]);
  3519. } else {
  3520. c[k] = b[k];
  3521. }
  3522. }
  3523. return function(t) {
  3524. for (k in i) c[k] = i[k](t);
  3525. return c;
  3526. };
  3527. }
  3528. var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
  3529. reB = new RegExp(reA.source, "g");
  3530. function zero(b) {
  3531. return function() {
  3532. return b;
  3533. };
  3534. }
  3535. function one(b) {
  3536. return function(t) {
  3537. return b(t) + "";
  3538. };
  3539. }
  3540. function string(a, b) {
  3541. var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
  3542. am, // current match in a
  3543. bm, // current match in b
  3544. bs, // string preceding current number in b, if any
  3545. i = -1, // index in s
  3546. s = [], // string constants and placeholders
  3547. q = []; // number interpolators
  3548. // Coerce inputs to strings.
  3549. a = a + "", b = b + "";
  3550. // Interpolate pairs of numbers in a & b.
  3551. while ((am = reA.exec(a))
  3552. && (bm = reB.exec(b))) {
  3553. if ((bs = bm.index) > bi) { // a string precedes the next number in b
  3554. bs = b.slice(bi, bs);
  3555. if (s[i]) s[i] += bs; // coalesce with previous string
  3556. else s[++i] = bs;
  3557. }
  3558. if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
  3559. if (s[i]) s[i] += bm; // coalesce with previous string
  3560. else s[++i] = bm;
  3561. } else { // interpolate non-matching numbers
  3562. s[++i] = null;
  3563. q.push({i: i, x: interpolateNumber(am, bm)});
  3564. }
  3565. bi = reB.lastIndex;
  3566. }
  3567. // Add remains of b.
  3568. if (bi < b.length) {
  3569. bs = b.slice(bi);
  3570. if (s[i]) s[i] += bs; // coalesce with previous string
  3571. else s[++i] = bs;
  3572. }
  3573. // Special optimization for only a single match.
  3574. // Otherwise, interpolate each of the numbers and rejoin the string.
  3575. return s.length < 2 ? (q[0]
  3576. ? one(q[0].x)
  3577. : zero(b))
  3578. : (b = q.length, function(t) {
  3579. for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
  3580. return s.join("");
  3581. });
  3582. }
  3583. function interpolate(a, b) {
  3584. var t = typeof b, c;
  3585. return b == null || t === "boolean" ? constant(b)
  3586. : (t === "number" ? interpolateNumber
  3587. : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string)
  3588. : b instanceof color ? rgb
  3589. : b instanceof Date ? date
  3590. : isNumberArray(b) ? numberArray
  3591. : Array.isArray(b) ? genericArray
  3592. : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
  3593. : interpolateNumber)(a, b);
  3594. }
  3595. function interpolateRound(a, b) {
  3596. return a = +a, b = +b, function(t) {
  3597. return Math.round(a * (1 - t) + b * t);
  3598. };
  3599. }
  3600. function constants(x) {
  3601. return function() {
  3602. return x;
  3603. };
  3604. }
  3605. function number(x) {
  3606. return +x;
  3607. }
  3608. var unit = [0, 1];
  3609. function identity$1(x) {
  3610. return x;
  3611. }
  3612. function normalize(a, b) {
  3613. return (b -= (a = +a))
  3614. ? function(x) { return (x - a) / b; }
  3615. : constants(isNaN(b) ? NaN : 0.5);
  3616. }
  3617. function clamper(a, b) {
  3618. var t;
  3619. if (a > b) t = a, a = b, b = t;
  3620. return function(x) { return Math.max(a, Math.min(b, x)); };
  3621. }
  3622. // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
  3623. // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
  3624. function bimap(domain, range, interpolate) {
  3625. var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
  3626. if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
  3627. else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
  3628. return function(x) { return r0(d0(x)); };
  3629. }
  3630. function polymap(domain, range, interpolate) {
  3631. var j = Math.min(domain.length, range.length) - 1,
  3632. d = new Array(j),
  3633. r = new Array(j),
  3634. i = -1;
  3635. // Reverse descending domains.
  3636. if (domain[j] < domain[0]) {
  3637. domain = domain.slice().reverse();
  3638. range = range.slice().reverse();
  3639. }
  3640. while (++i < j) {
  3641. d[i] = normalize(domain[i], domain[i + 1]);
  3642. r[i] = interpolate(range[i], range[i + 1]);
  3643. }
  3644. return function(x) {
  3645. var i = bisectRight(domain, x, 1, j) - 1;
  3646. return r[i](d[i](x));
  3647. };
  3648. }
  3649. function copy$1(source, target) {
  3650. return target
  3651. .domain(source.domain())
  3652. .range(source.range())
  3653. .interpolate(source.interpolate())
  3654. .clamp(source.clamp())
  3655. .unknown(source.unknown());
  3656. }
  3657. function transformer$1() {
  3658. var domain = unit,
  3659. range = unit,
  3660. interpolate$1 = interpolate,
  3661. transform,
  3662. untransform,
  3663. unknown,
  3664. clamp = identity$1,
  3665. piecewise,
  3666. output,
  3667. input;
  3668. function rescale() {
  3669. var n = Math.min(domain.length, range.length);
  3670. if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]);
  3671. piecewise = n > 2 ? polymap : bimap;
  3672. output = input = null;
  3673. return scale;
  3674. }
  3675. function scale(x) {
  3676. return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x)));
  3677. }
  3678. scale.invert = function(y) {
  3679. return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
  3680. };
  3681. scale.domain = function(_) {
  3682. return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
  3683. };
  3684. scale.range = function(_) {
  3685. return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
  3686. };
  3687. scale.rangeRound = function(_) {
  3688. return range = Array.from(_), interpolate$1 = interpolateRound, rescale();
  3689. };
  3690. scale.clamp = function(_) {
  3691. return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1;
  3692. };
  3693. scale.interpolate = function(_) {
  3694. return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1;
  3695. };
  3696. scale.unknown = function(_) {
  3697. return arguments.length ? (unknown = _, scale) : unknown;
  3698. };
  3699. return function(t, u) {
  3700. transform = t, untransform = u;
  3701. return rescale();
  3702. };
  3703. }
  3704. function continuous() {
  3705. return transformer$1()(identity$1, identity$1);
  3706. }
  3707. function formatDecimal(x) {
  3708. return Math.abs(x = Math.round(x)) >= 1e21
  3709. ? x.toLocaleString("en").replace(/,/g, "")
  3710. : x.toString(10);
  3711. }
  3712. // Computes the decimal coefficient and exponent of the specified number x with
  3713. // significant digits p, where x is positive and p is in [1, 21] or undefined.
  3714. // For example, formatDecimalParts(1.23) returns ["123", 0].
  3715. function formatDecimalParts(x, p) {
  3716. if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
  3717. var i, coefficient = x.slice(0, i);
  3718. // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
  3719. // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
  3720. return [
  3721. coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
  3722. +x.slice(i + 1)
  3723. ];
  3724. }
  3725. function exponent(x) {
  3726. return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
  3727. }
  3728. function formatGroup(grouping, thousands) {
  3729. return function(value, width) {
  3730. var i = value.length,
  3731. t = [],
  3732. j = 0,
  3733. g = grouping[0],
  3734. length = 0;
  3735. while (i > 0 && g > 0) {
  3736. if (length + g + 1 > width) g = Math.max(1, width - length);
  3737. t.push(value.substring(i -= g, i + g));
  3738. if ((length += g + 1) > width) break;
  3739. g = grouping[j = (j + 1) % grouping.length];
  3740. }
  3741. return t.reverse().join(thousands);
  3742. };
  3743. }
  3744. function formatNumerals(numerals) {
  3745. return function(value) {
  3746. return value.replace(/[0-9]/g, function(i) {
  3747. return numerals[+i];
  3748. });
  3749. };
  3750. }
  3751. // [[fill]align][sign][symbol][0][width][,][.precision][~][type]
  3752. var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
  3753. function formatSpecifier(specifier) {
  3754. if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
  3755. var match;
  3756. return new FormatSpecifier({
  3757. fill: match[1],
  3758. align: match[2],
  3759. sign: match[3],
  3760. symbol: match[4],
  3761. zero: match[5],
  3762. width: match[6],
  3763. comma: match[7],
  3764. precision: match[8] && match[8].slice(1),
  3765. trim: match[9],
  3766. type: match[10]
  3767. });
  3768. }
  3769. formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
  3770. function FormatSpecifier(specifier) {
  3771. this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
  3772. this.align = specifier.align === undefined ? ">" : specifier.align + "";
  3773. this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
  3774. this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
  3775. this.zero = !!specifier.zero;
  3776. this.width = specifier.width === undefined ? undefined : +specifier.width;
  3777. this.comma = !!specifier.comma;
  3778. this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
  3779. this.trim = !!specifier.trim;
  3780. this.type = specifier.type === undefined ? "" : specifier.type + "";
  3781. }
  3782. FormatSpecifier.prototype.toString = function() {
  3783. return this.fill
  3784. + this.align
  3785. + this.sign
  3786. + this.symbol
  3787. + (this.zero ? "0" : "")
  3788. + (this.width === undefined ? "" : Math.max(1, this.width | 0))
  3789. + (this.comma ? "," : "")
  3790. + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
  3791. + (this.trim ? "~" : "")
  3792. + this.type;
  3793. };
  3794. // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
  3795. function formatTrim(s) {
  3796. out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
  3797. switch (s[i]) {
  3798. case ".": i0 = i1 = i; break;
  3799. case "0": if (i0 === 0) i0 = i; i1 = i; break;
  3800. default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
  3801. }
  3802. }
  3803. return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
  3804. }
  3805. var prefixExponent;
  3806. function formatPrefixAuto(x, p) {
  3807. var d = formatDecimalParts(x, p);
  3808. if (!d) return x + "";
  3809. var coefficient = d[0],
  3810. exponent = d[1],
  3811. i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
  3812. n = coefficient.length;
  3813. return i === n ? coefficient
  3814. : i > n ? coefficient + new Array(i - n + 1).join("0")
  3815. : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
  3816. : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
  3817. }
  3818. function formatRounded(x, p) {
  3819. var d = formatDecimalParts(x, p);
  3820. if (!d) return x + "";
  3821. var coefficient = d[0],
  3822. exponent = d[1];
  3823. return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
  3824. : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
  3825. : coefficient + new Array(exponent - coefficient.length + 2).join("0");
  3826. }
  3827. var formatTypes = {
  3828. "%": (x, p) => (x * 100).toFixed(p),
  3829. "b": (x) => Math.round(x).toString(2),
  3830. "c": (x) => x + "",
  3831. "d": formatDecimal,
  3832. "e": (x, p) => x.toExponential(p),
  3833. "f": (x, p) => x.toFixed(p),
  3834. "g": (x, p) => x.toPrecision(p),
  3835. "o": (x) => Math.round(x).toString(8),
  3836. "p": (x, p) => formatRounded(x * 100, p),
  3837. "r": formatRounded,
  3838. "s": formatPrefixAuto,
  3839. "X": (x) => Math.round(x).toString(16).toUpperCase(),
  3840. "x": (x) => Math.round(x).toString(16)
  3841. };
  3842. function identity(x) {
  3843. return x;
  3844. }
  3845. var map = Array.prototype.map,
  3846. prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
  3847. function formatLocale(locale) {
  3848. var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
  3849. currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
  3850. currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
  3851. decimal = locale.decimal === undefined ? "." : locale.decimal + "",
  3852. numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
  3853. percent = locale.percent === undefined ? "%" : locale.percent + "",
  3854. minus = locale.minus === undefined ? "−" : locale.minus + "",
  3855. nan = locale.nan === undefined ? "NaN" : locale.nan + "";
  3856. function newFormat(specifier) {
  3857. specifier = formatSpecifier(specifier);
  3858. var fill = specifier.fill,
  3859. align = specifier.align,
  3860. sign = specifier.sign,
  3861. symbol = specifier.symbol,
  3862. zero = specifier.zero,
  3863. width = specifier.width,
  3864. comma = specifier.comma,
  3865. precision = specifier.precision,
  3866. trim = specifier.trim,
  3867. type = specifier.type;
  3868. // The "n" type is an alias for ",g".
  3869. if (type === "n") comma = true, type = "g";
  3870. // The "" type, and any invalid type, is an alias for ".12~g".
  3871. else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
  3872. // If zero fill is specified, padding goes after sign and before digits.
  3873. if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
  3874. // Compute the prefix and suffix.
  3875. // For SI-prefix, the suffix is lazily computed.
  3876. var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
  3877. suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
  3878. // What format function should we use?
  3879. // Is this an integer type?
  3880. // Can this type generate exponential notation?
  3881. var formatType = formatTypes[type],
  3882. maybeSuffix = /[defgprs%]/.test(type);
  3883. // Set the default precision if not specified,
  3884. // or clamp the specified precision to the supported range.
  3885. // For significant precision, it must be in [1, 21].
  3886. // For fixed precision, it must be in [0, 20].
  3887. precision = precision === undefined ? 6
  3888. : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
  3889. : Math.max(0, Math.min(20, precision));
  3890. function format(value) {
  3891. var valuePrefix = prefix,
  3892. valueSuffix = suffix,
  3893. i, n, c;
  3894. if (type === "c") {
  3895. valueSuffix = formatType(value) + valueSuffix;
  3896. value = "";
  3897. } else {
  3898. value = +value;
  3899. // Determine the sign. -0 is not less than 0, but 1 / -0 is!
  3900. var valueNegative = value < 0 || 1 / value < 0;
  3901. // Perform the initial formatting.
  3902. value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
  3903. // Trim insignificant zeros.
  3904. if (trim) value = formatTrim(value);
  3905. // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
  3906. if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
  3907. // Compute the prefix and suffix.
  3908. valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
  3909. valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
  3910. // Break the formatted value into the integer “value” part that can be
  3911. // grouped, and fractional or exponential “suffix” part that is not.
  3912. if (maybeSuffix) {
  3913. i = -1, n = value.length;
  3914. while (++i < n) {
  3915. if (c = value.charCodeAt(i), 48 > c || c > 57) {
  3916. valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
  3917. value = value.slice(0, i);
  3918. break;
  3919. }
  3920. }
  3921. }
  3922. }
  3923. // If the fill character is not "0", grouping is applied before padding.
  3924. if (comma && !zero) value = group(value, Infinity);
  3925. // Compute the padding.
  3926. var length = valuePrefix.length + value.length + valueSuffix.length,
  3927. padding = length < width ? new Array(width - length + 1).join(fill) : "";
  3928. // If the fill character is "0", grouping is applied after padding.
  3929. if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
  3930. // Reconstruct the final output based on the desired alignment.
  3931. switch (align) {
  3932. case "<": value = valuePrefix + value + valueSuffix + padding; break;
  3933. case "=": value = valuePrefix + padding + value + valueSuffix; break;
  3934. case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
  3935. default: value = padding + valuePrefix + value + valueSuffix; break;
  3936. }
  3937. return numerals(value);
  3938. }
  3939. format.toString = function() {
  3940. return specifier + "";
  3941. };
  3942. return format;
  3943. }
  3944. function formatPrefix(specifier, value) {
  3945. var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
  3946. e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
  3947. k = Math.pow(10, -e),
  3948. prefix = prefixes[8 + e / 3];
  3949. return function(value) {
  3950. return f(k * value) + prefix;
  3951. };
  3952. }
  3953. return {
  3954. format: newFormat,
  3955. formatPrefix: formatPrefix
  3956. };
  3957. }
  3958. var locale;
  3959. var format;
  3960. var formatPrefix;
  3961. defaultLocale({
  3962. thousands: ",",
  3963. grouping: [3],
  3964. currency: ["$", ""]
  3965. });
  3966. function defaultLocale(definition) {
  3967. locale = formatLocale(definition);
  3968. format = locale.format;
  3969. formatPrefix = locale.formatPrefix;
  3970. return locale;
  3971. }
  3972. function precisionFixed(step) {
  3973. return Math.max(0, -exponent(Math.abs(step)));
  3974. }
  3975. function precisionPrefix(step, value) {
  3976. return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
  3977. }
  3978. function precisionRound(step, max) {
  3979. step = Math.abs(step), max = Math.abs(max) - step;
  3980. return Math.max(0, exponent(max) - exponent(step)) + 1;
  3981. }
  3982. function tickFormat(start, stop, count, specifier) {
  3983. var step = tickStep(start, stop, count),
  3984. precision;
  3985. specifier = formatSpecifier(specifier == null ? ",f" : specifier);
  3986. switch (specifier.type) {
  3987. case "s": {
  3988. var value = Math.max(Math.abs(start), Math.abs(stop));
  3989. if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
  3990. return formatPrefix(specifier, value);
  3991. }
  3992. case "":
  3993. case "e":
  3994. case "g":
  3995. case "p":
  3996. case "r": {
  3997. if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
  3998. break;
  3999. }
  4000. case "f":
  4001. case "%": {
  4002. if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
  4003. break;
  4004. }
  4005. }
  4006. return format(specifier);
  4007. }
  4008. function linearish(scale) {
  4009. var domain = scale.domain;
  4010. scale.ticks = function(count) {
  4011. var d = domain();
  4012. return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
  4013. };
  4014. scale.tickFormat = function(count, specifier) {
  4015. var d = domain();
  4016. return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
  4017. };
  4018. scale.nice = function(count) {
  4019. if (count == null) count = 10;
  4020. var d = domain();
  4021. var i0 = 0;
  4022. var i1 = d.length - 1;
  4023. var start = d[i0];
  4024. var stop = d[i1];
  4025. var prestep;
  4026. var step;
  4027. var maxIter = 10;
  4028. if (stop < start) {
  4029. step = start, start = stop, stop = step;
  4030. step = i0, i0 = i1, i1 = step;
  4031. }
  4032. while (maxIter-- > 0) {
  4033. step = tickIncrement(start, stop, count);
  4034. if (step === prestep) {
  4035. d[i0] = start;
  4036. d[i1] = stop;
  4037. return domain(d);
  4038. } else if (step > 0) {
  4039. start = Math.floor(start / step) * step;
  4040. stop = Math.ceil(stop / step) * step;
  4041. } else if (step < 0) {
  4042. start = Math.ceil(start * step) / step;
  4043. stop = Math.floor(stop * step) / step;
  4044. } else {
  4045. break;
  4046. }
  4047. prestep = step;
  4048. }
  4049. return scale;
  4050. };
  4051. return scale;
  4052. }
  4053. function linear() {
  4054. var scale = continuous();
  4055. scale.copy = function() {
  4056. return copy$1(scale, linear());
  4057. };
  4058. initRange.apply(scale, arguments);
  4059. return linearish(scale);
  4060. }
  4061. function transformer() {
  4062. var x0 = 0,
  4063. x1 = 1,
  4064. t0,
  4065. t1,
  4066. k10,
  4067. transform,
  4068. interpolator = identity$1,
  4069. clamp = false,
  4070. unknown;
  4071. function scale(x) {
  4072. 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));
  4073. }
  4074. scale.domain = function(_) {
  4075. return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
  4076. };
  4077. scale.clamp = function(_) {
  4078. return arguments.length ? (clamp = !!_, scale) : clamp;
  4079. };
  4080. scale.interpolator = function(_) {
  4081. return arguments.length ? (interpolator = _, scale) : interpolator;
  4082. };
  4083. function range(interpolate) {
  4084. return function(_) {
  4085. var r0, r1;
  4086. return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];
  4087. };
  4088. }
  4089. scale.range = range(interpolate);
  4090. scale.rangeRound = range(interpolateRound);
  4091. scale.unknown = function(_) {
  4092. return arguments.length ? (unknown = _, scale) : unknown;
  4093. };
  4094. return function(t) {
  4095. transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);
  4096. return scale;
  4097. };
  4098. }
  4099. function copy(source, target) {
  4100. return target
  4101. .domain(source.domain())
  4102. .interpolator(source.interpolator())
  4103. .clamp(source.clamp())
  4104. .unknown(source.unknown());
  4105. }
  4106. function sequential() {
  4107. var scale = linearish(transformer()(identity$1));
  4108. scale.copy = function() {
  4109. return copy(scale, sequential());
  4110. };
  4111. return initInterpolator.apply(scale, arguments);
  4112. }
  4113. const COLOR_BASE = "#cecece";
  4114. // https://www.w3.org/TR/WCAG20/#relativeluminancedef
  4115. const rc = 0.2126;
  4116. const gc = 0.7152;
  4117. const bc = 0.0722;
  4118. // low-gamma adjust coefficient
  4119. const lowc = 1 / 12.92;
  4120. function adjustGamma(p) {
  4121. return Math.pow((p + 0.055) / 1.055, 2.4);
  4122. }
  4123. function relativeLuminance(o) {
  4124. const rsrgb = o.r / 255;
  4125. const gsrgb = o.g / 255;
  4126. const bsrgb = o.b / 255;
  4127. const r = rsrgb <= 0.03928 ? rsrgb * lowc : adjustGamma(rsrgb);
  4128. const g = gsrgb <= 0.03928 ? gsrgb * lowc : adjustGamma(gsrgb);
  4129. const b = bsrgb <= 0.03928 ? bsrgb * lowc : adjustGamma(bsrgb);
  4130. return r * rc + g * gc + b * bc;
  4131. }
  4132. const createRainbowColor = (root) => {
  4133. const colorParentMap = new Map();
  4134. colorParentMap.set(root, COLOR_BASE);
  4135. if (root.children != null) {
  4136. const colorScale = sequential([0, root.children.length], (n) => hsl(360 * n, 0.3, 0.85));
  4137. root.children.forEach((c, id) => {
  4138. colorParentMap.set(c, colorScale(id).toString());
  4139. });
  4140. }
  4141. const colorMap = new Map();
  4142. const lightScale = linear().domain([0, root.height]).range([0.9, 0.3]);
  4143. const getBackgroundColor = (node) => {
  4144. const parents = node.ancestors();
  4145. const colorStr = parents.length === 1
  4146. ? colorParentMap.get(parents[0])
  4147. : colorParentMap.get(parents[parents.length - 2]);
  4148. const hslColor = hsl(colorStr);
  4149. hslColor.l = lightScale(node.depth);
  4150. return hslColor;
  4151. };
  4152. return (node) => {
  4153. if (!colorMap.has(node)) {
  4154. const backgroundColor = getBackgroundColor(node);
  4155. const l = relativeLuminance(backgroundColor.rgb());
  4156. const fontColor = l > 0.19 ? "#000" : "#fff";
  4157. colorMap.set(node, {
  4158. backgroundColor: backgroundColor.toString(),
  4159. fontColor,
  4160. });
  4161. }
  4162. return colorMap.get(node);
  4163. };
  4164. };
  4165. const StaticContext = J({});
  4166. const drawChart = (parentNode, data, width, height) => {
  4167. const availableSizeProperties = getAvailableSizeOptions(data.options);
  4168. console.time("layout create");
  4169. const layout = treemap()
  4170. .size([width, height])
  4171. .paddingOuter(PADDING)
  4172. .paddingTop(TOP_PADDING)
  4173. .paddingInner(PADDING)
  4174. .round(true)
  4175. .tile(treemapResquarify);
  4176. console.timeEnd("layout create");
  4177. console.time("rawHierarchy create");
  4178. const rawHierarchy = hierarchy(data.tree);
  4179. console.timeEnd("rawHierarchy create");
  4180. const nodeSizesCache = new Map();
  4181. const nodeIdsCache = new Map();
  4182. 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; };
  4183. console.time("rawHierarchy eachAfter cache");
  4184. rawHierarchy.eachAfter((node) => {
  4185. var _a;
  4186. const nodeData = node.data;
  4187. nodeIdsCache.set(nodeData, {
  4188. nodeUid: generateUniqueId("node"),
  4189. clipUid: generateUniqueId("clip"),
  4190. });
  4191. const sizes = { renderedLength: 0, gzipLength: 0, brotliLength: 0 };
  4192. if (isModuleTree(nodeData)) {
  4193. for (const sizeKey of availableSizeProperties) {
  4194. sizes[sizeKey] = nodeData.children.reduce((acc, child) => getModuleSize(child, sizeKey) + acc, 0);
  4195. }
  4196. }
  4197. else {
  4198. for (const sizeKey of availableSizeProperties) {
  4199. sizes[sizeKey] = (_a = data.nodeParts[nodeData.uid][sizeKey]) !== null && _a !== void 0 ? _a : 0;
  4200. }
  4201. }
  4202. nodeSizesCache.set(nodeData, sizes);
  4203. });
  4204. console.timeEnd("rawHierarchy eachAfter cache");
  4205. const getModuleIds = (node) => nodeIdsCache.get(node);
  4206. console.time("color");
  4207. const getModuleColor = createRainbowColor(rawHierarchy);
  4208. console.timeEnd("color");
  4209. D$1(u$1(StaticContext.Provider, { value: {
  4210. data,
  4211. availableSizeProperties,
  4212. width,
  4213. height,
  4214. getModuleSize,
  4215. getModuleIds,
  4216. getModuleColor,
  4217. rawHierarchy,
  4218. layout,
  4219. }, children: u$1(Main, {}) }), parentNode);
  4220. };
  4221. exports.StaticContext = StaticContext;
  4222. exports.default = drawChart;
  4223. Object.defineProperty(exports, '__esModule', { value: true });
  4224. return exports;
  4225. })({});
  4226. /*-->*/
  4227. </script>
  4228. <script>
  4229. /*<!--*/
  4230. <<<<<<< HEAD
  4231. <<<<<<< HEAD
  4232. const data = {"version":2,"tree":{"name":"root","children":[{"name":"assets/echarts-CuWF_dEy.js","children":[{"name":"D:/gitzln1/gold_vue/gold-system/node_modules","children":[{"name":"tslib/tslib.es6.js","uid":"62d4627d-1"},{"name":"zrender/lib","children":[{"name":"core","children":[{"uid":"62d4627d-3","name":"env.js"},{"uid":"62d4627d-5","name":"platform.js"},{"uid":"62d4627d-7","name":"util.js"},{"uid":"62d4627d-9","name":"vector.js"},{"uid":"62d4627d-13","name":"Eventful.js"},{"uid":"62d4627d-15","name":"fourPointsTransform.js"},{"uid":"62d4627d-17","name":"dom.js"},{"uid":"62d4627d-19","name":"event.js"},{"uid":"62d4627d-21","name":"GestureMgr.js"},{"uid":"62d4627d-23","name":"matrix.js"},{"uid":"62d4627d-25","name":"Point.js"},{"uid":"62d4627d-27","name":"BoundingRect.js"},{"uid":"62d4627d-31","name":"timsort.js"},{"uid":"62d4627d-41","name":"curve.js"},{"uid":"62d4627d-47","name":"LRU.js"},{"uid":"62d4627d-61","name":"Transformable.js"},{"uid":"62d4627d-89","name":"bbox.js"},{"uid":"62d4627d-91","name":"PathProxy.js"},{"uid":"62d4627d-161","name":"OrientedBoundingRect.js"},{"uid":"62d4627d-271","name":"WeakMap.js"}]},{"name":"mixin/Draggable.js","uid":"62d4627d-11"},{"uid":"62d4627d-29","name":"Handler.js"},{"name":"graphic","children":[{"uid":"62d4627d-33","name":"constants.js"},{"uid":"62d4627d-67","name":"Group.js"},{"name":"helper","children":[{"uid":"62d4627d-83","name":"image.js"},{"uid":"62d4627d-85","name":"parseText.js"},{"uid":"62d4627d-113","name":"roundRect.js"},{"uid":"62d4627d-115","name":"subPixelOptimize.js"},{"uid":"62d4627d-133","name":"roundSector.js"},{"uid":"62d4627d-139","name":"smoothBezier.js"},{"uid":"62d4627d-141","name":"poly.js"}]},{"uid":"62d4627d-87","name":"Displayable.js"},{"uid":"62d4627d-107","name":"Path.js"},{"uid":"62d4627d-109","name":"TSpan.js"},{"uid":"62d4627d-111","name":"Image.js"},{"name":"shape","children":[{"uid":"62d4627d-117","name":"Rect.js"},{"uid":"62d4627d-129","name":"Circle.js"},{"uid":"62d4627d-131","name":"Ellipse.js"},{"uid":"62d4627d-135","name":"Sector.js"},{"uid":"62d4627d-137","name":"Ring.js"},{"uid":"62d4627d-143","name":"Polygon.js"},{"uid":"62d4627d-145","name":"Polyline.js"},{"uid":"62d4627d-147","name":"Line.js"},{"uid":"62d4627d-149","name":"BezierCurve.js"},{"uid":"62d4627d-151","name":"Arc.js"}]},{"uid":"62d4627d-119","name":"Text.js"},{"uid":"62d4627d-153","name":"CompoundPath.js"},{"uid":"62d4627d-155","name":"Gradient.js"},{"uid":"62d4627d-157","name":"LinearGradient.js"},{"uid":"62d4627d-159","name":"RadialGradient.js"},{"uid":"62d4627d-163","name":"IncrementalDisplayable.js"}]},{"uid":"62d4627d-35","name":"Storage.js"},{"name":"animation","children":[{"uid":"62d4627d-37","name":"requestAnimationFrame.js"},{"uid":"62d4627d-39","name":"easing.js"},{"uid":"62d4627d-43","name":"cubicEasing.js"},{"uid":"62d4627d-45","name":"Clip.js"},{"uid":"62d4627d-53","name":"Animator.js"},{"uid":"62d4627d-55","name":"Animation.js"}]},{"name":"tool","children":[{"uid":"62d4627d-49","name":"color.js"},{"uid":"62d4627d-125","name":"transformPath.js"},{"uid":"62d4627d-127","name":"path.js"},{"uid":"62d4627d-527","name":"parseXML.js"},{"uid":"62d4627d-529","name":"parseSVG.js"},{"uid":"62d4627d-1097","name":"convertPath.js"},{"uid":"62d4627d-1099","name":"dividePath.js"},{"uid":"62d4627d-1101","name":"morphPath.js"}]},{"name":"svg","children":[{"uid":"62d4627d-51","name":"helper.js"},{"uid":"62d4627d-369","name":"SVGPathRebuilder.js"},{"uid":"62d4627d-371","name":"mapStyleToAttrs.js"},{"uid":"62d4627d-373","name":"core.js"},{"uid":"62d4627d-375","name":"cssClassId.js"},{"uid":"62d4627d-377","name":"cssAnimation.js"},{"uid":"62d4627d-379","name":"cssEmphasis.js"},{"uid":"62d4627d-381","name":"graphic.js"},{"uid":"62d4627d-383","name":"domapi.js"},{"uid":"62d4627d-385","name":"patch.js"},{"uid":"62d4627d-387","name":"Painter.js"}]},{"name":"dom/HandlerProxy.js","uid":"62d4627d-57"},{"uid":"62d4627d-59","name":"config.js"},{"name":"contain","children":[{"uid":"62d4627d-63","name":"text.js"},{"uid":"62d4627d-93","name":"line.js"},{"uid":"62d4627d-95","name":"cu
  4233. =======
  4234. const data = {"version":2,"tree":{"name":"root","children":[{"name":"assets/echarts-CuWF_dEy.js","children":[{"name":"E:/goldcoin/gold_vue/gold-system/node_modules","children":[{"name":"tslib/tslib.es6.js","uid":"47a687d6-1"},{"name":"zrender/lib","children":[{"name":"core","children":[{"uid":"47a687d6-3","name":"env.js"},{"uid":"47a687d6-5","name":"platform.js"},{"uid":"47a687d6-7","name":"util.js"},{"uid":"47a687d6-9","name":"vector.js"},{"uid":"47a687d6-13","name":"Eventful.js"},{"uid":"47a687d6-15","name":"fourPointsTransform.js"},{"uid":"47a687d6-17","name":"dom.js"},{"uid":"47a687d6-19","name":"event.js"},{"uid":"47a687d6-21","name":"GestureMgr.js"},{"uid":"47a687d6-23","name":"matrix.js"},{"uid":"47a687d6-25","name":"Point.js"},{"uid":"47a687d6-27","name":"BoundingRect.js"},{"uid":"47a687d6-31","name":"timsort.js"},{"uid":"47a687d6-41","name":"curve.js"},{"uid":"47a687d6-47","name":"LRU.js"},{"uid":"47a687d6-61","name":"Transformable.js"},{"uid":"47a687d6-89","name":"bbox.js"},{"uid":"47a687d6-91","name":"PathProxy.js"},{"uid":"47a687d6-161","name":"OrientedBoundingRect.js"},{"uid":"47a687d6-271","name":"WeakMap.js"}]},{"name":"mixin/Draggable.js","uid":"47a687d6-11"},{"uid":"47a687d6-29","name":"Handler.js"},{"name":"graphic","children":[{"uid":"47a687d6-33","name":"constants.js"},{"uid":"47a687d6-67","name":"Group.js"},{"name":"helper","children":[{"uid":"47a687d6-83","name":"image.js"},{"uid":"47a687d6-85","name":"parseText.js"},{"uid":"47a687d6-113","name":"roundRect.js"},{"uid":"47a687d6-115","name":"subPixelOptimize.js"},{"uid":"47a687d6-133","name":"roundSector.js"},{"uid":"47a687d6-139","name":"smoothBezier.js"},{"uid":"47a687d6-141","name":"poly.js"}]},{"uid":"47a687d6-87","name":"Displayable.js"},{"uid":"47a687d6-107","name":"Path.js"},{"uid":"47a687d6-109","name":"TSpan.js"},{"uid":"47a687d6-111","name":"Image.js"},{"name":"shape","children":[{"uid":"47a687d6-117","name":"Rect.js"},{"uid":"47a687d6-129","name":"Circle.js"},{"uid":"47a687d6-131","name":"Ellipse.js"},{"uid":"47a687d6-135","name":"Sector.js"},{"uid":"47a687d6-137","name":"Ring.js"},{"uid":"47a687d6-143","name":"Polygon.js"},{"uid":"47a687d6-145","name":"Polyline.js"},{"uid":"47a687d6-147","name":"Line.js"},{"uid":"47a687d6-149","name":"BezierCurve.js"},{"uid":"47a687d6-151","name":"Arc.js"}]},{"uid":"47a687d6-119","name":"Text.js"},{"uid":"47a687d6-153","name":"CompoundPath.js"},{"uid":"47a687d6-155","name":"Gradient.js"},{"uid":"47a687d6-157","name":"LinearGradient.js"},{"uid":"47a687d6-159","name":"RadialGradient.js"},{"uid":"47a687d6-163","name":"IncrementalDisplayable.js"}]},{"uid":"47a687d6-35","name":"Storage.js"},{"name":"animation","children":[{"uid":"47a687d6-37","name":"requestAnimationFrame.js"},{"uid":"47a687d6-39","name":"easing.js"},{"uid":"47a687d6-43","name":"cubicEasing.js"},{"uid":"47a687d6-45","name":"Clip.js"},{"uid":"47a687d6-53","name":"Animator.js"},{"uid":"47a687d6-55","name":"Animation.js"}]},{"name":"tool","children":[{"uid":"47a687d6-49","name":"color.js"},{"uid":"47a687d6-125","name":"transformPath.js"},{"uid":"47a687d6-127","name":"path.js"},{"uid":"47a687d6-527","name":"parseXML.js"},{"uid":"47a687d6-529","name":"parseSVG.js"},{"uid":"47a687d6-1097","name":"convertPath.js"},{"uid":"47a687d6-1099","name":"dividePath.js"},{"uid":"47a687d6-1101","name":"morphPath.js"}]},{"name":"svg","children":[{"uid":"47a687d6-51","name":"helper.js"},{"uid":"47a687d6-369","name":"SVGPathRebuilder.js"},{"uid":"47a687d6-371","name":"mapStyleToAttrs.js"},{"uid":"47a687d6-373","name":"core.js"},{"uid":"47a687d6-375","name":"cssClassId.js"},{"uid":"47a687d6-377","name":"cssAnimation.js"},{"uid":"47a687d6-379","name":"cssEmphasis.js"},{"uid":"47a687d6-381","name":"graphic.js"},{"uid":"47a687d6-383","name":"domapi.js"},{"uid":"47a687d6-385","name":"patch.js"},{"uid":"47a687d6-387","name":"Painter.js"}]},{"name":"dom/HandlerProxy.js","uid":"47a687d6-57"},{"uid":"47a687d6-59","name":"config.js"},{"name":"contain","children":[{"uid":"47a687d6-63","name":"text.js"},{"uid":"47a687d6-93","name":"line.js"},{"uid":"47a687d6-95","name":"c
  4235. >>>>>>> zry
  4236. =======
  4237. const data = {"version":2,"tree":{"name":"root","children":[{"name":"assets/echarts-CuWF_dEy.js","children":[{"name":"D:/gitzln1/gold_vue/gold-system/node_modules","children":[{"name":"tslib/tslib.es6.js","uid":"2d143627-1"},{"name":"zrender/lib","children":[{"name":"core","children":[{"uid":"2d143627-3","name":"env.js"},{"uid":"2d143627-5","name":"platform.js"},{"uid":"2d143627-7","name":"util.js"},{"uid":"2d143627-9","name":"vector.js"},{"uid":"2d143627-13","name":"Eventful.js"},{"uid":"2d143627-15","name":"fourPointsTransform.js"},{"uid":"2d143627-17","name":"dom.js"},{"uid":"2d143627-19","name":"event.js"},{"uid":"2d143627-21","name":"GestureMgr.js"},{"uid":"2d143627-23","name":"matrix.js"},{"uid":"2d143627-25","name":"Point.js"},{"uid":"2d143627-27","name":"BoundingRect.js"},{"uid":"2d143627-31","name":"timsort.js"},{"uid":"2d143627-41","name":"curve.js"},{"uid":"2d143627-47","name":"LRU.js"},{"uid":"2d143627-61","name":"Transformable.js"},{"uid":"2d143627-89","name":"bbox.js"},{"uid":"2d143627-91","name":"PathProxy.js"},{"uid":"2d143627-161","name":"OrientedBoundingRect.js"},{"uid":"2d143627-271","name":"WeakMap.js"}]},{"name":"mixin/Draggable.js","uid":"2d143627-11"},{"uid":"2d143627-29","name":"Handler.js"},{"name":"graphic","children":[{"uid":"2d143627-33","name":"constants.js"},{"uid":"2d143627-67","name":"Group.js"},{"name":"helper","children":[{"uid":"2d143627-83","name":"image.js"},{"uid":"2d143627-85","name":"parseText.js"},{"uid":"2d143627-113","name":"roundRect.js"},{"uid":"2d143627-115","name":"subPixelOptimize.js"},{"uid":"2d143627-133","name":"roundSector.js"},{"uid":"2d143627-139","name":"smoothBezier.js"},{"uid":"2d143627-141","name":"poly.js"}]},{"uid":"2d143627-87","name":"Displayable.js"},{"uid":"2d143627-107","name":"Path.js"},{"uid":"2d143627-109","name":"TSpan.js"},{"uid":"2d143627-111","name":"Image.js"},{"name":"shape","children":[{"uid":"2d143627-117","name":"Rect.js"},{"uid":"2d143627-129","name":"Circle.js"},{"uid":"2d143627-131","name":"Ellipse.js"},{"uid":"2d143627-135","name":"Sector.js"},{"uid":"2d143627-137","name":"Ring.js"},{"uid":"2d143627-143","name":"Polygon.js"},{"uid":"2d143627-145","name":"Polyline.js"},{"uid":"2d143627-147","name":"Line.js"},{"uid":"2d143627-149","name":"BezierCurve.js"},{"uid":"2d143627-151","name":"Arc.js"}]},{"uid":"2d143627-119","name":"Text.js"},{"uid":"2d143627-153","name":"CompoundPath.js"},{"uid":"2d143627-155","name":"Gradient.js"},{"uid":"2d143627-157","name":"LinearGradient.js"},{"uid":"2d143627-159","name":"RadialGradient.js"},{"uid":"2d143627-163","name":"IncrementalDisplayable.js"}]},{"uid":"2d143627-35","name":"Storage.js"},{"name":"animation","children":[{"uid":"2d143627-37","name":"requestAnimationFrame.js"},{"uid":"2d143627-39","name":"easing.js"},{"uid":"2d143627-43","name":"cubicEasing.js"},{"uid":"2d143627-45","name":"Clip.js"},{"uid":"2d143627-53","name":"Animator.js"},{"uid":"2d143627-55","name":"Animation.js"}]},{"name":"tool","children":[{"uid":"2d143627-49","name":"color.js"},{"uid":"2d143627-125","name":"transformPath.js"},{"uid":"2d143627-127","name":"path.js"},{"uid":"2d143627-527","name":"parseXML.js"},{"uid":"2d143627-529","name":"parseSVG.js"},{"uid":"2d143627-1097","name":"convertPath.js"},{"uid":"2d143627-1099","name":"dividePath.js"},{"uid":"2d143627-1101","name":"morphPath.js"}]},{"name":"svg","children":[{"uid":"2d143627-51","name":"helper.js"},{"uid":"2d143627-369","name":"SVGPathRebuilder.js"},{"uid":"2d143627-371","name":"mapStyleToAttrs.js"},{"uid":"2d143627-373","name":"core.js"},{"uid":"2d143627-375","name":"cssClassId.js"},{"uid":"2d143627-377","name":"cssAnimation.js"},{"uid":"2d143627-379","name":"cssEmphasis.js"},{"uid":"2d143627-381","name":"graphic.js"},{"uid":"2d143627-383","name":"domapi.js"},{"uid":"2d143627-385","name":"patch.js"},{"uid":"2d143627-387","name":"Painter.js"}]},{"name":"dom/HandlerProxy.js","uid":"2d143627-57"},{"uid":"2d143627-59","name":"config.js"},{"name":"contain","children":[{"uid":"2d143627-63","name":"text.js"},{"uid":"2d143627-93","name":"line.js"},{"uid":"2d143627-95","name":"cu
  4238. >>>>>>> a117177bbbe1dd3064874e0b27bedb0c3b15c3e3
  4239. const run = () => {
  4240. const width = window.innerWidth;
  4241. const height = window.innerHeight;
  4242. const chartNode = document.querySelector("main");
  4243. drawChart.default(chartNode, data, width, height);
  4244. };
  4245. window.addEventListener('resize', run);
  4246. document.addEventListener('DOMContentLoaded', run);
  4247. /*-->*/
  4248. </script>
  4249. </body>
  4250. </html>