@vsleem-realsee-viewer/shared 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -738,6 +738,21 @@ export declare const MAP_PROVIDERS: {
738
738
  CRSTypes: CRSTypes[];
739
739
  }[];
740
740
 
741
+ /**地图瓦片图层配置 */
742
+ export declare const MAP_TILE_LAYERS: ({
743
+ url: string;
744
+ options: {
745
+ subdomains: string[];
746
+ attribution: string;
747
+ };
748
+ } | {
749
+ url: string;
750
+ options: {
751
+ subdomains: string[];
752
+ attribution?: undefined;
753
+ };
754
+ })[];
755
+
741
756
  /**
742
757
  * 坐标系映射
743
758
  */
@@ -753,7 +768,8 @@ declare type MappingRecord = {
753
768
  srcCsId: number /** 源坐标系ID */;
754
769
  };
755
770
 
756
- declare type MapProvider = {
771
+ /**地图服务商 */
772
+ export declare type MapProvider = {
757
773
  name: string /**地图服务商名称 */;
758
774
  patterns: string[] /**匹配的关键词 */;
759
775
  CRSTypes: CRSTypes[] /**[中国大陆区域标准,中国大陆区域外标准] */;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var P = /* @__PURE__ */ ((s) => (s[s.CADModel = 5] = "CADModel", s[s.BIMModel = 6] = "BIMModel", s[s.ForgeModel = 7] = "ForgeModel", s[s.ThreeDModel = 8] = "ThreeDModel", s[s.GeoModel = 9] = "GeoModel", s[s.ScaleModel = 101] = "ScaleModel", s))(P || {}), ct = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(ct || {}), v = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(v || {}), A = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(A || {}), $ = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))($ || {}), M = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(M || {}), L = /* @__PURE__ */ ((s) => (s.JSON = "application/json", s.FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8", s.FORM_DATA = "multipart/form-data;charset=UTF-8", s.OCTET_STREAM = "'application/octet-stream", s))(L || {}), ht = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(ht || {}), _ = /* @__PURE__ */ ((s) => (s.en_US = "en-US", s.zh_CN = "zh-CN", s.ja_JP = "ja-JP", s))(_ || {}), g = /* @__PURE__ */ ((s) => (s.WGS84 = "WGS84", s.WGS1984 = "WGS84", s.EPSG4326 = "WGS84", s.GCJ02 = "GCJ02", s.AMap = "GCJ02", s.BD09 = "BD09", s.BD09LL = "BD09", s.Baidu = "BD09", s.BMap = "BD09", s.BD09MC = "BD09MC", s.BD09Meter = "BD09MC", s.EPSG3857 = "EPSG3857", s.EPSG900913 = "EPSG3857", s.EPSG102100 = "EPSG3857", s.WebMercator = "EPSG3857", s.WM = "EPSG3857", s))(g || {}), p = /* @__PURE__ */ ((s) => (s[s.GeoPointNoPlane = 9e3] = "GeoPointNoPlane", s[s.PointUnmappedGIS = 9010] = "PointUnmappedGIS", s[s.PointNoXYZ = 9011] = "PointNoXYZ", s[s.PointNoPlane = 9012] = "PointNoPlane", s[s.RelativePlaneUnmatch = 9020] = "RelativePlaneUnmatch", s[s.RelativeNoPlane = 9021] = "RelativeNoPlane", s[s.RelativeJsonError = 9022] = "RelativeJsonError", s[s.RequestCodeError = 9030] = "RequestCodeError", s[s.RequestResultError = 9031] = "RequestResultError", s[s.RequestUnknownError = 9032] = "RequestUnknownError", s))(p || {});
1
+ var ct = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(ct || {}), _ = /* @__PURE__ */ ((s) => (s.en_US = "en-US", s.zh_CN = "zh-CN", s.ja_JP = "ja-JP", s))(_ || {}), g = /* @__PURE__ */ ((s) => (s.WGS84 = "WGS84", s.WGS1984 = "WGS84", s.EPSG4326 = "WGS84", s.GCJ02 = "GCJ02", s.AMap = "GCJ02", s.BD09 = "BD09", s.BD09LL = "BD09", s.Baidu = "BD09", s.BMap = "BD09", s.BD09MC = "BD09MC", s.BD09Meter = "BD09MC", s.EPSG3857 = "EPSG3857", s.EPSG900913 = "EPSG3857", s.EPSG102100 = "EPSG3857", s.WebMercator = "EPSG3857", s.WM = "EPSG3857", s))(g || {}), b = /* @__PURE__ */ ((s) => (s[s.CADModel = 5] = "CADModel", s[s.BIMModel = 6] = "BIMModel", s[s.ForgeModel = 7] = "ForgeModel", s[s.ThreeDModel = 8] = "ThreeDModel", s[s.GeoModel = 9] = "GeoModel", s[s.ScaleModel = 101] = "ScaleModel", s))(b || {}), ht = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(ht || {}), v = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(v || {}), A = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(A || {}), p = /* @__PURE__ */ ((s) => (s[s.GeoPointNoPlane = 9e3] = "GeoPointNoPlane", s[s.PointUnmappedGIS = 9010] = "PointUnmappedGIS", s[s.PointNoXYZ = 9011] = "PointNoXYZ", s[s.PointNoPlane = 9012] = "PointNoPlane", s[s.RelativePlaneUnmatch = 9020] = "RelativePlaneUnmatch", s[s.RelativeNoPlane = 9021] = "RelativeNoPlane", s[s.RelativeJsonError = 9022] = "RelativeJsonError", s[s.RequestCodeError = 9030] = "RequestCodeError", s[s.RequestResultError = 9031] = "RequestResultError", s[s.RequestUnknownError = 9032] = "RequestUnknownError", s))(p || {}), $ = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))($ || {}), M = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(M || {}), G = /* @__PURE__ */ ((s) => (s.JSON = "application/json", s.FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8", s.FORM_DATA = "multipart/form-data;charset=UTF-8", s.OCTET_STREAM = "'application/octet-stream", s))(G || {});
2
2
  const lt = {
3
3
  baseUrl: "https://vsleem.com/api",
4
4
  authorizeCode: ""
@@ -41,6 +41,20 @@ const lt = {
41
41
  patterns: ["openstreetmap", "openstreetmap.org"],
42
42
  CRSTypes: [g.WGS84, g.WGS84]
43
43
  }
44
+ ], Jt = [
45
+ {
46
+ url: "https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=99d9995c80e5ae67e043d659b748eb4b",
47
+ options: {
48
+ subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
49
+ attribution: "© 天地图 GS(2022)3124号"
50
+ }
51
+ },
52
+ {
53
+ url: "https://t{s}.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=99d9995c80e5ae67e043d659b748eb4b",
54
+ options: {
55
+ subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"]
56
+ }
57
+ }
44
58
  ];
45
59
  class w extends Error {
46
60
  constructor(t, e, i) {
@@ -61,7 +75,7 @@ function mt(s) {
61
75
  const { baseUrl: t, authorizeCode: e, locale: i } = s;
62
76
  Object.assign(J, { baseUrl: t, authorizeCode: e, locale: i });
63
77
  }
64
- async function T(s, t) {
78
+ async function E(s, t) {
65
79
  const e = { ...ut, ...t }, i = { ...dt, ...s };
66
80
  try {
67
81
  const n = yt(i, e), { url: o, ...r } = n, c = await (await window.fetch(o, r)).json();
@@ -75,16 +89,16 @@ function yt(s, t) {
75
89
  let { url: a, method: c, headers: l = {}, params: h, data: u } = s;
76
90
  o && e && (a = `${e}${a}`), c = c?.toUpperCase();
77
91
  const d = { ...l };
78
- if (/^https?:\/\/.+$/i.test(e ?? "") ? d.PlatForm = new URL(e ?? "").host : d.PlatForm = new URL(window.location.href).host, r && i && (d.AuthorizationCode = i), c === M.POST && !d["Content-Type"] && (d["Content-Type"] = L.JSON), n && (d["Accept-Language"] = n), c === M.GET && h) {
92
+ if (/^https?:\/\/.+$/i.test(e ?? "") ? d.PlatForm = new URL(e ?? "").host : d.PlatForm = new URL(window.location.href).host, r && i && (d.AuthorizationCode = i), c === M.POST && !d["Content-Type"] && (d["Content-Type"] = G.JSON), n && (d["Accept-Language"] = n), c === M.GET && h) {
79
93
  const S = new URLSearchParams(h), at = a.includes("?") ? "&" : "?";
80
94
  a += at + `${S.toString()}`;
81
95
  }
82
- let b;
83
- return c === M.POST && (b = d["Content-Type"] === L.JSON ? JSON.stringify(u || {}) : u), {
96
+ let T;
97
+ return c === M.POST && (T = d["Content-Type"] === G.JSON ? JSON.stringify(u || {}) : u), {
84
98
  url: a,
85
99
  method: c,
86
100
  headers: d,
87
- body: b
101
+ body: T
88
102
  };
89
103
  }
90
104
  function wt(s, t) {
@@ -103,13 +117,13 @@ function pt(s) {
103
117
  typeof s == "string" ? s : "未知的请求错误"
104
118
  );
105
119
  }
106
- const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120
+ const Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
107
121
  __proto__: null,
108
- request: T,
122
+ request: E,
109
123
  setRequestGlobalConfig: mt
110
124
  }, Symbol.toStringTag, { value: "Module" }));
111
- function q(s, t) {
112
- return T(
125
+ function W(s, t) {
126
+ return E(
113
127
  {
114
128
  url: "/project/jssdk/cs/list",
115
129
  method: M.GET,
@@ -118,8 +132,8 @@ function q(s, t) {
118
132
  t
119
133
  );
120
134
  }
121
- function W(s, t) {
122
- return T(
135
+ function q(s, t) {
136
+ return E(
123
137
  {
124
138
  url: "/project/jssdk/cs/bind",
125
139
  method: M.POST,
@@ -129,7 +143,7 @@ function W(s, t) {
129
143
  );
130
144
  }
131
145
  function j(s, t) {
132
- return T(
146
+ return E(
133
147
  {
134
148
  url: "/project/jssdk/cs/save",
135
149
  method: M.POST,
@@ -138,8 +152,8 @@ function j(s, t) {
138
152
  t
139
153
  );
140
154
  }
141
- function Z(s, t) {
142
- return T(
155
+ function V(s, t) {
156
+ return E(
143
157
  {
144
158
  url: "/project/jssdk/cs/delete",
145
159
  method: M.POST,
@@ -148,8 +162,8 @@ function Z(s, t) {
148
162
  t
149
163
  );
150
164
  }
151
- function V(s, t) {
152
- return T(
165
+ function Z(s, t) {
166
+ return E(
153
167
  {
154
168
  url: "/project/jssdk/cs/mapping",
155
169
  method: M.POST,
@@ -159,7 +173,7 @@ function V(s, t) {
159
173
  );
160
174
  }
161
175
  function H(s, t) {
162
- return T(
176
+ return E(
163
177
  {
164
178
  url: "/project/jssdk/cs/mapping/query",
165
179
  method: M.GET,
@@ -169,7 +183,7 @@ function H(s, t) {
169
183
  );
170
184
  }
171
185
  function Q(s, t) {
172
- return T(
186
+ return E(
173
187
  {
174
188
  url: "/project/jssdk/project/detail",
175
189
  method: M.GET,
@@ -183,7 +197,7 @@ function gt(s, t = {
183
197
  joinBaseUrl: !1,
184
198
  withAuthorize: !1
185
199
  }) {
186
- return T(
200
+ return E(
187
201
  {
188
202
  url: s,
189
203
  method: M.GET
@@ -193,13 +207,13 @@ function gt(s, t = {
193
207
  }
194
208
  const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
195
209
  __proto__: null,
196
- bindCoordinate: W,
197
- getCoordinateList: q,
210
+ bindCoordinate: q,
211
+ getCoordinateList: W,
198
212
  getImageInfo: gt,
199
213
  getMappingRelation: H,
200
214
  getProjectDetail: Q,
201
- mapingCoordinate: V,
202
- removeCoordinate: Z,
215
+ mapingCoordinate: Z,
216
+ removeCoordinate: V,
203
217
  saveCoordinate: j
204
218
  }, Symbol.toStringTag, { value: "Module" })), Mt = typeof window < "u", xt = Object.prototype.toString;
205
219
  function D(s, t) {
@@ -211,7 +225,7 @@ function K(s) {
211
225
  function tt(s) {
212
226
  return !K(s);
213
227
  }
214
- function E(s) {
228
+ function P(s) {
215
229
  return s !== null && D(s, "Object");
216
230
  }
217
231
  function et(s) {
@@ -226,37 +240,37 @@ function St(s) {
226
240
  function k(s) {
227
241
  return typeof s == "function";
228
242
  }
229
- function bt(s) {
243
+ function Tt(s) {
230
244
  return D(s, "Boolean");
231
245
  }
232
- function Pt(s) {
246
+ function bt(s) {
233
247
  return D(s, "RegExp");
234
248
  }
235
249
  function x(s) {
236
250
  return s && Array.isArray(s);
237
251
  }
238
- function Tt(s) {
252
+ function Et(s) {
239
253
  return typeof window < "u" && D(s, "Window");
240
254
  }
241
- function Et(s) {
242
- return E(s) && !!s.tagName;
255
+ function Pt(s) {
256
+ return P(s) && !!s.tagName;
243
257
  }
244
- function O(s) {
258
+ function R(s) {
245
259
  return typeof s == "number" ? !0 : typeof s != "string" ? !1 : /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s);
246
260
  }
247
261
  function Dt(s, t) {
248
262
  return JSON.stringify(s) === JSON.stringify(t);
249
263
  }
250
- function zt(s) {
264
+ function It(s) {
251
265
  return tt(s) || et(s);
252
266
  }
253
- function Nt(s) {
254
- return D(s, "Promise") && E(s) && k(s.then) && k(s.catch);
267
+ function zt(s) {
268
+ return D(s, "Promise") && P(s) && k(s.then) && k(s.catch);
255
269
  }
256
- function Ct(s, t = {}) {
270
+ function Nt(s, t = {}) {
257
271
  return new Promise((e, i) => {
258
- const n = N(s);
259
- if (It(n)) {
272
+ const n = z(s);
273
+ if (Ct(n)) {
260
274
  e(!0);
261
275
  return;
262
276
  }
@@ -270,14 +284,14 @@ function Ct(s, t = {}) {
270
284
  }, document.head.appendChild(o);
271
285
  });
272
286
  }
273
- function It(s) {
274
- const t = N(s);
275
- return Array.from(document.scripts).some((e) => N(e.src) === t);
287
+ function Ct(s) {
288
+ const t = z(s);
289
+ return Array.from(document.scripts).some((e) => z(e.src) === t);
276
290
  }
277
- function Ot(s) {
291
+ function Rt(s) {
278
292
  return new Promise((t, e) => {
279
- const i = N(s);
280
- if (Rt(i)) {
293
+ const i = z(s);
294
+ if (Ot(i)) {
281
295
  t(!0);
282
296
  return;
283
297
  }
@@ -289,13 +303,13 @@ function Ot(s) {
289
303
  }, document.head.appendChild(n);
290
304
  });
291
305
  }
292
- function Rt(s) {
293
- const t = N(s);
306
+ function Ot(s) {
307
+ const t = z(s);
294
308
  return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(
295
- (e) => N(e.href) === t
309
+ (e) => z(e.href) === t
296
310
  );
297
311
  }
298
- function N(s) {
312
+ function z(s) {
299
313
  try {
300
314
  const t = new URL(s, window.location.href);
301
315
  return `${t.origin}${t.pathname}`;
@@ -304,9 +318,9 @@ function N(s) {
304
318
  }
305
319
  }
306
320
  function st(s) {
307
- return z(s, /* @__PURE__ */ new WeakMap());
321
+ return I(s, /* @__PURE__ */ new WeakMap());
308
322
  }
309
- function z(s, t) {
323
+ function I(s, t) {
310
324
  if (typeof s != "object" || s === null)
311
325
  return s;
312
326
  if (t.has(s))
@@ -318,11 +332,11 @@ function z(s, t) {
318
332
  return e = new RegExp(s), t.set(s, e), e;
319
333
  if (s instanceof Map)
320
334
  return e = /* @__PURE__ */ new Map(), t.set(s, e), s.forEach((n, o) => {
321
- e.set(o, z(n, t));
335
+ e.set(o, I(n, t));
322
336
  }), e;
323
337
  if (s instanceof Set)
324
338
  return e = /* @__PURE__ */ new Set(), t.set(s, e), s.forEach((n) => {
325
- e.add(z(n, t));
339
+ e.add(I(n, t));
326
340
  }), e;
327
341
  if (ArrayBuffer.isView(s))
328
342
  return e = new s.constructor(
@@ -335,18 +349,18 @@ function z(s, t) {
335
349
  if (Array.isArray(s)) {
336
350
  e = [], t.set(s, e);
337
351
  for (let n = 0; n < s.length; n++)
338
- n in s && (e[n] = z(s[n], t));
352
+ n in s && (e[n] = I(s[n], t));
339
353
  return e;
340
354
  }
341
355
  e = Object.create(Object.getPrototypeOf(s)), t.set(s, e);
342
356
  for (const n in s)
343
- Object.prototype.hasOwnProperty.call(s, n) && (e[n] = z(s[n], t));
357
+ Object.prototype.hasOwnProperty.call(s, n) && (e[n] = I(s[n], t));
344
358
  const i = Object.getOwnPropertySymbols(s);
345
359
  for (const n of i)
346
- Object.prototype.propertyIsEnumerable.call(s, n) && (e[n] = z(s[n], t));
360
+ Object.prototype.propertyIsEnumerable.call(s, n) && (e[n] = I(s[n], t));
347
361
  return e;
348
362
  }
349
- function Gt(s, t, e = !1) {
363
+ function Lt(s, t, e = !1) {
350
364
  let i;
351
365
  const n = function(...o) {
352
366
  const r = this, a = e && !i;
@@ -376,12 +390,12 @@ function At(s, t, e = !1) {
376
390
  function U(s, ...t) {
377
391
  if (!t.length) return s;
378
392
  const e = t.shift();
379
- return e === void 0 ? s : (I(s) && I(e) && Object.keys(e).forEach((i) => {
393
+ return e === void 0 ? s : (C(s) && C(e) && Object.keys(e).forEach((i) => {
380
394
  const n = s[i], o = e[i];
381
- Array.isArray(n) && Array.isArray(o) ? s[i] = [...n, ...o] : I(n) && I(o) ? s[i] = U({ ...n }, o) : o !== void 0 && (s[i] = o);
395
+ Array.isArray(n) && Array.isArray(o) ? s[i] = [...n, ...o] : C(n) && C(o) ? s[i] = U({ ...n }, o) : o !== void 0 && (s[i] = o);
382
396
  }), U(s, ...t));
383
397
  }
384
- function I(s) {
398
+ function C(s) {
385
399
  return s !== null && typeof s == "object" && !Array.isArray(s);
386
400
  }
387
401
  function it(s, ...t) {
@@ -395,26 +409,26 @@ function it(s, ...t) {
395
409
  }
396
410
  function nt(s, t) {
397
411
  const e = {};
398
- if (E(s) && !x(s)) {
412
+ if (P(s) && !x(s)) {
399
413
  for (const i in s)
400
414
  if (Object.prototype.hasOwnProperty.call(s, i)) {
401
- const n = s[i], o = E(t) && !x(t) ? t[i] : void 0;
415
+ const n = s[i], o = P(t) && !x(t) ? t[i] : void 0;
402
416
  if (!(i in (t || {})))
403
417
  e[i] = n;
404
418
  else if (x(n) && x(o))
405
419
  JSON.stringify(n) !== JSON.stringify(o) && (e[i] = n);
406
- else if (E(n) && E(o)) {
420
+ else if (P(n) && P(o)) {
407
421
  const r = nt(n, o);
408
422
  r && Object.keys(r).length > 0 && (e[i] = r);
409
423
  } else n !== o && (e[i] = n);
410
424
  }
411
425
  }
412
- if (E(t) && x(t))
426
+ if (P(t) && x(t))
413
427
  for (const i in t)
414
428
  Object.prototype.hasOwnProperty.call(t, i) && !(i in (s || {})) && (e[i] = void 0);
415
429
  return e;
416
430
  }
417
- function Lt(s = 0) {
431
+ function Gt(s = 0) {
418
432
  return new Promise((t) => setTimeout(t, s));
419
433
  }
420
434
  function jt(s) {
@@ -469,21 +483,21 @@ function Yt() {
469
483
  (e === 4 || e === 6 || e === 8 || e === 10) && (s += "-"), s += X[t[e] >>> 4], s += X[t[e] & 15];
470
484
  return s;
471
485
  }
472
- let R = 0;
473
- const $t = 9999;
474
- function _t(s = "") {
486
+ let O = 0;
487
+ const _t = 9999;
488
+ function $t(s = "") {
475
489
  const t = Date.now(), e = Math.floor(Math.random() * 1e6);
476
- return R = (R + 1) % $t, `${s}${s ? "_" : ""}${t}_${R.toString().padStart(4, "0")}_${e.toString().padStart(6, "0")}`;
490
+ return O = (O + 1) % _t, `${s}${s ? "_" : ""}${t}_${O.toString().padStart(4, "0")}_${e.toString().padStart(6, "0")}`;
477
491
  }
478
- const Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
492
+ const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
479
493
  __proto__: null,
480
- buildShortUUID: _t,
494
+ buildShortUUID: $t,
481
495
  buildUUID: Yt,
482
496
  cloneDeep: st,
483
- debounce: Gt,
497
+ debounce: Lt,
484
498
  deepMerge: U,
485
499
  deepMergeProps: it,
486
- delay: Lt,
500
+ delay: Gt,
487
501
  error: kt,
488
502
  getDiffProps: nt,
489
503
  getImageTransform: Xt,
@@ -491,23 +505,23 @@ const Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
491
505
  inBrowser: Mt,
492
506
  is: D,
493
507
  isArray: x,
494
- isBoolean: bt,
508
+ isBoolean: Tt,
495
509
  isDate: vt,
496
510
  isDef: K,
497
- isElement: Et,
511
+ isElement: Pt,
498
512
  isFunction: k,
499
513
  isNull: et,
500
- isNullOrUnDef: zt,
501
- isNumeric: O,
502
- isObject: E,
503
- isPromise: Nt,
504
- isRegExp: Pt,
514
+ isNullOrUnDef: It,
515
+ isNumeric: R,
516
+ isObject: P,
517
+ isPromise: zt,
518
+ isRegExp: bt,
505
519
  isSameValue: Dt,
506
520
  isString: St,
507
521
  isUnDef: tt,
508
- isWindow: Tt,
509
- loadCss: Ot,
510
- loadScript: Ct,
522
+ isWindow: Et,
523
+ loadCss: Rt,
524
+ loadScript: Nt,
511
525
  throttle: At,
512
526
  toCanvasCoord: Bt,
513
527
  toModelCoord: Ft,
@@ -543,7 +557,7 @@ class f {
543
557
  /** 默认平面 ('xy' 或 'xz') */
544
558
  constructor(t) {
545
559
  const { x: e, y: i, z: n, lat: o, lon: r, alt: a, yaw: c, pitch: l, roll: h, plane: u = "xy" } = t || {};
546
- this.x = Number(e) || 0, this.y = Number(i) || 0, this.z = Number(n) || 0, (this.x !== 0 || this.y !== 0 || this.z !== 0) && (this.plane = u, this.hasXYZ = !0), this.lat = Number(o) || 0, this.lon = Number(r) || 0, this.alt = Number(a) || 0, (this.lat !== 0 || this.lon !== 0 || this.alt !== 0) && (this.hasGeo = !0), this.yaw = Number(c) || 0, this.pitch = Number(l) || 0, this.roll = Number(h) || 0, (O(c) || O(l) || O(h)) && (this.hasAngle = !0);
560
+ this.x = Number(e) || 0, this.y = Number(i) || 0, this.z = Number(n) || 0, (this.x !== 0 || this.y !== 0 || this.z !== 0) && (this.plane = u, this.hasXYZ = !0), this.lat = Number(o) || 0, this.lon = Number(r) || 0, this.alt = Number(a) || 0, (this.lat !== 0 || this.lon !== 0 || this.alt !== 0) && (this.hasGeo = !0), this.yaw = Number(c) || 0, this.pitch = Number(l) || 0, this.roll = Number(h) || 0, (R(c) || R(l) || R(h)) && (this.hasAngle = !0);
547
561
  }
548
562
  /**
549
563
  * 计算两点之间的三维距离
@@ -630,18 +644,18 @@ class f {
630
644
  try {
631
645
  if (e?.id === i?.id)
632
646
  return new f(this);
633
- if (e?.modelType === P.GeoModel) {
647
+ if (e?.modelType === b.GeoModel) {
634
648
  const { refPoint: n } = e?.relativeMap || {};
635
649
  if (this.hasGeo && n) {
636
- const o = C.LLHToXYZ(this, n);
650
+ const o = N.LLHToXYZ(this, n);
637
651
  return this.x = o.x, this.y = o.y, this.z = o.z, this.hasXYZ = !0, this.project(t);
638
652
  }
639
653
  throw new w(p.PointUnmappedGIS, "没有完成GIS与其他空间的映射");
640
654
  }
641
- if (i?.modelType === P.GeoModel) {
655
+ if (i?.modelType === b.GeoModel) {
642
656
  const { refPoint: n } = i?.relativeMap || {}, o = this.project(t);
643
657
  if (o?.hasXYZ && n) {
644
- const r = C.XYZToLLH(o, n);
658
+ const r = N.XYZToLLH(o, n);
645
659
  return o.lat = r.lat, o.lon = r.lon, o.alt = r.alt, o.hasGeo = !0, o;
646
660
  }
647
661
  throw new w(p.PointUnmappedGIS, "没有完成GIS与其他空间的映射");
@@ -690,7 +704,7 @@ class f {
690
704
  return e.x = i + t.x, e.y = n + t.y, e.z += t.z, e;
691
705
  }
692
706
  }
693
- class C {
707
+ class N {
694
708
  lat = 0;
695
709
  /** 经度 */
696
710
  lon = 0;
@@ -712,7 +726,7 @@ class C {
712
726
  c = e.lon + f.toDegrees(u), l = e.lat - f.toDegrees(d), h = e.alt + t.z / 1e3;
713
727
  } else
714
728
  throw new w(p.GeoPointNoPlane, "点的plane应为xz或xy");
715
- return new C({
729
+ return new N({
716
730
  lat: l,
717
731
  lon: c,
718
732
  alt: h
@@ -750,7 +764,7 @@ class y {
750
764
  /** 参考点 */
751
765
  constructor(t) {
752
766
  const { refPoint: e, ...i } = t || {};
753
- e && (this.refPoint = new C(e)), Object.assign(this, i);
767
+ e && (this.refPoint = new N(e)), Object.assign(this, i);
754
768
  }
755
769
  /**
756
770
  * 合并两个相对坐标系的映射关系
@@ -837,7 +851,7 @@ class m {
837
851
  * @returns
838
852
  */
839
853
  static async getCoordinateTree(t) {
840
- const e = await q({ projectId: t });
854
+ const e = await W({ projectId: t });
841
855
  if (e.length) {
842
856
  const i = m.handleCoordinateList(e);
843
857
  return m.buildCoordinateTree(i, 0);
@@ -860,14 +874,14 @@ class m {
860
874
  */
861
875
  static async addCoordinate(t, e) {
862
876
  const { projectId: i, id: n } = t, o = e.map((a) => {
863
- const { type: c, modelType: l, relativeMap: h, level: u, ...d } = a, b = h ? JSON.stringify(h) : void 0;
877
+ const { type: c, modelType: l, relativeMap: h, level: u, ...d } = a, T = h ? JSON.stringify(h) : void 0;
864
878
  return {
865
879
  ...d,
866
880
  projectId: i,
867
881
  parentId: n,
868
882
  coordinateType: c,
869
883
  renderType: l,
870
- relativePosition: b
884
+ relativePosition: T
871
885
  };
872
886
  }), r = await j(o);
873
887
  return m.handleCoordinateList(r);
@@ -880,7 +894,7 @@ class m {
880
894
  */
881
895
  static async removeCoordinate(t, e) {
882
896
  const i = e.map((n) => n.id ?? -1);
883
- return await Z(i);
897
+ return await V(i);
884
898
  }
885
899
  /**
886
900
  * 更新坐标系
@@ -905,7 +919,7 @@ class m {
905
919
  const { projectId: i, id: n } = t, o = e.map((a) => {
906
920
  const { modelId: c } = a;
907
921
  return { modelId: c, parentId: n, projectId: i };
908
- }), r = await W(o);
922
+ }), r = await q(o);
909
923
  return m.handleCoordinateList(r);
910
924
  }
911
925
  /**
@@ -921,8 +935,8 @@ class m {
921
935
  renderType: o,
922
936
  relativePosition: r,
923
937
  ...a
924
- } = e, c = o === P.GeoModel ? new y(y.toParse(r)) : y.toParse(r);
925
- return new G({
938
+ } = e, c = o === b.GeoModel ? new y(y.toParse(r)) : y.toParse(r);
939
+ return new L({
926
940
  ...a,
927
941
  type: i,
928
942
  modelType: o,
@@ -940,7 +954,7 @@ class m {
940
954
  const e = Array.isArray(t) ? t : [t], i = [];
941
955
  function n(o) {
942
956
  for (const r of o) {
943
- const { level: a, parent: c, relativeMap: l, ...h } = r, u = new G({
957
+ const { level: a, parent: c, relativeMap: l, ...h } = r, u = new L({
944
958
  ...h,
945
959
  relativeMap: new y(l)
946
960
  });
@@ -991,14 +1005,14 @@ class m {
991
1005
  static filterSpaceTree(t, e) {
992
1006
  const i = [];
993
1007
  return t.forEach((n) => {
994
- const o = new G(n);
1008
+ const o = new L(n);
995
1009
  e && (o.parent = e);
996
1010
  const r = m.filterSpaceTree(o.children, o);
997
1011
  o.children = r, o.disabled = o.disabled ?? !1, o.type !== v.Model && i.push(o);
998
1012
  }), i;
999
1013
  }
1000
1014
  }
1001
- class G {
1015
+ class L {
1002
1016
  id = 0;
1003
1017
  /** id */
1004
1018
  type = 0;
@@ -1098,7 +1112,7 @@ class G {
1098
1112
  }
1099
1113
  /** 映射到(模型映射到空间,空间映射到空间) */
1100
1114
  async mappingTo(t) {
1101
- await V(t);
1115
+ await Z(t);
1102
1116
  }
1103
1117
  /** 来自映射(被映射过的源坐标系关系) */
1104
1118
  async getMapping() {
@@ -1131,11 +1145,11 @@ class G {
1131
1145
  * @returns
1132
1146
  */
1133
1147
  findClosestModel(t = [
1134
- P.CADModel,
1135
- P.BIMModel,
1136
- P.ForgeModel,
1137
- P.ThreeDModel,
1138
- P.GeoModel
1148
+ b.CADModel,
1149
+ b.BIMModel,
1150
+ b.ForgeModel,
1151
+ b.ThreeDModel,
1152
+ b.GeoModel
1139
1153
  ], e) {
1140
1154
  const i = x(t) ? t : [t], n = /* @__PURE__ */ new Set();
1141
1155
  e?.forEach((h) => {
@@ -1148,15 +1162,15 @@ class G {
1148
1162
  continue;
1149
1163
  const d = h.modelType ?? -1;
1150
1164
  i.includes(d) && a.push({ node: h, distance: u, modelType: d }), r.add(h);
1151
- const b = [];
1165
+ const T = [];
1152
1166
  if (h.children)
1153
1167
  for (const S of h.children)
1154
- r.has(S) || b.push(S);
1168
+ r.has(S) || T.push(S);
1155
1169
  if (h.parent?.children)
1156
1170
  for (const S of h.parent.children)
1157
- S !== h && !r.has(S) && b.push(S);
1158
- h.parent && !r.has(h.parent) && b.push(h.parent);
1159
- for (const S of b)
1171
+ S !== h && !r.has(S) && T.push(S);
1172
+ h.parent && !r.has(h.parent) && T.push(h.parent);
1173
+ for (const S of T)
1160
1174
  o.push({ node: S, distance: u + 1 });
1161
1175
  }
1162
1176
  if (a.length === 0)
@@ -1379,7 +1393,7 @@ class Zt {
1379
1393
  }), o;
1380
1394
  }
1381
1395
  }
1382
- class Vt {
1396
+ class Ht {
1383
1397
  canvas;
1384
1398
  ctx;
1385
1399
  options;
@@ -1565,7 +1579,7 @@ class Vt {
1565
1579
  }
1566
1580
  }
1567
1581
  const B = {};
1568
- class Ht {
1582
+ class Qt {
1569
1583
  type = "image";
1570
1584
  // 修改为更通用的名称
1571
1585
  x;
@@ -1600,7 +1614,7 @@ class Ht {
1600
1614
  }
1601
1615
  }
1602
1616
  }
1603
- class Qt {
1617
+ class Kt {
1604
1618
  id = "";
1605
1619
  type = "point";
1606
1620
  x;
@@ -1621,7 +1635,7 @@ class Qt {
1621
1635
  }
1622
1636
  }
1623
1637
  const F = {};
1624
- class Kt {
1638
+ class te {
1625
1639
  id = "";
1626
1640
  type = "issue";
1627
1641
  //轨迹点上的事件
@@ -1660,7 +1674,7 @@ class Kt {
1660
1674
  }
1661
1675
  }
1662
1676
  const Y = {};
1663
- class te {
1677
+ class ee {
1664
1678
  type = "marker";
1665
1679
  x;
1666
1680
  y;
@@ -1714,7 +1728,7 @@ class te {
1714
1728
  }
1715
1729
  }
1716
1730
  }
1717
- class ee {
1731
+ class se {
1718
1732
  type = "radar";
1719
1733
  x;
1720
1734
  y;
@@ -1744,7 +1758,7 @@ class ee {
1744
1758
  r.addColorStop(0, "rgba(180, 42, 42, 1)"), r.addColorStop(1, "rgba(180, 42, 42, 0.5)"), t.beginPath(), t.moveTo(this.x, this.y), t.arc(this.x, this.y, this.r * i, n, o), t.closePath(), t.fillStyle = r, t.fill(), t.restore();
1745
1759
  }
1746
1760
  }
1747
- class se {
1761
+ class ie {
1748
1762
  type = "region";
1749
1763
  x;
1750
1764
  y;
@@ -1779,35 +1793,36 @@ export {
1779
1793
  lt as APP_SETTING,
1780
1794
  w as AppError,
1781
1795
  p as AppErrorCode,
1782
- ht as AppObsType,
1796
+ ct as AppObsType,
1783
1797
  g as CRSTypes,
1784
- Vt as CanvasElement,
1785
- Ht as CanvasImageElement,
1786
- Kt as CanvasIssueElement,
1787
- te as CanvasMarkerElement,
1788
- Qt as CanvasPointElement,
1789
- ee as CanvasRadarElement,
1790
- se as CanvasRegionElement,
1791
- G as Coordinate,
1792
- ct as CoordinateLevel,
1793
- P as CoordinateModelType,
1798
+ Ht as CanvasElement,
1799
+ Qt as CanvasImageElement,
1800
+ te as CanvasIssueElement,
1801
+ ee as CanvasMarkerElement,
1802
+ Kt as CanvasPointElement,
1803
+ se as CanvasRadarElement,
1804
+ ie as CanvasRegionElement,
1805
+ L as Coordinate,
1806
+ ht as CoordinateLevel,
1807
+ b as CoordinateModelType,
1794
1808
  A as CoordinateStatus,
1795
1809
  v as CoordinateType,
1796
1810
  Zt as DataHelper,
1797
1811
  m as DataSource,
1798
- C as GeoPoint,
1812
+ N as GeoPoint,
1799
1813
  _ as LocaleType,
1800
1814
  ft as MAP_PROVIDERS,
1815
+ Jt as MAP_TILE_LAYERS,
1801
1816
  f as Point,
1802
1817
  ot as Position,
1803
1818
  dt as REQUEST_CONFIG,
1804
1819
  ut as REQUEST_OPTIONS,
1805
1820
  y as RelativeMap,
1806
- L as RequestContentType,
1821
+ G as RequestContentType,
1807
1822
  M as RequestMethod,
1808
1823
  $ as RequestResultCode,
1809
1824
  rt as Vector3,
1810
1825
  qt as api,
1811
- Jt as http,
1812
- Wt as utils
1826
+ Wt as http,
1827
+ Vt as utils
1813
1828
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(l,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(l=typeof globalThis<"u"?globalThis:l||self,M(l.Shared={}))})(this,(function(l){"use strict";var M=(s=>(s[s.CADModel=5]="CADModel",s[s.BIMModel=6]="BIMModel",s[s.ForgeModel=7]="ForgeModel",s[s.ThreeDModel=8]="ThreeDModel",s[s.GeoModel=9]="GeoModel",s[s.ScaleModel=101]="ScaleModel",s))(M||{}),$=(s=>(s[s.Global=0]="Global",s))($||{}),S=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(S||{}),R=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(R||{}),j=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(j||{}),v=(s=>(s.GET="GET",s.POST="POST",s))(v||{}),O=(s=>(s.JSON="application/json",s.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",s.FORM_DATA="multipart/form-data;charset=UTF-8",s.OCTET_STREAM="'application/octet-stream",s))(O||{}),q=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(q||{}),k=(s=>(s.en_US="en-US",s.zh_CN="zh-CN",s.ja_JP="ja-JP",s))(k||{}),x=(s=>(s.WGS84="WGS84",s.WGS1984="WGS84",s.EPSG4326="WGS84",s.GCJ02="GCJ02",s.AMap="GCJ02",s.BD09="BD09",s.BD09LL="BD09",s.Baidu="BD09",s.BMap="BD09",s.BD09MC="BD09MC",s.BD09Meter="BD09MC",s.EPSG3857="EPSG3857",s.EPSG900913="EPSG3857",s.EPSG102100="EPSG3857",s.WebMercator="EPSG3857",s.WM="EPSG3857",s))(x||{}),g=(s=>(s[s.GeoPointNoPlane=9e3]="GeoPointNoPlane",s[s.PointUnmappedGIS=9010]="PointUnmappedGIS",s[s.PointNoXYZ=9011]="PointNoXYZ",s[s.PointNoPlane=9012]="PointNoPlane",s[s.RelativePlaneUnmatch=9020]="RelativePlaneUnmatch",s[s.RelativeNoPlane=9021]="RelativeNoPlane",s[s.RelativeJsonError=9022]="RelativeJsonError",s[s.RequestCodeError=9030]="RequestCodeError",s[s.RequestResultError=9031]="RequestResultError",s[s.RequestUnknownError=9032]="RequestUnknownError",s))(g||{});const J={baseUrl:"https://vsleem.com/api",authorizeCode:""},W={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},V={url:"",method:v.GET,headers:{}},Z=[{name:"GAODE",patterns:["amap","amap.com","autonavi.com","restapi.amap.com","tiles.amap.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"BAIDU",patterns:["baidu","baidu.com","bdimg.com"],CRSTypes:[x.BD09,x.WGS84]},{name:"TENCENT",patterns:["qq.com","map.qq.com","map.gtimg.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"TIANDITU",patterns:["tianditu","tianditu.gov.cn"],CRSTypes:[x.WGS84,x.WGS84]},{name:"GOOGLE",patterns:["google","googleapis","google.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"OPENSTREET",patterns:["openstreetmap","openstreetmap.org"],CRSTypes:[x.WGS84,x.WGS84]}];class m extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,m.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}const H={...J};function mt(s){const{baseUrl:t,authorizeCode:e,locale:i}=s;Object.assign(H,{baseUrl:t,authorizeCode:e,locale:i})}async function P(s,t){const e={...W,...t},i={...V,...s};try{const n=yt(i,e),{url:o,...r}=n,c=await(await window.fetch(o,r)).json();return wt(c,e)}catch(n){return pt(n)}}function yt(s,t){const{baseUrl:e,authorizeCode:i,locale:n=k.zh_CN}=H,{joinBaseUrl:o,withAuthorize:r}=t;let{url:a,method:c,headers:u={},params:h,data:d}=s;o&&e&&(a=`${e}${a}`),c=c?.toUpperCase();const f={...u};if(/^https?:\/\/.+$/i.test(e??"")?f.PlatForm=new URL(e??"").host:f.PlatForm=new URL(window.location.href).host,r&&i&&(f.AuthorizationCode=i),c===v.POST&&!f["Content-Type"]&&(f["Content-Type"]=O.JSON),n&&(f["Accept-Language"]=n),c===v.GET&&h){const T=new URLSearchParams(h),ie=a.includes("?")?"&":"?";a+=ie+`${T.toString()}`}let E;return c===v.POST&&(E=f["Content-Type"]===O.JSON?JSON.stringify(d||{}):d),{url:a,method:c,headers:f,body:E}}function wt(s,t){if(!t.isTransformResponse)return s;if(!s)throw new m(g.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===j.SUCCESS)return i;throw new m(g.RequestCodeError,n||"请求返回的Code错误")}function pt(s){throw s instanceof Error?s:new m(g.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const gt=Object.freeze(Object.defineProperty({__proto__:null,request:P,setRequestGlobalConfig:mt},Symbol.toStringTag,{value:"Module"}));function Q(s,t){return P({url:"/project/jssdk/cs/list",method:v.GET,params:s},t)}function K(s,t){return P({url:"/project/jssdk/cs/bind",method:v.POST,data:s},t)}function U(s,t){return P({url:"/project/jssdk/cs/save",method:v.POST,data:s},t)}function tt(s,t){return P({url:"/project/jssdk/cs/delete",method:v.POST,data:s},t)}function et(s,t){return P({url:"/project/jssdk/cs/mapping",method:v.POST,data:s},t)}function st(s,t){return P({url:"/project/jssdk/cs/mapping/query",method:v.GET,params:s},t)}function it(s,t){return P({url:"/project/jssdk/project/detail",method:v.GET,params:s},t)}function Mt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return P({url:s,method:v.GET},t)}const vt=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:K,getCoordinateList:Q,getImageInfo:Mt,getMappingRelation:st,getProjectDetail:it,mapingCoordinate:et,removeCoordinate:tt,saveCoordinate:U},Symbol.toStringTag,{value:"Module"})),xt=typeof window<"u",St=Object.prototype.toString;function D(s,t){return St.call(s)===`[object ${t}]`}function nt(s){return typeof s<"u"}function ot(s){return!nt(s)}function C(s){return s!==null&&D(s,"Object")}function rt(s){return s===null}function bt(s){return D(s,"Date")}function Tt(s){return D(s,"String")}function X(s){return typeof s=="function"}function Pt(s){return D(s,"Boolean")}function Et(s){return D(s,"RegExp")}function b(s){return s&&Array.isArray(s)}function Dt(s){return typeof window<"u"&&D(s,"Window")}function Ct(s){return C(s)&&!!s.tagName}function A(s){return typeof s=="number"?!0:typeof s!="string"?!1:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s)}function Nt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function It(s){return ot(s)||rt(s)}function zt(s){return D(s,"Promise")&&C(s)&&X(s.then)&&X(s.catch)}function Rt(s,t={}){return new Promise((e,i)=>{const n=N(s);if(Ot(n)){e(!0);return}const o=document.createElement("script");o.src=s,Object.entries(t).forEach(([r,a])=>{a!==!1&&o.setAttribute(r,a===!0?"":String(a))}),o.onload=()=>{e(!0)},o.onerror=()=>{document.head.removeChild(o),i(new Error(`Failed to load script: ${s}`))},document.head.appendChild(o)})}function Ot(s){const t=N(s);return Array.from(document.scripts).some(e=>N(e.src)===t)}function At(s){return new Promise((t,e)=>{const i=N(s);if(Gt(i)){t(!0);return}const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=s,n.onload=()=>{t(!0)},n.onerror=()=>{document.head.removeChild(n),e(new Error(`Failed to load link: ${s}`))},document.head.appendChild(n)})}function Gt(s){const t=N(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>N(e.href)===t)}function N(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function at(s){return I(s,new WeakMap)}function I(s,t){if(typeof s!="object"||s===null)return s;if(t.has(s))return t.get(s);let e;if(s instanceof Date)return e=new Date(s),t.set(s,e),e;if(s instanceof RegExp)return e=new RegExp(s),t.set(s,e),e;if(s instanceof Map)return e=new Map,t.set(s,e),s.forEach((n,o)=>{e.set(o,I(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(I(n,t))}),e;if(ArrayBuffer.isView(s))return e=new s.constructor(s.buffer.slice(0),s.byteOffset,s.byteLength),t.set(s,e),e;if(s instanceof ArrayBuffer)return e=s.slice(0),t.set(s,e),e;if(Array.isArray(s)){e=[],t.set(s,e);for(let n=0;n<s.length;n++)n in s&&(e[n]=I(s[n],t));return e}e=Object.create(Object.getPrototypeOf(s)),t.set(s,e);for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=I(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=I(s[n],t));return e}function Lt(s,t,e=!1){let i;const n=function(...o){const r=this,a=e&&!i;i&&clearTimeout(i),i=setTimeout(()=>{i=void 0,e||s.apply(r,o)},t),a&&s.apply(r,o)};return n.cancel=()=>{i&&clearTimeout(i),i=void 0},n}function jt(s,t,e=!1){let i,n;const o=function(...r){const a=this;n?(clearTimeout(i),i=setTimeout(()=>{Date.now()-n>=t&&(s.apply(a,r),n=Date.now())},t-(Date.now()-n))):(e&&s.apply(a,r),n=Date.now())};return o.cancel=()=>{clearTimeout(i),i=void 0,n=void 0},o}function B(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(G(s)&&G(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:G(n)&&G(o)?s[i]=B({...n},o):o!==void 0&&(s[i]=o)}),B(s,...t))}function G(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function ct(s,...t){if(!t.length)return s;for(const e of t)e!=null&&typeof e=="object"&&Object.keys(e).forEach(i=>{const n=e[i],o=s[i];n!==null&&typeof n=="object"&&!Array.isArray(n)?((!o||typeof o!="object")&&(s[i]={}),ct(s[i],n)):s[i]=n});return s}function ht(s,t){const e={};if(C(s)&&!b(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=C(t)&&!b(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(b(n)&&b(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(C(n)&&C(o)){const r=ht(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(C(t)&&b(t))for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!(i in(s||{}))&&(e[i]=void 0);return e}function kt(s=0){return new Promise(t=>setTimeout(t,s))}function Ut(s){console.warn(`[warn]:${s}`)}function Xt(s){throw new Error(`[error]:${s}`)}function Bt(s){if(s)return Z.find(t=>t?.patterns?.some(e=>s.includes(e)))}function Ft(s,t,e,i){const n=Math.min(s/e,t/i),o=e*n,r=i*n;return{scale:n,x:(s-o)/2,y:(t-r)/2,sw:o,sh:r}}function Yt(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function _t(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}const lt="0123456789abcdef";function $t(){let s="";const t=new Uint8Array(16);if(typeof crypto<"u"&&"getRandomValues"in crypto)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;for(let e=0;e<16;e++)(e===4||e===6||e===8||e===10)&&(s+="-"),s+=lt[t[e]>>>4],s+=lt[t[e]&15];return s}let F=0;const qt=9999;function Jt(s=""){const t=Date.now(),e=Math.floor(Math.random()*1e6);return F=(F+1)%qt,`${s}${s?"_":""}${t}_${F.toString().padStart(4,"0")}_${e.toString().padStart(6,"0")}`}const Wt=Object.freeze(Object.defineProperty({__proto__:null,buildShortUUID:Jt,buildUUID:$t,cloneDeep:at,debounce:Lt,deepMerge:B,deepMergeProps:ct,delay:kt,error:Xt,getDiffProps:ht,getImageTransform:Ft,getMapProvider:Bt,inBrowser:xt,is:D,isArray:b,isBoolean:Pt,isDate:bt,isDef:nt,isElement:Ct,isFunction:X,isNull:rt,isNullOrUnDef:It,isNumeric:A,isObject:C,isPromise:zt,isRegExp:Et,isSameValue:Nt,isString:Tt,isUnDef:ot,isWindow:Dt,loadCss:At,loadScript:Rt,throttle:jt,toCanvasCoord:Yt,toModelCoord:_t,warn:Ut},Symbol.toStringTag,{value:"Module"}));class y{x=0;y=0;z=0;lat=0;lon=0;alt=0;yaw=0;pitch=0;roll=0;hasXYZ=!1;hasGeo=!1;hasAngle=!1;plane="xy";constructor(t){const{x:e,y:i,z:n,lat:o,lon:r,alt:a,yaw:c,pitch:u,roll:h,plane:d="xy"}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,(this.x!==0||this.y!==0||this.z!==0)&&(this.plane=d,this.hasXYZ=!0),this.lat=Number(o)||0,this.lon=Number(r)||0,this.alt=Number(a)||0,(this.lat!==0||this.lon!==0||this.alt!==0)&&(this.hasGeo=!0),this.yaw=Number(c)||0,this.pitch=Number(u)||0,this.roll=Number(h)||0,(A(c)||A(u)||A(h))&&(this.hasAngle=!0)}static dist(t,e){return Math.hypot(t.x-e.x,t.y-e.y,t.z-e.z)}static distXZ(t,e){return Math.hypot(t.x-e.x,t.z-e.z)}static distXY(t,e){return Math.hypot(t.x-e.x,t.y-e.y)}static toRadians(t){return(Number(t)||0)*Math.PI/180}static toDegrees(t){return(Number(t)||0)*180/Math.PI}static angleXZ(t,e,i){const n={x:t.x-e.x,z:t.z-e.z},o={x:i.x-e.x,z:i.z-e.z},r=n.x*o.x+n.z*o.z,a=Math.sqrt(n.x**2+n.z**2),c=Math.sqrt(o.x**2+o.z**2),u=Math.max(-1,Math.min(1,r/(a*c))),d=Math.acos(u)*180/Math.PI;return Math.min(d,360-d)}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new y({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}projection(t,e,i){try{if(e?.id===i?.id)return new y(this);if(e?.modelType===M.GeoModel){const{refPoint:n}=e?.relativeMap||{};if(this.hasGeo&&n){const o=z.LLHToXYZ(this,n);return this.x=o.x,this.y=o.y,this.z=o.z,this.hasXYZ=!0,this.project(t)}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===M.GeoModel){const{refPoint:n}=i?.relativeMap||{},o=this.project(t);if(o?.hasXYZ&&n){const r=z.XYZToLLH(o,n);return o.lat=r.lat,o.lon=r.lon,o.alt=r.alt,o.hasGeo=!0,o}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new m(g.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new m(g.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.z*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.z*Math.cos(t.yaw);return e.x=i+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.y*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.y*Math.cos(t.yaw);return e.x=i+t.x,e.y=n+t.y,e.z+=t.z,e}}class z{lat=0;lon=0;alt=0;constructor(t){const{lat:e=0,lon:i=0,alt:n=0}=t||{};this.lat=Number(e)||0,this.lon=Number(i)||0,this.alt=Number(n)||0}static XYZToLLH(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let c,u,h;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),f=t.z/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),f=t.y/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.z/1e3}else throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy");return new z({lat:u,lon:c,alt:h})}static LLHToXYZ(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,c=y.toRadians(t.lon-e.lon),u=y.toRadians(e.lat-t.lat),h=a*c*Math.cos(r),d=a*u;if(t.plane==="xz")return new y({x:h*1e3,y:t.alt*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new y({x:h*1e3,y:d*1e3,z:t.alt*1e3,plane:"xy"});throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy")}}class w{scale=1;yaw=0;x=0;y=0;z=0;start=0;end=-1;plane="xy";refPoint;constructor(t){const{refPoint:e,...i}=t||{};e&&(this.refPoint=new z(e)),Object.assign(this,i)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new m(g.RelativePlaneUnmatch,"两个映射关系的plane应该相同");const i=t.scale*e.scale,n=t.yaw+e.yaw,o=Math.cos(e.yaw),r=Math.sin(e.yaw);let a=0,c=0,u=0;if(t.plane==="xz"){const h=t.x*o-t.z*r,d=t.y,f=t.x*r+t.z*o;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else if(t.plane==="xy"){const h=t.x*o-t.y*r,d=t.x*r+t.y*o,f=t.z;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:i,yaw:n,x:a,y:c,z:u,start:t.start,end:t.end,plane:t.plane})}static inverseRelativeMap(t){const e=1/t.scale,i=-t.yaw,n=Math.cos(-i),o=Math.sin(-i);let r=0,a=0,c=0;if(t.plane==="xz")r=-(t.x*n+t.z*o)*e,a=-t.y*e,c=-(t.z*n-t.x*o)*e;else if(t.plane==="xy")r=-(t.x*n+t.y*o)*e,a=-(t.y*n-t.x*o)*e,c=-t.z*e;else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:e,yaw:i,x:r,y:a,z:c,start:t.start,end:t.end,plane:t.plane})}static toParse(t){try{let e=t?JSON.parse(t):void 0;const{reference_point:i}=e||{};return i&&(e={refPoint:i}),e?new w(e):void 0}catch{throw new m(g.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}static isValid(t){return t&&t!=='{"scale":1.0, "yaw":0.0, "x":0.0, "y":0.0, "z":0.0}'}}class p{static async getProjectDetail(t){return await it({projectId:t})}static async getCoordinateTree(t){const e=await Q({projectId:t});if(e.length){const i=p.handleCoordinateList(e);return p.buildCoordinateTree(i,0)}}static parsedCoordinateTree(t){const e=p.flattenCoordinateTree(t);return p.buildCoordinateTree(e,0)}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,modelType:u,relativeMap:h,level:d,...f}=a,E=h?JSON.stringify(h):void 0;return{...f,projectId:i,parentId:n,coordinateType:c,renderType:u,relativePosition:E}}),r=await U(o);return p.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await tt(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,relativeMap:u,level:h,...d}=a,f=w.toStringify(u);return{...d,relativePosition:f,projectId:i,parentId:n}}),r=await U(o);return p.handleCoordinateList(r)}static async bindCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{modelId:c}=a;return{modelId:c,parentId:n,projectId:i}}),r=await K(o);return p.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,c=o===M.GeoModel?new w(w.toParse(r)):w.toParse(r);return new L({...a,type:i,modelType:o,modelValue:n,relativeMap:c})})}static flattenCoordinateTree(t){const e=Array.isArray(t)?t:[t],i=[];function n(o){for(const r of o){const{level:a,parent:c,relativeMap:u,...h}=r,d=new L({...h,relativeMap:new w(u)});i.push(d),r.children&&r.children.length>0&&n(r.children)}}return n(e),i}static buildCoordinateTree(t,e=0){const i=new Map,n=[];return t.forEach(o=>{i.set(String(o.id),o)}),t.forEach(o=>{const r=i.get(String(o.id));if(r)if(o.parentId===e)r.level=0,n.push(r);else{const a=i.get(String(o.parentId??-1));a&&(r.type===S.Space&&(r.level=(Number(a.level)||0)+1),r.parent=a,a.children?.push(r))}}),n.forEach(p.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===S.Space){const n=Number(i?.relativeMap?.z)-Number(e?.relativeMap?.z);return n!==0?n:Number(i.createTime)-Number(e.createTime)}else return e.status===0&&i.status!==0?-1:i.status===0&&e.status!==0?1:Number(i.createTime)-Number(e.createTime)}),t.children.forEach(p.sortCoordinateTree))}static filterSpaceTree(t,e){const i=[];return t.forEach(n=>{const o=new L(n);e&&(o.parent=e);const r=p.filterSpaceTree(o.children,o);o.children=r,o.disabled=o.disabled??!1,o.type!==S.Model&&i.push(o)}),i}}class L{id=0;type=0;children=[];level;relativeMap;no;name;shortName;status;modelId;modelType;modelValue;projectId;parentId;parent;groupUuid;z;createTime;disabled;constructor(t){this.setOptions(t)}get spaceList(){return this.children.filter(t=>t.type===S.Space)}get modelList(){return this.children.filter(t=>t.type===S.Model)}get fullName(){const t=this.name?`(${this.name})`:"";return this.shortName?`${this.shortName}${t}`:this.name??""}setOptions(t){const{relativeMap:e,parent:i,children:n,...o}=t||{};e&&(this.relativeMap=new w(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=b(t)?t:[t],i=await p.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=b(t)?t:[t];await p.removeCoordinate(this,e);for(const i of e){const n=this.children.findIndex(o=>o.id===i.id);n!==-1&&this.children.splice(n,1)}}async updateChild(t){const e=b(t)?t:[t],i=await p.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=b(t)?t:[t],i=await p.bindCoordinate(this,e);return this.mergeChild(i),i}async mergeChild(t){t?.length&&t.forEach(e=>{const i=this.children.find(n=>n.id===e.id);if(i){const{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await et(t)}async getMapping(){return(await st({srcCsId:this.id}))[0]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t,e=!0){const i=b(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==R.Disabled?this:([S.Data,S.Model].includes(this.type)?this.findParentSpace():this)?.modelList?.filter(a=>i.includes(a.modelType??-1)?e?!!a.relativeMap:!0:!1)?.sort((a,c)=>Number(a.status)-Number(c.status))?.[0]}findClosestModel(t=[M.CADModel,M.BIMModel,M.ForgeModel,M.ThreeDModel,M.GeoModel],e){const i=b(t)?t:[t],n=new Set;e?.forEach(h=>{n.add(String(h.id))});const o=[{node:this,distance:0}],r=new Set,a=[];for(;o.length>0;){const{node:h,distance:d}=o.shift();if(n.has(String(h.id))||r.has(h))continue;const f=h.modelType??-1;i.includes(f)&&a.push({node:h,distance:d,modelType:f}),r.add(h);const E=[];if(h.children)for(const T of h.children)r.has(T)||E.push(T);if(h.parent?.children)for(const T of h.parent.children)T!==h&&!r.has(T)&&E.push(T);h.parent&&!r.has(h.parent)&&E.push(h.parent);for(const T of E)o.push({node:T,distance:d+1})}if(a.length===0)return;const c=Math.min(...a.map(h=>h.distance)),u=a.filter(h=>h.distance===c);return u.sort((h,d)=>h.modelType-d.modelType),u[0]?.node}findParentSpace(){let t=this;for(;t&&t.type!==S.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===S.Space&&(e.unshift(i.fullName),t--),i=i.parent;return e}findCsGroup(){const{groupUuid:t,parent:e}=this;return t?e?.children?.filter(i=>i.groupUuid===t)||[]:[]}findCsByLevel(t){if(this.level===t)return this;if(this.children.length)for(const e of this.children){const i=e.findCsByLevel(t);if(i)return i}}findCsById(t){if(t){if(this.id===t)return this;for(const e of this.children){const i=e.findCsById(t);if(i)return i}}}getCsRoutes(t=!1){let e=this;const i=[e];for(;e?.parent&&!(t&&!e.relativeMap);)e=e.parent,e&&i.push(e);return i}getMappedCsTree(){function t(n){return n.children?.length&&(n.children=n.children.filter(o=>!!o?.relativeMap&&o.status!==R.Disabled).map(o=>t(o))),n}const e=at(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new w;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new w;return e?.forEach(o=>{n=w.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=w.addRelativeMap(n,w.inverseRelativeMap(o))}),n}getRelativeMaps(){let t=this;const e=[];for(;t?.parent&&t.relativeMap;)e.push(t.relativeMap),t=t.parent;return e}static filterCoordinateTree(t,e=[],i=[]){if(i.includes(t.id)||e.includes(t.type))return;const n=t.children?.map(o=>this.filterCoordinateTree(o,e,i)).filter(o=>o!==void 0);return{...t,children:n}}static getCommonCoordinate(t){let e;const i=t.map(n=>n.getCsRoutes(!0).filter(r=>r.id&&r.type===S.Space));for(;this.checkSameCoordinate(i);){const o=i.shift();o?.length&&(e=o[0])}return e}static checkSameCoordinate(t){if(t.length){if(t.length===1)return!0;for(let e=0;e<t.length-1;e++){const i=t[e];if(!i?.length)return!1;const n=t[e+1];if(!n?.length||i[0].id!==n[0].id)return!1}return!0}else return!1}}class Y{yaw=0;pitch=0;roll=0;constructor(t){const{yaw:e=0,pitch:i=0,roll:n=0}=t||{};this.yaw=Number(e)||0,this.pitch=Number(i)||0,this.roll=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new Y({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class _{x=0;y=0;z=0;constructor(t){const{x:e=0,y:i=0,z:n=0}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new _({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class Vt{static srcPointToDstPoint(t,e,i){if(!e||!i||!t?.length)return[];const n=e?.getDestRelativeMap(i);if(!n)return[];const o=[];return t.forEach(r=>{const a=r.projection(n,e,i);a&&o.push(a)}),o}}class Zt{canvas;ctx;options;offset={x:0,y:0};curOffset={x:0,y:0};mousePosition={x:-1,y:-1};MAX_SCALE=60;MIN_SCALE=1;STEP_SCALE=.5;scale=1;preScale=1;width=0;height=0;x=0;y=0;timeout=0;lastTouch;initialDistance=0;touchMode=0;isMouseover=!1;isBindEvent=!0;isDrawAssist=!1;customDrawAssist;isMoveRedrawing;afterDraw;screenPos={screenX:0,screenY:0};constructor(t){const{container:e,width:i=300,height:n=300,isBindEvent:o=!0,isDrawAssist:r=!1,isMoveRedrawing:a,customDrawAssist:c,afterDraw:u,...h}=t;this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.width=i,this.height=n,this.canvas.width=i,this.canvas.height=n,this.isBindEvent=o,this.isDrawAssist=r,this.customDrawAssist=c,this.isMoveRedrawing=a??r,this.options=h,this.onMousedown=this.onMousedown.bind(this),this.onMousemove=this.onMousemove.bind(this),this.onMousemoveTemp=this.onMousemoveTemp.bind(this),this.onMouseup=this.onMouseup.bind(this),this.onMousewheel=this.onMousewheel.bind(this),this.onDblclick=this.onDblclick.bind(this),this.onTouchstart=this.onTouchstart.bind(this),this.onTouchmove=this.onTouchmove.bind(this),this.onTouchend=this.onTouchend.bind(this),this.onMouseout=this.onMouseout.bind(this),this.afterDraw=this.afterDraw,o&&(this.canvas.addEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.addEventListener("mousewheel",this.onMousewheel),this.canvas.addEventListener("mousedown",this.onMousedown),this.canvas.addEventListener("mousemove",this.onMousemove),this.canvas.addEventListener("mouseout",this.onMouseout),this.canvas.addEventListener("dblclick",this.onDblclick),this.canvas.addEventListener("touchstart",this.onTouchstart))}onClick(t){const{screenX:e,screenY:i}=t;this.timeout&&clearTimeout(this.timeout);const n=this.getPos(t);this.x=n.x,this.y=n.y,this.screenPos={screenX:e,screenY:i},this.options.onClick&&(this.timeout=setTimeout(()=>{const o=parseFloat(((this.x-this.offset.x)/this.scale).toFixed(2)),r=parseFloat(((this.y-this.offset.y)/this.scale).toFixed(2));this.options.onClick(o,r)},200))}onMouseout(t){this.isMouseover=!1,this.draw()}onTouchstart(t){t.preventDefault(),t.touches.length==1?this.touchMode===0&&(this.touchMode=1):t.touches.length>=2&&this.touchMode<2&&(this.touchMode=2),this.touchMode==1&&t.touches.length==1?this.onTouch(t.touches[0]):this.touchMode==2&&t.touches.length==2&&this.onBothTouchstart(t),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend)}onMousedown(t){this.onClick(t),this.canvas.addEventListener("mousemove",this.onMousemoveTemp),this.canvas.addEventListener("mouseup",this.onMouseup)}onBothTouchstart(t){t.preventDefault();const e={x:t.touches[0].clientX,y:t.touches[0].clientY},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=this.getPos({clientX:(e.x+i.x)/2,clientY:(e.y+i.y)/2});this.x=n.x,this.y=n.y,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.initialDistance=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))}onTouchmove(t){t.preventDefault(),this.touchMode==1&&t.touches.length==1?(this.onMousemoveTemp(t.touches[0]),this.onMousemove(t.touches[0])):this.touchMode==2&&t.touches.length==2&&this.onBothTouchmove(t)}onMousemove(t){const e=this.getPos(t);this.mousePosition.x=e.x,this.mousePosition.y=e.y,this.isMouseover=!0,this.isMoveRedrawing&&this.draw()}onMousemoveTemp(t){const{screenX:e,screenY:i}=this.screenPos;(Math.abs(e-t.screenX)>10||Math.abs(i-t.screenY)>10)&&(this.timeout&&clearTimeout(this.timeout),this.offset.x=this.curOffset.x+(this.mousePosition.x-this.x),this.offset.y=this.curOffset.y+(this.mousePosition.y-this.y),!this.isMoveRedrawing&&this.draw())}onBothTouchmove(t){if(t.preventDefault(),this.initialDistance){const e={x:t.touches[0].clientX,y:t.touches[0].clientY},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));if(this.scale+=(n-this.initialDistance)/30*this.STEP_SCALE,this.initialDistance=n,this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}}onTouchend(){this.touchMode=0,this.onMouseup()}onMouseup(){this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.canvas.removeEventListener("mousemove",this.onMousemoveTemp),this.canvas.removeEventListener("mouseup",this.onMouseup),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend)}onMousewheel(t){this.timeout&&clearTimeout(this.timeout),t.preventDefault();const e=this.getPos(t);this.x=e.x,this.y=e.y;const i=t.wheelDelta>0||t.detail<0?this.STEP_SCALE:-this.STEP_SCALE;if(this.scale=parseFloat((this.scale+i).toFixed(2)),this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}onTouch(t){const e=Date.now(),{lastTouchTime:i=0,lastTouchX:n=0,lastTouchY:o=0}=this.lastTouch||{};e-i<300&&Math.abs(t.clientX-n)<30&&Math.abs(t.clientY-o)<30?(this.onDblclick(t),this.lastTouch={lastTouchTime:0,lastTouchX:0,lastTouchY:0}):(this.onClick(t),this.lastTouch={lastTouchTime:e,lastTouchX:t.clientX,lastTouchY:t.clientY})}onDblclick(t){this.timeout&&clearTimeout(this.timeout),this.reset(),this.draw()}zoom(){this.offset.x=this.x-(this.x-this.offset.x)*this.scale/this.preScale,this.offset.y=this.y-(this.y-this.offset.y)*this.scale/this.preScale,this.draw(),this.preScale=this.scale,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y}reset(t){const{width:e=this.width,height:i=this.height,scale:n=1,preScale:o=1,offset:r={x:0,y:0},curOffset:a={x:0,y:0}}=t||{};this.width=e,this.height=i,this.canvas.width=e,this.canvas.height=i,this.scale=n,this.preScale=o,this.offset=r,this.curOffset=a}drawAssist(){const t=this.ctx;t.save(),t.beginPath(),t.lineWidth=1,t.strokeStyle="#C656D5",t.moveTo(0,this.mousePosition.y),t.lineTo(this.width,this.mousePosition.y),t.closePath(),t.stroke(),t.beginPath(),t.moveTo(this.mousePosition.x,0),t.lineTo(this.mousePosition.x,this.height),t.closePath(),t.stroke(),t.restore()}draw(){this.ctx.clearRect(0,0,this.width,this.height),this.ctx.save(),this.ctx.translate(this.offset.x,this.offset.y),this.ctx.scale(this.scale,this.scale),this.options.draw(this.ctx,this),this.ctx.restore(),this.isDrawAssist&&this.isMouseover&&(this.customDrawAssist?this.customDrawAssist():this.drawAssist()),this.afterDraw?.(this.ctx,this)}getPos(t){const e=this.canvas.getBoundingClientRect();let i=parseFloat((t.clientX-e.left).toFixed(2)),n=parseFloat((t.clientY-e.top).toFixed(2));return i=i<0?0:i,n=n<0?0:n,{x:i,y:n}}unBindEvent(){this.isBindEvent&&(this.canvas.removeEventListener("mousemove",this.onMousemove),this.canvas.removeEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.removeEventListener("mousewheel",this.onMousewheel),this.canvas.removeEventListener("mousedown",this.onMousedown),this.canvas.removeEventListener("mouseout",this.onMouseout),this.canvas.removeEventListener("dblclick",this.onDblclick))}}const ut={};class Ht{type="image";x;y;width;height;img;src;redraw;constructor(t){this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.src=t.src,this.redraw=t.redraw,this.img=this.loadImage(t.onload)}loadImage(t){const e=ut[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.crossOrigin="anonymous",i.src=this.src,i.onload=()=>{ut[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t){try{if(!this.img.complete)return;t.save(),t.drawImage(this.img,this.x,this.y,this.width,this.height),t.restore()}catch(e){console.error(e)}}}class Qt{id="";type="point";x;y;r;text;backgroundColor;index;pIndex;parentId;constructor(t){this.id=t.id,this.x=t.x,this.y=t.y,this.r=t.r||15,this.text=t.text||"",this.index=t.index,this.pIndex=t.pIndex,this.parentId=t.parentId,this.backgroundColor=t.backgroundColor||"rgba(91, 179, 111, 0.8)"}draw(t,e){t.save();const i=1/e.scale;t.beginPath(),t.arc(this.x,this.y,this.r*i,0,2*Math.PI),t.fillStyle=this.backgroundColor,t.fill(),t.font=`${this.r*i}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.text,this.x,this.y+this.r*i/3),t.restore()}}const dt={};class Kt{id="";type="issue";x;y;width;height;src;img;index;pIndex;parentId;count;badgeR;redraw;constructor(t){this.id=t.id,this.x=t.x,this.y=t.y,this.width=t.width||0,this.height=t.height||0,this.index=t.index,this.pIndex=t.pIndex,this.parentId=t.parentId,this.count=t.count||0,this.badgeR=3,this.src=t.src,this.redraw=t.redraw,this.img=this.loadImage(t.onload)}loadImage(t){const e=dt[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.src,i.crossOrigin="anonymous",i.onload=()=>{dt[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t,e){if(!this.img.complete)return;const i=1/e.scale,n=this.width*i,o=this.height*i,r=this.x-n/2,a=this.y-o,c=this.badgeR*i,u=c*1.5;t.save(),t.drawImage(this.img,r,a,n,o),t.beginPath(),this.count>1&&(t.arc(this.x+n*.3,this.y-o*.8,c,0,2*Math.PI),t.fillStyle="red",t.fill(),t.font=`${u}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.count.toString(),this.x+n*.3,this.y-o*.8+c/2)),t.restore()}}const ft={};class te{type="marker";x;y;url;width;height;anchor;img;scale;redraw;beforeDraw;constructor(t){this.x=t.x,this.y=t.y,this.url=t.url,this.width=t.width??0,this.height=t.height??0,this.anchor=t.anchor,this.scale=t.scale??1,t.redraw&&(this.redraw=t.redraw),t.beforeDraw&&(this.beforeDraw=t.beforeDraw),this.img=this.loadImage(t.onload)}loadImage(t){const e=ft[this.url];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.url,i.crossOrigin="anonymous",i.onload=()=>{ft[this.url]=i,t?.(i),this.redraw?.()},i}}calculateIconPosition(){const t=this.anchor?.x??this.width/2,e=this.anchor?.y??this.height/2;return{iconStartX:this.x-t*this.scale,iconStartY:this.y-e*this.scale}}draw(t,e){if(this.beforeDraw?.(t,e),!this.img?.complete)return;const{iconStartX:i,iconStartY:n}=this.calculateIconPosition();t.save();try{t.drawImage(this.img,i,n,this.width*this.scale,this.height*this.scale)}catch(o){console.error("绘制标记时出错:",o)}finally{t.restore()}}}class ee{type="radar";x;y;r;angle;text;hFov=90;beforeDraw;constructor(t){this.x=t.x,this.y=t.y,this.r=t.r||15,this.angle=t.angle||0,this.text=t.text||"",this.hFov=t.fovh||90,this.beforeDraw=t.beforeDraw}draw(t,e){this.beforeDraw?.(t,e);const i=1/e.scale,[n,o]=[(this.angle-this.hFov/2)/180*Math.PI,(this.angle+this.hFov/2)/180*Math.PI];t.save();const r=t.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r*i);r.addColorStop(0,"rgba(180, 42, 42, 1)"),r.addColorStop(1,"rgba(180, 42, 42, 0.5)"),t.beginPath(),t.moveTo(this.x,this.y),t.arc(this.x,this.y,this.r*i,n,o),t.closePath(),t.fillStyle=r,t.fill(),t.restore()}}class se{type="region";x;y;shape;areaPoints;backgroundColor;constructor(t){if(this.x=t.x,this.y=t.y,this.shape=t.shape||"",this.backgroundColor=t.backgroundColor,t.areaPoints.length===2){const[{x:e,y:i},{},{x:n,y:o}]=t.areaPoints;this.areaPoints=[{x:Math.min(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.max(i,o)},{x:Math.min(e,n),y:Math.max(i,o)}]}else this.areaPoints=t.areaPoints}draw(t,e){if(t.save(),t.beginPath(),t.globalAlpha=.3,t.fillStyle=this.backgroundColor,this.shape==="circle"){const[{x:i,y:n},{},{x:o,y:r}]=this.areaPoints,a=Math.abs(o-i)/2,c=i+(o-i)/2,u=n+(r-n)/2;t.arc(c,u,a,0,2*Math.PI)}else this.areaPoints.forEach((i,n)=>{const{x:o,y:r}=i;n===0?t.moveTo(o,r):t.lineTo(o,r)});t.fill(),t.restore()}}l.APP_SETTING=J,l.AppError=m,l.AppErrorCode=g,l.AppObsType=q,l.CRSTypes=x,l.CanvasElement=Zt,l.CanvasImageElement=Ht,l.CanvasIssueElement=Kt,l.CanvasMarkerElement=te,l.CanvasPointElement=Qt,l.CanvasRadarElement=ee,l.CanvasRegionElement=se,l.Coordinate=L,l.CoordinateLevel=$,l.CoordinateModelType=M,l.CoordinateStatus=R,l.CoordinateType=S,l.DataHelper=Vt,l.DataSource=p,l.GeoPoint=z,l.LocaleType=k,l.MAP_PROVIDERS=Z,l.Point=y,l.Position=Y,l.REQUEST_CONFIG=V,l.REQUEST_OPTIONS=W,l.RelativeMap=w,l.RequestContentType=O,l.RequestMethod=v,l.RequestResultCode=j,l.Vector3=_,l.api=vt,l.http=gt,l.utils=Wt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(l,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(l=typeof globalThis<"u"?globalThis:l||self,C(l.Shared={}))})(this,(function(l){"use strict";var C=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(C||{}),k=(s=>(s.en_US="en-US",s.zh_CN="zh-CN",s.ja_JP="ja-JP",s))(k||{}),M=(s=>(s.WGS84="WGS84",s.WGS1984="WGS84",s.EPSG4326="WGS84",s.GCJ02="GCJ02",s.AMap="GCJ02",s.BD09="BD09",s.BD09LL="BD09",s.Baidu="BD09",s.BMap="BD09",s.BD09MC="BD09MC",s.BD09Meter="BD09MC",s.EPSG3857="EPSG3857",s.EPSG900913="EPSG3857",s.EPSG102100="EPSG3857",s.WebMercator="EPSG3857",s.WM="EPSG3857",s))(M||{}),x=(s=>(s[s.CADModel=5]="CADModel",s[s.BIMModel=6]="BIMModel",s[s.ForgeModel=7]="ForgeModel",s[s.ThreeDModel=8]="ThreeDModel",s[s.GeoModel=9]="GeoModel",s[s.ScaleModel=101]="ScaleModel",s))(x||{}),q=(s=>(s[s.Global=0]="Global",s))(q||{}),S=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(S||{}),O=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(O||{}),g=(s=>(s[s.GeoPointNoPlane=9e3]="GeoPointNoPlane",s[s.PointUnmappedGIS=9010]="PointUnmappedGIS",s[s.PointNoXYZ=9011]="PointNoXYZ",s[s.PointNoPlane=9012]="PointNoPlane",s[s.RelativePlaneUnmatch=9020]="RelativePlaneUnmatch",s[s.RelativeNoPlane=9021]="RelativeNoPlane",s[s.RelativeJsonError=9022]="RelativeJsonError",s[s.RequestCodeError=9030]="RequestCodeError",s[s.RequestResultError=9031]="RequestResultError",s[s.RequestUnknownError=9032]="RequestUnknownError",s))(g||{}),U=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(U||{}),v=(s=>(s.GET="GET",s.POST="POST",s))(v||{}),L=(s=>(s.JSON="application/json",s.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",s.FORM_DATA="multipart/form-data;charset=UTF-8",s.OCTET_STREAM="'application/octet-stream",s))(L||{});const J={baseUrl:"https://vsleem.com/api",authorizeCode:""},W={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},V={url:"",method:v.GET,headers:{}},Z=[{name:"GAODE",patterns:["amap","amap.com","autonavi.com","restapi.amap.com","tiles.amap.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"BAIDU",patterns:["baidu","baidu.com","bdimg.com"],CRSTypes:[M.BD09,M.WGS84]},{name:"TENCENT",patterns:["qq.com","map.qq.com","map.gtimg.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"TIANDITU",patterns:["tianditu","tianditu.gov.cn"],CRSTypes:[M.WGS84,M.WGS84]},{name:"GOOGLE",patterns:["google","googleapis","google.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"OPENSTREET",patterns:["openstreetmap","openstreetmap.org"],CRSTypes:[M.WGS84,M.WGS84]}],mt=[{url:"https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=99d9995c80e5ae67e043d659b748eb4b",options:{subdomains:["0","1","2","3","4","5","6","7"],attribution:"© 天地图 GS(2022)3124号"}},{url:"https://t{s}.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=99d9995c80e5ae67e043d659b748eb4b",options:{subdomains:["0","1","2","3","4","5","6","7"]}}];class m extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,m.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}const H={...J};function yt(s){const{baseUrl:t,authorizeCode:e,locale:i}=s;Object.assign(H,{baseUrl:t,authorizeCode:e,locale:i})}async function E(s,t){const e={...W,...t},i={...V,...s};try{const n=wt(i,e),{url:o,...r}=n,c=await(await window.fetch(o,r)).json();return pt(c,e)}catch(n){return gt(n)}}function wt(s,t){const{baseUrl:e,authorizeCode:i,locale:n=k.zh_CN}=H,{joinBaseUrl:o,withAuthorize:r}=t;let{url:a,method:c,headers:u={},params:h,data:d}=s;o&&e&&(a=`${e}${a}`),c=c?.toUpperCase();const f={...u};if(/^https?:\/\/.+$/i.test(e??"")?f.PlatForm=new URL(e??"").host:f.PlatForm=new URL(window.location.href).host,r&&i&&(f.AuthorizationCode=i),c===v.POST&&!f["Content-Type"]&&(f["Content-Type"]=L.JSON),n&&(f["Accept-Language"]=n),c===v.GET&&h){const b=new URLSearchParams(h),ne=a.includes("?")?"&":"?";a+=ne+`${b.toString()}`}let P;return c===v.POST&&(P=f["Content-Type"]===L.JSON?JSON.stringify(d||{}):d),{url:a,method:c,headers:f,body:P}}function pt(s,t){if(!t.isTransformResponse)return s;if(!s)throw new m(g.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===U.SUCCESS)return i;throw new m(g.RequestCodeError,n||"请求返回的Code错误")}function gt(s){throw s instanceof Error?s:new m(g.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const Mt=Object.freeze(Object.defineProperty({__proto__:null,request:E,setRequestGlobalConfig:yt},Symbol.toStringTag,{value:"Module"}));function Q(s,t){return E({url:"/project/jssdk/cs/list",method:v.GET,params:s},t)}function K(s,t){return E({url:"/project/jssdk/cs/bind",method:v.POST,data:s},t)}function X(s,t){return E({url:"/project/jssdk/cs/save",method:v.POST,data:s},t)}function tt(s,t){return E({url:"/project/jssdk/cs/delete",method:v.POST,data:s},t)}function et(s,t){return E({url:"/project/jssdk/cs/mapping",method:v.POST,data:s},t)}function st(s,t){return E({url:"/project/jssdk/cs/mapping/query",method:v.GET,params:s},t)}function it(s,t){return E({url:"/project/jssdk/project/detail",method:v.GET,params:s},t)}function vt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return E({url:s,method:v.GET},t)}const St=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:K,getCoordinateList:Q,getImageInfo:vt,getMappingRelation:st,getProjectDetail:it,mapingCoordinate:et,removeCoordinate:tt,saveCoordinate:X},Symbol.toStringTag,{value:"Module"})),Tt=typeof window<"u",xt=Object.prototype.toString;function I(s,t){return xt.call(s)===`[object ${t}]`}function nt(s){return typeof s<"u"}function ot(s){return!nt(s)}function D(s){return s!==null&&I(s,"Object")}function rt(s){return s===null}function bt(s){return I(s,"Date")}function Et(s){return I(s,"String")}function B(s){return typeof s=="function"}function Pt(s){return I(s,"Boolean")}function It(s){return I(s,"RegExp")}function T(s){return s&&Array.isArray(s)}function Dt(s){return typeof window<"u"&&I(s,"Window")}function Ct(s){return D(s)&&!!s.tagName}function A(s){return typeof s=="number"?!0:typeof s!="string"?!1:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s)}function Rt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function Nt(s){return ot(s)||rt(s)}function zt(s){return I(s,"Promise")&&D(s)&&B(s.then)&&B(s.catch)}function Ot(s,t={}){return new Promise((e,i)=>{const n=R(s);if(Lt(n)){e(!0);return}const o=document.createElement("script");o.src=s,Object.entries(t).forEach(([r,a])=>{a!==!1&&o.setAttribute(r,a===!0?"":String(a))}),o.onload=()=>{e(!0)},o.onerror=()=>{document.head.removeChild(o),i(new Error(`Failed to load script: ${s}`))},document.head.appendChild(o)})}function Lt(s){const t=R(s);return Array.from(document.scripts).some(e=>R(e.src)===t)}function At(s){return new Promise((t,e)=>{const i=R(s);if(Gt(i)){t(!0);return}const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=s,n.onload=()=>{t(!0)},n.onerror=()=>{document.head.removeChild(n),e(new Error(`Failed to load link: ${s}`))},document.head.appendChild(n)})}function Gt(s){const t=R(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>R(e.href)===t)}function R(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function at(s){return N(s,new WeakMap)}function N(s,t){if(typeof s!="object"||s===null)return s;if(t.has(s))return t.get(s);let e;if(s instanceof Date)return e=new Date(s),t.set(s,e),e;if(s instanceof RegExp)return e=new RegExp(s),t.set(s,e),e;if(s instanceof Map)return e=new Map,t.set(s,e),s.forEach((n,o)=>{e.set(o,N(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(N(n,t))}),e;if(ArrayBuffer.isView(s))return e=new s.constructor(s.buffer.slice(0),s.byteOffset,s.byteLength),t.set(s,e),e;if(s instanceof ArrayBuffer)return e=s.slice(0),t.set(s,e),e;if(Array.isArray(s)){e=[],t.set(s,e);for(let n=0;n<s.length;n++)n in s&&(e[n]=N(s[n],t));return e}e=Object.create(Object.getPrototypeOf(s)),t.set(s,e);for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=N(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=N(s[n],t));return e}function jt(s,t,e=!1){let i;const n=function(...o){const r=this,a=e&&!i;i&&clearTimeout(i),i=setTimeout(()=>{i=void 0,e||s.apply(r,o)},t),a&&s.apply(r,o)};return n.cancel=()=>{i&&clearTimeout(i),i=void 0},n}function kt(s,t,e=!1){let i,n;const o=function(...r){const a=this;n?(clearTimeout(i),i=setTimeout(()=>{Date.now()-n>=t&&(s.apply(a,r),n=Date.now())},t-(Date.now()-n))):(e&&s.apply(a,r),n=Date.now())};return o.cancel=()=>{clearTimeout(i),i=void 0,n=void 0},o}function F(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(G(s)&&G(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:G(n)&&G(o)?s[i]=F({...n},o):o!==void 0&&(s[i]=o)}),F(s,...t))}function G(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function ct(s,...t){if(!t.length)return s;for(const e of t)e!=null&&typeof e=="object"&&Object.keys(e).forEach(i=>{const n=e[i],o=s[i];n!==null&&typeof n=="object"&&!Array.isArray(n)?((!o||typeof o!="object")&&(s[i]={}),ct(s[i],n)):s[i]=n});return s}function ht(s,t){const e={};if(D(s)&&!T(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=D(t)&&!T(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(T(n)&&T(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(D(n)&&D(o)){const r=ht(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(D(t)&&T(t))for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!(i in(s||{}))&&(e[i]=void 0);return e}function Ut(s=0){return new Promise(t=>setTimeout(t,s))}function Xt(s){console.warn(`[warn]:${s}`)}function Bt(s){throw new Error(`[error]:${s}`)}function Ft(s){if(s)return Z.find(t=>t?.patterns?.some(e=>s.includes(e)))}function Yt(s,t,e,i){const n=Math.min(s/e,t/i),o=e*n,r=i*n;return{scale:n,x:(s-o)/2,y:(t-r)/2,sw:o,sh:r}}function _t(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function $t(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}const lt="0123456789abcdef";function qt(){let s="";const t=new Uint8Array(16);if(typeof crypto<"u"&&"getRandomValues"in crypto)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;for(let e=0;e<16;e++)(e===4||e===6||e===8||e===10)&&(s+="-"),s+=lt[t[e]>>>4],s+=lt[t[e]&15];return s}let Y=0;const Jt=9999;function Wt(s=""){const t=Date.now(),e=Math.floor(Math.random()*1e6);return Y=(Y+1)%Jt,`${s}${s?"_":""}${t}_${Y.toString().padStart(4,"0")}_${e.toString().padStart(6,"0")}`}const Vt=Object.freeze(Object.defineProperty({__proto__:null,buildShortUUID:Wt,buildUUID:qt,cloneDeep:at,debounce:jt,deepMerge:F,deepMergeProps:ct,delay:Ut,error:Bt,getDiffProps:ht,getImageTransform:Yt,getMapProvider:Ft,inBrowser:Tt,is:I,isArray:T,isBoolean:Pt,isDate:bt,isDef:nt,isElement:Ct,isFunction:B,isNull:rt,isNullOrUnDef:Nt,isNumeric:A,isObject:D,isPromise:zt,isRegExp:It,isSameValue:Rt,isString:Et,isUnDef:ot,isWindow:Dt,loadCss:At,loadScript:Ot,throttle:kt,toCanvasCoord:_t,toModelCoord:$t,warn:Xt},Symbol.toStringTag,{value:"Module"}));class y{x=0;y=0;z=0;lat=0;lon=0;alt=0;yaw=0;pitch=0;roll=0;hasXYZ=!1;hasGeo=!1;hasAngle=!1;plane="xy";constructor(t){const{x:e,y:i,z:n,lat:o,lon:r,alt:a,yaw:c,pitch:u,roll:h,plane:d="xy"}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,(this.x!==0||this.y!==0||this.z!==0)&&(this.plane=d,this.hasXYZ=!0),this.lat=Number(o)||0,this.lon=Number(r)||0,this.alt=Number(a)||0,(this.lat!==0||this.lon!==0||this.alt!==0)&&(this.hasGeo=!0),this.yaw=Number(c)||0,this.pitch=Number(u)||0,this.roll=Number(h)||0,(A(c)||A(u)||A(h))&&(this.hasAngle=!0)}static dist(t,e){return Math.hypot(t.x-e.x,t.y-e.y,t.z-e.z)}static distXZ(t,e){return Math.hypot(t.x-e.x,t.z-e.z)}static distXY(t,e){return Math.hypot(t.x-e.x,t.y-e.y)}static toRadians(t){return(Number(t)||0)*Math.PI/180}static toDegrees(t){return(Number(t)||0)*180/Math.PI}static angleXZ(t,e,i){const n={x:t.x-e.x,z:t.z-e.z},o={x:i.x-e.x,z:i.z-e.z},r=n.x*o.x+n.z*o.z,a=Math.sqrt(n.x**2+n.z**2),c=Math.sqrt(o.x**2+o.z**2),u=Math.max(-1,Math.min(1,r/(a*c))),d=Math.acos(u)*180/Math.PI;return Math.min(d,360-d)}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new y({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}projection(t,e,i){try{if(e?.id===i?.id)return new y(this);if(e?.modelType===x.GeoModel){const{refPoint:n}=e?.relativeMap||{};if(this.hasGeo&&n){const o=z.LLHToXYZ(this,n);return this.x=o.x,this.y=o.y,this.z=o.z,this.hasXYZ=!0,this.project(t)}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===x.GeoModel){const{refPoint:n}=i?.relativeMap||{},o=this.project(t);if(o?.hasXYZ&&n){const r=z.XYZToLLH(o,n);return o.lat=r.lat,o.lon=r.lon,o.alt=r.alt,o.hasGeo=!0,o}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new m(g.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new m(g.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.z*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.z*Math.cos(t.yaw);return e.x=i+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.y*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.y*Math.cos(t.yaw);return e.x=i+t.x,e.y=n+t.y,e.z+=t.z,e}}class z{lat=0;lon=0;alt=0;constructor(t){const{lat:e=0,lon:i=0,alt:n=0}=t||{};this.lat=Number(e)||0,this.lon=Number(i)||0,this.alt=Number(n)||0}static XYZToLLH(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let c,u,h;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),f=t.z/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),f=t.y/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.z/1e3}else throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy");return new z({lat:u,lon:c,alt:h})}static LLHToXYZ(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,c=y.toRadians(t.lon-e.lon),u=y.toRadians(e.lat-t.lat),h=a*c*Math.cos(r),d=a*u;if(t.plane==="xz")return new y({x:h*1e3,y:t.alt*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new y({x:h*1e3,y:d*1e3,z:t.alt*1e3,plane:"xy"});throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy")}}class w{scale=1;yaw=0;x=0;y=0;z=0;start=0;end=-1;plane="xy";refPoint;constructor(t){const{refPoint:e,...i}=t||{};e&&(this.refPoint=new z(e)),Object.assign(this,i)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new m(g.RelativePlaneUnmatch,"两个映射关系的plane应该相同");const i=t.scale*e.scale,n=t.yaw+e.yaw,o=Math.cos(e.yaw),r=Math.sin(e.yaw);let a=0,c=0,u=0;if(t.plane==="xz"){const h=t.x*o-t.z*r,d=t.y,f=t.x*r+t.z*o;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else if(t.plane==="xy"){const h=t.x*o-t.y*r,d=t.x*r+t.y*o,f=t.z;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:i,yaw:n,x:a,y:c,z:u,start:t.start,end:t.end,plane:t.plane})}static inverseRelativeMap(t){const e=1/t.scale,i=-t.yaw,n=Math.cos(-i),o=Math.sin(-i);let r=0,a=0,c=0;if(t.plane==="xz")r=-(t.x*n+t.z*o)*e,a=-t.y*e,c=-(t.z*n-t.x*o)*e;else if(t.plane==="xy")r=-(t.x*n+t.y*o)*e,a=-(t.y*n-t.x*o)*e,c=-t.z*e;else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:e,yaw:i,x:r,y:a,z:c,start:t.start,end:t.end,plane:t.plane})}static toParse(t){try{let e=t?JSON.parse(t):void 0;const{reference_point:i}=e||{};return i&&(e={refPoint:i}),e?new w(e):void 0}catch{throw new m(g.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}static isValid(t){return t&&t!=='{"scale":1.0, "yaw":0.0, "x":0.0, "y":0.0, "z":0.0}'}}class p{static async getProjectDetail(t){return await it({projectId:t})}static async getCoordinateTree(t){const e=await Q({projectId:t});if(e.length){const i=p.handleCoordinateList(e);return p.buildCoordinateTree(i,0)}}static parsedCoordinateTree(t){const e=p.flattenCoordinateTree(t);return p.buildCoordinateTree(e,0)}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,modelType:u,relativeMap:h,level:d,...f}=a,P=h?JSON.stringify(h):void 0;return{...f,projectId:i,parentId:n,coordinateType:c,renderType:u,relativePosition:P}}),r=await X(o);return p.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await tt(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,relativeMap:u,level:h,...d}=a,f=w.toStringify(u);return{...d,relativePosition:f,projectId:i,parentId:n}}),r=await X(o);return p.handleCoordinateList(r)}static async bindCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{modelId:c}=a;return{modelId:c,parentId:n,projectId:i}}),r=await K(o);return p.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,c=o===x.GeoModel?new w(w.toParse(r)):w.toParse(r);return new j({...a,type:i,modelType:o,modelValue:n,relativeMap:c})})}static flattenCoordinateTree(t){const e=Array.isArray(t)?t:[t],i=[];function n(o){for(const r of o){const{level:a,parent:c,relativeMap:u,...h}=r,d=new j({...h,relativeMap:new w(u)});i.push(d),r.children&&r.children.length>0&&n(r.children)}}return n(e),i}static buildCoordinateTree(t,e=0){const i=new Map,n=[];return t.forEach(o=>{i.set(String(o.id),o)}),t.forEach(o=>{const r=i.get(String(o.id));if(r)if(o.parentId===e)r.level=0,n.push(r);else{const a=i.get(String(o.parentId??-1));a&&(r.type===S.Space&&(r.level=(Number(a.level)||0)+1),r.parent=a,a.children?.push(r))}}),n.forEach(p.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===S.Space){const n=Number(i?.relativeMap?.z)-Number(e?.relativeMap?.z);return n!==0?n:Number(i.createTime)-Number(e.createTime)}else return e.status===0&&i.status!==0?-1:i.status===0&&e.status!==0?1:Number(i.createTime)-Number(e.createTime)}),t.children.forEach(p.sortCoordinateTree))}static filterSpaceTree(t,e){const i=[];return t.forEach(n=>{const o=new j(n);e&&(o.parent=e);const r=p.filterSpaceTree(o.children,o);o.children=r,o.disabled=o.disabled??!1,o.type!==S.Model&&i.push(o)}),i}}class j{id=0;type=0;children=[];level;relativeMap;no;name;shortName;status;modelId;modelType;modelValue;projectId;parentId;parent;groupUuid;z;createTime;disabled;constructor(t){this.setOptions(t)}get spaceList(){return this.children.filter(t=>t.type===S.Space)}get modelList(){return this.children.filter(t=>t.type===S.Model)}get fullName(){const t=this.name?`(${this.name})`:"";return this.shortName?`${this.shortName}${t}`:this.name??""}setOptions(t){const{relativeMap:e,parent:i,children:n,...o}=t||{};e&&(this.relativeMap=new w(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=T(t)?t:[t],i=await p.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=T(t)?t:[t];await p.removeCoordinate(this,e);for(const i of e){const n=this.children.findIndex(o=>o.id===i.id);n!==-1&&this.children.splice(n,1)}}async updateChild(t){const e=T(t)?t:[t],i=await p.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=T(t)?t:[t],i=await p.bindCoordinate(this,e);return this.mergeChild(i),i}async mergeChild(t){t?.length&&t.forEach(e=>{const i=this.children.find(n=>n.id===e.id);if(i){const{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await et(t)}async getMapping(){return(await st({srcCsId:this.id}))[0]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t,e=!0){const i=T(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==O.Disabled?this:([S.Data,S.Model].includes(this.type)?this.findParentSpace():this)?.modelList?.filter(a=>i.includes(a.modelType??-1)?e?!!a.relativeMap:!0:!1)?.sort((a,c)=>Number(a.status)-Number(c.status))?.[0]}findClosestModel(t=[x.CADModel,x.BIMModel,x.ForgeModel,x.ThreeDModel,x.GeoModel],e){const i=T(t)?t:[t],n=new Set;e?.forEach(h=>{n.add(String(h.id))});const o=[{node:this,distance:0}],r=new Set,a=[];for(;o.length>0;){const{node:h,distance:d}=o.shift();if(n.has(String(h.id))||r.has(h))continue;const f=h.modelType??-1;i.includes(f)&&a.push({node:h,distance:d,modelType:f}),r.add(h);const P=[];if(h.children)for(const b of h.children)r.has(b)||P.push(b);if(h.parent?.children)for(const b of h.parent.children)b!==h&&!r.has(b)&&P.push(b);h.parent&&!r.has(h.parent)&&P.push(h.parent);for(const b of P)o.push({node:b,distance:d+1})}if(a.length===0)return;const c=Math.min(...a.map(h=>h.distance)),u=a.filter(h=>h.distance===c);return u.sort((h,d)=>h.modelType-d.modelType),u[0]?.node}findParentSpace(){let t=this;for(;t&&t.type!==S.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===S.Space&&(e.unshift(i.fullName),t--),i=i.parent;return e}findCsGroup(){const{groupUuid:t,parent:e}=this;return t?e?.children?.filter(i=>i.groupUuid===t)||[]:[]}findCsByLevel(t){if(this.level===t)return this;if(this.children.length)for(const e of this.children){const i=e.findCsByLevel(t);if(i)return i}}findCsById(t){if(t){if(this.id===t)return this;for(const e of this.children){const i=e.findCsById(t);if(i)return i}}}getCsRoutes(t=!1){let e=this;const i=[e];for(;e?.parent&&!(t&&!e.relativeMap);)e=e.parent,e&&i.push(e);return i}getMappedCsTree(){function t(n){return n.children?.length&&(n.children=n.children.filter(o=>!!o?.relativeMap&&o.status!==O.Disabled).map(o=>t(o))),n}const e=at(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new w;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new w;return e?.forEach(o=>{n=w.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=w.addRelativeMap(n,w.inverseRelativeMap(o))}),n}getRelativeMaps(){let t=this;const e=[];for(;t?.parent&&t.relativeMap;)e.push(t.relativeMap),t=t.parent;return e}static filterCoordinateTree(t,e=[],i=[]){if(i.includes(t.id)||e.includes(t.type))return;const n=t.children?.map(o=>this.filterCoordinateTree(o,e,i)).filter(o=>o!==void 0);return{...t,children:n}}static getCommonCoordinate(t){let e;const i=t.map(n=>n.getCsRoutes(!0).filter(r=>r.id&&r.type===S.Space));for(;this.checkSameCoordinate(i);){const o=i.shift();o?.length&&(e=o[0])}return e}static checkSameCoordinate(t){if(t.length){if(t.length===1)return!0;for(let e=0;e<t.length-1;e++){const i=t[e];if(!i?.length)return!1;const n=t[e+1];if(!n?.length||i[0].id!==n[0].id)return!1}return!0}else return!1}}class _{yaw=0;pitch=0;roll=0;constructor(t){const{yaw:e=0,pitch:i=0,roll:n=0}=t||{};this.yaw=Number(e)||0,this.pitch=Number(i)||0,this.roll=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new _({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class ${x=0;y=0;z=0;constructor(t){const{x:e=0,y:i=0,z:n=0}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new $({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class Zt{static srcPointToDstPoint(t,e,i){if(!e||!i||!t?.length)return[];const n=e?.getDestRelativeMap(i);if(!n)return[];const o=[];return t.forEach(r=>{const a=r.projection(n,e,i);a&&o.push(a)}),o}}class Ht{canvas;ctx;options;offset={x:0,y:0};curOffset={x:0,y:0};mousePosition={x:-1,y:-1};MAX_SCALE=60;MIN_SCALE=1;STEP_SCALE=.5;scale=1;preScale=1;width=0;height=0;x=0;y=0;timeout=0;lastTouch;initialDistance=0;touchMode=0;isMouseover=!1;isBindEvent=!0;isDrawAssist=!1;customDrawAssist;isMoveRedrawing;afterDraw;screenPos={screenX:0,screenY:0};constructor(t){const{container:e,width:i=300,height:n=300,isBindEvent:o=!0,isDrawAssist:r=!1,isMoveRedrawing:a,customDrawAssist:c,afterDraw:u,...h}=t;this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.width=i,this.height=n,this.canvas.width=i,this.canvas.height=n,this.isBindEvent=o,this.isDrawAssist=r,this.customDrawAssist=c,this.isMoveRedrawing=a??r,this.options=h,this.onMousedown=this.onMousedown.bind(this),this.onMousemove=this.onMousemove.bind(this),this.onMousemoveTemp=this.onMousemoveTemp.bind(this),this.onMouseup=this.onMouseup.bind(this),this.onMousewheel=this.onMousewheel.bind(this),this.onDblclick=this.onDblclick.bind(this),this.onTouchstart=this.onTouchstart.bind(this),this.onTouchmove=this.onTouchmove.bind(this),this.onTouchend=this.onTouchend.bind(this),this.onMouseout=this.onMouseout.bind(this),this.afterDraw=this.afterDraw,o&&(this.canvas.addEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.addEventListener("mousewheel",this.onMousewheel),this.canvas.addEventListener("mousedown",this.onMousedown),this.canvas.addEventListener("mousemove",this.onMousemove),this.canvas.addEventListener("mouseout",this.onMouseout),this.canvas.addEventListener("dblclick",this.onDblclick),this.canvas.addEventListener("touchstart",this.onTouchstart))}onClick(t){const{screenX:e,screenY:i}=t;this.timeout&&clearTimeout(this.timeout);const n=this.getPos(t);this.x=n.x,this.y=n.y,this.screenPos={screenX:e,screenY:i},this.options.onClick&&(this.timeout=setTimeout(()=>{const o=parseFloat(((this.x-this.offset.x)/this.scale).toFixed(2)),r=parseFloat(((this.y-this.offset.y)/this.scale).toFixed(2));this.options.onClick(o,r)},200))}onMouseout(t){this.isMouseover=!1,this.draw()}onTouchstart(t){t.preventDefault(),t.touches.length==1?this.touchMode===0&&(this.touchMode=1):t.touches.length>=2&&this.touchMode<2&&(this.touchMode=2),this.touchMode==1&&t.touches.length==1?this.onTouch(t.touches[0]):this.touchMode==2&&t.touches.length==2&&this.onBothTouchstart(t),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend)}onMousedown(t){this.onClick(t),this.canvas.addEventListener("mousemove",this.onMousemoveTemp),this.canvas.addEventListener("mouseup",this.onMouseup)}onBothTouchstart(t){t.preventDefault();const e={x:t.touches[0].clientX,y:t.touches[0].clientY},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=this.getPos({clientX:(e.x+i.x)/2,clientY:(e.y+i.y)/2});this.x=n.x,this.y=n.y,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.initialDistance=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))}onTouchmove(t){t.preventDefault(),this.touchMode==1&&t.touches.length==1?(this.onMousemoveTemp(t.touches[0]),this.onMousemove(t.touches[0])):this.touchMode==2&&t.touches.length==2&&this.onBothTouchmove(t)}onMousemove(t){const e=this.getPos(t);this.mousePosition.x=e.x,this.mousePosition.y=e.y,this.isMouseover=!0,this.isMoveRedrawing&&this.draw()}onMousemoveTemp(t){const{screenX:e,screenY:i}=this.screenPos;(Math.abs(e-t.screenX)>10||Math.abs(i-t.screenY)>10)&&(this.timeout&&clearTimeout(this.timeout),this.offset.x=this.curOffset.x+(this.mousePosition.x-this.x),this.offset.y=this.curOffset.y+(this.mousePosition.y-this.y),!this.isMoveRedrawing&&this.draw())}onBothTouchmove(t){if(t.preventDefault(),this.initialDistance){const e={x:t.touches[0].clientX,y:t.touches[0].clientY},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));if(this.scale+=(n-this.initialDistance)/30*this.STEP_SCALE,this.initialDistance=n,this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}}onTouchend(){this.touchMode=0,this.onMouseup()}onMouseup(){this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.canvas.removeEventListener("mousemove",this.onMousemoveTemp),this.canvas.removeEventListener("mouseup",this.onMouseup),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend)}onMousewheel(t){this.timeout&&clearTimeout(this.timeout),t.preventDefault();const e=this.getPos(t);this.x=e.x,this.y=e.y;const i=t.wheelDelta>0||t.detail<0?this.STEP_SCALE:-this.STEP_SCALE;if(this.scale=parseFloat((this.scale+i).toFixed(2)),this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}onTouch(t){const e=Date.now(),{lastTouchTime:i=0,lastTouchX:n=0,lastTouchY:o=0}=this.lastTouch||{};e-i<300&&Math.abs(t.clientX-n)<30&&Math.abs(t.clientY-o)<30?(this.onDblclick(t),this.lastTouch={lastTouchTime:0,lastTouchX:0,lastTouchY:0}):(this.onClick(t),this.lastTouch={lastTouchTime:e,lastTouchX:t.clientX,lastTouchY:t.clientY})}onDblclick(t){this.timeout&&clearTimeout(this.timeout),this.reset(),this.draw()}zoom(){this.offset.x=this.x-(this.x-this.offset.x)*this.scale/this.preScale,this.offset.y=this.y-(this.y-this.offset.y)*this.scale/this.preScale,this.draw(),this.preScale=this.scale,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y}reset(t){const{width:e=this.width,height:i=this.height,scale:n=1,preScale:o=1,offset:r={x:0,y:0},curOffset:a={x:0,y:0}}=t||{};this.width=e,this.height=i,this.canvas.width=e,this.canvas.height=i,this.scale=n,this.preScale=o,this.offset=r,this.curOffset=a}drawAssist(){const t=this.ctx;t.save(),t.beginPath(),t.lineWidth=1,t.strokeStyle="#C656D5",t.moveTo(0,this.mousePosition.y),t.lineTo(this.width,this.mousePosition.y),t.closePath(),t.stroke(),t.beginPath(),t.moveTo(this.mousePosition.x,0),t.lineTo(this.mousePosition.x,this.height),t.closePath(),t.stroke(),t.restore()}draw(){this.ctx.clearRect(0,0,this.width,this.height),this.ctx.save(),this.ctx.translate(this.offset.x,this.offset.y),this.ctx.scale(this.scale,this.scale),this.options.draw(this.ctx,this),this.ctx.restore(),this.isDrawAssist&&this.isMouseover&&(this.customDrawAssist?this.customDrawAssist():this.drawAssist()),this.afterDraw?.(this.ctx,this)}getPos(t){const e=this.canvas.getBoundingClientRect();let i=parseFloat((t.clientX-e.left).toFixed(2)),n=parseFloat((t.clientY-e.top).toFixed(2));return i=i<0?0:i,n=n<0?0:n,{x:i,y:n}}unBindEvent(){this.isBindEvent&&(this.canvas.removeEventListener("mousemove",this.onMousemove),this.canvas.removeEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.removeEventListener("mousewheel",this.onMousewheel),this.canvas.removeEventListener("mousedown",this.onMousedown),this.canvas.removeEventListener("mouseout",this.onMouseout),this.canvas.removeEventListener("dblclick",this.onDblclick))}}const ut={};class Qt{type="image";x;y;width;height;img;src;redraw;constructor(t){this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.src=t.src,this.redraw=t.redraw,this.img=this.loadImage(t.onload)}loadImage(t){const e=ut[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.crossOrigin="anonymous",i.src=this.src,i.onload=()=>{ut[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t){try{if(!this.img.complete)return;t.save(),t.drawImage(this.img,this.x,this.y,this.width,this.height),t.restore()}catch(e){console.error(e)}}}class Kt{id="";type="point";x;y;r;text;backgroundColor;index;pIndex;parentId;constructor(t){this.id=t.id,this.x=t.x,this.y=t.y,this.r=t.r||15,this.text=t.text||"",this.index=t.index,this.pIndex=t.pIndex,this.parentId=t.parentId,this.backgroundColor=t.backgroundColor||"rgba(91, 179, 111, 0.8)"}draw(t,e){t.save();const i=1/e.scale;t.beginPath(),t.arc(this.x,this.y,this.r*i,0,2*Math.PI),t.fillStyle=this.backgroundColor,t.fill(),t.font=`${this.r*i}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.text,this.x,this.y+this.r*i/3),t.restore()}}const dt={};class te{id="";type="issue";x;y;width;height;src;img;index;pIndex;parentId;count;badgeR;redraw;constructor(t){this.id=t.id,this.x=t.x,this.y=t.y,this.width=t.width||0,this.height=t.height||0,this.index=t.index,this.pIndex=t.pIndex,this.parentId=t.parentId,this.count=t.count||0,this.badgeR=3,this.src=t.src,this.redraw=t.redraw,this.img=this.loadImage(t.onload)}loadImage(t){const e=dt[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.src,i.crossOrigin="anonymous",i.onload=()=>{dt[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t,e){if(!this.img.complete)return;const i=1/e.scale,n=this.width*i,o=this.height*i,r=this.x-n/2,a=this.y-o,c=this.badgeR*i,u=c*1.5;t.save(),t.drawImage(this.img,r,a,n,o),t.beginPath(),this.count>1&&(t.arc(this.x+n*.3,this.y-o*.8,c,0,2*Math.PI),t.fillStyle="red",t.fill(),t.font=`${u}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.count.toString(),this.x+n*.3,this.y-o*.8+c/2)),t.restore()}}const ft={};class ee{type="marker";x;y;url;width;height;anchor;img;scale;redraw;beforeDraw;constructor(t){this.x=t.x,this.y=t.y,this.url=t.url,this.width=t.width??0,this.height=t.height??0,this.anchor=t.anchor,this.scale=t.scale??1,t.redraw&&(this.redraw=t.redraw),t.beforeDraw&&(this.beforeDraw=t.beforeDraw),this.img=this.loadImage(t.onload)}loadImage(t){const e=ft[this.url];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.url,i.crossOrigin="anonymous",i.onload=()=>{ft[this.url]=i,t?.(i),this.redraw?.()},i}}calculateIconPosition(){const t=this.anchor?.x??this.width/2,e=this.anchor?.y??this.height/2;return{iconStartX:this.x-t*this.scale,iconStartY:this.y-e*this.scale}}draw(t,e){if(this.beforeDraw?.(t,e),!this.img?.complete)return;const{iconStartX:i,iconStartY:n}=this.calculateIconPosition();t.save();try{t.drawImage(this.img,i,n,this.width*this.scale,this.height*this.scale)}catch(o){console.error("绘制标记时出错:",o)}finally{t.restore()}}}class se{type="radar";x;y;r;angle;text;hFov=90;beforeDraw;constructor(t){this.x=t.x,this.y=t.y,this.r=t.r||15,this.angle=t.angle||0,this.text=t.text||"",this.hFov=t.fovh||90,this.beforeDraw=t.beforeDraw}draw(t,e){this.beforeDraw?.(t,e);const i=1/e.scale,[n,o]=[(this.angle-this.hFov/2)/180*Math.PI,(this.angle+this.hFov/2)/180*Math.PI];t.save();const r=t.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r*i);r.addColorStop(0,"rgba(180, 42, 42, 1)"),r.addColorStop(1,"rgba(180, 42, 42, 0.5)"),t.beginPath(),t.moveTo(this.x,this.y),t.arc(this.x,this.y,this.r*i,n,o),t.closePath(),t.fillStyle=r,t.fill(),t.restore()}}class ie{type="region";x;y;shape;areaPoints;backgroundColor;constructor(t){if(this.x=t.x,this.y=t.y,this.shape=t.shape||"",this.backgroundColor=t.backgroundColor,t.areaPoints.length===2){const[{x:e,y:i},{},{x:n,y:o}]=t.areaPoints;this.areaPoints=[{x:Math.min(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.max(i,o)},{x:Math.min(e,n),y:Math.max(i,o)}]}else this.areaPoints=t.areaPoints}draw(t,e){if(t.save(),t.beginPath(),t.globalAlpha=.3,t.fillStyle=this.backgroundColor,this.shape==="circle"){const[{x:i,y:n},{},{x:o,y:r}]=this.areaPoints,a=Math.abs(o-i)/2,c=i+(o-i)/2,u=n+(r-n)/2;t.arc(c,u,a,0,2*Math.PI)}else this.areaPoints.forEach((i,n)=>{const{x:o,y:r}=i;n===0?t.moveTo(o,r):t.lineTo(o,r)});t.fill(),t.restore()}}l.APP_SETTING=J,l.AppError=m,l.AppErrorCode=g,l.AppObsType=C,l.CRSTypes=M,l.CanvasElement=Ht,l.CanvasImageElement=Qt,l.CanvasIssueElement=te,l.CanvasMarkerElement=ee,l.CanvasPointElement=Kt,l.CanvasRadarElement=se,l.CanvasRegionElement=ie,l.Coordinate=j,l.CoordinateLevel=q,l.CoordinateModelType=x,l.CoordinateStatus=O,l.CoordinateType=S,l.DataHelper=Zt,l.DataSource=p,l.GeoPoint=z,l.LocaleType=k,l.MAP_PROVIDERS=Z,l.MAP_TILE_LAYERS=mt,l.Point=y,l.Position=_,l.REQUEST_CONFIG=V,l.REQUEST_OPTIONS=W,l.RelativeMap=w,l.RequestContentType=L,l.RequestMethod=v,l.RequestResultCode=U,l.Vector3=$,l.api=St,l.http=Mt,l.utils=Vt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsleem-realsee-viewer/shared",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "private": false,
5
5
  "description": "Shared utilities for VSLeem RealSee Viewer",
6
6
  "main": "./dist/index.umd.js",