@webskill/sdk 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
- package/dist/agent.d.ts +3 -3
- package/dist/agent.js +1012 -130
- package/dist/{approval-DwN2o2QG.js → approval-DWQlDPbY.js} +102 -16
- package/dist/arc-8U_6NQWm.js +130 -0
- package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
- package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
- package/dist/array-DQfpQNY8.js +8 -0
- package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
- package/dist/browser.d.ts +444 -48
- package/dist/browser.js +1771 -91
- package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
- package/dist/channel-CZxxLrG7.js +9 -0
- package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
- package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
- package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
- package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
- package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
- package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
- package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
- package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
- package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
- package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
- package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
- package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
- package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
- package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
- package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
- package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
- package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
- package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
- package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
- package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
- package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
- package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
- package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
- package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
- package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
- package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
- package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
- package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
- package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
- package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
- package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
- package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
- package/dist/defaultLocale-B_EoOkSF.js +249 -0
- package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
- package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
- package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
- package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
- package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
- package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
- package/dist/dist-UajCDt3n.js +92 -0
- package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
- package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
- package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
- package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
- package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
- package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
- package/dist/{toolSource-C9oNuKmr.js → geometry-wx5ZTYzi.js} +162 -12
- package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
- package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
- package/dist/governance.d.ts +3 -3
- package/dist/graphlib-tk9gQYuN.js +4194 -0
- package/dist/{index-B8Tgmpwh.d.ts → index-BiO9_XRk.d.ts} +2 -2
- package/dist/{index-CYLt5u4L.d.ts → index-CjwdZQOS.d.ts} +700 -12
- package/dist/{index-DHopiH_m.d.ts → index-YPd8ZSEa.d.ts} +156 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
- package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
- package/dist/init-CMOIWdg-.js +16 -0
- package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
- package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
- package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
- package/dist/katex-BcRRvyh_.js +26465 -0
- package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
- package/dist/line-LgV8iVMV.js +48 -0
- package/dist/linear-BWKR0Tqd.js +393 -0
- package/dist/linkedDocument-CIuh_Yp0.js +416 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
- package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
- package/dist/mermaid.core-DMtwGCHy.js +1756 -0
- package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +2 -2
- package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
- package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
- package/dist/ordinal-CxA6GHQS.js +84 -0
- package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
- package/dist/path-C27Z2Bjv.js +106 -0
- package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
- package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
- package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
- package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
- package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
- package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
- package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
- package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
- package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
- package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
- package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
- package/dist/rough.cjs-AmDd_NQk.js +1395 -0
- package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
- package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
- package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
- package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-B24Jjjry-BY1H7Krp.d.ts} +1 -1
- package/dist/src-NkhI3UMl.js +2653 -0
- package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
- package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
- package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
- package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
- package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
- package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BM5FI9oN.d.ts} +59 -8
- package/dist/ui-react.d.ts +3 -3
- package/dist/ui-react.js +3718 -77
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
- package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
- package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
- package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
- package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-Dy-Zjv0y.js} +1 -1
- package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
- package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
- package/package.json +1 -1
- package/dist/linkedDocument-C0gj1sMq.js +0 -245
|
@@ -0,0 +1,4816 @@
|
|
|
1
|
+
import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
|
|
2
|
+
import { m as log } from "./src-NkhI3UMl.js";
|
|
3
|
+
import { x as getConfig2 } from "./chunk-O7XYJQB3-B6K0KOSL.js";
|
|
4
|
+
import "./chunk-ZIGJFQKS-DqEFBuHR.js";
|
|
5
|
+
import "./chunk-742MDFTN-CPmgCGwC.js";
|
|
6
|
+
import "./chunk-MBY4JIJT-C34L7a4f.js";
|
|
7
|
+
import "./chunk-7PRAP22T-BHED6GVs.js";
|
|
8
|
+
import { c as updateNodeBounds } from "./chunk-7INBJB4K-C9jq9o66.js";
|
|
9
|
+
import { a as setNodeElem, i as positionNode, n as getSubGraphTitleMargins } from "./chunk-5DYCD2WN-Bt97YGTd.js";
|
|
10
|
+
import { a as insertEdgeLabel, i as insertEdge, l as positionEdgeLabel } from "./chunk-Z7XXMR3K-oLg1h8F3.js";
|
|
11
|
+
import { $ as arrayMap, A as baseKeys, B as baseRest, C as baseFlatten, D as castPath, E as toKey, F as baseUnary, G as arrayEach, H as eq, I as isBuffer, J as constant, K as setToString, L as isArguments, M as arrayLikeKeys, N as isTypedArray, O as toString, P as nodeUtil, Q as isArray, R as isPrototype, S as Stack, T as baseGet, U as isIndex, V as overRest, W as baseFindIndex, X as identity, Y as isFunction, Z as isObject, _ as _getTag_default, a as filter, b as getSymbols, c as isArrayLikeObject, d as baseFor, et as isSymbol, f as baseIteratee, g as Uint8Array, h as hasPath, i as values, it as root, j as overArg, k as keys, l as baseEach, m as hasIn, n as reduce, nt as baseGetTag, o as forEach, p as baseProperty, q as defineProperty, r as isUndefined, rt as Symbol, s as castFunction, t as Graph, tt as isObjectLike, u as baseForOwn, v as getAllKeys, w as arrayPush, x as stubArray, y as baseGetAllKeys, z as isArrayLike } from "./graphlib-tk9gQYuN.js";
|
|
12
|
+
import { r as insertCluster } from "./chunk-UA2S7LBM-DxHM29_K.js";
|
|
13
|
+
import { c as sortNodesByHierarchy, i as createLayoutElementGroups, n as clusterDb, o as findNonClusterChild, r as createCommonLayoutRenderer, s as insertMeasuredNode, t as adjustClustersAndEdges } from "./chunk-3FUC2YCW-tr6jmbQf.js";
|
|
14
|
+
|
|
15
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js
|
|
16
|
+
/** Used to match a single whitespace character. */
|
|
17
|
+
var reWhitespace = /\s/;
|
|
18
|
+
/**
|
|
19
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
20
|
+
* character of `string`.
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
* @param {string} string The string to inspect.
|
|
24
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
25
|
+
*/
|
|
26
|
+
function trimmedEndIndex(string) {
|
|
27
|
+
var index = string.length;
|
|
28
|
+
while (index-- && reWhitespace.test(string.charAt(index)));
|
|
29
|
+
return index;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js
|
|
34
|
+
/** Used to match leading whitespace. */
|
|
35
|
+
var reTrimStart = /^\s+/;
|
|
36
|
+
/**
|
|
37
|
+
* The base implementation of `_.trim`.
|
|
38
|
+
*
|
|
39
|
+
* @private
|
|
40
|
+
* @param {string} string The string to trim.
|
|
41
|
+
* @returns {string} Returns the trimmed string.
|
|
42
|
+
*/
|
|
43
|
+
function baseTrim(string) {
|
|
44
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js
|
|
49
|
+
/** Used as references for various `Number` constants. */
|
|
50
|
+
var NAN = NaN;
|
|
51
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
52
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
53
|
+
/** Used to detect binary string values. */
|
|
54
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
55
|
+
/** Used to detect octal string values. */
|
|
56
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
57
|
+
/** Built-in method references without a dependency on `root`. */
|
|
58
|
+
var freeParseInt = parseInt;
|
|
59
|
+
/**
|
|
60
|
+
* Converts `value` to a number.
|
|
61
|
+
*
|
|
62
|
+
* @static
|
|
63
|
+
* @memberOf _
|
|
64
|
+
* @since 4.0.0
|
|
65
|
+
* @category Lang
|
|
66
|
+
* @param {*} value The value to process.
|
|
67
|
+
* @returns {number} Returns the number.
|
|
68
|
+
* @example
|
|
69
|
+
*
|
|
70
|
+
* _.toNumber(3.2);
|
|
71
|
+
* // => 3.2
|
|
72
|
+
*
|
|
73
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
74
|
+
* // => 5e-324
|
|
75
|
+
*
|
|
76
|
+
* _.toNumber(Infinity);
|
|
77
|
+
* // => Infinity
|
|
78
|
+
*
|
|
79
|
+
* _.toNumber('3.2');
|
|
80
|
+
* // => 3.2
|
|
81
|
+
*/
|
|
82
|
+
function toNumber(value) {
|
|
83
|
+
if (typeof value == "number") return value;
|
|
84
|
+
if (isSymbol(value)) return NAN;
|
|
85
|
+
if (isObject(value)) {
|
|
86
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
87
|
+
value = isObject(other) ? other + "" : other;
|
|
88
|
+
}
|
|
89
|
+
if (typeof value != "string") return value === 0 ? value : +value;
|
|
90
|
+
value = baseTrim(value);
|
|
91
|
+
var isBinary = reIsBinary.test(value);
|
|
92
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toFinite.js
|
|
97
|
+
/** Used as references for various `Number` constants. */
|
|
98
|
+
var INFINITY = Infinity;
|
|
99
|
+
var MAX_INTEGER = 17976931348623157e292;
|
|
100
|
+
/**
|
|
101
|
+
* Converts `value` to a finite number.
|
|
102
|
+
*
|
|
103
|
+
* @static
|
|
104
|
+
* @memberOf _
|
|
105
|
+
* @since 4.12.0
|
|
106
|
+
* @category Lang
|
|
107
|
+
* @param {*} value The value to convert.
|
|
108
|
+
* @returns {number} Returns the converted number.
|
|
109
|
+
* @example
|
|
110
|
+
*
|
|
111
|
+
* _.toFinite(3.2);
|
|
112
|
+
* // => 3.2
|
|
113
|
+
*
|
|
114
|
+
* _.toFinite(Number.MIN_VALUE);
|
|
115
|
+
* // => 5e-324
|
|
116
|
+
*
|
|
117
|
+
* _.toFinite(Infinity);
|
|
118
|
+
* // => 1.7976931348623157e+308
|
|
119
|
+
*
|
|
120
|
+
* _.toFinite('3.2');
|
|
121
|
+
* // => 3.2
|
|
122
|
+
*/
|
|
123
|
+
function toFinite(value) {
|
|
124
|
+
if (!value) return value === 0 ? value : 0;
|
|
125
|
+
value = toNumber(value);
|
|
126
|
+
if (value === INFINITY || value === -INFINITY) return (value < 0 ? -1 : 1) * MAX_INTEGER;
|
|
127
|
+
return value === value ? value : 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toInteger.js
|
|
132
|
+
/**
|
|
133
|
+
* Converts `value` to an integer.
|
|
134
|
+
*
|
|
135
|
+
* **Note:** This method is loosely based on
|
|
136
|
+
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
|
137
|
+
*
|
|
138
|
+
* @static
|
|
139
|
+
* @memberOf _
|
|
140
|
+
* @since 4.0.0
|
|
141
|
+
* @category Lang
|
|
142
|
+
* @param {*} value The value to convert.
|
|
143
|
+
* @returns {number} Returns the converted integer.
|
|
144
|
+
* @example
|
|
145
|
+
*
|
|
146
|
+
* _.toInteger(3.2);
|
|
147
|
+
* // => 3
|
|
148
|
+
*
|
|
149
|
+
* _.toInteger(Number.MIN_VALUE);
|
|
150
|
+
* // => 0
|
|
151
|
+
*
|
|
152
|
+
* _.toInteger(Infinity);
|
|
153
|
+
* // => 1.7976931348623157e+308
|
|
154
|
+
*
|
|
155
|
+
* _.toInteger('3.2');
|
|
156
|
+
* // => 3
|
|
157
|
+
*/
|
|
158
|
+
function toInteger(value) {
|
|
159
|
+
var result = toFinite(value), remainder = result % 1;
|
|
160
|
+
return result === result ? remainder ? result - remainder : result : 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js
|
|
165
|
+
/** Built-in value references. */
|
|
166
|
+
var objectCreate = Object.create;
|
|
167
|
+
/**
|
|
168
|
+
* The base implementation of `_.create` without support for assigning
|
|
169
|
+
* properties to the created object.
|
|
170
|
+
*
|
|
171
|
+
* @private
|
|
172
|
+
* @param {Object} proto The object to inherit from.
|
|
173
|
+
* @returns {Object} Returns the new object.
|
|
174
|
+
*/
|
|
175
|
+
var baseCreate = function() {
|
|
176
|
+
function object() {}
|
|
177
|
+
return function(proto) {
|
|
178
|
+
if (!isObject(proto)) return {};
|
|
179
|
+
if (objectCreate) return objectCreate(proto);
|
|
180
|
+
object.prototype = proto;
|
|
181
|
+
var result = new object();
|
|
182
|
+
object.prototype = void 0;
|
|
183
|
+
return result;
|
|
184
|
+
};
|
|
185
|
+
}();
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js
|
|
189
|
+
/**
|
|
190
|
+
* Copies the values of `source` to `array`.
|
|
191
|
+
*
|
|
192
|
+
* @private
|
|
193
|
+
* @param {Array} source The array to copy values from.
|
|
194
|
+
* @param {Array} [array=[]] The array to copy values to.
|
|
195
|
+
* @returns {Array} Returns `array`.
|
|
196
|
+
*/
|
|
197
|
+
function copyArray(source, array) {
|
|
198
|
+
var index = -1, length = source.length;
|
|
199
|
+
array || (array = Array(length));
|
|
200
|
+
while (++index < length) array[index] = source[index];
|
|
201
|
+
return array;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js
|
|
206
|
+
/**
|
|
207
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
208
|
+
* value checks.
|
|
209
|
+
*
|
|
210
|
+
* @private
|
|
211
|
+
* @param {Object} object The object to modify.
|
|
212
|
+
* @param {string} key The key of the property to assign.
|
|
213
|
+
* @param {*} value The value to assign.
|
|
214
|
+
*/
|
|
215
|
+
function baseAssignValue(object, key, value) {
|
|
216
|
+
if (key == "__proto__" && defineProperty) defineProperty(object, key, {
|
|
217
|
+
"configurable": true,
|
|
218
|
+
"enumerable": true,
|
|
219
|
+
"value": value,
|
|
220
|
+
"writable": true
|
|
221
|
+
});
|
|
222
|
+
else object[key] = value;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js
|
|
227
|
+
/** Used to check objects for own properties. */
|
|
228
|
+
var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
|
|
229
|
+
/**
|
|
230
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
231
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
232
|
+
* for equality comparisons.
|
|
233
|
+
*
|
|
234
|
+
* @private
|
|
235
|
+
* @param {Object} object The object to modify.
|
|
236
|
+
* @param {string} key The key of the property to assign.
|
|
237
|
+
* @param {*} value The value to assign.
|
|
238
|
+
*/
|
|
239
|
+
function assignValue(object, key, value) {
|
|
240
|
+
var objValue = object[key];
|
|
241
|
+
if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js
|
|
246
|
+
/**
|
|
247
|
+
* Copies properties of `source` to `object`.
|
|
248
|
+
*
|
|
249
|
+
* @private
|
|
250
|
+
* @param {Object} source The object to copy properties from.
|
|
251
|
+
* @param {Array} props The property identifiers to copy.
|
|
252
|
+
* @param {Object} [object={}] The object to copy properties to.
|
|
253
|
+
* @param {Function} [customizer] The function to customize copied values.
|
|
254
|
+
* @returns {Object} Returns `object`.
|
|
255
|
+
*/
|
|
256
|
+
function copyObject(source, props, object, customizer) {
|
|
257
|
+
var isNew = !object;
|
|
258
|
+
object || (object = {});
|
|
259
|
+
var index = -1, length = props.length;
|
|
260
|
+
while (++index < length) {
|
|
261
|
+
var key = props[index];
|
|
262
|
+
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
|
263
|
+
if (newValue === void 0) newValue = source[key];
|
|
264
|
+
if (isNew) baseAssignValue(object, key, newValue);
|
|
265
|
+
else assignValue(object, key, newValue);
|
|
266
|
+
}
|
|
267
|
+
return object;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js
|
|
272
|
+
/**
|
|
273
|
+
* Checks if the given arguments are from an iteratee call.
|
|
274
|
+
*
|
|
275
|
+
* @private
|
|
276
|
+
* @param {*} value The potential iteratee value argument.
|
|
277
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
278
|
+
* @param {*} object The potential iteratee object argument.
|
|
279
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
280
|
+
* else `false`.
|
|
281
|
+
*/
|
|
282
|
+
function isIterateeCall(value, index, object) {
|
|
283
|
+
if (!isObject(object)) return false;
|
|
284
|
+
var type = typeof index;
|
|
285
|
+
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) return eq(object[index], value);
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createAssigner.js
|
|
291
|
+
/**
|
|
292
|
+
* Creates a function like `_.assign`.
|
|
293
|
+
*
|
|
294
|
+
* @private
|
|
295
|
+
* @param {Function} assigner The function to assign values.
|
|
296
|
+
* @returns {Function} Returns the new assigner function.
|
|
297
|
+
*/
|
|
298
|
+
function createAssigner(assigner) {
|
|
299
|
+
return baseRest(function(object, sources) {
|
|
300
|
+
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
|
|
301
|
+
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
|
|
302
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
303
|
+
customizer = length < 3 ? void 0 : customizer;
|
|
304
|
+
length = 1;
|
|
305
|
+
}
|
|
306
|
+
object = Object(object);
|
|
307
|
+
while (++index < length) {
|
|
308
|
+
var source = sources[index];
|
|
309
|
+
if (source) assigner(object, source, index, customizer);
|
|
310
|
+
}
|
|
311
|
+
return object;
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js
|
|
317
|
+
/**
|
|
318
|
+
* This function is like
|
|
319
|
+
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
320
|
+
* except that it includes inherited enumerable properties.
|
|
321
|
+
*
|
|
322
|
+
* @private
|
|
323
|
+
* @param {Object} object The object to query.
|
|
324
|
+
* @returns {Array} Returns the array of property names.
|
|
325
|
+
*/
|
|
326
|
+
function nativeKeysIn(object) {
|
|
327
|
+
var result = [];
|
|
328
|
+
if (object != null) for (var key in Object(object)) result.push(key);
|
|
329
|
+
return result;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js
|
|
334
|
+
/** Used to check objects for own properties. */
|
|
335
|
+
var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
|
|
336
|
+
/**
|
|
337
|
+
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
338
|
+
*
|
|
339
|
+
* @private
|
|
340
|
+
* @param {Object} object The object to query.
|
|
341
|
+
* @returns {Array} Returns the array of property names.
|
|
342
|
+
*/
|
|
343
|
+
function baseKeysIn(object) {
|
|
344
|
+
if (!isObject(object)) return nativeKeysIn(object);
|
|
345
|
+
var isProto = isPrototype(object), result = [];
|
|
346
|
+
for (var key in object) if (!(key == "constructor" && (isProto || !hasOwnProperty$4.call(object, key)))) result.push(key);
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js
|
|
352
|
+
/**
|
|
353
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
354
|
+
*
|
|
355
|
+
* **Note:** Non-object values are coerced to objects.
|
|
356
|
+
*
|
|
357
|
+
* @static
|
|
358
|
+
* @memberOf _
|
|
359
|
+
* @since 3.0.0
|
|
360
|
+
* @category Object
|
|
361
|
+
* @param {Object} object The object to query.
|
|
362
|
+
* @returns {Array} Returns the array of property names.
|
|
363
|
+
* @example
|
|
364
|
+
*
|
|
365
|
+
* function Foo() {
|
|
366
|
+
* this.a = 1;
|
|
367
|
+
* this.b = 2;
|
|
368
|
+
* }
|
|
369
|
+
*
|
|
370
|
+
* Foo.prototype.c = 3;
|
|
371
|
+
*
|
|
372
|
+
* _.keysIn(new Foo);
|
|
373
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
374
|
+
*/
|
|
375
|
+
function keysIn(object) {
|
|
376
|
+
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/flatten.js
|
|
381
|
+
/**
|
|
382
|
+
* Flattens `array` a single level deep.
|
|
383
|
+
*
|
|
384
|
+
* @static
|
|
385
|
+
* @memberOf _
|
|
386
|
+
* @since 0.1.0
|
|
387
|
+
* @category Array
|
|
388
|
+
* @param {Array} array The array to flatten.
|
|
389
|
+
* @returns {Array} Returns the new flattened array.
|
|
390
|
+
* @example
|
|
391
|
+
*
|
|
392
|
+
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
393
|
+
* // => [1, 2, [3, [4]], 5]
|
|
394
|
+
*/
|
|
395
|
+
function flatten(array) {
|
|
396
|
+
return (array == null ? 0 : array.length) ? baseFlatten(array, 1) : [];
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_flatRest.js
|
|
401
|
+
/**
|
|
402
|
+
* A specialized version of `baseRest` which flattens the rest array.
|
|
403
|
+
*
|
|
404
|
+
* @private
|
|
405
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
406
|
+
* @returns {Function} Returns the new function.
|
|
407
|
+
*/
|
|
408
|
+
function flatRest(func) {
|
|
409
|
+
return setToString(overRest(func, void 0, flatten), func + "");
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js
|
|
414
|
+
/** Built-in value references. */
|
|
415
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
416
|
+
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isPlainObject.js
|
|
419
|
+
/** `Object#toString` result references. */
|
|
420
|
+
var objectTag$1 = "[object Object]";
|
|
421
|
+
/** Used for built-in method references. */
|
|
422
|
+
var funcProto = Function.prototype;
|
|
423
|
+
var objectProto$1 = Object.prototype;
|
|
424
|
+
/** Used to resolve the decompiled source of functions. */
|
|
425
|
+
var funcToString = funcProto.toString;
|
|
426
|
+
/** Used to check objects for own properties. */
|
|
427
|
+
var hasOwnProperty$3 = objectProto$1.hasOwnProperty;
|
|
428
|
+
/** Used to infer the `Object` constructor. */
|
|
429
|
+
var objectCtorString = funcToString.call(Object);
|
|
430
|
+
/**
|
|
431
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
432
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
433
|
+
*
|
|
434
|
+
* @static
|
|
435
|
+
* @memberOf _
|
|
436
|
+
* @since 0.8.0
|
|
437
|
+
* @category Lang
|
|
438
|
+
* @param {*} value The value to check.
|
|
439
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
440
|
+
* @example
|
|
441
|
+
*
|
|
442
|
+
* function Foo() {
|
|
443
|
+
* this.a = 1;
|
|
444
|
+
* }
|
|
445
|
+
*
|
|
446
|
+
* _.isPlainObject(new Foo);
|
|
447
|
+
* // => false
|
|
448
|
+
*
|
|
449
|
+
* _.isPlainObject([1, 2, 3]);
|
|
450
|
+
* // => false
|
|
451
|
+
*
|
|
452
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
453
|
+
* // => true
|
|
454
|
+
*
|
|
455
|
+
* _.isPlainObject(Object.create(null));
|
|
456
|
+
* // => true
|
|
457
|
+
*/
|
|
458
|
+
function isPlainObject(value) {
|
|
459
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag$1) return false;
|
|
460
|
+
var proto = getPrototype(value);
|
|
461
|
+
if (proto === null) return true;
|
|
462
|
+
var Ctor = hasOwnProperty$3.call(proto, "constructor") && proto.constructor;
|
|
463
|
+
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hasUnicode.js
|
|
468
|
+
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
469
|
+
var reHasUnicode = RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");
|
|
470
|
+
/**
|
|
471
|
+
* Checks if `string` contains Unicode symbols.
|
|
472
|
+
*
|
|
473
|
+
* @private
|
|
474
|
+
* @param {string} string The string to inspect.
|
|
475
|
+
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
|
476
|
+
*/
|
|
477
|
+
function hasUnicode(string) {
|
|
478
|
+
return reHasUnicode.test(string);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js
|
|
483
|
+
/**
|
|
484
|
+
* The base implementation of `_.assign` without support for multiple sources
|
|
485
|
+
* or `customizer` functions.
|
|
486
|
+
*
|
|
487
|
+
* @private
|
|
488
|
+
* @param {Object} object The destination object.
|
|
489
|
+
* @param {Object} source The source object.
|
|
490
|
+
* @returns {Object} Returns `object`.
|
|
491
|
+
*/
|
|
492
|
+
function baseAssign(object, source) {
|
|
493
|
+
return object && copyObject(source, keys(source), object);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js
|
|
498
|
+
/**
|
|
499
|
+
* The base implementation of `_.assignIn` without support for multiple sources
|
|
500
|
+
* or `customizer` functions.
|
|
501
|
+
*
|
|
502
|
+
* @private
|
|
503
|
+
* @param {Object} object The destination object.
|
|
504
|
+
* @param {Object} source The source object.
|
|
505
|
+
* @returns {Object} Returns `object`.
|
|
506
|
+
*/
|
|
507
|
+
function baseAssignIn(object, source) {
|
|
508
|
+
return object && copyObject(source, keysIn(source), object);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js
|
|
513
|
+
/** Detect free variable `exports`. */
|
|
514
|
+
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
515
|
+
/** Detect free variable `module`. */
|
|
516
|
+
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
517
|
+
/** Built-in value references. */
|
|
518
|
+
var Buffer = freeModule && freeModule.exports === freeExports ? root.Buffer : void 0;
|
|
519
|
+
var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
|
|
520
|
+
/**
|
|
521
|
+
* Creates a clone of `buffer`.
|
|
522
|
+
*
|
|
523
|
+
* @private
|
|
524
|
+
* @param {Buffer} buffer The buffer to clone.
|
|
525
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
526
|
+
* @returns {Buffer} Returns the cloned buffer.
|
|
527
|
+
*/
|
|
528
|
+
function cloneBuffer(buffer, isDeep) {
|
|
529
|
+
if (isDeep) return buffer.slice();
|
|
530
|
+
var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
531
|
+
buffer.copy(result);
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js
|
|
537
|
+
/**
|
|
538
|
+
* Copies own symbols of `source` to `object`.
|
|
539
|
+
*
|
|
540
|
+
* @private
|
|
541
|
+
* @param {Object} source The object to copy symbols from.
|
|
542
|
+
* @param {Object} [object={}] The object to copy symbols to.
|
|
543
|
+
* @returns {Object} Returns `object`.
|
|
544
|
+
*/
|
|
545
|
+
function copySymbols(source, object) {
|
|
546
|
+
return copyObject(source, getSymbols(source), object);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js
|
|
551
|
+
/**
|
|
552
|
+
* Creates an array of the own and inherited enumerable symbols of `object`.
|
|
553
|
+
*
|
|
554
|
+
* @private
|
|
555
|
+
* @param {Object} object The object to query.
|
|
556
|
+
* @returns {Array} Returns the array of symbols.
|
|
557
|
+
*/
|
|
558
|
+
var getSymbolsIn = !Object.getOwnPropertySymbols ? stubArray : function(object) {
|
|
559
|
+
var result = [];
|
|
560
|
+
while (object) {
|
|
561
|
+
arrayPush(result, getSymbols(object));
|
|
562
|
+
object = getPrototype(object);
|
|
563
|
+
}
|
|
564
|
+
return result;
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js
|
|
569
|
+
/**
|
|
570
|
+
* Copies own and inherited symbols of `source` to `object`.
|
|
571
|
+
*
|
|
572
|
+
* @private
|
|
573
|
+
* @param {Object} source The object to copy symbols from.
|
|
574
|
+
* @param {Object} [object={}] The object to copy symbols to.
|
|
575
|
+
* @returns {Object} Returns `object`.
|
|
576
|
+
*/
|
|
577
|
+
function copySymbolsIn(source, object) {
|
|
578
|
+
return copyObject(source, getSymbolsIn(source), object);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js
|
|
583
|
+
/**
|
|
584
|
+
* Creates an array of own and inherited enumerable property names and
|
|
585
|
+
* symbols of `object`.
|
|
586
|
+
*
|
|
587
|
+
* @private
|
|
588
|
+
* @param {Object} object The object to query.
|
|
589
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
590
|
+
*/
|
|
591
|
+
function getAllKeysIn(object) {
|
|
592
|
+
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js
|
|
597
|
+
/** Used to check objects for own properties. */
|
|
598
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
599
|
+
/**
|
|
600
|
+
* Initializes an array clone.
|
|
601
|
+
*
|
|
602
|
+
* @private
|
|
603
|
+
* @param {Array} array The array to clone.
|
|
604
|
+
* @returns {Array} Returns the initialized clone.
|
|
605
|
+
*/
|
|
606
|
+
function initCloneArray(array) {
|
|
607
|
+
var length = array.length, result = new array.constructor(length);
|
|
608
|
+
if (length && typeof array[0] == "string" && hasOwnProperty$2.call(array, "index")) {
|
|
609
|
+
result.index = array.index;
|
|
610
|
+
result.input = array.input;
|
|
611
|
+
}
|
|
612
|
+
return result;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
//#endregion
|
|
616
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js
|
|
617
|
+
/**
|
|
618
|
+
* Creates a clone of `arrayBuffer`.
|
|
619
|
+
*
|
|
620
|
+
* @private
|
|
621
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
622
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
623
|
+
*/
|
|
624
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
625
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
626
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
627
|
+
return result;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js
|
|
632
|
+
/**
|
|
633
|
+
* Creates a clone of `dataView`.
|
|
634
|
+
*
|
|
635
|
+
* @private
|
|
636
|
+
* @param {Object} dataView The data view to clone.
|
|
637
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
638
|
+
* @returns {Object} Returns the cloned data view.
|
|
639
|
+
*/
|
|
640
|
+
function cloneDataView(dataView, isDeep) {
|
|
641
|
+
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
642
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js
|
|
647
|
+
/** Used to match `RegExp` flags from their coerced string values. */
|
|
648
|
+
var reFlags = /\w*$/;
|
|
649
|
+
/**
|
|
650
|
+
* Creates a clone of `regexp`.
|
|
651
|
+
*
|
|
652
|
+
* @private
|
|
653
|
+
* @param {Object} regexp The regexp to clone.
|
|
654
|
+
* @returns {Object} Returns the cloned regexp.
|
|
655
|
+
*/
|
|
656
|
+
function cloneRegExp(regexp) {
|
|
657
|
+
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
658
|
+
result.lastIndex = regexp.lastIndex;
|
|
659
|
+
return result;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js
|
|
664
|
+
/** Used to convert symbols to primitives and strings. */
|
|
665
|
+
var symbolProto = Symbol ? Symbol.prototype : void 0;
|
|
666
|
+
var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
667
|
+
/**
|
|
668
|
+
* Creates a clone of the `symbol` object.
|
|
669
|
+
*
|
|
670
|
+
* @private
|
|
671
|
+
* @param {Object} symbol The symbol object to clone.
|
|
672
|
+
* @returns {Object} Returns the cloned symbol object.
|
|
673
|
+
*/
|
|
674
|
+
function cloneSymbol(symbol) {
|
|
675
|
+
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js
|
|
680
|
+
/**
|
|
681
|
+
* Creates a clone of `typedArray`.
|
|
682
|
+
*
|
|
683
|
+
* @private
|
|
684
|
+
* @param {Object} typedArray The typed array to clone.
|
|
685
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
686
|
+
* @returns {Object} Returns the cloned typed array.
|
|
687
|
+
*/
|
|
688
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
689
|
+
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
690
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js
|
|
695
|
+
/** `Object#toString` result references. */
|
|
696
|
+
var boolTag$1 = "[object Boolean]";
|
|
697
|
+
var dateTag$1 = "[object Date]";
|
|
698
|
+
var mapTag$3 = "[object Map]";
|
|
699
|
+
var numberTag$1 = "[object Number]";
|
|
700
|
+
var regexpTag$1 = "[object RegExp]";
|
|
701
|
+
var setTag$3 = "[object Set]";
|
|
702
|
+
var stringTag$2 = "[object String]";
|
|
703
|
+
var symbolTag$1 = "[object Symbol]";
|
|
704
|
+
var arrayBufferTag$1 = "[object ArrayBuffer]";
|
|
705
|
+
var dataViewTag$1 = "[object DataView]";
|
|
706
|
+
var float32Tag$1 = "[object Float32Array]";
|
|
707
|
+
var float64Tag$1 = "[object Float64Array]";
|
|
708
|
+
var int8Tag$1 = "[object Int8Array]";
|
|
709
|
+
var int16Tag$1 = "[object Int16Array]";
|
|
710
|
+
var int32Tag$1 = "[object Int32Array]";
|
|
711
|
+
var uint8Tag$1 = "[object Uint8Array]";
|
|
712
|
+
var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
|
|
713
|
+
var uint16Tag$1 = "[object Uint16Array]";
|
|
714
|
+
var uint32Tag$1 = "[object Uint32Array]";
|
|
715
|
+
/**
|
|
716
|
+
* Initializes an object clone based on its `toStringTag`.
|
|
717
|
+
*
|
|
718
|
+
* **Note:** This function only supports cloning values with tags of
|
|
719
|
+
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
720
|
+
*
|
|
721
|
+
* @private
|
|
722
|
+
* @param {Object} object The object to clone.
|
|
723
|
+
* @param {string} tag The `toStringTag` of the object to clone.
|
|
724
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
725
|
+
* @returns {Object} Returns the initialized clone.
|
|
726
|
+
*/
|
|
727
|
+
function initCloneByTag(object, tag, isDeep) {
|
|
728
|
+
var Ctor = object.constructor;
|
|
729
|
+
switch (tag) {
|
|
730
|
+
case arrayBufferTag$1: return cloneArrayBuffer(object);
|
|
731
|
+
case boolTag$1:
|
|
732
|
+
case dateTag$1: return new Ctor(+object);
|
|
733
|
+
case dataViewTag$1: return cloneDataView(object, isDeep);
|
|
734
|
+
case float32Tag$1:
|
|
735
|
+
case float64Tag$1:
|
|
736
|
+
case int8Tag$1:
|
|
737
|
+
case int16Tag$1:
|
|
738
|
+
case int32Tag$1:
|
|
739
|
+
case uint8Tag$1:
|
|
740
|
+
case uint8ClampedTag$1:
|
|
741
|
+
case uint16Tag$1:
|
|
742
|
+
case uint32Tag$1: return cloneTypedArray(object, isDeep);
|
|
743
|
+
case mapTag$3: return new Ctor();
|
|
744
|
+
case numberTag$1:
|
|
745
|
+
case stringTag$2: return new Ctor(object);
|
|
746
|
+
case regexpTag$1: return cloneRegExp(object);
|
|
747
|
+
case setTag$3: return new Ctor();
|
|
748
|
+
case symbolTag$1: return cloneSymbol(object);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
//#endregion
|
|
753
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js
|
|
754
|
+
/**
|
|
755
|
+
* Initializes an object clone.
|
|
756
|
+
*
|
|
757
|
+
* @private
|
|
758
|
+
* @param {Object} object The object to clone.
|
|
759
|
+
* @returns {Object} Returns the initialized clone.
|
|
760
|
+
*/
|
|
761
|
+
function initCloneObject(object) {
|
|
762
|
+
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
//#endregion
|
|
766
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js
|
|
767
|
+
/** `Object#toString` result references. */
|
|
768
|
+
var mapTag$2 = "[object Map]";
|
|
769
|
+
/**
|
|
770
|
+
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
771
|
+
*
|
|
772
|
+
* @private
|
|
773
|
+
* @param {*} value The value to check.
|
|
774
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
775
|
+
*/
|
|
776
|
+
function baseIsMap(value) {
|
|
777
|
+
return isObjectLike(value) && _getTag_default(value) == mapTag$2;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
//#endregion
|
|
781
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isMap.js
|
|
782
|
+
var nodeIsMap = nodeUtil && nodeUtil.isMap;
|
|
783
|
+
/**
|
|
784
|
+
* Checks if `value` is classified as a `Map` object.
|
|
785
|
+
*
|
|
786
|
+
* @static
|
|
787
|
+
* @memberOf _
|
|
788
|
+
* @since 4.3.0
|
|
789
|
+
* @category Lang
|
|
790
|
+
* @param {*} value The value to check.
|
|
791
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
792
|
+
* @example
|
|
793
|
+
*
|
|
794
|
+
* _.isMap(new Map);
|
|
795
|
+
* // => true
|
|
796
|
+
*
|
|
797
|
+
* _.isMap(new WeakMap);
|
|
798
|
+
* // => false
|
|
799
|
+
*/
|
|
800
|
+
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
|
|
801
|
+
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js
|
|
804
|
+
/** `Object#toString` result references. */
|
|
805
|
+
var setTag$2 = "[object Set]";
|
|
806
|
+
/**
|
|
807
|
+
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
808
|
+
*
|
|
809
|
+
* @private
|
|
810
|
+
* @param {*} value The value to check.
|
|
811
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
812
|
+
*/
|
|
813
|
+
function baseIsSet(value) {
|
|
814
|
+
return isObjectLike(value) && _getTag_default(value) == setTag$2;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSet.js
|
|
819
|
+
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
820
|
+
/**
|
|
821
|
+
* Checks if `value` is classified as a `Set` object.
|
|
822
|
+
*
|
|
823
|
+
* @static
|
|
824
|
+
* @memberOf _
|
|
825
|
+
* @since 4.3.0
|
|
826
|
+
* @category Lang
|
|
827
|
+
* @param {*} value The value to check.
|
|
828
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
829
|
+
* @example
|
|
830
|
+
*
|
|
831
|
+
* _.isSet(new Set);
|
|
832
|
+
* // => true
|
|
833
|
+
*
|
|
834
|
+
* _.isSet(new WeakSet);
|
|
835
|
+
* // => false
|
|
836
|
+
*/
|
|
837
|
+
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
838
|
+
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js
|
|
841
|
+
/** Used to compose bitmasks for cloning. */
|
|
842
|
+
var CLONE_DEEP_FLAG$1 = 1;
|
|
843
|
+
var CLONE_FLAT_FLAG = 2;
|
|
844
|
+
var CLONE_SYMBOLS_FLAG$1 = 4;
|
|
845
|
+
/** `Object#toString` result references. */
|
|
846
|
+
var argsTag = "[object Arguments]";
|
|
847
|
+
var arrayTag = "[object Array]";
|
|
848
|
+
var boolTag = "[object Boolean]";
|
|
849
|
+
var dateTag = "[object Date]";
|
|
850
|
+
var errorTag = "[object Error]";
|
|
851
|
+
var funcTag = "[object Function]";
|
|
852
|
+
var genTag = "[object GeneratorFunction]";
|
|
853
|
+
var mapTag$1 = "[object Map]";
|
|
854
|
+
var numberTag = "[object Number]";
|
|
855
|
+
var objectTag = "[object Object]";
|
|
856
|
+
var regexpTag = "[object RegExp]";
|
|
857
|
+
var setTag$1 = "[object Set]";
|
|
858
|
+
var stringTag$1 = "[object String]";
|
|
859
|
+
var symbolTag = "[object Symbol]";
|
|
860
|
+
var weakMapTag = "[object WeakMap]";
|
|
861
|
+
var arrayBufferTag = "[object ArrayBuffer]";
|
|
862
|
+
var dataViewTag = "[object DataView]";
|
|
863
|
+
var float32Tag = "[object Float32Array]";
|
|
864
|
+
var float64Tag = "[object Float64Array]";
|
|
865
|
+
var int8Tag = "[object Int8Array]";
|
|
866
|
+
var int16Tag = "[object Int16Array]";
|
|
867
|
+
var int32Tag = "[object Int32Array]";
|
|
868
|
+
var uint8Tag = "[object Uint8Array]";
|
|
869
|
+
var uint8ClampedTag = "[object Uint8ClampedArray]";
|
|
870
|
+
var uint16Tag = "[object Uint16Array]";
|
|
871
|
+
var uint32Tag = "[object Uint32Array]";
|
|
872
|
+
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
873
|
+
var cloneableTags = {};
|
|
874
|
+
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
875
|
+
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
|
876
|
+
/**
|
|
877
|
+
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
878
|
+
* traversed objects.
|
|
879
|
+
*
|
|
880
|
+
* @private
|
|
881
|
+
* @param {*} value The value to clone.
|
|
882
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
883
|
+
* 1 - Deep clone
|
|
884
|
+
* 2 - Flatten inherited properties
|
|
885
|
+
* 4 - Clone symbols
|
|
886
|
+
* @param {Function} [customizer] The function to customize cloning.
|
|
887
|
+
* @param {string} [key] The key of `value`.
|
|
888
|
+
* @param {Object} [object] The parent object of `value`.
|
|
889
|
+
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
890
|
+
* @returns {*} Returns the cloned value.
|
|
891
|
+
*/
|
|
892
|
+
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
893
|
+
var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
|
|
894
|
+
if (customizer) result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
895
|
+
if (result !== void 0) return result;
|
|
896
|
+
if (!isObject(value)) return value;
|
|
897
|
+
var isArr = isArray(value);
|
|
898
|
+
if (isArr) {
|
|
899
|
+
result = initCloneArray(value);
|
|
900
|
+
if (!isDeep) return copyArray(value, result);
|
|
901
|
+
} else {
|
|
902
|
+
var tag = _getTag_default(value), isFunc = tag == funcTag || tag == genTag;
|
|
903
|
+
if (isBuffer(value)) return cloneBuffer(value, isDeep);
|
|
904
|
+
if (tag == objectTag || tag == argsTag || isFunc && !object) {
|
|
905
|
+
result = isFlat || isFunc ? {} : initCloneObject(value);
|
|
906
|
+
if (!isDeep) return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
|
|
907
|
+
} else {
|
|
908
|
+
if (!cloneableTags[tag]) return object ? value : {};
|
|
909
|
+
result = initCloneByTag(value, tag, isDeep);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
stack || (stack = new Stack());
|
|
913
|
+
var stacked = stack.get(value);
|
|
914
|
+
if (stacked) return stacked;
|
|
915
|
+
stack.set(value, result);
|
|
916
|
+
if (isSet(value)) value.forEach(function(subValue) {
|
|
917
|
+
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
918
|
+
});
|
|
919
|
+
else if (isMap(value)) value.forEach(function(subValue, key) {
|
|
920
|
+
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
921
|
+
});
|
|
922
|
+
var props = isArr ? void 0 : (isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys)(value);
|
|
923
|
+
arrayEach(props || value, function(subValue, key) {
|
|
924
|
+
if (props) {
|
|
925
|
+
key = subValue;
|
|
926
|
+
subValue = value[key];
|
|
927
|
+
}
|
|
928
|
+
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
929
|
+
});
|
|
930
|
+
return result;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js
|
|
935
|
+
/** Used to compose bitmasks for cloning. */
|
|
936
|
+
var CLONE_DEEP_FLAG = 1;
|
|
937
|
+
var CLONE_SYMBOLS_FLAG = 4;
|
|
938
|
+
/**
|
|
939
|
+
* This method is like `_.clone` except that it recursively clones `value`.
|
|
940
|
+
*
|
|
941
|
+
* @static
|
|
942
|
+
* @memberOf _
|
|
943
|
+
* @since 1.0.0
|
|
944
|
+
* @category Lang
|
|
945
|
+
* @param {*} value The value to recursively clone.
|
|
946
|
+
* @returns {*} Returns the deep cloned value.
|
|
947
|
+
* @see _.clone
|
|
948
|
+
* @example
|
|
949
|
+
*
|
|
950
|
+
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
|
951
|
+
*
|
|
952
|
+
* var deep = _.cloneDeep(objects);
|
|
953
|
+
* console.log(deep[0] === objects[0]);
|
|
954
|
+
* // => false
|
|
955
|
+
*/
|
|
956
|
+
function cloneDeep(value) {
|
|
957
|
+
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
//#endregion
|
|
961
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/now.js
|
|
962
|
+
/**
|
|
963
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
964
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
965
|
+
*
|
|
966
|
+
* @static
|
|
967
|
+
* @memberOf _
|
|
968
|
+
* @since 2.4.0
|
|
969
|
+
* @category Date
|
|
970
|
+
* @returns {number} Returns the timestamp.
|
|
971
|
+
* @example
|
|
972
|
+
*
|
|
973
|
+
* _.defer(function(stamp) {
|
|
974
|
+
* console.log(_.now() - stamp);
|
|
975
|
+
* }, _.now());
|
|
976
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
977
|
+
*/
|
|
978
|
+
var now = function() {
|
|
979
|
+
return root.Date.now();
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
//#endregion
|
|
983
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/defaults.js
|
|
984
|
+
/** Used for built-in method references. */
|
|
985
|
+
var objectProto = Object.prototype;
|
|
986
|
+
/** Used to check objects for own properties. */
|
|
987
|
+
var hasOwnProperty$1 = objectProto.hasOwnProperty;
|
|
988
|
+
/**
|
|
989
|
+
* Assigns own and inherited enumerable string keyed properties of source
|
|
990
|
+
* objects to the destination object for all destination properties that
|
|
991
|
+
* resolve to `undefined`. Source objects are applied from left to right.
|
|
992
|
+
* Once a property is set, additional values of the same property are ignored.
|
|
993
|
+
*
|
|
994
|
+
* **Note:** This method mutates `object`.
|
|
995
|
+
*
|
|
996
|
+
* @static
|
|
997
|
+
* @since 0.1.0
|
|
998
|
+
* @memberOf _
|
|
999
|
+
* @category Object
|
|
1000
|
+
* @param {Object} object The destination object.
|
|
1001
|
+
* @param {...Object} [sources] The source objects.
|
|
1002
|
+
* @returns {Object} Returns `object`.
|
|
1003
|
+
* @see _.defaultsDeep
|
|
1004
|
+
* @example
|
|
1005
|
+
*
|
|
1006
|
+
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
1007
|
+
* // => { 'a': 1, 'b': 2 }
|
|
1008
|
+
*/
|
|
1009
|
+
var defaults = baseRest(function(object, sources) {
|
|
1010
|
+
object = Object(object);
|
|
1011
|
+
var index = -1;
|
|
1012
|
+
var length = sources.length;
|
|
1013
|
+
var guard = length > 2 ? sources[2] : void 0;
|
|
1014
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) length = 1;
|
|
1015
|
+
while (++index < length) {
|
|
1016
|
+
var source = sources[index];
|
|
1017
|
+
var props = keysIn(source);
|
|
1018
|
+
var propsIndex = -1;
|
|
1019
|
+
var propsLength = props.length;
|
|
1020
|
+
while (++propsIndex < propsLength) {
|
|
1021
|
+
var key = props[propsIndex];
|
|
1022
|
+
var value = object[key];
|
|
1023
|
+
if (value === void 0 || eq(value, objectProto[key]) && !hasOwnProperty$1.call(object, key)) object[key] = source[key];
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
return object;
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
//#endregion
|
|
1030
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignMergeValue.js
|
|
1031
|
+
/**
|
|
1032
|
+
* This function is like `assignValue` except that it doesn't assign
|
|
1033
|
+
* `undefined` values.
|
|
1034
|
+
*
|
|
1035
|
+
* @private
|
|
1036
|
+
* @param {Object} object The object to modify.
|
|
1037
|
+
* @param {string} key The key of the property to assign.
|
|
1038
|
+
* @param {*} value The value to assign.
|
|
1039
|
+
*/
|
|
1040
|
+
function assignMergeValue(object, key, value) {
|
|
1041
|
+
if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
//#endregion
|
|
1045
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_safeGet.js
|
|
1046
|
+
/**
|
|
1047
|
+
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
|
|
1048
|
+
*
|
|
1049
|
+
* @private
|
|
1050
|
+
* @param {Object} object The object to query.
|
|
1051
|
+
* @param {string} key The key of the property to get.
|
|
1052
|
+
* @returns {*} Returns the property value.
|
|
1053
|
+
*/
|
|
1054
|
+
function safeGet(object, key) {
|
|
1055
|
+
if (key === "constructor" && typeof object[key] === "function") return;
|
|
1056
|
+
if (key == "__proto__") return;
|
|
1057
|
+
return object[key];
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
//#endregion
|
|
1061
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toPlainObject.js
|
|
1062
|
+
/**
|
|
1063
|
+
* Converts `value` to a plain object flattening inherited enumerable string
|
|
1064
|
+
* keyed properties of `value` to own properties of the plain object.
|
|
1065
|
+
*
|
|
1066
|
+
* @static
|
|
1067
|
+
* @memberOf _
|
|
1068
|
+
* @since 3.0.0
|
|
1069
|
+
* @category Lang
|
|
1070
|
+
* @param {*} value The value to convert.
|
|
1071
|
+
* @returns {Object} Returns the converted plain object.
|
|
1072
|
+
* @example
|
|
1073
|
+
*
|
|
1074
|
+
* function Foo() {
|
|
1075
|
+
* this.b = 2;
|
|
1076
|
+
* }
|
|
1077
|
+
*
|
|
1078
|
+
* Foo.prototype.c = 3;
|
|
1079
|
+
*
|
|
1080
|
+
* _.assign({ 'a': 1 }, new Foo);
|
|
1081
|
+
* // => { 'a': 1, 'b': 2 }
|
|
1082
|
+
*
|
|
1083
|
+
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
|
|
1084
|
+
* // => { 'a': 1, 'b': 2, 'c': 3 }
|
|
1085
|
+
*/
|
|
1086
|
+
function toPlainObject(value) {
|
|
1087
|
+
return copyObject(value, keysIn(value));
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
//#endregion
|
|
1091
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMergeDeep.js
|
|
1092
|
+
/**
|
|
1093
|
+
* A specialized version of `baseMerge` for arrays and objects which performs
|
|
1094
|
+
* deep merges and tracks traversed objects enabling objects with circular
|
|
1095
|
+
* references to be merged.
|
|
1096
|
+
*
|
|
1097
|
+
* @private
|
|
1098
|
+
* @param {Object} object The destination object.
|
|
1099
|
+
* @param {Object} source The source object.
|
|
1100
|
+
* @param {string} key The key of the value to merge.
|
|
1101
|
+
* @param {number} srcIndex The index of `source`.
|
|
1102
|
+
* @param {Function} mergeFunc The function to merge values.
|
|
1103
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
|
1104
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
1105
|
+
* counterparts.
|
|
1106
|
+
*/
|
|
1107
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
1108
|
+
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
|
|
1109
|
+
if (stacked) {
|
|
1110
|
+
assignMergeValue(object, key, stacked);
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
|
|
1114
|
+
var isCommon = newValue === void 0;
|
|
1115
|
+
if (isCommon) {
|
|
1116
|
+
var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
|
1117
|
+
newValue = srcValue;
|
|
1118
|
+
if (isArr || isBuff || isTyped) if (isArray(objValue)) newValue = objValue;
|
|
1119
|
+
else if (isArrayLikeObject(objValue)) newValue = copyArray(objValue);
|
|
1120
|
+
else if (isBuff) {
|
|
1121
|
+
isCommon = false;
|
|
1122
|
+
newValue = cloneBuffer(srcValue, true);
|
|
1123
|
+
} else if (isTyped) {
|
|
1124
|
+
isCommon = false;
|
|
1125
|
+
newValue = cloneTypedArray(srcValue, true);
|
|
1126
|
+
} else newValue = [];
|
|
1127
|
+
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
|
1128
|
+
newValue = objValue;
|
|
1129
|
+
if (isArguments(objValue)) newValue = toPlainObject(objValue);
|
|
1130
|
+
else if (!isObject(objValue) || isFunction(objValue)) newValue = initCloneObject(srcValue);
|
|
1131
|
+
} else isCommon = false;
|
|
1132
|
+
}
|
|
1133
|
+
if (isCommon) {
|
|
1134
|
+
stack.set(srcValue, newValue);
|
|
1135
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
1136
|
+
stack["delete"](srcValue);
|
|
1137
|
+
}
|
|
1138
|
+
assignMergeValue(object, key, newValue);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
//#endregion
|
|
1142
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMerge.js
|
|
1143
|
+
/**
|
|
1144
|
+
* The base implementation of `_.merge` without support for multiple sources.
|
|
1145
|
+
*
|
|
1146
|
+
* @private
|
|
1147
|
+
* @param {Object} object The destination object.
|
|
1148
|
+
* @param {Object} source The source object.
|
|
1149
|
+
* @param {number} srcIndex The index of `source`.
|
|
1150
|
+
* @param {Function} [customizer] The function to customize merged values.
|
|
1151
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
1152
|
+
* counterparts.
|
|
1153
|
+
*/
|
|
1154
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
1155
|
+
if (object === source) return;
|
|
1156
|
+
baseFor(source, function(srcValue, key) {
|
|
1157
|
+
stack || (stack = new Stack());
|
|
1158
|
+
if (isObject(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
1159
|
+
else {
|
|
1160
|
+
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
|
1161
|
+
if (newValue === void 0) newValue = srcValue;
|
|
1162
|
+
assignMergeValue(object, key, newValue);
|
|
1163
|
+
}
|
|
1164
|
+
}, keysIn);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
//#endregion
|
|
1168
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/last.js
|
|
1169
|
+
/**
|
|
1170
|
+
* Gets the last element of `array`.
|
|
1171
|
+
*
|
|
1172
|
+
* @static
|
|
1173
|
+
* @memberOf _
|
|
1174
|
+
* @since 0.1.0
|
|
1175
|
+
* @category Array
|
|
1176
|
+
* @param {Array} array The array to query.
|
|
1177
|
+
* @returns {*} Returns the last element of `array`.
|
|
1178
|
+
* @example
|
|
1179
|
+
*
|
|
1180
|
+
* _.last([1, 2, 3]);
|
|
1181
|
+
* // => 3
|
|
1182
|
+
*/
|
|
1183
|
+
function last(array) {
|
|
1184
|
+
var length = array == null ? 0 : array.length;
|
|
1185
|
+
return length ? array[length - 1] : void 0;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
//#endregion
|
|
1189
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createFind.js
|
|
1190
|
+
/**
|
|
1191
|
+
* Creates a `_.find` or `_.findLast` function.
|
|
1192
|
+
*
|
|
1193
|
+
* @private
|
|
1194
|
+
* @param {Function} findIndexFunc The function to find the collection index.
|
|
1195
|
+
* @returns {Function} Returns the new find function.
|
|
1196
|
+
*/
|
|
1197
|
+
function createFind(findIndexFunc) {
|
|
1198
|
+
return function(collection, predicate, fromIndex) {
|
|
1199
|
+
var iterable = Object(collection);
|
|
1200
|
+
if (!isArrayLike(collection)) {
|
|
1201
|
+
var iteratee = baseIteratee(predicate, 3);
|
|
1202
|
+
collection = keys(collection);
|
|
1203
|
+
predicate = function(key) {
|
|
1204
|
+
return iteratee(iterable[key], key, iterable);
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
var index = findIndexFunc(collection, predicate, fromIndex);
|
|
1208
|
+
return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
//#endregion
|
|
1213
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/findIndex.js
|
|
1214
|
+
var nativeMax$1 = Math.max;
|
|
1215
|
+
/**
|
|
1216
|
+
* This method is like `_.find` except that it returns the index of the first
|
|
1217
|
+
* element `predicate` returns truthy for instead of the element itself.
|
|
1218
|
+
*
|
|
1219
|
+
* @static
|
|
1220
|
+
* @memberOf _
|
|
1221
|
+
* @since 1.1.0
|
|
1222
|
+
* @category Array
|
|
1223
|
+
* @param {Array} array The array to inspect.
|
|
1224
|
+
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
1225
|
+
* @param {number} [fromIndex=0] The index to search from.
|
|
1226
|
+
* @returns {number} Returns the index of the found element, else `-1`.
|
|
1227
|
+
* @example
|
|
1228
|
+
*
|
|
1229
|
+
* var users = [
|
|
1230
|
+
* { 'user': 'barney', 'active': false },
|
|
1231
|
+
* { 'user': 'fred', 'active': false },
|
|
1232
|
+
* { 'user': 'pebbles', 'active': true }
|
|
1233
|
+
* ];
|
|
1234
|
+
*
|
|
1235
|
+
* _.findIndex(users, function(o) { return o.user == 'barney'; });
|
|
1236
|
+
* // => 0
|
|
1237
|
+
*
|
|
1238
|
+
* // The `_.matches` iteratee shorthand.
|
|
1239
|
+
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
|
1240
|
+
* // => 1
|
|
1241
|
+
*
|
|
1242
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
|
1243
|
+
* _.findIndex(users, ['active', false]);
|
|
1244
|
+
* // => 0
|
|
1245
|
+
*
|
|
1246
|
+
* // The `_.property` iteratee shorthand.
|
|
1247
|
+
* _.findIndex(users, 'active');
|
|
1248
|
+
* // => 2
|
|
1249
|
+
*/
|
|
1250
|
+
function findIndex(array, predicate, fromIndex) {
|
|
1251
|
+
var length = array == null ? 0 : array.length;
|
|
1252
|
+
if (!length) return -1;
|
|
1253
|
+
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
|
1254
|
+
if (index < 0) index = nativeMax$1(length + index, 0);
|
|
1255
|
+
return baseFindIndex(array, baseIteratee(predicate, 3), index);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
//#endregion
|
|
1259
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/find.js
|
|
1260
|
+
/**
|
|
1261
|
+
* Iterates over elements of `collection`, returning the first element
|
|
1262
|
+
* `predicate` returns truthy for. The predicate is invoked with three
|
|
1263
|
+
* arguments: (value, index|key, collection).
|
|
1264
|
+
*
|
|
1265
|
+
* @static
|
|
1266
|
+
* @memberOf _
|
|
1267
|
+
* @since 0.1.0
|
|
1268
|
+
* @category Collection
|
|
1269
|
+
* @param {Array|Object} collection The collection to inspect.
|
|
1270
|
+
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
1271
|
+
* @param {number} [fromIndex=0] The index to search from.
|
|
1272
|
+
* @returns {*} Returns the matched element, else `undefined`.
|
|
1273
|
+
* @example
|
|
1274
|
+
*
|
|
1275
|
+
* var users = [
|
|
1276
|
+
* { 'user': 'barney', 'age': 36, 'active': true },
|
|
1277
|
+
* { 'user': 'fred', 'age': 40, 'active': false },
|
|
1278
|
+
* { 'user': 'pebbles', 'age': 1, 'active': true }
|
|
1279
|
+
* ];
|
|
1280
|
+
*
|
|
1281
|
+
* _.find(users, function(o) { return o.age < 40; });
|
|
1282
|
+
* // => object for 'barney'
|
|
1283
|
+
*
|
|
1284
|
+
* // The `_.matches` iteratee shorthand.
|
|
1285
|
+
* _.find(users, { 'age': 1, 'active': true });
|
|
1286
|
+
* // => object for 'pebbles'
|
|
1287
|
+
*
|
|
1288
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
|
1289
|
+
* _.find(users, ['active', false]);
|
|
1290
|
+
* // => object for 'fred'
|
|
1291
|
+
*
|
|
1292
|
+
* // The `_.property` iteratee shorthand.
|
|
1293
|
+
* _.find(users, 'active');
|
|
1294
|
+
* // => object for 'barney'
|
|
1295
|
+
*/
|
|
1296
|
+
var find = createFind(findIndex);
|
|
1297
|
+
|
|
1298
|
+
//#endregion
|
|
1299
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMap.js
|
|
1300
|
+
/**
|
|
1301
|
+
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
1302
|
+
*
|
|
1303
|
+
* @private
|
|
1304
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
1305
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1306
|
+
* @returns {Array} Returns the new mapped array.
|
|
1307
|
+
*/
|
|
1308
|
+
function baseMap(collection, iteratee) {
|
|
1309
|
+
var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
1310
|
+
baseEach(collection, function(value, key, collection) {
|
|
1311
|
+
result[++index] = iteratee(value, key, collection);
|
|
1312
|
+
});
|
|
1313
|
+
return result;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
//#endregion
|
|
1317
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/map.js
|
|
1318
|
+
/**
|
|
1319
|
+
* Creates an array of values by running each element in `collection` thru
|
|
1320
|
+
* `iteratee`. The iteratee is invoked with three arguments:
|
|
1321
|
+
* (value, index|key, collection).
|
|
1322
|
+
*
|
|
1323
|
+
* Many lodash methods are guarded to work as iteratees for methods like
|
|
1324
|
+
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
|
1325
|
+
*
|
|
1326
|
+
* The guarded methods are:
|
|
1327
|
+
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
|
1328
|
+
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
|
|
1329
|
+
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
|
|
1330
|
+
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
|
|
1331
|
+
*
|
|
1332
|
+
* @static
|
|
1333
|
+
* @memberOf _
|
|
1334
|
+
* @since 0.1.0
|
|
1335
|
+
* @category Collection
|
|
1336
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
1337
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
1338
|
+
* @returns {Array} Returns the new mapped array.
|
|
1339
|
+
* @example
|
|
1340
|
+
*
|
|
1341
|
+
* function square(n) {
|
|
1342
|
+
* return n * n;
|
|
1343
|
+
* }
|
|
1344
|
+
*
|
|
1345
|
+
* _.map([4, 8], square);
|
|
1346
|
+
* // => [16, 64]
|
|
1347
|
+
*
|
|
1348
|
+
* _.map({ 'a': 4, 'b': 8 }, square);
|
|
1349
|
+
* // => [16, 64] (iteration order is not guaranteed)
|
|
1350
|
+
*
|
|
1351
|
+
* var users = [
|
|
1352
|
+
* { 'user': 'barney' },
|
|
1353
|
+
* { 'user': 'fred' }
|
|
1354
|
+
* ];
|
|
1355
|
+
*
|
|
1356
|
+
* // The `_.property` iteratee shorthand.
|
|
1357
|
+
* _.map(users, 'user');
|
|
1358
|
+
* // => ['barney', 'fred']
|
|
1359
|
+
*/
|
|
1360
|
+
function map(collection, iteratee) {
|
|
1361
|
+
return (isArray(collection) ? arrayMap : baseMap)(collection, baseIteratee(iteratee, 3));
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
//#endregion
|
|
1365
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/forIn.js
|
|
1366
|
+
/**
|
|
1367
|
+
* Iterates over own and inherited enumerable string keyed properties of an
|
|
1368
|
+
* object and invokes `iteratee` for each property. The iteratee is invoked
|
|
1369
|
+
* with three arguments: (value, key, object). Iteratee functions may exit
|
|
1370
|
+
* iteration early by explicitly returning `false`.
|
|
1371
|
+
*
|
|
1372
|
+
* @static
|
|
1373
|
+
* @memberOf _
|
|
1374
|
+
* @since 0.3.0
|
|
1375
|
+
* @category Object
|
|
1376
|
+
* @param {Object} object The object to iterate over.
|
|
1377
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
1378
|
+
* @returns {Object} Returns `object`.
|
|
1379
|
+
* @see _.forInRight
|
|
1380
|
+
* @example
|
|
1381
|
+
*
|
|
1382
|
+
* function Foo() {
|
|
1383
|
+
* this.a = 1;
|
|
1384
|
+
* this.b = 2;
|
|
1385
|
+
* }
|
|
1386
|
+
*
|
|
1387
|
+
* Foo.prototype.c = 3;
|
|
1388
|
+
*
|
|
1389
|
+
* _.forIn(new Foo, function(value, key) {
|
|
1390
|
+
* console.log(key);
|
|
1391
|
+
* });
|
|
1392
|
+
* // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
|
|
1393
|
+
*/
|
|
1394
|
+
function forIn(object, iteratee) {
|
|
1395
|
+
return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
//#endregion
|
|
1399
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/forOwn.js
|
|
1400
|
+
/**
|
|
1401
|
+
* Iterates over own enumerable string keyed properties of an object and
|
|
1402
|
+
* invokes `iteratee` for each property. The iteratee is invoked with three
|
|
1403
|
+
* arguments: (value, key, object). Iteratee functions may exit iteration
|
|
1404
|
+
* early by explicitly returning `false`.
|
|
1405
|
+
*
|
|
1406
|
+
* @static
|
|
1407
|
+
* @memberOf _
|
|
1408
|
+
* @since 0.3.0
|
|
1409
|
+
* @category Object
|
|
1410
|
+
* @param {Object} object The object to iterate over.
|
|
1411
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
1412
|
+
* @returns {Object} Returns `object`.
|
|
1413
|
+
* @see _.forOwnRight
|
|
1414
|
+
* @example
|
|
1415
|
+
*
|
|
1416
|
+
* function Foo() {
|
|
1417
|
+
* this.a = 1;
|
|
1418
|
+
* this.b = 2;
|
|
1419
|
+
* }
|
|
1420
|
+
*
|
|
1421
|
+
* Foo.prototype.c = 3;
|
|
1422
|
+
*
|
|
1423
|
+
* _.forOwn(new Foo, function(value, key) {
|
|
1424
|
+
* console.log(key);
|
|
1425
|
+
* });
|
|
1426
|
+
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
|
1427
|
+
*/
|
|
1428
|
+
function forOwn(object, iteratee) {
|
|
1429
|
+
return object && baseForOwn(object, castFunction(iteratee));
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
//#endregion
|
|
1433
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGt.js
|
|
1434
|
+
/**
|
|
1435
|
+
* The base implementation of `_.gt` which doesn't coerce arguments.
|
|
1436
|
+
*
|
|
1437
|
+
* @private
|
|
1438
|
+
* @param {*} value The value to compare.
|
|
1439
|
+
* @param {*} other The other value to compare.
|
|
1440
|
+
* @returns {boolean} Returns `true` if `value` is greater than `other`,
|
|
1441
|
+
* else `false`.
|
|
1442
|
+
*/
|
|
1443
|
+
function baseGt(value, other) {
|
|
1444
|
+
return value > other;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
//#endregion
|
|
1448
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseHas.js
|
|
1449
|
+
/** Used to check objects for own properties. */
|
|
1450
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1451
|
+
/**
|
|
1452
|
+
* The base implementation of `_.has` without support for deep paths.
|
|
1453
|
+
*
|
|
1454
|
+
* @private
|
|
1455
|
+
* @param {Object} [object] The object to query.
|
|
1456
|
+
* @param {Array|string} key The key to check.
|
|
1457
|
+
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
1458
|
+
*/
|
|
1459
|
+
function baseHas(object, key) {
|
|
1460
|
+
return object != null && hasOwnProperty.call(object, key);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
//#endregion
|
|
1464
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/has.js
|
|
1465
|
+
/**
|
|
1466
|
+
* Checks if `path` is a direct property of `object`.
|
|
1467
|
+
*
|
|
1468
|
+
* @static
|
|
1469
|
+
* @since 0.1.0
|
|
1470
|
+
* @memberOf _
|
|
1471
|
+
* @category Object
|
|
1472
|
+
* @param {Object} object The object to query.
|
|
1473
|
+
* @param {Array|string} path The path to check.
|
|
1474
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
1475
|
+
* @example
|
|
1476
|
+
*
|
|
1477
|
+
* var object = { 'a': { 'b': 2 } };
|
|
1478
|
+
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
1479
|
+
*
|
|
1480
|
+
* _.has(object, 'a');
|
|
1481
|
+
* // => true
|
|
1482
|
+
*
|
|
1483
|
+
* _.has(object, 'a.b');
|
|
1484
|
+
* // => true
|
|
1485
|
+
*
|
|
1486
|
+
* _.has(object, ['a', 'b']);
|
|
1487
|
+
* // => true
|
|
1488
|
+
*
|
|
1489
|
+
* _.has(other, 'a');
|
|
1490
|
+
* // => false
|
|
1491
|
+
*/
|
|
1492
|
+
function has(object, path) {
|
|
1493
|
+
return object != null && hasPath(object, path, baseHas);
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
//#endregion
|
|
1497
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isString.js
|
|
1498
|
+
/** `Object#toString` result references. */
|
|
1499
|
+
var stringTag = "[object String]";
|
|
1500
|
+
/**
|
|
1501
|
+
* Checks if `value` is classified as a `String` primitive or object.
|
|
1502
|
+
*
|
|
1503
|
+
* @static
|
|
1504
|
+
* @since 0.1.0
|
|
1505
|
+
* @memberOf _
|
|
1506
|
+
* @category Lang
|
|
1507
|
+
* @param {*} value The value to check.
|
|
1508
|
+
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
|
1509
|
+
* @example
|
|
1510
|
+
*
|
|
1511
|
+
* _.isString('abc');
|
|
1512
|
+
* // => true
|
|
1513
|
+
*
|
|
1514
|
+
* _.isString(1);
|
|
1515
|
+
* // => false
|
|
1516
|
+
*/
|
|
1517
|
+
function isString(value) {
|
|
1518
|
+
return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
//#endregion
|
|
1522
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseLt.js
|
|
1523
|
+
/**
|
|
1524
|
+
* The base implementation of `_.lt` which doesn't coerce arguments.
|
|
1525
|
+
*
|
|
1526
|
+
* @private
|
|
1527
|
+
* @param {*} value The value to compare.
|
|
1528
|
+
* @param {*} other The other value to compare.
|
|
1529
|
+
* @returns {boolean} Returns `true` if `value` is less than `other`,
|
|
1530
|
+
* else `false`.
|
|
1531
|
+
*/
|
|
1532
|
+
function baseLt(value, other) {
|
|
1533
|
+
return value < other;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
//#endregion
|
|
1537
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/mapValues.js
|
|
1538
|
+
/**
|
|
1539
|
+
* Creates an object with the same keys as `object` and values generated
|
|
1540
|
+
* by running each own enumerable string keyed property of `object` thru
|
|
1541
|
+
* `iteratee`. The iteratee is invoked with three arguments:
|
|
1542
|
+
* (value, key, object).
|
|
1543
|
+
*
|
|
1544
|
+
* @static
|
|
1545
|
+
* @memberOf _
|
|
1546
|
+
* @since 2.4.0
|
|
1547
|
+
* @category Object
|
|
1548
|
+
* @param {Object} object The object to iterate over.
|
|
1549
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
1550
|
+
* @returns {Object} Returns the new mapped object.
|
|
1551
|
+
* @see _.mapKeys
|
|
1552
|
+
* @example
|
|
1553
|
+
*
|
|
1554
|
+
* var users = {
|
|
1555
|
+
* 'fred': { 'user': 'fred', 'age': 40 },
|
|
1556
|
+
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
|
|
1557
|
+
* };
|
|
1558
|
+
*
|
|
1559
|
+
* _.mapValues(users, function(o) { return o.age; });
|
|
1560
|
+
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
1561
|
+
*
|
|
1562
|
+
* // The `_.property` iteratee shorthand.
|
|
1563
|
+
* _.mapValues(users, 'age');
|
|
1564
|
+
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
1565
|
+
*/
|
|
1566
|
+
function mapValues(object, iteratee) {
|
|
1567
|
+
var result = {};
|
|
1568
|
+
iteratee = baseIteratee(iteratee, 3);
|
|
1569
|
+
baseForOwn(object, function(value, key, object) {
|
|
1570
|
+
baseAssignValue(result, key, iteratee(value, key, object));
|
|
1571
|
+
});
|
|
1572
|
+
return result;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
//#endregion
|
|
1576
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseExtremum.js
|
|
1577
|
+
/**
|
|
1578
|
+
* The base implementation of methods like `_.max` and `_.min` which accepts a
|
|
1579
|
+
* `comparator` to determine the extremum value.
|
|
1580
|
+
*
|
|
1581
|
+
* @private
|
|
1582
|
+
* @param {Array} array The array to iterate over.
|
|
1583
|
+
* @param {Function} iteratee The iteratee invoked per iteration.
|
|
1584
|
+
* @param {Function} comparator The comparator used to compare values.
|
|
1585
|
+
* @returns {*} Returns the extremum value.
|
|
1586
|
+
*/
|
|
1587
|
+
function baseExtremum(array, iteratee, comparator) {
|
|
1588
|
+
var index = -1, length = array.length;
|
|
1589
|
+
while (++index < length) {
|
|
1590
|
+
var value = array[index], current = iteratee(value);
|
|
1591
|
+
if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) var computed = current, result = value;
|
|
1592
|
+
}
|
|
1593
|
+
return result;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/max.js
|
|
1598
|
+
/**
|
|
1599
|
+
* Computes the maximum value of `array`. If `array` is empty or falsey,
|
|
1600
|
+
* `undefined` is returned.
|
|
1601
|
+
*
|
|
1602
|
+
* @static
|
|
1603
|
+
* @since 0.1.0
|
|
1604
|
+
* @memberOf _
|
|
1605
|
+
* @category Math
|
|
1606
|
+
* @param {Array} array The array to iterate over.
|
|
1607
|
+
* @returns {*} Returns the maximum value.
|
|
1608
|
+
* @example
|
|
1609
|
+
*
|
|
1610
|
+
* _.max([4, 2, 8, 6]);
|
|
1611
|
+
* // => 8
|
|
1612
|
+
*
|
|
1613
|
+
* _.max([]);
|
|
1614
|
+
* // => undefined
|
|
1615
|
+
*/
|
|
1616
|
+
function max(array) {
|
|
1617
|
+
return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
//#endregion
|
|
1621
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/merge.js
|
|
1622
|
+
/**
|
|
1623
|
+
* This method is like `_.assign` except that it recursively merges own and
|
|
1624
|
+
* inherited enumerable string keyed properties of source objects into the
|
|
1625
|
+
* destination object. Source properties that resolve to `undefined` are
|
|
1626
|
+
* skipped if a destination value exists. Array and plain object properties
|
|
1627
|
+
* are merged recursively. Other objects and value types are overridden by
|
|
1628
|
+
* assignment. Source objects are applied from left to right. Subsequent
|
|
1629
|
+
* sources overwrite property assignments of previous sources.
|
|
1630
|
+
*
|
|
1631
|
+
* **Note:** This method mutates `object`.
|
|
1632
|
+
*
|
|
1633
|
+
* @static
|
|
1634
|
+
* @memberOf _
|
|
1635
|
+
* @since 0.5.0
|
|
1636
|
+
* @category Object
|
|
1637
|
+
* @param {Object} object The destination object.
|
|
1638
|
+
* @param {...Object} [sources] The source objects.
|
|
1639
|
+
* @returns {Object} Returns `object`.
|
|
1640
|
+
* @example
|
|
1641
|
+
*
|
|
1642
|
+
* var object = {
|
|
1643
|
+
* 'a': [{ 'b': 2 }, { 'd': 4 }]
|
|
1644
|
+
* };
|
|
1645
|
+
*
|
|
1646
|
+
* var other = {
|
|
1647
|
+
* 'a': [{ 'c': 3 }, { 'e': 5 }]
|
|
1648
|
+
* };
|
|
1649
|
+
*
|
|
1650
|
+
* _.merge(object, other);
|
|
1651
|
+
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
|
|
1652
|
+
*/
|
|
1653
|
+
var merge = createAssigner(function(object, source, srcIndex) {
|
|
1654
|
+
baseMerge(object, source, srcIndex);
|
|
1655
|
+
});
|
|
1656
|
+
|
|
1657
|
+
//#endregion
|
|
1658
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/min.js
|
|
1659
|
+
/**
|
|
1660
|
+
* Computes the minimum value of `array`. If `array` is empty or falsey,
|
|
1661
|
+
* `undefined` is returned.
|
|
1662
|
+
*
|
|
1663
|
+
* @static
|
|
1664
|
+
* @since 0.1.0
|
|
1665
|
+
* @memberOf _
|
|
1666
|
+
* @category Math
|
|
1667
|
+
* @param {Array} array The array to iterate over.
|
|
1668
|
+
* @returns {*} Returns the minimum value.
|
|
1669
|
+
* @example
|
|
1670
|
+
*
|
|
1671
|
+
* _.min([4, 2, 8, 6]);
|
|
1672
|
+
* // => 2
|
|
1673
|
+
*
|
|
1674
|
+
* _.min([]);
|
|
1675
|
+
* // => undefined
|
|
1676
|
+
*/
|
|
1677
|
+
function min(array) {
|
|
1678
|
+
return array && array.length ? baseExtremum(array, identity, baseLt) : void 0;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
//#endregion
|
|
1682
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/minBy.js
|
|
1683
|
+
/**
|
|
1684
|
+
* This method is like `_.min` except that it accepts `iteratee` which is
|
|
1685
|
+
* invoked for each element in `array` to generate the criterion by which
|
|
1686
|
+
* the value is ranked. The iteratee is invoked with one argument: (value).
|
|
1687
|
+
*
|
|
1688
|
+
* @static
|
|
1689
|
+
* @memberOf _
|
|
1690
|
+
* @since 4.0.0
|
|
1691
|
+
* @category Math
|
|
1692
|
+
* @param {Array} array The array to iterate over.
|
|
1693
|
+
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
1694
|
+
* @returns {*} Returns the minimum value.
|
|
1695
|
+
* @example
|
|
1696
|
+
*
|
|
1697
|
+
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
|
1698
|
+
*
|
|
1699
|
+
* _.minBy(objects, function(o) { return o.n; });
|
|
1700
|
+
* // => { 'n': 1 }
|
|
1701
|
+
*
|
|
1702
|
+
* // The `_.property` iteratee shorthand.
|
|
1703
|
+
* _.minBy(objects, 'n');
|
|
1704
|
+
* // => { 'n': 1 }
|
|
1705
|
+
*/
|
|
1706
|
+
function minBy(array, iteratee) {
|
|
1707
|
+
return array && array.length ? baseExtremum(array, baseIteratee(iteratee, 2), baseLt) : void 0;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
//#endregion
|
|
1711
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSet.js
|
|
1712
|
+
/**
|
|
1713
|
+
* The base implementation of `_.set`.
|
|
1714
|
+
*
|
|
1715
|
+
* @private
|
|
1716
|
+
* @param {Object} object The object to modify.
|
|
1717
|
+
* @param {Array|string} path The path of the property to set.
|
|
1718
|
+
* @param {*} value The value to set.
|
|
1719
|
+
* @param {Function} [customizer] The function to customize path creation.
|
|
1720
|
+
* @returns {Object} Returns `object`.
|
|
1721
|
+
*/
|
|
1722
|
+
function baseSet(object, path, value, customizer) {
|
|
1723
|
+
if (!isObject(object)) return object;
|
|
1724
|
+
path = castPath(path, object);
|
|
1725
|
+
var index = -1, length = path.length, lastIndex = length - 1, nested = object;
|
|
1726
|
+
while (nested != null && ++index < length) {
|
|
1727
|
+
var key = toKey(path[index]), newValue = value;
|
|
1728
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") return object;
|
|
1729
|
+
if (index != lastIndex) {
|
|
1730
|
+
var objValue = nested[key];
|
|
1731
|
+
newValue = customizer ? customizer(objValue, key, nested) : void 0;
|
|
1732
|
+
if (newValue === void 0) newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
|
|
1733
|
+
}
|
|
1734
|
+
assignValue(nested, key, newValue);
|
|
1735
|
+
nested = nested[key];
|
|
1736
|
+
}
|
|
1737
|
+
return object;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
//#endregion
|
|
1741
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePickBy.js
|
|
1742
|
+
/**
|
|
1743
|
+
* The base implementation of `_.pickBy` without support for iteratee shorthands.
|
|
1744
|
+
*
|
|
1745
|
+
* @private
|
|
1746
|
+
* @param {Object} object The source object.
|
|
1747
|
+
* @param {string[]} paths The property paths to pick.
|
|
1748
|
+
* @param {Function} predicate The function invoked per property.
|
|
1749
|
+
* @returns {Object} Returns the new object.
|
|
1750
|
+
*/
|
|
1751
|
+
function basePickBy(object, paths, predicate) {
|
|
1752
|
+
var index = -1, length = paths.length, result = {};
|
|
1753
|
+
while (++index < length) {
|
|
1754
|
+
var path = paths[index], value = baseGet(object, path);
|
|
1755
|
+
if (predicate(value, path)) baseSet(result, castPath(path, object), value);
|
|
1756
|
+
}
|
|
1757
|
+
return result;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
//#endregion
|
|
1761
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSortBy.js
|
|
1762
|
+
/**
|
|
1763
|
+
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
1764
|
+
* sort order of `array` and replaces criteria objects with their corresponding
|
|
1765
|
+
* values.
|
|
1766
|
+
*
|
|
1767
|
+
* @private
|
|
1768
|
+
* @param {Array} array The array to sort.
|
|
1769
|
+
* @param {Function} comparer The function to define sort order.
|
|
1770
|
+
* @returns {Array} Returns `array`.
|
|
1771
|
+
*/
|
|
1772
|
+
function baseSortBy(array, comparer) {
|
|
1773
|
+
var length = array.length;
|
|
1774
|
+
array.sort(comparer);
|
|
1775
|
+
while (length--) array[length] = array[length].value;
|
|
1776
|
+
return array;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
//#endregion
|
|
1780
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_compareAscending.js
|
|
1781
|
+
/**
|
|
1782
|
+
* Compares values to sort them in ascending order.
|
|
1783
|
+
*
|
|
1784
|
+
* @private
|
|
1785
|
+
* @param {*} value The value to compare.
|
|
1786
|
+
* @param {*} other The other value to compare.
|
|
1787
|
+
* @returns {number} Returns the sort order indicator for `value`.
|
|
1788
|
+
*/
|
|
1789
|
+
function compareAscending(value, other) {
|
|
1790
|
+
if (value !== other) {
|
|
1791
|
+
var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
|
|
1792
|
+
var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
|
|
1793
|
+
if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) return 1;
|
|
1794
|
+
if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) return -1;
|
|
1795
|
+
}
|
|
1796
|
+
return 0;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
//#endregion
|
|
1800
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_compareMultiple.js
|
|
1801
|
+
/**
|
|
1802
|
+
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
1803
|
+
* and stable sort them.
|
|
1804
|
+
*
|
|
1805
|
+
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
1806
|
+
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
1807
|
+
* of corresponding values.
|
|
1808
|
+
*
|
|
1809
|
+
* @private
|
|
1810
|
+
* @param {Object} object The object to compare.
|
|
1811
|
+
* @param {Object} other The other object to compare.
|
|
1812
|
+
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
1813
|
+
* @returns {number} Returns the sort order indicator for `object`.
|
|
1814
|
+
*/
|
|
1815
|
+
function compareMultiple(object, other, orders) {
|
|
1816
|
+
var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
|
|
1817
|
+
while (++index < length) {
|
|
1818
|
+
var result = compareAscending(objCriteria[index], othCriteria[index]);
|
|
1819
|
+
if (result) {
|
|
1820
|
+
if (index >= ordersLength) return result;
|
|
1821
|
+
return result * (orders[index] == "desc" ? -1 : 1);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
return object.index - other.index;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
//#endregion
|
|
1828
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseOrderBy.js
|
|
1829
|
+
/**
|
|
1830
|
+
* The base implementation of `_.orderBy` without param guards.
|
|
1831
|
+
*
|
|
1832
|
+
* @private
|
|
1833
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
1834
|
+
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
1835
|
+
* @param {string[]} orders The sort orders of `iteratees`.
|
|
1836
|
+
* @returns {Array} Returns the new sorted array.
|
|
1837
|
+
*/
|
|
1838
|
+
function baseOrderBy(collection, iteratees, orders) {
|
|
1839
|
+
if (iteratees.length) iteratees = arrayMap(iteratees, function(iteratee) {
|
|
1840
|
+
if (isArray(iteratee)) return function(value) {
|
|
1841
|
+
return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
1842
|
+
};
|
|
1843
|
+
return iteratee;
|
|
1844
|
+
});
|
|
1845
|
+
else iteratees = [identity];
|
|
1846
|
+
var index = -1;
|
|
1847
|
+
iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
|
|
1848
|
+
return baseSortBy(baseMap(collection, function(value, key, collection) {
|
|
1849
|
+
return {
|
|
1850
|
+
"criteria": arrayMap(iteratees, function(iteratee) {
|
|
1851
|
+
return iteratee(value);
|
|
1852
|
+
}),
|
|
1853
|
+
"index": ++index,
|
|
1854
|
+
"value": value
|
|
1855
|
+
};
|
|
1856
|
+
}), function(object, other) {
|
|
1857
|
+
return compareMultiple(object, other, orders);
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
//#endregion
|
|
1862
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_asciiSize.js
|
|
1863
|
+
/**
|
|
1864
|
+
* Gets the size of an ASCII `string`.
|
|
1865
|
+
*
|
|
1866
|
+
* @private
|
|
1867
|
+
* @param {string} string The string inspect.
|
|
1868
|
+
* @returns {number} Returns the string size.
|
|
1869
|
+
*/
|
|
1870
|
+
var asciiSize = baseProperty("length");
|
|
1871
|
+
|
|
1872
|
+
//#endregion
|
|
1873
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_unicodeSize.js
|
|
1874
|
+
/** Used to compose unicode character classes. */
|
|
1875
|
+
var rsAstralRange = "\\ud800-\\udfff";
|
|
1876
|
+
var rsComboRange = "\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff";
|
|
1877
|
+
var rsVarRange = "\\ufe0e\\ufe0f";
|
|
1878
|
+
/** Used to compose unicode capture groups. */
|
|
1879
|
+
var rsAstral = "[" + rsAstralRange + "]";
|
|
1880
|
+
var rsCombo = "[" + rsComboRange + "]";
|
|
1881
|
+
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
|
|
1882
|
+
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
|
|
1883
|
+
var rsNonAstral = "[^" + rsAstralRange + "]";
|
|
1884
|
+
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
|
|
1885
|
+
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
|
|
1886
|
+
var rsZWJ = "\\u200d";
|
|
1887
|
+
/** Used to compose unicode regexes. */
|
|
1888
|
+
var reOptMod = rsModifier + "?";
|
|
1889
|
+
var rsOptVar = "[" + rsVarRange + "]?";
|
|
1890
|
+
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [
|
|
1891
|
+
rsNonAstral,
|
|
1892
|
+
rsRegional,
|
|
1893
|
+
rsSurrPair
|
|
1894
|
+
].join("|") + ")" + rsOptVar + reOptMod + ")*";
|
|
1895
|
+
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
|
|
1896
|
+
var rsSymbol = "(?:" + [
|
|
1897
|
+
rsNonAstral + rsCombo + "?",
|
|
1898
|
+
rsCombo,
|
|
1899
|
+
rsRegional,
|
|
1900
|
+
rsSurrPair,
|
|
1901
|
+
rsAstral
|
|
1902
|
+
].join("|") + ")";
|
|
1903
|
+
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
1904
|
+
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
|
|
1905
|
+
/**
|
|
1906
|
+
* Gets the size of a Unicode `string`.
|
|
1907
|
+
*
|
|
1908
|
+
* @private
|
|
1909
|
+
* @param {string} string The string inspect.
|
|
1910
|
+
* @returns {number} Returns the string size.
|
|
1911
|
+
*/
|
|
1912
|
+
function unicodeSize(string) {
|
|
1913
|
+
var result = reUnicode.lastIndex = 0;
|
|
1914
|
+
while (reUnicode.test(string)) ++result;
|
|
1915
|
+
return result;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
//#endregion
|
|
1919
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stringSize.js
|
|
1920
|
+
/**
|
|
1921
|
+
* Gets the number of symbols in `string`.
|
|
1922
|
+
*
|
|
1923
|
+
* @private
|
|
1924
|
+
* @param {string} string The string to inspect.
|
|
1925
|
+
* @returns {number} Returns the string size.
|
|
1926
|
+
*/
|
|
1927
|
+
function stringSize(string) {
|
|
1928
|
+
return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
//#endregion
|
|
1932
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePick.js
|
|
1933
|
+
/**
|
|
1934
|
+
* The base implementation of `_.pick` without support for individual
|
|
1935
|
+
* property identifiers.
|
|
1936
|
+
*
|
|
1937
|
+
* @private
|
|
1938
|
+
* @param {Object} object The source object.
|
|
1939
|
+
* @param {string[]} paths The property paths to pick.
|
|
1940
|
+
* @returns {Object} Returns the new object.
|
|
1941
|
+
*/
|
|
1942
|
+
function basePick(object, paths) {
|
|
1943
|
+
return basePickBy(object, paths, function(value, path) {
|
|
1944
|
+
return hasIn(object, path);
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
//#endregion
|
|
1949
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/pick.js
|
|
1950
|
+
/**
|
|
1951
|
+
* Creates an object composed of the picked `object` properties.
|
|
1952
|
+
*
|
|
1953
|
+
* @static
|
|
1954
|
+
* @since 0.1.0
|
|
1955
|
+
* @memberOf _
|
|
1956
|
+
* @category Object
|
|
1957
|
+
* @param {Object} object The source object.
|
|
1958
|
+
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
1959
|
+
* @returns {Object} Returns the new object.
|
|
1960
|
+
* @example
|
|
1961
|
+
*
|
|
1962
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
1963
|
+
*
|
|
1964
|
+
* _.pick(object, ['a', 'c']);
|
|
1965
|
+
* // => { 'a': 1, 'c': 3 }
|
|
1966
|
+
*/
|
|
1967
|
+
var pick = flatRest(function(object, paths) {
|
|
1968
|
+
return object == null ? {} : basePick(object, paths);
|
|
1969
|
+
});
|
|
1970
|
+
|
|
1971
|
+
//#endregion
|
|
1972
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseRange.js
|
|
1973
|
+
var nativeCeil = Math.ceil;
|
|
1974
|
+
var nativeMax = Math.max;
|
|
1975
|
+
/**
|
|
1976
|
+
* The base implementation of `_.range` and `_.rangeRight` which doesn't
|
|
1977
|
+
* coerce arguments.
|
|
1978
|
+
*
|
|
1979
|
+
* @private
|
|
1980
|
+
* @param {number} start The start of the range.
|
|
1981
|
+
* @param {number} end The end of the range.
|
|
1982
|
+
* @param {number} step The value to increment or decrement by.
|
|
1983
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
1984
|
+
* @returns {Array} Returns the range of numbers.
|
|
1985
|
+
*/
|
|
1986
|
+
function baseRange(start, end, step, fromRight) {
|
|
1987
|
+
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
|
|
1988
|
+
while (length--) {
|
|
1989
|
+
result[fromRight ? length : ++index] = start;
|
|
1990
|
+
start += step;
|
|
1991
|
+
}
|
|
1992
|
+
return result;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
//#endregion
|
|
1996
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createRange.js
|
|
1997
|
+
/**
|
|
1998
|
+
* Creates a `_.range` or `_.rangeRight` function.
|
|
1999
|
+
*
|
|
2000
|
+
* @private
|
|
2001
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
2002
|
+
* @returns {Function} Returns the new range function.
|
|
2003
|
+
*/
|
|
2004
|
+
function createRange(fromRight) {
|
|
2005
|
+
return function(start, end, step) {
|
|
2006
|
+
if (step && typeof step != "number" && isIterateeCall(start, end, step)) end = step = void 0;
|
|
2007
|
+
start = toFinite(start);
|
|
2008
|
+
if (end === void 0) {
|
|
2009
|
+
end = start;
|
|
2010
|
+
start = 0;
|
|
2011
|
+
} else end = toFinite(end);
|
|
2012
|
+
step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
|
|
2013
|
+
return baseRange(start, end, step, fromRight);
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
//#endregion
|
|
2018
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/range.js
|
|
2019
|
+
/**
|
|
2020
|
+
* Creates an array of numbers (positive and/or negative) progressing from
|
|
2021
|
+
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
|
|
2022
|
+
* `start` is specified without an `end` or `step`. If `end` is not specified,
|
|
2023
|
+
* it's set to `start` with `start` then set to `0`.
|
|
2024
|
+
*
|
|
2025
|
+
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
|
2026
|
+
* floating-point values which can produce unexpected results.
|
|
2027
|
+
*
|
|
2028
|
+
* @static
|
|
2029
|
+
* @since 0.1.0
|
|
2030
|
+
* @memberOf _
|
|
2031
|
+
* @category Util
|
|
2032
|
+
* @param {number} [start=0] The start of the range.
|
|
2033
|
+
* @param {number} end The end of the range.
|
|
2034
|
+
* @param {number} [step=1] The value to increment or decrement by.
|
|
2035
|
+
* @returns {Array} Returns the range of numbers.
|
|
2036
|
+
* @see _.inRange, _.rangeRight
|
|
2037
|
+
* @example
|
|
2038
|
+
*
|
|
2039
|
+
* _.range(4);
|
|
2040
|
+
* // => [0, 1, 2, 3]
|
|
2041
|
+
*
|
|
2042
|
+
* _.range(-4);
|
|
2043
|
+
* // => [0, -1, -2, -3]
|
|
2044
|
+
*
|
|
2045
|
+
* _.range(1, 5);
|
|
2046
|
+
* // => [1, 2, 3, 4]
|
|
2047
|
+
*
|
|
2048
|
+
* _.range(0, 20, 5);
|
|
2049
|
+
* // => [0, 5, 10, 15]
|
|
2050
|
+
*
|
|
2051
|
+
* _.range(0, -4, -1);
|
|
2052
|
+
* // => [0, -1, -2, -3]
|
|
2053
|
+
*
|
|
2054
|
+
* _.range(1, 4, 0);
|
|
2055
|
+
* // => [1, 1, 1]
|
|
2056
|
+
*
|
|
2057
|
+
* _.range(0);
|
|
2058
|
+
* // => []
|
|
2059
|
+
*/
|
|
2060
|
+
var range = createRange();
|
|
2061
|
+
|
|
2062
|
+
//#endregion
|
|
2063
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/size.js
|
|
2064
|
+
/** `Object#toString` result references. */
|
|
2065
|
+
var mapTag = "[object Map]";
|
|
2066
|
+
var setTag = "[object Set]";
|
|
2067
|
+
/**
|
|
2068
|
+
* Gets the size of `collection` by returning its length for array-like
|
|
2069
|
+
* values or the number of own enumerable string keyed properties for objects.
|
|
2070
|
+
*
|
|
2071
|
+
* @static
|
|
2072
|
+
* @memberOf _
|
|
2073
|
+
* @since 0.1.0
|
|
2074
|
+
* @category Collection
|
|
2075
|
+
* @param {Array|Object|string} collection The collection to inspect.
|
|
2076
|
+
* @returns {number} Returns the collection size.
|
|
2077
|
+
* @example
|
|
2078
|
+
*
|
|
2079
|
+
* _.size([1, 2, 3]);
|
|
2080
|
+
* // => 3
|
|
2081
|
+
*
|
|
2082
|
+
* _.size({ 'a': 1, 'b': 2 });
|
|
2083
|
+
* // => 2
|
|
2084
|
+
*
|
|
2085
|
+
* _.size('pebbles');
|
|
2086
|
+
* // => 7
|
|
2087
|
+
*/
|
|
2088
|
+
function size(collection) {
|
|
2089
|
+
if (collection == null) return 0;
|
|
2090
|
+
if (isArrayLike(collection)) return isString(collection) ? stringSize(collection) : collection.length;
|
|
2091
|
+
var tag = _getTag_default(collection);
|
|
2092
|
+
if (tag == mapTag || tag == setTag) return collection.size;
|
|
2093
|
+
return baseKeys(collection).length;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
//#endregion
|
|
2097
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/sortBy.js
|
|
2098
|
+
/**
|
|
2099
|
+
* Creates an array of elements, sorted in ascending order by the results of
|
|
2100
|
+
* running each element in a collection thru each iteratee. This method
|
|
2101
|
+
* performs a stable sort, that is, it preserves the original sort order of
|
|
2102
|
+
* equal elements. The iteratees are invoked with one argument: (value).
|
|
2103
|
+
*
|
|
2104
|
+
* @static
|
|
2105
|
+
* @memberOf _
|
|
2106
|
+
* @since 0.1.0
|
|
2107
|
+
* @category Collection
|
|
2108
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
2109
|
+
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
2110
|
+
* The iteratees to sort by.
|
|
2111
|
+
* @returns {Array} Returns the new sorted array.
|
|
2112
|
+
* @example
|
|
2113
|
+
*
|
|
2114
|
+
* var users = [
|
|
2115
|
+
* { 'user': 'fred', 'age': 48 },
|
|
2116
|
+
* { 'user': 'barney', 'age': 36 },
|
|
2117
|
+
* { 'user': 'fred', 'age': 30 },
|
|
2118
|
+
* { 'user': 'barney', 'age': 34 }
|
|
2119
|
+
* ];
|
|
2120
|
+
*
|
|
2121
|
+
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
2122
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
2123
|
+
*
|
|
2124
|
+
* _.sortBy(users, ['user', 'age']);
|
|
2125
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
2126
|
+
*/
|
|
2127
|
+
var sortBy = baseRest(function(collection, iteratees) {
|
|
2128
|
+
if (collection == null) return [];
|
|
2129
|
+
var length = iteratees.length;
|
|
2130
|
+
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) iteratees = [];
|
|
2131
|
+
else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) iteratees = [iteratees[0]];
|
|
2132
|
+
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
|
|
2133
|
+
});
|
|
2134
|
+
|
|
2135
|
+
//#endregion
|
|
2136
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/uniqueId.js
|
|
2137
|
+
/** Used to generate unique IDs. */
|
|
2138
|
+
var idCounter = 0;
|
|
2139
|
+
/**
|
|
2140
|
+
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
|
2141
|
+
*
|
|
2142
|
+
* @static
|
|
2143
|
+
* @since 0.1.0
|
|
2144
|
+
* @memberOf _
|
|
2145
|
+
* @category Util
|
|
2146
|
+
* @param {string} [prefix=''] The value to prefix the ID with.
|
|
2147
|
+
* @returns {string} Returns the unique ID.
|
|
2148
|
+
* @example
|
|
2149
|
+
*
|
|
2150
|
+
* _.uniqueId('contact_');
|
|
2151
|
+
* // => 'contact_104'
|
|
2152
|
+
*
|
|
2153
|
+
* _.uniqueId();
|
|
2154
|
+
* // => '105'
|
|
2155
|
+
*/
|
|
2156
|
+
function uniqueId(prefix) {
|
|
2157
|
+
var id = ++idCounter;
|
|
2158
|
+
return toString(prefix) + id;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
//#endregion
|
|
2162
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseZipObject.js
|
|
2163
|
+
/**
|
|
2164
|
+
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
|
|
2165
|
+
*
|
|
2166
|
+
* @private
|
|
2167
|
+
* @param {Array} props The property identifiers.
|
|
2168
|
+
* @param {Array} values The property values.
|
|
2169
|
+
* @param {Function} assignFunc The function to assign values.
|
|
2170
|
+
* @returns {Object} Returns the new object.
|
|
2171
|
+
*/
|
|
2172
|
+
function baseZipObject(props, values, assignFunc) {
|
|
2173
|
+
var index = -1, length = props.length, valsLength = values.length, result = {};
|
|
2174
|
+
while (++index < length) {
|
|
2175
|
+
var value = index < valsLength ? values[index] : void 0;
|
|
2176
|
+
assignFunc(result, props[index], value);
|
|
2177
|
+
}
|
|
2178
|
+
return result;
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
//#endregion
|
|
2182
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/zipObject.js
|
|
2183
|
+
/**
|
|
2184
|
+
* This method is like `_.fromPairs` except that it accepts two arrays,
|
|
2185
|
+
* one of property identifiers and one of corresponding values.
|
|
2186
|
+
*
|
|
2187
|
+
* @static
|
|
2188
|
+
* @memberOf _
|
|
2189
|
+
* @since 0.4.0
|
|
2190
|
+
* @category Array
|
|
2191
|
+
* @param {Array} [props=[]] The property identifiers.
|
|
2192
|
+
* @param {Array} [values=[]] The property values.
|
|
2193
|
+
* @returns {Object} Returns the new object.
|
|
2194
|
+
* @example
|
|
2195
|
+
*
|
|
2196
|
+
* _.zipObject(['a', 'b'], [1, 2]);
|
|
2197
|
+
* // => { 'a': 1, 'b': 2 }
|
|
2198
|
+
*/
|
|
2199
|
+
function zipObject(props, values) {
|
|
2200
|
+
return baseZipObject(props || [], values || [], assignValue);
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
//#endregion
|
|
2204
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/data/list.js
|
|
2205
|
+
var List = class {
|
|
2206
|
+
constructor() {
|
|
2207
|
+
var sentinel = {};
|
|
2208
|
+
sentinel._next = sentinel._prev = sentinel;
|
|
2209
|
+
this._sentinel = sentinel;
|
|
2210
|
+
}
|
|
2211
|
+
dequeue() {
|
|
2212
|
+
var sentinel = this._sentinel;
|
|
2213
|
+
var entry = sentinel._prev;
|
|
2214
|
+
if (entry !== sentinel) {
|
|
2215
|
+
unlink(entry);
|
|
2216
|
+
return entry;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
enqueue(entry) {
|
|
2220
|
+
var sentinel = this._sentinel;
|
|
2221
|
+
if (entry._prev && entry._next) unlink(entry);
|
|
2222
|
+
entry._next = sentinel._next;
|
|
2223
|
+
sentinel._next._prev = entry;
|
|
2224
|
+
sentinel._next = entry;
|
|
2225
|
+
entry._prev = sentinel;
|
|
2226
|
+
}
|
|
2227
|
+
toString() {
|
|
2228
|
+
var strs = [];
|
|
2229
|
+
var sentinel = this._sentinel;
|
|
2230
|
+
var curr = sentinel._prev;
|
|
2231
|
+
while (curr !== sentinel) {
|
|
2232
|
+
strs.push(JSON.stringify(curr, filterOutLinks));
|
|
2233
|
+
curr = curr._prev;
|
|
2234
|
+
}
|
|
2235
|
+
return "[" + strs.join(", ") + "]";
|
|
2236
|
+
}
|
|
2237
|
+
};
|
|
2238
|
+
function unlink(entry) {
|
|
2239
|
+
entry._prev._next = entry._next;
|
|
2240
|
+
entry._next._prev = entry._prev;
|
|
2241
|
+
delete entry._next;
|
|
2242
|
+
delete entry._prev;
|
|
2243
|
+
}
|
|
2244
|
+
function filterOutLinks(k, v) {
|
|
2245
|
+
if (k !== "_next" && k !== "_prev") return v;
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
//#endregion
|
|
2249
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/greedy-fas.js
|
|
2250
|
+
var DEFAULT_WEIGHT_FN = constant(1);
|
|
2251
|
+
function greedyFAS(g, weightFn) {
|
|
2252
|
+
if (g.nodeCount() <= 1) return [];
|
|
2253
|
+
var state = buildState(g, weightFn || DEFAULT_WEIGHT_FN);
|
|
2254
|
+
var results = doGreedyFAS(state.graph, state.buckets, state.zeroIdx);
|
|
2255
|
+
return flatten(map(results, function(e) {
|
|
2256
|
+
return g.outEdges(e.v, e.w);
|
|
2257
|
+
}));
|
|
2258
|
+
}
|
|
2259
|
+
function doGreedyFAS(g, buckets, zeroIdx) {
|
|
2260
|
+
var results = [];
|
|
2261
|
+
var sources = buckets[buckets.length - 1];
|
|
2262
|
+
var sinks = buckets[0];
|
|
2263
|
+
var entry;
|
|
2264
|
+
while (g.nodeCount()) {
|
|
2265
|
+
while (entry = sinks.dequeue()) removeNode(g, buckets, zeroIdx, entry);
|
|
2266
|
+
while (entry = sources.dequeue()) removeNode(g, buckets, zeroIdx, entry);
|
|
2267
|
+
if (g.nodeCount()) for (var i = buckets.length - 2; i > 0; --i) {
|
|
2268
|
+
entry = buckets[i].dequeue();
|
|
2269
|
+
if (entry) {
|
|
2270
|
+
results = results.concat(removeNode(g, buckets, zeroIdx, entry, true));
|
|
2271
|
+
break;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
return results;
|
|
2276
|
+
}
|
|
2277
|
+
function removeNode(g, buckets, zeroIdx, entry, collectPredecessors) {
|
|
2278
|
+
var results = collectPredecessors ? [] : void 0;
|
|
2279
|
+
forEach(g.inEdges(entry.v), function(edge) {
|
|
2280
|
+
var weight = g.edge(edge);
|
|
2281
|
+
var uEntry = g.node(edge.v);
|
|
2282
|
+
if (collectPredecessors) results.push({
|
|
2283
|
+
v: edge.v,
|
|
2284
|
+
w: edge.w
|
|
2285
|
+
});
|
|
2286
|
+
uEntry.out -= weight;
|
|
2287
|
+
assignBucket(buckets, zeroIdx, uEntry);
|
|
2288
|
+
});
|
|
2289
|
+
forEach(g.outEdges(entry.v), function(edge) {
|
|
2290
|
+
var weight = g.edge(edge);
|
|
2291
|
+
var w = edge.w;
|
|
2292
|
+
var wEntry = g.node(w);
|
|
2293
|
+
wEntry["in"] -= weight;
|
|
2294
|
+
assignBucket(buckets, zeroIdx, wEntry);
|
|
2295
|
+
});
|
|
2296
|
+
g.removeNode(entry.v);
|
|
2297
|
+
return results;
|
|
2298
|
+
}
|
|
2299
|
+
function buildState(g, weightFn) {
|
|
2300
|
+
var fasGraph = new Graph();
|
|
2301
|
+
var maxIn = 0;
|
|
2302
|
+
var maxOut = 0;
|
|
2303
|
+
forEach(g.nodes(), function(v) {
|
|
2304
|
+
fasGraph.setNode(v, {
|
|
2305
|
+
v,
|
|
2306
|
+
in: 0,
|
|
2307
|
+
out: 0
|
|
2308
|
+
});
|
|
2309
|
+
});
|
|
2310
|
+
forEach(g.edges(), function(e) {
|
|
2311
|
+
var prevWeight = fasGraph.edge(e.v, e.w) || 0;
|
|
2312
|
+
var weight = weightFn(e);
|
|
2313
|
+
var edgeWeight = prevWeight + weight;
|
|
2314
|
+
fasGraph.setEdge(e.v, e.w, edgeWeight);
|
|
2315
|
+
maxOut = Math.max(maxOut, fasGraph.node(e.v).out += weight);
|
|
2316
|
+
maxIn = Math.max(maxIn, fasGraph.node(e.w)["in"] += weight);
|
|
2317
|
+
});
|
|
2318
|
+
var buckets = range(maxOut + maxIn + 3).map(function() {
|
|
2319
|
+
return new List();
|
|
2320
|
+
});
|
|
2321
|
+
var zeroIdx = maxIn + 1;
|
|
2322
|
+
forEach(fasGraph.nodes(), function(v) {
|
|
2323
|
+
assignBucket(buckets, zeroIdx, fasGraph.node(v));
|
|
2324
|
+
});
|
|
2325
|
+
return {
|
|
2326
|
+
graph: fasGraph,
|
|
2327
|
+
buckets,
|
|
2328
|
+
zeroIdx
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
2331
|
+
function assignBucket(buckets, zeroIdx, entry) {
|
|
2332
|
+
if (!entry.out) buckets[0].enqueue(entry);
|
|
2333
|
+
else if (!entry["in"]) buckets[buckets.length - 1].enqueue(entry);
|
|
2334
|
+
else buckets[entry.out - entry["in"] + zeroIdx].enqueue(entry);
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
//#endregion
|
|
2338
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/acyclic.js
|
|
2339
|
+
function run$2(g) {
|
|
2340
|
+
var fas = g.graph().acyclicer === "greedy" ? greedyFAS(g, weightFn(g)) : dfsFAS(g);
|
|
2341
|
+
forEach(fas, function(e) {
|
|
2342
|
+
var label = g.edge(e);
|
|
2343
|
+
g.removeEdge(e);
|
|
2344
|
+
label.forwardName = e.name;
|
|
2345
|
+
label.reversed = true;
|
|
2346
|
+
g.setEdge(e.w, e.v, label, uniqueId("rev"));
|
|
2347
|
+
});
|
|
2348
|
+
function weightFn(g) {
|
|
2349
|
+
return function(e) {
|
|
2350
|
+
return g.edge(e).weight;
|
|
2351
|
+
};
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
function dfsFAS(g) {
|
|
2355
|
+
var fas = [];
|
|
2356
|
+
var stack = {};
|
|
2357
|
+
var visited = {};
|
|
2358
|
+
function dfs(v) {
|
|
2359
|
+
if (Object.prototype.hasOwnProperty.call(visited, v)) return;
|
|
2360
|
+
visited[v] = true;
|
|
2361
|
+
stack[v] = true;
|
|
2362
|
+
forEach(g.outEdges(v), function(e) {
|
|
2363
|
+
if (Object.prototype.hasOwnProperty.call(stack, e.w)) fas.push(e);
|
|
2364
|
+
else dfs(e.w);
|
|
2365
|
+
});
|
|
2366
|
+
delete stack[v];
|
|
2367
|
+
}
|
|
2368
|
+
forEach(g.nodes(), dfs);
|
|
2369
|
+
return fas;
|
|
2370
|
+
}
|
|
2371
|
+
function undo$2(g) {
|
|
2372
|
+
forEach(g.edges(), function(e) {
|
|
2373
|
+
var label = g.edge(e);
|
|
2374
|
+
if (label.reversed) {
|
|
2375
|
+
g.removeEdge(e);
|
|
2376
|
+
var forwardName = label.forwardName;
|
|
2377
|
+
delete label.reversed;
|
|
2378
|
+
delete label.forwardName;
|
|
2379
|
+
g.setEdge(e.w, e.v, label, forwardName);
|
|
2380
|
+
}
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
//#endregion
|
|
2385
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/util.js
|
|
2386
|
+
function addDummyNode(g, type, attrs, name) {
|
|
2387
|
+
var v;
|
|
2388
|
+
do
|
|
2389
|
+
v = uniqueId(name);
|
|
2390
|
+
while (g.hasNode(v));
|
|
2391
|
+
attrs.dummy = type;
|
|
2392
|
+
g.setNode(v, attrs);
|
|
2393
|
+
return v;
|
|
2394
|
+
}
|
|
2395
|
+
function simplify(g) {
|
|
2396
|
+
var simplified = new Graph().setGraph(g.graph());
|
|
2397
|
+
forEach(g.nodes(), function(v) {
|
|
2398
|
+
simplified.setNode(v, g.node(v));
|
|
2399
|
+
});
|
|
2400
|
+
forEach(g.edges(), function(e) {
|
|
2401
|
+
var simpleLabel = simplified.edge(e.v, e.w) || {
|
|
2402
|
+
weight: 0,
|
|
2403
|
+
minlen: 1
|
|
2404
|
+
};
|
|
2405
|
+
var label = g.edge(e);
|
|
2406
|
+
simplified.setEdge(e.v, e.w, {
|
|
2407
|
+
weight: simpleLabel.weight + label.weight,
|
|
2408
|
+
minlen: Math.max(simpleLabel.minlen, label.minlen)
|
|
2409
|
+
});
|
|
2410
|
+
});
|
|
2411
|
+
return simplified;
|
|
2412
|
+
}
|
|
2413
|
+
function asNonCompoundGraph(g) {
|
|
2414
|
+
var simplified = new Graph({ multigraph: g.isMultigraph() }).setGraph(g.graph());
|
|
2415
|
+
forEach(g.nodes(), function(v) {
|
|
2416
|
+
if (!g.children(v).length) simplified.setNode(v, g.node(v));
|
|
2417
|
+
});
|
|
2418
|
+
forEach(g.edges(), function(e) {
|
|
2419
|
+
simplified.setEdge(e, g.edge(e));
|
|
2420
|
+
});
|
|
2421
|
+
return simplified;
|
|
2422
|
+
}
|
|
2423
|
+
function intersectRect(rect, point) {
|
|
2424
|
+
var x = rect.x;
|
|
2425
|
+
var y = rect.y;
|
|
2426
|
+
var dx = point.x - x;
|
|
2427
|
+
var dy = point.y - y;
|
|
2428
|
+
var w = rect.width / 2;
|
|
2429
|
+
var h = rect.height / 2;
|
|
2430
|
+
if (!dx && !dy) throw new Error("Not possible to find intersection inside of the rectangle");
|
|
2431
|
+
var sx, sy;
|
|
2432
|
+
if (Math.abs(dy) * w > Math.abs(dx) * h) {
|
|
2433
|
+
if (dy < 0) h = -h;
|
|
2434
|
+
sx = h * dx / dy;
|
|
2435
|
+
sy = h;
|
|
2436
|
+
} else {
|
|
2437
|
+
if (dx < 0) w = -w;
|
|
2438
|
+
sx = w;
|
|
2439
|
+
sy = w * dy / dx;
|
|
2440
|
+
}
|
|
2441
|
+
return {
|
|
2442
|
+
x: x + sx,
|
|
2443
|
+
y: y + sy
|
|
2444
|
+
};
|
|
2445
|
+
}
|
|
2446
|
+
function buildLayerMatrix(g) {
|
|
2447
|
+
var layering = map(range(maxRank(g) + 1), function() {
|
|
2448
|
+
return [];
|
|
2449
|
+
});
|
|
2450
|
+
forEach(g.nodes(), function(v) {
|
|
2451
|
+
var node = g.node(v);
|
|
2452
|
+
var rank = node.rank;
|
|
2453
|
+
if (!isUndefined(rank)) layering[rank][node.order] = v;
|
|
2454
|
+
});
|
|
2455
|
+
return layering;
|
|
2456
|
+
}
|
|
2457
|
+
function normalizeRanks(g) {
|
|
2458
|
+
var min$1 = min(map(g.nodes(), function(v) {
|
|
2459
|
+
return g.node(v).rank;
|
|
2460
|
+
}));
|
|
2461
|
+
forEach(g.nodes(), function(v) {
|
|
2462
|
+
var node = g.node(v);
|
|
2463
|
+
if (has(node, "rank")) node.rank -= min$1;
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
function removeEmptyRanks(g) {
|
|
2467
|
+
var offset = min(map(g.nodes(), function(v) {
|
|
2468
|
+
return g.node(v).rank;
|
|
2469
|
+
}));
|
|
2470
|
+
var layers = [];
|
|
2471
|
+
forEach(g.nodes(), function(v) {
|
|
2472
|
+
var rank = g.node(v).rank - offset;
|
|
2473
|
+
if (!layers[rank]) layers[rank] = [];
|
|
2474
|
+
layers[rank].push(v);
|
|
2475
|
+
});
|
|
2476
|
+
var delta = 0;
|
|
2477
|
+
var nodeRankFactor = g.graph().nodeRankFactor;
|
|
2478
|
+
forEach(layers, function(vs, i) {
|
|
2479
|
+
if (isUndefined(vs) && i % nodeRankFactor !== 0) --delta;
|
|
2480
|
+
else if (delta) forEach(vs, function(v) {
|
|
2481
|
+
g.node(v).rank += delta;
|
|
2482
|
+
});
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
function addBorderNode$1(g, prefix, rank, order) {
|
|
2486
|
+
var node = {
|
|
2487
|
+
width: 0,
|
|
2488
|
+
height: 0
|
|
2489
|
+
};
|
|
2490
|
+
if (arguments.length >= 4) {
|
|
2491
|
+
node.rank = rank;
|
|
2492
|
+
node.order = order;
|
|
2493
|
+
}
|
|
2494
|
+
return addDummyNode(g, "border", node, prefix);
|
|
2495
|
+
}
|
|
2496
|
+
function maxRank(g) {
|
|
2497
|
+
return max(map(g.nodes(), function(v) {
|
|
2498
|
+
var rank = g.node(v).rank;
|
|
2499
|
+
if (!isUndefined(rank)) return rank;
|
|
2500
|
+
}));
|
|
2501
|
+
}
|
|
2502
|
+
function partition(collection, fn) {
|
|
2503
|
+
var result = {
|
|
2504
|
+
lhs: [],
|
|
2505
|
+
rhs: []
|
|
2506
|
+
};
|
|
2507
|
+
forEach(collection, function(value) {
|
|
2508
|
+
if (fn(value)) result.lhs.push(value);
|
|
2509
|
+
else result.rhs.push(value);
|
|
2510
|
+
});
|
|
2511
|
+
return result;
|
|
2512
|
+
}
|
|
2513
|
+
function time(name, fn) {
|
|
2514
|
+
var start = now();
|
|
2515
|
+
try {
|
|
2516
|
+
return fn();
|
|
2517
|
+
} finally {
|
|
2518
|
+
console.log(name + " time: " + (now() - start) + "ms");
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
function notime(name, fn) {
|
|
2522
|
+
return fn();
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
//#endregion
|
|
2526
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/add-border-segments.js
|
|
2527
|
+
function addBorderSegments(g) {
|
|
2528
|
+
function dfs(v) {
|
|
2529
|
+
var children = g.children(v);
|
|
2530
|
+
var node = g.node(v);
|
|
2531
|
+
if (children.length) forEach(children, dfs);
|
|
2532
|
+
if (Object.prototype.hasOwnProperty.call(node, "minRank")) {
|
|
2533
|
+
node.borderLeft = [];
|
|
2534
|
+
node.borderRight = [];
|
|
2535
|
+
for (var rank = node.minRank, maxRank = node.maxRank + 1; rank < maxRank; ++rank) {
|
|
2536
|
+
addBorderNode(g, "borderLeft", "_bl", v, node, rank);
|
|
2537
|
+
addBorderNode(g, "borderRight", "_br", v, node, rank);
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
forEach(g.children(), dfs);
|
|
2542
|
+
}
|
|
2543
|
+
function addBorderNode(g, prop, prefix, sg, sgNode, rank) {
|
|
2544
|
+
var label = {
|
|
2545
|
+
width: 0,
|
|
2546
|
+
height: 0,
|
|
2547
|
+
rank,
|
|
2548
|
+
borderType: prop
|
|
2549
|
+
};
|
|
2550
|
+
var prev = sgNode[prop][rank - 1];
|
|
2551
|
+
var curr = addDummyNode(g, "border", label, prefix);
|
|
2552
|
+
sgNode[prop][rank] = curr;
|
|
2553
|
+
g.setParent(curr, sg);
|
|
2554
|
+
if (prev) g.setEdge(prev, curr, { weight: 1 });
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
//#endregion
|
|
2558
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/coordinate-system.js
|
|
2559
|
+
function adjust(g) {
|
|
2560
|
+
var rankDir = g.graph().rankdir.toLowerCase();
|
|
2561
|
+
if (rankDir === "lr" || rankDir === "rl") swapWidthHeight(g);
|
|
2562
|
+
}
|
|
2563
|
+
function undo$1(g) {
|
|
2564
|
+
var rankDir = g.graph().rankdir.toLowerCase();
|
|
2565
|
+
if (rankDir === "bt" || rankDir === "rl") reverseY(g);
|
|
2566
|
+
if (rankDir === "lr" || rankDir === "rl") {
|
|
2567
|
+
swapXY(g);
|
|
2568
|
+
swapWidthHeight(g);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
function swapWidthHeight(g) {
|
|
2572
|
+
forEach(g.nodes(), function(v) {
|
|
2573
|
+
swapWidthHeightOne(g.node(v));
|
|
2574
|
+
});
|
|
2575
|
+
forEach(g.edges(), function(e) {
|
|
2576
|
+
swapWidthHeightOne(g.edge(e));
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
function swapWidthHeightOne(attrs) {
|
|
2580
|
+
var w = attrs.width;
|
|
2581
|
+
attrs.width = attrs.height;
|
|
2582
|
+
attrs.height = w;
|
|
2583
|
+
}
|
|
2584
|
+
function reverseY(g) {
|
|
2585
|
+
forEach(g.nodes(), function(v) {
|
|
2586
|
+
reverseYOne(g.node(v));
|
|
2587
|
+
});
|
|
2588
|
+
forEach(g.edges(), function(e) {
|
|
2589
|
+
var edge = g.edge(e);
|
|
2590
|
+
forEach(edge.points, reverseYOne);
|
|
2591
|
+
if (Object.prototype.hasOwnProperty.call(edge, "y")) reverseYOne(edge);
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
function reverseYOne(attrs) {
|
|
2595
|
+
attrs.y = -attrs.y;
|
|
2596
|
+
}
|
|
2597
|
+
function swapXY(g) {
|
|
2598
|
+
forEach(g.nodes(), function(v) {
|
|
2599
|
+
swapXYOne(g.node(v));
|
|
2600
|
+
});
|
|
2601
|
+
forEach(g.edges(), function(e) {
|
|
2602
|
+
var edge = g.edge(e);
|
|
2603
|
+
forEach(edge.points, swapXYOne);
|
|
2604
|
+
if (Object.prototype.hasOwnProperty.call(edge, "x")) swapXYOne(edge);
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
function swapXYOne(attrs) {
|
|
2608
|
+
var x = attrs.x;
|
|
2609
|
+
attrs.x = attrs.y;
|
|
2610
|
+
attrs.y = x;
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
//#endregion
|
|
2614
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/normalize.js
|
|
2615
|
+
/**
|
|
2616
|
+
* TypeScript type imports:
|
|
2617
|
+
*
|
|
2618
|
+
* @import { Graph } from '../graphlib/graph.js';
|
|
2619
|
+
*/
|
|
2620
|
+
function run$1(g) {
|
|
2621
|
+
g.graph().dummyChains = [];
|
|
2622
|
+
forEach(g.edges(), function(edge) {
|
|
2623
|
+
normalizeEdge(g, edge);
|
|
2624
|
+
});
|
|
2625
|
+
}
|
|
2626
|
+
/**
|
|
2627
|
+
* @param {Graph} g
|
|
2628
|
+
*/
|
|
2629
|
+
function normalizeEdge(g, e) {
|
|
2630
|
+
var v = e.v;
|
|
2631
|
+
var vRank = g.node(v).rank;
|
|
2632
|
+
var w = e.w;
|
|
2633
|
+
var wRank = g.node(w).rank;
|
|
2634
|
+
var name = e.name;
|
|
2635
|
+
var edgeLabel = g.edge(e);
|
|
2636
|
+
var labelRank = edgeLabel.labelRank;
|
|
2637
|
+
if (wRank === vRank + 1) return;
|
|
2638
|
+
g.removeEdge(e);
|
|
2639
|
+
/**
|
|
2640
|
+
* @typedef {Object} Attrs
|
|
2641
|
+
* @property {number} width
|
|
2642
|
+
* @property {number} height
|
|
2643
|
+
* @property {ReturnType<Graph["node"]>} edgeLabel
|
|
2644
|
+
* @property {any} edgeObj
|
|
2645
|
+
* @property {ReturnType<Graph["node"]>["rank"]} rank
|
|
2646
|
+
* @property {string} [dummy]
|
|
2647
|
+
* @property {ReturnType<Graph["node"]>["labelpos"]} [labelpos]
|
|
2648
|
+
*/
|
|
2649
|
+
/** @type {Attrs | undefined} */
|
|
2650
|
+
var attrs = void 0;
|
|
2651
|
+
var dummy, i;
|
|
2652
|
+
for (i = 0, ++vRank; vRank < wRank; ++i, ++vRank) {
|
|
2653
|
+
edgeLabel.points = [];
|
|
2654
|
+
attrs = {
|
|
2655
|
+
width: 0,
|
|
2656
|
+
height: 0,
|
|
2657
|
+
edgeLabel,
|
|
2658
|
+
edgeObj: e,
|
|
2659
|
+
rank: vRank
|
|
2660
|
+
};
|
|
2661
|
+
dummy = addDummyNode(g, "edge", attrs, "_d");
|
|
2662
|
+
if (vRank === labelRank) {
|
|
2663
|
+
attrs.width = edgeLabel.width;
|
|
2664
|
+
attrs.height = edgeLabel.height;
|
|
2665
|
+
attrs.dummy = "edge-label";
|
|
2666
|
+
attrs.labelpos = edgeLabel.labelpos;
|
|
2667
|
+
}
|
|
2668
|
+
g.setEdge(v, dummy, { weight: edgeLabel.weight }, name);
|
|
2669
|
+
if (i === 0) g.graph().dummyChains.push(dummy);
|
|
2670
|
+
v = dummy;
|
|
2671
|
+
}
|
|
2672
|
+
g.setEdge(v, w, { weight: edgeLabel.weight }, name);
|
|
2673
|
+
}
|
|
2674
|
+
function undo(g) {
|
|
2675
|
+
forEach(g.graph().dummyChains, function(v) {
|
|
2676
|
+
var node = g.node(v);
|
|
2677
|
+
var origLabel = node.edgeLabel;
|
|
2678
|
+
var w;
|
|
2679
|
+
g.setEdge(node.edgeObj, origLabel);
|
|
2680
|
+
while (node.dummy) {
|
|
2681
|
+
w = g.successors(v)[0];
|
|
2682
|
+
g.removeNode(v);
|
|
2683
|
+
origLabel.points.push({
|
|
2684
|
+
x: node.x,
|
|
2685
|
+
y: node.y
|
|
2686
|
+
});
|
|
2687
|
+
if (node.dummy === "edge-label") {
|
|
2688
|
+
origLabel.x = node.x;
|
|
2689
|
+
origLabel.y = node.y;
|
|
2690
|
+
origLabel.width = node.width;
|
|
2691
|
+
origLabel.height = node.height;
|
|
2692
|
+
}
|
|
2693
|
+
v = w;
|
|
2694
|
+
node = g.node(v);
|
|
2695
|
+
}
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
//#endregion
|
|
2700
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/util.js
|
|
2701
|
+
function longestPath(g) {
|
|
2702
|
+
var visited = {};
|
|
2703
|
+
function dfs(v) {
|
|
2704
|
+
var label = g.node(v);
|
|
2705
|
+
if (Object.prototype.hasOwnProperty.call(visited, v)) return label.rank;
|
|
2706
|
+
visited[v] = true;
|
|
2707
|
+
var rank = min(map(g.outEdges(v), function(e) {
|
|
2708
|
+
return dfs(e.w) - g.edge(e).minlen;
|
|
2709
|
+
}));
|
|
2710
|
+
if (rank === Number.POSITIVE_INFINITY || rank === void 0 || rank === null) rank = 0;
|
|
2711
|
+
return label.rank = rank;
|
|
2712
|
+
}
|
|
2713
|
+
forEach(g.sources(), dfs);
|
|
2714
|
+
}
|
|
2715
|
+
function slack(g, e) {
|
|
2716
|
+
return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
//#endregion
|
|
2720
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/feasible-tree.js
|
|
2721
|
+
function feasibleTree(g) {
|
|
2722
|
+
var t = new Graph({ directed: false });
|
|
2723
|
+
var start = g.nodes()[0];
|
|
2724
|
+
var size = g.nodeCount();
|
|
2725
|
+
t.setNode(start, {});
|
|
2726
|
+
var edge, delta;
|
|
2727
|
+
while (tightTree(t, g) < size) {
|
|
2728
|
+
edge = findMinSlackEdge(t, g);
|
|
2729
|
+
delta = t.hasNode(edge.v) ? slack(g, edge) : -slack(g, edge);
|
|
2730
|
+
shiftRanks(t, g, delta);
|
|
2731
|
+
}
|
|
2732
|
+
return t;
|
|
2733
|
+
}
|
|
2734
|
+
function tightTree(t, g) {
|
|
2735
|
+
function dfs(v) {
|
|
2736
|
+
forEach(g.nodeEdges(v), function(e) {
|
|
2737
|
+
var edgeV = e.v, w = v === edgeV ? e.w : edgeV;
|
|
2738
|
+
if (!t.hasNode(w) && !slack(g, e)) {
|
|
2739
|
+
t.setNode(w, {});
|
|
2740
|
+
t.setEdge(v, w, {});
|
|
2741
|
+
dfs(w);
|
|
2742
|
+
}
|
|
2743
|
+
});
|
|
2744
|
+
}
|
|
2745
|
+
forEach(t.nodes(), dfs);
|
|
2746
|
+
return t.nodeCount();
|
|
2747
|
+
}
|
|
2748
|
+
function findMinSlackEdge(t, g) {
|
|
2749
|
+
return minBy(g.edges(), function(e) {
|
|
2750
|
+
if (t.hasNode(e.v) !== t.hasNode(e.w)) return slack(g, e);
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2753
|
+
function shiftRanks(t, g, delta) {
|
|
2754
|
+
forEach(t.nodes(), function(v) {
|
|
2755
|
+
g.node(v).rank += delta;
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
//#endregion
|
|
2760
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js
|
|
2761
|
+
var DEFAULT_WEIGHT_FUNC$1 = constant(1);
|
|
2762
|
+
|
|
2763
|
+
//#endregion
|
|
2764
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js
|
|
2765
|
+
var DEFAULT_WEIGHT_FUNC = constant(1);
|
|
2766
|
+
|
|
2767
|
+
//#endregion
|
|
2768
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/topsort.js
|
|
2769
|
+
topsort.CycleException = CycleException;
|
|
2770
|
+
/**
|
|
2771
|
+
* An implementation of [topological sorting](https://en.wikipedia.org/wiki/Topological_sorting).
|
|
2772
|
+
*
|
|
2773
|
+
* @remarks Takes `O(|V| + |E|)` time.
|
|
2774
|
+
*
|
|
2775
|
+
* @example
|
|
2776
|
+
*
|
|
2777
|
+
* 
|
|
2778
|
+
*
|
|
2779
|
+
* ```js
|
|
2780
|
+
* graphlib.alg.topsort(g)
|
|
2781
|
+
* // [ '1', '2', '3', '4' ] or [ '1', '3', '2', '4' ]
|
|
2782
|
+
* ```
|
|
2783
|
+
*
|
|
2784
|
+
* @param {Graph} g - The graph to sort.
|
|
2785
|
+
* @returns {NodeID[]} an array of nodes
|
|
2786
|
+
* such that for each edge `u -> v`, `u` appears before `v` in the array.
|
|
2787
|
+
* @throws {CycleException} If the graph has a cycle so that it is impossible
|
|
2788
|
+
* to generate a topological sort.
|
|
2789
|
+
*/
|
|
2790
|
+
function topsort(g) {
|
|
2791
|
+
/** @type {Record<NodeID, true>} */
|
|
2792
|
+
var visited = {};
|
|
2793
|
+
/** @type {Record<NodeID, true>} */
|
|
2794
|
+
var stack = {};
|
|
2795
|
+
/** @type {NodeID[]} */
|
|
2796
|
+
var results = [];
|
|
2797
|
+
/**
|
|
2798
|
+
* @param {NodeID} node - Node to recursively visit.
|
|
2799
|
+
*/
|
|
2800
|
+
function visit(node) {
|
|
2801
|
+
if (Object.prototype.hasOwnProperty.call(stack, node)) throw new CycleException();
|
|
2802
|
+
if (!Object.prototype.hasOwnProperty.call(visited, node)) {
|
|
2803
|
+
stack[node] = true;
|
|
2804
|
+
visited[node] = true;
|
|
2805
|
+
forEach(g.predecessors(node), visit);
|
|
2806
|
+
delete stack[node];
|
|
2807
|
+
results.push(node);
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
forEach(g.sinks(), visit);
|
|
2811
|
+
if (size(visited) !== g.nodeCount()) throw new CycleException();
|
|
2812
|
+
return results;
|
|
2813
|
+
}
|
|
2814
|
+
/**
|
|
2815
|
+
* @class
|
|
2816
|
+
*/
|
|
2817
|
+
function CycleException() {}
|
|
2818
|
+
CycleException.prototype = /* @__PURE__ */ new Error();
|
|
2819
|
+
|
|
2820
|
+
//#endregion
|
|
2821
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dfs.js
|
|
2822
|
+
/**
|
|
2823
|
+
* A helper that preforms a pre- or post-order traversal on the input graph
|
|
2824
|
+
* and returns the nodes in the order they were visited. If the graph is
|
|
2825
|
+
* undirected then this algorithm will navigate using neighbors. If the graph
|
|
2826
|
+
* is directed then this algorithm will navigate using successors.
|
|
2827
|
+
*
|
|
2828
|
+
* @param {Graph} g - Input graph.
|
|
2829
|
+
* @param {NodeID[] | NodeID} vs - Starting node or array of nodes.
|
|
2830
|
+
* @param {'post' | 'pre'} order - The order to use. Must be one of "pre" or "post".
|
|
2831
|
+
* @returns {NodeID[]} The nodes in the order they were visited.
|
|
2832
|
+
*/
|
|
2833
|
+
function dfs$1(g, vs, order) {
|
|
2834
|
+
if (!isArray(vs)) vs = [vs];
|
|
2835
|
+
/** @type {Parameters<typeof doDfs>[4]} */
|
|
2836
|
+
var navigation = (g.isDirected() ? g.successors : g.neighbors).bind(g);
|
|
2837
|
+
/** @type {Parameters<typeof doDfs>[5]} */
|
|
2838
|
+
var acc = [];
|
|
2839
|
+
/** @type {Parameters<typeof doDfs>[3]} */
|
|
2840
|
+
var visited = {};
|
|
2841
|
+
forEach(vs, function(v) {
|
|
2842
|
+
if (!g.hasNode(v)) throw new Error("Graph does not have node: " + v);
|
|
2843
|
+
doDfs(g, v, order === "post", visited, navigation, acc);
|
|
2844
|
+
});
|
|
2845
|
+
return acc;
|
|
2846
|
+
}
|
|
2847
|
+
/**
|
|
2848
|
+
* @param {Graph} g - Input graph.
|
|
2849
|
+
* @param {NodeID} v - The node to visit.
|
|
2850
|
+
* @param {boolean} postorder - Whether to do postorder traversal.
|
|
2851
|
+
* @param {Record<NodeID, true>} visited - Visited nodes.
|
|
2852
|
+
* @param {(node: NodeID) => (NodeID[] | undefined)} navigation - Function to get
|
|
2853
|
+
* neighbors/successors.
|
|
2854
|
+
* @param {NodeID[]} acc - Accumulator for visited nodes.
|
|
2855
|
+
*/
|
|
2856
|
+
function doDfs(g, v, postorder, visited, navigation, acc) {
|
|
2857
|
+
if (!Object.prototype.hasOwnProperty.call(visited, v)) {
|
|
2858
|
+
visited[v] = true;
|
|
2859
|
+
if (!postorder) acc.push(v);
|
|
2860
|
+
forEach(navigation(v), function(w) {
|
|
2861
|
+
doDfs(g, w, postorder, visited, navigation, acc);
|
|
2862
|
+
});
|
|
2863
|
+
if (postorder) acc.push(v);
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
//#endregion
|
|
2868
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/postorder.js
|
|
2869
|
+
/**
|
|
2870
|
+
* This function performs a [postorder traversal][] of the graph `g` starting
|
|
2871
|
+
* at the nodes `vs`. For each node visited, `v`, the function `callback(v)`
|
|
2872
|
+
* is called.
|
|
2873
|
+
*
|
|
2874
|
+
* [postorder traversal]: https://en.wikipedia.org/wiki/Tree_traversal#Depth-first
|
|
2875
|
+
*
|
|
2876
|
+
* @example
|
|
2877
|
+
*
|
|
2878
|
+
* 
|
|
2879
|
+
*
|
|
2880
|
+
* ```js
|
|
2881
|
+
* graphlib.alg.postorder(g, "A");
|
|
2882
|
+
* // => One of:
|
|
2883
|
+
* // [ "B", "D", "E", C", "A" ]
|
|
2884
|
+
* // [ "B", "E", "D", C", "A" ]
|
|
2885
|
+
* // [ "D", "E", "C", B", "A" ]
|
|
2886
|
+
* // [ "E", "D", "C", B", "A" ]
|
|
2887
|
+
* ```
|
|
2888
|
+
*
|
|
2889
|
+
* @param {Parameters<typeof dfs>[0]} g - The graph to traverse.
|
|
2890
|
+
* @param {Parameters<typeof dfs>[1]} vs - Nodes to start the traversal from.
|
|
2891
|
+
* @returns {ReturnType<typeof dfs>} The nodes in the order they were visited.
|
|
2892
|
+
*/
|
|
2893
|
+
function postorder$1(g, vs) {
|
|
2894
|
+
return dfs$1(g, vs, "post");
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
//#endregion
|
|
2898
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/preorder.js
|
|
2899
|
+
/**
|
|
2900
|
+
* This function performs a [preorder traversal][] of the graph `g` starting
|
|
2901
|
+
* at the nodes `vs`. For each node visited, `v`, the function `callback(v)`
|
|
2902
|
+
* is called.
|
|
2903
|
+
*
|
|
2904
|
+
* [preorder traversal]: https://en.wikipedia.org/wiki/Tree_traversal#Depth-first
|
|
2905
|
+
*
|
|
2906
|
+
* @example
|
|
2907
|
+
*
|
|
2908
|
+
* 
|
|
2909
|
+
* <!-- SOURCE:
|
|
2910
|
+
* http://dagrejs.github.io/project/dagre-d3/latest/demo/interactive-demo.html?graph=digraph%20%7B%0Anode%20%5Bshape%3Dcircle%2C%20style%3D%22fill%3Awhite%3Bstroke%3A%23333%3Bstroke-width%3A1.5px%22%5D%0Aedge%20%5Blabeloffset%3D2%20labelpos%3Dr%5D%0Arankdir%3Dlr%0A%20%20A%20-%3E%20B%0A%20%20A%20-%3E%20C%0A%20%20C%20-%3E%20D%0A%20%20C%20-%3E%20E%0A%7D
|
|
2911
|
+
* -->
|
|
2912
|
+
*
|
|
2913
|
+
* ```js
|
|
2914
|
+
* graphlib.alg.preorder(g, "A");
|
|
2915
|
+
* // => One of:
|
|
2916
|
+
* // [ "A", "B", "C", "D", "E" ]
|
|
2917
|
+
* // [ "A", "B", "C", "E", "D" ]
|
|
2918
|
+
* // [ "A", "C", "D", "E", "B" ]
|
|
2919
|
+
* // [ "A", "C", "E", "D", "B" ]
|
|
2920
|
+
* ```
|
|
2921
|
+
*
|
|
2922
|
+
* @param {Parameters<typeof dfs>[0]} g - The graph to traverse.
|
|
2923
|
+
* @param {Parameters<typeof dfs>[1]} vs - Nodes to start the traversal from.
|
|
2924
|
+
* @returns {ReturnType<typeof dfs>} The nodes in the order they were visited.
|
|
2925
|
+
*/
|
|
2926
|
+
function preorder(g, vs) {
|
|
2927
|
+
return dfs$1(g, vs, "pre");
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
//#endregion
|
|
2931
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js
|
|
2932
|
+
networkSimplex.initLowLimValues = initLowLimValues;
|
|
2933
|
+
networkSimplex.initCutValues = initCutValues;
|
|
2934
|
+
networkSimplex.calcCutValue = calcCutValue;
|
|
2935
|
+
networkSimplex.leaveEdge = leaveEdge;
|
|
2936
|
+
networkSimplex.enterEdge = enterEdge;
|
|
2937
|
+
networkSimplex.exchangeEdges = exchangeEdges;
|
|
2938
|
+
function networkSimplex(g) {
|
|
2939
|
+
g = simplify(g);
|
|
2940
|
+
longestPath(g);
|
|
2941
|
+
var t = feasibleTree(g);
|
|
2942
|
+
initLowLimValues(t);
|
|
2943
|
+
initCutValues(t, g);
|
|
2944
|
+
var e, f;
|
|
2945
|
+
while (e = leaveEdge(t)) {
|
|
2946
|
+
f = enterEdge(t, g, e);
|
|
2947
|
+
exchangeEdges(t, g, e, f);
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
function initCutValues(t, g) {
|
|
2951
|
+
var vs = postorder$1(t, t.nodes());
|
|
2952
|
+
vs = vs.slice(0, vs.length - 1);
|
|
2953
|
+
forEach(vs, function(v) {
|
|
2954
|
+
assignCutValue(t, g, v);
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2957
|
+
function assignCutValue(t, g, child) {
|
|
2958
|
+
var parent = t.node(child).parent;
|
|
2959
|
+
t.edge(child, parent).cutvalue = calcCutValue(t, g, child);
|
|
2960
|
+
}
|
|
2961
|
+
function calcCutValue(t, g, child) {
|
|
2962
|
+
var parent = t.node(child).parent;
|
|
2963
|
+
var childIsTail = true;
|
|
2964
|
+
var graphEdge = g.edge(child, parent);
|
|
2965
|
+
var cutValue = 0;
|
|
2966
|
+
if (!graphEdge) {
|
|
2967
|
+
childIsTail = false;
|
|
2968
|
+
graphEdge = g.edge(parent, child);
|
|
2969
|
+
}
|
|
2970
|
+
cutValue = graphEdge.weight;
|
|
2971
|
+
forEach(g.nodeEdges(child), function(e) {
|
|
2972
|
+
var isOutEdge = e.v === child, other = isOutEdge ? e.w : e.v;
|
|
2973
|
+
if (other !== parent) {
|
|
2974
|
+
var pointsToHead = isOutEdge === childIsTail, otherWeight = g.edge(e).weight;
|
|
2975
|
+
cutValue += pointsToHead ? otherWeight : -otherWeight;
|
|
2976
|
+
if (isTreeEdge(t, child, other)) {
|
|
2977
|
+
var otherCutValue = t.edge(child, other).cutvalue;
|
|
2978
|
+
cutValue += pointsToHead ? -otherCutValue : otherCutValue;
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
});
|
|
2982
|
+
return cutValue;
|
|
2983
|
+
}
|
|
2984
|
+
function initLowLimValues(tree, root) {
|
|
2985
|
+
if (arguments.length < 2) root = tree.nodes()[0];
|
|
2986
|
+
dfsAssignLowLim(tree, {}, 1, root);
|
|
2987
|
+
}
|
|
2988
|
+
function dfsAssignLowLim(tree, visited, nextLim, v, parent) {
|
|
2989
|
+
var low = nextLim;
|
|
2990
|
+
var label = tree.node(v);
|
|
2991
|
+
visited[v] = true;
|
|
2992
|
+
forEach(tree.neighbors(v), function(w) {
|
|
2993
|
+
if (!Object.prototype.hasOwnProperty.call(visited, w)) nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);
|
|
2994
|
+
});
|
|
2995
|
+
label.low = low;
|
|
2996
|
+
label.lim = nextLim++;
|
|
2997
|
+
if (parent) label.parent = parent;
|
|
2998
|
+
else delete label.parent;
|
|
2999
|
+
return nextLim;
|
|
3000
|
+
}
|
|
3001
|
+
function leaveEdge(tree) {
|
|
3002
|
+
return find(tree.edges(), function(e) {
|
|
3003
|
+
return tree.edge(e).cutvalue < 0;
|
|
3004
|
+
});
|
|
3005
|
+
}
|
|
3006
|
+
function enterEdge(t, g, edge) {
|
|
3007
|
+
var v = edge.v;
|
|
3008
|
+
var w = edge.w;
|
|
3009
|
+
if (!g.hasEdge(v, w)) {
|
|
3010
|
+
v = edge.w;
|
|
3011
|
+
w = edge.v;
|
|
3012
|
+
}
|
|
3013
|
+
var vLabel = t.node(v);
|
|
3014
|
+
var wLabel = t.node(w);
|
|
3015
|
+
var tailLabel = vLabel;
|
|
3016
|
+
var flip = false;
|
|
3017
|
+
if (vLabel.lim > wLabel.lim) {
|
|
3018
|
+
tailLabel = wLabel;
|
|
3019
|
+
flip = true;
|
|
3020
|
+
}
|
|
3021
|
+
var candidates = filter(g.edges(), function(edge) {
|
|
3022
|
+
return flip === isDescendant(t, t.node(edge.v), tailLabel) && flip !== isDescendant(t, t.node(edge.w), tailLabel);
|
|
3023
|
+
});
|
|
3024
|
+
return minBy(candidates, function(edge) {
|
|
3025
|
+
return slack(g, edge);
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
function exchangeEdges(t, g, e, f) {
|
|
3029
|
+
var v = e.v;
|
|
3030
|
+
var w = e.w;
|
|
3031
|
+
t.removeEdge(v, w);
|
|
3032
|
+
t.setEdge(f.v, f.w, {});
|
|
3033
|
+
initLowLimValues(t);
|
|
3034
|
+
initCutValues(t, g);
|
|
3035
|
+
updateRanks(t, g);
|
|
3036
|
+
}
|
|
3037
|
+
function updateRanks(t, g) {
|
|
3038
|
+
var root = find(t.nodes(), function(v) {
|
|
3039
|
+
return !g.node(v).parent;
|
|
3040
|
+
});
|
|
3041
|
+
var vs = preorder(t, root);
|
|
3042
|
+
vs = vs.slice(1);
|
|
3043
|
+
forEach(vs, function(v) {
|
|
3044
|
+
var parent = t.node(v).parent, edge = g.edge(v, parent), flipped = false;
|
|
3045
|
+
if (!edge) {
|
|
3046
|
+
edge = g.edge(parent, v);
|
|
3047
|
+
flipped = true;
|
|
3048
|
+
}
|
|
3049
|
+
g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen);
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3052
|
+
function isTreeEdge(tree, u, v) {
|
|
3053
|
+
return tree.hasEdge(u, v);
|
|
3054
|
+
}
|
|
3055
|
+
function isDescendant(tree, vLabel, rootLabel) {
|
|
3056
|
+
return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
//#endregion
|
|
3060
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/index.js
|
|
3061
|
+
function rank(g) {
|
|
3062
|
+
switch (g.graph().ranker) {
|
|
3063
|
+
case "network-simplex":
|
|
3064
|
+
networkSimplexRanker(g);
|
|
3065
|
+
break;
|
|
3066
|
+
case "tight-tree":
|
|
3067
|
+
tightTreeRanker(g);
|
|
3068
|
+
break;
|
|
3069
|
+
case "longest-path":
|
|
3070
|
+
longestPathRanker(g);
|
|
3071
|
+
break;
|
|
3072
|
+
default: networkSimplexRanker(g);
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
var longestPathRanker = longestPath;
|
|
3076
|
+
function tightTreeRanker(g) {
|
|
3077
|
+
longestPath(g);
|
|
3078
|
+
feasibleTree(g);
|
|
3079
|
+
}
|
|
3080
|
+
function networkSimplexRanker(g) {
|
|
3081
|
+
networkSimplex(g);
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
//#endregion
|
|
3085
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/nesting-graph.js
|
|
3086
|
+
function run(g) {
|
|
3087
|
+
var root = addDummyNode(g, "root", {}, "_root");
|
|
3088
|
+
var depths = treeDepths(g);
|
|
3089
|
+
var height = max(values(depths)) - 1;
|
|
3090
|
+
var nodeSep = 2 * height + 1;
|
|
3091
|
+
g.graph().nestingRoot = root;
|
|
3092
|
+
forEach(g.edges(), function(e) {
|
|
3093
|
+
g.edge(e).minlen *= nodeSep;
|
|
3094
|
+
});
|
|
3095
|
+
var weight = sumWeights(g) + 1;
|
|
3096
|
+
forEach(g.children(), function(child) {
|
|
3097
|
+
dfs(g, root, nodeSep, weight, height, depths, child);
|
|
3098
|
+
});
|
|
3099
|
+
g.graph().nodeRankFactor = nodeSep;
|
|
3100
|
+
}
|
|
3101
|
+
function dfs(g, root, nodeSep, weight, height, depths, v) {
|
|
3102
|
+
var children = g.children(v);
|
|
3103
|
+
if (!children.length) {
|
|
3104
|
+
if (v !== root) g.setEdge(root, v, {
|
|
3105
|
+
weight: 0,
|
|
3106
|
+
minlen: nodeSep
|
|
3107
|
+
});
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
var top = addBorderNode$1(g, "_bt");
|
|
3111
|
+
var bottom = addBorderNode$1(g, "_bb");
|
|
3112
|
+
var label = g.node(v);
|
|
3113
|
+
g.setParent(top, v);
|
|
3114
|
+
label.borderTop = top;
|
|
3115
|
+
g.setParent(bottom, v);
|
|
3116
|
+
label.borderBottom = bottom;
|
|
3117
|
+
forEach(children, function(child) {
|
|
3118
|
+
dfs(g, root, nodeSep, weight, height, depths, child);
|
|
3119
|
+
var childNode = g.node(child);
|
|
3120
|
+
var childTop = childNode.borderTop ? childNode.borderTop : child;
|
|
3121
|
+
var childBottom = childNode.borderBottom ? childNode.borderBottom : child;
|
|
3122
|
+
var thisWeight = childNode.borderTop ? weight : 2 * weight;
|
|
3123
|
+
var minlen = childTop !== childBottom ? 1 : height - depths[v] + 1;
|
|
3124
|
+
g.setEdge(top, childTop, {
|
|
3125
|
+
weight: thisWeight,
|
|
3126
|
+
minlen,
|
|
3127
|
+
nestingEdge: true
|
|
3128
|
+
});
|
|
3129
|
+
g.setEdge(childBottom, bottom, {
|
|
3130
|
+
weight: thisWeight,
|
|
3131
|
+
minlen,
|
|
3132
|
+
nestingEdge: true
|
|
3133
|
+
});
|
|
3134
|
+
});
|
|
3135
|
+
if (!g.parent(v)) g.setEdge(root, top, {
|
|
3136
|
+
weight: 0,
|
|
3137
|
+
minlen: height + depths[v]
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
function treeDepths(g) {
|
|
3141
|
+
var depths = {};
|
|
3142
|
+
function dfs(v, depth) {
|
|
3143
|
+
var children = g.children(v);
|
|
3144
|
+
if (children && children.length) forEach(children, function(child) {
|
|
3145
|
+
dfs(child, depth + 1);
|
|
3146
|
+
});
|
|
3147
|
+
depths[v] = depth;
|
|
3148
|
+
}
|
|
3149
|
+
forEach(g.children(), function(v) {
|
|
3150
|
+
dfs(v, 1);
|
|
3151
|
+
});
|
|
3152
|
+
return depths;
|
|
3153
|
+
}
|
|
3154
|
+
function sumWeights(g) {
|
|
3155
|
+
return reduce(g.edges(), function(acc, e) {
|
|
3156
|
+
return acc + g.edge(e).weight;
|
|
3157
|
+
}, 0);
|
|
3158
|
+
}
|
|
3159
|
+
function cleanup(g) {
|
|
3160
|
+
var graphLabel = g.graph();
|
|
3161
|
+
g.removeNode(graphLabel.nestingRoot);
|
|
3162
|
+
delete graphLabel.nestingRoot;
|
|
3163
|
+
forEach(g.edges(), function(e) {
|
|
3164
|
+
if (g.edge(e).nestingEdge) g.removeEdge(e);
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
//#endregion
|
|
3169
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/add-subgraph-constraints.js
|
|
3170
|
+
function addSubgraphConstraints(g, cg, vs) {
|
|
3171
|
+
var prev = {}, rootPrev;
|
|
3172
|
+
forEach(vs, function(v) {
|
|
3173
|
+
var child = g.parent(v), parent, prevChild;
|
|
3174
|
+
while (child) {
|
|
3175
|
+
parent = g.parent(child);
|
|
3176
|
+
if (parent) {
|
|
3177
|
+
prevChild = prev[parent];
|
|
3178
|
+
prev[parent] = child;
|
|
3179
|
+
} else {
|
|
3180
|
+
prevChild = rootPrev;
|
|
3181
|
+
rootPrev = child;
|
|
3182
|
+
}
|
|
3183
|
+
if (prevChild && prevChild !== child) {
|
|
3184
|
+
cg.setEdge(prevChild, child);
|
|
3185
|
+
return;
|
|
3186
|
+
}
|
|
3187
|
+
child = parent;
|
|
3188
|
+
}
|
|
3189
|
+
});
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
//#endregion
|
|
3193
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/build-layer-graph.js
|
|
3194
|
+
function buildLayerGraph(g, rank, relationship) {
|
|
3195
|
+
var root = createRootNode(g), result = new Graph({ compound: true }).setGraph({ root }).setDefaultNodeLabel(function(v) {
|
|
3196
|
+
return g.node(v);
|
|
3197
|
+
});
|
|
3198
|
+
forEach(g.nodes(), function(v) {
|
|
3199
|
+
var node = g.node(v), parent = g.parent(v);
|
|
3200
|
+
if (node.rank === rank || node.minRank <= rank && rank <= node.maxRank) {
|
|
3201
|
+
result.setNode(v);
|
|
3202
|
+
result.setParent(v, parent || root);
|
|
3203
|
+
forEach(g[relationship](v), function(e) {
|
|
3204
|
+
var u = e.v === v ? e.w : e.v, edge = result.edge(u, v), weight = !isUndefined(edge) ? edge.weight : 0;
|
|
3205
|
+
result.setEdge(u, v, { weight: g.edge(e).weight + weight });
|
|
3206
|
+
});
|
|
3207
|
+
if (Object.prototype.hasOwnProperty.call(node, "minRank")) result.setNode(v, {
|
|
3208
|
+
borderLeft: node.borderLeft[rank],
|
|
3209
|
+
borderRight: node.borderRight[rank]
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
});
|
|
3213
|
+
return result;
|
|
3214
|
+
}
|
|
3215
|
+
function createRootNode(g) {
|
|
3216
|
+
var v;
|
|
3217
|
+
while (g.hasNode(v = uniqueId("_root")));
|
|
3218
|
+
return v;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
//#endregion
|
|
3222
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/cross-count.js
|
|
3223
|
+
function crossCount(g, layering) {
|
|
3224
|
+
var cc = 0;
|
|
3225
|
+
for (var i = 1; i < layering.length; ++i) cc += twoLayerCrossCount(g, layering[i - 1], layering[i]);
|
|
3226
|
+
return cc;
|
|
3227
|
+
}
|
|
3228
|
+
function twoLayerCrossCount(g, northLayer, southLayer) {
|
|
3229
|
+
var southPos = zipObject(southLayer, map(southLayer, function(v, i) {
|
|
3230
|
+
return i;
|
|
3231
|
+
}));
|
|
3232
|
+
var southEntries = flatten(map(northLayer, function(v) {
|
|
3233
|
+
return sortBy(map(g.outEdges(v), function(e) {
|
|
3234
|
+
return {
|
|
3235
|
+
pos: southPos[e.w],
|
|
3236
|
+
weight: g.edge(e).weight
|
|
3237
|
+
};
|
|
3238
|
+
}), "pos");
|
|
3239
|
+
}));
|
|
3240
|
+
var firstIndex = 1;
|
|
3241
|
+
while (firstIndex < southLayer.length) firstIndex <<= 1;
|
|
3242
|
+
var treeSize = 2 * firstIndex - 1;
|
|
3243
|
+
firstIndex -= 1;
|
|
3244
|
+
var tree = map(new Array(treeSize), function() {
|
|
3245
|
+
return 0;
|
|
3246
|
+
});
|
|
3247
|
+
var cc = 0;
|
|
3248
|
+
forEach(southEntries.forEach(function(entry) {
|
|
3249
|
+
var index = entry.pos + firstIndex;
|
|
3250
|
+
tree[index] += entry.weight;
|
|
3251
|
+
var weightSum = 0;
|
|
3252
|
+
while (index > 0) {
|
|
3253
|
+
if (index % 2) weightSum += tree[index + 1];
|
|
3254
|
+
index = index - 1 >> 1;
|
|
3255
|
+
tree[index] += entry.weight;
|
|
3256
|
+
}
|
|
3257
|
+
cc += entry.weight * weightSum;
|
|
3258
|
+
}));
|
|
3259
|
+
return cc;
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
//#endregion
|
|
3263
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/init-order.js
|
|
3264
|
+
function initOrder(g) {
|
|
3265
|
+
var visited = {};
|
|
3266
|
+
var simpleNodes = filter(g.nodes(), function(v) {
|
|
3267
|
+
return !g.children(v).length;
|
|
3268
|
+
});
|
|
3269
|
+
var maxRank = max(map(simpleNodes, function(v) {
|
|
3270
|
+
return g.node(v).rank;
|
|
3271
|
+
}));
|
|
3272
|
+
var layers = map(range(maxRank + 1), function() {
|
|
3273
|
+
return [];
|
|
3274
|
+
});
|
|
3275
|
+
function dfs(v) {
|
|
3276
|
+
if (has(visited, v)) return;
|
|
3277
|
+
visited[v] = true;
|
|
3278
|
+
layers[g.node(v).rank].push(v);
|
|
3279
|
+
forEach(g.successors(v), dfs);
|
|
3280
|
+
}
|
|
3281
|
+
var orderedVs = sortBy(simpleNodes, function(v) {
|
|
3282
|
+
return g.node(v).rank;
|
|
3283
|
+
});
|
|
3284
|
+
forEach(orderedVs, dfs);
|
|
3285
|
+
return layers;
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
//#endregion
|
|
3289
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/barycenter.js
|
|
3290
|
+
function barycenter(g, movable) {
|
|
3291
|
+
return map(movable, function(v) {
|
|
3292
|
+
var inV = g.inEdges(v);
|
|
3293
|
+
if (!inV.length) return { v };
|
|
3294
|
+
else {
|
|
3295
|
+
var result = reduce(inV, function(acc, e) {
|
|
3296
|
+
var edge = g.edge(e), nodeU = g.node(e.v);
|
|
3297
|
+
return {
|
|
3298
|
+
sum: acc.sum + edge.weight * nodeU.order,
|
|
3299
|
+
weight: acc.weight + edge.weight
|
|
3300
|
+
};
|
|
3301
|
+
}, {
|
|
3302
|
+
sum: 0,
|
|
3303
|
+
weight: 0
|
|
3304
|
+
});
|
|
3305
|
+
return {
|
|
3306
|
+
v,
|
|
3307
|
+
barycenter: result.sum / result.weight,
|
|
3308
|
+
weight: result.weight
|
|
3309
|
+
};
|
|
3310
|
+
}
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
|
|
3314
|
+
//#endregion
|
|
3315
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js
|
|
3316
|
+
function resolveConflicts(entries, cg) {
|
|
3317
|
+
var mappedEntries = {};
|
|
3318
|
+
forEach(entries, function(entry, i) {
|
|
3319
|
+
var tmp = mappedEntries[entry.v] = {
|
|
3320
|
+
indegree: 0,
|
|
3321
|
+
in: [],
|
|
3322
|
+
out: [],
|
|
3323
|
+
vs: [entry.v],
|
|
3324
|
+
i
|
|
3325
|
+
};
|
|
3326
|
+
if (!isUndefined(entry.barycenter)) {
|
|
3327
|
+
tmp.barycenter = entry.barycenter;
|
|
3328
|
+
tmp.weight = entry.weight;
|
|
3329
|
+
}
|
|
3330
|
+
});
|
|
3331
|
+
forEach(cg.edges(), function(e) {
|
|
3332
|
+
var entryV = mappedEntries[e.v];
|
|
3333
|
+
var entryW = mappedEntries[e.w];
|
|
3334
|
+
if (!isUndefined(entryV) && !isUndefined(entryW)) {
|
|
3335
|
+
entryW.indegree++;
|
|
3336
|
+
entryV.out.push(mappedEntries[e.w]);
|
|
3337
|
+
}
|
|
3338
|
+
});
|
|
3339
|
+
return doResolveConflicts(filter(mappedEntries, function(entry) {
|
|
3340
|
+
return !entry.indegree;
|
|
3341
|
+
}));
|
|
3342
|
+
}
|
|
3343
|
+
function doResolveConflicts(sourceSet) {
|
|
3344
|
+
var entries = [];
|
|
3345
|
+
function handleIn(vEntry) {
|
|
3346
|
+
return function(uEntry) {
|
|
3347
|
+
if (uEntry.merged) return;
|
|
3348
|
+
if (isUndefined(uEntry.barycenter) || isUndefined(vEntry.barycenter) || uEntry.barycenter >= vEntry.barycenter) mergeEntries(vEntry, uEntry);
|
|
3349
|
+
};
|
|
3350
|
+
}
|
|
3351
|
+
function handleOut(vEntry) {
|
|
3352
|
+
return function(wEntry) {
|
|
3353
|
+
wEntry["in"].push(vEntry);
|
|
3354
|
+
if (--wEntry.indegree === 0) sourceSet.push(wEntry);
|
|
3355
|
+
};
|
|
3356
|
+
}
|
|
3357
|
+
while (sourceSet.length) {
|
|
3358
|
+
var entry = sourceSet.pop();
|
|
3359
|
+
entries.push(entry);
|
|
3360
|
+
forEach(entry["in"].reverse(), handleIn(entry));
|
|
3361
|
+
forEach(entry.out, handleOut(entry));
|
|
3362
|
+
}
|
|
3363
|
+
return map(filter(entries, function(entry) {
|
|
3364
|
+
return !entry.merged;
|
|
3365
|
+
}), function(entry) {
|
|
3366
|
+
return pick(entry, [
|
|
3367
|
+
"vs",
|
|
3368
|
+
"i",
|
|
3369
|
+
"barycenter",
|
|
3370
|
+
"weight"
|
|
3371
|
+
]);
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
function mergeEntries(target, source) {
|
|
3375
|
+
var sum = 0;
|
|
3376
|
+
var weight = 0;
|
|
3377
|
+
if (target.weight) {
|
|
3378
|
+
sum += target.barycenter * target.weight;
|
|
3379
|
+
weight += target.weight;
|
|
3380
|
+
}
|
|
3381
|
+
if (source.weight) {
|
|
3382
|
+
sum += source.barycenter * source.weight;
|
|
3383
|
+
weight += source.weight;
|
|
3384
|
+
}
|
|
3385
|
+
target.vs = source.vs.concat(target.vs);
|
|
3386
|
+
target.barycenter = sum / weight;
|
|
3387
|
+
target.weight = weight;
|
|
3388
|
+
target.i = Math.min(source.i, target.i);
|
|
3389
|
+
source.merged = true;
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3392
|
+
//#endregion
|
|
3393
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort.js
|
|
3394
|
+
function sort(entries, biasRight) {
|
|
3395
|
+
var parts = partition(entries, function(entry) {
|
|
3396
|
+
return Object.prototype.hasOwnProperty.call(entry, "barycenter");
|
|
3397
|
+
});
|
|
3398
|
+
var sortable = parts.lhs, unsortable = sortBy(parts.rhs, function(entry) {
|
|
3399
|
+
return -entry.i;
|
|
3400
|
+
}), vs = [], sum = 0, weight = 0, vsIndex = 0;
|
|
3401
|
+
sortable.sort(compareWithBias(!!biasRight));
|
|
3402
|
+
vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
|
|
3403
|
+
forEach(sortable, function(entry) {
|
|
3404
|
+
vsIndex += entry.vs.length;
|
|
3405
|
+
vs.push(entry.vs);
|
|
3406
|
+
sum += entry.barycenter * entry.weight;
|
|
3407
|
+
weight += entry.weight;
|
|
3408
|
+
vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
|
|
3409
|
+
});
|
|
3410
|
+
var result = { vs: flatten(vs) };
|
|
3411
|
+
if (weight) {
|
|
3412
|
+
result.barycenter = sum / weight;
|
|
3413
|
+
result.weight = weight;
|
|
3414
|
+
}
|
|
3415
|
+
return result;
|
|
3416
|
+
}
|
|
3417
|
+
function consumeUnsortable(vs, unsortable, index) {
|
|
3418
|
+
var last$1;
|
|
3419
|
+
while (unsortable.length && (last$1 = last(unsortable)).i <= index) {
|
|
3420
|
+
unsortable.pop();
|
|
3421
|
+
vs.push(last$1.vs);
|
|
3422
|
+
index++;
|
|
3423
|
+
}
|
|
3424
|
+
return index;
|
|
3425
|
+
}
|
|
3426
|
+
function compareWithBias(bias) {
|
|
3427
|
+
return function(entryV, entryW) {
|
|
3428
|
+
if (entryV.barycenter < entryW.barycenter) return -1;
|
|
3429
|
+
else if (entryV.barycenter > entryW.barycenter) return 1;
|
|
3430
|
+
return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;
|
|
3431
|
+
};
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3434
|
+
//#endregion
|
|
3435
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js
|
|
3436
|
+
function sortSubgraph(g, v, cg, biasRight) {
|
|
3437
|
+
var movable = g.children(v);
|
|
3438
|
+
var node = g.node(v);
|
|
3439
|
+
var bl = node ? node.borderLeft : void 0;
|
|
3440
|
+
var br = node ? node.borderRight : void 0;
|
|
3441
|
+
var subgraphs = {};
|
|
3442
|
+
if (bl) movable = filter(movable, function(w) {
|
|
3443
|
+
return w !== bl && w !== br;
|
|
3444
|
+
});
|
|
3445
|
+
var barycenters = barycenter(g, movable);
|
|
3446
|
+
forEach(barycenters, function(entry) {
|
|
3447
|
+
if (g.children(entry.v).length) {
|
|
3448
|
+
var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight);
|
|
3449
|
+
subgraphs[entry.v] = subgraphResult;
|
|
3450
|
+
if (Object.prototype.hasOwnProperty.call(subgraphResult, "barycenter")) mergeBarycenters(entry, subgraphResult);
|
|
3451
|
+
}
|
|
3452
|
+
});
|
|
3453
|
+
var entries = resolveConflicts(barycenters, cg);
|
|
3454
|
+
expandSubgraphs(entries, subgraphs);
|
|
3455
|
+
var result = sort(entries, biasRight);
|
|
3456
|
+
if (bl) {
|
|
3457
|
+
result.vs = flatten([
|
|
3458
|
+
bl,
|
|
3459
|
+
result.vs,
|
|
3460
|
+
br
|
|
3461
|
+
]);
|
|
3462
|
+
if (g.predecessors(bl).length) {
|
|
3463
|
+
var blPred = g.node(g.predecessors(bl)[0]), brPred = g.node(g.predecessors(br)[0]);
|
|
3464
|
+
if (!Object.prototype.hasOwnProperty.call(result, "barycenter")) {
|
|
3465
|
+
result.barycenter = 0;
|
|
3466
|
+
result.weight = 0;
|
|
3467
|
+
}
|
|
3468
|
+
result.barycenter = (result.barycenter * result.weight + blPred.order + brPred.order) / (result.weight + 2);
|
|
3469
|
+
result.weight += 2;
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
return result;
|
|
3473
|
+
}
|
|
3474
|
+
function expandSubgraphs(entries, subgraphs) {
|
|
3475
|
+
forEach(entries, function(entry) {
|
|
3476
|
+
entry.vs = flatten(entry.vs.map(function(v) {
|
|
3477
|
+
if (subgraphs[v]) return subgraphs[v].vs;
|
|
3478
|
+
return v;
|
|
3479
|
+
}));
|
|
3480
|
+
});
|
|
3481
|
+
}
|
|
3482
|
+
function mergeBarycenters(target, other) {
|
|
3483
|
+
if (!isUndefined(target.barycenter)) {
|
|
3484
|
+
target.barycenter = (target.barycenter * target.weight + other.barycenter * other.weight) / (target.weight + other.weight);
|
|
3485
|
+
target.weight += other.weight;
|
|
3486
|
+
} else {
|
|
3487
|
+
target.barycenter = other.barycenter;
|
|
3488
|
+
target.weight = other.weight;
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
|
|
3492
|
+
//#endregion
|
|
3493
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/index.js
|
|
3494
|
+
function order(g) {
|
|
3495
|
+
var maxRank$1 = maxRank(g), downLayerGraphs = buildLayerGraphs(g, range(1, maxRank$1 + 1), "inEdges"), upLayerGraphs = buildLayerGraphs(g, range(maxRank$1 - 1, -1, -1), "outEdges");
|
|
3496
|
+
var layering = initOrder(g);
|
|
3497
|
+
assignOrder(g, layering);
|
|
3498
|
+
var bestCC = Number.POSITIVE_INFINITY, best;
|
|
3499
|
+
for (var i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) {
|
|
3500
|
+
sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2);
|
|
3501
|
+
layering = buildLayerMatrix(g);
|
|
3502
|
+
var cc = crossCount(g, layering);
|
|
3503
|
+
if (cc < bestCC) {
|
|
3504
|
+
lastBest = 0;
|
|
3505
|
+
best = cloneDeep(layering);
|
|
3506
|
+
bestCC = cc;
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
assignOrder(g, best);
|
|
3510
|
+
}
|
|
3511
|
+
function buildLayerGraphs(g, ranks, relationship) {
|
|
3512
|
+
return map(ranks, function(rank) {
|
|
3513
|
+
return buildLayerGraph(g, rank, relationship);
|
|
3514
|
+
});
|
|
3515
|
+
}
|
|
3516
|
+
function sweepLayerGraphs(layerGraphs, biasRight) {
|
|
3517
|
+
var cg = new Graph();
|
|
3518
|
+
forEach(layerGraphs, function(lg) {
|
|
3519
|
+
var root = lg.graph().root;
|
|
3520
|
+
var sorted = sortSubgraph(lg, root, cg, biasRight);
|
|
3521
|
+
forEach(sorted.vs, function(v, i) {
|
|
3522
|
+
lg.node(v).order = i;
|
|
3523
|
+
});
|
|
3524
|
+
addSubgraphConstraints(lg, cg, sorted.vs);
|
|
3525
|
+
});
|
|
3526
|
+
}
|
|
3527
|
+
function assignOrder(g, layering) {
|
|
3528
|
+
forEach(layering, function(layer) {
|
|
3529
|
+
forEach(layer, function(v, i) {
|
|
3530
|
+
g.node(v).order = i;
|
|
3531
|
+
});
|
|
3532
|
+
});
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3535
|
+
//#endregion
|
|
3536
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/parent-dummy-chains.js
|
|
3537
|
+
function parentDummyChains(g) {
|
|
3538
|
+
var postorderNums = postorder(g);
|
|
3539
|
+
forEach(g.graph().dummyChains, function(v) {
|
|
3540
|
+
var node = g.node(v);
|
|
3541
|
+
var edgeObj = node.edgeObj;
|
|
3542
|
+
var pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w);
|
|
3543
|
+
var path = pathData.path;
|
|
3544
|
+
var lca = pathData.lca;
|
|
3545
|
+
var pathIdx = 0;
|
|
3546
|
+
var pathV = path[pathIdx];
|
|
3547
|
+
var ascending = true;
|
|
3548
|
+
while (v !== edgeObj.w) {
|
|
3549
|
+
node = g.node(v);
|
|
3550
|
+
if (ascending) {
|
|
3551
|
+
while ((pathV = path[pathIdx]) !== lca && g.node(pathV).maxRank < node.rank) pathIdx++;
|
|
3552
|
+
if (pathV === lca) ascending = false;
|
|
3553
|
+
}
|
|
3554
|
+
if (!ascending) {
|
|
3555
|
+
while (pathIdx < path.length - 1 && g.node(pathV = path[pathIdx + 1]).minRank <= node.rank) pathIdx++;
|
|
3556
|
+
pathV = path[pathIdx];
|
|
3557
|
+
}
|
|
3558
|
+
g.setParent(v, pathV);
|
|
3559
|
+
v = g.successors(v)[0];
|
|
3560
|
+
}
|
|
3561
|
+
});
|
|
3562
|
+
}
|
|
3563
|
+
function findPath(g, postorderNums, v, w) {
|
|
3564
|
+
var vPath = [];
|
|
3565
|
+
var wPath = [];
|
|
3566
|
+
var low = Math.min(postorderNums[v].low, postorderNums[w].low);
|
|
3567
|
+
var lim = Math.max(postorderNums[v].lim, postorderNums[w].lim);
|
|
3568
|
+
var parent;
|
|
3569
|
+
var lca;
|
|
3570
|
+
parent = v;
|
|
3571
|
+
do {
|
|
3572
|
+
parent = g.parent(parent);
|
|
3573
|
+
vPath.push(parent);
|
|
3574
|
+
} while (parent && (postorderNums[parent].low > low || lim > postorderNums[parent].lim));
|
|
3575
|
+
lca = parent;
|
|
3576
|
+
parent = w;
|
|
3577
|
+
while ((parent = g.parent(parent)) !== lca) wPath.push(parent);
|
|
3578
|
+
return {
|
|
3579
|
+
path: vPath.concat(wPath.reverse()),
|
|
3580
|
+
lca
|
|
3581
|
+
};
|
|
3582
|
+
}
|
|
3583
|
+
function postorder(g) {
|
|
3584
|
+
var result = {};
|
|
3585
|
+
var lim = 0;
|
|
3586
|
+
function dfs(v) {
|
|
3587
|
+
var low = lim;
|
|
3588
|
+
forEach(g.children(v), dfs);
|
|
3589
|
+
result[v] = {
|
|
3590
|
+
low,
|
|
3591
|
+
lim: lim++
|
|
3592
|
+
};
|
|
3593
|
+
}
|
|
3594
|
+
forEach(g.children(), dfs);
|
|
3595
|
+
return result;
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
//#endregion
|
|
3599
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/bk.js
|
|
3600
|
+
function findType1Conflicts(g, layering) {
|
|
3601
|
+
/** @type {{[nodeId: string | number]: {[nodeId: string | number]: true}}} */
|
|
3602
|
+
var conflicts = {};
|
|
3603
|
+
function visitLayer(prevLayer, layer) {
|
|
3604
|
+
var k0 = 0, scanPos = 0, prevLayerLength = prevLayer.length, lastNode = last(layer);
|
|
3605
|
+
forEach(layer, function(v, i) {
|
|
3606
|
+
var w = findOtherInnerSegmentNode(g, v), k1 = w ? g.node(w).order : prevLayerLength;
|
|
3607
|
+
if (w || v === lastNode) {
|
|
3608
|
+
forEach(layer.slice(scanPos, i + 1), function(scanNode) {
|
|
3609
|
+
forEach(g.predecessors(scanNode), function(u) {
|
|
3610
|
+
var uLabel = g.node(u), uPos = uLabel.order;
|
|
3611
|
+
if ((uPos < k0 || k1 < uPos) && !(uLabel.dummy && g.node(scanNode).dummy)) addConflict(conflicts, u, scanNode);
|
|
3612
|
+
});
|
|
3613
|
+
});
|
|
3614
|
+
scanPos = i + 1;
|
|
3615
|
+
k0 = k1;
|
|
3616
|
+
}
|
|
3617
|
+
});
|
|
3618
|
+
return layer;
|
|
3619
|
+
}
|
|
3620
|
+
reduce(layering, visitLayer);
|
|
3621
|
+
return conflicts;
|
|
3622
|
+
}
|
|
3623
|
+
function findType2Conflicts(g, layering) {
|
|
3624
|
+
/** @type {{[nodeId: string | number]: {[nodeId: string | number]: true}}} */
|
|
3625
|
+
var conflicts = {};
|
|
3626
|
+
function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) {
|
|
3627
|
+
var v;
|
|
3628
|
+
forEach(range(southPos, southEnd), function(i) {
|
|
3629
|
+
v = south[i];
|
|
3630
|
+
if (g.node(v).dummy) forEach(g.predecessors(v), function(u) {
|
|
3631
|
+
var uNode = g.node(u);
|
|
3632
|
+
if (uNode.dummy && (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) addConflict(conflicts, u, v);
|
|
3633
|
+
});
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
function visitLayer(north, south) {
|
|
3637
|
+
var prevNorthPos = -1, nextNorthPos, southPos = 0;
|
|
3638
|
+
forEach(south, function(v, southLookahead) {
|
|
3639
|
+
if (g.node(v).dummy === "border") {
|
|
3640
|
+
var predecessors = g.predecessors(v);
|
|
3641
|
+
if (predecessors.length) {
|
|
3642
|
+
nextNorthPos = g.node(predecessors[0]).order;
|
|
3643
|
+
scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);
|
|
3644
|
+
southPos = southLookahead;
|
|
3645
|
+
prevNorthPos = nextNorthPos;
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
scan(south, southPos, south.length, nextNorthPos, north.length);
|
|
3649
|
+
});
|
|
3650
|
+
return south;
|
|
3651
|
+
}
|
|
3652
|
+
reduce(layering, visitLayer);
|
|
3653
|
+
return conflicts;
|
|
3654
|
+
}
|
|
3655
|
+
function findOtherInnerSegmentNode(g, v) {
|
|
3656
|
+
if (g.node(v).dummy) return find(g.predecessors(v), function(u) {
|
|
3657
|
+
return g.node(u).dummy;
|
|
3658
|
+
});
|
|
3659
|
+
}
|
|
3660
|
+
/**
|
|
3661
|
+
* Sets `conflicts[v][w] = true`, creating objects if needed.
|
|
3662
|
+
*
|
|
3663
|
+
* @param {{[nodeId: string | number]: {[nodeId: string | number]: true}}} conflicts - Object to set.
|
|
3664
|
+
* @param {string | number} v - First Node ID
|
|
3665
|
+
* @param {string | number} w - Second Node ID
|
|
3666
|
+
*/
|
|
3667
|
+
function addConflict(conflicts, v, w) {
|
|
3668
|
+
if (v > w) {
|
|
3669
|
+
var tmp = v;
|
|
3670
|
+
v = w;
|
|
3671
|
+
w = tmp;
|
|
3672
|
+
}
|
|
3673
|
+
if (!Object.prototype.hasOwnProperty.call(conflicts, v)) Object.defineProperty(conflicts, v, {
|
|
3674
|
+
enumerable: true,
|
|
3675
|
+
configurable: true,
|
|
3676
|
+
value: {},
|
|
3677
|
+
writable: true
|
|
3678
|
+
});
|
|
3679
|
+
var conflictsV = conflicts[v];
|
|
3680
|
+
Object.defineProperty(conflictsV, w, {
|
|
3681
|
+
enumerable: true,
|
|
3682
|
+
configurable: true,
|
|
3683
|
+
value: true,
|
|
3684
|
+
writable: true
|
|
3685
|
+
});
|
|
3686
|
+
}
|
|
3687
|
+
function hasConflict(conflicts, v, w) {
|
|
3688
|
+
if (v > w) {
|
|
3689
|
+
var tmp = v;
|
|
3690
|
+
v = w;
|
|
3691
|
+
w = tmp;
|
|
3692
|
+
}
|
|
3693
|
+
return !!conflicts[v] && Object.prototype.hasOwnProperty.call(conflicts[v], w);
|
|
3694
|
+
}
|
|
3695
|
+
function verticalAlignment(g, layering, conflicts, neighborFn) {
|
|
3696
|
+
var root = {}, align = {}, pos = {};
|
|
3697
|
+
forEach(layering, function(layer) {
|
|
3698
|
+
forEach(layer, function(v, order) {
|
|
3699
|
+
root[v] = v;
|
|
3700
|
+
align[v] = v;
|
|
3701
|
+
pos[v] = order;
|
|
3702
|
+
});
|
|
3703
|
+
});
|
|
3704
|
+
forEach(layering, function(layer) {
|
|
3705
|
+
var prevIdx = -1;
|
|
3706
|
+
forEach(layer, function(v) {
|
|
3707
|
+
var ws = neighborFn(v);
|
|
3708
|
+
if (ws.length) {
|
|
3709
|
+
ws = sortBy(ws, function(w) {
|
|
3710
|
+
return pos[w];
|
|
3711
|
+
});
|
|
3712
|
+
var mp = (ws.length - 1) / 2;
|
|
3713
|
+
for (var i = Math.floor(mp), il = Math.ceil(mp); i <= il; ++i) {
|
|
3714
|
+
var w = ws[i];
|
|
3715
|
+
if (align[v] === v && prevIdx < pos[w] && !hasConflict(conflicts, v, w)) {
|
|
3716
|
+
align[w] = v;
|
|
3717
|
+
align[v] = root[v] = root[w];
|
|
3718
|
+
prevIdx = pos[w];
|
|
3719
|
+
}
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
});
|
|
3723
|
+
});
|
|
3724
|
+
return {
|
|
3725
|
+
root,
|
|
3726
|
+
align
|
|
3727
|
+
};
|
|
3728
|
+
}
|
|
3729
|
+
function horizontalCompaction(g, layering, root, align, reverseSep) {
|
|
3730
|
+
/** @type {Record<import('../../graphlib/graph.js').NodeID, number>} */
|
|
3731
|
+
var xs = {}, blockG = buildBlockGraph(g, layering, root, reverseSep), borderType = reverseSep ? "borderLeft" : "borderRight";
|
|
3732
|
+
function iterate(setXsFunc, nextNodesFunc) {
|
|
3733
|
+
var stack = blockG.nodes();
|
|
3734
|
+
var elem = stack.pop();
|
|
3735
|
+
var visited = {};
|
|
3736
|
+
while (elem) {
|
|
3737
|
+
if (visited[elem]) setXsFunc(elem);
|
|
3738
|
+
else {
|
|
3739
|
+
visited[elem] = true;
|
|
3740
|
+
stack.push(elem);
|
|
3741
|
+
stack = stack.concat(nextNodesFunc(elem));
|
|
3742
|
+
}
|
|
3743
|
+
elem = stack.pop();
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
function pass1(elem) {
|
|
3747
|
+
xs[elem] = blockG.inEdges(elem).reduce(function(acc, e) {
|
|
3748
|
+
return Math.max(acc, xs[e.v] + blockG.edge(e));
|
|
3749
|
+
}, 0);
|
|
3750
|
+
}
|
|
3751
|
+
function pass2(elem) {
|
|
3752
|
+
var min = blockG.outEdges(elem).reduce(function(acc, e) {
|
|
3753
|
+
return Math.min(acc, xs[e.w] - blockG.edge(e));
|
|
3754
|
+
}, Number.POSITIVE_INFINITY);
|
|
3755
|
+
var node = g.node(elem);
|
|
3756
|
+
if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) xs[elem] = Math.max(xs[elem], min);
|
|
3757
|
+
}
|
|
3758
|
+
iterate(pass1, blockG.predecessors.bind(blockG));
|
|
3759
|
+
iterate(pass2, blockG.successors.bind(blockG));
|
|
3760
|
+
forEach(align, function(v) {
|
|
3761
|
+
xs[v] = xs[root[v]];
|
|
3762
|
+
});
|
|
3763
|
+
return xs;
|
|
3764
|
+
}
|
|
3765
|
+
function buildBlockGraph(g, layering, root, reverseSep) {
|
|
3766
|
+
var blockGraph = new Graph(), graphLabel = g.graph(), sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
|
|
3767
|
+
forEach(layering, function(layer) {
|
|
3768
|
+
var u;
|
|
3769
|
+
forEach(layer, function(v) {
|
|
3770
|
+
var vRoot = root[v];
|
|
3771
|
+
blockGraph.setNode(vRoot);
|
|
3772
|
+
if (u) {
|
|
3773
|
+
var uRoot = root[u], prevMax = blockGraph.edge(uRoot, vRoot);
|
|
3774
|
+
blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g, v, u), prevMax || 0));
|
|
3775
|
+
}
|
|
3776
|
+
u = v;
|
|
3777
|
+
});
|
|
3778
|
+
});
|
|
3779
|
+
return blockGraph;
|
|
3780
|
+
}
|
|
3781
|
+
function findSmallestWidthAlignment(g, xss) {
|
|
3782
|
+
return minBy(values(xss), function(xs) {
|
|
3783
|
+
var max = Number.NEGATIVE_INFINITY;
|
|
3784
|
+
var min = Number.POSITIVE_INFINITY;
|
|
3785
|
+
forIn(xs, function(x, v) {
|
|
3786
|
+
var halfWidth = width(g, v) / 2;
|
|
3787
|
+
max = Math.max(x + halfWidth, max);
|
|
3788
|
+
min = Math.min(x - halfWidth, min);
|
|
3789
|
+
});
|
|
3790
|
+
return max - min;
|
|
3791
|
+
});
|
|
3792
|
+
}
|
|
3793
|
+
function alignCoordinates(xss, alignTo) {
|
|
3794
|
+
var alignToVals = values(alignTo), alignToMin = min(alignToVals), alignToMax = max(alignToVals);
|
|
3795
|
+
forEach(["u", "d"], function(vert) {
|
|
3796
|
+
forEach(["l", "r"], function(horiz) {
|
|
3797
|
+
var alignment = vert + horiz, xs = xss[alignment], delta;
|
|
3798
|
+
if (xs === alignTo) return;
|
|
3799
|
+
var xsVals = values(xs);
|
|
3800
|
+
delta = horiz === "l" ? alignToMin - min(xsVals) : alignToMax - max(xsVals);
|
|
3801
|
+
if (delta) xss[alignment] = mapValues(xs, function(x) {
|
|
3802
|
+
return x + delta;
|
|
3803
|
+
});
|
|
3804
|
+
});
|
|
3805
|
+
});
|
|
3806
|
+
}
|
|
3807
|
+
function balance(xss, align) {
|
|
3808
|
+
return mapValues(xss.ul, function(ignore, v) {
|
|
3809
|
+
if (align) return xss[align.toLowerCase()][v];
|
|
3810
|
+
else {
|
|
3811
|
+
var xs = sortBy(map(xss, v));
|
|
3812
|
+
return (xs[1] + xs[2]) / 2;
|
|
3813
|
+
}
|
|
3814
|
+
});
|
|
3815
|
+
}
|
|
3816
|
+
function positionX(g) {
|
|
3817
|
+
var layering = buildLayerMatrix(g);
|
|
3818
|
+
var conflicts = merge(findType1Conflicts(g, layering), findType2Conflicts(g, layering));
|
|
3819
|
+
var xss = {};
|
|
3820
|
+
var adjustedLayering;
|
|
3821
|
+
forEach(["u", "d"], function(vert) {
|
|
3822
|
+
adjustedLayering = vert === "u" ? layering : values(layering).reverse();
|
|
3823
|
+
forEach(["l", "r"], function(horiz) {
|
|
3824
|
+
if (horiz === "r") adjustedLayering = map(adjustedLayering, function(inner) {
|
|
3825
|
+
return values(inner).reverse();
|
|
3826
|
+
});
|
|
3827
|
+
var neighborFn = (vert === "u" ? g.predecessors : g.successors).bind(g);
|
|
3828
|
+
var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn);
|
|
3829
|
+
var xs = horizontalCompaction(g, adjustedLayering, align.root, align.align, horiz === "r");
|
|
3830
|
+
if (horiz === "r") xs = mapValues(xs, function(x) {
|
|
3831
|
+
return -x;
|
|
3832
|
+
});
|
|
3833
|
+
xss[vert + horiz] = xs;
|
|
3834
|
+
});
|
|
3835
|
+
});
|
|
3836
|
+
alignCoordinates(xss, findSmallestWidthAlignment(g, xss));
|
|
3837
|
+
return balance(xss, g.graph().align);
|
|
3838
|
+
}
|
|
3839
|
+
function sep(nodeSep, edgeSep, reverseSep) {
|
|
3840
|
+
return function(g, v, w) {
|
|
3841
|
+
var vLabel = g.node(v);
|
|
3842
|
+
var wLabel = g.node(w);
|
|
3843
|
+
var sum = 0;
|
|
3844
|
+
var delta;
|
|
3845
|
+
sum += vLabel.width / 2;
|
|
3846
|
+
if (Object.prototype.hasOwnProperty.call(vLabel, "labelpos")) switch (vLabel.labelpos.toLowerCase()) {
|
|
3847
|
+
case "l":
|
|
3848
|
+
delta = -vLabel.width / 2;
|
|
3849
|
+
break;
|
|
3850
|
+
case "r":
|
|
3851
|
+
delta = vLabel.width / 2;
|
|
3852
|
+
break;
|
|
3853
|
+
}
|
|
3854
|
+
if (delta) sum += reverseSep ? delta : -delta;
|
|
3855
|
+
delta = 0;
|
|
3856
|
+
sum += (vLabel.dummy ? edgeSep : nodeSep) / 2;
|
|
3857
|
+
sum += (wLabel.dummy ? edgeSep : nodeSep) / 2;
|
|
3858
|
+
sum += wLabel.width / 2;
|
|
3859
|
+
if (Object.prototype.hasOwnProperty.call(wLabel, "labelpos")) switch (wLabel.labelpos.toLowerCase()) {
|
|
3860
|
+
case "l":
|
|
3861
|
+
delta = wLabel.width / 2;
|
|
3862
|
+
break;
|
|
3863
|
+
case "r":
|
|
3864
|
+
delta = -wLabel.width / 2;
|
|
3865
|
+
break;
|
|
3866
|
+
}
|
|
3867
|
+
if (delta) sum += reverseSep ? delta : -delta;
|
|
3868
|
+
delta = 0;
|
|
3869
|
+
return sum;
|
|
3870
|
+
};
|
|
3871
|
+
}
|
|
3872
|
+
function width(g, v) {
|
|
3873
|
+
return g.node(v).width;
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
//#endregion
|
|
3877
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/index.js
|
|
3878
|
+
function position(g) {
|
|
3879
|
+
g = asNonCompoundGraph(g);
|
|
3880
|
+
positionY(g);
|
|
3881
|
+
forOwn(positionX(g), function(x, v) {
|
|
3882
|
+
g.node(v).x = x;
|
|
3883
|
+
});
|
|
3884
|
+
}
|
|
3885
|
+
function positionY(g) {
|
|
3886
|
+
var layering = buildLayerMatrix(g);
|
|
3887
|
+
var rankSep = g.graph().ranksep;
|
|
3888
|
+
var prevY = 0;
|
|
3889
|
+
forEach(layering, function(layer) {
|
|
3890
|
+
var maxHeight = max(map(layer, function(v) {
|
|
3891
|
+
return g.node(v).height;
|
|
3892
|
+
}));
|
|
3893
|
+
forEach(layer, function(v) {
|
|
3894
|
+
g.node(v).y = prevY + maxHeight / 2;
|
|
3895
|
+
});
|
|
3896
|
+
prevY += maxHeight + rankSep;
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3900
|
+
//#endregion
|
|
3901
|
+
//#region ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/layout.js
|
|
3902
|
+
function layout(g, opts) {
|
|
3903
|
+
var time$1 = opts && opts.debugTiming ? time : notime;
|
|
3904
|
+
time$1("layout", () => {
|
|
3905
|
+
var layoutGraph = time$1(" buildLayoutGraph", () => buildLayoutGraph(g));
|
|
3906
|
+
time$1(" runLayout", () => runLayout(layoutGraph, time$1));
|
|
3907
|
+
time$1(" updateInputGraph", () => updateInputGraph(g, layoutGraph));
|
|
3908
|
+
});
|
|
3909
|
+
}
|
|
3910
|
+
function runLayout(g, time) {
|
|
3911
|
+
time(" makeSpaceForEdgeLabels", () => makeSpaceForEdgeLabels(g));
|
|
3912
|
+
time(" removeSelfEdges", () => removeSelfEdges(g));
|
|
3913
|
+
time(" acyclic", () => run$2(g));
|
|
3914
|
+
time(" nestingGraph.run", () => run(g));
|
|
3915
|
+
time(" rank", () => rank(asNonCompoundGraph(g)));
|
|
3916
|
+
time(" injectEdgeLabelProxies", () => injectEdgeLabelProxies(g));
|
|
3917
|
+
time(" removeEmptyRanks", () => removeEmptyRanks(g));
|
|
3918
|
+
time(" nestingGraph.cleanup", () => cleanup(g));
|
|
3919
|
+
time(" normalizeRanks", () => normalizeRanks(g));
|
|
3920
|
+
time(" assignRankMinMax", () => assignRankMinMax(g));
|
|
3921
|
+
time(" removeEdgeLabelProxies", () => removeEdgeLabelProxies(g));
|
|
3922
|
+
time(" normalize.run", () => run$1(g));
|
|
3923
|
+
time(" parentDummyChains", () => parentDummyChains(g));
|
|
3924
|
+
time(" addBorderSegments", () => addBorderSegments(g));
|
|
3925
|
+
time(" order", () => order(g));
|
|
3926
|
+
time(" insertSelfEdges", () => insertSelfEdges(g));
|
|
3927
|
+
time(" adjustCoordinateSystem", () => adjust(g));
|
|
3928
|
+
time(" position", () => position(g));
|
|
3929
|
+
time(" positionSelfEdges", () => positionSelfEdges(g));
|
|
3930
|
+
time(" removeBorderNodes", () => removeBorderNodes(g));
|
|
3931
|
+
time(" normalize.undo", () => undo(g));
|
|
3932
|
+
time(" fixupEdgeLabelCoords", () => fixupEdgeLabelCoords(g));
|
|
3933
|
+
time(" undoCoordinateSystem", () => undo$1(g));
|
|
3934
|
+
time(" translateGraph", () => translateGraph(g));
|
|
3935
|
+
time(" assignNodeIntersects", () => assignNodeIntersects(g));
|
|
3936
|
+
time(" reversePoints", () => reversePointsForReversedEdges(g));
|
|
3937
|
+
time(" acyclic.undo", () => undo$2(g));
|
|
3938
|
+
}
|
|
3939
|
+
function updateInputGraph(inputGraph, layoutGraph) {
|
|
3940
|
+
forEach(inputGraph.nodes(), function(v) {
|
|
3941
|
+
var inputLabel = inputGraph.node(v);
|
|
3942
|
+
var layoutLabel = layoutGraph.node(v);
|
|
3943
|
+
if (inputLabel) {
|
|
3944
|
+
inputLabel.x = layoutLabel.x;
|
|
3945
|
+
inputLabel.y = layoutLabel.y;
|
|
3946
|
+
if (layoutGraph.children(v).length) {
|
|
3947
|
+
inputLabel.width = layoutLabel.width;
|
|
3948
|
+
inputLabel.height = layoutLabel.height;
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3951
|
+
});
|
|
3952
|
+
forEach(inputGraph.edges(), function(e) {
|
|
3953
|
+
var inputLabel = inputGraph.edge(e);
|
|
3954
|
+
var layoutLabel = layoutGraph.edge(e);
|
|
3955
|
+
inputLabel.points = layoutLabel.points;
|
|
3956
|
+
if (Object.prototype.hasOwnProperty.call(layoutLabel, "x")) {
|
|
3957
|
+
inputLabel.x = layoutLabel.x;
|
|
3958
|
+
inputLabel.y = layoutLabel.y;
|
|
3959
|
+
}
|
|
3960
|
+
});
|
|
3961
|
+
inputGraph.graph().width = layoutGraph.graph().width;
|
|
3962
|
+
inputGraph.graph().height = layoutGraph.graph().height;
|
|
3963
|
+
}
|
|
3964
|
+
var graphNumAttrs = [
|
|
3965
|
+
"nodesep",
|
|
3966
|
+
"edgesep",
|
|
3967
|
+
"ranksep",
|
|
3968
|
+
"marginx",
|
|
3969
|
+
"marginy"
|
|
3970
|
+
];
|
|
3971
|
+
var graphDefaults = {
|
|
3972
|
+
ranksep: 50,
|
|
3973
|
+
edgesep: 20,
|
|
3974
|
+
nodesep: 50,
|
|
3975
|
+
rankdir: "tb"
|
|
3976
|
+
};
|
|
3977
|
+
var graphAttrs = [
|
|
3978
|
+
"acyclicer",
|
|
3979
|
+
"ranker",
|
|
3980
|
+
"rankdir",
|
|
3981
|
+
"align"
|
|
3982
|
+
];
|
|
3983
|
+
var nodeNumAttrs = ["width", "height"];
|
|
3984
|
+
var nodeDefaults = {
|
|
3985
|
+
width: 0,
|
|
3986
|
+
height: 0
|
|
3987
|
+
};
|
|
3988
|
+
var edgeNumAttrs = [
|
|
3989
|
+
"minlen",
|
|
3990
|
+
"weight",
|
|
3991
|
+
"width",
|
|
3992
|
+
"height",
|
|
3993
|
+
"labeloffset"
|
|
3994
|
+
];
|
|
3995
|
+
var edgeDefaults = {
|
|
3996
|
+
minlen: 1,
|
|
3997
|
+
weight: 1,
|
|
3998
|
+
width: 0,
|
|
3999
|
+
height: 0,
|
|
4000
|
+
labeloffset: 10,
|
|
4001
|
+
labelpos: "r"
|
|
4002
|
+
};
|
|
4003
|
+
var edgeAttrs = ["labelpos"];
|
|
4004
|
+
function buildLayoutGraph(inputGraph) {
|
|
4005
|
+
var g = new Graph({
|
|
4006
|
+
multigraph: true,
|
|
4007
|
+
compound: true
|
|
4008
|
+
});
|
|
4009
|
+
var graph = canonicalize(inputGraph.graph());
|
|
4010
|
+
g.setGraph(merge({}, graphDefaults, selectNumberAttrs(graph, graphNumAttrs), pick(graph, graphAttrs)));
|
|
4011
|
+
forEach(inputGraph.nodes(), function(v) {
|
|
4012
|
+
var node = canonicalize(inputGraph.node(v));
|
|
4013
|
+
g.setNode(v, defaults(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults));
|
|
4014
|
+
g.setParent(v, inputGraph.parent(v));
|
|
4015
|
+
});
|
|
4016
|
+
forEach(inputGraph.edges(), function(e) {
|
|
4017
|
+
var edge = canonicalize(inputGraph.edge(e));
|
|
4018
|
+
g.setEdge(e, merge({}, edgeDefaults, selectNumberAttrs(edge, edgeNumAttrs), pick(edge, edgeAttrs)));
|
|
4019
|
+
});
|
|
4020
|
+
return g;
|
|
4021
|
+
}
|
|
4022
|
+
function makeSpaceForEdgeLabels(g) {
|
|
4023
|
+
var graph = g.graph();
|
|
4024
|
+
graph.ranksep /= 2;
|
|
4025
|
+
forEach(g.edges(), function(e) {
|
|
4026
|
+
var edge = g.edge(e);
|
|
4027
|
+
edge.minlen *= 2;
|
|
4028
|
+
if (edge.labelpos.toLowerCase() !== "c") if (graph.rankdir === "TB" || graph.rankdir === "BT") edge.width += edge.labeloffset;
|
|
4029
|
+
else edge.height += edge.labeloffset;
|
|
4030
|
+
});
|
|
4031
|
+
}
|
|
4032
|
+
function injectEdgeLabelProxies(g) {
|
|
4033
|
+
forEach(g.edges(), function(e) {
|
|
4034
|
+
var edge = g.edge(e);
|
|
4035
|
+
if (edge.width && edge.height) {
|
|
4036
|
+
var v = g.node(e.v);
|
|
4037
|
+
var label = {
|
|
4038
|
+
rank: (g.node(e.w).rank - v.rank) / 2 + v.rank,
|
|
4039
|
+
e
|
|
4040
|
+
};
|
|
4041
|
+
addDummyNode(g, "edge-proxy", label, "_ep");
|
|
4042
|
+
}
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
function assignRankMinMax(g) {
|
|
4046
|
+
var maxRank = 0;
|
|
4047
|
+
forEach(g.nodes(), function(v) {
|
|
4048
|
+
var node = g.node(v);
|
|
4049
|
+
if (node.borderTop) {
|
|
4050
|
+
node.minRank = g.node(node.borderTop).rank;
|
|
4051
|
+
node.maxRank = g.node(node.borderBottom).rank;
|
|
4052
|
+
maxRank = max(maxRank, node.maxRank);
|
|
4053
|
+
}
|
|
4054
|
+
});
|
|
4055
|
+
g.graph().maxRank = maxRank;
|
|
4056
|
+
}
|
|
4057
|
+
function removeEdgeLabelProxies(g) {
|
|
4058
|
+
forEach(g.nodes(), function(v) {
|
|
4059
|
+
var node = g.node(v);
|
|
4060
|
+
if (node.dummy === "edge-proxy") {
|
|
4061
|
+
g.edge(node.e).labelRank = node.rank;
|
|
4062
|
+
g.removeNode(v);
|
|
4063
|
+
}
|
|
4064
|
+
});
|
|
4065
|
+
}
|
|
4066
|
+
function translateGraph(g) {
|
|
4067
|
+
var minX = Number.POSITIVE_INFINITY;
|
|
4068
|
+
var maxX = 0;
|
|
4069
|
+
var minY = Number.POSITIVE_INFINITY;
|
|
4070
|
+
var maxY = 0;
|
|
4071
|
+
var graphLabel = g.graph();
|
|
4072
|
+
var marginX = graphLabel.marginx || 0;
|
|
4073
|
+
var marginY = graphLabel.marginy || 0;
|
|
4074
|
+
function getExtremes(attrs) {
|
|
4075
|
+
var x = attrs.x;
|
|
4076
|
+
var y = attrs.y;
|
|
4077
|
+
var w = attrs.width;
|
|
4078
|
+
var h = attrs.height;
|
|
4079
|
+
minX = Math.min(minX, x - w / 2);
|
|
4080
|
+
maxX = Math.max(maxX, x + w / 2);
|
|
4081
|
+
minY = Math.min(minY, y - h / 2);
|
|
4082
|
+
maxY = Math.max(maxY, y + h / 2);
|
|
4083
|
+
}
|
|
4084
|
+
forEach(g.nodes(), function(v) {
|
|
4085
|
+
getExtremes(g.node(v));
|
|
4086
|
+
});
|
|
4087
|
+
forEach(g.edges(), function(e) {
|
|
4088
|
+
var edge = g.edge(e);
|
|
4089
|
+
if (Object.prototype.hasOwnProperty.call(edge, "x")) getExtremes(edge);
|
|
4090
|
+
});
|
|
4091
|
+
minX -= marginX;
|
|
4092
|
+
minY -= marginY;
|
|
4093
|
+
forEach(g.nodes(), function(v) {
|
|
4094
|
+
var node = g.node(v);
|
|
4095
|
+
node.x -= minX;
|
|
4096
|
+
node.y -= minY;
|
|
4097
|
+
});
|
|
4098
|
+
forEach(g.edges(), function(e) {
|
|
4099
|
+
var edge = g.edge(e);
|
|
4100
|
+
forEach(edge.points, function(p) {
|
|
4101
|
+
p.x -= minX;
|
|
4102
|
+
p.y -= minY;
|
|
4103
|
+
});
|
|
4104
|
+
if (Object.prototype.hasOwnProperty.call(edge, "x")) edge.x -= minX;
|
|
4105
|
+
if (Object.prototype.hasOwnProperty.call(edge, "y")) edge.y -= minY;
|
|
4106
|
+
});
|
|
4107
|
+
graphLabel.width = maxX - minX + marginX;
|
|
4108
|
+
graphLabel.height = maxY - minY + marginY;
|
|
4109
|
+
}
|
|
4110
|
+
function assignNodeIntersects(g) {
|
|
4111
|
+
forEach(g.edges(), function(e) {
|
|
4112
|
+
var edge = g.edge(e);
|
|
4113
|
+
var nodeV = g.node(e.v);
|
|
4114
|
+
var nodeW = g.node(e.w);
|
|
4115
|
+
var p1, p2;
|
|
4116
|
+
if (!edge.points) {
|
|
4117
|
+
edge.points = [];
|
|
4118
|
+
p1 = nodeW;
|
|
4119
|
+
p2 = nodeV;
|
|
4120
|
+
} else {
|
|
4121
|
+
p1 = edge.points[0];
|
|
4122
|
+
p2 = edge.points[edge.points.length - 1];
|
|
4123
|
+
}
|
|
4124
|
+
edge.points.unshift(intersectRect(nodeV, p1));
|
|
4125
|
+
edge.points.push(intersectRect(nodeW, p2));
|
|
4126
|
+
});
|
|
4127
|
+
}
|
|
4128
|
+
function fixupEdgeLabelCoords(g) {
|
|
4129
|
+
forEach(g.edges(), function(e) {
|
|
4130
|
+
var edge = g.edge(e);
|
|
4131
|
+
if (Object.prototype.hasOwnProperty.call(edge, "x")) {
|
|
4132
|
+
if (edge.labelpos === "l" || edge.labelpos === "r") edge.width -= edge.labeloffset;
|
|
4133
|
+
switch (edge.labelpos) {
|
|
4134
|
+
case "l":
|
|
4135
|
+
edge.x -= edge.width / 2 + edge.labeloffset;
|
|
4136
|
+
break;
|
|
4137
|
+
case "r":
|
|
4138
|
+
edge.x += edge.width / 2 + edge.labeloffset;
|
|
4139
|
+
break;
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
});
|
|
4143
|
+
}
|
|
4144
|
+
function reversePointsForReversedEdges(g) {
|
|
4145
|
+
forEach(g.edges(), function(e) {
|
|
4146
|
+
var edge = g.edge(e);
|
|
4147
|
+
if (edge.reversed) edge.points.reverse();
|
|
4148
|
+
});
|
|
4149
|
+
}
|
|
4150
|
+
function removeBorderNodes(g) {
|
|
4151
|
+
forEach(g.nodes(), function(v) {
|
|
4152
|
+
if (g.children(v).length) {
|
|
4153
|
+
var node = g.node(v);
|
|
4154
|
+
var t = g.node(node.borderTop);
|
|
4155
|
+
var b = g.node(node.borderBottom);
|
|
4156
|
+
var l = g.node(last(node.borderLeft));
|
|
4157
|
+
var r = g.node(last(node.borderRight));
|
|
4158
|
+
node.width = Math.abs(r.x - l.x);
|
|
4159
|
+
node.height = Math.abs(b.y - t.y);
|
|
4160
|
+
node.x = l.x + node.width / 2;
|
|
4161
|
+
node.y = t.y + node.height / 2;
|
|
4162
|
+
}
|
|
4163
|
+
});
|
|
4164
|
+
forEach(g.nodes(), function(v) {
|
|
4165
|
+
if (g.node(v).dummy === "border") g.removeNode(v);
|
|
4166
|
+
});
|
|
4167
|
+
}
|
|
4168
|
+
function removeSelfEdges(g) {
|
|
4169
|
+
forEach(g.edges(), function(e) {
|
|
4170
|
+
if (e.v === e.w) {
|
|
4171
|
+
var node = g.node(e.v);
|
|
4172
|
+
if (!node.selfEdges) node.selfEdges = [];
|
|
4173
|
+
node.selfEdges.push({
|
|
4174
|
+
e,
|
|
4175
|
+
label: g.edge(e)
|
|
4176
|
+
});
|
|
4177
|
+
g.removeEdge(e);
|
|
4178
|
+
}
|
|
4179
|
+
});
|
|
4180
|
+
}
|
|
4181
|
+
function insertSelfEdges(g) {
|
|
4182
|
+
var layers = buildLayerMatrix(g);
|
|
4183
|
+
forEach(layers, function(layer) {
|
|
4184
|
+
var orderShift = 0;
|
|
4185
|
+
forEach(layer, function(v, i) {
|
|
4186
|
+
var node = g.node(v);
|
|
4187
|
+
node.order = i + orderShift;
|
|
4188
|
+
forEach(node.selfEdges, function(selfEdge) {
|
|
4189
|
+
addDummyNode(g, "selfedge", {
|
|
4190
|
+
width: selfEdge.label.width,
|
|
4191
|
+
height: selfEdge.label.height,
|
|
4192
|
+
rank: node.rank,
|
|
4193
|
+
order: i + ++orderShift,
|
|
4194
|
+
e: selfEdge.e,
|
|
4195
|
+
label: selfEdge.label
|
|
4196
|
+
}, "_se");
|
|
4197
|
+
});
|
|
4198
|
+
delete node.selfEdges;
|
|
4199
|
+
});
|
|
4200
|
+
});
|
|
4201
|
+
}
|
|
4202
|
+
function positionSelfEdges(g) {
|
|
4203
|
+
forEach(g.nodes(), function(v) {
|
|
4204
|
+
var node = g.node(v);
|
|
4205
|
+
if (node.dummy === "selfedge") {
|
|
4206
|
+
var selfNode = g.node(node.e.v);
|
|
4207
|
+
var x = selfNode.x + selfNode.width / 2;
|
|
4208
|
+
var y = selfNode.y;
|
|
4209
|
+
var dx = node.x - x;
|
|
4210
|
+
var dy = selfNode.height / 2;
|
|
4211
|
+
g.setEdge(node.e, node.label);
|
|
4212
|
+
g.removeNode(v);
|
|
4213
|
+
node.label.points = [
|
|
4214
|
+
{
|
|
4215
|
+
x: x + 2 * dx / 3,
|
|
4216
|
+
y: y - dy
|
|
4217
|
+
},
|
|
4218
|
+
{
|
|
4219
|
+
x: x + 5 * dx / 6,
|
|
4220
|
+
y: y - dy
|
|
4221
|
+
},
|
|
4222
|
+
{
|
|
4223
|
+
x: x + dx,
|
|
4224
|
+
y
|
|
4225
|
+
},
|
|
4226
|
+
{
|
|
4227
|
+
x: x + 5 * dx / 6,
|
|
4228
|
+
y: y + dy
|
|
4229
|
+
},
|
|
4230
|
+
{
|
|
4231
|
+
x: x + 2 * dx / 3,
|
|
4232
|
+
y: y + dy
|
|
4233
|
+
}
|
|
4234
|
+
];
|
|
4235
|
+
node.label.x = node.x;
|
|
4236
|
+
node.label.y = node.y;
|
|
4237
|
+
}
|
|
4238
|
+
});
|
|
4239
|
+
}
|
|
4240
|
+
function selectNumberAttrs(obj, attrs) {
|
|
4241
|
+
return mapValues(pick(obj, attrs), Number);
|
|
4242
|
+
}
|
|
4243
|
+
function canonicalize(attrs) {
|
|
4244
|
+
var newAttrs = {};
|
|
4245
|
+
forEach(attrs, function(v, k) {
|
|
4246
|
+
newAttrs[k.toLowerCase()] = v;
|
|
4247
|
+
});
|
|
4248
|
+
return newAttrs;
|
|
4249
|
+
}
|
|
4250
|
+
|
|
4251
|
+
//#endregion
|
|
4252
|
+
//#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/dagre-6A5THRUB.mjs
|
|
4253
|
+
var clamp = /* @__PURE__ */ __name((value, min, max) => Math.max(min, Math.min(max, value)), "clamp");
|
|
4254
|
+
var getDefaultSelfLoopSide = /* @__PURE__ */ __name((rankdir = "TB") => {
|
|
4255
|
+
switch (rankdir) {
|
|
4256
|
+
case "BT": return "bottom";
|
|
4257
|
+
case "LR": return "right";
|
|
4258
|
+
case "RL": return "left";
|
|
4259
|
+
default: return "top";
|
|
4260
|
+
}
|
|
4261
|
+
}, "getDefaultSelfLoopSide");
|
|
4262
|
+
var shouldMergeSelfLoopSegments = /* @__PURE__ */ __name((diagramType) => diagramType === "flowchart" || diagramType === "flowchart-v2" || diagramType === "stateDiagram" || diagramType === "er" || diagramType === "classDiagram", "shouldMergeSelfLoopSegments");
|
|
4263
|
+
var DAGRE_NODE_LAYOUT_PROPERTIES = [
|
|
4264
|
+
"x",
|
|
4265
|
+
"y",
|
|
4266
|
+
"width",
|
|
4267
|
+
"height",
|
|
4268
|
+
"labelBBox",
|
|
4269
|
+
"intersect",
|
|
4270
|
+
"calcIntersect",
|
|
4271
|
+
"diff",
|
|
4272
|
+
"clusterNode"
|
|
4273
|
+
];
|
|
4274
|
+
var getSelfLoopSide = /* @__PURE__ */ __name((graph, node, segments, originalNodeId, rankdir) => {
|
|
4275
|
+
const layoutHints = [];
|
|
4276
|
+
const dummyNodeIds = /* @__PURE__ */ new Set();
|
|
4277
|
+
segments.forEach(({ start, end }) => {
|
|
4278
|
+
if (start !== originalNodeId) dummyNodeIds.add(start);
|
|
4279
|
+
if (end !== originalNodeId) dummyNodeIds.add(end);
|
|
4280
|
+
});
|
|
4281
|
+
dummyNodeIds.forEach((id) => {
|
|
4282
|
+
const dummyNode = graph.node(id);
|
|
4283
|
+
if (typeof dummyNode?.x === "number" && typeof dummyNode?.y === "number") layoutHints.push(dummyNode);
|
|
4284
|
+
});
|
|
4285
|
+
if (layoutHints.length === 0) segments.forEach(({ edge }) => {
|
|
4286
|
+
(edge.points ?? []).forEach((point) => {
|
|
4287
|
+
if (typeof point?.x === "number" && typeof point?.y === "number") layoutHints.push(point);
|
|
4288
|
+
});
|
|
4289
|
+
});
|
|
4290
|
+
if (layoutHints.length === 0) return getDefaultSelfLoopSide(rankdir);
|
|
4291
|
+
const center = layoutHints.reduce((acc, point) => ({
|
|
4292
|
+
x: acc.x + point.x / layoutHints.length,
|
|
4293
|
+
y: acc.y + point.y / layoutHints.length
|
|
4294
|
+
}), {
|
|
4295
|
+
x: 0,
|
|
4296
|
+
y: 0
|
|
4297
|
+
});
|
|
4298
|
+
const dx = center.x - node.x;
|
|
4299
|
+
const dy = center.y - node.y;
|
|
4300
|
+
if (Math.abs(dx) > Math.abs(dy)) return dx > 0 ? "right" : "left";
|
|
4301
|
+
if (Math.abs(dy) > 0) return dy > 0 ? "bottom" : "top";
|
|
4302
|
+
return getDefaultSelfLoopSide(rankdir);
|
|
4303
|
+
}, "getSelfLoopSide");
|
|
4304
|
+
var getSelfLoopPoints = /* @__PURE__ */ __name((node, side = "top", yOffset = 0, labelWidth = 0) => {
|
|
4305
|
+
const x = node.x;
|
|
4306
|
+
const y = node.y - yOffset;
|
|
4307
|
+
const halfWidth = node.width / 2;
|
|
4308
|
+
const halfHeight = node.height / 2;
|
|
4309
|
+
const maxSpan = Math.max(36, Math.min(100, node.width * .8));
|
|
4310
|
+
const span = clamp(Math.max(labelWidth, node.width * .35), 36, maxSpan);
|
|
4311
|
+
const depth = clamp(Math.min(node.width, node.height) * .45, 24, 48);
|
|
4312
|
+
switch (side) {
|
|
4313
|
+
case "bottom": {
|
|
4314
|
+
const bottom = y + halfHeight;
|
|
4315
|
+
return [
|
|
4316
|
+
{
|
|
4317
|
+
x: x - span / 2,
|
|
4318
|
+
y: bottom
|
|
4319
|
+
},
|
|
4320
|
+
{
|
|
4321
|
+
x: x - span / 2,
|
|
4322
|
+
y: bottom + depth
|
|
4323
|
+
},
|
|
4324
|
+
{
|
|
4325
|
+
x: x + span / 2,
|
|
4326
|
+
y: bottom + depth
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
x: x + span / 2,
|
|
4330
|
+
y: bottom
|
|
4331
|
+
}
|
|
4332
|
+
];
|
|
4333
|
+
}
|
|
4334
|
+
case "right": {
|
|
4335
|
+
const right = x + halfWidth;
|
|
4336
|
+
return [
|
|
4337
|
+
{
|
|
4338
|
+
x: right,
|
|
4339
|
+
y: y - span / 2
|
|
4340
|
+
},
|
|
4341
|
+
{
|
|
4342
|
+
x: right + depth,
|
|
4343
|
+
y: y - span / 2
|
|
4344
|
+
},
|
|
4345
|
+
{
|
|
4346
|
+
x: right + depth,
|
|
4347
|
+
y: y + span / 2
|
|
4348
|
+
},
|
|
4349
|
+
{
|
|
4350
|
+
x: right,
|
|
4351
|
+
y: y + span / 2
|
|
4352
|
+
}
|
|
4353
|
+
];
|
|
4354
|
+
}
|
|
4355
|
+
case "left": {
|
|
4356
|
+
const left = x - halfWidth;
|
|
4357
|
+
return [
|
|
4358
|
+
{
|
|
4359
|
+
x: left,
|
|
4360
|
+
y: y - span / 2
|
|
4361
|
+
},
|
|
4362
|
+
{
|
|
4363
|
+
x: left - depth,
|
|
4364
|
+
y: y - span / 2
|
|
4365
|
+
},
|
|
4366
|
+
{
|
|
4367
|
+
x: left - depth,
|
|
4368
|
+
y: y + span / 2
|
|
4369
|
+
},
|
|
4370
|
+
{
|
|
4371
|
+
x: left,
|
|
4372
|
+
y: y + span / 2
|
|
4373
|
+
}
|
|
4374
|
+
];
|
|
4375
|
+
}
|
|
4376
|
+
default: {
|
|
4377
|
+
const top = y - halfHeight;
|
|
4378
|
+
return [
|
|
4379
|
+
{
|
|
4380
|
+
x: x - span / 2,
|
|
4381
|
+
y: top
|
|
4382
|
+
},
|
|
4383
|
+
{
|
|
4384
|
+
x: x - span / 2,
|
|
4385
|
+
y: top - depth
|
|
4386
|
+
},
|
|
4387
|
+
{
|
|
4388
|
+
x: x + span / 2,
|
|
4389
|
+
y: top - depth
|
|
4390
|
+
},
|
|
4391
|
+
{
|
|
4392
|
+
x: x + span / 2,
|
|
4393
|
+
y: top
|
|
4394
|
+
}
|
|
4395
|
+
];
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
}, "getSelfLoopPoints");
|
|
4399
|
+
var getSelfLoopLabelPosition = /* @__PURE__ */ __name((node, points, side = "top", yOffset = 0, label = {}) => {
|
|
4400
|
+
const gap = 4;
|
|
4401
|
+
const x = node.x;
|
|
4402
|
+
const y = node.y - yOffset;
|
|
4403
|
+
const labelWidth = label.width ?? 0;
|
|
4404
|
+
const labelHeight = label.height ?? 0;
|
|
4405
|
+
switch (side) {
|
|
4406
|
+
case "bottom": return {
|
|
4407
|
+
x,
|
|
4408
|
+
y: Math.max(...points.map((point) => point.y)) + labelHeight / 2 + gap
|
|
4409
|
+
};
|
|
4410
|
+
case "right": return {
|
|
4411
|
+
x: Math.max(...points.map((point) => point.x)) + labelWidth / 2 + gap,
|
|
4412
|
+
y
|
|
4413
|
+
};
|
|
4414
|
+
case "left": return {
|
|
4415
|
+
x: Math.min(...points.map((point) => point.x)) - labelWidth / 2 - gap,
|
|
4416
|
+
y
|
|
4417
|
+
};
|
|
4418
|
+
default: return {
|
|
4419
|
+
x,
|
|
4420
|
+
y: Math.min(...points.map((point) => point.y)) - labelHeight / 2 - gap
|
|
4421
|
+
};
|
|
4422
|
+
}
|
|
4423
|
+
}, "getSelfLoopLabelPosition");
|
|
4424
|
+
var getEdgesToRender = /* @__PURE__ */ __name((graph, yOffset = 0, { mergeSelfLoops = true } = {}) => {
|
|
4425
|
+
const selfLoopEdgeGroups = /* @__PURE__ */ new Map();
|
|
4426
|
+
const edgesToRender = [];
|
|
4427
|
+
const rankdir = graph.graph()?.rankdir;
|
|
4428
|
+
graph.edges().forEach((e) => {
|
|
4429
|
+
const edge = graph.edge(e);
|
|
4430
|
+
if (mergeSelfLoops && edge.selfLoop) {
|
|
4431
|
+
const key = edge.selfLoop.id;
|
|
4432
|
+
if (!selfLoopEdgeGroups.has(key)) selfLoopEdgeGroups.set(key, []);
|
|
4433
|
+
selfLoopEdgeGroups.get(key).push({
|
|
4434
|
+
edge,
|
|
4435
|
+
start: e.v,
|
|
4436
|
+
end: e.w
|
|
4437
|
+
});
|
|
4438
|
+
} else edgesToRender.push({
|
|
4439
|
+
edge,
|
|
4440
|
+
start: e.v,
|
|
4441
|
+
end: e.w
|
|
4442
|
+
});
|
|
4443
|
+
});
|
|
4444
|
+
selfLoopEdgeGroups.forEach((segments) => {
|
|
4445
|
+
if (segments.length !== 3) {
|
|
4446
|
+
segments.forEach((segment) => edgesToRender.push(segment));
|
|
4447
|
+
return;
|
|
4448
|
+
}
|
|
4449
|
+
segments.sort((a, b) => a.edge.selfLoop.order - b.edge.selfLoop.order);
|
|
4450
|
+
const [firstSegment, middleSegment, lastSegment] = segments;
|
|
4451
|
+
const originalEdge = firstSegment.edge.originalEdge ?? middleSegment.edge.originalEdge ?? lastSegment.edge.originalEdge ?? middleSegment.edge;
|
|
4452
|
+
const node = graph.node(originalEdge.start);
|
|
4453
|
+
if (!node) {
|
|
4454
|
+
segments.forEach((segment) => edgesToRender.push(segment));
|
|
4455
|
+
return;
|
|
4456
|
+
}
|
|
4457
|
+
const label = {
|
|
4458
|
+
width: middleSegment.edge.width,
|
|
4459
|
+
height: middleSegment.edge.height
|
|
4460
|
+
};
|
|
4461
|
+
const side = getSelfLoopSide(graph, node, segments, originalEdge.start, rankdir);
|
|
4462
|
+
const points = getSelfLoopPoints(node, side, yOffset, label.width ?? 0);
|
|
4463
|
+
const labelPosition = getSelfLoopLabelPosition(node, points, side, yOffset, label);
|
|
4464
|
+
const mergedEdge = {
|
|
4465
|
+
...middleSegment.edge,
|
|
4466
|
+
...originalEdge,
|
|
4467
|
+
id: originalEdge.id,
|
|
4468
|
+
points,
|
|
4469
|
+
start: originalEdge.start,
|
|
4470
|
+
end: originalEdge.end,
|
|
4471
|
+
x: labelPosition.x,
|
|
4472
|
+
y: labelPosition.y,
|
|
4473
|
+
width: label.width,
|
|
4474
|
+
height: label.height,
|
|
4475
|
+
labelStyle: middleSegment.edge.labelStyle,
|
|
4476
|
+
fromCluster: firstSegment.edge.fromCluster ?? middleSegment.edge.fromCluster ?? lastSegment.edge.fromCluster,
|
|
4477
|
+
toCluster: firstSegment.edge.toCluster ?? middleSegment.edge.toCluster ?? lastSegment.edge.toCluster
|
|
4478
|
+
};
|
|
4479
|
+
delete mergedEdge.selfLoop;
|
|
4480
|
+
delete mergedEdge.originalEdge;
|
|
4481
|
+
edgesToRender.push({
|
|
4482
|
+
edge: mergedEdge,
|
|
4483
|
+
start: mergedEdge.start,
|
|
4484
|
+
end: mergedEdge.end
|
|
4485
|
+
});
|
|
4486
|
+
});
|
|
4487
|
+
return edgesToRender;
|
|
4488
|
+
}, "getEdgesToRender");
|
|
4489
|
+
var measureDagreGraph = /* @__PURE__ */ __name(async ({ element: _elem, graph, diagramType, id, parentCluster, siteConfig }) => {
|
|
4490
|
+
const dir = graph.graph().rankdir;
|
|
4491
|
+
log.trace("Dir in recursive render - dir:", dir);
|
|
4492
|
+
const { clusters, edgePaths, edgeLabels, nodes, rootGroups: elem } = createLayoutElementGroups(_elem, { edgePathsClass: "edgePaths" });
|
|
4493
|
+
if (!graph.nodes()) log.info("No nodes found for", graph);
|
|
4494
|
+
else log.info("Recursive render XXX", graph.nodes());
|
|
4495
|
+
if (graph.edges().length > 0) log.info("Recursive edges", graph.edge(graph.edges()[0]));
|
|
4496
|
+
const mergeSelfLoops = shouldMergeSelfLoopSegments(diagramType);
|
|
4497
|
+
await Promise.all(graph.nodes().map(async function(v) {
|
|
4498
|
+
const node = graph.node(v);
|
|
4499
|
+
if (parentCluster !== void 0) {
|
|
4500
|
+
const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
|
|
4501
|
+
log.trace("Setting data for parent cluster XXX\n Node.id = ", v, "\n data=", data.height, "\nParent cluster", parentCluster.height);
|
|
4502
|
+
graph.setNode(parentCluster.id, data);
|
|
4503
|
+
if (!graph.parent(v)) {
|
|
4504
|
+
log.trace("Setting parent", v, parentCluster.id);
|
|
4505
|
+
graph.setParent(v, parentCluster.id, data);
|
|
4506
|
+
}
|
|
4507
|
+
}
|
|
4508
|
+
log.info("(Insert) Node XXX" + v + ": " + JSON.stringify(graph.node(v)));
|
|
4509
|
+
if (node?.clusterNode) {
|
|
4510
|
+
log.info("Cluster identified XBX", v, node.width, graph.node(v));
|
|
4511
|
+
const { ranksep, nodesep } = graph.graph();
|
|
4512
|
+
node.graph.setGraph({
|
|
4513
|
+
...node.graph.graph(),
|
|
4514
|
+
ranksep: ranksep + 25,
|
|
4515
|
+
nodesep
|
|
4516
|
+
});
|
|
4517
|
+
const o = await renderDagreSubgraph({
|
|
4518
|
+
element: nodes,
|
|
4519
|
+
graph: node.graph,
|
|
4520
|
+
diagramType,
|
|
4521
|
+
id,
|
|
4522
|
+
parentCluster: graph.node(v),
|
|
4523
|
+
siteConfig
|
|
4524
|
+
});
|
|
4525
|
+
const newEl = o.elem;
|
|
4526
|
+
updateNodeBounds(node, newEl);
|
|
4527
|
+
node.diff = o.diff || 0;
|
|
4528
|
+
log.info("New compound node after recursive render XAX", v, "width", node.width, "height", node.height);
|
|
4529
|
+
setNodeElem(newEl, node);
|
|
4530
|
+
} else if (graph.children(v).length > 0) {
|
|
4531
|
+
log.trace("Cluster - the non recursive path XBX", v, node.id, node, node.width, "Graph:", graph);
|
|
4532
|
+
log.trace(findNonClusterChild(node.id, graph));
|
|
4533
|
+
clusterDb.set(node.id, {
|
|
4534
|
+
id: findNonClusterChild(node.id, graph),
|
|
4535
|
+
node
|
|
4536
|
+
});
|
|
4537
|
+
} else {
|
|
4538
|
+
log.trace("Node - the non recursive path XAX", v, nodes, graph.node(v), dir);
|
|
4539
|
+
await insertMeasuredNode(nodes, graph.node(v), {
|
|
4540
|
+
config: siteConfig,
|
|
4541
|
+
dir
|
|
4542
|
+
});
|
|
4543
|
+
}
|
|
4544
|
+
}));
|
|
4545
|
+
await (/* @__PURE__ */ __name(async () => {
|
|
4546
|
+
const edgePromises = graph.edges().map(async function(e) {
|
|
4547
|
+
const edge = graph.edge(e.v, e.w, e.name);
|
|
4548
|
+
log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
|
|
4549
|
+
log.info("Edge " + e.v + " -> " + e.w + ": ", e, " ", JSON.stringify(graph.edge(e)));
|
|
4550
|
+
log.info("Fix", clusterDb, "ids:", e.v, e.w, "Translating: ", clusterDb.get(e.v), clusterDb.get(e.w));
|
|
4551
|
+
if (mergeSelfLoops && edge.selfLoop) {
|
|
4552
|
+
if (edge.selfLoop.order !== 1) return;
|
|
4553
|
+
const labelEdge = {
|
|
4554
|
+
...edge.originalEdge,
|
|
4555
|
+
...edge,
|
|
4556
|
+
id: edge.selfLoop.id,
|
|
4557
|
+
startLabelLeft: edge.originalEdge?.startLabelLeft ?? edge.startLabelLeft,
|
|
4558
|
+
startLabelRight: edge.originalEdge?.startLabelRight ?? edge.startLabelRight,
|
|
4559
|
+
endLabelLeft: edge.originalEdge?.endLabelLeft ?? edge.endLabelLeft,
|
|
4560
|
+
endLabelRight: edge.originalEdge?.endLabelRight ?? edge.endLabelRight
|
|
4561
|
+
};
|
|
4562
|
+
await insertEdgeLabel(edgeLabels, labelEdge);
|
|
4563
|
+
edge.width = labelEdge.width;
|
|
4564
|
+
edge.height = labelEdge.height;
|
|
4565
|
+
edge.labelStyle = labelEdge.labelStyle;
|
|
4566
|
+
return;
|
|
4567
|
+
}
|
|
4568
|
+
await insertEdgeLabel(edgeLabels, edge);
|
|
4569
|
+
});
|
|
4570
|
+
await Promise.all(edgePromises);
|
|
4571
|
+
}, "processEdges"))();
|
|
4572
|
+
const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
|
|
4573
|
+
return {
|
|
4574
|
+
elem,
|
|
4575
|
+
graph,
|
|
4576
|
+
groups: {
|
|
4577
|
+
clusters,
|
|
4578
|
+
edgePaths,
|
|
4579
|
+
edgeLabels,
|
|
4580
|
+
nodes,
|
|
4581
|
+
rootGroups: elem
|
|
4582
|
+
},
|
|
4583
|
+
diagramType,
|
|
4584
|
+
id,
|
|
4585
|
+
mergeSelfLoops,
|
|
4586
|
+
subGraphTitleTotalMargin
|
|
4587
|
+
};
|
|
4588
|
+
}, "measureDagreGraph");
|
|
4589
|
+
var runDagreGraphLayout = /* @__PURE__ */ __name((graph) => {
|
|
4590
|
+
log.info("############################################# XXX");
|
|
4591
|
+
log.info("### Layout ### XXX");
|
|
4592
|
+
log.info("############################################# XXX");
|
|
4593
|
+
layout(graph);
|
|
4594
|
+
}, "runDagreGraphLayout");
|
|
4595
|
+
var normalizeDagreNode = /* @__PURE__ */ __name((graph, nodeId, subGraphTitleTotalMargin) => {
|
|
4596
|
+
const node = graph.node(nodeId);
|
|
4597
|
+
if (!node) return;
|
|
4598
|
+
const normalizedNode = { ...node };
|
|
4599
|
+
if (node?.clusterNode) normalizedNode.y = (node.y ?? 0) + subGraphTitleTotalMargin;
|
|
4600
|
+
else if (graph.children(nodeId).length > 0) normalizedNode.height = (node.height ?? 0) + subGraphTitleTotalMargin;
|
|
4601
|
+
else normalizedNode.y = (node.y ?? 0) + subGraphTitleTotalMargin / 2;
|
|
4602
|
+
return normalizedNode;
|
|
4603
|
+
}, "normalizeDagreNode");
|
|
4604
|
+
var applyDagreNodeLayout = /* @__PURE__ */ __name((targetNode, dagreNode) => {
|
|
4605
|
+
DAGRE_NODE_LAYOUT_PROPERTIES.forEach((property) => {
|
|
4606
|
+
if (dagreNode[property] !== void 0) targetNode[property] = dagreNode[property];
|
|
4607
|
+
});
|
|
4608
|
+
}, "applyDagreNodeLayout");
|
|
4609
|
+
var normalizeDagreEdge = /* @__PURE__ */ __name((edge, start, end, edgeOffsetY) => ({
|
|
4610
|
+
...edge,
|
|
4611
|
+
start: edge.start ?? start,
|
|
4612
|
+
end: edge.end ?? end,
|
|
4613
|
+
points: (edge.points ?? []).map((point) => ({
|
|
4614
|
+
...point,
|
|
4615
|
+
y: typeof point.y === "number" ? point.y + edgeOffsetY : point.y
|
|
4616
|
+
}))
|
|
4617
|
+
}), "normalizeDagreEdge");
|
|
4618
|
+
var applyDagreLayoutResult = /* @__PURE__ */ __name((data4Layout, measuredLayout) => {
|
|
4619
|
+
const { graph, mergeSelfLoops, subGraphTitleTotalMargin = 0 } = measuredLayout;
|
|
4620
|
+
const nodeById = new Map(data4Layout.nodes.map((node) => [node.id, node]));
|
|
4621
|
+
sortNodesByHierarchy(graph).forEach((nodeId) => {
|
|
4622
|
+
const dagreNode = normalizeDagreNode(graph, nodeId, subGraphTitleTotalMargin);
|
|
4623
|
+
if (!dagreNode) return;
|
|
4624
|
+
applyDagreNodeLayout(graph.node(nodeId), dagreNode);
|
|
4625
|
+
const targetNode = nodeById.get(nodeId);
|
|
4626
|
+
if (targetNode) applyDagreNodeLayout(targetNode, dagreNode);
|
|
4627
|
+
});
|
|
4628
|
+
const edgeOffsetY = subGraphTitleTotalMargin / 2;
|
|
4629
|
+
data4Layout.edges = getEdgesToRender(graph, edgeOffsetY, { mergeSelfLoops }).map(({ edge, start, end }) => normalizeDagreEdge(edge, start, end, edgeOffsetY));
|
|
4630
|
+
return data4Layout;
|
|
4631
|
+
}, "applyDagreLayoutResult");
|
|
4632
|
+
var paintDagreLayoutCore = /* @__PURE__ */ __name(async ({ elem, graph, groups: { clusters, edgePaths }, diagramType, id, mergeSelfLoops, subGraphTitleTotalMargin }) => {
|
|
4633
|
+
let diff = 0;
|
|
4634
|
+
await Promise.all(sortNodesByHierarchy(graph).map(async function(v) {
|
|
4635
|
+
const node = graph.node(v);
|
|
4636
|
+
log.info("Position XBX => " + v + ": (" + node.x, "," + node.y, ") width: ", node.width, " height: ", node.height);
|
|
4637
|
+
if (node?.clusterNode) {
|
|
4638
|
+
node.y += subGraphTitleTotalMargin;
|
|
4639
|
+
log.info("A tainted cluster node XBX1", v, node.id, node.width, node.height, node.x, node.y, graph.parent(v));
|
|
4640
|
+
clusterDb.get(node.id).node = node;
|
|
4641
|
+
positionNode(node);
|
|
4642
|
+
} else if (graph.children(v).length > 0) {
|
|
4643
|
+
log.info("A pure cluster node XBX1", v, node.id, node.x, node.y, node.width, node.height, graph.parent(v));
|
|
4644
|
+
node.height += subGraphTitleTotalMargin;
|
|
4645
|
+
graph.node(node.parentId);
|
|
4646
|
+
const halfPadding = node?.padding / 2 || 0;
|
|
4647
|
+
const labelHeight = node?.labelBBox?.height || 0;
|
|
4648
|
+
const offsetY = labelHeight - halfPadding || 0;
|
|
4649
|
+
log.debug("OffsetY", offsetY, "labelHeight", labelHeight, "halfPadding", halfPadding);
|
|
4650
|
+
await insertCluster(clusters, node);
|
|
4651
|
+
clusterDb.get(node.id).node = node;
|
|
4652
|
+
} else {
|
|
4653
|
+
const parent = graph.node(node.parentId);
|
|
4654
|
+
node.y += subGraphTitleTotalMargin / 2;
|
|
4655
|
+
log.info("A regular node XBX1 - using the padding", node.id, "parent", node.parentId, node.width, node.height, node.x, node.y, "offsetY", node.offsetY, "parent", parent, parent?.offsetY, node);
|
|
4656
|
+
positionNode(node);
|
|
4657
|
+
}
|
|
4658
|
+
}));
|
|
4659
|
+
const edgeOffsetY = subGraphTitleTotalMargin / 2;
|
|
4660
|
+
getEdgesToRender(graph, edgeOffsetY, { mergeSelfLoops }).forEach(function({ edge, start, end }) {
|
|
4661
|
+
log.info("Edge " + start + " -> " + end + ": " + JSON.stringify(edge), edge);
|
|
4662
|
+
edge.points.forEach((point) => point.y += edgeOffsetY);
|
|
4663
|
+
positionEdgeLabel(edge, insertEdge(edgePaths, edge, clusterDb, diagramType, graph.node(start), graph.node(end), id));
|
|
4664
|
+
});
|
|
4665
|
+
graph.nodes().forEach(function(v) {
|
|
4666
|
+
const n = graph.node(v);
|
|
4667
|
+
log.info(v, n.type, n.diff);
|
|
4668
|
+
if (n.isGroup) diff = n.diff;
|
|
4669
|
+
});
|
|
4670
|
+
log.warn("Returning from recursive render XAX", elem, diff);
|
|
4671
|
+
return {
|
|
4672
|
+
elem,
|
|
4673
|
+
diff
|
|
4674
|
+
};
|
|
4675
|
+
}, "paintDagreLayoutCore");
|
|
4676
|
+
var renderDagreSubgraph = /* @__PURE__ */ __name(async (options) => {
|
|
4677
|
+
const measuredLayout = await measureDagreGraph(options);
|
|
4678
|
+
runDagreGraphLayout(measuredLayout.graph);
|
|
4679
|
+
return await paintDagreLayoutCore(measuredLayout);
|
|
4680
|
+
}, "renderDagreSubgraph");
|
|
4681
|
+
var prepareLayoutForDagre = /* @__PURE__ */ __name((data4Layout) => {
|
|
4682
|
+
const graph = new Graph({
|
|
4683
|
+
multigraph: true,
|
|
4684
|
+
compound: true
|
|
4685
|
+
}).setGraph({
|
|
4686
|
+
rankdir: data4Layout.direction,
|
|
4687
|
+
nodesep: data4Layout.config?.nodeSpacing || data4Layout.nodeSpacing || data4Layout.config?.flowchart?.nodeSpacing,
|
|
4688
|
+
ranksep: data4Layout.config?.rankSpacing || data4Layout.rankSpacing || data4Layout.config?.flowchart?.rankSpacing,
|
|
4689
|
+
marginx: 8,
|
|
4690
|
+
marginy: 8
|
|
4691
|
+
}).setDefaultEdgeLabel(function() {
|
|
4692
|
+
return {};
|
|
4693
|
+
});
|
|
4694
|
+
data4Layout.nodes.forEach((node) => {
|
|
4695
|
+
graph.setNode(node.id, { ...node });
|
|
4696
|
+
if (node.parentId) graph.setParent(node.id, node.parentId);
|
|
4697
|
+
});
|
|
4698
|
+
log.debug("Edges:", data4Layout.edges);
|
|
4699
|
+
data4Layout.edges.forEach((edge) => {
|
|
4700
|
+
if (edge.start === edge.end) {
|
|
4701
|
+
const nodeId = edge.start;
|
|
4702
|
+
const specialId1 = nodeId + "---" + nodeId + "---1";
|
|
4703
|
+
const specialId2 = nodeId + "---" + nodeId + "---2";
|
|
4704
|
+
const node = graph.node(nodeId);
|
|
4705
|
+
graph.setNode(specialId1, {
|
|
4706
|
+
domId: specialId1,
|
|
4707
|
+
id: specialId1,
|
|
4708
|
+
parentId: node.parentId,
|
|
4709
|
+
labelStyle: "",
|
|
4710
|
+
label: "",
|
|
4711
|
+
padding: 0,
|
|
4712
|
+
shape: "labelRect",
|
|
4713
|
+
style: "",
|
|
4714
|
+
width: 10,
|
|
4715
|
+
height: 10
|
|
4716
|
+
});
|
|
4717
|
+
graph.setParent(specialId1, node.parentId);
|
|
4718
|
+
graph.setNode(specialId2, {
|
|
4719
|
+
domId: specialId2,
|
|
4720
|
+
id: specialId2,
|
|
4721
|
+
parentId: node.parentId,
|
|
4722
|
+
labelStyle: "",
|
|
4723
|
+
padding: 0,
|
|
4724
|
+
shape: "labelRect",
|
|
4725
|
+
label: "",
|
|
4726
|
+
style: "",
|
|
4727
|
+
width: 10,
|
|
4728
|
+
height: 10
|
|
4729
|
+
});
|
|
4730
|
+
graph.setParent(specialId2, node.parentId);
|
|
4731
|
+
const originalEdge = structuredClone(edge);
|
|
4732
|
+
const edge1 = structuredClone(edge);
|
|
4733
|
+
const edgeMid = structuredClone(edge);
|
|
4734
|
+
const edge2 = structuredClone(edge);
|
|
4735
|
+
edge1.originalEdge = originalEdge;
|
|
4736
|
+
edge1.selfLoop = {
|
|
4737
|
+
id: originalEdge.id,
|
|
4738
|
+
order: 0
|
|
4739
|
+
};
|
|
4740
|
+
edgeMid.originalEdge = originalEdge;
|
|
4741
|
+
edgeMid.selfLoop = {
|
|
4742
|
+
id: originalEdge.id,
|
|
4743
|
+
order: 1
|
|
4744
|
+
};
|
|
4745
|
+
edge2.originalEdge = originalEdge;
|
|
4746
|
+
edge2.selfLoop = {
|
|
4747
|
+
id: originalEdge.id,
|
|
4748
|
+
order: 2
|
|
4749
|
+
};
|
|
4750
|
+
edge1.label = "";
|
|
4751
|
+
edge1.arrowTypeEnd = "none";
|
|
4752
|
+
edge1.endLabelLeft = "";
|
|
4753
|
+
edge1.endLabelRight = "";
|
|
4754
|
+
edge1.startLabelLeft = "";
|
|
4755
|
+
edge1.id = nodeId + "-cyclic-special-1";
|
|
4756
|
+
edgeMid.startLabelRight = "";
|
|
4757
|
+
edgeMid.startLabelLeft = "";
|
|
4758
|
+
edgeMid.endLabelLeft = "";
|
|
4759
|
+
edgeMid.endLabelRight = "";
|
|
4760
|
+
edgeMid.arrowTypeStart = "none";
|
|
4761
|
+
edgeMid.arrowTypeEnd = "none";
|
|
4762
|
+
edgeMid.id = nodeId + "-cyclic-special-mid";
|
|
4763
|
+
edge2.label = "";
|
|
4764
|
+
edge2.startLabelRight = "";
|
|
4765
|
+
edge2.startLabelLeft = "";
|
|
4766
|
+
edge2.arrowTypeStart = "none";
|
|
4767
|
+
if (node.isGroup) {
|
|
4768
|
+
edge1.fromCluster = nodeId;
|
|
4769
|
+
edge2.toCluster = nodeId;
|
|
4770
|
+
}
|
|
4771
|
+
edge2.id = nodeId + "-cyclic-special-2";
|
|
4772
|
+
edge2.arrowTypeStart = "none";
|
|
4773
|
+
graph.setEdge(nodeId, specialId1, edge1, nodeId + "-cyclic-special-0");
|
|
4774
|
+
graph.setEdge(specialId1, specialId2, edgeMid, nodeId + "-cyclic-special-1");
|
|
4775
|
+
graph.setEdge(specialId2, nodeId, edge2, nodeId + "-cyclic-special-2");
|
|
4776
|
+
} else graph.setEdge(edge.start, edge.end, { ...edge }, edge.id);
|
|
4777
|
+
});
|
|
4778
|
+
adjustClustersAndEdges(graph);
|
|
4779
|
+
return { graph };
|
|
4780
|
+
}, "prepareLayoutForDagre");
|
|
4781
|
+
var measureDagreLayout = /* @__PURE__ */ __name(async (data4Layout, { element, preparedLayout }) => {
|
|
4782
|
+
const prepared = preparedLayout ?? prepareLayoutForDagre(data4Layout);
|
|
4783
|
+
const siteConfig = getConfig2();
|
|
4784
|
+
const measuredLayout = await measureDagreGraph({
|
|
4785
|
+
element,
|
|
4786
|
+
graph: prepared.graph,
|
|
4787
|
+
diagramType: data4Layout.type,
|
|
4788
|
+
id: data4Layout.diagramId,
|
|
4789
|
+
parentCluster: void 0,
|
|
4790
|
+
siteConfig
|
|
4791
|
+
});
|
|
4792
|
+
prepared.measuredLayout = measuredLayout;
|
|
4793
|
+
return measuredLayout;
|
|
4794
|
+
}, "measureDagreLayout");
|
|
4795
|
+
var runDagreLayoutCore = /* @__PURE__ */ __name((data4Layout, context) => {
|
|
4796
|
+
const measuredLayout = context.preparedLayout?.measuredLayout;
|
|
4797
|
+
if (!measuredLayout) throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");
|
|
4798
|
+
runDagreGraphLayout(measuredLayout.graph);
|
|
4799
|
+
applyDagreLayoutResult(data4Layout, measuredLayout);
|
|
4800
|
+
return measuredLayout;
|
|
4801
|
+
}, "runDagreLayoutCore");
|
|
4802
|
+
var render = createCommonLayoutRenderer({
|
|
4803
|
+
prepareLayout: prepareLayoutForDagre,
|
|
4804
|
+
measureLayout: measureDagreLayout,
|
|
4805
|
+
runLayoutCore: runDagreLayoutCore,
|
|
4806
|
+
paintOptions: {
|
|
4807
|
+
clusterDb,
|
|
4808
|
+
getNodes: /* @__PURE__ */ __name((_data4Layout, { measure }) => sortNodesByHierarchy(measure.graph).map((nodeId) => measure.graph.node(nodeId)).filter(Boolean), "getDagrePaintNodes"),
|
|
4809
|
+
getEdgeNode: /* @__PURE__ */ __name((nodeId, _edge, { measure }) => nodeId ? measure.graph.node(nodeId) : void 0, "getDagreEdgeNode"),
|
|
4810
|
+
skipNode: /* @__PURE__ */ __name((node, { measure }) => !measure.graph.hasNode(node.id), "skipNode"),
|
|
4811
|
+
isCluster: /* @__PURE__ */ __name((node, { measure }) => measure.graph.hasNode(node.id) && (measure.graph.children(node.id) ?? []).length > 0, "isCluster")
|
|
4812
|
+
}
|
|
4813
|
+
});
|
|
4814
|
+
|
|
4815
|
+
//#endregion
|
|
4816
|
+
export { applyDagreLayoutResult, getEdgesToRender, measureDagreLayout, prepareLayoutForDagre, render, runDagreLayoutCore };
|