web3dlink 2.1.18 → 2.1.20

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.
@@ -1,34 +1,30 @@
1
1
  //#endregion
2
- //#region version.js
2
+ //#region baseConfig/version.js
3
3
  var e = {
4
4
  name: "web3dlink",
5
- version: "2.1.18",
5
+ version: "2.1.20",
6
6
  description: "LarkSR / ZS 推流 GameAPI SDK",
7
+ releaseNotes: { "2.1.20": ["更新 zs-stream-parent(配合推流平台修复 streamId 重复,二次打开视频流导致首次页面流关闭的问题)"] },
7
8
  type: "module",
8
9
  main: "./dist/web3dlink.js",
9
10
  module: "./dist/web3dlink.js",
10
- types: "./dist/web3dlink.d.ts",
11
11
  exports: {
12
12
  ".": {
13
- types: "./dist/web3dlink.d.ts",
14
13
  import: "./dist/web3dlink.js",
15
14
  default: "./dist/web3dlink.js"
16
15
  },
17
16
  "./larksr": {
18
- types: "./dist/web3dlink.d.ts",
19
17
  import: "./dist/web3dlink-larksr.js",
20
18
  default: "./dist/web3dlink-larksr.js"
21
19
  },
22
20
  "./zs": {
23
- types: "./dist/web3dlink.d.ts",
24
21
  import: "./dist/web3dlink-zs.js",
25
22
  default: "./dist/web3dlink-zs.js"
26
23
  }
27
24
  },
28
25
  files: ["dist"],
29
26
  scripts: {
30
- build: "node ./scripts/build.mjs",
31
- "sync:dts": "node ./scripts/sync-dts.mjs",
27
+ build: "vite build",
32
28
  prepublishOnly: "npm run build"
33
29
  },
34
30
  keywords: [
@@ -40,12 +36,13 @@ var e = {
40
36
  ],
41
37
  license: "MIT",
42
38
  dependencies: { larksr_websdk: "^3.3.119" },
39
+ devDependencies: { vite: "^8.0.12" },
43
40
  sideEffects: [
44
41
  "./dist/web3dlink.js",
45
42
  "./dist/web3dlink-larksr.js",
46
43
  "./dist/web3dlink-zs.js",
47
- "./zs-stream-parent.js",
48
- "./version.js"
44
+ "./stream/zs-stream-parent.js",
45
+ "./baseConfig/version.js"
49
46
  ]
50
47
  }.version, t = "background: #22c55e; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 600;";
51
48
  function n() {
@@ -249,7 +246,7 @@ function c(e) {
249
246
  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
247
  }
251
248
  //#endregion
252
- //#region baseConfig/validateHelpers.js
249
+ //#region baseConfig/validators.js
253
250
  function l(e, t, n) {
254
251
  if (!e || typeof e != "object") return;
255
252
  let r = t.split("."), i = r.pop(), a = e;
@@ -260,8 +257,6 @@ function u(e, t) {
260
257
  let { normalized: n, field: r, assign: i } = e || {};
261
258
  n && r ? r.includes(".") ? l(n, r, t) : n[r] = t : typeof i == "function" && i(t);
262
259
  }
263
- //#endregion
264
- //#region baseConfig/validators.js
265
260
  function d(e, t = null, n = null) {
266
261
  return !(e == null || typeof e != "number" || isNaN(e) || t !== null && e < t || n !== null && e > n);
267
262
  }
@@ -292,7 +287,7 @@ function p(...e) {
292
287
  normalized: o
293
288
  };
294
289
  }
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) => {
290
+ 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
291
  u({
297
292
  normalized: c,
298
293
  field: p,
@@ -321,7 +316,7 @@ function m(...e) {
321
316
  max: a
322
317
  };
323
318
  }
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) => {
319
+ 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
320
  u({
326
321
  normalized: s,
327
322
  field: f,
@@ -347,7 +342,7 @@ function h(...e) {
347
342
  value: r
348
343
  };
349
344
  }
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) => {
345
+ 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
346
  u({
352
347
  normalized: a,
353
348
  field: c,
@@ -366,7 +361,7 @@ function g(...e) {
366
361
  value: r
367
362
  };
368
363
  }
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) => {
364
+ 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
365
  u({
371
366
  normalized: a,
372
367
  field: c,
@@ -419,7 +414,7 @@ function v(...e) {
419
414
  0,
420
415
  0,
421
416
  0
422
- ], assign: s } = t, c = n || r || "field", l = r || c, d = [], f = !(i == null || i === ""), p = (e) => {
417
+ ], assign: s } = t, c = n || r || "field", l = r || c, d = [], f = i != null && i !== "", p = (e) => {
423
418
  let t = [...e];
424
419
  u({
425
420
  normalized: a,
@@ -444,7 +439,7 @@ function y(...e) {
444
439
  ...i
445
440
  };
446
441
  }
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) => {
442
+ 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
443
  u({
449
444
  normalized: s,
450
445
  field: d,
@@ -674,7 +669,7 @@ function x(e, t, n, r, i) {
674
669
  //#endregion
675
670
  //#region api/camera/aroundMode.js
676
671
  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 === "");
672
+ 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
673
  return r && i ? t.push("[id]与[coordinates]只能二选一,不能同时提供") : !r && !i ? t.push("[id]与[coordinates]必须二选一,至少提供一个") : r ? (t.push(...h({
679
674
  normalized: n,
680
675
  field: "id",
@@ -1337,10 +1332,10 @@ function Te(e, t) {
1337
1332
  field: "dataTexts",
1338
1333
  value: e.dataTexts,
1339
1334
  defaultValue: []
1340
- })), Array.isArray(e.dataTexts) ? e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1335
+ })), e.dataTexts = Array.isArray(e.dataTexts) ? e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1341
1336
  key: e.key ?? "",
1342
1337
  value: e.value ?? ""
1343
- })) : e.dataTexts = [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1338
+ })) : [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1344
1339
  }
1345
1340
  function Ee(e, t) {
1346
1341
  t.push(..._({
@@ -1369,10 +1364,10 @@ function Ee(e, t) {
1369
1364
  field: "dataTexts",
1370
1365
  value: e.dataTexts,
1371
1366
  defaultValue: []
1372
- })), Array.isArray(e.dataTexts) ? e.dataTexts = e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1367
+ })), e.dataTexts = Array.isArray(e.dataTexts) ? e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1373
1368
  key: e.key ?? "",
1374
1369
  value: e.value ?? ""
1375
- })) : e.dataTexts = [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1370
+ })) : [], O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t);
1376
1371
  }
1377
1372
  function De(e, t) {
1378
1373
  t.push(...m({
@@ -1660,10 +1655,10 @@ function Ne(e, t) {
1660
1655
  field: "detailBtnText",
1661
1656
  value: e.detailBtnText,
1662
1657
  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) => ({
1658
+ })), O(e, "textStyle", t), O(e, "titleStyle", t), O(e, "detailStyle", t), O(e, "dataKeyStyle", t), O(e, "dataValueStyle", t), e.dataTexts = Array.isArray(e.dataTexts) ? e.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1664
1659
  key: e.key ?? "",
1665
1660
  value: e.value ?? ""
1666
- })) : e.dataTexts = [];
1661
+ })) : [];
1667
1662
  }
1668
1663
  var Pe = [0, 2147483647];
1669
1664
  function j(e, t, n, r = "visibleRange") {
@@ -1712,7 +1707,7 @@ var M = [
1712
1707
  //#region api/marker/iconMarker.js
1713
1708
  function Fe(e) {
1714
1709
  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({
1710
+ if (n.id = e.id === void 0 || e.id === null || e.id === "" ? E() : e.id, t.push(...f(e.coordinates)), t.push(...g({
1716
1711
  normalized: n,
1717
1712
  field: "groupId",
1718
1713
  value: e.groupId
@@ -1748,7 +1743,7 @@ function Fe(e) {
1748
1743
  //#region api/marker/followMarker.js
1749
1744
  function Ie(e) {
1750
1745
  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({
1746
+ if (n.id = e.id === void 0 || e.id === null || e.id === "" ? E() : e.id, t.push(...h({
1752
1747
  normalized: n,
1753
1748
  field: "modelId",
1754
1749
  value: e.modelId
@@ -1939,7 +1934,7 @@ function Ge(e) {
1939
1934
  //#region api/marker/secondMarker.js
1940
1935
  function Ke(e) {
1941
1936
  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({
1937
+ n.id = e.id === void 0 || e.id === null || e.id === "" ? E() : e.id, t.push(...f(e.coordinates)), t.push(...g({
1943
1938
  normalized: n,
1944
1939
  field: "groupId",
1945
1940
  value: e.groupId
@@ -1980,10 +1975,10 @@ function Ke(e) {
1980
1975
  field: "title",
1981
1976
  value: r.title,
1982
1977
  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) => ({
1978
+ })), n.markerType === "popupCustom1" ? Ne(r, t) : (O(r, "titleStyle", t), O(r, "dataKeyStyle", t), O(r, "dataValueStyle", t), r.dataTexts = Array.isArray(r.dataTexts) ? r.dataTexts.filter((e) => e && typeof e == "object").map((e) => ({
1984
1979
  key: e.key ?? "",
1985
1980
  value: e.value ?? ""
1986
- })) : r.dataTexts = []), e.recordData !== void 0) {
1981
+ })) : []), e.recordData !== void 0) {
1987
1982
  let r = e.recordData;
1988
1983
  if (typeof r != "object" || !r || Array.isArray(r)) t.push("[recordData] 必须是对象类型");
1989
1984
  else try {
@@ -2609,7 +2604,7 @@ function yt(e) {
2609
2604
  }
2610
2605
  //#endregion
2611
2606
  //#region api/sceneModel/helpers.js
2612
- var N = (e) => !(e == null || e === "");
2607
+ var N = (e) => e != null && e !== "";
2613
2608
  function P(e, { id: t, tag: n }) {
2614
2609
  let r = N(t), i = N(n);
2615
2610
  if (!r && !i) {
@@ -2658,7 +2653,7 @@ function F(e, t, n) {
2658
2653
  }
2659
2654
  }
2660
2655
  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);
2656
+ let r = (t, n) => N(n) ? Array.isArray(n) ? n.length !== 0 || (e.push(`[${t}]不能为空数组`), !1) : (e.push(`[${t}]必须是数组类型`), !1) : !1, i = r("ids", t), a = r("tags", n);
2662
2657
  !i && !a ? e.push("[ids]和[tags]必须提供其中一个") : i && a && e.push("[ids]和[tags]不能同时提供");
2663
2658
  }
2664
2659
  var bt = [
@@ -2770,7 +2765,7 @@ function Et(e) {
2770
2765
  //#region api/sceneModel/showOnly.js
2771
2766
  function Dt(e) {
2772
2767
  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, {
2768
+ return I(t, e.ids, e.tags), e.isIgnoreMarker !== void 0 && typeof e.isIgnoreMarker != "boolean" ? t.push("[isIgnoreMarker]必须是布尔类型") : n.isIgnoreMarker = e.isIgnoreMarker === void 0 || e.isIgnoreMarker, e.isIgnoreSky !== void 0 && typeof e.isIgnoreSky != "boolean" ? t.push("[isIgnoreSky]必须是布尔类型") : n.isIgnoreSky = e.isIgnoreSky !== void 0 && e.isIgnoreSky, {
2774
2769
  errors: t,
2775
2770
  normalized: n
2776
2771
  };
@@ -2910,7 +2905,7 @@ function Nt(e) {
2910
2905
  }
2911
2906
  //#endregion
2912
2907
  //#region api/sceneModel/openSlice.js
2913
- function R(e = {}) {
2908
+ function Pt(e = {}) {
2914
2909
  let t = [], n = { ...e };
2915
2910
  return t.push(...h({
2916
2911
  normalized: n,
@@ -2974,7 +2969,7 @@ function R(e = {}) {
2974
2969
  }
2975
2970
  //#endregion
2976
2971
  //#region api/sceneModel/closeSlice.js
2977
- function Pt(e = {}) {
2972
+ function Ft(e = {}) {
2978
2973
  let t = [], n = { ...e };
2979
2974
  return t.push(...h({
2980
2975
  normalized: n,
@@ -2987,7 +2982,7 @@ function Pt(e = {}) {
2987
2982
  }
2988
2983
  //#endregion
2989
2984
  //#region api/sceneModel/closeAllSlice.js
2990
- function Ft(e = {}) {
2985
+ function It(e = {}) {
2991
2986
  return {
2992
2987
  errors: [],
2993
2988
  normalized: { ...e }
@@ -2995,7 +2990,7 @@ function Ft(e = {}) {
2995
2990
  }
2996
2991
  //#endregion
2997
2992
  //#region api/sceneModel/sceneModelApi.js
2998
- var It = r("sceneModel", {
2993
+ var Lt = r("sceneModel", {
2999
2994
  getById: vt,
3000
2995
  getByTag: yt,
3001
2996
  setTransform: xt,
@@ -3011,13 +3006,13 @@ var It = r("sceneModel", {
3011
3006
  outline: jt,
3012
3007
  removeOutline: Mt,
3013
3008
  removeAllOutline: Nt,
3014
- openSlice: R,
3015
- closeSlice: Pt,
3016
- closeAllSlice: Ft
3009
+ openSlice: Pt,
3010
+ closeSlice: Ft,
3011
+ closeAllSlice: It
3017
3012
  });
3018
3013
  //#endregion
3019
3014
  //#region api/atmosphericEffects/time.js
3020
- function Lt(e) {
3015
+ function Rt(e) {
3021
3016
  let t = [], n = { ...e };
3022
3017
  return t.push(...p({
3023
3018
  normalized: n,
@@ -3032,7 +3027,7 @@ function Lt(e) {
3032
3027
  }
3033
3028
  //#endregion
3034
3029
  //#region api/atmosphericEffects/weather.js
3035
- function Rt(e) {
3030
+ function R(e) {
3036
3031
  let t = [], n = { ...e };
3037
3032
  return !e.type || typeof e.type != "string" ? t.push("[type]为必填项,且必须是字符串类型") : n.type = e.type, {
3038
3033
  errors: t,
@@ -3042,8 +3037,8 @@ function Rt(e) {
3042
3037
  //#endregion
3043
3038
  //#region api/atmosphericEffects/atmosphericEffectsApi.js
3044
3039
  var zt = r("atmosphericEffects", {
3045
- time: Lt,
3046
- weather: Rt
3040
+ time: Rt,
3041
+ weather: R
3047
3042
  });
3048
3043
  //#endregion
3049
3044
  //#region api/tool/onMouseClick.js
@@ -3812,22 +3807,254 @@ var On = r("VTK", {
3812
3807
  setPlaybackSpeed: Tn,
3813
3808
  clearSequence: En,
3814
3809
  clearAllSequence: Dn
3815
- }, { getOptions: () => ({ timeout: 0 }) }), B = !0;
3816
- function kn(e) {
3817
- B = !!e;
3810
+ }, { getOptions: () => ({ timeout: 0 }) });
3811
+ //#endregion
3812
+ //#region api/videoFusion/open.js
3813
+ function kn(e, t) {
3814
+ if (t === "Geographic") return f(e);
3815
+ let n = [];
3816
+ if (!e || !Array.isArray(e)) n.push("[coordinates] 为必填项,且必须是数组类型");
3817
+ else if (e.length < 3) n.push("[coordinates]包含:[x, y, z]");
3818
+ else {
3819
+ let [t, r, i] = e;
3820
+ d(t) || n.push("[coordinates[0]]必须是数字类型"), d(r) || n.push("[coordinates[1]]必须是数字类型"), d(i) || n.push("[coordinates[2]]必须是数字类型");
3821
+ }
3822
+ return n;
3823
+ }
3824
+ function An(e = {}) {
3825
+ let t = { ...e }, n = [];
3826
+ return e.instanceId !== void 0 && e.instanceId !== null && e.instanceId !== "" ? typeof e.instanceId == "string" ? t.instanceId = e.instanceId : n.push("[instanceId]必须是字符串类型") : delete t.instanceId, n.push(...b({
3827
+ normalized: t,
3828
+ field: "poseMode",
3829
+ value: e.poseMode,
3830
+ defaultValue: "Geographic",
3831
+ type: "string",
3832
+ list: ["UnrealWorld", "Geographic"]
3833
+ })), n.push(...kn(e.coordinates, t.poseMode)), n.push(...h({
3834
+ normalized: t,
3835
+ field: "url",
3836
+ value: e.url
3837
+ })), n.push(...p({
3838
+ normalized: t,
3839
+ field: "horizontalFov",
3840
+ value: e.horizontalFov,
3841
+ required: !0
3842
+ })), n.push(...p({
3843
+ normalized: t,
3844
+ field: "verticalFov",
3845
+ value: e.verticalFov,
3846
+ required: !0
3847
+ })), n.push(...p({
3848
+ normalized: t,
3849
+ field: "yaw",
3850
+ value: e.yaw,
3851
+ required: !0
3852
+ })), n.push(...p({
3853
+ normalized: t,
3854
+ field: "pitch",
3855
+ value: e.pitch,
3856
+ required: !0
3857
+ })), n.push(...p({
3858
+ normalized: t,
3859
+ field: "roll",
3860
+ value: e.roll,
3861
+ required: !0
3862
+ })), n.push(...m({
3863
+ normalized: t,
3864
+ field: "distanceMeters",
3865
+ value: e.distanceMeters,
3866
+ min: 0
3867
+ })), n.push(...m({
3868
+ normalized: t,
3869
+ field: "opacity",
3870
+ value: e.opacity,
3871
+ defaultValue: 1,
3872
+ min: 0,
3873
+ max: 1
3874
+ })), n.push(...m({
3875
+ normalized: t,
3876
+ field: "edgeFade",
3877
+ value: e.edgeFade,
3878
+ defaultValue: .1,
3879
+ min: 0,
3880
+ max: 1
3881
+ })), x(t, "bFlipX", e.bFlipX, n, !1), x(t, "bFlipY", e.bFlipY, n, !0), n.push(...m({
3882
+ normalized: t,
3883
+ field: "distortion",
3884
+ value: e.distortion,
3885
+ defaultValue: 0
3886
+ })), n.push(...m({
3887
+ normalized: t,
3888
+ field: "distortionCenterU",
3889
+ value: e.distortionCenterU,
3890
+ defaultValue: .5,
3891
+ min: 0,
3892
+ max: 1
3893
+ })), n.push(...m({
3894
+ normalized: t,
3895
+ field: "distortionCenterV",
3896
+ value: e.distortionCenterV,
3897
+ defaultValue: .5,
3898
+ min: 0,
3899
+ max: 1
3900
+ })), {
3901
+ errors: n,
3902
+ normalized: t
3903
+ };
3904
+ }
3905
+ //#endregion
3906
+ //#region api/videoFusion/close.js
3907
+ function jn(e = {}) {
3908
+ let t = { ...e };
3909
+ return {
3910
+ errors: [...h({
3911
+ normalized: t,
3912
+ field: "instanceId",
3913
+ value: e.instanceId
3914
+ })],
3915
+ normalized: t
3916
+ };
3917
+ }
3918
+ //#endregion
3919
+ //#region api/videoFusion/closeAll.js
3920
+ function Mn(e = {}) {
3921
+ return {
3922
+ errors: [],
3923
+ normalized: { ...e }
3924
+ };
3925
+ }
3926
+ //#endregion
3927
+ //#region api/videoFusion/pause.js
3928
+ function Nn(e = {}) {
3929
+ let t = { ...e };
3930
+ return {
3931
+ errors: [...h({
3932
+ normalized: t,
3933
+ field: "instanceId",
3934
+ value: e.instanceId
3935
+ })],
3936
+ normalized: t
3937
+ };
3818
3938
  }
3819
- function V(...e) {
3820
- B && console.log(...e);
3939
+ //#endregion
3940
+ //#region api/videoFusion/resume.js
3941
+ function Pn(e = {}) {
3942
+ let t = { ...e };
3943
+ return {
3944
+ errors: [...h({
3945
+ normalized: t,
3946
+ field: "instanceId",
3947
+ value: e.instanceId
3948
+ })],
3949
+ normalized: t
3950
+ };
3821
3951
  }
3822
- function H(...e) {
3823
- B && console.warn(...e);
3952
+ //#endregion
3953
+ //#region api/videoFusion/setPlaybackRate.js
3954
+ function Fn(e = {}) {
3955
+ let t = { ...e }, n = [];
3956
+ return n.push(...h({
3957
+ normalized: t,
3958
+ field: "instanceId",
3959
+ value: e.instanceId
3960
+ })), n.push(...m({
3961
+ normalized: t,
3962
+ field: "rate",
3963
+ value: e.rate,
3964
+ defaultValue: 1,
3965
+ min: 0
3966
+ })), {
3967
+ errors: n,
3968
+ normalized: t
3969
+ };
3970
+ }
3971
+ //#endregion
3972
+ //#region api/videoFusion/seekToTime.js
3973
+ function In(e = {}) {
3974
+ let t = { ...e }, n = [];
3975
+ return n.push(...h({
3976
+ normalized: t,
3977
+ field: "instanceId",
3978
+ value: e.instanceId
3979
+ })), n.push(...m({
3980
+ normalized: t,
3981
+ field: "seconds",
3982
+ value: e.seconds,
3983
+ defaultValue: 0,
3984
+ min: 0
3985
+ })), {
3986
+ errors: n,
3987
+ normalized: t
3988
+ };
3989
+ }
3990
+ //#endregion
3991
+ //#region api/videoFusion/videoFusionApi.js
3992
+ var Ln = r("videoFusion", {
3993
+ open: An,
3994
+ close: jn,
3995
+ closeAll: Mn,
3996
+ pause: Nn,
3997
+ resume: Pn,
3998
+ setPlaybackRate: Fn,
3999
+ seekToTime: In
4000
+ });
4001
+ //#endregion
4002
+ //#region api/other/otherApi.js
4003
+ function B(e) {
4004
+ return class {
4005
+ constructor(t) {
4006
+ this.commandManager = t, this.domain = e;
4007
+ }
4008
+ _handleSend(t, n = {}, r = {}) {
4009
+ return this.commandManager.sendWithDefault({
4010
+ errors: [],
4011
+ normalized: n
4012
+ }, `${e}.${t}`, r);
4013
+ }
4014
+ };
4015
+ }
4016
+ //#endregion
4017
+ //#region api/index.js
4018
+ var Rn = {
4019
+ camera: ue,
4020
+ cesium: Se,
4021
+ marker: qe,
4022
+ floodPeak: nt,
4023
+ animation: ut,
4024
+ hydrodynamicForce: _t,
4025
+ sceneModel: Lt,
4026
+ atmosphericEffects: zt,
4027
+ tool: Gt,
4028
+ line: Xt,
4029
+ level: Qt,
4030
+ VTK: On,
4031
+ videoFusion: Ln,
4032
+ oneDimensionalHydrodynamics: B("oneDimensionalHydrodynamics"),
4033
+ customDomain: B("customDomain"),
4034
+ arrow: B("arrow"),
4035
+ NC: B("NC"),
4036
+ gateOperation: B("gateOperation")
4037
+ }, V = class {
4038
+ constructor(e) {
4039
+ this._apis = {};
4040
+ for (let [t, n] of Object.entries(Rn)) this._apis[t] = new n(e), this[t] = (e, n, r) => this._apis[t]._handleSend(e, n, r);
4041
+ }
4042
+ }, H = !0;
4043
+ function zn(e) {
4044
+ H = !!e;
3824
4045
  }
3825
4046
  function U(...e) {
3826
- B && console.error(...e);
4047
+ H && console.log(...e);
4048
+ }
4049
+ function W(...e) {
4050
+ H && console.warn(...e);
4051
+ }
4052
+ function G(...e) {
4053
+ H && console.error(...e);
3827
4054
  }
3828
4055
  //#endregion
3829
- //#region baseConfig/responses.js
3830
- function W(e) {
4056
+ //#region commFlow/streamResponses.js
4057
+ function K(e) {
3831
4058
  return (Array.isArray(e) ? e : [e]).map((e) => {
3832
4059
  if (typeof e == "string") return e;
3833
4060
  if (e && typeof e == "object") {
@@ -3841,7 +4068,7 @@ function W(e) {
3841
4068
  return e == null ? "" : String(e);
3842
4069
  }).filter((e) => e !== "");
3843
4070
  }
3844
- function An(e, t, n) {
4071
+ function Bn(e, t, n) {
3845
4072
  return {
3846
4073
  success: !0,
3847
4074
  message: e,
@@ -3849,66 +4076,26 @@ function An(e, t, n) {
3849
4076
  command: n
3850
4077
  };
3851
4078
  }
3852
- function G(e, t, n) {
4079
+ function q(e, t, n) {
3853
4080
  let r = {
3854
4081
  success: !1,
3855
- message: W(e),
4082
+ message: K(e),
3856
4083
  params: t,
3857
4084
  command: n
3858
4085
  };
3859
- return U("三维场景报错:", r), r;
4086
+ return G("三维场景报错:", r), r;
3860
4087
  }
3861
- function K(e, t, n) {
4088
+ function J(e, t, n) {
3862
4089
  let r = {
3863
4090
  success: !1,
3864
- message: W(e),
4091
+ message: K(e),
3865
4092
  params: t,
3866
4093
  command: n
3867
4094
  };
3868
- return H("三维场景警告:", r), r;
4095
+ return W("三维场景警告:", r), r;
3869
4096
  }
3870
4097
  //#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
4098
+ //#region commFlow/commFlow.js
3912
4099
  function Y() {
3913
4100
  return {
3914
4101
  Hovered: {},
@@ -3993,8 +4180,8 @@ var Q = {
3993
4180
  }
3994
4181
  sendWithDefault(e, t, n = {}) {
3995
4182
  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);
4183
+ if (e.errors.length > 0) return q(e.errors, r, t);
4184
+ if (this._destroyed || !this.transport) return q("连接已关闭,无法发送命令", r, t);
3998
4185
  let i = (++this.requestId).toString(), a = n?.timeout === 0 ? 0 : n?.timeout ?? this.timeout, o = new Promise((e, t) => {
3999
4186
  let n = null;
4000
4187
  a !== 0 && (n = setTimeout(() => {
@@ -4009,18 +4196,18 @@ var Q = {
4009
4196
  requestId: i,
4010
4197
  params: r
4011
4198
  };
4012
- return V("消息下发成功:", s), this.transport.sendTextToDataChannel(JSON.stringify(s)), o.then((e) => {
4199
+ return U("消息下发成功:", s), this.transport.sendTextToDataChannel(JSON.stringify(s)), o.then((e) => {
4013
4200
  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);
4201
+ case "info": return Bn("操作执行成功", e.data, t);
4202
+ case "warn": return J(e.message, e.data, t);
4203
+ default: return q(e.message, e.data, t);
4017
4204
  }
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));
4205
+ return q("返回数据格式错乱【请注意command参数】", e?.command, t);
4206
+ }).catch((e) => e && e.message ? e.message === "Command timeout with no results" ? J(e.message, r, t) : q(e.message, r, t) : q("数据返回发生错误", r, t));
4020
4207
  }
4021
4208
  _handleRawResponse(e) {
4022
4209
  if (this._destroyed) return null;
4023
- if (!e) return U("数据第一步解析失败:", e), null;
4210
+ if (!e) return G("数据第一步解析失败:", e), null;
4024
4211
  let t;
4025
4212
  try {
4026
4213
  let n = JSON.parse(String(e).trim());
@@ -4032,7 +4219,7 @@ var Q = {
4032
4219
  requestId: n.requestId || ""
4033
4220
  }, t.message === "The data channel has been connected." || t.message === "The level has been initialized") return null;
4034
4221
  } catch {
4035
- return U("数据第二步解析失败:", e), null;
4222
+ return G("数据第二步解析失败:", e), null;
4036
4223
  }
4037
4224
  if (this._processEventResponse(t)) return;
4038
4225
  let { command: n, message: r, data: i, status: a, requestId: o } = t;
@@ -4046,7 +4233,7 @@ var Q = {
4046
4233
  });
4047
4234
  return;
4048
4235
  }
4049
- H("注意:非常规响应", t);
4236
+ W("注意:非常规响应", t);
4050
4237
  }
4051
4238
  _registerMarkerCallbacks(e, t) {
4052
4239
  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";
@@ -4071,18 +4258,18 @@ var Q = {
4071
4258
  return r?.dispatch ? r.dispatch(this, t, n) : !1;
4072
4259
  }
4073
4260
  _executeCallback(e, t, n) {
4074
- if (typeof e != "function") return V(`${t}未监听:${n.eventType}`), !0;
4261
+ if (typeof e != "function") return U(`${t}未监听:${n.eventType}`), !0;
4075
4262
  try {
4076
4263
  return e(n), !0;
4077
4264
  } catch (e) {
4078
- return U(`执行${t}回调出错:`, e, n), !0;
4265
+ return G(`执行${t}回调出错:`, e, n), !0;
4079
4266
  }
4080
4267
  }
4081
4268
  _executeCallbacks(e, t, n) {
4082
4269
  return e ? Array.isArray(e) ? (e.forEach((e) => this._executeCallback(e, t, n)), !0) : this._executeCallback(e, t, n) : !1;
4083
4270
  }
4084
4271
  };
4085
- function Nn(e) {
4272
+ function Vn(e) {
4086
4273
  if (!e) return "";
4087
4274
  try {
4088
4275
  return JSON.parse(String(e).trim())?.message || "";
@@ -4090,7 +4277,7 @@ function Nn(e) {
4090
4277
  return "";
4091
4278
  }
4092
4279
  }
4093
- function Pn(t = {}) {
4280
+ function Hn(t = {}) {
4094
4281
  let { sendText: n, commandTimeout: r = 3e3, onSceneInit: i } = t;
4095
4282
  if (typeof n != "function") throw Error("createGameSession: sendText 必须是函数");
4096
4283
  let a = null, o = !1, s = new $({
@@ -4100,11 +4287,11 @@ function Pn(t = {}) {
4100
4287
  bindMessageHandler(e) {
4101
4288
  a = e;
4102
4289
  }
4103
- }, { timeout: r }), c = new J(s);
4290
+ }, { timeout: r }), c = new V(s);
4104
4291
  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));
4292
+ e && a && a(e), !o && Vn(e) === "The level has been initialized" && (o = !0, i ? i(t === void 0 ? e : t) : U("场景初始化加载成功", t === void 0 ? e : t));
4106
4293
  }
4107
- return V(`插件初始化成功 [web3dlink@${e}]`), {
4294
+ return U(`插件初始化成功 [web3dlink@${e}]`), {
4108
4295
  gameAPI: c,
4109
4296
  commandManager: s,
4110
4297
  handleIncoming: l,
@@ -4113,7 +4300,7 @@ function Pn(t = {}) {
4113
4300
  }
4114
4301
  };
4115
4302
  }
4116
- function Fn(e, t, n) {
4303
+ function Un(e, t, n) {
4117
4304
  if (!(!e || !n)) {
4118
4305
  if (typeof e.off == "function") {
4119
4306
  e.off(t, n);
@@ -4122,10 +4309,10 @@ function Fn(e, t, n) {
4122
4309
  typeof e.removeListener == "function" && e.removeListener(t, n);
4123
4310
  }
4124
4311
  }
4125
- function In(e = []) {
4126
- for (let { target: t, event: n, handler: r } of e) Fn(t, n, r);
4312
+ function Wn(e = []) {
4313
+ for (let { target: t, event: n, handler: r } of e) Un(t, n, r);
4127
4314
  }
4128
4315
  //#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 };
4316
+ export { G as a, e as c, U as i, Wn as n, zn as o, $ as r, V as s, Hn as t };
4130
4317
 
4131
- //# sourceMappingURL=createGameSession-DkD790Ci.js.map
4318
+ //# sourceMappingURL=createGameSession-BVx3-mqj.js.map