web3dlink 2.1.16 → 2.1.18

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.
@@ -0,0 +1,4131 @@
1
+ //#endregion
2
+ //#region version.js
3
+ var e = {
4
+ name: "web3dlink",
5
+ version: "2.1.18",
6
+ description: "LarkSR / ZS 推流 GameAPI SDK",
7
+ type: "module",
8
+ main: "./dist/web3dlink.js",
9
+ module: "./dist/web3dlink.js",
10
+ types: "./dist/web3dlink.d.ts",
11
+ exports: {
12
+ ".": {
13
+ types: "./dist/web3dlink.d.ts",
14
+ import: "./dist/web3dlink.js",
15
+ default: "./dist/web3dlink.js"
16
+ },
17
+ "./larksr": {
18
+ types: "./dist/web3dlink.d.ts",
19
+ import: "./dist/web3dlink-larksr.js",
20
+ default: "./dist/web3dlink-larksr.js"
21
+ },
22
+ "./zs": {
23
+ types: "./dist/web3dlink.d.ts",
24
+ import: "./dist/web3dlink-zs.js",
25
+ default: "./dist/web3dlink-zs.js"
26
+ }
27
+ },
28
+ files: ["dist"],
29
+ scripts: {
30
+ build: "node ./scripts/build.mjs",
31
+ "sync:dts": "node ./scripts/sync-dts.mjs",
32
+ prepublishOnly: "npm run build"
33
+ },
34
+ keywords: [
35
+ "larksr",
36
+ "zs-stream",
37
+ "game-api",
38
+ "streaming",
39
+ "web3dlink"
40
+ ],
41
+ license: "MIT",
42
+ dependencies: { larksr_websdk: "^3.3.119" },
43
+ sideEffects: [
44
+ "./dist/web3dlink.js",
45
+ "./dist/web3dlink-larksr.js",
46
+ "./dist/web3dlink-zs.js",
47
+ "./zs-stream-parent.js",
48
+ "./version.js"
49
+ ]
50
+ }.version, t = "background: #22c55e; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 600;";
51
+ function n() {
52
+ if (typeof globalThis < "u" && globalThis.WEB3DLINK_SILENT) return !1;
53
+ try {
54
+ if (typeof location < "u" && new URLSearchParams(location.search).get("web3dlink_silent") === "1") return !1;
55
+ } catch {}
56
+ return !0;
57
+ }
58
+ n() && (console.log(`%c [web3dlink] version: ${e}`, t), console.log("%c [larksr_websdk] bundled ^3.3.119 ", t));
59
+ //#endregion
60
+ //#region api/createNamespaceApi.js
61
+ function r(e, t = {}, n = {}) {
62
+ class r {
63
+ constructor(e) {
64
+ this.commandManager = e;
65
+ }
66
+ _handleSend(r, i = {}) {
67
+ let a = `${e}.${r}`, o = t[r], s = o ? o(i) : {
68
+ errors: [],
69
+ normalized: i
70
+ }, c = n.getOptions?.(r, i) || {};
71
+ return this.commandManager.sendWithDefault(s, a, c);
72
+ }
73
+ }
74
+ return r;
75
+ }
76
+ var i = {
77
+ lightpink: "#FFB6C1",
78
+ pink: "#FFC0CB",
79
+ crimson: "#DC143C",
80
+ lavenderblush: "#FFF0F5",
81
+ palevioletred: "#DB7093",
82
+ hotpink: "#FF69B4",
83
+ deeppink: "#FF1493",
84
+ mediumvioletred: "#C71585",
85
+ orchid: "#DA70D6",
86
+ thistle: "#D8BFD8",
87
+ plum: "#DDA0DD",
88
+ violet: "#EE82EE",
89
+ magenta: "#FF00FF",
90
+ fuchsia: "#FF00FF",
91
+ darkmagenta: "#8B008B",
92
+ purple: "#800080",
93
+ mediumorchid: "#BA55D3",
94
+ darkvoilet: "#9400D3",
95
+ darkorchid: "#9932CC",
96
+ indigo: "#4B0082",
97
+ blueviolet: "#8A2BE2",
98
+ mediumpurple: "#9370DB",
99
+ mediumslateblue: "#7B68EE",
100
+ slateblue: "#6A5ACD",
101
+ darkslateblue: "#483D8B",
102
+ lavender: "#E6E6FA",
103
+ ghostwhite: "#F8F8FF",
104
+ blue: "#0000FF",
105
+ mediumblue: "#0000CD",
106
+ midnightblue: "#191970",
107
+ darkblue: "#00008B",
108
+ navy: "#000080",
109
+ royalblue: "#4169E1",
110
+ cornflowerblue: "#6495ED",
111
+ lightsteelblue: "#B0C4DE",
112
+ lightslategray: "#778899",
113
+ slategray: "#708090",
114
+ doderblue: "#1E90FF",
115
+ aliceblue: "#F0F8FF",
116
+ steelblue: "#4682B4",
117
+ lightskyblue: "#87CEFA",
118
+ skyblue: "#87CEEB",
119
+ deepskyblue: "#00BFFF",
120
+ lightblue: "#ADD8E6",
121
+ powderblue: "#B0E0E6",
122
+ cadetblue: "#5F9EA0",
123
+ azure: "#F0FFFF",
124
+ lightcyan: "#E1FFFF",
125
+ paleturquoise: "#AFEEEE",
126
+ cyan: "#00FFFF",
127
+ aqua: "#D4F2E7",
128
+ darkturquoise: "#00CED1",
129
+ darkslategray: "#2F4F4F",
130
+ darkcyan: "#008B8B",
131
+ teal: "#008080",
132
+ mediumturquoise: "#48D1CC",
133
+ lightseagreen: "#20B2AA",
134
+ turquoise: "#40E0D0",
135
+ auqamarin: "#7FFFAA",
136
+ mediumaquamarine: "#00FA9A",
137
+ mediumspringgreen: "#00FF7F",
138
+ mintcream: "#F5FFFA",
139
+ springgreen: "#3CB371",
140
+ seagreen: "#2E8B57",
141
+ honeydew: "#F0FFF0",
142
+ lightgreen: "#90EE90",
143
+ palegreen: "#98FB98",
144
+ darkseagreen: "#8FBC8F",
145
+ limegreen: "#32CD32",
146
+ lime: "#00FF00",
147
+ forestgreen: "#228B22",
148
+ green: "#008000",
149
+ darkgreen: "#006400",
150
+ chartreuse: "#7FFF00",
151
+ lawngreen: "#7CFC00",
152
+ greenyellow: "#ADFF2F",
153
+ olivedrab: "#556B2F",
154
+ beige: "#F5F5DC",
155
+ lightgoldenrodyellow: "#FAFAD2",
156
+ ivory: "#FFFFF0",
157
+ lightyellow: "#FFFFE0",
158
+ yellow: "#FFFF00",
159
+ olive: "#808000",
160
+ darkkhaki: "#BDB76B",
161
+ lemonchiffon: "#FFFACD",
162
+ palegodenrod: "#EEE8AA",
163
+ khaki: "#F0E68C",
164
+ gold: "#FFD700",
165
+ cornislk: "#FFF8DC",
166
+ goldenrod: "#DAA520",
167
+ floralwhite: "#FFFAF0",
168
+ oldlace: "#FDF5E6",
169
+ wheat: "#F5DEB3",
170
+ moccasin: "#FFE4B5",
171
+ orange: "#FFA500",
172
+ papayawhip: "#FFEFD5",
173
+ blanchedalmond: "#FFEBCD",
174
+ navajowhite: "#FFDEAD",
175
+ antiquewhite: "#FAEBD7",
176
+ tan: "#D2B48C",
177
+ brulywood: "#DEB887",
178
+ bisque: "#FFE4C4",
179
+ darkorange: "#FF8C00",
180
+ linen: "#FAF0E6",
181
+ peru: "#CD853F",
182
+ peachpuff: "#FFDAB9",
183
+ sandybrown: "#F4A460",
184
+ chocolate: "#D2691E",
185
+ saddlebrown: "#8B4513",
186
+ seashell: "#FFF5EE",
187
+ sienna: "#A0522D",
188
+ lightsalmon: "#FFA07A",
189
+ coral: "#FF7F50",
190
+ orangered: "#FF4500",
191
+ darksalmon: "#E9967A",
192
+ tomato: "#FF6347",
193
+ mistyrose: "#FFE4E1",
194
+ salmon: "#FA8072",
195
+ snow: "#FFFAFA",
196
+ lightcoral: "#F08080",
197
+ rosybrown: "#BC8F8F",
198
+ indianred: "#CD5C5C",
199
+ red: "#FF0000",
200
+ brown: "#A52A2A",
201
+ firebrick: "#B22222",
202
+ darkred: "#8B0000",
203
+ maroon: "#800000",
204
+ white: "#FFFFFF",
205
+ whitesmoke: "#F5F5F5",
206
+ gainsboro: "#DCDCDC",
207
+ lightgrey: "#D3D3D3",
208
+ silver: "#C0C0C0",
209
+ darkgray: "#A9A9A9",
210
+ gray: "#808080",
211
+ dimgray: "#696969",
212
+ black: "#000000"
213
+ };
214
+ //#endregion
215
+ //#region baseConfig/color/color.js
216
+ function a(e) {
217
+ if (!e || typeof e != "string") return !1;
218
+ let t = e.trim().toLowerCase(), n = /^#?([0-9A-Fa-f]{3})$/, r = /^#?([0-9A-Fa-f]{6})$/, a = /^#?([0-9A-Fa-f]{8})$/, l = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/, u = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0\.\d+)\s*\)$/, d = /^(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)$/;
219
+ if (a.test(t)) return `#${t.replace("#", "").toUpperCase()}`;
220
+ if (r.test(t)) return `#${t.replace("#", "").toUpperCase()}FF`;
221
+ if (n.test(t)) return `#${t.replace("#", "").split("").map((e) => e + e).join("").toUpperCase()}FF`;
222
+ if (i[t]) {
223
+ let e = i[t].replace("#", "").toUpperCase();
224
+ if (e.length === 8) return `#${e}`;
225
+ if (e.length === 6) return `#${e}FF`;
226
+ }
227
+ return l.test(t) ? o(t.match(l)) : u.test(t) ? s(t.match(u)) : d.test(t) ? c(t.match(d)) : !1;
228
+ }
229
+ function o(e) {
230
+ if (!e || e.length < 4) return !1;
231
+ let [, t, n, r] = e, i = parseInt(t), a = parseInt(n), o = parseInt(r);
232
+ return i < 0 || i > 255 || a < 0 || a > 255 || o < 0 || o > 255 ? !1 : `#${(i << 16 | a << 8 | o).toString(16).padStart(6, "0").toUpperCase()}FF`;
233
+ }
234
+ function s(e) {
235
+ if (!e || e.length < 5) return !1;
236
+ let [, t, n, r, i] = e, a = parseInt(t), o = parseInt(n), s = parseInt(r), c = parseFloat(i);
237
+ return a < 0 || a > 255 || o < 0 || o > 255 || s < 0 || s > 255 || c < 0 || c > 1 ? !1 : `#${(a << 16 | o << 8 | s).toString(16).padStart(6, "0").toUpperCase()}${Math.round(c * 255).toString(16).padStart(2, "0").toUpperCase()}`;
238
+ }
239
+ function c(e) {
240
+ if (!e || e.length < 5) return !1;
241
+ let [, t, n, r, i] = e, a = parseFloat(t), o = parseFloat(n), s = parseFloat(r), c = parseFloat(i), l = a <= 1 && o <= 1 && s <= 1, u, d, f;
242
+ if (l) {
243
+ if (a < 0 || a > 1 || o < 0 || o > 1 || s < 0 || s > 1) return !1;
244
+ u = Math.round(a * 255), d = Math.round(o * 255), f = Math.round(s * 255);
245
+ } else {
246
+ if (a < 0 || a > 255 || o < 0 || o > 255 || s < 0 || s > 255) return !1;
247
+ u = Math.round(a), d = Math.round(o), f = Math.round(s);
248
+ }
249
+ return c < 0 || c > 1 ? !1 : `#${(u << 16 | d << 8 | f).toString(16).padStart(6, "0").toUpperCase()}${Math.round(c * 255).toString(16).padStart(2, "0").toUpperCase()}`;
250
+ }
251
+ //#endregion
252
+ //#region baseConfig/validateHelpers.js
253
+ function l(e, t, n) {
254
+ if (!e || typeof e != "object") return;
255
+ let r = t.split("."), i = r.pop(), a = e;
256
+ for (let e of r) (!(e in a) || typeof a[e] != "object" || a[e] === null) && (a[e] = {}), a = a[e];
257
+ a[i] = n;
258
+ }
259
+ function u(e, t) {
260
+ let { normalized: n, field: r, assign: i } = e || {};
261
+ n && r ? r.includes(".") ? l(n, r, t) : n[r] = t : typeof i == "function" && i(t);
262
+ }
263
+ //#endregion
264
+ //#region baseConfig/validators.js
265
+ function d(e, t = null, n = null) {
266
+ return !(e == null || typeof e != "number" || isNaN(e) || t !== null && e < t || n !== null && e > n);
267
+ }
268
+ function f(e) {
269
+ let t = [];
270
+ if (!e || !Array.isArray(e)) t.push("[coordinates] 为必填项,且必须是数组类型");
271
+ else if (e.length < 3) t.push("[coordinates]包含:[经度, 纬度, 高程]");
272
+ else {
273
+ let [n, r, i] = e;
274
+ d(n, -180, 180) || t.push("[coordinates[0]]经度取值范围:-180~180"), d(r, -90, 90) || t.push("[coordinates[1]]纬度取值范围:-90~90"), d(i) || t.push("[coordinates[2]]高度必须是数字类型");
275
+ }
276
+ return t;
277
+ }
278
+ function p(...e) {
279
+ let t;
280
+ if (e.length === 1 && typeof e[0] == "object" && !Array.isArray(e[0])) t = e[0] || {};
281
+ else {
282
+ let [n, r, i, a, o] = e;
283
+ t = i && typeof i == "object" && !Array.isArray(i) ? {
284
+ value: n,
285
+ field: r,
286
+ ...i
287
+ } : {
288
+ value: n,
289
+ field: r,
290
+ min: i,
291
+ max: a,
292
+ normalized: o
293
+ };
294
+ }
295
+ let { value: n, field: r, label: i, required: a = !0, min: o = null, max: s = null, normalized: c, defaultValue: l, assign: f } = t, p = r || i || "field", m = i || p, h = [], g = !(n == null || n === ""), _ = (e) => {
296
+ u({
297
+ normalized: c,
298
+ field: p,
299
+ assign: f
300
+ }, e);
301
+ };
302
+ if (!g) {
303
+ if (a) h.push(`[${m}]为必填项`);
304
+ else if (l != null) {
305
+ let e = typeof l == "number" ? l : Number(l);
306
+ Number.isNaN(e) || _(e);
307
+ }
308
+ return h;
309
+ }
310
+ return n === null ? (h.push(`[${m}]不能为null`), h) : (d(n, o, s) ? _(n) : o !== null && s !== null ? h.push(`[${m}]取值范围:${o}~${s}`) : o === null ? s === null ? h.push(`[${m}]必须是数字类型`) : h.push(`[${m}]必须≤${s}`) : h.push(`[${m}]必须≥${o}`), h);
311
+ }
312
+ function m(...e) {
313
+ let t;
314
+ if (e.length === 1 && typeof e[0] == "object" && !Array.isArray(e[0])) t = e[0] || {};
315
+ else {
316
+ let [n, r, i = null, a = null] = e;
317
+ t = {
318
+ value: n,
319
+ field: r,
320
+ min: i,
321
+ max: a
322
+ };
323
+ }
324
+ let { value: n, field: r, label: i, min: a = null, max: o = null, normalized: s, defaultValue: c, assign: l } = t, f = r || i || "field", p = i || f, m = [], h = !(n == null || n === ""), g = (e) => {
325
+ u({
326
+ normalized: s,
327
+ field: f,
328
+ assign: l
329
+ }, e);
330
+ };
331
+ if (!h) {
332
+ if (c != null) {
333
+ let e = typeof c == "number" ? c : Number(c);
334
+ Number.isNaN(e) || (s[f] = Array.isArray(c) ? [...c] : c && typeof c == "object" ? { ...c } : c);
335
+ }
336
+ return m;
337
+ }
338
+ return d(n, a, o) ? g(n) : a !== null && o !== null ? m.push(`[${p}]取值范围:${a}~${o}`) : a === null ? o === null ? m.push(`[${p}]必须是数字类型`) : m.push(`[${p}]必须≤${o}`) : m.push(`[${p}]必须≥${a}`), m;
339
+ }
340
+ function h(...e) {
341
+ let t;
342
+ if (e.length === 1 && typeof e[0] == "object" && !Array.isArray(e[0])) t = e[0] || {};
343
+ else {
344
+ let [n, r] = e;
345
+ t = {
346
+ field: n,
347
+ value: r
348
+ };
349
+ }
350
+ let { field: n, label: r, value: i, normalized: a, defaultValue: o, assign: s } = t, c = n || r || "field", l = r || c, d = [], f = !(i == null || i === ""), p = (e) => {
351
+ u({
352
+ normalized: a,
353
+ field: c,
354
+ assign: s
355
+ }, e);
356
+ };
357
+ return f ? (typeof i == "string" ? i.trim() === "" ? d.push(`[${l}]不能为空字符串`) : p(i) : d.push(`[${l}]必须是字符串类型`), d) : (d.push(`[${l}]为必填项`), o != null && typeof o == "string" && p(o), d);
358
+ }
359
+ function g(...e) {
360
+ let t;
361
+ if (e.length === 1 && typeof e[0] == "object" && !Array.isArray(e[0])) t = e[0] || {};
362
+ else {
363
+ let [n, r] = e;
364
+ t = {
365
+ field: n,
366
+ value: r
367
+ };
368
+ }
369
+ let { field: n, label: r, value: i, normalized: a, defaultValue: o, assign: s } = t, c = n || r || "field", l = r || c, d = [], f = !(i == null || i === ""), p = (e) => {
370
+ u({
371
+ normalized: a,
372
+ field: c,
373
+ assign: s
374
+ }, e);
375
+ };
376
+ return f ? (typeof i == "string" ? i.trim() === "" ? d.push(`[${l}]不能为空字符串`) : p(i) : d.push(`[${l}]必须是字符串类型`), d) : (o != null && typeof o == "string" && p(o), d);
377
+ }
378
+ function _(...e) {
379
+ let t;
380
+ if (e.length === 1 && typeof e[0] == "object" && !Array.isArray(e[0])) t = e[0] || {};
381
+ else {
382
+ let [n, r, i, a] = e;
383
+ t = i && typeof i == "object" && !Array.isArray(i) ? {
384
+ label: n,
385
+ value: r,
386
+ ...i
387
+ } : {
388
+ label: n,
389
+ value: r,
390
+ length: i,
391
+ minLength: a
392
+ };
393
+ }
394
+ let { label: n, field: r, value: i, required: a = !1, normalized: o, defaultValue: s, assign: c, length: l, minLength: d, maxLength: f } = t, p = r || n || "field", m = n || p, h = [], g = i != null, _ = (e) => {
395
+ let t = Array.isArray(e) ? [...e] : e;
396
+ u({
397
+ normalized: o,
398
+ field: p,
399
+ assign: c
400
+ }, t);
401
+ };
402
+ if (!g) return a ? h.push(`[${m}]为必填项`) : s !== void 0 && (Array.isArray(s) ? _(s) : h.push(`[${m}] 默认值必须是数组类型`)), h;
403
+ if (!Array.isArray(i)) return h.push(`[${m}]必须是数组类型`), h;
404
+ let v = typeof l == "number" ? l : void 0;
405
+ return v !== void 0 && i.length !== v && h.push(`[${m}]必须是长度为${v}的数组`), typeof d == "number" && i.length < d && h.push(`[${m}]长度至少为${d}`), typeof f == "number" && i.length > f && h.push(`[${m}]长度不能超过${f}`), h.length === 0 && _(i), h;
406
+ }
407
+ function v(...e) {
408
+ let t;
409
+ if (e.length === 1 && typeof e[0] == "object" && !Array.isArray(e[0])) t = e[0] || {};
410
+ else {
411
+ let [n, r, i] = e;
412
+ t = {
413
+ field: n,
414
+ value: r,
415
+ defaultValue: i
416
+ };
417
+ }
418
+ let { field: n, label: r, value: i, normalized: a, defaultValue: o = [
419
+ 0,
420
+ 0,
421
+ 0
422
+ ], assign: s } = t, c = n || r || "field", l = r || c, d = [], f = !(i == null || i === ""), p = (e) => {
423
+ let t = [...e];
424
+ u({
425
+ normalized: a,
426
+ field: c,
427
+ assign: s
428
+ }, t);
429
+ };
430
+ if (!f) return Array.isArray(o) ? p(o.slice(0, 3).map(Number)) : d.push(`[${l}] 默认值必须是数组类型`), d;
431
+ if (!Array.isArray(i)) return d.push(`[${l}]必须是数组类型`), d;
432
+ if (i.length < 3) return d.push(`[${l}]必须包含3个元素 [x, y, z]`), d;
433
+ let m = i.slice(0, 3).map(Number);
434
+ return m.every((e) => Number.isFinite(e)) ? (p(m), d) : (d.push(`[${l}]数组元素必须是数字`), d);
435
+ }
436
+ function y(...e) {
437
+ let t;
438
+ if (e.length === 1 && typeof e[0] == "object" && !Array.isArray(e[0])) t = e[0] || {};
439
+ else {
440
+ let [n, r, i = {}] = e;
441
+ t = {
442
+ label: n,
443
+ value: r,
444
+ ...i
445
+ };
446
+ }
447
+ let { label: n, field: r, value: i, required: o = !1, normalized: s, defaultValue: c, assign: l } = t, d = r || n || "field", f = n || d, p = [], m = !(i == null || i === ""), h = (e) => {
448
+ u({
449
+ normalized: s,
450
+ field: d,
451
+ assign: l
452
+ }, e);
453
+ };
454
+ if (!m) {
455
+ if (o) p.push(`[${f}]为必填项`);
456
+ else if (c != null && c !== "") {
457
+ if (typeof c != "string") return p.push(`[${f}] 默认值必须是字符串类型`), p;
458
+ let e = a(c);
459
+ e ? h(e) : p.push(`${f} 默认值颜色格式不正确`);
460
+ }
461
+ return p;
462
+ }
463
+ if (typeof i != "string") return p.push(`[${f}] 必须是字符串类型`), p;
464
+ let g = a(i);
465
+ return g ? (h(g), p) : (p.push(`${f} 颜色格式不正确`), p);
466
+ }
467
+ function b(e) {
468
+ let { normalized: t, field: n, value: r, defaultValue: i, type: a = "string", list: o = [] } = e, s = [], c = n || "field";
469
+ return r == null || r === "" ? (i != null && t && typeof t == "object" && t && (t[c] = i), s) : a === "string" && typeof r != "string" ? (s.push(`[${c}] 必须是字符串类型`), s) : a === "number" && typeof r != "number" ? (s.push(`[${c}] 必须是数字类型`), s) : !Array.isArray(o) || o.length === 0 ? (s.push(`[${c}] 枚举列表配置错误`), s) : o.includes(r) ? (t && typeof t == "object" && t && (t[c] = r), s) : (s.push(`[${c}] 必须是有效的值: ${o.join(", ")}`), s);
470
+ }
471
+ //#endregion
472
+ //#region api/camera/flyTo.js
473
+ function ee(e) {
474
+ let t = [], n = { ...e };
475
+ return t.push(...f(e.coordinates)), t.push(...m({
476
+ normalized: n,
477
+ field: "pitch",
478
+ value: e.pitch,
479
+ defaultValue: 0,
480
+ min: -90,
481
+ max: 90
482
+ })), t.push(...m({
483
+ normalized: n,
484
+ field: "yaw",
485
+ value: e.yaw,
486
+ defaultValue: 0,
487
+ min: -180,
488
+ max: 180
489
+ })), t.push(...m({
490
+ normalized: n,
491
+ field: "duration",
492
+ value: e.duration,
493
+ defaultValue: 2,
494
+ min: 0,
495
+ max: null
496
+ })), {
497
+ errors: t,
498
+ normalized: n
499
+ };
500
+ }
501
+ //#endregion
502
+ //#region api/camera/focusToID.js
503
+ function te(e) {
504
+ let t = [], n = { ...e };
505
+ return t.push(...h({
506
+ normalized: n,
507
+ field: "id",
508
+ value: e.id
509
+ })), t.push(...m({
510
+ normalized: n,
511
+ field: "pitch",
512
+ value: e.pitch,
513
+ min: -90,
514
+ max: 90
515
+ })), t.push(...m({
516
+ normalized: n,
517
+ field: "yaw",
518
+ value: e.yaw,
519
+ min: -180,
520
+ max: 180
521
+ })), t.push(...m({
522
+ normalized: n,
523
+ field: "duration",
524
+ value: e.duration,
525
+ defaultValue: 2,
526
+ min: 0,
527
+ max: null
528
+ })), t.push(...m({
529
+ normalized: n,
530
+ field: "screenPercent",
531
+ value: e.screenPercent,
532
+ defaultValue: 30,
533
+ min: 0,
534
+ max: 100
535
+ })), {
536
+ errors: t,
537
+ normalized: n
538
+ };
539
+ }
540
+ //#endregion
541
+ //#region api/camera/focusToPoint.js
542
+ function ne(e) {
543
+ let t = [], n = { ...e };
544
+ return t.push(...f(e.coordinates)), t.push(...m({
545
+ normalized: n,
546
+ field: "pitch",
547
+ value: e.pitch,
548
+ defaultValue: 0,
549
+ min: -90,
550
+ max: 90
551
+ })), t.push(...m({
552
+ normalized: n,
553
+ field: "yaw",
554
+ value: e.yaw,
555
+ defaultValue: 0,
556
+ min: -180,
557
+ max: 180
558
+ })), t.push(...m({
559
+ normalized: n,
560
+ field: "duration",
561
+ value: e.duration,
562
+ defaultValue: 2,
563
+ min: 0
564
+ })), t.push(...m({
565
+ normalized: n,
566
+ field: "distance",
567
+ value: e.distance,
568
+ defaultValue: 10,
569
+ min: 0
570
+ })), {
571
+ errors: t,
572
+ normalized: n
573
+ };
574
+ }
575
+ //#endregion
576
+ //#region api/camera/lookAtID.js
577
+ function re(e) {
578
+ let t = [], n = { ...e };
579
+ return t.push(...h({
580
+ normalized: n,
581
+ field: "id",
582
+ value: e.id
583
+ })), t.push(...m({
584
+ normalized: n,
585
+ field: "duration",
586
+ value: e.duration,
587
+ defaultValue: 2,
588
+ min: 0
589
+ })), {
590
+ errors: t,
591
+ normalized: n
592
+ };
593
+ }
594
+ //#endregion
595
+ //#region api/camera/lookAtPoint.js
596
+ function ie(e) {
597
+ let t = [], n = { ...e };
598
+ return t.push(...f(e.coordinates)), t.push(...m({
599
+ normalized: n,
600
+ field: "duration",
601
+ value: e.duration,
602
+ defaultValue: 2,
603
+ min: 0
604
+ })), {
605
+ errors: t,
606
+ normalized: n
607
+ };
608
+ }
609
+ //#endregion
610
+ //#region api/camera/config.js
611
+ function ae(e) {
612
+ let t = [], n = { ...e };
613
+ return e.isUseDragLerp !== void 0 && typeof e.isUseDragLerp != "boolean" ? t.push("[isUseDragLerp]必须是布尔类型") : e.isUseDragLerp === void 0 && (n.isUseDragLerp = !0), t.push(...m({
614
+ normalized: n,
615
+ field: "dragLerpSpeed",
616
+ value: e.dragLerpSpeed,
617
+ defaultValue: 9,
618
+ min: 0
619
+ })), t.push(...m({
620
+ normalized: n,
621
+ field: "dragSpeed",
622
+ value: e.dragSpeed,
623
+ defaultValue: 5,
624
+ min: 0
625
+ })), t.push(...m({
626
+ normalized: n,
627
+ field: "pitchAngleOnSwitchDragMode",
628
+ value: e.pitchAngleOnSwitchDragMode,
629
+ defaultValue: 3,
630
+ min: 0
631
+ })), t.push(...m({
632
+ normalized: n,
633
+ field: "scaleSpeed",
634
+ value: e.scaleSpeed,
635
+ defaultValue: 2,
636
+ min: 0
637
+ })), e.isUseMiddleAround !== void 0 && typeof e.isUseMiddleAround != "boolean" ? t.push("[isUseMiddleAround]必须是布尔类型") : e.isUseMiddleAround === void 0 && (n.isUseMiddleAround = !1), e.isUseMousePosOnAround !== void 0 && typeof e.isUseMousePosOnAround != "boolean" ? t.push("[isUseMousePosOnAround]必须是布尔类型") : e.isUseMousePosOnAround === void 0 && (n.isUseMousePosOnAround = !1), t.push(...m({
638
+ normalized: n,
639
+ field: "x_AroundSpeed",
640
+ value: e.x_AroundSpeed,
641
+ defaultValue: 3,
642
+ min: 0
643
+ })), t.push(...m({
644
+ normalized: n,
645
+ field: "y_AroundSpeed",
646
+ value: e.y_AroundSpeed,
647
+ defaultValue: 3,
648
+ min: 0
649
+ })), t.push(...m({
650
+ normalized: n,
651
+ field: "fov",
652
+ value: e.fov,
653
+ defaultValue: 90,
654
+ min: 1,
655
+ max: 180
656
+ })), {
657
+ errors: t,
658
+ normalized: n
659
+ };
660
+ }
661
+ //#endregion
662
+ //#region api/camera/helpers.js
663
+ function x(e, t, n, r, i) {
664
+ if (n == null || n === "") {
665
+ e[t] = i;
666
+ return;
667
+ }
668
+ if (typeof n != "boolean") {
669
+ r.push(`[${t}]必须是布尔类型`);
670
+ return;
671
+ }
672
+ e[t] = n;
673
+ }
674
+ //#endregion
675
+ //#region api/camera/aroundMode.js
676
+ function oe(e = {}) {
677
+ let t = [], n = { ...e }, r = !(e.id === void 0 || e.id === null || e.id === ""), i = !(e.coordinates === void 0 || e.coordinates === null || e.coordinates === "");
678
+ return r && i ? t.push("[id]与[coordinates]只能二选一,不能同时提供") : !r && !i ? t.push("[id]与[coordinates]必须二选一,至少提供一个") : r ? (t.push(...h({
679
+ normalized: n,
680
+ field: "id",
681
+ value: e.id
682
+ })), delete n.coordinates) : (t.push(...f(e.coordinates)), delete n.id), t.push(...m({
683
+ normalized: n,
684
+ field: "distance",
685
+ value: e.distance,
686
+ defaultValue: 1e4,
687
+ min: 0
688
+ })), t.push(...m({
689
+ normalized: n,
690
+ field: "pitch",
691
+ value: e.pitch,
692
+ defaultValue: 0,
693
+ min: -90,
694
+ max: 90
695
+ })), t.push(...m({
696
+ normalized: n,
697
+ field: "yaw",
698
+ value: e.yaw,
699
+ defaultValue: 0,
700
+ min: -180,
701
+ max: 180
702
+ })), t.push(...m({
703
+ normalized: n,
704
+ field: "duration",
705
+ value: e.duration,
706
+ defaultValue: 2,
707
+ min: 0
708
+ })), t.push(...m({
709
+ normalized: n,
710
+ field: "minDistanceToTarget",
711
+ value: e.minDistanceToTarget,
712
+ defaultValue: 100,
713
+ min: 0
714
+ })), t.push(...m({
715
+ normalized: n,
716
+ field: "maxDistanceToTarget",
717
+ value: e.maxDistanceToTarget,
718
+ defaultValue: 5e4,
719
+ min: 0
720
+ })), t.push(...m({
721
+ normalized: n,
722
+ field: "scaleSpeed",
723
+ value: e.scaleSpeed,
724
+ defaultValue: 30,
725
+ min: 0
726
+ })), t.push(...m({
727
+ normalized: n,
728
+ field: "x_AroundSpeed",
729
+ value: e.x_AroundSpeed,
730
+ defaultValue: 20,
731
+ min: 0
732
+ })), t.push(...m({
733
+ normalized: n,
734
+ field: "y_AroundSpeed",
735
+ value: e.y_AroundSpeed,
736
+ defaultValue: 20,
737
+ min: 0
738
+ })), t.push(...m({
739
+ normalized: n,
740
+ field: "x_AnimSpeed",
741
+ value: e.x_AnimSpeed,
742
+ defaultValue: 5,
743
+ min: 0
744
+ })), t.push(...m({
745
+ normalized: n,
746
+ field: "y_AnimSpeed",
747
+ value: e.y_AnimSpeed,
748
+ defaultValue: 5,
749
+ min: 0
750
+ })), x(n, "isCheckCollision", e.isCheckCollision, t, !1), x(n, "isIgnoreAttachedActors", e.isIgnoreAttachedActors, t, !0), t.push(...m({
751
+ normalized: n,
752
+ field: "collisionOffset",
753
+ value: e.collisionOffset,
754
+ defaultValue: 100,
755
+ min: 0
756
+ })), {
757
+ errors: t,
758
+ normalized: n
759
+ };
760
+ }
761
+ //#endregion
762
+ //#region api/camera/dragMode.js
763
+ function se(e = {}) {
764
+ return {
765
+ errors: [],
766
+ normalized: { ...e }
767
+ };
768
+ }
769
+ //#endregion
770
+ //#region api/camera/firstPersonMode.js
771
+ function ce(e = {}) {
772
+ let t = [], n = { ...e };
773
+ return t.push(...f(e.coordinates)), t.push(...m({
774
+ normalized: n,
775
+ field: "pitch",
776
+ value: e.pitch,
777
+ defaultValue: 0,
778
+ min: -90,
779
+ max: 90
780
+ })), t.push(...m({
781
+ normalized: n,
782
+ field: "yaw",
783
+ value: e.yaw,
784
+ defaultValue: 0,
785
+ min: -180,
786
+ max: 180
787
+ })), t.push(...m({
788
+ normalized: n,
789
+ field: "duration",
790
+ value: e.duration,
791
+ defaultValue: 2,
792
+ min: 0
793
+ })), t.push(...m({
794
+ normalized: n,
795
+ field: "speed",
796
+ value: e.speed,
797
+ defaultValue: 2,
798
+ min: 0
799
+ })), x(n, "collision", e.collision, t, !0), {
800
+ errors: t,
801
+ normalized: n
802
+ };
803
+ }
804
+ //#endregion
805
+ //#region api/camera/viewLock.js
806
+ function le(e = {}) {
807
+ let t = [], n = { ...e };
808
+ return x(n, "state", e.state, t, !1), {
809
+ errors: t,
810
+ normalized: n
811
+ };
812
+ }
813
+ //#endregion
814
+ //#region api/camera/cameraApi.js
815
+ var ue = r("camera", {
816
+ flyTo: ee,
817
+ focusToID: te,
818
+ focusToPoint: ne,
819
+ lookAtID: re,
820
+ lookAtPoint: ie,
821
+ config: ae,
822
+ aroundMode: oe,
823
+ dragMode: se,
824
+ firstPersonMode: ce,
825
+ viewLock: le
826
+ });
827
+ //#endregion
828
+ //#region api/cesium/helpers.js
829
+ function S(e, t = {}) {
830
+ let { minLength: n = 2, exactLength: r = null, field: i = "points" } = t, a = [], o = [];
831
+ return !e || !Array.isArray(e) ? (a.push(`[${i}] 为必填项,且必须是数组类型`), {
832
+ errors: a,
833
+ validPoints: o
834
+ }) : (r !== null && e.length !== r ? a.push(`[${i}] 长度必须为 ${r}`) : r === null && e.length < n && a.push(`[${i}] 至少需要 ${n} 个坐标点`), e.forEach((e, t) => {
835
+ if (!Array.isArray(e) || e.length < 3) {
836
+ a.push(`[${i}[${t}]] 坐标点格式错误,应为 [经度, 纬度, 高度]`);
837
+ return;
838
+ }
839
+ let [n, r, s] = e;
840
+ d(n, -180, 180) || a.push(`[${i}[${t}][0]] 经度取值范围:-180~180`), d(r, -90, 90) || a.push(`[${i}[${t}][1]] 纬度取值范围:-90~90`), d(s) || a.push(`[${i}[${t}][2]] 高度必须是数字类型`), d(n, -180, 180) && d(r, -90, 90) && d(s) && o.push([
841
+ n,
842
+ r,
843
+ s
844
+ ]);
845
+ }), {
846
+ errors: a,
847
+ validPoints: o
848
+ });
849
+ }
850
+ function C(e, t, n) {
851
+ (n.exactLength != null && t.length === n.exactLength || n.exactLength == null && t.length >= (n.minLength || 0)) && (e.points = t);
852
+ }
853
+ //#endregion
854
+ //#region api/cesium/addMultiLine.js
855
+ function de(e = {}) {
856
+ let t = [], n = { ...e };
857
+ t.push(...h({
858
+ normalized: n,
859
+ field: "name",
860
+ value: e.name
861
+ }));
862
+ let r = {
863
+ minLength: 2,
864
+ field: "points"
865
+ }, { errors: i, validPoints: a } = S(e.points, r);
866
+ return t.push(...i), C(n, a, r), t.push(...y({
867
+ normalized: n,
868
+ field: "color",
869
+ value: e.color,
870
+ defaultValue: "#FF0000CC"
871
+ })), t.push(...m({
872
+ normalized: n,
873
+ field: "lineWidth",
874
+ value: e.lineWidth,
875
+ defaultValue: 1,
876
+ min: 0
877
+ })), {
878
+ errors: t,
879
+ normalized: n
880
+ };
881
+ }
882
+ //#endregion
883
+ //#region api/cesium/addMultiPolygon.js
884
+ function fe(e = {}) {
885
+ let t = [], n = { ...e };
886
+ t.push(...h({
887
+ normalized: n,
888
+ field: "name",
889
+ value: e.name
890
+ })), t.push(...b({
891
+ normalized: n,
892
+ field: "polygonType",
893
+ value: e.polygonType,
894
+ defaultValue: "rectangle",
895
+ type: "string",
896
+ list: [
897
+ "rectangle",
898
+ "circle",
899
+ "polygon"
900
+ ]
901
+ }));
902
+ let r = n.polygonType, i = {
903
+ minLength: 2,
904
+ field: "points"
905
+ };
906
+ r === "rectangle" || r === "circle" ? i = {
907
+ exactLength: 2,
908
+ field: "points"
909
+ } : r === "polygon" && (i = {
910
+ minLength: 3,
911
+ field: "points"
912
+ });
913
+ let { errors: a, validPoints: o } = S(e.points, i);
914
+ return t.push(...a), C(n, o, i), t.push(...y({
915
+ normalized: n,
916
+ field: "color",
917
+ value: e.color,
918
+ defaultValue: "#0099FF99"
919
+ })), {
920
+ errors: t,
921
+ normalized: n
922
+ };
923
+ }
924
+ //#endregion
925
+ //#region api/cesium/removeDrawn.js
926
+ function pe(e = {}) {
927
+ let t = [], n = { ...e };
928
+ return t.push(...h({
929
+ normalized: n,
930
+ field: "name",
931
+ value: e.name
932
+ })), {
933
+ errors: t,
934
+ normalized: n
935
+ };
936
+ }
937
+ //#endregion
938
+ //#region api/cesium/removeAllDrawn.js
939
+ function me(e = {}) {
940
+ return {
941
+ errors: [],
942
+ normalized: { ...e }
943
+ };
944
+ }
945
+ //#endregion
946
+ //#region api/cesium/addTexturedQuad.js
947
+ function he(e = {}) {
948
+ let t = [], n = { ...e };
949
+ t.push(...h({
950
+ normalized: n,
951
+ field: "name",
952
+ value: e.name
953
+ }));
954
+ let r = {
955
+ exactLength: 4,
956
+ field: "points"
957
+ }, { errors: i, validPoints: a } = S(e.points, r);
958
+ return t.push(...i), C(n, a, r), t.push(...h({
959
+ normalized: n,
960
+ field: "texture",
961
+ value: e.texture
962
+ })), {
963
+ errors: t,
964
+ normalized: n
965
+ };
966
+ }
967
+ //#endregion
968
+ //#region api/cesium/startMouseDraw.js
969
+ function ge(e = {}) {
970
+ let t = [], n = { ...e };
971
+ return t.push(...b({
972
+ normalized: n,
973
+ field: "drawMode",
974
+ value: e.drawMode,
975
+ defaultValue: "polyline",
976
+ type: "string",
977
+ list: [
978
+ "polyline",
979
+ "rectangle",
980
+ "circle",
981
+ "polygon"
982
+ ]
983
+ })), t.push(...y({
984
+ normalized: n,
985
+ field: "color",
986
+ value: e.color,
987
+ defaultValue: "#FF0000CC"
988
+ })), t.push(...m({
989
+ normalized: n,
990
+ field: "lineWidth",
991
+ value: e.lineWidth,
992
+ defaultValue: 3,
993
+ min: 0
994
+ })), t.push(...g({
995
+ normalized: n,
996
+ field: "name",
997
+ value: e.name
998
+ })), {
999
+ errors: t,
1000
+ normalized: n
1001
+ };
1002
+ }
1003
+ //#endregion
1004
+ //#region api/cesium/stopMouseDraw.js
1005
+ function _e(e = {}) {
1006
+ return {
1007
+ errors: [],
1008
+ normalized: { ...e }
1009
+ };
1010
+ }
1011
+ //#endregion
1012
+ //#region api/cesium/getDrawnInfoByName.js
1013
+ function ve(e = {}) {
1014
+ let t = [], n = { ...e };
1015
+ return t.push(...h({
1016
+ normalized: n,
1017
+ field: "name",
1018
+ value: e.name
1019
+ })), {
1020
+ errors: t,
1021
+ normalized: n
1022
+ };
1023
+ }
1024
+ //#endregion
1025
+ //#region api/cesium/getAllDrawnInfo.js
1026
+ function ye(e = {}) {
1027
+ return {
1028
+ errors: [],
1029
+ normalized: { ...e }
1030
+ };
1031
+ }
1032
+ //#endregion
1033
+ //#region api/cesium/measureDistance.js
1034
+ function be(e = {}) {
1035
+ let t = [], n = { ...e };
1036
+ t.push(...h({
1037
+ normalized: n,
1038
+ field: "name",
1039
+ value: e.name
1040
+ }));
1041
+ let r = {
1042
+ minLength: 2,
1043
+ field: "points"
1044
+ }, { errors: i, validPoints: a } = S(e.points, r);
1045
+ return t.push(...i), C(n, a, r), {
1046
+ errors: t,
1047
+ normalized: n
1048
+ };
1049
+ }
1050
+ //#endregion
1051
+ //#region api/cesium/measureArea.js
1052
+ function xe(e = {}) {
1053
+ let t = [], n = { ...e };
1054
+ t.push(...h({
1055
+ normalized: n,
1056
+ field: "name",
1057
+ value: e.name
1058
+ })), t.push(...b({
1059
+ normalized: n,
1060
+ field: "polyType",
1061
+ value: e.polyType,
1062
+ defaultValue: "rectangle",
1063
+ type: "string",
1064
+ list: [
1065
+ "rectangle",
1066
+ "circle",
1067
+ "polygon"
1068
+ ]
1069
+ }));
1070
+ let r = n.polyType, i = {
1071
+ minLength: 2,
1072
+ field: "points"
1073
+ };
1074
+ r === "polygon" && (i = {
1075
+ minLength: 3,
1076
+ field: "points"
1077
+ });
1078
+ let { errors: a, validPoints: o } = S(e.points, i);
1079
+ return t.push(...a), C(n, o, i), {
1080
+ errors: t,
1081
+ normalized: n
1082
+ };
1083
+ }
1084
+ //#endregion
1085
+ //#region api/cesium/cesiumApi.js
1086
+ var Se = r("cesium", {
1087
+ addMultiLine: de,
1088
+ addMultiPolygon: fe,
1089
+ removeDrawn: pe,
1090
+ removeAllDrawn: me,
1091
+ addTexturedQuad: he,
1092
+ startMouseDraw: ge,
1093
+ stopMouseDraw: _e,
1094
+ getDrawnInfoByName: ve,
1095
+ getAllDrawnInfo: ye,
1096
+ measureDistance: be,
1097
+ measureArea: xe
1098
+ });
1099
+ //#endregion
1100
+ //#region api/marker/helpers.js
1101
+ function w(e) {
1102
+ return Array.isArray(e) && e.length === 0 ? void 0 : e;
1103
+ }
1104
+ function T(e) {
1105
+ return !!(e == null || e === "" || Array.isArray(e) && e.length === 0);
1106
+ }
1107
+ function E() {
1108
+ return `marker_${Date.now()}`;
1109
+ }
1110
+ function D(e, t, n) {
1111
+ let r = e?.[t];
1112
+ if (r != null) {
1113
+ if (typeof r != "object" || Array.isArray(r)) {
1114
+ n.push(`${t} 必须是对象`);
1115
+ return;
1116
+ }
1117
+ r.color !== void 0 && !T(r.color) && n.push(...y({
1118
+ normalized: r,
1119
+ field: "color",
1120
+ value: r.color
1121
+ })), r.size !== void 0 && !T(r.size) && n.push(..._({
1122
+ normalized: r,
1123
+ field: "size",
1124
+ value: w(r.size),
1125
+ length: 2
1126
+ })), r.padding !== void 0 && !T(r.padding) && n.push(..._({
1127
+ normalized: r,
1128
+ field: "padding",
1129
+ value: w(r.padding),
1130
+ length: 4
1131
+ })), r.backgroundColor !== void 0 && !T(r.backgroundColor) && n.push(...y({
1132
+ normalized: r,
1133
+ field: "backgroundColor",
1134
+ value: r.backgroundColor
1135
+ })), r.margin !== void 0 && !T(r.margin) && n.push(..._({
1136
+ normalized: r,
1137
+ field: "margin",
1138
+ value: w(r.margin),
1139
+ length: 4
1140
+ })), r.borderColor !== void 0 && !T(r.borderColor) && n.push(...y({
1141
+ normalized: r,
1142
+ field: "borderColor",
1143
+ value: r.borderColor
1144
+ })), r.borderWidth !== void 0 && !T(r.borderWidth) && n.push(...m({
1145
+ normalized: r,
1146
+ field: "borderWidth",
1147
+ value: r.borderWidth,
1148
+ min: 0
1149
+ })), r.borderRadius !== void 0 && !T(r.borderRadius) && n.push(...m({
1150
+ normalized: r,
1151
+ field: "borderRadius",
1152
+ value: r.borderRadius,
1153
+ min: 0
1154
+ }));
1155
+ }
1156
+ }
1157
+ function O(e, t, n) {
1158
+ let r = e?.[t];
1159
+ if (r != null) {
1160
+ if (typeof r != "object" || Array.isArray(r)) {
1161
+ n.push(`${t} 必须是对象`);
1162
+ return;
1163
+ }
1164
+ r.color !== void 0 && !T(r.color) && n.push(...y({
1165
+ normalized: r,
1166
+ field: "color",
1167
+ value: r.color
1168
+ })), r.fontSize !== void 0 && !T(r.fontSize) && n.push(...m({
1169
+ normalized: r,
1170
+ field: "fontSize",
1171
+ value: r.fontSize,
1172
+ min: 0
1173
+ })), r.typeface !== void 0 && !T(r.typeface) && n.push(...b({
1174
+ normalized: r,
1175
+ field: "typeface",
1176
+ value: r.typeface,
1177
+ type: "string",
1178
+ list: [
1179
+ "Bold",
1180
+ "Bold Italic",
1181
+ "Regular",
1182
+ "Italic",
1183
+ "Light"
1184
+ ]
1185
+ })), r.outlineSize !== void 0 && !T(r.outlineSize) && n.push(...m({
1186
+ normalized: r,
1187
+ field: "outlineSize",
1188
+ value: r.outlineSize,
1189
+ min: 0
1190
+ })), r.outlineColor !== void 0 && !T(r.outlineColor) && n.push(...y({
1191
+ normalized: r,
1192
+ field: "outlineColor",
1193
+ value: r.outlineColor
1194
+ })), r.shadowOffset !== void 0 && !T(r.shadowOffset) && n.push(..._({
1195
+ normalized: r,
1196
+ field: "shadowOffset",
1197
+ value: w(r.shadowOffset),
1198
+ length: 2
1199
+ })), r.shadowColor !== void 0 && !T(r.shadowColor) && n.push(...y({
1200
+ normalized: r,
1201
+ field: "shadowColor",
1202
+ value: r.shadowColor
1203
+ })), r.padding !== void 0 && !T(r.padding) && n.push(..._({
1204
+ normalized: r,
1205
+ field: "padding",
1206
+ value: w(r.padding),
1207
+ length: 4
1208
+ })), r.backgroundColor !== void 0 && !T(r.backgroundColor) && n.push(...y({
1209
+ normalized: r,
1210
+ field: "backgroundColor",
1211
+ value: r.backgroundColor
1212
+ })), r.margin !== void 0 && !T(r.margin) && n.push(..._({
1213
+ normalized: r,
1214
+ field: "margin",
1215
+ value: w(r.margin),
1216
+ length: 4
1217
+ })), r.borderColor !== void 0 && !T(r.borderColor) && n.push(...y({
1218
+ normalized: r,
1219
+ field: "borderColor",
1220
+ value: r.borderColor
1221
+ })), r.borderWidth !== void 0 && !T(r.borderWidth) && n.push(...m({
1222
+ normalized: r,
1223
+ field: "borderWidth",
1224
+ value: r.borderWidth,
1225
+ min: 0
1226
+ })), r.borderRadius !== void 0 && !T(r.borderRadius) && n.push(...m({
1227
+ normalized: r,
1228
+ field: "borderRadius",
1229
+ value: r.borderRadius,
1230
+ min: 0
1231
+ }));
1232
+ }
1233
+ }
1234
+ function k(e, t) {
1235
+ let n = e.markerType || "default";
1236
+ e.config ||= {};
1237
+ let r = e.config;
1238
+ n === "flashIcon" ? ke(r, t) : n === "component" ? Te(r, t) : n === "customCom" ? Ee(r, t) : n === "menuIcon" ? Ae(r, t) : n === "flood" ? je(r, t) : n === "capture" ? Me(r, t) : [
1239
+ "anchor1",
1240
+ "anchor2",
1241
+ "anchor3",
1242
+ "anchor4",
1243
+ "anchor5",
1244
+ "anchor6"
1245
+ ].includes(n) ? Oe(r, t) : n === "html" ? A(r, t) : n === "url" ? we(r, t) : n === "lod" ? Ce(r, t) : De(r, t);
1246
+ }
1247
+ function Ce(e, t) {
1248
+ if (D(e, "iconStyle", t), O(e, "textStyle", t), e.levels === void 0 || e.levels === null) {
1249
+ e.levels = [];
1250
+ return;
1251
+ }
1252
+ if (!Array.isArray(e.levels)) {
1253
+ t.push("[config.levels]必须是数组");
1254
+ return;
1255
+ }
1256
+ e.levels.forEach((e, n) => {
1257
+ if (!e || typeof e != "object" || Array.isArray(e)) {
1258
+ t.push(`[config.levels[${n}]]必须是对象`);
1259
+ return;
1260
+ }
1261
+ t.push(..._({
1262
+ normalized: e,
1263
+ field: "distance",
1264
+ value: w(e.distance),
1265
+ length: 2
1266
+ })), (!Array.isArray(e.distance) || e.distance.length !== 2) && t.push(`[config.levels[${n}].distance]必填,格式为 [min, max]`), t.push(...g({
1267
+ normalized: e,
1268
+ field: "text",
1269
+ value: e.text,
1270
+ defaultValue: ""
1271
+ })), t.push(...g({
1272
+ normalized: e,
1273
+ field: "iconAddress",
1274
+ value: e.iconAddress,
1275
+ defaultValue: ""
1276
+ })), D(e, "iconStyle", t), O(e, "textStyle", t);
1277
+ });
1278
+ }
1279
+ function A(e, t) {
1280
+ if (t.push(...m({
1281
+ normalized: e,
1282
+ field: "scale",
1283
+ value: e.scale,
1284
+ defaultValue: 1,
1285
+ min: 0
1286
+ })), t.push(..._({
1287
+ normalized: e,
1288
+ field: "size",
1289
+ value: w(e.size),
1290
+ length: 2
1291
+ })), Array.isArray(e.size) && e.size.length === 2) {
1292
+ let [n, r] = e.size;
1293
+ (typeof n != "number" || Number.isNaN(n) || n <= 0) && t.push("[size[0]]必须是>0的数字"), (typeof r != "number" || Number.isNaN(r) || r <= 0) && t.push("[size[1]]必须是>0的数字");
1294
+ }
1295
+ t.push(...g({
1296
+ normalized: e,
1297
+ field: "content",
1298
+ value: e.content,
1299
+ defaultValue: ""
1300
+ }));
1301
+ }
1302
+ function we(e, t) {
1303
+ if (t.push(..._({
1304
+ normalized: e,
1305
+ field: "size",
1306
+ value: w(e.size),
1307
+ length: 2,
1308
+ defaultValue: [400, 300]
1309
+ })), Array.isArray(e.size) && e.size.length === 2) {
1310
+ let [n, r] = e.size;
1311
+ (typeof n != "number" || Number.isNaN(n) || n <= 0) && t.push("[size[0]]必须是>0的数字"), (typeof r != "number" || Number.isNaN(r) || r <= 0) && t.push("[size[1]]必须是>0的数字");
1312
+ }
1313
+ t.push(...h({
1314
+ normalized: e,
1315
+ field: "url",
1316
+ value: e.url
1317
+ }));
1318
+ }
1319
+ function Te(e, t) {
1320
+ t.push(...y({
1321
+ normalized: e,
1322
+ field: "color",
1323
+ value: e.color,
1324
+ defaultValue: "#1cfeff"
1325
+ })), t.push(..._({
1326
+ normalized: e,
1327
+ field: "padding",
1328
+ value: w(e.padding),
1329
+ length: 4
1330
+ })), t.push(...g({
1331
+ normalized: e,
1332
+ field: "title",
1333
+ value: e.title,
1334
+ defaultValue: ""
1335
+ })), O(e, "titleStyle", t), t.push(..._({
1336
+ normalized: e,
1337
+ field: "dataTexts",
1338
+ value: e.dataTexts,
1339
+ defaultValue: []
1340
+ })), Array.isArray(e.dataTexts) ? e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1341
+ key: e.key ?? "",
1342
+ value: e.value ?? ""
1343
+ })) : e.dataTexts = [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1344
+ }
1345
+ function Ee(e, t) {
1346
+ t.push(..._({
1347
+ normalized: e,
1348
+ field: "size",
1349
+ value: w(e.size),
1350
+ length: 2,
1351
+ defaultValue: [400, 300]
1352
+ })), t.push(...g({
1353
+ normalized: e,
1354
+ field: "baseAddress",
1355
+ value: e.baseAddress,
1356
+ defaultValue: ""
1357
+ })), t.push(..._({
1358
+ normalized: e,
1359
+ field: "padding",
1360
+ value: w(e.padding),
1361
+ length: 4
1362
+ })), t.push(...g({
1363
+ normalized: e,
1364
+ field: "title",
1365
+ value: e.title,
1366
+ defaultValue: ""
1367
+ })), O(e, "titleStyle", t), t.push(..._({
1368
+ normalized: e,
1369
+ field: "dataTexts",
1370
+ value: e.dataTexts,
1371
+ defaultValue: []
1372
+ })), Array.isArray(e.dataTexts) ? e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1373
+ key: e.key ?? "",
1374
+ value: e.value ?? ""
1375
+ })) : e.dataTexts = [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1376
+ }
1377
+ function De(e, t) {
1378
+ t.push(...m({
1379
+ normalized: e,
1380
+ field: "scale",
1381
+ value: e.scale,
1382
+ defaultValue: 1,
1383
+ min: 0
1384
+ })), t.push(...g({
1385
+ normalized: e,
1386
+ field: "iconAddress",
1387
+ value: e.iconAddress,
1388
+ defaultValue: ""
1389
+ })), t.push(...g({
1390
+ normalized: e,
1391
+ field: "text",
1392
+ value: e.text,
1393
+ defaultValue: ""
1394
+ })), t.push(..._({
1395
+ normalized: e,
1396
+ field: "textVisibleRange",
1397
+ value: e.textVisibleRange,
1398
+ length: 2,
1399
+ defaultValue: [0, 2147483647]
1400
+ })), D(e, "iconStyle", t), O(e, "textStyle", t);
1401
+ }
1402
+ function Oe(e, t) {
1403
+ t.push(...m({
1404
+ normalized: e,
1405
+ field: "scale",
1406
+ value: e.scale,
1407
+ defaultValue: 1,
1408
+ min: 0
1409
+ })), t.push(...g({
1410
+ normalized: e,
1411
+ field: "iconAddress",
1412
+ value: e.iconAddress,
1413
+ defaultValue: ""
1414
+ })), t.push(...g({
1415
+ normalized: e,
1416
+ field: "text",
1417
+ value: e.text,
1418
+ defaultValue: ""
1419
+ })), t.push(..._({
1420
+ normalized: e,
1421
+ field: "textVisibleRange",
1422
+ value: e.textVisibleRange,
1423
+ length: 2,
1424
+ defaultValue: [0, 2147483647]
1425
+ })), t.push(...y({
1426
+ normalized: e,
1427
+ field: "color",
1428
+ value: e.color
1429
+ })), O(e, "textStyle", t);
1430
+ }
1431
+ function ke(e, t) {
1432
+ t.push(...y({
1433
+ normalized: e,
1434
+ field: "baseColor",
1435
+ value: e.baseColor,
1436
+ defaultValue: "#FF0000"
1437
+ })), t.push(...y({
1438
+ normalized: e,
1439
+ field: "flashColor",
1440
+ value: e.flashColor,
1441
+ defaultValue: "#00FF66"
1442
+ })), t.push(...g({
1443
+ normalized: e,
1444
+ field: "size",
1445
+ value: e.size,
1446
+ defaultValue: "32"
1447
+ })), t.push(...m({
1448
+ normalized: e,
1449
+ field: "centerScale",
1450
+ value: e.centerScale,
1451
+ defaultValue: .5,
1452
+ min: 0,
1453
+ max: 1
1454
+ })), t.push(...m({
1455
+ normalized: e,
1456
+ field: "frequency",
1457
+ value: e.frequency,
1458
+ defaultValue: 1,
1459
+ min: 0
1460
+ }));
1461
+ }
1462
+ function Ae(e, t) {
1463
+ t.push(...y({
1464
+ normalized: e,
1465
+ field: "color",
1466
+ value: e.color,
1467
+ defaultValue: "#1cfeff"
1468
+ })), t.push(...g({
1469
+ normalized: e,
1470
+ field: "title",
1471
+ value: e.title,
1472
+ defaultValue: ""
1473
+ })), t.push(...g({
1474
+ normalized: e,
1475
+ field: "iconAddress",
1476
+ value: e.iconAddress,
1477
+ defaultValue: ""
1478
+ })), t.push(..._({
1479
+ normalized: e,
1480
+ field: "secondVisibleRange",
1481
+ value: e.secondVisibleRange,
1482
+ length: 2,
1483
+ defaultValue: [0, 2147483647]
1484
+ })), t.push(..._({
1485
+ normalized: e,
1486
+ field: "textVisibleRange",
1487
+ value: e.textVisibleRange,
1488
+ length: 2,
1489
+ defaultValue: [0, 2147483647]
1490
+ }));
1491
+ let n = _({
1492
+ normalized: e,
1493
+ field: "tagList",
1494
+ value: e.tagList,
1495
+ length: 4,
1496
+ defaultValue: [
1497
+ {
1498
+ tagId: "id1",
1499
+ iconAddress: 1
1500
+ },
1501
+ {
1502
+ tagId: "id2",
1503
+ iconAddress: 2
1504
+ },
1505
+ {
1506
+ tagId: "id3",
1507
+ iconAddress: 3
1508
+ },
1509
+ {
1510
+ tagId: "id4",
1511
+ iconAddress: 4
1512
+ }
1513
+ ]
1514
+ });
1515
+ t.push(...n), n.length === 0 && Array.isArray(e.tagList) && e.tagList.forEach((e, n) => {
1516
+ if (!e) {
1517
+ t.push(`tagList[${n}] 必须是对象`);
1518
+ return;
1519
+ }
1520
+ t.push(...h({
1521
+ normalized: e,
1522
+ field: "tagId",
1523
+ value: e.tagId
1524
+ })), t.push(...m({
1525
+ normalized: e,
1526
+ field: "iconAddress",
1527
+ value: e.iconAddress,
1528
+ min: 0
1529
+ }));
1530
+ });
1531
+ }
1532
+ function je(e, t) {
1533
+ t.push(...y({
1534
+ normalized: e,
1535
+ field: "color",
1536
+ value: e.color,
1537
+ defaultValue: "#1cfeff"
1538
+ })), t.push(...g({
1539
+ normalized: e,
1540
+ field: "showName",
1541
+ value: e.showName,
1542
+ defaultValue: ""
1543
+ })), t.push(...g({
1544
+ normalized: e,
1545
+ field: "showValue",
1546
+ value: e.showValue,
1547
+ defaultValue: ""
1548
+ })), t.push(...g({
1549
+ normalized: e,
1550
+ field: "showTime",
1551
+ value: e.showTime,
1552
+ defaultValue: ""
1553
+ }));
1554
+ }
1555
+ function Me(e, t) {
1556
+ t.push(...y({
1557
+ normalized: e,
1558
+ field: "color",
1559
+ value: e.color,
1560
+ defaultValue: "#1cfeff"
1561
+ })), t.push(..._({
1562
+ normalized: e,
1563
+ field: "margin",
1564
+ value: w(e.margin),
1565
+ length: 4,
1566
+ defaultValue: [
1567
+ 0,
1568
+ 0,
1569
+ 0,
1570
+ 0
1571
+ ]
1572
+ })), t.push(...g({
1573
+ normalized: e,
1574
+ field: "title",
1575
+ value: e.title,
1576
+ defaultValue: ""
1577
+ })), O(e, "titleStyle", t), t.push(..._({
1578
+ normalized: e,
1579
+ field: "dataTexts",
1580
+ value: e.dataTexts,
1581
+ defaultValue: []
1582
+ })), Array.isArray(e.dataTexts) && e.dataTexts.length > 0 && typeof e.dataTexts[0] == "string" ? e.dataTexts = e.dataTexts.map((e) => ({
1583
+ key: "",
1584
+ value: e
1585
+ })) : Array.isArray(e.dataTexts) && (e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1586
+ key: e.key ?? "",
1587
+ value: e.value ?? ""
1588
+ }))), !e.dataKeyStyle && e.dataTextStyle && (e.dataKeyStyle = e.dataTextStyle), !e.dataValueStyle && e.dataTextStyle && (e.dataValueStyle = e.dataTextStyle), O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t), D(e, "imageStyle", t), t.push(..._({
1589
+ normalized: e,
1590
+ field: "coordinates",
1591
+ value: e.coordinates,
1592
+ length: 3,
1593
+ defaultValue: [
1594
+ 112.777328,
1595
+ 33.726444,
1596
+ 381.310616
1597
+ ]
1598
+ })), t.push(...m({
1599
+ normalized: e,
1600
+ field: "pitch",
1601
+ value: e.pitch,
1602
+ defaultValue: 0,
1603
+ min: -90,
1604
+ max: 90
1605
+ })), t.push(...m({
1606
+ normalized: e,
1607
+ field: "yaw",
1608
+ value: e.yaw,
1609
+ defaultValue: 0
1610
+ })), t.push(...m({
1611
+ normalized: e,
1612
+ field: "width",
1613
+ value: e.width,
1614
+ defaultValue: 800,
1615
+ min: 0
1616
+ })), t.push(...m({
1617
+ normalized: e,
1618
+ field: "height",
1619
+ value: e.height,
1620
+ defaultValue: 600,
1621
+ min: 0
1622
+ }));
1623
+ }
1624
+ function Ne(e, t) {
1625
+ t.push(...m({
1626
+ normalized: e,
1627
+ field: "scale",
1628
+ value: e.scale,
1629
+ defaultValue: 1,
1630
+ min: 0
1631
+ })), t.push(...g({
1632
+ normalized: e,
1633
+ field: "iconAddress",
1634
+ value: e.iconAddress,
1635
+ defaultValue: ""
1636
+ })), t.push(...g({
1637
+ normalized: e,
1638
+ field: "text",
1639
+ value: e.text,
1640
+ defaultValue: ""
1641
+ })), t.push(..._({
1642
+ normalized: e,
1643
+ field: "textVisibleRange",
1644
+ value: e.textVisibleRange,
1645
+ length: 2,
1646
+ defaultValue: [0, 2147483647]
1647
+ })), t.push(..._({
1648
+ normalized: e,
1649
+ field: "secondVisibleRange",
1650
+ value: e.secondVisibleRange,
1651
+ length: 2,
1652
+ defaultValue: [0, 2147483647]
1653
+ })), t.push(...g({
1654
+ normalized: e,
1655
+ field: "title",
1656
+ value: e.title,
1657
+ defaultValue: ""
1658
+ })), t.push(...g({
1659
+ normalized: e,
1660
+ field: "detailBtnText",
1661
+ value: e.detailBtnText,
1662
+ defaultValue: ""
1663
+ })), O(e, "textStyle", t), O(e, "titleStyle", t), O(e, "detailStyle", t), O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t), Array.isArray(e.dataTexts) ? e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1664
+ key: e.key ?? "",
1665
+ value: e.value ?? ""
1666
+ })) : e.dataTexts = [];
1667
+ }
1668
+ var Pe = [0, 2147483647];
1669
+ function j(e, t, n, r = "visibleRange") {
1670
+ n.push(..._({
1671
+ normalized: t,
1672
+ field: r,
1673
+ value: e[r],
1674
+ length: 2,
1675
+ defaultValue: [...Pe]
1676
+ }));
1677
+ let i = t[r];
1678
+ if (!Array.isArray(i) || i.length !== 2) return;
1679
+ let a = Number(i[0]), o = Number(i[1]);
1680
+ if (!Number.isFinite(a) || !Number.isFinite(o)) {
1681
+ n.push(`[${r}]元素必须是数字`);
1682
+ return;
1683
+ }
1684
+ if (a > o) {
1685
+ n.push(`[${r}]最小值不能大于最大值`);
1686
+ return;
1687
+ }
1688
+ t[r] = [a, o];
1689
+ }
1690
+ var M = [
1691
+ "default",
1692
+ "default1",
1693
+ "default2",
1694
+ "default3",
1695
+ "flashIcon",
1696
+ "component",
1697
+ "customCom",
1698
+ "menuIcon",
1699
+ "flood",
1700
+ "capture",
1701
+ "anchor1",
1702
+ "anchor2",
1703
+ "anchor3",
1704
+ "anchor4",
1705
+ "anchor5",
1706
+ "anchor6",
1707
+ "html",
1708
+ "url",
1709
+ "lod"
1710
+ ];
1711
+ //#endregion
1712
+ //#region api/marker/iconMarker.js
1713
+ function Fe(e) {
1714
+ let t = [], n = { ...e };
1715
+ if (e.id === void 0 || e.id === null || e.id === "" ? n.id = E() : n.id = e.id, t.push(...f(e.coordinates)), t.push(...g({
1716
+ normalized: n,
1717
+ field: "groupId",
1718
+ value: e.groupId
1719
+ })), j(e, n, t), t.push(...b({
1720
+ normalized: n,
1721
+ field: "isScreenSpace",
1722
+ value: e.isScreenSpace,
1723
+ defaultValue: 1,
1724
+ type: "number",
1725
+ list: [0, 1]
1726
+ })), e.markerState === void 0 || e.markerState === null ? n.markerState = !0 : typeof e.markerState == "boolean" ? n.markerState = e.markerState : t.push("[markerState]必须是布尔类型"), t.push(...b({
1727
+ normalized: n,
1728
+ field: "markerType",
1729
+ value: e.markerType,
1730
+ defaultValue: "default",
1731
+ type: "string",
1732
+ list: M
1733
+ })), e.recordData !== void 0) {
1734
+ let r = e.recordData;
1735
+ if (typeof r != "object" || !r || Array.isArray(r)) t.push("[recordData] 必须是对象类型");
1736
+ else try {
1737
+ n.recordData = JSON.stringify(r);
1738
+ } catch {
1739
+ t.push("[recordData] 序列化失败,请检查是否包含循环引用");
1740
+ }
1741
+ }
1742
+ return k(n, t), {
1743
+ errors: t,
1744
+ normalized: n
1745
+ };
1746
+ }
1747
+ //#endregion
1748
+ //#region api/marker/followMarker.js
1749
+ function Ie(e) {
1750
+ let t = [], n = { ...e };
1751
+ if (e.id === void 0 || e.id === null || e.id === "" ? n.id = E() : n.id = e.id, t.push(...h({
1752
+ normalized: n,
1753
+ field: "modelId",
1754
+ value: e.modelId
1755
+ })), t.push(...g({
1756
+ normalized: n,
1757
+ field: "groupId",
1758
+ value: e.groupId
1759
+ })), j(e, n, t), t.push(...b({
1760
+ normalized: n,
1761
+ field: "isScreenSpace",
1762
+ value: e.isScreenSpace,
1763
+ defaultValue: 1,
1764
+ type: "number",
1765
+ list: [0, 1]
1766
+ })), e.markerState === void 0 || e.markerState === null ? n.markerState = !0 : typeof e.markerState == "boolean" ? n.markerState = e.markerState : t.push("[markerState]必须是布尔类型"), t.push(...b({
1767
+ normalized: n,
1768
+ field: "markerType",
1769
+ value: e.markerType,
1770
+ defaultValue: "default",
1771
+ type: "string",
1772
+ list: M
1773
+ })), e.recordData !== void 0) {
1774
+ let r = e.recordData;
1775
+ if (typeof r != "object" || !r || Array.isArray(r)) t.push("[recordData] 必须是对象类型");
1776
+ else try {
1777
+ n.recordData = JSON.stringify(r);
1778
+ } catch {
1779
+ t.push("[recordData] 序列化失败,请检查是否包含循环引用");
1780
+ }
1781
+ }
1782
+ return k(n, t), {
1783
+ errors: t,
1784
+ normalized: n
1785
+ };
1786
+ }
1787
+ //#endregion
1788
+ //#region api/marker/removeMarker.js
1789
+ function Le(e = {}) {
1790
+ let t = [], n = { ...e };
1791
+ return t.push(..._({
1792
+ normalized: n,
1793
+ field: "groupIds",
1794
+ value: e.groupIds,
1795
+ minLength: 1
1796
+ })), {
1797
+ errors: t,
1798
+ normalized: n
1799
+ };
1800
+ }
1801
+ //#endregion
1802
+ //#region api/marker/removeAllMarker.js
1803
+ function Re(e) {
1804
+ return {
1805
+ errors: [],
1806
+ normalized: { ...e }
1807
+ };
1808
+ }
1809
+ //#endregion
1810
+ //#region api/marker/showMarker.js
1811
+ function ze(e = {}) {
1812
+ let t = [], n = { ...e };
1813
+ return t.push(..._({
1814
+ normalized: n,
1815
+ field: "groupIds",
1816
+ value: e.groupIds,
1817
+ minLength: 1
1818
+ })), {
1819
+ errors: t,
1820
+ normalized: n
1821
+ };
1822
+ }
1823
+ //#endregion
1824
+ //#region api/marker/showAllMarker.js
1825
+ function Be(e = {}) {
1826
+ return {
1827
+ errors: [],
1828
+ normalized: { ...e }
1829
+ };
1830
+ }
1831
+ //#endregion
1832
+ //#region api/marker/hideMarker.js
1833
+ function Ve(e = {}) {
1834
+ let t = [], n = { ...e };
1835
+ return t.push(..._({
1836
+ normalized: n,
1837
+ field: "groupIds",
1838
+ value: e.groupIds,
1839
+ minLength: 1
1840
+ })), {
1841
+ errors: t,
1842
+ normalized: n
1843
+ };
1844
+ }
1845
+ //#endregion
1846
+ //#region api/marker/hideAllMarker.js
1847
+ function He(e = {}) {
1848
+ return {
1849
+ errors: [],
1850
+ normalized: { ...e }
1851
+ };
1852
+ }
1853
+ //#endregion
1854
+ //#region api/marker/iconUrlMarker.js
1855
+ function Ue(e = {}) {
1856
+ let t = [], n = { ...e };
1857
+ return t.push(...h({
1858
+ normalized: n,
1859
+ field: "url",
1860
+ value: e.url
1861
+ })), {
1862
+ errors: t,
1863
+ normalized: n
1864
+ };
1865
+ }
1866
+ //#endregion
1867
+ //#region api/marker/addClustering.js
1868
+ function We(e) {
1869
+ let t = [], n = { ...e };
1870
+ t.push(...b({
1871
+ normalized: n,
1872
+ field: "type",
1873
+ value: e.type,
1874
+ type: "string",
1875
+ list: ["all", "groupId"]
1876
+ })), n.type === "groupId" ? t.push(..._({
1877
+ normalized: n,
1878
+ field: "value",
1879
+ value: e.value,
1880
+ minLength: 1
1881
+ })) : t.push(..._({
1882
+ normalized: n,
1883
+ field: "value",
1884
+ value: e.value
1885
+ })), t.push(...m({
1886
+ normalized: n,
1887
+ field: "distance",
1888
+ value: e.distance,
1889
+ defaultValue: 0,
1890
+ min: 0
1891
+ })), t.push(...b({
1892
+ normalized: n,
1893
+ field: "clusteringType",
1894
+ value: e.clusteringType,
1895
+ type: "string",
1896
+ list: ["clusteringDefault"]
1897
+ })), n.clusteringConfig ||= {};
1898
+ let r = n.clusteringConfig;
1899
+ return t.push(...y({
1900
+ normalized: r,
1901
+ field: "color",
1902
+ value: r.color,
1903
+ defaultValue: "#1cfeff"
1904
+ })), t.push(...g({
1905
+ normalized: r,
1906
+ field: "text",
1907
+ value: r.text,
1908
+ defaultValue: "${number}"
1909
+ })), O(r, "textStyle", t), {
1910
+ errors: t,
1911
+ normalized: n
1912
+ };
1913
+ }
1914
+ //#endregion
1915
+ //#region api/marker/removeClustering.js
1916
+ function Ge(e) {
1917
+ let t = [], n = { ...e };
1918
+ return t.push(...b({
1919
+ normalized: n,
1920
+ field: "type",
1921
+ value: e.type,
1922
+ type: "string",
1923
+ list: ["all", "groupId"]
1924
+ })), n.type === "groupId" ? t.push(..._({
1925
+ normalized: n,
1926
+ field: "value",
1927
+ value: e.value,
1928
+ minLength: 1
1929
+ })) : t.push(..._({
1930
+ normalized: n,
1931
+ field: "value",
1932
+ value: e.value
1933
+ })), {
1934
+ errors: t,
1935
+ normalized: n
1936
+ };
1937
+ }
1938
+ //#endregion
1939
+ //#region api/marker/secondMarker.js
1940
+ function Ke(e) {
1941
+ let t = [], n = { ...e };
1942
+ e.id === void 0 || e.id === null || e.id === "" ? n.id = E() : n.id = e.id, t.push(...f(e.coordinates)), t.push(...g({
1943
+ normalized: n,
1944
+ field: "groupId",
1945
+ value: e.groupId
1946
+ })), j(e, n, t), t.push(...b({
1947
+ normalized: n,
1948
+ field: "isScreenSpace",
1949
+ value: e.isScreenSpace,
1950
+ defaultValue: 1,
1951
+ type: "number",
1952
+ list: [0, 1]
1953
+ })), typeof e.isInitSecond == "boolean" ? n.isInitSecond = e.isInitSecond : e.isInitSecond === void 0 ? n.isInitSecond = !1 : t.push("[isInitSecond]必须是布尔类型"), t.push(...b({
1954
+ normalized: n,
1955
+ field: "triggerType",
1956
+ value: e.triggerType,
1957
+ defaultValue: "click",
1958
+ type: "string",
1959
+ list: ["click", "move"]
1960
+ })), t.push(...b({
1961
+ normalized: n,
1962
+ field: "markerType",
1963
+ value: e.markerType,
1964
+ defaultValue: "menu1",
1965
+ type: "string",
1966
+ list: [
1967
+ "menu1",
1968
+ "menuIcon",
1969
+ "popupCustom1"
1970
+ ]
1971
+ })), (!n.config || typeof n.config != "object") && (n.config = {});
1972
+ let r = n.config;
1973
+ if (n.markerType !== "popupCustom1" && t.push(...y({
1974
+ normalized: r,
1975
+ field: "color",
1976
+ value: r.color,
1977
+ defaultValue: "#1cfeff"
1978
+ })), t.push(...g({
1979
+ normalized: r,
1980
+ field: "title",
1981
+ value: r.title,
1982
+ defaultValue: ""
1983
+ })), n.markerType === "popupCustom1" ? Ne(r, t) : (O(r, "titleStyle", t), O(r, "dataKeyStyle", t), O(r, "dataValueStyle", t), Array.isArray(r.dataTexts) ? r.dataTexts = r.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1984
+ key: e.key ?? "",
1985
+ value: e.value ?? ""
1986
+ })) : r.dataTexts = []), e.recordData !== void 0) {
1987
+ let r = e.recordData;
1988
+ if (typeof r != "object" || !r || Array.isArray(r)) t.push("[recordData] 必须是对象类型");
1989
+ else try {
1990
+ n.recordData = JSON.stringify(r);
1991
+ } catch {
1992
+ t.push("[recordData] 序列化失败,请检查是否包含循环引用");
1993
+ }
1994
+ }
1995
+ return {
1996
+ errors: t,
1997
+ normalized: n
1998
+ };
1999
+ }
2000
+ //#endregion
2001
+ //#region api/marker/markerApi.js
2002
+ var qe = r("marker", {
2003
+ iconMarker: Fe,
2004
+ followMarker: Ie,
2005
+ removeMarker: Le,
2006
+ removeAllMarker: Re,
2007
+ showMarker: ze,
2008
+ showAllMarker: Be,
2009
+ hideMarker: Ve,
2010
+ hideAllMarker: He,
2011
+ iconUrlMarker: Ue,
2012
+ addClustering: We,
2013
+ removeClustering: Ge,
2014
+ secondMarker: Ke
2015
+ }, { getOptions: (e) => e === "iconUrlMarker" ? { timeout: 12e4 } : {} });
2016
+ //#endregion
2017
+ //#region api/floodPeak/getList.js
2018
+ function Je(e) {
2019
+ return {
2020
+ errors: [],
2021
+ normalized: { ...e }
2022
+ };
2023
+ }
2024
+ //#endregion
2025
+ //#region api/floodPeak/helpers.js
2026
+ var Ye = (e, t, n) => {
2027
+ e && (n === "default" || n === "default1" || n === "default2" || n === "default3" || n === "default4" || n === "flashIcon") && (t.push(...y({
2028
+ normalized: e,
2029
+ field: "color",
2030
+ value: e.color
2031
+ })), t.push(...m({
2032
+ normalized: e,
2033
+ field: "flowVelocity",
2034
+ value: e.flowVelocity,
2035
+ min: 0
2036
+ })), t.push(...m({
2037
+ normalized: e,
2038
+ field: "peakLength",
2039
+ value: e.peakLength,
2040
+ defaultValue: .5,
2041
+ min: 0,
2042
+ max: 1
2043
+ })), t.push(...m({
2044
+ normalized: e,
2045
+ field: "foam",
2046
+ value: e.foam,
2047
+ defaultValue: 1,
2048
+ min: 0,
2049
+ max: 1
2050
+ })));
2051
+ };
2052
+ //#endregion
2053
+ //#region api/floodPeak/record.js
2054
+ function Xe(e) {
2055
+ let t = [], n = { ...e };
2056
+ t.push(...h({
2057
+ normalized: n,
2058
+ field: "floodPeakName",
2059
+ value: e.floodPeakName
2060
+ })), t.push(...b({
2061
+ normalized: n,
2062
+ field: "materialType",
2063
+ value: e.materialType,
2064
+ defaultValue: "default",
2065
+ type: "string",
2066
+ list: [
2067
+ "default",
2068
+ "default1",
2069
+ "default2",
2070
+ "default3",
2071
+ "default4",
2072
+ "flashIcon"
2073
+ ]
2074
+ })), t.push(...m({
2075
+ normalized: n,
2076
+ field: "duration",
2077
+ value: e.duration,
2078
+ min: 0
2079
+ }));
2080
+ let r = n.materialType || e.materialType || "default";
2081
+ return Ye(n.config, t, r), {
2082
+ errors: t,
2083
+ normalized: n
2084
+ };
2085
+ }
2086
+ //#endregion
2087
+ //#region api/floodPeak/offset.js
2088
+ function Ze(e) {
2089
+ let t = [], n = { ...e };
2090
+ return t.push(...h({
2091
+ normalized: n,
2092
+ field: "floodPeakName",
2093
+ value: e.floodPeakName
2094
+ })), t.push(...p({
2095
+ normalized: n,
2096
+ field: "height",
2097
+ value: e.height
2098
+ })), {
2099
+ errors: t,
2100
+ normalized: n
2101
+ };
2102
+ }
2103
+ //#endregion
2104
+ //#region api/floodPeak/offsetReset.js
2105
+ function Qe(e) {
2106
+ let t = [], n = { ...e };
2107
+ return t.push(...h({
2108
+ normalized: n,
2109
+ field: "floodPeakName",
2110
+ value: e.floodPeakName
2111
+ })), {
2112
+ errors: t,
2113
+ normalized: n
2114
+ };
2115
+ }
2116
+ //#endregion
2117
+ //#region api/floodPeak/setText.js
2118
+ function $e(e) {
2119
+ let t = [], n = { ...e };
2120
+ t.push(...h({
2121
+ normalized: n,
2122
+ field: "floodPeakName",
2123
+ value: e.floodPeakName
2124
+ }));
2125
+ let r = _({
2126
+ normalized: n,
2127
+ field: "textList",
2128
+ value: e.textList,
2129
+ required: !0,
2130
+ minLength: 1
2131
+ });
2132
+ return t.push(...r), Array.isArray(e.textList) && e.textList.forEach((e, n) => {
2133
+ e != null && typeof e != "string" && t.push(`[textList[${n}]]必须是字符串类型`);
2134
+ }), {
2135
+ errors: t,
2136
+ normalized: n
2137
+ };
2138
+ }
2139
+ //#endregion
2140
+ //#region api/floodPeak/close.js
2141
+ function et(e) {
2142
+ let t = [], n = { ...e };
2143
+ return t.push(...h({
2144
+ normalized: n,
2145
+ field: "floodPeakName",
2146
+ value: e.floodPeakName
2147
+ })), {
2148
+ errors: t,
2149
+ normalized: n
2150
+ };
2151
+ }
2152
+ //#endregion
2153
+ //#region api/floodPeak/cameraFollow.js
2154
+ function tt(e) {
2155
+ let t = [], n = { ...e };
2156
+ t.push(...h({
2157
+ normalized: n,
2158
+ field: "floodPeakName",
2159
+ value: e.floodPeakName
2160
+ }));
2161
+ let r = e.state;
2162
+ r == null ? n.state = !0 : typeof r == "boolean" ? n.state = r : t.push("[state]必须是布尔类型");
2163
+ for (let r of [
2164
+ "x",
2165
+ "y",
2166
+ "z",
2167
+ "yaw"
2168
+ ]) t.push(...m({
2169
+ normalized: n,
2170
+ field: r,
2171
+ value: e[r],
2172
+ defaultValue: 0
2173
+ }));
2174
+ return t.push(...m({
2175
+ normalized: n,
2176
+ field: "pitch",
2177
+ value: e.pitch,
2178
+ defaultValue: 0,
2179
+ min: -90,
2180
+ max: 90
2181
+ })), {
2182
+ errors: t,
2183
+ normalized: n
2184
+ };
2185
+ }
2186
+ //#endregion
2187
+ //#region api/floodPeak/floodPeakApi.js
2188
+ var nt = r("floodPeak", {
2189
+ getList: Je,
2190
+ record: Xe,
2191
+ offset: Ze,
2192
+ offsetReset: Qe,
2193
+ setText: $e,
2194
+ close: et,
2195
+ cameraFollow: tt
2196
+ }, { getOptions: () => ({ timeout: 0 }) });
2197
+ //#endregion
2198
+ //#region api/animation/play.js
2199
+ function rt(e = {}) {
2200
+ let t = { ...e }, n = [];
2201
+ return n.push(...h({
2202
+ normalized: t,
2203
+ field: "animName",
2204
+ value: e.animName
2205
+ })), n.push(...m({
2206
+ normalized: t,
2207
+ field: "frameRate",
2208
+ value: e.frameRate,
2209
+ defaultValue: 1,
2210
+ min: 0
2211
+ })), n.push(...m({
2212
+ normalized: t,
2213
+ field: "frameIndex",
2214
+ value: e.frameIndex,
2215
+ defaultValue: 0,
2216
+ min: 0
2217
+ })), e.isSyncview === void 0 || e.isSyncview === null || e.isSyncview === "" ? t.isSyncview = !0 : typeof e.isSyncview == "boolean" ? t.isSyncview = e.isSyncview : n.push("[isSyncview]必须是布尔类型"), {
2218
+ errors: n,
2219
+ normalized: t
2220
+ };
2221
+ }
2222
+ //#endregion
2223
+ //#region api/animation/carryOn.js
2224
+ function it(e = {}) {
2225
+ let t = { ...e };
2226
+ return {
2227
+ errors: [...h({
2228
+ normalized: t,
2229
+ field: "animName",
2230
+ value: e.animName
2231
+ })],
2232
+ normalized: t
2233
+ };
2234
+ }
2235
+ //#endregion
2236
+ //#region api/animation/pause.js
2237
+ function at(e = {}) {
2238
+ let t = { ...e };
2239
+ return {
2240
+ errors: [...h({
2241
+ normalized: t,
2242
+ field: "animName",
2243
+ value: e.animName
2244
+ })],
2245
+ normalized: t
2246
+ };
2247
+ }
2248
+ //#endregion
2249
+ //#region api/animation/stop.js
2250
+ function ot(e = {}) {
2251
+ let t = { ...e };
2252
+ return {
2253
+ errors: [...h({
2254
+ normalized: t,
2255
+ field: "animName",
2256
+ value: e.animName
2257
+ })],
2258
+ normalized: t
2259
+ };
2260
+ }
2261
+ //#endregion
2262
+ //#region api/animation/jumpToFrame.js
2263
+ function st(e = {}) {
2264
+ let t = { ...e }, n = [];
2265
+ return n.push(...h({
2266
+ normalized: t,
2267
+ field: "animName",
2268
+ value: e.animName
2269
+ })), n.push(...p({
2270
+ normalized: t,
2271
+ field: "frameIndex",
2272
+ value: e.frameIndex,
2273
+ required: !0,
2274
+ min: 0
2275
+ })), {
2276
+ errors: n,
2277
+ normalized: t
2278
+ };
2279
+ }
2280
+ //#endregion
2281
+ //#region api/animation/setPlaybackFrameRate.js
2282
+ function ct(e = {}) {
2283
+ let t = { ...e }, n = [];
2284
+ return n.push(...h({
2285
+ normalized: t,
2286
+ field: "animName",
2287
+ value: e.animName
2288
+ })), n.push(...p({
2289
+ normalized: t,
2290
+ field: "frameRate",
2291
+ value: e.frameRate,
2292
+ required: !0,
2293
+ min: 0
2294
+ })), {
2295
+ errors: n,
2296
+ normalized: t
2297
+ };
2298
+ }
2299
+ //#endregion
2300
+ //#region api/animation/onData.js
2301
+ function lt(e = {}) {
2302
+ let t = [];
2303
+ return e.onChange && typeof e.onChange != "function" && t.push("onChange 必须为函数"), {
2304
+ errors: t,
2305
+ normalized: { ...e }
2306
+ };
2307
+ }
2308
+ //#endregion
2309
+ //#region api/animation/animationApi.js
2310
+ var ut = r("animation", {
2311
+ play: rt,
2312
+ carryOn: it,
2313
+ pause: at,
2314
+ stop: ot,
2315
+ jumpToFrame: st,
2316
+ setPlaybackFrameRate: ct,
2317
+ onData: lt
2318
+ });
2319
+ //#endregion
2320
+ //#region api/hydrodynamicForce/create.js
2321
+ function dt(e) {
2322
+ let t = [], n = { ...e };
2323
+ return t.push(...p({
2324
+ normalized: n,
2325
+ field: "xMin",
2326
+ value: e.xMin,
2327
+ required: !0,
2328
+ min: -180,
2329
+ max: 180
2330
+ })), t.push(...p({
2331
+ normalized: n,
2332
+ field: "xMax",
2333
+ value: e.xMax,
2334
+ required: !0,
2335
+ min: e.xMin,
2336
+ max: 180
2337
+ })), t.push(...p({
2338
+ normalized: n,
2339
+ field: "yMin",
2340
+ value: e.yMin,
2341
+ required: !0,
2342
+ min: -90,
2343
+ max: 90
2344
+ })), t.push(...p({
2345
+ normalized: n,
2346
+ field: "yMax",
2347
+ value: e.yMax,
2348
+ required: !0,
2349
+ min: e.yMin,
2350
+ max: 90
2351
+ })), t.push(...p({
2352
+ normalized: n,
2353
+ field: "minTerrain",
2354
+ value: e.minTerrain,
2355
+ required: !0
2356
+ })), t.push(...p({
2357
+ normalized: n,
2358
+ field: "maxTerrain",
2359
+ value: e.maxTerrain,
2360
+ required: !0,
2361
+ min: e.minTerrain
2362
+ })), t.push(...h({
2363
+ normalized: n,
2364
+ field: "mapUrl",
2365
+ value: e.mapUrl
2366
+ })), t.push(...h({
2367
+ normalized: n,
2368
+ field: "key",
2369
+ value: e.key
2370
+ })), {
2371
+ errors: t,
2372
+ normalized: n
2373
+ };
2374
+ }
2375
+ //#endregion
2376
+ //#region api/hydrodynamicForce/waterFlow.js
2377
+ function ft(e) {
2378
+ let t = [], n = { ...e };
2379
+ return t.push(...p({
2380
+ normalized: n,
2381
+ field: "minWater",
2382
+ value: e.minWater,
2383
+ required: !0
2384
+ })), t.push(...p({
2385
+ normalized: n,
2386
+ field: "maxWater",
2387
+ value: e.maxWater,
2388
+ required: !0,
2389
+ min: e.minWater
2390
+ })), t.push(...p({
2391
+ normalized: n,
2392
+ field: "minU",
2393
+ value: e.minU,
2394
+ required: !0
2395
+ })), t.push(...p({
2396
+ normalized: n,
2397
+ field: "maxU",
2398
+ value: e.maxU,
2399
+ required: !0,
2400
+ min: e.minU
2401
+ })), t.push(...p({
2402
+ normalized: n,
2403
+ field: "minV",
2404
+ value: e.minV,
2405
+ required: !0
2406
+ })), t.push(...p({
2407
+ normalized: n,
2408
+ field: "maxV",
2409
+ value: e.maxV,
2410
+ required: !0,
2411
+ min: e.minV
2412
+ })), t.push(...h({
2413
+ normalized: n,
2414
+ field: "waterFlowUrl",
2415
+ value: e.waterFlowUrl
2416
+ })), t.push(...h({
2417
+ normalized: n,
2418
+ field: "key",
2419
+ value: e.key
2420
+ })), {
2421
+ errors: t,
2422
+ normalized: n
2423
+ };
2424
+ }
2425
+ //#endregion
2426
+ //#region api/hydrodynamicForce/waterDepth.js
2427
+ function pt(e) {
2428
+ let t = [], n = { ...e };
2429
+ return t.push(...p({
2430
+ normalized: n,
2431
+ field: "minWater",
2432
+ value: e.minWater,
2433
+ required: !0
2434
+ })), t.push(...p({
2435
+ normalized: n,
2436
+ field: "maxWater",
2437
+ value: e.maxWater,
2438
+ required: !0,
2439
+ min: e.minWater
2440
+ })), e.rangeList === void 0 || e.rangeList === null ? t.push("[rangeList]为必填项") : Array.isArray(e.rangeList) ? e.rangeList.length === 0 ? t.push("[rangeList]不能为空数组") : e.rangeList.forEach((e, n) => {
2441
+ if (typeof e != "object" || !e) {
2442
+ t.push(`[rangeList[${n}]]必须是对象类型`);
2443
+ return;
2444
+ }
2445
+ t.push(...p({
2446
+ normalized: e,
2447
+ field: "rangeDepth",
2448
+ value: e.rangeDepth,
2449
+ required: !0
2450
+ })), t.push(...h({
2451
+ normalized: e,
2452
+ field: "color",
2453
+ value: e.color
2454
+ }));
2455
+ }) : t.push("[rangeList]必须是数组类型"), t.push(...h({
2456
+ normalized: n,
2457
+ field: "waterDepthUrl",
2458
+ value: e.waterDepthUrl
2459
+ })), t.push(...h({
2460
+ normalized: n,
2461
+ field: "key",
2462
+ value: e.key
2463
+ })), {
2464
+ errors: t,
2465
+ normalized: n
2466
+ };
2467
+ }
2468
+ //#endregion
2469
+ //#region api/hydrodynamicForce/sediment.js
2470
+ function mt(e) {
2471
+ let t = [], n = { ...e };
2472
+ return t.push(...h({
2473
+ normalized: n,
2474
+ field: "key",
2475
+ value: e.key
2476
+ })), t.push(...h({
2477
+ normalized: n,
2478
+ field: "sedimentTexUrl",
2479
+ value: e.sedimentTexUrl
2480
+ })), t.push(...p({
2481
+ normalized: n,
2482
+ field: "minWater",
2483
+ value: e.minWater,
2484
+ required: !0
2485
+ })), t.push(...p({
2486
+ normalized: n,
2487
+ field: "maxWater",
2488
+ value: e.maxWater,
2489
+ required: !0,
2490
+ min: e.minWater
2491
+ })), t.push(...p({
2492
+ normalized: n,
2493
+ field: "minDoD",
2494
+ value: e.minDoD,
2495
+ required: !0
2496
+ })), t.push(...p({
2497
+ normalized: n,
2498
+ field: "maxDoD",
2499
+ value: e.maxDoD,
2500
+ required: !0,
2501
+ min: e.minDoD
2502
+ })), {
2503
+ errors: t,
2504
+ normalized: n
2505
+ };
2506
+ }
2507
+ //#endregion
2508
+ //#region api/hydrodynamicForce/materialParams.js
2509
+ function ht(e = {}) {
2510
+ let t = [], n = { ...e };
2511
+ return t.push(...h({
2512
+ normalized: n,
2513
+ field: "key",
2514
+ value: e.key
2515
+ })), t.push(...m({
2516
+ normalized: n,
2517
+ field: "heightOffset",
2518
+ value: e.heightOffset,
2519
+ defaultValue: 0
2520
+ })), t.push(...m({
2521
+ normalized: n,
2522
+ field: "resolutionScale",
2523
+ value: e.resolutionScale,
2524
+ defaultValue: .2,
2525
+ min: 0
2526
+ })), t.push(...m({
2527
+ normalized: n,
2528
+ field: "cameraLODDistance",
2529
+ value: e.cameraLODDistance,
2530
+ defaultValue: 4e4,
2531
+ min: 0
2532
+ })), t.push(...m({
2533
+ normalized: n,
2534
+ field: "cameraLODNum",
2535
+ value: e.cameraLODNum,
2536
+ defaultValue: 4,
2537
+ min: 0
2538
+ })), t.push(...m({
2539
+ normalized: n,
2540
+ field: "cameraRemapMaxOffest",
2541
+ value: e.cameraRemapMaxOffest,
2542
+ defaultValue: 40,
2543
+ min: 0
2544
+ })), t.push(...m({
2545
+ normalized: n,
2546
+ field: "flowAmplitude",
2547
+ value: e.flowAmplitude,
2548
+ defaultValue: .5,
2549
+ min: 0
2550
+ })), t.push(...m({
2551
+ normalized: n,
2552
+ field: "flowFrequency",
2553
+ value: e.flowFrequency,
2554
+ defaultValue: .5,
2555
+ min: 0
2556
+ })), {
2557
+ errors: t,
2558
+ normalized: n
2559
+ };
2560
+ }
2561
+ //#endregion
2562
+ //#region api/hydrodynamicForce/close.js
2563
+ function gt(e) {
2564
+ let t = [], n = { ...e };
2565
+ return t.push(...h({
2566
+ normalized: n,
2567
+ field: "key",
2568
+ value: e.key
2569
+ })), {
2570
+ errors: t,
2571
+ normalized: n
2572
+ };
2573
+ }
2574
+ //#endregion
2575
+ //#region api/hydrodynamicForce/hydrodynamicForceApi.js
2576
+ var _t = r("hydrodynamicForce", {
2577
+ create: dt,
2578
+ waterFlow: ft,
2579
+ waterDepth: pt,
2580
+ sediment: mt,
2581
+ materialParams: ht,
2582
+ close: gt
2583
+ });
2584
+ //#endregion
2585
+ //#region api/sceneModel/getById.js
2586
+ function vt(e) {
2587
+ let t = [], n = { ...e };
2588
+ return t.push(...h({
2589
+ normalized: n,
2590
+ field: "id",
2591
+ value: e.id
2592
+ })), {
2593
+ errors: t,
2594
+ normalized: n
2595
+ };
2596
+ }
2597
+ //#endregion
2598
+ //#region api/sceneModel/getByTag.js
2599
+ function yt(e) {
2600
+ let t = [], n = { ...e };
2601
+ return t.push(...h({
2602
+ normalized: n,
2603
+ field: "tag",
2604
+ value: e.tag
2605
+ })), {
2606
+ errors: t,
2607
+ normalized: n
2608
+ };
2609
+ }
2610
+ //#endregion
2611
+ //#region api/sceneModel/helpers.js
2612
+ var N = (e) => !(e == null || e === "");
2613
+ function P(e, { id: t, tag: n }) {
2614
+ let r = N(t), i = N(n);
2615
+ if (!r && !i) {
2616
+ e.push("[id]和[tag]必须提供其中一个");
2617
+ return;
2618
+ }
2619
+ if (r && i) {
2620
+ e.push("[id]和[tag]不能同时提供");
2621
+ return;
2622
+ }
2623
+ r ? e.push(...g({
2624
+ field: "id",
2625
+ value: t
2626
+ })) : i && e.push(...g({
2627
+ field: "tag",
2628
+ value: n
2629
+ }));
2630
+ }
2631
+ function F(e, t, n) {
2632
+ if (e == null) return;
2633
+ if (typeof e != "object") {
2634
+ n.push(`[${t}]必须是对象类型`);
2635
+ return;
2636
+ }
2637
+ let { x: r, y: i, z: a } = e;
2638
+ if (r != null) {
2639
+ let e = r === "" ? NaN : r;
2640
+ n.push(...m({
2641
+ field: `${t}.x`,
2642
+ value: e
2643
+ }));
2644
+ }
2645
+ if (i != null) {
2646
+ let e = i === "" ? NaN : i;
2647
+ n.push(...m({
2648
+ field: `${t}.y`,
2649
+ value: e
2650
+ }));
2651
+ }
2652
+ if (a != null) {
2653
+ let e = a === "" ? NaN : a;
2654
+ n.push(...m({
2655
+ field: `${t}.z`,
2656
+ value: e
2657
+ }));
2658
+ }
2659
+ }
2660
+ function I(e, t, n) {
2661
+ let r = (t, n) => N(n) ? Array.isArray(n) ? n.length === 0 ? (e.push(`[${t}]不能为空数组`), !1) : !0 : (e.push(`[${t}]必须是数组类型`), !1) : !1, i = r("ids", t), a = r("tags", n);
2662
+ !i && !a ? e.push("[ids]和[tags]必须提供其中一个") : i && a && e.push("[ids]和[tags]不能同时提供");
2663
+ }
2664
+ var bt = [
2665
+ "None",
2666
+ "Color",
2667
+ "Texture",
2668
+ "Material"
2669
+ ];
2670
+ function L(e, t, n, r, i) {
2671
+ if (r == null) {
2672
+ t[n] = i;
2673
+ return;
2674
+ }
2675
+ if (typeof r != "boolean") {
2676
+ e.push(`[${n}]必须是布尔类型`);
2677
+ return;
2678
+ }
2679
+ t[n] = r;
2680
+ }
2681
+ //#endregion
2682
+ //#region api/sceneModel/setTransform.js
2683
+ function xt(e) {
2684
+ let t = [], n = { ...e };
2685
+ return P(t, e), F(e.rotation, "rotation", t), F(e.scale, "scale", t), F(e.translation, "translation", t), t.push(...m({
2686
+ normalized: n,
2687
+ field: "duration",
2688
+ value: e.duration,
2689
+ defaultValue: 0,
2690
+ min: 0
2691
+ })), e.list !== void 0 && e.list !== null && (Array.isArray(e.list) ? e.list.forEach((e, n) => {
2692
+ if (typeof e != "object" || !e) {
2693
+ t.push(`[list[${n}]]必须是对象类型`);
2694
+ return;
2695
+ }
2696
+ F(e.rotation, `list[${n}].rotation`, t), F(e.scale, `list[${n}].scale`, t), F(e.translation, `list[${n}].translation`, t), t.push(...m({
2697
+ normalized: e,
2698
+ field: "duration",
2699
+ value: e.duration,
2700
+ min: 0
2701
+ }));
2702
+ }) : t.push("[list]必须是数组类型")), {
2703
+ errors: t,
2704
+ normalized: n
2705
+ };
2706
+ }
2707
+ //#endregion
2708
+ //#region api/sceneModel/clearTransform.js
2709
+ function St(e) {
2710
+ let t = [], n = { ...e };
2711
+ return P(t, e), {
2712
+ errors: t,
2713
+ normalized: n
2714
+ };
2715
+ }
2716
+ //#endregion
2717
+ //#region api/sceneModel/offset.js
2718
+ function Ct(e) {
2719
+ let t = [], n = { ...e };
2720
+ return P(t, e), F(e.rotation, "rotation", t), F(e.scale, "scale", t), F(e.translation, "translation", t), t.push(...m({
2721
+ normalized: n,
2722
+ field: "duration",
2723
+ value: e.duration,
2724
+ defaultValue: 0,
2725
+ min: 0
2726
+ })), e.list !== void 0 && e.list !== null && (Array.isArray(e.list) ? e.list.forEach((e, n) => {
2727
+ if (typeof e != "object" || !e) {
2728
+ t.push(`[list[${n}]]必须是对象类型`);
2729
+ return;
2730
+ }
2731
+ F(e.rotation, `list[${n}].rotation`, t), F(e.scale, `list[${n}].scale`, t), F(e.translation, `list[${n}].translation`, t), t.push(...m({
2732
+ normalized: e,
2733
+ field: "duration",
2734
+ value: e.duration,
2735
+ min: 0
2736
+ }));
2737
+ }) : t.push("[list]必须是数组类型")), {
2738
+ errors: t,
2739
+ normalized: n
2740
+ };
2741
+ }
2742
+ //#endregion
2743
+ //#region api/sceneModel/clearOffset.js
2744
+ function wt(e) {
2745
+ let t = [], n = { ...e };
2746
+ return P(t, e), {
2747
+ errors: t,
2748
+ normalized: n
2749
+ };
2750
+ }
2751
+ //#endregion
2752
+ //#region api/sceneModel/show.js
2753
+ function Tt(e) {
2754
+ let t = [], n = { ...e };
2755
+ return I(t, e.ids, e.tags), {
2756
+ errors: t,
2757
+ normalized: n
2758
+ };
2759
+ }
2760
+ //#endregion
2761
+ //#region api/sceneModel/hide.js
2762
+ function Et(e) {
2763
+ let t = [], n = { ...e };
2764
+ return I(t, e.ids, e.tags), {
2765
+ errors: t,
2766
+ normalized: n
2767
+ };
2768
+ }
2769
+ //#endregion
2770
+ //#region api/sceneModel/showOnly.js
2771
+ function Dt(e) {
2772
+ let t = [], n = { ...e };
2773
+ return I(t, e.ids, e.tags), e.isIgnoreMarker !== void 0 && typeof e.isIgnoreMarker != "boolean" ? t.push("[isIgnoreMarker]必须是布尔类型") : e.isIgnoreMarker === void 0 ? n.isIgnoreMarker = !0 : n.isIgnoreMarker = e.isIgnoreMarker, e.isIgnoreSky !== void 0 && typeof e.isIgnoreSky != "boolean" ? t.push("[isIgnoreSky]必须是布尔类型") : e.isIgnoreSky === void 0 ? n.isIgnoreSky = !1 : n.isIgnoreSky = e.isIgnoreSky, {
2774
+ errors: t,
2775
+ normalized: n
2776
+ };
2777
+ }
2778
+ //#endregion
2779
+ //#region api/sceneModel/highLight.js
2780
+ function Ot(e) {
2781
+ let t = [], n = { ...e };
2782
+ return I(t, e.ids, e.tags), n.config ||= {}, t.push(...y({
2783
+ normalized: n.config,
2784
+ field: "color",
2785
+ value: n.config.color,
2786
+ defaultValue: "#003748"
2787
+ })), t.push(...m({
2788
+ normalized: n.config,
2789
+ field: "opacity",
2790
+ value: n.config.opacity,
2791
+ min: 0,
2792
+ max: 1
2793
+ })), t.push(...m({
2794
+ normalized: n.config,
2795
+ field: "minBrightness",
2796
+ value: n.config.minBrightness,
2797
+ min: 0
2798
+ })), t.push(...m({
2799
+ normalized: n.config,
2800
+ field: "maxBrightness",
2801
+ value: n.config.maxBrightness,
2802
+ min: n.config.minBrightness
2803
+ })), t.push(...m({
2804
+ normalized: n.config,
2805
+ field: "frequency",
2806
+ value: n.config.frequency,
2807
+ defaultValue: 2,
2808
+ min: 0
2809
+ })), {
2810
+ errors: t,
2811
+ normalized: n
2812
+ };
2813
+ }
2814
+ //#endregion
2815
+ //#region api/sceneModel/removeHighLight.js
2816
+ function kt(e) {
2817
+ let t = [], n = { ...e };
2818
+ return I(t, e.ids, e.tags), {
2819
+ errors: t,
2820
+ normalized: n
2821
+ };
2822
+ }
2823
+ //#endregion
2824
+ //#region api/sceneModel/setOpacity.js
2825
+ function At(e) {
2826
+ let t = [], n = { ...e };
2827
+ return I(t, e.ids, e.tags), n.config ||= {}, t.push(...m({
2828
+ normalized: n.config,
2829
+ field: "opacity",
2830
+ value: e.config?.opacity,
2831
+ defaultValue: .5,
2832
+ min: 0,
2833
+ max: 1
2834
+ })), t.push(...m({
2835
+ normalized: n.config,
2836
+ field: "selfLuminous",
2837
+ value: e.config?.selfLuminous,
2838
+ defaultValue: 0,
2839
+ min: 0
2840
+ })), t.push(...y({
2841
+ normalized: n.config,
2842
+ field: "color",
2843
+ value: e.config?.color,
2844
+ defaultValue: "#ffffff"
2845
+ })), {
2846
+ errors: t,
2847
+ normalized: n
2848
+ };
2849
+ }
2850
+ //#endregion
2851
+ //#region api/sceneModel/outline.js
2852
+ function jt(e) {
2853
+ let t = [], n = { ...e };
2854
+ return I(t, e.ids, e.tags), n.config ||= {}, t.push(...y({
2855
+ normalized: n.config,
2856
+ field: "color",
2857
+ value: n.config.color,
2858
+ defaultValue: "#1A80CCFF"
2859
+ })), t.push(...m({
2860
+ normalized: n.config,
2861
+ field: "brightness",
2862
+ value: n.config.brightness,
2863
+ defaultValue: 1,
2864
+ min: 0
2865
+ })), t.push(...m({
2866
+ normalized: n.config,
2867
+ field: "width",
2868
+ value: n.config.width,
2869
+ defaultValue: 1,
2870
+ min: 0
2871
+ })), n.config.IsSolidMesh === void 0 ? n.config.IsSolidMesh = !1 : typeof n.config.IsSolidMesh != "boolean" && t.push("[config.IsSolidMesh] 必须是布尔类型"), t.push(...y({
2872
+ normalized: n.config,
2873
+ field: "meshColor",
2874
+ value: n.config.meshColor,
2875
+ defaultValue: "#000305FF"
2876
+ })), t.push(...m({
2877
+ normalized: n.config,
2878
+ field: "meshBrightness",
2879
+ value: n.config.meshBrightness,
2880
+ defaultValue: 1,
2881
+ min: 0
2882
+ })), t.push(...m({
2883
+ normalized: n.config,
2884
+ field: "meshOpacity",
2885
+ value: n.config.meshOpacity,
2886
+ defaultValue: .02,
2887
+ min: 0,
2888
+ max: 1
2889
+ })), {
2890
+ errors: t,
2891
+ normalized: n
2892
+ };
2893
+ }
2894
+ //#endregion
2895
+ //#region api/sceneModel/removeOutline.js
2896
+ function Mt(e) {
2897
+ let t = [], n = { ...e };
2898
+ return I(t, e.ids, e.tags), {
2899
+ errors: t,
2900
+ normalized: n
2901
+ };
2902
+ }
2903
+ //#endregion
2904
+ //#region api/sceneModel/removeAllOutline.js
2905
+ function Nt(e) {
2906
+ return {
2907
+ errors: [],
2908
+ normalized: { ...e }
2909
+ };
2910
+ }
2911
+ //#endregion
2912
+ //#region api/sceneModel/openSlice.js
2913
+ function R(e = {}) {
2914
+ let t = [], n = { ...e };
2915
+ return t.push(...h({
2916
+ normalized: n,
2917
+ field: "id",
2918
+ value: e.id
2919
+ })), t.push(...b({
2920
+ normalized: n,
2921
+ field: "mode",
2922
+ value: e.mode,
2923
+ defaultValue: "None",
2924
+ type: "string",
2925
+ list: bt
2926
+ })), t.push(...y({
2927
+ normalized: n,
2928
+ field: "color",
2929
+ value: e.color,
2930
+ defaultValue: "#FFFFFF00"
2931
+ })), t.push(...g({
2932
+ normalized: n,
2933
+ field: "texturePath",
2934
+ value: e.texturePath,
2935
+ defaultValue: ""
2936
+ })), t.push(...g({
2937
+ normalized: n,
2938
+ field: "materialName",
2939
+ value: e.materialName,
2940
+ defaultValue: ""
2941
+ })), t.push(..._({
2942
+ normalized: n,
2943
+ field: "uvOffset",
2944
+ value: e.uvOffset,
2945
+ length: 2,
2946
+ defaultValue: [0, 0]
2947
+ })), t.push(..._({
2948
+ normalized: n,
2949
+ field: "uvScale",
2950
+ value: e.uvScale,
2951
+ length: 2,
2952
+ defaultValue: [1, 1]
2953
+ })), L(t, n, "isWorldUV", e.isWorldUV, !1), t.push(..._({
2954
+ normalized: n,
2955
+ field: "direction",
2956
+ value: e.direction,
2957
+ length: 3,
2958
+ defaultValue: [
2959
+ 0,
2960
+ 0,
2961
+ -1
2962
+ ]
2963
+ })), L(t, n, "isWorldDirection", e.isWorldDirection, !1), t.push(...m({
2964
+ normalized: n,
2965
+ field: "ratio",
2966
+ value: e.ratio,
2967
+ defaultValue: .5,
2968
+ min: 0,
2969
+ max: 1
2970
+ })), {
2971
+ errors: t,
2972
+ normalized: n
2973
+ };
2974
+ }
2975
+ //#endregion
2976
+ //#region api/sceneModel/closeSlice.js
2977
+ function Pt(e = {}) {
2978
+ let t = [], n = { ...e };
2979
+ return t.push(...h({
2980
+ normalized: n,
2981
+ field: "id",
2982
+ value: e.id
2983
+ })), {
2984
+ errors: t,
2985
+ normalized: n
2986
+ };
2987
+ }
2988
+ //#endregion
2989
+ //#region api/sceneModel/closeAllSlice.js
2990
+ function Ft(e = {}) {
2991
+ return {
2992
+ errors: [],
2993
+ normalized: { ...e }
2994
+ };
2995
+ }
2996
+ //#endregion
2997
+ //#region api/sceneModel/sceneModelApi.js
2998
+ var It = r("sceneModel", {
2999
+ getById: vt,
3000
+ getByTag: yt,
3001
+ setTransform: xt,
3002
+ clearTransform: St,
3003
+ offset: Ct,
3004
+ clearOffset: wt,
3005
+ show: Tt,
3006
+ hide: Et,
3007
+ showOnly: Dt,
3008
+ highLight: Ot,
3009
+ removeHighLight: kt,
3010
+ setOpacity: At,
3011
+ outline: jt,
3012
+ removeOutline: Mt,
3013
+ removeAllOutline: Nt,
3014
+ openSlice: R,
3015
+ closeSlice: Pt,
3016
+ closeAllSlice: Ft
3017
+ });
3018
+ //#endregion
3019
+ //#region api/atmosphericEffects/time.js
3020
+ function Lt(e) {
3021
+ let t = [], n = { ...e };
3022
+ return t.push(...p({
3023
+ normalized: n,
3024
+ field: "hour",
3025
+ value: e.hour,
3026
+ min: 1,
3027
+ max: 24
3028
+ })), {
3029
+ errors: t,
3030
+ normalized: n
3031
+ };
3032
+ }
3033
+ //#endregion
3034
+ //#region api/atmosphericEffects/weather.js
3035
+ function Rt(e) {
3036
+ let t = [], n = { ...e };
3037
+ return !e.type || typeof e.type != "string" ? t.push("[type]为必填项,且必须是字符串类型") : n.type = e.type, {
3038
+ errors: t,
3039
+ normalized: n
3040
+ };
3041
+ }
3042
+ //#endregion
3043
+ //#region api/atmosphericEffects/atmosphericEffectsApi.js
3044
+ var zt = r("atmosphericEffects", {
3045
+ time: Lt,
3046
+ weather: Rt
3047
+ });
3048
+ //#endregion
3049
+ //#region api/tool/onMouseClick.js
3050
+ function Bt(e) {
3051
+ let t = [], n = { ...e };
3052
+ return t.push(...b({
3053
+ normalized: n,
3054
+ field: "pressKey",
3055
+ value: e.pressKey,
3056
+ defaultValue: "LeftMouseButton",
3057
+ type: "string",
3058
+ list: [
3059
+ "LeftMouseButton",
3060
+ "RightMouseButton",
3061
+ "MiddleMouseButton"
3062
+ ]
3063
+ })), n.onMouseClick && typeof n.onMouseClick != "function" && t.push("onMouseClick 参数 onMouseClick 必须为函数"), {
3064
+ errors: t,
3065
+ normalized: n
3066
+ };
3067
+ }
3068
+ //#endregion
3069
+ //#region api/tool/offMouseClick.js
3070
+ function Vt(e) {
3071
+ let t = [], n = { ...e };
3072
+ return t.push(...b({
3073
+ normalized: n,
3074
+ field: "pressKey",
3075
+ value: e.pressKey,
3076
+ defaultValue: "",
3077
+ type: "string",
3078
+ list: [
3079
+ "LeftMouseButton",
3080
+ "RightMouseButton",
3081
+ "MiddleMouseButton"
3082
+ ]
3083
+ })), {
3084
+ errors: t,
3085
+ normalized: n
3086
+ };
3087
+ }
3088
+ //#endregion
3089
+ //#region api/tool/onDistance.js
3090
+ function Ht(e) {
3091
+ return {
3092
+ errors: [],
3093
+ normalized: { ...e }
3094
+ };
3095
+ }
3096
+ //#endregion
3097
+ //#region api/tool/offDistance.js
3098
+ function Ut(e) {
3099
+ return {
3100
+ errors: [],
3101
+ normalized: { ...e }
3102
+ };
3103
+ }
3104
+ //#endregion
3105
+ //#region api/tool/editConfigFile.js
3106
+ function Wt(e) {
3107
+ return {
3108
+ errors: [],
3109
+ normalized: { ...e }
3110
+ };
3111
+ }
3112
+ //#endregion
3113
+ //#region api/tool/toolApi.js
3114
+ var Gt = r("tool", {
3115
+ onMouseClick: Bt,
3116
+ offMouseClick: Vt,
3117
+ onDistance: Ht,
3118
+ offDistance: Ut,
3119
+ editConfigFile: Wt
3120
+ });
3121
+ //#endregion
3122
+ //#region api/line/helpers.js
3123
+ function Kt() {
3124
+ return "line_" + Date.now() + "_" + Math.random().toString(36).substring(2, 9);
3125
+ }
3126
+ //#endregion
3127
+ //#region api/line/addLine.js
3128
+ function qt(e) {
3129
+ let t = [], n = { ...e };
3130
+ if (!e.coordinates || !Array.isArray(e.coordinates)) t.push("[coordinates] 为必填项,且必须是数组类型");
3131
+ else if (e.coordinates.length < 2) t.push("[coordinates] 至少需要2个坐标点才能绘制线条");
3132
+ else {
3133
+ let r = [];
3134
+ e.coordinates.forEach((e, n) => {
3135
+ if (!Array.isArray(e) || e.length < 3) t.push(`[coordinates[${n}]] 坐标点格式错误,应为 [经度, 纬度, 高度]`);
3136
+ else {
3137
+ let [i, a, o] = e, s = [];
3138
+ (typeof i != "number" || i < -180 || i > 180) && s.push(`[coordinates[${n}][0]] 经度取值范围:-180~180`), (typeof a != "number" || a < -90 || a > 90) && s.push(`[coordinates[${n}][1]] 纬度取值范围:-90~90`), typeof o != "number" && s.push(`[coordinates[${n}][2]] 高度必须是数字类型`), s.length === 0 ? r.push([
3139
+ i,
3140
+ a,
3141
+ o
3142
+ ]) : t.push(...s);
3143
+ }
3144
+ }), r.length >= 2 && (n.coordinates = r);
3145
+ }
3146
+ return t.push(...b({
3147
+ normalized: n,
3148
+ field: "type",
3149
+ value: e.type,
3150
+ defaultValue: 0,
3151
+ type: "number",
3152
+ list: [0, 1]
3153
+ })), t.push(...m({
3154
+ normalized: n,
3155
+ field: "width",
3156
+ value: e.width,
3157
+ defaultValue: 1,
3158
+ min: .1
3159
+ })), e.key === void 0 || e.key === null || e.key === "" ? n.key = Kt() : t.push(...g({
3160
+ normalized: n,
3161
+ field: "key",
3162
+ value: e.key
3163
+ })), t.push(...y({
3164
+ normalized: n,
3165
+ field: "color",
3166
+ value: e.color,
3167
+ defaultValue: "#1cfeff"
3168
+ })), t.push(...m({
3169
+ normalized: n,
3170
+ field: "spacing",
3171
+ value: e.spacing,
3172
+ min: 0
3173
+ })), t.push(...b({
3174
+ normalized: n,
3175
+ field: "interpolate",
3176
+ value: e.interpolate,
3177
+ defaultValue: "smooth",
3178
+ type: "string",
3179
+ list: ["smooth", "linear"]
3180
+ })), t.push(...g({
3181
+ normalized: n,
3182
+ field: "startImg",
3183
+ value: e.startImg
3184
+ })), t.push(...g({
3185
+ normalized: n,
3186
+ field: "endImg",
3187
+ value: e.endImg
3188
+ })), t.push(...g({
3189
+ normalized: n,
3190
+ field: "midImg",
3191
+ value: e.midImg
3192
+ })), {
3193
+ errors: t,
3194
+ normalized: n
3195
+ };
3196
+ }
3197
+ //#endregion
3198
+ //#region api/line/clearLine.js
3199
+ function Jt(e) {
3200
+ let t = [], n = { ...e };
3201
+ if (!e.key || !Array.isArray(e.key)) t.push("[key] 为必填项,且必须是数组类型");
3202
+ else if (e.key.length === 0) t.push("[key] 至少需要一个线条标识");
3203
+ else {
3204
+ let r = [];
3205
+ e.key.forEach((e, n) => {
3206
+ typeof e != "string" || e.trim() === "" ? t.push(`[key[${n}]] 必须是非空字符串`) : r.push(e.trim());
3207
+ }), r.length > 0 && (n.key = r);
3208
+ }
3209
+ return {
3210
+ errors: t,
3211
+ normalized: n
3212
+ };
3213
+ }
3214
+ //#endregion
3215
+ //#region api/line/clearAllLine.js
3216
+ function Yt(e) {
3217
+ return {
3218
+ errors: [],
3219
+ normalized: { ...e }
3220
+ };
3221
+ }
3222
+ //#endregion
3223
+ //#region api/line/lineApi.js
3224
+ var Xt = r("line", {
3225
+ addLine: qt,
3226
+ clearLine: Jt,
3227
+ clearAllLine: Yt
3228
+ });
3229
+ //#endregion
3230
+ //#region api/level/switch.js
3231
+ function Zt(e) {
3232
+ let t = [], n = { ...e };
3233
+ return t.push(...h({
3234
+ normalized: n,
3235
+ field: "levelName",
3236
+ value: e.levelName
3237
+ })), {
3238
+ errors: t,
3239
+ normalized: n
3240
+ };
3241
+ }
3242
+ //#endregion
3243
+ //#region api/level/levelApi.js
3244
+ var Qt = r("level", { switch: Zt });
3245
+ //#endregion
3246
+ //#region api/vtk/getInfo.js
3247
+ function $t(e = {}) {
3248
+ let t = [], n = { ...e };
3249
+ return t.push(...h({
3250
+ normalized: n,
3251
+ field: "id",
3252
+ value: e.id
3253
+ })), {
3254
+ errors: t,
3255
+ normalized: n
3256
+ };
3257
+ }
3258
+ //#endregion
3259
+ //#region api/vtk/getFieldRange.js
3260
+ function en(e = {}) {
3261
+ let t = [], n = { ...e };
3262
+ return t.push(...h({
3263
+ normalized: n,
3264
+ field: "id",
3265
+ value: e.id
3266
+ })), t.push(...h({
3267
+ normalized: n,
3268
+ field: "fieldName",
3269
+ value: e.fieldName
3270
+ })), t.push(..._({
3271
+ normalized: n,
3272
+ field: "indexList",
3273
+ value: e.indexList,
3274
+ defaultValue: []
3275
+ })), Array.isArray(n.indexList) && (n.indexList.forEach((e, n) => {
3276
+ Number.isFinite(Number(e)) || t.push(`[indexList[${n}]]必须是数字`);
3277
+ }), n.indexList = n.indexList.map(Number)), {
3278
+ errors: t,
3279
+ normalized: n
3280
+ };
3281
+ }
3282
+ //#endregion
3283
+ //#region api/vtk/helpers.js
3284
+ function z(e, t, n, r, i) {
3285
+ let a = e[t];
3286
+ if (a == null || a === "") {
3287
+ i[t] = n;
3288
+ return;
3289
+ }
3290
+ if (typeof a != "boolean") {
3291
+ r.push(`[${t}]必须是布尔类型`);
3292
+ return;
3293
+ }
3294
+ i[t] = a;
3295
+ }
3296
+ function tn(e) {
3297
+ let t = [];
3298
+ if (!e || !Array.isArray(e)) return t.push("[coordinates] 为必填项,且必须是数组类型"), t;
3299
+ if (e.length < 3) return t.push("[coordinates]包含:[x, y, z]"), t;
3300
+ let [n, r, i] = e;
3301
+ return d(n) || t.push("[coordinates[0]]必须是数字类型"), d(r) || t.push("[coordinates[1]]必须是数字类型"), d(i) || t.push("[coordinates[2]]必须是数字类型"), t;
3302
+ }
3303
+ function nn(e, t, n) {
3304
+ let r = e.coordinates;
3305
+ if (r == null || r === "" || Array.isArray(r) && r.length === 0) {
3306
+ n.coordinates = [];
3307
+ return;
3308
+ }
3309
+ n.isUseUePos ? t.push(...tn(r)) : t.push(...f(r)), Array.isArray(r) && r.length >= 3 && (n.coordinates = r.slice(0, 3).map(Number));
3310
+ }
3311
+ //#endregion
3312
+ //#region api/vtk/create.js
3313
+ function rn(e) {
3314
+ let t = [];
3315
+ if (!e || !Array.isArray(e)) t.push("[coordinates] 为必填项,且必须是数组类型");
3316
+ else if (e.length < 3) t.push("[coordinates]包含:[x, y, z]");
3317
+ else {
3318
+ let [n, r, i] = e;
3319
+ d(n) || t.push("[coordinates[0]]必须是数字类型"), d(r) || t.push("[coordinates[1]]必须是数字类型"), d(i) || t.push("[coordinates[2]]必须是数字类型");
3320
+ }
3321
+ return t;
3322
+ }
3323
+ function an(e = {}) {
3324
+ let t = [], n = { ...e };
3325
+ return t.push(...h({
3326
+ normalized: n,
3327
+ field: "id",
3328
+ value: e.id
3329
+ })), t.push(...h({
3330
+ normalized: n,
3331
+ field: "url",
3332
+ value: e.url
3333
+ })), z(e, "isUseUePos", !1, t, n), n.isUseUePos ? (t.push(...rn(e.coordinates)), Array.isArray(e.coordinates) && e.coordinates.length >= 3 && (n.coordinates = e.coordinates.slice(0, 3).map(Number))) : t.push(...f(e.coordinates)), t.push(...v({
3334
+ normalized: n,
3335
+ field: "rotation",
3336
+ value: e.rotation,
3337
+ defaultValue: [
3338
+ 0,
3339
+ 0,
3340
+ 0
3341
+ ]
3342
+ })), t.push(...v({
3343
+ normalized: n,
3344
+ field: "scale",
3345
+ value: e.scale,
3346
+ defaultValue: [
3347
+ 1,
3348
+ 1,
3349
+ 1
3350
+ ]
3351
+ })), {
3352
+ errors: t,
3353
+ normalized: n
3354
+ };
3355
+ }
3356
+ //#endregion
3357
+ //#region api/vtk/close.js
3358
+ function on(e = {}) {
3359
+ let t = [], n = { ...e };
3360
+ return t.push(...h({
3361
+ normalized: n,
3362
+ field: "id",
3363
+ value: e.id
3364
+ })), {
3365
+ errors: t,
3366
+ normalized: n
3367
+ };
3368
+ }
3369
+ //#endregion
3370
+ //#region api/vtk/allClose.js
3371
+ function sn(e = {}) {
3372
+ return {
3373
+ errors: [],
3374
+ normalized: { ...e }
3375
+ };
3376
+ }
3377
+ //#endregion
3378
+ //#region api/vtk/clearCacheByUrl.js
3379
+ function cn(e = {}) {
3380
+ let t = [], n = { ...e };
3381
+ return t.push(...h({
3382
+ normalized: n,
3383
+ field: "url",
3384
+ value: e.url
3385
+ })), {
3386
+ errors: t,
3387
+ normalized: n
3388
+ };
3389
+ }
3390
+ //#endregion
3391
+ //#region api/vtk/clearAllCache.js
3392
+ function ln(e = {}) {
3393
+ return {
3394
+ errors: [],
3395
+ normalized: { ...e }
3396
+ };
3397
+ }
3398
+ //#endregion
3399
+ //#region api/vtk/setField.js
3400
+ function un(e = {}) {
3401
+ let t = [], n = { ...e };
3402
+ return t.push(...h({
3403
+ normalized: n,
3404
+ field: "id",
3405
+ value: e.id
3406
+ })), t.push(...h({
3407
+ normalized: n,
3408
+ field: "fieldName",
3409
+ value: e.fieldName
3410
+ })), t.push(..._({
3411
+ normalized: n,
3412
+ field: "indexList",
3413
+ value: e.indexList,
3414
+ defaultValue: []
3415
+ })), Array.isArray(n.indexList) && (n.indexList.forEach((e, n) => {
3416
+ Number.isFinite(Number(e)) || t.push(`[indexList[${n}]]必须是数字`);
3417
+ }), n.indexList = n.indexList.map(Number)), {
3418
+ errors: t,
3419
+ normalized: n
3420
+ };
3421
+ }
3422
+ //#endregion
3423
+ //#region api/vtk/setMode.js
3424
+ function dn(e = {}) {
3425
+ let t = [], n = { ...e };
3426
+ return t.push(...h({
3427
+ normalized: n,
3428
+ field: "id",
3429
+ value: e.id
3430
+ })), t.push(...b({
3431
+ normalized: n,
3432
+ field: "mode",
3433
+ value: e.mode,
3434
+ defaultValue: "Heatmap",
3435
+ type: "string",
3436
+ list: [
3437
+ "Heatmap",
3438
+ "Wireframe",
3439
+ "Mixed"
3440
+ ]
3441
+ })), {
3442
+ errors: t,
3443
+ normalized: n
3444
+ };
3445
+ }
3446
+ //#endregion
3447
+ //#region api/vtk/setCellOpacity.js
3448
+ function fn(e = {}) {
3449
+ let t = [], n = { ...e };
3450
+ return t.push(...h({
3451
+ normalized: n,
3452
+ field: "id",
3453
+ value: e.id
3454
+ })), t.push(...h({
3455
+ normalized: n,
3456
+ field: "fieldName",
3457
+ value: e.fieldName
3458
+ })), t.push(..._({
3459
+ normalized: n,
3460
+ field: "cellTypes",
3461
+ value: e.cellTypes,
3462
+ required: !0,
3463
+ minLength: 1
3464
+ })), Array.isArray(n.cellTypes) && (n.cellTypes.forEach((e, n) => {
3465
+ Number.isFinite(Number(e)) || t.push(`[cellTypes[${n}]]必须是数字`);
3466
+ }), n.cellTypes = n.cellTypes.map(Number)), t.push(...m({
3467
+ normalized: n,
3468
+ field: "value",
3469
+ value: e.value,
3470
+ defaultValue: 0,
3471
+ min: 0,
3472
+ max: 1
3473
+ })), {
3474
+ errors: t,
3475
+ normalized: n
3476
+ };
3477
+ }
3478
+ //#endregion
3479
+ //#region api/vtk/setColorRange.js
3480
+ function pn(e = {}) {
3481
+ let t = [], n = { ...e };
3482
+ if (t.push(...h({
3483
+ normalized: n,
3484
+ field: "id",
3485
+ value: e.id
3486
+ })), e.list === void 0 || e.list === null || e.list === "") n.list = [0, 1];
3487
+ else if (!Array.isArray(e.list) || e.list.length < 2) t.push("[list]必须是包含2个元素的数组");
3488
+ else {
3489
+ let r = e.list.slice(0, 2).map(Number);
3490
+ if (!r.every((e) => Number.isFinite(e))) t.push("[list]数组元素必须是数字");
3491
+ else {
3492
+ let e = !0;
3493
+ r[0] < 0 && (t.push("[list[0]]取值不能小于0"), e = !1), r[1] > 1 && (t.push("[list[1]]取值不能大于1"), e = !1), e && (n.list = r);
3494
+ }
3495
+ }
3496
+ return {
3497
+ errors: t,
3498
+ normalized: n
3499
+ };
3500
+ }
3501
+ //#endregion
3502
+ //#region api/vtk/setColorBar.js
3503
+ var mn = {
3504
+ 0: "#0000FFFF",
3505
+ "0.25": "#00FFFFFF",
3506
+ "0.5": "#00FF00FF",
3507
+ "0.75": "#FFFF00FF",
3508
+ 1: "#FF0000FF"
3509
+ };
3510
+ function hn(e = {}) {
3511
+ let t = [], n = { ...e };
3512
+ t.push(...h({
3513
+ normalized: n,
3514
+ field: "id",
3515
+ value: e.id
3516
+ }));
3517
+ let r = e.colorBar;
3518
+ if (r == null || r === "") n.colorBar = { ...mn };
3519
+ else if (typeof r != "object" || Array.isArray(r)) t.push("[colorBar]必须是对象类型");
3520
+ else {
3521
+ let e = Object.keys(r);
3522
+ if (e.length === 0) t.push("[colorBar]不能为空对象");
3523
+ else {
3524
+ let i = {};
3525
+ e.forEach((e) => {
3526
+ let n = Number(e);
3527
+ if (!Number.isFinite(n) || n < 0 || n > 1) {
3528
+ t.push(`[colorBar.${e}]键必须是 0~1 之间的数字`);
3529
+ return;
3530
+ }
3531
+ let o = r[e];
3532
+ if (o == null || o === "") {
3533
+ t.push(`[colorBar.${e}]为必填项`);
3534
+ return;
3535
+ }
3536
+ if (typeof o != "string") {
3537
+ t.push(`[colorBar.${e}]必须是字符串类型`);
3538
+ return;
3539
+ }
3540
+ let s = a(o);
3541
+ if (!s) {
3542
+ t.push(`[colorBar.${e}]颜色格式不正确`);
3543
+ return;
3544
+ }
3545
+ i[e] = s;
3546
+ }), t.length === 0 && (n.colorBar = i);
3547
+ }
3548
+ }
3549
+ return {
3550
+ errors: t,
3551
+ normalized: n
3552
+ };
3553
+ }
3554
+ //#endregion
3555
+ //#region api/vtk/setOpacity.js
3556
+ function gn(e = {}) {
3557
+ let t = [], n = { ...e };
3558
+ return t.push(...h({
3559
+ normalized: n,
3560
+ field: "id",
3561
+ value: e.id
3562
+ })), t.push(...p({
3563
+ normalized: n,
3564
+ field: "value",
3565
+ value: e.value,
3566
+ required: !0,
3567
+ min: 0,
3568
+ max: 1
3569
+ })), {
3570
+ errors: t,
3571
+ normalized: n
3572
+ };
3573
+ }
3574
+ //#endregion
3575
+ //#region api/vtk/setDisplacementScale.js
3576
+ function _n(e = {}) {
3577
+ let t = [], n = { ...e };
3578
+ return t.push(...h({
3579
+ normalized: n,
3580
+ field: "id",
3581
+ value: e.id
3582
+ })), t.push(...h({
3583
+ normalized: n,
3584
+ field: "fieldName",
3585
+ value: e.fieldName
3586
+ })), t.push(...m({
3587
+ normalized: n,
3588
+ field: "scale",
3589
+ value: e.scale,
3590
+ defaultValue: 1,
3591
+ min: 1
3592
+ })), typeof n.scale == "number" && n.scale <= 0 && t.push("[scale]取值必须大于0"), t.push(..._({
3593
+ normalized: n,
3594
+ field: "indexList",
3595
+ value: e.indexList,
3596
+ defaultValue: []
3597
+ })), Array.isArray(n.indexList) && (n.indexList.forEach((e, n) => {
3598
+ Number.isFinite(Number(e)) || t.push(`[indexList[${n}]]必须是数字`);
3599
+ }), n.indexList = n.indexList.map(Number)), {
3600
+ errors: t,
3601
+ normalized: n
3602
+ };
3603
+ }
3604
+ //#endregion
3605
+ //#region api/vtk/closeDisplacementScale.js
3606
+ function vn(e = {}) {
3607
+ let t = [], n = { ...e };
3608
+ return t.push(...h({
3609
+ normalized: n,
3610
+ field: "id",
3611
+ value: e.id
3612
+ })), {
3613
+ errors: t,
3614
+ normalized: n
3615
+ };
3616
+ }
3617
+ //#endregion
3618
+ //#region api/vtk/onMouseClick.js
3619
+ function yn(e = {}) {
3620
+ let t = [], n = { ...e };
3621
+ return t.push(...h({
3622
+ normalized: n,
3623
+ field: "id",
3624
+ value: e.id
3625
+ })), {
3626
+ errors: t,
3627
+ normalized: n
3628
+ };
3629
+ }
3630
+ //#endregion
3631
+ //#region api/vtk/offMouseClick.js
3632
+ function bn(e = {}) {
3633
+ let t = [], n = { ...e };
3634
+ return t.push(...h({
3635
+ normalized: n,
3636
+ field: "id",
3637
+ value: e.id
3638
+ })), {
3639
+ errors: t,
3640
+ normalized: n
3641
+ };
3642
+ }
3643
+ //#endregion
3644
+ //#region api/vtk/playSequence.js
3645
+ function xn(e = {}) {
3646
+ let t = [], n = { ...e };
3647
+ t.push(...h({
3648
+ normalized: n,
3649
+ field: "id",
3650
+ value: e.id
3651
+ })), t.push(...h({
3652
+ normalized: n,
3653
+ field: "fieldName",
3654
+ value: e.fieldName
3655
+ })), t.push(...g({
3656
+ normalized: n,
3657
+ field: "sequenceDirectory",
3658
+ value: e.sequenceDirectory,
3659
+ defaultValue: ""
3660
+ })), t.push(..._({
3661
+ normalized: n,
3662
+ field: "sequenceFiles",
3663
+ value: e.sequenceFiles,
3664
+ defaultValue: []
3665
+ })), Array.isArray(n.sequenceFiles) && (n.sequenceFiles = n.sequenceFiles.map((e) => String(e ?? "").trim()).filter(Boolean));
3666
+ let r = typeof n.sequenceDirectory == "string" && n.sequenceDirectory.trim() !== "", i = Array.isArray(n.sequenceFiles) && n.sequenceFiles.length > 0;
3667
+ return i && r ? t.push("[sequenceFiles]与[sequenceDirectory]二选一,不能同时填写(设置 sequenceDirectory 时 sequenceFiles 必须为空)") : i ? n.sequenceDirectory = "" : r ? (n.sequenceDirectory = n.sequenceDirectory.trim(), n.sequenceFiles = []) : t.push("[sequenceFiles]与[sequenceDirectory]二选一,必须填写其中一个(设置 sequenceDirectory 时 sequenceFiles 必须为空)"), t.push(...m({
3668
+ normalized: n,
3669
+ field: "frameIndex",
3670
+ value: e.frameIndex,
3671
+ defaultValue: 0,
3672
+ min: 0
3673
+ })), t.push(...m({
3674
+ normalized: n,
3675
+ field: "playbackSpeed",
3676
+ value: e.playbackSpeed,
3677
+ defaultValue: 1,
3678
+ min: 0
3679
+ })), typeof n.playbackSpeed == "number" && n.playbackSpeed <= 0 && t.push("[playbackSpeed]取值必须大于0"), z(e, "isUseUePos", !1, t, n), nn(e, t, n), t.push(...v({
3680
+ normalized: n,
3681
+ field: "rotation",
3682
+ value: e.rotation,
3683
+ defaultValue: [
3684
+ 0,
3685
+ 0,
3686
+ 0
3687
+ ]
3688
+ })), t.push(...v({
3689
+ normalized: n,
3690
+ field: "scale",
3691
+ value: e.scale,
3692
+ defaultValue: [
3693
+ 1,
3694
+ 1,
3695
+ 1
3696
+ ]
3697
+ })), {
3698
+ errors: t,
3699
+ normalized: n
3700
+ };
3701
+ }
3702
+ //#endregion
3703
+ //#region api/vtk/pauseSequence.js
3704
+ function Sn(e = {}) {
3705
+ let t = [], n = { ...e };
3706
+ return t.push(...h({
3707
+ normalized: n,
3708
+ field: "id",
3709
+ value: e.id
3710
+ })), {
3711
+ errors: t,
3712
+ normalized: n
3713
+ };
3714
+ }
3715
+ //#endregion
3716
+ //#region api/vtk/stopSequence.js
3717
+ function Cn(e = {}) {
3718
+ let t = [], n = { ...e };
3719
+ return t.push(...h({
3720
+ normalized: n,
3721
+ field: "id",
3722
+ value: e.id
3723
+ })), {
3724
+ errors: t,
3725
+ normalized: n
3726
+ };
3727
+ }
3728
+ //#endregion
3729
+ //#region api/vtk/setFrame.js
3730
+ function wn(e = {}) {
3731
+ let t = [], n = { ...e };
3732
+ return t.push(...h({
3733
+ normalized: n,
3734
+ field: "id",
3735
+ value: e.id
3736
+ })), t.push(...m({
3737
+ normalized: n,
3738
+ field: "frameIndex",
3739
+ value: e.frameIndex,
3740
+ defaultValue: 0,
3741
+ min: 0
3742
+ })), {
3743
+ errors: t,
3744
+ normalized: n
3745
+ };
3746
+ }
3747
+ //#endregion
3748
+ //#region api/vtk/setPlaybackSpeed.js
3749
+ function Tn(e = {}) {
3750
+ let t = [], n = { ...e };
3751
+ return t.push(...h({
3752
+ normalized: n,
3753
+ field: "id",
3754
+ value: e.id
3755
+ })), t.push(...m({
3756
+ normalized: n,
3757
+ field: "playbackSpeed",
3758
+ value: e.playbackSpeed,
3759
+ defaultValue: 4,
3760
+ min: 0
3761
+ })), typeof n.playbackSpeed == "number" && n.playbackSpeed <= 0 && t.push("[playbackSpeed]取值必须大于0"), {
3762
+ errors: t,
3763
+ normalized: n
3764
+ };
3765
+ }
3766
+ //#endregion
3767
+ //#region api/vtk/clearSequence.js
3768
+ function En(e = {}) {
3769
+ let t = [], n = { ...e };
3770
+ return t.push(...h({
3771
+ normalized: n,
3772
+ field: "id",
3773
+ value: e.id
3774
+ })), z(e, "isClearCache", !0, t, n), {
3775
+ errors: t,
3776
+ normalized: n
3777
+ };
3778
+ }
3779
+ //#endregion
3780
+ //#region api/vtk/clearAllSequence.js
3781
+ function Dn(e = {}) {
3782
+ let t = [], n = { ...e };
3783
+ return z(e, "isClearCache", !0, t, n), {
3784
+ errors: t,
3785
+ normalized: n
3786
+ };
3787
+ }
3788
+ //#endregion
3789
+ //#region api/vtk/vtkApi.js
3790
+ var On = r("VTK", {
3791
+ getInfo: $t,
3792
+ getFieldRange: en,
3793
+ create: an,
3794
+ close: on,
3795
+ allClose: sn,
3796
+ clearCacheByUrl: cn,
3797
+ clearAllCache: ln,
3798
+ setField: un,
3799
+ setMode: dn,
3800
+ setCellOpacity: fn,
3801
+ setColorRange: pn,
3802
+ setColorBar: hn,
3803
+ setOpacity: gn,
3804
+ setDisplacementScale: _n,
3805
+ closeDisplacementScale: vn,
3806
+ onMouseClick: yn,
3807
+ offMouseClick: bn,
3808
+ playSequence: xn,
3809
+ pauseSequence: Sn,
3810
+ stopSequence: Cn,
3811
+ setFrame: wn,
3812
+ setPlaybackSpeed: Tn,
3813
+ clearSequence: En,
3814
+ clearAllSequence: Dn
3815
+ }, { getOptions: () => ({ timeout: 0 }) }), B = !0;
3816
+ function kn(e) {
3817
+ B = !!e;
3818
+ }
3819
+ function V(...e) {
3820
+ B && console.log(...e);
3821
+ }
3822
+ function H(...e) {
3823
+ B && console.warn(...e);
3824
+ }
3825
+ function U(...e) {
3826
+ B && console.error(...e);
3827
+ }
3828
+ //#endregion
3829
+ //#region baseConfig/responses.js
3830
+ function W(e) {
3831
+ return (Array.isArray(e) ? e : [e]).map((e) => {
3832
+ if (typeof e == "string") return e;
3833
+ if (e && typeof e == "object") {
3834
+ if (typeof e.message == "string" && e.message) return e.message;
3835
+ try {
3836
+ return JSON.stringify(e);
3837
+ } catch {
3838
+ return String(e);
3839
+ }
3840
+ }
3841
+ return e == null ? "" : String(e);
3842
+ }).filter((e) => e !== "");
3843
+ }
3844
+ function An(e, t, n) {
3845
+ return {
3846
+ success: !0,
3847
+ message: e,
3848
+ data: t,
3849
+ command: n
3850
+ };
3851
+ }
3852
+ function G(e, t, n) {
3853
+ let r = {
3854
+ success: !1,
3855
+ message: W(e),
3856
+ params: t,
3857
+ command: n
3858
+ };
3859
+ return U("三维场景报错:", r), r;
3860
+ }
3861
+ function K(e, t, n) {
3862
+ let r = {
3863
+ success: !1,
3864
+ message: W(e),
3865
+ params: t,
3866
+ command: n
3867
+ };
3868
+ return H("三维场景警告:", r), r;
3869
+ }
3870
+ //#endregion
3871
+ //#region api/other/otherApi.js
3872
+ var jn = class {
3873
+ constructor(e) {
3874
+ this.commandManager = e;
3875
+ }
3876
+ _handleSend(e, t = {}, n = {}) {
3877
+ return !e || typeof e != "string" ? G("命令不能为空", t, e || "unknown") : (V("自定义域命令下发:", e), this.commandManager.sendWithDefault({
3878
+ errors: [],
3879
+ normalized: t
3880
+ }, e, n));
3881
+ }
3882
+ }, q = {
3883
+ camera: ue,
3884
+ cesium: Se,
3885
+ marker: qe,
3886
+ floodPeak: nt,
3887
+ animation: ut,
3888
+ hydrodynamicForce: _t,
3889
+ sceneModel: It,
3890
+ atmosphericEffects: zt,
3891
+ tool: Gt,
3892
+ line: Xt,
3893
+ level: Qt,
3894
+ VTK: On
3895
+ }, Mn = [
3896
+ "oneDimensionalHydrodynamics",
3897
+ "customDomain",
3898
+ "arrow",
3899
+ "NC",
3900
+ "gateOperation"
3901
+ ], J = class {
3902
+ constructor(e) {
3903
+ this._apis = {};
3904
+ for (let [t, n] of Object.entries(q)) this._apis[t] = new n(e);
3905
+ this._otherApi = new jn(e);
3906
+ for (let e of Object.keys(q)) this[e] = (t, n) => this._apis[e]._handleSend(t, n);
3907
+ for (let e of Mn) this[e] = (t, n, r) => this._otherApi._handleSend(`${e}.${t}`, n, r);
3908
+ }
3909
+ };
3910
+ //#endregion
3911
+ //#region commFlow.js
3912
+ function Y() {
3913
+ return {
3914
+ Hovered: {},
3915
+ Click: {},
3916
+ DoubleClick: {},
3917
+ Unhovered: {}
3918
+ };
3919
+ }
3920
+ function X(e, t) {
3921
+ typeof t == "function" && (e.includes(t) || e.push(t));
3922
+ }
3923
+ function Z(e) {
3924
+ return {
3925
+ prepare(t, n) {
3926
+ return t._registerMarkerCallbacks(t[e], n);
3927
+ },
3928
+ dispatch(t, n, r) {
3929
+ return t._dispatchMarkerEvent(t[e], n, r);
3930
+ }
3931
+ };
3932
+ }
3933
+ var Q = {
3934
+ "marker.iconMarker": Z("markerEventCallbacks"),
3935
+ "marker.iconUrlMarker": Z("markerEventCallbacks"),
3936
+ "marker.secondMarker": Z("secondMarkerEventCallbacks"),
3937
+ "marker.followMarker": Z("followMarkerEventCallbacks"),
3938
+ "tool.onMouseClick": {
3939
+ prepare(e, t) {
3940
+ let { onMouseClick: n, ...r } = t || {};
3941
+ return X(e.mouseClickCallback.MouseClick, n), r;
3942
+ },
3943
+ dispatch(e, t, n) {
3944
+ return n.coordinates ? e._executeCallbacks(e.mouseClickCallback.MouseClick, t, n) : !1;
3945
+ }
3946
+ },
3947
+ "tool.offMouseClick": { prepare(e, t) {
3948
+ return e.mouseClickCallback.MouseClick = [], t;
3949
+ } },
3950
+ "VTK.onMouseClick": {
3951
+ prepare(e, t) {
3952
+ let { onMouseClick: n, ...r } = t || {}, i = r?.id;
3953
+ return i != null && i !== "" && typeof n == "function" && (e.vtkMouseClickCallback[i] = n), r;
3954
+ },
3955
+ dispatch(e, t, n) {
3956
+ let r = e.vtkMouseClickCallback;
3957
+ if (!r || !Object.keys(r).length) return !1;
3958
+ let i = n?.id, a = i ? r[i] : null;
3959
+ return a ? e._executeCallback(a, t, n) : e._executeCallbacks(Object.values(r), t, n);
3960
+ }
3961
+ },
3962
+ "VTK.offMouseClick": { prepare(e, t) {
3963
+ let n = t?.id;
3964
+ return n != null && n !== "" && delete e.vtkMouseClickCallback[n], t;
3965
+ } },
3966
+ "animation.onData": {
3967
+ prepare(e, t) {
3968
+ let { onChange: n, ...r } = t || {};
3969
+ return X(e.animationOnDataCallback.Change, n), r;
3970
+ },
3971
+ dispatch(e, t, n) {
3972
+ return n.type ? e._executeCallbacks(e.animationOnDataCallback.Change, t, n) : !1;
3973
+ }
3974
+ }
3975
+ }, $ = class {
3976
+ constructor(e, t = {}) {
3977
+ this.transport = e, this.callbacks = {}, this.requestId = 0, this.timeout = t.timeout ?? 3e3, this._destroyed = !1, this._resetEventCallbacks(), e.bindMessageHandler((e) => {
3978
+ this._handleRawResponse(e);
3979
+ });
3980
+ }
3981
+ _resetEventCallbacks() {
3982
+ this.markerEventCallbacks = Y(), this.secondMarkerEventCallbacks = Y(), this.followMarkerEventCallbacks = Y(), this.animationOnDataCallback = { Change: [] }, this.mouseClickCallback = { MouseClick: [] }, this.vtkMouseClickCallback = {};
3983
+ }
3984
+ destroy() {
3985
+ if (!this._destroyed) {
3986
+ this._destroyed = !0;
3987
+ for (let e of Object.keys(this.callbacks)) {
3988
+ let t = this.callbacks[e];
3989
+ t?.timeoutId && clearTimeout(t.timeoutId), t?.reject?.(/* @__PURE__ */ Error("CommandManager destroyed"));
3990
+ }
3991
+ this.callbacks = {}, this._resetEventCallbacks(), this.transport = null;
3992
+ }
3993
+ }
3994
+ sendWithDefault(e, t, n = {}) {
3995
+ let r = this._sendPreparePayload(t, e.normalized || {});
3996
+ if (e.errors.length > 0) return G(e.errors, r, t);
3997
+ if (this._destroyed || !this.transport) return G("连接已关闭,无法发送命令", r, t);
3998
+ let i = (++this.requestId).toString(), a = n?.timeout === 0 ? 0 : n?.timeout ?? this.timeout, o = new Promise((e, t) => {
3999
+ let n = null;
4000
+ a !== 0 && (n = setTimeout(() => {
4001
+ delete this.callbacks[i], t(/* @__PURE__ */ Error("Command timeout with no results"));
4002
+ }, a)), this.callbacks[i] = {
4003
+ resolve: e,
4004
+ reject: t,
4005
+ timeoutId: n
4006
+ };
4007
+ }), s = {
4008
+ command: t,
4009
+ requestId: i,
4010
+ params: r
4011
+ };
4012
+ return V("消息下发成功:", s), this.transport.sendTextToDataChannel(JSON.stringify(s)), o.then((e) => {
4013
+ if (e && e.command && e.command === t) switch (e.status) {
4014
+ case "info": return An("操作执行成功", e.data, t);
4015
+ case "warn": return K(e.message, e.data, t);
4016
+ default: return G(e.message, e.data, t);
4017
+ }
4018
+ return G("返回数据格式错乱【请注意command参数】", e?.command, t);
4019
+ }).catch((e) => e && e.message ? e.message === "Command timeout with no results" ? K(e.message, r, t) : G(e.message, r, t) : G("数据返回发生错误", r, t));
4020
+ }
4021
+ _handleRawResponse(e) {
4022
+ if (this._destroyed) return null;
4023
+ if (!e) return U("数据第一步解析失败:", e), null;
4024
+ let t;
4025
+ try {
4026
+ let n = JSON.parse(String(e).trim());
4027
+ if (t = {
4028
+ command: n.command || "",
4029
+ message: n.message || "",
4030
+ data: n.data || {},
4031
+ status: n.status || "error",
4032
+ requestId: n.requestId || ""
4033
+ }, t.message === "The data channel has been connected." || t.message === "The level has been initialized") return null;
4034
+ } catch {
4035
+ return U("数据第二步解析失败:", e), null;
4036
+ }
4037
+ if (this._processEventResponse(t)) return;
4038
+ let { command: n, message: r, data: i, status: a, requestId: o } = t;
4039
+ if (o && this.callbacks[o]) {
4040
+ let { resolve: e, timeoutId: t } = this.callbacks[o];
4041
+ clearTimeout(t), delete this.callbacks[o], e({
4042
+ command: n,
4043
+ message: r,
4044
+ data: i,
4045
+ status: a
4046
+ });
4047
+ return;
4048
+ }
4049
+ H("注意:非常规响应", t);
4050
+ }
4051
+ _registerMarkerCallbacks(e, t) {
4052
+ let { onMarkerClick: n, onMarkerDoubleClick: r, onMarkerDblClick: i, onMouseHover: a, onMouseLeave: o, ...s } = t || {}, c = r || i, l = s?.id, u = l != null && l !== "" ? l : "__default";
4053
+ return typeof a == "function" && (e.Hovered[u] = a), typeof n == "function" && (e.Click[u] = n), typeof c == "function" && (e.DoubleClick[u] = c), typeof o == "function" && (e.Unhovered[u] = o), s;
4054
+ }
4055
+ _dispatchMarkerEvent(e, t, n) {
4056
+ if (typeof n.recordData == "string") try {
4057
+ n.recordData = JSON.parse(n.recordData);
4058
+ } catch {}
4059
+ let { pointId: r, eventType: i } = n;
4060
+ if (!(i && e)) return !1;
4061
+ let a = e[i], o = a?.[r] || a?.__default;
4062
+ return this._executeCallback(o, t, n);
4063
+ }
4064
+ _sendPreparePayload(e, t) {
4065
+ let n = Q[e];
4066
+ return n?.prepare ? n.prepare(this, t) : t;
4067
+ }
4068
+ _processEventResponse(e) {
4069
+ if (!e) return !1;
4070
+ let { command: t, data: n = {} } = e, r = Q[t];
4071
+ return r?.dispatch ? r.dispatch(this, t, n) : !1;
4072
+ }
4073
+ _executeCallback(e, t, n) {
4074
+ if (typeof e != "function") return V(`${t}未监听:${n.eventType}`), !0;
4075
+ try {
4076
+ return e(n), !0;
4077
+ } catch (e) {
4078
+ return U(`执行${t}回调出错:`, e, n), !0;
4079
+ }
4080
+ }
4081
+ _executeCallbacks(e, t, n) {
4082
+ return e ? Array.isArray(e) ? (e.forEach((e) => this._executeCallback(e, t, n)), !0) : this._executeCallback(e, t, n) : !1;
4083
+ }
4084
+ };
4085
+ function Nn(e) {
4086
+ if (!e) return "";
4087
+ try {
4088
+ return JSON.parse(String(e).trim())?.message || "";
4089
+ } catch {
4090
+ return "";
4091
+ }
4092
+ }
4093
+ function Pn(t = {}) {
4094
+ let { sendText: n, commandTimeout: r = 3e3, onSceneInit: i } = t;
4095
+ if (typeof n != "function") throw Error("createGameSession: sendText 必须是函数");
4096
+ let a = null, o = !1, s = new $({
4097
+ sendTextToDataChannel(e) {
4098
+ n(e);
4099
+ },
4100
+ bindMessageHandler(e) {
4101
+ a = e;
4102
+ }
4103
+ }, { timeout: r }), c = new J(s);
4104
+ function l(e, t) {
4105
+ e && a && a(e), !o && Nn(e) === "The level has been initialized" && (o = !0, i ? i(t === void 0 ? e : t) : V("场景初始化加载成功", t === void 0 ? e : t));
4106
+ }
4107
+ return V(`插件初始化成功 [web3dlink@${e}]`), {
4108
+ gameAPI: c,
4109
+ commandManager: s,
4110
+ handleIncoming: l,
4111
+ destroy() {
4112
+ s.destroy();
4113
+ }
4114
+ };
4115
+ }
4116
+ function Fn(e, t, n) {
4117
+ if (!(!e || !n)) {
4118
+ if (typeof e.off == "function") {
4119
+ e.off(t, n);
4120
+ return;
4121
+ }
4122
+ typeof e.removeListener == "function" && e.removeListener(t, n);
4123
+ }
4124
+ }
4125
+ function In(e = []) {
4126
+ for (let { target: t, event: n, handler: r } of e) Fn(t, n, r);
4127
+ }
4128
+ //#endregion
4129
+ export { V as a, e as c, J as i, In as n, U as o, $ as r, kn as s, Pn as t };
4130
+
4131
+ //# sourceMappingURL=createGameSession-DkD790Ci.js.map