@n8n-zengchao/chat 0.62.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/README.md +289 -0
- package/dist/App.vue.d.ts +2 -0
- package/dist/__stories__/App.stories.d.ts +18 -0
- package/dist/__tests__/Input.spec.d.ts +1 -0
- package/dist/__tests__/api/generic.spec.d.ts +1 -0
- package/dist/__tests__/api/message.spec.d.ts +1 -0
- package/dist/__tests__/index.spec.d.ts +1 -0
- package/dist/__tests__/plugins/chat.spec.d.ts +1 -0
- package/dist/__tests__/plugins/chat.test.d.ts +1 -0
- package/dist/__tests__/setup.d.ts +0 -0
- package/dist/__tests__/utils/create.d.ts +5 -0
- package/dist/__tests__/utils/fetch.d.ts +13 -0
- package/dist/__tests__/utils/index.d.ts +3 -0
- package/dist/__tests__/utils/selectors.d.ts +12 -0
- package/dist/__tests__/utils/streaming.spec.d.ts +1 -0
- package/dist/__tests__/utils/streamingHandlers.spec.d.ts +1 -0
- package/dist/_basePickBy-aQilsjEs.mjs +106 -0
- package/dist/_baseUniq-Agc10qFQ.mjs +232 -0
- package/dist/api/generic.d.ts +7 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/message.d.ts +11 -0
- package/dist/arc-EhYU_DB1.mjs +79 -0
- package/dist/architecture-U656AL7Q-B1STlXpR.mjs +10 -0
- package/dist/architectureDiagram-VXUJARFQ-DOVAbXSw.mjs +4054 -0
- package/dist/array-B5w981Vk.mjs +5 -0
- package/dist/blockDiagram-VD42YOAC-BsX3Fkg3.mjs +3013 -0
- package/dist/c4Diagram-YG6GDRKO-B5JaLuX6.mjs +2957 -0
- package/dist/channel-CqrIo07y.mjs +4 -0
- package/dist/chat.bundle.es.js +37656 -0
- package/dist/chat.bundle.umd.js +2784 -0
- package/dist/chat.es.js +35738 -0
- package/dist/chat.umd.js +2776 -0
- package/dist/chunk-4BX2VUAB-dn0RXIrC.mjs +7 -0
- package/dist/chunk-55IACEB6-DrIttNoL.mjs +7 -0
- package/dist/chunk-76Q3JFCE-D7DMbWeQ.mjs +20 -0
- package/dist/chunk-ABZYJK2D-_NXv778f.mjs +2516 -0
- package/dist/chunk-ATLVNIR6-CBnG7Ev9.mjs +66 -0
- package/dist/chunk-B4BG7PRW-DElmmAse.mjs +3109 -0
- package/dist/chunk-CVBHYZKI-kPsSw5G9.mjs +11 -0
- package/dist/chunk-DI55MBZ5-Bw6uFFfD.mjs +1995 -0
- package/dist/chunk-DZXZ2BO8.mjs +19 -0
- package/dist/chunk-EXTU4WIE-DWzncOZf.mjs +8 -0
- package/dist/chunk-FMBD7UC4-CQf-nVrj.mjs +4 -0
- package/dist/chunk-FPAJGGOC-HRc6DGju.mjs +12254 -0
- package/dist/chunk-FWNWRKHM-CGiJVNMo.mjs +57 -0
- package/dist/chunk-HN2XXSSU-DMfVdeUE.mjs +75 -0
- package/dist/chunk-JA3XYJ7Z-b0Li4NN8.mjs +1834 -0
- package/dist/chunk-JZLCHNYA-C_4MLySW.mjs +4862 -0
- package/dist/chunk-KS23V3DP-BRKOfbU6.mjs +136 -0
- package/dist/chunk-LBM3YZW2-JIQK8wiH.mjs +20 -0
- package/dist/chunk-LHMN2FUI-PNCyIUgu.mjs +20 -0
- package/dist/chunk-MI3HLSF2-B9GTCmLp.mjs +1146 -0
- package/dist/chunk-N4CR4FBY-CjlmnCPD.mjs +40 -0
- package/dist/chunk-O7ZBX7Z2-DmJUfqJj.mjs +27 -0
- package/dist/chunk-QN33PNHL-nN1zLFSf.mjs +24 -0
- package/dist/chunk-QXUST7PY-CY78Btj9.mjs +487 -0
- package/dist/chunk-QZHKN3VN-BF5N1pfB.mjs +12 -0
- package/dist/chunk-S3R3BYOJ-BhFsv0Go.mjs +1076 -0
- package/dist/chunk-S6J4BHB3-BvrWTdbl.mjs +20 -0
- package/dist/chunk-T53DSG4Q-XzY06amw.mjs +25 -0
- package/dist/chunk-TZMSLE5B-DVmJQ8eg.mjs +57 -0
- package/dist/classDiagram-2ON5EDUG-CKxiEVX9.mjs +33 -0
- package/dist/classDiagram-v2-WZHVMYZB-sAa_2keq.mjs +33 -0
- package/dist/clone-nkGlb0Gn.mjs +8 -0
- package/dist/components/Button.vue.d.ts +17 -0
- package/dist/components/Chat.vue.d.ts +2 -0
- package/dist/components/ChatFile.vue.d.ts +11 -0
- package/dist/components/ChatWindow.vue.d.ts +2 -0
- package/dist/components/GetStarted.vue.d.ts +2 -0
- package/dist/components/GetStartedFooter.vue.d.ts +2 -0
- package/dist/components/Input.vue.d.ts +39 -0
- package/dist/components/Layout.vue.d.ts +23 -0
- package/dist/components/Message.vue.d.ts +39 -0
- package/dist/components/MessageTyping.vue.d.ts +76 -0
- package/dist/components/MessagesList.vue.d.ts +164 -0
- package/dist/components/PoweredBy.vue.d.ts +2 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/composables/index.d.ts +3 -0
- package/dist/composables/useChat.d.ts +2 -0
- package/dist/composables/useI18n.d.ts +4 -0
- package/dist/composables/useOptions.d.ts +4 -0
- package/dist/constants/defaults.d.ts +3 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/localStorage.d.ts +2 -0
- package/dist/constants/symbols.d.ts +4 -0
- package/dist/cose-bilkent-S5V4N54A-1lKG2PUg.mjs +2251 -0
- package/dist/cytoscape.esm-Dls1_mGy.mjs +18108 -0
- package/dist/dagre-6UL2VRFP-CbWFu9xQ.mjs +300 -0
- package/dist/dagre-DEdOheHq.mjs +1385 -0
- package/dist/defaultLocale-CyoQm63E.mjs +178 -0
- package/dist/diagram-PSM6KHXK-CJcHbrJH.mjs +499 -0
- package/dist/diagram-QEK2KX5R-XQ9XOVL4.mjs +228 -0
- package/dist/diagram-S2PKOQOG-CmRfaeSf.mjs +146 -0
- package/dist/dist-BT0fjU7K.mjs +50 -0
- package/dist/erDiagram-Q2GNP2WA-iuoUWHwm.mjs +1603 -0
- package/dist/event-buses/chatEventBus.d.ts +1 -0
- package/dist/event-buses/index.d.ts +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/flowDiagram-NV44I4VS-D3GMS8-G.mjs +4132 -0
- package/dist/ganttDiagram-LVOFAZNH-DMTZVZDR.mjs +2832 -0
- package/dist/gitGraph-F6HP7TQM-CrdUzURw.mjs +10 -0
- package/dist/gitGraphDiagram-NY62KEGX-DipP5Fgt.mjs +636 -0
- package/dist/graphlib-D9eH5icd.mjs +224 -0
- package/dist/index.d.ts +2 -0
- package/dist/info-NVLQJR56-C-93Yf3U.mjs +10 -0
- package/dist/infoDiagram-F6ZHWCRC-jM50s26K.mjs +33 -0
- package/dist/init-CYeu4QfE.mjs +14 -0
- package/dist/isArrayLikeObject-BPcFdnyK.mjs +459 -0
- package/dist/isUndefined-BvarJ1wS.mjs +374 -0
- package/dist/journeyDiagram-XKPGCS4Q-BEEO_0Bh.mjs +885 -0
- package/dist/kanban-definition-3W4ZIXB7-B8u_HDmL.mjs +971 -0
- package/dist/katex-Dc1vXbUC.mjs +22094 -0
- package/dist/line-BJxACIPZ.mjs +31 -0
- package/dist/linear-DHHVI-cj.mjs +251 -0
- package/dist/math-Byg0NvhS.mjs +9 -0
- package/dist/mermaid-parser.core-YT4qvimq.mjs +49 -0
- package/dist/mindmap-definition-VGOIOE7T-ah41V88S.mjs +960 -0
- package/dist/now-DsJMgI1z.mjs +6 -0
- package/dist/ordinal-L0-EVPg8.mjs +62 -0
- package/dist/packet-BFZMPI3H-Cs4kRHct.mjs +10 -0
- package/dist/path-BcDHwjEr.mjs +80 -0
- package/dist/pie-7BOR55EZ-YZ5Xu4o6.mjs +10 -0
- package/dist/pieDiagram-ADFJNKIX-CqI33m1a.mjs +174 -0
- package/dist/plugins/chat.d.ts +3 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/quadrantDiagram-AYHSOK5B-DDv2X9c1.mjs +1971 -0
- package/dist/radar-NHE76QYJ-TpirOFtv.mjs +10 -0
- package/dist/requirementDiagram-UZGBJVZJ-DXa77VzO.mjs +2194 -0
- package/dist/sankeyDiagram-TZEHDZUN--B9DInJC.mjs +885 -0
- package/dist/sequenceDiagram-WL72ISMW-Dqn9jJ3g.mjs +3562 -0
- package/dist/src-DdwtiGjk.mjs +1976 -0
- package/dist/stateDiagram-FKZM4ZOC-D3eEcVjS.mjs +226 -0
- package/dist/stateDiagram-v2-4FDKWEC3-dzwJ4caL.mjs +32 -0
- package/dist/style.css +3 -0
- package/dist/timeline-definition-IT6M3QCI-z93ry7RN.mjs +831 -0
- package/dist/toInteger-1S_4Byef.mjs +36 -0
- package/dist/treemap-KMMF4GRG-BlF0Ev1z.mjs +10 -0
- package/dist/types/chat.d.ts +13 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/messages.d.ts +17 -0
- package/dist/types/options.d.ts +33 -0
- package/dist/types/streaming.d.ts +18 -0
- package/dist/types/webhook.d.ts +19 -0
- package/dist/utils/event-bus.d.ts +8 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/mount.d.ts +1 -0
- package/dist/utils/streaming.d.ts +26 -0
- package/dist/utils/streamingHandlers.d.ts +6 -0
- package/dist/utils/utils.d.ts +1 -0
- package/dist/xychartDiagram-PRI3JC2R-C3aDcgBz.mjs +2022 -0
- package/package.json +78 -0
|
@@ -0,0 +1,1076 @@
|
|
|
1
|
+
/*! Package version @n8n/chat@0.62.0 */
|
|
2
|
+
import { o as __toESM } from "./chunk-DZXZ2BO8.mjs";
|
|
3
|
+
import { A as eq_default, B as isObject_default, F as _copyArray_default, H as isObjectLike_default, O as _copyObject_default, R as isFunction_default, S as _createAssigner_default, U as _baseGetTag_default, V as isArray_default, b as isArguments_default, c as _Stack_default, g as isTypedArray_default, i as _cloneTypedArray_default, j as _baseAssignValue_default, l as _getPrototype_default, n as _baseFor_default, p as keysIn_default, r as _initCloneObject_default, s as _cloneBuffer_default, t as isArrayLikeObject_default, u as memoize_default, y as isBuffer_default } from "./isArrayLikeObject-BPcFdnyK.mjs";
|
|
4
|
+
import { g as log, h as __name, p as select_default } from "./src-DdwtiGjk.mjs";
|
|
5
|
+
import { F as sanitizeDirective, f as detectType, m as directiveRegex, r as assignWithDepth_default, s as common_default } from "./chunk-ABZYJK2D-_NXv778f.mjs";
|
|
6
|
+
import { o as epsilon } from "./math-Byg0NvhS.mjs";
|
|
7
|
+
import { t as require_dist } from "./dist-BT0fjU7K.mjs";
|
|
8
|
+
var objectTag = "[object Object]", funcProto = Function.prototype, objectProto = Object.prototype, funcToString = funcProto.toString, hasOwnProperty = objectProto.hasOwnProperty, objectCtorString = funcToString.call(Object);
|
|
9
|
+
function isPlainObject(o) {
|
|
10
|
+
if (!isObjectLike_default(o) || _baseGetTag_default(o) != objectTag) return !1;
|
|
11
|
+
var F = _getPrototype_default(o);
|
|
12
|
+
if (F === null) return !0;
|
|
13
|
+
var I = hasOwnProperty.call(F, "constructor") && F.constructor;
|
|
14
|
+
return typeof I == "function" && I instanceof I && funcToString.call(I) == objectCtorString;
|
|
15
|
+
}
|
|
16
|
+
var isPlainObject_default = isPlainObject;
|
|
17
|
+
function assignMergeValue(o, I, L) {
|
|
18
|
+
(L !== void 0 && !eq_default(o[I], L) || L === void 0 && !(I in o)) && _baseAssignValue_default(o, I, L);
|
|
19
|
+
}
|
|
20
|
+
var _assignMergeValue_default = assignMergeValue;
|
|
21
|
+
function safeGet(o, F) {
|
|
22
|
+
if (!(F === "constructor" && typeof o[F] == "function") && F != "__proto__") return o[F];
|
|
23
|
+
}
|
|
24
|
+
var _safeGet_default = safeGet;
|
|
25
|
+
function toPlainObject(o) {
|
|
26
|
+
return _copyObject_default(o, keysIn_default(o));
|
|
27
|
+
}
|
|
28
|
+
var toPlainObject_default = toPlainObject;
|
|
29
|
+
function baseMergeDeep(o, F, R, z, V, H, G) {
|
|
30
|
+
var K = _safeGet_default(o, R), q = _safeGet_default(F, R), J = G.get(q);
|
|
31
|
+
if (J) {
|
|
32
|
+
_assignMergeValue_default(o, R, J);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
var Y = H ? H(K, q, R + "", o, F, G) : void 0, X = Y === void 0;
|
|
36
|
+
if (X) {
|
|
37
|
+
var Z = isArray_default(q), Q = !Z && isBuffer_default(q), $ = !Z && !Q && isTypedArray_default(q);
|
|
38
|
+
Y = q, Z || Q || $ ? isArray_default(K) ? Y = K : isArrayLikeObject_default(K) ? Y = _copyArray_default(K) : Q ? (X = !1, Y = _cloneBuffer_default(q, !0)) : $ ? (X = !1, Y = _cloneTypedArray_default(q, !0)) : Y = [] : isPlainObject_default(q) || isArguments_default(q) ? (Y = K, isArguments_default(K) ? Y = toPlainObject_default(K) : (!isObject_default(K) || isFunction_default(K)) && (Y = _initCloneObject_default(q))) : X = !1;
|
|
39
|
+
}
|
|
40
|
+
X && (G.set(q, Y), V(Y, q, z, H, G), G.delete(q)), _assignMergeValue_default(o, R, Y);
|
|
41
|
+
}
|
|
42
|
+
var _baseMergeDeep_default = baseMergeDeep;
|
|
43
|
+
function baseMerge(o, F, L, R, z) {
|
|
44
|
+
o !== F && _baseFor_default(F, function(B, V) {
|
|
45
|
+
if (z ||= new _Stack_default(), isObject_default(B)) _baseMergeDeep_default(o, F, V, L, baseMerge, R, z);
|
|
46
|
+
else {
|
|
47
|
+
var H = R ? R(_safeGet_default(o, V), B, V + "", o, F, z) : void 0;
|
|
48
|
+
H === void 0 && (H = B), _assignMergeValue_default(o, V, H);
|
|
49
|
+
}
|
|
50
|
+
}, keysIn_default);
|
|
51
|
+
}
|
|
52
|
+
var _baseMerge_default = baseMerge, merge_default = _createAssigner_default(function(o, F, I) {
|
|
53
|
+
_baseMerge_default(o, F, I);
|
|
54
|
+
});
|
|
55
|
+
function Linear(o) {
|
|
56
|
+
this._context = o;
|
|
57
|
+
}
|
|
58
|
+
Linear.prototype = {
|
|
59
|
+
areaStart: function() {
|
|
60
|
+
this._line = 0;
|
|
61
|
+
},
|
|
62
|
+
areaEnd: function() {
|
|
63
|
+
this._line = NaN;
|
|
64
|
+
},
|
|
65
|
+
lineStart: function() {
|
|
66
|
+
this._point = 0;
|
|
67
|
+
},
|
|
68
|
+
lineEnd: function() {
|
|
69
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
70
|
+
},
|
|
71
|
+
point: function(o, F) {
|
|
72
|
+
switch (o = +o, F = +F, this._point) {
|
|
73
|
+
case 0:
|
|
74
|
+
this._point = 1, this._line ? this._context.lineTo(o, F) : this._context.moveTo(o, F);
|
|
75
|
+
break;
|
|
76
|
+
case 1: this._point = 2;
|
|
77
|
+
default:
|
|
78
|
+
this._context.lineTo(o, F);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
function linear_default(o) {
|
|
84
|
+
return new Linear(o);
|
|
85
|
+
}
|
|
86
|
+
var Bump = class {
|
|
87
|
+
constructor(o, F) {
|
|
88
|
+
this._context = o, this._x = F;
|
|
89
|
+
}
|
|
90
|
+
areaStart() {
|
|
91
|
+
this._line = 0;
|
|
92
|
+
}
|
|
93
|
+
areaEnd() {
|
|
94
|
+
this._line = NaN;
|
|
95
|
+
}
|
|
96
|
+
lineStart() {
|
|
97
|
+
this._point = 0;
|
|
98
|
+
}
|
|
99
|
+
lineEnd() {
|
|
100
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
101
|
+
}
|
|
102
|
+
point(o, F) {
|
|
103
|
+
switch (o = +o, F = +F, this._point) {
|
|
104
|
+
case 0:
|
|
105
|
+
this._point = 1, this._line ? this._context.lineTo(o, F) : this._context.moveTo(o, F);
|
|
106
|
+
break;
|
|
107
|
+
case 1: this._point = 2;
|
|
108
|
+
default:
|
|
109
|
+
this._x ? this._context.bezierCurveTo(this._x0 = (this._x0 + o) / 2, this._y0, this._x0, F, o, F) : this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + F) / 2, o, this._y0, o, F);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
this._x0 = o, this._y0 = F;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function bumpX(o) {
|
|
116
|
+
return new Bump(o, !0);
|
|
117
|
+
}
|
|
118
|
+
function bumpY(o) {
|
|
119
|
+
return new Bump(o, !1);
|
|
120
|
+
}
|
|
121
|
+
function noop_default() {}
|
|
122
|
+
function point$3(o, F, I) {
|
|
123
|
+
o._context.bezierCurveTo((2 * o._x0 + o._x1) / 3, (2 * o._y0 + o._y1) / 3, (o._x0 + 2 * o._x1) / 3, (o._y0 + 2 * o._y1) / 3, (o._x0 + 4 * o._x1 + F) / 6, (o._y0 + 4 * o._y1 + I) / 6);
|
|
124
|
+
}
|
|
125
|
+
function Basis(o) {
|
|
126
|
+
this._context = o;
|
|
127
|
+
}
|
|
128
|
+
Basis.prototype = {
|
|
129
|
+
areaStart: function() {
|
|
130
|
+
this._line = 0;
|
|
131
|
+
},
|
|
132
|
+
areaEnd: function() {
|
|
133
|
+
this._line = NaN;
|
|
134
|
+
},
|
|
135
|
+
lineStart: function() {
|
|
136
|
+
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
|
|
137
|
+
},
|
|
138
|
+
lineEnd: function() {
|
|
139
|
+
switch (this._point) {
|
|
140
|
+
case 3: point$3(this, this._x1, this._y1);
|
|
141
|
+
case 2:
|
|
142
|
+
this._context.lineTo(this._x1, this._y1);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
146
|
+
},
|
|
147
|
+
point: function(o, F) {
|
|
148
|
+
switch (o = +o, F = +F, this._point) {
|
|
149
|
+
case 0:
|
|
150
|
+
this._point = 1, this._line ? this._context.lineTo(o, F) : this._context.moveTo(o, F);
|
|
151
|
+
break;
|
|
152
|
+
case 1:
|
|
153
|
+
this._point = 2;
|
|
154
|
+
break;
|
|
155
|
+
case 2: this._point = 3, this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
|
|
156
|
+
default:
|
|
157
|
+
point$3(this, o, F);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
this._x0 = this._x1, this._x1 = o, this._y0 = this._y1, this._y1 = F;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
function basis_default(o) {
|
|
164
|
+
return new Basis(o);
|
|
165
|
+
}
|
|
166
|
+
function BasisClosed(o) {
|
|
167
|
+
this._context = o;
|
|
168
|
+
}
|
|
169
|
+
BasisClosed.prototype = {
|
|
170
|
+
areaStart: noop_default,
|
|
171
|
+
areaEnd: noop_default,
|
|
172
|
+
lineStart: function() {
|
|
173
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN, this._point = 0;
|
|
174
|
+
},
|
|
175
|
+
lineEnd: function() {
|
|
176
|
+
switch (this._point) {
|
|
177
|
+
case 1:
|
|
178
|
+
this._context.moveTo(this._x2, this._y2), this._context.closePath();
|
|
179
|
+
break;
|
|
180
|
+
case 2:
|
|
181
|
+
this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3), this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3), this._context.closePath();
|
|
182
|
+
break;
|
|
183
|
+
case 3:
|
|
184
|
+
this.point(this._x2, this._y2), this.point(this._x3, this._y3), this.point(this._x4, this._y4);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
point: function(o, F) {
|
|
189
|
+
switch (o = +o, F = +F, this._point) {
|
|
190
|
+
case 0:
|
|
191
|
+
this._point = 1, this._x2 = o, this._y2 = F;
|
|
192
|
+
break;
|
|
193
|
+
case 1:
|
|
194
|
+
this._point = 2, this._x3 = o, this._y3 = F;
|
|
195
|
+
break;
|
|
196
|
+
case 2:
|
|
197
|
+
this._point = 3, this._x4 = o, this._y4 = F, this._context.moveTo((this._x0 + 4 * this._x1 + o) / 6, (this._y0 + 4 * this._y1 + F) / 6);
|
|
198
|
+
break;
|
|
199
|
+
default:
|
|
200
|
+
point$3(this, o, F);
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
this._x0 = this._x1, this._x1 = o, this._y0 = this._y1, this._y1 = F;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
function basisClosed_default(o) {
|
|
207
|
+
return new BasisClosed(o);
|
|
208
|
+
}
|
|
209
|
+
function BasisOpen(o) {
|
|
210
|
+
this._context = o;
|
|
211
|
+
}
|
|
212
|
+
BasisOpen.prototype = {
|
|
213
|
+
areaStart: function() {
|
|
214
|
+
this._line = 0;
|
|
215
|
+
},
|
|
216
|
+
areaEnd: function() {
|
|
217
|
+
this._line = NaN;
|
|
218
|
+
},
|
|
219
|
+
lineStart: function() {
|
|
220
|
+
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
|
|
221
|
+
},
|
|
222
|
+
lineEnd: function() {
|
|
223
|
+
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
|
|
224
|
+
},
|
|
225
|
+
point: function(o, F) {
|
|
226
|
+
switch (o = +o, F = +F, this._point) {
|
|
227
|
+
case 0:
|
|
228
|
+
this._point = 1;
|
|
229
|
+
break;
|
|
230
|
+
case 1:
|
|
231
|
+
this._point = 2;
|
|
232
|
+
break;
|
|
233
|
+
case 2:
|
|
234
|
+
this._point = 3;
|
|
235
|
+
var I = (this._x0 + 4 * this._x1 + o) / 6, L = (this._y0 + 4 * this._y1 + F) / 6;
|
|
236
|
+
this._line ? this._context.lineTo(I, L) : this._context.moveTo(I, L);
|
|
237
|
+
break;
|
|
238
|
+
case 3: this._point = 4;
|
|
239
|
+
default:
|
|
240
|
+
point$3(this, o, F);
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
this._x0 = this._x1, this._x1 = o, this._y0 = this._y1, this._y1 = F;
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
function basisOpen_default(o) {
|
|
247
|
+
return new BasisOpen(o);
|
|
248
|
+
}
|
|
249
|
+
function Bundle(o, F) {
|
|
250
|
+
this._basis = new Basis(o), this._beta = F;
|
|
251
|
+
}
|
|
252
|
+
Bundle.prototype = {
|
|
253
|
+
lineStart: function() {
|
|
254
|
+
this._x = [], this._y = [], this._basis.lineStart();
|
|
255
|
+
},
|
|
256
|
+
lineEnd: function() {
|
|
257
|
+
var o = this._x, F = this._y, I = o.length - 1;
|
|
258
|
+
if (I > 0) for (var L = o[0], R = F[0], z = o[I] - L, B = F[I] - R, V = -1, H; ++V <= I;) H = V / I, this._basis.point(this._beta * o[V] + (1 - this._beta) * (L + H * z), this._beta * F[V] + (1 - this._beta) * (R + H * B));
|
|
259
|
+
this._x = this._y = null, this._basis.lineEnd();
|
|
260
|
+
},
|
|
261
|
+
point: function(o, F) {
|
|
262
|
+
this._x.push(+o), this._y.push(+F);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var bundle_default = (function o(F) {
|
|
266
|
+
function I(o) {
|
|
267
|
+
return F === 1 ? new Basis(o) : new Bundle(o, F);
|
|
268
|
+
}
|
|
269
|
+
return I.beta = function(F) {
|
|
270
|
+
return o(+F);
|
|
271
|
+
}, I;
|
|
272
|
+
})(.85);
|
|
273
|
+
function point$2(o, F, I) {
|
|
274
|
+
o._context.bezierCurveTo(o._x1 + o._k * (o._x2 - o._x0), o._y1 + o._k * (o._y2 - o._y0), o._x2 + o._k * (o._x1 - F), o._y2 + o._k * (o._y1 - I), o._x2, o._y2);
|
|
275
|
+
}
|
|
276
|
+
function Cardinal(o, F) {
|
|
277
|
+
this._context = o, this._k = (1 - F) / 6;
|
|
278
|
+
}
|
|
279
|
+
Cardinal.prototype = {
|
|
280
|
+
areaStart: function() {
|
|
281
|
+
this._line = 0;
|
|
282
|
+
},
|
|
283
|
+
areaEnd: function() {
|
|
284
|
+
this._line = NaN;
|
|
285
|
+
},
|
|
286
|
+
lineStart: function() {
|
|
287
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
|
|
288
|
+
},
|
|
289
|
+
lineEnd: function() {
|
|
290
|
+
switch (this._point) {
|
|
291
|
+
case 2:
|
|
292
|
+
this._context.lineTo(this._x2, this._y2);
|
|
293
|
+
break;
|
|
294
|
+
case 3:
|
|
295
|
+
point$2(this, this._x1, this._y1);
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
299
|
+
},
|
|
300
|
+
point: function(o, F) {
|
|
301
|
+
switch (o = +o, F = +F, this._point) {
|
|
302
|
+
case 0:
|
|
303
|
+
this._point = 1, this._line ? this._context.lineTo(o, F) : this._context.moveTo(o, F);
|
|
304
|
+
break;
|
|
305
|
+
case 1:
|
|
306
|
+
this._point = 2, this._x1 = o, this._y1 = F;
|
|
307
|
+
break;
|
|
308
|
+
case 2: this._point = 3;
|
|
309
|
+
default:
|
|
310
|
+
point$2(this, o, F);
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = o, this._y0 = this._y1, this._y1 = this._y2, this._y2 = F;
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
var cardinal_default = (function o(F) {
|
|
317
|
+
function I(o) {
|
|
318
|
+
return new Cardinal(o, F);
|
|
319
|
+
}
|
|
320
|
+
return I.tension = function(F) {
|
|
321
|
+
return o(+F);
|
|
322
|
+
}, I;
|
|
323
|
+
})(0);
|
|
324
|
+
function CardinalClosed(o, F) {
|
|
325
|
+
this._context = o, this._k = (1 - F) / 6;
|
|
326
|
+
}
|
|
327
|
+
CardinalClosed.prototype = {
|
|
328
|
+
areaStart: noop_default,
|
|
329
|
+
areaEnd: noop_default,
|
|
330
|
+
lineStart: function() {
|
|
331
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, this._point = 0;
|
|
332
|
+
},
|
|
333
|
+
lineEnd: function() {
|
|
334
|
+
switch (this._point) {
|
|
335
|
+
case 1:
|
|
336
|
+
this._context.moveTo(this._x3, this._y3), this._context.closePath();
|
|
337
|
+
break;
|
|
338
|
+
case 2:
|
|
339
|
+
this._context.lineTo(this._x3, this._y3), this._context.closePath();
|
|
340
|
+
break;
|
|
341
|
+
case 3:
|
|
342
|
+
this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
point: function(o, F) {
|
|
347
|
+
switch (o = +o, F = +F, this._point) {
|
|
348
|
+
case 0:
|
|
349
|
+
this._point = 1, this._x3 = o, this._y3 = F;
|
|
350
|
+
break;
|
|
351
|
+
case 1:
|
|
352
|
+
this._point = 2, this._context.moveTo(this._x4 = o, this._y4 = F);
|
|
353
|
+
break;
|
|
354
|
+
case 2:
|
|
355
|
+
this._point = 3, this._x5 = o, this._y5 = F;
|
|
356
|
+
break;
|
|
357
|
+
default:
|
|
358
|
+
point$2(this, o, F);
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = o, this._y0 = this._y1, this._y1 = this._y2, this._y2 = F;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
var cardinalClosed_default = (function o(F) {
|
|
365
|
+
function I(o) {
|
|
366
|
+
return new CardinalClosed(o, F);
|
|
367
|
+
}
|
|
368
|
+
return I.tension = function(F) {
|
|
369
|
+
return o(+F);
|
|
370
|
+
}, I;
|
|
371
|
+
})(0);
|
|
372
|
+
function CardinalOpen(o, F) {
|
|
373
|
+
this._context = o, this._k = (1 - F) / 6;
|
|
374
|
+
}
|
|
375
|
+
CardinalOpen.prototype = {
|
|
376
|
+
areaStart: function() {
|
|
377
|
+
this._line = 0;
|
|
378
|
+
},
|
|
379
|
+
areaEnd: function() {
|
|
380
|
+
this._line = NaN;
|
|
381
|
+
},
|
|
382
|
+
lineStart: function() {
|
|
383
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
|
|
384
|
+
},
|
|
385
|
+
lineEnd: function() {
|
|
386
|
+
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
|
|
387
|
+
},
|
|
388
|
+
point: function(o, F) {
|
|
389
|
+
switch (o = +o, F = +F, this._point) {
|
|
390
|
+
case 0:
|
|
391
|
+
this._point = 1;
|
|
392
|
+
break;
|
|
393
|
+
case 1:
|
|
394
|
+
this._point = 2;
|
|
395
|
+
break;
|
|
396
|
+
case 2:
|
|
397
|
+
this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
|
398
|
+
break;
|
|
399
|
+
case 3: this._point = 4;
|
|
400
|
+
default:
|
|
401
|
+
point$2(this, o, F);
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = o, this._y0 = this._y1, this._y1 = this._y2, this._y2 = F;
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
var cardinalOpen_default = (function o(F) {
|
|
408
|
+
function I(o) {
|
|
409
|
+
return new CardinalOpen(o, F);
|
|
410
|
+
}
|
|
411
|
+
return I.tension = function(F) {
|
|
412
|
+
return o(+F);
|
|
413
|
+
}, I;
|
|
414
|
+
})(0);
|
|
415
|
+
function point$1(o, F, I) {
|
|
416
|
+
var L = o._x1, R = o._y1, z = o._x2, B = o._y2;
|
|
417
|
+
if (o._l01_a > 1e-12) {
|
|
418
|
+
var V = 2 * o._l01_2a + 3 * o._l01_a * o._l12_a + o._l12_2a, H = 3 * o._l01_a * (o._l01_a + o._l12_a);
|
|
419
|
+
L = (L * V - o._x0 * o._l12_2a + o._x2 * o._l01_2a) / H, R = (R * V - o._y0 * o._l12_2a + o._y2 * o._l01_2a) / H;
|
|
420
|
+
}
|
|
421
|
+
if (o._l23_a > 1e-12) {
|
|
422
|
+
var U = 2 * o._l23_2a + 3 * o._l23_a * o._l12_a + o._l12_2a, W = 3 * o._l23_a * (o._l23_a + o._l12_a);
|
|
423
|
+
z = (z * U + o._x1 * o._l23_2a - F * o._l12_2a) / W, B = (B * U + o._y1 * o._l23_2a - I * o._l12_2a) / W;
|
|
424
|
+
}
|
|
425
|
+
o._context.bezierCurveTo(L, R, z, B, o._x2, o._y2);
|
|
426
|
+
}
|
|
427
|
+
function CatmullRom(o, F) {
|
|
428
|
+
this._context = o, this._alpha = F;
|
|
429
|
+
}
|
|
430
|
+
CatmullRom.prototype = {
|
|
431
|
+
areaStart: function() {
|
|
432
|
+
this._line = 0;
|
|
433
|
+
},
|
|
434
|
+
areaEnd: function() {
|
|
435
|
+
this._line = NaN;
|
|
436
|
+
},
|
|
437
|
+
lineStart: function() {
|
|
438
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
439
|
+
},
|
|
440
|
+
lineEnd: function() {
|
|
441
|
+
switch (this._point) {
|
|
442
|
+
case 2:
|
|
443
|
+
this._context.lineTo(this._x2, this._y2);
|
|
444
|
+
break;
|
|
445
|
+
case 3:
|
|
446
|
+
this.point(this._x2, this._y2);
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
450
|
+
},
|
|
451
|
+
point: function(o, F) {
|
|
452
|
+
if (o = +o, F = +F, this._point) {
|
|
453
|
+
var I = this._x2 - o, L = this._y2 - F;
|
|
454
|
+
this._l23_a = Math.sqrt(this._l23_2a = (I * I + L * L) ** +this._alpha);
|
|
455
|
+
}
|
|
456
|
+
switch (this._point) {
|
|
457
|
+
case 0:
|
|
458
|
+
this._point = 1, this._line ? this._context.lineTo(o, F) : this._context.moveTo(o, F);
|
|
459
|
+
break;
|
|
460
|
+
case 1:
|
|
461
|
+
this._point = 2;
|
|
462
|
+
break;
|
|
463
|
+
case 2: this._point = 3;
|
|
464
|
+
default:
|
|
465
|
+
point$1(this, o, F);
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = o, this._y0 = this._y1, this._y1 = this._y2, this._y2 = F;
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
var catmullRom_default = (function o(F) {
|
|
472
|
+
function I(o) {
|
|
473
|
+
return F ? new CatmullRom(o, F) : new Cardinal(o, 0);
|
|
474
|
+
}
|
|
475
|
+
return I.alpha = function(F) {
|
|
476
|
+
return o(+F);
|
|
477
|
+
}, I;
|
|
478
|
+
})(.5);
|
|
479
|
+
function CatmullRomClosed(o, F) {
|
|
480
|
+
this._context = o, this._alpha = F;
|
|
481
|
+
}
|
|
482
|
+
CatmullRomClosed.prototype = {
|
|
483
|
+
areaStart: noop_default,
|
|
484
|
+
areaEnd: noop_default,
|
|
485
|
+
lineStart: function() {
|
|
486
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
487
|
+
},
|
|
488
|
+
lineEnd: function() {
|
|
489
|
+
switch (this._point) {
|
|
490
|
+
case 1:
|
|
491
|
+
this._context.moveTo(this._x3, this._y3), this._context.closePath();
|
|
492
|
+
break;
|
|
493
|
+
case 2:
|
|
494
|
+
this._context.lineTo(this._x3, this._y3), this._context.closePath();
|
|
495
|
+
break;
|
|
496
|
+
case 3:
|
|
497
|
+
this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
point: function(o, F) {
|
|
502
|
+
if (o = +o, F = +F, this._point) {
|
|
503
|
+
var I = this._x2 - o, L = this._y2 - F;
|
|
504
|
+
this._l23_a = Math.sqrt(this._l23_2a = (I * I + L * L) ** +this._alpha);
|
|
505
|
+
}
|
|
506
|
+
switch (this._point) {
|
|
507
|
+
case 0:
|
|
508
|
+
this._point = 1, this._x3 = o, this._y3 = F;
|
|
509
|
+
break;
|
|
510
|
+
case 1:
|
|
511
|
+
this._point = 2, this._context.moveTo(this._x4 = o, this._y4 = F);
|
|
512
|
+
break;
|
|
513
|
+
case 2:
|
|
514
|
+
this._point = 3, this._x5 = o, this._y5 = F;
|
|
515
|
+
break;
|
|
516
|
+
default:
|
|
517
|
+
point$1(this, o, F);
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = o, this._y0 = this._y1, this._y1 = this._y2, this._y2 = F;
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
var catmullRomClosed_default = (function o(F) {
|
|
524
|
+
function I(o) {
|
|
525
|
+
return F ? new CatmullRomClosed(o, F) : new CardinalClosed(o, 0);
|
|
526
|
+
}
|
|
527
|
+
return I.alpha = function(F) {
|
|
528
|
+
return o(+F);
|
|
529
|
+
}, I;
|
|
530
|
+
})(.5);
|
|
531
|
+
function CatmullRomOpen(o, F) {
|
|
532
|
+
this._context = o, this._alpha = F;
|
|
533
|
+
}
|
|
534
|
+
CatmullRomOpen.prototype = {
|
|
535
|
+
areaStart: function() {
|
|
536
|
+
this._line = 0;
|
|
537
|
+
},
|
|
538
|
+
areaEnd: function() {
|
|
539
|
+
this._line = NaN;
|
|
540
|
+
},
|
|
541
|
+
lineStart: function() {
|
|
542
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
543
|
+
},
|
|
544
|
+
lineEnd: function() {
|
|
545
|
+
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
|
|
546
|
+
},
|
|
547
|
+
point: function(o, F) {
|
|
548
|
+
if (o = +o, F = +F, this._point) {
|
|
549
|
+
var I = this._x2 - o, L = this._y2 - F;
|
|
550
|
+
this._l23_a = Math.sqrt(this._l23_2a = (I * I + L * L) ** +this._alpha);
|
|
551
|
+
}
|
|
552
|
+
switch (this._point) {
|
|
553
|
+
case 0:
|
|
554
|
+
this._point = 1;
|
|
555
|
+
break;
|
|
556
|
+
case 1:
|
|
557
|
+
this._point = 2;
|
|
558
|
+
break;
|
|
559
|
+
case 2:
|
|
560
|
+
this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
|
561
|
+
break;
|
|
562
|
+
case 3: this._point = 4;
|
|
563
|
+
default:
|
|
564
|
+
point$1(this, o, F);
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = o, this._y0 = this._y1, this._y1 = this._y2, this._y2 = F;
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
var catmullRomOpen_default = (function o(F) {
|
|
571
|
+
function I(o) {
|
|
572
|
+
return F ? new CatmullRomOpen(o, F) : new CardinalOpen(o, 0);
|
|
573
|
+
}
|
|
574
|
+
return I.alpha = function(F) {
|
|
575
|
+
return o(+F);
|
|
576
|
+
}, I;
|
|
577
|
+
})(.5);
|
|
578
|
+
function LinearClosed(o) {
|
|
579
|
+
this._context = o;
|
|
580
|
+
}
|
|
581
|
+
LinearClosed.prototype = {
|
|
582
|
+
areaStart: noop_default,
|
|
583
|
+
areaEnd: noop_default,
|
|
584
|
+
lineStart: function() {
|
|
585
|
+
this._point = 0;
|
|
586
|
+
},
|
|
587
|
+
lineEnd: function() {
|
|
588
|
+
this._point && this._context.closePath();
|
|
589
|
+
},
|
|
590
|
+
point: function(o, F) {
|
|
591
|
+
o = +o, F = +F, this._point ? this._context.lineTo(o, F) : (this._point = 1, this._context.moveTo(o, F));
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
function linearClosed_default(o) {
|
|
595
|
+
return new LinearClosed(o);
|
|
596
|
+
}
|
|
597
|
+
function sign(o) {
|
|
598
|
+
return o < 0 ? -1 : 1;
|
|
599
|
+
}
|
|
600
|
+
function slope3(o, F, I) {
|
|
601
|
+
var L = o._x1 - o._x0, R = F - o._x1, z = (o._y1 - o._y0) / (L || R < 0 && -0), B = (I - o._y1) / (R || L < 0 && -0), V = (z * R + B * L) / (L + R);
|
|
602
|
+
return (sign(z) + sign(B)) * Math.min(Math.abs(z), Math.abs(B), .5 * Math.abs(V)) || 0;
|
|
603
|
+
}
|
|
604
|
+
function slope2(o, F) {
|
|
605
|
+
var I = o._x1 - o._x0;
|
|
606
|
+
return I ? (3 * (o._y1 - o._y0) / I - F) / 2 : F;
|
|
607
|
+
}
|
|
608
|
+
function point(o, F, I) {
|
|
609
|
+
var L = o._x0, R = o._y0, z = o._x1, B = o._y1, V = (z - L) / 3;
|
|
610
|
+
o._context.bezierCurveTo(L + V, R + V * F, z - V, B - V * I, z, B);
|
|
611
|
+
}
|
|
612
|
+
function MonotoneX(o) {
|
|
613
|
+
this._context = o;
|
|
614
|
+
}
|
|
615
|
+
MonotoneX.prototype = {
|
|
616
|
+
areaStart: function() {
|
|
617
|
+
this._line = 0;
|
|
618
|
+
},
|
|
619
|
+
areaEnd: function() {
|
|
620
|
+
this._line = NaN;
|
|
621
|
+
},
|
|
622
|
+
lineStart: function() {
|
|
623
|
+
this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
|
|
624
|
+
},
|
|
625
|
+
lineEnd: function() {
|
|
626
|
+
switch (this._point) {
|
|
627
|
+
case 2:
|
|
628
|
+
this._context.lineTo(this._x1, this._y1);
|
|
629
|
+
break;
|
|
630
|
+
case 3:
|
|
631
|
+
point(this, this._t0, slope2(this, this._t0));
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
635
|
+
},
|
|
636
|
+
point: function(o, F) {
|
|
637
|
+
var I = NaN;
|
|
638
|
+
if (o = +o, F = +F, !(o === this._x1 && F === this._y1)) {
|
|
639
|
+
switch (this._point) {
|
|
640
|
+
case 0:
|
|
641
|
+
this._point = 1, this._line ? this._context.lineTo(o, F) : this._context.moveTo(o, F);
|
|
642
|
+
break;
|
|
643
|
+
case 1:
|
|
644
|
+
this._point = 2;
|
|
645
|
+
break;
|
|
646
|
+
case 2:
|
|
647
|
+
this._point = 3, point(this, slope2(this, I = slope3(this, o, F)), I);
|
|
648
|
+
break;
|
|
649
|
+
default:
|
|
650
|
+
point(this, this._t0, I = slope3(this, o, F));
|
|
651
|
+
break;
|
|
652
|
+
}
|
|
653
|
+
this._x0 = this._x1, this._x1 = o, this._y0 = this._y1, this._y1 = F, this._t0 = I;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
function MonotoneY(o) {
|
|
658
|
+
this._context = new ReflectContext(o);
|
|
659
|
+
}
|
|
660
|
+
(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(o, F) {
|
|
661
|
+
MonotoneX.prototype.point.call(this, F, o);
|
|
662
|
+
};
|
|
663
|
+
function ReflectContext(o) {
|
|
664
|
+
this._context = o;
|
|
665
|
+
}
|
|
666
|
+
ReflectContext.prototype = {
|
|
667
|
+
moveTo: function(o, F) {
|
|
668
|
+
this._context.moveTo(F, o);
|
|
669
|
+
},
|
|
670
|
+
closePath: function() {
|
|
671
|
+
this._context.closePath();
|
|
672
|
+
},
|
|
673
|
+
lineTo: function(o, F) {
|
|
674
|
+
this._context.lineTo(F, o);
|
|
675
|
+
},
|
|
676
|
+
bezierCurveTo: function(o, F, I, L, R, z) {
|
|
677
|
+
this._context.bezierCurveTo(F, o, L, I, z, R);
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
function monotoneX(o) {
|
|
681
|
+
return new MonotoneX(o);
|
|
682
|
+
}
|
|
683
|
+
function monotoneY(o) {
|
|
684
|
+
return new MonotoneY(o);
|
|
685
|
+
}
|
|
686
|
+
function Natural(o) {
|
|
687
|
+
this._context = o;
|
|
688
|
+
}
|
|
689
|
+
Natural.prototype = {
|
|
690
|
+
areaStart: function() {
|
|
691
|
+
this._line = 0;
|
|
692
|
+
},
|
|
693
|
+
areaEnd: function() {
|
|
694
|
+
this._line = NaN;
|
|
695
|
+
},
|
|
696
|
+
lineStart: function() {
|
|
697
|
+
this._x = [], this._y = [];
|
|
698
|
+
},
|
|
699
|
+
lineEnd: function() {
|
|
700
|
+
var o = this._x, F = this._y, I = o.length;
|
|
701
|
+
if (I) if (this._line ? this._context.lineTo(o[0], F[0]) : this._context.moveTo(o[0], F[0]), I === 2) this._context.lineTo(o[1], F[1]);
|
|
702
|
+
else for (var L = controlPoints(o), R = controlPoints(F), z = 0, B = 1; B < I; ++z, ++B) this._context.bezierCurveTo(L[0][z], R[0][z], L[1][z], R[1][z], o[B], F[B]);
|
|
703
|
+
(this._line || this._line !== 0 && I === 1) && this._context.closePath(), this._line = 1 - this._line, this._x = this._y = null;
|
|
704
|
+
},
|
|
705
|
+
point: function(o, F) {
|
|
706
|
+
this._x.push(+o), this._y.push(+F);
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
function controlPoints(o) {
|
|
710
|
+
var F, I = o.length - 1, L, R = Array(I), z = Array(I), B = Array(I);
|
|
711
|
+
for (R[0] = 0, z[0] = 2, B[0] = o[0] + 2 * o[1], F = 1; F < I - 1; ++F) R[F] = 1, z[F] = 4, B[F] = 4 * o[F] + 2 * o[F + 1];
|
|
712
|
+
for (R[I - 1] = 2, z[I - 1] = 7, B[I - 1] = 8 * o[I - 1] + o[I], F = 1; F < I; ++F) L = R[F] / z[F - 1], z[F] -= L, B[F] -= L * B[F - 1];
|
|
713
|
+
for (R[I - 1] = B[I - 1] / z[I - 1], F = I - 2; F >= 0; --F) R[F] = (B[F] - R[F + 1]) / z[F];
|
|
714
|
+
for (z[I - 1] = (o[I] + R[I - 1]) / 2, F = 0; F < I - 1; ++F) z[F] = 2 * o[F + 1] - R[F + 1];
|
|
715
|
+
return [R, z];
|
|
716
|
+
}
|
|
717
|
+
function natural_default(o) {
|
|
718
|
+
return new Natural(o);
|
|
719
|
+
}
|
|
720
|
+
function Step(o, F) {
|
|
721
|
+
this._context = o, this._t = F;
|
|
722
|
+
}
|
|
723
|
+
Step.prototype = {
|
|
724
|
+
areaStart: function() {
|
|
725
|
+
this._line = 0;
|
|
726
|
+
},
|
|
727
|
+
areaEnd: function() {
|
|
728
|
+
this._line = NaN;
|
|
729
|
+
},
|
|
730
|
+
lineStart: function() {
|
|
731
|
+
this._x = this._y = NaN, this._point = 0;
|
|
732
|
+
},
|
|
733
|
+
lineEnd: function() {
|
|
734
|
+
0 < this._t && this._t < 1 && this._point === 2 && this._context.lineTo(this._x, this._y), (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
|
|
735
|
+
},
|
|
736
|
+
point: function(o, F) {
|
|
737
|
+
switch (o = +o, F = +F, this._point) {
|
|
738
|
+
case 0:
|
|
739
|
+
this._point = 1, this._line ? this._context.lineTo(o, F) : this._context.moveTo(o, F);
|
|
740
|
+
break;
|
|
741
|
+
case 1: this._point = 2;
|
|
742
|
+
default:
|
|
743
|
+
if (this._t <= 0) this._context.lineTo(this._x, F), this._context.lineTo(o, F);
|
|
744
|
+
else {
|
|
745
|
+
var I = this._x * (1 - this._t) + o * this._t;
|
|
746
|
+
this._context.lineTo(I, this._y), this._context.lineTo(I, F);
|
|
747
|
+
}
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
this._x = o, this._y = F;
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
function step_default(o) {
|
|
754
|
+
return new Step(o, .5);
|
|
755
|
+
}
|
|
756
|
+
function stepBefore(o) {
|
|
757
|
+
return new Step(o, 0);
|
|
758
|
+
}
|
|
759
|
+
function stepAfter(o) {
|
|
760
|
+
return new Step(o, 1);
|
|
761
|
+
}
|
|
762
|
+
var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1), ZERO_WIDTH_SPACE = "", d3CurveTypes = {
|
|
763
|
+
curveBasis: basis_default,
|
|
764
|
+
curveBasisClosed: basisClosed_default,
|
|
765
|
+
curveBasisOpen: basisOpen_default,
|
|
766
|
+
curveBumpX: bumpX,
|
|
767
|
+
curveBumpY: bumpY,
|
|
768
|
+
curveBundle: bundle_default,
|
|
769
|
+
curveCardinalClosed: cardinalClosed_default,
|
|
770
|
+
curveCardinalOpen: cardinalOpen_default,
|
|
771
|
+
curveCardinal: cardinal_default,
|
|
772
|
+
curveCatmullRomClosed: catmullRomClosed_default,
|
|
773
|
+
curveCatmullRomOpen: catmullRomOpen_default,
|
|
774
|
+
curveCatmullRom: catmullRom_default,
|
|
775
|
+
curveLinear: linear_default,
|
|
776
|
+
curveLinearClosed: linearClosed_default,
|
|
777
|
+
curveMonotoneX: monotoneX,
|
|
778
|
+
curveMonotoneY: monotoneY,
|
|
779
|
+
curveNatural: natural_default,
|
|
780
|
+
curveStep: step_default,
|
|
781
|
+
curveStepAfter: stepAfter,
|
|
782
|
+
curveStepBefore: stepBefore
|
|
783
|
+
}, directiveWithoutOpen = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi, detectInit = /* @__PURE__ */ __name(function(o, F) {
|
|
784
|
+
let I = detectDirective(o, /(?:init\b)|(?:initialize\b)/), L = {};
|
|
785
|
+
if (Array.isArray(I)) {
|
|
786
|
+
let o = I.map((o) => o.args);
|
|
787
|
+
sanitizeDirective(o), L = assignWithDepth_default(L, [...o]);
|
|
788
|
+
} else L = I.args;
|
|
789
|
+
if (!L) return;
|
|
790
|
+
let R = detectType(o, F), z = "config";
|
|
791
|
+
return L[z] !== void 0 && (R === "flowchart-v2" && (R = "flowchart"), L[R] = L[z], delete L[z]), L;
|
|
792
|
+
}, "detectInit"), detectDirective = /* @__PURE__ */ __name(function(o, F = null) {
|
|
793
|
+
try {
|
|
794
|
+
let I = RegExp(`[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*
|
|
795
|
+
`, "ig");
|
|
796
|
+
o = o.trim().replace(I, "").replace(/'/gm, "\""), log.debug(`Detecting diagram directive${F === null ? "" : " type:" + F} based on the text:${o}`);
|
|
797
|
+
let L, R = [];
|
|
798
|
+
for (; (L = directiveRegex.exec(o)) !== null;) if (L.index === directiveRegex.lastIndex && directiveRegex.lastIndex++, L && !F || F && L[1]?.match(F) || F && L[2]?.match(F)) {
|
|
799
|
+
let o = L[1] ? L[1] : L[2], F = L[3] ? L[3].trim() : L[4] ? JSON.parse(L[4].trim()) : null;
|
|
800
|
+
R.push({
|
|
801
|
+
type: o,
|
|
802
|
+
args: F
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
return R.length === 0 ? {
|
|
806
|
+
type: o,
|
|
807
|
+
args: null
|
|
808
|
+
} : R.length === 1 ? R[0] : R;
|
|
809
|
+
} catch (I) {
|
|
810
|
+
return log.error(`ERROR: ${I.message} - Unable to parse directive type: '${F}' based on the text: '${o}'`), {
|
|
811
|
+
type: void 0,
|
|
812
|
+
args: null
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
}, "detectDirective"), removeDirectives = /* @__PURE__ */ __name(function(o) {
|
|
816
|
+
return o.replace(directiveRegex, "");
|
|
817
|
+
}, "removeDirectives"), isSubstringInArray = /* @__PURE__ */ __name(function(o, F) {
|
|
818
|
+
for (let [I, L] of F.entries()) if (L.match(o)) return I;
|
|
819
|
+
return -1;
|
|
820
|
+
}, "isSubstringInArray");
|
|
821
|
+
function interpolateToCurve(o, F) {
|
|
822
|
+
return o ? d3CurveTypes[`curve${o.charAt(0).toUpperCase() + o.slice(1)}`] ?? F : F;
|
|
823
|
+
}
|
|
824
|
+
__name(interpolateToCurve, "interpolateToCurve");
|
|
825
|
+
function formatUrl(o, F) {
|
|
826
|
+
let I = o.trim();
|
|
827
|
+
if (I) return F.securityLevel === "loose" ? I : (0, import_dist.sanitizeUrl)(I);
|
|
828
|
+
}
|
|
829
|
+
__name(formatUrl, "formatUrl");
|
|
830
|
+
var runFunc = /* @__PURE__ */ __name((o, ...F) => {
|
|
831
|
+
let I = o.split("."), L = I.length - 1, R = I[L], z = window;
|
|
832
|
+
for (let F = 0; F < L; F++) if (z = z[I[F]], !z) {
|
|
833
|
+
log.error(`Function name: ${o} not found in window`);
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
z[R](...F);
|
|
837
|
+
}, "runFunc");
|
|
838
|
+
function distance(o, F) {
|
|
839
|
+
return !o || !F ? 0 : Math.sqrt((F.x - o.x) ** 2 + (F.y - o.y) ** 2);
|
|
840
|
+
}
|
|
841
|
+
__name(distance, "distance");
|
|
842
|
+
function traverseEdge(o) {
|
|
843
|
+
let F, I = 0;
|
|
844
|
+
return o.forEach((o) => {
|
|
845
|
+
I += distance(o, F), F = o;
|
|
846
|
+
}), calculatePoint(o, I / 2);
|
|
847
|
+
}
|
|
848
|
+
__name(traverseEdge, "traverseEdge");
|
|
849
|
+
function calcLabelPosition(o) {
|
|
850
|
+
return o.length === 1 ? o[0] : traverseEdge(o);
|
|
851
|
+
}
|
|
852
|
+
__name(calcLabelPosition, "calcLabelPosition");
|
|
853
|
+
var roundNumber = /* @__PURE__ */ __name((o, F = 2) => {
|
|
854
|
+
let I = 10 ** F;
|
|
855
|
+
return Math.round(o * I) / I;
|
|
856
|
+
}, "roundNumber"), calculatePoint = /* @__PURE__ */ __name((o, F) => {
|
|
857
|
+
let I, L = F;
|
|
858
|
+
for (let F of o) {
|
|
859
|
+
if (I) {
|
|
860
|
+
let o = distance(F, I);
|
|
861
|
+
if (o === 0) return I;
|
|
862
|
+
if (o < L) L -= o;
|
|
863
|
+
else {
|
|
864
|
+
let R = L / o;
|
|
865
|
+
if (R <= 0) return I;
|
|
866
|
+
if (R >= 1) return {
|
|
867
|
+
x: F.x,
|
|
868
|
+
y: F.y
|
|
869
|
+
};
|
|
870
|
+
if (R > 0 && R < 1) return {
|
|
871
|
+
x: roundNumber((1 - R) * I.x + R * F.x, 5),
|
|
872
|
+
y: roundNumber((1 - R) * I.y + R * F.y, 5)
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
I = F;
|
|
877
|
+
}
|
|
878
|
+
throw Error("Could not find a suitable point for the given distance");
|
|
879
|
+
}, "calculatePoint"), calcCardinalityPosition = /* @__PURE__ */ __name((o, F, I) => {
|
|
880
|
+
log.info(`our points ${JSON.stringify(F)}`), F[0] !== I && (F = F.reverse());
|
|
881
|
+
let L = calculatePoint(F, 25), R = o ? 10 : 5, z = Math.atan2(F[0].y - L.y, F[0].x - L.x), B = {
|
|
882
|
+
x: 0,
|
|
883
|
+
y: 0
|
|
884
|
+
};
|
|
885
|
+
return B.x = Math.sin(z) * R + (F[0].x + L.x) / 2, B.y = -Math.cos(z) * R + (F[0].y + L.y) / 2, B;
|
|
886
|
+
}, "calcCardinalityPosition");
|
|
887
|
+
function calcTerminalLabelPosition(o, F, I) {
|
|
888
|
+
let L = structuredClone(I);
|
|
889
|
+
log.info("our points", L), F !== "start_left" && F !== "start_right" && L.reverse();
|
|
890
|
+
let R = calculatePoint(L, 25 + o), z = 10 + o * .5, B = Math.atan2(L[0].y - R.y, L[0].x - R.x), V = {
|
|
891
|
+
x: 0,
|
|
892
|
+
y: 0
|
|
893
|
+
};
|
|
894
|
+
return F === "start_left" ? (V.x = Math.sin(B + Math.PI) * z + (L[0].x + R.x) / 2, V.y = -Math.cos(B + Math.PI) * z + (L[0].y + R.y) / 2) : F === "end_right" ? (V.x = Math.sin(B - Math.PI) * z + (L[0].x + R.x) / 2 - 5, V.y = -Math.cos(B - Math.PI) * z + (L[0].y + R.y) / 2 - 5) : F === "end_left" ? (V.x = Math.sin(B) * z + (L[0].x + R.x) / 2 - 5, V.y = -Math.cos(B) * z + (L[0].y + R.y) / 2 - 5) : (V.x = Math.sin(B) * z + (L[0].x + R.x) / 2, V.y = -Math.cos(B) * z + (L[0].y + R.y) / 2), V;
|
|
895
|
+
}
|
|
896
|
+
__name(calcTerminalLabelPosition, "calcTerminalLabelPosition");
|
|
897
|
+
function getStylesFromArray(o) {
|
|
898
|
+
let F = "", I = "";
|
|
899
|
+
for (let L of o) L !== void 0 && (L.startsWith("color:") || L.startsWith("text-align:") ? I = I + L + ";" : F = F + L + ";");
|
|
900
|
+
return {
|
|
901
|
+
style: F,
|
|
902
|
+
labelStyle: I
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
__name(getStylesFromArray, "getStylesFromArray");
|
|
906
|
+
var cnt = 0, generateId = /* @__PURE__ */ __name(() => (cnt++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt), "generateId");
|
|
907
|
+
function makeRandomHex(o) {
|
|
908
|
+
let F = "";
|
|
909
|
+
for (let I = 0; I < o; I++) F += "0123456789abcdef".charAt(Math.floor(Math.random() * 16));
|
|
910
|
+
return F;
|
|
911
|
+
}
|
|
912
|
+
__name(makeRandomHex, "makeRandomHex");
|
|
913
|
+
var random = /* @__PURE__ */ __name((o) => makeRandomHex(o.length), "random"), getTextObj = /* @__PURE__ */ __name(function() {
|
|
914
|
+
return {
|
|
915
|
+
x: 0,
|
|
916
|
+
y: 0,
|
|
917
|
+
fill: void 0,
|
|
918
|
+
anchor: "start",
|
|
919
|
+
style: "#666",
|
|
920
|
+
width: 100,
|
|
921
|
+
height: 100,
|
|
922
|
+
textMargin: 0,
|
|
923
|
+
rx: 0,
|
|
924
|
+
ry: 0,
|
|
925
|
+
valign: void 0,
|
|
926
|
+
text: ""
|
|
927
|
+
};
|
|
928
|
+
}, "getTextObj"), drawSimpleText = /* @__PURE__ */ __name(function(o, F) {
|
|
929
|
+
let I = F.text.replace(common_default.lineBreakRegex, " "), [, L] = parseFontSize(F.fontSize), R = o.append("text");
|
|
930
|
+
R.attr("x", F.x), R.attr("y", F.y), R.style("text-anchor", F.anchor), R.style("font-family", F.fontFamily), R.style("font-size", L), R.style("font-weight", F.fontWeight), R.attr("fill", F.fill), F.class !== void 0 && R.attr("class", F.class);
|
|
931
|
+
let z = R.append("tspan");
|
|
932
|
+
return z.attr("x", F.x + F.textMargin * 2), z.attr("fill", F.fill), z.text(I), R;
|
|
933
|
+
}, "drawSimpleText"), wrapLabel = memoize_default((o, F, I) => {
|
|
934
|
+
if (!o || (I = Object.assign({
|
|
935
|
+
fontSize: 12,
|
|
936
|
+
fontWeight: 400,
|
|
937
|
+
fontFamily: "Arial",
|
|
938
|
+
joinWith: "<br/>"
|
|
939
|
+
}, I), common_default.lineBreakRegex.test(o))) return o;
|
|
940
|
+
let L = o.split(" ").filter(Boolean), R = [], z = "";
|
|
941
|
+
return L.forEach((o, B) => {
|
|
942
|
+
let V = calculateTextWidth(`${o} `, I), H = calculateTextWidth(z, I);
|
|
943
|
+
if (V > F) {
|
|
944
|
+
let { hyphenatedStrings: L, remainingWord: B } = breakString(o, F, "-", I);
|
|
945
|
+
R.push(z, ...L), z = B;
|
|
946
|
+
} else H + V >= F ? (R.push(z), z = o) : z = [z, o].filter(Boolean).join(" ");
|
|
947
|
+
B + 1 === L.length && R.push(z);
|
|
948
|
+
}), R.filter((o) => o !== "").join(I.joinWith);
|
|
949
|
+
}, (o, F, I) => `${o}${F}${I.fontSize}${I.fontWeight}${I.fontFamily}${I.joinWith}`), breakString = memoize_default((o, F, I = "-", L) => {
|
|
950
|
+
L = Object.assign({
|
|
951
|
+
fontSize: 12,
|
|
952
|
+
fontWeight: 400,
|
|
953
|
+
fontFamily: "Arial",
|
|
954
|
+
margin: 0
|
|
955
|
+
}, L);
|
|
956
|
+
let R = [...o], z = [], B = "";
|
|
957
|
+
return R.forEach((o, V) => {
|
|
958
|
+
let H = `${B}${o}`;
|
|
959
|
+
if (calculateTextWidth(H, L) >= F) {
|
|
960
|
+
let o = V + 1, F = R.length === o, L = `${H}${I}`;
|
|
961
|
+
z.push(F ? H : L), B = "";
|
|
962
|
+
} else B = H;
|
|
963
|
+
}), {
|
|
964
|
+
hyphenatedStrings: z,
|
|
965
|
+
remainingWord: B
|
|
966
|
+
};
|
|
967
|
+
}, (o, F, I = "-", L) => `${o}${F}${I}${L.fontSize}${L.fontWeight}${L.fontFamily}`);
|
|
968
|
+
function calculateTextHeight(o, F) {
|
|
969
|
+
return calculateTextDimensions(o, F).height;
|
|
970
|
+
}
|
|
971
|
+
__name(calculateTextHeight, "calculateTextHeight");
|
|
972
|
+
function calculateTextWidth(o, F) {
|
|
973
|
+
return calculateTextDimensions(o, F).width;
|
|
974
|
+
}
|
|
975
|
+
__name(calculateTextWidth, "calculateTextWidth");
|
|
976
|
+
var calculateTextDimensions = memoize_default((o, F) => {
|
|
977
|
+
let { fontSize: I = 12, fontFamily: L = "Arial", fontWeight: R = 400 } = F;
|
|
978
|
+
if (!o) return {
|
|
979
|
+
width: 0,
|
|
980
|
+
height: 0
|
|
981
|
+
};
|
|
982
|
+
let [, z] = parseFontSize(I), B = ["sans-serif", L], V = o.split(common_default.lineBreakRegex), H = [], U = select_default("body");
|
|
983
|
+
if (!U.remove) return {
|
|
984
|
+
width: 0,
|
|
985
|
+
height: 0,
|
|
986
|
+
lineHeight: 0
|
|
987
|
+
};
|
|
988
|
+
let W = U.append("svg");
|
|
989
|
+
for (let o of B) {
|
|
990
|
+
let F = 0, I = {
|
|
991
|
+
width: 0,
|
|
992
|
+
height: 0,
|
|
993
|
+
lineHeight: 0
|
|
994
|
+
};
|
|
995
|
+
for (let L of V) {
|
|
996
|
+
let B = getTextObj();
|
|
997
|
+
B.text = L || "";
|
|
998
|
+
let V = drawSimpleText(W, B).style("font-size", z).style("font-weight", R).style("font-family", o), H = (V._groups || V)[0][0].getBBox();
|
|
999
|
+
if (H.width === 0 && H.height === 0) throw Error("svg element not in render tree");
|
|
1000
|
+
I.width = Math.round(Math.max(I.width, H.width)), F = Math.round(H.height), I.height += F, I.lineHeight = Math.round(Math.max(I.lineHeight, F));
|
|
1001
|
+
}
|
|
1002
|
+
H.push(I);
|
|
1003
|
+
}
|
|
1004
|
+
return W.remove(), H[isNaN(H[1].height) || isNaN(H[1].width) || isNaN(H[1].lineHeight) || H[0].height > H[1].height && H[0].width > H[1].width && H[0].lineHeight > H[1].lineHeight ? 0 : 1];
|
|
1005
|
+
}, (o, F) => `${o}${F.fontSize}${F.fontWeight}${F.fontFamily}`), InitIDGenerator = class {
|
|
1006
|
+
constructor(o = !1, F) {
|
|
1007
|
+
this.count = 0, this.count = F ? F.length : 0, this.next = o ? () => this.count++ : () => Date.now();
|
|
1008
|
+
}
|
|
1009
|
+
static #_ = __name(this, "InitIDGenerator");
|
|
1010
|
+
}, decoder, entityDecode = /* @__PURE__ */ __name(function(o) {
|
|
1011
|
+
return decoder ||= document.createElement("div"), o = escape(o).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";"), decoder.innerHTML = o, unescape(decoder.textContent);
|
|
1012
|
+
}, "entityDecode");
|
|
1013
|
+
function isDetailedError(o) {
|
|
1014
|
+
return "str" in o;
|
|
1015
|
+
}
|
|
1016
|
+
__name(isDetailedError, "isDetailedError");
|
|
1017
|
+
var insertTitle = /* @__PURE__ */ __name((o, F, I, L) => {
|
|
1018
|
+
if (!L) return;
|
|
1019
|
+
let R = o.node()?.getBBox();
|
|
1020
|
+
R && o.append("text").text(L).attr("text-anchor", "middle").attr("x", R.x + R.width / 2).attr("y", -I).attr("class", F);
|
|
1021
|
+
}, "insertTitle"), parseFontSize = /* @__PURE__ */ __name((o) => {
|
|
1022
|
+
if (typeof o == "number") return [o, o + "px"];
|
|
1023
|
+
let F = parseInt(o ?? "", 10);
|
|
1024
|
+
return Number.isNaN(F) ? [void 0, void 0] : o === String(F) ? [F, o + "px"] : [F, o];
|
|
1025
|
+
}, "parseFontSize");
|
|
1026
|
+
function cleanAndMerge(o, F) {
|
|
1027
|
+
return merge_default({}, o, F);
|
|
1028
|
+
}
|
|
1029
|
+
__name(cleanAndMerge, "cleanAndMerge");
|
|
1030
|
+
var utils_default = {
|
|
1031
|
+
assignWithDepth: assignWithDepth_default,
|
|
1032
|
+
wrapLabel,
|
|
1033
|
+
calculateTextHeight,
|
|
1034
|
+
calculateTextWidth,
|
|
1035
|
+
calculateTextDimensions,
|
|
1036
|
+
cleanAndMerge,
|
|
1037
|
+
detectInit,
|
|
1038
|
+
detectDirective,
|
|
1039
|
+
isSubstringInArray,
|
|
1040
|
+
interpolateToCurve,
|
|
1041
|
+
calcLabelPosition,
|
|
1042
|
+
calcCardinalityPosition,
|
|
1043
|
+
calcTerminalLabelPosition,
|
|
1044
|
+
formatUrl,
|
|
1045
|
+
getStylesFromArray,
|
|
1046
|
+
generateId,
|
|
1047
|
+
random,
|
|
1048
|
+
runFunc,
|
|
1049
|
+
entityDecode,
|
|
1050
|
+
insertTitle,
|
|
1051
|
+
isLabelCoordinateInPath,
|
|
1052
|
+
parseFontSize,
|
|
1053
|
+
InitIDGenerator
|
|
1054
|
+
}, encodeEntities = /* @__PURE__ */ __name(function(o) {
|
|
1055
|
+
let F = o;
|
|
1056
|
+
return F = F.replace(/style.*:\S*#.*;/g, function(o) {
|
|
1057
|
+
return o.substring(0, o.length - 1);
|
|
1058
|
+
}), F = F.replace(/classDef.*:\S*#.*;/g, function(o) {
|
|
1059
|
+
return o.substring(0, o.length - 1);
|
|
1060
|
+
}), F = F.replace(/#\w+;/g, function(o) {
|
|
1061
|
+
let F = o.substring(1, o.length - 1);
|
|
1062
|
+
return /^\+?\d+$/.test(F) ? "fl°°" + F + "¶ß" : "fl°" + F + "¶ß";
|
|
1063
|
+
}), F;
|
|
1064
|
+
}, "encodeEntities"), decodeEntities = /* @__PURE__ */ __name(function(o) {
|
|
1065
|
+
return o.replace(/fl°°/g, "&#").replace(/fl°/g, "&").replace(/¶ß/g, ";");
|
|
1066
|
+
}, "decodeEntities"), getEdgeId = /* @__PURE__ */ __name((o, F, { counter: I = 0, prefix: L, suffix: R }, z) => z || `${L ? `${L}_` : ""}${o}_${F}_${I}${R ? `_${R}` : ""}`, "getEdgeId");
|
|
1067
|
+
function handleUndefinedAttr(o) {
|
|
1068
|
+
return o ?? null;
|
|
1069
|
+
}
|
|
1070
|
+
__name(handleUndefinedAttr, "handleUndefinedAttr");
|
|
1071
|
+
function isLabelCoordinateInPath(o, F) {
|
|
1072
|
+
let I = Math.round(o.x), L = Math.round(o.y), R = F.replace(/(\d+\.\d+)/g, (o) => Math.round(parseFloat(o)).toString());
|
|
1073
|
+
return R.includes(I.toString()) || R.includes(L.toString());
|
|
1074
|
+
}
|
|
1075
|
+
__name(isLabelCoordinateInPath, "isLabelCoordinateInPath");
|
|
1076
|
+
export { merge_default as A, monotoneY as C, bumpX as D, basis_default as E, bumpY as O, monotoneX as S, cardinal_default as T, wrapLabel as _, decodeEntities as a, step_default as b, getEdgeId as c, interpolateToCurve as d, isDetailedError as f, utils_default as g, removeDirectives as h, cleanAndMerge as i, linear_default as k, getStylesFromArray as l, random as m, calculateTextHeight as n, encodeEntities as o, parseFontSize as p, calculateTextWidth as r, generateId as s, ZERO_WIDTH_SPACE as t, handleUndefinedAttr as u, stepAfter as v, catmullRom_default as w, natural_default as x, stepBefore as y };
|