@vsleem-realsee-viewer/shared 2.0.11 → 2.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ declare namespace api {
11
11
  }
12
12
  export { api }
13
13
 
14
+ /** 全局默认配置 */
14
15
  export declare const APP_SETTING: {
15
16
  baseUrl: string;
16
17
  obsType: string;
@@ -58,19 +59,20 @@ export declare enum AppErrorCode {
58
59
  RequestUnknownError = 9032
59
60
  }
60
61
 
62
+ /** obs类型枚举 */
61
63
  export declare enum AppObsType {
62
- Hw = "huawei",// 华为云
63
- Ali = "aliyun",// 阿里云
64
- Hs = "hs",// 火山引擎
65
- Aws = "amazon",// AWS S3
66
- Minio = "minio"
64
+ Hw = "huawei" /** 华为云 */,
65
+ Ali = "aliyun" /** 阿里云 */,
66
+ Hs = "hs" /** 火山引擎 */,
67
+ Aws = "amazon" /** AWS S3 */,
68
+ Minio = "minio" /** MinIO */
67
69
  }
68
70
 
69
71
  export declare type AppSetting = {
70
- baseUrl?: string;
71
- authorizeCode: string;
72
- obsPrefix?: string;
73
- obsType?: string;
72
+ baseUrl?: string /**用于配置应用后端服务的根路径 */;
73
+ authorizeCode: string /**用于API身份验证和授权的凭证 */;
74
+ obsPrefix?: string /**用于在对象存储中组织文件的目录路径(不可用) */;
75
+ obsType?: string /**指定使用的对象存储服务提供商 huawei | aliyun | hs 等 */;
74
76
  };
75
77
 
76
78
  declare abstract class BaseAsyncElement {
@@ -91,21 +93,21 @@ declare abstract class BaseElement {
91
93
  declare function bindCoordinate(data: CoordinateModel[], options?: RequestOptions): Promise<CoordinateModel[]>;
92
94
 
93
95
  export declare type CADModel = {
94
- bindCsIds?: string;
95
- createBy?: string;
96
- createTime?: number;
97
- updateBy?: string;
98
- updateTime?: number;
99
- id?: number;
100
- no?: string;
101
- projectId?: number;
102
- renderType?: number;
103
- rawType?: string;
104
- name?: string;
105
- modelKey?: string;
106
- rawUrl?: string;
107
- length?: number;
108
- mappingRecords?: MappingRecord[];
96
+ bindCsIds?: string /** 绑定坐标系id集合 */;
97
+ createBy?: string /** 创建者ID */;
98
+ createTime?: number /** 创建时间戳(毫秒) */;
99
+ updateBy?: string /** 最后更新者ID */;
100
+ updateTime?: number /** 最后更新时间戳(毫秒) */;
101
+ id?: number /** 唯一标识符 */;
102
+ no?: string /** 模型编号/代码 */;
103
+ projectId?: number /** 所属项目ID */;
104
+ renderType?: number /** 模型渲染类型 */;
105
+ rawType?: string /** 模型原始文件类型 */;
106
+ name?: string /** 模型名称/描述 */;
107
+ modelKey?: string /** 模型关键标识符 */;
108
+ rawUrl?: string /** 原始模型文件URL */;
109
+ length?: number /** 模型文件大小(字节) */;
110
+ mappingRecords?: MappingRecord[] /** 映射记录 */;
109
111
  };
110
112
 
111
113
  export declare class CanvasElement {
@@ -288,36 +290,44 @@ export declare class CanvasRegionElement implements BaseElement {
288
290
  declare function cloneDeep<T>(value: T): T;
289
291
 
290
292
  export declare class Coordinate {
291
- id: number;
292
- type: number;
293
- children: Coordinate[];
294
- level?: number;
295
- relativeMap?: RelativeMap;
296
- no?: string;
297
- name?: string;
298
- shortName?: string;
299
- status?: number;
300
- modelId?: number;
301
- modelType?: number;
302
- modelValue?: string;
303
- projectId?: number;
304
- parentId?: number;
305
- parent?: Coordinate;
306
- groupUuid?: string;
307
- z?: number;
308
- createTime?: number;
293
+ id: number; /** id */
294
+ type: number; /** 0空间,1模型 */
295
+ children: Coordinate[]; /** 子节点 */
296
+ level?: number; /** 空间的层级 */
297
+ relativeMap?: RelativeMap; /** 相对位置关系 */
298
+ no?: string; /** 坐标系编号 */
299
+ name?: string; /** 名称 */
300
+ shortName?: string; /** 简称 */
301
+ status?: number; /** 使用状态 */
302
+ modelId?: number; /** 模型ID */
303
+ modelType?: number; /** 模型的类型 */
304
+ modelValue?: string; /** 模型value */
305
+ projectId?: number; /** 项目id */
306
+ parentId?: number; /** 父节点id */
307
+ parent?: Coordinate; /** 父节点 */
308
+ groupUuid?: string; /** 分组uuid */
309
+ z?: number; /** 坐标系高度 */
310
+ createTime?: number; /** 创建时间 */
309
311
  disabled?: boolean;
310
312
  constructor(options?: Partial<Coordinate>);
311
313
  get spaceList(): Coordinate[];
312
314
  get modelList(): Coordinate[];
313
315
  get fullName(): string;
316
+ /** 设置参数 */
314
317
  setOptions(options?: Partial<Coordinate>): void;
318
+ /** 添加子节点 */
315
319
  addChild(child: Partial<Coordinate> | Partial<Coordinate>[]): Promise<Coordinate[]>;
320
+ /** 删除子节点 */
316
321
  removeChild(child: Partial<Coordinate> | Partial<Coordinate>[]): Promise<void>;
322
+ /** 更新子节点 */
317
323
  updateChild(child: Partial<Coordinate> | Partial<Coordinate>[]): Promise<Coordinate[]>;
324
+ /** 绑定子节点,不建立映射关系 */
318
325
  bindChild(child: Partial<Coordinate> | Partial<Coordinate>[]): Promise<Coordinate[]>;
326
+ /** 合并子节点,没有查询到节点就插入 */
319
327
  mergeChild(result?: Coordinate[]): Promise<void>;
328
+ /** 映射到(模型映射到空间,空间映射到空间) */
320
329
  mappingTo(result: ProjectionModel[]): Promise<void>;
330
+ /** 来自映射(被映射过的源坐标系关系) */
321
331
  fromMapping(): Promise<ProjectionModel | undefined>;
322
332
  /**
323
333
  * 递归寻找到根坐标系
@@ -334,7 +344,7 @@ export declare class Coordinate {
334
344
  /**
335
345
  * 寻找与当前节点最近的一个模型节点,从当前节点遍历到根节点-广度优先遍历
336
346
  * @param type 允许的模型类型
337
- * @param excludeNodes //排除的坐标系
347
+ * @param excludeNodes 排除的坐标系
338
348
  * @returns
339
349
  */
340
350
  findClosestModel(type?: number | number[], excludeNodes?: Coordinate[]): Coordinate | undefined;
@@ -349,10 +359,11 @@ export declare class Coordinate {
349
359
  * @returns
350
360
  */
351
361
  findParentSpaceNames(level?: number): string[];
362
+ /** 寻找坐标系组, 有groupUuid表示坐标系组 */
352
363
  findCsGroup(): Coordinate[];
353
364
  /**
354
365
  * 递归寻找到相应的层级
355
- * @param level //坐标系的层级
366
+ * @param level 坐标系的层级
356
367
  * @returns
357
368
  */
358
369
  findCsByLevel(level: number): Coordinate | undefined;
@@ -406,53 +417,57 @@ export declare class Coordinate {
406
417
  private static checkSameCoordinate;
407
418
  }
408
419
 
420
+ /** 坐标系空间层级枚举 */
409
421
  export declare enum CoordinateLevel {
410
- Global = 0
422
+ Global = 0 /** 地图 */
411
423
  }
412
424
 
413
425
  export declare type CoordinateModel = {
414
- coordinateType?: number;
415
- renderType?: number;
416
- createBy?: string;
417
- createTime?: number;
418
- groupUuid?: string;
419
- id?: number;
420
- modelId?: number;
421
- modelKey?: string;
422
- name?: string;
423
- no?: string;
424
- parentId?: number;
425
- projectId?: number;
426
- relativePosition?: string;
427
- shortName?: string;
428
- status?: number;
429
- thirdId?: string;
430
- type?: number;
431
- updateBy?: string;
432
- updateTime?: number;
433
- uuid?: string;
434
- z?: number;
426
+ coordinateType?: number /** 坐标系分类 0空间 1模型 */;
427
+ renderType?: number /** 模型类型 */;
428
+ createBy?: string /** 创建者 */;
429
+ createTime?: number /** 创建时间 */;
430
+ groupUuid?: string /** 组UUID 多楼层前端传入时需保持一致 */;
431
+ id?: number /** 唯一 ID */;
432
+ modelId?: number /** 模型 ID */;
433
+ modelKey?: string /** 模型键 */;
434
+ name?: string /** 名称 */;
435
+ no?: string /** 编号 */;
436
+ parentId?: number /** 父节点 ID */;
437
+ projectId?: number /** 项目 ID */;
438
+ relativePosition?: string /** 位置关系 */;
439
+ shortName?: string /** 短名称 */;
440
+ status?: number /** 状态 0:使用 1:激活 2:未使用 */;
441
+ thirdId?: string /** 第三方 ID */;
442
+ type?: number /** 层级类型 0-global-全局坐标系 |1-field-场布图|2-building-建筑|3-floor-楼层|4-room-房间 | 5-cad位图图纸 | 6-bim | 7-forge | 8-3DGS| 9-天地图模型 */;
443
+ updateBy?: string /** 更新者 */;
444
+ updateTime?: number /** 更新时间 */;
445
+ uuid?: string /** UUID */;
446
+ z?: number /** z坐标 */;
435
447
  };
436
448
 
449
+ /** 坐标系模型类型枚举 */
437
450
  export declare enum CoordinateModelType {
438
- CADModel = 5,//cad图片模型
439
- BIMModel = 6,//bim模型
440
- ForgeModel = 7,//forge模型
441
- ThreeDModel = 8,//3d模型
442
- SkyMapModel = 9,//天地图模型
443
- ScaleModel = 10
451
+ CADModel = 5 /** cad图片模型 */,
452
+ BIMModel = 6 /** bim模型 */,
453
+ ForgeModel = 7 /** forge模型 */,
454
+ ThreeDModel = 8 /** 3d模型 */,
455
+ SkyMapModel = 9 /** 天地图模型 */,
456
+ ScaleModel = 10 /** 比例尺模型-前端自定义 */
444
457
  }
445
458
 
459
+ /** 坐标系使用状态 */
446
460
  export declare enum CoordinateStatus {
447
- Used = 0,//当前使用
448
- Enabled = 1,//可使用
449
- Disabled = 2
461
+ Used = 0 /** 当前使用 */,
462
+ Enabled = 1 /** 可使用 */,
463
+ Disabled = 2 /** 无法使用 */
450
464
  }
451
465
 
466
+ /** 坐标系类型 */
452
467
  export declare enum CoordinateType {
453
- Space = 0,//空间
454
- Model = 1,//模型
455
- Data = 2
468
+ Space = 0 /** 空间 */,
469
+ Model = 1 /** 模型 */,
470
+ Data = 2 /** 数据 */
456
471
  }
457
472
 
458
473
  export declare class DataHelper {
@@ -521,14 +536,14 @@ export declare class DataSource {
521
536
  static flattenCoordinateTree(tree: Coordinate | Coordinate[]): Coordinate[];
522
537
  /**
523
538
  * 递归函数将扁平列表转化为树形结构
524
- * @param flatNodes // 扁平列表
525
- * @param rootId // 根id
539
+ * @param flatNodes 扁平列表
540
+ * @param rootId 根id
526
541
  * @returns
527
542
  */
528
543
  static buildCoordinateTree(flatNodes: Coordinate[], rootId?: number): Coordinate;
529
544
  /**
530
545
  * 对子节点进行排序,首先按 status=0 升序,然后按 type=0 升序,最后按 createTime 降序
531
- * @param node // 节点
546
+ * @param node 节点
532
547
  * @returns 无返回值
533
548
  */
534
549
  static sortCoordinateTree(node: Coordinate): void;
@@ -573,9 +588,9 @@ declare type DeepPartial<T> = {
573
588
  declare function error(message: string): void;
574
589
 
575
590
  export declare class GeoPoint {
576
- lat: number;
577
- lon: number;
578
- alt: number;
591
+ lat: number; /** 经度 */
592
+ lon: number; /** 纬度 */
593
+ alt: number; /** 高度 */
579
594
  constructor(options?: Partial<GeoPoint>);
580
595
  static XYZToLLH(p: Point, refPoint: GeoPoint): GeoPoint;
581
596
  static LLHToXYZ(p: Point, refPoint: GeoPoint): Point;
@@ -684,13 +699,14 @@ declare function loadScript(src: string, attributes?: Record<string, string | bo
684
699
  */
685
700
  declare function mapingCoordinate(data: ProjectionModel[], options?: RequestOptions): Promise<any>;
686
701
 
702
+ /** 映射记录 */
687
703
  declare type MappingRecord = {
688
- dstCsGroupUuid: string;
689
- dstCsId: number;
690
- dstCsName: string;
691
- dstCsShortName: string;
692
- dstParentCsName: string;
693
- srcCsId: number;
704
+ dstCsGroupUuid: string /** 目标坐标系组的UUID */;
705
+ dstCsId: number /** 目标坐标系ID */;
706
+ dstCsName: string /** 目标坐标系名称 */;
707
+ dstCsShortName: string /** 目标坐标系简称 */;
708
+ dstParentCsName: string /** 目标父坐标系名称 */;
709
+ srcCsId: number /** 源坐标系ID */;
694
710
  };
695
711
 
696
712
  /**
@@ -698,19 +714,23 @@ declare type MappingRecord = {
698
714
  * 支持直角坐标系(x,y,z)和地理坐标系(经度,纬度,高度)
699
715
  */
700
716
  export declare class Point {
717
+ /** 直角坐标系坐标 */
701
718
  x: number;
702
719
  y: number;
703
720
  z: number;
704
- lat: number;
705
- lon: number;
706
- alt: number;
707
- yaw: number;
708
- pitch: number;
709
- roll: number;
710
- hasXYZ: boolean;
711
- hasGeo: boolean;
712
- hasAngle: boolean;
713
- plane: string;
721
+ /** 地理坐标系坐标 */
722
+ lat: number; /** 经度 (longitude) */
723
+ lon: number; /** 纬度 (latitude) */
724
+ alt: number; /** 高度 (altitude) */
725
+ /** 欧拉角 */
726
+ yaw: number; /** 偏航角 */
727
+ pitch: number; /** 俯仰角 */
728
+ roll: number; /** 翻滚角 */
729
+ /** 状态标志 */
730
+ hasXYZ: boolean; /** 是否有直角坐标 */
731
+ hasGeo: boolean; /** 是否有地理坐标 */
732
+ hasAngle: boolean; /** 是否有角度信息 */
733
+ plane: string; /** 默认平面 ('xy' 或 'xz') */
714
734
  constructor(options?: Partial<Point>);
715
735
  /**
716
736
  * 计算两点之间的三维距离
@@ -796,27 +816,27 @@ export declare class Point {
796
816
  }
797
817
 
798
818
  export declare class Position {
799
- yaw: number;
800
- pitch: number;
801
- roll: number;
819
+ yaw: number; /** 偏航角 */
820
+ pitch: number; /** 俯仰角 */
821
+ roll: number; /** 横滚角 */
802
822
  constructor(options?: Partial<Position>);
803
823
  static toParse(position?: string): Position | undefined;
804
824
  static toStringify(position?: Position): string;
805
825
  }
806
826
 
807
827
  export declare type ProjectionModel = {
808
- mappingType?: number;
809
- projectId?: number;
810
- srcCsId?: number;
811
- srcModelCsId?: number;
812
- srcModelId?: number;
813
- srcCsPointA?: string;
814
- srcCsPointB?: string;
815
- dstCsId?: number;
816
- dstModelCsId?: number;
817
- dstModelId?: number;
818
- dstPointA?: string;
819
- dstPointB?: string;
828
+ mappingType?: number /** 映射类型 */;
829
+ projectId?: number /** 项目ID */;
830
+ srcCsId?: number /** 源坐标系ID(被映射的模型/空间) */;
831
+ srcModelCsId?: number /** 源模型坐标系ID(左侧视图模型) */;
832
+ srcModelId?: number /** 源模型 ID(非坐标系id,是模型自身的原始id) */;
833
+ srcCsPointA?: string /** 源坐标系点A(左侧视图点A) */;
834
+ srcCsPointB?: string /** 源坐标系点B(左侧视图点B) */;
835
+ dstCsId?: number /** 目标坐标系ID(映射目标-空间) */;
836
+ dstModelCsId?: number /** 目标模型坐标系ID(右侧视图模型) */;
837
+ dstModelId?: number /** 目标模型 ID(非坐标系id,是模型自身的原始id) */;
838
+ dstPointA?: string /** 目标坐标系点A(右侧视图点A) */;
839
+ dstPointB?: string /** 目标坐标系点B(右侧视图点B) */;
820
840
  };
821
841
 
822
842
  export declare class RelativeMap {
@@ -828,7 +848,7 @@ export declare class RelativeMap {
828
848
  start: number;
829
849
  end: number;
830
850
  plane: string;
831
- refPoint?: GeoPoint;
851
+ refPoint?: GeoPoint; /** 参考点 */
832
852
  constructor(options?: Partial<RelativeMap>);
833
853
  /**
834
854
  * 合并两个相对坐标系的映射关系
@@ -859,14 +879,15 @@ declare function removeCoordinate(data: number[], options?: RequestOptions): Pro
859
879
  */
860
880
  declare function request<T = any>(config: RequestConfig, options?: Partial<RequestOptions>): Promise<T>;
861
881
 
882
+ /** 请求配置 */
862
883
  export declare type RequestConfig = {
863
- url: string;
864
- method?: string;
865
- params?: Record<string, any>;
866
- data?: Record<string, any>;
867
- body?: any;
868
- mode?: any;
869
- headers?: Record<string, string>;
884
+ url: string /** 请求URL */;
885
+ method?: string /** 请求方法(GET/POST等) */;
886
+ params?: Record<string, any> /** URL参数(通常用于GET请求) */;
887
+ data?: Record<string, any> /** 请求体数据(通常用于POST/PUT) */;
888
+ body?: any /** 原始请求体内容 */;
889
+ mode?: any /** 请求模式(如cors/no-cors等) */;
890
+ headers?: Record<string, string> /** 请求头配置 */;
870
891
  };
871
892
 
872
893
  /**
@@ -887,10 +908,11 @@ export declare enum RequestMethod {
887
908
  POST = "POST"
888
909
  }
889
910
 
911
+ /** 请求选项 */
890
912
  export declare type RequestOptions = {
891
- isTransformResponse?: boolean;
892
- joinBaseUrl?: boolean;
893
- withAuthorize?: boolean;
913
+ isTransformResponse?: boolean /** 是否需要对返回数据进行处理 */;
914
+ joinBaseUrl?: boolean /** 是否加入基础URL */;
915
+ withAuthorize?: boolean /** 是否携带授权码 */;
894
916
  };
895
917
 
896
918
  /**
@@ -902,10 +924,11 @@ export declare enum RequestResultCode {
902
924
  TIMEOUT = 401
903
925
  }
904
926
 
927
+ /** 响应结果 */
905
928
  export declare type ResponseResult = {
906
- code: number;
907
- msg: string;
908
- data: any;
929
+ code: number /** 状态码 */;
930
+ msg: string /** 消息提示 */;
931
+ data: any /** 返回数据 */;
909
932
  };
910
933
 
911
934
  /**
@@ -998,9 +1021,9 @@ declare namespace utils {
998
1021
  export { utils }
999
1022
 
1000
1023
  export declare class Vector3 {
1001
- x: number;
1002
- y: number;
1003
- z: number;
1024
+ x: number; /** x轴 */
1025
+ y: number; /** y轴 */
1026
+ z: number; /** z轴 */
1004
1027
  constructor(options?: Partial<Vector3>);
1005
1028
  static toParse(position?: string): Vector3 | undefined;
1006
1029
  static toStringify(position?: Vector3): string;
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ class y extends Error {
12
12
  };
13
13
  }
14
14
  }
15
- var z = /* @__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))(z || {}), 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 || {});
15
+ 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 || {});
16
16
  const it = {
17
17
  baseUrl: "https://vsleem.com/api",
18
18
  obsType: "hs",
@@ -29,7 +29,7 @@ const it = {
29
29
  function rt(s) {
30
30
  Object.assign(Y, s);
31
31
  }
32
- async function T(s, t) {
32
+ async function S(s, t) {
33
33
  const e = { ...nt, ...t }, i = { ...ot, ...s };
34
34
  try {
35
35
  const n = at(i, e), { url: o, ...r } = n, h = await (await window.fetch(o, r)).json();
@@ -73,11 +73,11 @@ function ct(s) {
73
73
  }
74
74
  const Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
75
75
  __proto__: null,
76
- request: T,
76
+ request: S,
77
77
  setRequestGlobalConfig: rt
78
78
  }, Symbol.toStringTag, { value: "Module" }));
79
79
  function G(s, t) {
80
- return T(
80
+ return S(
81
81
  {
82
82
  url: "/project/jssdk/cs/list",
83
83
  method: M.GET,
@@ -87,7 +87,7 @@ function G(s, t) {
87
87
  );
88
88
  }
89
89
  function B(s, t) {
90
- return T(
90
+ return S(
91
91
  {
92
92
  url: "/project/jssdk/cs/bind",
93
93
  method: M.POST,
@@ -97,7 +97,7 @@ function B(s, t) {
97
97
  );
98
98
  }
99
99
  function O(s, t) {
100
- return T(
100
+ return S(
101
101
  {
102
102
  url: "/project/jssdk/cs/save",
103
103
  method: M.POST,
@@ -107,7 +107,7 @@ function O(s, t) {
107
107
  );
108
108
  }
109
109
  function $(s, t) {
110
- return T(
110
+ return S(
111
111
  {
112
112
  url: "/project/jssdk/cs/delete",
113
113
  method: M.POST,
@@ -117,7 +117,7 @@ function $(s, t) {
117
117
  );
118
118
  }
119
119
  function _(s, t) {
120
- return T(
120
+ return S(
121
121
  {
122
122
  url: "/project/jssdk/cs/mapping",
123
123
  method: M.POST,
@@ -127,7 +127,7 @@ function _(s, t) {
127
127
  );
128
128
  }
129
129
  function Z(s, t) {
130
- return T(
130
+ return S(
131
131
  {
132
132
  url: "/project/jssdk/cs/mapping/query",
133
133
  method: M.GET,
@@ -141,7 +141,7 @@ function lt(s, t = {
141
141
  joinBaseUrl: !1,
142
142
  withAuthorize: !1
143
143
  }) {
144
- return T(
144
+ return S(
145
145
  {
146
146
  url: s,
147
147
  method: M.GET
@@ -159,7 +159,7 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
159
159
  removeCoordinate: $,
160
160
  saveCoordinate: O
161
161
  }, Symbol.toStringTag, { value: "Module" })), ut = typeof window < "u", dt = Object.prototype.toString;
162
- function P(s, t) {
162
+ function T(s, t) {
163
163
  return dt.call(s) === `[object ${t}]`;
164
164
  }
165
165
  function q(s) {
@@ -168,37 +168,37 @@ function q(s) {
168
168
  function J(s) {
169
169
  return !q(s);
170
170
  }
171
- function S(s) {
172
- return s !== null && P(s, "Object");
171
+ function b(s) {
172
+ return s !== null && T(s, "Object");
173
173
  }
174
174
  function H(s) {
175
175
  return s === null;
176
176
  }
177
177
  function ft(s) {
178
- return P(s, "Date");
178
+ return T(s, "Date");
179
179
  }
180
180
  function mt(s) {
181
- return P(s, "String");
181
+ return T(s, "String");
182
182
  }
183
183
  function L(s) {
184
184
  return typeof s == "function";
185
185
  }
186
186
  function yt(s) {
187
- return P(s, "Boolean");
187
+ return T(s, "Boolean");
188
188
  }
189
189
  function wt(s) {
190
- return P(s, "RegExp");
190
+ return T(s, "RegExp");
191
191
  }
192
192
  function x(s) {
193
193
  return s && Array.isArray(s);
194
194
  }
195
195
  function pt(s) {
196
- return typeof window < "u" && P(s, "Window");
196
+ return typeof window < "u" && T(s, "Window");
197
197
  }
198
198
  function gt(s) {
199
- return S(s) && !!s.tagName;
199
+ return b(s) && !!s.tagName;
200
200
  }
201
- function b(s) {
201
+ function N(s) {
202
202
  return typeof s == "number" ? !0 : typeof s != "string" ? !1 : /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s);
203
203
  }
204
204
  function xt(s, t) {
@@ -208,12 +208,12 @@ function Mt(s) {
208
208
  return J(s) || H(s);
209
209
  }
210
210
  function vt(s) {
211
- return P(s, "Promise") && S(s) && L(s.then) && L(s.catch);
211
+ return T(s, "Promise") && b(s) && L(s.then) && L(s.catch);
212
212
  }
213
213
  function V(s) {
214
- return E(s, /* @__PURE__ */ new WeakMap());
214
+ return P(s, /* @__PURE__ */ new WeakMap());
215
215
  }
216
- function E(s, t) {
216
+ function P(s, t) {
217
217
  if (typeof s != "object" || s === null)
218
218
  return s;
219
219
  if (t.has(s))
@@ -225,11 +225,11 @@ function E(s, t) {
225
225
  return e = new RegExp(s), t.set(s, e), e;
226
226
  if (s instanceof Map)
227
227
  return e = /* @__PURE__ */ new Map(), t.set(s, e), s.forEach((n, o) => {
228
- e.set(o, E(n, t));
228
+ e.set(o, P(n, t));
229
229
  }), e;
230
230
  if (s instanceof Set)
231
231
  return e = /* @__PURE__ */ new Set(), t.set(s, e), s.forEach((n) => {
232
- e.add(E(n, t));
232
+ e.add(P(n, t));
233
233
  }), e;
234
234
  if (ArrayBuffer.isView(s))
235
235
  return e = new s.constructor(
@@ -242,15 +242,15 @@ function E(s, t) {
242
242
  if (Array.isArray(s)) {
243
243
  e = [], t.set(s, e);
244
244
  for (let n = 0; n < s.length; n++)
245
- n in s && (e[n] = E(s[n], t));
245
+ n in s && (e[n] = P(s[n], t));
246
246
  return e;
247
247
  }
248
248
  e = Object.create(Object.getPrototypeOf(s)), t.set(s, e);
249
249
  for (const n in s)
250
- Object.prototype.hasOwnProperty.call(s, n) && (e[n] = E(s[n], t));
250
+ Object.prototype.hasOwnProperty.call(s, n) && (e[n] = P(s[n], t));
251
251
  const i = Object.getOwnPropertySymbols(s);
252
252
  for (const n of i)
253
- Object.prototype.propertyIsEnumerable.call(s, n) && (e[n] = E(s[n], t));
253
+ Object.prototype.propertyIsEnumerable.call(s, n) && (e[n] = P(s[n], t));
254
254
  return e;
255
255
  }
256
256
  function bt(s, t, e = !1) {
@@ -302,28 +302,28 @@ function W(s, ...t) {
302
302
  }
303
303
  function Q(s, t) {
304
304
  const e = {};
305
- if (S(s) && !x(s)) {
305
+ if (b(s) && !x(s)) {
306
306
  for (const i in s)
307
307
  if (Object.prototype.hasOwnProperty.call(s, i)) {
308
- const n = s[i], o = S(t) && !x(t) ? t[i] : void 0;
308
+ const n = s[i], o = b(t) && !x(t) ? t[i] : void 0;
309
309
  if (!(i in (t || {})))
310
310
  e[i] = n;
311
311
  else if (x(n) && x(o))
312
312
  JSON.stringify(n) !== JSON.stringify(o) && (e[i] = n);
313
- else if (S(n) && S(o)) {
313
+ else if (b(n) && b(o)) {
314
314
  const r = Q(n, o);
315
315
  r && Object.keys(r).length > 0 && (e[i] = r);
316
316
  } else n !== o && (e[i] = n);
317
317
  }
318
318
  }
319
- if (S(t) && x(t))
319
+ if (b(t) && x(t))
320
320
  for (const i in t)
321
321
  Object.prototype.hasOwnProperty.call(t, i) && !(i in (s || {})) && (e[i] = void 0);
322
322
  return e;
323
323
  }
324
324
  function Tt(s, t = {}) {
325
325
  return new Promise((e, i) => {
326
- const n = D(s);
326
+ const n = z(s);
327
327
  if (Pt(n)) {
328
328
  e(!0);
329
329
  return;
@@ -339,12 +339,12 @@ function Tt(s, t = {}) {
339
339
  });
340
340
  }
341
341
  function Pt(s) {
342
- const t = D(s);
343
- return Array.from(document.scripts).some((e) => D(e.src) === t);
342
+ const t = z(s);
343
+ return Array.from(document.scripts).some((e) => z(e.src) === t);
344
344
  }
345
345
  function Et(s) {
346
346
  return new Promise((t, e) => {
347
- const i = D(s);
347
+ const i = z(s);
348
348
  if (zt(i)) {
349
349
  t(!0);
350
350
  return;
@@ -358,12 +358,12 @@ function Et(s) {
358
358
  });
359
359
  }
360
360
  function zt(s) {
361
- const t = D(s);
361
+ const t = z(s);
362
362
  return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(
363
- (e) => D(e.href) === t
363
+ (e) => z(e.href) === t
364
364
  );
365
365
  }
366
- function D(s) {
366
+ function z(s) {
367
367
  try {
368
368
  const t = new URL(s, window.location.href);
369
369
  return `${t.origin}${t.pathname}`;
@@ -383,14 +383,14 @@ function Dt(s, t, e, i) {
383
383
  sh: r
384
384
  };
385
385
  }
386
- function Nt(s, t, e) {
386
+ function It(s, t, e) {
387
387
  return {
388
388
  x: s * e.scale + e.x,
389
389
  // 缩放后加上偏移量
390
390
  y: t * e.scale + e.y
391
391
  };
392
392
  }
393
- function It(s, t, e) {
393
+ function Nt(s, t, e) {
394
394
  return {
395
395
  x: (s - e.x) / e.scale,
396
396
  // 减去偏移量后缩放到模型尺寸
@@ -413,7 +413,7 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
413
413
  getDiffProps: Q,
414
414
  getImageTransform: Dt,
415
415
  inBrowser: ut,
416
- is: P,
416
+ is: T,
417
417
  isArray: x,
418
418
  isBoolean: yt,
419
419
  isDate: ft,
@@ -422,8 +422,8 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
422
422
  isFunction: L,
423
423
  isNull: H,
424
424
  isNullOrUnDef: Mt,
425
- isNumeric: b,
426
- isObject: S,
425
+ isNumeric: N,
426
+ isObject: b,
427
427
  isPromise: vt,
428
428
  isRegExp: wt,
429
429
  isSameValue: xt,
@@ -433,41 +433,41 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
433
433
  loadCss: Et,
434
434
  loadScript: Tt,
435
435
  throttle: St,
436
- toCanvasCoord: Nt,
437
- toModelCoord: It,
436
+ toCanvasCoord: It,
437
+ toModelCoord: Nt,
438
438
  warn: Ct
439
439
  }, Symbol.toStringTag, { value: "Module" }));
440
440
  class f {
441
- // 直角坐标系坐标
441
+ /** 直角坐标系坐标 */
442
442
  x = 0;
443
443
  y = 0;
444
444
  z = 0;
445
- // 地理坐标系坐标
445
+ /** 地理坐标系坐标 */
446
446
  lat = 0;
447
- // 经度 (longitude)
447
+ /** 经度 (longitude) */
448
448
  lon = 0;
449
- // 纬度 (latitude)
449
+ /** 纬度 (latitude) */
450
450
  alt = 0;
451
- // 高度 (altitude)
452
- // 欧拉角
451
+ /** 高度 (altitude) */
452
+ /** 欧拉角 */
453
453
  yaw = 0;
454
- // 偏航角
454
+ /** 偏航角 */
455
455
  pitch = 0;
456
- // 俯仰角
456
+ /** 俯仰角 */
457
457
  roll = 0;
458
- // 翻滚角
459
- // 状态标志
458
+ /** 翻滚角 */
459
+ /** 状态标志 */
460
460
  hasXYZ = !1;
461
- // 是否有直角坐标
461
+ /** 是否有直角坐标 */
462
462
  hasGeo = !1;
463
- // 是否有地理坐标
463
+ /** 是否有地理坐标 */
464
464
  hasAngle = !1;
465
- // 是否有角度信息
465
+ /** 是否有角度信息 */
466
466
  plane = "xy";
467
- // 默认平面 ('xy' 或 'xz')
467
+ /** 默认平面 ('xy' 或 'xz') */
468
468
  constructor(t) {
469
469
  const { x: e, y: i, z: n, lat: o, lon: r, alt: a, yaw: h, pitch: l, roll: c, plane: u = "xy" } = t || {};
470
- b(e) && b(i) && Number(e) !== 0 && Number(i) !== 0 && (this.x = Number(e) || 0, this.y = Number(i) || 0, this.z = Number(n) || 0, this.plane = u, this.hasXYZ = !0), b(o) && b(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), (b(h) || b(l) || b(c)) && (this.yaw = Number(h) || 0, this.pitch = Number(l) || 0, this.roll = Number(c) || 0, this.hasAngle = !0);
470
+ this.x = Number(e) || 0, this.y = Number(i) || 0, this.z = Number(n) || 0, (this.x !== 0 || this.y !== 0 || this.z !== 0) && (this.plane = u, this.hasXYZ = !0), this.lat = Number(o) || 0, this.lon = Number(r) || 0, this.alt = Number(a) || 0, (this.lat !== 0 || this.lon !== 0 || this.alt !== 0) && (this.hasGeo = !0), this.yaw = Number(h) || 0, this.pitch = Number(l) || 0, this.roll = Number(c) || 0, (N(h) || N(l) || N(c)) && (this.hasAngle = !0);
471
471
  }
472
472
  /**
473
473
  * 计算两点之间的三维距离
@@ -554,23 +554,23 @@ class f {
554
554
  try {
555
555
  if (e?.id === i?.id)
556
556
  return new f(this);
557
- if (e?.modelType === z.SkyMapModel) {
557
+ if (e?.modelType === E.SkyMapModel) {
558
558
  const { refPoint: n } = e?.relativeMap || {};
559
559
  if (this?.hasXYZ)
560
560
  return this.project(t);
561
561
  if (this.hasGeo && n) {
562
- const o = N.LLHToXYZ(this, n);
562
+ const o = D.LLHToXYZ(this, n);
563
563
  return this.x = o.x, this.y = o.y, this.z = o.z, this.hasXYZ = !0, this.project(t);
564
564
  }
565
565
  throw new y(w.PointUnmappedGIS, "没有完成GIS与其他空间的映射");
566
566
  }
567
- if (i?.modelType === z.SkyMapModel) {
567
+ if (i?.modelType === E.SkyMapModel) {
568
568
  const { refPoint: n } = i?.relativeMap || {};
569
569
  if (this?.hasGeo)
570
570
  return new f(this);
571
571
  const o = this.project(t);
572
572
  if (o?.hasXYZ && n) {
573
- const r = N.XYZToLLH(o, n);
573
+ const r = D.XYZToLLH(o, n);
574
574
  return o.lat = r.lat, o.lon = r.lon, o.alt = r.alt, o.hasGeo = !0, o;
575
575
  }
576
576
  throw new y(w.PointUnmappedGIS, "没有完成GIS与其他空间的映射");
@@ -619,13 +619,13 @@ class f {
619
619
  return e.x = i + t.x, e.y = n + t.y, e.z += t.z, e;
620
620
  }
621
621
  }
622
- class N {
622
+ class D {
623
623
  lat = 0;
624
- //经度
624
+ /** 经度 */
625
625
  lon = 0;
626
- //纬度
626
+ /** 纬度 */
627
627
  alt = 0;
628
- //高度
628
+ /** 高度 */
629
629
  constructor(t) {
630
630
  const { lat: e = 0, lon: i = 0, alt: n = 0 } = t || {};
631
631
  this.lat = e, this.lon = i, this.alt = n;
@@ -641,7 +641,7 @@ class N {
641
641
  h = e.lon + f.toDegrees(u), l = e.lat - f.toDegrees(d), c = e.alt + t.z / 1e3;
642
642
  } else
643
643
  throw new y(w.GeoPointNoPlane, "点的plane应为xz或xy");
644
- return new N({
644
+ return new D({
645
645
  lat: l,
646
646
  lon: h,
647
647
  alt: c
@@ -676,10 +676,10 @@ class p {
676
676
  end = -1;
677
677
  plane = "xy";
678
678
  refPoint;
679
- //参考点
679
+ /** 参考点 */
680
680
  constructor(t) {
681
681
  const { refPoint: e, ...i } = t || {};
682
- e && (this.refPoint = new N(e)), Object.assign(this, i);
682
+ e && (this.refPoint = new D(e)), Object.assign(this, i);
683
683
  }
684
684
  /**
685
685
  * 合并两个相对坐标系的映射关系
@@ -870,8 +870,8 @@ class m {
870
870
  }
871
871
  /**
872
872
  * 递归函数将扁平列表转化为树形结构
873
- * @param flatNodes // 扁平列表
874
- * @param rootId // 根id
873
+ * @param flatNodes 扁平列表
874
+ * @param rootId 根id
875
875
  * @returns
876
876
  */
877
877
  static buildCoordinateTree(t, e = 0) {
@@ -891,7 +891,7 @@ class m {
891
891
  }
892
892
  /**
893
893
  * 对子节点进行排序,首先按 status=0 升序,然后按 type=0 升序,最后按 createTime 降序
894
- * @param node // 节点
894
+ * @param node 节点
895
895
  * @returns 无返回值
896
896
  */
897
897
  static sortCoordinateTree(t) {
@@ -917,41 +917,41 @@ class m {
917
917
  }
918
918
  class A {
919
919
  id = 0;
920
- //id
920
+ /** id */
921
921
  type = 0;
922
- //0空间,1模型
922
+ /** 0空间,1模型 */
923
923
  children = [];
924
- //子节点
924
+ /** 子节点 */
925
925
  level;
926
- //空间的层级
926
+ /** 空间的层级 */
927
927
  relativeMap;
928
- //相对位置关系
928
+ /** 相对位置关系 */
929
929
  no;
930
- //坐标系编号
930
+ /** 坐标系编号 */
931
931
  name;
932
- //名称
932
+ /** 名称 */
933
933
  shortName;
934
- //简称
934
+ /** 简称 */
935
935
  status;
936
- //使用状态
936
+ /** 使用状态 */
937
937
  modelId;
938
- // 模型ID
938
+ /** 模型ID */
939
939
  modelType;
940
- //模型的类型
940
+ /** 模型的类型 */
941
941
  modelValue;
942
- // 模型value
942
+ /** 模型value */
943
943
  projectId;
944
- //项目id
944
+ /** 项目id */
945
945
  parentId;
946
- //父节点id
946
+ /** 父节点id */
947
947
  parent;
948
- //父节点
948
+ /** 父节点 */
949
949
  groupUuid;
950
- //分组uuid
950
+ /** 分组uuid */
951
951
  z;
952
- //坐标系高度
952
+ /** 坐标系高度 */
953
953
  createTime;
954
- // 创建时间
954
+ /** 创建时间 */
955
955
  disabled;
956
956
  constructor(t) {
957
957
  this.setOptions(t);
@@ -966,17 +966,17 @@ class A {
966
966
  const t = this.name ? `(${this.name})` : "";
967
967
  return this.shortName ? `${this.shortName}${t}` : this.name ?? "";
968
968
  }
969
- //设置参数
969
+ /** 设置参数 */
970
970
  setOptions(t) {
971
971
  const { relativeMap: e, parent: i, children: n, ...o } = t || {};
972
972
  e && (this.relativeMap = new p(e)), i && (this.parent = i), n?.length && (this.children = n), Object.assign(this, o);
973
973
  }
974
- //添加子节点
974
+ /** 添加子节点 */
975
975
  async addChild(t) {
976
976
  const e = x(t) ? t : [t], i = await m.addCoordinate(this, e);
977
977
  return this.mergeChild(i), i;
978
978
  }
979
- //删除子节点
979
+ /** 删除子节点 */
980
980
  async removeChild(t) {
981
981
  const e = x(t) ? t : [t];
982
982
  await m.removeCoordinate(this, e);
@@ -985,17 +985,17 @@ class A {
985
985
  n !== -1 && this.children.splice(n, 1);
986
986
  }
987
987
  }
988
- //更新子节点
988
+ /** 更新子节点 */
989
989
  async updateChild(t) {
990
990
  const e = x(t) ? t : [t], i = await m.updateCoordinate(this, e);
991
991
  return this.mergeChild(i), i;
992
992
  }
993
- //绑定子节点,不建立映射关系
993
+ /** 绑定子节点,不建立映射关系 */
994
994
  async bindChild(t) {
995
995
  const e = x(t) ? t : [t], i = await m.bindCoordinate(this, e);
996
996
  return this.mergeChild(i), i;
997
997
  }
998
- // 合并子节点,没有查询到节点就插入
998
+ /** 合并子节点,没有查询到节点就插入 */
999
999
  async mergeChild(t) {
1000
1000
  t?.length && t.forEach((e) => {
1001
1001
  const i = this.children.find((n) => n.id === e.id);
@@ -1013,11 +1013,11 @@ class A {
1013
1013
  } else this.id === e.parentId && (e.parent = this, this.children.unshift(e));
1014
1014
  });
1015
1015
  }
1016
- //映射到(模型映射到空间,空间映射到空间)
1016
+ /** 映射到(模型映射到空间,空间映射到空间) */
1017
1017
  async mappingTo(t) {
1018
1018
  await _(t);
1019
1019
  }
1020
- // 来自映射(被映射过的源坐标系关系)
1020
+ /** 来自映射(被映射过的源坐标系关系) */
1021
1021
  async fromMapping() {
1022
1022
  const t = await Z({ srcCsId: this.id });
1023
1023
  return t[t.length - 1];
@@ -1038,17 +1038,17 @@ class A {
1038
1038
  * @param mapped 是否被映射
1039
1039
  * @returns
1040
1040
  */
1041
- findChildModel(t = [z.CADModel, z.SkyMapModel], e = !0) {
1041
+ findChildModel(t = [E.CADModel, E.SkyMapModel], e = !0) {
1042
1042
  const i = x(t) ? t : [t];
1043
1043
  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];
1044
1044
  }
1045
1045
  /**
1046
1046
  * 寻找与当前节点最近的一个模型节点,从当前节点遍历到根节点-广度优先遍历
1047
1047
  * @param type 允许的模型类型
1048
- * @param excludeNodes //排除的坐标系
1048
+ * @param excludeNodes 排除的坐标系
1049
1049
  * @returns
1050
1050
  */
1051
- findClosestModel(t = z.CADModel, e) {
1051
+ findClosestModel(t = E.CADModel, e) {
1052
1052
  const i = /* @__PURE__ */ new Set();
1053
1053
  for (const l of e ?? [])
1054
1054
  i.add(String(l.id));
@@ -1101,14 +1101,14 @@ class A {
1101
1101
  i.type === v.Space && (e.unshift(i.fullName), t--), i = i.parent;
1102
1102
  return e;
1103
1103
  }
1104
- // 寻找坐标系组, 有groupUuid表示坐标系组
1104
+ /** 寻找坐标系组, 有groupUuid表示坐标系组 */
1105
1105
  findCsGroup() {
1106
1106
  const { groupUuid: t, parent: e } = this;
1107
1107
  return t ? e?.children?.filter((i) => i.groupUuid === t) || [] : [this];
1108
1108
  }
1109
1109
  /**
1110
1110
  * 递归寻找到相应的层级
1111
- * @param level //坐标系的层级
1111
+ * @param level 坐标系的层级
1112
1112
  * @returns
1113
1113
  */
1114
1114
  findCsByLevel(t) {
@@ -1235,11 +1235,11 @@ class A {
1235
1235
  }
1236
1236
  class K {
1237
1237
  yaw = 0;
1238
- //偏航角
1238
+ /** 偏航角 */
1239
1239
  pitch = 0;
1240
- //俯仰角
1240
+ /** 俯仰角 */
1241
1241
  roll = 0;
1242
- //横滚角
1242
+ /** 横滚角 */
1243
1243
  constructor(t) {
1244
1244
  const { yaw: e = 0, pitch: i = 0, roll: n = 0 } = t || {};
1245
1245
  this.yaw = Number(e) || 0, this.pitch = Number(i) || 0, this.roll = Number(n) || 0;
@@ -1256,11 +1256,11 @@ class K {
1256
1256
  }
1257
1257
  class tt {
1258
1258
  x = 0;
1259
- //x轴
1259
+ /** x轴 */
1260
1260
  y = 0;
1261
- //y轴
1261
+ /** y轴 */
1262
1262
  z = 0;
1263
- //z轴
1263
+ /** z轴 */
1264
1264
  constructor(t) {
1265
1265
  const { x: e = 0, y: i = 0, z: n = 0 } = t || {};
1266
1266
  this.x = Number(e) || 0, this.y = Number(i) || 0, this.z = Number(n) || 0;
@@ -1704,12 +1704,12 @@ export {
1704
1704
  Bt as CanvasRegionElement,
1705
1705
  A as Coordinate,
1706
1706
  et as CoordinateLevel,
1707
- z as CoordinateModelType,
1707
+ E as CoordinateModelType,
1708
1708
  C as CoordinateStatus,
1709
1709
  v as CoordinateType,
1710
1710
  At as DataHelper,
1711
1711
  m as DataSource,
1712
- N as GeoPoint,
1712
+ D as GeoPoint,
1713
1713
  f as Point,
1714
1714
  K as Position,
1715
1715
  p as RelativeMap,
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(u,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(u=typeof globalThis<"u"?globalThis:u||self,f(u.Shared={}))})(this,(function(u){"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 C=(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))(C||{}),Y=(s=>(s[s.Global=0]="Global",s))(Y||{}),b=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(b||{}),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||{}),R=(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||{}),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:{}},$={...B};function at(s){Object.assign($,s)}async function T(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"]=R.JSON),a===M.GET&&l){const x=new URLSearchParams(l);r+=`?${x.toString()}`}let m;return a===M.POST&&(m=d["Content-Type"]===R.JSON?JSON.stringify(c||{}):c),{url:r,method:a,headers:d,body:m}}function ct(s,t){if(!t.isTransformResponse)return s;if(!s)throw new f(p.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===L.SUCCESS)return i;throw new f(p.RequestCodeError,n||"请求返回的Code错误")}function lt(s){throw s instanceof Error?s:new f(p.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const ut=Object.freeze(Object.defineProperty({__proto__:null,request:T,setRequestGlobalConfig:at},Symbol.toStringTag,{value:"Module"}));function _(s,t){return T({url:"/project/jssdk/cs/list",method:M.GET,params:s},t)}function q(s,t){return T({url:"/project/jssdk/cs/bind",method:M.POST,data:s},t)}function k(s,t){return T({url:"/project/jssdk/cs/save",method:M.POST,data:s},t)}function Z(s,t){return T({url:"/project/jssdk/cs/delete",method:M.POST,data:s},t)}function J(s,t){return T({url:"/project/jssdk/cs/mapping",method:M.POST,data:s},t)}function H(s,t){return T({url:"/project/jssdk/cs/mapping/query",method:M.GET,params:s},t)}function dt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return T({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 S(s,t){return yt.call(s)===`[object ${t}]`}function V(s){return typeof s<"u"}function W(s){return!V(s)}function P(s){return s!==null&&S(s,"Object")}function Q(s){return s===null}function wt(s){return S(s,"Date")}function pt(s){return S(s,"String")}function A(s){return typeof s=="function"}function gt(s){return S(s,"Boolean")}function Mt(s){return S(s,"RegExp")}function v(s){return s&&Array.isArray(s)}function vt(s){return typeof window<"u"&&S(s,"Window")}function xt(s){return P(s)&&!!s.tagName}function E(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 S(s,"Promise")&&P(s)&&A(s.then)&&A(s.catch)}function K(s){return D(s,new WeakMap)}function D(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,D(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(D(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]=D(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]=D(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=D(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(P(s)&&!v(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=P(t)&&!v(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(v(n)&&v(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(P(n)&&P(o)){const r=et(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(P(t)&&v(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=N(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=N(s);return Array.from(document.scripts).some(e=>N(e.src)===t)}function Nt(s){return new Promise((t,e)=>{const i=N(s);if(zt(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 zt(s){const t=N(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>N(e.href)===t)}function N(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function 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 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:It,inBrowser:mt,is:S,isArray:v,isBoolean:gt,isDate:wt,isDef:V,isElement:xt,isFunction:A,isNull:Q,isNullOrUnDef:Tt,isNumeric:E,isObject:P,isPromise:St,isRegExp:Mt,isSameValue:bt,isString:pt,isUnDef:W,isWindow:vt,loadCss:Nt,loadScript:Ct,throttle:Et,toCanvasCoord:Rt,toModelCoord:Ot,warn:Lt},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:l,roll:c,plane:d="xy"}=t||{};E(e)&&E(i)&&Number(e)!==0&&Number(i)!==0&&(this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,this.plane=d,this.hasXYZ=!0),E(o)&&E(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),(E(h)||E(l)||E(c))&&(this.yaw=Number(h)||0,this.pitch=Number(l)||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),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 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===C.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 f(p.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===C.SkyMapModel){const{refPoint:n}=i?.relativeMap||{};if(this?.hasGeo)return new y(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 f(p.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new f(p.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new f(p.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.z*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.z*Math.cos(t.yaw);return e.x=i+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.y*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.y*Math.cos(t.yaw);return e.x=i+t.x,e.y=n+t.y,e.z+=t.z,e}}class z{lat=0;lon=0;alt=0;constructor(t){const{lat:e=0,lon:i=0,alt:n=0}=t||{};this.lat=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,l,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),l=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),l=e.lat-y.toDegrees(m),c=e.alt+t.z/1e3}else throw new f(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=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,h=y.toRadians(t.lon-e.lon),l=y.toRadians(e.lat-t.lat),c=a*h*Math.cos(r),d=a*l;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(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 f(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,m=t.x*r+t.z*o;a=e.x+c*e.scale,h=e.y+d*e.scale,l=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,l=e.z+m*e.scale}else throw new f(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 f(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 f(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,...m}=a,x=c?JSON.stringify(c):void 0;return{...m,projectId:i,parentId:n,coordinateType:h,renderType:l,relativePosition:x}}),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,m=g.toStringify(l);return{...d,relativePosition:m,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.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===b.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!==b.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===b.Space)}get modelList(){return this.children.filter(t=>t.type===b.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=v(t)?t:[t],i=await w.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=v(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=v(t)?t:[t],i=await w.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=v(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=[C.CADModel,C.SkyMapModel],e=!0){const i=v(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==I.Disabled?this:([b.Data,b.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=C.CADModel,e){const i=new Set;for(const l of e??[])i.add(String(l.id));const n=[{node:this,distance:0}],o=v(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 m=[];if(c.children)for(const x of c.children)r.has(x)||m.push(x);if(c.parent?.children)for(const x of c.parent.children)x!==c&&!r.has(x)&&m.push(x);c.parent&&!r.has(c.parent)&&m.push(c.parent);for(const x of m)n.push({node:x,distance:d+1})}return a}findParentSpace(){let t=this;for(;t&&t.type!==b.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===b.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===b.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=f,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=C,u.CoordinateStatus=I,u.CoordinateType=b,u.DataHelper=jt,u.DataSource=w,u.GeoPoint=z,u.Point=y,u.Position=F,u.RelativeMap=g,u.RequestContentType=R,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,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(u=typeof globalThis<"u"?globalThis:u||self,f(u.Shared={}))})(this,(function(u){"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 E=(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||{}),Y=(s=>(s[s.Global=0]="Global",s))(Y||{}),b=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(b||{}),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:{}},$={...B};function at(s){Object.assign($,s)}async function T(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 x=new URLSearchParams(l);r+=`?${x.toString()}`}let m;return a===M.POST&&(m=d["Content-Type"]===N.JSON?JSON.stringify(c||{}):c),{url:r,method:a,headers:d,body:m}}function ct(s,t){if(!t.isTransformResponse)return s;if(!s)throw new f(p.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===L.SUCCESS)return i;throw new f(p.RequestCodeError,n||"请求返回的Code错误")}function lt(s){throw s instanceof Error?s:new f(p.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const ut=Object.freeze(Object.defineProperty({__proto__:null,request:T,setRequestGlobalConfig:at},Symbol.toStringTag,{value:"Module"}));function _(s,t){return T({url:"/project/jssdk/cs/list",method:M.GET,params:s},t)}function q(s,t){return T({url:"/project/jssdk/cs/bind",method:M.POST,data:s},t)}function k(s,t){return T({url:"/project/jssdk/cs/save",method:M.POST,data:s},t)}function Z(s,t){return T({url:"/project/jssdk/cs/delete",method:M.POST,data:s},t)}function J(s,t){return T({url:"/project/jssdk/cs/mapping",method:M.POST,data:s},t)}function H(s,t){return T({url:"/project/jssdk/cs/mapping/query",method:M.GET,params:s},t)}function dt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return T({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 S(s,t){return yt.call(s)===`[object ${t}]`}function V(s){return typeof s<"u"}function W(s){return!V(s)}function P(s){return s!==null&&S(s,"Object")}function Q(s){return s===null}function wt(s){return S(s,"Date")}function pt(s){return S(s,"String")}function A(s){return typeof s=="function"}function gt(s){return S(s,"Boolean")}function Mt(s){return S(s,"RegExp")}function v(s){return s&&Array.isArray(s)}function vt(s){return typeof window<"u"&&S(s,"Window")}function xt(s){return P(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 S(s,"Promise")&&P(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(P(s)&&!v(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=P(t)&&!v(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(v(n)&&v(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(P(n)&&P(o)){const r=et(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(P(t)&&v(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:S,isArray:v,isBoolean:gt,isDate:wt,isDef:V,isElement:xt,isFunction:A,isNull:Q,isNullOrUnDef:Tt,isNumeric:R,isObject:P,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 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: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 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===E.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 f(p.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===E.SkyMapModel){const{refPoint:n}=i?.relativeMap||{};if(this?.hasGeo)return new y(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 f(p.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new f(p.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new f(p.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.z*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.z*Math.cos(t.yaw);return e.x=i+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.y*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.y*Math.cos(t.yaw);return e.x=i+t.x,e.y=n+t.y,e.z+=t.z,e}}class z{lat=0;lon=0;alt=0;constructor(t){const{lat:e=0,lon:i=0,alt:n=0}=t||{};this.lat=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,l,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),l=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),l=e.lat-y.toDegrees(m),c=e.alt+t.z/1e3}else throw new f(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=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,h=y.toRadians(t.lon-e.lon),l=y.toRadians(e.lat-t.lat),c=a*h*Math.cos(r),d=a*l;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(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 f(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,m=t.x*r+t.z*o;a=e.x+c*e.scale,h=e.y+d*e.scale,l=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,l=e.z+m*e.scale}else throw new f(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 f(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 f(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,...m}=a,x=c?JSON.stringify(c):void 0;return{...m,projectId:i,parentId:n,coordinateType:h,renderType:l,relativePosition:x}}),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,m=g.toStringify(l);return{...d,relativePosition:m,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.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===b.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!==b.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===b.Space)}get modelList(){return this.children.filter(t=>t.type===b.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=v(t)?t:[t],i=await w.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=v(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=v(t)?t:[t],i=await w.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=v(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=[E.CADModel,E.SkyMapModel],e=!0){const i=v(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==I.Disabled?this:([b.Data,b.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=E.CADModel,e){const i=new Set;for(const l of e??[])i.add(String(l.id));const n=[{node:this,distance:0}],o=v(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 m=[];if(c.children)for(const x of c.children)r.has(x)||m.push(x);if(c.parent?.children)for(const x of c.parent.children)x!==c&&!r.has(x)&&m.push(x);c.parent&&!r.has(c.parent)&&m.push(c.parent);for(const x of m)n.push({node:x,distance:d+1})}return a}findParentSpace(){let t=this;for(;t&&t.type!==b.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===b.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===b.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=f,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=E,u.CoordinateStatus=I,u.CoordinateType=b,u.DataHelper=jt,u.DataSource=w,u.GeoPoint=z,u.Point=y,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"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsleem-realsee-viewer/shared",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "private": false,
5
5
  "description": "Shared utilities for VSLeem RealSee Viewer",
6
6
  "main": "./dist/index.umd.js",