@syhr/sy-three 1.0.0-rc.1
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/CHANGELOG.md +717 -0
- package/README.md +223 -0
- package/dist-three/sy-three.cjs +51 -0
- package/dist-three/sy-three.css +1 -0
- package/dist-three/sy-three.mjs +2311 -0
- package/dist-three/sy-three.umd.js +52 -0
- package/package.json +159 -0
- package/readme.text +4 -0
|
@@ -0,0 +1,2311 @@
|
|
|
1
|
+
import './sy-three.css';var zt = Object.defineProperty, Wt = Object.defineProperties;
|
|
2
|
+
var __$t__ = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Fe = Object.getOwnPropertySymbols;
|
|
4
|
+
var Yt = Object.prototype.hasOwnProperty, Jt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var pe = (r, e, t) => e in r ? zt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, x = (r, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
Yt.call(e, t) && pe(r, t, e[t]);
|
|
8
|
+
if (Fe)
|
|
9
|
+
for (var t of Fe(e))
|
|
10
|
+
Jt.call(e, t) && pe(r, t, e[t]);
|
|
11
|
+
return r;
|
|
12
|
+
}, ne = (r, e) => Wt(r, __$t__(e));
|
|
13
|
+
var W = (r, e, t) => pe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
14
|
+
var f = (r, e, t) => new Promise((n, s) => {
|
|
15
|
+
var o = (u) => {
|
|
16
|
+
try {
|
|
17
|
+
l(t.next(u));
|
|
18
|
+
} catch (d) {
|
|
19
|
+
s(d);
|
|
20
|
+
}
|
|
21
|
+
}, a = (u) => {
|
|
22
|
+
try {
|
|
23
|
+
l(t.throw(u));
|
|
24
|
+
} catch (d) {
|
|
25
|
+
s(d);
|
|
26
|
+
}
|
|
27
|
+
}, l = (u) => u.done ? n(u.value) : Promise.resolve(u.value).then(o, a);
|
|
28
|
+
l((t = t.apply(r, e)).next());
|
|
29
|
+
});
|
|
30
|
+
import { ref as ct, watch as oe, onMounted as lt, onUnmounted as ut, openBlock as ht, createElementBlock as dt, withModifiers as Ne, shallowRef as Xt, createVNode as jt, unref as qt } from "vue";
|
|
31
|
+
import Qt from "qs";
|
|
32
|
+
import Zt from "axios";
|
|
33
|
+
import "dayjs";
|
|
34
|
+
import en from "mitt";
|
|
35
|
+
import { createPinia as tn, defineStore as nn, storeToRefs as rn } from "pinia";
|
|
36
|
+
import "crypto-js";
|
|
37
|
+
import { SM4 as X, SM2 as sn } from "gm-crypto";
|
|
38
|
+
import { throttle as on } from "lodash-es";
|
|
39
|
+
import { ElMessage as G } from "element-plus";
|
|
40
|
+
import { CSS2DObject as an } from "three/examples/jsm/renderers/CSS2DRenderer.js";
|
|
41
|
+
import { THREE as U, ThreeEditor as _e } from "three-edit-cores";
|
|
42
|
+
import R from "localforage";
|
|
43
|
+
import "@element-plus/icons-vue";
|
|
44
|
+
import { RoomEnvironment as cn } from "three/addons/environments/RoomEnvironment.js";
|
|
45
|
+
const re = {
|
|
46
|
+
NONE: "none",
|
|
47
|
+
WUJIE: "wujie",
|
|
48
|
+
QIANKUN: "qiankun",
|
|
49
|
+
MICROAPP: "microapp"
|
|
50
|
+
}, Be = {
|
|
51
|
+
ACPOINT: {
|
|
52
|
+
YCVALUE: "status.platform.ycvalue",
|
|
53
|
+
// 遥测信号值
|
|
54
|
+
YXVALUE: "status.platform.yxvalue"
|
|
55
|
+
// 遥信信号值
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var ue = {};
|
|
59
|
+
/*!
|
|
60
|
+
* vite-plugin-qiankun.js v1.0.14
|
|
61
|
+
* (c) 2021-2022 Teng Mao Qing
|
|
62
|
+
* Released under the MIT License.
|
|
63
|
+
*/
|
|
64
|
+
Object.defineProperty(ue, "__esModule", { value: !0 });
|
|
65
|
+
var Y = typeof window != "undefined" ? window.proxy || window : {}, mt = function(r) {
|
|
66
|
+
Y != null && Y.__POWERED_BY_QIANKUN__ && (window.moudleQiankunAppLifeCycles || (window.moudleQiankunAppLifeCycles = {}), Y.qiankunName && (window.moudleQiankunAppLifeCycles[Y.qiankunName] = r));
|
|
67
|
+
};
|
|
68
|
+
ue.default = mt;
|
|
69
|
+
var Ee = ue.qiankunWindow = Y;
|
|
70
|
+
ue.renderWithQiankun = mt;
|
|
71
|
+
function ln() {
|
|
72
|
+
return window.__POWERED_BY_WUJIE__ || window.$wujie ? re.WUJIE : window.__POWERED_BY_QIANKUN__ || Ee != null && Ee.__POWERED_BY_QIANKUN__ ? re.QIANKUN : window.__MICRO_APP_ENVIRONMENT__ || window.microApp ? re.MICROAPP : re.NONE;
|
|
73
|
+
}
|
|
74
|
+
const un = "/";
|
|
75
|
+
ln();
|
|
76
|
+
const hn = location.origin;
|
|
77
|
+
var Xe, je, qe, Qe, Ze, et, tt, nt, rt, st, it, ot;
|
|
78
|
+
const ft = {
|
|
79
|
+
savePath: ((je = (Xe = window.meta) == null ? void 0 : Xe.graph) == null ? void 0 : je.savePath) || "/cockpit/drawing",
|
|
80
|
+
graphPenPath: ((Qe = (qe = window.meta) == null ? void 0 : qe.graph) == null ? void 0 : Qe.graphPenPath) || "/cockpit/graph",
|
|
81
|
+
templatePath: ((et = (Ze = window.meta) == null ? void 0 : Ze.graph) == null ? void 0 : et.templatePath) || "/cockpit/template",
|
|
82
|
+
graphImgUploadPath: ((nt = (tt = window.meta) == null ? void 0 : tt.graph) == null ? void 0 : nt.graphImgUploadPath) || "/cockpit/upload",
|
|
83
|
+
threeSavePath: ((st = (rt = window.meta) == null ? void 0 : rt.graph) == null ? void 0 : st.threeSavePath) || "/cockpit/threed",
|
|
84
|
+
threeModelPath: ((ot = (it = window.meta) == null ? void 0 : it.graph) == null ? void 0 : ot.threeModelPath) || "/cockpit/models"
|
|
85
|
+
}, A = Zt.create({
|
|
86
|
+
baseURL: hn,
|
|
87
|
+
timeout: window.meta.axios.timeout || 12e4,
|
|
88
|
+
withCredentials: !1,
|
|
89
|
+
paramsSerializer: (r) => Qt.stringify(r)
|
|
90
|
+
});
|
|
91
|
+
A.interceptors.request.use(
|
|
92
|
+
(r) => (r.headers["x-token"] = "ewoglCJhbGcilDogpc3", r),
|
|
93
|
+
(r) => Promise.reject(r)
|
|
94
|
+
);
|
|
95
|
+
A.interceptors.response.use(
|
|
96
|
+
(r) => {
|
|
97
|
+
const { data: e } = r;
|
|
98
|
+
return Promise.resolve(e);
|
|
99
|
+
},
|
|
100
|
+
(r) => Promise.reject(r)
|
|
101
|
+
);
|
|
102
|
+
function dn(r, e = {}, t = {}) {
|
|
103
|
+
return new Promise((n) => {
|
|
104
|
+
A.get(r, x({ params: e }, t)).then((s) => n({ res: s, err: null })).catch((s) => n({ res: null, err: s }));
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function mn(r, e = {}, t = {}) {
|
|
108
|
+
return new Promise((n) => {
|
|
109
|
+
A.post(r, e, t).then((s) => n({ res: s, err: null })).catch((s) => n({ res: null, err: s }));
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function fn(r, e = {}, t = {}) {
|
|
113
|
+
return A.get(r, x({ params: e }, t));
|
|
114
|
+
}
|
|
115
|
+
function pn(r, e = {}, t = {}) {
|
|
116
|
+
return A.post(r, e, t);
|
|
117
|
+
}
|
|
118
|
+
function _n(r, e = {}) {
|
|
119
|
+
return A.get(`/filehandle/${r}`, { params: e });
|
|
120
|
+
}
|
|
121
|
+
function En(r, e = {}, t = {}) {
|
|
122
|
+
return A.post(`/filehandle/${r}`, e, t);
|
|
123
|
+
}
|
|
124
|
+
function An(r, e = {}) {
|
|
125
|
+
return A.get(`/user/${r}`, { params: e });
|
|
126
|
+
}
|
|
127
|
+
function gn(r, e = {}, t = {}) {
|
|
128
|
+
return A.post(`/user/${r}`, e, t);
|
|
129
|
+
}
|
|
130
|
+
function wn(r, e = {}) {
|
|
131
|
+
return A.get(`${r}`, e.local ? { params: e, baseURL: un } : { params: e });
|
|
132
|
+
}
|
|
133
|
+
function Sn(r, e = {}) {
|
|
134
|
+
return A.get(`/media/${r}/`, { params: e });
|
|
135
|
+
}
|
|
136
|
+
function In(r, e = {}, t = {}) {
|
|
137
|
+
return A.post(`/media/${r}/`, e, t);
|
|
138
|
+
}
|
|
139
|
+
function Cn(r, e = {}) {
|
|
140
|
+
return A.get(
|
|
141
|
+
`/${window.meta.app.isFactory ? window.meta.factory.singo_prefix || "acproxy/common" : "common"}/${r}/`,
|
|
142
|
+
{ params: e }
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
function yn(r, e = {}, t = {}) {
|
|
146
|
+
return A.post(
|
|
147
|
+
`/${window.meta.app.isFactory ? window.meta.factory.singo_prefix || "acproxy/common" : "common"}/${r}/`,
|
|
148
|
+
e,
|
|
149
|
+
t
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
function Rn(r, e = {}) {
|
|
153
|
+
return A.get(`/history/${r}`, { params: e });
|
|
154
|
+
}
|
|
155
|
+
function Dn(r, e = {}, t = {}) {
|
|
156
|
+
return A.post(`/history/${r}`, e, t);
|
|
157
|
+
}
|
|
158
|
+
function vn(r, e = {}) {
|
|
159
|
+
return A.get(`/scada/${r}`, { params: e });
|
|
160
|
+
}
|
|
161
|
+
function xn(r, e = {}, t = {}) {
|
|
162
|
+
return A.post(`/scada/${r}`, e, t);
|
|
163
|
+
}
|
|
164
|
+
function Pn(r, e = {}) {
|
|
165
|
+
return A.get(`/common/factory/${r}`, { params: e });
|
|
166
|
+
}
|
|
167
|
+
function Tn(r, e = {}, t = {}) {
|
|
168
|
+
return A.post(`/common/factory/${r}`, e, t);
|
|
169
|
+
}
|
|
170
|
+
function bn(r, e = {}) {
|
|
171
|
+
return A.get(`/factory/${r}`, { params: e });
|
|
172
|
+
}
|
|
173
|
+
function Ln(r, e = {}, t = {}) {
|
|
174
|
+
return A.post(`/factory/${r}`, e, t);
|
|
175
|
+
}
|
|
176
|
+
function On(r, e = {}) {
|
|
177
|
+
return A.get(`/pd/${r}`, { params: e });
|
|
178
|
+
}
|
|
179
|
+
function Mn(r, e = {}, t = {}) {
|
|
180
|
+
return A.post(`/pd/${r}`, e, t);
|
|
181
|
+
}
|
|
182
|
+
const H = {
|
|
183
|
+
getApi: dn,
|
|
184
|
+
postApi: mn,
|
|
185
|
+
getFileApi: _n,
|
|
186
|
+
postFileApi: En,
|
|
187
|
+
getBaseApi: fn,
|
|
188
|
+
postBaseApi: pn,
|
|
189
|
+
getUserApi: An,
|
|
190
|
+
postUserApi: gn,
|
|
191
|
+
getGraphApi: wn,
|
|
192
|
+
getMediaApi: Sn,
|
|
193
|
+
postMediaApi: In,
|
|
194
|
+
getScadaApi: vn,
|
|
195
|
+
postScadaApi: xn,
|
|
196
|
+
getCommonApi: Cn,
|
|
197
|
+
postCommonApi: yn,
|
|
198
|
+
getHistoryApi: Rn,
|
|
199
|
+
postHistoryApi: Dn,
|
|
200
|
+
getFactoryApi: bn,
|
|
201
|
+
postFactoryApi: Ln,
|
|
202
|
+
getCommonFactoryApi: Pn,
|
|
203
|
+
postCommonFactoryApi: Tn,
|
|
204
|
+
getPDApi: On,
|
|
205
|
+
postPDApi: Mn
|
|
206
|
+
}, Un = () => {
|
|
207
|
+
var n;
|
|
208
|
+
const r = {}, e = ((n = window.location.href.split("?")) == null ? void 0 : n[1]) || "", t = new URLSearchParams(e);
|
|
209
|
+
for (const [s, o] of t.entries())
|
|
210
|
+
r[s] = o;
|
|
211
|
+
return r;
|
|
212
|
+
};
|
|
213
|
+
function Ge(r) {
|
|
214
|
+
return Object.prototype.toString.call(r).slice(8, -1);
|
|
215
|
+
}
|
|
216
|
+
function ge() {
|
|
217
|
+
return ("10000000-1000-4000-8000" + -1e11).replace(
|
|
218
|
+
/[018]/g,
|
|
219
|
+
(r) => (r ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> r / 4).toString(16)
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
const we = en();
|
|
223
|
+
class Hn {
|
|
224
|
+
constructor(e = {}) {
|
|
225
|
+
this._options = x({
|
|
226
|
+
url: e.socketUrl,
|
|
227
|
+
onOpen: null,
|
|
228
|
+
onClose: null,
|
|
229
|
+
onError: null,
|
|
230
|
+
onMessage: null
|
|
231
|
+
}, e), this._client = null, this._isConnect = !1, this._closeClient = !1, this._retryCount = 0, this._retryTimes = 10, this._retryInterval = 1e4, this._retryIntervalObj = null, this._initSockjs();
|
|
232
|
+
}
|
|
233
|
+
_initSockjs() {
|
|
234
|
+
const { url: e, onOpen: t, onClose: n, onError: s, onMessage: o, token: a } = this._options;
|
|
235
|
+
WebSocket !== void 0 ? this._client = new WebSocket(e, [a]) : this.$message({
|
|
236
|
+
type: "error",
|
|
237
|
+
message: "当前浏览器不支持WebSocket推送!"
|
|
238
|
+
}), this._client.onopen = (l) => {
|
|
239
|
+
this._client.readyState === WebSocket.OPEN && (this._retryCount = 0, this._isConnect = !0, this._closeClient = !1, this._retryIntervalObj && clearInterval(this._retryIntervalObj), this._retryIntervalObj = null), t && t(l);
|
|
240
|
+
}, this._client.onclose = (l) => {
|
|
241
|
+
!this._closeClient && this.retryIntervalStart(), this._isConnect = !1, n && n(l);
|
|
242
|
+
}, this._client.onerror = (l) => {
|
|
243
|
+
s && s(l);
|
|
244
|
+
}, this._client.onmessage = (l) => {
|
|
245
|
+
o && o(l);
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
_reconnect() {
|
|
249
|
+
if (this._retryCount === this._retryTimes) {
|
|
250
|
+
this._retryIntervalObj && clearInterval(this._retryIntervalObj), this._retryIntervalObj = null;
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this._client = null, this._initSockjs(), this._retryCount++;
|
|
254
|
+
}
|
|
255
|
+
retryIntervalStart() {
|
|
256
|
+
this._closeClient = !0, this._retryIntervalObj || (this._retryIntervalObj = setInterval(() => {
|
|
257
|
+
this._reconnect();
|
|
258
|
+
}, this._retryInterval));
|
|
259
|
+
}
|
|
260
|
+
sendMsg(e) {
|
|
261
|
+
this._isConnect && this._client.send(e);
|
|
262
|
+
}
|
|
263
|
+
destroy() {
|
|
264
|
+
this._client && (this._isConnect = !1, this._retryIntervalObj && clearInterval(this._retryIntervalObj), this._retryIntervalObj = null, this._closeClient = !0, this._client.close(), this._client = null);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const kn = (r, e) => new Promise((t, n) => {
|
|
268
|
+
H.postApi("/filehandle/save", {
|
|
269
|
+
path: r,
|
|
270
|
+
data: e
|
|
271
|
+
}).then((s) => {
|
|
272
|
+
s.res.success ? t(!0) : n(!1);
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
tn();
|
|
276
|
+
(function() {
|
|
277
|
+
if (typeof Object.id == "undefined") {
|
|
278
|
+
var r = 0;
|
|
279
|
+
Object.id = function(e) {
|
|
280
|
+
return typeof e.__uniqueid == "undefined" && Object.defineProperty(e, "__uniqueid", {
|
|
281
|
+
value: ++r,
|
|
282
|
+
enumerable: !1,
|
|
283
|
+
// This could go either way, depending on your
|
|
284
|
+
// interpretation of what an "id" is
|
|
285
|
+
writable: !1
|
|
286
|
+
}), e.__uniqueid;
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
})();
|
|
290
|
+
function Fn() {
|
|
291
|
+
var r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", e = [
|
|
292
|
+
-1,
|
|
293
|
+
-1,
|
|
294
|
+
-1,
|
|
295
|
+
-1,
|
|
296
|
+
-1,
|
|
297
|
+
-1,
|
|
298
|
+
-1,
|
|
299
|
+
-1,
|
|
300
|
+
-1,
|
|
301
|
+
-1,
|
|
302
|
+
-1,
|
|
303
|
+
-1,
|
|
304
|
+
-1,
|
|
305
|
+
-1,
|
|
306
|
+
-1,
|
|
307
|
+
-1,
|
|
308
|
+
-1,
|
|
309
|
+
-1,
|
|
310
|
+
-1,
|
|
311
|
+
-1,
|
|
312
|
+
-1,
|
|
313
|
+
-1,
|
|
314
|
+
-1,
|
|
315
|
+
-1,
|
|
316
|
+
-1,
|
|
317
|
+
-1,
|
|
318
|
+
-1,
|
|
319
|
+
-1,
|
|
320
|
+
-1,
|
|
321
|
+
-1,
|
|
322
|
+
-1,
|
|
323
|
+
-1,
|
|
324
|
+
-1,
|
|
325
|
+
-1,
|
|
326
|
+
-1,
|
|
327
|
+
-1,
|
|
328
|
+
-1,
|
|
329
|
+
-1,
|
|
330
|
+
-1,
|
|
331
|
+
-1,
|
|
332
|
+
-1,
|
|
333
|
+
-1,
|
|
334
|
+
-1,
|
|
335
|
+
62,
|
|
336
|
+
-1,
|
|
337
|
+
-1,
|
|
338
|
+
-1,
|
|
339
|
+
63,
|
|
340
|
+
52,
|
|
341
|
+
53,
|
|
342
|
+
54,
|
|
343
|
+
55,
|
|
344
|
+
56,
|
|
345
|
+
57,
|
|
346
|
+
58,
|
|
347
|
+
59,
|
|
348
|
+
60,
|
|
349
|
+
61,
|
|
350
|
+
-1,
|
|
351
|
+
-1,
|
|
352
|
+
-1,
|
|
353
|
+
-1,
|
|
354
|
+
-1,
|
|
355
|
+
-1,
|
|
356
|
+
-1,
|
|
357
|
+
0,
|
|
358
|
+
1,
|
|
359
|
+
2,
|
|
360
|
+
3,
|
|
361
|
+
4,
|
|
362
|
+
5,
|
|
363
|
+
6,
|
|
364
|
+
7,
|
|
365
|
+
8,
|
|
366
|
+
9,
|
|
367
|
+
10,
|
|
368
|
+
11,
|
|
369
|
+
12,
|
|
370
|
+
13,
|
|
371
|
+
14,
|
|
372
|
+
15,
|
|
373
|
+
16,
|
|
374
|
+
17,
|
|
375
|
+
18,
|
|
376
|
+
19,
|
|
377
|
+
20,
|
|
378
|
+
21,
|
|
379
|
+
22,
|
|
380
|
+
23,
|
|
381
|
+
24,
|
|
382
|
+
25,
|
|
383
|
+
-1,
|
|
384
|
+
-1,
|
|
385
|
+
-1,
|
|
386
|
+
-1,
|
|
387
|
+
-1,
|
|
388
|
+
-1,
|
|
389
|
+
26,
|
|
390
|
+
27,
|
|
391
|
+
28,
|
|
392
|
+
29,
|
|
393
|
+
30,
|
|
394
|
+
31,
|
|
395
|
+
32,
|
|
396
|
+
33,
|
|
397
|
+
34,
|
|
398
|
+
35,
|
|
399
|
+
36,
|
|
400
|
+
37,
|
|
401
|
+
38,
|
|
402
|
+
39,
|
|
403
|
+
40,
|
|
404
|
+
41,
|
|
405
|
+
42,
|
|
406
|
+
43,
|
|
407
|
+
44,
|
|
408
|
+
45,
|
|
409
|
+
46,
|
|
410
|
+
47,
|
|
411
|
+
48,
|
|
412
|
+
49,
|
|
413
|
+
50,
|
|
414
|
+
51,
|
|
415
|
+
-1,
|
|
416
|
+
-1,
|
|
417
|
+
-1,
|
|
418
|
+
-1,
|
|
419
|
+
-1
|
|
420
|
+
];
|
|
421
|
+
this.encode = function(t) {
|
|
422
|
+
var n, s, o, a, l, u;
|
|
423
|
+
for (o = t.length, s = 0, n = ""; s < o; ) {
|
|
424
|
+
if (a = t.charCodeAt(s++) & 255, s == o) {
|
|
425
|
+
n += r.charAt(a >> 2), n += r.charAt((a & 3) << 4), n += "==";
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
if (l = t.charCodeAt(s++), s == o) {
|
|
429
|
+
n += r.charAt(a >> 2), n += r.charAt((a & 3) << 4 | (l & 240) >> 4), n += r.charAt((l & 15) << 2), n += "=";
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
u = t.charCodeAt(s++), n += r.charAt(a >> 2), n += r.charAt((a & 3) << 4 | (l & 240) >> 4), n += r.charAt((l & 15) << 2 | (u & 192) >> 6), n += r.charAt(u & 63);
|
|
433
|
+
}
|
|
434
|
+
return n;
|
|
435
|
+
}, this.decode = function(t) {
|
|
436
|
+
var n, s, o, a, l, u, d;
|
|
437
|
+
for (u = t.length, l = 0, d = ""; l < u; ) {
|
|
438
|
+
do
|
|
439
|
+
n = e[t.charCodeAt(l++) & 255];
|
|
440
|
+
while (l < u && n == -1);
|
|
441
|
+
if (n == -1) break;
|
|
442
|
+
do
|
|
443
|
+
s = e[t.charCodeAt(l++) & 255];
|
|
444
|
+
while (l < u && s == -1);
|
|
445
|
+
if (s == -1) break;
|
|
446
|
+
d += String.fromCharCode(n << 2 | (s & 48) >> 4);
|
|
447
|
+
do {
|
|
448
|
+
if (o = t.charCodeAt(l++) & 255, o == 61) return d;
|
|
449
|
+
o = e[o];
|
|
450
|
+
} while (l < u && o == -1);
|
|
451
|
+
if (o == -1) break;
|
|
452
|
+
d += String.fromCharCode((s & 15) << 4 | (o & 60) >> 2);
|
|
453
|
+
do {
|
|
454
|
+
if (a = t.charCodeAt(l++) & 255, a == 61) return d;
|
|
455
|
+
a = e[a];
|
|
456
|
+
} while (l < u && a == -1);
|
|
457
|
+
if (a == -1) break;
|
|
458
|
+
d += String.fromCharCode((o & 3) << 6 | a);
|
|
459
|
+
}
|
|
460
|
+
return d;
|
|
461
|
+
}, this.utf16to8 = function(t) {
|
|
462
|
+
var n, s, o, a;
|
|
463
|
+
for (n = "", o = t.length, s = 0; s < o; s++)
|
|
464
|
+
a = t.charCodeAt(s), a >= 1 && a <= 127 ? n += t.charAt(s) : a > 2047 ? (n += String.fromCharCode(224 | a >> 12 & 15), n += String.fromCharCode(128 | a >> 6 & 63), n += String.fromCharCode(128 | a >> 0 & 63)) : (n += String.fromCharCode(192 | a >> 6 & 31), n += String.fromCharCode(128 | a >> 0 & 63));
|
|
465
|
+
return n;
|
|
466
|
+
}, this.utf8to16 = function(t) {
|
|
467
|
+
var n, s, o, a, l, u;
|
|
468
|
+
for (n = "", o = t.length, s = 0; s < o; )
|
|
469
|
+
switch (a = t.charCodeAt(s++), a >> 4) {
|
|
470
|
+
case 0:
|
|
471
|
+
case 1:
|
|
472
|
+
case 2:
|
|
473
|
+
case 3:
|
|
474
|
+
case 4:
|
|
475
|
+
case 5:
|
|
476
|
+
case 6:
|
|
477
|
+
case 7:
|
|
478
|
+
n += t.charAt(s - 1);
|
|
479
|
+
break;
|
|
480
|
+
case 12:
|
|
481
|
+
case 13:
|
|
482
|
+
l = t.charCodeAt(s++), n += String.fromCharCode((a & 31) << 6 | l & 63);
|
|
483
|
+
break;
|
|
484
|
+
case 14:
|
|
485
|
+
l = t.charCodeAt(s++), u = t.charCodeAt(s++), n += String.fromCharCode((a & 15) << 12 | (l & 63) << 6 | (u & 63) << 0);
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
return n;
|
|
489
|
+
}, this.charToHex = function(t) {
|
|
490
|
+
var n, s, o;
|
|
491
|
+
for (n = "", s = 0; s < t.length; )
|
|
492
|
+
o = t.charCodeAt(s++).toString(16), n += "\\0x" + o, n += s > 0 && s % 8 == 0 ? `\r
|
|
493
|
+
` : ", ";
|
|
494
|
+
return n;
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function Nn() {
|
|
498
|
+
var r = 0, e = new Object();
|
|
499
|
+
this.add = function(t, n) {
|
|
500
|
+
this.containsKey(t) || r++, e[t] = n;
|
|
501
|
+
}, this.getValue = function(t) {
|
|
502
|
+
return this.containsKey(t) ? e[t] : null;
|
|
503
|
+
}, this.remove = function(t) {
|
|
504
|
+
this.containsKey(t) && delete e[t] && r--;
|
|
505
|
+
}, this.containsKey = function(t) {
|
|
506
|
+
return t in e;
|
|
507
|
+
}, this.containsValue = function(t) {
|
|
508
|
+
for (var n in e)
|
|
509
|
+
if (e[n] == t)
|
|
510
|
+
return !0;
|
|
511
|
+
return !1;
|
|
512
|
+
}, this.getValues = function() {
|
|
513
|
+
var t = [];
|
|
514
|
+
for (var n in e)
|
|
515
|
+
t.push(e[n]);
|
|
516
|
+
return t;
|
|
517
|
+
}, this.getKeys = function() {
|
|
518
|
+
var t = [];
|
|
519
|
+
for (var n in e)
|
|
520
|
+
t.push(n);
|
|
521
|
+
return t;
|
|
522
|
+
}, this.getSize = function() {
|
|
523
|
+
return r;
|
|
524
|
+
}, this.clear = function() {
|
|
525
|
+
r = 0, e = new Object();
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function Bn(r) {
|
|
529
|
+
if (this.connect = !1, this.ready_func_ = null, this.callbacks_ = new Nn(), this.module_ = "JS_IActiveXCtrl", "WebSocket" in window)
|
|
530
|
+
this.ws = new WebSocket("ws://127.0.0.1:7321");
|
|
531
|
+
else
|
|
532
|
+
throw "WebSocket not supported";
|
|
533
|
+
this.ws.onerror = function() {
|
|
534
|
+
throw "Unable to establish connection to WebSocket";
|
|
535
|
+
}, this.loadModule = function() {
|
|
536
|
+
this.connect = !0;
|
|
537
|
+
var e = JSON.stringify({
|
|
538
|
+
MsgId: "LoadModule",
|
|
539
|
+
Module: this.module_
|
|
540
|
+
});
|
|
541
|
+
this.ws.onmessage = this._callback.bind(this), this.ws.send(e);
|
|
542
|
+
}, this.loadModuleCallBack = function(e) {
|
|
543
|
+
if (!e) throw e.Response;
|
|
544
|
+
this.ready_func_ && this.ready_func_();
|
|
545
|
+
}.bind(this), this.callbacks_.add("LoadModule", this.loadModuleCallBack), this.exec = function(e, t, n) {
|
|
546
|
+
var s = Object.id(n).toString();
|
|
547
|
+
this.callbacks_.add(s, n);
|
|
548
|
+
var o = {
|
|
549
|
+
MsgId: s,
|
|
550
|
+
Method: e + "|" + r
|
|
551
|
+
};
|
|
552
|
+
t && (o.Param = JSON.stringify(t));
|
|
553
|
+
var a = JSON.stringify(o);
|
|
554
|
+
this.connect && this.ws.send(a);
|
|
555
|
+
}, this.ready = function(e) {
|
|
556
|
+
this.ready_func_ = e;
|
|
557
|
+
}, this._callback = function(e) {
|
|
558
|
+
var t = JSON.parse(e.data), n = t.MsgId;
|
|
559
|
+
if (this.callbacks_.containsKey(n)) {
|
|
560
|
+
var s = this.callbacks_.getValue(n);
|
|
561
|
+
s(t.Result, t.Response), this.callbacks_.remove(n);
|
|
562
|
+
}
|
|
563
|
+
}, this.ws.onopen = this.loadModule.bind(this), this.Arm_GetDongleInfo = function({ Index: e, DongleInfoNum: t }, n) {
|
|
564
|
+
this.exec("Arm_GetDongleInfo", [parseInt(e), parseInt(t)], n);
|
|
565
|
+
}, this.Arm_Enum = function(e) {
|
|
566
|
+
this.exec("Arm_Enum", null, e);
|
|
567
|
+
}, this.Arm_Open = function({ Index: e }, t) {
|
|
568
|
+
this.exec("Arm_Open", [parseInt(e)], t);
|
|
569
|
+
}, this.Arm_Close = function({ Handle: e }, t) {
|
|
570
|
+
this.exec("Arm_Close", [parseInt(e)], t);
|
|
571
|
+
}, this.Arm_VerifyPIN = function({ Handle: e, UserPin: t, UserType: n }, s) {
|
|
572
|
+
this.exec("Arm_VerifyPIN", [parseInt(e), n, t], s);
|
|
573
|
+
}, this.Arm_ResetState = function({ Handle: e }, t) {
|
|
574
|
+
this.exec("Arm_ResetState", [parseInt(e)], t);
|
|
575
|
+
}, this.Arm_GenRandom = function({ Handle: e, RandomLen: t }, n) {
|
|
576
|
+
this.exec("Arm_GenRandom", [parseInt(e), parseInt(t)], n);
|
|
577
|
+
}, this.Arm_LEDControl = function({ Handle: e, LedFlag: t }, n) {
|
|
578
|
+
this.exec("Arm_LEDControl", [parseInt(e), t], n);
|
|
579
|
+
}, this.Arm_SwitchProtocol = function({ Handle: e, ProtocolFlag: t }, n) {
|
|
580
|
+
this.exec("Arm_SwitchProtocol", [parseInt(e), t], n);
|
|
581
|
+
}, this.Arm_CreateFile = function({ Handle: e, FileID: t, FileType: n, AttrBuffer: s }, o) {
|
|
582
|
+
this.exec("Arm_CreateFile", [parseInt(e), n, parseInt(t), s], o);
|
|
583
|
+
}, this.Arm_WriteFile = function({ Handle: e, FileID: t, FileType: n, FileOffset: s, DataInput: o }, a) {
|
|
584
|
+
this.exec(
|
|
585
|
+
"Arm_WriteFile",
|
|
586
|
+
[parseInt(e), n, parseInt(t), parseInt(s), o],
|
|
587
|
+
a
|
|
588
|
+
);
|
|
589
|
+
}, this.Arm_ReadFile0001 = function({ Handle: e }, t) {
|
|
590
|
+
this.exec("Arm_ReadFile", [parseInt(e), parseInt("0001"), parseInt(0), parseInt("64")], t);
|
|
591
|
+
}, this.Arm_ReadFile0002 = function({ Handle: e }, t) {
|
|
592
|
+
this.exec("Arm_ReadFile", [parseInt(e), parseInt("0002"), parseInt(0), parseInt("130")], t);
|
|
593
|
+
}, this.Arm_ReadFile0003 = function({ Handle: e }, t) {
|
|
594
|
+
this.exec("Arm_ReadFile", [parseInt(e), parseInt("0003"), parseInt(0), parseInt("130")], t);
|
|
595
|
+
}, this.Arm_ReadFile0004 = function({ Handle: e }, t) {
|
|
596
|
+
this.exec("Arm_ReadFile", [parseInt(e), parseInt("0004"), parseInt(0), parseInt("2048")], t);
|
|
597
|
+
}, this.Arm_ReadFile0005 = function({ Handle: e }, t) {
|
|
598
|
+
this.exec("Arm_ReadFile", [parseInt(e), parseInt("0005"), parseInt(0), parseInt("2048")], t);
|
|
599
|
+
}, this.Arm_DownloadExeFile = function({ Handle: e, Count: t, ExeFileInfo: n }, s) {
|
|
600
|
+
this.exec("Arm_DownloadExeFile", [parseInt(e), parseInt(t), n], s);
|
|
601
|
+
}, this.Arm_RunExeFile = function({ Handle: e, FileID: t, InData: n, DataLen: s }, o) {
|
|
602
|
+
this.exec(
|
|
603
|
+
"Arm_RunExeFile",
|
|
604
|
+
[parseInt(e), parseInt(t), n, n.length, parseInt(s)],
|
|
605
|
+
o
|
|
606
|
+
);
|
|
607
|
+
}, this.Arm_ReadRunExeFileData = function(e) {
|
|
608
|
+
this.exec("Arm_ReadRunExeFileData", null, e);
|
|
609
|
+
}, this.Arm_DeleteFile = function({ Handle: e, FileID: t, FileType: n }, s) {
|
|
610
|
+
this.exec("Arm_DeleteFile", [parseInt(e), n, parseInt(t)], s);
|
|
611
|
+
}, this.Arm_WriteData = function({ Handle: e, Offset: t, DataInput: n }, s) {
|
|
612
|
+
this.exec("Arm_WriteData", [parseInt(e), parseInt(t), n], s);
|
|
613
|
+
}, this.Arm_ReadData = function({ Handle: e, Offset: t, ReadLength: n }, s) {
|
|
614
|
+
this.exec("Arm_ReadData", [parseInt(e), parseInt(t), n], s);
|
|
615
|
+
}, this.Arm_WriteShareMemory = function({ Handle: e, DataInput: t }, n) {
|
|
616
|
+
this.exec("Arm_WriteShareMemory", [parseInt(e), t], n);
|
|
617
|
+
}, this.Arm_ReadShareMemory = function({ Handle: e }, t) {
|
|
618
|
+
this.exec("Arm_ReadShareMemory", [parseInt(e)], t);
|
|
619
|
+
}, this.Arm_GenUniqueKey = function({ Handle: e, Seed: t }, n) {
|
|
620
|
+
this.exec("Arm_GenUniqueKey", [parseInt(e), t.length, t], n);
|
|
621
|
+
}, this.Arm_ChangePIN = function({ Handle: e, NewPIN: t, OldPIN: n, TryCount: s, PinFlag: o }, a) {
|
|
622
|
+
this.exec("Arm_ChangePIN", [parseInt(e), o, n, t, parseInt(s)], a);
|
|
623
|
+
}, this.Arm_ResetUserPIN = function({ Handle: e, AdminPIN: t }, n) {
|
|
624
|
+
this.exec("Arm_ResetUserPIN", [parseInt(e), t], n);
|
|
625
|
+
}, this.Arm_SetUserID = function({ Handle: e, UserID: t }, n) {
|
|
626
|
+
this.exec("Arm_SetUserID", [parseInt(e), parseInt(t)], n);
|
|
627
|
+
}, this.Arm_GetDeadline = function({ Handle: e }, t) {
|
|
628
|
+
this.exec("Arm_GetDeadline", [parseInt(e)], t);
|
|
629
|
+
}, this.Arm_SetDeadline = function({ Handle: e, SetDeadTime: t }, n) {
|
|
630
|
+
this.exec("Arm_SetDeadline", [parseInt(e), parseInt(t)], n);
|
|
631
|
+
}, this.Arm_GetUTCTime = function({ Handle: e }, t) {
|
|
632
|
+
this.exec("Arm_GetUTCTime", [parseInt(e)], t);
|
|
633
|
+
}, this.Arm_RFS = function({ Handle: e }, t) {
|
|
634
|
+
this.exec("Arm_RFS", [parseInt(e)], t);
|
|
635
|
+
}, this.Arm_RsaGenPubPriKey = function({ Handle: e, RsaFileId: t }, n) {
|
|
636
|
+
this.exec("Arm_RsaGenPubPriKey", [parseInt(e), parseInt(t)], n);
|
|
637
|
+
}, this.Arm_EccGenPubPriKey = function({ Handle: e, EccFileId: t }, n) {
|
|
638
|
+
this.exec("Arm_EccGenPubPriKey", [parseInt(e), parseInt(t)], n);
|
|
639
|
+
}, this.Arm_Sm2GenPubPriKey = function({ Handle: e, Sm2FileId: t }, n) {
|
|
640
|
+
this.exec("Arm_Sm2GenPubPriKey", [parseInt(e), parseInt(t)], n);
|
|
641
|
+
}, this.Arm_ReadRsaPri = function(e) {
|
|
642
|
+
this.exec("Arm_ReadRsaPri", null, e);
|
|
643
|
+
}, this.Arm_ReadRsaPub = function(e) {
|
|
644
|
+
this.exec("Arm_ReadRsaPub", null, e);
|
|
645
|
+
}, this.Arm_ReadEccPri = function(e) {
|
|
646
|
+
this.exec("Arm_ReadEccPri", null, e);
|
|
647
|
+
}, this.Arm_ReadEccPub = function(e) {
|
|
648
|
+
this.exec("Arm_ReadEccPub", null, e);
|
|
649
|
+
}, this.Arm_ReadSm2Pri = function(e) {
|
|
650
|
+
this.exec("Arm_ReadSm2Pri", null, e);
|
|
651
|
+
}, this.Arm_ReadSm2Pub = function(e) {
|
|
652
|
+
this.exec("Arm_ReadSm2Pub", null, e);
|
|
653
|
+
}, this.Arm_RsaPri = function({ Handle: e, RsaPri_Flag: t, RsaPriInData: n, RsaPriFileID: s, RsaPriFileSize: o }, a) {
|
|
654
|
+
this.exec(
|
|
655
|
+
"Arm_RsaPri",
|
|
656
|
+
[parseInt(e), parseInt(s), parseInt(o), t, n],
|
|
657
|
+
a
|
|
658
|
+
);
|
|
659
|
+
}, this.Arm_RsaPub = function({ Handle: e, RsaPubKey: t, RsaPub_Flag: n, RsaPubInData: s, RsaPubFileSize: o }, a) {
|
|
660
|
+
this.exec(
|
|
661
|
+
"Arm_RsaPub",
|
|
662
|
+
[parseInt(e), parseInt(o), n, t, t.length, s],
|
|
663
|
+
a
|
|
664
|
+
);
|
|
665
|
+
}, this.Arm_EccSign = function({ Handle: e, HashData: t, EccFileId: n }, s) {
|
|
666
|
+
this.exec("Arm_EccSign", [parseInt(e), parseInt(n), t], s);
|
|
667
|
+
}, this.Arm_EccVerify = function({ Handle: e, HashData: t, EccPubKey: n, EccSignData: s }, o) {
|
|
668
|
+
this.exec("Arm_EccVerify", [parseInt(e), n, n.length, t, s], o);
|
|
669
|
+
}, this.Arm_Sm2Sign = function({ Handle: e, HashData: t, Sm2FileId: n }, s) {
|
|
670
|
+
this.exec("Arm_Sm2Sign", [parseInt(e), parseInt(n), t], s);
|
|
671
|
+
}, this.Arm_Sm2Verify = function({ Handle: e, HashData: t, Sm2PubKey: n, Sm2SignData: s }, o) {
|
|
672
|
+
this.exec("Arm_Sm2Verify", [parseInt(e), n, n.length, t, s], o);
|
|
673
|
+
}, this.Arm_TDES = function({ Handle: e, Tdes_Flag: t, TdesFileID: n, TdesInData: s }, o) {
|
|
674
|
+
this.exec("Arm_TDES", [parseInt(e), parseInt(n), t, s], o);
|
|
675
|
+
}, this.Arm_SM4 = function({ Handle: e, Sm4_Flag: t, Sm4FileID: n, Sm4InData: s }, o) {
|
|
676
|
+
this.exec("Arm_SM4", [parseInt(e), parseInt(n), t, s], o);
|
|
677
|
+
}, this.Arm_HASH = function({ Handle: e, Hash_Flag: t, HashInData: n }, s) {
|
|
678
|
+
this.exec("Arm_HASH", [parseInt(e), t, n], s);
|
|
679
|
+
}, this.Arm_Seed = function({ Handle: e, SeedData: t, SeedLength: n }, s) {
|
|
680
|
+
this.exec("Arm_Seed", [parseInt(e), n, t], s);
|
|
681
|
+
}, this.Arm_LimitSeedCount = function({ Handle: e, SeedCount: t }, n) {
|
|
682
|
+
this.exec("Arm_LimitSeedCount", [parseInt(e), parseInt(t)], n);
|
|
683
|
+
}, this.Arm_GenMotherKey = function({ Handle: e, SeedLen: t, SeedForPID: n, SonCount: s, StartUserID: o, AdminTryCount: a, UserPin: l, UserTryCount: u, UpdateRSAPriKey: d }, v) {
|
|
684
|
+
this.exec(
|
|
685
|
+
"Arm_GenMotherKey",
|
|
686
|
+
[
|
|
687
|
+
parseInt(e),
|
|
688
|
+
parseInt(t),
|
|
689
|
+
n,
|
|
690
|
+
l,
|
|
691
|
+
parseInt(u),
|
|
692
|
+
parseInt(a),
|
|
693
|
+
d,
|
|
694
|
+
parseInt(o),
|
|
695
|
+
parseInt(s)
|
|
696
|
+
],
|
|
697
|
+
v
|
|
698
|
+
);
|
|
699
|
+
}, this.Arm_RequestInit = function({ Handle: e }, t) {
|
|
700
|
+
this.exec("Arm_RequestInit", [parseInt(e)], t);
|
|
701
|
+
}, this.Arm_GetInitDataFromMother = function({ Handle: e }, t) {
|
|
702
|
+
this.exec("Arm_GetInitDataFromMother", [parseInt(e), Request], t);
|
|
703
|
+
}, this.Arm_InitSon = function({ Handle: e, InitData: t }, n) {
|
|
704
|
+
this.exec("Arm_InitSon", [parseInt(e), t], n);
|
|
705
|
+
}, this.Arm_SetUpdatePriKey = function({ Handle: e, UpdatePriKey: t }, n) {
|
|
706
|
+
this.exec("Arm_SetUpdatePriKey", [parseInt(e), t], n);
|
|
707
|
+
}, this.Arm_MakeUpdatePacket = function({ Handle: e, HID: t, Func: n, FileID: s, FileType: o, Offset: a, DataLen: l, DataBuffer: u, UpRSAPubKey: d }, v) {
|
|
708
|
+
this.exec(
|
|
709
|
+
"Arm_MakeUpdatePacket",
|
|
710
|
+
[
|
|
711
|
+
parseInt(e),
|
|
712
|
+
t,
|
|
713
|
+
n,
|
|
714
|
+
o,
|
|
715
|
+
parseInt(s),
|
|
716
|
+
parseInt(a),
|
|
717
|
+
u,
|
|
718
|
+
d,
|
|
719
|
+
parseInt(l)
|
|
720
|
+
],
|
|
721
|
+
v
|
|
722
|
+
);
|
|
723
|
+
}, this.Arm_MakeUpdatePacketFromMother = function({ Handle: e, HID: t, Func: n, FileID: s, FileType: o, Offset: a, DataLen: l, DataBuffer: u }, d) {
|
|
724
|
+
this.exec(
|
|
725
|
+
"Arm_MakeUpdatePacketFromMother",
|
|
726
|
+
[parseInt(e), t, n, o, parseInt(s), parseInt(a), u, parseInt(l)],
|
|
727
|
+
d
|
|
728
|
+
);
|
|
729
|
+
}, this.Arm_Update = function({ Handle: e, UpdateData: t }, n) {
|
|
730
|
+
this.exec("Arm_Update", [parseInt(e), t], n);
|
|
731
|
+
}, this.Arm_Set_DATA_FILE_ATTR = function({ Size: e, ReadPriv: t, WritePriv: n }, s) {
|
|
732
|
+
this.exec("Arm_Set_DATA_FILE_ATTR", [parseInt(e), parseInt(t), parseInt(n)], s);
|
|
733
|
+
}, this.Arm_Set_PRIKEY_FILE_ATTR = function({ Count: e, Size: t, Type: n, Priv: s, IsReset: o, IsDecOnRAM: a }, l) {
|
|
734
|
+
this.exec(
|
|
735
|
+
"Arm_Set_PRIKEY_FILE_ATTR",
|
|
736
|
+
[n, parseInt(t), parseInt(e), parseInt(s), parseInt(a), parseInt(o)],
|
|
737
|
+
l
|
|
738
|
+
);
|
|
739
|
+
}, this.Arm_Set_KEY_FILE_ATTR = function({ Size: e, PrivEnc: t }, n) {
|
|
740
|
+
this.exec("Arm_Set_KEY_FILE_ATTR", [parseInt(e), parseInt(t)], n);
|
|
741
|
+
}, this.Arm_Set_EXE_FILE_ATTR = function({ FileLen: e, PrivExe: t }, n) {
|
|
742
|
+
this.exec("Arm_Set_EXE_FILE_ATTR", [parseInt(e), parseInt(t)], n);
|
|
743
|
+
}, this.Arm_Set_DATA_LIC = function({ ReadPriv: e, WritePriv: t }, n) {
|
|
744
|
+
this.exec("Arm_Set_DATA_LIC", [parseInt(e), parseInt(t)], n);
|
|
745
|
+
}, this.Arm_Set_PRIKEY_LIC = function({ Count: e, Priv: t, IsReset: n, IsDecOnRAM: s }, o) {
|
|
746
|
+
this.exec(
|
|
747
|
+
"Arm_Set_PRIKEY_LIC",
|
|
748
|
+
[parseInt(e), parseInt(t), parseInt(s), parseInt(n)],
|
|
749
|
+
o
|
|
750
|
+
);
|
|
751
|
+
}, this.Arm_Set_KEY_LIC = function({ PrivEnc: e }, t) {
|
|
752
|
+
this.exec("Arm_Set_KEY_LIC", [parseInt(e)], t);
|
|
753
|
+
}, this.Arm_Set_EXE_LIC = function({ PrivExe: e }, t) {
|
|
754
|
+
this.exec("Arm_Set_EXE_LIC", [parseInt(e)], t);
|
|
755
|
+
}, this.Arm_Set_EXE_FILE_INFO = function({ FileID: e, FileData: t, FileSize: n, InBuffer: s, CallLimit: o }, a) {
|
|
756
|
+
this.exec(
|
|
757
|
+
"Arm_Set_EXE_FILE_INFO",
|
|
758
|
+
[s, parseInt(n), parseInt(e), parseInt(o), t, t.length],
|
|
759
|
+
a
|
|
760
|
+
);
|
|
761
|
+
}, this.Arm_Clear_EXE_FILE_INFO = function({ InBuffer: e }, t) {
|
|
762
|
+
this.exec("Arm_Clear_EXE_FILE_INFO", [e], t);
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
const Gn = {
|
|
766
|
+
HID: 0
|
|
767
|
+
}, se = {
|
|
768
|
+
PRODUCT_ID: 0,
|
|
769
|
+
// 产品ID
|
|
770
|
+
USER_ID: 1,
|
|
771
|
+
// 用户ID
|
|
772
|
+
HARDWARE_ID: 2
|
|
773
|
+
// 硬件ID
|
|
774
|
+
}, Ke = {
|
|
775
|
+
USER: 0
|
|
776
|
+
// 普通用户
|
|
777
|
+
};
|
|
778
|
+
class pt {
|
|
779
|
+
// 加密随机数
|
|
780
|
+
constructor() {
|
|
781
|
+
W(this, "Base64", new Fn());
|
|
782
|
+
W(this, "AtlCtrl", null);
|
|
783
|
+
W(this, "ArmCount", 0);
|
|
784
|
+
// 加密锁数量
|
|
785
|
+
W(this, "ArmIndex", 0);
|
|
786
|
+
// 加密锁索引
|
|
787
|
+
W(this, "ArmHandle", 0);
|
|
788
|
+
// 加密锁句柄
|
|
789
|
+
W(this, "ArmRandom", "");
|
|
790
|
+
try {
|
|
791
|
+
this.AtlCtrl = new Bn("{39E9B272-82A7-4177-A19D-6723C1BDB0CC}");
|
|
792
|
+
} catch (e) {
|
|
793
|
+
console.error(e), this.AtlCtrl = null;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
// 获取加密锁数量
|
|
797
|
+
armEnum() {
|
|
798
|
+
if (this.AtlCtrl)
|
|
799
|
+
return new Promise((e, t) => {
|
|
800
|
+
this.AtlCtrl.Arm_Enum((n, s) => {
|
|
801
|
+
n ? (this.ArmCount = +s, e(s)) : t(s);
|
|
802
|
+
});
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
// 打开加密锁,索引值从0开始
|
|
806
|
+
armOpen(e = 0) {
|
|
807
|
+
if (this.AtlCtrl)
|
|
808
|
+
return this.ArmIndex = e, new Promise((t, n) => {
|
|
809
|
+
this.AtlCtrl.Arm_Open({ Index: e }, (s, o) => {
|
|
810
|
+
s ? (this.ArmHandle = +o, t(o)) : (this.ArmHandle = o, n(o));
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
// 关闭加密锁
|
|
815
|
+
armClose(e = this.ArmHandle) {
|
|
816
|
+
if (this.AtlCtrl)
|
|
817
|
+
return new Promise((t, n) => {
|
|
818
|
+
this.AtlCtrl.Arm_Close({ Handle: e }, (s, o) => {
|
|
819
|
+
s ? t(o) : n(o);
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
// 修改用户PIN码
|
|
824
|
+
armChangePIN(e, t, n = 255, s = Ke.USER, o = this.ArmHandle) {
|
|
825
|
+
if (this.AtlCtrl)
|
|
826
|
+
return new Promise((a, l) => {
|
|
827
|
+
this.AtlCtrl.Arm_ChangePIN({ Handle: o, NewPIN: e, OldPIN: t, TryCount: n, PinFlag: s }, (u, d) => {
|
|
828
|
+
u && d == 0 ? (this.ArmPin = e, a(d)) : l(d);
|
|
829
|
+
});
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
// 生成随机数,随机数长度范围为1~128
|
|
833
|
+
armGenRandom(e = 16, t = this.ArmHandle) {
|
|
834
|
+
if (this.AtlCtrl)
|
|
835
|
+
return new Promise((n, s) => {
|
|
836
|
+
this.AtlCtrl.Arm_GenRandom({ Handle: t, RandomLen: e }, (o, a) => {
|
|
837
|
+
o ? (this.ArmRandom = a, n(a)) : s(a);
|
|
838
|
+
});
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
// 获取加密锁到期时间
|
|
842
|
+
armGetDeadline(e = this.ArmHandle) {
|
|
843
|
+
if (this.AtlCtrl)
|
|
844
|
+
return new Promise((t, n) => {
|
|
845
|
+
this.AtlCtrl.Arm_GetDeadline({ Handle: e }, (s, o) => {
|
|
846
|
+
s ? (this.ArmDeadline = o, t(o)) : n(o);
|
|
847
|
+
});
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
// 唯一化锁,种子码为1234567890,唯一化锁后生成密码为0C56DA077DF5CA8C,产品ID为66D23E87
|
|
851
|
+
armGenUniqueKey(e = "MTIzNDU2Nzg5MA==", t = this.ArmHandle) {
|
|
852
|
+
if (this.AtlCtrl)
|
|
853
|
+
return new Promise((n, s) => {
|
|
854
|
+
this.AtlCtrl.Arm_GenUniqueKey({ Handle: t, Seed: e }, (o, a) => {
|
|
855
|
+
o ? (this.ArmUKey = a, n(a)) : s(a);
|
|
856
|
+
});
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
// 读取加密锁信息(产品ID/用户ID/硬件ID)
|
|
860
|
+
armGetDongleInfo(e = 0, t = se.HARDWARE_ID) {
|
|
861
|
+
if (this.AtlCtrl)
|
|
862
|
+
return this.ArmIndex = e, new Promise((n, s) => {
|
|
863
|
+
this.AtlCtrl.Arm_GetDongleInfo({ Index: e, DongleInfoNum: t }, (o, a) => {
|
|
864
|
+
if (o) {
|
|
865
|
+
switch (t) {
|
|
866
|
+
case se.USER_ID:
|
|
867
|
+
this.ArmUid = a;
|
|
868
|
+
break;
|
|
869
|
+
case se.PRODUCT_ID:
|
|
870
|
+
this.ArmPid = a;
|
|
871
|
+
break;
|
|
872
|
+
case se.HARDWARE_ID:
|
|
873
|
+
this.ArmHid = a;
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
n(a);
|
|
877
|
+
} else
|
|
878
|
+
s(a);
|
|
879
|
+
});
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
// LED灯控制操作
|
|
883
|
+
armLEDControl(e, t = this.ArmHandle) {
|
|
884
|
+
if (this.AtlCtrl)
|
|
885
|
+
return new Promise((n, s) => {
|
|
886
|
+
this.AtlCtrl.Arm_LEDControl({ Handle: t, LedFlag: e }, (o, a) => {
|
|
887
|
+
o && a == 0 ? n(a) : s(a);
|
|
888
|
+
});
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
// 一键恢复出厂状态
|
|
892
|
+
armRFS(e = this.ArmHandle) {
|
|
893
|
+
if (this.AtlCtrl)
|
|
894
|
+
return new Promise((t, n) => {
|
|
895
|
+
this.AtlCtrl.Arm_RFS({ Handle: e }, (s, o) => {
|
|
896
|
+
s && o == 0 ? t(o) : n(o);
|
|
897
|
+
});
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
// 读取加密锁文件
|
|
901
|
+
armReadFile(e = "0001", t = this.ArmHandle) {
|
|
902
|
+
if (this.AtlCtrl)
|
|
903
|
+
return new Promise((n, s) => {
|
|
904
|
+
this.AtlCtrl[`Arm_ReadFile${e}`]({ Handle: t }, (o, a) => {
|
|
905
|
+
if (o && a.length > 0)
|
|
906
|
+
try {
|
|
907
|
+
a = this.Base64.decode(a), n(a);
|
|
908
|
+
} catch (l) {
|
|
909
|
+
console.error(l), n(a);
|
|
910
|
+
}
|
|
911
|
+
else
|
|
912
|
+
s(a);
|
|
913
|
+
});
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
// 清除PIN码验证状态
|
|
917
|
+
armResetState(e = this.ArmHandle) {
|
|
918
|
+
if (this.AtlCtrl)
|
|
919
|
+
return new Promise((t, n) => {
|
|
920
|
+
this.AtlCtrl.Arm_ResetState({ Handle: e }, (s, o) => {
|
|
921
|
+
s && o == 0 ? t(o) : n(o);
|
|
922
|
+
});
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
// 重置用户PIN码,空锁不能重置
|
|
926
|
+
armResetUserPIN(e, t = this.ArmHandle) {
|
|
927
|
+
if (this.AtlCtrl)
|
|
928
|
+
return new Promise((n, s) => {
|
|
929
|
+
this.AtlCtrl.Arm_ResetUserPIN({ Handle: t, AdminPIN: e }, (o, a) => {
|
|
930
|
+
o && a == 0 ? n(a) : s(a);
|
|
931
|
+
});
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
// 设置用户ID
|
|
935
|
+
armSetUserID(e, t = this.ArmHandle) {
|
|
936
|
+
if (this.AtlCtrl)
|
|
937
|
+
return new Promise((n, s) => {
|
|
938
|
+
this.AtlCtrl.Arm_SetUserID({ Handle: t, UserID: e }, (o, a) => {
|
|
939
|
+
o && a == 0 ? n(a) : s(a);
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
// 设置加密锁到期时间
|
|
944
|
+
armSetDeadline(e, t = this.ArmHandle) {
|
|
945
|
+
if (this.AtlCtrl)
|
|
946
|
+
return new Promise((n, s) => {
|
|
947
|
+
this.AtlCtrl.Arm_SetDeadline({ Handle: t, SetDeadTime: e }, (o, a) => {
|
|
948
|
+
o && a == 0 ? n(a) : s(a);
|
|
949
|
+
});
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
// 切换通讯协议
|
|
953
|
+
armSwitchProtocol(e = Gn.HID, t = this.ArmHandle) {
|
|
954
|
+
if (this.AtlCtrl)
|
|
955
|
+
return new Promise((n, s) => {
|
|
956
|
+
this.AtlCtrl.Arm_SwitchProtocol({ Handle: t, ProtocolFlag: e }, (o, a) => {
|
|
957
|
+
o && a == 0 ? n(a) : s(a);
|
|
958
|
+
});
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
// 验证加密锁PIN码
|
|
962
|
+
armVerifyPIN(e, t = Ke.USER, n = this.ArmHandle) {
|
|
963
|
+
if (this.AtlCtrl)
|
|
964
|
+
return new Promise((s, o) => {
|
|
965
|
+
this.AtlCtrl.Arm_VerifyPIN({ Handle: n, UserPin: e, UserType: t }, (a, l) => {
|
|
966
|
+
a && l == 0 ? (this.ArmPin = e, s(l)) : o(l);
|
|
967
|
+
});
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
// 读取锁内数据区数据
|
|
971
|
+
armReadData(e = 0, t = 128, n = this.ArmHandle) {
|
|
972
|
+
if (this.AtlCtrl)
|
|
973
|
+
return new Promise((s, o) => {
|
|
974
|
+
this.AtlCtrl.Arm_ReadData({ Handle: n, Offset: e, ReadLength: t }, (a, l) => {
|
|
975
|
+
a ? (this.ArmData = l, s(l)) : o(l);
|
|
976
|
+
});
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
// 写入锁内数据区数据
|
|
980
|
+
armWriteData(e, t = 0, n = this.ArmHandle) {
|
|
981
|
+
if (this.AtlCtrl)
|
|
982
|
+
return new Promise((s, o) => {
|
|
983
|
+
this.AtlCtrl.Arm_WriteData({ Handle: n, Offset: t, DataInput: e }, (a, l) => {
|
|
984
|
+
a && l == 0 ? s(l) : o(l);
|
|
985
|
+
});
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
// 读取共享内存数据
|
|
989
|
+
armReadShareMemory(e = this.ArmHandle) {
|
|
990
|
+
if (this.AtlCtrl)
|
|
991
|
+
return new Promise((t, n) => {
|
|
992
|
+
this.AtlCtrl.Arm_ReadShareMemory({ Handle: e }, (s, o) => {
|
|
993
|
+
s ? (this.ArmData = o, t(o)) : n(o);
|
|
994
|
+
});
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
// 设置共享内存数据
|
|
998
|
+
armWriteShareMemory(e, t = this.ArmHandle) {
|
|
999
|
+
if (this.AtlCtrl)
|
|
1000
|
+
return new Promise((n, s) => {
|
|
1001
|
+
this.AtlCtrl.Arm_WriteShareMemory({ Handle: t, DataInput: e }, (o, a) => {
|
|
1002
|
+
o && a == 0 ? n(a) : s(a);
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
const _t = "0123456789abcdeffedcba9876543210", Et = "4b0de988570c3a0f", Kn = window.ENCRYPT;
|
|
1008
|
+
let J = Kn && new pt();
|
|
1009
|
+
function At(r = 16, e = "0123456789abcdefghijklmnopqrstuvwxyz") {
|
|
1010
|
+
let t = "", n = e.length;
|
|
1011
|
+
for (; r > 0; )
|
|
1012
|
+
t += e[Math.floor(Math.random() * n)], r--;
|
|
1013
|
+
return t;
|
|
1014
|
+
}
|
|
1015
|
+
function gt() {
|
|
1016
|
+
return f(this, null, function* () {
|
|
1017
|
+
return J || (J = new pt()), new Promise((r, e) => {
|
|
1018
|
+
J.armEnum().then((t) => {
|
|
1019
|
+
r(+t);
|
|
1020
|
+
}).catch((t) => {
|
|
1021
|
+
G({
|
|
1022
|
+
type: "warning",
|
|
1023
|
+
ElMessage: "未找到U盘锁,请检查U盘锁!"
|
|
1024
|
+
}), e(t);
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
on(
|
|
1030
|
+
() => f(void 0, null, function* () {
|
|
1031
|
+
const r = yield gt(), e = {};
|
|
1032
|
+
if (typeof r != "number" || r <= 0)
|
|
1033
|
+
G({
|
|
1034
|
+
type: "warning",
|
|
1035
|
+
ElMessage: "未找到U盘锁,请检查U盘锁!"
|
|
1036
|
+
}), e.resetToken();
|
|
1037
|
+
else {
|
|
1038
|
+
const t = yield zn();
|
|
1039
|
+
if (!e.token) return;
|
|
1040
|
+
t.length ? t.includes(e.ukeyHid) || (G({
|
|
1041
|
+
type: "error",
|
|
1042
|
+
ElMessage: "U盘锁不匹配,请检查U盘锁!"
|
|
1043
|
+
}), e.resetToken()) : (G({
|
|
1044
|
+
type: "warning",
|
|
1045
|
+
ElMessage: "未找到U盘锁,请检查U盘锁!"
|
|
1046
|
+
}), e.resetToken());
|
|
1047
|
+
}
|
|
1048
|
+
}),
|
|
1049
|
+
5e3,
|
|
1050
|
+
{ trailing: !1 }
|
|
1051
|
+
);
|
|
1052
|
+
function Vn(r = 0) {
|
|
1053
|
+
return f(this, null, function* () {
|
|
1054
|
+
return J ? new Promise((e, t) => {
|
|
1055
|
+
J.armGetDongleInfo(r).then((n) => {
|
|
1056
|
+
n ? e(n) : (G({
|
|
1057
|
+
type: "warning",
|
|
1058
|
+
ElMessage: "U盘锁信息为空,请检查U盘锁!"
|
|
1059
|
+
}), t(n));
|
|
1060
|
+
}).catch((n) => {
|
|
1061
|
+
t(n);
|
|
1062
|
+
});
|
|
1063
|
+
}) : G({
|
|
1064
|
+
type: "warning",
|
|
1065
|
+
ElMessage: "未找到U盘锁程序,请检查后台程序!"
|
|
1066
|
+
});
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
function zn() {
|
|
1070
|
+
return f(this, null, function* () {
|
|
1071
|
+
if (!J)
|
|
1072
|
+
return G({
|
|
1073
|
+
type: "warning",
|
|
1074
|
+
ElMessage: "未找到U盘锁程序,请检查后台程序!"
|
|
1075
|
+
});
|
|
1076
|
+
const r = yield gt();
|
|
1077
|
+
let e = [];
|
|
1078
|
+
for (let t = 0; t < r; t++) {
|
|
1079
|
+
const n = yield Vn(t);
|
|
1080
|
+
e.push(n);
|
|
1081
|
+
}
|
|
1082
|
+
return e;
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
At(16);
|
|
1086
|
+
At(16);
|
|
1087
|
+
const wt = window.meta.app.inspect ? X.constants.CBC : X.constants.ECB, { publicKey: as, privateKey: cs } = sn.generateKeyPair();
|
|
1088
|
+
function Ve(r, e, t = {}) {
|
|
1089
|
+
const n = St(Et), s = t.mode || wt;
|
|
1090
|
+
t = s === X.constants.ECB ? x({
|
|
1091
|
+
mode: s,
|
|
1092
|
+
// ECB
|
|
1093
|
+
inputEncoding: "utf8",
|
|
1094
|
+
outputEncoding: "hex"
|
|
1095
|
+
}, t) : x({
|
|
1096
|
+
iv: _t,
|
|
1097
|
+
mode: s,
|
|
1098
|
+
// ECB
|
|
1099
|
+
inputEncoding: "utf8",
|
|
1100
|
+
outputEncoding: "hex"
|
|
1101
|
+
}, t);
|
|
1102
|
+
let o = "";
|
|
1103
|
+
try {
|
|
1104
|
+
o = X.encrypt(r, n, t);
|
|
1105
|
+
} catch (a) {
|
|
1106
|
+
console.log("err: ", a);
|
|
1107
|
+
}
|
|
1108
|
+
return o;
|
|
1109
|
+
}
|
|
1110
|
+
function ze(r, e, t = {}) {
|
|
1111
|
+
const n = St(Et), s = t.mode || wt;
|
|
1112
|
+
return t = s === X.constants.ECB ? x({
|
|
1113
|
+
mode: s,
|
|
1114
|
+
inputEncoding: "hex",
|
|
1115
|
+
outputEncoding: "utf8"
|
|
1116
|
+
}, t) : x({
|
|
1117
|
+
iv: _t,
|
|
1118
|
+
mode: s,
|
|
1119
|
+
inputEncoding: "hex",
|
|
1120
|
+
outputEncoding: "utf8"
|
|
1121
|
+
}, t), X.decrypt(r, n, t);
|
|
1122
|
+
}
|
|
1123
|
+
function St(r) {
|
|
1124
|
+
return [...r].map((e) => e.charCodeAt().toString(16)).join("");
|
|
1125
|
+
}
|
|
1126
|
+
const ve = {
|
|
1127
|
+
getLocal: (r) => {
|
|
1128
|
+
try {
|
|
1129
|
+
let e = window.localStorage.getItem(r);
|
|
1130
|
+
return e = e !== null ? ze(e) : e, JSON.parse(e);
|
|
1131
|
+
} catch (e) {
|
|
1132
|
+
console.error(e);
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
setLocal: (r, e) => {
|
|
1136
|
+
try {
|
|
1137
|
+
let t = JSON.stringify(e);
|
|
1138
|
+
t = t !== null ? Ve(t) : t, window.localStorage.setItem(r, t);
|
|
1139
|
+
} catch (t) {
|
|
1140
|
+
console.error(t);
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
eachLocal: (r) => {
|
|
1144
|
+
if (!r || Ge(r) !== "Function")
|
|
1145
|
+
return console.error("传递参数非函数类型!");
|
|
1146
|
+
for (let e = 0, t = window.localStorage.length; e < t; e++) {
|
|
1147
|
+
const n = window.localStorage.key(e);
|
|
1148
|
+
r((void 0).getLocal(n), n);
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
clearLocal: () => {
|
|
1152
|
+
window.localStorage.clear();
|
|
1153
|
+
},
|
|
1154
|
+
removeLocal: (r) => {
|
|
1155
|
+
window.localStorage.removeItem(r);
|
|
1156
|
+
},
|
|
1157
|
+
getSession: (r) => {
|
|
1158
|
+
try {
|
|
1159
|
+
let e = window.sessionStorage.getItem(r);
|
|
1160
|
+
return e = e !== null ? ze(e) : e, JSON.parse(e);
|
|
1161
|
+
} catch (e) {
|
|
1162
|
+
console.error(e);
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
setSession: (r, e) => {
|
|
1166
|
+
try {
|
|
1167
|
+
let t = JSON.stringify(e);
|
|
1168
|
+
t = t !== null ? Ve(t) : t, window.sessionStorage.setItem(r, t);
|
|
1169
|
+
} catch (t) {
|
|
1170
|
+
console.error(t);
|
|
1171
|
+
}
|
|
1172
|
+
},
|
|
1173
|
+
eachSession: (r) => {
|
|
1174
|
+
if (!r || Ge(r) !== "Function")
|
|
1175
|
+
return console.error("传递参数非函数类型!");
|
|
1176
|
+
for (let e = 0, t = window.sessionStorage.length; e < t; e++) {
|
|
1177
|
+
const n = window.sessionStorage.key(e);
|
|
1178
|
+
r((void 0).getSession(n), n);
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
clearSession: () => {
|
|
1182
|
+
window.sessionStorage.clear();
|
|
1183
|
+
},
|
|
1184
|
+
removeSession: (r) => {
|
|
1185
|
+
window.sessionStorage.removeItem(r);
|
|
1186
|
+
}
|
|
1187
|
+
}, Wn = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1778134039448'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1155'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M512%20512m-500.62222187%200a500.62222187%20500.62222187%200%201%200%201001.24444374%200%20500.62222187%20500.62222187%200%201%200-1001.24444374%200Z'%20fill='%231afa29'%20p-id='1156'%3e%3c/path%3e%3c/svg%3e", We = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1778135587292'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1657'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M512%20512m-500.62222187%200a500.62222187%20500.62222187%200%201%200%201001.24444374%200%20500.62222187%20500.62222187%200%201%200-1001.24444374%200Z'%20fill='%23808080'%20p-id='1658'%3e%3c/path%3e%3c/svg%3e", $n = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1778133589331'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='25776'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M377.083%20125.44c74.606-135.314%20195.292-135.314%20269.897%200l346.332%20629.394c74.606%20135.315%209.508%20245.395-145.189%20245.395H175.94c-154.697%200-219.428-109.715-145.188-245.395L377.083%20125.44z'%20fill='%23FF2D16'%20p-id='25777'%3e%3c/path%3e%3cpath%20d='M567.986%20328.046c0-31.086-25.234-55.955-55.954-55.955s-55.954%2025.235-55.954%2055.955v280.137c0%2031.086%2025.234%2055.954%2055.954%2055.954s55.954-25.234%2055.954-55.954V328.046z%20m-111.908%20448h111.908v111.908H456.078z'%20fill='%23FFFFFF'%20p-id='25778'%3e%3c/path%3e%3c/svg%3e", Yn = {
|
|
1188
|
+
name: "局放测点",
|
|
1189
|
+
label: "局放测点",
|
|
1190
|
+
create: function(r, e) {
|
|
1191
|
+
return f(this, null, function* () {
|
|
1192
|
+
const { transformControls: t } = e, n = document.createElement("div");
|
|
1193
|
+
n.style.position = "relative", n.style.gap = "20px";
|
|
1194
|
+
const s = document.createElement("img");
|
|
1195
|
+
s.style.objectFit = "fill", s.style.width = "1.3vw", s.style.height = "1.3vw", s.src = We, s.style.cursor = "pointer", s.style.pointerEvents = "auto", s.style.userSelect = "none", n.append(s);
|
|
1196
|
+
const o = document.createElement("div");
|
|
1197
|
+
Object.assign(o.style, {
|
|
1198
|
+
position: "absolute",
|
|
1199
|
+
top: "0",
|
|
1200
|
+
left: "1.8vw",
|
|
1201
|
+
display: "none",
|
|
1202
|
+
flexDirection: "column",
|
|
1203
|
+
gap: "10px",
|
|
1204
|
+
padding: "10px",
|
|
1205
|
+
borderRadius: "4px",
|
|
1206
|
+
border: "1px solid rgba(255, 255, 255, 0.2)",
|
|
1207
|
+
backdropFilter: "blur(12px)",
|
|
1208
|
+
background: "#24262933",
|
|
1209
|
+
minWidth: "12vw"
|
|
1210
|
+
}), r.valueEleId || (r.valueEleId = ge()), o.innerHTML = `
|
|
1211
|
+
<div style="padding-bottom: 10px; font-size: 16px; color: #ffffff; border-bottom: 1px solid rgba(255, 113, 108, 0.5);white-space: nowrap;">${r.name}</div>
|
|
1212
|
+
<div style="font-size: 14px; color: #cae4ff;">幅值峰值</div>
|
|
1213
|
+
<div style="display: flex; align-items: flex-end; gap: 10px; color: #FF716C;">
|
|
1214
|
+
<span id="${r.valueEleId}" style="font-size: 24px;font-weight: 600;">${r.value}</span>
|
|
1215
|
+
<span style="font-size: 14px;">dBm</span>
|
|
1216
|
+
</div>
|
|
1217
|
+
`;
|
|
1218
|
+
const a = new an(n);
|
|
1219
|
+
a.name = r.name, a.dataId = r.id, a.userData.params = r, s.addEventListener("mouseover", () => {
|
|
1220
|
+
o.style.display = "flex";
|
|
1221
|
+
}), s.addEventListener("mouseleave", () => {
|
|
1222
|
+
o.style.display = "none";
|
|
1223
|
+
}), s.addEventListener("click", () => {
|
|
1224
|
+
we.emit("three-event", {
|
|
1225
|
+
type: "pd-sensor-click",
|
|
1226
|
+
data: a
|
|
1227
|
+
}), r.preview || setTimeout(() => {
|
|
1228
|
+
t.attach(a);
|
|
1229
|
+
}, 100);
|
|
1230
|
+
}), n.append(o);
|
|
1231
|
+
const l = (d) => {
|
|
1232
|
+
d === 0 ? s.src = We : d === 1 ? s.src = Wn : d === 2 && (s.src = $n);
|
|
1233
|
+
}, u = (d) => {
|
|
1234
|
+
const v = document.getElementById(r.valueEleId);
|
|
1235
|
+
v && (v.innerText = d);
|
|
1236
|
+
};
|
|
1237
|
+
return a.changeState = l, a.changeValue = u, setTimeout(() => {
|
|
1238
|
+
l(r.state), u(r.value);
|
|
1239
|
+
}, 200), a;
|
|
1240
|
+
});
|
|
1241
|
+
},
|
|
1242
|
+
// 获取存储数据
|
|
1243
|
+
getStorage: function(r) {
|
|
1244
|
+
return r.userData.params;
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
var at;
|
|
1248
|
+
R.config(x({
|
|
1249
|
+
driver: [R.INDEXEDDB, R.LOCALSTORAGE],
|
|
1250
|
+
name: "SGP7000",
|
|
1251
|
+
size: 4980736,
|
|
1252
|
+
storeName: "keyvaluepairs",
|
|
1253
|
+
version: 1,
|
|
1254
|
+
description: "SGP7000"
|
|
1255
|
+
}, ((at = window.meta.storage) == null ? void 0 : at.config) || {}));
|
|
1256
|
+
function Jn() {
|
|
1257
|
+
return {
|
|
1258
|
+
getKey: (_) => f(this, null, function* () {
|
|
1259
|
+
return yield R.key(_);
|
|
1260
|
+
}),
|
|
1261
|
+
getKeys: () => f(this, null, function* () {
|
|
1262
|
+
return yield R.keys();
|
|
1263
|
+
}),
|
|
1264
|
+
getItem: (_) => f(this, null, function* () {
|
|
1265
|
+
if (_)
|
|
1266
|
+
return yield R.getItem(_);
|
|
1267
|
+
}),
|
|
1268
|
+
setItem: (_, b) => f(this, null, function* () {
|
|
1269
|
+
if (_)
|
|
1270
|
+
return yield R.setItem(_, b);
|
|
1271
|
+
}),
|
|
1272
|
+
removeItem: (_) => f(this, null, function* () {
|
|
1273
|
+
if (_)
|
|
1274
|
+
return yield R.removeItem(_);
|
|
1275
|
+
}),
|
|
1276
|
+
clearItems: () => f(this, null, function* () {
|
|
1277
|
+
return yield R.clear();
|
|
1278
|
+
}),
|
|
1279
|
+
iterateItems: (_, b) => f(this, null, function* () {
|
|
1280
|
+
if (_)
|
|
1281
|
+
return yield R.iterate(_, b);
|
|
1282
|
+
}),
|
|
1283
|
+
getReady: () => f(this, null, function* () {
|
|
1284
|
+
return yield R.ready();
|
|
1285
|
+
}),
|
|
1286
|
+
getLength: () => f(this, null, function* () {
|
|
1287
|
+
return yield R.length();
|
|
1288
|
+
}),
|
|
1289
|
+
getDriver: () => f(this, null, function* () {
|
|
1290
|
+
return yield R.driver();
|
|
1291
|
+
}),
|
|
1292
|
+
setDriver: (_) => f(this, null, function* () {
|
|
1293
|
+
if (_)
|
|
1294
|
+
return yield R.setDriver(_);
|
|
1295
|
+
}),
|
|
1296
|
+
setConfig: (_) => f(this, null, function* () {
|
|
1297
|
+
if (_)
|
|
1298
|
+
return yield R.config(_);
|
|
1299
|
+
}),
|
|
1300
|
+
dropInstance: (_) => f(this, null, function* () {
|
|
1301
|
+
if (_)
|
|
1302
|
+
return yield R.dropInstance(_);
|
|
1303
|
+
}),
|
|
1304
|
+
createInstance: (_) => f(this, null, function* () {
|
|
1305
|
+
if (_)
|
|
1306
|
+
return yield R.createInstance(_);
|
|
1307
|
+
})
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
const Xn = "THREED_LOG_BUFFER", jn = "THREED_CURRSCENE", qn = "THREED_ACTIVE_MENU", Qn = "THREED_PIXEL_RATIO", ie = "THREED_MODEL_DBNAME", Se = "THREED_MODEL_DBSTORE", Zn = "THREED_SCENE_PREVIEW", Ie = "THREED_MODEL_LOAD_KEY", Z = "THREED_PREVIEW_URL_KEY", er = "THREED_ADDON_EDITOR_JSON", tr = "THREED_SCENE_STORAGE_SUFFIX", Ce = { step: 0.1 }, nr = 80, It = 30, rr = 1e3, sr = 1200, ir = 3e5, or = "三维测试", ar = "灯光", cr = 1, lr = ["环境光", "平行光", "点光源", "聚光灯", "半球光", "平面光"], Ct = /* @__PURE__ */ new Set(["syncStatus", "disposeTargets", "statusMaterials", "syncPanelPlacement"]), ur = ["AxesHelper", "GridHelper", "Box3Helper", "PerspectiveCamera"], yt = /* @__PURE__ */ new Set([
|
|
1311
|
+
"GridHelper",
|
|
1312
|
+
"AxesHelper",
|
|
1313
|
+
"CameraHelper",
|
|
1314
|
+
"SpotLightHelper",
|
|
1315
|
+
"PointLightHelper",
|
|
1316
|
+
"TransformControls",
|
|
1317
|
+
"HemisphereLightHelper",
|
|
1318
|
+
"DirectionalLightHelper",
|
|
1319
|
+
"TransformControlsPlane"
|
|
1320
|
+
]), Rt = /* @__PURE__ */ new Set(["CSS2DObject", "CSS3DObject"]), hr = /* @__PURE__ */ Object.assign({
|
|
1321
|
+
"/src/views/threed/models/pd-sensor.js": Yn
|
|
1322
|
+
}), dr = /* @__PURE__ */ Object.assign({}), mr = {
|
|
1323
|
+
环境光: () => new U.AmbientLight(16777215, 1),
|
|
1324
|
+
平行光: () => new U.DirectionalLight(16777215, 1),
|
|
1325
|
+
点光源: () => new U.PointLight(16777215, 1, 0, 0),
|
|
1326
|
+
聚光灯: () => new U.SpotLight(16777215, 1, 0, Math.PI / 6, 0, 0),
|
|
1327
|
+
半球光: () => new U.HemisphereLight(16777215, 0, 1),
|
|
1328
|
+
平面光: () => new U.RectAreaLight(16777215, 1, 100, 100)
|
|
1329
|
+
}, fr = [
|
|
1330
|
+
{
|
|
1331
|
+
name: "荧光流动",
|
|
1332
|
+
commonUniforms: !0,
|
|
1333
|
+
vertex: "vUv-material",
|
|
1334
|
+
fragment: `
|
|
1335
|
+
vec4 o = gl_FragColor.rgba;
|
|
1336
|
+
vec2 u = gl_FragCoord.xy;
|
|
1337
|
+
vec2 v = iResolution.xy;
|
|
1338
|
+
vec2 uv = .2*(u+u-v)/v.y;
|
|
1339
|
+
<UV_PLACEHOLDER>
|
|
1340
|
+
u = uv;
|
|
1341
|
+
vec4 z = o = vec4(1,2,3,0);
|
|
1342
|
+
for (float a = .5, t = iTime, i;
|
|
1343
|
+
++i < 19.;
|
|
1344
|
+
o += (1. + cos(z+t))
|
|
1345
|
+
/ length((1.+i*dot(v,v))
|
|
1346
|
+
* sin(1.5*u/(.5-dot(u,u)) - 9.*u.yx + t))
|
|
1347
|
+
)
|
|
1348
|
+
v = cos(++t - 7.*u*pow(a += .03, i)) - 5.*u,
|
|
1349
|
+
u += tanh(40. * dot(u *= mat2(cos(i + .02*t - vec4(0,11,33,0)))
|
|
1350
|
+
,u)
|
|
1351
|
+
* cos(1e2*u.yx + t)) / 2e2
|
|
1352
|
+
+ .2 * a * u
|
|
1353
|
+
+ cos(4./exp(dot(o,o)/1e2) + t) / 3e2;
|
|
1354
|
+
|
|
1355
|
+
o = 25.6 / (min(o, 13.) + 164. / o)
|
|
1356
|
+
- dot(u, u) / 250.;
|
|
1357
|
+
vec3 col = o.rgb;
|
|
1358
|
+
`,
|
|
1359
|
+
key: "col",
|
|
1360
|
+
commonFinish: !0,
|
|
1361
|
+
render: "iTime+speed"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
name: "太阳照射",
|
|
1365
|
+
commonUniforms: !0,
|
|
1366
|
+
vertex: "vUv-material",
|
|
1367
|
+
fragment: `
|
|
1368
|
+
float cheap_star(vec2 uv, float anim)
|
|
1369
|
+
{
|
|
1370
|
+
uv = abs(uv);
|
|
1371
|
+
vec2 pos = min(uv.xy/uv.yx, anim);
|
|
1372
|
+
float p = (2.0 - pos.x - pos.y);
|
|
1373
|
+
return (2.0+p*(p*p-1.5)) / (uv.x+uv.y);
|
|
1374
|
+
}
|
|
1375
|
+
<SPLIT_PLACEHOLDER>
|
|
1376
|
+
vec2 uv = ( gl_FragCoord.xy - .5*iResolution.xy ) / iResolution.y;
|
|
1377
|
+
<UV_PLACEHOLDER>
|
|
1378
|
+
uv *= 2.0 * ( cos(iTime * 2.0) -2.5);
|
|
1379
|
+
float anim = sin(iTime * 12.0) * 0.1 + 1.0;
|
|
1380
|
+
vec3 col = cheap_star(uv, anim) * vec3(0.35,0.2,0.15);
|
|
1381
|
+
`,
|
|
1382
|
+
key: "col",
|
|
1383
|
+
commonFinish: !0,
|
|
1384
|
+
render: "iTime+speed"
|
|
1385
|
+
}
|
|
1386
|
+
];
|
|
1387
|
+
let Q = null, O = null;
|
|
1388
|
+
const $e = (r) => (r == null ? void 0 : r.name) || (r == null ? void 0 : r.label) || "", Dt = (r = {}) => Object.values(r).filter((e) => e && (e.label || e.name)), pr = Dt(hr), _r = Dt(dr), Er = () => ({
|
|
1389
|
+
THREED_GUI_PARAMS: Ce,
|
|
1390
|
+
THREED_LOG_BUFFER: Xn,
|
|
1391
|
+
THREED_CURRSCENE: jn,
|
|
1392
|
+
THREED_ACTIVE_MENU: qn,
|
|
1393
|
+
THREED_PIXEL_RATIO: Qn,
|
|
1394
|
+
THREED_IMPORT_SIZE: nr,
|
|
1395
|
+
THREED_LIGHT_TYPES: lr,
|
|
1396
|
+
THREED_EXPORT_BATCH: It,
|
|
1397
|
+
THREED_RELOAD_DELAY: rr,
|
|
1398
|
+
THREED_MODEL_DBNAME: ie,
|
|
1399
|
+
THREED_MODEL_DBSTORE: Se,
|
|
1400
|
+
THREED_SCENE_PREVIEW: Zn,
|
|
1401
|
+
THREED_USER_DATA_KEYS: Ct,
|
|
1402
|
+
THREED_MODEL_LOAD_KEY: Ie,
|
|
1403
|
+
THREED_PREVIEW_URL_KEY: Z,
|
|
1404
|
+
THREED_ADDON_EDITOR_JSON: er,
|
|
1405
|
+
THREED_EXPORT_NODE_COUNT: sr,
|
|
1406
|
+
THREED_DEFAULT_SCENE_NAME: or,
|
|
1407
|
+
THREED_DEFAULT_ACTIVE_MENU: ar,
|
|
1408
|
+
THREED_DEFAULT_PIXEL_RATIO: cr,
|
|
1409
|
+
THREED_EXPORT_VERTEX_COUNT: ir,
|
|
1410
|
+
THREED_SCENE_EXCLUDE_TYPES: ur,
|
|
1411
|
+
THREED_EXPORT_EXCLUDE_TYPES: yt,
|
|
1412
|
+
THREED_EXPORT_RUNTIME_TYPES: Rt,
|
|
1413
|
+
THREED_SCENE_STORAGE_SUFFIX: tr
|
|
1414
|
+
});
|
|
1415
|
+
function Ar() {
|
|
1416
|
+
const { createInstance: r, dropInstance: e } = Jn(), t = "/";
|
|
1417
|
+
let n = [];
|
|
1418
|
+
const s = (i) => {
|
|
1419
|
+
let c = URL.createObjectURL(i);
|
|
1420
|
+
return n.push(c), c;
|
|
1421
|
+
}, o = () => {
|
|
1422
|
+
n.forEach((i) => URL.revokeObjectURL(i)), n = [];
|
|
1423
|
+
}, a = () => f(this, null, function* () {
|
|
1424
|
+
return yield d(), {
|
|
1425
|
+
clearRequest: l,
|
|
1426
|
+
getAllRequest: _,
|
|
1427
|
+
getRequest: k,
|
|
1428
|
+
status: !0,
|
|
1429
|
+
message: "数据库打开成功",
|
|
1430
|
+
DATABASE: O
|
|
1431
|
+
};
|
|
1432
|
+
}), l = (i) => f(this, null, function* () {
|
|
1433
|
+
if (!i) return { status: !1, message: "删除失败" };
|
|
1434
|
+
yield d(), yield O.removeItem(i);
|
|
1435
|
+
const c = M();
|
|
1436
|
+
return c.list = c.list.filter((h) => h.name !== i), { status: !0, message: "删除成功" };
|
|
1437
|
+
}), u = (...c) => f(this, [...c], function* (i = ie) {
|
|
1438
|
+
O = null, Q = null, yield e({ name: i, storeName: Se });
|
|
1439
|
+
}), d = () => f(this, null, function* () {
|
|
1440
|
+
return O || (Q || (Q = r({
|
|
1441
|
+
name: ie,
|
|
1442
|
+
storeName: Se
|
|
1443
|
+
}).then((i) => (O = i, i))), yield Q);
|
|
1444
|
+
}), v = (i) => {
|
|
1445
|
+
if (!i) return !1;
|
|
1446
|
+
const c = String(i.message || "");
|
|
1447
|
+
return i.name === "DataError" || c.includes("in-line keys");
|
|
1448
|
+
}, K = () => f(this, null, function* () {
|
|
1449
|
+
O = null, Q = null, yield e({ name: ie }), yield d();
|
|
1450
|
+
}), M = () => (window.threeEditorDB || (window.threeEditorDB = { db: null, list: [] }), window.threeEditorDB), k = (i) => f(this, null, function* () {
|
|
1451
|
+
if (!i) return { status: !1, message: "获取失败" };
|
|
1452
|
+
yield d();
|
|
1453
|
+
const c = yield O.getItem(i);
|
|
1454
|
+
if (c != null && c.blob && !i)
|
|
1455
|
+
return { status: !0, message: "获取成功", url: s(c.blob) };
|
|
1456
|
+
if (!i) return { status: !1, message: "获取失败" };
|
|
1457
|
+
const h = yield fetch(i).then((y) => y.blob()), m = { blob: h };
|
|
1458
|
+
try {
|
|
1459
|
+
yield O.setItem(i, m);
|
|
1460
|
+
} catch (y) {
|
|
1461
|
+
if (!v(y)) throw y;
|
|
1462
|
+
yield K(), yield O.setItem(i, m);
|
|
1463
|
+
}
|
|
1464
|
+
const g = M(), T = x({ name: i }, m), C = g.list.findIndex((y) => y.name === i);
|
|
1465
|
+
return C > -1 ? g.list.splice(C, 1, T) : g.list.push(T), { status: !0, message: "文件缓存成功", url: s(h) };
|
|
1466
|
+
}), _ = () => f(this, null, function* () {
|
|
1467
|
+
const i = M();
|
|
1468
|
+
yield d();
|
|
1469
|
+
const c = [];
|
|
1470
|
+
return yield O.iterate((h, m) => {
|
|
1471
|
+
c.push(ne(x({}, h || {}), { name: m }));
|
|
1472
|
+
}), i.list = c, { status: !0, message: "获取成功", data: c };
|
|
1473
|
+
}), b = () => f(this, null, function* () {
|
|
1474
|
+
const i = yield H.getApi("/filehandle/scan", {
|
|
1475
|
+
path: ft.threeModelPath,
|
|
1476
|
+
extension: "glb,gltf"
|
|
1477
|
+
}), { children: c } = i.res, h = [];
|
|
1478
|
+
if (c != null && c.length)
|
|
1479
|
+
for (const m of c)
|
|
1480
|
+
h.push({
|
|
1481
|
+
name: m.name,
|
|
1482
|
+
path: "/" + m.path
|
|
1483
|
+
});
|
|
1484
|
+
return h;
|
|
1485
|
+
}), $ = () => window.GUI_PARAMS || Ce, p = () => window.threeEditor || null, E = () => window.editorJsons || [], D = () => ({ width: window.innerWidth || 0, height: window.innerHeight || 0 }), S = () => pr, w = () => M(), I = () => mr || {}, P = () => window[Z] || "", F = () => _r, L = () => window.devicePixelRatio || 1, V = () => window[Z] || "", z = () => {
|
|
1486
|
+
const i = S(), c = F();
|
|
1487
|
+
return {
|
|
1488
|
+
modelDesigns: i,
|
|
1489
|
+
componentDesigns: c,
|
|
1490
|
+
modelList: i.map((h) => h.label),
|
|
1491
|
+
componentList: c.map((h) => h.label)
|
|
1492
|
+
};
|
|
1493
|
+
}, te = (i, c) => {
|
|
1494
|
+
var h;
|
|
1495
|
+
return (h = i == null ? void 0 : i.__DESIGNS__) == null ? void 0 : h.find((m) => m.label === c);
|
|
1496
|
+
}, he = (i = 0) => !Number.isFinite(i) || i <= 0 ? "0 B" : i < 1024 ? `${i} B` : i < 1024 * 1024 ? `${(i / 1024).toFixed(1)} KB` : i < 1024 * 1024 * 1024 ? `${(i / 1024 / 1024).toFixed(1)} MB` : `${(i / 1024 / 1024 / 1024).toFixed(2)} GB`, j = (i) => {
|
|
1497
|
+
const c = window[Ie];
|
|
1498
|
+
typeof c == "function" && c(i);
|
|
1499
|
+
}, de = (i) => !!i && Number.isFinite(i.x) && Number.isFinite(i.y) && Number.isFinite(i.z), q = (i) => {
|
|
1500
|
+
var c, h;
|
|
1501
|
+
return !i || !i.visible || (c = i.userData) != null && c.excludeFromExport || i.isTransformControls || i.isHelper || i.isLight || i.isPoints || (h = i.type) != null && h.includes("Helper") || yt.has(i.type) || Rt.has(i.type) || i.isCSS2DObject || i.isCSS3DObject ? !1 : i.isMesh || i.isGroup || i.isObject3D || i.isLine;
|
|
1502
|
+
}, me = (i, c) => i && Number.isFinite(i.x) && Number.isFinite(i.y) && Number.isFinite(i.z) ? i : c, Pt = (i) => i && Number.isFinite(i.x) && Number.isFinite(i.y) && Number.isFinite(i.z) && Number.isFinite(i.w) ? i : { x: 0, y: 0, z: 0, w: 1 }, Le = (i) => {
|
|
1503
|
+
if (!(i != null && i.isObject3D)) return;
|
|
1504
|
+
const c = me(i.position, { x: 0, y: 0, z: 0 });
|
|
1505
|
+
i.position.set(c.x, c.y, c.z);
|
|
1506
|
+
const h = me(i.scale, { x: 1, y: 1, z: 1 });
|
|
1507
|
+
i.scale.set(
|
|
1508
|
+
h.x === 0 ? 1 : h.x,
|
|
1509
|
+
h.y === 0 ? 1 : h.y,
|
|
1510
|
+
h.z === 0 ? 1 : h.z
|
|
1511
|
+
);
|
|
1512
|
+
const m = me(i.up, { x: 0, y: 1, z: 0 });
|
|
1513
|
+
i.up.set(m.x, m.y, m.z);
|
|
1514
|
+
const g = Pt(i.quaternion);
|
|
1515
|
+
i.quaternion.set(g.x, g.y, g.z, g.w), i.pivot && !de(i.pivot) && delete i.pivot, i.updateMatrix(), i.updateMatrixWorld(!1);
|
|
1516
|
+
}, Tt = (i, c = "_blank") => window.open(i, c), bt = (i, c = "") => window.prompt(i, c), Lt = () => window.location.reload(), Ot = () => document.documentElement.classList.remove("dark"), Mt = (i) => {
|
|
1517
|
+
if (!Array.isArray(i == null ? void 0 : i.__DESIGNS__)) return z();
|
|
1518
|
+
const c = [...S(), ...F()], h = new Set(i.__DESIGNS__.map((m) => $e(m)));
|
|
1519
|
+
return c.forEach((m) => {
|
|
1520
|
+
const g = $e(m);
|
|
1521
|
+
!g || h.has(g) || (h.add(g), i.__DESIGNS__.unshift(m));
|
|
1522
|
+
}), z();
|
|
1523
|
+
}, Ut = (i) => {
|
|
1524
|
+
if (!Array.isArray(i == null ? void 0 : i.__GLSLLIB__)) return;
|
|
1525
|
+
const c = new Set(i.__GLSLLIB__.map((h) => h == null ? void 0 : h.name));
|
|
1526
|
+
fr.forEach((h) => {
|
|
1527
|
+
c.has(h.name) || (c.add(h.name), i.__GLSLLIB__.push(h));
|
|
1528
|
+
});
|
|
1529
|
+
}, fe = (i = {}) => {
|
|
1530
|
+
const c = {};
|
|
1531
|
+
return Object.entries(i || {}).forEach(([h, m]) => {
|
|
1532
|
+
if (!(Ct.has(h) || typeof m == "function")) {
|
|
1533
|
+
if (!m || ["string", "number", "boolean"].includes(typeof m)) {
|
|
1534
|
+
c[h] = m;
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
if (Array.isArray(m)) {
|
|
1538
|
+
try {
|
|
1539
|
+
c[h] = structuredClone(m);
|
|
1540
|
+
} catch (g) {
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
if (!(m.isObject3D || m.isMaterial || m.isTexture || m.nodeType))
|
|
1546
|
+
try {
|
|
1547
|
+
c[h] = structuredClone(m);
|
|
1548
|
+
} catch (g) {
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
}), c;
|
|
1553
|
+
}, Ht = (i = Ce) => {
|
|
1554
|
+
window.GUI_PARAMS = i;
|
|
1555
|
+
}, kt = (i) => {
|
|
1556
|
+
window.threeEditor = i;
|
|
1557
|
+
}, Ft = (i) => {
|
|
1558
|
+
window.threeEditorDB = i;
|
|
1559
|
+
}, Nt = (i) => {
|
|
1560
|
+
window[Ie] = i;
|
|
1561
|
+
}, Bt = (i = "") => {
|
|
1562
|
+
window[Z] = i;
|
|
1563
|
+
}, Gt = (i = "") => {
|
|
1564
|
+
window[Z] = i;
|
|
1565
|
+
}, Oe = (i) => {
|
|
1566
|
+
var h;
|
|
1567
|
+
const c = [];
|
|
1568
|
+
return (h = i == null ? void 0 : i.children) == null || h.forEach((m) => {
|
|
1569
|
+
q(m) && c.push(m);
|
|
1570
|
+
}), c;
|
|
1571
|
+
}, Me = (i = []) => {
|
|
1572
|
+
const c = { rootCount: i.length, nodeCount: 0, meshCount: 0, vertexCount: 0, skippedCount: 0 };
|
|
1573
|
+
return i.forEach((h) => {
|
|
1574
|
+
h.traverse((m) => {
|
|
1575
|
+
var g, T, C;
|
|
1576
|
+
if (q(m)) {
|
|
1577
|
+
c.nodeCount += 1, m.isMesh && (c.meshCount += 1, c.vertexCount += ((C = (T = (g = m.geometry) == null ? void 0 : g.attributes) == null ? void 0 : T.position) == null ? void 0 : C.count) || 0);
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
m !== h && (c.skippedCount += 1);
|
|
1581
|
+
});
|
|
1582
|
+
}), c;
|
|
1583
|
+
}, Ue = () => new Promise((i) => requestAnimationFrame(() => setTimeout(i, 0))), He = () => new Promise((i) => {
|
|
1584
|
+
if (typeof window.requestIdleCallback == "function") {
|
|
1585
|
+
window.requestIdleCallback(() => i(), { timeout: 80 });
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
setTimeout(i, 0);
|
|
1589
|
+
}), Kt = (i, c) => f(this, null, function* () {
|
|
1590
|
+
var g;
|
|
1591
|
+
if (!q(i)) return null;
|
|
1592
|
+
const h = i.clone(!1);
|
|
1593
|
+
h.userData = fe(i.userData), de(i.pivot) ? h.pivot = new U.Vector3(i.pivot.x, i.pivot.y, i.pivot.z) : "pivot" in h && delete h.pivot, Le(h);
|
|
1594
|
+
const m = [{ source: i, clone: h }];
|
|
1595
|
+
for (; m.length; ) {
|
|
1596
|
+
const T = m.shift();
|
|
1597
|
+
for (const C of T.source.children) {
|
|
1598
|
+
if (!q(C)) {
|
|
1599
|
+
c.skippedCount += 1;
|
|
1600
|
+
continue;
|
|
1601
|
+
}
|
|
1602
|
+
const y = C.clone(!1);
|
|
1603
|
+
y.userData = fe(C.userData), de(C.pivot) ? y.pivot = new U.Vector3(C.pivot.x, C.pivot.y, C.pivot.z) : "pivot" in y && delete y.pivot, Le(y), T.clone.add(y), m.push({ source: C, clone: y }), c.processedCount += 1, c.processedCount % It === 0 && (yield (g = c.onProgress) == null ? void 0 : g.call(c, {
|
|
1604
|
+
processedCount: c.processedCount,
|
|
1605
|
+
totalCount: c.totalCount,
|
|
1606
|
+
skippedCount: c.skippedCount,
|
|
1607
|
+
progress: 18 + Math.min(c.processedCount / Math.max(c.totalCount, 1) * 54, 54)
|
|
1608
|
+
}), yield Ue());
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
return h;
|
|
1612
|
+
});
|
|
1613
|
+
return {
|
|
1614
|
+
baseUrl: t,
|
|
1615
|
+
getModels: b,
|
|
1616
|
+
getRequest: k,
|
|
1617
|
+
reloadPage: Lt,
|
|
1618
|
+
promptInput: bt,
|
|
1619
|
+
waitForIdle: He,
|
|
1620
|
+
waitForPaint: Ue,
|
|
1621
|
+
clearRequest: l,
|
|
1622
|
+
getGuiParams: $,
|
|
1623
|
+
setGuiParams: Ht,
|
|
1624
|
+
getAllRequest: _,
|
|
1625
|
+
getEditorJsons: E,
|
|
1626
|
+
getThreeEditor: p,
|
|
1627
|
+
formatFileSize: he,
|
|
1628
|
+
setThreeEditor: kt,
|
|
1629
|
+
removeDarkClass: Ot,
|
|
1630
|
+
openExternalUrl: Tt,
|
|
1631
|
+
getThreedModels: S,
|
|
1632
|
+
getViewportSize: D,
|
|
1633
|
+
buildExportScene: (h, ...m) => f(this, [h, ...m], function* (i, c = {}) {
|
|
1634
|
+
const g = Oe(i), T = Me(g), C = new U.Scene(), y = {
|
|
1635
|
+
totalCount: T.nodeCount,
|
|
1636
|
+
processedCount: 0,
|
|
1637
|
+
skippedCount: 0,
|
|
1638
|
+
onProgress: c.onProgress
|
|
1639
|
+
};
|
|
1640
|
+
for (const Vt of g) {
|
|
1641
|
+
const ke = yield Kt(Vt, y);
|
|
1642
|
+
ke && C.add(ke), yield He();
|
|
1643
|
+
}
|
|
1644
|
+
return C.updateMatrixWorld(!0), T.skippedCount += y.skippedCount, { exportScene: C, exportObjects: g, stats: T };
|
|
1645
|
+
}),
|
|
1646
|
+
createModelDbApi: a,
|
|
1647
|
+
getEditorPreviewSceneUrl: V,
|
|
1648
|
+
getThreeEditorDB: w,
|
|
1649
|
+
sanitizeUserData: fe,
|
|
1650
|
+
setThreeEditorDB: Ft,
|
|
1651
|
+
findThreedDesign: te,
|
|
1652
|
+
getThreedLightMap: I,
|
|
1653
|
+
collectExportStats: Me,
|
|
1654
|
+
getPreviewSceneUrl: P,
|
|
1655
|
+
setEditorPreviewSceneUrl: Gt,
|
|
1656
|
+
setPreviewSceneUrl: Bt,
|
|
1657
|
+
setModelLoadHander: Nt,
|
|
1658
|
+
isExportableObject: q,
|
|
1659
|
+
deleteThreeEditorDB: u,
|
|
1660
|
+
ensureThreeEditorDB: M,
|
|
1661
|
+
getDevicePixelRatio: L,
|
|
1662
|
+
getThreedComponents: F,
|
|
1663
|
+
collectExportObjects: Oe,
|
|
1664
|
+
resetModelDbInstance: K,
|
|
1665
|
+
ensureModelDbInstance: d,
|
|
1666
|
+
getLocalDesignMenuData: z,
|
|
1667
|
+
invokeModelLoadHandler: j,
|
|
1668
|
+
isLegacyInlineKeyError: v,
|
|
1669
|
+
ensureThreedShaderLibrary: Ut,
|
|
1670
|
+
ensureThreedDesignRegistry: Mt,
|
|
1671
|
+
createBlobUrl: s,
|
|
1672
|
+
revokeModelObjectUrls: o
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
const {
|
|
1676
|
+
THREED_LOG_BUFFER: xe,
|
|
1677
|
+
THREED_CURRSCENE: ae,
|
|
1678
|
+
THREED_ACTIVE_MENU: Pe,
|
|
1679
|
+
THREED_PIXEL_RATIO: Te,
|
|
1680
|
+
THREED_SCENE_PREVIEW: be,
|
|
1681
|
+
THREED_ADDON_EDITOR_JSON: ce,
|
|
1682
|
+
THREED_DEFAULT_SCENE_NAME: gr,
|
|
1683
|
+
THREED_DEFAULT_ACTIVE_MENU: ye,
|
|
1684
|
+
THREED_DEFAULT_PIXEL_RATIO: Re,
|
|
1685
|
+
THREED_SCENE_STORAGE_SUFFIX: Ye
|
|
1686
|
+
} = Er(), wr = [
|
|
1687
|
+
xe,
|
|
1688
|
+
ae,
|
|
1689
|
+
Pe,
|
|
1690
|
+
Te,
|
|
1691
|
+
be,
|
|
1692
|
+
ce
|
|
1693
|
+
], B = (r, e) => {
|
|
1694
|
+
const t = ve.getLocal(r);
|
|
1695
|
+
return t == null ? e : t;
|
|
1696
|
+
}, N = (r, e) => {
|
|
1697
|
+
r && ve.setLocal(r, e);
|
|
1698
|
+
}, Ae = (r) => {
|
|
1699
|
+
r && ve.removeLocal(r);
|
|
1700
|
+
}, Sr = (r, e) => {
|
|
1701
|
+
var n, s;
|
|
1702
|
+
const t = (n = r == null ? void 0 : r.trim) == null ? void 0 : n.call(r);
|
|
1703
|
+
return t && e.some((o) => o.name === t) ? t : ((s = e[0]) == null ? void 0 : s.name) || gr;
|
|
1704
|
+
}, De = (r = []) => Array.isArray(r) ? r.filter((e) => typeof e == "string" && e) : [], Je = () => {
|
|
1705
|
+
const r = [], e = B(ae, { name: "", path: "" }), t = Number.parseFloat(B(Te, Re));
|
|
1706
|
+
return {
|
|
1707
|
+
taskState: {
|
|
1708
|
+
busy: !1,
|
|
1709
|
+
type: "",
|
|
1710
|
+
title: "",
|
|
1711
|
+
message: "",
|
|
1712
|
+
description: "",
|
|
1713
|
+
progress: 0
|
|
1714
|
+
},
|
|
1715
|
+
currScene: e,
|
|
1716
|
+
sceneList: r,
|
|
1717
|
+
previewScene: !!B(be, !1),
|
|
1718
|
+
activeMenuTitle: B(Pe, ye) || ye,
|
|
1719
|
+
pixelRatio: Number.isFinite(t) && t > 0 ? t : Re,
|
|
1720
|
+
logarithmicDepthBuffer: B(xe, !0) !== !1,
|
|
1721
|
+
addonEditorJson: De(B(ce, []))
|
|
1722
|
+
};
|
|
1723
|
+
}, vt = nn("threed", {
|
|
1724
|
+
state: () => Je(),
|
|
1725
|
+
actions: {
|
|
1726
|
+
getSceneList() {
|
|
1727
|
+
return f(this, null, function* () {
|
|
1728
|
+
var e;
|
|
1729
|
+
const r = yield H.getCommonApi("threedfloorplan", {
|
|
1730
|
+
limit: 1e4,
|
|
1731
|
+
ordering: "-create_time"
|
|
1732
|
+
});
|
|
1733
|
+
(e = r == null ? void 0 : r.data) != null && e.length ? (this.sceneList = r.data, this.currScene.path ? this.sceneList.find((n) => n.id === this.currScene.id) || this.setCurrScene({ name: "", path: "" }) : this.setCurrScene(this.sceneList[0])) : (this.sceneList = [], this.setCurrScene({ name: "", path: "" }));
|
|
1734
|
+
});
|
|
1735
|
+
},
|
|
1736
|
+
setSceneList(r) {
|
|
1737
|
+
this.sceneList = r;
|
|
1738
|
+
},
|
|
1739
|
+
setSceneName(r) {
|
|
1740
|
+
this.sceneName = Sr(r, this.sceneList), N(ae, this.sceneName);
|
|
1741
|
+
},
|
|
1742
|
+
createScene(r, e = "") {
|
|
1743
|
+
return f(this, null, function* () {
|
|
1744
|
+
var l, u;
|
|
1745
|
+
const t = (l = r == null ? void 0 : r.trim) == null ? void 0 : l.call(r);
|
|
1746
|
+
if (!t || this.sceneList.some((d) => d.name === t)) return !1;
|
|
1747
|
+
const n = ft.threeSavePath + "/" + ge() + ".json", s = ge();
|
|
1748
|
+
if (!(yield H.postCommonApi("query/threedfloorplan/create", {
|
|
1749
|
+
data: [
|
|
1750
|
+
{
|
|
1751
|
+
name: t,
|
|
1752
|
+
path: n,
|
|
1753
|
+
guid: s
|
|
1754
|
+
}
|
|
1755
|
+
]
|
|
1756
|
+
})).success)
|
|
1757
|
+
return !1;
|
|
1758
|
+
if (yield kn(n, e)) {
|
|
1759
|
+
const d = yield H.postCommonApi("threedfloorplan", { guid: s });
|
|
1760
|
+
if ((u = d == null ? void 0 : d.data) != null && u.length)
|
|
1761
|
+
return this.sceneList = [...this.sceneList, d.data[0]], d.data[0];
|
|
1762
|
+
}
|
|
1763
|
+
return !0;
|
|
1764
|
+
});
|
|
1765
|
+
},
|
|
1766
|
+
deleteScene(r) {
|
|
1767
|
+
return f(this, null, function* () {
|
|
1768
|
+
var n;
|
|
1769
|
+
if (!r) return;
|
|
1770
|
+
if (!(yield H.postCommonApi("query/threedfloorplan/delete", {
|
|
1771
|
+
data: [r]
|
|
1772
|
+
})).success)
|
|
1773
|
+
return !1;
|
|
1774
|
+
const t = this.sceneList.findIndex((s) => s.id === r);
|
|
1775
|
+
return t === -1 ? !1 : (this.sceneList.splice(t, 1), ((n = this.currScene) == null ? void 0 : n.id) === r && this.setCurrScene(this.sceneList[0] || { name: "", path: "" }), !0);
|
|
1776
|
+
});
|
|
1777
|
+
},
|
|
1778
|
+
setCurrScene(r) {
|
|
1779
|
+
return f(this, null, function* () {
|
|
1780
|
+
this.currScene = r, N(ae, this.currScene);
|
|
1781
|
+
});
|
|
1782
|
+
},
|
|
1783
|
+
setPreviewMode(r) {
|
|
1784
|
+
this.previewScene = !!r, N(be, this.previewScene);
|
|
1785
|
+
},
|
|
1786
|
+
setActiveMenuTitle(r) {
|
|
1787
|
+
this.activeMenuTitle = r || ye, N(Pe, this.activeMenuTitle);
|
|
1788
|
+
},
|
|
1789
|
+
setPixelRatio(r) {
|
|
1790
|
+
const e = Number.parseFloat(r);
|
|
1791
|
+
this.pixelRatio = Number.isFinite(e) && e > 0 ? e : Re, N(Te, this.pixelRatio);
|
|
1792
|
+
},
|
|
1793
|
+
setLogarithmicDepthBuffer(r) {
|
|
1794
|
+
this.logarithmicDepthBuffer = !!r, N(xe, this.logarithmicDepthBuffer);
|
|
1795
|
+
},
|
|
1796
|
+
getSceneStorageKey(r) {
|
|
1797
|
+
return `${r || this.sceneName}${Ye}`;
|
|
1798
|
+
},
|
|
1799
|
+
getSceneStorageParams(r, e = null) {
|
|
1800
|
+
return B(this.getSceneStorageKey(r), e);
|
|
1801
|
+
},
|
|
1802
|
+
setSceneStorageParams(r, e) {
|
|
1803
|
+
r && N(this.getSceneStorageKey(r), e);
|
|
1804
|
+
},
|
|
1805
|
+
removeSceneStorageParams(r) {
|
|
1806
|
+
r && Ae(this.getSceneStorageKey(r));
|
|
1807
|
+
},
|
|
1808
|
+
// 导出结束后延迟清空进度态,避免面板闪烁
|
|
1809
|
+
resetTaskState() {
|
|
1810
|
+
return f(this, null, function* () {
|
|
1811
|
+
yield new Promise((r) => setTimeout(r, 120)), this.taskState = {
|
|
1812
|
+
busy: !1,
|
|
1813
|
+
type: "",
|
|
1814
|
+
title: "",
|
|
1815
|
+
message: "",
|
|
1816
|
+
description: "",
|
|
1817
|
+
progress: 0
|
|
1818
|
+
};
|
|
1819
|
+
});
|
|
1820
|
+
},
|
|
1821
|
+
getAddonEditorJson() {
|
|
1822
|
+
return this.addonEditorJson = De(B(ce, this.addonEditorJson)), this.addonEditorJson;
|
|
1823
|
+
},
|
|
1824
|
+
setAddonEditorJson(r) {
|
|
1825
|
+
this.addonEditorJson = De(r), N(ce, this.addonEditorJson);
|
|
1826
|
+
},
|
|
1827
|
+
clearThreedStorage() {
|
|
1828
|
+
wr.forEach((e) => Ae(e)), Object.keys(window.localStorage).filter((e) => e.endsWith(Ye)).forEach((e) => Ae(e));
|
|
1829
|
+
const r = Je();
|
|
1830
|
+
this.currScene = r.currScene, this.sceneList = r.sceneList, this.previewScene = r.previewScene, this.activeMenuTitle = r.activeMenuTitle, this.pixelRatio = r.pixelRatio, this.logarithmicDepthBuffer = r.logarithmicDepthBuffer, this.addonEditorJson = r.addonEditorJson;
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
}), ee = (r) => {
|
|
1834
|
+
const { onClose: e, customClass: t } = r;
|
|
1835
|
+
return G(ne(x({}, r), {
|
|
1836
|
+
center: !0,
|
|
1837
|
+
customClass: `sy-message ${t || ""}`,
|
|
1838
|
+
onClose: (s) => {
|
|
1839
|
+
e && e(s);
|
|
1840
|
+
}
|
|
1841
|
+
}));
|
|
1842
|
+
};
|
|
1843
|
+
["success", "warning", "info", "error"].forEach((r) => {
|
|
1844
|
+
ee[r] = (e) => ee(typeof e == "string" ? { type: r, message: e } : ne(x({}, e), { type: r }));
|
|
1845
|
+
});
|
|
1846
|
+
const Ir = {
|
|
1847
|
+
backgroundBlurriness: 0,
|
|
1848
|
+
backgroundIntensity: 1,
|
|
1849
|
+
backgroundUrls: null,
|
|
1850
|
+
environmentEnabled: !1
|
|
1851
|
+
}, Cr = {
|
|
1852
|
+
fov: 50,
|
|
1853
|
+
near: 0.1,
|
|
1854
|
+
far: 1e5,
|
|
1855
|
+
zoom: 1,
|
|
1856
|
+
layers: {
|
|
1857
|
+
mask: 1
|
|
1858
|
+
},
|
|
1859
|
+
filmOffset: 0,
|
|
1860
|
+
filmGauge: 35,
|
|
1861
|
+
position: {
|
|
1862
|
+
x: 247.72931803058157,
|
|
1863
|
+
y: 715.3890430349733,
|
|
1864
|
+
z: 789.6794984861216
|
|
1865
|
+
}
|
|
1866
|
+
}, yr = {
|
|
1867
|
+
outputColorSpace: "srgb",
|
|
1868
|
+
toneMapping: 0,
|
|
1869
|
+
toneMappingExposure: 1,
|
|
1870
|
+
shadowMap: {
|
|
1871
|
+
enabled: !1,
|
|
1872
|
+
type: 1
|
|
1873
|
+
},
|
|
1874
|
+
color: 0,
|
|
1875
|
+
opacity: 0,
|
|
1876
|
+
sortObjects: !0,
|
|
1877
|
+
localClippingEnabled: !1,
|
|
1878
|
+
autoClear: !0,
|
|
1879
|
+
autoClearColor: !0,
|
|
1880
|
+
renderListCompare: [
|
|
1881
|
+
{
|
|
1882
|
+
name: "stats",
|
|
1883
|
+
enabled: !0
|
|
1884
|
+
},
|
|
1885
|
+
{
|
|
1886
|
+
name: "controls",
|
|
1887
|
+
enabled: !0
|
|
1888
|
+
},
|
|
1889
|
+
{
|
|
1890
|
+
name: "scene",
|
|
1891
|
+
enabled: !0
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
name: "css3DRender",
|
|
1895
|
+
enabled: !0
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
name: "css2DRender",
|
|
1899
|
+
enabled: !0
|
|
1900
|
+
}
|
|
1901
|
+
]
|
|
1902
|
+
}, Rr = {
|
|
1903
|
+
autoRotate: !1,
|
|
1904
|
+
autoRotateSpeed: 2,
|
|
1905
|
+
enableDamping: !0,
|
|
1906
|
+
dampingFactor: 0.05,
|
|
1907
|
+
minDistance: 0.01,
|
|
1908
|
+
maxDistance: 1e6,
|
|
1909
|
+
maxAzimuthAngle: null,
|
|
1910
|
+
minAzimuthAngle: null,
|
|
1911
|
+
maxPolarAngle: 3.141592653589793,
|
|
1912
|
+
minPolarAngle: 0,
|
|
1913
|
+
maxTargetRadius: null,
|
|
1914
|
+
minTargetRadius: 0,
|
|
1915
|
+
enablePan: !0,
|
|
1916
|
+
panSpeed: 1,
|
|
1917
|
+
enableRotate: !0,
|
|
1918
|
+
rotateSpeed: 1,
|
|
1919
|
+
enableZoom: !0,
|
|
1920
|
+
zoomSpeed: 1,
|
|
1921
|
+
zoomToCursor: !1,
|
|
1922
|
+
target: {
|
|
1923
|
+
x: -38.59603927643809,
|
|
1924
|
+
y: -48.97202695679889,
|
|
1925
|
+
z: -49.19814250541991
|
|
1926
|
+
}
|
|
1927
|
+
}, Dr = {
|
|
1928
|
+
mode: "translate",
|
|
1929
|
+
space: "world",
|
|
1930
|
+
size: 1,
|
|
1931
|
+
showX: !0,
|
|
1932
|
+
showY: !0,
|
|
1933
|
+
showZ: !0,
|
|
1934
|
+
translationSnap: null,
|
|
1935
|
+
rotationSnap: null,
|
|
1936
|
+
scaleSnap: null
|
|
1937
|
+
}, vr = {
|
|
1938
|
+
renderWay: "effectComposer",
|
|
1939
|
+
fxaaPass: {
|
|
1940
|
+
enabled: !0,
|
|
1941
|
+
order: 60,
|
|
1942
|
+
multPixel: 1
|
|
1943
|
+
},
|
|
1944
|
+
outlinePass: {
|
|
1945
|
+
enabled: !0,
|
|
1946
|
+
order: 40,
|
|
1947
|
+
edgeStrength: 3,
|
|
1948
|
+
edgeGlow: 0,
|
|
1949
|
+
edgeThickness: 1,
|
|
1950
|
+
pulsePeriod: 0,
|
|
1951
|
+
usePatternTexture: !1,
|
|
1952
|
+
visibleEdgeColor: 16449071,
|
|
1953
|
+
hiddenEdgeColor: 16449071,
|
|
1954
|
+
overlayMaterial: {
|
|
1955
|
+
blending: 5,
|
|
1956
|
+
blendEquation: 100,
|
|
1957
|
+
blendSrc: 201,
|
|
1958
|
+
blendDst: 205
|
|
1959
|
+
}
|
|
1960
|
+
},
|
|
1961
|
+
outputPass: {
|
|
1962
|
+
enabled: !0,
|
|
1963
|
+
order: 50
|
|
1964
|
+
},
|
|
1965
|
+
saoPass: {
|
|
1966
|
+
enabled: !1,
|
|
1967
|
+
order: 10,
|
|
1968
|
+
saoBias: 0.5,
|
|
1969
|
+
saoIntensity: 0.01,
|
|
1970
|
+
saoScale: 100,
|
|
1971
|
+
saoKernelRadius: 100,
|
|
1972
|
+
saoMinResolution: 0,
|
|
1973
|
+
saoBlur: !0,
|
|
1974
|
+
saoBlurRadius: 8,
|
|
1975
|
+
saoBlurStdDev: 4,
|
|
1976
|
+
saoBlurDepthCutoff: 0.01
|
|
1977
|
+
},
|
|
1978
|
+
screenMaskPass: {
|
|
1979
|
+
enabled: !1,
|
|
1980
|
+
order: 70,
|
|
1981
|
+
intensity: 1,
|
|
1982
|
+
maskColor: 16777215,
|
|
1983
|
+
R: 0.2,
|
|
1984
|
+
sr: 1.2
|
|
1985
|
+
},
|
|
1986
|
+
ssrPass: {
|
|
1987
|
+
enabled: !1,
|
|
1988
|
+
order: 30,
|
|
1989
|
+
maxDistance: 0.01,
|
|
1990
|
+
distanceAttenuation: !0,
|
|
1991
|
+
opacity: 0.5,
|
|
1992
|
+
thickness: 0.018,
|
|
1993
|
+
fresnel: !0,
|
|
1994
|
+
infiniteThick: !1,
|
|
1995
|
+
bouncing: !1
|
|
1996
|
+
},
|
|
1997
|
+
unrealBloomPass: {
|
|
1998
|
+
enabled: !1,
|
|
1999
|
+
order: 20,
|
|
2000
|
+
strength: 1.5,
|
|
2001
|
+
radius: 0.4,
|
|
2002
|
+
threshold: 0.85
|
|
2003
|
+
}
|
|
2004
|
+
}, xr = {
|
|
2005
|
+
mode: "transform",
|
|
2006
|
+
openKeyEnable: !0,
|
|
2007
|
+
rightClickMenusEnable: !0,
|
|
2008
|
+
selectChildEnabled: !1,
|
|
2009
|
+
selectChildLevel: 1,
|
|
2010
|
+
stats: {
|
|
2011
|
+
showStats: !1,
|
|
2012
|
+
statsMode: 0
|
|
2013
|
+
},
|
|
2014
|
+
helpers: {
|
|
2015
|
+
axes: {
|
|
2016
|
+
showAxes: !0,
|
|
2017
|
+
axesLength: 1e3
|
|
2018
|
+
},
|
|
2019
|
+
grid: {
|
|
2020
|
+
showGrid: !0,
|
|
2021
|
+
size: 1e3,
|
|
2022
|
+
divisions: 15,
|
|
2023
|
+
colorCenterLine: 4473924,
|
|
2024
|
+
colorGrid: 8947848
|
|
2025
|
+
},
|
|
2026
|
+
box3: {
|
|
2027
|
+
useBox3: !0,
|
|
2028
|
+
color: 16776960
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
}, Pr = [], Tr = [], br = [], Lr = [], Or = [], Mr = [], Ur = {}, Hr = [], kr = {
|
|
2032
|
+
viewAngleList: [],
|
|
2033
|
+
clipping: {
|
|
2034
|
+
size: 20,
|
|
2035
|
+
clipList: []
|
|
2036
|
+
}
|
|
2037
|
+
}, Fr = {
|
|
2038
|
+
scene: Ir,
|
|
2039
|
+
perspectiveCamera: Cr,
|
|
2040
|
+
webglRenderer: yr,
|
|
2041
|
+
orbitControls: Rr,
|
|
2042
|
+
transformControls: Dr,
|
|
2043
|
+
effectComposer: vr,
|
|
2044
|
+
handler: xr,
|
|
2045
|
+
lightCores: Pr,
|
|
2046
|
+
innerCores: Tr,
|
|
2047
|
+
modelCores: br,
|
|
2048
|
+
drawCores: Lr,
|
|
2049
|
+
textCores: Or,
|
|
2050
|
+
particleCores: Mr,
|
|
2051
|
+
geoCores: Ur,
|
|
2052
|
+
designCores: Hr,
|
|
2053
|
+
other: kr
|
|
2054
|
+
}, xt = (r, e) => {
|
|
2055
|
+
const t = r.__vccOpts || r;
|
|
2056
|
+
for (const [n, s] of e)
|
|
2057
|
+
t[n] = s;
|
|
2058
|
+
return t;
|
|
2059
|
+
}, Nr = /* @__PURE__ */ Object.assign({
|
|
2060
|
+
name: "ThreedEditor"
|
|
2061
|
+
}, {
|
|
2062
|
+
__name: "editor",
|
|
2063
|
+
props: {
|
|
2064
|
+
data: {
|
|
2065
|
+
type: Object,
|
|
2066
|
+
default: () => ({})
|
|
2067
|
+
},
|
|
2068
|
+
preview: {
|
|
2069
|
+
type: Boolean,
|
|
2070
|
+
default: !1
|
|
2071
|
+
}
|
|
2072
|
+
},
|
|
2073
|
+
emits: ["emit-three-editor", "graph-event"],
|
|
2074
|
+
setup(r, { expose: e, emit: t }) {
|
|
2075
|
+
const n = r, s = vt(), { currScene: o } = rn(s), a = t, l = window.__SY_THREED_DRACO_PATH__ || "/draco/";
|
|
2076
|
+
_e.dracoPath = l.endsWith("/") ? l : l + "/";
|
|
2077
|
+
let u = null, d = null;
|
|
2078
|
+
const v = ct(null), {
|
|
2079
|
+
setGuiParams: K,
|
|
2080
|
+
getDevicePixelRatio: M,
|
|
2081
|
+
getThreeEditorDB: k,
|
|
2082
|
+
createBlobUrl: _,
|
|
2083
|
+
revokeModelObjectUrls: b,
|
|
2084
|
+
ensureThreedDesignRegistry: $
|
|
2085
|
+
} = Ar();
|
|
2086
|
+
$(_e), K({ step: 0.1 });
|
|
2087
|
+
const p = () => {
|
|
2088
|
+
var I;
|
|
2089
|
+
return (I = u == null ? void 0 : u.renderSceneResize) == null ? void 0 : I.call(u);
|
|
2090
|
+
}, E = () => f(this, null, function* () {
|
|
2091
|
+
var P, F;
|
|
2092
|
+
let I = Fr;
|
|
2093
|
+
try {
|
|
2094
|
+
if (n.data && Object.keys(n.data).length)
|
|
2095
|
+
I = n.data;
|
|
2096
|
+
else if ((P = o.value) != null && P.path) {
|
|
2097
|
+
const L = yield H.getApi((F = o.value) == null ? void 0 : F.path).catch(() => ({}));
|
|
2098
|
+
console.log("初始化三维场景:", L), L.res && (I = L.res);
|
|
2099
|
+
}
|
|
2100
|
+
u ? u.resetEditorStorage(I) : u = new _e(v.value, {
|
|
2101
|
+
fps: null,
|
|
2102
|
+
pixelRatio: M() * s.pixelRatio,
|
|
2103
|
+
webglRenderParams: {
|
|
2104
|
+
antialias: !0,
|
|
2105
|
+
alpha: !0,
|
|
2106
|
+
logarithmicDepthBuffer: s.logarithmicDepthBuffer
|
|
2107
|
+
},
|
|
2108
|
+
sceneParams: D(I)
|
|
2109
|
+
});
|
|
2110
|
+
} catch (L) {
|
|
2111
|
+
console.error("三维图纸初始化失败", L), u == null || u.resetEditorStorage(I);
|
|
2112
|
+
} finally {
|
|
2113
|
+
n.preview && u && setTimeout(() => {
|
|
2114
|
+
u.handler.mode = "none", u.handler.helpers.axes.showAxes = !1, u.handler.helpers.box3.useBox3 = !1, u.handler.helpers.grid.showGrid = !1;
|
|
2115
|
+
}, 200), S();
|
|
2116
|
+
}
|
|
2117
|
+
a("emit-three-editor", u), window.addEventListener("resize", p);
|
|
2118
|
+
}), D = (I) => {
|
|
2119
|
+
b(), I.designCores.forEach((V) => {
|
|
2120
|
+
V.preview = n.preview;
|
|
2121
|
+
});
|
|
2122
|
+
const P = k(), F = P.list || [], L = structuredClone(I || {});
|
|
2123
|
+
return L.modelCores = (L.modelCores || []).filter((V) => {
|
|
2124
|
+
const z = V.modelInfo.originPath;
|
|
2125
|
+
if (z) {
|
|
2126
|
+
const te = F.find((j) => j.name === z);
|
|
2127
|
+
if (!te) {
|
|
2128
|
+
const j = P.db.getRequest(z);
|
|
2129
|
+
V.modelInfo.url = j.url;
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
const he = _(te.blob);
|
|
2133
|
+
V.modelInfo.url = he;
|
|
2134
|
+
}
|
|
2135
|
+
return !0;
|
|
2136
|
+
}), L;
|
|
2137
|
+
}, S = () => {
|
|
2138
|
+
u != null && u.renderer && (d = new U.PMREMGenerator(u.renderer), d.compileEquirectangularShader(), u.scene.environment = d.fromScene(new cn()).texture);
|
|
2139
|
+
}, w = () => u;
|
|
2140
|
+
return oe(
|
|
2141
|
+
() => o.value.path,
|
|
2142
|
+
() => f(this, null, function* () {
|
|
2143
|
+
E();
|
|
2144
|
+
})
|
|
2145
|
+
), oe(
|
|
2146
|
+
() => n.data,
|
|
2147
|
+
() => {
|
|
2148
|
+
E();
|
|
2149
|
+
},
|
|
2150
|
+
{ deep: !0 }
|
|
2151
|
+
), lt(() => {
|
|
2152
|
+
E();
|
|
2153
|
+
}), ut(() => {
|
|
2154
|
+
window.removeEventListener("resize", p), b(), u == null || u.destroySceneRender(), s.setCurrScene({ name: "", path: "" });
|
|
2155
|
+
}), e({
|
|
2156
|
+
getEditorInstance: w
|
|
2157
|
+
}), (I, P) => (ht(), dt("div", {
|
|
2158
|
+
ref_key: "editorRef",
|
|
2159
|
+
ref: v,
|
|
2160
|
+
class: "threed-editor",
|
|
2161
|
+
onDragover: P[0] || (P[0] = Ne(() => {
|
|
2162
|
+
}, ["prevent"])),
|
|
2163
|
+
onDrop: P[1] || (P[1] = Ne(() => {
|
|
2164
|
+
}, ["prevent"]))
|
|
2165
|
+
}, null, 544));
|
|
2166
|
+
}
|
|
2167
|
+
}), Br = /* @__PURE__ */ xt(Nr, [["__scopeId", "data-v-cebfdbf8"]]), Gr = { class: "threed-preview" }, Kr = {
|
|
2168
|
+
__name: "preview",
|
|
2169
|
+
props: {
|
|
2170
|
+
// 场景数据,优先级最高
|
|
2171
|
+
data: {
|
|
2172
|
+
type: Object,
|
|
2173
|
+
default: null
|
|
2174
|
+
},
|
|
2175
|
+
// 场景json文件地址,优先级第二
|
|
2176
|
+
url: {
|
|
2177
|
+
type: String,
|
|
2178
|
+
default: ""
|
|
2179
|
+
},
|
|
2180
|
+
// 场景数据库中存储guid,优先级第三
|
|
2181
|
+
id: {
|
|
2182
|
+
type: String,
|
|
2183
|
+
default: ""
|
|
2184
|
+
},
|
|
2185
|
+
token: {
|
|
2186
|
+
type: String,
|
|
2187
|
+
default: ""
|
|
2188
|
+
},
|
|
2189
|
+
socketUrl: {
|
|
2190
|
+
type: String,
|
|
2191
|
+
default: ""
|
|
2192
|
+
}
|
|
2193
|
+
},
|
|
2194
|
+
emits: ["loaded", "graph-event"],
|
|
2195
|
+
setup(r, { expose: e, emit: t }) {
|
|
2196
|
+
const n = r, s = t;
|
|
2197
|
+
let o = Xt({});
|
|
2198
|
+
const a = ct(), l = vt(), u = {};
|
|
2199
|
+
let d = null;
|
|
2200
|
+
const v = (p) => {
|
|
2201
|
+
var D, S, w;
|
|
2202
|
+
if (!p) return;
|
|
2203
|
+
if ((D = p == null ? void 0 : p.includes) != null && D.call(p, "token 必传"))
|
|
2204
|
+
return ee({
|
|
2205
|
+
message: p,
|
|
2206
|
+
type: "warning"
|
|
2207
|
+
});
|
|
2208
|
+
const E = typeof p == "string" ? JSON.parse(p) : p;
|
|
2209
|
+
if ((E == null ? void 0 : E.data) === "服务错误" || (w = (S = E == null ? void 0 : E.data) == null ? void 0 : S.includes) != null && w.call(S, "token is expired"))
|
|
2210
|
+
return ee({
|
|
2211
|
+
message: E.data,
|
|
2212
|
+
type: "warning"
|
|
2213
|
+
});
|
|
2214
|
+
switch (E.action) {
|
|
2215
|
+
case Be.ACPOINT.YCVALUE:
|
|
2216
|
+
case Be.ACPOINT.YXVALUE:
|
|
2217
|
+
console.warn("遥测信息");
|
|
2218
|
+
break;
|
|
2219
|
+
}
|
|
2220
|
+
}, K = () => {
|
|
2221
|
+
try {
|
|
2222
|
+
d = new Hn({
|
|
2223
|
+
socketUrl: n.socketUrl,
|
|
2224
|
+
token: n.token,
|
|
2225
|
+
onMessage: v
|
|
2226
|
+
});
|
|
2227
|
+
} catch (p) {
|
|
2228
|
+
console.warn("三维场景消息处理失败", p);
|
|
2229
|
+
}
|
|
2230
|
+
}, M = (p) => f(this, null, function* () {
|
|
2231
|
+
var D;
|
|
2232
|
+
const E = yield H.postCommonApi("queryrealtimepoint", {
|
|
2233
|
+
point_id: p.join(",")
|
|
2234
|
+
});
|
|
2235
|
+
if ((D = E == null ? void 0 : E.data) != null && D.length) {
|
|
2236
|
+
E.data.forEach((w) => {
|
|
2237
|
+
u[w.guid] = w.value_disp || w.value;
|
|
2238
|
+
});
|
|
2239
|
+
const S = $();
|
|
2240
|
+
p.forEach((w) => {
|
|
2241
|
+
const I = S.scene.getObjectByProperty("dataId", w);
|
|
2242
|
+
I && (I.userData.params.state = u[w], I.userData.params.value = u[w]);
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2245
|
+
}), k = (p) => {
|
|
2246
|
+
console.log("🚀 ~ handleGraphEvent:", p), s("graph-event", p);
|
|
2247
|
+
}, _ = (p) => {
|
|
2248
|
+
var S;
|
|
2249
|
+
if (!p) return;
|
|
2250
|
+
console.log("🚀 ~ handleEditorReady:", p), n.socketUrl && K();
|
|
2251
|
+
const E = p.saveSceneEdit();
|
|
2252
|
+
let D = [];
|
|
2253
|
+
(S = E == null ? void 0 : E.designCores) == null || S.forEach((w) => {
|
|
2254
|
+
w.designType === "局放测点" && w.id && D.push(w.id);
|
|
2255
|
+
}), D != null && D.length && M(D), s("loaded", p);
|
|
2256
|
+
}, b = () => f(this, null, function* () {
|
|
2257
|
+
if (o.value && Object.keys(o.value).length)
|
|
2258
|
+
return;
|
|
2259
|
+
const p = Un(), E = n.url || p.url;
|
|
2260
|
+
if (E) {
|
|
2261
|
+
const w = yield H.getApi(E).catch(() => ({}));
|
|
2262
|
+
w.res && (o.value = w.res);
|
|
2263
|
+
return;
|
|
2264
|
+
}
|
|
2265
|
+
if (!(n.id || p.id)) {
|
|
2266
|
+
console.warn("三维场景渲染失败,场景id为空!");
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2269
|
+
const S = yield H.getCommonApi("threedfloorplan", {
|
|
2270
|
+
guid: n.id
|
|
2271
|
+
});
|
|
2272
|
+
S.data.length ? l.setCurrScene(S.data[0]) : console.warn("三维场景渲染失败,场景id为:" + n.id + "不存在!");
|
|
2273
|
+
}), $ = () => a.value ? a.value.getEditorInstance() : null;
|
|
2274
|
+
return oe(
|
|
2275
|
+
() => n.data,
|
|
2276
|
+
(p) => {
|
|
2277
|
+
o.value = p, b();
|
|
2278
|
+
},
|
|
2279
|
+
{ deep: !0, immediate: !0 }
|
|
2280
|
+
), oe(
|
|
2281
|
+
() => n.id,
|
|
2282
|
+
() => {
|
|
2283
|
+
b();
|
|
2284
|
+
},
|
|
2285
|
+
{ deep: !0, immediate: !0 }
|
|
2286
|
+
), lt(() => {
|
|
2287
|
+
we.on("three-event", k);
|
|
2288
|
+
}), ut(() => {
|
|
2289
|
+
d && d.destroy(), we.off("three-event", k);
|
|
2290
|
+
}), e({
|
|
2291
|
+
getEditorInstance: $
|
|
2292
|
+
}), (p, E) => (ht(), dt("div", Gr, [
|
|
2293
|
+
jt(Br, {
|
|
2294
|
+
ref_key: "threedEditorRef",
|
|
2295
|
+
ref: a,
|
|
2296
|
+
data: qt(o),
|
|
2297
|
+
preview: "",
|
|
2298
|
+
onGraphEvent: k,
|
|
2299
|
+
onEmitThreeEditor: _
|
|
2300
|
+
}, null, 8, ["data"])
|
|
2301
|
+
]));
|
|
2302
|
+
}
|
|
2303
|
+
}, le = /* @__PURE__ */ xt(Kr, [["__scopeId", "data-v-46ac6fc4"]]);
|
|
2304
|
+
le.name || (le.name = "SyThree");
|
|
2305
|
+
const Vr = (r) => {
|
|
2306
|
+
r.component(le.name || "SyThree", le);
|
|
2307
|
+
}, ls = { install: Vr };
|
|
2308
|
+
export {
|
|
2309
|
+
le as SyThree,
|
|
2310
|
+
ls as default
|
|
2311
|
+
};
|