@vsleem-realsee-viewer/shared 2.0.17 → 2.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- # 坐标系相关类文档
1
+ # 1. Coordinate 坐标系类
2
2
 
3
- # Coordinate 坐标系类
3
+ ## 1.1 介绍
4
4
 
5
5
  该类设计适用于建筑信息模型(Bim)、地理信息系统(GIS)等需要复杂空间关系管理的全景。
6
6
 
7
- ## 属性说明
7
+ ## 1.2 属性说明
8
8
 
9
9
  | 属性 | 类型 | 默认值 | 说明 |
10
10
  | -------------- | -------------- | ------ | -------------------------------------------- |
@@ -28,7 +28,7 @@
28
28
  | `disabled?` | `boolean` | - | 标识坐标系是否被禁用 |
29
29
  | `createTime?` | `number` | - | 坐标系的创建时间戳 |
30
30
 
31
- ## 计算属性说明
31
+ ## 1.3 计算属性说明
32
32
 
33
33
  | 属性 | 类型 | 默认值 | 说明 |
34
34
  | ----------- | -------------- | ------ | -------------------------------------------------- |
@@ -36,7 +36,7 @@
36
36
  | `modelList` | `Coordinate[]` | [] | 获取所有模型类型的子坐标系 |
37
37
  | `fullName` | `string` | - | 获取组合后的完整名称,格式为"简称(名称)"或单独名称 |
38
38
 
39
- ## 方法说明
39
+ ## 1.4 方法说明
40
40
 
41
41
  | 方法 | 类型 | 说明 |
42
42
  | ---------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------- |
@@ -61,11 +61,13 @@
61
61
  | `getDestRelativeMap` | `(dstCoordinate: Coordinate) => RelativeMap` | 计算到目标坐标系的相对变换关系 |
62
62
  | `getRelativeMaps` | `() => RelativeMap[]` | 获取从当前坐标系到根系的相对变换链 |
63
63
 
64
- # DataSource 数据源类
64
+ # 2. DataSource 数据源类
65
+
66
+ ## 2.1 介绍
65
67
 
66
68
  该类类用于管理 Bim、GIS、数字孪生的层级结构与空间关系
67
69
 
68
- ## 静态方法说明
70
+ ## 2.2 静态方法说明
69
71
 
70
72
  | 方法 | 类型 | 说明 |
71
73
  | ----------------------- | -------------------------------------------------------------------------------- | ------------------------------------ |
@@ -79,13 +81,15 @@
79
81
  | `buildCoordinateTree` | `(flatNodes: Coordinate[], rootId: number) => Coordinate` | 将扁平列表转为树形结构 |
80
82
  | `flattenCoordinateTree` | `(tree: Coordinate \| Coordinate[]) => Coordinate[]` | 将树形结构的节点扁平化为一个一维数组 |
81
83
  | `sortCoordinateTree` | `(node: Coordinate) => void` | 递归排序坐标系树 |
82
- | `filterSpaceTree` | `(tree: Coordinate[]) => Coordinate[]` | 过滤出空间坐标系树 |
84
+ | `filterSpaceTree` | `(tree: Coordinate[],parent?: Coordinate) => Coordinate[]` | 过滤出空间坐标系树 |
85
+
86
+ # 3. GeoPoint 地理坐标类
83
87
 
84
- # GeoPoint 地理坐标类
88
+ ## 3.1 介绍
85
89
 
86
90
  该类实现地理与平面坐标的高精度双向转换
87
91
 
88
- ## 属性说明
92
+ ## 3.2 属性说明
89
93
 
90
94
  | 属性 | 类型 | 默认值 | 说明 |
91
95
  | ----- | -------- | ------ | -------- |
@@ -93,7 +97,7 @@
93
97
  | `lon` | `number` | 0 | 纬度(°) |
94
98
  | `alt` | `number` | 0 | 高度(mm) |
95
99
 
96
- ## 方法说明
100
+ ## 3.3 方法说明
97
101
 
98
102
  | 方法 | 类型 | 说明 |
99
103
  | ------------- | -------------------------------------------- | ---------------------------------- |
@@ -101,11 +105,13 @@
101
105
  | `XYZToLLH` | `(p: Point, refPoint: GeoPoint) => GeoPoint` | 平面坐标转地理坐标(WGS84椭球体) |
102
106
  | `LLHToXYZ` | `(p: Point, refPoint: GeoPoint) => Point` | 地理坐标转平面坐标(WGS84椭球体) |
103
107
 
104
- # RelativeMap 相对坐标映射类
108
+ # 4. RelativeMap 相对坐标映射类
109
+
110
+ ## 4.1 介绍
105
111
 
106
112
  该类用于管理三维空间中的相对坐标变换关系
107
113
 
108
- ## 属性说明
114
+ ## 4.2 属性说明
109
115
 
110
116
  | 属性 | 类型 | 默认值 | 说明 |
111
117
  | ----------- | ---------- | ------ | ---------------------------- |
@@ -119,7 +125,7 @@
119
125
  | `plane` | `string` | 'xy' | 坐标系平面类型('xy'或'xz') |
120
126
  | `refPoint?` | `GeoPoint` | - | 参考点坐标 |
121
127
 
122
- ## 方法说明
128
+ ## 4.3 方法说明
123
129
 
124
130
  | 方法 | 类型 | 说明 |
125
131
  | -------------------- | --------------------------------------------------- | ------------------------------------ |
@@ -129,11 +135,13 @@
129
135
  | `toParse` | `(r?: string) => RelativeMap \| undefined` | 从JSON字符串解析为RelativeMap对象 |
130
136
  | `toStringify` | `(r?: RelativeMap) => string \| undefined` | 将RelativeMap对象序列化为JSON字符串 |
131
137
 
132
- # Point 点坐标类
138
+ # 5. Point 点坐标类
139
+
140
+ ## 5.1 介绍
133
141
 
134
142
  该类用于三维空间中的坐标表示与转换,支持位置、角度和坐标系投影变换
135
143
 
136
- ## 属性说明
144
+ ## 5.2 属性说明
137
145
 
138
146
  | 属性 | 类型 | 默认值 | 说明 |
139
147
  | ---------- | --------- | ------ | -------------------------- |
@@ -151,7 +159,7 @@
151
159
  | `hasAngle` | `boolean` | false | 是否包含角度信息 |
152
160
  | `plane` | `string` | 'xy' | 坐标平面类型('xy'或'xz') |
153
161
 
154
- ## 方法说明
162
+ ## 5.3 方法说明
155
163
 
156
164
  | 方法 | 类型 | 说明 |
157
165
  | ------------- | ------------------------------------------------------------------------------------------------ | ---------------------- |
package/dist/index.d.ts CHANGED
@@ -551,7 +551,7 @@ export declare class DataSource {
551
551
  * 过滤空间坐标系树
552
552
  * @param tree
553
553
  */
554
- static filterSpaceTree(tree: Coordinate[]): Coordinate[];
554
+ static filterSpaceTree(tree: Coordinate[], parent?: Coordinate): Coordinate[];
555
555
  }
556
556
 
557
557
  /**
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var E = /* @__PURE__ */ ((s) => (s[s.CADModel = 5] = "CADModel", s[s.BIMModel = 6] = "BIMModel", s[s.ForgeModel = 7] = "ForgeModel", s[s.ThreeDModel = 8] = "ThreeDModel", s[s.SkyMapModel = 9] = "SkyMapModel", s[s.ScaleModel = 10] = "ScaleModel", s))(E || {}), et = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(et || {}), v = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(v || {}), C = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(C || {}), U = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))(U || {}), M = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(M || {}), R = /* @__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))(R || {}), st = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(st || {}), w = /* @__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))(w || {});
1
+ var E = /* @__PURE__ */ ((s) => (s[s.CADModel = 5] = "CADModel", s[s.BIMModel = 6] = "BIMModel", s[s.ForgeModel = 7] = "ForgeModel", s[s.ThreeDModel = 8] = "ThreeDModel", s[s.SkyMapModel = 9] = "SkyMapModel", s[s.ScaleModel = 10] = "ScaleModel", s))(E || {}), et = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(et || {}), v = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(v || {}), R = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(R || {}), U = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))(U || {}), M = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(M || {}), O = /* @__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))(O || {}), st = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(st || {}), w = /* @__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))(w || {});
2
2
  const it = {
3
3
  baseUrl: "https://vsleem.com/api",
4
4
  obsType: "hs",
@@ -44,12 +44,12 @@ function at(s, t) {
44
44
  let { url: r, method: a, headers: h = {}, params: l, data: c } = s;
45
45
  n && e && (r = `${e}${r}`), a = a?.toUpperCase();
46
46
  const u = { ...h };
47
- if (/^https?:\/\/.+$/i.test(e ?? "") ? u.PlatForm = new URL(e ?? "").host : u.PlatForm = new URL(window.location.href).host, o && i && (u.AuthorizationCode = i), a === M.POST && !u["Content-Type"] && (u["Content-Type"] = R.JSON), a === M.GET && l) {
47
+ if (/^https?:\/\/.+$/i.test(e ?? "") ? u.PlatForm = new URL(e ?? "").host : u.PlatForm = new URL(window.location.href).host, o && i && (u.AuthorizationCode = i), a === M.POST && !u["Content-Type"] && (u["Content-Type"] = O.JSON), a === M.GET && l) {
48
48
  const g = new URLSearchParams(l);
49
49
  r += `?${g.toString()}`;
50
50
  }
51
51
  let d;
52
- return a === M.POST && (d = u["Content-Type"] === R.JSON ? JSON.stringify(c || {}) : c), {
52
+ return a === M.POST && (d = u["Content-Type"] === O.JSON ? JSON.stringify(c || {}) : c), {
53
53
  url: r,
54
54
  method: a,
55
55
  headers: u,
@@ -97,7 +97,7 @@ function B(s, t) {
97
97
  t
98
98
  );
99
99
  }
100
- function O(s, t) {
100
+ function L(s, t) {
101
101
  return S(
102
102
  {
103
103
  url: "/project/jssdk/cs/save",
@@ -158,7 +158,7 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
158
158
  getMappingRelation: Z,
159
159
  mapingCoordinate: _,
160
160
  removeCoordinate: $,
161
- saveCoordinate: O
161
+ saveCoordinate: L
162
162
  }, Symbol.toStringTag, { value: "Module" })), ut = typeof window < "u", dt = Object.prototype.toString;
163
163
  function T(s, t) {
164
164
  return dt.call(s) === `[object ${t}]`;
@@ -181,7 +181,7 @@ function ft(s) {
181
181
  function mt(s) {
182
182
  return T(s, "String");
183
183
  }
184
- function L(s) {
184
+ function k(s) {
185
185
  return typeof s == "function";
186
186
  }
187
187
  function yt(s) {
@@ -209,7 +209,7 @@ function Mt(s) {
209
209
  return J(s) || H(s);
210
210
  }
211
211
  function vt(s) {
212
- return T(s, "Promise") && b(s) && L(s.then) && L(s.catch);
212
+ return T(s, "Promise") && b(s) && k(s.then) && k(s.catch);
213
213
  }
214
214
  function V(s) {
215
215
  return P(s, /* @__PURE__ */ new WeakMap());
@@ -281,13 +281,13 @@ function St(s, t, e = !1) {
281
281
  clearTimeout(i), i = void 0, n = void 0;
282
282
  }, o;
283
283
  }
284
- function k(s, ...t) {
284
+ function A(s, ...t) {
285
285
  if (!t.length) return s;
286
286
  const e = t.shift();
287
287
  return e === void 0 ? s : (I(s) && I(e) && Object.keys(e).forEach((i) => {
288
288
  const n = s[i], o = e[i];
289
- Array.isArray(n) && Array.isArray(o) ? s[i] = [...n, ...o] : I(n) && I(o) ? s[i] = k({ ...n }, o) : o !== void 0 && (s[i] = o);
290
- }), k(s, ...t));
289
+ Array.isArray(n) && Array.isArray(o) ? s[i] = [...n, ...o] : I(n) && I(o) ? s[i] = A({ ...n }, o) : o !== void 0 && (s[i] = o);
290
+ }), A(s, ...t));
291
291
  }
292
292
  function I(s) {
293
293
  return s !== null && typeof s == "object" && !Array.isArray(s);
@@ -408,7 +408,7 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
408
408
  __proto__: null,
409
409
  cloneDeep: V,
410
410
  debounce: bt,
411
- deepMerge: k,
411
+ deepMerge: A,
412
412
  deepMergeProps: W,
413
413
  error: Rt,
414
414
  getDiffProps: Q,
@@ -420,7 +420,7 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
420
420
  isDate: ft,
421
421
  isDef: q,
422
422
  isElement: gt,
423
- isFunction: L,
423
+ isFunction: k,
424
424
  isNull: H,
425
425
  isNullOrUnDef: Mt,
426
426
  isNumeric: N,
@@ -789,7 +789,7 @@ class m {
789
789
  renderType: l,
790
790
  relativePosition: g
791
791
  };
792
- }), r = await O(o);
792
+ }), r = await L(o);
793
793
  return m.handleCoordinateList(r);
794
794
  }
795
795
  /**
@@ -812,7 +812,7 @@ class m {
812
812
  const { projectId: i, id: n } = t, o = e.map((a) => {
813
813
  const { type: h, relativeMap: l, level: c, ...u } = a, d = p.toStringify(l);
814
814
  return { ...u, relativePosition: d, projectId: i, parentId: n };
815
- }), r = await O(o);
815
+ }), r = await L(o);
816
816
  return m.handleCoordinateList(r);
817
817
  }
818
818
  /**
@@ -842,7 +842,7 @@ class m {
842
842
  relativePosition: r,
843
843
  ...a
844
844
  } = e, h = p.toParse(r);
845
- return new A({
845
+ return new C({
846
846
  ...a,
847
847
  type: i,
848
848
  modelType: o,
@@ -860,7 +860,7 @@ class m {
860
860
  const e = Array.isArray(t) ? t : [t], i = [];
861
861
  function n(o) {
862
862
  for (const r of o) {
863
- const { level: a, parent: h, relativeMap: l, ...c } = r, u = new A({
863
+ const { level: a, parent: h, relativeMap: l, ...c } = r, u = new C({
864
864
  ...c,
865
865
  relativeMap: new p(l)
866
866
  });
@@ -908,15 +908,17 @@ class m {
908
908
  * 过滤空间坐标系树
909
909
  * @param tree
910
910
  */
911
- static filterSpaceTree(t) {
912
- const e = [];
913
- return t.forEach((i) => {
914
- const n = m.filterSpaceTree(i.children);
915
- i.children = n, i.disabled = i.disabled ?? !1, i.type !== v.Model && e.push(i);
916
- }), e;
911
+ static filterSpaceTree(t, e) {
912
+ const i = [];
913
+ return t.forEach((n) => {
914
+ const o = new C(n);
915
+ e && (o.parent = e);
916
+ const r = m.filterSpaceTree(o.children, o);
917
+ o.children = r, o.disabled = o.disabled ?? !1, o.type !== v.Model && i.push(o);
918
+ }), i;
917
919
  }
918
920
  }
919
- class A {
921
+ class C {
920
922
  id = 0;
921
923
  /** id */
922
924
  type = 0;
@@ -1041,7 +1043,7 @@ class A {
1041
1043
  */
1042
1044
  findChildModel(t = [E.CADModel, E.SkyMapModel], e = !0) {
1043
1045
  const i = x(t) ? t : [t];
1044
- return i.includes(this.modelType ?? -1) && this.status !== C.Disabled ? this : ([v.Data, v.Model].includes(this.type) ? this.findParentSpace() : this)?.modelList?.filter((a) => i.includes(a.modelType ?? -1) ? e ? !!a.relativeMap : !0 : !1)?.sort((a, h) => Number(a.status) - Number(h.status))?.[0];
1046
+ return i.includes(this.modelType ?? -1) && this.status !== R.Disabled ? this : ([v.Data, v.Model].includes(this.type) ? this.findParentSpace() : this)?.modelList?.filter((a) => i.includes(a.modelType ?? -1) ? e ? !!a.relativeMap : !0 : !1)?.sort((a, h) => Number(a.status) - Number(h.status))?.[0];
1045
1047
  }
1046
1048
  /**
1047
1049
  * 寻找与当前节点最近的一个模型节点,从当前节点遍历到根节点-广度优先遍历
@@ -1154,7 +1156,7 @@ class A {
1154
1156
  */
1155
1157
  getMappedCsTree() {
1156
1158
  function t(n) {
1157
- return n.children?.length && (n.children = n.children.filter((o) => !!o?.relativeMap && o.status !== C.Disabled).map((o) => t(o))), n;
1159
+ return n.children?.length && (n.children = n.children.filter((o) => !!o?.relativeMap && o.status !== R.Disabled).map((o) => t(o))), n;
1158
1160
  }
1159
1161
  const e = V(this.findRoot(!0)), i = t(e);
1160
1162
  return i.parentId = 0, i.parent = void 0, i;
@@ -1703,10 +1705,10 @@ export {
1703
1705
  Ft as CanvasPointElement,
1704
1706
  Gt as CanvasRadarElement,
1705
1707
  Bt as CanvasRegionElement,
1706
- A as Coordinate,
1708
+ C as Coordinate,
1707
1709
  et as CoordinateLevel,
1708
1710
  E as CoordinateModelType,
1709
- C as CoordinateStatus,
1711
+ R as CoordinateStatus,
1710
1712
  v as CoordinateType,
1711
1713
  At as DataHelper,
1712
1714
  m as DataSource,
@@ -1714,7 +1716,7 @@ export {
1714
1716
  f as Point,
1715
1717
  K as Position,
1716
1718
  p as RelativeMap,
1717
- R as RequestContentType,
1719
+ O as RequestContentType,
1718
1720
  M as RequestMethod,
1719
1721
  U as RequestResultCode,
1720
1722
  tt as Vector3,
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(u,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(u=typeof globalThis<"u"?globalThis:u||self,T(u.Shared={}))})(this,(function(u){"use strict";var T=(s=>(s[s.CADModel=5]="CADModel",s[s.BIMModel=6]="BIMModel",s[s.ForgeModel=7]="ForgeModel",s[s.ThreeDModel=8]="ThreeDModel",s[s.SkyMapModel=9]="SkyMapModel",s[s.ScaleModel=10]="ScaleModel",s))(T||{}),Y=(s=>(s[s.Global=0]="Global",s))(Y||{}),v=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(v||{}),I=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(I||{}),L=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(L||{}),M=(s=>(s.GET="GET",s.POST="POST",s))(M||{}),N=(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))(N||{}),G=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(G||{}),p=(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||{});const B={baseUrl:"https://vsleem.com/api",obsType:"hs",authorizeCode:""},ot={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},rt={url:"",method:M.GET,headers:{}};class y extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,y.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}const $={...B};function at(s){Object.assign($,s)}async function S(s,t){const e={...ot,...t},i={...rt,...s};try{const n=ht(i,e),{url:o,...r}=n,h=await(await window.fetch(o,r)).json();return ct(h,e)}catch(n){return lt(n)}}function ht(s,t){const{baseUrl:e,authorizeCode:i}=$,{joinBaseUrl:n,withAuthorize:o}=t;let{url:r,method:a,headers:h={},params:l,data:c}=s;n&&e&&(r=`${e}${r}`),a=a?.toUpperCase();const d={...h};if(/^https?:\/\/.+$/i.test(e??"")?d.PlatForm=new URL(e??"").host:d.PlatForm=new URL(window.location.href).host,o&&i&&(d.AuthorizationCode=i),a===M.POST&&!d["Content-Type"]&&(d["Content-Type"]=N.JSON),a===M.GET&&l){const b=new URLSearchParams(l);r+=`?${b.toString()}`}let f;return a===M.POST&&(f=d["Content-Type"]===N.JSON?JSON.stringify(c||{}):c),{url:r,method:a,headers:d,body:f}}function ct(s,t){if(!t.isTransformResponse)return s;if(!s)throw new y(p.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===L.SUCCESS)return i;throw new y(p.RequestCodeError,n||"请求返回的Code错误")}function lt(s){throw s instanceof Error?s:new y(p.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const ut=Object.freeze(Object.defineProperty({__proto__:null,request:S,setRequestGlobalConfig:at},Symbol.toStringTag,{value:"Module"}));function _(s,t){return S({url:"/project/jssdk/cs/list",method:M.GET,params:s},t)}function q(s,t){return S({url:"/project/jssdk/cs/bind",method:M.POST,data:s},t)}function k(s,t){return S({url:"/project/jssdk/cs/save",method:M.POST,data:s},t)}function Z(s,t){return S({url:"/project/jssdk/cs/delete",method:M.POST,data:s},t)}function J(s,t){return S({url:"/project/jssdk/cs/mapping",method:M.POST,data:s},t)}function H(s,t){return S({url:"/project/jssdk/cs/mapping/query",method:M.GET,params:s},t)}function dt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return S({url:s,method:M.GET},t)}const ft=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:q,getCoordinateList:_,getImageInfo:dt,getMappingRelation:H,mapingCoordinate:J,removeCoordinate:Z,saveCoordinate:k},Symbol.toStringTag,{value:"Module"})),mt=typeof window<"u",yt=Object.prototype.toString;function P(s,t){return yt.call(s)===`[object ${t}]`}function V(s){return typeof s<"u"}function W(s){return!V(s)}function E(s){return s!==null&&P(s,"Object")}function Q(s){return s===null}function wt(s){return P(s,"Date")}function pt(s){return P(s,"String")}function A(s){return typeof s=="function"}function gt(s){return P(s,"Boolean")}function Mt(s){return P(s,"RegExp")}function x(s){return s&&Array.isArray(s)}function vt(s){return typeof window<"u"&&P(s,"Window")}function xt(s){return E(s)&&!!s.tagName}function R(s){return typeof s=="number"?!0:typeof s!="string"?!1:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s)}function bt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function Tt(s){return W(s)||Q(s)}function St(s){return P(s,"Promise")&&E(s)&&A(s.then)&&A(s.catch)}function K(s){return C(s,new WeakMap)}function C(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,C(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(C(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]=C(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]=C(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=C(s[n],t));return e}function Pt(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 Et(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 j(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(O(s)&&O(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:O(n)&&O(o)?s[i]=j({...n},o):o!==void 0&&(s[i]=o)}),j(s,...t))}function O(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function tt(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]={}),tt(s[i],n)):s[i]=n});return s}function et(s,t){const e={};if(E(s)&&!x(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=E(t)&&!x(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(x(n)&&x(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(E(n)&&E(o)){const r=et(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(E(t)&&x(t))for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!(i in(s||{}))&&(e[i]=void 0);return e}function Ct(s,t={}){return new Promise((e,i)=>{const n=D(s);if(Dt(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 Dt(s){const t=D(s);return Array.from(document.scripts).some(e=>D(e.src)===t)}function zt(s){return new Promise((t,e)=>{const i=D(s);if(It(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 It(s){const t=D(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>D(e.href)===t)}function D(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function Nt(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 Rt(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function Ot(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}function Lt(s){console.warn(`[warn]:${s}`)}function kt(s){throw new Error(`[error]:${s}`)}const At=Object.freeze(Object.defineProperty({__proto__:null,cloneDeep:K,debounce:Pt,deepMerge:j,deepMergeProps:tt,error:kt,getDiffProps:et,getImageTransform:Nt,inBrowser:mt,is:P,isArray:x,isBoolean:gt,isDate:wt,isDef:V,isElement:xt,isFunction:A,isNull:Q,isNullOrUnDef:Tt,isNumeric:R,isObject:E,isPromise:St,isRegExp:Mt,isSameValue:bt,isString:pt,isUnDef:W,isWindow:vt,loadCss:zt,loadScript:Ct,throttle:Et,toCanvasCoord:Rt,toModelCoord:Ot,warn:Lt},Symbol.toStringTag,{value:"Module"}));class m{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:h,pitch:l,roll:c,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(h)||0,this.pitch=Number(l)||0,this.roll=Number(c)||0,(R(h)||R(l)||R(c))&&(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),h=Math.sqrt(o.x**2+o.z**2),l=Math.max(-1,Math.min(1,r/(a*h))),d=Math.acos(l)*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 m({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 m(this);if(e?.modelType===T.SkyMapModel){const{refPoint:n}=e?.relativeMap||{};if(this?.hasXYZ)return this.project(t);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 y(p.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===T.SkyMapModel){const{refPoint:n}=i?.relativeMap||{};if(this?.hasGeo)return new m(this);const 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 y(p.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new y(p.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new y(p.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new m(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 m(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=e,this.lon=i,this.alt=n}static XYZToLLH(t,e){const n=.0033528106647474805,o=n*(2-n),r=m.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let h,l,c;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),f=t.z/1e3/a;h=e.lon+m.toDegrees(d),l=e.lat-m.toDegrees(f),c=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),f=t.y/1e3/a;h=e.lon+m.toDegrees(d),l=e.lat-m.toDegrees(f),c=e.alt+t.z/1e3}else throw new y(p.GeoPointNoPlane,"点的plane应为xz或xy");return new z({lat:l,lon:h,alt:c})}static LLHToXYZ(t,e){const n=.0033528106647474805,o=n*(2-n),r=m.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,h=m.toRadians(t.lon-e.lon),l=m.toRadians(e.lat-t.lat),c=a*h*Math.cos(r),d=a*l;if(t.plane==="xz")return new m({x:c*1e3,y:(t.alt-e.alt)*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new m({x:c*1e3,y:d*1e3,z:(t.alt-e.alt)*1e3,plane:"xy"});throw new y(p.GeoPointNoPlane,"点的plane应为xz或xy")}}class g{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 y(p.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,h=0,l=0;if(t.plane==="xz"){const c=t.x*o-t.z*r,d=t.y,f=t.x*r+t.z*o;a=e.x+c*e.scale,h=e.y+d*e.scale,l=e.z+f*e.scale}else if(t.plane==="xy"){const c=t.x*o-t.y*r,d=t.x*r+t.y*o,f=t.z;a=e.x+c*e.scale,h=e.y+d*e.scale,l=e.z+f*e.scale}else throw new y(p.RelativeNoPlane,"映射关系的plane应为xz或xy");return new g({scale:i,yaw:n,x:a,y:h,z:l,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,h=0;if(t.plane==="xz")r=-(t.x*n+t.z*o)*e,a=-t.y*e,h=-(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,h=-t.z*e;else throw new y(p.RelativeNoPlane,"映射关系的plane应为xz或xy");return new g({scale:e,yaw:i,x:r,y:a,z:h,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 g(e):void 0}catch{throw new y(p.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}}class w{static async getCoordinateTree(t){const e=await _({projectId:t});if(e.length){const i=w.handleCoordinateList(e);return w.buildCoordinateTree(i,0)}}static parsedCoordinateTree(t){const e=w.flattenCoordinateTree(t);return w.buildCoordinateTree(e,0)}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,modelType:l,relativeMap:c,level:d,...f}=a,b=c?JSON.stringify(c):void 0;return{...f,projectId:i,parentId:n,coordinateType:h,renderType:l,relativePosition:b}}),r=await k(o);return w.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await Z(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,relativeMap:l,level:c,...d}=a,f=g.toStringify(l);return{...d,relativePosition:f,projectId:i,parentId:n}}),r=await k(o);return w.handleCoordinateList(r)}static async bindCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{modelId:h}=a;return{modelId:h,parentId:n,projectId:i}}),r=await q(o);return w.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,h=g.toParse(r);return new X({...a,type:i,modelType:o,modelValue:n,relativeMap:h})})}static flattenCoordinateTree(t){const e=Array.isArray(t)?t:[t],i=[];function n(o){for(const r of o){const{level:a,parent:h,relativeMap:l,...c}=r,d=new X({...c,relativeMap:new g(l)});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===v.Space&&(r.level=(Number(a.level)||0)+1),r.parent=a,a.children?.push(r))}}),n.forEach(w.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===v.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(w.sortCoordinateTree))}static filterSpaceTree(t){const e=[];return t.forEach(i=>{const n=w.filterSpaceTree(i.children);i.children=n,i.disabled=i.disabled??!1,i.type!==v.Model&&e.push(i)}),e}}class X{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===v.Space)}get modelList(){return this.children.filter(t=>t.type===v.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 g(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=x(t)?t:[t],i=await w.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=x(t)?t:[t];await w.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=x(t)?t:[t],i=await w.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=x(t)?t:[t],i=await w.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:h,modelId:l,modelValue:c}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:h,modelId:l,modelValue:c})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await J(t)}async fromMapping(){const t=await H({srcCsId:this.id});return t[t.length-1]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t=[T.CADModel,T.SkyMapModel],e=!0){const i=x(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==I.Disabled?this:([v.Data,v.Model].includes(this.type)?this.findParentSpace():this)?.modelList?.filter(a=>i.includes(a.modelType??-1)?e?!!a.relativeMap:!0:!1)?.sort((a,h)=>Number(a.status)-Number(h.status))?.[0]}findClosestModel(t=T.CADModel,e){const i=new Set;for(const l of e??[])i.add(String(l.id));const n=[{node:this,distance:0}],o=x(t)?t:[t],r=new Set;let a,h=1/0;for(;n.length>0;){const l=n.shift();if(!l)break;const{node:c,distance:d}=l;if(i.has(String(c.id)))continue;if(o.includes(c.modelType??-1)){if(d<h&&(a=c,h=d,d<=1))break;continue}r.add(c);const f=[];if(c.children)for(const b of c.children)r.has(b)||f.push(b);if(c.parent?.children)for(const b of c.parent.children)b!==c&&!r.has(b)&&f.push(b);c.parent&&!r.has(c.parent)&&f.push(c.parent);for(const b of f)n.push({node:b,distance:d+1})}return a}findParentSpace(){let t=this;for(;t&&t.type!==v.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===v.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)||[]:[this]}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!==I.Disabled).map(o=>t(o))),n}const e=K(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new g;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new g;return e?.forEach(o=>{n=g.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=g.addRelativeMap(n,g.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===v.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 F{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 F({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class U{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 U({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class jt{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 Xt{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:h,afterDraw:l,...c}=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=h,this.isMoveRedrawing=a??r,this.options=c,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 st={};class Ft{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=st[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=()=>{st[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 Ut{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 it={};class Yt{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=it[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=()=>{it[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,h=this.badgeR*i,l=h*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,h,0,2*Math.PI),t.fillStyle="red",t.fill(),t.font=`${l}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.count.toString(),this.x+n*.3,this.y-o*.8+h/2)),t.restore()}}const nt={};class Gt{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=nt[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=()=>{nt[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 Bt{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 $t{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,h=i+(o-i)/2,l=n+(r-n)/2;t.arc(h,l,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()}}u.APP_SETTING=B,u.AppError=y,u.AppErrorCode=p,u.AppObsType=G,u.CanvasElement=Xt,u.CanvasImageElement=Ft,u.CanvasIssueElement=Yt,u.CanvasMarkerElement=Gt,u.CanvasPointElement=Ut,u.CanvasRadarElement=Bt,u.CanvasRegionElement=$t,u.Coordinate=X,u.CoordinateLevel=Y,u.CoordinateModelType=T,u.CoordinateStatus=I,u.CoordinateType=v,u.DataHelper=jt,u.DataSource=w,u.GeoPoint=z,u.Point=m,u.Position=F,u.RelativeMap=g,u.RequestContentType=N,u.RequestMethod=M,u.RequestResultCode=L,u.Vector3=U,u.api=ft,u.http=ut,u.utils=At,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(u,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(u=typeof globalThis<"u"?globalThis:u||self,T(u.Shared={}))})(this,(function(u){"use strict";var T=(s=>(s[s.CADModel=5]="CADModel",s[s.BIMModel=6]="BIMModel",s[s.ForgeModel=7]="ForgeModel",s[s.ThreeDModel=8]="ThreeDModel",s[s.SkyMapModel=9]="SkyMapModel",s[s.ScaleModel=10]="ScaleModel",s))(T||{}),Y=(s=>(s[s.Global=0]="Global",s))(Y||{}),v=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(v||{}),I=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(I||{}),k=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(k||{}),M=(s=>(s.GET="GET",s.POST="POST",s))(M||{}),N=(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))(N||{}),G=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(G||{}),p=(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||{});const B={baseUrl:"https://vsleem.com/api",obsType:"hs",authorizeCode:""},ot={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},rt={url:"",method:M.GET,headers:{}};class y extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,y.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}const $={...B};function at(s){Object.assign($,s)}async function S(s,t){const e={...ot,...t},i={...rt,...s};try{const n=ht(i,e),{url:o,...r}=n,h=await(await window.fetch(o,r)).json();return ct(h,e)}catch(n){return lt(n)}}function ht(s,t){const{baseUrl:e,authorizeCode:i}=$,{joinBaseUrl:n,withAuthorize:o}=t;let{url:r,method:a,headers:h={},params:l,data:c}=s;n&&e&&(r=`${e}${r}`),a=a?.toUpperCase();const d={...h};if(/^https?:\/\/.+$/i.test(e??"")?d.PlatForm=new URL(e??"").host:d.PlatForm=new URL(window.location.href).host,o&&i&&(d.AuthorizationCode=i),a===M.POST&&!d["Content-Type"]&&(d["Content-Type"]=N.JSON),a===M.GET&&l){const b=new URLSearchParams(l);r+=`?${b.toString()}`}let f;return a===M.POST&&(f=d["Content-Type"]===N.JSON?JSON.stringify(c||{}):c),{url:r,method:a,headers:d,body:f}}function ct(s,t){if(!t.isTransformResponse)return s;if(!s)throw new y(p.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===k.SUCCESS)return i;throw new y(p.RequestCodeError,n||"请求返回的Code错误")}function lt(s){throw s instanceof Error?s:new y(p.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const ut=Object.freeze(Object.defineProperty({__proto__:null,request:S,setRequestGlobalConfig:at},Symbol.toStringTag,{value:"Module"}));function _(s,t){return S({url:"/project/jssdk/cs/list",method:M.GET,params:s},t)}function q(s,t){return S({url:"/project/jssdk/cs/bind",method:M.POST,data:s},t)}function A(s,t){return S({url:"/project/jssdk/cs/save",method:M.POST,data:s},t)}function Z(s,t){return S({url:"/project/jssdk/cs/delete",method:M.POST,data:s},t)}function J(s,t){return S({url:"/project/jssdk/cs/mapping",method:M.POST,data:s},t)}function H(s,t){return S({url:"/project/jssdk/cs/mapping/query",method:M.GET,params:s},t)}function dt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return S({url:s,method:M.GET},t)}const ft=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:q,getCoordinateList:_,getImageInfo:dt,getMappingRelation:H,mapingCoordinate:J,removeCoordinate:Z,saveCoordinate:A},Symbol.toStringTag,{value:"Module"})),mt=typeof window<"u",yt=Object.prototype.toString;function P(s,t){return yt.call(s)===`[object ${t}]`}function V(s){return typeof s<"u"}function W(s){return!V(s)}function E(s){return s!==null&&P(s,"Object")}function Q(s){return s===null}function wt(s){return P(s,"Date")}function pt(s){return P(s,"String")}function j(s){return typeof s=="function"}function gt(s){return P(s,"Boolean")}function Mt(s){return P(s,"RegExp")}function x(s){return s&&Array.isArray(s)}function vt(s){return typeof window<"u"&&P(s,"Window")}function xt(s){return E(s)&&!!s.tagName}function R(s){return typeof s=="number"?!0:typeof s!="string"?!1:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s)}function bt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function Tt(s){return W(s)||Q(s)}function St(s){return P(s,"Promise")&&E(s)&&j(s.then)&&j(s.catch)}function K(s){return C(s,new WeakMap)}function C(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,C(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(C(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]=C(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]=C(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=C(s[n],t));return e}function Pt(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 Et(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 X(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(O(s)&&O(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:O(n)&&O(o)?s[i]=X({...n},o):o!==void 0&&(s[i]=o)}),X(s,...t))}function O(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function tt(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]={}),tt(s[i],n)):s[i]=n});return s}function et(s,t){const e={};if(E(s)&&!x(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=E(t)&&!x(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(x(n)&&x(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(E(n)&&E(o)){const r=et(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(E(t)&&x(t))for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!(i in(s||{}))&&(e[i]=void 0);return e}function Ct(s,t={}){return new Promise((e,i)=>{const n=D(s);if(Dt(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 Dt(s){const t=D(s);return Array.from(document.scripts).some(e=>D(e.src)===t)}function zt(s){return new Promise((t,e)=>{const i=D(s);if(It(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 It(s){const t=D(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>D(e.href)===t)}function D(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function Nt(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 Rt(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function Ot(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}function Lt(s){console.warn(`[warn]:${s}`)}function kt(s){throw new Error(`[error]:${s}`)}const At=Object.freeze(Object.defineProperty({__proto__:null,cloneDeep:K,debounce:Pt,deepMerge:X,deepMergeProps:tt,error:kt,getDiffProps:et,getImageTransform:Nt,inBrowser:mt,is:P,isArray:x,isBoolean:gt,isDate:wt,isDef:V,isElement:xt,isFunction:j,isNull:Q,isNullOrUnDef:Tt,isNumeric:R,isObject:E,isPromise:St,isRegExp:Mt,isSameValue:bt,isString:pt,isUnDef:W,isWindow:vt,loadCss:zt,loadScript:Ct,throttle:Et,toCanvasCoord:Rt,toModelCoord:Ot,warn:Lt},Symbol.toStringTag,{value:"Module"}));class m{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:h,pitch:l,roll:c,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(h)||0,this.pitch=Number(l)||0,this.roll=Number(c)||0,(R(h)||R(l)||R(c))&&(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),h=Math.sqrt(o.x**2+o.z**2),l=Math.max(-1,Math.min(1,r/(a*h))),d=Math.acos(l)*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 m({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 m(this);if(e?.modelType===T.SkyMapModel){const{refPoint:n}=e?.relativeMap||{};if(this?.hasXYZ)return this.project(t);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 y(p.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===T.SkyMapModel){const{refPoint:n}=i?.relativeMap||{};if(this?.hasGeo)return new m(this);const 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 y(p.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new y(p.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new y(p.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new m(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 m(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=e,this.lon=i,this.alt=n}static XYZToLLH(t,e){const n=.0033528106647474805,o=n*(2-n),r=m.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let h,l,c;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),f=t.z/1e3/a;h=e.lon+m.toDegrees(d),l=e.lat-m.toDegrees(f),c=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),f=t.y/1e3/a;h=e.lon+m.toDegrees(d),l=e.lat-m.toDegrees(f),c=e.alt+t.z/1e3}else throw new y(p.GeoPointNoPlane,"点的plane应为xz或xy");return new z({lat:l,lon:h,alt:c})}static LLHToXYZ(t,e){const n=.0033528106647474805,o=n*(2-n),r=m.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,h=m.toRadians(t.lon-e.lon),l=m.toRadians(e.lat-t.lat),c=a*h*Math.cos(r),d=a*l;if(t.plane==="xz")return new m({x:c*1e3,y:(t.alt-e.alt)*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new m({x:c*1e3,y:d*1e3,z:(t.alt-e.alt)*1e3,plane:"xy"});throw new y(p.GeoPointNoPlane,"点的plane应为xz或xy")}}class g{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 y(p.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,h=0,l=0;if(t.plane==="xz"){const c=t.x*o-t.z*r,d=t.y,f=t.x*r+t.z*o;a=e.x+c*e.scale,h=e.y+d*e.scale,l=e.z+f*e.scale}else if(t.plane==="xy"){const c=t.x*o-t.y*r,d=t.x*r+t.y*o,f=t.z;a=e.x+c*e.scale,h=e.y+d*e.scale,l=e.z+f*e.scale}else throw new y(p.RelativeNoPlane,"映射关系的plane应为xz或xy");return new g({scale:i,yaw:n,x:a,y:h,z:l,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,h=0;if(t.plane==="xz")r=-(t.x*n+t.z*o)*e,a=-t.y*e,h=-(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,h=-t.z*e;else throw new y(p.RelativeNoPlane,"映射关系的plane应为xz或xy");return new g({scale:e,yaw:i,x:r,y:a,z:h,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 g(e):void 0}catch{throw new y(p.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}}class w{static async getCoordinateTree(t){const e=await _({projectId:t});if(e.length){const i=w.handleCoordinateList(e);return w.buildCoordinateTree(i,0)}}static parsedCoordinateTree(t){const e=w.flattenCoordinateTree(t);return w.buildCoordinateTree(e,0)}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,modelType:l,relativeMap:c,level:d,...f}=a,b=c?JSON.stringify(c):void 0;return{...f,projectId:i,parentId:n,coordinateType:h,renderType:l,relativePosition:b}}),r=await A(o);return w.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await Z(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,relativeMap:l,level:c,...d}=a,f=g.toStringify(l);return{...d,relativePosition:f,projectId:i,parentId:n}}),r=await A(o);return w.handleCoordinateList(r)}static async bindCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{modelId:h}=a;return{modelId:h,parentId:n,projectId:i}}),r=await q(o);return w.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,h=g.toParse(r);return new L({...a,type:i,modelType:o,modelValue:n,relativeMap:h})})}static flattenCoordinateTree(t){const e=Array.isArray(t)?t:[t],i=[];function n(o){for(const r of o){const{level:a,parent:h,relativeMap:l,...c}=r,d=new L({...c,relativeMap:new g(l)});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===v.Space&&(r.level=(Number(a.level)||0)+1),r.parent=a,a.children?.push(r))}}),n.forEach(w.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===v.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(w.sortCoordinateTree))}static filterSpaceTree(t,e){const i=[];return t.forEach(n=>{const o=new L(n);e&&(o.parent=e);const r=w.filterSpaceTree(o.children,o);o.children=r,o.disabled=o.disabled??!1,o.type!==v.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===v.Space)}get modelList(){return this.children.filter(t=>t.type===v.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 g(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=x(t)?t:[t],i=await w.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=x(t)?t:[t];await w.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=x(t)?t:[t],i=await w.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=x(t)?t:[t],i=await w.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:h,modelId:l,modelValue:c}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:h,modelId:l,modelValue:c})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await J(t)}async fromMapping(){const t=await H({srcCsId:this.id});return t[t.length-1]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t=[T.CADModel,T.SkyMapModel],e=!0){const i=x(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==I.Disabled?this:([v.Data,v.Model].includes(this.type)?this.findParentSpace():this)?.modelList?.filter(a=>i.includes(a.modelType??-1)?e?!!a.relativeMap:!0:!1)?.sort((a,h)=>Number(a.status)-Number(h.status))?.[0]}findClosestModel(t=T.CADModel,e){const i=new Set;for(const l of e??[])i.add(String(l.id));const n=[{node:this,distance:0}],o=x(t)?t:[t],r=new Set;let a,h=1/0;for(;n.length>0;){const l=n.shift();if(!l)break;const{node:c,distance:d}=l;if(i.has(String(c.id)))continue;if(o.includes(c.modelType??-1)){if(d<h&&(a=c,h=d,d<=1))break;continue}r.add(c);const f=[];if(c.children)for(const b of c.children)r.has(b)||f.push(b);if(c.parent?.children)for(const b of c.parent.children)b!==c&&!r.has(b)&&f.push(b);c.parent&&!r.has(c.parent)&&f.push(c.parent);for(const b of f)n.push({node:b,distance:d+1})}return a}findParentSpace(){let t=this;for(;t&&t.type!==v.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===v.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)||[]:[this]}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!==I.Disabled).map(o=>t(o))),n}const e=K(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new g;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new g;return e?.forEach(o=>{n=g.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=g.addRelativeMap(n,g.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===v.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 F{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 F({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class U{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 U({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class jt{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 Xt{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:h,afterDraw:l,...c}=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=h,this.isMoveRedrawing=a??r,this.options=c,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 st={};class Ft{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=st[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=()=>{st[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 Ut{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 it={};class Yt{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=it[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=()=>{it[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,h=this.badgeR*i,l=h*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,h,0,2*Math.PI),t.fillStyle="red",t.fill(),t.font=`${l}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.count.toString(),this.x+n*.3,this.y-o*.8+h/2)),t.restore()}}const nt={};class Gt{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=nt[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=()=>{nt[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 Bt{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 $t{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,h=i+(o-i)/2,l=n+(r-n)/2;t.arc(h,l,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()}}u.APP_SETTING=B,u.AppError=y,u.AppErrorCode=p,u.AppObsType=G,u.CanvasElement=Xt,u.CanvasImageElement=Ft,u.CanvasIssueElement=Yt,u.CanvasMarkerElement=Gt,u.CanvasPointElement=Ut,u.CanvasRadarElement=Bt,u.CanvasRegionElement=$t,u.Coordinate=L,u.CoordinateLevel=Y,u.CoordinateModelType=T,u.CoordinateStatus=I,u.CoordinateType=v,u.DataHelper=jt,u.DataSource=w,u.GeoPoint=z,u.Point=m,u.Position=F,u.RelativeMap=g,u.RequestContentType=N,u.RequestMethod=M,u.RequestResultCode=k,u.Vector3=U,u.api=ft,u.http=ut,u.utils=At,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsleem-realsee-viewer/shared",
3
- "version": "2.0.17",
3
+ "version": "2.0.18",
4
4
  "private": false,
5
5
  "description": "Shared utilities for VSLeem RealSee Viewer",
6
6
  "main": "./dist/index.umd.js",