"use strict";exports.__esModule=!0,exports.default=void 0;var _extension=require("../../core/extension"),_constant=require("../../common/constant"),_CSS2DRenderer=require("three/examples/jsm/renderers/CSS2DRenderer"),_default=exports.default=(0,_extension.definePlugin)("css2d",{setup(a,b){const c=b.container,d=new _CSS2DRenderer.CSS2DRenderer;d.setSize(c.offsetWidth,c.offsetHeight),d.domElement.style.position="absolute",d.domElement.style.top="0",d.domElement.style.left="0px",d.domElement.style.pointerEvents="none";let e=a=>{d.domElement.addEventListener(a,a=>{a.stopPropagation(),a.preventDefault()})};[_constant.ModelMouseEvent.Blur,_constant.ModelMouseEvent.Hover,_constant.ModelMouseEvent.Mousemove,_constant.ModelMouseEvent.ContextMenu].forEach(a=>e(a)),c.append(d.domElement);const f=b.renderer.onResize((a,b)=>{d.setSize(a,b)});return{css2DRenderer:d,dispose:()=>{f(),d.domElement.remove()},update:()=>{d.render(b.scene,b.camera)},add:a=>{b.scene.add(a)}}},render(){this.update()},destroyed(){this.dispose()}});