iflow-engine 1.3.4 → 1.4.0
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/iflow-engine.es.js
CHANGED
|
@@ -53470,7 +53470,7 @@ class D4 {
|
|
|
53470
53470
|
init() {
|
|
53471
53471
|
this.container.innerHTML = "", this.wrapper = document.createElement("div"), this.wrapper.className = "bim-engine-wrapper", this.container.appendChild(this.wrapper);
|
|
53472
53472
|
const e = document.createElement("div");
|
|
53473
|
-
e.className = "bim-engine-version", e.textContent = "v1.
|
|
53473
|
+
e.className = "bim-engine-version", e.textContent = "v1.4.0", this.wrapper.appendChild(e), this.registry.container = this.container, this.registry.wrapper = this.wrapper, this.engine = new sT(this.wrapper, this.registry), this.dialog = new Lg(this.wrapper, this.registry), this.toolbar = new Ag(this.wrapper, this.registry), this.buttonGroup = new Pg(this.wrapper, this.registry), this.rightKey = new ug(this.wrapper, this.registry), this.constructTreeBtn = new hT(this.wrapper, this.registry), this.measure = new uT(this.registry), this.sectionPlane = new fT(this.registry), this.sectionAxis = new gT(this.registry), this.sectionBox = new vT(this.registry), this.walkControl = new MT(this.registry), this.walkControl.init(), this.engineInfo = new wT(this.registry), this.engineInfo.init(), this.registry.engine3d = this.engine, this.registry.dialog = this.dialog, this.registry.toolbar = this.toolbar, this.registry.buttonGroup = this.buttonGroup, this.registry.rightKey = this.rightKey, this.registry.constructTree = this.constructTreeBtn, this.registry.measure = this.measure, this.registry.sectionPlane = this.sectionPlane, this.registry.sectionAxis = this.sectionAxis, this.registry.sectionBox = this.sectionBox, this.registry.walkControl = this.walkControl, this.registry.engineInfo = this.engineInfo, this.componentDetail = new RT(this.registry), this.registry.componentDetail = this.componentDetail, this.componentDetail.init(), this.aiChat = new IT(this.registry), this.registry.aiChat = this.aiChat, this.aiChat.init(), this.setting = new AT(this.registry), this.registry.setting = this.setting, this.setting.init(), this.updateTheme(lt.getTheme()), lt.subscribe((t) => {
|
|
53474
53474
|
this.updateTheme(t);
|
|
53475
53475
|
});
|
|
53476
53476
|
}
|
package/dist/iflow-engine.umd.js
CHANGED
|
@@ -5250,7 +5250,7 @@ void main() {
|
|
|
5250
5250
|
<span class="bim-ai-qa-answer">${this.escapeHtml(n||"")}</span>
|
|
5251
5251
|
</div>
|
|
5252
5252
|
</div>
|
|
5253
|
-
`}bindQuestionEvents(){this.messagesContainer?.querySelectorAll(".bim-ai-option").forEach(e=>{e.addEventListener("click",t=>{const n=t.currentTarget,i=n.dataset.questionId,r=n.dataset.optionId;if(i&&r){const a=this.messages.find(o=>o.id===i);a&&!a.answered&&(a.selectedOptionId=r,this.renderMessages())}})}),this.messagesContainer?.querySelectorAll(".bim-ai-option-input").forEach(e=>{e.addEventListener("input",t=>{const n=t.target,i=n.dataset.questionId;if(i){const r=this.messages.find(a=>a.id===i);r&&(r.customAnswer=n.value)}})}),this.messagesContainer?.querySelectorAll(".bim-ai-question-submit").forEach(e=>{e.addEventListener("click",t=>{const i=t.currentTarget.dataset.questionId;if(i){const r=this.messages.find(a=>a.id===i);r&&r.selectedOptionId&&(r.answered=!0,this.renderMessages(),this.options.onQuestionSubmit?.(i,r.selectedOptionId,r.customAnswer))}})})}scrollToBottom(){this.messagesContainer&&(this.messagesContainer.scrollTop=this.messagesContainer.scrollHeight)}escapeHtml(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}destroy(){this._isDestroyed||(this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.element.remove(),this._isDestroyed=!0)}}class jC{aiChat=null;registry;initialized=!1;constructor(e){this.registry=e}init(){if(this.initialized)return;const e=this.registry.wrapper;if(!e){console.warn("[AiChatManager] wrapper 不存在,无法初始化");return}this.aiChat=new XC({container:e,width:440,title:"aiChat.title",placeholder:"aiChat.placeholder",quickPrompts:[{id:"summarize",label:"aiChat.quickPrompt.summarize"},{id:"explain",label:"aiChat.quickPrompt.explain"},{id:"generate",label:"aiChat.quickPrompt.generate"}],onSend:t=>{console.log("[AiChatManager] 用户发送消息:",t),this.aiChat?.addUserMessage(t),this.registry.emit("aiChat:message-sent",{message:t})},onQuestionSubmit:(t,n,i)=>{console.log("[AiChatManager] 用户回答问题:",{questionId:t,optionId:n,customAnswer:i}),this.registry.emit("aiChat:question-answered",{questionId:t,optionId:n,customAnswer:i})},onNewChat:()=>{console.log("[AiChatManager] 新建对话"),this.registry.emit("aiChat:new-chat",{})},onHistory:()=>{console.log("[AiChatManager] 打开历史"),this.registry.emit("aiChat:history-opened",{})},onSettings:()=>{console.log("[AiChatManager] 打开设置"),this.registry.emit("aiChat:settings-opened",{})},onClose:()=>{console.log("[AiChatManager] 关闭 AI 聊天"),this.registry.emit("aiChat:closed",{}),this.registry.toolbar?.setBtnActive("aiChat",!1)}}),this.initialized=!0}show(){this.aiChat||this.init(),this.aiChat?.show(),this.registry.emit("aiChat:opened",{}),this.registry.toolbar?.setBtnActive("aiChat",!0)}hide(){this.aiChat?.hide(),this.registry.emit("aiChat:closed",{}),this.registry.toolbar?.setBtnActive("aiChat",!1)}toggle(){this.aiChat?.isVisible()?this.hide():this.show()}isVisible(){return this.aiChat?.isVisible()??!1}addUserMessage(e){return this.aiChat?.addUserMessage(e)??""}addAiMessage(e){return this.aiChat?.addAiMessage(e)??""}addStepMessage(e,t){return this.aiChat?.addStepMessage(e,t)??""}addThinkingMessage(){return this.aiChat?.addThinkingMessage()??""}addQuestionMessage(e,t,n){return this.aiChat?.addQuestionMessage(e,t,n)??""}updateMessage(e,t){this.aiChat?.updateMessage(e,t)}removeMessage(e){this.aiChat?.removeMessage(e)}clearMessages(){this.aiChat?.clearMessages()}destroy(){this.aiChat&&(this.aiChat.destroy(),this.aiChat=null),this.initialized=!1}}class qC{events=new Map;on(e,t){return this.events.has(e)||this.events.set(e,[]),this.events.get(e).push(t),()=>this.off(e,t)}off(e,t){const n=this.events.get(e);if(!n)return;const i=n.indexOf(t);i!==-1&&n.splice(i,1)}emit(e,t){const n=this.events.get(e);n&&n.forEach(i=>{try{i(t)}catch(r){console.error(`[EventEmitter] Error in listener for event "${e}":`,r)}})}clear(){this.events.clear()}}class ZC{eventEmitter=new qC;container=null;wrapper=null;toolbar=null;dialog=null;engine3d=null;buttonGroup=null;rightKey=null;constructTree=null;measure=null;walkControl=null;sectionPlane=null;sectionAxis=null;sectionBox=null;walkPath=null;walkPlanView=null;engineInfo=null;componentDetail=null;aiChat=null;setting=null;constructor(){}reset(){this.eventEmitter.clear(),this.container=null,this.wrapper=null,this.toolbar=null,this.dialog=null,this.engine3d=null,this.buttonGroup=null,this.rightKey=null,this.constructTree=null,this.measure=null,this.walkControl=null,this.sectionPlane=null,this.sectionAxis=null,this.sectionBox=null,this.walkPath=null,this.walkPlanView=null,this.engineInfo=null,this.componentDetail=null,this.aiChat=null,this.setting=null}emit(e,t){this.eventEmitter.emit(e,t)}on(e,t){return this.eventEmitter.on(e,t)}off(e,t){this.eventEmitter.off(e,t)}clearEvents(){this.eventEmitter.clear()}}class YC{container;wrapper=null;registry;toolbar=null;constructTreeBtn=null;buttonGroup=null;dialog=null;engine=null;rightKey=null;measure=null;sectionPlane=null;sectionAxis=null;sectionBox=null;walkControl=null;engineInfo=null;componentDetail=null;aiChat=null;setting=null;constructor(e,t){const n=typeof e=="string"?document.getElementById(e):e;if(!n)throw new Error("Container not found");this.container=n,this.registry=new ZC,t?.locale&&Qt.setLocale(t.locale),t?.theme&&(t.theme==="custom"?console.warn("Custom theme should be set via setCustomTheme()."):ot.setTheme(t.theme)),this.init()}emit(e,t){this.registry.emit(e,t)}on(e,t){return this.registry.on(e,t)}setLocale(e){Qt.setLocale(e)}getLocale(){return Qt.getLocale()}setTheme(e){ot.setTheme(e)}setCustomTheme(e){ot.setCustomTheme(e)}init(){this.container.innerHTML="",this.wrapper=document.createElement("div"),this.wrapper.className="bim-engine-wrapper",this.container.appendChild(this.wrapper);const e=document.createElement("div");e.className="bim-engine-version",e.textContent="v1.3.4",this.wrapper.appendChild(e),this.registry.container=this.container,this.registry.wrapper=this.wrapper,this.engine=new vC(this.wrapper,this.registry),this.dialog=new Eg(this.wrapper,this.registry),this.toolbar=new Mg(this.wrapper,this.registry),this.buttonGroup=new wg(this.wrapper,this.registry),this.rightKey=new Q0(this.wrapper,this.registry),this.constructTreeBtn=new SC(this.wrapper,this.registry),this.measure=new CC(this.registry),this.sectionPlane=new AC(this.registry),this.sectionAxis=new RC(this.registry),this.sectionBox=new IC(this.registry),this.walkControl=new kC(this.registry),this.walkControl.init(),this.engineInfo=new UC(this.registry),this.engineInfo.init(),this.registry.engine3d=this.engine,this.registry.dialog=this.dialog,this.registry.toolbar=this.toolbar,this.registry.buttonGroup=this.buttonGroup,this.registry.rightKey=this.rightKey,this.registry.constructTree=this.constructTreeBtn,this.registry.measure=this.measure,this.registry.sectionPlane=this.sectionPlane,this.registry.sectionAxis=this.sectionAxis,this.registry.sectionBox=this.sectionBox,this.registry.walkControl=this.walkControl,this.registry.engineInfo=this.engineInfo,this.componentDetail=new WC(this.registry),this.registry.componentDetail=this.componentDetail,this.componentDetail.init(),this.aiChat=new jC(this.registry),this.registry.aiChat=this.aiChat,this.aiChat.init(),this.setting=new VC(this.registry),this.registry.setting=this.setting,this.setting.init(),this.updateTheme(ot.getTheme()),ot.subscribe(t=>{this.updateTheme(t)})}updateTheme(e){this.wrapper&&(this.wrapper.style.color=e.textPrimary)}destroy(){this.toolbar?.destroy(),this.buttonGroup?.destroy(),this.engine?.destroy(),this.dialog?.destroy(),this.rightKey?.destroy(),this.measure?.destroy(),this.sectionPlane?.destroy(),this.sectionAxis?.destroy(),this.sectionBox?.destroy(),this.walkControl?.destroy(),this.aiChat?.destroy(),this.setting?.destroy(),this.container.innerHTML="",this.registry.reset()}}const $C=Object.freeze(Object.defineProperty({__proto__:null,createHomeButton:s=>({id:"home",groupId:"group-1",type:"button",label:"toolbar.home",icon:rt("主视角"),keepActive:!1,onClick:e=>{console.log("首页按钮被点击:",e.id),s.engine3d?.getEngineComponent()?.CameraGoHome()}})},Symbol.toStringTag,{value:"Module"})),KC=Object.freeze(Object.defineProperty({__proto__:null,createZoomBoxButton:s=>({id:"zoom-box",groupId:"group-1",keepActive:!1,type:"button",label:"toolbar.zoomBox",icon:rt("框选放大"),onClick:()=>{s.engine3d?.getEngineComponent()?.activateZoomBox()}})},Symbol.toStringTag,{value:"Module"})),JC=Object.freeze(Object.defineProperty({__proto__:null,createWalkMenuButton:s=>({id:"walk",groupId:"group-1",type:"button",label:"toolbar.walk",align:"vertical",icon:rt("漫游"),onClick:()=>{console.log("漫游按钮被点击"),s.walkControl?.show()}})},Symbol.toStringTag,{value:"Module"})),QC=Object.freeze(Object.defineProperty({__proto__:null,createMapButton:s=>({id:"map",groupId:"group-1",type:"button",label:"toolbar.map",align:"vertical",keepActive:!0,icon:rt("地图"),onClick:()=>{s.engine3d?.getEngineComponent()?.toggleMiniMap();const e=s.engine3d?.getEngineComponent()?.getMiniMapState()??!1;s.walkControl?.panel?.setPlanViewActive(e)}})},Symbol.toStringTag,{value:"Module"})),eT=Object.freeze(Object.defineProperty({__proto__:null,createPropertyButton:s=>({id:"property",groupId:"group-1",type:"button",label:"toolbar.property",align:"vertical",icon:rt("文档"),onClick:()=>{console.log("构件详情按钮被点击"),s.componentDetail?.show()}})},Symbol.toStringTag,{value:"Module"})),tT=Object.freeze(Object.defineProperty({__proto__:null,createSettingButton:s=>({id:"setting",groupId:"group-2",type:"button",label:"toolbar.setting",icon:rt("设置"),keepActive:!1,onClick:e=>{s?.setting?.toggle()}})},Symbol.toStringTag,{value:"Module"})),nT=Object.freeze(Object.defineProperty({__proto__:null,createInfoButton:s=>({id:"info",groupId:"group-2",type:"button",label:"toolbar.info",icon:rt("信息"),keepActive:!1,onClick:()=>{s.engineInfo?.show()}})},Symbol.toStringTag,{value:"Module"})),iT=Object.freeze(Object.defineProperty({__proto__:null,createFullscreenButton:s=>({id:"fullscreen",groupId:"group-2",type:"button",label:"toolbar.fullscreen",align:"vertical",icon:rt("全屏"),onClick:async()=>{console.log("全屏按钮被点击"),window.self!==window.top&&console.warn('检测到在 Iframe 中运行,请确保父级 iframe 标签拥有 allow="fullscreen" 属性');try{const t=document,i=!!(t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement);console.log("当前是否全屏:",i);const a=document.querySelector(".bim-engine-container")||document.body,o=a;if(i){console.log("准备退出全屏...");const l=t.exitFullscreen||t.webkitExitFullscreen||t.mozCancelFullScreen||t.msExitFullscreen;l&&(await l.call(t),console.log("退出全屏请求已发送"))}else{console.log("准备进入全屏..."),(a.style.backgroundColor===""||a.style.backgroundColor==="transparent")&&(a.style.backgroundColor="#ffffff");const l=o.requestFullscreen||o.webkitRequestFullscreen||o.mozRequestFullScreen||o.msRequestFullscreen;l?(await l.call(o,{navigationUI:"hide"}),console.log("全屏请求已发送")):(console.warn("当前浏览器不支持全屏 API"),alert("当前浏览器不支持全屏功能"))}}catch(t){console.error("全屏操作失败:",t),t&&t.message&&t.message.includes("denied")&&console.error('全屏请求被拒绝。如果是 Iframe,请检查 allow="fullscreen"。如果是自动触发,请确保由用户点击触发。')}}})},Symbol.toStringTag,{value:"Module"})),sT=Object.freeze(Object.defineProperty({__proto__:null,createMeasureButton:s=>({id:"measure",groupId:"group-1",type:"button",label:"toolbar.measure",icon:rt("测量"),keepActive:!0,onClick:e=>{e.isActive?s.measure?.show():s.measure?.destroy()}})},Symbol.toStringTag,{value:"Module"})),rT=Object.freeze(Object.defineProperty({__proto__:null,createSectionMenuButton:s=>({id:"section",groupId:"group-1",type:"menu",label:"toolbar.section",align:"vertical",icon:rt("剖切"),keepActive:!0,onClick:e=>{console.log("剖切按钮被点击:",e.id)}})},Symbol.toStringTag,{value:"Module"})),aT=Object.freeze(Object.defineProperty({__proto__:null,createSectionPlaneButton:s=>({id:"section-plane",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionPlane",icon:rt("拾曲面剖切"),onClick:e=>{console.log("拾取面剖切被点击:",e.id,"激活状态:",e.isActive),e.isActive?s.sectionPlane?.show():s.sectionPlane?.hide()}})},Symbol.toStringTag,{value:"Module"})),oT=Object.freeze(Object.defineProperty({__proto__:null,createSectionAxisButton:s=>({id:"section-axis",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionAxis",icon:rt("轴向剖切"),onClick:e=>{e.isActive?s.sectionAxis?.show():s.sectionAxis?.destroy()}})},Symbol.toStringTag,{value:"Module"})),lT=Object.freeze(Object.defineProperty({__proto__:null,createSectionBoxButton:s=>({id:"section-box",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionBox",icon:rt("剖切盒"),onClick:e=>{console.log("剖切盒被点击:",e.id,"激活状态:",e.isActive),e.isActive?s.sectionBox?.show():s.sectionBox?.hide()}})},Symbol.toStringTag,{value:"Module"})),cT=Object.freeze(Object.defineProperty({__proto__:null,createAiChatButton:s=>(s.on("aiChat:opened",()=>{s.toolbar?.setBtnActive("aiChat",!0)}),s.on("aiChat:closed",()=>{s.toolbar?.setBtnActive("aiChat",!1)}),{id:"aiChat",groupId:"group-2",type:"button",label:"aiChat.title",align:"vertical",keepActive:!0,icon:rt("bot"),onClick:()=>{s.aiChat?.toggle()}})},Symbol.toStringTag,{value:"Module"})),hT=Object.freeze(Object.defineProperty({__proto__:null,createCameraSwitchButton:s=>({id:"camera-switch",groupId:"group-1",type:"button",label:"toolbar.cameraSwitch",icon:rt("透视相机"),keepActive:!1,onClick:()=>{const e=s.engine3d?.getEngineComponent();if(!e)return;e.switchCamera();const t=e.getCameraType(),n=rt(t==="orthographic"?"正交相机":"透视相机");s.toolbar?.updateButtonIcon("camera-switch",n)}})},Symbol.toStringTag,{value:"Module"})),dT=Object.freeze(Object.defineProperty({__proto__:null,default:`# BIM引擎AI助手 - 需求分析与步骤规划专家\r
|
|
5253
|
+
`}bindQuestionEvents(){this.messagesContainer?.querySelectorAll(".bim-ai-option").forEach(e=>{e.addEventListener("click",t=>{const n=t.currentTarget,i=n.dataset.questionId,r=n.dataset.optionId;if(i&&r){const a=this.messages.find(o=>o.id===i);a&&!a.answered&&(a.selectedOptionId=r,this.renderMessages())}})}),this.messagesContainer?.querySelectorAll(".bim-ai-option-input").forEach(e=>{e.addEventListener("input",t=>{const n=t.target,i=n.dataset.questionId;if(i){const r=this.messages.find(a=>a.id===i);r&&(r.customAnswer=n.value)}})}),this.messagesContainer?.querySelectorAll(".bim-ai-question-submit").forEach(e=>{e.addEventListener("click",t=>{const i=t.currentTarget.dataset.questionId;if(i){const r=this.messages.find(a=>a.id===i);r&&r.selectedOptionId&&(r.answered=!0,this.renderMessages(),this.options.onQuestionSubmit?.(i,r.selectedOptionId,r.customAnswer))}})})}scrollToBottom(){this.messagesContainer&&(this.messagesContainer.scrollTop=this.messagesContainer.scrollHeight)}escapeHtml(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}destroy(){this._isDestroyed||(this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.element.remove(),this._isDestroyed=!0)}}class jC{aiChat=null;registry;initialized=!1;constructor(e){this.registry=e}init(){if(this.initialized)return;const e=this.registry.wrapper;if(!e){console.warn("[AiChatManager] wrapper 不存在,无法初始化");return}this.aiChat=new XC({container:e,width:440,title:"aiChat.title",placeholder:"aiChat.placeholder",quickPrompts:[{id:"summarize",label:"aiChat.quickPrompt.summarize"},{id:"explain",label:"aiChat.quickPrompt.explain"},{id:"generate",label:"aiChat.quickPrompt.generate"}],onSend:t=>{console.log("[AiChatManager] 用户发送消息:",t),this.aiChat?.addUserMessage(t),this.registry.emit("aiChat:message-sent",{message:t})},onQuestionSubmit:(t,n,i)=>{console.log("[AiChatManager] 用户回答问题:",{questionId:t,optionId:n,customAnswer:i}),this.registry.emit("aiChat:question-answered",{questionId:t,optionId:n,customAnswer:i})},onNewChat:()=>{console.log("[AiChatManager] 新建对话"),this.registry.emit("aiChat:new-chat",{})},onHistory:()=>{console.log("[AiChatManager] 打开历史"),this.registry.emit("aiChat:history-opened",{})},onSettings:()=>{console.log("[AiChatManager] 打开设置"),this.registry.emit("aiChat:settings-opened",{})},onClose:()=>{console.log("[AiChatManager] 关闭 AI 聊天"),this.registry.emit("aiChat:closed",{}),this.registry.toolbar?.setBtnActive("aiChat",!1)}}),this.initialized=!0}show(){this.aiChat||this.init(),this.aiChat?.show(),this.registry.emit("aiChat:opened",{}),this.registry.toolbar?.setBtnActive("aiChat",!0)}hide(){this.aiChat?.hide(),this.registry.emit("aiChat:closed",{}),this.registry.toolbar?.setBtnActive("aiChat",!1)}toggle(){this.aiChat?.isVisible()?this.hide():this.show()}isVisible(){return this.aiChat?.isVisible()??!1}addUserMessage(e){return this.aiChat?.addUserMessage(e)??""}addAiMessage(e){return this.aiChat?.addAiMessage(e)??""}addStepMessage(e,t){return this.aiChat?.addStepMessage(e,t)??""}addThinkingMessage(){return this.aiChat?.addThinkingMessage()??""}addQuestionMessage(e,t,n){return this.aiChat?.addQuestionMessage(e,t,n)??""}updateMessage(e,t){this.aiChat?.updateMessage(e,t)}removeMessage(e){this.aiChat?.removeMessage(e)}clearMessages(){this.aiChat?.clearMessages()}destroy(){this.aiChat&&(this.aiChat.destroy(),this.aiChat=null),this.initialized=!1}}class qC{events=new Map;on(e,t){return this.events.has(e)||this.events.set(e,[]),this.events.get(e).push(t),()=>this.off(e,t)}off(e,t){const n=this.events.get(e);if(!n)return;const i=n.indexOf(t);i!==-1&&n.splice(i,1)}emit(e,t){const n=this.events.get(e);n&&n.forEach(i=>{try{i(t)}catch(r){console.error(`[EventEmitter] Error in listener for event "${e}":`,r)}})}clear(){this.events.clear()}}class ZC{eventEmitter=new qC;container=null;wrapper=null;toolbar=null;dialog=null;engine3d=null;buttonGroup=null;rightKey=null;constructTree=null;measure=null;walkControl=null;sectionPlane=null;sectionAxis=null;sectionBox=null;walkPath=null;walkPlanView=null;engineInfo=null;componentDetail=null;aiChat=null;setting=null;constructor(){}reset(){this.eventEmitter.clear(),this.container=null,this.wrapper=null,this.toolbar=null,this.dialog=null,this.engine3d=null,this.buttonGroup=null,this.rightKey=null,this.constructTree=null,this.measure=null,this.walkControl=null,this.sectionPlane=null,this.sectionAxis=null,this.sectionBox=null,this.walkPath=null,this.walkPlanView=null,this.engineInfo=null,this.componentDetail=null,this.aiChat=null,this.setting=null}emit(e,t){this.eventEmitter.emit(e,t)}on(e,t){return this.eventEmitter.on(e,t)}off(e,t){this.eventEmitter.off(e,t)}clearEvents(){this.eventEmitter.clear()}}class YC{container;wrapper=null;registry;toolbar=null;constructTreeBtn=null;buttonGroup=null;dialog=null;engine=null;rightKey=null;measure=null;sectionPlane=null;sectionAxis=null;sectionBox=null;walkControl=null;engineInfo=null;componentDetail=null;aiChat=null;setting=null;constructor(e,t){const n=typeof e=="string"?document.getElementById(e):e;if(!n)throw new Error("Container not found");this.container=n,this.registry=new ZC,t?.locale&&Qt.setLocale(t.locale),t?.theme&&(t.theme==="custom"?console.warn("Custom theme should be set via setCustomTheme()."):ot.setTheme(t.theme)),this.init()}emit(e,t){this.registry.emit(e,t)}on(e,t){return this.registry.on(e,t)}setLocale(e){Qt.setLocale(e)}getLocale(){return Qt.getLocale()}setTheme(e){ot.setTheme(e)}setCustomTheme(e){ot.setCustomTheme(e)}init(){this.container.innerHTML="",this.wrapper=document.createElement("div"),this.wrapper.className="bim-engine-wrapper",this.container.appendChild(this.wrapper);const e=document.createElement("div");e.className="bim-engine-version",e.textContent="v1.4.0",this.wrapper.appendChild(e),this.registry.container=this.container,this.registry.wrapper=this.wrapper,this.engine=new vC(this.wrapper,this.registry),this.dialog=new Eg(this.wrapper,this.registry),this.toolbar=new Mg(this.wrapper,this.registry),this.buttonGroup=new wg(this.wrapper,this.registry),this.rightKey=new Q0(this.wrapper,this.registry),this.constructTreeBtn=new SC(this.wrapper,this.registry),this.measure=new CC(this.registry),this.sectionPlane=new AC(this.registry),this.sectionAxis=new RC(this.registry),this.sectionBox=new IC(this.registry),this.walkControl=new kC(this.registry),this.walkControl.init(),this.engineInfo=new UC(this.registry),this.engineInfo.init(),this.registry.engine3d=this.engine,this.registry.dialog=this.dialog,this.registry.toolbar=this.toolbar,this.registry.buttonGroup=this.buttonGroup,this.registry.rightKey=this.rightKey,this.registry.constructTree=this.constructTreeBtn,this.registry.measure=this.measure,this.registry.sectionPlane=this.sectionPlane,this.registry.sectionAxis=this.sectionAxis,this.registry.sectionBox=this.sectionBox,this.registry.walkControl=this.walkControl,this.registry.engineInfo=this.engineInfo,this.componentDetail=new WC(this.registry),this.registry.componentDetail=this.componentDetail,this.componentDetail.init(),this.aiChat=new jC(this.registry),this.registry.aiChat=this.aiChat,this.aiChat.init(),this.setting=new VC(this.registry),this.registry.setting=this.setting,this.setting.init(),this.updateTheme(ot.getTheme()),ot.subscribe(t=>{this.updateTheme(t)})}updateTheme(e){this.wrapper&&(this.wrapper.style.color=e.textPrimary)}destroy(){this.toolbar?.destroy(),this.buttonGroup?.destroy(),this.engine?.destroy(),this.dialog?.destroy(),this.rightKey?.destroy(),this.measure?.destroy(),this.sectionPlane?.destroy(),this.sectionAxis?.destroy(),this.sectionBox?.destroy(),this.walkControl?.destroy(),this.aiChat?.destroy(),this.setting?.destroy(),this.container.innerHTML="",this.registry.reset()}}const $C=Object.freeze(Object.defineProperty({__proto__:null,createHomeButton:s=>({id:"home",groupId:"group-1",type:"button",label:"toolbar.home",icon:rt("主视角"),keepActive:!1,onClick:e=>{console.log("首页按钮被点击:",e.id),s.engine3d?.getEngineComponent()?.CameraGoHome()}})},Symbol.toStringTag,{value:"Module"})),KC=Object.freeze(Object.defineProperty({__proto__:null,createZoomBoxButton:s=>({id:"zoom-box",groupId:"group-1",keepActive:!1,type:"button",label:"toolbar.zoomBox",icon:rt("框选放大"),onClick:()=>{s.engine3d?.getEngineComponent()?.activateZoomBox()}})},Symbol.toStringTag,{value:"Module"})),JC=Object.freeze(Object.defineProperty({__proto__:null,createWalkMenuButton:s=>({id:"walk",groupId:"group-1",type:"button",label:"toolbar.walk",align:"vertical",icon:rt("漫游"),onClick:()=>{console.log("漫游按钮被点击"),s.walkControl?.show()}})},Symbol.toStringTag,{value:"Module"})),QC=Object.freeze(Object.defineProperty({__proto__:null,createMapButton:s=>({id:"map",groupId:"group-1",type:"button",label:"toolbar.map",align:"vertical",keepActive:!0,icon:rt("地图"),onClick:()=>{s.engine3d?.getEngineComponent()?.toggleMiniMap();const e=s.engine3d?.getEngineComponent()?.getMiniMapState()??!1;s.walkControl?.panel?.setPlanViewActive(e)}})},Symbol.toStringTag,{value:"Module"})),eT=Object.freeze(Object.defineProperty({__proto__:null,createPropertyButton:s=>({id:"property",groupId:"group-1",type:"button",label:"toolbar.property",align:"vertical",icon:rt("文档"),onClick:()=>{console.log("构件详情按钮被点击"),s.componentDetail?.show()}})},Symbol.toStringTag,{value:"Module"})),tT=Object.freeze(Object.defineProperty({__proto__:null,createSettingButton:s=>({id:"setting",groupId:"group-2",type:"button",label:"toolbar.setting",icon:rt("设置"),keepActive:!1,onClick:e=>{s?.setting?.toggle()}})},Symbol.toStringTag,{value:"Module"})),nT=Object.freeze(Object.defineProperty({__proto__:null,createInfoButton:s=>({id:"info",groupId:"group-2",type:"button",label:"toolbar.info",icon:rt("信息"),keepActive:!1,onClick:()=>{s.engineInfo?.show()}})},Symbol.toStringTag,{value:"Module"})),iT=Object.freeze(Object.defineProperty({__proto__:null,createFullscreenButton:s=>({id:"fullscreen",groupId:"group-2",type:"button",label:"toolbar.fullscreen",align:"vertical",icon:rt("全屏"),onClick:async()=>{console.log("全屏按钮被点击"),window.self!==window.top&&console.warn('检测到在 Iframe 中运行,请确保父级 iframe 标签拥有 allow="fullscreen" 属性');try{const t=document,i=!!(t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement);console.log("当前是否全屏:",i);const a=document.querySelector(".bim-engine-container")||document.body,o=a;if(i){console.log("准备退出全屏...");const l=t.exitFullscreen||t.webkitExitFullscreen||t.mozCancelFullScreen||t.msExitFullscreen;l&&(await l.call(t),console.log("退出全屏请求已发送"))}else{console.log("准备进入全屏..."),(a.style.backgroundColor===""||a.style.backgroundColor==="transparent")&&(a.style.backgroundColor="#ffffff");const l=o.requestFullscreen||o.webkitRequestFullscreen||o.mozRequestFullScreen||o.msRequestFullscreen;l?(await l.call(o,{navigationUI:"hide"}),console.log("全屏请求已发送")):(console.warn("当前浏览器不支持全屏 API"),alert("当前浏览器不支持全屏功能"))}}catch(t){console.error("全屏操作失败:",t),t&&t.message&&t.message.includes("denied")&&console.error('全屏请求被拒绝。如果是 Iframe,请检查 allow="fullscreen"。如果是自动触发,请确保由用户点击触发。')}}})},Symbol.toStringTag,{value:"Module"})),sT=Object.freeze(Object.defineProperty({__proto__:null,createMeasureButton:s=>({id:"measure",groupId:"group-1",type:"button",label:"toolbar.measure",icon:rt("测量"),keepActive:!0,onClick:e=>{e.isActive?s.measure?.show():s.measure?.destroy()}})},Symbol.toStringTag,{value:"Module"})),rT=Object.freeze(Object.defineProperty({__proto__:null,createSectionMenuButton:s=>({id:"section",groupId:"group-1",type:"menu",label:"toolbar.section",align:"vertical",icon:rt("剖切"),keepActive:!0,onClick:e=>{console.log("剖切按钮被点击:",e.id)}})},Symbol.toStringTag,{value:"Module"})),aT=Object.freeze(Object.defineProperty({__proto__:null,createSectionPlaneButton:s=>({id:"section-plane",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionPlane",icon:rt("拾曲面剖切"),onClick:e=>{console.log("拾取面剖切被点击:",e.id,"激活状态:",e.isActive),e.isActive?s.sectionPlane?.show():s.sectionPlane?.hide()}})},Symbol.toStringTag,{value:"Module"})),oT=Object.freeze(Object.defineProperty({__proto__:null,createSectionAxisButton:s=>({id:"section-axis",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionAxis",icon:rt("轴向剖切"),onClick:e=>{e.isActive?s.sectionAxis?.show():s.sectionAxis?.destroy()}})},Symbol.toStringTag,{value:"Module"})),lT=Object.freeze(Object.defineProperty({__proto__:null,createSectionBoxButton:s=>({id:"section-box",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionBox",icon:rt("剖切盒"),onClick:e=>{console.log("剖切盒被点击:",e.id,"激活状态:",e.isActive),e.isActive?s.sectionBox?.show():s.sectionBox?.hide()}})},Symbol.toStringTag,{value:"Module"})),cT=Object.freeze(Object.defineProperty({__proto__:null,createAiChatButton:s=>(s.on("aiChat:opened",()=>{s.toolbar?.setBtnActive("aiChat",!0)}),s.on("aiChat:closed",()=>{s.toolbar?.setBtnActive("aiChat",!1)}),{id:"aiChat",groupId:"group-2",type:"button",label:"aiChat.title",align:"vertical",keepActive:!0,icon:rt("bot"),onClick:()=>{s.aiChat?.toggle()}})},Symbol.toStringTag,{value:"Module"})),hT=Object.freeze(Object.defineProperty({__proto__:null,createCameraSwitchButton:s=>({id:"camera-switch",groupId:"group-1",type:"button",label:"toolbar.cameraSwitch",icon:rt("透视相机"),keepActive:!1,onClick:()=>{const e=s.engine3d?.getEngineComponent();if(!e)return;e.switchCamera();const t=e.getCameraType(),n=rt(t==="orthographic"?"正交相机":"透视相机");s.toolbar?.updateButtonIcon("camera-switch",n)}})},Symbol.toStringTag,{value:"Module"})),dT=Object.freeze(Object.defineProperty({__proto__:null,default:`# BIM引擎AI助手 - 需求分析与步骤规划专家\r
|
|
5254
5254
|
\r
|
|
5255
5255
|
## 角色定位\r
|
|
5256
5256
|
\r
|