@vsleem-realsee-viewer/shared 2.0.6 → 2.0.7

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/README.md CHANGED
@@ -8,58 +8,58 @@
8
8
 
9
9
  | 属性 | 类型 | 默认值 | 说明 |
10
10
  | -------------- | -------------- | ------ | -------------------------------------------- |
11
- | `id` | `number` | `0` | 坐标系的唯一标识符 |
12
- | `type` | `number` | `0` | 坐标系类型:0表示空间坐标系,1表示模型坐标系 |
13
- | `level?` | `number` | `-` | 可选,表示空间坐标系的层级深度 |
14
- | `relativeMap?` | `RelativeMap` | `-` | 可选,存储与父坐标系的相对位置变换关系 |
15
- | `no?` | `string` | `-` | 可选,坐标系的编号标识 |
16
- | `name?` | `string` | `-` | 可选,坐标系的完整名称 |
17
- | `shortName?` | `string` | `-` | 可选,坐标系的简称 |
18
- | `status?` | `number` | `-` | 可选,表示坐标系的当前使用状态 |
19
- | `modelId?` | `number` | `-` | 可选,关联的模型ID |
20
- | `modelType?` | `number` | `-` | 可选,关联的模型类型 |
21
- | `modelValue?` | `string` | `-` | 可选,关联的模型值 |
22
- | `projectId?` | `number` | `-` | 可选,所属项目ID |
23
- | `parentId?` | `number` | `-` | 可选,父坐标系ID |
24
- | `parent?` | `Coordinate` | `-` | 可选,父坐标系对象引用 |
25
- | `groupUuid?` | `string` | `-` | 可选,坐标系分组的唯一标识 |
26
- | `children` | `Coordinate[]` | `[]` | 子坐标系数组,默认初始化为空数组 |
27
- | `z?` | `number` | `-` | 可选,坐标系的高度值 |
28
- | `disabled?` | `boolean` | `-` | 可选,标识坐标系是否被禁用 |
29
- | `createTime?` | `number` | `-` | 可选,坐标系的创建时间戳 |
11
+ | `id` | `number` | 0 | 坐标系的唯一标识符 |
12
+ | `type` | `number` | 0 | 坐标系类型:0表示空间坐标系,1表示模型坐标系 |
13
+ | `level?` | `number` | - | 表示空间坐标系的层级深度 |
14
+ | `relativeMap?` | `RelativeMap` | - | 存储与父坐标系的相对位置变换关系 |
15
+ | `no?` | `string` | - | 坐标系的编号标识 |
16
+ | `name?` | `string` | - | 坐标系的完整名称 |
17
+ | `shortName?` | `string` | - | 坐标系的简称 |
18
+ | `status?` | `number` | - | 表示坐标系的当前使用状态 |
19
+ | `modelId?` | `number` | - | 关联的模型ID |
20
+ | `modelType?` | `number` | - | 关联的模型类型 |
21
+ | `modelValue?` | `string` | - | 关联的模型值 |
22
+ | `projectId?` | `number` | - | 所属项目ID |
23
+ | `parentId?` | `number` | - | 父坐标系ID |
24
+ | `parent?` | `Coordinate` | - | 父坐标系对象引用 |
25
+ | `groupUuid?` | `string` | - | 坐标系分组的唯一标识 |
26
+ | `children` | `Coordinate[]` | [] | 子坐标系数组,默认初始化为空数组 |
27
+ | `z?` | `number` | - | 坐标系的高度值 |
28
+ | `disabled?` | `boolean` | - | 标识坐标系是否被禁用 |
29
+ | `createTime?` | `number` | - | 坐标系的创建时间戳 |
30
30
 
31
31
  ## 计算属性说明
32
32
 
33
- | 属性 | 类型 | 说明 |
34
- | ----------- | -------------- | -------------------------------------------------- |
35
- | `spaceList` | `Coordinate[]` | 获取所有空间类型的子坐标系 |
36
- | `modelList` | `Coordinate[]` | 获取所有模型类型的子坐标系 |
37
- | `fullName` | `string` | 获取组合后的完整名称,格式为"简称(名称)"或单独名称 |
33
+ | 属性 | 类型 | 默认值 | 说明 |
34
+ | ----------- | -------------- | ------ | -------------------------------------------------- |
35
+ | `spaceList` | `Coordinate[]` | [] | 获取所有空间类型的子坐标系 |
36
+ | `modelList` | `Coordinate[]` | [] | 获取所有模型类型的子坐标系 |
37
+ | `fullName` | `string` | - | 获取组合后的完整名称,格式为"简称(名称)"或单独名称 |
38
38
 
39
39
  ## 方法说明
40
40
 
41
- | 方法 | 类型 | 说明 |
42
- | ---------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------- |
43
- | `constructor` | `(options?: Partial<Coordinate>) => Coordinate` | 初始化坐标系实例,支持部分属性配置 |
44
- | `addChild` | `(child: Partial<Coordinate> \| Partial<Coordinate>[]) => Promise<void>` | 添加一个或多个子坐标系,并建立映射关系 |
45
- | `removeChild` | `(child: Partial<Coordinate> \| Partial<Coordinate>[]) => Promise<void>` | 移除一个或多个子坐标系 |
46
- | `updateChild` | `(child: Partial<Coordinate> \| Partial<Coordinate>[]) => Promise<void>` | 更新子坐标系的属性信息 |
47
- | `bindChild` | `(child: Partial<Coordinate> \| Partial<Coordinate>[]) => Promise<void>` | 绑定子坐标系但不建立映射关系 |
48
- | `mergeChild` | `(result?: Coordinate[]) => Promise<void>` | 合并更新的子坐标系数据到当前树结构 |
49
- | `mappingTo` | `(result: ProjectionModel[]) => Promise<void>` | 将当前坐标系映射到目标坐标系组 |
50
- | `fromMapping` | `() => Promise<ProjectionModel \| undefined>` | 查询当前坐标系被哪些源坐标系映射 |
51
- | `findRoot` | `(mapped?: boolean) => Coordinate` | 递归查找根坐标系,可选是否只查找有映射关系的 |
52
- | `findChildModel` | `(type?: number \| number[], mapped?: boolean) => Coordinate \| undefined` | 查找符合条件的子模型坐标系 |
53
- | `findClosestModel` | `(type?: number \| number[], excludeNodes?: Coordinate[]) => Coordinate \| undefined` | 使用广度优先搜索查找最近的模型坐标系 |
54
- | `findParentSpace` | `() => Coordinate \| undefined` | 向上查找最近的父级空间坐标系 |
55
- | `findParentSpaceNames` | `(level?: number) => string[]` | 获取指定层级数的父空间名称列表 |
56
- | `findCsGroup` | `() => Coordinate[]` | 查找当前坐标系所在的分组 |
57
- | `findCsByLevel` | `(level: number) => Coordinate \| undefined` | 递归查找指定层级的坐标系 |
58
- | `findCsById` | `(id?: number) => Coordinate \| undefined` | 通过ID深度优先搜索查找坐标系 |
59
- | `getCsRoutes` | `(mapped?: boolean) => Coordinate[]` | 获取从当前坐标系到根系的路径数组 |
60
- | `getMappedCsTree` | `() => Coordinate` | 生成只包含有映射关系的坐标系树 |
61
- | `getDestRelativeMap` | `(dstCoordinate: Coordinate) => RelativeMap` | 计算到目标坐标系的相对变换关系 |
62
- | `getRelativeMaps` | `() => RelativeMap[]` | 获取从当前坐标系到根系的相对变换链 |
41
+ | 方法 | 类型 | 说明 |
42
+ | ---------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------- |
43
+ | `constructor` | `(options?: Partial<Coordinate>) => Coordinate` | 初始化坐标系实例,支持部分属性配置 |
44
+ | `addChild` | `(child: Partial<Coordinate> \ Partial<Coordinate>[]) => Promise<void>` | 添加一个或多个子坐标系,并建立映射关系 |
45
+ | `removeChild` | `(child: Partial<Coordinate> \ Partial<Coordinate>[]) => Promise<void>` | 移除一个或多个子坐标系 |
46
+ | `updateChild` | `(child: Partial<Coordinate> \ Partial<Coordinate>[]) => Promise<void>` | 更新子坐标系的属性信息 |
47
+ | `bindChild` | `(child: Partial<Coordinate> \ Partial<Coordinate>[]) => Promise<void>` | 绑定子坐标系但不建立映射关系 |
48
+ | `mergeChild` | `(result?: Coordinate[]) => Promise<void>` | 合并更新的子坐标系数据到当前树结构 |
49
+ | `mappingTo` | `(result: ProjectionModel[]) => Promise<void>` | 将当前坐标系映射到目标坐标系组 |
50
+ | `fromMapping` | `() => Promise<ProjectionModel \ undefined>` | 查询当前坐标系被哪些源坐标系映射 |
51
+ | `findRoot` | `(mapped?: boolean) => Coordinate` | 递归查找根坐标系,可选是否只查找有映射关系的 |
52
+ | `findChildModel` | `(type?: number \ number[], mapped?: boolean) => Coordinate \ undefined` | 查找符合条件的子模型坐标系 |
53
+ | `findClosestModel` | `(type?: number \ number[], excludeNodes?: Coordinate[]) => Coordinate \ undefined` | 使用广度优先搜索查找最近的模型坐标系 |
54
+ | `findParentSpace` | `() => Coordinate \ undefined` | 向上查找最近的父级空间坐标系 |
55
+ | `findParentSpaceNames` | `(level?: number) => string[]` | 获取指定层级数的父空间名称列表 |
56
+ | `findCsGroup` | `() => Coordinate[]` | 查找当前坐标系所在的分组 |
57
+ | `findCsByLevel` | `(level: number) => Coordinate \ undefined` | 递归查找指定层级的坐标系 |
58
+ | `findCsById` | `(id?: number) => Coordinate \ undefined` | 通过ID深度优先搜索查找坐标系 |
59
+ | `getCsRoutes` | `(mapped?: boolean) => Coordinate[]` | 获取从当前坐标系到根系的路径数组 |
60
+ | `getMappedCsTree` | `() => Coordinate` | 生成只包含有映射关系的坐标系树 |
61
+ | `getDestRelativeMap` | `(dstCoordinate: Coordinate) => RelativeMap` | 计算到目标坐标系的相对变换关系 |
62
+ | `getRelativeMaps` | `() => RelativeMap[]` | 获取从当前坐标系到根系的相对变换链 |
63
63
 
64
64
  # DataSource 数据源类
65
65
 
@@ -69,7 +69,7 @@
69
69
 
70
70
  | 方法 | 类型 | 说明 |
71
71
  | ---------------------- | -------------------------------------------------------------------------------- | ---------------------------- |
72
- | `getCoordinateTree` | `(projectId: number) => Promise<Coordinate \| undefined>` | 获取项目坐标系树结构 |
72
+ | `getCoordinateTree` | `(projectId: number) => Promise<Coordinate \ undefined>` | 获取项目坐标系树结构 |
73
73
  | `addCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<Coordinate[]>` | 添加子坐标系到指定父节点 |
74
74
  | `removeCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<any>` | 删除指定坐标系 |
75
75
  | `updateCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<Coordinate[]>` | 更新坐标系信息 |
@@ -87,9 +87,9 @@
87
87
 
88
88
  | 属性 | 类型 | 默认值 | 说明 |
89
89
  | ----- | -------- | ------ | -------- |
90
- | `lat` | `number` | `0` | 经度(°) |
91
- | `lon` | `number` | `0` | 纬度(°) |
92
- | `alt` | `number` | `0` | 高度(mm) |
90
+ | `lat` | `number` | 0 | 经度(°) |
91
+ | `lon` | `number` | 0 | 纬度(°) |
92
+ | `alt` | `number` | 0 | 高度(mm) |
93
93
 
94
94
  ## 方法说明
95
95
 
@@ -107,15 +107,15 @@
107
107
 
108
108
  | 属性 | 类型 | 默认值 | 说明 |
109
109
  | ----------- | ---------- | ------ | ---------------------------- |
110
- | `scale` | `number` | `1` | 缩放比例 |
111
- | `yaw` | `number` | `0` | 旋转弧度 |
112
- | `x` | `number` | `0` | X轴平移量 |
113
- | `y` | `number` | `0` | Y轴平移量 |
114
- | `z` | `number` | `0` | Z轴平移量 |
115
- | `start` | `number` | `0` | 起始 |
116
- | `end` | `number` | `-1` | 结束 |
117
- | `plane` | `string` | `'xy'` | 坐标系平面类型('xy'或'xz') |
118
- | `refPoint?` | `GeoPoint` | `-` | 参考点坐标 |
110
+ | `scale` | `number` | 1 | 缩放比例 |
111
+ | `yaw` | `number` | 0 | 旋转弧度 |
112
+ | `x` | `number` | 0 | X轴平移量 |
113
+ | `y` | `number` | 0 | Y轴平移量 |
114
+ | `z` | `number` | 0 | Z轴平移量 |
115
+ | `start` | `number` | 0 | 起始 |
116
+ | `end` | `number` | -1 | 结束 |
117
+ | `plane` | `string` | 'xy' | 坐标系平面类型('xy'或'xz') |
118
+ | `refPoint?` | `GeoPoint` | - | 参考点坐标 |
119
119
 
120
120
  ## 方法说明
121
121
 
@@ -124,8 +124,8 @@
124
124
  | `constructor` | `(options?: Partial<RelativeMap>) => RelativeMap` | 初始化相对映射关系,支持部分属性配置 |
125
125
  | `addRelativeMap` | `(r1: RelativeMap, r2: RelativeMap) => RelativeMap` | 合并两个坐标变换(先应用r1后应用r2) |
126
126
  | `inverseRelativeMap` | `(r: RelativeMap) => RelativeMap` | 计算坐标变换的逆变换 |
127
- | `toParse` | `(r?: string) => RelativeMap \| undefined` | 从JSON字符串解析为RelativeMap对象 |
128
- | `toStringify` | `(r?: RelativeMap) => string \| undefined` | 将RelativeMap对象序列化为JSON字符串 |
127
+ | `toParse` | `(r?: string) => RelativeMap \ undefined` | 从JSON字符串解析为RelativeMap对象 |
128
+ | `toStringify` | `(r?: RelativeMap) => string \ undefined` | 将RelativeMap对象序列化为JSON字符串 |
129
129
 
130
130
  # Point 点坐标类
131
131
 
@@ -133,36 +133,36 @@
133
133
 
134
134
  ## 属性说明
135
135
 
136
- | 属性 | 类型 | 默认值 | 说明 |
137
- | ---------- | --------- | ------- | ---------------- |
138
- | `x` | `number` | `0` | X轴坐标 |
139
- | `y` | `number` | `0` | Y轴坐标 |
140
- | `z` | `number` | `0` | Z轴坐标 |
141
- | `lat` | `number` | `0` | 经度 |
142
- | `lon` | `number` | `0` | 纬度 |
143
- | `alt` | `number` | `0` | 高度 |
144
- | `yaw` | `number` | `0` | 偏航角 |
145
- | `pitch` | `number` | `0` | 俯仰角 |
146
- | `roll` | `number` | `0` | 翻滚角 |
147
- | `hasXYZ` | `boolean` | `false` | 是否包含XYZ坐标 |
148
- | `hasGeo` | `boolean` | `false` | 是否包含地理坐标 |
149
- | `hasAngle` | `boolean` | `false` | 是否包含角度信息 |
150
- | `plane` | `string` | `'xy'` | 坐标平面类型 |
136
+ | 属性 | 类型 | 默认值 | 说明 |
137
+ | ---------- | --------- | ------ | -------------------------- |
138
+ | `x` | `number` | 0 | X轴坐标 |
139
+ | `y` | `number` | 0 | Y轴坐标 |
140
+ | `z` | `number` | 0 | Z轴坐标 |
141
+ | `lat` | `number` | 0 | 经度 |
142
+ | `lon` | `number` | 0 | 纬度 |
143
+ | `alt` | `number` | 0 | 高度 |
144
+ | `yaw` | `number` | 0 | 偏航角 |
145
+ | `pitch` | `number` | 0 | 俯仰角 |
146
+ | `roll` | `number` | 0 | 翻滚角 |
147
+ | `hasXYZ` | `boolean` | false | 是否包含XYZ坐标 |
148
+ | `hasGeo` | `boolean` | false | 是否包含地理坐标 |
149
+ | `hasAngle` | `boolean` | false | 是否包含角度信息 |
150
+ | `plane` | `string` | 'xy' | 坐标平面类型('xy'或'xz') |
151
151
 
152
152
  ## 方法说明
153
153
 
154
- | 方法 | 类型 | 说明 |
155
- | ------------- | ------------------------------------------------------------------------------------------------ | ---------------------- |
156
- | `constructor` | `(options?: Partial<Point>) => Point` | 初始化点坐标 |
157
- | `dist` | `(p1: Point, p2: Point) => number` | 计算两点间三维距离 |
158
- | `distXZ` | `(p1: Point, p2: Point) => number` | 计算两点在XZ平面的距离 |
159
- | `distXY` | `(p1: Point, p2: Point) => number` | 计算两点在XY平面的距离 |
160
- | `toRadians` | `(degrees: number) => number` | 角度转弧度 |
161
- | `toDegrees` | `(radians: number) => number` | 弧度转角度 |
162
- | `angleXZ` | `(pa: Point, pb: Point, pc: Point) => number` | 计算三点在XZ平面的夹角 |
163
- | `toParse` | `(point?: string) => Point \| undefined` | 从字符串解析点坐标 |
164
- | `toStringify` | `(point?: Point) => string` | 将点坐标序列化为字符串 |
165
- | `projection` | `(r: RelativeMap, srcCoordinate?: Coordinate, dstCoordinate?: Coordinate) => Point \| undefined` | 坐标投影转换 |
166
- | `project` | `(r: RelativeMap) => Point \| undefined` | 基础坐标投影 |
167
- | `projectXZ` | `(r: RelativeMap) => Point` | XZ平面坐标投影 |
168
- | `projectXY` | `(r: RelativeMap) => Point` | XY平面坐标投影 |
154
+ | 方法 | 类型 | 说明 |
155
+ | ------------- | ----------------------------------------------------------------------------------------------- | ---------------------- |
156
+ | `constructor` | `(options?: Partial<Point>) => Point` | 初始化点坐标 |
157
+ | `dist` | `(p1: Point, p2: Point) => number` | 计算两点间三维距离 |
158
+ | `distXZ` | `(p1: Point, p2: Point) => number` | 计算两点在XZ平面的距离 |
159
+ | `distXY` | `(p1: Point, p2: Point) => number` | 计算两点在XY平面的距离 |
160
+ | `toRadians` | `(degrees: number) => number` | 角度转弧度 |
161
+ | `toDegrees` | `(radians: number) => number` | 弧度转角度 |
162
+ | `angleXZ` | `(pa: Point, pb: Point, pc: Point) => number` | 计算三点在XZ平面的夹角 |
163
+ | `toParse` | `(point?: string) => Point \ undefined` | 从字符串解析点坐标 |
164
+ | `toStringify` | `(point?: Point) => string` | 将点坐标序列化为字符串 |
165
+ | `projection` | `(r: RelativeMap, srcCoordinate?: Coordinate, dstCoordinate?: Coordinate) => Point \ undefined` | 坐标投影转换 |
166
+ | `project` | `(r: RelativeMap) => Point \ undefined` | 基础坐标投影 |
167
+ | `projectXZ` | `(r: RelativeMap) => Point` | XZ平面坐标投影 |
168
+ | `projectXY` | `(r: RelativeMap) => Point` | XY平面坐标投影 |
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { api }
14
14
  export declare const APP_SETTING: {
15
15
  baseUrl: string;
16
16
  obsType: string;
17
+ authorizeCode: string;
17
18
  };
18
19
 
19
20
  export declare class AppError extends Error {
@@ -57,7 +58,7 @@ export declare enum AppObsType {
57
58
 
58
59
  export declare type AppSetting = {
59
60
  baseUrl?: string;
60
- authorizeCode?: string;
61
+ authorizeCode: string;
61
62
  obsPrefix?: string;
62
63
  obsType?: string;
63
64
  };
package/dist/index.mjs CHANGED
@@ -15,7 +15,8 @@ class m extends Error {
15
15
  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.SkyMapModel = 9] = "SkyMapModel", s[s.ScaleModel = 10] = "ScaleModel", s))(P || {}), K = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(K || {}), M = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(M || {}), D = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(D || {}), F = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))(F || {}), x = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(x || {}), I = /* @__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))(I || {}), tt = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(tt || {}), y = /* @__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))(y || {});
16
16
  const et = {
17
17
  baseUrl: "https://vsleem.com/api",
18
- obsType: "hs"
18
+ obsType: "hs",
19
+ authorizeCode: ""
19
20
  }, st = {
20
21
  isTransformResponse: !0,
21
22
  joinBaseUrl: !0,
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(l,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(l=typeof globalThis<"u"?globalThis:l||self,f(l.Shared={}))})(this,(function(l){"use strict";class f extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,f.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}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||{}),U=(s=>(s[s.Global=0]="Global",s))(U||{}),x=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(x||{}),I=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(I||{}),R=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(R||{}),p=(s=>(s.GET="GET",s.POST="POST",s))(p||{}),z=(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))(z||{}),Y=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(Y||{}),w=(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||{});const G={baseUrl:"https://vsleem.com/api",obsType:"hs"},nt={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},ot={url:"",method:p.GET,headers:{}},B={...G};function rt(s){Object.assign(B,s)}async function S(s,t){const e={...nt,...t},i={...ot,...s};try{const n=at(i,e),{url:o,...r}=n,h=await(await window.fetch(o,r)).json();return ht(h,e)}catch(n){return ct(n)}}function at(s,t){const{baseUrl:e,authorizeCode:i}=B,{joinBaseUrl:n,withAuthorize:o}=t;let{url:r,method:a,headers:h={},params:u,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===p.POST&&!d["Content-Type"]&&(d["Content-Type"]=z.JSON),a===p.GET&&u){const v=new URLSearchParams(u);r+=`?${v.toString()}`}let m;return a===p.POST&&(m=d["Content-Type"]===z.JSON?JSON.stringify(c||{}):c),{url:r,method:a,headers:d,body:m}}function ht(s,t){if(!t.isTransformResponse)return s;if(!s)throw new f(w.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===R.SUCCESS)return i;throw new f(w.RequestCodeError,n||"请求返回的Code错误")}function ct(s){throw s instanceof Error?s:new f(w.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const lt=Object.freeze(Object.defineProperty({__proto__:null,request:S,setRequestGlobalConfig:rt},Symbol.toStringTag,{value:"Module"}));function $(s,t){return S({url:"/project/jssdk/cs/list",method:p.GET,params:s},t)}function _(s,t){return S({url:"/project/jssdk/cs/bind",method:p.POST,data:s},t)}function O(s,t){return S({url:"/project/jssdk/cs/save",method:p.POST,data:s},t)}function q(s,t){return S({url:"/project/jssdk/cs/delete",method:p.POST,data:s},t)}function Z(s,t){return S({url:"/project/jssdk/cs/mapping",method:p.POST,data:s},t)}function J(s,t){return S({url:"/project/jssdk/cs/mapping/query",method:p.GET,params:s},t)}function ut(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return S({url:s,method:p.GET},t)}const dt=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:_,getCoordinateList:$,getImageInfo:ut,getMappingRelation:J,mapingCoordinate:Z,removeCoordinate:q,saveCoordinate:O},Symbol.toStringTag,{value:"Module"})),ft=typeof window<"u",mt=Object.prototype.toString;function b(s,t){return mt.call(s)===`[object ${t}]`}function H(s){return typeof s<"u"}function V(s){return!H(s)}function L(s){return s!==null&&b(s,"Object")}function W(s){return s===null}function yt(s){return b(s,"Date")}function wt(s){return b(s,"String")}function j(s){return typeof s=="function"}function gt(s){return b(s,"Boolean")}function pt(s){return b(s,"RegExp")}function P(s){return s&&Array.isArray(s)}function Mt(s){return typeof window<"u"&&b(s,"Window")}function vt(s){return L(s)&&!!s.tagName}function xt(s){return typeof s=="number"||/^\d+(\.\d+)?$/.test(s)}function N(s){return b(Number(s),"Number")}function bt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function St(s){return V(s)||W(s)}function Tt(s){return b(s,"Promise")&&L(s)&&j(s.then)&&j(s.catch)}function Q(s){return E(s,new WeakMap)}function E(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,E(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(E(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]=E(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]=E(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=E(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 A(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(D(s)&&D(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:D(n)&&D(o)?s[i]=A({...n},o):o!==void 0&&(s[i]=o)}),A(s,...t))}function D(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function K(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]={}),K(s[i],n)):s[i]=n});return s}function Ct(s,t={}){return new Promise((e,i)=>{const n=k(s);if(Nt(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 Nt(s){const t=k(s);return Array.from(document.scripts).some(e=>k(e.src)===t)}function k(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function It(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 zt(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function Dt(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}function Rt(s){console.warn(`[warn]:${s}`)}function Ot(s){throw new Error(`[error]:${s}`)}const Lt=Object.freeze(Object.defineProperty({__proto__:null,cloneDeep:Q,debounce:Pt,deepMerge:A,deepMergeProps:K,error:Ot,getImageTransform:It,inBrowser:ft,is:b,isArray:P,isBoolean:gt,isDate:yt,isDef:H,isElement:vt,isFunction:j,isNull:W,isNullOrUnDef:St,isNumber:N,isNumeric:xt,isObject:L,isPromise:Tt,isRegExp:pt,isSameValue:bt,isString:wt,isUnDef:V,isWindow:Mt,loadScript:Ct,throttle:Et,toCanvasCoord:zt,toModelCoord:Dt,warn:Rt},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:h,pitch:u,roll:c,plane:d="xy"}=t||{};N(e)&&N(i)&&(this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,this.plane=d,this.hasXYZ=!0),N(o)&&N(r)&&Number(o)!==0&&Number(r)!==0&&(this.lat=Number(o)||0,this.lon=Number(r)||0,this.alt=Number(a)||0,this.hasGeo=!0),(h!==void 0||u!==void 0||c!==void 0)&&(this.yaw=Number(h)||0,this.pitch=Number(u)||0,this.roll=Number(c)||0,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),u=Math.max(-1,Math.min(1,r/(a*h))),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===T.SkyMapModel){const{refPoint:n}=e?.relativeMap||{};if(this.hasGeo&&n){const o=C.LLHToXYZ(this,n);return this.x=o.x,this.y=o.y,this.z=o.z,this.hasXYZ=!0,this.project(t)}throw new f(w.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===T.SkyMapModel){const{refPoint:n}=i?.relativeMap||{},o=this.project(t);if(o?.hasXYZ&&n){const r=C.XYZToLLH(o,n);return o.lat=r.lat,o.lon=r.lon,o.alt=r.alt,o.hasGeo=!0,o}throw new f(w.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch{return}}project(t){if(!this.hasXYZ)throw new f(w.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new f(w.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 C{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=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let h,u,c;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),m=t.z/1e3/a;h=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(m),c=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),m=t.y/1e3/a;h=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(m),c=e.alt+t.z/1e3}else throw new f(w.GeoPointNoPlane,"点的plane应为xz或xy");return new C({lat:u,lon:h,alt:c})}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,h=y.toRadians(t.lon-e.lon),u=y.toRadians(e.lat-t.lat),c=a*h*Math.cos(r),d=a*u;if(t.plane==="xz")return new y({x:c*1e3,y:(t.alt-e.alt)*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new y({x:c*1e3,y:d*1e3,z:(t.alt-e.alt)*1e3,plane:"xy"});throw new f(w.GeoPointNoPlane,"点的plane应为xz或xy")}}class M{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 C(e)),Object.assign(this,i)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new f(w.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,u=0;if(t.plane==="xz"){const c=t.x*o-t.z*r,d=t.y,m=t.x*r+t.z*o;a=e.x+c*e.scale,h=e.y+d*e.scale,u=e.z+m*e.scale}else if(t.plane==="xy"){const c=t.x*o-t.y*r,d=t.x*r+t.y*o,m=t.z;a=e.x+c*e.scale,h=e.y+d*e.scale,u=e.z+m*e.scale}else throw new f(w.RelativeNoPlane,"映射关系的plane应为xz或xy");return new M({scale:i,yaw:n,x:a,y:h,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,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 f(w.RelativeNoPlane,"映射关系的plane应为xz或xy");return new M({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 M(e):void 0}catch{throw new f(w.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}}class g{static async getCoordinateTree(t){const e=await $({projectId:t});if(e.length){const i=g.handleCoordinateList(e);return g.buildCoordinateTree(i,0)}}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,modelType:u,relativeMap:c,level:d,...m}=a,v=c?JSON.stringify(c):void 0;return{...m,projectId:i,parentId:n,coordinateType:h,renderType:u,relativePosition:v}}),r=await O(o);return g.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await q(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,relativeMap:u,level:c,...d}=a,m=M.toStringify(u);return{...d,relativePosition:m,projectId:i,parentId:n}}),r=await O(o);return g.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 _(o);return g.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,h=M.toParse(r);return new tt({...a,type:i,modelType:o,modelValue:n,relativeMap:h})})}static buildCoordinateTree(t,e){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.level=(Number(a.level)||0)+1,r.parent=a,a.children?.push(r))}}),n.forEach(g.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===x.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(g.sortCoordinateTree))}static filterSpaceTree(t){const e=[];return t.forEach(i=>{const n=g.filterSpaceTree(i.children);i.children=n,i.disabled=i.disabled??!1,i.type!==x.Model&&e.push(i)}),e}}class tt{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===x.Space)}get modelList(){return this.children.filter(t=>t.type===x.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 M(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=P(t)?t:[t],i=await g.addCoordinate(this,e);this.mergeChild(i)}async removeChild(t){const e=P(t)?t:[t];await g.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=P(t)?t:[t],i=await g.updateCoordinate(this,e);this.mergeChild(i)}async bindChild(t){const e=P(t)?t:[t],i=await g.bindCoordinate(this,e);this.mergeChild(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:u,modelValue:c}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:h,modelId:u,modelValue:c})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await Z(t)}async fromMapping(){const t=await J({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=P(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==I.Disabled?this:([x.Data,x.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 u of e??[])i.add(String(u.id));const n=[{node:this,distance:0}],o=P(t)?t:[t],r=new Set;let a,h=1/0;for(;n.length>0;){const u=n.shift();if(!u)break;const{node:c,distance:d}=u;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 m=[];if(c.children)for(const v of c.children)r.has(v)||m.push(v);if(c.parent?.children)for(const v of c.parent.children)v!==c&&!r.has(v)&&m.push(v);c.parent&&!r.has(c.parent)&&m.push(c.parent);for(const v of m)n.push({node:v,distance:d+1})}return a}findParentSpace(){let t=this;for(;t&&t.type!==x.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===x.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=Q(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new M;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new M;return e?.forEach(o=>{n=M.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=M.addRelativeMap(n,M.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===x.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 X{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 X({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class F{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 F({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class jt{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:u,...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 et={};class At{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=et[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=()=>{et[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 st={};class Xt{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=st[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=()=>{st[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,u=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=`${u}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 it={};class Ft{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=it[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=()=>{it[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 Ut{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 Yt{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,u=n+(r-n)/2;t.arc(h,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=G,l.AppError=f,l.AppErrorCode=w,l.AppObsType=Y,l.CanvasElement=jt,l.CanvasImageElement=At,l.CanvasIssueElement=Xt,l.CanvasMarkerElement=Ft,l.CanvasPointElement=kt,l.CanvasRadarElement=Ut,l.CanvasRegionElement=Yt,l.Coordinate=tt,l.CoordinateLevel=U,l.CoordinateModelType=T,l.CoordinateStatus=I,l.CoordinateType=x,l.DataSource=g,l.GeoPoint=C,l.Point=y,l.Position=X,l.RelativeMap=M,l.RequestContentType=z,l.RequestMethod=p,l.RequestResultCode=R,l.Vector3=F,l.api=dt,l.http=lt,l.utils=Lt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(l,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(l=typeof globalThis<"u"?globalThis:l||self,f(l.Shared={}))})(this,(function(l){"use strict";class f extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,f.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}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||{}),U=(s=>(s[s.Global=0]="Global",s))(U||{}),x=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(x||{}),I=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(I||{}),R=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(R||{}),p=(s=>(s.GET="GET",s.POST="POST",s))(p||{}),z=(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))(z||{}),Y=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(Y||{}),w=(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||{});const G={baseUrl:"https://vsleem.com/api",obsType:"hs",authorizeCode:""},nt={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},ot={url:"",method:p.GET,headers:{}},B={...G};function rt(s){Object.assign(B,s)}async function S(s,t){const e={...nt,...t},i={...ot,...s};try{const n=at(i,e),{url:o,...r}=n,h=await(await window.fetch(o,r)).json();return ht(h,e)}catch(n){return ct(n)}}function at(s,t){const{baseUrl:e,authorizeCode:i}=B,{joinBaseUrl:n,withAuthorize:o}=t;let{url:r,method:a,headers:h={},params:u,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===p.POST&&!d["Content-Type"]&&(d["Content-Type"]=z.JSON),a===p.GET&&u){const v=new URLSearchParams(u);r+=`?${v.toString()}`}let m;return a===p.POST&&(m=d["Content-Type"]===z.JSON?JSON.stringify(c||{}):c),{url:r,method:a,headers:d,body:m}}function ht(s,t){if(!t.isTransformResponse)return s;if(!s)throw new f(w.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===R.SUCCESS)return i;throw new f(w.RequestCodeError,n||"请求返回的Code错误")}function ct(s){throw s instanceof Error?s:new f(w.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const lt=Object.freeze(Object.defineProperty({__proto__:null,request:S,setRequestGlobalConfig:rt},Symbol.toStringTag,{value:"Module"}));function $(s,t){return S({url:"/project/jssdk/cs/list",method:p.GET,params:s},t)}function _(s,t){return S({url:"/project/jssdk/cs/bind",method:p.POST,data:s},t)}function O(s,t){return S({url:"/project/jssdk/cs/save",method:p.POST,data:s},t)}function q(s,t){return S({url:"/project/jssdk/cs/delete",method:p.POST,data:s},t)}function Z(s,t){return S({url:"/project/jssdk/cs/mapping",method:p.POST,data:s},t)}function J(s,t){return S({url:"/project/jssdk/cs/mapping/query",method:p.GET,params:s},t)}function ut(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return S({url:s,method:p.GET},t)}const dt=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:_,getCoordinateList:$,getImageInfo:ut,getMappingRelation:J,mapingCoordinate:Z,removeCoordinate:q,saveCoordinate:O},Symbol.toStringTag,{value:"Module"})),ft=typeof window<"u",mt=Object.prototype.toString;function b(s,t){return mt.call(s)===`[object ${t}]`}function H(s){return typeof s<"u"}function V(s){return!H(s)}function L(s){return s!==null&&b(s,"Object")}function W(s){return s===null}function yt(s){return b(s,"Date")}function wt(s){return b(s,"String")}function j(s){return typeof s=="function"}function gt(s){return b(s,"Boolean")}function pt(s){return b(s,"RegExp")}function P(s){return s&&Array.isArray(s)}function Mt(s){return typeof window<"u"&&b(s,"Window")}function vt(s){return L(s)&&!!s.tagName}function xt(s){return typeof s=="number"||/^\d+(\.\d+)?$/.test(s)}function N(s){return b(Number(s),"Number")}function bt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function St(s){return V(s)||W(s)}function Tt(s){return b(s,"Promise")&&L(s)&&j(s.then)&&j(s.catch)}function Q(s){return E(s,new WeakMap)}function E(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,E(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(E(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]=E(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]=E(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=E(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 A(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(D(s)&&D(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:D(n)&&D(o)?s[i]=A({...n},o):o!==void 0&&(s[i]=o)}),A(s,...t))}function D(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function K(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]={}),K(s[i],n)):s[i]=n});return s}function Ct(s,t={}){return new Promise((e,i)=>{const n=k(s);if(Nt(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 Nt(s){const t=k(s);return Array.from(document.scripts).some(e=>k(e.src)===t)}function k(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function It(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 zt(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function Dt(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}function Rt(s){console.warn(`[warn]:${s}`)}function Ot(s){throw new Error(`[error]:${s}`)}const Lt=Object.freeze(Object.defineProperty({__proto__:null,cloneDeep:Q,debounce:Pt,deepMerge:A,deepMergeProps:K,error:Ot,getImageTransform:It,inBrowser:ft,is:b,isArray:P,isBoolean:gt,isDate:yt,isDef:H,isElement:vt,isFunction:j,isNull:W,isNullOrUnDef:St,isNumber:N,isNumeric:xt,isObject:L,isPromise:Tt,isRegExp:pt,isSameValue:bt,isString:wt,isUnDef:V,isWindow:Mt,loadScript:Ct,throttle:Et,toCanvasCoord:zt,toModelCoord:Dt,warn:Rt},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:h,pitch:u,roll:c,plane:d="xy"}=t||{};N(e)&&N(i)&&(this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,this.plane=d,this.hasXYZ=!0),N(o)&&N(r)&&Number(o)!==0&&Number(r)!==0&&(this.lat=Number(o)||0,this.lon=Number(r)||0,this.alt=Number(a)||0,this.hasGeo=!0),(h!==void 0||u!==void 0||c!==void 0)&&(this.yaw=Number(h)||0,this.pitch=Number(u)||0,this.roll=Number(c)||0,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),u=Math.max(-1,Math.min(1,r/(a*h))),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===T.SkyMapModel){const{refPoint:n}=e?.relativeMap||{};if(this.hasGeo&&n){const o=C.LLHToXYZ(this,n);return this.x=o.x,this.y=o.y,this.z=o.z,this.hasXYZ=!0,this.project(t)}throw new f(w.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===T.SkyMapModel){const{refPoint:n}=i?.relativeMap||{},o=this.project(t);if(o?.hasXYZ&&n){const r=C.XYZToLLH(o,n);return o.lat=r.lat,o.lon=r.lon,o.alt=r.alt,o.hasGeo=!0,o}throw new f(w.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch{return}}project(t){if(!this.hasXYZ)throw new f(w.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new f(w.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 C{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=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let h,u,c;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),m=t.z/1e3/a;h=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(m),c=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),m=t.y/1e3/a;h=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(m),c=e.alt+t.z/1e3}else throw new f(w.GeoPointNoPlane,"点的plane应为xz或xy");return new C({lat:u,lon:h,alt:c})}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,h=y.toRadians(t.lon-e.lon),u=y.toRadians(e.lat-t.lat),c=a*h*Math.cos(r),d=a*u;if(t.plane==="xz")return new y({x:c*1e3,y:(t.alt-e.alt)*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new y({x:c*1e3,y:d*1e3,z:(t.alt-e.alt)*1e3,plane:"xy"});throw new f(w.GeoPointNoPlane,"点的plane应为xz或xy")}}class M{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 C(e)),Object.assign(this,i)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new f(w.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,u=0;if(t.plane==="xz"){const c=t.x*o-t.z*r,d=t.y,m=t.x*r+t.z*o;a=e.x+c*e.scale,h=e.y+d*e.scale,u=e.z+m*e.scale}else if(t.plane==="xy"){const c=t.x*o-t.y*r,d=t.x*r+t.y*o,m=t.z;a=e.x+c*e.scale,h=e.y+d*e.scale,u=e.z+m*e.scale}else throw new f(w.RelativeNoPlane,"映射关系的plane应为xz或xy");return new M({scale:i,yaw:n,x:a,y:h,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,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 f(w.RelativeNoPlane,"映射关系的plane应为xz或xy");return new M({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 M(e):void 0}catch{throw new f(w.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}}class g{static async getCoordinateTree(t){const e=await $({projectId:t});if(e.length){const i=g.handleCoordinateList(e);return g.buildCoordinateTree(i,0)}}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,modelType:u,relativeMap:c,level:d,...m}=a,v=c?JSON.stringify(c):void 0;return{...m,projectId:i,parentId:n,coordinateType:h,renderType:u,relativePosition:v}}),r=await O(o);return g.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await q(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,relativeMap:u,level:c,...d}=a,m=M.toStringify(u);return{...d,relativePosition:m,projectId:i,parentId:n}}),r=await O(o);return g.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 _(o);return g.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,h=M.toParse(r);return new tt({...a,type:i,modelType:o,modelValue:n,relativeMap:h})})}static buildCoordinateTree(t,e){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.level=(Number(a.level)||0)+1,r.parent=a,a.children?.push(r))}}),n.forEach(g.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===x.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(g.sortCoordinateTree))}static filterSpaceTree(t){const e=[];return t.forEach(i=>{const n=g.filterSpaceTree(i.children);i.children=n,i.disabled=i.disabled??!1,i.type!==x.Model&&e.push(i)}),e}}class tt{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===x.Space)}get modelList(){return this.children.filter(t=>t.type===x.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 M(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=P(t)?t:[t],i=await g.addCoordinate(this,e);this.mergeChild(i)}async removeChild(t){const e=P(t)?t:[t];await g.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=P(t)?t:[t],i=await g.updateCoordinate(this,e);this.mergeChild(i)}async bindChild(t){const e=P(t)?t:[t],i=await g.bindCoordinate(this,e);this.mergeChild(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:u,modelValue:c}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:h,modelId:u,modelValue:c})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await Z(t)}async fromMapping(){const t=await J({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=P(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==I.Disabled?this:([x.Data,x.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 u of e??[])i.add(String(u.id));const n=[{node:this,distance:0}],o=P(t)?t:[t],r=new Set;let a,h=1/0;for(;n.length>0;){const u=n.shift();if(!u)break;const{node:c,distance:d}=u;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 m=[];if(c.children)for(const v of c.children)r.has(v)||m.push(v);if(c.parent?.children)for(const v of c.parent.children)v!==c&&!r.has(v)&&m.push(v);c.parent&&!r.has(c.parent)&&m.push(c.parent);for(const v of m)n.push({node:v,distance:d+1})}return a}findParentSpace(){let t=this;for(;t&&t.type!==x.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===x.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=Q(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new M;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new M;return e?.forEach(o=>{n=M.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=M.addRelativeMap(n,M.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===x.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 X{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 X({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class F{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 F({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class jt{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:u,...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 et={};class At{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=et[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=()=>{et[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 st={};class Xt{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=st[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=()=>{st[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,u=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=`${u}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 it={};class Ft{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=it[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=()=>{it[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 Ut{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 Yt{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,u=n+(r-n)/2;t.arc(h,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=G,l.AppError=f,l.AppErrorCode=w,l.AppObsType=Y,l.CanvasElement=jt,l.CanvasImageElement=At,l.CanvasIssueElement=Xt,l.CanvasMarkerElement=Ft,l.CanvasPointElement=kt,l.CanvasRadarElement=Ut,l.CanvasRegionElement=Yt,l.Coordinate=tt,l.CoordinateLevel=U,l.CoordinateModelType=T,l.CoordinateStatus=I,l.CoordinateType=x,l.DataSource=g,l.GeoPoint=C,l.Point=y,l.Position=X,l.RelativeMap=M,l.RequestContentType=z,l.RequestMethod=p,l.RequestResultCode=R,l.Vector3=F,l.api=dt,l.http=lt,l.utils=Lt,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.0.6",
3
+ "version": "2.0.7",
4
4
  "private": false,
5
5
  "description": "Shared utilities for VSLeem RealSee Viewer",
6
6
  "main": "./dist/index.umd.js",