web3dlink 2.1.10 → 2.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web3dlink.js +479 -479
- package/dist/web3dlink.js.map +1 -1
- package/package.json +1 -1
package/dist/web3dlink.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
|
-
var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), name = "web3dlink", version$1 = "2.1.
|
|
2
|
+
var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), name = "web3dlink", version$1 = "2.1.12", description = "LarkSR / ZS 推流 GameAPI SDK", type = "module", main = "./dist/web3dlink.js", module$1 = "./dist/web3dlink.js", exports$1 = { ".": {
|
|
3
3
|
import: "./dist/web3dlink.js",
|
|
4
4
|
default: "./dist/web3dlink.js"
|
|
5
5
|
} }, files = ["dist"], scripts = {
|
|
@@ -29,355 +29,11 @@ var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t),
|
|
|
29
29
|
keywords,
|
|
30
30
|
license: "MIT",
|
|
31
31
|
sideEffects
|
|
32
|
-
}, version = package_default.version;
|
|
32
|
+
}, version = package_default.version, logStyle = "background: #22c55e; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 600;";
|
|
33
|
+
console.log(`%c [web3dlink] version: ${version} `, logStyle), console.log("%c [larksr_websdk] version: 3.3.119 ", logStyle);
|
|
33
34
|
//#endregion
|
|
34
|
-
//#region
|
|
35
|
-
|
|
36
|
-
let t = "zs-stream-parent", n = "zs-stream-embed";
|
|
37
|
-
function r(e) {
|
|
38
|
-
return e ? typeof e == "string" ? document.querySelector(e) : e : null;
|
|
39
|
-
}
|
|
40
|
-
function i(e, t, n) {
|
|
41
|
-
let r = (e || "").replace(/\/+$/, "") || (typeof location < "u" ? location.origin : ""), i = new URLSearchParams({
|
|
42
|
-
template: t || "default",
|
|
43
|
-
autoconnect: "1",
|
|
44
|
-
muted: "1"
|
|
45
|
-
});
|
|
46
|
-
return n && i.set("streamId", n), `${r}/embed?${i.toString()}`;
|
|
47
|
-
}
|
|
48
|
-
function a(e, n, r) {
|
|
49
|
-
return e?.contentWindow ? (e.contentWindow.postMessage({
|
|
50
|
-
source: t,
|
|
51
|
-
streamId: n,
|
|
52
|
-
...r
|
|
53
|
-
}, "*"), { ok: !0 }) : {
|
|
54
|
-
ok: !1,
|
|
55
|
-
error: "iframe 未就绪"
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
class o {
|
|
59
|
-
constructor({ streamId: t, template: n, container: i, baseUrl: a } = {}) {
|
|
60
|
-
if (!t) throw Error("ZsStream: streamId 必填(同页多路时用于区分)");
|
|
61
|
-
this.streamId = t, this.template = n || "default", this.baseUrl = a, this.container = r(i), this.iframe = null, this._handlers = /* @__PURE__ */ new Map(), this._ready = !1, this._inputReady = !1, this._onMessage = this._onMessage.bind(this), e.addEventListener("message", this._onMessage), this._mountIframe();
|
|
62
|
-
}
|
|
63
|
-
_mountIframe() {
|
|
64
|
-
if (!this.container) throw Error("ZsStream: container 未找到");
|
|
65
|
-
let e = document.createElement("iframe");
|
|
66
|
-
e.src = i(this.baseUrl, this.template, this.streamId), e.style.width = "100%", e.style.height = "100%", e.style.border = "0", e.setAttribute("allow", "autoplay; fullscreen; encrypted-media"), e.title = `ZS Stream ${this.streamId}`, this.container.innerHTML = "", this.container.appendChild(e), this.iframe = e;
|
|
67
|
-
}
|
|
68
|
-
_onMessage(e) {
|
|
69
|
-
let t = e.data;
|
|
70
|
-
if (!t || t.source !== n || t.streamId && t.streamId !== this.streamId || t.type !== "event") return;
|
|
71
|
-
let r = t.event;
|
|
72
|
-
r === "ready" && (this._ready = !0), r === "inputready" && (this._inputReady = !0), this._emit(r, t.data);
|
|
73
|
-
}
|
|
74
|
-
_emit(e, t) {
|
|
75
|
-
let n = this._handlers.get(e);
|
|
76
|
-
if (n) for (let e of n) try {
|
|
77
|
-
e(t);
|
|
78
|
-
} catch (e) {
|
|
79
|
-
console.error("[ZsStream]", e);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
on(e, t) {
|
|
83
|
-
return this._handlers.has(e) || this._handlers.set(e, /* @__PURE__ */ new Set()), this._handlers.get(e).add(t), () => this.off(e, t);
|
|
84
|
-
}
|
|
85
|
-
off(e, t) {
|
|
86
|
-
this._handlers.get(e)?.delete(t);
|
|
87
|
-
}
|
|
88
|
-
_send(e, t) {
|
|
89
|
-
return a(this.iframe, this.streamId, {
|
|
90
|
-
type: e,
|
|
91
|
-
...t
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
invoke(e, t, n) {
|
|
95
|
-
return this._send("invoke", {
|
|
96
|
-
module: e,
|
|
97
|
-
action: t,
|
|
98
|
-
params: n ?? {}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
camera(e, t) {
|
|
102
|
-
return this._send("camera", {
|
|
103
|
-
action: e,
|
|
104
|
-
params: t ?? {}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
sendRaw(e) {
|
|
108
|
-
return this._send("sendRaw", { descriptor: String(e) });
|
|
109
|
-
}
|
|
110
|
-
sendCommand(e, t) {
|
|
111
|
-
return this._send("larkCommand", {
|
|
112
|
-
command: e,
|
|
113
|
-
params: t ?? {}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
sendTextToDataChannel(e) {
|
|
117
|
-
let t = typeof e == "string" ? e : JSON.stringify({
|
|
118
|
-
command: e.command,
|
|
119
|
-
params: e.params ?? {}
|
|
120
|
-
});
|
|
121
|
-
return this._send("sendRaw", { descriptor: t });
|
|
122
|
-
}
|
|
123
|
-
disconnect() {
|
|
124
|
-
return this._send("disconnect", {});
|
|
125
|
-
}
|
|
126
|
-
destroy() {
|
|
127
|
-
e.removeEventListener("message", this._onMessage), this.disconnect(), this.iframe?.parentNode && this.iframe.parentNode.removeChild(this.iframe), this.iframe = null, this._handlers.clear();
|
|
128
|
-
}
|
|
129
|
-
get isReady() {
|
|
130
|
-
return this._ready;
|
|
131
|
-
}
|
|
132
|
-
get isInputReady() {
|
|
133
|
-
return this._inputReady;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
class s {
|
|
137
|
-
constructor() {
|
|
138
|
-
this._streams = /* @__PURE__ */ new Map();
|
|
139
|
-
}
|
|
140
|
-
mount(e) {
|
|
141
|
-
let t = e?.streamId;
|
|
142
|
-
if (!t) throw Error("ZsStreamHub.mount: streamId 必填");
|
|
143
|
-
this._streams.has(t) && this._streams.get(t).destroy();
|
|
144
|
-
let n = new o(e);
|
|
145
|
-
return this._streams.set(t, n), n;
|
|
146
|
-
}
|
|
147
|
-
get(e) {
|
|
148
|
-
return this._streams.get(e) || null;
|
|
149
|
-
}
|
|
150
|
-
has(e) {
|
|
151
|
-
return this._streams.has(e);
|
|
152
|
-
}
|
|
153
|
-
destroy(e) {
|
|
154
|
-
let t = this._streams.get(e);
|
|
155
|
-
t && (t.destroy(), this._streams.delete(e));
|
|
156
|
-
}
|
|
157
|
-
destroyAll() {
|
|
158
|
-
for (let e of [...this._streams.keys()]) this.destroy(e);
|
|
159
|
-
}
|
|
160
|
-
list() {
|
|
161
|
-
return [...this._streams.keys()];
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
e.ZsStream = {
|
|
165
|
-
mount(e) {
|
|
166
|
-
return new o(e);
|
|
167
|
-
},
|
|
168
|
-
Hub: s,
|
|
169
|
-
buildEmbedSrc: i,
|
|
170
|
-
MSG_SOURCE_PARENT: t,
|
|
171
|
-
MSG_SOURCE_EMBED: n
|
|
172
|
-
}, e.ZsStreamHub = s;
|
|
173
|
-
})(typeof window < "u" ? window : globalThis);
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region ../baseConfig/responses.js
|
|
176
|
-
function createSuccessResponse(e, t, n) {
|
|
177
|
-
return {
|
|
178
|
-
success: !0,
|
|
179
|
-
message: e,
|
|
180
|
-
data: t,
|
|
181
|
-
command: n
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
function createErrorResponse(e, t, n) {
|
|
185
|
-
let r = {
|
|
186
|
-
success: !1,
|
|
187
|
-
message: e,
|
|
188
|
-
params: t,
|
|
189
|
-
command: n
|
|
190
|
-
};
|
|
191
|
-
return console.error("三维场景报错:", r), r;
|
|
192
|
-
}
|
|
193
|
-
function createWarnResponse(e, t, n) {
|
|
194
|
-
let r = {
|
|
195
|
-
success: !1,
|
|
196
|
-
message: e,
|
|
197
|
-
params: t,
|
|
198
|
-
command: n
|
|
199
|
-
};
|
|
200
|
-
return console.warn("三维场景警告:", r), r;
|
|
201
|
-
}
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region ../baseConfig/logger.js
|
|
204
|
-
var ueLogEnabled = !0;
|
|
205
|
-
function setUELogEnabled(e) {
|
|
206
|
-
ueLogEnabled = !!e;
|
|
207
|
-
}
|
|
208
|
-
function log(...e) {
|
|
209
|
-
ueLogEnabled && console.log(...e);
|
|
210
|
-
}
|
|
211
|
-
//#endregion
|
|
212
|
-
//#region commFlow.js
|
|
213
|
-
var CommandManager = class {
|
|
214
|
-
constructor(e) {
|
|
215
|
-
this.transport = e, this.callbacks = {}, this.requestId = 0, this.timeout = 3e3, this.markerEventCallbacks = {
|
|
216
|
-
Hovered: {},
|
|
217
|
-
Click: {},
|
|
218
|
-
DoubleClick: {},
|
|
219
|
-
Unhovered: {}
|
|
220
|
-
}, this.secondMarkerEventCallbacks = {
|
|
221
|
-
Hovered: {},
|
|
222
|
-
Click: {},
|
|
223
|
-
DoubleClick: {},
|
|
224
|
-
Unhovered: {}
|
|
225
|
-
}, this.followMarkerEventCallbacks = {
|
|
226
|
-
Hovered: {},
|
|
227
|
-
Click: {},
|
|
228
|
-
DoubleClick: {},
|
|
229
|
-
Unhovered: {}
|
|
230
|
-
}, this.animationOnDataCallback = { Change: [] }, this.mouseClickCallback = { MouseClick: [] }, this.vtkMouseClickCallback = {}, e.bindMessageHandler((e) => {
|
|
231
|
-
this._handleRawResponse(e);
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
sendWithDefault(e, t, n = {}) {
|
|
235
|
-
let r = this._sendPreparePayload(t, e.normalized || {});
|
|
236
|
-
if (e.errors.length > 0) return createErrorResponse(e.errors, r, t);
|
|
237
|
-
let i = (++this.requestId).toString(), a = n?.timeout === 0 ? 0 : this.timeout, o = new Promise((e, t) => {
|
|
238
|
-
let n = null;
|
|
239
|
-
a !== 0 && (n = setTimeout(() => {
|
|
240
|
-
delete this.callbacks[i], t(/* @__PURE__ */ Error("Command timeout with no results"));
|
|
241
|
-
}, a)), this.callbacks[i] = {
|
|
242
|
-
resolve: e,
|
|
243
|
-
reject: t,
|
|
244
|
-
timeoutId: n
|
|
245
|
-
};
|
|
246
|
-
}), s = {
|
|
247
|
-
command: t,
|
|
248
|
-
requestId: i,
|
|
249
|
-
params: r
|
|
250
|
-
};
|
|
251
|
-
return log("消息下发成功:", s), this.transport.sendTextToDataChannel(JSON.stringify(s)), o.then((e) => {
|
|
252
|
-
if (e && e.command && e.command === t) switch (e.status) {
|
|
253
|
-
case "info": return createSuccessResponse("操作执行成功", e.data, t);
|
|
254
|
-
case "warn": return createWarnResponse(e.message, e.data, t);
|
|
255
|
-
default: return createErrorResponse(e.message, e.data, t);
|
|
256
|
-
}
|
|
257
|
-
return createErrorResponse("返回数据格式错乱【请注意command参数】", e?.command, t);
|
|
258
|
-
}).catch((e) => e && e.message ? e.message === "Command timeout with no results" ? createWarnResponse(e.message, r, t) : createErrorResponse(e.message, r, t) : createErrorResponse("数据返回发生错误", r, t));
|
|
259
|
-
}
|
|
260
|
-
_handleRawResponse(e) {
|
|
261
|
-
if (!e) return console.error("数据第一步解析失败:", e), null;
|
|
262
|
-
let t;
|
|
263
|
-
try {
|
|
264
|
-
let n = JSON.parse(String(e).trim());
|
|
265
|
-
if (t = {
|
|
266
|
-
command: n.command || "",
|
|
267
|
-
message: n.message || "",
|
|
268
|
-
data: n.data || {},
|
|
269
|
-
status: n.status || "error",
|
|
270
|
-
requestId: n.requestId || ""
|
|
271
|
-
}, t.message === "The data channel has been connected." || t.message === "The level has been initialized") return null;
|
|
272
|
-
} catch {
|
|
273
|
-
return console.error("数据第二步解析失败:", e), null;
|
|
274
|
-
}
|
|
275
|
-
if (this._processEventResponse(t)) return;
|
|
276
|
-
let { command: n, message: r, data: i, status: a, requestId: o } = t;
|
|
277
|
-
if (o && this.callbacks[o]) {
|
|
278
|
-
let { resolve: e, timeoutId: t } = this.callbacks[o];
|
|
279
|
-
clearTimeout(t), delete this.callbacks[o], e({
|
|
280
|
-
command: n,
|
|
281
|
-
message: r,
|
|
282
|
-
data: i,
|
|
283
|
-
status: a
|
|
284
|
-
});
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
console.warn("注意:非常规响应", t);
|
|
288
|
-
}
|
|
289
|
-
_sendPreparePayload(e, t) {
|
|
290
|
-
if (e === "marker.iconMarker" || e === "marker.iconUrlMarker") {
|
|
291
|
-
let { onMarkerClick: e, onMarkerDoubleClick: n, onMarkerDblClick: r, onMouseHover: i, onMouseLeave: a, ...o } = t || {}, s = n || r, c = o?.id;
|
|
292
|
-
return c != null && c !== "" ? (typeof i == "function" && (this.markerEventCallbacks.Hovered[c] = i), typeof e == "function" && (this.markerEventCallbacks.Click[c] = e), typeof s == "function" && (this.markerEventCallbacks.DoubleClick[c] = s), typeof a == "function" && (this.markerEventCallbacks.Unhovered[c] = a)) : (typeof i == "function" && (this.markerEventCallbacks.Hovered.__default = i), typeof e == "function" && (this.markerEventCallbacks.Click.__default = e), typeof s == "function" && (this.markerEventCallbacks.DoubleClick.__default = s), typeof a == "function" && (this.markerEventCallbacks.Unhovered.__default = a)), o;
|
|
293
|
-
}
|
|
294
|
-
if (e === "marker.secondMarker") {
|
|
295
|
-
let { onMarkerClick: e, onMarkerDoubleClick: n, onMarkerDblClick: r, onMouseHover: i, onMouseLeave: a, ...o } = t || {}, s = n || r, c = o?.id;
|
|
296
|
-
return c != null && c !== "" ? (typeof i == "function" && (this.secondMarkerEventCallbacks.Hovered[c] = i), typeof e == "function" && (this.secondMarkerEventCallbacks.Click[c] = e), typeof s == "function" && (this.secondMarkerEventCallbacks.DoubleClick[c] = s), typeof a == "function" && (this.secondMarkerEventCallbacks.Unhovered[c] = a)) : (typeof i == "function" && (this.secondMarkerEventCallbacks.Hovered.__default = i), typeof e == "function" && (this.secondMarkerEventCallbacks.Click.__default = e), typeof s == "function" && (this.secondMarkerEventCallbacks.DoubleClick.__default = s), typeof a == "function" && (this.secondMarkerEventCallbacks.Unhovered.__default = a)), o;
|
|
297
|
-
}
|
|
298
|
-
if (e === "marker.followMarker") {
|
|
299
|
-
let { onMarkerClick: e, onMarkerDoubleClick: n, onMarkerDblClick: r, onMouseHover: i, onMouseLeave: a, ...o } = t || {}, s = n || r, c = o?.id;
|
|
300
|
-
return c != null && c !== "" ? (typeof i == "function" && (this.followMarkerEventCallbacks.Hovered[c] = i), typeof e == "function" && (this.followMarkerEventCallbacks.Click[c] = e), typeof s == "function" && (this.followMarkerEventCallbacks.DoubleClick[c] = s), typeof a == "function" && (this.followMarkerEventCallbacks.Unhovered[c] = a)) : (typeof i == "function" && (this.followMarkerEventCallbacks.Hovered.__default = i), typeof e == "function" && (this.followMarkerEventCallbacks.Click.__default = e), typeof s == "function" && (this.followMarkerEventCallbacks.DoubleClick.__default = s), typeof a == "function" && (this.followMarkerEventCallbacks.Unhovered.__default = a)), o;
|
|
301
|
-
}
|
|
302
|
-
if (e === "tool.onMouseClick") {
|
|
303
|
-
let { onMouseClick: e, ...n } = t || {};
|
|
304
|
-
return typeof e == "function" && (Array.isArray(this.mouseClickCallback.MouseClick) || (this.mouseClickCallback.MouseClick = []), this.mouseClickCallback.MouseClick.includes(e) || this.mouseClickCallback.MouseClick.push(e)), n;
|
|
305
|
-
}
|
|
306
|
-
if (e === "VTK.onMouseClick") {
|
|
307
|
-
let { onMouseClick: e, ...n } = t || {}, r = n?.id;
|
|
308
|
-
return r != null && r !== "" && typeof e == "function" && (this.vtkMouseClickCallback[r] = e), n;
|
|
309
|
-
}
|
|
310
|
-
if (e === "VTK.offMouseClick") {
|
|
311
|
-
let e = t?.id;
|
|
312
|
-
return e != null && e !== "" && delete this.vtkMouseClickCallback[e], t;
|
|
313
|
-
}
|
|
314
|
-
if (e === "animation.onData") {
|
|
315
|
-
let { onChange: e, ...n } = t || {};
|
|
316
|
-
return typeof e == "function" && (Array.isArray(this.animationOnDataCallback.Change) || (this.animationOnDataCallback.Change = []), this.animationOnDataCallback.Change.includes(e) || this.animationOnDataCallback.Change.push(e)), n;
|
|
317
|
-
}
|
|
318
|
-
return t;
|
|
319
|
-
}
|
|
320
|
-
_processEventResponse(e) {
|
|
321
|
-
if (!e) return !1;
|
|
322
|
-
let { command: t, data: n = {} } = e;
|
|
323
|
-
if (t === "marker.iconMarker" || t === "marker.iconUrlMarker") {
|
|
324
|
-
if (typeof n.recordData == "string") try {
|
|
325
|
-
n.recordData = JSON.parse(n.recordData);
|
|
326
|
-
} catch {}
|
|
327
|
-
let { pointId: e, eventType: r } = n;
|
|
328
|
-
if (!(r && this.markerEventCallbacks)) return !1;
|
|
329
|
-
let i = this.markerEventCallbacks[r], a = i?.[e] || i?.__default;
|
|
330
|
-
return this._executeCallback(a, t, n);
|
|
331
|
-
}
|
|
332
|
-
if (t === "marker.secondMarker") {
|
|
333
|
-
if (typeof n.recordData == "string") try {
|
|
334
|
-
n.recordData = JSON.parse(n.recordData);
|
|
335
|
-
} catch {}
|
|
336
|
-
let { pointId: e, eventType: r } = n;
|
|
337
|
-
if (!(r && this.secondMarkerEventCallbacks)) return !1;
|
|
338
|
-
let i = this.secondMarkerEventCallbacks[r], a = i?.[e] || i?.__default;
|
|
339
|
-
return this._executeCallback(a, t, n);
|
|
340
|
-
}
|
|
341
|
-
if (t === "marker.followMarker") {
|
|
342
|
-
if (typeof n.recordData == "string") try {
|
|
343
|
-
n.recordData = JSON.parse(n.recordData);
|
|
344
|
-
} catch {}
|
|
345
|
-
let { pointId: e, eventType: r } = n;
|
|
346
|
-
if (!(r && this.followMarkerEventCallbacks)) return !1;
|
|
347
|
-
let i = this.followMarkerEventCallbacks[r], a = i?.[e] || i?.__default;
|
|
348
|
-
return this._executeCallback(a, t, n);
|
|
349
|
-
}
|
|
350
|
-
if (t === "tool.onMouseClick") {
|
|
351
|
-
let { coordinates: e } = n;
|
|
352
|
-
if (!(e && this.mouseClickCallback)) return !1;
|
|
353
|
-
let r = this.mouseClickCallback.MouseClick;
|
|
354
|
-
return this._executeCallbacks(r, t, n);
|
|
355
|
-
}
|
|
356
|
-
if (t === "VTK.onMouseClick") {
|
|
357
|
-
if (!this.vtkMouseClickCallback || !Object.keys(this.vtkMouseClickCallback).length) return !1;
|
|
358
|
-
let e = n?.id, r = e ? this.vtkMouseClickCallback[e] : null;
|
|
359
|
-
return r ? this._executeCallback(r, t, n) : this._executeCallbacks(Object.values(this.vtkMouseClickCallback), t, n);
|
|
360
|
-
}
|
|
361
|
-
if (t === "animation.onData") {
|
|
362
|
-
let { type: e } = n;
|
|
363
|
-
if (!(e && this.animationOnDataCallback)) return !1;
|
|
364
|
-
let r = this.animationOnDataCallback.Change;
|
|
365
|
-
return this._executeCallbacks(r, t, n);
|
|
366
|
-
}
|
|
367
|
-
return !1;
|
|
368
|
-
}
|
|
369
|
-
_executeCallback(e, t, n) {
|
|
370
|
-
if (typeof e != "function") return log(`${t}未监听:${n.eventType}`), !0;
|
|
371
|
-
try {
|
|
372
|
-
return e(n), !0;
|
|
373
|
-
} catch (e) {
|
|
374
|
-
return console.error(`执行${t}回调出错:`, e, n), !0;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
_executeCallbacks(e, t, n) {
|
|
378
|
-
return e ? Array.isArray(e) ? (e.forEach((e) => this._executeCallback(e, t, n)), !0) : this._executeCallback(e, t, n) : !1;
|
|
379
|
-
}
|
|
380
|
-
}, lightpink = "#FFB6C1", pink = "#FFC0CB", crimson = "#DC143C", lavenderblush = "#FFF0F5", palevioletred = "#DB7093", hotpink = "#FF69B4", deeppink = "#FF1493", mediumvioletred = "#C71585", orchid = "#DA70D6", thistle = "#D8BFD8", plum = "#DDA0DD", violet = "#EE82EE", magenta = "#FF00FF", fuchsia = "#FF00FF", darkmagenta = "#8B008B", purple = "#800080", mediumorchid = "#BA55D3", darkvoilet = "#9400D3", darkorchid = "#9932CC", indigo = "#4B0082", blueviolet = "#8A2BE2", mediumpurple = "#9370DB", mediumslateblue = "#7B68EE", slateblue = "#6A5ACD", darkslateblue = "#483D8B", lavender = "#E6E6FA", ghostwhite = "#F8F8FF", blue = "#0000FF", mediumblue = "#0000CD", midnightblue = "#191970", darkblue = "#00008B", navy = "#000080", royalblue = "#4169E1", cornflowerblue = "#6495ED", lightsteelblue = "#B0C4DE", lightslategray = "#778899", slategray = "#708090", doderblue = "#1E90FF", aliceblue = "#F0F8FF", steelblue = "#4682B4", lightskyblue = "#87CEFA", skyblue = "#87CEEB", deepskyblue = "#00BFFF", lightblue = "#ADD8E6", powderblue = "#B0E0E6", cadetblue = "#5F9EA0", azure = "#F0FFFF", lightcyan = "#E1FFFF", paleturquoise = "#AFEEEE", cyan = "#00FFFF", aqua = "#D4F2E7", darkturquoise = "#00CED1", darkslategray = "#2F4F4F", darkcyan = "#008B8B", teal = "#008080", mediumturquoise = "#48D1CC", lightseagreen = "#20B2AA", turquoise = "#40E0D0", auqamarin = "#7FFFAA", mediumaquamarine = "#00FA9A", mediumspringgreen = "#00FF7F", mintcream = "#F5FFFA", springgreen = "#3CB371", seagreen = "#2E8B57", honeydew = "#F0FFF0", lightgreen = "#90EE90", palegreen = "#98FB98", darkseagreen = "#8FBC8F", limegreen = "#32CD32", lime = "#00FF00", forestgreen = "#228B22", green = "#008000", darkgreen = "#006400", chartreuse = "#7FFF00", lawngreen = "#7CFC00", greenyellow = "#ADFF2F", olivedrab = "#556B2F", beige = "#F5F5DC", lightgoldenrodyellow = "#FAFAD2", ivory = "#FFFFF0", lightyellow = "#FFFFE0", yellow = "#FFFF00", olive = "#808000", darkkhaki = "#BDB76B", lemonchiffon = "#FFFACD", palegodenrod = "#EEE8AA", khaki = "#F0E68C", gold = "#FFD700", cornislk = "#FFF8DC", goldenrod = "#DAA520", floralwhite = "#FFFAF0", oldlace = "#FDF5E6", wheat = "#F5DEB3", moccasin = "#FFE4B5", orange = "#FFA500", papayawhip = "#FFEFD5", blanchedalmond = "#FFEBCD", navajowhite = "#FFDEAD", antiquewhite = "#FAEBD7", tan = "#D2B48C", brulywood = "#DEB887", bisque = "#FFE4C4", darkorange = "#FF8C00", linen = "#FAF0E6", peru = "#CD853F", peachpuff = "#FFDAB9", sandybrown = "#F4A460", chocolate = "#D2691E", saddlebrown = "#8B4513", seashell = "#FFF5EE", sienna = "#A0522D", lightsalmon = "#FFA07A", coral = "#FF7F50", orangered = "#FF4500", darksalmon = "#E9967A", tomato = "#FF6347", mistyrose = "#FFE4E1", salmon = "#FA8072", snow = "#FFFAFA", lightcoral = "#F08080", rosybrown = "#BC8F8F", indianred = "#CD5C5C", red = "#FF0000", brown = "#A52A2A", firebrick = "#B22222", darkred = "#8B0000", maroon = "#800000", white = "#FFFFFF", whitesmoke = "#F5F5F5", gainsboro = "#DCDCDC", lightgrey = "#D3D3D3", silver = "#C0C0C0", darkgray = "#A9A9A9", gray = "#808080", dimgray = "#696969", black = "#000000", colorCodeData_default = {
|
|
35
|
+
//#region baseConfig/color/colorCodeData.json
|
|
36
|
+
var lightpink = "#FFB6C1", pink = "#FFC0CB", crimson = "#DC143C", lavenderblush = "#FFF0F5", palevioletred = "#DB7093", hotpink = "#FF69B4", deeppink = "#FF1493", mediumvioletred = "#C71585", orchid = "#DA70D6", thistle = "#D8BFD8", plum = "#DDA0DD", violet = "#EE82EE", magenta = "#FF00FF", fuchsia = "#FF00FF", darkmagenta = "#8B008B", purple = "#800080", mediumorchid = "#BA55D3", darkvoilet = "#9400D3", darkorchid = "#9932CC", indigo = "#4B0082", blueviolet = "#8A2BE2", mediumpurple = "#9370DB", mediumslateblue = "#7B68EE", slateblue = "#6A5ACD", darkslateblue = "#483D8B", lavender = "#E6E6FA", ghostwhite = "#F8F8FF", blue = "#0000FF", mediumblue = "#0000CD", midnightblue = "#191970", darkblue = "#00008B", navy = "#000080", royalblue = "#4169E1", cornflowerblue = "#6495ED", lightsteelblue = "#B0C4DE", lightslategray = "#778899", slategray = "#708090", doderblue = "#1E90FF", aliceblue = "#F0F8FF", steelblue = "#4682B4", lightskyblue = "#87CEFA", skyblue = "#87CEEB", deepskyblue = "#00BFFF", lightblue = "#ADD8E6", powderblue = "#B0E0E6", cadetblue = "#5F9EA0", azure = "#F0FFFF", lightcyan = "#E1FFFF", paleturquoise = "#AFEEEE", cyan = "#00FFFF", aqua = "#D4F2E7", darkturquoise = "#00CED1", darkslategray = "#2F4F4F", darkcyan = "#008B8B", teal = "#008080", mediumturquoise = "#48D1CC", lightseagreen = "#20B2AA", turquoise = "#40E0D0", auqamarin = "#7FFFAA", mediumaquamarine = "#00FA9A", mediumspringgreen = "#00FF7F", mintcream = "#F5FFFA", springgreen = "#3CB371", seagreen = "#2E8B57", honeydew = "#F0FFF0", lightgreen = "#90EE90", palegreen = "#98FB98", darkseagreen = "#8FBC8F", limegreen = "#32CD32", lime = "#00FF00", forestgreen = "#228B22", green = "#008000", darkgreen = "#006400", chartreuse = "#7FFF00", lawngreen = "#7CFC00", greenyellow = "#ADFF2F", olivedrab = "#556B2F", beige = "#F5F5DC", lightgoldenrodyellow = "#FAFAD2", ivory = "#FFFFF0", lightyellow = "#FFFFE0", yellow = "#FFFF00", olive = "#808000", darkkhaki = "#BDB76B", lemonchiffon = "#FFFACD", palegodenrod = "#EEE8AA", khaki = "#F0E68C", gold = "#FFD700", cornislk = "#FFF8DC", goldenrod = "#DAA520", floralwhite = "#FFFAF0", oldlace = "#FDF5E6", wheat = "#F5DEB3", moccasin = "#FFE4B5", orange = "#FFA500", papayawhip = "#FFEFD5", blanchedalmond = "#FFEBCD", navajowhite = "#FFDEAD", antiquewhite = "#FAEBD7", tan = "#D2B48C", brulywood = "#DEB887", bisque = "#FFE4C4", darkorange = "#FF8C00", linen = "#FAF0E6", peru = "#CD853F", peachpuff = "#FFDAB9", sandybrown = "#F4A460", chocolate = "#D2691E", saddlebrown = "#8B4513", seashell = "#FFF5EE", sienna = "#A0522D", lightsalmon = "#FFA07A", coral = "#FF7F50", orangered = "#FF4500", darksalmon = "#E9967A", tomato = "#FF6347", mistyrose = "#FFE4E1", salmon = "#FA8072", snow = "#FFFAFA", lightcoral = "#F08080", rosybrown = "#BC8F8F", indianred = "#CD5C5C", red = "#FF0000", brown = "#A52A2A", firebrick = "#B22222", darkred = "#8B0000", maroon = "#800000", white = "#FFFFFF", whitesmoke = "#F5F5F5", gainsboro = "#DCDCDC", lightgrey = "#D3D3D3", silver = "#C0C0C0", darkgray = "#A9A9A9", gray = "#808080", dimgray = "#696969", black = "#000000", colorCodeData_default = {
|
|
381
37
|
lightpink,
|
|
382
38
|
pink,
|
|
383
39
|
crimson,
|
|
@@ -516,7 +172,7 @@ var CommandManager = class {
|
|
|
516
172
|
black
|
|
517
173
|
};
|
|
518
174
|
//#endregion
|
|
519
|
-
//#region
|
|
175
|
+
//#region baseConfig/color/color.js
|
|
520
176
|
function analyzeColorValue(e) {
|
|
521
177
|
if (!e || typeof e != "string") return !1;
|
|
522
178
|
let t = e.trim().toLowerCase(), n = /^#?([0-9A-Fa-f]{3})$/, r = /^#?([0-9A-Fa-f]{6})$/, i = /^#?([0-9A-Fa-f]{8})$/, a = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/, o = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0\.\d+)\s*\)$/, s = /^(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)$/;
|
|
@@ -553,7 +209,7 @@ function convertSimpleRgbaToHex8(e) {
|
|
|
553
209
|
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()}`;
|
|
554
210
|
}
|
|
555
211
|
//#endregion
|
|
556
|
-
//#region
|
|
212
|
+
//#region baseConfig/validators.js
|
|
557
213
|
function isValidNumber(e, t = null, n = null) {
|
|
558
214
|
return !(e == null || typeof e != "number" || isNaN(e) || t !== null && e < t || n !== null && e > n);
|
|
559
215
|
}
|
|
@@ -768,7 +424,7 @@ function verifyEnumerationValue(e) {
|
|
|
768
424
|
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);
|
|
769
425
|
}
|
|
770
426
|
//#endregion
|
|
771
|
-
//#region
|
|
427
|
+
//#region api/camera/validate.js
|
|
772
428
|
function validateOptionalBoolean$1(e, t, n, r, i) {
|
|
773
429
|
if (n == null || n === "") {
|
|
774
430
|
e[t] = i;
|
|
@@ -984,6 +640,12 @@ function aroundMode(e = {}) {
|
|
|
984
640
|
defaultValue: 0,
|
|
985
641
|
min: -180,
|
|
986
642
|
max: 180
|
|
643
|
+
})), t.push(...validateOptionalNumber({
|
|
644
|
+
normalized: n,
|
|
645
|
+
field: "duration",
|
|
646
|
+
value: e.duration,
|
|
647
|
+
defaultValue: 2,
|
|
648
|
+
min: 0
|
|
987
649
|
})), t.push(...validateOptionalNumber({
|
|
988
650
|
normalized: n,
|
|
989
651
|
field: "minDistanceToTarget",
|
|
@@ -1084,7 +746,7 @@ function viewLock(e = {}) {
|
|
|
1084
746
|
};
|
|
1085
747
|
}
|
|
1086
748
|
//#endregion
|
|
1087
|
-
//#region
|
|
749
|
+
//#region api/camera/cameraApi.js
|
|
1088
750
|
var validator$10 = {
|
|
1089
751
|
flyTo,
|
|
1090
752
|
focusToID,
|
|
@@ -1109,7 +771,7 @@ var validator$10 = {
|
|
|
1109
771
|
}
|
|
1110
772
|
};
|
|
1111
773
|
//#endregion
|
|
1112
|
-
//#region
|
|
774
|
+
//#region api/marker/iconMarkerValidate.js
|
|
1113
775
|
function normalizeEmptyArray(e) {
|
|
1114
776
|
return Array.isArray(e) && e.length === 0 ? void 0 : e;
|
|
1115
777
|
}
|
|
@@ -1678,7 +1340,29 @@ function validatePopupCustom1Config(e, t) {
|
|
|
1678
1340
|
})) : e.dataTexts = [];
|
|
1679
1341
|
}
|
|
1680
1342
|
//#endregion
|
|
1681
|
-
//#region
|
|
1343
|
+
//#region api/marker/validate.js
|
|
1344
|
+
var DEFAULT_VISIBLE_RANGE = [0, 2147483647];
|
|
1345
|
+
function validateVisibleRange(e, t, n, r = "visibleRange") {
|
|
1346
|
+
n.push(...validateOptionalArray({
|
|
1347
|
+
normalized: t,
|
|
1348
|
+
field: r,
|
|
1349
|
+
value: e[r],
|
|
1350
|
+
length: 2,
|
|
1351
|
+
defaultValue: [...DEFAULT_VISIBLE_RANGE]
|
|
1352
|
+
}));
|
|
1353
|
+
let i = t[r];
|
|
1354
|
+
if (!Array.isArray(i) || i.length !== 2) return;
|
|
1355
|
+
let a = Number(i[0]), o = Number(i[1]);
|
|
1356
|
+
if (!Number.isFinite(a) || !Number.isFinite(o)) {
|
|
1357
|
+
n.push(`[${r}]元素必须是数字`);
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
if (a > o) {
|
|
1361
|
+
n.push(`[${r}]最小值不能大于最大值`);
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
t[r] = [a, o];
|
|
1365
|
+
}
|
|
1682
1366
|
var MARKER_TYPE_LIST = [
|
|
1683
1367
|
"default",
|
|
1684
1368
|
"default1",
|
|
@@ -1706,13 +1390,7 @@ function iconMarker(e) {
|
|
|
1706
1390
|
normalized: n,
|
|
1707
1391
|
field: "groupId",
|
|
1708
1392
|
value: e.groupId
|
|
1709
|
-
})), t.push(...
|
|
1710
|
-
normalized: n,
|
|
1711
|
-
field: "visibleRange",
|
|
1712
|
-
value: e.visibleRange,
|
|
1713
|
-
length: 2,
|
|
1714
|
-
defaultValue: [0, 2147483647]
|
|
1715
|
-
})), t.push(...verifyEnumerationValue({
|
|
1393
|
+
})), validateVisibleRange(e, n, t), t.push(...verifyEnumerationValue({
|
|
1716
1394
|
normalized: n,
|
|
1717
1395
|
field: "isScreenSpace",
|
|
1718
1396
|
value: e.isScreenSpace,
|
|
@@ -1728,17 +1406,11 @@ function iconMarker(e) {
|
|
|
1728
1406
|
list: MARKER_TYPE_LIST
|
|
1729
1407
|
})), e.recordData !== void 0) {
|
|
1730
1408
|
let r = e.recordData;
|
|
1731
|
-
if (typeof r != "object" || !r || Array.isArray(r)) t.push(
|
|
1732
|
-
field: "recordData",
|
|
1733
|
-
message: "[recordData] 必须是对象类型"
|
|
1734
|
-
});
|
|
1409
|
+
if (typeof r != "object" || !r || Array.isArray(r)) t.push("[recordData] 必须是对象类型");
|
|
1735
1410
|
else try {
|
|
1736
1411
|
n.recordData = JSON.stringify(r);
|
|
1737
1412
|
} catch {
|
|
1738
|
-
t.push(
|
|
1739
|
-
field: "recordData",
|
|
1740
|
-
message: "[recordData] 序列化失败,请检查是否包含循环引用"
|
|
1741
|
-
});
|
|
1413
|
+
t.push("[recordData] 序列化失败,请检查是否包含循环引用");
|
|
1742
1414
|
}
|
|
1743
1415
|
}
|
|
1744
1416
|
return validateConfigByMarkerType(n, t), {
|
|
@@ -1756,13 +1428,7 @@ function followMarker(e) {
|
|
|
1756
1428
|
normalized: n,
|
|
1757
1429
|
field: "groupId",
|
|
1758
1430
|
value: e.groupId
|
|
1759
|
-
})), t.push(...
|
|
1760
|
-
normalized: n,
|
|
1761
|
-
field: "visibleRange",
|
|
1762
|
-
value: e.visibleRange,
|
|
1763
|
-
length: 2,
|
|
1764
|
-
defaultValue: [0, 2147483647]
|
|
1765
|
-
})), t.push(...verifyEnumerationValue({
|
|
1431
|
+
})), validateVisibleRange(e, n, t), t.push(...verifyEnumerationValue({
|
|
1766
1432
|
normalized: n,
|
|
1767
1433
|
field: "isScreenSpace",
|
|
1768
1434
|
value: e.isScreenSpace,
|
|
@@ -1778,17 +1444,11 @@ function followMarker(e) {
|
|
|
1778
1444
|
list: MARKER_TYPE_LIST
|
|
1779
1445
|
})), e.recordData !== void 0) {
|
|
1780
1446
|
let r = e.recordData;
|
|
1781
|
-
if (typeof r != "object" || !r || Array.isArray(r)) t.push(
|
|
1782
|
-
field: "recordData",
|
|
1783
|
-
message: "[recordData] 必须是对象类型"
|
|
1784
|
-
});
|
|
1447
|
+
if (typeof r != "object" || !r || Array.isArray(r)) t.push("[recordData] 必须是对象类型");
|
|
1785
1448
|
else try {
|
|
1786
1449
|
n.recordData = JSON.stringify(r);
|
|
1787
1450
|
} catch {
|
|
1788
|
-
t.push(
|
|
1789
|
-
field: "recordData",
|
|
1790
|
-
message: "[recordData] 序列化失败,请检查是否包含循环引用"
|
|
1791
|
-
});
|
|
1451
|
+
t.push("[recordData] 序列化失败,请检查是否包含循环引用");
|
|
1792
1452
|
}
|
|
1793
1453
|
}
|
|
1794
1454
|
return validateConfigByMarkerType(n, t), {
|
|
@@ -1935,23 +1595,14 @@ function secondMarker(e) {
|
|
|
1935
1595
|
normalized: n,
|
|
1936
1596
|
field: "groupId",
|
|
1937
1597
|
value: e.groupId
|
|
1938
|
-
})), t.push(...
|
|
1939
|
-
normalized: n,
|
|
1940
|
-
field: "visibleRange",
|
|
1941
|
-
value: e.visibleRange,
|
|
1942
|
-
length: 2,
|
|
1943
|
-
defaultValue: [0, 2147483647]
|
|
1944
|
-
})), t.push(...verifyEnumerationValue({
|
|
1598
|
+
})), validateVisibleRange(e, n, t), t.push(...verifyEnumerationValue({
|
|
1945
1599
|
normalized: n,
|
|
1946
1600
|
field: "isScreenSpace",
|
|
1947
1601
|
value: e.isScreenSpace,
|
|
1948
1602
|
defaultValue: 1,
|
|
1949
1603
|
type: "number",
|
|
1950
1604
|
list: [0, 1]
|
|
1951
|
-
})), typeof e.isInitSecond == "boolean" ? n.isInitSecond = e.isInitSecond : e.isInitSecond === void 0 ? n.isInitSecond = !1 : t.push({
|
|
1952
|
-
field: "isInitSecond",
|
|
1953
|
-
message: "isInitSecond must be boolean"
|
|
1954
|
-
}), t.push(...verifyEnumerationValue({
|
|
1605
|
+
})), typeof e.isInitSecond == "boolean" ? n.isInitSecond = e.isInitSecond : e.isInitSecond === void 0 ? n.isInitSecond = !1 : t.push("[isInitSecond]必须是布尔类型"), t.push(...verifyEnumerationValue({
|
|
1955
1606
|
normalized: n,
|
|
1956
1607
|
field: "triggerType",
|
|
1957
1608
|
value: e.triggerType,
|
|
@@ -1986,17 +1637,11 @@ function secondMarker(e) {
|
|
|
1986
1637
|
value: e.value ?? ""
|
|
1987
1638
|
})) : r.dataTexts = []), e.recordData !== void 0) {
|
|
1988
1639
|
let r = e.recordData;
|
|
1989
|
-
if (typeof r != "object" || !r || Array.isArray(r)) t.push(
|
|
1990
|
-
field: "recordData",
|
|
1991
|
-
message: "[recordData] 必须是对象类型"
|
|
1992
|
-
});
|
|
1640
|
+
if (typeof r != "object" || !r || Array.isArray(r)) t.push("[recordData] 必须是对象类型");
|
|
1993
1641
|
else try {
|
|
1994
1642
|
n.recordData = JSON.stringify(r);
|
|
1995
1643
|
} catch {
|
|
1996
|
-
t.push(
|
|
1997
|
-
field: "recordData",
|
|
1998
|
-
message: "[recordData] 序列化失败,请检查是否包含循环引用"
|
|
1999
|
-
});
|
|
1644
|
+
t.push("[recordData] 序列化失败,请检查是否包含循环引用");
|
|
2000
1645
|
}
|
|
2001
1646
|
}
|
|
2002
1647
|
return {
|
|
@@ -2005,7 +1650,7 @@ function secondMarker(e) {
|
|
|
2005
1650
|
};
|
|
2006
1651
|
}
|
|
2007
1652
|
//#endregion
|
|
2008
|
-
//#region
|
|
1653
|
+
//#region api/marker/markerApi.js
|
|
2009
1654
|
var validator$9 = {
|
|
2010
1655
|
iconMarker,
|
|
2011
1656
|
followMarker,
|
|
@@ -2185,7 +1830,7 @@ function getList(e) {
|
|
|
2185
1830
|
};
|
|
2186
1831
|
}
|
|
2187
1832
|
//#endregion
|
|
2188
|
-
//#region
|
|
1833
|
+
//#region api/floodPeak/floodPeakApi.js
|
|
2189
1834
|
var validator$8 = {
|
|
2190
1835
|
getList,
|
|
2191
1836
|
record,
|
|
@@ -2307,7 +1952,7 @@ function onData(e = {}) {
|
|
|
2307
1952
|
};
|
|
2308
1953
|
}
|
|
2309
1954
|
//#endregion
|
|
2310
|
-
//#region
|
|
1955
|
+
//#region api/animation/animationApi.js
|
|
2311
1956
|
var validator$7 = {
|
|
2312
1957
|
play,
|
|
2313
1958
|
carryOn,
|
|
@@ -2329,7 +1974,7 @@ var validator$7 = {
|
|
|
2329
1974
|
}
|
|
2330
1975
|
};
|
|
2331
1976
|
//#endregion
|
|
2332
|
-
//#region
|
|
1977
|
+
//#region api/hydrodynamicForce/validate.js
|
|
2333
1978
|
function create$1(e) {
|
|
2334
1979
|
let t = [], n = { ...e };
|
|
2335
1980
|
return t.push(...validateRequiredNumber({
|
|
@@ -2511,7 +2156,7 @@ function close$1(e) {
|
|
|
2511
2156
|
};
|
|
2512
2157
|
}
|
|
2513
2158
|
//#endregion
|
|
2514
|
-
//#region
|
|
2159
|
+
//#region api/hydrodynamicForce/hydrodynamicForceApi.js
|
|
2515
2160
|
var validator$6 = {
|
|
2516
2161
|
create: create$1,
|
|
2517
2162
|
waterFlow,
|
|
@@ -2904,7 +2549,7 @@ function closeAllSlice(e = {}) {
|
|
|
2904
2549
|
};
|
|
2905
2550
|
}
|
|
2906
2551
|
//#endregion
|
|
2907
|
-
//#region
|
|
2552
|
+
//#region api/sceneModel/sceneModelApi.js
|
|
2908
2553
|
var validator$5 = {
|
|
2909
2554
|
getById,
|
|
2910
2555
|
getByTag,
|
|
@@ -2937,7 +2582,7 @@ var validator$5 = {
|
|
|
2937
2582
|
}
|
|
2938
2583
|
};
|
|
2939
2584
|
//#endregion
|
|
2940
|
-
//#region
|
|
2585
|
+
//#region api/atmosphericEffects/validate.js
|
|
2941
2586
|
function time(e) {
|
|
2942
2587
|
let t = [], n = { ...e };
|
|
2943
2588
|
return t.push(...validateRequiredNumber({
|
|
@@ -2959,7 +2604,7 @@ function weather(e) {
|
|
|
2959
2604
|
};
|
|
2960
2605
|
}
|
|
2961
2606
|
//#endregion
|
|
2962
|
-
//#region
|
|
2607
|
+
//#region api/atmosphericEffects/atmosphericEffectsApi.js
|
|
2963
2608
|
var validator$4 = {
|
|
2964
2609
|
time,
|
|
2965
2610
|
weather
|
|
@@ -2976,7 +2621,7 @@ var validator$4 = {
|
|
|
2976
2621
|
}
|
|
2977
2622
|
};
|
|
2978
2623
|
//#endregion
|
|
2979
|
-
//#region
|
|
2624
|
+
//#region api/tool/validate.js
|
|
2980
2625
|
function onMouseClick$1(e) {
|
|
2981
2626
|
let t = [], n = { ...e };
|
|
2982
2627
|
return t.push(...verifyEnumerationValue({
|
|
@@ -3032,7 +2677,7 @@ function editConfigFile(e) {
|
|
|
3032
2677
|
};
|
|
3033
2678
|
}
|
|
3034
2679
|
//#endregion
|
|
3035
|
-
//#region
|
|
2680
|
+
//#region api/tool/toolApi.js
|
|
3036
2681
|
var validator$3 = {
|
|
3037
2682
|
onMouseClick: onMouseClick$1,
|
|
3038
2683
|
offMouseClick: offMouseClick$1,
|
|
@@ -3052,7 +2697,7 @@ var validator$3 = {
|
|
|
3052
2697
|
}
|
|
3053
2698
|
};
|
|
3054
2699
|
//#endregion
|
|
3055
|
-
//#region
|
|
2700
|
+
//#region api/line/validate.js
|
|
3056
2701
|
function generateUniqueId() {
|
|
3057
2702
|
return "line_" + Date.now() + "_" + Math.random().toString(36).substring(2, 9);
|
|
3058
2703
|
}
|
|
@@ -3147,7 +2792,7 @@ function clearAllLine(e) {
|
|
|
3147
2792
|
};
|
|
3148
2793
|
}
|
|
3149
2794
|
//#endregion
|
|
3150
|
-
//#region
|
|
2795
|
+
//#region api/line/lineApi.js
|
|
3151
2796
|
var validator$2 = {
|
|
3152
2797
|
addLine,
|
|
3153
2798
|
clearLine,
|
|
@@ -3165,7 +2810,7 @@ var validator$2 = {
|
|
|
3165
2810
|
}
|
|
3166
2811
|
};
|
|
3167
2812
|
//#endregion
|
|
3168
|
-
//#region
|
|
2813
|
+
//#region api/level/validate.js
|
|
3169
2814
|
function switchLevel(e) {
|
|
3170
2815
|
let t = [], n = { ...e };
|
|
3171
2816
|
return t.push(...validateRequiredString({
|
|
@@ -3178,7 +2823,7 @@ function switchLevel(e) {
|
|
|
3178
2823
|
};
|
|
3179
2824
|
}
|
|
3180
2825
|
//#endregion
|
|
3181
|
-
//#region
|
|
2826
|
+
//#region api/level/levelApi.js
|
|
3182
2827
|
var validator$1 = { switch: switchLevel }, LevelApi = class {
|
|
3183
2828
|
constructor(e) {
|
|
3184
2829
|
this.commandManager = e;
|
|
@@ -3192,7 +2837,7 @@ var validator$1 = { switch: switchLevel }, LevelApi = class {
|
|
|
3192
2837
|
}
|
|
3193
2838
|
};
|
|
3194
2839
|
//#endregion
|
|
3195
|
-
//#region
|
|
2840
|
+
//#region api/vtk/validate.js
|
|
3196
2841
|
function getInfo(e = {}) {
|
|
3197
2842
|
let t = [], n = { ...e };
|
|
3198
2843
|
return t.push(...validateRequiredString({
|
|
@@ -3584,7 +3229,7 @@ function clearAllSequence(e = {}) {
|
|
|
3584
3229
|
};
|
|
3585
3230
|
}
|
|
3586
3231
|
//#endregion
|
|
3587
|
-
//#region
|
|
3232
|
+
//#region api/vtk/vtkApi.js
|
|
3588
3233
|
var validator = {
|
|
3589
3234
|
getInfo,
|
|
3590
3235
|
getFieldRange,
|
|
@@ -3617,7 +3262,16 @@ var validator = {
|
|
|
3617
3262
|
};
|
|
3618
3263
|
return this.commandManager.sendWithDefault(i, n, { timeout: 0 });
|
|
3619
3264
|
}
|
|
3620
|
-
},
|
|
3265
|
+
}, ueLogEnabled = !0;
|
|
3266
|
+
function setUELogEnabled(e) {
|
|
3267
|
+
ueLogEnabled = !!e;
|
|
3268
|
+
}
|
|
3269
|
+
function log(...e) {
|
|
3270
|
+
ueLogEnabled && console.log(...e);
|
|
3271
|
+
}
|
|
3272
|
+
//#endregion
|
|
3273
|
+
//#region api/other/otherApi.js
|
|
3274
|
+
var OtherApi = class {
|
|
3621
3275
|
constructor(e) {
|
|
3622
3276
|
this.commandManager = e;
|
|
3623
3277
|
}
|
|
@@ -3676,14 +3330,226 @@ var validator = {
|
|
|
3676
3330
|
async arrow(e, t) {
|
|
3677
3331
|
return this._otherApi._handleSend(`arrow.${e}`, t);
|
|
3678
3332
|
}
|
|
3679
|
-
async VTKLS(e, t) {
|
|
3680
|
-
return this._otherApi._handleSend(`VTK.${e}`, t);
|
|
3333
|
+
async VTKLS(e, t) {
|
|
3334
|
+
return this._otherApi._handleSend(`VTK.${e}`, t);
|
|
3335
|
+
}
|
|
3336
|
+
async NC(e, t) {
|
|
3337
|
+
return this._otherApi._handleSend(`NC.${e}`, t);
|
|
3338
|
+
}
|
|
3339
|
+
async gateOperation(e, t) {
|
|
3340
|
+
return this._otherApi._handleSend(`gateOperation.${e}`, t);
|
|
3341
|
+
}
|
|
3342
|
+
};
|
|
3343
|
+
//#endregion
|
|
3344
|
+
//#region baseConfig/responses.js
|
|
3345
|
+
function normalizeMessageList(e) {
|
|
3346
|
+
return (Array.isArray(e) ? e : [e]).map((e) => {
|
|
3347
|
+
if (typeof e == "string") return e;
|
|
3348
|
+
if (e && typeof e == "object") {
|
|
3349
|
+
if (typeof e.message == "string" && e.message) return e.message;
|
|
3350
|
+
try {
|
|
3351
|
+
return JSON.stringify(e);
|
|
3352
|
+
} catch {
|
|
3353
|
+
return String(e);
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
return e == null ? "" : String(e);
|
|
3357
|
+
}).filter((e) => e !== "");
|
|
3358
|
+
}
|
|
3359
|
+
function createSuccessResponse(e, t, n) {
|
|
3360
|
+
return {
|
|
3361
|
+
success: !0,
|
|
3362
|
+
message: e,
|
|
3363
|
+
data: t,
|
|
3364
|
+
command: n
|
|
3365
|
+
};
|
|
3366
|
+
}
|
|
3367
|
+
function createErrorResponse(e, t, n) {
|
|
3368
|
+
let r = {
|
|
3369
|
+
success: !1,
|
|
3370
|
+
message: normalizeMessageList(e),
|
|
3371
|
+
params: t,
|
|
3372
|
+
command: n
|
|
3373
|
+
};
|
|
3374
|
+
return console.error("三维场景报错:", r), r;
|
|
3375
|
+
}
|
|
3376
|
+
function createWarnResponse(e, t, n) {
|
|
3377
|
+
let r = {
|
|
3378
|
+
success: !1,
|
|
3379
|
+
message: normalizeMessageList(e),
|
|
3380
|
+
params: t,
|
|
3381
|
+
command: n
|
|
3382
|
+
};
|
|
3383
|
+
return console.warn("三维场景警告:", r), r;
|
|
3384
|
+
}
|
|
3385
|
+
//#endregion
|
|
3386
|
+
//#region commFlow.js
|
|
3387
|
+
var CommandManager = class {
|
|
3388
|
+
constructor(e) {
|
|
3389
|
+
this.transport = e, this.callbacks = {}, this.requestId = 0, this.timeout = 3e3, this.markerEventCallbacks = {
|
|
3390
|
+
Hovered: {},
|
|
3391
|
+
Click: {},
|
|
3392
|
+
DoubleClick: {},
|
|
3393
|
+
Unhovered: {}
|
|
3394
|
+
}, this.secondMarkerEventCallbacks = {
|
|
3395
|
+
Hovered: {},
|
|
3396
|
+
Click: {},
|
|
3397
|
+
DoubleClick: {},
|
|
3398
|
+
Unhovered: {}
|
|
3399
|
+
}, this.followMarkerEventCallbacks = {
|
|
3400
|
+
Hovered: {},
|
|
3401
|
+
Click: {},
|
|
3402
|
+
DoubleClick: {},
|
|
3403
|
+
Unhovered: {}
|
|
3404
|
+
}, this.animationOnDataCallback = { Change: [] }, this.mouseClickCallback = { MouseClick: [] }, this.vtkMouseClickCallback = {}, e.bindMessageHandler((e) => {
|
|
3405
|
+
this._handleRawResponse(e);
|
|
3406
|
+
});
|
|
3407
|
+
}
|
|
3408
|
+
sendWithDefault(e, t, n = {}) {
|
|
3409
|
+
let r = this._sendPreparePayload(t, e.normalized || {});
|
|
3410
|
+
if (e.errors.length > 0) return createErrorResponse(e.errors, r, t);
|
|
3411
|
+
let i = (++this.requestId).toString(), a = n?.timeout === 0 ? 0 : this.timeout, o = new Promise((e, t) => {
|
|
3412
|
+
let n = null;
|
|
3413
|
+
a !== 0 && (n = setTimeout(() => {
|
|
3414
|
+
delete this.callbacks[i], t(/* @__PURE__ */ Error("Command timeout with no results"));
|
|
3415
|
+
}, a)), this.callbacks[i] = {
|
|
3416
|
+
resolve: e,
|
|
3417
|
+
reject: t,
|
|
3418
|
+
timeoutId: n
|
|
3419
|
+
};
|
|
3420
|
+
}), s = {
|
|
3421
|
+
command: t,
|
|
3422
|
+
requestId: i,
|
|
3423
|
+
params: r
|
|
3424
|
+
};
|
|
3425
|
+
return log("消息下发成功:", s), this.transport.sendTextToDataChannel(JSON.stringify(s)), o.then((e) => {
|
|
3426
|
+
if (e && e.command && e.command === t) switch (e.status) {
|
|
3427
|
+
case "info": return createSuccessResponse("操作执行成功", e.data, t);
|
|
3428
|
+
case "warn": return createWarnResponse(e.message, e.data, t);
|
|
3429
|
+
default: return createErrorResponse(e.message, e.data, t);
|
|
3430
|
+
}
|
|
3431
|
+
return createErrorResponse("返回数据格式错乱【请注意command参数】", e?.command, t);
|
|
3432
|
+
}).catch((e) => e && e.message ? e.message === "Command timeout with no results" ? createWarnResponse(e.message, r, t) : createErrorResponse(e.message, r, t) : createErrorResponse("数据返回发生错误", r, t));
|
|
3433
|
+
}
|
|
3434
|
+
_handleRawResponse(e) {
|
|
3435
|
+
if (!e) return console.error("数据第一步解析失败:", e), null;
|
|
3436
|
+
let t;
|
|
3437
|
+
try {
|
|
3438
|
+
let n = JSON.parse(String(e).trim());
|
|
3439
|
+
if (t = {
|
|
3440
|
+
command: n.command || "",
|
|
3441
|
+
message: n.message || "",
|
|
3442
|
+
data: n.data || {},
|
|
3443
|
+
status: n.status || "error",
|
|
3444
|
+
requestId: n.requestId || ""
|
|
3445
|
+
}, t.message === "The data channel has been connected." || t.message === "The level has been initialized") return null;
|
|
3446
|
+
} catch {
|
|
3447
|
+
return console.error("数据第二步解析失败:", e), null;
|
|
3448
|
+
}
|
|
3449
|
+
if (this._processEventResponse(t)) return;
|
|
3450
|
+
let { command: n, message: r, data: i, status: a, requestId: o } = t;
|
|
3451
|
+
if (o && this.callbacks[o]) {
|
|
3452
|
+
let { resolve: e, timeoutId: t } = this.callbacks[o];
|
|
3453
|
+
clearTimeout(t), delete this.callbacks[o], e({
|
|
3454
|
+
command: n,
|
|
3455
|
+
message: r,
|
|
3456
|
+
data: i,
|
|
3457
|
+
status: a
|
|
3458
|
+
});
|
|
3459
|
+
return;
|
|
3460
|
+
}
|
|
3461
|
+
console.warn("注意:非常规响应", t);
|
|
3462
|
+
}
|
|
3463
|
+
_sendPreparePayload(e, t) {
|
|
3464
|
+
if (e === "marker.iconMarker" || e === "marker.iconUrlMarker") {
|
|
3465
|
+
let { onMarkerClick: e, onMarkerDoubleClick: n, onMarkerDblClick: r, onMouseHover: i, onMouseLeave: a, ...o } = t || {}, s = n || r, c = o?.id;
|
|
3466
|
+
return c != null && c !== "" ? (typeof i == "function" && (this.markerEventCallbacks.Hovered[c] = i), typeof e == "function" && (this.markerEventCallbacks.Click[c] = e), typeof s == "function" && (this.markerEventCallbacks.DoubleClick[c] = s), typeof a == "function" && (this.markerEventCallbacks.Unhovered[c] = a)) : (typeof i == "function" && (this.markerEventCallbacks.Hovered.__default = i), typeof e == "function" && (this.markerEventCallbacks.Click.__default = e), typeof s == "function" && (this.markerEventCallbacks.DoubleClick.__default = s), typeof a == "function" && (this.markerEventCallbacks.Unhovered.__default = a)), o;
|
|
3467
|
+
}
|
|
3468
|
+
if (e === "marker.secondMarker") {
|
|
3469
|
+
let { onMarkerClick: e, onMarkerDoubleClick: n, onMarkerDblClick: r, onMouseHover: i, onMouseLeave: a, ...o } = t || {}, s = n || r, c = o?.id;
|
|
3470
|
+
return c != null && c !== "" ? (typeof i == "function" && (this.secondMarkerEventCallbacks.Hovered[c] = i), typeof e == "function" && (this.secondMarkerEventCallbacks.Click[c] = e), typeof s == "function" && (this.secondMarkerEventCallbacks.DoubleClick[c] = s), typeof a == "function" && (this.secondMarkerEventCallbacks.Unhovered[c] = a)) : (typeof i == "function" && (this.secondMarkerEventCallbacks.Hovered.__default = i), typeof e == "function" && (this.secondMarkerEventCallbacks.Click.__default = e), typeof s == "function" && (this.secondMarkerEventCallbacks.DoubleClick.__default = s), typeof a == "function" && (this.secondMarkerEventCallbacks.Unhovered.__default = a)), o;
|
|
3471
|
+
}
|
|
3472
|
+
if (e === "marker.followMarker") {
|
|
3473
|
+
let { onMarkerClick: e, onMarkerDoubleClick: n, onMarkerDblClick: r, onMouseHover: i, onMouseLeave: a, ...o } = t || {}, s = n || r, c = o?.id;
|
|
3474
|
+
return c != null && c !== "" ? (typeof i == "function" && (this.followMarkerEventCallbacks.Hovered[c] = i), typeof e == "function" && (this.followMarkerEventCallbacks.Click[c] = e), typeof s == "function" && (this.followMarkerEventCallbacks.DoubleClick[c] = s), typeof a == "function" && (this.followMarkerEventCallbacks.Unhovered[c] = a)) : (typeof i == "function" && (this.followMarkerEventCallbacks.Hovered.__default = i), typeof e == "function" && (this.followMarkerEventCallbacks.Click.__default = e), typeof s == "function" && (this.followMarkerEventCallbacks.DoubleClick.__default = s), typeof a == "function" && (this.followMarkerEventCallbacks.Unhovered.__default = a)), o;
|
|
3475
|
+
}
|
|
3476
|
+
if (e === "tool.onMouseClick") {
|
|
3477
|
+
let { onMouseClick: e, ...n } = t || {};
|
|
3478
|
+
return typeof e == "function" && (Array.isArray(this.mouseClickCallback.MouseClick) || (this.mouseClickCallback.MouseClick = []), this.mouseClickCallback.MouseClick.includes(e) || this.mouseClickCallback.MouseClick.push(e)), n;
|
|
3479
|
+
}
|
|
3480
|
+
if (e === "VTK.onMouseClick") {
|
|
3481
|
+
let { onMouseClick: e, ...n } = t || {}, r = n?.id;
|
|
3482
|
+
return r != null && r !== "" && typeof e == "function" && (this.vtkMouseClickCallback[r] = e), n;
|
|
3483
|
+
}
|
|
3484
|
+
if (e === "VTK.offMouseClick") {
|
|
3485
|
+
let e = t?.id;
|
|
3486
|
+
return e != null && e !== "" && delete this.vtkMouseClickCallback[e], t;
|
|
3487
|
+
}
|
|
3488
|
+
if (e === "animation.onData") {
|
|
3489
|
+
let { onChange: e, ...n } = t || {};
|
|
3490
|
+
return typeof e == "function" && (Array.isArray(this.animationOnDataCallback.Change) || (this.animationOnDataCallback.Change = []), this.animationOnDataCallback.Change.includes(e) || this.animationOnDataCallback.Change.push(e)), n;
|
|
3491
|
+
}
|
|
3492
|
+
return t;
|
|
3493
|
+
}
|
|
3494
|
+
_processEventResponse(e) {
|
|
3495
|
+
if (!e) return !1;
|
|
3496
|
+
let { command: t, data: n = {} } = e;
|
|
3497
|
+
if (t === "marker.iconMarker" || t === "marker.iconUrlMarker") {
|
|
3498
|
+
if (typeof n.recordData == "string") try {
|
|
3499
|
+
n.recordData = JSON.parse(n.recordData);
|
|
3500
|
+
} catch {}
|
|
3501
|
+
let { pointId: e, eventType: r } = n;
|
|
3502
|
+
if (!(r && this.markerEventCallbacks)) return !1;
|
|
3503
|
+
let i = this.markerEventCallbacks[r], a = i?.[e] || i?.__default;
|
|
3504
|
+
return this._executeCallback(a, t, n);
|
|
3505
|
+
}
|
|
3506
|
+
if (t === "marker.secondMarker") {
|
|
3507
|
+
if (typeof n.recordData == "string") try {
|
|
3508
|
+
n.recordData = JSON.parse(n.recordData);
|
|
3509
|
+
} catch {}
|
|
3510
|
+
let { pointId: e, eventType: r } = n;
|
|
3511
|
+
if (!(r && this.secondMarkerEventCallbacks)) return !1;
|
|
3512
|
+
let i = this.secondMarkerEventCallbacks[r], a = i?.[e] || i?.__default;
|
|
3513
|
+
return this._executeCallback(a, t, n);
|
|
3514
|
+
}
|
|
3515
|
+
if (t === "marker.followMarker") {
|
|
3516
|
+
if (typeof n.recordData == "string") try {
|
|
3517
|
+
n.recordData = JSON.parse(n.recordData);
|
|
3518
|
+
} catch {}
|
|
3519
|
+
let { pointId: e, eventType: r } = n;
|
|
3520
|
+
if (!(r && this.followMarkerEventCallbacks)) return !1;
|
|
3521
|
+
let i = this.followMarkerEventCallbacks[r], a = i?.[e] || i?.__default;
|
|
3522
|
+
return this._executeCallback(a, t, n);
|
|
3523
|
+
}
|
|
3524
|
+
if (t === "tool.onMouseClick") {
|
|
3525
|
+
let { coordinates: e } = n;
|
|
3526
|
+
if (!(e && this.mouseClickCallback)) return !1;
|
|
3527
|
+
let r = this.mouseClickCallback.MouseClick;
|
|
3528
|
+
return this._executeCallbacks(r, t, n);
|
|
3529
|
+
}
|
|
3530
|
+
if (t === "VTK.onMouseClick") {
|
|
3531
|
+
if (!this.vtkMouseClickCallback || !Object.keys(this.vtkMouseClickCallback).length) return !1;
|
|
3532
|
+
let e = n?.id, r = e ? this.vtkMouseClickCallback[e] : null;
|
|
3533
|
+
return r ? this._executeCallback(r, t, n) : this._executeCallbacks(Object.values(this.vtkMouseClickCallback), t, n);
|
|
3534
|
+
}
|
|
3535
|
+
if (t === "animation.onData") {
|
|
3536
|
+
let { type: e } = n;
|
|
3537
|
+
if (!(e && this.animationOnDataCallback)) return !1;
|
|
3538
|
+
let r = this.animationOnDataCallback.Change;
|
|
3539
|
+
return this._executeCallbacks(r, t, n);
|
|
3540
|
+
}
|
|
3541
|
+
return !1;
|
|
3681
3542
|
}
|
|
3682
|
-
|
|
3683
|
-
return
|
|
3543
|
+
_executeCallback(e, t, n) {
|
|
3544
|
+
if (typeof e != "function") return log(`${t}未监听:${n.eventType}`), !0;
|
|
3545
|
+
try {
|
|
3546
|
+
return e(n), !0;
|
|
3547
|
+
} catch (e) {
|
|
3548
|
+
return console.error(`执行${t}回调出错:`, e, n), !0;
|
|
3549
|
+
}
|
|
3684
3550
|
}
|
|
3685
|
-
|
|
3686
|
-
return this.
|
|
3551
|
+
_executeCallbacks(e, t, n) {
|
|
3552
|
+
return e ? Array.isArray(e) ? (e.forEach((e) => this._executeCallback(e, t, n)), !0) : this._executeCallback(e, t, n) : !1;
|
|
3687
3553
|
}
|
|
3688
3554
|
}, require_larksr_web_sdk_min = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3689
3555
|
(function(e, t) {
|
|
@@ -24283,38 +24149,7 @@ var validator = {
|
|
|
24283
24149
|
}(), __webpack_exports__ = __webpack_exports__.default, __webpack_exports__;
|
|
24284
24150
|
}();
|
|
24285
24151
|
}));
|
|
24286
|
-
})), import_larksr_web_sdk_min = require_larksr_web_sdk_min()
|
|
24287
|
-
function createLarkSRTransport(e) {
|
|
24288
|
-
return {
|
|
24289
|
-
sendTextToDataChannel(t) {
|
|
24290
|
-
e.sendTextToDataChannel(t);
|
|
24291
|
-
},
|
|
24292
|
-
bindMessageHandler(t) {
|
|
24293
|
-
e.on("datachanneltext", (e) => {
|
|
24294
|
-
e?.type === "datachanneltext" && typeof e.data == "string" && t(e.data);
|
|
24295
|
-
});
|
|
24296
|
-
}
|
|
24297
|
-
};
|
|
24298
|
-
}
|
|
24299
|
-
function createZsStreamTransport(e) {
|
|
24300
|
-
return {
|
|
24301
|
-
sendTextToDataChannel(t) {
|
|
24302
|
-
e.sendTextToDataChannel(t);
|
|
24303
|
-
},
|
|
24304
|
-
bindMessageHandler(t) {
|
|
24305
|
-
e.on("message", (e) => {
|
|
24306
|
-
if (typeof e == "string") {
|
|
24307
|
-
t(e);
|
|
24308
|
-
return;
|
|
24309
|
-
}
|
|
24310
|
-
e != null && t(JSON.stringify(e));
|
|
24311
|
-
});
|
|
24312
|
-
}
|
|
24313
|
-
};
|
|
24314
|
-
}
|
|
24315
|
-
//#endregion
|
|
24316
|
-
//#region linkFlowLarkSR.js
|
|
24317
|
-
var LoadStream = class {
|
|
24152
|
+
})), import_larksr_web_sdk_min = require_larksr_web_sdk_min(), LoadStream = class {
|
|
24318
24153
|
constructor() {
|
|
24319
24154
|
this._gameApi = null, this._larksr = null;
|
|
24320
24155
|
}
|
|
@@ -24375,7 +24210,16 @@ var LoadStream = class {
|
|
|
24375
24210
|
}
|
|
24376
24211
|
init(e) {
|
|
24377
24212
|
try {
|
|
24378
|
-
let t = new CommandManager(
|
|
24213
|
+
let t = new CommandManager({
|
|
24214
|
+
sendTextToDataChannel(t) {
|
|
24215
|
+
e.sendTextToDataChannel(t);
|
|
24216
|
+
},
|
|
24217
|
+
bindMessageHandler(t) {
|
|
24218
|
+
e.on("datachanneltext", (e) => {
|
|
24219
|
+
e?.type === "datachanneltext" && typeof e.data == "string" && t(e.data);
|
|
24220
|
+
});
|
|
24221
|
+
}
|
|
24222
|
+
});
|
|
24379
24223
|
return this._gameApi = new GameAPI(t), console.log(`插件初始化成功 [web3dlink@${version}]`), this._gameApi;
|
|
24380
24224
|
} catch (e) {
|
|
24381
24225
|
throw console.error("插件初始化失败", e), e;
|
|
@@ -24392,10 +24236,160 @@ var LoadStream = class {
|
|
|
24392
24236
|
getLarkSR() {
|
|
24393
24237
|
return this._larksr;
|
|
24394
24238
|
}
|
|
24395
|
-
}, loadStream = new LoadStream(),
|
|
24239
|
+
}, loadStream = new LoadStream(), createAndInitLarkSR = LoadStream.createAndInitLarkSR.bind(LoadStream);
|
|
24240
|
+
function closeGameApi() {
|
|
24241
|
+
return loadStream.close();
|
|
24242
|
+
}
|
|
24243
|
+
function getLarkSR() {
|
|
24244
|
+
return loadStream.getLarkSR();
|
|
24245
|
+
}
|
|
24246
|
+
//#endregion
|
|
24247
|
+
//#region zs-stream-parent.js
|
|
24248
|
+
(function(e) {
|
|
24249
|
+
let t = "zs-stream-parent", n = "zs-stream-embed";
|
|
24250
|
+
function r(e) {
|
|
24251
|
+
return e ? typeof e == "string" ? document.querySelector(e) : e : null;
|
|
24252
|
+
}
|
|
24253
|
+
function i(e, t, n) {
|
|
24254
|
+
let r = (e || "").replace(/\/+$/, "") || (typeof location < "u" ? location.origin : ""), i = new URLSearchParams({
|
|
24255
|
+
template: t || "default",
|
|
24256
|
+
autoconnect: "1",
|
|
24257
|
+
muted: "1"
|
|
24258
|
+
});
|
|
24259
|
+
return n && i.set("streamId", n), `${r}/embed?${i.toString()}`;
|
|
24260
|
+
}
|
|
24261
|
+
function a(e, n, r) {
|
|
24262
|
+
return e?.contentWindow ? (e.contentWindow.postMessage({
|
|
24263
|
+
source: t,
|
|
24264
|
+
streamId: n,
|
|
24265
|
+
...r
|
|
24266
|
+
}, "*"), { ok: !0 }) : {
|
|
24267
|
+
ok: !1,
|
|
24268
|
+
error: "iframe 未就绪"
|
|
24269
|
+
};
|
|
24270
|
+
}
|
|
24271
|
+
class o {
|
|
24272
|
+
constructor({ streamId: t, template: n, container: i, baseUrl: a } = {}) {
|
|
24273
|
+
if (!t) throw Error("ZsStream: streamId 必填(同页多路时用于区分)");
|
|
24274
|
+
this.streamId = t, this.template = n || "default", this.baseUrl = a, this.container = r(i), this.iframe = null, this._handlers = /* @__PURE__ */ new Map(), this._ready = !1, this._inputReady = !1, this._onMessage = this._onMessage.bind(this), e.addEventListener("message", this._onMessage), this._mountIframe();
|
|
24275
|
+
}
|
|
24276
|
+
_mountIframe() {
|
|
24277
|
+
if (!this.container) throw Error("ZsStream: container 未找到");
|
|
24278
|
+
let e = document.createElement("iframe");
|
|
24279
|
+
e.src = i(this.baseUrl, this.template, this.streamId), e.style.width = "100%", e.style.height = "100%", e.style.border = "0", e.setAttribute("allow", "autoplay; fullscreen; encrypted-media"), e.title = `ZS Stream ${this.streamId}`, this.container.innerHTML = "", this.container.appendChild(e), this.iframe = e;
|
|
24280
|
+
}
|
|
24281
|
+
_onMessage(e) {
|
|
24282
|
+
let t = e.data;
|
|
24283
|
+
if (!t || t.source !== n || t.streamId && t.streamId !== this.streamId || t.type !== "event") return;
|
|
24284
|
+
let r = t.event;
|
|
24285
|
+
r === "ready" && (this._ready = !0), r === "inputready" && (this._inputReady = !0), this._emit(r, t.data);
|
|
24286
|
+
}
|
|
24287
|
+
_emit(e, t) {
|
|
24288
|
+
let n = this._handlers.get(e);
|
|
24289
|
+
if (n) for (let e of n) try {
|
|
24290
|
+
e(t);
|
|
24291
|
+
} catch (e) {
|
|
24292
|
+
console.error("[ZsStream]", e);
|
|
24293
|
+
}
|
|
24294
|
+
}
|
|
24295
|
+
on(e, t) {
|
|
24296
|
+
return this._handlers.has(e) || this._handlers.set(e, /* @__PURE__ */ new Set()), this._handlers.get(e).add(t), () => this.off(e, t);
|
|
24297
|
+
}
|
|
24298
|
+
off(e, t) {
|
|
24299
|
+
this._handlers.get(e)?.delete(t);
|
|
24300
|
+
}
|
|
24301
|
+
_send(e, t) {
|
|
24302
|
+
return a(this.iframe, this.streamId, {
|
|
24303
|
+
type: e,
|
|
24304
|
+
...t
|
|
24305
|
+
});
|
|
24306
|
+
}
|
|
24307
|
+
invoke(e, t, n) {
|
|
24308
|
+
return this._send("invoke", {
|
|
24309
|
+
module: e,
|
|
24310
|
+
action: t,
|
|
24311
|
+
params: n ?? {}
|
|
24312
|
+
});
|
|
24313
|
+
}
|
|
24314
|
+
camera(e, t) {
|
|
24315
|
+
return this._send("camera", {
|
|
24316
|
+
action: e,
|
|
24317
|
+
params: t ?? {}
|
|
24318
|
+
});
|
|
24319
|
+
}
|
|
24320
|
+
sendRaw(e) {
|
|
24321
|
+
return this._send("sendRaw", { descriptor: String(e) });
|
|
24322
|
+
}
|
|
24323
|
+
sendCommand(e, t) {
|
|
24324
|
+
return this._send("larkCommand", {
|
|
24325
|
+
command: e,
|
|
24326
|
+
params: t ?? {}
|
|
24327
|
+
});
|
|
24328
|
+
}
|
|
24329
|
+
sendTextToDataChannel(e) {
|
|
24330
|
+
let t = typeof e == "string" ? e : JSON.stringify({
|
|
24331
|
+
command: e.command,
|
|
24332
|
+
params: e.params ?? {}
|
|
24333
|
+
});
|
|
24334
|
+
return this._send("sendRaw", { descriptor: t });
|
|
24335
|
+
}
|
|
24336
|
+
disconnect() {
|
|
24337
|
+
return this._send("disconnect", {});
|
|
24338
|
+
}
|
|
24339
|
+
destroy() {
|
|
24340
|
+
e.removeEventListener("message", this._onMessage), this.disconnect(), this.iframe?.parentNode && this.iframe.parentNode.removeChild(this.iframe), this.iframe = null, this._handlers.clear();
|
|
24341
|
+
}
|
|
24342
|
+
get isReady() {
|
|
24343
|
+
return this._ready;
|
|
24344
|
+
}
|
|
24345
|
+
get isInputReady() {
|
|
24346
|
+
return this._inputReady;
|
|
24347
|
+
}
|
|
24348
|
+
}
|
|
24349
|
+
class s {
|
|
24350
|
+
constructor() {
|
|
24351
|
+
this._streams = /* @__PURE__ */ new Map();
|
|
24352
|
+
}
|
|
24353
|
+
mount(e) {
|
|
24354
|
+
let t = e?.streamId;
|
|
24355
|
+
if (!t) throw Error("ZsStreamHub.mount: streamId 必填");
|
|
24356
|
+
this._streams.has(t) && this._streams.get(t).destroy();
|
|
24357
|
+
let n = new o(e);
|
|
24358
|
+
return this._streams.set(t, n), n;
|
|
24359
|
+
}
|
|
24360
|
+
get(e) {
|
|
24361
|
+
return this._streams.get(e) || null;
|
|
24362
|
+
}
|
|
24363
|
+
has(e) {
|
|
24364
|
+
return this._streams.has(e);
|
|
24365
|
+
}
|
|
24366
|
+
destroy(e) {
|
|
24367
|
+
let t = this._streams.get(e);
|
|
24368
|
+
t && (t.destroy(), this._streams.delete(e));
|
|
24369
|
+
}
|
|
24370
|
+
destroyAll() {
|
|
24371
|
+
for (let e of [...this._streams.keys()]) this.destroy(e);
|
|
24372
|
+
}
|
|
24373
|
+
list() {
|
|
24374
|
+
return [...this._streams.keys()];
|
|
24375
|
+
}
|
|
24376
|
+
}
|
|
24377
|
+
e.ZsStream = {
|
|
24378
|
+
mount(e) {
|
|
24379
|
+
return new o(e);
|
|
24380
|
+
},
|
|
24381
|
+
Hub: s,
|
|
24382
|
+
buildEmbedSrc: i,
|
|
24383
|
+
MSG_SOURCE_PARENT: t,
|
|
24384
|
+
MSG_SOURCE_EMBED: n
|
|
24385
|
+
}, e.ZsStreamHub = s;
|
|
24386
|
+
})(typeof window < "u" ? window : globalThis);
|
|
24387
|
+
//#endregion
|
|
24388
|
+
//#region linkFlowzsStream.js
|
|
24389
|
+
var activeStream = null;
|
|
24396
24390
|
async function ZsStreamMount(e, t = {}) {
|
|
24397
24391
|
if (!globalThis.ZsStream?.mount) throw Error("ZsStream 未加载,请确认已引入 zs-stream-parent.js");
|
|
24398
|
-
ZsStreamDestroy(), setUELogEnabled(e?.UELogLevel ?? !0);
|
|
24392
|
+
await ZsStreamDestroy(), setUELogEnabled(e?.UELogLevel ?? !0);
|
|
24399
24393
|
let n = globalThis.ZsStream.mount(e);
|
|
24400
24394
|
activeStream = n, t.onInputready && n.on("inputready", t.onInputready), t.onPlatform && n.on("platform", t.onPlatform), t.onQueue && n.on("queue", t.onQueue), n.on("message", (e) => {
|
|
24401
24395
|
if (t.onSceneInit && typeof e == "string") try {
|
|
@@ -24404,25 +24398,31 @@ async function ZsStreamMount(e, t = {}) {
|
|
|
24404
24398
|
} catch {}
|
|
24405
24399
|
t.onMessage && t.onMessage(e);
|
|
24406
24400
|
}), t.onError && n.on("error", t.onError);
|
|
24407
|
-
let r = new GameAPI(new CommandManager(
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
|
|
24417
|
-
|
|
24418
|
-
|
|
24419
|
-
|
|
24401
|
+
let r = new GameAPI(new CommandManager({
|
|
24402
|
+
sendTextToDataChannel(e) {
|
|
24403
|
+
n.sendTextToDataChannel(e);
|
|
24404
|
+
},
|
|
24405
|
+
bindMessageHandler(e) {
|
|
24406
|
+
n.on("message", (t) => {
|
|
24407
|
+
if (typeof t == "string") {
|
|
24408
|
+
e(t);
|
|
24409
|
+
return;
|
|
24410
|
+
}
|
|
24411
|
+
t != null && e(JSON.stringify(t));
|
|
24412
|
+
});
|
|
24413
|
+
}
|
|
24414
|
+
}));
|
|
24415
|
+
return r.destroy = () => ZsStreamDestroy(), r;
|
|
24420
24416
|
}
|
|
24421
|
-
function
|
|
24422
|
-
|
|
24417
|
+
async function ZsStreamDestroy() {
|
|
24418
|
+
if (activeStream && typeof activeStream.destroy == "function") try {
|
|
24419
|
+
await activeStream.destroy(), console.log("连接关闭成功");
|
|
24420
|
+
} catch (e) {
|
|
24421
|
+
console.error("连接关闭失败:", e);
|
|
24422
|
+
}
|
|
24423
|
+
activeStream = null;
|
|
24423
24424
|
}
|
|
24424
|
-
var web3dlink_default = loadStream;
|
|
24425
24425
|
//#endregion
|
|
24426
|
-
export { CommandManager, GameAPI, ZsStreamDestroy, ZsStreamMount, closeGameApi, createAndInitLarkSR,
|
|
24426
|
+
export { CommandManager, GameAPI, ZsStreamDestroy, ZsStreamMount, closeGameApi, createAndInitLarkSR, getLarkSR, version };
|
|
24427
24427
|
|
|
24428
24428
|
//# sourceMappingURL=web3dlink.js.map
|