@syhr/sy-three 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # @syhr/sy-three
2
+
3
+ 一个基于 ThreeJs 的三维图形展示工具。
4
+
5
+ ## 特性
6
+
7
+ - 🎨 基于 ThreeJs 的强大三维图形展示能力
8
+ - 🔧 支持多种三维模型
9
+ - 📱 响应式设计,支持移动端
10
+ - 🎯 完整的 TypeScript 支持
11
+ - 📦 多种模块格式支持(ES、UMD、CommonJS)
12
+ - 🔌 Vue 3 插件化架构
13
+ - 🛡️ 安全的全局属性处理,避免变量冲突
14
+ - 🔄 实时数据更新和 WebSocket 支持
15
+ - 🎛️ 可定制的错误处理和回调机制
16
+ - 🚀 高性能渲染和批量更新
17
+ - 🎨 多层级显示控制
18
+ - 📡 支持自定义 API 和事件总线注入
19
+
20
+ ## 安装
21
+
22
+ ```bash
23
+ npm install @syhr/sy-three
24
+ ```
25
+
26
+ ### Peer Dependencies
27
+
28
+ 确保你的项目已安装以下 peer dependencies:
29
+
30
+ ```bash
31
+ # 必需依赖
32
+ npm install vue@^3.0.0 element-plus@^2.0.0 lodash-es@^4.17.0 three@^0.184.0 three-edit-cores@^0.0.15
33
+
34
+ # 可选依赖(根据需要安装)
35
+ npm install pinia@^2.0.0 vue-router@^4.0.0
36
+ ```
37
+
38
+ ## 使用
39
+
40
+ 设置 draco 解码器的资源路径。在库模式下使用时需要:
41
+
42
+ 1. 将 `node_modules/@syhr/sy-threed-graph/lib-threed/draco` 文件夹拷贝到自己项目的 `public/` 目录下
43
+ 2. 在注册组件之前调用此函数指定路径
44
+
45
+ ### 全局注册(推荐)
46
+
47
+ ```javascript
48
+ import { createApp } from 'vue';
49
+ import SyThreed, { setDracoPath } from '@syhr/sy-threed';
50
+ import '@syhr/sy-threed/style';
51
+ const dracoPath = `${import.meta.env.BASE_URL}draco/`;
52
+ setDracoPath(dracoPath);
53
+
54
+ const app = createApp(App);
55
+ app.use(SyThreed);
56
+ app.mount('#app');
57
+ ```
58
+
59
+ ### 局部使用
60
+
61
+ ```javascript
62
+ import { SyThree } from '@syhr/sy-three';
63
+
64
+ export default {
65
+ components: {
66
+ SyThree,
67
+ },
68
+ };
69
+ ```
70
+
71
+ ### 在模板中使用
72
+
73
+ ```vue
74
+ <template>
75
+ <div>
76
+ <SyThree
77
+ ref="graphRef"
78
+ :id="sceneId"
79
+ :data="sceneData"
80
+ :url="graphUrl"
81
+ :token="token"
82
+ :socketUrl="socketUrl"
83
+ @loaded="handleLoaded"
84
+ @graph-event="handleGraphEvent"
85
+ />
86
+ </div>
87
+ </template>
88
+
89
+ <script setup>
90
+ import { ref } from 'vue';
91
+ import { SyGraph } from '@syhr/sy-graph';
92
+ const sceneId = ref('');
93
+ const sceneData = ref({});
94
+ const graphRef = ref();
95
+ const graphUrl = ref('path/to/your/graph.json');
96
+ const token = ref('');
97
+ const socketUrl = ref('');
98
+
99
+ const handleLoaded = (stage) => {
100
+ console.log('Graph loaded:', stage);
101
+ // 可以通过 stage 进行图纸操作
102
+ };
103
+
104
+ // 图纸事件, 点击等
105
+ const handleGraphEvent = (errorInfo) => {
106
+ console.error('Graph error:', errorInfo);
107
+ };
108
+
109
+ // 获取实例
110
+ const getEditorInstance = () => {
111
+ graphRef.value?.getEditorInstance();
112
+ };
113
+ </script>
114
+ ```
115
+
116
+ ## Props
117
+
118
+ | 属性 | 类型 | 默认值 | 说明 |
119
+ | --------- | ------ | ------ | ------------------------ |
120
+ | data | Object | null | 场景数据,优先级最高 |
121
+ | url | String | '' | 图纸数据 URL,优先级第二 |
122
+ | id | String | '' | 图纸 ID,优先级第三 |
123
+ | token | String | '' | socket token |
124
+ | socketUrl | String | '' | socket 地址 |
125
+
126
+ ## Events
127
+
128
+ | 事件名 | 说明 | 参数 |
129
+ | ----------- | ---------------- | ------------------ |
130
+ | loaded | 图纸加载完成 | stage: Meta2D 实例 |
131
+ | graph-event | 图纸事件,点击等 | msg: 消息对象 |
132
+
133
+ ## 方法
134
+
135
+ 通过 ref 获取组件实例后可调用以下方法:
136
+
137
+ - `getEditorInstance()` - 获取编辑器实例
138
+
139
+ ## 使用场景
140
+
141
+ ### 1. 基础三维图纸展示
142
+
143
+ ```vue
144
+ <SyThree :data="graphData" />
145
+ ```
146
+
147
+ ### 2. 图纸id
148
+
149
+ ```vue
150
+ <SyThree :url="'https://ip:port/cockpit/threed/xxx.json'" />
151
+ ```
152
+
153
+ ### 3. 直接传入数据
154
+
155
+ ```vue
156
+ <SyThree :id="'111111111'" />
157
+ ```
158
+
159
+ ### 4. 完整配置示例
160
+
161
+ ```vue
162
+ <SyThree
163
+ ref="graphRef"
164
+ :id="sceneId"
165
+ :data="sceneData"
166
+ :url="graphUrl"
167
+ :token="token"
168
+ :socketUrl="socketUrl"
169
+ @loaded="handleLoaded"
170
+ @graph-event="handleGraphEvent"
171
+ />
172
+ ```
173
+
174
+ ## 浏览器支持
175
+
176
+ - Chrome >= 60
177
+ - Firefox >= 60
178
+ - Safari >= 12
179
+ - Edge >= 79
180
+
181
+ ## 开发
182
+
183
+ ```bash
184
+ # 安装依赖
185
+ npm install
186
+
187
+ # 开发模式
188
+ npm run dev
189
+
190
+ # 构建库
191
+ npm run build:lib
192
+
193
+ # 构建类型
194
+ npm run build:types
195
+
196
+ # 完整构建
197
+ npm run build:all
198
+
199
+ # 类型检查
200
+ npm run type-check
201
+
202
+ # 代码检查
203
+ npm run lint
204
+ ```
205
+
206
+ ## 许可证
207
+
208
+ [MIT](LICENSE)
209
+
210
+ ## 更新日志
211
+
212
+ 查看 [CHANGELOG.md](CHANGELOG.md) 了解详细的更新记录。
213
+
214
+ ## 贡献
215
+
216
+ 欢迎提交 Issue 和 Pull Request。
217
+
218
+ ## 相关链接
219
+
220
+ - [ThreeJs 官方文档](https://threejs.org)
221
+ - [ThreeEditor 官方文档](https://z2586300277.github.io/editor-docs/)
222
+ - [Vue 3 文档](https://vuejs.org)
223
+ - [Element Plus 文档](https://element-plus.org)
@@ -0,0 +1,51 @@
1
+ "use strict";require('./sy-three.css');var Ft=Object.defineProperty,Nt=Object.defineProperties;var Bt=Object.getOwnPropertyDescriptors;var Fe=Object.getOwnPropertySymbols;var Gt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var pe=(r,e,t)=>e in r?Ft(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,T=(r,e)=>{for(var t in e||(e={}))Gt.call(e,t)&&pe(r,t,e[t]);if(Fe)for(var t of Fe(e))Kt.call(e,t)&&pe(r,t,e[t]);return r},se=(r,e)=>Nt(r,Bt(e));var $=(r,e,t)=>pe(r,typeof e!="symbol"?e+"":e,t);var f=(r,e,t)=>new Promise((n,s)=>{var a=u=>{try{l(t.next(u))}catch(d){s(d)}},o=u=>{try{l(t.throw(u))}catch(d){s(d)}},l=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,o);l((t=t.apply(r,e)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("vue"),Vt=require("qs"),zt=require("axios");require("dayjs");const Wt=require("mitt"),De=require("pinia");require("crypto-js");const q=require("gm-crypto"),__$t__=require("lodash-es"),K=require("element-plus"),qt=require("three/examples/jsm/renderers/CSS2DRenderer.js"),P=require("three-edit-cores"),D=require("localforage");require("@element-plus/icons-vue");const Yt=require("three/addons/environments/RoomEnvironment.js"),ie={NONE:"none",WUJIE:"wujie",QIANKUN:"qiankun",MICROAPP:"microapp"},Ne={ACPOINT:{YCVALUE:"status.platform.ycvalue",YXVALUE:"status.platform.yxvalue"}};var ue={};/*!
2
+ * vite-plugin-qiankun.js v1.0.14
3
+ * (c) 2021-2022 Teng Mao Qing
4
+ * Released under the MIT License.
5
+ */Object.defineProperty(ue,"__esModule",{value:!0});var J=typeof window!="undefined"?window.proxy||window:{},ot=function(r){J!=null&&J.__POWERED_BY_QIANKUN__&&(window.moudleQiankunAppLifeCycles||(window.moudleQiankunAppLifeCycles={}),J.qiankunName&&(window.moudleQiankunAppLifeCycles[J.qiankunName]=r))};ue.default=ot;var _e=ue.qiankunWindow=J;ue.renderWithQiankun=ot;function Jt(){return window.__POWERED_BY_WUJIE__||window.$wujie?ie.WUJIE:window.__POWERED_BY_QIANKUN__||_e!=null&&_e.__POWERED_BY_QIANKUN__?ie.QIANKUN:window.__MICRO_APP_ENVIRONMENT__||window.microApp?ie.MICROAPP:ie.NONE}const jt="/";Jt();const Xt=location.origin;var Ye,Je,je,Xe,Qe,Ze,et,tt,nt,rt,st,it;const ct={savePath:((Je=(Ye=window.meta)==null?void 0:Ye.graph)==null?void 0:Je.savePath)||"/cockpit/drawing",graphPenPath:((Xe=(je=window.meta)==null?void 0:je.graph)==null?void 0:Xe.graphPenPath)||"/cockpit/graph",templatePath:((Ze=(Qe=window.meta)==null?void 0:Qe.graph)==null?void 0:Ze.templatePath)||"/cockpit/template",graphImgUploadPath:((tt=(et=window.meta)==null?void 0:et.graph)==null?void 0:tt.graphImgUploadPath)||"/cockpit/upload",threeSavePath:((rt=(nt=window.meta)==null?void 0:nt.graph)==null?void 0:rt.threeSavePath)||"/cockpit/threed",threeModelPath:((it=(st=window.meta)==null?void 0:st.graph)==null?void 0:it.threeModelPath)||"/cockpit/models"},A=zt.create({baseURL:Xt,timeout:window.meta.axios.timeout||12e4,withCredentials:!1,paramsSerializer:r=>Vt.stringify(r)});A.interceptors.request.use(r=>(r.headers["x-token"]="ewoglCJhbGcilDogpc3",r),r=>Promise.reject(r));A.interceptors.response.use(r=>{const{data:e}=r;return Promise.resolve(e)},r=>Promise.reject(r));function Qt(r,e={},t={}){return new Promise(n=>{A.get(r,T({params:e},t)).then(s=>n({res:s,err:null})).catch(s=>n({res:null,err:s}))})}function Zt(r,e={},t={}){return new Promise(n=>{A.post(r,e,t).then(s=>n({res:s,err:null})).catch(s=>n({res:null,err:s}))})}function en(r,e={},t={}){return A.get(r,T({params:e},t))}function tn(r,e={},t={}){return A.post(r,e,t)}function nn(r,e={}){return A.get(`/filehandle/${r}`,{params:e})}function rn(r,e={},t={}){return A.post(`/filehandle/${r}`,e,t)}function sn(r,e={}){return A.get(`/user/${r}`,{params:e})}function an(r,e={},t={}){return A.post(`/user/${r}`,e,t)}function on(r,e={}){return A.get(`${r}`,e.local?{params:e,baseURL:jt}:{params:e})}function cn(r,e={}){return A.get(`/media/${r}/`,{params:e})}function ln(r,e={},t={}){return A.post(`/media/${r}/`,e,t)}function un(r,e={}){return A.get(`/${window.meta.app.isFactory?window.meta.factory.singo_prefix||"acproxy/common":"common"}/${r}/`,{params:e})}function hn(r,e={},t={}){return A.post(`/${window.meta.app.isFactory?window.meta.factory.singo_prefix||"acproxy/common":"common"}/${r}/`,e,t)}function dn(r,e={}){return A.get(`/history/${r}`,{params:e})}function mn(r,e={},t={}){return A.post(`/history/${r}`,e,t)}function fn(r,e={}){return A.get(`/scada/${r}`,{params:e})}function pn(r,e={},t={}){return A.post(`/scada/${r}`,e,t)}function _n(r,e={}){return A.get(`/common/factory/${r}`,{params:e})}function En(r,e={},t={}){return A.post(`/common/factory/${r}`,e,t)}function An(r,e={}){return A.get(`/factory/${r}`,{params:e})}function gn(r,e={},t={}){return A.post(`/factory/${r}`,e,t)}function wn(r,e={}){return A.get(`/pd/${r}`,{params:e})}function Sn(r,e={},t={}){return A.post(`/pd/${r}`,e,t)}const k={getApi:Qt,postApi:Zt,getFileApi:nn,postFileApi:rn,getBaseApi:en,postBaseApi:tn,getUserApi:sn,postUserApi:an,getGraphApi:on,getMediaApi:cn,postMediaApi:ln,getScadaApi:fn,postScadaApi:pn,getCommonApi:un,postCommonApi:hn,getHistoryApi:dn,postHistoryApi:mn,getFactoryApi:An,postFactoryApi:gn,getCommonFactoryApi:_n,postCommonFactoryApi:En,getPDApi:wn,postPDApi:Sn},In=()=>{var n;const r={},e=((n=window.location.href.split("?"))==null?void 0:n[1])||"",t=new URLSearchParams(e);for(const[s,a]of t.entries())r[s]=a;return r};function Be(r){return Object.prototype.toString.call(r).slice(8,-1)}function Ae(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,r=>(r^crypto.getRandomValues(new Uint8Array(1))[0]&15>>r/4).toString(16))}const ge=Wt();class Cn{constructor(e={}){this._options=T({url:e.socketUrl,onOpen:null,onClose:null,onError:null,onMessage:null},e),this._client=null,this._isConnect=!1,this._closeClient=!1,this._retryCount=0,this._retryTimes=10,this._retryInterval=1e4,this._retryIntervalObj=null,this._initSockjs()}_initSockjs(){const{url:e,onOpen:t,onClose:n,onError:s,onMessage:a,token:o}=this._options;WebSocket!==void 0?this._client=new WebSocket(e,[o]):this.$message({type:"error",message:"当前浏览器不支持WebSocket推送!"}),this._client.onopen=l=>{this._client.readyState===WebSocket.OPEN&&(this._retryCount=0,this._isConnect=!0,this._closeClient=!1,this._retryIntervalObj&&clearInterval(this._retryIntervalObj),this._retryIntervalObj=null),t&&t(l)},this._client.onclose=l=>{!this._closeClient&&this.retryIntervalStart(),this._isConnect=!1,n&&n(l)},this._client.onerror=l=>{s&&s(l)},this._client.onmessage=l=>{a&&a(l)}}_reconnect(){if(this._retryCount===this._retryTimes){this._retryIntervalObj&&clearInterval(this._retryIntervalObj),this._retryIntervalObj=null;return}this._client=null,this._initSockjs(),this._retryCount++}retryIntervalStart(){this._closeClient=!0,this._retryIntervalObj||(this._retryIntervalObj=setInterval(()=>{this._reconnect()},this._retryInterval))}sendMsg(e){this._isConnect&&this._client.send(e)}destroy(){this._client&&(this._isConnect=!1,this._retryIntervalObj&&clearInterval(this._retryIntervalObj),this._retryIntervalObj=null,this._closeClient=!0,this._client.close(),this._client=null)}}const yn=(r,e)=>new Promise((t,n)=>{k.postApi("/filehandle/save",{path:r,data:e}).then(s=>{s.res.success?t(!0):n(!1)})});De.createPinia();(function(){if(typeof Object.id=="undefined"){var r=0;Object.id=function(e){return typeof e.__uniqueid=="undefined"&&Object.defineProperty(e,"__uniqueid",{value:++r,enumerable:!1,writable:!1}),e.__uniqueid}}})();function Rn(){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1];this.encode=function(t){var n,s,a,o,l,u;for(a=t.length,s=0,n="";s<a;){if(o=t.charCodeAt(s++)&255,s==a){n+=r.charAt(o>>2),n+=r.charAt((o&3)<<4),n+="==";break}if(l=t.charCodeAt(s++),s==a){n+=r.charAt(o>>2),n+=r.charAt((o&3)<<4|(l&240)>>4),n+=r.charAt((l&15)<<2),n+="=";break}u=t.charCodeAt(s++),n+=r.charAt(o>>2),n+=r.charAt((o&3)<<4|(l&240)>>4),n+=r.charAt((l&15)<<2|(u&192)>>6),n+=r.charAt(u&63)}return n},this.decode=function(t){var n,s,a,o,l,u,d;for(u=t.length,l=0,d="";l<u;){do n=e[t.charCodeAt(l++)&255];while(l<u&&n==-1);if(n==-1)break;do s=e[t.charCodeAt(l++)&255];while(l<u&&s==-1);if(s==-1)break;d+=String.fromCharCode(n<<2|(s&48)>>4);do{if(a=t.charCodeAt(l++)&255,a==61)return d;a=e[a]}while(l<u&&a==-1);if(a==-1)break;d+=String.fromCharCode((s&15)<<4|(a&60)>>2);do{if(o=t.charCodeAt(l++)&255,o==61)return d;o=e[o]}while(l<u&&o==-1);if(o==-1)break;d+=String.fromCharCode((a&3)<<6|o)}return d},this.utf16to8=function(t){var n,s,a,o;for(n="",a=t.length,s=0;s<a;s++)o=t.charCodeAt(s),o>=1&&o<=127?n+=t.charAt(s):o>2047?(n+=String.fromCharCode(224|o>>12&15),n+=String.fromCharCode(128|o>>6&63),n+=String.fromCharCode(128|o>>0&63)):(n+=String.fromCharCode(192|o>>6&31),n+=String.fromCharCode(128|o>>0&63));return n},this.utf8to16=function(t){var n,s,a,o,l,u;for(n="",a=t.length,s=0;s<a;)switch(o=t.charCodeAt(s++),o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=t.charAt(s-1);break;case 12:case 13:l=t.charCodeAt(s++),n+=String.fromCharCode((o&31)<<6|l&63);break;case 14:l=t.charCodeAt(s++),u=t.charCodeAt(s++),n+=String.fromCharCode((o&15)<<12|(l&63)<<6|(u&63)<<0);break}return n},this.charToHex=function(t){var n,s,a;for(n="",s=0;s<t.length;)a=t.charCodeAt(s++).toString(16),n+="\\0x"+a,n+=s>0&&s%8==0?`\r
6
+ `:", ";return n}}function Dn(){var r=0,e=new Object;this.add=function(t,n){this.containsKey(t)||r++,e[t]=n},this.getValue=function(t){return this.containsKey(t)?e[t]:null},this.remove=function(t){this.containsKey(t)&&delete e[t]&&r--},this.containsKey=function(t){return t in e},this.containsValue=function(t){for(var n in e)if(e[n]==t)return!0;return!1},this.getValues=function(){var t=[];for(var n in e)t.push(e[n]);return t},this.getKeys=function(){var t=[];for(var n in e)t.push(n);return t},this.getSize=function(){return r},this.clear=function(){r=0,e=new Object}}function vn(r){if(this.connect=!1,this.ready_func_=null,this.callbacks_=new Dn,this.module_="JS_IActiveXCtrl","WebSocket"in window)this.ws=new WebSocket("ws://127.0.0.1:7321");else throw"WebSocket not supported";this.ws.onerror=function(){throw"Unable to establish connection to WebSocket"},this.loadModule=function(){this.connect=!0;var e=JSON.stringify({MsgId:"LoadModule",Module:this.module_});this.ws.onmessage=this._callback.bind(this),this.ws.send(e)},this.loadModuleCallBack=function(e){if(!e)throw e.Response;this.ready_func_&&this.ready_func_()}.bind(this),this.callbacks_.add("LoadModule",this.loadModuleCallBack),this.exec=function(e,t,n){var s=Object.id(n).toString();this.callbacks_.add(s,n);var a={MsgId:s,Method:e+"|"+r};t&&(a.Param=JSON.stringify(t));var o=JSON.stringify(a);this.connect&&this.ws.send(o)},this.ready=function(e){this.ready_func_=e},this._callback=function(e){var t=JSON.parse(e.data),n=t.MsgId;if(this.callbacks_.containsKey(n)){var s=this.callbacks_.getValue(n);s(t.Result,t.Response),this.callbacks_.remove(n)}},this.ws.onopen=this.loadModule.bind(this),this.Arm_GetDongleInfo=function({Index:e,DongleInfoNum:t},n){this.exec("Arm_GetDongleInfo",[parseInt(e),parseInt(t)],n)},this.Arm_Enum=function(e){this.exec("Arm_Enum",null,e)},this.Arm_Open=function({Index:e},t){this.exec("Arm_Open",[parseInt(e)],t)},this.Arm_Close=function({Handle:e},t){this.exec("Arm_Close",[parseInt(e)],t)},this.Arm_VerifyPIN=function({Handle:e,UserPin:t,UserType:n},s){this.exec("Arm_VerifyPIN",[parseInt(e),n,t],s)},this.Arm_ResetState=function({Handle:e},t){this.exec("Arm_ResetState",[parseInt(e)],t)},this.Arm_GenRandom=function({Handle:e,RandomLen:t},n){this.exec("Arm_GenRandom",[parseInt(e),parseInt(t)],n)},this.Arm_LEDControl=function({Handle:e,LedFlag:t},n){this.exec("Arm_LEDControl",[parseInt(e),t],n)},this.Arm_SwitchProtocol=function({Handle:e,ProtocolFlag:t},n){this.exec("Arm_SwitchProtocol",[parseInt(e),t],n)},this.Arm_CreateFile=function({Handle:e,FileID:t,FileType:n,AttrBuffer:s},a){this.exec("Arm_CreateFile",[parseInt(e),n,parseInt(t),s],a)},this.Arm_WriteFile=function({Handle:e,FileID:t,FileType:n,FileOffset:s,DataInput:a},o){this.exec("Arm_WriteFile",[parseInt(e),n,parseInt(t),parseInt(s),a],o)},this.Arm_ReadFile0001=function({Handle:e},t){this.exec("Arm_ReadFile",[parseInt(e),parseInt("0001"),parseInt(0),parseInt("64")],t)},this.Arm_ReadFile0002=function({Handle:e},t){this.exec("Arm_ReadFile",[parseInt(e),parseInt("0002"),parseInt(0),parseInt("130")],t)},this.Arm_ReadFile0003=function({Handle:e},t){this.exec("Arm_ReadFile",[parseInt(e),parseInt("0003"),parseInt(0),parseInt("130")],t)},this.Arm_ReadFile0004=function({Handle:e},t){this.exec("Arm_ReadFile",[parseInt(e),parseInt("0004"),parseInt(0),parseInt("2048")],t)},this.Arm_ReadFile0005=function({Handle:e},t){this.exec("Arm_ReadFile",[parseInt(e),parseInt("0005"),parseInt(0),parseInt("2048")],t)},this.Arm_DownloadExeFile=function({Handle:e,Count:t,ExeFileInfo:n},s){this.exec("Arm_DownloadExeFile",[parseInt(e),parseInt(t),n],s)},this.Arm_RunExeFile=function({Handle:e,FileID:t,InData:n,DataLen:s},a){this.exec("Arm_RunExeFile",[parseInt(e),parseInt(t),n,n.length,parseInt(s)],a)},this.Arm_ReadRunExeFileData=function(e){this.exec("Arm_ReadRunExeFileData",null,e)},this.Arm_DeleteFile=function({Handle:e,FileID:t,FileType:n},s){this.exec("Arm_DeleteFile",[parseInt(e),n,parseInt(t)],s)},this.Arm_WriteData=function({Handle:e,Offset:t,DataInput:n},s){this.exec("Arm_WriteData",[parseInt(e),parseInt(t),n],s)},this.Arm_ReadData=function({Handle:e,Offset:t,ReadLength:n},s){this.exec("Arm_ReadData",[parseInt(e),parseInt(t),n],s)},this.Arm_WriteShareMemory=function({Handle:e,DataInput:t},n){this.exec("Arm_WriteShareMemory",[parseInt(e),t],n)},this.Arm_ReadShareMemory=function({Handle:e},t){this.exec("Arm_ReadShareMemory",[parseInt(e)],t)},this.Arm_GenUniqueKey=function({Handle:e,Seed:t},n){this.exec("Arm_GenUniqueKey",[parseInt(e),t.length,t],n)},this.Arm_ChangePIN=function({Handle:e,NewPIN:t,OldPIN:n,TryCount:s,PinFlag:a},o){this.exec("Arm_ChangePIN",[parseInt(e),a,n,t,parseInt(s)],o)},this.Arm_ResetUserPIN=function({Handle:e,AdminPIN:t},n){this.exec("Arm_ResetUserPIN",[parseInt(e),t],n)},this.Arm_SetUserID=function({Handle:e,UserID:t},n){this.exec("Arm_SetUserID",[parseInt(e),parseInt(t)],n)},this.Arm_GetDeadline=function({Handle:e},t){this.exec("Arm_GetDeadline",[parseInt(e)],t)},this.Arm_SetDeadline=function({Handle:e,SetDeadTime:t},n){this.exec("Arm_SetDeadline",[parseInt(e),parseInt(t)],n)},this.Arm_GetUTCTime=function({Handle:e},t){this.exec("Arm_GetUTCTime",[parseInt(e)],t)},this.Arm_RFS=function({Handle:e},t){this.exec("Arm_RFS",[parseInt(e)],t)},this.Arm_RsaGenPubPriKey=function({Handle:e,RsaFileId:t},n){this.exec("Arm_RsaGenPubPriKey",[parseInt(e),parseInt(t)],n)},this.Arm_EccGenPubPriKey=function({Handle:e,EccFileId:t},n){this.exec("Arm_EccGenPubPriKey",[parseInt(e),parseInt(t)],n)},this.Arm_Sm2GenPubPriKey=function({Handle:e,Sm2FileId:t},n){this.exec("Arm_Sm2GenPubPriKey",[parseInt(e),parseInt(t)],n)},this.Arm_ReadRsaPri=function(e){this.exec("Arm_ReadRsaPri",null,e)},this.Arm_ReadRsaPub=function(e){this.exec("Arm_ReadRsaPub",null,e)},this.Arm_ReadEccPri=function(e){this.exec("Arm_ReadEccPri",null,e)},this.Arm_ReadEccPub=function(e){this.exec("Arm_ReadEccPub",null,e)},this.Arm_ReadSm2Pri=function(e){this.exec("Arm_ReadSm2Pri",null,e)},this.Arm_ReadSm2Pub=function(e){this.exec("Arm_ReadSm2Pub",null,e)},this.Arm_RsaPri=function({Handle:e,RsaPri_Flag:t,RsaPriInData:n,RsaPriFileID:s,RsaPriFileSize:a},o){this.exec("Arm_RsaPri",[parseInt(e),parseInt(s),parseInt(a),t,n],o)},this.Arm_RsaPub=function({Handle:e,RsaPubKey:t,RsaPub_Flag:n,RsaPubInData:s,RsaPubFileSize:a},o){this.exec("Arm_RsaPub",[parseInt(e),parseInt(a),n,t,t.length,s],o)},this.Arm_EccSign=function({Handle:e,HashData:t,EccFileId:n},s){this.exec("Arm_EccSign",[parseInt(e),parseInt(n),t],s)},this.Arm_EccVerify=function({Handle:e,HashData:t,EccPubKey:n,EccSignData:s},a){this.exec("Arm_EccVerify",[parseInt(e),n,n.length,t,s],a)},this.Arm_Sm2Sign=function({Handle:e,HashData:t,Sm2FileId:n},s){this.exec("Arm_Sm2Sign",[parseInt(e),parseInt(n),t],s)},this.Arm_Sm2Verify=function({Handle:e,HashData:t,Sm2PubKey:n,Sm2SignData:s},a){this.exec("Arm_Sm2Verify",[parseInt(e),n,n.length,t,s],a)},this.Arm_TDES=function({Handle:e,Tdes_Flag:t,TdesFileID:n,TdesInData:s},a){this.exec("Arm_TDES",[parseInt(e),parseInt(n),t,s],a)},this.Arm_SM4=function({Handle:e,Sm4_Flag:t,Sm4FileID:n,Sm4InData:s},a){this.exec("Arm_SM4",[parseInt(e),parseInt(n),t,s],a)},this.Arm_HASH=function({Handle:e,Hash_Flag:t,HashInData:n},s){this.exec("Arm_HASH",[parseInt(e),t,n],s)},this.Arm_Seed=function({Handle:e,SeedData:t,SeedLength:n},s){this.exec("Arm_Seed",[parseInt(e),n,t],s)},this.Arm_LimitSeedCount=function({Handle:e,SeedCount:t},n){this.exec("Arm_LimitSeedCount",[parseInt(e),parseInt(t)],n)},this.Arm_GenMotherKey=function({Handle:e,SeedLen:t,SeedForPID:n,SonCount:s,StartUserID:a,AdminTryCount:o,UserPin:l,UserTryCount:u,UpdateRSAPriKey:d},x){this.exec("Arm_GenMotherKey",[parseInt(e),parseInt(t),n,l,parseInt(u),parseInt(o),d,parseInt(a),parseInt(s)],x)},this.Arm_RequestInit=function({Handle:e},t){this.exec("Arm_RequestInit",[parseInt(e)],t)},this.Arm_GetInitDataFromMother=function({Handle:e},t){this.exec("Arm_GetInitDataFromMother",[parseInt(e),Request],t)},this.Arm_InitSon=function({Handle:e,InitData:t},n){this.exec("Arm_InitSon",[parseInt(e),t],n)},this.Arm_SetUpdatePriKey=function({Handle:e,UpdatePriKey:t},n){this.exec("Arm_SetUpdatePriKey",[parseInt(e),t],n)},this.Arm_MakeUpdatePacket=function({Handle:e,HID:t,Func:n,FileID:s,FileType:a,Offset:o,DataLen:l,DataBuffer:u,UpRSAPubKey:d},x){this.exec("Arm_MakeUpdatePacket",[parseInt(e),t,n,a,parseInt(s),parseInt(o),u,d,parseInt(l)],x)},this.Arm_MakeUpdatePacketFromMother=function({Handle:e,HID:t,Func:n,FileID:s,FileType:a,Offset:o,DataLen:l,DataBuffer:u},d){this.exec("Arm_MakeUpdatePacketFromMother",[parseInt(e),t,n,a,parseInt(s),parseInt(o),u,parseInt(l)],d)},this.Arm_Update=function({Handle:e,UpdateData:t},n){this.exec("Arm_Update",[parseInt(e),t],n)},this.Arm_Set_DATA_FILE_ATTR=function({Size:e,ReadPriv:t,WritePriv:n},s){this.exec("Arm_Set_DATA_FILE_ATTR",[parseInt(e),parseInt(t),parseInt(n)],s)},this.Arm_Set_PRIKEY_FILE_ATTR=function({Count:e,Size:t,Type:n,Priv:s,IsReset:a,IsDecOnRAM:o},l){this.exec("Arm_Set_PRIKEY_FILE_ATTR",[n,parseInt(t),parseInt(e),parseInt(s),parseInt(o),parseInt(a)],l)},this.Arm_Set_KEY_FILE_ATTR=function({Size:e,PrivEnc:t},n){this.exec("Arm_Set_KEY_FILE_ATTR",[parseInt(e),parseInt(t)],n)},this.Arm_Set_EXE_FILE_ATTR=function({FileLen:e,PrivExe:t},n){this.exec("Arm_Set_EXE_FILE_ATTR",[parseInt(e),parseInt(t)],n)},this.Arm_Set_DATA_LIC=function({ReadPriv:e,WritePriv:t},n){this.exec("Arm_Set_DATA_LIC",[parseInt(e),parseInt(t)],n)},this.Arm_Set_PRIKEY_LIC=function({Count:e,Priv:t,IsReset:n,IsDecOnRAM:s},a){this.exec("Arm_Set_PRIKEY_LIC",[parseInt(e),parseInt(t),parseInt(s),parseInt(n)],a)},this.Arm_Set_KEY_LIC=function({PrivEnc:e},t){this.exec("Arm_Set_KEY_LIC",[parseInt(e)],t)},this.Arm_Set_EXE_LIC=function({PrivExe:e},t){this.exec("Arm_Set_EXE_LIC",[parseInt(e)],t)},this.Arm_Set_EXE_FILE_INFO=function({FileID:e,FileData:t,FileSize:n,InBuffer:s,CallLimit:a},o){this.exec("Arm_Set_EXE_FILE_INFO",[s,parseInt(n),parseInt(e),parseInt(a),t,t.length],o)},this.Arm_Clear_EXE_FILE_INFO=function({InBuffer:e},t){this.exec("Arm_Clear_EXE_FILE_INFO",[e],t)}}const xn={HID:0},ae={PRODUCT_ID:0,USER_ID:1,HARDWARE_ID:2},Ge={USER:0};class lt{constructor(){$(this,"Base64",new Rn);$(this,"AtlCtrl",null);$(this,"ArmCount",0);$(this,"ArmIndex",0);$(this,"ArmHandle",0);$(this,"ArmRandom","");try{this.AtlCtrl=new vn("{39E9B272-82A7-4177-A19D-6723C1BDB0CC}")}catch(e){console.error(e),this.AtlCtrl=null}}armEnum(){if(this.AtlCtrl)return new Promise((e,t)=>{this.AtlCtrl.Arm_Enum((n,s)=>{n?(this.ArmCount=+s,e(s)):t(s)})})}armOpen(e=0){if(this.AtlCtrl)return this.ArmIndex=e,new Promise((t,n)=>{this.AtlCtrl.Arm_Open({Index:e},(s,a)=>{s?(this.ArmHandle=+a,t(a)):(this.ArmHandle=a,n(a))})})}armClose(e=this.ArmHandle){if(this.AtlCtrl)return new Promise((t,n)=>{this.AtlCtrl.Arm_Close({Handle:e},(s,a)=>{s?t(a):n(a)})})}armChangePIN(e,t,n=255,s=Ge.USER,a=this.ArmHandle){if(this.AtlCtrl)return new Promise((o,l)=>{this.AtlCtrl.Arm_ChangePIN({Handle:a,NewPIN:e,OldPIN:t,TryCount:n,PinFlag:s},(u,d)=>{u&&d==0?(this.ArmPin=e,o(d)):l(d)})})}armGenRandom(e=16,t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl.Arm_GenRandom({Handle:t,RandomLen:e},(a,o)=>{a?(this.ArmRandom=o,n(o)):s(o)})})}armGetDeadline(e=this.ArmHandle){if(this.AtlCtrl)return new Promise((t,n)=>{this.AtlCtrl.Arm_GetDeadline({Handle:e},(s,a)=>{s?(this.ArmDeadline=a,t(a)):n(a)})})}armGenUniqueKey(e="MTIzNDU2Nzg5MA==",t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl.Arm_GenUniqueKey({Handle:t,Seed:e},(a,o)=>{a?(this.ArmUKey=o,n(o)):s(o)})})}armGetDongleInfo(e=0,t=ae.HARDWARE_ID){if(this.AtlCtrl)return this.ArmIndex=e,new Promise((n,s)=>{this.AtlCtrl.Arm_GetDongleInfo({Index:e,DongleInfoNum:t},(a,o)=>{if(a){switch(t){case ae.USER_ID:this.ArmUid=o;break;case ae.PRODUCT_ID:this.ArmPid=o;break;case ae.HARDWARE_ID:this.ArmHid=o;break}n(o)}else s(o)})})}armLEDControl(e,t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl.Arm_LEDControl({Handle:t,LedFlag:e},(a,o)=>{a&&o==0?n(o):s(o)})})}armRFS(e=this.ArmHandle){if(this.AtlCtrl)return new Promise((t,n)=>{this.AtlCtrl.Arm_RFS({Handle:e},(s,a)=>{s&&a==0?t(a):n(a)})})}armReadFile(e="0001",t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl[`Arm_ReadFile${e}`]({Handle:t},(a,o)=>{if(a&&o.length>0)try{o=this.Base64.decode(o),n(o)}catch(l){console.error(l),n(o)}else s(o)})})}armResetState(e=this.ArmHandle){if(this.AtlCtrl)return new Promise((t,n)=>{this.AtlCtrl.Arm_ResetState({Handle:e},(s,a)=>{s&&a==0?t(a):n(a)})})}armResetUserPIN(e,t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl.Arm_ResetUserPIN({Handle:t,AdminPIN:e},(a,o)=>{a&&o==0?n(o):s(o)})})}armSetUserID(e,t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl.Arm_SetUserID({Handle:t,UserID:e},(a,o)=>{a&&o==0?n(o):s(o)})})}armSetDeadline(e,t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl.Arm_SetDeadline({Handle:t,SetDeadTime:e},(a,o)=>{a&&o==0?n(o):s(o)})})}armSwitchProtocol(e=xn.HID,t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl.Arm_SwitchProtocol({Handle:t,ProtocolFlag:e},(a,o)=>{a&&o==0?n(o):s(o)})})}armVerifyPIN(e,t=Ge.USER,n=this.ArmHandle){if(this.AtlCtrl)return new Promise((s,a)=>{this.AtlCtrl.Arm_VerifyPIN({Handle:n,UserPin:e,UserType:t},(o,l)=>{o&&l==0?(this.ArmPin=e,s(l)):a(l)})})}armReadData(e=0,t=128,n=this.ArmHandle){if(this.AtlCtrl)return new Promise((s,a)=>{this.AtlCtrl.Arm_ReadData({Handle:n,Offset:e,ReadLength:t},(o,l)=>{o?(this.ArmData=l,s(l)):a(l)})})}armWriteData(e,t=0,n=this.ArmHandle){if(this.AtlCtrl)return new Promise((s,a)=>{this.AtlCtrl.Arm_WriteData({Handle:n,Offset:t,DataInput:e},(o,l)=>{o&&l==0?s(l):a(l)})})}armReadShareMemory(e=this.ArmHandle){if(this.AtlCtrl)return new Promise((t,n)=>{this.AtlCtrl.Arm_ReadShareMemory({Handle:e},(s,a)=>{s?(this.ArmData=a,t(a)):n(a)})})}armWriteShareMemory(e,t=this.ArmHandle){if(this.AtlCtrl)return new Promise((n,s)=>{this.AtlCtrl.Arm_WriteShareMemory({Handle:t,DataInput:e},(a,o)=>{a&&o==0?n(o):s(o)})})}}const ut="0123456789abcdeffedcba9876543210",ht="4b0de988570c3a0f",Tn=window.ENCRYPT;let j=Tn&&new lt;function dt(r=16,e="0123456789abcdefghijklmnopqrstuvwxyz"){let t="",n=e.length;for(;r>0;)t+=e[Math.floor(Math.random()*n)],r--;return t}function mt(){return f(this,null,function*(){return j||(j=new lt),new Promise((r,e)=>{j.armEnum().then(t=>{r(+t)}).catch(t=>{K.ElMessage({type:"warning",ElMessage:"未找到U盘锁,请检查U盘锁!"}),e(t)})})})}__$t__.throttle(()=>f(exports,null,function*(){const r=yield mt(),e={};if(typeof r!="number"||r<=0)K.ElMessage({type:"warning",ElMessage:"未找到U盘锁,请检查U盘锁!"}),e.resetToken();else{const t=yield bn();if(!e.token)return;t.length?t.includes(e.ukeyHid)||(K.ElMessage({type:"error",ElMessage:"U盘锁不匹配,请检查U盘锁!"}),e.resetToken()):(K.ElMessage({type:"warning",ElMessage:"未找到U盘锁,请检查U盘锁!"}),e.resetToken())}}),5e3,{trailing:!1});function Pn(r=0){return f(this,null,function*(){return j?new Promise((e,t)=>{j.armGetDongleInfo(r).then(n=>{n?e(n):(K.ElMessage({type:"warning",ElMessage:"U盘锁信息为空,请检查U盘锁!"}),t(n))}).catch(n=>{t(n)})}):K.ElMessage({type:"warning",ElMessage:"未找到U盘锁程序,请检查后台程序!"})})}function bn(){return f(this,null,function*(){if(!j)return K.ElMessage({type:"warning",ElMessage:"未找到U盘锁程序,请检查后台程序!"});const r=yield mt();let e=[];for(let t=0;t<r;t++){const n=yield Pn(t);e.push(n)}return e})}dt(16);dt(16);const ft=window.meta.app.inspect?q.SM4.constants.CBC:q.SM4.constants.ECB,{publicKey:Or,privateKey:Ur}=q.SM2.generateKeyPair();function Ke(r,e,t={}){const n=pt(ht),s=t.mode||ft;t=s===q.SM4.constants.ECB?T({mode:s,inputEncoding:"utf8",outputEncoding:"hex"},t):T({iv:ut,mode:s,inputEncoding:"utf8",outputEncoding:"hex"},t);let a="";try{a=q.SM4.encrypt(r,n,t)}catch(o){console.log("err: ",o)}return a}function Ve(r,e,t={}){const n=pt(ht),s=t.mode||ft;return t=s===q.SM4.constants.ECB?T({mode:s,inputEncoding:"hex",outputEncoding:"utf8"},t):T({iv:ut,mode:s,inputEncoding:"hex",outputEncoding:"utf8"},t),q.SM4.decrypt(r,n,t)}function pt(r){return[...r].map(e=>e.charCodeAt().toString(16)).join("")}const ve={getLocal:r=>{try{let e=window.localStorage.getItem(r);return e=e!==null?Ve(e):e,JSON.parse(e)}catch(e){console.error(e)}},setLocal:(r,e)=>{try{let t=JSON.stringify(e);t=t!==null?Ke(t):t,window.localStorage.setItem(r,t)}catch(t){console.error(t)}},eachLocal:r=>{if(!r||Be(r)!=="Function")return console.error("传递参数非函数类型!");for(let e=0,t=window.localStorage.length;e<t;e++){const n=window.localStorage.key(e);r((void 0).getLocal(n),n)}},clearLocal:()=>{window.localStorage.clear()},removeLocal:r=>{window.localStorage.removeItem(r)},getSession:r=>{try{let e=window.sessionStorage.getItem(r);return e=e!==null?Ve(e):e,JSON.parse(e)}catch(e){console.error(e)}},setSession:(r,e)=>{try{let t=JSON.stringify(e);t=t!==null?Ke(t):t,window.sessionStorage.setItem(r,t)}catch(t){console.error(t)}},eachSession:r=>{if(!r||Be(r)!=="Function")return console.error("传递参数非函数类型!");for(let e=0,t=window.sessionStorage.length;e<t;e++){const n=window.sessionStorage.key(e);r((void 0).getSession(n),n)}},clearSession:()=>{window.sessionStorage.clear()},removeSession:r=>{window.sessionStorage.removeItem(r)}},Ln="data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1778134039448'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1155'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M512%20512m-500.62222187%200a500.62222187%20500.62222187%200%201%200%201001.24444374%200%20500.62222187%20500.62222187%200%201%200-1001.24444374%200Z'%20fill='%231afa29'%20p-id='1156'%3e%3c/path%3e%3c/svg%3e",ze="data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1778135587292'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1657'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M512%20512m-500.62222187%200a500.62222187%20500.62222187%200%201%200%201001.24444374%200%20500.62222187%20500.62222187%200%201%200-1001.24444374%200Z'%20fill='%23808080'%20p-id='1658'%3e%3c/path%3e%3c/svg%3e",Mn="data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1778133589331'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='25776'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M377.083%20125.44c74.606-135.314%20195.292-135.314%20269.897%200l346.332%20629.394c74.606%20135.315%209.508%20245.395-145.189%20245.395H175.94c-154.697%200-219.428-109.715-145.188-245.395L377.083%20125.44z'%20fill='%23FF2D16'%20p-id='25777'%3e%3c/path%3e%3cpath%20d='M567.986%20328.046c0-31.086-25.234-55.955-55.954-55.955s-55.954%2025.235-55.954%2055.955v280.137c0%2031.086%2025.234%2055.954%2055.954%2055.954s55.954-25.234%2055.954-55.954V328.046z%20m-111.908%20448h111.908v111.908H456.078z'%20fill='%23FFFFFF'%20p-id='25778'%3e%3c/path%3e%3c/svg%3e",On={name:"局放测点",label:"局放测点",create:function(r,e){return f(this,null,function*(){const{transformControls:t}=e,n=document.createElement("div");n.style.position="relative",n.style.gap="20px";const s=document.createElement("img");s.style.objectFit="fill",s.style.width="1.3vw",s.style.height="1.3vw",s.src=ze,s.style.cursor="pointer",s.style.pointerEvents="auto",s.style.userSelect="none",n.append(s);const a=document.createElement("div");Object.assign(a.style,{position:"absolute",top:"0",left:"1.8vw",display:"none",flexDirection:"column",gap:"10px",padding:"10px",borderRadius:"4px",border:"1px solid rgba(255, 255, 255, 0.2)",backdropFilter:"blur(12px)",background:"#24262933",minWidth:"12vw"}),r.valueEleId||(r.valueEleId=Ae()),a.innerHTML=`
7
+ <div style="padding-bottom: 10px; font-size: 16px; color: #ffffff; border-bottom: 1px solid rgba(255, 113, 108, 0.5);white-space: nowrap;">${r.name}</div>
8
+ <div style="font-size: 14px; color: #cae4ff;">幅值峰值</div>
9
+ <div style="display: flex; align-items: flex-end; gap: 10px; color: #FF716C;">
10
+ <span id="${r.valueEleId}" style="font-size: 24px;font-weight: 600;">${r.value}</span>
11
+ <span style="font-size: 14px;">dBm</span>
12
+ </div>
13
+ `;const o=new qt.CSS2DObject(n);o.name=r.name,o.dataId=r.id,o.userData.params=r,s.addEventListener("mouseover",()=>{a.style.display="flex"}),s.addEventListener("mouseleave",()=>{a.style.display="none"}),s.addEventListener("click",()=>{ge.emit("three-event",{type:"pd-sensor-click",data:o}),r.preview||setTimeout(()=>{t.attach(o)},100)}),n.append(a);const l=d=>{d===0?s.src=ze:d===1?s.src=Ln:d===2&&(s.src=Mn)},u=d=>{const x=document.getElementById(r.valueEleId);x&&(x.innerText=d)};return o.changeState=l,o.changeValue=u,setTimeout(()=>{l(r.state),u(r.value)},200),o})},getStorage:function(r){return r.userData.params}};var at;D.config(T({driver:[D.INDEXEDDB,D.LOCALSTORAGE],name:"SGP7000",size:4980736,storeName:"keyvaluepairs",version:1,description:"SGP7000"},((at=window.meta.storage)==null?void 0:at.config)||{}));function Un(){return{getKey:_=>f(this,null,function*(){return yield D.key(_)}),getKeys:()=>f(this,null,function*(){return yield D.keys()}),getItem:_=>f(this,null,function*(){if(_)return yield D.getItem(_)}),setItem:(_,M)=>f(this,null,function*(){if(_)return yield D.setItem(_,M)}),removeItem:_=>f(this,null,function*(){if(_)return yield D.removeItem(_)}),clearItems:()=>f(this,null,function*(){return yield D.clear()}),iterateItems:(_,M)=>f(this,null,function*(){if(_)return yield D.iterate(_,M)}),getReady:()=>f(this,null,function*(){return yield D.ready()}),getLength:()=>f(this,null,function*(){return yield D.length()}),getDriver:()=>f(this,null,function*(){return yield D.driver()}),setDriver:_=>f(this,null,function*(){if(_)return yield D.setDriver(_)}),setConfig:_=>f(this,null,function*(){if(_)return yield D.config(_)}),dropInstance:_=>f(this,null,function*(){if(_)return yield D.dropInstance(_)}),createInstance:_=>f(this,null,function*(){if(_)return yield D.createInstance(_)})}}const Hn="THREED_LOG_BUFFER",kn="THREED_CURRSCENE",Fn="THREED_ACTIVE_MENU",Nn="THREED_PIXEL_RATIO",oe="THREED_MODEL_DBNAME",we="THREED_MODEL_DBSTORE",Bn="THREED_SCENE_PREVIEW",Se="THREED_MODEL_LOAD_KEY",ee="THREED_PREVIEW_URL_KEY",Gn="THREED_ADDON_EDITOR_JSON",Kn="THREED_SCENE_STORAGE_SUFFIX",Ie={step:.1},Vn=80,_t=30,zn=1e3,Wn=1200,$n=3e5,qn="三维测试",Yn="灯光",Jn=1,jn=["环境光","平行光","点光源","聚光灯","半球光","平面光"],Et=new Set(["syncStatus","disposeTargets","statusMaterials","syncPanelPlacement"]),Xn=["AxesHelper","GridHelper","Box3Helper","PerspectiveCamera"],At=new Set(["GridHelper","AxesHelper","CameraHelper","SpotLightHelper","PointLightHelper","TransformControls","HemisphereLightHelper","DirectionalLightHelper","TransformControlsPlane"]),gt=new Set(["CSS2DObject","CSS3DObject"]),Qn=Object.assign({"/src/views/threed/models/pd-sensor.js":On}),Zn=Object.assign({}),er={环境光:()=>new P.THREE.AmbientLight(16777215,1),平行光:()=>new P.THREE.DirectionalLight(16777215,1),点光源:()=>new P.THREE.PointLight(16777215,1,0,0),聚光灯:()=>new P.THREE.SpotLight(16777215,1,0,Math.PI/6,0,0),半球光:()=>new P.THREE.HemisphereLight(16777215,0,1),平面光:()=>new P.THREE.RectAreaLight(16777215,1,100,100)},tr=[{name:"荧光流动",commonUniforms:!0,vertex:"vUv-material",fragment:`
14
+ vec4 o = gl_FragColor.rgba;
15
+ vec2 u = gl_FragCoord.xy;
16
+ vec2 v = iResolution.xy;
17
+ vec2 uv = .2*(u+u-v)/v.y;
18
+ <UV_PLACEHOLDER>
19
+ u = uv;
20
+ vec4 z = o = vec4(1,2,3,0);
21
+ for (float a = .5, t = iTime, i;
22
+ ++i < 19.;
23
+ o += (1. + cos(z+t))
24
+ / length((1.+i*dot(v,v))
25
+ * sin(1.5*u/(.5-dot(u,u)) - 9.*u.yx + t))
26
+ )
27
+ v = cos(++t - 7.*u*pow(a += .03, i)) - 5.*u,
28
+ u += tanh(40. * dot(u *= mat2(cos(i + .02*t - vec4(0,11,33,0)))
29
+ ,u)
30
+ * cos(1e2*u.yx + t)) / 2e2
31
+ + .2 * a * u
32
+ + cos(4./exp(dot(o,o)/1e2) + t) / 3e2;
33
+
34
+ o = 25.6 / (min(o, 13.) + 164. / o)
35
+ - dot(u, u) / 250.;
36
+ vec3 col = o.rgb;
37
+ `,key:"col",commonFinish:!0,render:"iTime+speed"},{name:"太阳照射",commonUniforms:!0,vertex:"vUv-material",fragment:`
38
+ float cheap_star(vec2 uv, float anim)
39
+ {
40
+ uv = abs(uv);
41
+ vec2 pos = min(uv.xy/uv.yx, anim);
42
+ float p = (2.0 - pos.x - pos.y);
43
+ return (2.0+p*(p*p-1.5)) / (uv.x+uv.y);
44
+ }
45
+ <SPLIT_PLACEHOLDER>
46
+ vec2 uv = ( gl_FragCoord.xy - .5*iResolution.xy ) / iResolution.y;
47
+ <UV_PLACEHOLDER>
48
+ uv *= 2.0 * ( cos(iTime * 2.0) -2.5);
49
+ float anim = sin(iTime * 12.0) * 0.1 + 1.0;
50
+ vec3 col = cheap_star(uv, anim) * vec3(0.35,0.2,0.15);
51
+ `,key:"col",commonFinish:!0,render:"iTime+speed"}];let Z=null,U=null;const We=r=>(r==null?void 0:r.name)||(r==null?void 0:r.label)||"",wt=(r={})=>Object.values(r).filter(e=>e&&(e.label||e.name)),nr=wt(Qn),rr=wt(Zn),sr=()=>({THREED_GUI_PARAMS:Ie,THREED_LOG_BUFFER:Hn,THREED_CURRSCENE:kn,THREED_ACTIVE_MENU:Fn,THREED_PIXEL_RATIO:Nn,THREED_IMPORT_SIZE:Vn,THREED_LIGHT_TYPES:jn,THREED_EXPORT_BATCH:_t,THREED_RELOAD_DELAY:zn,THREED_MODEL_DBNAME:oe,THREED_MODEL_DBSTORE:we,THREED_SCENE_PREVIEW:Bn,THREED_USER_DATA_KEYS:Et,THREED_MODEL_LOAD_KEY:Se,THREED_PREVIEW_URL_KEY:ee,THREED_ADDON_EDITOR_JSON:Gn,THREED_EXPORT_NODE_COUNT:Wn,THREED_DEFAULT_SCENE_NAME:qn,THREED_DEFAULT_ACTIVE_MENU:Yn,THREED_DEFAULT_PIXEL_RATIO:Jn,THREED_EXPORT_VERTEX_COUNT:$n,THREED_SCENE_EXCLUDE_TYPES:Xn,THREED_EXPORT_EXCLUDE_TYPES:At,THREED_EXPORT_RUNTIME_TYPES:gt,THREED_SCENE_STORAGE_SUFFIX:Kn});function ir(){const{createInstance:r,dropInstance:e}=Un(),t="/";let n=[];const s=i=>{let c=URL.createObjectURL(i);return n.push(c),c},a=()=>{n.forEach(i=>URL.revokeObjectURL(i)),n=[]},o=()=>f(this,null,function*(){return yield d(),{clearRequest:l,getAllRequest:_,getRequest:F,status:!0,message:"数据库打开成功",DATABASE:U}}),l=i=>f(this,null,function*(){if(!i)return{status:!1,message:"删除失败"};yield d(),yield U.removeItem(i);const c=H();return c.list=c.list.filter(h=>h.name!==i),{status:!0,message:"删除成功"}}),u=(...c)=>f(this,[...c],function*(i=oe){U=null,Z=null,yield e({name:i,storeName:we})}),d=()=>f(this,null,function*(){return U||(Z||(Z=r({name:oe,storeName:we}).then(i=>(U=i,i))),yield Z)}),x=i=>{if(!i)return!1;const c=String(i.message||"");return i.name==="DataError"||c.includes("in-line keys")},V=()=>f(this,null,function*(){U=null,Z=null,yield e({name:oe}),yield d()}),H=()=>(window.threeEditorDB||(window.threeEditorDB={db:null,list:[]}),window.threeEditorDB),F=i=>f(this,null,function*(){if(!i)return{status:!1,message:"获取失败"};yield d();const c=yield U.getItem(i);if(c!=null&&c.blob&&!i)return{status:!0,message:"获取成功",url:s(c.blob)};if(!i)return{status:!1,message:"获取失败"};const h=yield fetch(i).then(R=>R.blob()),m={blob:h};try{yield U.setItem(i,m)}catch(R){if(!x(R))throw R;yield V(),yield U.setItem(i,m)}const g=H(),L=T({name:i},m),y=g.list.findIndex(R=>R.name===i);return y>-1?g.list.splice(y,1,L):g.list.push(L),{status:!0,message:"文件缓存成功",url:s(h)}}),_=()=>f(this,null,function*(){const i=H();yield d();const c=[];return yield U.iterate((h,m)=>{c.push(se(T({},h||{}),{name:m}))}),i.list=c,{status:!0,message:"获取成功",data:c}}),M=()=>f(this,null,function*(){const i=yield k.getApi("/filehandle/scan",{path:ct.threeModelPath,extension:"glb,gltf"}),{children:c}=i.res,h=[];if(c!=null&&c.length)for(const m of c)h.push({name:m.name,path:"/"+m.path});return h}),Y=()=>window.GUI_PARAMS||Ie,p=()=>window.threeEditor||null,E=()=>window.editorJsons||[],v=()=>({width:window.innerWidth||0,height:window.innerHeight||0}),I=()=>nr,w=()=>H(),C=()=>er||{},b=()=>window[ee]||"",N=()=>rr,O=()=>window.devicePixelRatio||1,z=()=>window[ee]||"",W=()=>{const i=I(),c=N();return{modelDesigns:i,componentDesigns:c,modelList:i.map(h=>h.label),componentList:c.map(h=>h.label)}},re=(i,c)=>{var h;return(h=i==null?void 0:i.__DESIGNS__)==null?void 0:h.find(m=>m.label===c)},he=(i=0)=>!Number.isFinite(i)||i<=0?"0 B":i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:i<1024*1024*1024?`${(i/1024/1024).toFixed(1)} MB`:`${(i/1024/1024/1024).toFixed(2)} GB`,X=i=>{const c=window[Se];typeof c=="function"&&c(i)},de=i=>!!i&&Number.isFinite(i.x)&&Number.isFinite(i.y)&&Number.isFinite(i.z),Q=i=>{var c,h;return!i||!i.visible||(c=i.userData)!=null&&c.excludeFromExport||i.isTransformControls||i.isHelper||i.isLight||i.isPoints||(h=i.type)!=null&&h.includes("Helper")||At.has(i.type)||gt.has(i.type)||i.isCSS2DObject||i.isCSS3DObject?!1:i.isMesh||i.isGroup||i.isObject3D||i.isLine},me=(i,c)=>i&&Number.isFinite(i.x)&&Number.isFinite(i.y)&&Number.isFinite(i.z)?i:c,Ct=i=>i&&Number.isFinite(i.x)&&Number.isFinite(i.y)&&Number.isFinite(i.z)&&Number.isFinite(i.w)?i:{x:0,y:0,z:0,w:1},Le=i=>{if(!(i!=null&&i.isObject3D))return;const c=me(i.position,{x:0,y:0,z:0});i.position.set(c.x,c.y,c.z);const h=me(i.scale,{x:1,y:1,z:1});i.scale.set(h.x===0?1:h.x,h.y===0?1:h.y,h.z===0?1:h.z);const m=me(i.up,{x:0,y:1,z:0});i.up.set(m.x,m.y,m.z);const g=Ct(i.quaternion);i.quaternion.set(g.x,g.y,g.z,g.w),i.pivot&&!de(i.pivot)&&delete i.pivot,i.updateMatrix(),i.updateMatrixWorld(!1)},yt=(i,c="_blank")=>window.open(i,c),Rt=(i,c="")=>window.prompt(i,c),Dt=()=>window.location.reload(),vt=()=>document.documentElement.classList.remove("dark"),xt=i=>{if(!Array.isArray(i==null?void 0:i.__DESIGNS__))return W();const c=[...I(),...N()],h=new Set(i.__DESIGNS__.map(m=>We(m)));return c.forEach(m=>{const g=We(m);!g||h.has(g)||(h.add(g),i.__DESIGNS__.unshift(m))}),W()},Tt=i=>{if(!Array.isArray(i==null?void 0:i.__GLSLLIB__))return;const c=new Set(i.__GLSLLIB__.map(h=>h==null?void 0:h.name));tr.forEach(h=>{c.has(h.name)||(c.add(h.name),i.__GLSLLIB__.push(h))})},fe=(i={})=>{const c={};return Object.entries(i||{}).forEach(([h,m])=>{if(!(Et.has(h)||typeof m=="function")){if(!m||["string","number","boolean"].includes(typeof m)){c[h]=m;return}if(Array.isArray(m)){try{c[h]=structuredClone(m)}catch(g){return}return}if(!(m.isObject3D||m.isMaterial||m.isTexture||m.nodeType))try{c[h]=structuredClone(m)}catch(g){return}}}),c},Pt=(i=Ie)=>{window.GUI_PARAMS=i},bt=i=>{window.threeEditor=i},Lt=i=>{window.threeEditorDB=i},Mt=i=>{window[Se]=i},Ot=(i="")=>{window[ee]=i},Ut=(i="")=>{window[ee]=i},Me=i=>{var h;const c=[];return(h=i==null?void 0:i.children)==null||h.forEach(m=>{Q(m)&&c.push(m)}),c},Oe=(i=[])=>{const c={rootCount:i.length,nodeCount:0,meshCount:0,vertexCount:0,skippedCount:0};return i.forEach(h=>{h.traverse(m=>{var g,L,y;if(Q(m)){c.nodeCount+=1,m.isMesh&&(c.meshCount+=1,c.vertexCount+=((y=(L=(g=m.geometry)==null?void 0:g.attributes)==null?void 0:L.position)==null?void 0:y.count)||0);return}m!==h&&(c.skippedCount+=1)})}),c},Ue=()=>new Promise(i=>requestAnimationFrame(()=>setTimeout(i,0))),He=()=>new Promise(i=>{if(typeof window.requestIdleCallback=="function"){window.requestIdleCallback(()=>i(),{timeout:80});return}setTimeout(i,0)}),Ht=(i,c)=>f(this,null,function*(){var g;if(!Q(i))return null;const h=i.clone(!1);h.userData=fe(i.userData),de(i.pivot)?h.pivot=new P.THREE.Vector3(i.pivot.x,i.pivot.y,i.pivot.z):"pivot"in h&&delete h.pivot,Le(h);const m=[{source:i,clone:h}];for(;m.length;){const L=m.shift();for(const y of L.source.children){if(!Q(y)){c.skippedCount+=1;continue}const R=y.clone(!1);R.userData=fe(y.userData),de(y.pivot)?R.pivot=new P.THREE.Vector3(y.pivot.x,y.pivot.y,y.pivot.z):"pivot"in R&&delete R.pivot,Le(R),L.clone.add(R),m.push({source:y,clone:R}),c.processedCount+=1,c.processedCount%_t===0&&(yield(g=c.onProgress)==null?void 0:g.call(c,{processedCount:c.processedCount,totalCount:c.totalCount,skippedCount:c.skippedCount,progress:18+Math.min(c.processedCount/Math.max(c.totalCount,1)*54,54)}),yield Ue())}}return h});return{baseUrl:t,getModels:M,getRequest:F,reloadPage:Dt,promptInput:Rt,waitForIdle:He,waitForPaint:Ue,clearRequest:l,getGuiParams:Y,setGuiParams:Pt,getAllRequest:_,getEditorJsons:E,getThreeEditor:p,formatFileSize:he,setThreeEditor:bt,removeDarkClass:vt,openExternalUrl:yt,getThreedModels:I,getViewportSize:v,buildExportScene:(h,...m)=>f(this,[h,...m],function*(i,c={}){const g=Me(i),L=Oe(g),y=new P.THREE.Scene,R={totalCount:L.nodeCount,processedCount:0,skippedCount:0,onProgress:c.onProgress};for(const kt of g){const ke=yield Ht(kt,R);ke&&y.add(ke),yield He()}return y.updateMatrixWorld(!0),L.skippedCount+=R.skippedCount,{exportScene:y,exportObjects:g,stats:L}}),createModelDbApi:o,getEditorPreviewSceneUrl:z,getThreeEditorDB:w,sanitizeUserData:fe,setThreeEditorDB:Lt,findThreedDesign:re,getThreedLightMap:C,collectExportStats:Oe,getPreviewSceneUrl:b,setEditorPreviewSceneUrl:Ut,setPreviewSceneUrl:Ot,setModelLoadHander:Mt,isExportableObject:Q,deleteThreeEditorDB:u,ensureThreeEditorDB:H,getDevicePixelRatio:O,getThreedComponents:N,collectExportObjects:Me,resetModelDbInstance:V,ensureModelDbInstance:d,getLocalDesignMenuData:W,invokeModelLoadHandler:X,isLegacyInlineKeyError:x,ensureThreedShaderLibrary:Tt,ensureThreedDesignRegistry:xt,createBlobUrl:s,revokeModelObjectUrls:a}}const{THREED_LOG_BUFFER:xe,THREED_CURRSCENE:ce,THREED_ACTIVE_MENU:Te,THREED_PIXEL_RATIO:Pe,THREED_SCENE_PREVIEW:be,THREED_ADDON_EDITOR_JSON:le,THREED_DEFAULT_SCENE_NAME:ar,THREED_DEFAULT_ACTIVE_MENU:Ce,THREED_DEFAULT_PIXEL_RATIO:ye,THREED_SCENE_STORAGE_SUFFIX:$e}=sr(),or=[xe,ce,Te,Pe,be,le],G=(r,e)=>{const t=ve.getLocal(r);return t==null?e:t},B=(r,e)=>{r&&ve.setLocal(r,e)},Ee=r=>{r&&ve.removeLocal(r)},cr=(r,e)=>{var n,s;const t=(n=r==null?void 0:r.trim)==null?void 0:n.call(r);return t&&e.some(a=>a.name===t)?t:((s=e[0])==null?void 0:s.name)||ar},Re=(r=[])=>Array.isArray(r)?r.filter(e=>typeof e=="string"&&e):[],qe=()=>{const r=[],e=G(ce,{name:"",path:""}),t=Number.parseFloat(G(Pe,ye));return{taskState:{busy:!1,type:"",title:"",message:"",description:"",progress:0},currScene:e,sceneList:r,previewScene:!!G(be,!1),activeMenuTitle:G(Te,Ce)||Ce,pixelRatio:Number.isFinite(t)&&t>0?t:ye,logarithmicDepthBuffer:G(xe,!0)!==!1,addonEditorJson:Re(G(le,[]))}},St=De.defineStore("threed",{state:()=>qe(),actions:{getSceneList(){return f(this,null,function*(){var e;const r=yield k.getCommonApi("threedfloorplan",{limit:1e4,ordering:"-create_time"});(e=r==null?void 0:r.data)!=null&&e.length?(this.sceneList=r.data,this.currScene.path?this.sceneList.find(n=>n.id===this.currScene.id)||this.setCurrScene({name:"",path:""}):this.setCurrScene(this.sceneList[0])):(this.sceneList=[],this.setCurrScene({name:"",path:""}))})},setSceneList(r){this.sceneList=r},setSceneName(r){this.sceneName=cr(r,this.sceneList),B(ce,this.sceneName)},createScene(r,e=""){return f(this,null,function*(){var l,u;const t=(l=r==null?void 0:r.trim)==null?void 0:l.call(r);if(!t||this.sceneList.some(d=>d.name===t))return!1;const n=ct.threeSavePath+"/"+Ae()+".json",s=Ae();if(!(yield k.postCommonApi("query/threedfloorplan/create",{data:[{name:t,path:n,guid:s}]})).success)return!1;if(yield yn(n,e)){const d=yield k.postCommonApi("threedfloorplan",{guid:s});if((u=d==null?void 0:d.data)!=null&&u.length)return this.sceneList=[...this.sceneList,d.data[0]],d.data[0]}return!0})},deleteScene(r){return f(this,null,function*(){var n;if(!r)return;if(!(yield k.postCommonApi("query/threedfloorplan/delete",{data:[r]})).success)return!1;const t=this.sceneList.findIndex(s=>s.id===r);return t===-1?!1:(this.sceneList.splice(t,1),((n=this.currScene)==null?void 0:n.id)===r&&this.setCurrScene(this.sceneList[0]||{name:"",path:""}),!0)})},setCurrScene(r){return f(this,null,function*(){this.currScene=r,B(ce,this.currScene)})},setPreviewMode(r){this.previewScene=!!r,B(be,this.previewScene)},setActiveMenuTitle(r){this.activeMenuTitle=r||Ce,B(Te,this.activeMenuTitle)},setPixelRatio(r){const e=Number.parseFloat(r);this.pixelRatio=Number.isFinite(e)&&e>0?e:ye,B(Pe,this.pixelRatio)},setLogarithmicDepthBuffer(r){this.logarithmicDepthBuffer=!!r,B(xe,this.logarithmicDepthBuffer)},getSceneStorageKey(r){return`${r||this.sceneName}${$e}`},getSceneStorageParams(r,e=null){return G(this.getSceneStorageKey(r),e)},setSceneStorageParams(r,e){r&&B(this.getSceneStorageKey(r),e)},removeSceneStorageParams(r){r&&Ee(this.getSceneStorageKey(r))},resetTaskState(){return f(this,null,function*(){yield new Promise(r=>setTimeout(r,120)),this.taskState={busy:!1,type:"",title:"",message:"",description:"",progress:0}})},getAddonEditorJson(){return this.addonEditorJson=Re(G(le,this.addonEditorJson)),this.addonEditorJson},setAddonEditorJson(r){this.addonEditorJson=Re(r),B(le,this.addonEditorJson)},clearThreedStorage(){or.forEach(e=>Ee(e)),Object.keys(window.localStorage).filter(e=>e.endsWith($e)).forEach(e=>Ee(e));const r=qe();this.currScene=r.currScene,this.sceneList=r.sceneList,this.previewScene=r.previewScene,this.activeMenuTitle=r.activeMenuTitle,this.pixelRatio=r.pixelRatio,this.logarithmicDepthBuffer=r.logarithmicDepthBuffer,this.addonEditorJson=r.addonEditorJson}}}),te=r=>{const{onClose:e,customClass:t}=r;return K.ElMessage(se(T({},r),{center:!0,customClass:`sy-message ${t||""}`,onClose:s=>{e&&e(s)}}))};["success","warning","info","error"].forEach(r=>{te[r]=e=>te(typeof e=="string"?{type:r,message:e}:se(T({},e),{type:r}))});const lr={backgroundBlurriness:0,backgroundIntensity:1,backgroundUrls:null,environmentEnabled:!1},ur={fov:50,near:.1,far:1e5,zoom:1,layers:{mask:1},filmOffset:0,filmGauge:35,position:{x:247.72931803058157,y:715.3890430349733,z:789.6794984861216}},hr={outputColorSpace:"srgb",toneMapping:0,toneMappingExposure:1,shadowMap:{enabled:!1,type:1},color:0,opacity:0,sortObjects:!0,localClippingEnabled:!1,autoClear:!0,autoClearColor:!0,renderListCompare:[{name:"stats",enabled:!0},{name:"controls",enabled:!0},{name:"scene",enabled:!0},{name:"css3DRender",enabled:!0},{name:"css2DRender",enabled:!0}]},dr={autoRotate:!1,autoRotateSpeed:2,enableDamping:!0,dampingFactor:.05,minDistance:.01,maxDistance:1e6,maxAzimuthAngle:null,minAzimuthAngle:null,maxPolarAngle:3.141592653589793,minPolarAngle:0,maxTargetRadius:null,minTargetRadius:0,enablePan:!0,panSpeed:1,enableRotate:!0,rotateSpeed:1,enableZoom:!0,zoomSpeed:1,zoomToCursor:!1,target:{x:-38.59603927643809,y:-48.97202695679889,z:-49.19814250541991}},mr={mode:"translate",space:"world",size:1,showX:!0,showY:!0,showZ:!0,translationSnap:null,rotationSnap:null,scaleSnap:null},fr={renderWay:"effectComposer",fxaaPass:{enabled:!0,order:60,multPixel:1},outlinePass:{enabled:!0,order:40,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,usePatternTexture:!1,visibleEdgeColor:16449071,hiddenEdgeColor:16449071,overlayMaterial:{blending:5,blendEquation:100,blendSrc:201,blendDst:205}},outputPass:{enabled:!0,order:50},saoPass:{enabled:!1,order:10,saoBias:.5,saoIntensity:.01,saoScale:100,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},screenMaskPass:{enabled:!1,order:70,intensity:1,maskColor:16777215,R:.2,sr:1.2},ssrPass:{enabled:!1,order:30,maxDistance:.01,distanceAttenuation:!0,opacity:.5,thickness:.018,fresnel:!0,infiniteThick:!1,bouncing:!1},unrealBloomPass:{enabled:!1,order:20,strength:1.5,radius:.4,threshold:.85}},pr={mode:"transform",openKeyEnable:!0,rightClickMenusEnable:!0,selectChildEnabled:!1,selectChildLevel:1,stats:{showStats:!1,statsMode:0},helpers:{axes:{showAxes:!0,axesLength:1e3},grid:{showGrid:!0,size:1e3,divisions:15,colorCenterLine:4473924,colorGrid:8947848},box3:{useBox3:!0,color:16776960}}},_r=[],Er=[],Ar=[],gr=[],wr=[],Sr=[],Ir={},Cr=[],yr={viewAngleList:[],clipping:{size:20,clipList:[]}},Rr={scene:lr,perspectiveCamera:ur,webglRenderer:hr,orbitControls:dr,transformControls:mr,effectComposer:fr,handler:pr,lightCores:_r,innerCores:Er,modelCores:Ar,drawCores:gr,textCores:wr,particleCores:Sr,geoCores:Ir,designCores:Cr,other:yr},It=(r,e)=>{const t=r.__vccOpts||r;for(const[n,s]of e)t[n]=s;return t},Dr=Object.assign({name:"ThreedEditor"},{__name:"editor",props:{data:{type:Object,default:()=>({})},preview:{type:Boolean,default:!1}},emits:["emit-three-editor","graph-event"],setup(r,{expose:e,emit:t}){const n=r,s=St(),{currScene:a}=De.storeToRefs(s),o=t,l=window.__SY_THREED_DRACO_PATH__||"/draco/";P.ThreeEditor.dracoPath=l.endsWith("/")?l:l+"/";let u=null,d=null;const x=S.ref(null),{setGuiParams:V,getDevicePixelRatio:H,getThreeEditorDB:F,createBlobUrl:_,revokeModelObjectUrls:M,ensureThreedDesignRegistry:Y}=ir();Y(P.ThreeEditor),V({step:.1});const p=()=>{var C;return(C=u==null?void 0:u.renderSceneResize)==null?void 0:C.call(u)},E=()=>f(this,null,function*(){var b,N;let C=Rr;try{if(n.data&&Object.keys(n.data).length)C=n.data;else if((b=a.value)!=null&&b.path){const O=yield k.getApi((N=a.value)==null?void 0:N.path).catch(()=>({}));console.log("初始化三维场景:",O),O.res&&(C=O.res)}u?u.resetEditorStorage(C):u=new P.ThreeEditor(x.value,{fps:null,pixelRatio:H()*s.pixelRatio,webglRenderParams:{antialias:!0,alpha:!0,logarithmicDepthBuffer:s.logarithmicDepthBuffer},sceneParams:v(C)})}catch(O){console.error("三维图纸初始化失败",O),u==null||u.resetEditorStorage(C)}finally{n.preview&&u&&setTimeout(()=>{u.handler.mode="none",u.handler.helpers.axes.showAxes=!1,u.handler.helpers.box3.useBox3=!1,u.handler.helpers.grid.showGrid=!1},200),I()}o("emit-three-editor",u),window.addEventListener("resize",p)}),v=C=>{M(),C.designCores.forEach(z=>{z.preview=n.preview});const b=F(),N=b.list||[],O=structuredClone(C||{});return O.modelCores=(O.modelCores||[]).filter(z=>{const W=z.modelInfo.originPath;if(W){const re=N.find(X=>X.name===W);if(!re){const X=b.db.getRequest(W);z.modelInfo.url=X.url;return}const he=_(re.blob);z.modelInfo.url=he}return!0}),O},I=()=>{u!=null&&u.renderer&&(d=new P.THREE.PMREMGenerator(u.renderer),d.compileEquirectangularShader(),u.scene.environment=d.fromScene(new Yt.RoomEnvironment).texture)},w=()=>u;return S.watch(()=>a.value.path,()=>f(this,null,function*(){E()})),S.watch(()=>n.data,()=>{E()},{deep:!0}),S.onMounted(()=>{E()}),S.onUnmounted(()=>{window.removeEventListener("resize",p),M(),u==null||u.destroySceneRender(),s.setCurrScene({name:"",path:""})}),e({getEditorInstance:w}),(C,b)=>(S.openBlock(),S.createElementBlock("div",{ref_key:"editorRef",ref:x,class:"threed-editor",onDragover:b[0]||(b[0]=S.withModifiers(()=>{},["prevent"])),onDrop:b[1]||(b[1]=S.withModifiers(()=>{},["prevent"]))},null,544))}}),vr=It(Dr,[["__scopeId","data-v-cebfdbf8"]]),xr={class:"threed-preview"},Tr={__name:"preview",props:{data:{type:Object,default:null},url:{type:String,default:""},id:{type:String,default:""},token:{type:String,default:""},socketUrl:{type:String,default:""}},emits:["loaded","graph-event"],setup(r,{expose:e,emit:t}){const n=r,s=t;let a=S.shallowRef({});const o=S.ref(),l=St(),u={};let d=null;const x=p=>{var v,I,w;if(!p)return;if((v=p==null?void 0:p.includes)!=null&&v.call(p,"token 必传"))return te({message:p,type:"warning"});const E=typeof p=="string"?JSON.parse(p):p;if((E==null?void 0:E.data)==="服务错误"||(w=(I=E==null?void 0:E.data)==null?void 0:I.includes)!=null&&w.call(I,"token is expired"))return te({message:E.data,type:"warning"});switch(E.action){case Ne.ACPOINT.YCVALUE:case Ne.ACPOINT.YXVALUE:console.warn("遥测信息");break}},V=()=>{try{d=new Cn({socketUrl:n.socketUrl,token:n.token,onMessage:x})}catch(p){console.warn("三维场景消息处理失败",p)}},H=p=>f(this,null,function*(){var v;const E=yield k.postCommonApi("queryrealtimepoint",{point_id:p.join(",")});if((v=E==null?void 0:E.data)!=null&&v.length){E.data.forEach(w=>{u[w.guid]=w.value_disp||w.value});const I=Y();p.forEach(w=>{const C=I.scene.getObjectByProperty("dataId",w);C&&(C.userData.params.state=u[w],C.userData.params.value=u[w])})}}),F=p=>{console.log("🚀 ~ handleGraphEvent:",p),s("graph-event",p)},_=p=>{var I;if(!p)return;console.log("🚀 ~ handleEditorReady:",p),n.socketUrl&&V();const E=p.saveSceneEdit();let v=[];(I=E==null?void 0:E.designCores)==null||I.forEach(w=>{w.designType==="局放测点"&&w.id&&v.push(w.id)}),v!=null&&v.length&&H(v),s("loaded",p)},M=()=>f(this,null,function*(){if(a.value&&Object.keys(a.value).length)return;const p=In(),E=n.url||p.url;if(E){const w=yield k.getApi(E).catch(()=>({}));w.res&&(a.value=w.res);return}if(!(n.id||p.id)){console.warn("三维场景渲染失败,场景id为空!");return}const I=yield k.getCommonApi("threedfloorplan",{guid:n.id});I.data.length?l.setCurrScene(I.data[0]):console.warn("三维场景渲染失败,场景id为:"+n.id+"不存在!")}),Y=()=>o.value?o.value.getEditorInstance():null;return S.watch(()=>n.data,p=>{a.value=p,M()},{deep:!0,immediate:!0}),S.watch(()=>n.id,()=>{M()},{deep:!0,immediate:!0}),S.onMounted(()=>{ge.on("three-event",F)}),S.onUnmounted(()=>{d&&d.destroy(),ge.off("three-event",F)}),e({getEditorInstance:Y}),(p,E)=>(S.openBlock(),S.createElementBlock("div",xr,[S.createVNode(vr,{ref_key:"threedEditorRef",ref:o,data:S.unref(a),preview:"",onGraphEvent:F,onEmitThreeEditor:_},null,8,["data"])]))}},ne=It(Tr,[["__scopeId","data-v-46ac6fc4"]]);ne.name||(ne.name="SyThree");const Pr=r=>{r.component(ne.name||"SyThree",ne)},br={install:Pr};exports.SyThree=ne;exports.default=br;
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.threed-editor[data-v-cebfdbf8]{position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--sc-bg-color)}.threed-preview[data-v-46ac6fc4]{width:100%;height:100%}