zyf-model-engine 0.3.0 → 0.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/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";var Ba=Object.defineProperty;var Ra=(o,e,i)=>e in o?Ba(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i;var L=(o,e,i)=>(Ra(o,typeof e!="symbol"?e+"":e,i),i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("vue"),f=require("three"),Oa=require("three/examples/jsm/controls/OrbitControls.js"),Oe=require("@tweenjs/tween.js"),Po=require("three/examples/jsm/renderers/CSS2DRenderer.js"),Da=require("jszip"),Ee=require("element-plus"),Vo=require("@element-plus/icons-vue"),ft=require("three/examples/jsm/lines/Line2.js"),kn=require("three/examples/jsm/lines/LineGeometry.js"),Na=require("three/examples/jsm/lines/LineMaterial.js"),Pa=require("three/src/extras/core/ShapePath.js"),pn=require("three/src/extras/ShapeUtils.js");function Va(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const i in o)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(o,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:()=>o[i]})}}return e.default=o,Object.freeze(e)}const Se=Va(f);let Ws=function(o,e){e===void 0&&(console.warn('THREE.FlyControls: The second parameter "domElement" is now mandatory.'),e=document),this.object=o,this.domElement=e,e&&this.domElement.setAttribute("tabindex",-1),this.movementSpeed=3,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this.enabled=!0;let i=this,r={type:"change"},a=1e-6;this.tmpQuaternion=new f.Quaternion,this.mouseStatus=0,this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this.moveVector=new f.Vector3(0,0,0),this.rotationVector=new f.Vector3(0,0,0),this.movementSpeedMultiplier=1,this.keydown=function(b){if(this.enabled&&!b.altKey){switch(b.keyCode){case 32:this.movementSpeedMultiplier=5;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1;break}this.updateMovementVector(),this.updateRotationVector()}},this.keyup=function(b){if(this.enabled){switch(b.keyCode){case 32:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0;break}this.updateMovementVector(),this.updateRotationVector()}};let l=null;this.dolly=function(b){this.enabled&&(b.deltaY<0?(this.moveState.forward=1,this.moveState.back=0):(this.moveState.back=1,this.moveState.forward=0),this.updateMovementVector(),this.updateRotationVector(),clearTimeout(l),l=setTimeout(()=>{this.moveState.forward=0,this.moveState.back=0,this.updateMovementVector(),this.updateRotationVector()},10))},this.mousedown=function(b){if(this.enabled)if(this.domElement!==document&&this.domElement.focus(),b.preventDefault(),b.stopPropagation(),this.dragToLook)this.mouseStatus++;else{switch(b.button){case 0:this.moveState.forward=1;break;case 2:this.moveState.back=1;break}this.updateMovementVector()}},this.mousemove=function(b){if(this.enabled&&(!this.dragToLook||this.mouseStatus>0)){let C=this.getContainerDimensions(),T=C.size[0]/2,A=C.size[1]/2;this.moveState.yawLeft=-(b.pageX-C.offset[0]-T)/T,this.moveState.pitchDown=(b.pageY-C.offset[1]-A)/A,this.updateRotationVector()}},this.mouseup=function(b){if(this.enabled){if(b.preventDefault(),b.stopPropagation(),this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else{switch(b.button){case 0:this.moveState.forward=0;break;case 2:this.moveState.back=0;break}this.updateMovementVector()}this.updateRotationVector()}},this.mouseout=function(){this.enabled&&(this.mouseStatus=0)},this.update=function(){let b=new f.Quaternion,C=new f.Vector3;return function(T){if(!i.enabled)return;let A=T*i.movementSpeed*i.movementSpeedMultiplier,O=T*i.rollSpeed;i.object.translateX(i.moveVector.x*A),i.object.translateY(i.moveVector.y*A),i.object.translateZ(i.moveVector.z*A),i.tmpQuaternion.set(i.rotationVector.x*O,i.rotationVector.y*O,i.rotationVector.z*O,1).normalize(),i.object.quaternion.multiply(i.tmpQuaternion),(C.distanceToSquared(i.object.position)>a||8*(1-b.dot(i.object.quaternion))>a)&&(i.dispatchEvent(r),b.copy(i.object.quaternion),C.copy(i.object.position))}}(),this.updateMovementVector=function(){let b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right,this.moveVector.y=-this.moveState.down+this.moveState.up,this.moveVector.z=-b+this.moveState.back},this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp,this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft,this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft},this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};function c(b,C){return function(){C.apply(b,arguments)}}function h(b){b.preventDefault()}this.dispose=function(){this.domElement.removeEventListener("contextmenu",h,!1),this.domElement.removeEventListener("mousedown",u,!1),this.domElement.removeEventListener("mousemove",p,!1),this.domElement.removeEventListener("mouseup",d,!1),this.domElement.removeEventListener("mouseout",m,!1),this.domElement.removeEventListener("wheel",x,!1),window.removeEventListener("keydown",v,!1),window.removeEventListener("keyup",g,!1)};let p=c(this,this.mousemove),u=c(this,this.mousedown),d=c(this,this.mouseup),m=c(this,this.mouseout),v=c(this,this.keydown),g=c(this,this.keyup),x=c(this,this.dolly);this.domElement.addEventListener("contextmenu",h,!1),this.domElement.addEventListener("mousemove",p,!1),this.domElement.addEventListener("mousedown",u,!1),this.domElement.addEventListener("mouseup",d,!1),this.domElement.addEventListener("mouseout",m,!1),this.domElement.addEventListener("wheel",x,!1),window.addEventListener("keydown",v,!1),window.addEventListener("keyup",g,!1),this.updateMovementVector(),this.updateRotationVector()};Ws.prototype=Object.create(f.EventDispatcher.prototype);Ws.prototype.constructor=Ws;let Xs=function(o,e,i){i===void 0&&(console.warn('THREE.FirstPersonControls: The second parameter "domElement" is now mandatory.'),i=document),this.object=o,this.domElement=i,this.camera=e,this.enabled=!0,this.target=new f.Vector3,this.movementSpeed=1,this.lookSpeed=1,this.lookVertical=!0,this.activeLook=!0,this.enableZoom=!0,this.autoForward=!1,this.heightSpeed=!1,this.heightCoef=1,this.heightMin=0,this.heightMax=1,this.constrainVertical=!1,this.verticalMin=0,this.verticalMax=Math.PI,this.mouseDragOn=!1,this.autoSpeedFactor=0,this.mouseX=0,this.mouseY=0,this.moveForward=!1,this.moveBackward=!1,this.moveLeft=!1,this.moveRight=!1,this.viewHalfX=0,this.viewHalfY=0,this.rotate=!1,this.start=new f.Vector2,this.end=new f.Vector2,this.delta=new f.Vector2,this.radius=1,this.lat=90,this.lon=0,this.zoomMax=50,this.zoomMin=10,this.zoomspeed=1,this.meshs=[];let r=new f.Vector3,a=new f.Spherical,l=new f.Vector3,c=!0;const h=this,p=new f.Raycaster,u=new f.Vector3(0,-1,0),d=new f.Vector3;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1),this.handleResize=function(){this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2)},this.onMouseDown=function(I){this.enabled&&(this.domElement!==document&&this.domElement.focus(),this.domElement===document?(this.mouseX=I.pageX-this.viewHalfX,this.mouseY=I.pageY-this.viewHalfY):(this.mouseX=I.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=I.pageY-this.domElement.offsetTop-this.viewHalfY),I.stopPropagation(),this.activeLook&&I.button===0&&(this.rotate=!0,this.start.set(this.mouseX,this.mouseY),this.end.set(this.mouseX,this.mouseY),this.delta.set(0,0)),this.mouseDragOn=!0)},this.onMouseUp=function(I){this.enabled&&(I.preventDefault(),I.stopPropagation(),this.activeLook&&(this.domElement===document?(this.mouseX=I.pageX-this.viewHalfX,this.mouseY=I.pageY-this.viewHalfY):(this.mouseX=I.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=I.pageY-this.domElement.offsetTop-this.viewHalfY),I.button===0&&(this.rotate=!1,this.start.set(this.mouseX,this.mouseY),this.end.set(this.mouseX,this.mouseY),this.delta.set(0,0))),this.mouseDragOn=!1)},this.onMouseMove=function(I){this.enabled&&(this.domElement===document?(this.mouseX=I.pageX-this.viewHalfX,this.mouseY=I.pageY-this.viewHalfY):(this.mouseX=I.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=I.pageY-this.domElement.offsetTop-this.viewHalfY),this.rotate&&(this.end.set(this.mouseX,this.mouseY),this.delta.subVectors(this.end,this.start),this.start.set(this.mouseX,this.mouseY)))},this.onmouseOut=function(I){I.preventDefault(),this.rotate=!1,this.delta.set(0,0),this.mouseDragOn=!1},this.onMouseWheel=I=>{this.enabled===!1||this.enableZoom===!1||(I.preventDefault(),I.stopPropagation(),g.call(this,I.deltaY))},this.onKeyDown=function(I){if(this.enabled)switch(I.keyCode){case 38:case 87:this.moveForward=!0,c=!1;break;case 37:case 65:this.moveLeft=!0,c=!1;break;case 40:case 83:this.moveBackward=!0,c=!1;break;case 39:case 68:this.moveRight=!0,c=!1;break;case 82:this.moveUp=!0,c=!1;break;case 70:this.moveDown=!0,c=!1;break;case 32:this.object.position.y+=5;break}};function m(){d.copy(h.object.position),d.y-=.8,p.set(d,u);const I=p.intersectObjects(h.meshs,!1);I.length>0&&(I[0].distance>0&&I[0].distance>.08?h.object.position.y-=.08:(h.object.position.copy(I[0].point),h.object.position.y+=.81))}this.onKeyUp=function(I){if(this.enabled){switch(I.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1;break}c=!0}},this.lookAt=function(I,G,X){return I.isVector3?l.copy(I):l.set(I,G,X),this.object.lookAt(l),R(this),this},this.update=function(){let I=new f.Vector3,G=new f.Vector3;return function(j){if(this.enabled===!1)return;let z=j*this.movementSpeed;const J=this.object.position.y;this.moveForward&&this.object.translateZ(z),this.moveBackward&&this.object.translateZ(-z),this.moveLeft&&this.object.translateX(z),this.moveRight&&this.object.translateX(-z),this.object.position.y=J,this.moveUp&&this.object.translateY(z),this.moveDown&&this.object.translateY(-z),c&&m();let Q=1;this.constrainVertical&&(Q=Math.PI/(this.verticalMax-this.verticalMin)),this.lon+=this.delta.x*this.lookSpeed,this.lookVertical&&(this.lat+=Q*this.delta.y*this.lookSpeed),this.lat=Math.max(-85,Math.min(85,this.lat));let de=f.MathUtils.degToRad(90-this.lat),ie=f.MathUtils.degToRad(this.lon);this.constrainVertical&&(de=f.MathUtils.mapLinear(de,0,Math.PI,this.verticalMin,this.verticalMax));let me=this.object.position;I.setFromSphericalCoords(this.radius,de,ie).add(me),G.setFromSphericalCoords(this.radius,1.5707963267948966,ie).add(me),this.target.copy(I),this.object.lookAt(G);const W=new f.Vector3().subVectors(me,I);W.setLength(1.5),W.add(me),this.camera.position.copy(W),this.camera.lookAt(me),this.camera.updateProjectionMatrix(),this.delta.set(0,0),this.dispatchEvent({type:"change"})}}();function v(I){I.preventDefault()}const g=function(I){const G=this.camera.getFocalLength();I<0?this.camera.setFocalLength(G+this.zoomspeed<this.zoomMax?G+this.zoomspeed:this.zoomMax):this.camera.setFocalLength(G-this.zoomspeed>this.zoomMin?G-this.zoomspeed:this.zoomMin),this.camera.updateProjectionMatrix()};this.dispose=function(){this.domElement.removeEventListener("contextmenu",v,!1),this.domElement.removeEventListener("mousedown",b,!1),this.domElement.removeEventListener("mousemove",x,!1),this.domElement.removeEventListener("mouseup",C,!1),window.removeEventListener("keydown",T,!1),window.removeEventListener("keyup",A,!1)};let x=V(this,this.onMouseMove),b=V(this,this.onMouseDown),C=V(this,this.onMouseUp),T=V(this,this.onKeyDown),A=V(this,this.onKeyUp),O=V(this,this.onmouseOut),P=V(this,this.onMouseWheel);this.domElement.addEventListener("contextmenu",v,!1),this.domElement.addEventListener("mousemove",x,!1),this.domElement.addEventListener("mousedown",b,!1),this.domElement.addEventListener("mouseup",C,!1),this.domElement.addEventListener("mouseout",O,!1),this.domElement.addEventListener("wheel",P,!1),window.addEventListener("keydown",T,!1),window.addEventListener("keyup",A,!1);function V(I,G){return function(){G.apply(I,arguments)}}function R(I){let G=I.object.quaternion;r.set(0,0,-1).applyQuaternion(G),a.setFromVector3(r),h.lat=90-f.MathUtils.radToDeg(a.phi),h.lon=f.MathUtils.radToDeg(a.theta)}this.handleResize(),R(this)};Xs.prototype=Object.create(f.EventDispatcher.prototype);Xs.prototype.constructor=Xs;let Fo=function(){function o(w){f.Loader.call(this,w),this.dracoLoader=null,this.ddsLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.imageJson=null,this.register(function(E){return new c(E)}),this.register(function(E){return new p(E)}),this.register(function(E){return new u(E)}),this.register(function(E){return new h(E)}),this.register(function(E){return new a(E)}),this.register(function(E){return new d(E)})}o.prototype=Object.assign(Object.create(f.Loader.prototype),{constructor:o,load:function(w,E,M,S){let k=this,D;this.resourcePath!==""?D=this.resourcePath:this.path!==""?D=this.path:D=f.LoaderUtils.extractUrlBase(w),this.manager.itemStart(w);let B=function(F){S?S(F):console.error(F),k.manager.itemError(w),k.manager.itemEnd(w)},_=new f.FileLoader(this.manager);_.setPath(this.path),_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setWithCredentials(this.withCredentials),_.load(w,function(F){try{k.parse(F,D,function(H){E(H),k.manager.itemEnd(w)},B)}catch(H){B(H)}},M,B)},setDRACOLoader:function(w){return this.dracoLoader=w,this},setDDSLoader:function(w){return this.ddsLoader=w,this},setKTX2Loader:function(w){return this.ktx2Loader=w,this},setMeshoptDecoder:function(w){return this.meshoptDecoder=w,this},register:function(w){return this.pluginCallbacks.indexOf(w)===-1&&this.pluginCallbacks.push(w),this},unregister:function(w){return this.pluginCallbacks.indexOf(w)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(w),1),this},setImageJson:function(w){return this.imageJson=w,this},parse:function(w,E,M,S){let k,D={},B={};if(typeof w=="string")k=w;else if(f.LoaderUtils.decodeText(new Uint8Array(w,0,4))===m){try{D[i.KHR_BINARY_GLTF]=new x(w)}catch(U){S&&S(U);return}k=D[i.KHR_BINARY_GLTF].content}else k=f.LoaderUtils.decodeText(new Uint8Array(w));let _=JSON.parse(k);if(_.asset===void 0||_.asset.version[0]<2){S&&S(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let F=new te(_,{path:E||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder},this.imageJson);F.fileLoader.setRequestHeader(this.requestHeader);for(let H=0;H<this.pluginCallbacks.length;H++){let U=this.pluginCallbacks[H](F);B[U.name]=U,D[U.name]=!0}if(_.extensionsUsed)for(let H=0;H<_.extensionsUsed.length;++H){let U=_.extensionsUsed[H],Y=_.extensionsRequired||[];switch(U){case i.KHR_MATERIALS_UNLIT:D[U]=new l;break;case i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:D[U]=new A;break;case i.KHR_DRACO_MESH_COMPRESSION:D[U]=new b(_,this.dracoLoader);break;case i.MSFT_TEXTURE_DDS:D[U]=new r(this.ddsLoader);break;case i.KHR_TEXTURE_TRANSFORM:D[U]=new C;break;case i.KHR_MESH_QUANTIZATION:D[U]=new O;break;default:Y.indexOf(U)>=0&&B[U]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+U+'".')}}F.setExtensions(D),F.setPlugins(B),F.parse(M,S)}});function e(){let w={};return{get:function(E){return w[E]},add:function(E,M){w[E]=M},remove:function(E){delete w[E]},removeAll:function(){w={}}}}let i={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function r(w){if(!w)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=i.MSFT_TEXTURE_DDS,this.ddsLoader=w}function a(w){this.parser=w,this.name=i.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}a.prototype._markDefs=function(){let w=this.parser,E=this.parser.json.nodes||[];for(let M=0,S=E.length;M<S;M++){let k=E[M];k.extensions&&k.extensions[this.name]&&k.extensions[this.name].light!==void 0&&w._addNodeRef(this.cache,k.extensions[this.name].light)}},a.prototype._loadLight=function(w){let E=this.parser,M="light:"+w,S=E.cache.get(M);if(S)return S;let k=E.json,_=((k.extensions&&k.extensions[this.name]||{}).lights||[])[w],F,H=new f.Color(16777215);_.color!==void 0&&H.fromArray(_.color);let U=_.range!==void 0?_.range:0;switch(_.type){case"directional":F=new f.DirectionalLight(H),F.target.position.set(0,0,-1),F.add(F.target);break;case"point":F=new f.PointLight(H),F.distance=U;break;case"spot":F=new f.SpotLight(H),F.distance=U,_.spot=_.spot||{},_.spot.innerConeAngle=_.spot.innerConeAngle!==void 0?_.spot.innerConeAngle:0,_.spot.outerConeAngle=_.spot.outerConeAngle!==void 0?_.spot.outerConeAngle:Math.PI/4,F.angle=_.spot.outerConeAngle,F.penumbra=1-_.spot.innerConeAngle/_.spot.outerConeAngle,F.target.position.set(0,0,-1),F.add(F.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+_.type)}return F.position.set(0,0,0),F.decay=2,_.intensity!==void 0&&(F.intensity=_.intensity),F.name=E.createUniqueName(_.name||"light_"+w),S=Promise.resolve(F),E.cache.add(M,S),S},a.prototype.createNodeAttachment=function(w){let E=this,M=this.parser,k=M.json.nodes[w],B=(k.extensions&&k.extensions[this.name]||{}).light;return B===void 0?null:this._loadLight(B).then(function(_){return M._getNodeRef(E.cache,B,_)})};function l(){this.name=i.KHR_MATERIALS_UNLIT}l.prototype.getMaterialType=function(){return f.MeshBasicMaterial},l.prototype.extendParams=function(w,E,M){let S=[];w.color=new f.Color(1,1,1),w.opacity=1;let k=E.pbrMetallicRoughness;if(k){if(Array.isArray(k.baseColorFactor)){let D=k.baseColorFactor;w.color.fromArray(D),w.opacity=D[3]}k.baseColorTexture!==void 0&&S.push(M.assignTexture(w,"map",k.baseColorTexture))}return Promise.all(S)};function c(w){this.parser=w,this.name=i.KHR_MATERIALS_CLEARCOAT}c.prototype.getMaterialType=function(w){let M=this.parser.json.materials[w];return!M.extensions||!M.extensions[this.name]?null:f.MeshPhysicalMaterial},c.prototype.extendMaterialParams=function(w,E){let M=this.parser,S=M.json.materials[w];if(!S.extensions||!S.extensions[this.name])return Promise.resolve();let k=[],D=S.extensions[this.name];if(D.clearcoatFactor!==void 0&&(E.clearcoat=D.clearcoatFactor),D.clearcoatTexture!==void 0&&k.push(M.assignTexture(E,"clearcoatMap",D.clearcoatTexture)),D.clearcoatRoughnessFactor!==void 0&&(E.clearcoatRoughness=D.clearcoatRoughnessFactor),D.clearcoatRoughnessTexture!==void 0&&k.push(M.assignTexture(E,"clearcoatRoughnessMap",D.clearcoatRoughnessTexture)),D.clearcoatNormalTexture!==void 0&&(k.push(M.assignTexture(E,"clearcoatNormalMap",D.clearcoatNormalTexture)),D.clearcoatNormalTexture.scale!==void 0)){let B=D.clearcoatNormalTexture.scale;E.clearcoatNormalScale=new f.Vector2(B,B)}return Promise.all(k)};function h(w){this.parser=w,this.name=i.KHR_MATERIALS_TRANSMISSION}h.prototype.getMaterialType=function(w){let M=this.parser.json.materials[w];return!M.extensions||!M.extensions[this.name]?null:f.MeshPhysicalMaterial},h.prototype.extendMaterialParams=function(w,E){let M=this.parser,S=M.json.materials[w];if(!S.extensions||!S.extensions[this.name])return Promise.resolve();let k=[],D=S.extensions[this.name];return D.transmissionFactor!==void 0&&(E.transmission=D.transmissionFactor),D.transmissionTexture!==void 0&&k.push(M.assignTexture(E,"transmissionMap",D.transmissionTexture)),Promise.all(k)};function p(w){this.parser=w,this.name=i.KHR_TEXTURE_BASISU}p.prototype.loadTexture=function(w){let E=this.parser,M=E.json,S=M.textures[w];if(!S.extensions||!S.extensions[this.name])return null;let k=S.extensions[this.name],D=M.images[k.source],B=E.options.ktx2Loader;if(!B){if(M.extensionsRequired&&M.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return E.loadTextureImage(w,D,B)};function u(w){this.parser=w,this.name=i.EXT_TEXTURE_WEBP,this.isSupported=null}u.prototype.loadTexture=function(w){let E=this.name,M=this.parser,S=M.json,k=S.textures[w];if(!k.extensions||!k.extensions[E])return null;let D=k.extensions[E],B=S.images[D.source],_=B.uri?M.options.manager.getHandler(B.uri):M.textureLoader;return this.detectSupport().then(function(F){if(F)return M.loadTextureImage(w,B,_);if(S.extensionsRequired&&S.extensionsRequired.indexOf(E)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return M.loadTexture(w)})},u.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise(function(w){let E=new Image;E.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",E.onload=E.onerror=function(){w(E.height===1)}})),this.isSupported};function d(w){this.name=i.EXT_MESHOPT_COMPRESSION,this.parser=w}d.prototype.loadBufferView=function(w){let E=this.parser.json,M=E.bufferViews[w];if(M.extensions&&M.extensions[this.name]){let S=M.extensions[this.name],k=this.parser.getDependency("buffer",S.buffer),D=this.parser.options.meshoptDecoder;if(!D||!D.supported){if(E.extensionsRequired&&E.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([k,D.ready]).then(function(B){let _=S.byteOffset||0,F=S.byteLength||0,H=S.count,U=S.byteStride,Y=new ArrayBuffer(H*U),oe=new Uint8Array(B[0],_,F);return D.decodeGltfBuffer(new Uint8Array(Y),H,U,oe,S.mode,S.filter),Y})}else return null};let m="glTF",v=12,g={JSON:1313821514,BIN:5130562};function x(w){this.name=i.KHR_BINARY_GLTF,this.content=null,this.body=null;let E=new DataView(w,0,v);if(this.header={magic:f.LoaderUtils.decodeText(new Uint8Array(w.slice(0,4))),version:E.getUint32(4,!0),length:E.getUint32(8,!0)},this.header.magic!==m)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let M=new DataView(w,v),S=0;for(;S<M.byteLength;){let k=M.getUint32(S,!0);S+=4;let D=M.getUint32(S,!0);if(S+=4,D===g.JSON){let B=new Uint8Array(w,v+S,k);this.content=f.LoaderUtils.decodeText(B)}else if(D===g.BIN){let B=v+S;this.body=w.slice(B,B+k)}S+=k}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}function b(w,E){if(!E)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=i.KHR_DRACO_MESH_COMPRESSION,this.json=w,this.dracoLoader=E,this.dracoLoader.preload()}b.prototype.decodePrimitive=function(w,E){let M=this.json,S=this.dracoLoader,k=w.extensions[this.name].bufferView,D=w.extensions[this.name].attributes,B={},_={},F={};for(let H in D){let U=j[H]||H.toLowerCase();B[U]=D[H]}for(attributeName in w.attributes){let H=j[attributeName]||attributeName.toLowerCase();if(D[attributeName]!==void 0){let U=M.accessors[w.attributes[attributeName]],Y=R[U.componentType];F[H]=Y,_[H]=U.normalized===!0}}return E.getDependency("bufferView",k).then(function(H){return new Promise(function(U){S.decodeDracoFile(H,function(Y){for(let oe in Y.attributes){let he=Y.attributes[oe],re=_[oe];re!==void 0&&(he.normalized=re)}U(Y)},B,F)})})};function C(){this.name=i.KHR_TEXTURE_TRANSFORM}C.prototype.extendTexture=function(w,E){return w=w.clone(),E.offset!==void 0&&w.offset.fromArray(E.offset),E.rotation!==void 0&&(w.rotation=E.rotation),E.scale!==void 0&&w.repeat.fromArray(E.scale),E.texCoord!==void 0&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),w.needsUpdate=!0,w};function T(w){f.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;let E=["#ifdef USE_SPECULARMAP"," uniform sampler2D specularMap;","#endif"].join(`
1
+ "use strict";var Ba=Object.defineProperty;var Ra=(o,e,i)=>e in o?Ba(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i;var L=(o,e,i)=>(Ra(o,typeof e!="symbol"?e+"":e,i),i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("vue"),f=require("three"),Oa=require("three/examples/jsm/controls/OrbitControls.js"),De=require("@tweenjs/tween.js"),Po=require("three/examples/jsm/renderers/CSS2DRenderer.js"),Da=require("jszip"),Se=require("element-plus"),Vo=require("@element-plus/icons-vue"),ft=require("three/examples/jsm/lines/Line2.js"),kn=require("three/examples/jsm/lines/LineGeometry.js"),Na=require("three/examples/jsm/lines/LineMaterial.js"),Pa=require("three/src/extras/core/ShapePath.js"),pn=require("three/src/extras/ShapeUtils.js");function Va(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const i in o)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(o,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:()=>o[i]})}}return e.default=o,Object.freeze(e)}const Te=Va(f);let Xs=function(o,e){e===void 0&&(console.warn('THREE.FlyControls: The second parameter "domElement" is now mandatory.'),e=document),this.object=o,this.domElement=e,e&&this.domElement.setAttribute("tabindex",-1),this.movementSpeed=3,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this.enabled=!0;let i=this,r={type:"change"},a=1e-6;this.tmpQuaternion=new f.Quaternion,this.mouseStatus=0,this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this.moveVector=new f.Vector3(0,0,0),this.rotationVector=new f.Vector3(0,0,0),this.movementSpeedMultiplier=1,this.keydown=function(b){if(this.enabled&&!b.altKey){switch(b.keyCode){case 32:this.movementSpeedMultiplier=5;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1;break}this.updateMovementVector(),this.updateRotationVector()}},this.keyup=function(b){if(this.enabled){switch(b.keyCode){case 32:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0;break}this.updateMovementVector(),this.updateRotationVector()}};let l=null;this.dolly=function(b){this.enabled&&(b.deltaY<0?(this.moveState.forward=1,this.moveState.back=0):(this.moveState.back=1,this.moveState.forward=0),this.updateMovementVector(),this.updateRotationVector(),clearTimeout(l),l=setTimeout(()=>{this.moveState.forward=0,this.moveState.back=0,this.updateMovementVector(),this.updateRotationVector()},10))},this.mousedown=function(b){if(this.enabled)if(this.domElement!==document&&this.domElement.focus(),b.preventDefault(),b.stopPropagation(),this.dragToLook)this.mouseStatus++;else{switch(b.button){case 0:this.moveState.forward=1;break;case 2:this.moveState.back=1;break}this.updateMovementVector()}},this.mousemove=function(b){if(this.enabled&&(!this.dragToLook||this.mouseStatus>0)){let C=this.getContainerDimensions(),T=C.size[0]/2,A=C.size[1]/2;this.moveState.yawLeft=-(b.pageX-C.offset[0]-T)/T,this.moveState.pitchDown=(b.pageY-C.offset[1]-A)/A,this.updateRotationVector()}},this.mouseup=function(b){if(this.enabled){if(b.preventDefault(),b.stopPropagation(),this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else{switch(b.button){case 0:this.moveState.forward=0;break;case 2:this.moveState.back=0;break}this.updateMovementVector()}this.updateRotationVector()}},this.mouseout=function(){this.enabled&&(this.mouseStatus=0)},this.update=function(){let b=new f.Quaternion,C=new f.Vector3;return function(T){if(!i.enabled)return;let A=T*i.movementSpeed*i.movementSpeedMultiplier,O=T*i.rollSpeed;i.object.translateX(i.moveVector.x*A),i.object.translateY(i.moveVector.y*A),i.object.translateZ(i.moveVector.z*A),i.tmpQuaternion.set(i.rotationVector.x*O,i.rotationVector.y*O,i.rotationVector.z*O,1).normalize(),i.object.quaternion.multiply(i.tmpQuaternion),(C.distanceToSquared(i.object.position)>a||8*(1-b.dot(i.object.quaternion))>a)&&(i.dispatchEvent(r),b.copy(i.object.quaternion),C.copy(i.object.position))}}(),this.updateMovementVector=function(){let b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right,this.moveVector.y=-this.moveState.down+this.moveState.up,this.moveVector.z=-b+this.moveState.back},this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp,this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft,this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft},this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};function c(b,C){return function(){C.apply(b,arguments)}}function h(b){b.preventDefault()}this.dispose=function(){this.domElement.removeEventListener("contextmenu",h,!1),this.domElement.removeEventListener("mousedown",u,!1),this.domElement.removeEventListener("mousemove",p,!1),this.domElement.removeEventListener("mouseup",d,!1),this.domElement.removeEventListener("mouseout",m,!1),this.domElement.removeEventListener("wheel",x,!1),window.removeEventListener("keydown",v,!1),window.removeEventListener("keyup",y,!1)};let p=c(this,this.mousemove),u=c(this,this.mousedown),d=c(this,this.mouseup),m=c(this,this.mouseout),v=c(this,this.keydown),y=c(this,this.keyup),x=c(this,this.dolly);this.domElement.addEventListener("contextmenu",h,!1),this.domElement.addEventListener("mousemove",p,!1),this.domElement.addEventListener("mousedown",u,!1),this.domElement.addEventListener("mouseup",d,!1),this.domElement.addEventListener("mouseout",m,!1),this.domElement.addEventListener("wheel",x,!1),window.addEventListener("keydown",v,!1),window.addEventListener("keyup",y,!1),this.updateMovementVector(),this.updateRotationVector()};Xs.prototype=Object.create(f.EventDispatcher.prototype);Xs.prototype.constructor=Xs;let Zs=function(o,e,i){i===void 0&&(console.warn('THREE.FirstPersonControls: The second parameter "domElement" is now mandatory.'),i=document),this.object=o,this.domElement=i,this.camera=e,this.enabled=!0,this.target=new f.Vector3,this.movementSpeed=1,this.lookSpeed=1,this.lookVertical=!0,this.activeLook=!0,this.enableZoom=!0,this.autoForward=!1,this.heightSpeed=!1,this.heightCoef=1,this.heightMin=0,this.heightMax=1,this.constrainVertical=!1,this.verticalMin=0,this.verticalMax=Math.PI,this.mouseDragOn=!1,this.autoSpeedFactor=0,this.mouseX=0,this.mouseY=0,this.moveForward=!1,this.moveBackward=!1,this.moveLeft=!1,this.moveRight=!1,this.viewHalfX=0,this.viewHalfY=0,this.rotate=!1,this.start=new f.Vector2,this.end=new f.Vector2,this.delta=new f.Vector2,this.radius=1,this.lat=90,this.lon=0,this.zoomMax=50,this.zoomMin=10,this.zoomspeed=1,this.meshs=[];let r=new f.Vector3,a=new f.Spherical,l=new f.Vector3,c=!0;const h=this,p=new f.Raycaster,u=new f.Vector3(0,-1,0),d=new f.Vector3;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1),this.handleResize=function(){this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2)},this.onMouseDown=function(I){this.enabled&&(this.domElement!==document&&this.domElement.focus(),this.domElement===document?(this.mouseX=I.pageX-this.viewHalfX,this.mouseY=I.pageY-this.viewHalfY):(this.mouseX=I.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=I.pageY-this.domElement.offsetTop-this.viewHalfY),I.stopPropagation(),this.activeLook&&I.button===0&&(this.rotate=!0,this.start.set(this.mouseX,this.mouseY),this.end.set(this.mouseX,this.mouseY),this.delta.set(0,0)),this.mouseDragOn=!0)},this.onMouseUp=function(I){this.enabled&&(I.preventDefault(),I.stopPropagation(),this.activeLook&&(this.domElement===document?(this.mouseX=I.pageX-this.viewHalfX,this.mouseY=I.pageY-this.viewHalfY):(this.mouseX=I.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=I.pageY-this.domElement.offsetTop-this.viewHalfY),I.button===0&&(this.rotate=!1,this.start.set(this.mouseX,this.mouseY),this.end.set(this.mouseX,this.mouseY),this.delta.set(0,0))),this.mouseDragOn=!1)},this.onMouseMove=function(I){this.enabled&&(this.domElement===document?(this.mouseX=I.pageX-this.viewHalfX,this.mouseY=I.pageY-this.viewHalfY):(this.mouseX=I.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=I.pageY-this.domElement.offsetTop-this.viewHalfY),this.rotate&&(this.end.set(this.mouseX,this.mouseY),this.delta.subVectors(this.end,this.start),this.start.set(this.mouseX,this.mouseY)))},this.onmouseOut=function(I){I.preventDefault(),this.rotate=!1,this.delta.set(0,0),this.mouseDragOn=!1},this.onMouseWheel=I=>{this.enabled===!1||this.enableZoom===!1||(I.preventDefault(),I.stopPropagation(),y.call(this,I.deltaY))},this.onKeyDown=function(I){if(this.enabled)switch(I.keyCode){case 38:case 87:this.moveForward=!0,c=!1;break;case 37:case 65:this.moveLeft=!0,c=!1;break;case 40:case 83:this.moveBackward=!0,c=!1;break;case 39:case 68:this.moveRight=!0,c=!1;break;case 82:this.moveUp=!0,c=!1;break;case 70:this.moveDown=!0,c=!1;break;case 32:this.object.position.y+=5;break}};function m(){d.copy(h.object.position),d.y-=.8,p.set(d,u);const I=p.intersectObjects(h.meshs,!1);I.length>0&&(I[0].distance>0&&I[0].distance>.08?h.object.position.y-=.08:(h.object.position.copy(I[0].point),h.object.position.y+=.81))}this.onKeyUp=function(I){if(this.enabled){switch(I.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1;break}c=!0}},this.lookAt=function(I,G,W){return I.isVector3?l.copy(I):l.set(I,G,W),this.object.lookAt(l),B(this),this},this.update=function(){let I=new f.Vector3,G=new f.Vector3;return function(j){if(this.enabled===!1)return;let H=j*this.movementSpeed;const ee=this.object.position.y;this.moveForward&&this.object.translateZ(H),this.moveBackward&&this.object.translateZ(-H),this.moveLeft&&this.object.translateX(H),this.moveRight&&this.object.translateX(-H),this.object.position.y=ee,this.moveUp&&this.object.translateY(H),this.moveDown&&this.object.translateY(-H),c&&m();let $=1;this.constrainVertical&&($=Math.PI/(this.verticalMax-this.verticalMin)),this.lon+=this.delta.x*this.lookSpeed,this.lookVertical&&(this.lat+=$*this.delta.y*this.lookSpeed),this.lat=Math.max(-85,Math.min(85,this.lat));let de=f.MathUtils.degToRad(90-this.lat),ie=f.MathUtils.degToRad(this.lon);this.constrainVertical&&(de=f.MathUtils.mapLinear(de,0,Math.PI,this.verticalMin,this.verticalMax));let me=this.object.position;I.setFromSphericalCoords(this.radius,de,ie).add(me),G.setFromSphericalCoords(this.radius,1.5707963267948966,ie).add(me),this.target.copy(I),this.object.lookAt(G);const re=new f.Vector3().subVectors(me,I);re.setLength(1.5),re.add(me),this.camera.position.copy(re),this.camera.lookAt(me),this.camera.updateProjectionMatrix(),this.delta.set(0,0),this.dispatchEvent({type:"change"})}}();function v(I){I.preventDefault()}const y=function(I){const G=this.camera.getFocalLength();I<0?this.camera.setFocalLength(G+this.zoomspeed<this.zoomMax?G+this.zoomspeed:this.zoomMax):this.camera.setFocalLength(G-this.zoomspeed>this.zoomMin?G-this.zoomspeed:this.zoomMin),this.camera.updateProjectionMatrix()};this.dispose=function(){this.domElement.removeEventListener("contextmenu",v,!1),this.domElement.removeEventListener("mousedown",b,!1),this.domElement.removeEventListener("mousemove",x,!1),this.domElement.removeEventListener("mouseup",C,!1),window.removeEventListener("keydown",T,!1),window.removeEventListener("keyup",A,!1)};let x=V(this,this.onMouseMove),b=V(this,this.onMouseDown),C=V(this,this.onMouseUp),T=V(this,this.onKeyDown),A=V(this,this.onKeyUp),O=V(this,this.onmouseOut),P=V(this,this.onMouseWheel);this.domElement.addEventListener("contextmenu",v,!1),this.domElement.addEventListener("mousemove",x,!1),this.domElement.addEventListener("mousedown",b,!1),this.domElement.addEventListener("mouseup",C,!1),this.domElement.addEventListener("mouseout",O,!1),this.domElement.addEventListener("wheel",P,!1),window.addEventListener("keydown",T,!1),window.addEventListener("keyup",A,!1);function V(I,G){return function(){G.apply(I,arguments)}}function B(I){let G=I.object.quaternion;r.set(0,0,-1).applyQuaternion(G),a.setFromVector3(r),h.lat=90-f.MathUtils.radToDeg(a.phi),h.lon=f.MathUtils.radToDeg(a.theta)}this.handleResize(),B(this)};Zs.prototype=Object.create(f.EventDispatcher.prototype);Zs.prototype.constructor=Zs;let Fo=function(){function o(w){f.Loader.call(this,w),this.dracoLoader=null,this.ddsLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.imageJson=null,this.register(function(E){return new c(E)}),this.register(function(E){return new p(E)}),this.register(function(E){return new u(E)}),this.register(function(E){return new h(E)}),this.register(function(E){return new a(E)}),this.register(function(E){return new d(E)})}o.prototype=Object.assign(Object.create(f.Loader.prototype),{constructor:o,load:function(w,E,M,S){let k=this,D;this.resourcePath!==""?D=this.resourcePath:this.path!==""?D=this.path:D=f.LoaderUtils.extractUrlBase(w),this.manager.itemStart(w);let R=function(F){S?S(F):console.error(F),k.manager.itemError(w),k.manager.itemEnd(w)},_=new f.FileLoader(this.manager);_.setPath(this.path),_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setWithCredentials(this.withCredentials),_.load(w,function(F){try{k.parse(F,D,function(z){E(z),k.manager.itemEnd(w)},R)}catch(z){R(z)}},M,R)},setDRACOLoader:function(w){return this.dracoLoader=w,this},setDDSLoader:function(w){return this.ddsLoader=w,this},setKTX2Loader:function(w){return this.ktx2Loader=w,this},setMeshoptDecoder:function(w){return this.meshoptDecoder=w,this},register:function(w){return this.pluginCallbacks.indexOf(w)===-1&&this.pluginCallbacks.push(w),this},unregister:function(w){return this.pluginCallbacks.indexOf(w)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(w),1),this},setImageJson:function(w){return this.imageJson=w,this},parse:function(w,E,M,S){let k,D={},R={};if(typeof w=="string")k=w;else if(f.LoaderUtils.decodeText(new Uint8Array(w,0,4))===m){try{D[i.KHR_BINARY_GLTF]=new x(w)}catch(U){S&&S(U);return}k=D[i.KHR_BINARY_GLTF].content}else k=f.LoaderUtils.decodeText(new Uint8Array(w));let _=JSON.parse(k);if(_.asset===void 0||_.asset.version[0]<2){S&&S(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let F=new Y(_,{path:E||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder},this.imageJson);F.fileLoader.setRequestHeader(this.requestHeader);for(let z=0;z<this.pluginCallbacks.length;z++){let U=this.pluginCallbacks[z](F);R[U.name]=U,D[U.name]=!0}if(_.extensionsUsed)for(let z=0;z<_.extensionsUsed.length;++z){let U=_.extensionsUsed[z],q=_.extensionsRequired||[];switch(U){case i.KHR_MATERIALS_UNLIT:D[U]=new l;break;case i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:D[U]=new A;break;case i.KHR_DRACO_MESH_COMPRESSION:D[U]=new b(_,this.dracoLoader);break;case i.MSFT_TEXTURE_DDS:D[U]=new r(this.ddsLoader);break;case i.KHR_TEXTURE_TRANSFORM:D[U]=new C;break;case i.KHR_MESH_QUANTIZATION:D[U]=new O;break;default:q.indexOf(U)>=0&&R[U]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+U+'".')}}F.setExtensions(D),F.setPlugins(R),F.parse(M,S)}});function e(){let w={};return{get:function(E){return w[E]},add:function(E,M){w[E]=M},remove:function(E){delete w[E]},removeAll:function(){w={}}}}let i={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function r(w){if(!w)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=i.MSFT_TEXTURE_DDS,this.ddsLoader=w}function a(w){this.parser=w,this.name=i.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}a.prototype._markDefs=function(){let w=this.parser,E=this.parser.json.nodes||[];for(let M=0,S=E.length;M<S;M++){let k=E[M];k.extensions&&k.extensions[this.name]&&k.extensions[this.name].light!==void 0&&w._addNodeRef(this.cache,k.extensions[this.name].light)}},a.prototype._loadLight=function(w){let E=this.parser,M="light:"+w,S=E.cache.get(M);if(S)return S;let k=E.json,_=((k.extensions&&k.extensions[this.name]||{}).lights||[])[w],F,z=new f.Color(16777215);_.color!==void 0&&z.fromArray(_.color);let U=_.range!==void 0?_.range:0;switch(_.type){case"directional":F=new f.DirectionalLight(z),F.target.position.set(0,0,-1),F.add(F.target);break;case"point":F=new f.PointLight(z),F.distance=U;break;case"spot":F=new f.SpotLight(z),F.distance=U,_.spot=_.spot||{},_.spot.innerConeAngle=_.spot.innerConeAngle!==void 0?_.spot.innerConeAngle:0,_.spot.outerConeAngle=_.spot.outerConeAngle!==void 0?_.spot.outerConeAngle:Math.PI/4,F.angle=_.spot.outerConeAngle,F.penumbra=1-_.spot.innerConeAngle/_.spot.outerConeAngle,F.target.position.set(0,0,-1),F.add(F.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+_.type)}return F.position.set(0,0,0),F.decay=2,_.intensity!==void 0&&(F.intensity=_.intensity),F.name=E.createUniqueName(_.name||"light_"+w),S=Promise.resolve(F),E.cache.add(M,S),S},a.prototype.createNodeAttachment=function(w){let E=this,M=this.parser,k=M.json.nodes[w],R=(k.extensions&&k.extensions[this.name]||{}).light;return R===void 0?null:this._loadLight(R).then(function(_){return M._getNodeRef(E.cache,R,_)})};function l(){this.name=i.KHR_MATERIALS_UNLIT}l.prototype.getMaterialType=function(){return f.MeshBasicMaterial},l.prototype.extendParams=function(w,E,M){let S=[];w.color=new f.Color(1,1,1),w.opacity=1;let k=E.pbrMetallicRoughness;if(k){if(Array.isArray(k.baseColorFactor)){let D=k.baseColorFactor;w.color.fromArray(D),w.opacity=D[3]}k.baseColorTexture!==void 0&&S.push(M.assignTexture(w,"map",k.baseColorTexture))}return Promise.all(S)};function c(w){this.parser=w,this.name=i.KHR_MATERIALS_CLEARCOAT}c.prototype.getMaterialType=function(w){let M=this.parser.json.materials[w];return!M.extensions||!M.extensions[this.name]?null:f.MeshPhysicalMaterial},c.prototype.extendMaterialParams=function(w,E){let M=this.parser,S=M.json.materials[w];if(!S.extensions||!S.extensions[this.name])return Promise.resolve();let k=[],D=S.extensions[this.name];if(D.clearcoatFactor!==void 0&&(E.clearcoat=D.clearcoatFactor),D.clearcoatTexture!==void 0&&k.push(M.assignTexture(E,"clearcoatMap",D.clearcoatTexture)),D.clearcoatRoughnessFactor!==void 0&&(E.clearcoatRoughness=D.clearcoatRoughnessFactor),D.clearcoatRoughnessTexture!==void 0&&k.push(M.assignTexture(E,"clearcoatRoughnessMap",D.clearcoatRoughnessTexture)),D.clearcoatNormalTexture!==void 0&&(k.push(M.assignTexture(E,"clearcoatNormalMap",D.clearcoatNormalTexture)),D.clearcoatNormalTexture.scale!==void 0)){let R=D.clearcoatNormalTexture.scale;E.clearcoatNormalScale=new f.Vector2(R,R)}return Promise.all(k)};function h(w){this.parser=w,this.name=i.KHR_MATERIALS_TRANSMISSION}h.prototype.getMaterialType=function(w){let M=this.parser.json.materials[w];return!M.extensions||!M.extensions[this.name]?null:f.MeshPhysicalMaterial},h.prototype.extendMaterialParams=function(w,E){let M=this.parser,S=M.json.materials[w];if(!S.extensions||!S.extensions[this.name])return Promise.resolve();let k=[],D=S.extensions[this.name];return D.transmissionFactor!==void 0&&(E.transmission=D.transmissionFactor),D.transmissionTexture!==void 0&&k.push(M.assignTexture(E,"transmissionMap",D.transmissionTexture)),Promise.all(k)};function p(w){this.parser=w,this.name=i.KHR_TEXTURE_BASISU}p.prototype.loadTexture=function(w){let E=this.parser,M=E.json,S=M.textures[w];if(!S.extensions||!S.extensions[this.name])return null;let k=S.extensions[this.name],D=M.images[k.source],R=E.options.ktx2Loader;if(!R){if(M.extensionsRequired&&M.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return E.loadTextureImage(w,D,R)};function u(w){this.parser=w,this.name=i.EXT_TEXTURE_WEBP,this.isSupported=null}u.prototype.loadTexture=function(w){let E=this.name,M=this.parser,S=M.json,k=S.textures[w];if(!k.extensions||!k.extensions[E])return null;let D=k.extensions[E],R=S.images[D.source],_=R.uri?M.options.manager.getHandler(R.uri):M.textureLoader;return this.detectSupport().then(function(F){if(F)return M.loadTextureImage(w,R,_);if(S.extensionsRequired&&S.extensionsRequired.indexOf(E)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return M.loadTexture(w)})},u.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise(function(w){let E=new Image;E.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",E.onload=E.onerror=function(){w(E.height===1)}})),this.isSupported};function d(w){this.name=i.EXT_MESHOPT_COMPRESSION,this.parser=w}d.prototype.loadBufferView=function(w){let E=this.parser.json,M=E.bufferViews[w];if(M.extensions&&M.extensions[this.name]){let S=M.extensions[this.name],k=this.parser.getDependency("buffer",S.buffer),D=this.parser.options.meshoptDecoder;if(!D||!D.supported){if(E.extensionsRequired&&E.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([k,D.ready]).then(function(R){let _=S.byteOffset||0,F=S.byteLength||0,z=S.count,U=S.byteStride,q=new ArrayBuffer(z*U),ae=new Uint8Array(R[0],_,F);return D.decodeGltfBuffer(new Uint8Array(q),z,U,ae,S.mode,S.filter),q})}else return null};let m="glTF",v=12,y={JSON:1313821514,BIN:5130562};function x(w){this.name=i.KHR_BINARY_GLTF,this.content=null,this.body=null;let E=new DataView(w,0,v);if(this.header={magic:f.LoaderUtils.decodeText(new Uint8Array(w.slice(0,4))),version:E.getUint32(4,!0),length:E.getUint32(8,!0)},this.header.magic!==m)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let M=new DataView(w,v),S=0;for(;S<M.byteLength;){let k=M.getUint32(S,!0);S+=4;let D=M.getUint32(S,!0);if(S+=4,D===y.JSON){let R=new Uint8Array(w,v+S,k);this.content=f.LoaderUtils.decodeText(R)}else if(D===y.BIN){let R=v+S;this.body=w.slice(R,R+k)}S+=k}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}function b(w,E){if(!E)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=i.KHR_DRACO_MESH_COMPRESSION,this.json=w,this.dracoLoader=E,this.dracoLoader.preload()}b.prototype.decodePrimitive=function(w,E){let M=this.json,S=this.dracoLoader,k=w.extensions[this.name].bufferView,D=w.extensions[this.name].attributes,R={},_={},F={};for(let z in D){let U=j[z]||z.toLowerCase();R[U]=D[z]}for(attributeName in w.attributes){let z=j[attributeName]||attributeName.toLowerCase();if(D[attributeName]!==void 0){let U=M.accessors[w.attributes[attributeName]],q=B[U.componentType];F[z]=q,_[z]=U.normalized===!0}}return E.getDependency("bufferView",k).then(function(z){return new Promise(function(U){S.decodeDracoFile(z,function(q){for(let ae in q.attributes){let le=q.attributes[ae],oe=_[ae];oe!==void 0&&(le.normalized=oe)}U(q)},R,F)})})};function C(){this.name=i.KHR_TEXTURE_TRANSFORM}C.prototype.extendTexture=function(w,E){return w=w.clone(),E.offset!==void 0&&w.offset.fromArray(E.offset),E.rotation!==void 0&&(w.rotation=E.rotation),E.scale!==void 0&&w.repeat.fromArray(E.scale),E.texCoord!==void 0&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),w.needsUpdate=!0,w};function T(w){f.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;let E=["#ifdef USE_SPECULARMAP"," uniform sampler2D specularMap;","#endif"].join(`
2
2
  `),M=["#ifdef USE_GLOSSINESSMAP"," uniform sampler2D glossinessMap;","#endif"].join(`
3
3
  `),S=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP"," vec4 texelSpecular = texture2D( specularMap, vUv );"," texelSpecular = sRGBToLinear( texelSpecular );"," // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture"," specularFactor *= texelSpecular.rgb;","#endif"].join(`
4
4
  `),k=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP"," vec4 texelGlossiness = texture2D( glossinessMap, vUv );"," // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture"," glossinessFactor *= texelGlossiness.a;","#endif"].join(`
5
5
  `),D=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join(`
6
- `),B={specular:{value:new f.Color().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=B,this.onBeforeCompile=function(_){for(let F in B)_.uniforms[F]=B[F];_.fragmentShader=_.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",E).replace("#include <metalnessmap_pars_fragment>",M).replace("#include <roughnessmap_fragment>",S).replace("#include <metalnessmap_fragment>",k).replace("#include <lights_physical_fragment>",D)},Object.defineProperties(this,{specular:{get:function(){return B.specular.value},set:function(_){B.specular.value=_}},specularMap:{get:function(){return B.specularMap.value},set:function(_){B.specularMap.value=_,_?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return B.glossiness.value},set:function(_){B.glossiness.value=_}},glossinessMap:{get:function(){return B.glossinessMap.value},set:function(_){B.glossinessMap.value=_,_?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(w)}T.prototype=Object.create(f.MeshStandardMaterial.prototype),T.prototype.constructor=T,T.prototype.copy=function(w){return f.MeshStandardMaterial.prototype.copy.call(this,w),this.specularMap=w.specularMap,this.specular.copy(w.specular),this.glossinessMap=w.glossinessMap,this.glossiness=w.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this};function A(){return{name:i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return T},extendParams:function(w,E,M){let S=E.extensions[this.name];w.color=new f.Color(1,1,1),w.opacity=1;let k=[];if(Array.isArray(S.diffuseFactor)){let D=S.diffuseFactor;w.color.fromArray(D),w.opacity=D[3]}if(S.diffuseTexture!==void 0&&k.push(M.assignTexture(w,"map",S.diffuseTexture)),w.emissive=new f.Color(0,0,0),w.glossiness=S.glossinessFactor!==void 0?S.glossinessFactor:1,w.specular=new f.Color(1,1,1),Array.isArray(S.specularFactor)&&w.specular.fromArray(S.specularFactor),S.specularGlossinessTexture!==void 0){let D=S.specularGlossinessTexture;k.push(M.assignTexture(w,"glossinessMap",D)),k.push(M.assignTexture(w,"specularMap",D))}return Promise.all(k)},createMaterial:function(w){let E=new T(w);return E.fog=!0,E.color=w.color,E.map=w.map===void 0?null:w.map,E.lightMap=null,E.lightMapIntensity=1,E.aoMap=w.aoMap===void 0?null:w.aoMap,E.aoMapIntensity=1,E.emissive=w.emissive,E.emissiveIntensity=1,E.emissiveMap=w.emissiveMap===void 0?null:w.emissiveMap,E.bumpMap=w.bumpMap===void 0?null:w.bumpMap,E.bumpScale=1,E.normalMap=w.normalMap===void 0?null:w.normalMap,E.normalMapType=f.TangentSpaceNormalMap,w.normalScale&&(E.normalScale=w.normalScale),E.displacementMap=null,E.displacementScale=1,E.displacementBias=0,E.specularMap=w.specularMap===void 0?null:w.specularMap,E.specular=w.specular,E.glossinessMap=w.glossinessMap===void 0?null:w.glossinessMap,E.glossiness=w.glossiness,E.alphaMap=null,E.envMap=w.envMap===void 0?null:w.envMap,E.envMapIntensity=1,E.refractionRatio=.98,E}}}function O(){this.name=i.KHR_MESH_QUANTIZATION}function P(w,E,M,S){f.Interpolant.call(this,w,E,M,S)}P.prototype=Object.create(f.Interpolant.prototype),P.prototype.constructor=P,P.prototype.copySampleValue_=function(w){let E=this.resultBuffer,M=this.sampleValues,S=this.valueSize,k=w*S*3+S;for(let D=0;D!==S;D++)E[D]=M[k+D];return E},P.prototype.beforeStart_=P.prototype.copySampleValue_,P.prototype.afterEnd_=P.prototype.copySampleValue_,P.prototype.interpolate_=function(w,E,M,S){let k=this.resultBuffer,D=this.sampleValues,B=this.valueSize,_=B*2,F=B*3,H=S-E,U=(M-E)/H,Y=U*U,oe=Y*U,he=w*F,re=he-F,ye=-2*oe+3*Y,ve=oe-Y,De=1-ye,Re=ve-Y+U;for(let et=0;et!==B;et++){let Bt=D[re+et+B],ot=D[re+et+_]*H,We=D[he+et+B],bt=D[he+et]*H;k[et]=De*Bt+Re*ot+ye*We+ve*bt}return k};let V={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},R={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},I={9728:f.NearestFilter,9729:f.LinearFilter,9984:f.NearestMipmapNearestFilter,9985:f.LinearMipmapNearestFilter,9986:f.NearestMipmapLinearFilter,9987:f.LinearMipmapLinearFilter},G={33071:f.ClampToEdgeWrapping,33648:f.MirroredRepeatWrapping,10497:f.RepeatWrapping},X={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},j={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},z={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},J={CUBICSPLINE:void 0,LINEAR:f.InterpolateLinear,STEP:f.InterpolateDiscrete},Q={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function de(w,E){return typeof w!="string"||w===""?"":(/^https?:\/\//i.test(E)&&/^\//.test(w)&&(E=E.replace(/(^https?:\/\/[^]+).*/i,"$1")),/^(https?:)?\/\//i.test(w)||/^data:.*,.*$/i.test(w)||/^blob:.*$/i.test(w)?w:E+w)}function ie(w){return w.DefaultMaterial===void 0&&(w.DefaultMaterial=new f.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:f.FrontSide})),w.DefaultMaterial}function me(w,E,M){for(let S in M.extensions)w[S]===void 0&&(E.userData.gltfExtensions=E.userData.gltfExtensions||{},E.userData.gltfExtensions[S]=M.extensions[S])}function W(w,E){E.extras!==void 0&&(typeof E.extras=="object"?Object.assign(w.userData,E.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+E.extras))}function $(w,E,M){let S=!1,k=!1;for(let _=0,F=E.length;_<F;_++){let H=E[_];if(H.POSITION!==void 0&&(S=!0),H.NORMAL!==void 0&&(k=!0),S&&k)break}if(!S&&!k)return Promise.resolve(w);let D=[],B=[];for(let _=0,F=E.length;_<F;_++){let H=E[_];if(S){let U=H.POSITION!==void 0?M.getDependency("accessor",H.POSITION):w.attributes.position;D.push(U)}if(k){let U=H.NORMAL!==void 0?M.getDependency("accessor",H.NORMAL):w.attributes.normal;B.push(U)}}return Promise.all([Promise.all(D),Promise.all(B)]).then(function(_){let F=_[0],H=_[1];return S&&(w.morphAttributes.position=F),k&&(w.morphAttributes.normal=H),w.morphTargetsRelative=!0,w})}function q(w,E){if(w.updateMorphTargets(),E.weights!==void 0)for(let M=0,S=E.weights.length;M<S;M++)w.morphTargetInfluences[M]=E.weights[M];if(E.extras&&Array.isArray(E.extras.targetNames)){let M=E.extras.targetNames;if(w.morphTargetInfluences.length===M.length){w.morphTargetDictionary={};for(let S=0,k=M.length;S<k;S++)w.morphTargetDictionary[M[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function ae(w){let E=w.extensions&&w.extensions[i.KHR_DRACO_MESH_COMPRESSION],M;return E?M="draco:"+E.bufferView+":"+E.indices+":"+ce(E.attributes):M=w.indices+":"+ce(w.attributes)+":"+w.mode,M}function ce(w){let E="",M=Object.keys(w).sort();for(let S=0,k=M.length;S<k;S++)E+=M[S]+":"+w[M[S]]+";";return E}function te(w,E,M){this.json=w||{},this.extensions={},this.plugins={},this.options=E||{},this.imageJson=M,this.cache=new e,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},typeof createImageBitmap<"u"&&/Firefox/.test(navigator.userAgent)===!1?this.textureLoader=new f.ImageBitmapLoader(this.options.manager):this.textureLoader=new f.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new f.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}te.prototype.setExtensions=function(w){this.extensions=w},te.prototype.setPlugins=function(w){this.plugins=w},te.prototype.parse=function(w,E){let M=this,S=this.json,k=this.extensions;this.cache.removeAll(),this._invokeAll(function(D){return D._markDefs&&D._markDefs()}),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then(function(D){let B={scene:D[0][S.scene||0],scenes:D[0],animations:D[1],cameras:D[2],asset:S.asset,parser:M,userData:{}};me(k,B,S),W(B,S),w(B)}).catch(E)},te.prototype._markDefs=function(){let w=this.json.nodes||[],E=this.json.skins||[],M=this.json.meshes||[];for(let S=0,k=E.length;S<k;S++){let D=E[S].joints;for(let B=0,_=D.length;B<_;B++)w[D[B]].isBone=!0}for(let S=0,k=w.length;S<k;S++){let D=w[S];D.mesh!==void 0&&(this._addNodeRef(this.meshCache,D.mesh),D.skin!==void 0&&(M[D.mesh].isSkinnedMesh=!0)),D.camera!==void 0&&this._addNodeRef(this.cameraCache,D.camera)}},te.prototype._addNodeRef=function(w,E){E!==void 0&&(w.refs[E]===void 0&&(w.refs[E]=w.uses[E]=0),w.refs[E]++)},te.prototype._getNodeRef=function(w,E,M){if(w.refs[E]<=1)return M;let S=M.clone();return S.name+="_instance_"+w.uses[E]++,S},te.prototype._invokeOne=function(w){let E=Object.values(this.plugins);E.push(this);for(let M=0;M<E.length;M++){let S=w(E[M]);if(S)return S}},te.prototype._invokeAll=function(w){let E=Object.values(this.plugins);E.unshift(this);let M=[];for(let S=0;S<E.length;S++){let k=w(E[S]);k&&M.push(k)}return M},te.prototype.getDependency=function(w,E){let M=w+":"+E,S=this.cache.get(M);if(!S){switch(w){case"scene":S=this.loadScene(E);break;case"node":S=this.loadNode(E);break;case"mesh":S=this._invokeOne(function(k){return k.loadMesh&&k.loadMesh(E)});break;case"accessor":S=this.loadAccessor(E);break;case"bufferView":S=this._invokeOne(function(k){return k.loadBufferView&&k.loadBufferView(E)});break;case"buffer":S=this.loadBuffer(E);break;case"material":S=this._invokeOne(function(k){return k.loadMaterial&&k.loadMaterial(E)});break;case"texture":S=this._invokeOne(function(k){return k.loadTexture&&k.loadTexture(E)});break;case"skin":S=this.loadSkin(E);break;case"animation":S=this.loadAnimation(E);break;case"camera":S=this.loadCamera(E);break;default:throw new Error("Unknown type: "+w)}this.cache.add(M,S)}return S},te.prototype.getDependencies=function(w){let E=this.cache.get(w);if(!E){let M=this,S=this.json[w+(w==="mesh"?"es":"s")]||[];E=Promise.all(S.map(function(k,D){return M.getDependency(w,D)})),this.cache.add(w,E)}return E},te.prototype.loadBuffer=function(w){let E=this.json.buffers[w],M=this.fileLoader;if(E.type&&E.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+E.type+" buffer type is not supported.");if(E.uri===void 0&&w===0)return Promise.resolve(this.extensions[i.KHR_BINARY_GLTF].body);let S=this.options;return new Promise(function(k,D){M.load(de(E.uri,S.path),k,void 0,function(){D(new Error('THREE.GLTFLoader: Failed to load buffer "'+E.uri+'".'))})})},te.prototype.loadBufferView=function(w){let E=this.json.bufferViews[w];return this.getDependency("buffer",E.buffer).then(function(M){let S=E.byteLength||0,k=E.byteOffset||0;return M.slice(k,k+S)})},te.prototype.loadAccessor=function(w){let E=this,M=this.json,S=this.json.accessors[w];if(S.bufferView===void 0&&S.sparse===void 0)return Promise.resolve(null);let k=[];return S.bufferView!==void 0?k.push(this.getDependency("bufferView",S.bufferView)):k.push(null),S.sparse!==void 0&&(k.push(this.getDependency("bufferView",S.sparse.indices.bufferView)),k.push(this.getDependency("bufferView",S.sparse.values.bufferView))),Promise.all(k).then(function(D){let B=D[0],_=X[S.type],F=R[S.componentType],H=F.BYTES_PER_ELEMENT,U=H*_,Y=S.byteOffset||0,oe=S.bufferView!==void 0?M.bufferViews[S.bufferView].byteStride:void 0,he=S.normalized===!0,re,ye;if(oe&&oe!==U){let ve=Math.floor(Y/oe),De="InterleavedBuffer:"+S.bufferView+":"+S.componentType+":"+ve+":"+S.count,Re=E.cache.get(De);Re||(re=new F(B,ve*oe,S.count*oe/H),Re=new f.InterleavedBuffer(re,oe/H),E.cache.add(De,Re)),ye=new f.InterleavedBufferAttribute(Re,_,Y%oe/H,he)}else B===null?re=new F(S.count*_):re=new F(B,Y,S.count*_),ye=new f.BufferAttribute(re,_,he);if(S.sparse!==void 0){let ve=X.SCALAR,De=R[S.sparse.indices.componentType],Re=S.sparse.indices.byteOffset||0,et=S.sparse.values.byteOffset||0,Bt=new De(D[1],Re,S.sparse.count*ve),ot=new F(D[2],et,S.sparse.count*_);B!==null&&(ye=new f.BufferAttribute(ye.array.slice(),ye.itemSize,ye.normalized));for(let We=0,bt=Bt.length;We<bt;We++){let Wt=Bt[We];if(ye.setX(Wt,ot[We*_]),_>=2&&ye.setY(Wt,ot[We*_+1]),_>=3&&ye.setZ(Wt,ot[We*_+2]),_>=4&&ye.setW(Wt,ot[We*_+3]),_>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return ye})},te.prototype.loadTexture=function(w){let E=this,M=this.json,S=this.options,k=M.textures[w],D=k.extensions||{},B;D[i.MSFT_TEXTURE_DDS]?B=M.images[D[i.MSFT_TEXTURE_DDS].source]:B=M.images[k.source];let _;return B.uri&&(_=S.manager.getHandler(B.uri)),_||(_=D[i.MSFT_TEXTURE_DDS]?E.extensions[i.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(w,B,_)},te.prototype.loadTextureImage=function(w,E,M){let S=this,k=this.json,D=this.options,B=k.textures[w],_=self.URL||self.webkitURL;this.imageJson&&(E.uri=this.imageJson[E.uri]);let F=E.uri,H=!1,U=!0;return E.mimeType==="image/jpeg"&&(U=!1),E.bufferView!==void 0&&(F=S.getDependency("bufferView",E.bufferView).then(function(Y){if(E.mimeType==="image/png"){let he=new DataView(Y,25,1).getUint8(0,!1);U=he===6||he===4||he===3}H=!0;let oe=new Blob([Y],{type:E.mimeType});return F=_.createObjectURL(oe),F})),Promise.resolve(F).then(function(Y){return new Promise(function(oe,he){let re=oe;M.isImageBitmapLoader===!0&&(re=function(ye){oe(new f.CanvasTexture(ye))}),M.load(de(Y,D.path),re,void 0,he)})}).then(function(Y){H===!0&&_.revokeObjectURL(F),Y.flipY=!1,B.name&&(Y.name=B.name),U||(Y.format=f.RGBFormat);let he=(k.samplers||{})[B.sampler]||{};return Y.magFilter=I[he.magFilter]||f.LinearFilter,Y.minFilter=I[he.minFilter]||f.LinearMipmapLinearFilter,Y.wrapS=G[he.wrapS]||f.RepeatWrapping,Y.wrapT=G[he.wrapT]||f.RepeatWrapping,S.associations.set(Y,{type:"textures",index:w}),Y})},te.prototype.assignTexture=function(w,E,M){let S=this;return this.getDependency("texture",M.index).then(function(k){if(M.texCoord!==void 0&&M.texCoord!=0&&!(E==="aoMap"&&M.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+M.texCoord+" for texture "+E+" not yet supported."),S.extensions[i.KHR_TEXTURE_TRANSFORM]){let D=M.extensions!==void 0?M.extensions[i.KHR_TEXTURE_TRANSFORM]:void 0;if(D){let B=S.associations.get(k);k=S.extensions[i.KHR_TEXTURE_TRANSFORM].extendTexture(k,D),S.associations.set(k,B)}}w[E]=k})},te.prototype.assignFinalMaterial=function(w){let E=w.geometry,M=w.material,S=E.attributes.tangent!==void 0,k=E.attributes.color!==void 0,D=E.attributes.normal===void 0,B=w.isSkinnedMesh===!0,_=Object.keys(E.morphAttributes).length>0,F=_&&E.morphAttributes.normal!==void 0;if(w.isPoints){let H="PointsMaterial:"+M.uuid,U=this.cache.get(H);U||(U=new f.PointsMaterial,f.Material.prototype.copy.call(U,M),U.color.copy(M.color),U.map=M.map,U.sizeAttenuation=!1,this.cache.add(H,U)),M=U}else if(w.isLine){let H="LineBasicMaterial:"+M.uuid,U=this.cache.get(H);U||(U=new f.LineBasicMaterial,f.Material.prototype.copy.call(U,M),U.color.copy(M.color),this.cache.add(H,U)),M=U}if(S||k||D||B||_){let H="ClonedMaterial:"+M.uuid+":";M.isGLTFSpecularGlossinessMaterial&&(H+="specular-glossiness:"),B&&(H+="skinning:"),S&&(H+="vertex-tangents:"),k&&(H+="vertex-colors:"),D&&(H+="flat-shading:"),_&&(H+="morph-targets:"),F&&(H+="morph-normals:");let U=this.cache.get(H);U||(U=M.clone(),B&&(U.skinning=!0),S&&(U.vertexTangents=!0),k&&(U.vertexColors=!0),D&&(U.flatShading=!0),_&&(U.morphTargets=!0),F&&(U.morphNormals=!0),this.cache.add(H,U),this.associations.set(U,this.associations.get(M))),M=U}M.aoMap&&E.attributes.uv2===void 0&&E.attributes.uv!==void 0&&E.setAttribute("uv2",E.attributes.uv),M.normalScale&&!S&&(M.normalScale.y=-M.normalScale.y),M.clearcoatNormalScale&&!S&&(M.clearcoatNormalScale.y=-M.clearcoatNormalScale.y),w.material=M},te.prototype.getMaterialType=function(){return f.MeshStandardMaterial},te.prototype.loadMaterial=function(w){let E=this,M=this.json,S=this.extensions,k=M.materials[w],D,B={},_=k.extensions||{},F=[];if(_[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){let U=S[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];D=U.getMaterialType(),F.push(U.extendParams(B,k,E))}else if(_[i.KHR_MATERIALS_UNLIT]){let U=S[i.KHR_MATERIALS_UNLIT];D=U.getMaterialType(),F.push(U.extendParams(B,k,E))}else{let U=k.pbrMetallicRoughness||{};if(B.color=new f.Color(1,1,1),B.opacity=1,Array.isArray(U.baseColorFactor)){let Y=U.baseColorFactor;B.color.fromArray(Y),B.opacity=Y[3]}U.baseColorTexture!==void 0&&F.push(E.assignTexture(B,"map",U.baseColorTexture)),B.metalness=U.metallicFactor!==void 0?U.metallicFactor:1,B.roughness=U.roughnessFactor!==void 0?U.roughnessFactor:1,U.metallicRoughnessTexture!==void 0&&(F.push(E.assignTexture(B,"metalnessMap",U.metallicRoughnessTexture)),F.push(E.assignTexture(B,"roughnessMap",U.metallicRoughnessTexture))),D=this._invokeOne(function(Y){return Y.getMaterialType&&Y.getMaterialType(w)}),F.push(Promise.all(this._invokeAll(function(Y){return Y.extendMaterialParams&&Y.extendMaterialParams(w,B)})))}k.doubleSided===!0&&(B.side=f.DoubleSide);let H=k.alphaMode||Q.OPAQUE;return H===Q.BLEND?(B.transparent=!0,B.depthWrite=!1):(B.transparent=!1,H===Q.MASK&&(B.alphaTest=k.alphaCutoff!==void 0?k.alphaCutoff:.5)),k.normalTexture!==void 0&&D!==f.MeshBasicMaterial&&(F.push(E.assignTexture(B,"normalMap",k.normalTexture)),B.normalScale=new f.Vector2(1,1),k.normalTexture.scale!==void 0&&B.normalScale.set(k.normalTexture.scale,k.normalTexture.scale)),k.occlusionTexture!==void 0&&D!==f.MeshBasicMaterial&&(F.push(E.assignTexture(B,"aoMap",k.occlusionTexture)),k.occlusionTexture.strength!==void 0&&(B.aoMapIntensity=k.occlusionTexture.strength)),k.emissiveFactor!==void 0&&D!==f.MeshBasicMaterial&&(B.emissive=new f.Color().fromArray(k.emissiveFactor)),k.emissiveTexture!==void 0&&D!==f.MeshBasicMaterial&&F.push(E.assignTexture(B,"emissiveMap",k.emissiveTexture)),Promise.all(F).then(function(){let U;return D===T?U=S[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(B):U=new D(B),k.name&&(U.name=k.name),U.map&&(U.map.encoding=f.sRGBEncoding),U.emissiveMap&&(U.emissiveMap.encoding=f.sRGBEncoding),W(U,k),E.associations.set(U,{type:"materials",index:w}),k.extensions&&me(S,U,k),U})},te.prototype.createUniqueName=function(w){let E=f.PropertyBinding.sanitizeNodeName(w||""),M=E;for(let S=1;this.nodeNamesUsed[M];++S)M=E+"_"+S;return this.nodeNamesUsed[M]=!0,M};function ue(w,E,M){let S=E.attributes,k=new f.Box3;if(S.POSITION!==void 0){let _=M.json.accessors[S.POSITION],F=_.min,H=_.max;if(F!==void 0&&H!==void 0)k.set(new f.Vector3(F[0],F[1],F[2]),new f.Vector3(H[0],H[1],H[2]));else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let D=E.targets;if(D!==void 0){let _=new f.Vector3,F=new f.Vector3;for(let H=0,U=D.length;H<U;H++){let Y=D[H];if(Y.POSITION!==void 0){let oe=M.json.accessors[Y.POSITION],he=oe.min,re=oe.max;he!==void 0&&re!==void 0?(F.setX(Math.max(Math.abs(he[0]),Math.abs(re[0]))),F.setY(Math.max(Math.abs(he[1]),Math.abs(re[1]))),F.setZ(Math.max(Math.abs(he[2]),Math.abs(re[2]))),_.max(F)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}k.expandByVector(_)}w.boundingBox=k;let B=new f.Sphere;k.getCenter(B.center),B.radius=k.min.distanceTo(k.max)/2,w.boundingSphere=B}function fe(w,E,M){let S=E.attributes,k=[];function D(B,_){return M.getDependency("accessor",B).then(function(F){if(F.isInterleavedBufferAttribute){if(_=="position"){const H=F.data.stride,U=F.data.count,Y=new Float32Array(U*3),oe=new Float32Array(U*3),he=new Float32Array(U*2);for(let re=0;re<U;re++)Y[re*3]=F.data.array[re*H],Y[re*3+1]=F.data.array[re*H+1],Y[re*3+2]=F.data.array[re*H+2],oe[re*3]=F.data.array[re*H+3],oe[re*3+1]=F.data.array[re*H+4],oe[re*3+2]=F.data.array[re*H+5],H==8&&(he[re*2]=F.data.array[re*H+6],he[re*2+1]=F.data.array[re*H+7]);w.setAttribute("position",new f.BufferAttribute(Y,3)),w.setAttribute("normal",new f.BufferAttribute(oe,3)),H==8&&w.setAttribute("uv",new f.BufferAttribute(he,2))}}else w.setAttribute(_,F)})}for(let B in S){let _=j[B]||B.toLowerCase();_ in w.attributes||k.push(D(S[B],_))}if(E.indices!==void 0&&!w.index){let B=M.getDependency("accessor",E.indices).then(function(_){w.setIndex(_)});k.push(B)}return W(w,E),ue(w,E,M),Promise.all(k).then(function(){return E.targets!==void 0?$(w,E.targets,M):w})}function _e(w,E){let M=w.getIndex();if(M===null){let B=[],_=w.getAttribute("position");if(_!==void 0){for(let F=0;F<_.count;F++)B.push(F);w.setIndex(B),M=w.getIndex()}else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),w}let S=M.count-2,k=[];if(E===f.TriangleFanDrawMode)for(let B=1;B<=S;B++)k.push(M.getX(0)),k.push(M.getX(B)),k.push(M.getX(B+1));else for(let B=0;B<S;B++)B%2===0?(k.push(M.getX(B)),k.push(M.getX(B+1)),k.push(M.getX(B+2))):(k.push(M.getX(B+2)),k.push(M.getX(B+1)),k.push(M.getX(B)));k.length/3!==S&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let D=w.clone();return D.setIndex(k),D}return te.prototype.loadGeometries=function(w){let E=this,M=this.extensions,S=this.primitiveCache;function k(B){return M[i.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(B,E).then(function(_){return fe(_,B,E)})}let D=[];for(let B=0,_=w.length;B<_;B++){let F=w[B],H=ae(F),U=S[H];if(U)D.push(U.promise);else{let Y;F.extensions&&F.extensions[i.KHR_DRACO_MESH_COMPRESSION]?Y=k(F):Y=fe(new f.BufferGeometry,F,E),S[H]={primitive:F,promise:Y},D.push(Y)}}return Promise.all(D)},te.prototype.loadMesh=function(w){let E=this,M=this.json,S=this.extensions,k=M.meshes[w],D=k.primitives,B=[];for(let _=0,F=D.length;_<F;_++){let H=D[_].material===void 0?ie(this.cache):this.getDependency("material",D[_].material);B.push(H)}return B.push(E.loadGeometries(D)),Promise.all(B).then(function(_){let F=_.slice(0,_.length-1),H=_[_.length-1],U=[];for(let oe=0,he=H.length;oe<he;oe++){let re=H[oe],ye=D[oe],ve,De=F[oe];if(ye.mode===V.TRIANGLES||ye.mode===V.TRIANGLE_STRIP||ye.mode===V.TRIANGLE_FAN||ye.mode===void 0)ve=k.isSkinnedMesh===!0?new f.SkinnedMesh(re,De):new f.Mesh(re,De),ve.isSkinnedMesh===!0&&!ve.geometry.attributes.skinWeight.normalized&&ve.normalizeSkinWeights(),ye.mode===V.TRIANGLE_STRIP?ve.geometry=_e(ve.geometry,f.TriangleStripDrawMode):ye.mode===V.TRIANGLE_FAN&&(ve.geometry=_e(ve.geometry,f.TriangleFanDrawMode));else if(ye.mode===V.LINES)ve=new f.LineSegments(re,De);else if(ye.mode===V.LINE_STRIP)ve=new f.Line(re,De);else if(ye.mode===V.LINE_LOOP)ve=new f.LineLoop(re,De);else if(ye.mode===V.POINTS)ve=new f.Points(re,De);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+ye.mode);Object.keys(ve.geometry.morphAttributes).length>0&&q(ve,k),ve.name=E.createUniqueName(k.name||"mesh_"+w),W(ve,k),ye.extensions&&me(S,ve,ye),E.assignFinalMaterial(ve),U.push(ve)}if(U.length===1)return U[0];let Y=new f.Group;for(let oe=0,he=U.length;oe<he;oe++)Y.add(U[oe]);return Y})},te.prototype.loadCamera=function(w){let E,M=this.json.cameras[w],S=M[M.type];if(!S){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return M.type==="perspective"?E=new f.PerspectiveCamera(f.MathUtils.radToDeg(S.yfov),S.aspectRatio||1,S.znear||1,S.zfar||2e6):M.type==="orthographic"&&(E=new f.OrthographicCamera(-S.xmag,S.xmag,S.ymag,-S.ymag,S.znear,S.zfar)),M.name&&(E.name=this.createUniqueName(M.name)),W(E,M),Promise.resolve(E)},te.prototype.loadSkin=function(w){let E=this.json.skins[w],M={joints:E.joints};return E.inverseBindMatrices===void 0?Promise.resolve(M):this.getDependency("accessor",E.inverseBindMatrices).then(function(S){return M.inverseBindMatrices=S,M})},te.prototype.loadAnimation=function(w){let M=this.json.animations[w],S=[],k=[],D=[],B=[],_=[];for(let F=0,H=M.channels.length;F<H;F++){let U=M.channels[F],Y=M.samplers[U.sampler],oe=U.target,he=oe.node!==void 0?oe.node:oe.id,re=M.parameters!==void 0?M.parameters[Y.input]:Y.input,ye=M.parameters!==void 0?M.parameters[Y.output]:Y.output;S.push(this.getDependency("node",he)),k.push(this.getDependency("accessor",re)),D.push(this.getDependency("accessor",ye)),B.push(Y),_.push(oe)}return Promise.all([Promise.all(S),Promise.all(k),Promise.all(D),Promise.all(B),Promise.all(_)]).then(function(F){let H=F[0],U=F[1],Y=F[2],oe=F[3],he=F[4],re=[];for(let ve=0,De=H.length;ve<De;ve++){let Re=H[ve],et=U[ve],Bt=Y[ve],ot=oe[ve],We=he[ve];if(Re===void 0)continue;Re.updateMatrix(),Re.matrixAutoUpdate=!0;let bt;switch(z[We.path]){case z.weights:bt=f.NumberKeyframeTrack;break;case z.rotation:bt=f.QuaternionKeyframeTrack;break;case z.position:case z.scale:default:bt=f.VectorKeyframeTrack;break}let Wt=Re.name?Re.name:Re.uuid,Aa=ot.interpolation!==void 0?J[ot.interpolation]:f.InterpolateLinear,ks=[];z[We.path]===z.weights?Re.traverse(function(Ne){Ne.isMesh===!0&&Ne.morphTargetInfluences&&ks.push(Ne.name?Ne.name:Ne.uuid)}):ks.push(Wt);let dt=Bt.array;if(Bt.normalized){let Ne;if(dt.constructor===Int8Array)Ne=1/127;else if(dt.constructor===Uint8Array)Ne=1/255;else if(dt.constructor==Int16Array)Ne=1/32767;else if(dt.constructor===Uint16Array)Ne=1/65535;else throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");let Ms=new Float32Array(dt.length);for(let xt=0,Ii=dt.length;xt<Ii;xt++)Ms[xt]=dt[xt]*Ne;dt=Ms}for(let Ne=0,Ms=ks.length;Ne<Ms;Ne++){let xt=new bt(ks[Ne]+"."+z[We.path],et.array,dt,Aa);ot.interpolation==="CUBICSPLINE"&&(xt.createInterpolant=function(_a){return new P(this.times,this.values,this.getValueSize()/3,_a)},xt.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),re.push(xt)}}let ye=M.name?M.name:"animation_"+w;return new f.AnimationClip(ye,void 0,re)})},te.prototype.loadNode=function(w){let E=this.json,M=this.extensions,S=this,k=E.nodes[w],D=k.name?S.createUniqueName(k.name):"";return function(){let B=[];return k.mesh!==void 0&&B.push(S.getDependency("mesh",k.mesh).then(function(_){let F=S._getNodeRef(S.meshCache,k.mesh,_);return k.weights!==void 0&&F.traverse(function(H){if(H.isMesh)for(let U=0,Y=k.weights.length;U<Y;U++)H.morphTargetInfluences[U]=k.weights[U]}),F})),k.camera!==void 0&&B.push(S.getDependency("camera",k.camera).then(function(_){return S._getNodeRef(S.cameraCache,k.camera,_)})),S._invokeAll(function(_){return _.createNodeAttachment&&_.createNodeAttachment(w)}).forEach(function(_){B.push(_)}),Promise.all(B)}().then(function(B){let _;if(k.isBone===!0?_=new f.Bone:B.length>1?_=new f.Group:B.length===1?_=B[0]:_=new f.Object3D,_!==B[0])for(let F=0,H=B.length;F<H;F++)_.add(B[F]);if(k.name&&(_.userData.name=k.name,_.name=D),W(_,k),k.extensions&&me(M,_,k),k.matrix!==void 0){let F=new f.Matrix4;F.fromArray(k.matrix),_.applyMatrix4(F)}else k.translation!==void 0&&_.position.fromArray(k.translation),k.rotation!==void 0&&_.quaternion.fromArray(k.rotation),k.scale!==void 0&&_.scale.fromArray(k.scale);return S.associations.set(_,{type:"nodes",index:w}),_})},te.prototype.loadScene=function(){function w(E,M,S,k){let D=S.nodes[E];return k.getDependency("node",E).then(function(B){if(D.skin===void 0)return B;let _;return k.getDependency("skin",D.skin).then(function(F){_=F;let H=[];for(let U=0,Y=_.joints.length;U<Y;U++)H.push(k.getDependency("node",_.joints[U]));return Promise.all(H)}).then(function(F){return B.traverse(function(H){if(!H.isMesh)return;let U=[],Y=[];for(let oe=0,he=F.length;oe<he;oe++){let re=F[oe];if(re){U.push(re);let ye=new f.Matrix4;_.inverseBindMatrices!==void 0&&ye.fromArray(_.inverseBindMatrices.array,oe*16),Y.push(ye)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',_.joints[oe])}H.bind(new f.Skeleton(U,Y),H.matrixWorld)}),B})}).then(function(B){M.add(B);let _=[];if(D.children){let F=D.children;for(let H=0,U=F.length;H<U;H++){let Y=F[H];_.push(w(Y,B,S,k))}}return Promise.all(_)})}return function(M){let S=this.json,k=this.extensions,D=this.json.scenes[M],B=this,_=new f.Group;D.name&&(_.name=B.createUniqueName(D.name)),W(_,D),D.extensions&&me(k,_,D);let F=D.nodes||[],H=[];for(let U=0,Y=F.length;U<Y;U++)H.push(w(F[U],_,S,B));return Promise.all(H).then(function(){return _})}}(),o}();class Fa{constructor(e,i,r,a,l=200){L(this,"group");L(this,"sceneCamera");L(this,"cubeCamera");L(this,"element");L(this,"meshs");L(this,"currentMesh");L(this,"raycaster",new f.Raycaster);L(this,"control");L(this,"moveMesh");L(this,"size");L(this,"getAllObjectBox");this.group=new f.Group;const c=new f.DirectionalLight(16777215,1.2);i.add(c),this.moveMesh=new f.Mesh(new f.BufferGeometry,new f.MeshStandardMaterial({color:57599,transparent:!0,opacity:.45,depthTest:!1})),this.group.add(this.moveMesh),this.sceneCamera=e,this.cubeCamera=i,this.element=r,this.meshs=[],this.getAllObjectBox=a;const h=["前","后","上","下","左","右"],p=[{vertex:[-10,-6,6,-10,-6,-6,-6,-10,-6,-6,-10,-6,-6,-10,6,-10,-6,6],color:15856112,name:"EDGE_BACK_LEFT"},{vertex:[-10,-6,-6,-10,6,-6,-6,6,-10,-6,6,-10,-6,-6,-10,-10,-6,-6],color:15856112,name:"EDGE_BACK_BOTTOM"},{vertex:[-6,6,10,-10,6,6,-10,-6,6,-10,-6,6,-6,-6,10,-6,6,10],color:15856112,name:"EDGE_BACK_TOP"},{vertex:[-10,6,-6,-10,6,6,-6,10,6,-6,10,6,-6,10,-6,-10,6,-6],color:15856112,name:"EDGE_BACK_RIGHT"},{vertex:[-6,-6,-10,6,-6,-10,6,-10,-6,6,-10,-6,-6,-10,-6,-6,-6,-10],color:15856112,name:"EDGE_BOTTOM_LEFT"},{vertex:[6,-6,10,-6,-6,10,-6,-10,6,-6,-10,6,6,-10,6,6,-6,10],color:15856112,name:"EDGE_TOP_LEFT"},{vertex:[10,-6,-6,10,-6,6,6,-10,6,6,-10,6,6,-10,-6,10,-6,-6],color:15856112,name:"EDGE_LEFT_FRONT"},{vertex:[-6,10,-6,6,10,-6,6,6,-10,6,6,-10,-6,6,-10,-6,10,-6],color:15856112,name:"EDGE_RIGHT_BOTTOM"},{vertex:[6,6,-10,10,6,-6,10,-6,-6,10,-6,-6,6,-6,-10,6,6,-10],color:15856112,name:"EDGE_FRONT_BOTTOM"},{vertex:[6,10,6,-6,10,6,-6,6,10,-6,6,10,6,6,10,6,10,6],color:15856112,name:"EDGE_TOP_RIGHT"},{vertex:[10,6,6,6,6,10,6,-6,10,6,-6,10,10,-6,6,10,6,6],color:15856112,name:"EDGE_TOP_FRONT"},{vertex:[6,10,-6,6,10,6,10,6,6,10,6,6,10,6,-6,6,10,-6],color:15856112,name:"EDGE_FRONT_RIGHT"},{vertex:[-10,-6,-6,-6,-6,-10,-6,-10,-6],color:15856112,name:"CORNER_BACK_LEFT_BOTTOM"},{vertex:[-6,-6,10,-10,-6,6,-6,-10,6],color:15856112,name:"CORNER_BACK_LEFT_TOP"},{vertex:[-6,10,-6,-6,6,-10,-10,6,-6],color:15856112,name:"CORNER_BACK_RIGHT_BOTTOM"},{vertex:[-6,10,6,-10,6,6,-6,6,10],color:15856112,name:"CORNER_BACK_RIGHT_TOP"},{vertex:[6,-6,-10,10,-6,-6,6,-10,-6],color:15856112,name:"CORNER_FRONT_BOTTOM_LEFT"},{vertex:[10,-6,6,6,-6,10,6,-10,6],color:15856112,name:"CORNER_FRONT_TOP_LEFT"},{vertex:[6,10,-6,10,6,-6,6,6,-10],color:15856112,name:"CORNER_RIGHT_FRONT_BOTTOM"},{vertex:[6,10,6,6,6,10,10,6,6],color:15856112,name:"CORNER_TOP_FRONT_RIGHT"}];h.forEach(u=>{const d=Ua(u);this.group.add(d),this.meshs.push(d)}),p.forEach(u=>{const d=Ga(u.vertex,u.color,u.name);this.group.add(d),this.meshs.push(d)}),this.group.add(Ha()),this.size=l,this.element.addEventListener("mousemove",this.mouseEvent.bind(this)),this.element.addEventListener("click",this.clickEvent.bind(this))}mouseEvent(e){var p;const i=this.element.getBoundingClientRect(),r=i.width,a=i.left,l=i.top,c={x:0,y:0};c.x=(e.clientX-a-r+this.size)/this.size*2-1,c.y=(e.clientY-l)/this.size*-2+1,this.raycaster.setFromCamera(c,this.cubeCamera);const h=this.raycaster.intersectObjects(this.meshs,!1);if(h.length<1){this.moveMesh.geometry.setFromPoints([]),this.currentMesh=null;return}h[0].object.uuid!=((p=this.currentMesh)==null?void 0:p.uuid)&&(this.currentMesh=h[0].object,this.moveMesh.geometry.copy(this.currentMesh.geometry))}clickEvent(){if(this.currentMesh==null)return;const e=this.currentMesh.name;this.changeCamera(e)}changeCamera(e){const i=new f.Vector3,r=new f.Vector3(0,1,0),a=this,l=function(){a.sceneCamera.updateMatrix(),a.sceneCamera.updateProjectionMatrix()},c=function(d,m,v){const g=d.distanceTo(a.sceneCamera.position)*2,x=new Oe.Tween(a.sceneCamera.position).to(d,g).easing(Oe.Easing.Circular.Out).onUpdate(()=>{l()}),b=new Oe.Tween(a.sceneCamera.up).to(m,g).easing(Oe.Easing.Circular.Out).onUpdate(()=>{l()}),C=new Oe.Tween(a.control.target).to(v,g).easing(Oe.Easing.Circular.Out).onUpdate(()=>{l()});x.start(),b.start(),C.start()},h=this.getAllObjectBox(),p=h.getCenter(new f.Vector3),u=h.max.distanceTo(h.min);if(u!=1/0){switch(e){case"qian":i.set(p.x,p.y,h.max.z);break;case"EDGE_FRONT_RIGHT":i.set(p.x+5,p.y+5,p.z);break;case"you":i.set(h.max.x,p.y,p.z);break;case"EDGE_BACK_RIGHT":i.set(p.x-5,p.y+5,p.z);break;case"hou":i.set(p.x,p.y,p.z-10);break;case"EDGE_BACK_LEFT":i.set(p.x-5,p.y-5,p.z);break;case"zuo":i.set(p.x-10,p.y,p.z);break;case"EDGE_LEFT_FRONT":i.set(p.x+5,p.y-5,p.z);break;case"EDGE_TOP_FRONT":i.set(p.x+5,p.y,p.z+5);break;case"CORNER_TOP_FRONT_RIGHT":i.set(p.x+5,p.y+5,p.z+5);break;case"EDGE_TOP_RIGHT":i.set(p.x,p.y+5,p.z+5);break;case"CORNER_BACK_RIGHT_TOP":i.set(p.x-5,p.y+5,p.z+5);break;case"EDGE_BACK_TOP":i.set(p.x-5,p.y,p.z+5);break;case"CORNER_BACK_LEFT_TOP":i.set(p.x-5,p.y-5,p.z+5);break;case"EDGE_TOP_LEFT":i.set(p.x,p.y-5,p.z+5);break;case"CORNER_FRONT_TOP_LEFT":i.set(p.x+5,p.y-5,p.z+5);break;case"EDGE_FRONT_BOTTOM":i.set(p.x+5,p.y,p.z-5);break;case"CORNER_RIGHT_FRONT_BOTTOM":i.set(p.x+5,p.y+5,p.z-5);break;case"EDGE_RIGHT_BOTTOM":i.set(p.x,p.y+5,p.z-5);break;case"CORNER_BACK_RIGHT_BOTTOM":i.set(p.x-5,p.y+5,p.z-5);break;case"EDGE_BACK_BOTTOM":i.set(p.x-5,p.y,p.z-5);break;case"EDGE_BOTTOM_LEFT":i.set(p.x,p.y-5,p.z-5);break;case"CORNER_FRONT_BOTTOM_LEFT":i.set(p.x+5,p.y-5,p.z-5);break;case"CORNER_BACK_LEFT_BOTTOM":i.set(p.x-5,p.y-5,p.z-5);break;case"shang":i.set(p.x,p.y+5,p.z);break;case"xia":i.set(p.x,p.y-5,p.z);break}i.sub(p),i.setLength(u/1.2),i.add(p),c(i,r,p)}}setControl(e){this.control=e}}function Ua(o){const e=new f.PlaneBufferGeometry(12,12),i=new f.MeshStandardMaterial({map:null}),r=new f.Mesh(e,i);r.userData.color=16777215;let a;switch(o){case"上":a=new f.CanvasTexture(Xt("前")),a.encoding=f.sRGBEncoding,i.map=a,r.name="qian",e.translate(0,0,10);break;case"下":a=new f.CanvasTexture(Xt("后")),a.encoding=f.sRGBEncoding,i.map=a,r.name="hou",e.rotateY(Math.PI),e.translate(0,0,-10);break;case"前":a=new f.CanvasTexture(Xt("下")),a.encoding=f.sRGBEncoding,i.map=a,r.name="xia",e.rotateX(Math.PI/2),e.translate(0,-10,0);break;case"后":a=new f.CanvasTexture(Xt("上")),a.encoding=f.sRGBEncoding,i.map=a,r.name="shang",e.rotateX(-Math.PI/2),e.translate(0,10,0);break;case"右":a=new f.CanvasTexture(Xt("右")),a.encoding=f.sRGBEncoding,i.map=a,r.name="you",e.rotateY(Math.PI/2),e.translate(10,0,0);break;case"左":a=new f.CanvasTexture(Xt("左")),a.encoding=f.sRGBEncoding,i.map=a,r.name="zuo",e.rotateY(-Math.PI/2),e.translate(-10,0,0);break}return r}function Ga(o,e=16711680,i){const r=new f.BufferGeometry;r.setAttribute("position",new f.Float32BufferAttribute(o,3)),r.computeVertexNormals();const a=new f.MeshStandardMaterial({color:e}),l=new f.Mesh(r,a);if(o.length>10){const c=new f.Line(r,new f.LineBasicMaterial({color:5005417}));l.add(c)}return l.name=i,l.userData.color=e,l}function Xt(o){const r=document.createElement("canvas");r.width=512,r.height=512;const a=r.getContext("2d");return a.fillStyle="rgba(241, 241, 240, 1)",a.fillRect(0,0,512,512),a.font="220px blod",a.fillStyle="#6D8994",a.textAlign="center",a.textBaseline="middle",a.fillText(o,512/2,512/2),r}function za(){const o=document.createElement("canvas"),e=o.getContext("2d"),i=512,r=512;o.width=i,o.height=r;const a=e.createLinearGradient(0,0,512,512);a.addColorStop(0,"#F0F0F0"),a.addColorStop(1,"#D6DEEB"),e.fillStyle=a,e.fillRect(0,0,i,r),e.font="50px blod",e.fillStyle="#6D8994",e.textAlign="center",e.textBaseline="middle",e.fillText("西",50,r/2),e.font="50px blod",e.fillStyle="#6D8994",e.textAlign="center",e.textBaseline="middle",e.fillText("南",i/2,462),e.font="50px blod",e.fillStyle="#6D8994",e.textAlign="center",e.textBaseline="middle",e.fillText("东",462,r/2),e.font="50px blod",e.fillStyle="#6D8994",e.textAlign="center",e.textBaseline="middle",e.fillText("北",i/2,50);const l=new f.CanvasTexture(o);return l.encoding=f.sRGBEncoding,new f.MeshStandardMaterial({map:l,transparent:!0,side:2})}function Ha(){const o=new f.RingBufferGeometry(.6,1,100),e=za(),i=new f.Mesh(o,e);return i.scale.set(20,20,1),i.rotateX(-Math.PI/2),i.position.y=-15,i}class ja{constructor(e){L(this,"viewer");this.viewer=e}addAmbientLight(e){const i=new f.AmbientLight(e.color,e.intensity);return this.viewer.scene.add(i),i}addPointLight(e){const i=new f.PointLight(e.color,e.intensity,e.distance,e.decay);return e.position&&i.position.copy(e.position),this.viewer.scene.add(i),i}addSpotLight(e){const i=new f.SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);return e.position&&i.position.copy(e.position),this.viewer.scene.add(i),i}addDirectionalLight(e){const i=new f.DirectionalLight(e.color,e.intensity);return e.position&&i.position.copy(e.position),this.viewer.scene.add(i),i}updateLightIntensity(e,i){e.intensity=i}}class Wa{constructor(e){L(this,"viewer");L(this,"highLightMesh");L(this,"highLightMeshLine");L(this,"sparklingMesh");L(this,"keyDisplay");this.viewer=e;const i=new f.BufferGeometry;let r=new f.MeshBasicMaterial({color:4977407,transparent:!0,opacity:.5,depthTest:!1,depthWrite:!1});this.highLightMesh=new f.Mesh(i,r),this.highLightMesh.renderOrder=99,this.viewer.scene.add(this.highLightMesh);const a=new f.LineBasicMaterial({color:4977407,transparent:!0,depthTest:!1,depthWrite:!1});this.highLightMeshLine=new f.LineSegments(new f.BufferGeometry,a),this.highLightMeshLine.renderOrder=99,this.viewer.scene.add(this.highLightMeshLine),this.viewer.element.onpointerup=l=>{l.button==2&&(this.clearHeightMeshAndTreeHeightLight(),window.onpointerup=null)},this.viewer.element.onkeydown=l=>{l.key==="Escape"&&this.clearHeightMeshAndTreeHeightLight()}}setHighLightMeshMaterial(e,i){const r={color:4977407,transparent:!0,depthTest:!1,depthWrite:!1};try{e instanceof f.MeshBasicMaterial?this.highLightMesh.material=e:this.highLightMesh.material=new f.MeshBasicMaterial({...r,...e}),i instanceof f.LineBasicMaterial?this.highLightMeshLine.material=i:(i!=null&&i.color||(r.color=this.highLightMesh.material.color.clone()),i!=null&&i.opacity||(r.opacity=.5),this.highLightMeshLine.material=new f.LineBasicMaterial({...r,...i||e}))}catch(a){console.log(a)}}setHighLightById(e,i="uuid",r=!0,a=!1){var p,u,d,m,v,g,x;const l=[];let c=[],h=!!((u=(p=this.viewer)==null?void 0:p.utilsMenuRef)!=null&&u.comInfoRef)||a;return i==="uuid"?e.forEach(b=>{var C;if(this.viewer.allMesh[b]){h&&["Mesh","LineSegments"].includes((C=this.viewer.allMesh[b])==null?void 0:C.type)&&c.push(this.viewer.allMesh[b]);const T=new f.BufferGeometry().copy(this.viewer.allMesh[b].geometry);T.applyMatrix4(this.viewer.allMesh[b].matrix),T.deleteAttribute("normal"),T.deleteAttribute("uv"),T.userData={mesh:this.viewer.allMesh[b].uuid,guid:this.viewer.allMesh[b].userData.ExId},l.push(T)}}):i==="guid"&&e.forEach(b=>{for(const C in this.viewer.objs){let T=!1;if(this.viewer.objs[C].children.forEach(O=>{const P=O.geometry.userData[b];P&&P.forEach(V=>{var I;const R=V.uuid;if(this.viewer.allMesh[R]){h&&["Mesh","LineSegments"].includes((I=this.viewer.allMesh[b])==null?void 0:I.type)&&c.push(this.viewer.allMesh[b]);const G=new f.BufferGeometry().copy(this.viewer.allMesh[R].geometry);G.applyMatrix4(this.viewer.allMesh[R].matrix),G.deleteAttribute("normal"),G.deleteAttribute("uv"),G.userData={mesh:this.viewer.allMesh[R].uuid,guid:this.viewer.allMesh[R].userData.ExId},l.push(G),T=!0;return}})}),T)break}}),l.length?(this.viewer.mergeBufferGeometries(l,b=>{this.setHighLightMesh(b),r&&this.viewer.focusOnTheMesh(this.highLightMesh)}),(m=(d=this.viewer)==null?void 0:d.utilsMenuRef)!=null&&m.comInfoRef&&((x=(g=(v=this.viewer)==null?void 0:v.utilsMenuRef)==null?void 0:g.comInfoRef)==null||x.setComGroup(c))):this.clearHighLightMesh(),c}setHighLightMesh(e){if(!e.attributes.position){console.error("Geometry is empty. Cannot create EdgesGeometry.");return}this.highLightMesh.geometry.copy(e),this.updateHighLightMeshLine(),this.viewer.setAllMaterialsTransparent(.5)}updateHighLightMeshLine(){var e;this.highLightMeshLine.geometry.setFromPoints([]),this.highLightMeshLine.geometry.dispose(),(e=this.highLightMesh.geometry)!=null&&e.attributes.position&&this.highLightMeshLine.geometry.copy(new f.EdgesGeometry(this.highLightMesh.geometry,Math.PI*6.137))}clearHeightMeshAndTreeHeightLight(){var e,i,r,a,l,c,h,p,u,d,m,v,g,x,b;(i=(e=this.viewer)==null?void 0:e.rayCasterManager)!=null&&i.raycasterResultGuid&&(this.viewer.rayCasterManager.raycasterResultGuid=""),(h=(c=(l=(a=(r=this.viewer.highLightMeshManager.highLightMesh)==null?void 0:r.geometry)==null?void 0:a.attributes)==null?void 0:l.position)==null?void 0:c.array)!=null&&h.length&&(((u=(p=this.viewer.options.utilsMenu)==null?void 0:p.options.tree)==null?void 0:u.show)!==!1&&((m=(d=this.viewer.utilsMenuRef)==null?void 0:d.treeRef)!=null&&m.show)&&((g=(v=this.viewer.utilsMenuRef)==null?void 0:v.treeRef)!=null&&g.onTreeNodePointerClick)?(b=(x=this.viewer.utilsMenuRef)==null?void 0:x.treeRef)==null||b.onTreeNodePointerClick(null,!0,!1):this.clearHighLightMesh(!1))}clearHighLightMesh(e=!0){var i,r,a,l;(i=this.keyDisplay)!=null&&i.length&&this.keyDisplay.forEach(c=>{c.parent&&c.parent.remove(c),c.geometry.dispose(),c.material&&(Array.isArray(c.material)?c.material.forEach(h=>h.dispose()):c.material.dispose())}),this.highLightMesh.geometry.setFromPoints([]),this.highLightMesh.geometry.dispose(),this.highLightMeshLine.geometry.setFromPoints([]),this.highLightMeshLine.geometry.dispose(),e&&this.viewer.resetView(500),this.viewer.setAllMaterialsTransparent(1),(l=(a=(r=this.viewer)==null?void 0:r.utilsMenuRef)==null?void 0:a.comInfoRef)==null||l.setComGroup([])}}function Xa(){let o="";for(let e=0;e<32;e++){let i=Math.random()*16|0;(e===8||e===12||e===16||e===20)&&(o+="-"),o+=(e===12?4:e===16?i&3|8:i).toString(16)}return o}const Zs=o=>{if(typeof o!="object"||o===null)return o;let e;if(Array.isArray(o)){e=[];for(let i=0;i<o.length;i++)e[i]=Zs(o[i])}else{e={};for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=Zs(o[i]))}return e};function rn(o,e,i="id"){if(Object.prototype.toString.call(o)==="[object Object]"){if(o[i]===e)return o;if(o.children&&Array.isArray(o.children))for(let r of o.children){const a=rn(r,e,i);if(a)return a}return null}}function Ys(o,e){const i={...o};for(const r in e)e.hasOwnProperty(r)&&(typeof e[r]=="object"&&e[r]!==null&&!Array.isArray(e[r])&&typeof o[r]=="object"&&o[r]!==null&&!Array.isArray(o[r])?i[r]=Ys(o[r],e[r]):i[r]=e[r]);return i}function kt(o){return getComputedStyle(document.documentElement).getPropertyValue(o)}function Za(o,e){const i=o.getBoundingClientRect(),r=i.width,a=i.height,l=e.clientY-i.top,c=e.clientX-i.left,h={x:0,y:0};return h.x=c/r*2-1,h.y=-(l/a)*2+1,h}class Ya{constructor(e,i){L(this,"viewer");L(this,"raycaster",new f.Raycaster);L(this,"eventHandler");L(this,"raycasterResultGuid");L(this,"objs",[]);this.viewer=e;for(const r in this.viewer.objs)Object.prototype.hasOwnProperty.call(this.viewer.objs,r)&&this.viewer.objs[r].traverse(a=>{a instanceof f.Mesh&&this.objs.push(a)});this.setEventHandler(i)}setEventHandler(e){var l,c,h;if(this.raycasterResultGuid="",(c=(l=this.viewer)==null?void 0:l.highLightMeshManager)==null||c.clearHeightMeshAndTreeHeightLight(),(h=this.eventHandler)!=null&&h.length&&this.eventHandler.forEach(p=>{this.viewer.element.removeEventListener(p.type,p.handler)}),this.eventHandler=[],!e)return;const i=Array.isArray(e)?e:[e],r=i.map(p=>p.type);if(r.includes("click")&&!(r.includes("mousedown")||r.includes("mouseup"))){const p=i.findIndex(u=>u.type==="click");if(p!==-1){let u;const d={rayResultOption:{highLightMesh:!1,focus:!1,useDefault:!0,useRaycasterResult:!1},type:"pointerdown",callback:v=>{v.button===0&&(u=Date.now())}},m={...i[p],type:"pointerup",executeBeforeCallback:v=>v.button===0?Date.now()-u<200:!1};i.splice(p,1,d,m)}}let a={highLightMesh:!0,focus:!0,useDefault:!1,useRaycasterResult:!0,intersectObjectsParams:{objects:this.objs}};i.forEach(p=>{const u=d=>{var v;let m=(p.executeBeforeCallback&&p.executeBeforeCallback(d))??!0;if(((v=p.rayResultOption)==null?void 0:v.useRaycasterResult)!==!1&&m!==!1){const g=this.getRaycasterResult(d,Ys(a,p.rayResultOption));p!=null&&p.callback&&p.callback(g)}else p!=null&&p.callback&&p.callback(d)};this.eventHandler.push({handler:u,type:p.type}),this.viewer.element.addEventListener(p.type,u,p==null?void 0:p.options)})}getRaycasterResult(e,i){var c,h,p,u,d,m,v,g,x,b,C,T,A;const{intersectObjectsParams:r}=i;let a=Za(this.viewer.renderer.domElement,e);this.raycaster.setFromCamera(a,this.viewer.camera);const l=this.raycaster.intersectObjects(r.objects,(r==null?void 0:r.recursive)||!1,(r==null?void 0:r.optionalTarget)||void 0);if(i.useDefault)return l;if(l.length>0&&l[0].object.type=="Mesh"&&l[0].faceIndex!==void 0){const O={},P=l[0].faceIndex*3,V=l[0].object,R=V.geometry;O.point=l[0].point,O.default=l;const I=R.userData;e:for(const G in I){const X=I[G];for(let j=0;j<X.length;j++){const z=X[j];if(P<z.face_end&&P>=z.face_start){const J=z.uuid,Q=this.viewer.allMesh[J],de=(c=Q==null?void 0:Q.userData)==null?void 0:c.ExId;if(O.uuid=J,O.guid=de,O.object=Q,O.userData=(h=V.parent)==null?void 0:h.userData,i.highLightMesh){const ie=(p=this.viewer.utilsMenuRef)==null?void 0:p.treeRef,me=!!(ie!=null&&ie.show),W=!!((u=this.viewer.utilsMenuRef)!=null&&u.comInfoRef),$=me||W||!!((m=(d=this.viewer.options)==null?void 0:d.baseConfig)!=null&&m.clickHighlight);if(this.raycasterResultGuid="",$){const ae=((x=(g=(v=this.viewer.options.utilsMenu)==null?void 0:v.options)==null?void 0:g.tree)==null?void 0:x.show)!==!1&&me&&!!(ie!=null&&ie.onTreeNodePointerClick)&&(ie==null?void 0:ie.activeName)!=="model"&&!!((b=ie==null?void 0:ie.currentTreeData)!=null&&b.length)?rn(ie.currentTreeData[0],de,"guid"):void 0;ae?ie.onTreeNodePointerClick(ae,!0):(((A=(T=(C=this.viewer.options.utilsMenu)==null?void 0:C.options)==null?void 0:T.tree)==null?void 0:A.show)!==!1&&(this.raycasterResultGuid=de),this.viewer.highLightMeshManager.setHighLightById([J]))}}break e}}}return O}else return null}destroy(){var e;(e=this.eventHandler)!=null&&e.length&&(this.eventHandler.forEach(i=>{this.viewer.element.removeEventListener(i.type,i.handler)}),this.eventHandler=[]),this.raycaster=null}}const St=(o,e,i)=>{const r=y.ref(null),a=document.createElement("div");i.appendChild(a);const l=y.defineComponent({setup(){return()=>y.h(o,{ref:r,...e})}});return y.render(y.h(l),a),r.value&&(r.value.destroy=function(){y.render(null,a),i.removeChild(a),r.value=null}),r.value},Ka=y.defineComponent({__name:"index",props:{text:{default:()=>"-"},customStyle:{},enterable:{type:Boolean,default:()=>!0}},setup(o){const e=y.ref(!1),i=l=>{e.value=a(l.target)},r=()=>{e.value=!1},a=l=>{const c=l,h=c.getBoundingClientRect().width,p=document.createRange();return p.setStart(c,0),p.setEnd(c,c.childNodes.length),p.getBoundingClientRect().width>h};return(l,c)=>(y.openBlock(),y.createBlock(y.unref(Ee.ElTooltip),{"popper-class":"custom-over-flow",visible:y.unref(e),content:l.text.toString(),effect:"light",placement:"top",enterable:l.enterable,"hide-after":100},{default:y.withCtx(()=>[y.createElementVNode("div",{class:"text",style:y.normalizeStyle(l.customStyle),onMouseenter:c[0]||(c[0]=h=>i(h)),onMouseout:r},y.toDisplayString(l.text),37)]),_:1},8,["visible","content","enterable"]))}});const Ue=(o,e)=>{const i=o.__vccOpts||o;for(const[r,a]of e)i[r]=a;return i},vt=Ue(Ka,[["__scopeId","data-v-c466b0fc"]]),qa="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADCCAYAAAAMw434AAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQmMJUd5/qvf3DM7e3l3Zuc+dnaAxcQ2xiHExoAVYoIsAg4KIUEON1gxAouIBHNsOJyExME2QgYZxBGCyIJsRIKJIYqRMSDHNsYGO+s95r53Z9az1+zMvHkVVXdXd1V1dXd1v+43/XqqJXt3X9fx/99fXx3/X1WNYJMejHE7ANwEADcAwBUA0LhJouhqqwOBMwDwJAAcBoDvIoROVkJsVIlKxDowxu8GgLs0KTYD/VzUOQ8ANyOE7ktbm4oTBGN8CAA+KSpWKpVgYwMDxhhw2lrr8qsWAdJgEUJQKBhgGOhDCKE701SmogTBGL8VAP6NVai4UYLV1XWTHPrRCERBoKbGWEdgvKqpqfYXUfJFSVsxgmCM6wHgBAB0UgFXV4uwulaMIq9OqxHgEMAAv93R2nhpWrBUkiBvthdYpi6EGIQg+tEIlItAaaN0xc6dzWQBn/hTSYLcDQC3EA02Nkpw/sJa4sroArcmArgEt+3Y0Xh7GtpXkiAPAMDriBIrF9dhfX0jDX10mVsRAQz3bN/eeHMaqleSIA8BwKswBjh77mIauugyty4CX9/e2vj2NNSvOEGIO/fceT29SsOYW7jM/BBErz+2cDNOT3VNkPSw1SXnAAFNkBwYUauQHgKaIOlhq0vOAQKaIDkwolYhPQQ0QdLDVpecAwQ0QXJgRK1CeghogqSHrS45BwhoguTAiFqF9BDQBEkPW11yDhDQBMmBEbUK6SGgCZIetrrkHCCgCZIDI2oV0kNAEyQ9bHXJOUBAEyQHRtQqpIeAJkh62OqSc4CAJoiKEVHFjn+pSKPTUATIKdKUH02QMIANA0FLM7lZSD9ZQ+DM2dSPWGuChBldEyQMoc17rwmigD3G2Ly0Ia0jt5ogCkbYpCSaIArAa4IogJTTJJogCobVBFEAKadJNEEUDJs2QYgHq7GhTkESnaTSCFxYSf2ap+pZpP/kJ49vr2+tvxqM0p8ijPoAYCcxyEteNNjf2tzUnNYapNJG1/VlB4Hls+dOj0/PTpsSIXy+hOFRMIwfnpldfeSGG668UI6kiUUODmFsvObRp98EBfR1BNAsCnXpcD9s39ai7+Utx1o6rxSBpeUzMDVHvqkjPBgWSgZ627VXXvrjuNAlQhBCjuv+9zf3ggHv8BNEEySuiXS+MAR8CWJnRGDcevXLXvz5sHJk7xMhyCOPPf1eDPClIAE0QeKYR+dRQSCMIGYZJfSma3730vtVymPTlE2QX/z6uc6N9dUjANCiCRIVfp0+CQRUCIIxzG2cX+x/9atfHSmsXzZBfvbYU7cBoM+EKapHkDCE9Pu4CKgQhJSNEbr5lVdeek+UesomyMOPPf0Esj7jHPhogoQhpN/HRUCZIAAPvPJlL3l9lHrKJsjPHnt6FQBCAxCaIFHMotNGQUCVIIDx0Wuu+p3hKGUnQRClzcyaIFHMotNGQUCVIBjD2Cuvekl/lLI1QaKgpdNmEgFNkEyaRQuVFQQ0QbJiCS1HJhHQBMmkWbRQWUFAEyQrltByZBIBTZBMmkULlRUENEGyYgktRyYR0ARRMAs5k97cFBqvVChJJ0kagbPnSCw5vUcTRAFbfWmDAkiblCTtI7eaIAqG1QRRAGmTkmiCKACf9lYTTRAFI2xSEk0QBeA1QRRAymkSTRAFw6ZNEITI1aN6ka5gioon0Yt0BcjTJoiCCDpJThHQi/ScGlarlQwCmiDJ4KhLySkCmiA5NaxWKxkENEGSwVGXklMENEFyalitVjIIaIIkg6MuJacIaILk1LBarWQQ0ARJBkddSk4R0ATJqWG1WskgoAmSDI66lJwioAmSU8NqtZJBQBMkGRx1KTlFQBMkp4bVaiWDgCZIMjjqUnKKgCZITg2r1UoGgUoTBC0vL+9c2djoKG3g3yuA0QpQghIY5DtWAOaf5CG/GLCw9Pw/s9e7+92G3b5nFzTW10EJY1hb2+CQQYAAA39JvOw3mom8Iw/JE5SOpjcMA+pqC1AwEJCDVfqpLAKrgr2Trr1iBFlYWGjfgNrvAMC1Zvsj/8MYgdkgMW1c2PrNeqqtwbU0NUBzU33VyZ10o6pkebk4cjszv/iHAOi/goEjPTDhjD9B6DiQ5X6akPqSXdugYNDRsJLNZevVVfUEmVlYugYwPBxmOtKwMFb6Xo4zutjDEBlrCLm4h7yTEcnv9zD5orwnuuzd3apHkiigxUxb1QQ5fPhw4eprr1tEyGhlRwZhkWBPuGIi5JMtKuEs1tmFURaxQ5YKd5n8DfW1sKO1WZMkWbN6SqtqgszOL92MAb5oryeYdYcXNYQQN71KGdeKFL+8vAjD+wc1SVJEu6oJMjO/9CAAvJbgQ6ZP1bboLteuR08cg+amRjh4INK3HcutdkvlXy8S72d6T6perJn5xTkM0Oa4Ti2SsMsAbklgk6gSy4T0EGVKnj+5AM8eew6G+gbgwIAeSSoCesKVpEqQ6fklDDYp6BqEGUVMIpgLc7LCthfo5lTLXg1k2VulYocz587Cr5/5jenRGujphcHe/i03iqrglOU0qRJkZn5pEQB2Ogt0K+TBEYKuT1gCWaQxfVNZxi5UtmKxCI8++TgUCiSQaEBvVzf0dfVokoQil50EKRPk9BMY8BVkfKAqm0SwRwzqafJ4nHJADjpPfOypX5mjo2GTpHtfJ3R3dGqSZIcDgZKkSpDpucVvI4TewowOUk+VPe3yvDOJYw05jP/VHHPMf1sDkvXeGZzoICWoXemFjSkXBnj26BG4uLZqjiCGUYBCwYCOtnbobNunSVIFJEmVIFNzp25HgP42VRcuZYbLmxiws4UwXIw0w3PLMPdw2WuqkYkxOHvurEUQexQhRGnfs9f8b6t59mIYZ1OzpEqQybnF9xgAX5asM3IX8/Cz4uzCHCwuLXLkIBscyX97d++Bvbt3a5JsKgWCK0+VIFNziy9HAL+MoX/sGVGsCHoMAVWzLD1/GuZOzjtTLEoOa8plwJ5dl8DunTtVi9PpKoxAqgQZHV1or2sszNJlgUqrpwHFVKdlFQR55eIKTExPmusPjhwFAwxkkWT3zl2ws3V7BaXSVakikCpBiBDTc4unMeAddF7OzrnpOQ3bnWvFRexzGKoKcOkkS4lY5SSYqbhRhNGJcZ4c9uhBCUP+JATZvq01wZp1UUkgUAmCPIkxvoyuQ8ifxKtFPVT0UBL7ZxKKZamM0clxUxw6rWKJwf59e8s22NbckiXRt7wsFSDIqfsxhj+mSNOpExcDscMkwpaU3BhnZn4WSNDQjxjm7wiZ77c1tUBzU1NudK92RSpAkKW/B8AfYUYOy4PFBi6cSIYXTneXuffYrFmmz7mPLBnm1NIiXFy96E8QmxxkTYIMBM2NTdDU0JglFbasLKkTZGp+6b1QKn2JTrEwYBL9cx8hjsGfA/dZVAis4KdpbgDR+l1+cMoilzzI6Ab+eeHcwCS/DUaujnum/czZM3D+wgUvQcxFujVyUHKYfyJkEqShvn7LNsysKJ46QWZnT1+7ARs/VVZYOLTkEMZp6e7GRqdMSUBPvHBB5QIGPxmleSXM86Sz01xYWTGDhdwUK4AcJB0hSUNdPdTX6a/rKredFBKmThDi6q1tMIirN/BRil/E8VLFyOPIwhJP5UShj4YbpQ0g8RCeIPKRg65HiAwIGVBfWwu1tbVh8On3KSGQOkGI3FOzJ1cAUIN9Aw/f38t2eSRwuEqJcCmBKit2de2COakzRwfq5qVrD2aRThbr5nv7HdGjjpCkpqaC0lZPVVV9opDCPDWz+CRGpcvE7es+64NsrLtjjDyeZsWUUSptQLG05rp6KRFCyEEIQshCCEK2zeuHRyAXBJmcO3U/Yly9rIpsYNC5rC0n50HExlzCRTMUSkcH1r0rGzkoOcw/DcMhlyaJi0A+CDKzcCdCxgfcE4SWf5bdTmIFDpkt7Nb7nLUFoiE5GwIcSSgBTJLYIwadZllrEfd3uoDPGTCx1ckFQaZmTr4PI7iHkoKg4cRC7BiIcycW51l1CSKe/aCIZmM+Ft2+ZElRU1OwCGFPs+jf2ZGDJQdLlug15jNHLggyOblwPdSgHyFyBF2Mg8jsJgQRw0xL4x1WOja2wd6vy7ukxBiJe38vexjLKpE/rsXHTthLvXg5qCxUejc26v4i18xU37mUlU3j3hxMpLIca0RH6//W8TI+jd901u1g3HGbXyO6v/MouBiznZQrhxUjUtlT503jdnd8x8cfmnP/hcz7mOmVBirzDRez4BiZoxtpsfbZHjZoLbY5hFAJAJ3jrWX+axZB4c6ujl1mLFDyHmBs7OS+Qh3MhDV0szHK7scSNaeSqiCiUmnaaap1mEsbl2oqn21zostf5tDx/IbWAMEnuvdd8o+yDhJNzpwkfs4G+9of++LqEISieJLYUSeNBplGmXz3HhTy938Xt5HJ9AnTUdYxheXxDjju/iB2kPLr7MTy/RpnWvYXB1K/YYCRy7qZR9gxYuUjqb7T3bHnreZgwJY1OXPyCAAMs1vcfbEld2cxl1jHbQO5yBelk8iFwjlRgs4ybXW46SQufaq7s+2TIkG+DwBvsGjErw2chEKhOYFKq7HFEPDr+BmSlNZW1vs5goxPL9yFEBBXr/k4CzlztLBGG6XRZYuBrdWtLgR4J4DXdWK2cyvOdztPkJmTHzQAPs9cCudse2fPgdBt8PmLgVSXobW00RHgO3hxsWQOCuZQgEsYGQj9ip9iTS5cjw34Eesz9fVY2WVTkvBVsY5M602138AY3RQ6R6URcNfqdFTg72Uz19/+i2qTF8I5qBWOIGNjMy80amuedQ5K0amWdZm169WyblV0CxMzBCAji22wUQE+RuJV0D82wk4MXQH4S+2sSaL78G4VvygFHZL5y/Cssljii+msery+R+95GiqRZT0acHXTeeMzbFRF1JxtA2LsSBaDYs3FfyvSjS7JOjhv/ytvfW4pfMOlU/Zk7R9CS5kr2M/JYse52BLRxPSC5656x+0ruMUcV1mluwpPfdqNVM5Zmk03XyUFcGc+ZgfvzJCYJkTbNcZ43OPZnpheOIoQ2u/7tSmOToJmfNfFv6yWgGEljaXrShYBcXQQ4y7WXN9xOLnjNj8TcIRC8LCXIDMLDwK2P6gTcL1P4ndisYNA3AGh3DL88rMoyYbocswcMLxzM7Sodcgah9VAvJ/TU8XNr0yZbFFtqCpDVBzE9H5hCllcD8M3PAQZn164GwHcIu7BcWlnTsys4anKP31QLtap5Y/auFITJH8F24tpaxc6v1VOuILd3Kr+UckIcvJDgPG/uDct2l4oOxaissEtf7BqjfKAgBP/sPcSOtdb+XX0BfRnHoJMTi68DhvwQ7oNhfdqeGHSo0gemk7+dZB79iy9fS8PMWoOeqdY47MvgoLxjJ3Tcufa3itkIEwCKBRONgbCTk/zD7fWMOsIsPsXWTcz53V3yEG0sWMk1m51cyX//Km5Fg9BDh06ZLz9Xe/fYBdzvgtylyrMaQe7Mg+C4kkG3mfOr4PFQA+/q1L0tnvXS/z5EJG8sru2XI8G7VX4CAarlbc8Nw9bjmsY7+eFnE7G/otv/Ep479VdvonYf6+R+qZjMWIkw4jiwupq9cr8I7MZm6pc+3utJqGwLYQTw7MFNaPn9p3TZi5roTLZ29XeI3W+jk/NW67egINTnP84693JlpBPr+xVzMyRQ5bBZcTPejvbXiknyPT8jwHDH0jzi4elpCWoiKrTaAQqjEA0F/03erva/tKHIHN3A0a3OOIzbl2pF0ucS4h7EPJMorC5kawNxMnj15aSLKvC7TWx6tgFh1ioPO7jCRZy2cw8+KO9Xe1/L226Y1PztwLAHXxcyG312nPFwKlnNom180oVJHzzxlstMtcWb+3pbP+OlCDHJ2feWIOM+zwH++3ACt3DQs+IVEoxXU+KCGwRojuzLGFWZK3X3Yss1orFlw71dfLb3Sn8Y9PTlwMu/Io1B90nb6/yzRNUtNAUzba1i94ijbaSRhbjejSMQT1ZRBaS5nydse3g3r3npCPIU0891bx9dxt3PYq/Eu5WbL+lSJ6XIJU0rq7LH4Ewt7a7THE6diu+J33Qyb6utr3WAODzjE/Nz2HAbeawY18z6jlKEcNi7HmOoPWld91l/cL7272/+SnEAuQ9w2H1G2L5sjgGVVkWI+CjtVZKv1hIUNlUGvfMh/WL/EwGfzgtbH0YFkNiTSoG2/xu9PKLl4jNw73nwN0zGW4vFnF/+7MjQ+DWf1tY7qgGGx+xSPPzvq72qwMJMjI5998GgusoKTzXpLAr+BhEqVwW9wCSMGV0zte7v+d5TpNn3SK2JpsQztearUAhaQ/mKhsh9K3erra3BRJkbHLuKwDwTucDUCzz2Ot+9PwponV08k1FgB/u7EGNEIS5IwvhT/d17ftEMEGm5j4KAJ8J8lSZRNQE2VR768oZBMLmesL0il5XKpmW/nlfd/u3g6dYU7N/gjB811kz2B4w9r4s8yiufR2QI6Y4kssDNfzNfTRzFLKJE35ZXsenJ4AYNj30K9s7gecXGuICxU+muN6MoPqDVqniYijQ8rYSfguqOLiLC0o+wMbPcFUZL5OPbUcsWcQywy49NNDv93W2/SIQpuPjMy+tMYzHeZvbC0J9eZyqGXW6jCHghCeY802Oc8Zu1yuoeMkLu7oWAwlCXL2tu/Y6rl4/z0CY1yRj+GhxtiACssGVvznUHTURQqf6utv3KE1qRidnFwDASWwyStisKLsqhzJPNsPZgvbRKlcAAdGN7z9D9J972UuGJ/q621+mRpCJmYcBoWvcxPyN2PRgie+JLAYYMfbATs8tkb3+fK8f3r0ni71LyTult0qUpbFqYuMTPjdaMOn81n5BSxVZm2CXYzL9qXY8Vi4K4mgtkytYJm9fKi7HxLMy/tN6v7hMOLbypVR8+3tvoVBdjDBWsoVCgL7V191uungDp1jk5cjEzFcQIOLqld9I57cwrECPoauoBgSqKPZit2WM8WcHejo+pkSQsYm52wDBp61eV/IthShep2qwp5Yx/wiwrl7z4jhzo4h7gRzAO/p79n1NiSAj47NvRggOO2MNu6gwP3kluZsx/xBrDasZAWFeyp8wJB9vLVzd29n2cyWCPDcyeVVdTc2jzhzPiXsEzK28k1r1Q9DVDLyWffMQCIx52GIxaeioYS0deFfS6oX1zhe8oMf5FGHgJOmZZyZ3NW0rmP5ge7Tg7o+zCo85z+J3HXrBFVexaUxnw4Kafu+DAn2iscLKsOav3lsd/PT1ru5d7Pze+XkHaN1RmrZfByjzqASVu1n2N2MdmHyzWwhym4Zb6u/p2M2KHdq6iasXY7xHvuWP3f8aBWWdNnMIpNEBZU5Jc2uUueZw2MFE1RGgJ/p69l0ZiSAjEzOPIoCrnI7RdYf5uLZkXWIoDzMIpRYpjwhQYvATK3rTD3xvoLfjzdEIMj7zr4DgL6wgivVlcDsKaV8fzy5ngiaD9jTNTC6Kx4oUZdqWRFpxbpD1ZiGLIqh0QFGwEjGQ5S23PLY9lGN/t/2xjd89xue1J2tx4e3tAz0dt0UjyMTsxwHwp5wbFu3cdH1jfiCe/Y0pXWX6zQuY1DgfVE5SdYjAq5armi5sAh9gZierrC52EaFSRpQOo1zdouf3o65fIzfbqnnmQ2i35IVhvGugu/2r0QgyNfM22IBvmnM3upRkPLx+5JBVEoVINKpcwhiKxQ0oYc93faJYTqfNOAIGMqC2tsaU0hoPLbKozElEmgeu/yV9Aj0MWBBcvH5jHAclcfXW1hQetRObCxxG/thOLBV7ra8X4dTpZSAk0U/+ETAMA/bs3A41NQWuiSWquWwIsSvYWCt1Dw11TUUaQWZnZ/esrGGyadESmo4k1tFE9+C7ZFkhHTCZMVE2TWOFO7n0PKytFxPFRxeWbQQa6+tg145Wr5DlLIPYvL59LV775tfubTx06BA3VVFZ3cHI+MwyALalFp3tIUXIxrswH7gNz+zJRT16ZLs9Jy5dbU0N7N21w1uuGMvxa+hByy6nVLc3d4KGAL8d6O24VKxYiSAnxqcfQwCcfzj8XooA7BTXYgtLp2G9uJG4EXSB2UWgoa4OdstGkMRF5ockhOC+/p6OG2MSZOZ7CPCNZpHscUXZkdsEFVlcPgMXV9cSLFEXlXUEmhsbYMe2lvTEpJF05vseZrvG6I6Bvo4PxyLIyMTMZzDGt7HnPpSGHqc2vzmVOG6y4mF4/ux5OL9yMT2wdMmZQ6C1pRm2NTVKv2fv9vmiq5qqwbYz7zSF86Jya2GES6XS+/f3d305FkGOj0/dhAB9nRXDdBvTr08JpcrWRKxKohCs541Nd/bCCpw5dyFzRtQCpYfAztZt0NhQ5/kYryx6Q6RglyJ+acR0Ip3IvzdK6Pqh/o4HYxHkxPjM1QjgYfdiLf/goCp0fmsu9ncyvVpaPqtapE6XAwSIm5fGQ1h1VNfoYRB4PKd271wDxcHe3t6RWAQZGZlvw4XinH3rnOnapRXF3cwbpgh5T+IgJ08vqyTVaXKCQPslO4HEQ5J6PBMt9hyTO/ysDfR2NCKEPNFo5aXEibHpcwC42YnRB82ZEtKuVCrB3KnTCZWmi8k6AqTX3beH222erMjc8Qxr6LB6ejg60Nc5LKtMmSDHxyYfR4Be6hbCnCaUBAmddOI7MeAT9B4DzJ5asi7P1k/uEagpFKwYiOjTEdfedFEhW5OLLdqzv8mMcNv7Gp2X9w/2db6pLIKcGJv6HgDcKL+vXChaMc7B5fLJQ6ZY60UdTc89OwCAxEB2bd+WrqqeSw/Nzz/fOdjf9aGyCHJ8bPJzAOivXYKq+KXK13WJxELW1ssvSJeQeQRIDGR7S3OKclqjB/lCmoEQLpFLG6xTt++TuXiJIOpTrNGpmxACx9Xr1ULmZHN3Y3orstKLLmGRgMvnLuhYSIpNJktFtzY3QUtTgy2SbEoRZ2piNXPmrLjjZKK6l3Dp+qH+Ho+LNxJBjo1OXosQ+mmQ2CwJxFWD37RSNJC4JDm/sgrL585nyY5alpQQ2NnaAg31dWbpYlsKWlrIliRBIlqfW7O+LkXaWwltDB6QuHgjEWRkZKSthOrm6E0/bHCPCiOSIAqOfn0D8WQtLC4rnAyIUptOmzUECgVrqzu5qCrqE7ndmSebyIkp80KstYHeTqmLNxJBDh8+XLjiqlecAQxNKhOzsMFQfB+UvlgswrkLF6FYIrT0uCUEPNmSxHWSCq1ledguwC/uz4ohq0c0e9gUIuy9XzPy63v9dBd/lzU3cfrM1i2bG6jo75ZRYxjQ2tLkG/8Ia0tRCGXSwvlkBwZkoBODvV37VdAMref46OQRAMT7i6MTPrSezU6QpEFkuviVn3a9m43rptcvCxcg9MD+vq7XJ0KQY6NTP0CAb3AP9NpD1WZqLsZVNlOWcupOQI/IBEugznJUTiRvFB3MyYc7vbKnUHcN9nd/MBGCnBibuqOE8a3coCHOGWUCy+J8QSt62aJGtkoTZ1M0n+gao5NJmefA341mleaXJ2hoEGckfrMWmby0TjZPlPziDJAtTzab8vuNYsZiIJsXizhk3P72iVjbthiBYXxgf2/nFxIhyLGx6ZsRLn2RL0wyx4rcldklxs3n0S5Kt5JIP6ZYSIhcyvrH0S9OHkW1xGTKeggZ4+ZTtr8bB3H6nCJ+w9BQzw+SIcjIxGsBoQe9nZv1i/N5K2Gzsmsavy4oqJv2osabOmhRqW45b5myxThbnt/CVSZPUEOTYSI6Ivg0skHCPeGp2qiDW6NVh6uj+410v8V+NdifcfHYB/9K6xsvOnCg7/8SIciRI2P9hfqCuSU4rKmHzRDYMtimJs46ZLMzdvSXzVJkzYsFgH0v/i7KzZJb/GKpXzOW6R40c5IZRzbz8epqIRckh9+4If7u3+xd6VhbVLP9aTSd6LB64Uz9wYMHfY+tSuZH/j0QcfVefuXLVwChWvoptiCg2HdB/VViI6tA3Ch9uaqsKv2z39gSlleUN+lyZPWXi3312d/tGjDgkQP9PYNh43uY3bj3R0cnjyCAYfknp9ykqsaVGShKw07D6LIRMhJICSUut/GqTzD9BQ7qOFQ6vTAdKm1/5hYTovT/DPV3X5c0QX6IAP7IKjR44RcGTkLtaEsWUw3YZl5GBPcO9XW/J1GCHBuZuAMQulWFIFul5Wa+IWwVQ6jraW7EwoBuHervujNRghwfmbwFA77bOoqlH41AtSFAPlJgOZkQgjfu7+/5fqIEOWa6esHeGqxJUm3NQ8trHpCyng18cGio99lECXL06PgA1KATzgVygSOJ6FBlhLMPA1vLGJtozC5La0OktePSHa3sXcrmO6ZsJ43MWUnVZ8jMpnfqt8tj/80uscTfWVQ5DESnq60HZwW7YLo3yNHfvMHM0duqUu7usFSQ6WRjw+JKsLInFU6Zzl39dvmOrmx9FGZqA8Z+jlpBnWTW7G/JY2OHl+sLLVd2dATeKxV5CMAYF46PTq5ggFrHdnS57mArzMqFYIbMB2/i7XyT11aCa4T8bx7fv+hucYCwhHPS25yj9vXz/8t8/jKXppifBZTTk3HNySjk0JjtGNg+wk7gV58fr2nAKjAfAwbXXzBYcXhJOMvny779EaDJoYHunrARNTJBSIHHRiaeAwRDZJUjtH1PfZ52K3RYYflZw7CNKOo9DioLaXZQswjLfARVgiT7nvs7498TB6Ewg8j0FfqJWN/MKLdeGfZKmIrfE8uI/THGDw0P9r4mDJe4BHkQA7w2rPCg9yrgxs0f1rDLkbsckqrUWwnZVeRQ6SBUy5Gl20z7k4lKCeOvDg/0vjtMh1gEeW5k4gsI4K/CCt/M9+UaIO0GklVsskTQcjAKtj9ZUxkfOdDf/bmwOmIR5Ojo5AcA47vCCo/zPi8GiqO7zhM+rU0MI1y68cBg331h5cUjyImx1wNC/2kVHquIMLlo850DAAAD5klEQVT0e41AKghQP9DaevGyFw8PPBVWSazWfezY+EFcQL+xfIexigiTS7/XCKSCgHkgHQGcaahtDnPxxu7+Hzh2rH5/oY5cu17rjiIS56Xt+7OEYnyD7vdyGRBE36HoMBV9ycxOMNHnz8VPRIctqdLX0WzLI3P+UlEZfy276d/Pp8tVJ58ZW1lZ/WmmoDbi46/2HESI2s4Y3KV2os2GxUj0VdqYZ87+FhbkRtvhgd4OFWRid/9HT0yMA4JuMoqwLteguCEb83NiguwkTWy3zhSODfCoqOWm4eKMtPlL2j9d+4gxS1qSJ6bnexzfaixSXel3tG3UZbKZBmS+422WZrc3LmbI6iKJtdKWwA7wnvpk/YQQm6UcoX0Q+2+TKmKsJKBFbbr97XgYQvDLAwO9r1BpSfEJMjLxIMbYdPVyfSpjfFEApxHKjnr7xBziLtplhvOLnQTVwRInLPYSJmvYexWDydKoyO/JF+DmMU3oFwNi8rH2dAbKKrA/Bvy1Fwz2vUMF79gEee74+L3IQO8EjEODhSqC+PVGYY0ycBISQjq/hiX7PW7jjptPFbPNTpeEO53qEKVTU9HbD3vDgEND/b1/p1SGSiJZmiMnxj+CAP4hbv6tmq+ShEm6weXGZgZ6y3B/z7+r6BN7BDk2OvGGUqn0/XK9WJVsMCqA6DSVRWAz7F/CcOUL9/c+oaJpbII8c3T0spqC8aRKJTqNRiBTCBQv7hkeHj6lIlNsgjw0OtrQUTJWVCrJSprN6K2yoruWw0YAw6nh/b17VPGITRBSwXMnxkYBUJ9qZbJ01dpoq1XucmyVRt5NwPGR4cHea1R1KYsgR0+M34MBv6/cdYiqsDqdRqBcBBBCHzsw0PNZ1XLKIsizx4+/2IDaJxGCGtUKqzndJvR21QxXFmW/WIsa+gYG2uZVhSuLIKSSoyMT/4Qx/rBqheWky00DTTJ4UA6gVZY3vv2dzTwfPDDYG2kXetkEeeihh2r2dff/B0Lo+irDW4u7hRBAAHceGOyVfsk2CIayCUIKJyTp6Bm4DQD+BgDq9R74LdTyMquqPWogOI0Bf3x4oE/4KoGa4IkQhFb1zDOj7YUG4yYEcDVC0GVeq8xu8qUJnd/ozjjywpp3kA8smnv6ZDvbzPzujjNORXHHJPdvrnyr9JL1EUfzcTbSynbe+ezos3YEW9eF2Dv5zLMGpFxxM5P9b1K6pYFdN7ch1hZCsknWvEHGvu/EEpjBScCYVG7fxM7gKPlyHauzWSTdSWkDYu/AJjuxrVtlbMGcnZTuLmlbPvPTNLQcKsdm2R9jfNww0CPnny994/LL+59Xo4M31f8D7yiCh0k/HrcAAAAASUVORK5CYII=",Qa={class:"title"},Ja=y.defineComponent({__name:"index",props:{width:{default:()=>"100%"},height:{default:()=>"100%"},imgStyle:{default:()=>({})},title:{default:()=>"暂无数据"}},setup(o){const e=y.ref(),i=y.ref({height:"30%"});return y.watchEffect(()=>{e.value&&(i.value=e.value.offsetHeight>e.value.offsetWidth?{width:"30%"}:{height:"30%"})}),(r,a)=>(y.openBlock(),y.createElementBlock("div",{ref_key:"emptyRef",ref:e,class:"empty-box flx-center",style:y.normalizeStyle({width:r.width,height:r.height})},[y.createElementVNode("img",{src:qa,alt:"",style:y.normalizeStyle(y.unref(i))},null,4),y.createElementVNode("p",Qa,y.toDisplayString(r.title),1)],4))}});const Gn=Ue(Ja,[["__scopeId","data-v-7f559bc0"]]),$a=["innerHTML"],el=y.defineComponent({__name:"SvgPathIcon",props:{svgContent:{},iconStyle:{},className:{default:""}},setup(o){const e=o,{svgContent:i,iconStyle:r}=y.toRefs(e),a=y.ref("");function l(){var p,u,d,m;const c=parseInt((p=r.value)==null?void 0:p.width),h=parseInt((u=r.value)==null?void 0:u.height);!c||!h||(c&&(a.value=i.value.replace(/width="[^"]*"/,`width="${c}"`),(d=r.value)==null||delete d.width),h&&(a.value=(a.value||i.value).replace(/height="[^"]*"/,`height="${h}"`),(m=r.value)==null||delete m.height))}return y.onBeforeMount(()=>{l()}),(c,h)=>(y.openBlock(),y.createElementBlock("span",{innerHTML:y.unref(a)||y.unref(i),style:y.normalizeStyle(y.unref(r)),class:y.normalizeClass(["svg-container",c.className])},null,14,$a))}});const tl=Ue(el,[["__scopeId","data-v-e4df4dc8"]]),sl='<svg t="1755848457184" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9235" width="256" height="256"><path d="M469.333333 85.333333m42.666667 0l0 0q42.666667 0 42.666667 42.666667l0 128q0 42.666667-42.666667 42.666667l0 0q-42.666667 0-42.666667-42.666667l0-128q0-42.666667 42.666667-42.666667Z" fill="#2c2c2c" opacity=".8" p-id="9236"></path><path d="M469.333333 725.333333m42.666667 0l0 0q42.666667 0 42.666667 42.666667l0 128q0 42.666667-42.666667 42.666667l0 0q-42.666667 0-42.666667-42.666667l0-128q0-42.666667 42.666667-42.666667Z" fill="#2c2c2c" opacity=".4" p-id="9237"></path><path d="M938.666667 469.333333m0 42.666667l0 0q0 42.666667-42.666667 42.666667l-128 0q-42.666667 0-42.666667-42.666667l0 0q0-42.666667 42.666667-42.666667l128 0q42.666667 0 42.666667 42.666667Z" fill="#2c2c2c" opacity=".2" p-id="9238"></path><path d="M298.666667 469.333333m0 42.666667l0 0q0 42.666667-42.666667 42.666667l-128 0q-42.666667 0-42.666667-42.666667l0 0q0-42.666667 42.666667-42.666667l128 0q42.666667 0 42.666667 42.666667Z" fill="#2c2c2c" opacity=".6" p-id="9239"></path><path d="M783.530667 180.138667m30.169889 30.169889l0 0q30.169889 30.169889 0 60.339779l-90.509668 90.509668q-30.169889 30.169889-60.339779 0l0 0q-30.169889-30.169889 0-60.339779l90.509668-90.509668q30.169889-30.169889 60.339779 0Z" fill="#2c2c2c" opacity=".1" p-id="9240"></path><path d="M330.965333 632.661333m30.16989 30.16989l0 0q30.169889 30.169889 0 60.339778l-90.509668 90.509668q-30.169889 30.169889-60.339779 0l0 0q-30.169889-30.169889 0-60.339778l90.509668-90.509668q30.169889-30.169889 60.339779 0Z" fill="#2c2c2c" opacity=".5" p-id="9241"></path><path d="M843.861333 783.530667m-30.169889 30.169889l0 0q-30.169889 30.169889-60.339779 0l-90.509668-90.509668q-30.169889-30.169889 0-60.339779l0 0q30.169889-30.169889 60.339779 0l90.509668 90.509668q30.169889 30.169889 0 60.339779Z" fill="#2c2c2c" opacity=".3" p-id="9242"></path><path d="M391.338667 330.965333m-30.16989 30.16989l0 0q-30.169889 30.169889-60.339778 0l-90.509668-90.509668q-30.169889-30.169889 0-60.339779l0 0q30.169889-30.169889 60.339778 0l90.509668 90.509668q30.169889 30.169889 0 60.339779Z" fill="#2c2c2c" opacity=".7" p-id="9243"></path></svg>',nl='<svg t="1747118667412" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4123" width="256" height="256"><path d="M804 832.2H220c-65.1 0-118.1-53-118.1-118.1V309.8c0-31.6 12.3-61.2 34.6-83.5 22-22 52.4-34.6 83.5-34.6h584c31.5 0 61.2 12.3 83.5 34.6l5.5 6.5c18.8 21.6 29.1 49 29.1 77v404.3c0 28-10.3 55.3-29.1 77-22.6 26.2-55.1 41.1-89 41.1zM220 248.3c-16.3 0-32.1 6.6-43.6 18-11.6 11.6-18 27.1-18 43.6v404.3c0 34 27.6 61.6 61.6 61.6h584c17.8 0 34.3-7.6 46.3-21.5 7-8.1 15.3-21.6 15.3-40.1V309.8c0-18.5-8.3-32-15.3-40l-4.5-5.5c-9.9-9.7-25.3-16.1-41.8-16.1H220z" p-id="4124"></path><path d="M405.1 503.2H279.9c-27.7 0-50.4-22.6-50.4-50.4v-68.7c0-27.8 22.6-50.4 50.4-50.4h125.2c27.7 0 50.4 22.6 50.4 50.4v68.7c0 27.8-22.6 50.4-50.4 50.4z m-119-56.5h113v-56.5h-113v56.5z m119-56.5h0.6-0.6zM713.6 483.7H551.3c-15.6 0-28.2-12.6-28.2-28.2s12.6-28.2 28.2-28.2h162.3c15.6 0 28.2 12.6 28.2 28.2s-12.6 28.2-28.2 28.2zM750.6 649.2H273.4c-15.6 0-28.2-12.6-28.2-28.2s12.6-28.2 28.2-28.2h477.2c15.6 0 28.2 12.6 28.2 28.2s-12.6 28.2-28.2 28.2z" p-id="4125"></path></svg>',il='<svg t="1747118726217" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4285" width="256" height="256"><path d="M653.897143 618.0864l0.146286 3.335314v62.756572a93.447314 93.447314 0 0 1-0.585143 173.494857l0.468114 3.159771 0.117029 3.393829v66.911086a35.079314 35.079314 0 0 1-69.895315 3.364571l-0.175543-3.364571v-66.911086a35.108571 35.108571 0 0 1 0.643658-6.612114 93.418057 93.418057 0 0 1-0.585143-173.436343V621.421714c0-19.309714 15.652571-35.0208 34.991543-35.050057 18.0224 0 33.119086 13.7216 34.845257 31.685486z m268.756114 83.3536a93.447314 93.447314 0 0 1-59.684571 86.454857c0.555886 1.989486 0.906971 4.008229 1.111771 6.056229l0.146286 3.335314v133.851429a35.079314 35.079314 0 0 1-69.866057 3.364571l-0.175543-3.364571V797.257143c0-3.247543 0.468114-6.436571 1.2288-9.391543a93.418057 93.418057 0 0 1-1.2288-173.787429v-59.567542a35.079314 35.079314 0 0 1 69.895314-3.423086l0.146286 3.423086v59.567542a93.447314 93.447314 0 0 1 58.426514 87.332572zM887.456914 181.774629l0.146286 5.178514v283.560228h-83.968V194.442971c0-30.72-23.873829-56.232229-54.564571-58.250971l-3.832686-0.117029H214.103771c-30.72 0-56.232229 23.844571-58.250971 54.535315l-0.117029 3.832685v611.210972c0 30.72 23.844571 56.232229 54.535315 58.250971l3.803428 0.117029h271.301486v81.92h-286.72a128.438857 128.438857 0 0 1-128.321829-123.260343l-0.117028-5.178514V186.953143a128.438857 128.438857 0 0 1 123.260343-128.321829L198.656 58.514286h560.566857a128.438857 128.438857 0 0 1 128.234057 123.260343zM617.618286 724.114286a46.6944 46.6944 0 1 0 1.404343 0l1.4336 0.087771h-1.462858l-1.375085-0.087771z m211.587657-70.100115a46.723657 46.723657 0 1 0 0 93.447315 46.723657 46.723657 0 0 0 0-93.447315z m-274.753829-175.133257a35.079314 35.079314 0 0 1 3.306057 69.895315l-3.306057 0.146285H221.944686a35.079314 35.079314 0 0 1-3.335315-69.866057l3.335315-0.175543h332.507428z m168.901486-165.098057c0.877714 18.402743-12.639086 34.347886-30.954057 36.483657l-3.335314 0.175543H222.0032a35.079314 35.079314 0 0 1-3.335314-69.895314l3.335314-0.146286h467.090286c18.402743 0.380343 33.353143 14.979657 34.230857 33.353143z" p-id="4286"></path></svg>',ol='<svg t="1747118758801" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4442" width="256" height="256"><path d="M615.04 64a444.992 444.992 0 0 1 223.04 132.416 134.464 134.464 0 0 0 6.464 118.336c21.12 37.632 57.6 60.416 96.64 64.96C953.408 421.632 960 465.92 960 512c0 46.016-6.592 90.368-18.816 132.288-39.04 4.48-75.52 27.328-96.64 64.96a134.464 134.464 0 0 0-6.4 118.4A444.992 444.992 0 0 1 615.04 960 126.72 126.72 0 0 0 512 906.496 126.72 126.72 0 0 0 408.96 960a444.992 444.992 0 0 1-223.04-132.416 134.464 134.464 0 0 0-6.464-118.336c-21.12-37.632-57.6-60.416-96.64-64.96A471.936 471.936 0 0 1 64 512c0-46.016 6.592-90.368 18.816-132.288 39.04-4.48 75.52-27.328 96.64-64.96 21.12-37.568 22.144-81.408 6.4-118.4A444.992 444.992 0 0 1 408.96 64c23.296 32.448 60.8 53.504 103.04 53.504A126.72 126.72 0 0 0 615.04 64z m19.648 72.384a189.44 189.44 0 0 1-245.376 0 380.928 380.928 0 0 0-131.584 78.72c7.68 44.224 0.256 90.56-22.464 131.008-22.72 40.32-58.112 70.4-99.456 86.016a410.56 410.56 0 0 0 0 159.744c41.344 15.68 76.8 45.632 99.456 86.016 22.72 40.448 30.08 86.784 22.4 131.008 38.4 35.008 83.072 61.824 131.648 78.72a189.44 189.44 0 0 1 245.376 0 380.928 380.928 0 0 0 131.584-78.72 198.144 198.144 0 0 1 22.464-131.008c22.72-40.32 58.112-70.4 99.456-86.016a410.56 410.56 0 0 0 0-159.744 192.576 192.576 0 0 1-99.456-86.016 198.144 198.144 0 0 1-22.4-131.008 380.928 380.928 0 0 0-131.648-78.72zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384z m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256z" p-id="4443"></path></svg>',rl='<svg t="1747118776141" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4603" width="256" height="256"><path d="M605.440831 444.871267a32.779988 32.779988 0 0 1-12.784195-2.762885L191.757381 249.783509a30.157589 30.157589 0 0 1 0-54.508437L528.033231 2.90337a30.719532 30.719532 0 0 1 26.130333 0l393.219372 192.371702a29.548818 29.548818 0 0 1 16.670965 27.254219 30.532217 30.532217 0 0 1-16.670965 27.254218l-328.595967 191.997074a29.595646 29.595646 0 0 1-13.346138 3.324827zM274.597094 222.529291l330.796909 158.467828L865.198823 222.529291l-324.240911-158.467829z" p-id="4604"></path><path d="M605.440831 843.56958a32.779988 32.779988 0 0 1-12.784195-2.762885l-400.852426-192.371702a30.157589 30.157589 0 0 1 0-54.508437L528.033231 401.554854a30.719532 30.719532 0 0 1 26.130333 0l393.078886 192.371702a29.548818 29.548818 0 0 1 16.670965 27.254219 30.532217 30.532217 0 0 1-16.670965 27.254218l-328.595966 191.997074c-4.448713 2.200942-73.380345 3.324827-77.829058 3.324827z m-328.595966-222.388805l328.595966 158.467828L865.198823 621.180775l-324.240911-158.467829z" p-id="4605"></path><path d="M605.440831 845.81735a38.2121 38.2121 0 0 1-13.346138-2.762884l-395.326656-192.418531A30.344903 30.344903 0 1 1 223.647627 596.174327L605.440831 782.036859l315.249829-185.722047a30.344903 30.344903 0 0 1 26.692276 54.508438L618.786969 842.91398a28.84639 28.84639 0 0 1-13.346138 2.762885z" p-id="4606"></path><path d="M934.036798 645.110166a29.876618 29.876618 0 0 1-30.017104-30.017103V227.539946a30.017103 30.017103 0 0 1 60.034207 0v386.991174a30.017103 30.017103 0 0 1-30.017103 30.579046z m-732.820049 3.324827a29.876618 29.876618 0 0 1-30.017103-30.017103V227.539946a30.017103 30.017103 0 0 1 60.034207 0v390.877944a29.876618 29.876618 0 0 1-30.017104 30.017103zM90.045761 713.479855a29.876618 29.876618 0 0 1-30.017103-30.017103V292.584808a30.017103 30.017103 0 1 1 60.034206 0v390.877944a29.876618 29.876618 0 0 1-30.017103 30.017103z" p-id="4607"></path><path d="M90.045761 469.971372a29.876618 29.876618 0 0 1-30.063932-30.017103V49.076325a30.017103 30.017103 0 1 1 60.034207 0v390.877944a30.251246 30.251246 0 0 1-30.017104 30.017103zM62.791542 674.331184a30.43856 30.43856 0 0 1 40.600357-14.048566l350.83953 171.813966a30.344903 30.344903 0 1 1-26.692276 54.508437L76.699623 715.165683a30.43856 30.43856 0 0 1-14.048566-40.600356z" p-id="4608"></path><path d="M337.441014 808.541821a30.43856 30.43856 0 0 1 40.600357-14.048566l350.83953 171.813966a30.344903 30.344903 0 0 1-26.692276 54.508437l-350.83953-171.67348a30.43856 30.43856 0 0 1-14.048567-40.600357zM62.791542 29.033704a30.43856 30.43856 0 0 1 40.600357-14.048567l350.792701 171.954452a30.344903 30.344903 0 1 1-26.692276 54.508438L76.699623 69.63406A30.625875 30.625875 0 0 1 62.791542 29.033704z" p-id="4609"></path><path d="M337.441014 163.057027a30.43856 30.43856 0 0 1 40.600357-14.048567l350.83953 171.813966a30.344903 30.344903 0 0 1-26.692276 54.508438L351.349095 203.095441a29.829789 29.829789 0 0 1-14.048567-40.038414z m378.093749 856.962546a29.876618 29.876618 0 0 1-30.017104-30.017104V598.937211a30.017103 30.017103 0 1 1 60.034207 0v390.877944a29.876618 29.876618 0 0 1-30.204418 30.017104z" p-id="4610"></path><path d="M715.347448 791.870856a29.876618 29.876618 0 0 1-30.017103-30.017104V370.975808a30.017103 30.017103 0 1 1 60.034207 0v390.877944a30.251246 30.251246 0 0 1-30.017104 30.017104z m-84.291398-374.628436l4.448713 390.877944-60.596149 0.561943L570.17893 417.710706z" p-id="4611"></path><path d="M566.526302 26.832762l4.448713 390.877944-60.596149 0.561942-4.448713-390.877944z" p-id="4612"></path></svg>',al='<svg t="1747118806738" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4772" width="256" height="256"><path d="M534.598127 955.955046l429.178794-229.368665 0.464027-193.963386-426.441033 215.169431-3.248191 208.16262z m-48.212431-1.206471l3.248191-205.332054-1.392082-0.696041-428.111531-219.948911L59.573441 726.679186l426.765853 228.069389z m-396.140054-469.13154l421.800761 216.700721 425.837798-214.844612-425.559382-227.41975-422.079177 225.517239z m434.375899-278.18433l478.133668 255.539801c8.538101 4.547467 13.828012 13.410387 13.828012 23.062154l-0.649639 256.282244a26.078331 26.078331 0 0 1-13.781609 22.969349L523.9255 1020.872456a26.078331 26.078331 0 0 1-24.593444 0L21.151986 765.332655a26.124734 26.124734 0 0 1-13.781609-23.062153l0.649638-256.328648c0-9.605364 5.289911-18.421881 13.781609-22.969348L500.028097 207.432705a26.124734 26.124734 0 0 1 24.593444 0z" p-id="4773"></path><path d="M538.078331 954.052534l425.69859-227.466153 0.51043-400.409105-416.696462 210.250742c-3.108983 1.577693-6.264368 2.784163-9.512558 3.712218v413.912298z m-52.156662 0.464027v-425.559382L60.176677 310.214739 59.573441 726.679186l426.301825 227.837375zM992.964234 253.232194l2.088123-1.067263 1.484887 2.969774 6.217965 3.294594c8.538101 4.547467 13.828012 13.45679 13.828012 23.108556v13.271179l1.995317 3.944232-2.04172 1.02086-0.603236 442.496376a26.078331 26.078331 0 0 1-13.781609 22.969348L523.9255 1020.872456a26.078331 26.078331 0 0 1-24.593444 0L21.151986 765.332655a26.124734 26.124734 0 0 1-13.781609-23.062153l0.649638-460.77905c0-9.605364 5.289911-18.421881 13.781609-22.969348L500.028097 2.982303a26.124734 26.124734 0 0 1 24.593444 0l468.342693 250.296293z m-889.2154 20.649212l420.269472 215.911874 411.963383-207.8378-423.65687-226.445293-408.575985 218.371219z" p-id="4774"></path></svg>',ll='<svg t="1747118819652" class="icon" viewBox="0 0 2353 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4930" width="256" height="256"><path d="M41.840281 1011.047298S-65.841404-121.173333 2346.576842 122.107509C1843.146105-4.706807-266.796912-278.707649 41.840281 1011.029333z" p-id="4931"></path><path d="M1726.805333 365.442246L1445.205333 769.598877V1012.143158H1256.861193V769.598877L975.961825 365.442246h238.753684l138.293895 226.663298 146.575719-226.663298H1726.787368zM998.310175 541.462456L567.26007 850.189474h413.049263v161.953684h-713.386666v-161.953684l450.506105-322.811509h-386.065965c55.475649-56.212211 124.96393-111.292632 212.129684-161.953684h332.027509l122.790175 176.002245zM2318.156351 527.018667h-469.962105v97.262035h375.969684v129.041965h-375.969684V1012.143158H1659.850105V603.189895l166.03172-237.747649h492.274526v161.576421z" p-id="4932"></path></svg>',cl='<svg t="1747118858016" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5249" width="256" height="256"><path d="M925.753792 109.082187v-1.083598-1.083598c0-0.722399 0-1.083598-0.361199-1.805996v-1.083598-0.722399c0-0.722399-0.361199-1.083598-0.3612-1.444797 0-0.361199-0.361199-1.083598-0.361199-1.444797 0-0.361199-0.361199-0.722399-0.361199-0.722399 0-0.361199-0.361199-0.722399-0.722399-1.083598-0.361199-0.361199-0.722399-1.083598-0.722398-1.444797 0-0.361199-0.361199-0.722399-0.3612-0.722398s0-0.361199-0.361199-0.3612l-0.361199-0.361199c-0.361199-0.722399-1.083598-1.083598-1.444798-1.805996l-0.361199-0.3612-0.361199-0.361199c-0.722399-0.361199-1.083598-1.083598-1.805997-1.444797-0.361199-0.361199-0.722399-0.722399-1.083597-0.722399h-0.3612c-0.722399-0.361199-1.083598-0.722399-1.805996-1.083598-0.361199-0.361199-0.722399-0.361199-1.444797-0.722398h-0.3612-0.361199c-0.361199 0-0.722399-0.361199-1.083598-0.3612h-0.361199c-0.361199 0-0.722399-0.361199-1.444797-0.361199h-0.722399c-0.361199 0-0.722399 0-1.444797-0.361199H902.275838c-0.361199 0-0.722399 0-1.083598 0.361199-0.361199 0-0.722399 0-1.444797 0.361199-0.361199 0-0.722399 0-0.722399 0.3612-0.361199 0-0.722399 0.361199-1.083598 0.361199-0.361199 0-0.361199 0-0.722398 0.361199-0.361199 0-0.722399 0.361199-1.083598 0.3612-0.361199 0-0.361199 0.361199-0.722399 0.361199h-0.361199L57.069489 494.843034c-7.585185 3.611993-12.280776 11.197178-12.280776 19.504761 0 8.307584 4.695591 15.892769 11.919576 19.504762L340.972134 675.442681l64.654674 248.143915c2.167196 8.307584 9.391182 14.809171 18.059964 15.892769 1.083598 0 2.167196 0.361199 2.889595 0.361199 7.585185 0 14.809171-3.973192 18.782363-10.835978l89.938624-152.426103c0.361199-0.722399 1.083598-1.805996 1.444798-2.528395l244.170723 156.038095c3.611993 2.167196 7.585185 3.250794 11.558377 3.250794 3.250794 0 6.140388-0.722399 9.029983-2.167196 6.862787-3.250794 11.197178-9.391182 12.280776-16.615167l111.971781-804.02963v-0.722398-0.722399z m-125.336155 73.684656l-445.35873 451.499118L115.583774 514.708995l684.833863-331.942152zM497.732628 754.906526l-63.571076 107.637389-50.929101-195.408818 265.481482-268.732275 69.711464-70.795062-265.120282 365.533686c-3.611993 4.695591-5.417989 10.835979-4.334392 16.976367 1.083598 6.140388 4.695591 11.197178 9.752381 14.447972l41.899118 26.728748c-1.083598 1.083598-2.167196 2.167196-2.889594 3.611993z m277.762257 121.001763L502.067019 700.726631 871.573898 185.295238l-96.079013 690.613051z" p-id="5250"></path></svg>',hl='<svg t="1747118871130" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5410" width="256" height="256"><path d="M368.896 192H224a32 32 0 0 0-32 32v137.888a32 32 0 0 0 64 0V256h112.896a32 32 0 0 0 0-64zM784.864 192H640a32 32 0 1 0 0 64h112.864v105.888a32 32 0 1 0 64 0V224a32 32 0 0 0-32-32zM368.896 777.92H256V672a32 32 0 1 0-64 0v137.92a32 32 0 0 0 32 32h144.896a32 32 0 1 0 0-64zM784.864 640a32 32 0 0 0-32 32v105.92H640a32 32 0 1 0 0 64h144.864a32 32 0 0 0 32-32V672a32 32 0 0 0-32-32z" p-id="5411"></path><path d="M912 48h-800c-35.296 0-64 28.704-64 64v800c0 35.296 28.704 64 64 64h800c35.296 0 64-28.704 64-64v-800c0-35.296-28.704-64-64-64z m-800 864v-800h800l0.064 800H112z" p-id="5412"></path></svg>',ul='<svg t="1747118881671" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5572" width="256" height="256"><path d="M512 1023.99986A511.99993 511.99993 0 1 0 512 0a511.99993 511.99993 0 0 0 0 1023.99986z m6.582856-731.428471c20.04114 0 46.591994 5.851428 66.559991 11.702855s39.862852 17.554283 53.17485 40.959995c13.311998 17.554283 19.967997 40.959994 19.967997 64.365705v17.554284c0 5.851428-6.582856 11.702856-6.582856 17.554283q-6.729142 5.851428-6.729142 11.702855c0 5.851428 0 11.702856-6.582856 17.554284l-6.729142 5.851427-13.238855 11.702856c-6.655999 5.851428-6.655999 11.702856-13.311999 11.702856l-13.311998 11.702855c-19.967997 11.702856-33.279995 23.405711-46.518851 29.257139-6.655999 5.851428-6.655999 17.554283-6.655999 29.257139v29.257139q0 5.851428-6.655999 5.851428h-59.830849q-6.655999 0-6.655999-5.851428v-35.108567c0-23.405711 6.582856-40.959994 19.894855-58.514278l46.591993-40.959994c19.894854-11.702856 33.206853-23.405711 39.862852-35.108567 6.655999-5.851428 6.655999-17.554283 6.655999-29.257139 0-17.554283-6.582856-29.257139-19.967997-35.108566-6.582856-5.851428-26.550854-11.702856-46.518851-11.702856-26.623996 0-39.862852 5.851428-53.17485 17.554284A62.17142 62.17142 0 0 0 438.857153 421.3028v5.851428q0 5.851428-6.582856 5.851427h-59.977135Q365.714306 433.005655 365.714306 427.154228v-5.851428c0-23.405711 0-46.811422 13.311998-64.365706 6.582856-11.702856 19.967997-29.257139 33.206852-35.108566 19.967997-11.702856 33.279995-17.554283 53.247993-23.405712C485.376004 292.571389 498.688002 292.571389 518.582856 292.571389z m-46.445708 368.639949c6.582856-5.851428 19.894854-11.702856 33.206853-11.702855s26.623996 5.851428 33.279995 5.851428c6.582856 11.702856 13.238855 23.405711 13.238856 35.108566 0 11.702856-6.582856 23.405711-13.238856 29.257139a54.637707 54.637707 0 0 1-33.279995 11.702856 54.637707 54.637707 0 0 1-33.206853-11.702856 42.057137 42.057137 0 0 1-13.311998-29.257139c0-11.702856 6.582856-17.554283 13.311998-29.257139z" p-id="5573"></path></svg>',pl='<svg t="1747118889578" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5733" width="256" height="256"><path d="M0 1024h1024V0L0 1024z" p-id="5734"></path></svg>',dl='<svg t="1747118897788" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5890" width="256" height="256"><path d="M606.171429 921.6c26.697143-96.182857 20.48-174.08-20.48-235.52s-112.64-94.171429-165.12-108.617143L763.977143 57.417143 677.851429 0 0 1024h1024v-102.4z m-53.211429 2.011429H190.537143L389.12 621.714286c47.177143 10.24 116.662857 32.731429 153.6 91.428571 32.731429 52.845714 36.937143 122.514286 10.24 210.468572z" p-id="5891"></path></svg>',fl='<svg t="1747118919514" class="icon" viewBox="0 0 1187 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6047" width="256" height="256"><path d="M557.769568 0v1009.233236H0V700.828379h309.834603v-84.102769H0V476.610396h247.850862v-84.10277H0V252.308309h309.834603V168.205539H0V0h557.769568z m612.856883 802.340422q14.297471-57.105781-1.429747-94.279204l-54.498595-2.691289a198.398434 198.398434 0 0 0-20.689281-48.190887l36.837013-41.799077q-30.276997-50.461662-67.70273-65.60016l-40.537535 36.668808a198.482536 198.482536 0 0 0-48.695504-20.184665l-3.36411-54.835006q-57.105781-14.297471-94.279205 1.429747l-2.607186 52.732437c-17.072862 4.205138-33.220594 10.596949-48.190887 18.923123l-38.350863-34.734444q-37.425732 15.138499-67.618627 65.60016c9.587716 10.93336 28.510839 23.464673 29.604175 39.528302 0.336411 3.868727-18.166198 50.629867-19.007226 50.71397l-49.031914 2.438981q-15.727218 37.173424-1.429748 94.195102l48.611401 3.111802c4.625652 19.343637 11.942593 37.509835 21.698515 54.246287l-31.959053 35.323163q15.138499 37.425732 65.600161 67.618627l36.500602-32.127258c16.568246 9.924127 34.566238 17.493376 53.825772 22.287234l2.354878 48.274989q37.173424 15.727218 94.195102 1.429747l3.195905-50.461661c19.42774-5.046166 37.678041-13.035929 54.330389-23.464673l38.687274 34.061622q50.461662-30.276997 65.600161-67.618627l-35.239061-38.85548c8.746688-15.643115 15.222601-32.547772 19.511843-50.461662l54.078081-3.36411zM925.130466 873.995982a117.155158 117.155158 0 1 1 0-234.310316 117.155158 117.155158 0 0 1 0 234.310316z" p-id="6048"></path></svg>',ml='<svg t="1747118950929" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6222" width="256" height="256"><path d="M979.30091 188.371816L835.506169 44.621874 828.158992 38.042695c-60.396607-53.158231-151.711516-50.27824-208.639335 6.579179L44.41109 619.544841l-6.579179 7.532776c-52.972631 60.428607-49.971041 151.577117 6.867179 208.383336l143.794741 143.858741 7.347177 6.860779c60.447807 52.959831 151.621917 49.958241 208.447335-6.860779l575.012567-575.217366 6.867179-7.340777c52.972631-60.422207 49.971041-151.577117-6.867179-208.383335z m-53.875028 162.060283l-575.486165 574.929367c-29.791905 29.759905-78.060551 29.759905-107.852457 0l-143.897141-143.756341c-29.759905-29.779105-29.759905-78.041351 0-107.814057l45.011057-44.710257 53.875028 53.862228a38.150278 38.150278 0 0 0 53.926228-1.337596 38.124678 38.124678 0 0 0 0.0512-52.524632l-53.977428-54.246227 89.926113-89.791714 90.015713 89.702114 1.907194 1.900794a38.150278 38.150278 0 0 0 53.945428-0.064 38.124678 38.124678 0 0 0-1.971193-55.699022l-89.919714-89.894114 89.919714-89.894113 53.971027 53.951828 1.907194 1.811194a38.150278 38.150278 0 0 0 53.945428-0.064 38.124678 38.124678 0 0 0-1.977593-55.699022l-53.875029-53.862229 89.830114-89.894113 90.015713 89.894113 1.907194 1.907194a38.150278 38.150278 0 0 0 53.811029-3.750388 38.124678 38.124678 0 0 0-1.843195-52.019034L629.055627 143.475959l45.004656-44.991857c29.791905-29.759905 78.060551-29.759905 107.852457 0l143.513142 143.845942c29.766305 29.779105 29.766305 78.041351 0 107.820456v0.281599z" p-id="6223"></path></svg>',gl='<svg t="1747118975051" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6383" width="256" height="256"><path d="M938.666667 565.333333a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32H85.333333A32 32 0 0 1 53.333333 853.333333V597.333333A32 32 0 0 1 85.333333 565.333333z m-32 64h-789.333334v192h789.333334v-192z m32-448a32 32 0 0 1 3.072 63.850667L938.666667 245.333333H567.893333L342.613333 470.613333a32 32 0 0 1-45.226666 0l-234.666667-234.666666-0.512-0.512a32.213333 32.213333 0 0 1-0.917333-1.002667l1.408 1.536a34.176 34.176 0 0 1-2.645334-2.986667L59.733333 232.533333a31.274667 31.274667 0 0 1-5.205333-27.925333l0.085333-0.256 0.426667-1.365333 0.341333-0.938667 0.576-1.450667 0.533334-1.130666a31.381333 31.381333 0 0 1 25.557333-17.984h0.213333A31.36 31.36 0 0 1 85.333333 181.333333h853.333334z m-461.248 64H162.56L320 402.752l157.418667-157.418667z" p-id="6384"></path></svg>',yl='<svg t="1747118993460" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6544" width="256" height="256"><path d="M958.1 717.3L723.8 483l203-206c32.4-32.9 32.4-86.5 0-119.4l-59.1-60c-15.8-16-36.9-24.9-59.3-24.9s-43.4 8.8-59.2 24.9L545.3 304.5 305.1 64.3c-7.3-7.3-19.2-7.3-26.5 0L68.3 274.5c-7.3 7.3-7.3 19.2 0 26.5l213 213 29 29-104.1 105.7c-1.8 1.3-3.4 2.9-4.7 4.7l-11.3 11.5 5.1 5.2-55.1 172.5-36.7 37.2c-7.2 7.3-7.2 19 0 26.3l22.8 23.1c3.5 3.6 8.3 5.6 13.4 5.6s9.8-2 13.4-5.6l31.5-32 177.2-58.3 5.5 5.6 121.4-123.2 232.5 232.5c3.7 3.7 8.5 5.5 13.3 5.5s9.6-1.8 13.3-5.5L958 743.6c7.4-7.1 7.4-19 0.1-26.3zM775.9 124c8.7-8.8 20.2-13.7 32.5-13.7s23.8 4.9 32.5 13.7l59.1 60c18.1 18.4 18.1 48.3 0 66.7L697.3 456.5 571.9 331.1l204-207.1zM223.3 845.2c-0.8-3.1-2.3-6.1-4.7-8.6l-22.8-23.1c-1.6-1.6-3.5-2.9-5.6-3.8l34.9-109.3 107.3 108.9-109.1 35.9zM368 790.6L243.6 664.3l93.3-94.7 62.1 62.1 63.2 63.2-94.2 95.7z m366.6 123.7L674.3 854l48.4-48.4c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0l-48.4 48.4-91.2-91.2 76.4-76.4c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0L530 709.6l-28-28-63.1-63.1 48.4-48.4c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0L412.4 592l-62.3-62.3-28.9-28.9L392 430c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0l-70.8 70.8-91.3-91.3 48.4-48.4c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0l-48.4 48.4-68.8-68.8L291.8 104l240.4 240.4 151.9 151.9 234.2 234.2-183.7 183.8z" p-id="6545"></path></svg>',vl='<svg t="1747119002108" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6711" width="256" height="256"><path d="M592.554667 51.2c68.36419 0 123.855238 50.176 123.855238 111.811048 0 55.344762-44.665905 101.424762-103.180191 110.250666 30.573714 16.091429 52.857905 41.252571 66.169905 74.898286 27.794286 69.632 90.940952 98.742857 139.068952 110.933333 16.237714 4.096 29.793524 11.751619 39.253334 22.186667 9.752381 10.678857 14.09219 23.161905 12.288 35.05981-2.584381 16.871619-18.578286 34.962286-55.686095 34.962285-5.558857 0-11.50781-0.390095-17.65181-1.219047a390.582857 390.582857 0 0 1-117.808762-36.181334c-19.748571-9.947429-42.76419-24.283429-58.12419-42.617904-9.752381 19.504762-20.772571 47.201524-20.772572 73.289142 0 30.866286 39.009524 67.584 73.386667 99.961905 15.311238 14.433524 29.744762 28.086857 41.593905 41.642667 38.960762 44.373333 36.815238 141.604571 35.742476 193.828571-0.146286 7.168-0.292571 13.360762-0.292572 18.285715 0 30.037333-24.527238 74.50819-58.368 74.50819-8.582095 0-21.065143-2.925714-31.890285-16.822857-7.41181-9.557333-13.06819-23.015619-17.359238-41.106286a1735.68 1735.68 0 0 1-9.801143-45.251047c-14.238476-68.266667-26.477714-127.21981-79.872-168.131048l-45.153524-34.523429c-3.023238 23.79581-8.825905 57.197714-19.212191 81.92-10.581333 24.917333-60.123429 79.530667-99.376761 118.784-20.918857 21.113905-42.812952 41.252571-65.633524 60.464762-31.158857 25.746286-43.739429 30.232381-51.931429 31.207619a60.562286 60.562286 0 0 1-7.119238 0.438857c-19.114667 0-43.25181-9.557333-54.223238-30.866285-9.654857-18.870857-11.702857-51.492571 33.499429-99.766857 17.554286-18.773333 33.255619-33.401905 47.055238-46.32381 40.17981-37.546667 62.366476-58.319238 69.729523-125.074286 10.922667-98.108952 28.867048-142.238476 47.932953-182.320762 10.727619-22.625524 12.53181-57.295238 12.336762-80.262095-28.769524 14.823619-75.971048 43.836952-88.746667 79.481905-4.681143 13.165714-8.533333 25.84381-12.190476 38.034286-5.948952 19.602286-11.02019 36.522667-18.041905 49.444571-9.752381 17.993143-23.405714 27.160381-40.472381 27.160381a50.224762 50.224762 0 0 1-10.727619-1.219048c-8.679619-1.80419-20.23619-8.143238-25.648762-27.599238-6.290286-22.479238-3.900952-60.952381 6.290286-102.985143 5.022476-20.772571 19.260952-71.094857 42.812952-89.916952a20.48 20.48 0 0 1 1.365334-0.975238c0.438857-0.24381 44.178286-28.525714 93.866666-56.417524 103.619048-58.172952 132.144762-58.172952 141.55581-58.172952h6.631619c-29.744762-20.382476-48.956952-52.662857-48.956953-88.941714 0-61.68381 55.588571-111.85981 123.855239-111.85981h-0.048762z" p-id="6712"></path></svg>',bl='<svg t="1747119024586" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6868" width="256" height="256"><path d="M204.8 204.8v3.84c2.304 4.693333 7.68 10.24 0-3.84zM512 742.4h230.4V512h-76.8v153.6H512z" p-id="6869"></path><path d="M834.944 128H189.056A61.098667 61.098667 0 0 0 128 189.141333v645.717334c0 33.749333 27.306667 61.098667 61.056 61.141333h645.888A61.098667 61.098667 0 0 0 896 834.858667V189.141333c0-33.749333-27.306667-61.098667-61.056-61.141333zM819.2 819.2H204.8V208.64c-1.152-2.005333-1.536-3.84 0-3.84h614.4v614.4z" p-id="6870"></path><path d="M358.4 358.4H512V281.6H281.6V512h76.8z" p-id="6871"></path></svg>',xl='<svg t="1747120237899" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13155" width="256" height="256"><path d="M466.72 861.44l-72.96 58.816a32.448 32.448 0 0 1-45.76-4.928 32.544 32.544 0 0 1 4.928-45.76l13.984-11.264c-62.848-11.744-119.552-31.104-164.16-56.416-32.32-18.304-57.856-39.36-75.872-62.496-20.48-26.304-30.88-54.56-30.88-84 0-61.568 45.504-117.504 128.224-157.76v15.424a68.48 68.48 0 0 0 19.36 47.68c-52.608 27.584-82.528 61.696-82.528 94.656 0 31.008 26.208 62.944 73.76 89.92 39.2 22.176 89.888 39.2 146.656 49.536l-15.264-24a32.544 32.544 0 0 1 54.912-34.912l52.64 82.72a32.544 32.544 0 0 1-7.04 42.784z" p-id="13156"></path><path d="M243.68 560.672l-0.096 0.064a68.48 68.48 0 0 1-19.36-47.68v-15.424l0.064-0.032v15.456c0 17.984 7.136 35.04 19.392 47.616z m483.2-356.576l-162.944-94.08a101.12 101.12 0 0 0-100.864 0L300.16 204.096a101.12 101.12 0 0 0-50.4 87.36v188.16a101.184 101.184 0 0 0 50.432 87.36l162.912 94.016c15.552 8.96 32.992 13.472 50.432 13.472 17.44 0 34.88-4.48 50.432-13.44l162.944-94.08a101.216 101.216 0 0 0 50.432-87.36v-188.16a101.12 101.12 0 0 0-50.432-87.328zM495.616 166.4a35.776 35.776 0 0 1 35.776 0l150.4 86.816-149.248 83.968a38.72 38.72 0 0 1-38.848-0.576L350.272 250.24 495.616 166.4z m-143.36 355.52l-19.584-11.296c-11.04-6.4-17.92-18.24-17.92-31.008v-174.72l145.408 87.456c6.048 3.648 12.384 6.624 18.88 8.896v193.888l-126.784-73.216z m360-42.304c0 12.736-6.88 24.64-17.92 31.008l-20.448 11.808-129.76 74.912V402.56c6.976-2.144 13.792-5.056 20.32-8.704l147.776-83.136v168.864zM928 655.392c0 58.24-41.408 112.192-116.576 151.872-67.648 35.712-159.04 58.08-257.376 63.04a32.544 32.544 0 0 1-3.264-64.96c89.056-4.48 170.848-24.256 230.272-55.616 27.072-14.272 48.768-30.848 62.816-47.872 12.64-15.392 19.072-31.04 19.072-46.464 0-32.544-29.152-66.208-80.544-93.632l-0.096-0.032c12.864-12.672 20.416-30.176 20.416-48.64v-14.016l0.064 0.032C883.616 539.232 928 594.592 928 655.392z" p-id="13157"></path><path d="M224.32 513.056v-15.456h-0.096v15.456a68.48 68.48 0 0 0 19.36 47.68l0.096-0.064a68.448 68.448 0 0 1-19.392-47.616z m578.4-13.984v13.984c0 18.496-7.552 36-20.416 48.64l0.096 0.064a68.416 68.416 0 0 0 20.384-48.704v-13.952l-0.064-0.032z" p-id="13158"></path></svg>',Cl='<svg t="1747119042485" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7190" width="256" height="256"><path d="M370.47 556.68c62.48 78.41 123.99 139.25 126.58 141.8 12.46 12.29 32.48 12.29 44.93 0 2.59-2.55 64.09-63.39 126.58-141.8 37.09-46.54 66.76-89.62 88.18-128.02 28.81-51.64 42.81-94.46 42.81-130.91 0-73.22-29.24-142.01-82.33-193.7-52.86-51.46-123.07-79.81-197.71-79.81-74.64 0-144.86 28.34-197.71 79.81-53.09 51.69-82.32 120.48-82.32 193.69 0 36.45 14 79.27 42.81 130.91 21.42 38.41 51.09 81.48 88.18 128.03zM519.52 88.24c119.12 0 216.04 93.98 216.04 209.5 0 46.45-41.43 124.08-116.66 218.57-37.84 47.53-76.08 89.11-99.37 113.54-23.29-24.44-61.53-66.01-99.37-113.54C344.93 421.82 303.5 344.2 303.5 297.74c-0.02-115.52 96.89-209.5 216.02-209.5z" p-id="7191"></path><path d="M519.52 438.03c66.75 0 121.06-54.33 121.06-121.12s-54.31-121.12-121.06-121.12-121.06 54.33-121.06 121.12 54.31 121.12 121.06 121.12z m0-170.24c27.05 0 49.06 22.04 49.06 49.12s-22.01 49.12-49.06 49.12-49.06-22.04-49.06-49.12 22.01-49.12 49.06-49.12zM847.65 724.52L731.86 650c-3.95-2.55-9.3-1.52-11.94 2.3l-33.45 48.37c-2.64 3.82-1.57 8.97 2.38 11.52l63.46 40.85L512 915.78 271.69 753.03l75.97-48.9c3.95-2.55 5.02-7.7 2.38-11.52l-33.46-48.37c-2.64-3.81-7.98-4.84-11.94-2.3l-128.3 82.57c-20.14 12.96-20.49 41.4-0.68 54.82L492.2 993.71c11.87 8.04 27.7 8.04 39.58 0l316.54-214.38c19.82-13.41 19.47-41.85-0.67-54.81z" p-id="7192"></path></svg>',wl='<svg t="1747119052739" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7348" width="256" height="256"><path d="M512 384c55.6 0 107.8 21.6 147.1 60.9S720 536.4 720 592s-21.6 107.8-60.9 147.1S567.6 800 512 800s-107.8-21.6-147.1-60.9S304 647.6 304 592s21.6-107.8 60.9-147.1S456.4 384 512 384z m0-64c-150.2 0-272 121.8-272 272s121.8 272 272 272 272-121.8 272-272-121.8-272-272-272z" p-id="7349"></path><path d="M650.9 128l4.4 23.6C666.7 212.1 719.6 256 781.1 256H896c35.3 0 64 28.7 64 64v512c0 35.3-28.7 64-64 64H128c-35.3 0-64-28.7-64-64V320c0-35.3 28.7-64 64-64h114.9c61.6 0 114.5-43.9 125.8-104.4l4.4-23.6h277.8z m39.8-64H333.3c-7.7 0-14.3 5.5-15.7 13.1l-11.8 62.7c-5.7 30.3-32.1 52.2-62.9 52.2H128C57.3 192 0 249.3 0 320v512c0 70.7 57.3 128 128 128h768c70.7 0 128-57.3 128-128V320c0-70.7-57.3-128-128-128H781.1c-30.8 0-57.2-21.9-62.9-52.2l-11.8-62.7c-1.4-7.6-8-13.1-15.7-13.1z" p-id="7350"></path><path d="M224 352h-64c-17.7 0-32-14.3-32-32s14.3-32 32-32h64c17.7 0 32 14.3 32 32s-14.3 32-32 32zM512 560c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32z m0-64c-53 0-96 43-96 96s43 96 96 96 96-43 96-96-43-96-96-96z" p-id="7351"></path></svg>',El='<svg t="1747119058409" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7511" width="256" height="256"><path d="M554.666667 682.666667h85.333333v128h-213.333333v-128h85.333333v-128H256v128h85.333333v128H128v-128h85.333333v-170.666667h298.666667V384h-85.333333V256h213.333333v128h-85.333333v128h298.666666v170.666667h85.333334v128h-213.333334v-128h85.333334v-128h-256v128z m42.666666-384h-128v42.666666h128V298.666667zM298.666667 725.333333H170.666667v42.666667h128v-42.666667z m597.333333 0h-128v42.666667h128v-42.666667z m-298.666667 0h-128v42.666667h128v-42.666667z" p-id="7512"></path></svg>',Sl='<svg t="1747119094287" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9625" width="256" height="256"><path d="M835.907368 902.036211H229.591579a60.631579 60.631579 0 0 1-60.577684-60.631579v-121.263158H229.591579v121.263158h606.315789v-121.263158h60.631579v121.263158a60.631579 60.631579 0 0 1-60.631579 60.631579z m-272.815157-151.552H502.460632v-520.623158L274.378105 458.105263l-42.846316-42.846316L511.461053 135.275789a30.288842 30.288842 0 0 1 42.846315 0l279.929264 279.983158-42.846316 42.846316-228.298105-228.24421v520.623158z" p-id="9626"></path></svg>',Ai=Object.freeze(Object.defineProperty({__proto__:null,baseInfo:nl,comInfo:il,config:ol,cuttingGlobal:rl,cuttingLocal:al,demo:ll,fly:cl,fullScreen:hl,instruction:ul,loading:sl,lowerRightTriangle:pl,measure:yl,measureAngle:dl,measureConfig:fl,measureDistance:ml,measureElevation:gl,person:vl,refresh:bl,review:xl,roam:Cl,screenshot:wl,tree:El,upload:Sl},Symbol.toStringTag,{value:"Module"})),Tl=y.defineComponent({__name:"index",props:{svgContent:{},name:{},toolTipContent:{default:""},cur:{default:""},size:{default:"16"},color:{default:""},iconStyle:{default:()=>({})},leftText:{default:""},rightText:{default:""},textColor:{default:""},titleStyle:{default:null},centered:{type:Boolean,default:!1},useParentTrigger:{type:Boolean}},setup(o){const e=o,i=y.ref(!1),r=y.ref(null),a=l=>{e.toolTipContent&&(i.value=l)};return y.onMounted(()=>{r.value&&(e.useParentTrigger&&r.value.parentElement?(r.value.parentElement.onmouseenter=()=>a(!0),r.value.parentElement.onmouseleave=()=>a(!1)):(r.value.onmouseenter=()=>a(!0),r.value.onmouseleave=()=>a(!1)))}),y.onUnmounted(()=>{r.value&&(e.useParentTrigger&&r.value.parentElement?(r.value.parentElement.onmouseenter=null,r.value.parentElement.onmouseleave=null):(r.value.onmouseenter=null,r.value.onmouseleave=null))}),(l,c)=>typeof l.name=="string"&&Ai[l.name]||typeof l.svgContent=="string"&&l.svgContent.startsWith("<svg ")?(y.openBlock(),y.createBlock(y.unref(Ee.ElTooltip),{key:0,class:"tooltip-box",effect:"light",content:l.toolTipContent,placement:"top","hide-after":100,visible:y.unref(i)},{default:y.withCtx(()=>[y.createElementVNode("div",{ref_key:"svgIconBoxRef",ref:r,class:"svg-icon-box",onMouseenter:c[0]||(c[0]=h=>a(!0)),onMouseleave:c[1]||(c[1]=h=>a(!1)),style:y.normalizeStyle({cursor:l.cur})},[l.leftText?(y.openBlock(),y.createElementBlock("div",{key:0,class:"left-text text",style:y.normalizeStyle({color:l.textColor||l.color,...l.titleStyle})},[y.createVNode(vt,{text:l.leftText},null,8,["text"])],4)):y.createCommentVNode("",!0),y.createVNode(tl,{class:"icon","icon-style":{width:l.size,height:l.size,color:l.color,...l.iconStyle},"svg-content":Ai[l.name]||l.svgContent},null,8,["icon-style","svg-content"]),l.rightText?(y.openBlock(),y.createElementBlock("div",{key:1,class:"right-text text",style:y.normalizeStyle({color:l.textColor||l.color,...l.titleStyle})},[y.createVNode(vt,{text:l.rightText},null,8,["text"])],4)):y.createCommentVNode("",!0)],36)]),_:1},8,["content","visible"])):y.createCommentVNode("",!0)}});const ht=Ue(Tl,[["__scopeId","data-v-621d0d75"]]),Ll={key:2,class:"base-panel__header-title"},kl={class:"base-panel__body"},Ml={class:"base-panel__footer"},Il=y.defineComponent({__name:"index",props:{title:{},render:{},z:{default:10},size:{default:()=>({width:"280px",height:"auto"})},position:{default:()=>({left:"20px",top:"20px"})},resize:{type:Boolean,default:!0},resizeCallback:{},drag:{type:Boolean,default:!0},dragCallback:{},close:{type:Boolean,default:!0},closeCallback:{}},setup(o,{expose:e}){const i=o,r=!!y.useSlots().header,a=y.ref(),l=v=>{if(!i.drag)return;const g=a.value;if(!g)return;g.style.top||(g.style.top=`${g.offsetTop}px`),g.style.left||(g.style.left=`${g.offsetLeft}px`);const x=p(g);if(!x)return;const b=v.clientX-parseInt(g.style.left,10),C=v.clientY-parseInt(g.style.top,10);g.classList.add("dragging");const T=O=>{O.preventDefault();let P=O.clientX-b,V=O.clientY-C;const R=x.offsetWidth,I=x.offsetHeight,G=g.offsetWidth,X=g.offsetHeight;P=Math.min(Math.max(P,0),R-G),V=Math.min(Math.max(V,0),I-X),g.style.left=`${P}px`,g.style.top=`${V}px`},A=()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",A),g.classList.remove("dragging")};document.addEventListener("mousemove",T),document.addEventListener("mouseup",A),i!=null&&i.dragCallback&&i.dragCallback(d())},c=v=>{if(!a.value)return;const g=d(),x=g.width,b=g.height,C=v.clientX,T=v.clientY;a.value.classList.add("unselectable"),document.onpointermove=function(A){const O=A.clientX-C,P=A.clientY-T,V=Math.max(x+O,50),R=Math.max(b+P,50);a.value.style.width=`${V}px`,a.value.style.height=`${R}px`},document.onpointerup=function(){a.value.classList.remove("unselectable"),document.onpointermove=null,document.onpointerup=null,i!=null&&i.resizeCallback&&i.resizeCallback(d())}},h=()=>{a.value&&(a.value.classList.remove("unselectable"),document.onpointermove=null,i!=null&&i.resizeCallback&&i.resizeCallback(d()))};function p(v){let g=v.parentElement;for(;g;){if(getComputedStyle(g).position!=="static")return g;g=g.parentElement}return document.body}const u=()=>{i!=null&&i.closeCallback&&i.closeCallback(d())};function d(){var v;return(v=a.value)==null?void 0:v.getBoundingClientRect()}function m(){if(!a.value)return;const g=p(a.value).getBoundingClientRect(),x=a.value.offsetWidth,b=a.value.offsetHeight;let C={...i.position,zIndex:i.z};if(C.left!==void 0&&(C.left=C.left.includes("%")?`${parseFloat(C.left)/100*g.width}px`:C.left),C.top!==void 0&&(C.top=C.top.includes("%")?`${parseFloat(C.top)/100*g.height}px`:C.top),C.right!==void 0){const T=C.right.includes("%")?parseFloat(C.right)/100*g.width:parseFloat(C.right);C.left=`${g.width-T-x}px`,delete C.right}if(C.bottom!==void 0){const T=C.bottom.includes("%")?parseFloat(C.bottom)/100*g.height:parseFloat(C.bottom);C.top=`${g.height-T-b}px`,delete C.bottom}Object.entries(C).forEach(([T,A])=>{a.value.style[T]=A})}return y.onMounted(()=>{var v;if(a.value){const x=p(a.value).getBoundingClientRect();if(i.size){let b=typeof i.size.width&&((v=i.size.width)!=null&&v.includes("%"))?parseFloat(i.size.width)/100*x.width:parseFloat(i.size.width);a.value.style.width=b+"px";let C=i.size.height&&i.size.height.includes("%")?parseFloat(i.size.height)/100*x.height:parseFloat(i.size.height);a.value.style.height=C+"px"}}m(),window.addEventListener("resize",m)}),y.onUnmounted(()=>{window.removeEventListener("resize",m)}),e({getBoundingClientRect:d}),(v,g)=>(y.openBlock(),y.createElementBlock("div",{class:"base-panel",ref_key:"basePanel",ref:a},[r||v.title||v.render?(y.openBlock(),y.createElementBlock("div",{key:0,class:"base-panel__header",style:y.normalizeStyle({cursor:v.drag?"move":"auto"}),onMousedown:l},[r?y.renderSlot(v.$slots,"header",{key:0},void 0,!0):v.render?(y.openBlock(),y.createBlock(y.resolveDynamicComponent(v.render),{key:1})):(y.openBlock(),y.createElementBlock("span",Ll,y.toDisplayString(v.title),1))],36)):y.createCommentVNode("",!0),v.close?(y.openBlock(),y.createElementBlock("span",{key:1,class:"close-btn",onClick:u},[y.createVNode(y.unref(Vo.Close),{style:{width:"1em",height:"1em"}})])):y.createCommentVNode("",!0),y.createElementVNode("div",kl,[y.renderSlot(v.$slots,"default",{},void 0,!0)]),y.createElementVNode("div",Ml,[r?y.renderSlot(v.$slots,"footer",{key:0},void 0,!0):y.createCommentVNode("",!0)]),v.resize?(y.openBlock(),y.createElementBlock("div",{key:2,class:"base-panel__resize",onPointerdown:c,onPointerup:h},[y.createVNode(ht,{name:"lowerRightTriangle",size:"15px"})],32)):y.createCommentVNode("",!0)],512))}});const zt=Ue(Il,[["__scopeId","data-v-a0e4f5c1"]]);function Al(o,e,i=[],r=!1){return fetch(o).then(a=>a.json()).then(a=>{var g,x;const l=[],c={};if(!(a!=null&&a.length))return;a[0].name=e,a[0].visible=!i.includes((g=a[0])==null?void 0:g.guid),v(a[0]);const h={},p=[],u=function(b,C){C&&C.length>0&&C.forEach(T=>{if(!h[T.id]){const A=Object.assign({},T);A.children=[],h[A.id]=A,h[A.parent_id]&&(h[A.parent_id].children.push(A),A.parent=h[A.parent_id],A.category=="Revit Category"?(A.parent=null,p.push(A)):!T.children&&A.parent.category=="Revit Level"&&["Revit FamilyInstance","Revit Duct","Revit Element","Revit Pipe"].includes(T.category)&&(h.other||(h.other={guid:"",id:"",name:"其它",parent:null,parent_id:0,revit_level:0,children:[]},p.push(h.other)),A.parent=h.other,h.other.children.push(A)))}T.parent=b,T.children&&T.children.length>0&&u(T,T.children)})};u(a[0],(x=a[0])==null?void 0:x.children);const d=Object.assign({},a[0]);d.children=[],p.forEach(b=>{b.parent=d,d.children.push(b)});const m=Object.assign({},a[0]);m.children=[];function v(b){var C;b.secondId=Xa(),b.visible=!0,i.includes(b.guid)&&(c[b.guid]=b.secondId,r&&(b.visible=!1)),l.push(b.secondId),b.children&&((C=b.children)!=null&&C.length)&&b.children.forEach(T=>{v(T)})}return{category:d,floor:a[0],model:m,secondUuids:l,hiddenSecondIds:c}})}const _l={class:"tree-box"},Bl=["onPointerover","onPointerout","onClick","onContextmenu"],Rl=y.defineComponent({__name:"index",props:{viewer:{},config:{},cardConfig:{}},setup(o,{expose:e}){const i=o,{config:r,viewer:a,cardConfig:l}=y.toRefs(i),{model:c}=y.toRefs(r.value),h=y.ref(!1);function p(W){h.value=W,W||I(null,!1,!1)}const u=y.ref(""),d=y.computed(()=>{const W={model:"模型",floor:"楼层",category:"构件"};return r.value.tabs.map($=>({label:W[$],name:$}))}),m=(W,$)=>{var q;return $&&(j(P.value[0],!0),$==="model"&&(c.value.visible=!0,((q=a.value.highLightMeshManager.highLightMesh)==null?void 0:q.visible)===!1&&(a.value.highLightMeshManager.highLightMesh.visible=!0,a.value.highLightMeshManager.highLightMeshLine.visible=!0)),z()),!0},v=async(W,$=!1)=>{var q;if(u.value=W,P.value=O.value[u.value],x.value&&x.value.setData(P.value),(q=r.value)!=null&&q.changeTabSaveHiddenMesh||$){if(!Q.value)return;let ae=setTimeout(()=>{Object.entries(Q.value).forEach(([ce,te])=>{try{x.value&&x.value.setChecked(te,!1)}catch(ue){console.log(ue)}}),!$&&a.value.hiddenObjectPartsByHiddenMeshGuids(),clearTimeout(ae),ae=null},1e3)}},g=y.ref(""),x=y.ref(),b=W=>{x.value.filter(W)},C=(W,$)=>{var q,ae,ce;return $[((ce=(ae=(q=r.value)==null?void 0:q.treeConfig)==null?void 0:ae.props)==null?void 0:ce.label)||"name"].includes(W)},T=y.ref(400);function A(){var W,$;T.value=(($=(W=x.value)==null?void 0:W.$el)==null?void 0:$.clientHeight)||400}const O=y.ref({model:[],floor:[],category:[]}),P=y.ref([]);let V=[];const R=y.ref([]),I=(W,$=!1,q=!0)=>{var ae,ce;if(a.value){if(V=[],R.value=[],console.log(W),(W==null?void 0:W.parent)==null||!W.visible)a.value.highLightMeshManager.clearHighLightMesh(q);else{const te=function(ue){if(!ue.visible){x.value&&x.value.setCurrentKey("");return}if(R.value.push(ue.secondId),ue.children&&ue.children.length>0)ue.children.forEach(fe=>{te(fe)});else for(const fe in a.value.objects){const w=a.value.objects[fe].geometry;w.userData[ue.guid]&&w.userData[ue.guid].forEach(E=>{V.push(E==null?void 0:E.uuid)})}};te(W),V.length?a.value.highLightMeshManager.setHighLightById(V,"uuid",q):(a.value.highLightMeshManager.clearHighLightMesh(),R.value=[],Ee.ElMessage("未查询到对应构件."))}x.value&&$&&(W!=null&&W.secondId)&&u.value!=="model"&&(x.value.setCurrentKey(W.secondId),y.nextTick(()=>{var ue,fe,_e;const te=(ue=x.value)==null?void 0:ue.getCurrentNode();te&&((fe=x.value)==null||fe.setExpandedKeys([te.secondId]),(_e=x.value)==null||_e.scrollToNode(te.secondId,"center"))})),(ae=r.value)!=null&&ae.nodeClickCallback&&((ce=r.value)==null||ce.nodeClickCallback(W))}},G=(W,$)=>{if(W.preventDefault(),$){if($.secondId===R.value[0]){z();return}const q=function(ae){const ce=R.value.indexOf(ae.secondId);if(ce>-1&&R.value.splice(ce,1),ae.children&&ae.children.length>0)ae.children.forEach(te=>{q(te)});else for(const te in a.value.objects){const fe=a.value.objects[te].geometry;fe.userData[ae.guid]&&fe.userData[ae.guid].forEach(_e=>{const w=V.indexOf(_e.uuid);w>-1&&V.splice(w,1)})}};q($),V.length?a.value.highLightMeshManager.setHighLightById(V,"uuid",!1):(a.value.highLightMeshManager.clearHighLightMesh(),R.value=[])}},X=(W,$)=>{var q,ae;!((q=r.value)!=null&&q.model)||W.parent||(ae=r.value)==null||ae.model.children.forEach(ce=>{ce instanceof f.Mesh&&(ce.material.depthTest=$,ce.material.depthWrite=$)})},j=(W,$)=>{var q,ae,ce,te,ue,fe,_e,w,E,M,S,k;try{if(a.value&&c.value){if(u.value==="model")W.visible=$,c.value.visible=$,(ue=(te=(ce=(ae=(q=a.value.highLightMeshManager.highLightMesh)==null?void 0:q.geometry)==null?void 0:ae.attributes)==null?void 0:ce.position)==null?void 0:te.array)!=null&&ue.length&&(a.value.highLightMeshManager.highLightMesh.visible=$,a.value.highLightMeshManager.highLightMeshLine.visible=$);else{let D=function(Y,oe){var he;Y.visible=oe,(he=Y==null?void 0:Y.children)!=null&&he.length&&(Y==null||Y.children.forEach(re=>{D(re,oe)}))};const B=!(W!=null&&W.parent);D(W,$);const _={};let F=null;(M=(E=(w=(_e=(fe=a.value.highLightMeshManager.highLightMesh)==null?void 0:fe.geometry)==null?void 0:_e.attributes)==null?void 0:w.position)==null?void 0:E.array)!=null&&M.length&&(F=a.value.highLightMeshManager.highLightMesh.geometry);let H=!1;const U=function(Y,oe){if(Y.children&&Y.children.length>0)Y.children.forEach(he=>{U(he,oe)});else{for(const he in a.value.objects){const re=a.value.objects[he];a.value.setObjectPartsToBeVisibleAndHiddenByGuid(re.geometry,Y.guid,oe)&&(_[he]=re)}F&&(a.value.setObjectPartsToBeVisibleAndHiddenByGuid(F,Y.guid,oe),H=!0)}};U(W,B?$:W.visible),H&&a.value.highLightMeshManager.updateHighLightMeshLine();for(const Y in _){const oe=_[Y].geometry,he=_[Y].children[0];he instanceof f.LineSegments&&(he.geometry.dispose(),he.geometry=new f.EdgesGeometry(oe))}}(S=r.value)!=null&&S.nodeCheckCallback&&((k=r.value)==null||k.nodeCheckCallback(W,$))}}catch(D){console.log(D)}};function z(W=!0){V=[],R.value=[],a.value.highLightMeshManager.clearHighLightMesh(W),x.value&&x.value.setCurrentKey("")}const J=y.ref([]),Q=y.ref({});async function de(){var W,$,q,ae,ce,te,ue,fe,_e,w;if(($=(W=r.value)==null?void 0:W.tabs)!=null&&$.length&&((q=a.value)!=null&&q.objects)){u.value=(ae=r.value)==null?void 0:ae.tabs[0];const E=await Al((ce=r.value)==null?void 0:ce.jsonFileUrl,(te=r.value)==null?void 0:te.model.name,(ue=r.value)==null?void 0:ue.hiddenMeshGuids,(fe=r.value)==null?void 0:fe.changeTabSaveHiddenMesh);(_e=r.value)==null||_e.tabs.forEach(M=>{O.value[M]=E!=null&&E.hasOwnProperty(M)?[E[M]]:[]}),J.value=E==null?void 0:E.secondUuids,Q.value=E==null?void 0:E.hiddenSecondIds,v((w=r.value)==null?void 0:w.tabs[0],!0)}}function ie(){p(!0),y.nextTick(()=>{if(a.value.rayCasterManager.raycasterResultGuid){const W=rn(P.value[0],a.value.rayCasterManager.raycasterResultGuid,"guid");W&&I(W,!0,!1)}})}function me(W){var $;p(!1),($=l.value)!=null&&$.closeCallback&&l.value.closeCallback(W)}return y.onMounted(async()=>{await de(),A(),ie(),y.nextTick(()=>{var W,$;(W=r.value)!=null&&W.loadCallback&&(($=r.value)==null||$.loadCallback())})}),e({show:h,setShow:p,open:ie,activeName:u,treeRef:x,onTreeNodePointerClick:I,currentTreeData:P,heightLightSecondIds:R,secondUuids:J,treeData:O}),(W,$)=>(y.openBlock(),y.createBlock(zt,y.mergeProps({style:{visibility:h.value?"visible":"hidden"},"resize-callback":A,"close-callback":me},{resize:!0,drag:!0,close:!0,...y.unref(l)}),{default:y.withCtx(()=>[y.createElementVNode("div",{class:"model-tree-box",style:y.normalizeStyle({contentVisibility:h.value?"visible":"hidden"})},[u.value?(y.openBlock(),y.createBlock(y.unref(Ee.ElTabs),{key:0,modelValue:u.value,"onUpdate:modelValue":$[0]||($[0]=q=>u.value=q),class:"tree-tabs","before-leave":m,onTabChange:$[1]||($[1]=q=>v(q))},{default:y.withCtx(()=>[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(d.value,q=>(y.openBlock(),y.createBlock(y.unref(Ee.ElTabPane),{key:q.name,label:q.label,name:q.name},null,8,["label","name"]))),128))]),_:1},8,["modelValue"])):y.createCommentVNode("",!0),y.createElementVNode("div",_l,[y.createVNode(y.unref(Ee.ElInput),{modelValue:g.value,"onUpdate:modelValue":$[2]||($[2]=q=>g.value=q),style:{width:"100%"},placeholder:"过滤关键字",onChange:b,clearable:""},null,8,["modelValue"]),y.createVNode(y.unref(Ee.ElTreeV2),y.mergeProps({ref_key:"treeRef",ref:x,style:{width:"100%"},class:"filter-tree",icon:y.unref(Vo.ArrowRightBold),"filter-method":C,"highlight-current":"","expand-on-click-node":!1,"show-checkbox":"",height:T.value,onCheckChange:j,"default-checked-keys":J.value,"check-on-click-node":!1,"check-on-click-leaf":!1,props:{label:"name",value:"secondId",children:"children"}},y.unref(r).treeConfig),{default:y.withCtx(({data:q})=>[y.createElementVNode("div",{class:y.normalizeClass({"tree-node-box":!0,"row-hover":q.visible,"height-light":R.value.includes(q.secondId)&&q.visible}),onPointerover:ae=>X(q,!1),onPointerout:ae=>X(q,!0),onClick:ae=>I(q,!1),onContextmenu:ae=>G(ae,R.value.includes(q.secondId)&&q.visible?q:void 0)},[y.createVNode(vt,{text:q.name},null,8,["text"])],42,Bl)]),empty:y.withCtx(()=>[y.createVNode(Gn)]),_:1},16,["icon","height","default-checked-keys"])])],4)]),_:1},16,["style"]))}});const Ol=Ue(Rl,[["__scopeId","data-v-54e25803"]]),Mt=function(o){const e=o.text,i=o.hPxText?o.hPxText:50,r=o.fgColor?o.fgColor:"#ffffff",a=o.fontFamily?o.fontFamily:"sans-serif",l=o.bold?"bold ":"",c=o.italic?"italic":"",h=o.bgColor?o.bgColor:kt("--el-color-primary"),p=document.createElement("canvas"),u=p.getContext("2d");if(u==null)return;u.font=c+l+i+"px "+a;const d=u.measureText(e),m=d.width+30,v=d.fontBoundingBoxAscent+d.fontBoundingBoxDescent,g=d.actualBoundingBoxAscent+d.actualBoundingBoxDescent,x=(v-g)/4;p.width=m,p.height=v;const b=20;u.fillStyle=h,u.beginPath(),u.moveTo(b,0),u.arcTo(m,0,m,v,b),u.arcTo(m,v,0,v,b),u.arcTo(0,v,0,0,b),u.arcTo(0,0,b,0,b),u.lineWidth=5,u.strokeStyle="#fff",u.fill(),u.stroke(),u.textAlign="center",u.textBaseline="middle",u.fillStyle=r,u.font=c+l+i+"px "+a,u.fillText(e,m/2,v/2+x);const C=new f.CanvasTexture(p),T=new f.SpriteMaterial({map:C,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),A=new f.Sprite(T);return A.scale.set(m/2200,v/2200,1),A},Uo=function(o){const e=o.text,i=o.hPxText?o.hPxText:150,r=o.hWorldAll?o.hWorldAll:200,a=o.fgColor?o.fgColor:"#ffffff",l=o.fontFamily?o.fontFamily:"sans-serif",c=o.bold?"bold ":"",h=o.textAlign?o.textAlign:"start",p=o.bgColor?o.bgColor:kt("--el-color-primary");let u=200;const d=document.createElement("canvas"),m=d.getContext("2d");if(m==null)return;m.font=c+i+"px "+l,u=m.measureText(e).width;const g=u+30>900?900:u+30,x=g/4+50;d.width=u+30,d.height=r+x,m.fillStyle=p,m.fillRect(0,0,u+30,r),m.textAlign=h,m.textBaseline="top",m.fillStyle=a,m.font=c+i+"px "+l,m.fillText(e,15,40),m.beginPath(),m.moveTo(g,r+40),m.lineTo(40,r+40),m.lineTo(g*3/16-20,r+x-40),m.lineTo(g*2/8+40,r+40),m.closePath(),m.strokeStyle=kt("--el-color-primary"),m.lineWidth=30,m.stroke();const b=new f.CanvasTexture(d),C=new f.SpriteMaterial({map:b,transparent:!0,depthTest:!0,depthWrite:!0,sizeAttenuation:!1}),T=new f.Sprite(C);return T.scale.set(d.width/8e3,d.height/8e3,1),T.center.set((g*3/16-40)/d.width,0),T};class ze extends ft.Line2{constructor(i){super();L(this,"name","cline");L(this,"geometry",new kn.LineGeometry);L(this,"material",new Na.LineMaterial({depthTest:!1,depthWrite:!1,color:parseInt(kt("--el-color-primary").replace("#","0x"))}));i!=null&&i.name&&(this.name=i.name),this.initUI(i),this.frustumCulled=!1}initUI(i){i&&i.vertexs!==void 0&&this.setVertexs(i.vertexs),i&&i.color!==void 0&&this.setColor(i.color),i&&i.dashed!==void 0&&this.setDashed(i.dashed),i&&i.lineWidth!==void 0&&this.setLineWidth(i.lineWidth),i&&i.opacity!==void 0&&this.setOpacity(i.opacity),i&&i.transparent!==void 0&&this.setTransparent(i.transparent),this.setDashSize(i&&i.dashSize!==void 0?i.dashSize:30),this.setGapSize(i&&i.gapSize!==void 0?i.gapSize:30)}setVertexs(i){let r=[];if(!i||i.length==0)throw new Error("vertexs is not defined or vertexs array is empty.");return i[0].isVector3?i.forEach(a=>{r.push(a.x,a.y,a.z)}):i[0]instanceof Array?i.forEach(a=>{r.push(a[0],a[1],a[2])}):r=i.slice(),this.geometry.dispose(),this.geometry=new kn.LineGeometry,this.geometry.setPositions(r),this.computeLineDistances(),this}getVertexs(){const i=[];if(!this.geometry.attributes.instanceStart)return[];const r=this.geometry.attributes.instanceStart.data.array;for(let a=0;a<r.length;a+=3)i.push(new f.Vector3(r[a],r[a+1],r[a+2]));return i}setDashed(i){this.material.dashed=i,i?this.material.defines.USE_DASH="":delete this.material.defines.USE_DASH,this.material.needsUpdate=!0}setDashSize(i){this.userData.dashSize=i}setGapSize(i){this.userData.gapSize=i}setLineWidth(i=.001){this.material.linewidth=i}setTransparent(i){this.material.transparent=i}setOpacity(i=1){this.material.opacity=i}setColor(i=9945056){this.material.color.set(i)}}const Ks=o=>{let e=0;for(let i=0,r=1,a=2;a<o.length;r++,a++){const l=o[i].distanceTo(o[r]),c=o[r].distanceTo(o[a]),h=o[a].distanceTo(o[i]),p=(l+c+h)/2;e+=Math.sqrt(p*(p-l)*(p-c)*(p-h))}return e},fs=o=>{if(o.length!=3)throw new Error("角度点数量只能为3个!");const e=new f.Vector3().subVectors(o[0],o[1]),i=new f.Vector3().subVectors(o[2],o[1]);return e.angleTo(i)/Math.PI*180},Go=new f.MeshBasicMaterial({color:16358667,transparent:!0,opacity:.2,depthTest:!1,depthWrite:!1,side:2}),zo=new f.MeshBasicMaterial({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,side:2});function Dl(o,e=!1){if(o.length<3)throw new Error("点的数量必须大于等于3个!");const i=new f.Shape;o.forEach((c,h)=>{h==0?i.moveTo(c.x,c.y):i.lineTo(c.x,c.y)});const r=new f.ExtrudeGeometry(i,{bevelEnabled:!1,bevelThickness:0}),a=e?zo:Go;return new f.Mesh(r,a)}const zn=(o,e)=>{if(o.length<3)throw new Error("点的数量必须大于等于3个!");const i=new f.BufferGeometry,r=[];for(let c=1;c<o.length;c++)o[c+1]&&(r.push(o[0].x,o[0].y,o[0].z),r.push(o[c].x,o[c].y,o[c].z),r.push(o[c+1].x,o[c+1].y,o[c+1].z));const a=new Float32Array(r);i.setAttribute("position",new f.BufferAttribute(a,3));const l=e?zo:Go;return new f.Mesh(i,l)};function Ho(o,e,i,r,a,l=!0){const c=document.createElement("div");c.innerHTML=o,c.id=o,c.style.padding="3px 6px",c.style.color=r||"#fff",c.style.fontSize=i||"12px",c.style.backgroundColor=a||"#777777",c.style.position="absolute",c.style.top="0px",c.style.left="0px",c.style.textShadow="-1px 1px 0 #000, 1px 1px 0 #000, 1px -1px 0 #000,-1px -1px 0 #000";const h=new Po.CSS2DObject(c);return e&&h.position.copy(e),h.position.y=h.position.y+13,h.name=o,h.visible=l,h}const Mn=function(){const o=document.createElement("canvas"),e=o.getContext("2d");o.width=100,o.height=100,e.arc(50,50,50,0,360,!1),e.fillStyle="#ffffff",e.fill();const i=new f.CanvasTexture(o);return new f.SpriteMaterial({map:i,transparent:!0,sizeAttenuation:!1,depthTest:!1,color:255})}();let Hn=class{constructor(e,i){L(this,"rays");L(this,"step");L(this,"state");L(this,"element");L(this,"raycaster",new f.Raycaster);L(this,"camera");L(this,"point",new f.Vector3);L(this,"currentObj");L(this,"group");L(this,"points");L(this,"curr_line");L(this,"down");L(this,"pointMesh");L(this,"callback");L(this,"viewer");L(this,"start",new f.Vector2);L(this,"end",new f.Vector2);L(this,"events");L(this,"UNIT");this.rays=[],this.viewer=e,this.step=0,this.state="",this.element=e.element,this.camera=e.camera,this.currentObj=null,this.group=e.containerGroup,this.points=[],this.down=!1,this.callback=i.callback;const r=e.containerGroup.getObjectByName("curr_line");if(r)this.curr_line=r,this.pointMesh=e.containerGroup.getObjectByName("move_point");else{this.curr_line=new ze({vertexs:[0,0,0,0,0,0],color:16358667,lineWidth:.002,name:"curr_line",transparent:!0});const a=Ho("");this.curr_line.add(a),this.curr_line.visible=!1,a.visible=!1,e.containerGroup.add(this.curr_line),this.pointMesh=new f.Sprite(Mn),this.pointMesh.scale.set(.01,.01,1),this.pointMesh.name="move_point",this.pointMesh.visible=!1,e.containerGroup.add(this.pointMesh)}this.events={pointerup:this.upEvent.bind(this),pointerdown:this.downEvent.bind(this),pointermove:this.mouseMoveEvent.bind(this)},this.UNIT={unit:"m",precision:"1"},this.initEvents()}initEvents(){for(const e in this.viewer.objs)this.viewer.objs[e].traverse(r=>{r instanceof f.Mesh&&this.rays.push(r)});this.element.addEventListener("pointerup",this.events.pointerup),this.element.addEventListener("pointerdown",this.events.pointerdown),this.element.addEventListener("pointermove",this.events.pointermove),this.group.children.forEach(e=>{e.userData.type=="measure"&&(e.visible=!0)})}mouseMoveEvent(e){if(this.state=="")return;if(this.down){this.end.set(e.clientX,e.clientY);return}const i=this.element.getBoundingClientRect(),r=i.width,a=i.height,l=e.clientY-i.top,c=e.clientX-i.left,h={x:0,y:0};h.x=c/r*2-1,h.y=-(l/a)*2+1,this.raycaster.setFromCamera(h,this.camera);const p=this.raycaster.intersectObjects(this.rays,!1);if(this.currentObj=null,p.length<1||!p[0].point)return;const u=this.computedEdegPoint(p[0].object.matrix,p[0].object.geometry,p[0].face,p[0].point);if(this.point.copy(u),this.pointMesh.position.copy(u),this.currentObj=p[0].object,this.points[this.step]=u,this.state=="elevation"){const d=this.judeUnit(this.UNIT.unit,u.y,Number(this.UNIT.precision))+this.UNIT.unit;this.curr_line.children[0].element.innerHTML=d,this.curr_line.children[0].position.set(u.x,u.y+.1,u.z);return}if(this.curr_line.setVertexs(this.points),this.state=="angle"&&this.step>1){const d=fs(this.points).toFixed(Number(this.UNIT.precision));this.curr_line.children[0].element.innerHTML=d+"°",this.curr_line.children[0].position.lerpVectors(this.points[1],this.points[2],.5)}else if(this.state=="distance"&&this.step>0){const d=this.points[0].distanceTo(this.points[1]),m=this.judeUnit(this.UNIT.unit,d,Number(this.UNIT.precision))+this.UNIT.unit;this.curr_line.children[0].element.innerHTML=m,this.curr_line.children[0].position.lerpVectors(this.points[0],this.points[1],.5)}}upEvent(e){if(this.down=!1,this.start.distanceTo(this.end)>0){this.start.multiplyScalar(0),this.end.multiplyScalar(0);return}if(this.currentObj!=null&&e.button==0)if(this.curr_line.children[0].visible=!0,this.state=="distance"){if(this.step<1)this.step++;else if(this.step==1){this.points.sort((c,h)=>h.y-c.y);const i=this.points[0].clone(),r=this.points[1].clone(),a=[{x:i.x,y:i.y,z:i.z},{x:i.x,y:i.y,z:r.z},{x:r.x,y:i.y,z:r.z},{x:r.x,y:r.y,z:r.z}].map(c=>new f.Vector3(c.x,c.y,c.z)),l=[{points:[a[3],a[0]],color:parseInt(kt("--el-color-primary").replace("#","0x")),label:"直线距离",useLabel:!0,dashed:!1,lineWidth:.002,opacity:1},{points:[a[1],a[2]],color:65280,label:"x(横轴)",dashed:!1,opacity:.7,lineWidth:.001},{points:[a[2],a[3]],color:8388736,label:"y(纵轴)",dashed:!1,opacity:.7,lineWidth:.001},{points:[a[0],a[1]],color:16711680,label:"z(竖轴)",dashed:!1,opacity:.7,lineWidth:.001}];this.createDistanceLine(l),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText=""}}else this.state=="angle"?this.step<2?this.step++:this.step==2&&(this.createAngleLine(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText=""):this.state=="elevation"&&(this.step++,this.step===1&&(this.createHeight(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText=""))}downEvent(e){this.down=!0,this.start.set(e.clientX,e.clientY),this.end.set(e.clientX,e.clientY)}createDistanceLine(e){const i=new f.Group,r=[];e.forEach((a,l)=>{const c=a.points[0].distanceTo(a.points[1]),h=new ze({vertexs:[a.points[0],a.points[1]],color:a.color,lineWidth:a.lineWidth,transparent:!0,opacity:a.opacity,dashed:a.dashed}),p=this.judeUnit(this.UNIT.unit,Number(c),Number(this.UNIT.precision))+this.UNIT.unit;if(a.useLabel){const u=Mt({text:p});u.position.lerpVectors(a.points[0],a.points[1],.5),h.add(u)}h.userData.type="measure",i.add(h),r.push({label:a.label,color:`#${a.color.toString(16).padStart(6,"0")}`,value:p})}),i.userData.type="measure",this.group.add(i),this.callback&&this.callback(r)}createAngleLine(e){if(e.length<3)throw new Error("角度测量点必须是三个!");e.length>3&&(e=e.slice(0,3));const i=new ze({vertexs:e,lineWidth:.002,transparent:!0}),a=fs(e).toFixed(Number(this.UNIT.precision))+"°",l=Mt({text:a}),c=e[0],h=e[1],p=e[2],u=new f.Vector3().subVectors(c,h),d=new f.Vector3().subVectors(p,h),m=new f.Vector3,v=u.angleTo(d);if(m.crossVectors(u,d),m.normalize(),d.applyAxisAngle(m,-v/2),d.multiplyScalar(.5),d.add(h),!l)return;new f.Box3().expandByObject(i),l.position.copy(d),i.add(l),this.group.add(i),i.userData.type="measure",this.callback&&this.callback([{label:"角度",color:kt("--el-color-primary"),value:a}])}createAreaLine(e){if(e.length<3)throw new Error("面积测量点不能少于三个!");const r=Ks(e)+"",a=zn(e),l=new ze({vertexs:[...e,e[0]],color:kt("--el-color-primary").replace("#","0x"),lineWidth:.002,transparent:!0}),c=Mt({text:r});if(!c)return;const h=new f.Box3;h.expandByObject(l),h.getCenter(c.position),l.add(a,c),this.group.add(l),l.userData.type="measure",this.callback&&this.callback(r)}createElevationLine(e){const i=new ze({vertexs:[e[1],e[0]],lineWidth:.002,transparent:!0}),a=e[0].distanceTo(e[1]).toFixed(Number(this.UNIT.precision))+this.UNIT.unit,l=Mt({text:a});if(!l){i.material.dispose(),i.geometry.dispose();return}l.position.lerpVectors(e[0],e[1],.5),i.add(l),i.userData.type="measure",this.group.add(i)}createHeight(e){if(!e[0])return;const i=this.judeUnit(this.UNIT.unit,e[0].y,Number(this.UNIT.precision))+this.UNIT.unit,r=Uo({text:i});r&&(r.position.copy(e[0]),r.userData.type="measure",this.group.add(r),this.callback&&this.callback([{label:"标高",color:kt("--el-color-primary"),value:i}]))}computedEdegPoint(e,i,r,a){const l=i.attributes.position,c=new f.Vector3(l.getX(r.a),l.getY(r.a),l.getZ(r.a)).applyMatrix4(e),h=new f.Vector3(l.getX(r.b),l.getY(r.b),l.getZ(r.b)).applyMatrix4(e),p=new f.Vector3(l.getX(r.c),l.getY(r.c),l.getZ(r.c)).applyMatrix4(e),u=c.distanceTo(a),d=h.distanceTo(a),m=p.distanceTo(a),v=[{dis:u,point:c},{dis:d,point:h},{dis:m,point:p}];return v.sort((g,x)=>g.dis-x.dis),v[0].dis<.2?v[0].point:a}adjustSetting(e){this.UNIT.unit=e.unit,this.UNIT.precision=e.precision}judeUnit(e,i,r){return e=="m"?i.toFixed(r):e=="cm"?(i*100).toFixed(r):e=="mm"?(i*1e3).toFixed(r):""}setType(e){this.state=e,this.step=0,e==""?(this.curr_line.visible=!1,this.pointMesh.visible=!1,this.curr_line.children[0].visible=!1,this.points.length=0):(this.curr_line.visible=!0,this.pointMesh.visible=!0,this.curr_line.children[0].visible=!0)}clearAll(){const e=[];this.group.children.forEach(r=>{r.userData.type=="measure"&&e.push(r)}),this.curr_line.children[0].visible=!0,this.curr_line.children[0].element.innerHTML="",this.curr_line.children[0].visible=!1,e.forEach(r=>{if(this.curr_line.children[0].visible=!1,r instanceof ze){const a=r;a.geometry.dispose(),a.material.dispose(),r.children[0].material.dispose()}else r instanceof f.Sprite&&r.material.dispose();this.group.remove(r)});let i="";(this.state=="distance"||this.state=="elevation")&&(i="0"+this.UNIT.unit),this.state=="angle"&&(i="0°"),this.callback&&this.callback({num1:i})}destory(){this.element.removeEventListener("pointerup",this.events.pointerup),this.element.removeEventListener("pointerdown",this.events.pointerdown),this.element.removeEventListener("pointermove",this.events.pointermove),this.step=0,this.currentObj=null,this.state="",this.curr_line.visible=!1,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerHTML="",this.pointMesh.visible=!1,this.group.children.forEach(e=>{e.userData.type=="measure"&&(e.visible=!1)})}};const Nl={class:"measure-box"},Pl={class:"measure-types-box"},Vl={class:"measure-types"},Fl=["onMouseup"],Ul={class:"label"},Gl={class:"measure-result"},zl={key:0,class:"measure-result-box"},Hl={class:"label"},jl={class:"clear-btn"},Wl=y.defineComponent({__name:"index",props:{viewer:{},cardConfig:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a}=y.toRefs(i),l=y.ref(),c=()=>{var P;return(P=l.value)==null?void 0:P.getBoundingClientRect()},h=y.ref(!1),p=()=>{h.value=!h.value};function u(P){var V,R;(V=a.value)!=null&&V.closeCallback&&((R=a.value)==null||R.closeCallback(P))}const d={distance:{name:"距离",icon:"measureDistance"},angle:{name:"角度",icon:"measureAngle"},elevation:{name:"标高",icon:"measureElevation"}},m=y.ref([{bindValue:"m",label:"单位",key:["distance","elevation"],options:[{name:"m",value:"m"},{name:"cm",value:"cm"},{name:"mm",value:"mm"}]},{bindValue:"1",label:"精度",key:["distance","angle","elevation"],options:[{name:"0.0",value:"1"},{name:"0.00",value:"2"},{name:"0.000",value:"3"}]}]);let v;function g(){v&&v.adjustSetting({unit:m.value[0].bindValue,precision:m.value[1].bindValue})}const x=y.ref(""),b=P=>{P!==x.value&&(x.value=P,v.setType(P),O())};function C(){r.value&&r.value.rayCasterManager.setEventHandler(null),v=new Hn(r.value,{callback:A.bind(this)}),b("distance")}const T=y.ref([]);function A(P){T.value=P}function O(){v&&v.clearAll()}return y.onMounted(()=>{C()}),y.onBeforeUnmount(()=>{var P,V;O(),v&&v.destory(),r.value&&(Array.isArray(r.value.options.rayCaster)?(P=r.value.options.rayCaster)!=null&&P.length:(V=r.value.options.rayCaster)!=null&&V.type)&&r.value&&r.value.rayCasterManager.setEventHandler(r.value.options.rayCaster)}),e({getCardDOMRect:c}),(P,V)=>(y.openBlock(),y.createBlock(zt,y.mergeProps({ref_key:"CardRef",ref:l,"close-callback":u},{resize:!1,drag:!0,close:!0,...y.unref(a)}),{default:y.withCtx(()=>{var R;return[y.createElementVNode("div",Nl,[y.createElementVNode("div",Pl,[y.createElementVNode("div",Vl,[(y.openBlock(),y.createElementBlock(y.Fragment,null,y.renderList(d,(I,G)=>y.createElementVNode("div",{class:y.normalizeClass(["measure-type",{active:y.unref(x)===G}]),key:I.name,onMouseup:X=>b(G)},[y.createVNode(ht,{"use-parent-trigger":"",name:I.icon,"tool-tip-content":I.name,size:"25px"},null,8,["name","tool-tip-content"])],42,Fl)),64))]),y.createElementVNode("span",{class:y.normalizeClass(["arrow-right",{active:y.unref(h)}]),onClick:p},[y.createVNode(ht,{name:"config",size:"20px"})],2)]),y.createElementVNode("div",{class:"measure-config",style:y.normalizeStyle({height:y.unref(h)?y.unref(x)==="angle"?"39px":"68px":"0"})},[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(y.unref(m),I=>y.withDirectives((y.openBlock(),y.createElementBlock("div",{class:"unit-box config",key:I.label},[y.createElementVNode("span",Ul,y.toDisplayString(I.label),1),y.createVNode(y.unref(Ee.ElSelect),{modelValue:I.bindValue,"onUpdate:modelValue":G=>I.bindValue=G,size:"small",onChange:g},{default:y.withCtx(()=>[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(I.options,G=>(y.openBlock(),y.createBlock(y.unref(Ee.ElOption),{key:G.value,label:G.name,value:G.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])),[[y.vShow,I.key.includes(y.unref(x))]])),128))],4),y.createElementVNode("div",Gl,[(R=y.unref(T))!=null&&R.length?(y.openBlock(),y.createElementBlock("div",zl,[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(y.unref(T),(I,G)=>(y.openBlock(),y.createElementBlock("div",{class:"measure-item",key:G},[y.createElementVNode("div",Hl,y.toDisplayString(I.label),1),y.createElementVNode("div",{class:"value",style:y.normalizeStyle({color:I.color})},y.toDisplayString(I.value),5)]))),128))])):(y.openBlock(),y.createBlock(Gn,{key:1,height:"100px",title:"暂无测试数据"}))]),y.createElementVNode("div",jl,[y.createVNode(y.unref(Ee.ElButton),{size:"small",onClick:V[0]||(V[0]=I=>O())},{default:y.withCtx(()=>V[1]||(V[1]=[y.createTextVNode("清除")])),_:1})])])]}),_:1},16))}});const Xl=Ue(Wl,[["__scopeId","data-v-39b67b39"]]);function Zl(o){let e=new f.Box3;return e.setFromObject(o),e.getSize(new f.Vector3)}const jo="c2VsZi5vbm1lc3NhZ2UgPSBhc3luYyAobikgPT4gewogIGNvbnN0IHsgY2FudmFzOiBlLCBpbWFnZVNvdXJjZTogcyB9ID0gbi5kYXRhOwogIGlmICghZSB8IHMpCiAgICB0aHJvdyBwb3N0TWVzc2FnZShudWxsKSwgbmV3IEVycm9yKCLnvLrlsJHlj4LmlbAhIik7CiAgdHJ5IHsKICAgIGNvbnN0IHQgPSBhd2FpdCBjcmVhdGVJbWFnZUJpdG1hcChzKTsKICAgIGUud2lkdGggPSB0LndpZHRoLCBlLmhlaWdodCA9IHQuaGVpZ2h0LCBlLmdldENvbnRleHQoIjJkIikuZHJhd0ltYWdlKHQsIDAsIDAsIGUud2lkdGgsIGUuaGVpZ2h0KSwgdC5jbG9zZSgpLCBlLmNvbnZlcnRUb0Jsb2IoKS50aGVuKChvKSA9PiBuZXcgUHJvbWlzZSgociwgYykgPT4gewogICAgICBjb25zdCBhID0gbmV3IEZpbGVSZWFkZXIoKTsKICAgICAgYS5vbmVycm9yID0gYywgYS5vbmxvYWQgPSBmdW5jdGlvbigpIHsKICAgICAgICByKGEucmVzdWx0KTsKICAgICAgfSwgYS5yZWFkQXNEYXRhVVJMKG8pOwogICAgfSkpLnRoZW4oKG8pID0+IHsKICAgICAgcG9zdE1lc3NhZ2Uobyk7CiAgICB9KS5jYXRjaCgobykgPT4gewogICAgICBjb25zb2xlLmxvZyhvKSwgcG9zdE1lc3NhZ2UobnVsbCk7CiAgICB9KTsKICB9IGNhdGNoICh0KSB7CiAgICBjb25zb2xlLmxvZyh0KSwgcG9zdE1lc3NhZ2UobnVsbCk7CiAgfQp9Owo=",_i=typeof window<"u"&&window.Blob&&new Blob([atob(jo)],{type:"text/javascript;charset=utf-8"});function Yl(){let o;try{if(o=_i&&(window.URL||window.webkitURL).createObjectURL(_i),!o)throw"";return new Worker(o)}catch{return new Worker("data:application/javascript;base64,"+jo,{type:"module"})}finally{o&&(window.URL||window.webkitURL).revokeObjectURL(o)}}class Kl{constructor(e,i=4){L(this,"WorkerScript");L(this,"maxSize");L(this,"destructionTimer",null);L(this,"idleDestructionCountdownDuration",60*1e3);L(this,"workers",[]);L(this,"queue",[]);this.WorkerScript=e,this.maxSize=i}run(e,i){return this.destructionTimer&&(clearTimeout(this.destructionTimer),this.destructionTimer=null),new Promise((r,a)=>{const l={data:e,transferable:i,resolve:r,reject:a},c=this.obtainIdleWorker();c?this.executeTask(c,l):this.queue.push(l)})}obtainIdleWorker(){const e=this.workers.find(i=>!i.busy);if(e)return e;if(this.workers.length<this.maxSize){const i=new this.WorkerScript;let r={worker:i,busy:!1};return i.onmessage=a=>{r.busy=!1,r==null||r.resolve(a),this.nextTask(r)},i.onerror=a=>{r.busy=!1,r==null||r.reject(a),this.nextTask(r)},this.workers.push(r),r}else return null}executeTask(e,i){e.busy=!0,e.resolve=i.resolve,e.reject=i.reject,e.worker.postMessage(i.data,i.transferable)}nextTask(e){if(this.queue.length>0){const i=this.queue.shift();this.executeTask(e,i)}else this.workers.every(i=>!i.busy)&&(this.destructionTimer=setTimeout(()=>{this.terminateAll(),clearTimeout(this.destructionTimer),this.destructionTimer=null},this.idleDestructionCountdownDuration))}terminateAll(){this.workers.forEach(e=>e.worker.terminate()),this.workers=[],this.queue=[]}}const Wo=Kl,ql={class:"com-info-box"},Ql={key:0},Jl={key:1,class:"descriptions-box"},$l={class:"label"},e1={class:"content"},t1={key:0,class:"material-box"},s1={key:0,class:"loading-box"},n1=y.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},otherInfo:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a}=y.toRefs(i),l=y.ref(),c=()=>{var b;return(b=l.value)==null?void 0:b.getBoundingClientRect()};function h(b){var C,T;(C=a.value)!=null&&C.closeCallback&&((T=a.value)==null||T.closeCallback(b))}const p=y.ref([]),u=y.ref(0);async function d(b){p.value=b,u.value=0,await x(p.value[0])}async function m(b){var C,T,A,O,P,V,R,I,G,X,j,z,J,Q,de;if(await x(p.value[b]),p.value[b]instanceof f.Mesh&&(r.value.focusOnTheMesh(p.value[b]),((C=r.value.options.utilsMenu.options.tree)==null?void 0:C.show)!==!1&&((T=r.value.utilsMenuRef.treeRef)!=null&&T.show)&&((O=(A=r.value.utilsMenuRef)==null?void 0:A.treeRef)!=null&&O.onTreeNodePointerClick)&&((V=(P=r.value.utilsMenuRef)==null?void 0:P.treeRef)==null?void 0:V.activeName)!=="model"&&((I=(R=r.value.utilsMenuRef.treeRef)==null?void 0:R.currentTreeData)!=null&&I.length))){const ie=rn((G=r.value.utilsMenuRef.treeRef)==null?void 0:G.currentTreeData[0],p.value[b].userData.ExId,"guid");if(ie&&(ie!=null&&ie.secondId)){(z=(j=(X=r.value.utilsMenuRef)==null?void 0:X.treeRef)==null?void 0:j.treeRef)==null||z.setExpandedKeys([ie==null?void 0:ie.secondId]),(de=(Q=(J=r.value.utilsMenuRef)==null?void 0:J.treeRef)==null?void 0:Q.treeRef)==null||de.scrollToNode(ie==null?void 0:ie.secondId,"center");const me=p.value[b].clone(),W=new f.BufferGeometry().copy(me.geometry);W.applyMatrix4(me.matrix),W.deleteAttribute("normal"),W.deleteAttribute("uv"),W.userData={mesh:me.geometry.uuid,guid:me.geometry.userData.ExId};const $=new f.Mesh(W,new f.MeshBasicMaterial({color:14365695,transparent:!0,opacity:.5,depthTest:!1,depthWrite:!1}));r.value.highLightMeshManager.highLightMesh.add($)}}}const v=y.ref([]),g=new Wo(Yl,4);async function x(b){var C,T,A,O;v.value=[];try{if(b!=null&&b.isObject3D)switch(b==null?void 0:b.type){case"Mesh":if(v.value.push({label:"构件名称",value:(b==null?void 0:b.name)||"暂无"}),v.value.push({label:"构件分类",value:b==null?void 0:b.type}),b!=null&&b.material){let V=[b==null?void 0:b.material].flat(1/0);const R=v.value.push({label:"构件材质",value:V.length?[]:"暂无"})-1;for(let I=0;I<V.length;I++){v.value[R].value[I]={loading:!0};let G=V[I];try{if(G!=null&&G.map&&((C=G==null?void 0:G.map)!=null&&C.image))if((T=G==null?void 0:G.map.image)!=null&&T.currentSrc)v.value[R].value[I]={map:(O=(A=G.map)==null?void 0:A.image)==null?void 0:O.currentSrc};else{const j=document.createElement("canvas").transferControlToOffscreen(),z=G==null?void 0:G.map.image,J={canvas:j,imageSource:z},Q=[j];(z instanceof Blob||z instanceof File)&&Q.push(z),g.run(J,Q).then(de=>{const ie=de==null?void 0:de.data;v.value[R].value[I]=ie?{map:ie}:null}).catch(de=>{v.value[R].value[I]=null})}else{let X=G==null?void 0:G.color.getStyle();v.value[R].value[I]=X?{color:X}:null}}catch{v.value[R].value[I]=null}}}let P=Zl(b);if(P!=null&&P.isVector3){let V=`${Math.round(P.x*10)/10}m*${Math.round(P.y*10)/10}m*${Math.round(P.z*10)/10}m`;v.value.push({label:"构件尺寸",value:V})}break;default:v.value=[];break}}catch(P){console.log({error:P})}}return y.onMounted(()=>{r.value&&r.value.rayCasterManager.setEventHandler({type:"click"})}),y.onBeforeUnmount(()=>{var b,C;r.value&&(Array.isArray(r.value.options.rayCaster)?(b=r.value.options.rayCaster)!=null&&b.length:(C=r.value.options.rayCaster)!=null&&C.type)&&r.value&&r.value.rayCasterManager.setEventHandler(r.value.options.rayCaster)}),e({getCardDOMRect:c,comInfo:v,setComInfo:x,setComGroup:d}),(b,C)=>(y.openBlock(),y.createBlock(zt,y.mergeProps({ref_key:"CardRef",ref:l,"close-callback":h},{resize:!1,drag:!0,close:!0,title:"构件信息",...y.unref(a)}),{default:y.withCtx(()=>{var T;return[y.createElementVNode("div",ql,[((T=y.unref(p))==null?void 0:T.length)>1?(y.openBlock(),y.createElementBlock("div",Ql,[y.createVNode(y.unref(Ee.ElSelect),{modelValue:y.unref(u),"onUpdate:modelValue":C[0]||(C[0]=A=>y.isRef(u)?u.value=A:null),placeholder:"请选择",style:{width:"100%"},onChange:m},{default:y.withCtx(()=>[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(y.unref(p),(A,O)=>(y.openBlock(),y.createBlock(y.unref(Ee.ElOption),{key:O,label:A.name,value:O,disabled:y.unref(u)===O},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"])])):y.createCommentVNode("",!0),y.unref(v).length?(y.openBlock(),y.createElementBlock("div",Jl,[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(y.unref(v),A=>{var O;return y.openBlock(),y.createElementBlock("div",{class:"descriptions-item",key:A.label},[y.createElementVNode("div",$l,[y.createVNode(vt,{text:A.label},null,8,["text"])]),y.createElementVNode("div",e1,[A.label==="构件材质"&&((O=A.value.filter(P=>!!(P!=null&&P.loading)||!!(P!=null&&P.map)||!!(P!=null&&P.color)))!=null&&O.length)?(y.openBlock(),y.createElementBlock("div",t1,[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(A.value,(P,V)=>(y.openBlock(),y.createElementBlock(y.Fragment,{key:V},[P.loading?(y.openBlock(),y.createElementBlock("div",s1,[y.createVNode(ht,{name:"loading",size:"16px"})])):P.map?(y.openBlock(),y.createBlock(y.unref(Ee.ElTooltip),{key:1,content:"贴图",placement:"top"},{default:y.withCtx(()=>[y.createVNode(y.unref(Ee.ElImage),{class:"material-item",src:P.map,fit:"cover","preview-src-list":[P.map]},null,8,["src","preview-src-list"])]),_:2},1024)):P.color?(y.openBlock(),y.createBlock(y.unref(Ee.ElTooltip),{key:2,content:P.color,placement:"top"},{default:y.withCtx(()=>[y.createElementVNode("div",{class:"material-item",style:y.normalizeStyle({backgroundColor:P})},null,4)]),_:2},1032,["content"])):y.createCommentVNode("",!0)],64))),128))])):(y.openBlock(),y.createBlock(vt,{key:1,text:Array.isArray(A.value)?"暂无":A.value},null,8,["text"]))])])}),128))])):(y.openBlock(),y.createBlock(Gn,{key:2,height:"150px",title:"点击模型获取构件数据"}))])]}),_:1},16))}});const i1=Ue(n1,[["__scopeId","data-v-9386eb37"]]);class Xo extends f.EventDispatcher{constructor(i,r,a){super();L(this,"_plane",new f.Plane);L(this,"_raycaster",new f.Raycaster);L(this,"_mouse",new f.Vector2);L(this,"_offset",new f.Vector3);L(this,"_intersection",new f.Vector3);L(this,"_worldPosition",new f.Vector3);L(this,"_inverseMatrix",new f.Matrix4);L(this,"origin",new f.Vector3);L(this,"direction",new f.Vector3);L(this,"_selected");L(this,"_hovered");L(this,"enabled",!0);L(this,"events");L(this,"element");L(this,"camera");L(this,"objects");this._selected=null,this._hovered=null,this.element=a,this.objects=i,this.camera=r,this.events={},this.activate(a)}activate(i){this.events.pointermove=this.onDocumentMouseMove.bind(this),this.events.pointerdown=this.onDocumentMouseDown.bind(this),this.events.pointerup=this.onDocumentMouseCancel.bind(this),this.events.mouseout=this.onDocumentMouseCancel.bind(this),i.addEventListener("pointermove",this.events.pointermove,!1),i.addEventListener("pointerdown",this.events.pointerdown,!1),i.addEventListener("pointerup",this.events.pointerup,!1),i.addEventListener("mouseout",this.events.mouseout,!1)}dispose(){for(const i in this.events)this.element.removeEventListener(i,this.events[i],!1)}onDocumentMouseMove(i){if(i.preventDefault(),!this.enabled)return;const r=this.element.getBoundingClientRect();if(this._mouse.x=(i.clientX-r.left)/r.width*2-1,this._mouse.y=-((i.clientY-r.top)/r.height)*2+1,this._raycaster.setFromCamera(this._mouse,this.camera),this._selected){const l=new f.Vector3;if(this._raycaster.ray.intersectPlane(this._plane,this._intersection)){const h=this._intersection.sub(this._offset).applyMatrix4(this._inverseMatrix);l.subVectors(h,this.origin),l.projectOnVector(this.direction),l.add(this.origin),l.add(this.origin)}this.dispatchEvent({type:"drag",object:this._selected,point:l});return}this._raycaster.setFromCamera(this._mouse,this.camera);const a=this._raycaster.intersectObjects(this.objects,!0);if(a.length>0){const l=a[0].object;this._plane.setFromNormalAndCoplanarPoint(this.camera.getWorldDirection(this._plane.normal),l.getWorldPosition(this._worldPosition)),this._hovered!==l&&(this.dispatchEvent({type:"hoveron",object:l}),this.element.style.cursor="pointer",this._hovered=l)}else this._hovered!==null&&(this.dispatchEvent({type:"hoveroff",object:this._hovered}),this.element.style.cursor="auto",this._hovered=null)}onDocumentMouseDown(i){if(!this.enabled)return;this._raycaster.setFromCamera(this._mouse,this.camera);const r=this._raycaster.intersectObjects(this.objects,!0);r.length>0&&(i.preventDefault(),this._selected=r[0].object,this.origin.copy(r[0].object.geometry.boundingSphere.center),this.direction.copy(r[0].face.normal),this._raycaster.ray.intersectPlane(this._plane,this._intersection)&&(this._inverseMatrix.copy(this._selected.parent.matrixWorld).invert(),this._offset.copy(this._intersection).sub(this._worldPosition.setFromMatrixPosition(this._selected.matrixWorld))),this.element.style.cursor="move",this.dispatchEvent({type:"dragstart",object:this._selected,plane:this._plane,intersection:this._intersection}))}onDocumentMouseCancel(i){this._selected&&(i.preventDefault(),this.dispatchEvent({type:"dragend",object:this._selected}),this._selected=null),this.element.style.cursor=this._hovered?"pointer":"auto"}}const Rt=new f.Raycaster,Ge=new f.Vector3,Ct=new f.Vector3,Te=new f.Quaternion,Bi={X:new f.Vector3(1,0,0),Y:new f.Vector3(0,1,0),Z:new f.Vector3(0,0,1)},dn={type:"change"},Ri={type:"mouseDown"},Oi={type:"mouseUp",mode:null},Di={type:"objectChange"};class Zo extends f.Object3D{constructor(e,i){super(),i===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),i=document),this.isTransformControls=!0,this.visible=!1,this.domElement=i,this.domElement.style.touchAction="none";const r=new h1;this._gizmo=r,this.add(r);const a=new u1;this._plane=a,this.add(a);const l=this;function c(A,O){let P=O;Object.defineProperty(l,A,{get:function(){return P!==void 0?P:O},set:function(V){P!==V&&(P=V,a[A]=V,r[A]=V,l.dispatchEvent({type:A+"-changed",value:V}),l.dispatchEvent(dn))}}),l[A]=O,a[A]=O,r[A]=O}c("camera",e),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0);const h=new f.Vector3,p=new f.Vector3,u=new f.Quaternion,d=new f.Quaternion,m=new f.Vector3,v=new f.Quaternion,g=new f.Vector3,x=new f.Vector3,b=new f.Vector3,C=0,T=new f.Vector3;c("worldPosition",h),c("worldPositionStart",p),c("worldQuaternion",u),c("worldQuaternionStart",d),c("cameraPosition",m),c("cameraQuaternion",v),c("pointStart",g),c("pointEnd",x),c("rotationAxis",b),c("rotationAngle",C),c("eye",T),this._offset=new f.Vector3,this._startNorm=new f.Vector3,this._endNorm=new f.Vector3,this._cameraScale=new f.Vector3,this._parentPosition=new f.Vector3,this._parentQuaternion=new f.Quaternion,this._parentQuaternionInv=new f.Quaternion,this._parentScale=new f.Vector3,this._worldScaleStart=new f.Vector3,this._worldQuaternionInv=new f.Quaternion,this._worldScale=new f.Vector3,this._positionStart=new f.Vector3,this._quaternionStart=new f.Quaternion,this._scaleStart=new f.Vector3,this._getPointer=o1.bind(this),this._onPointerDown=a1.bind(this),this._onPointerHover=r1.bind(this),this._onPointerMove=l1.bind(this),this._onPointerUp=c1.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;Rt.setFromCamera(e,this.camera);const i=fn(this._gizmo.picker[this.mode],Rt);i?this.axis=i.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){Rt.setFromCamera(e,this.camera);const i=fn(this._plane,Rt,!0);i&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(i.point).sub(this.worldPositionStart)),this.dragging=!0,Ri.mode=this.mode,this.dispatchEvent(Ri)}}pointerMove(e){const i=this.axis,r=this.mode,a=this.object;let l=this.space;if(r==="scale"?l="local":(i==="E"||i==="XYZE"||i==="XYZ")&&(l="world"),a===void 0||i===null||this.dragging===!1||e.button!==-1)return;Rt.setFromCamera(e,this.camera);const c=fn(this._plane,Rt,!0);if(c){if(this.pointEnd.copy(c.point).sub(this.worldPositionStart),r==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),l==="local"&&i!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),i.indexOf("X")===-1&&(this._offset.x=0),i.indexOf("Y")===-1&&(this._offset.y=0),i.indexOf("Z")===-1&&(this._offset.z=0),l==="local"&&i!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),a.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(l==="local"&&(a.position.applyQuaternion(Te.copy(this._quaternionStart).invert()),i.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),i.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),i.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.position.applyQuaternion(this._quaternionStart)),l==="world"&&(a.parent&&a.position.add(Ge.setFromMatrixPosition(a.parent.matrixWorld)),i.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),i.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),i.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.parent&&a.position.sub(Ge.setFromMatrixPosition(a.parent.matrixWorld))));else if(r==="scale"){if(i.search("XYZ")!==-1){let h=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(h*=-1),Ct.set(h,h,h)}else Ge.copy(this.pointStart),Ct.copy(this.pointEnd),Ge.applyQuaternion(this._worldQuaternionInv),Ct.applyQuaternion(this._worldQuaternionInv),Ct.divide(Ge),i.search("X")===-1&&(Ct.x=1),i.search("Y")===-1&&(Ct.y=1),i.search("Z")===-1&&(Ct.z=1);a.scale.copy(this._scaleStart).multiply(Ct),this.scaleSnap&&(i.search("X")!==-1&&(a.scale.x=Math.round(a.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),i.search("Y")!==-1&&(a.scale.y=Math.round(a.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),i.search("Z")!==-1&&(a.scale.z=Math.round(a.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(r==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const h=20/this.worldPosition.distanceTo(Ge.setFromMatrixPosition(this.camera.matrixWorld));i==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):i==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Ge.copy(this.rotationAxis).cross(this.eye))*h):(i==="X"||i==="Y"||i==="Z")&&(this.rotationAxis.copy(Bi[i]),Ge.copy(Bi[i]),l==="local"&&Ge.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(Ge.cross(this.eye).normalize())*h),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),l==="local"&&i!=="E"&&i!=="XYZE"?(a.quaternion.copy(this._quaternionStart),a.quaternion.multiply(Te.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),a.quaternion.copy(Te.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),a.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(dn),this.dispatchEvent(Di)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(Oi.mode=this.mode,this.dispatchEvent(Oi)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(dn),this.dispatchEvent(Di),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Rt}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function o1(o){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:o.button};{const e=this.domElement.getBoundingClientRect();return{x:(o.clientX-e.left)/e.width*2-1,y:-(o.clientY-e.top)/e.height*2+1,button:o.button}}}function r1(o){if(this.enabled)switch(o.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(o));break}}function a1(o){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(o.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(o)),this.pointerDown(this._getPointer(o)))}function l1(o){this.enabled&&this.pointerMove(this._getPointer(o))}function c1(o){this.enabled&&(this.domElement.releasePointerCapture(o.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(o)))}function fn(o,e,i){const r=e.intersectObject(o,!0);for(let a=0;a<r.length;a++)if(r[a].object.visible||i)return r[a];return!1}const Is=new f.Euler,we=new f.Vector3(0,1,0),Ni=new f.Vector3(0,0,0),Pi=new f.Matrix4,As=new f.Quaternion,Us=new f.Quaternion,rt=new f.Vector3,Vi=new f.Matrix4,hs=new f.Vector3(1,0,0),Nt=new f.Vector3(0,1,0),us=new f.Vector3(0,0,1),_s=new f.Vector3,is=new f.Vector3,os=new f.Vector3;class h1 extends f.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new f.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=new f.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:.008,opacity:1,fog:!1,toneMapped:!1,side:2}),r=e.clone();r.opacity=.15;const a=i.clone();a.opacity=.5;const l=e.clone();l.color.setHex(16711680);const c=e.clone();c.color.setHex(65280);const h=e.clone();h.color.setHex(255);const p=e.clone();p.color.setHex(16711680),p.opacity=.5;const u=e.clone();u.color.setHex(65280),u.opacity=.5;const d=e.clone();d.color.setHex(255),d.opacity=.5;const m=e.clone();m.opacity=.25;const v=e.clone();v.color.setHex(16776960),v.opacity=.25,e.clone().color.setHex(16776960);const x=e.clone();x.color.setHex(7895160);const b=new f.CylinderGeometry(0,.04,.1,12);b.translate(0,.05,0);const C=new f.BoxGeometry(.08,.08,.08);C.translate(0,.04,0);const T=new kn.LineGeometry;T.setPositions([0,0,0,1,0,0]);const A=new f.CylinderGeometry(.0075,.0075,.5,3);A.translate(0,.25,0);function O(ie,me){const W=new f.TorusGeometry(ie,.0075,3,64,me*Math.PI*2);return W.rotateY(Math.PI/2),W.rotateX(Math.PI/2),W}function P(){const ie=new f.BufferGeometry;return ie.setAttribute("position",new f.Float32BufferAttribute([0,0,0,1,1,1],3)),ie}const V={X:[[new f.Mesh(b,l),[.5,0,0],[0,0,-Math.PI/2]],[new f.Mesh(b,l),[-.5,0,0],[0,0,Math.PI/2]],[new f.Mesh(A,l),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new f.Mesh(b,c),[0,.5,0]],[new f.Mesh(b,c),[0,-.5,0],[Math.PI,0,0]],[new f.Mesh(A,c)]],Z:[[new f.Mesh(b,h),[0,0,.5],[Math.PI/2,0,0]],[new f.Mesh(b,h),[0,0,-.5],[-Math.PI/2,0,0]],[new f.Mesh(A,h),null,[Math.PI/2,0,0]]],XYZ:[[new f.Mesh(new f.OctahedronGeometry(.1,0),m.clone()),[0,0,0]]],XY:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),d.clone()),[.15,.15,0]]],YZ:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),p.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},R={X:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[.3,0,0],[0,0,-Math.PI/2]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,.3,0]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,-.3,0],[0,0,Math.PI]]],Z:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,0,.3],[Math.PI/2,0,0]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new f.Mesh(new f.OctahedronGeometry(.2,0),r)]],XY:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[.15,.15,0]]],YZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[.15,0,.15],[-Math.PI/2,0,0]]]},I={START:[[new f.Mesh(new f.OctahedronGeometry(.01,2),a),null,null,null,"helper"]],END:[[new f.Mesh(new f.OctahedronGeometry(.01,2),a),null,null,null,"helper"]],DELTA:[[new ft.Line2(P(),a),null,null,null,"helper"]],X:[[new ft.Line2(T,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ft.Line2(T,a.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ft.Line2(T,a.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},G={XYZE:[[new f.Mesh(O(.5,1),x),null,[0,Math.PI/2,0]]],X:[[new f.Mesh(O(.5,.5),l)]],Y:[[new f.Mesh(O(.5,.5),c),null,[0,0,-Math.PI/2]]],Z:[[new f.Mesh(O(.5,.5),h),null,[0,Math.PI/2,0]]],E:[[new f.Mesh(O(.75,1),v),null,[0,Math.PI/2,0]]]},X={AXIS:[[new ft.Line2(T,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},j={XYZE:[[new f.Mesh(new f.SphereGeometry(.25,10,8),r)]],X:[[new f.Mesh(new f.TorusGeometry(.5,.1,4,24),r),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new f.Mesh(new f.TorusGeometry(.5,.1,4,24),r),[0,0,0],[Math.PI/2,0,0]]],Z:[[new f.Mesh(new f.TorusGeometry(.5,.1,4,24),r),[0,0,0],[0,0,-Math.PI/2]]],E:[[new f.Mesh(new f.TorusGeometry(.75,.1,2,24),r)]]},z={X:[[new f.Mesh(C,l),[.5,0,0],[0,0,-Math.PI/2]],[new f.Mesh(A,l),[0,0,0],[0,0,-Math.PI/2]],[new f.Mesh(C,l),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new f.Mesh(C,c),[0,.5,0]],[new f.Mesh(A,c)],[new f.Mesh(C,c),[0,-.5,0],[0,0,Math.PI]]],Z:[[new f.Mesh(C,h),[0,0,.5],[Math.PI/2,0,0]],[new f.Mesh(A,h),[0,0,0],[Math.PI/2,0,0]],[new f.Mesh(C,h),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),p),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new f.Mesh(new f.BoxGeometry(.1,.1,.1),m.clone())]]},J={X:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[.3,0,0],[0,0,-Math.PI/2]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,.3,0]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,-.3,0],[0,0,Math.PI]]],Z:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,0,.3],[Math.PI/2,0,0]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[.15,.15,0]]],YZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.2),r),[0,0,0]]]},Q={X:[[new ft.Line2(T,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ft.Line2(T,a.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ft.Line2(T,a.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function de(ie){const me=new f.Object3D;for(const W in ie)for(let $=ie[W].length;$--;){const q=ie[W][$][0].clone(),ae=ie[W][$][1],ce=ie[W][$][2],te=ie[W][$][3],ue=ie[W][$][4];q.name=W,q.tag=ue,ae&&q.position.set(ae[0],ae[1],ae[2]),ce&&q.rotation.set(ce[0],ce[1],ce[2]),te&&q.scale.set(te[0],te[1],te[2]),q.updateMatrix();const fe=q.geometry.clone();fe.applyMatrix4(q.matrix),q.geometry=fe,q.renderOrder=1/0,q.position.set(0,0,0),q.rotation.set(0,0,0),q.scale.set(1,1,1),me.add(q)}return me}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=de(V)),this.add(this.gizmo.rotate=de(G)),this.add(this.gizmo.scale=de(z)),this.add(this.picker.translate=de(R)),this.add(this.picker.rotate=de(j)),this.add(this.picker.scale=de(J)),this.add(this.helper.translate=de(I)),this.add(this.helper.rotate=de(X)),this.add(this.helper.scale=de(Q)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const r=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Us;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let a=[];a=a.concat(this.picker[this.mode].children),a=a.concat(this.gizmo[this.mode].children),a=a.concat(this.helper[this.mode].children);for(let l=0;l<a.length;l++){const c=a[l];c.visible=!0,c.rotation.set(0,0,0),c.position.copy(this.worldPosition);let h;if(this.camera.isOrthographicCamera?h=(this.camera.top-this.camera.bottom)/this.camera.zoom:h=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),c.scale.set(1,1,1).multiplyScalar(h*this.size/4),c.tag==="helper"){c.visible=!1,c.name==="AXIS"?(c.position.copy(this.worldPositionStart),c.visible=!!this.axis,this.axis==="X"&&(Te.setFromEuler(Is.set(0,0,0)),c.quaternion.copy(r).multiply(Te),Math.abs(we.copy(hs).applyQuaternion(r).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="Y"&&(Te.setFromEuler(Is.set(0,0,Math.PI/2)),c.quaternion.copy(r).multiply(Te),Math.abs(we.copy(Nt).applyQuaternion(r).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="Z"&&(Te.setFromEuler(Is.set(0,Math.PI/2,0)),c.quaternion.copy(r).multiply(Te),Math.abs(we.copy(us).applyQuaternion(r).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="XYZE"&&(Te.setFromEuler(Is.set(0,Math.PI/2,0)),we.copy(this.rotationAxis),c.quaternion.setFromRotationMatrix(Pi.lookAt(Ni,we,Nt)),c.quaternion.multiply(Te),c.visible=this.dragging),this.axis==="E"&&(c.visible=!1)):c.name==="START"?(c.position.copy(this.worldPositionStart),c.visible=this.dragging):c.name==="END"?(c.position.copy(this.worldPosition),c.visible=this.dragging):c.name==="DELTA"?(c.position.copy(this.worldPositionStart),c.quaternion.copy(this.worldQuaternionStart),Ge.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Ge.applyQuaternion(this.worldQuaternionStart.clone().invert()),c.scale.copy(Ge),c.visible=this.dragging):(c.quaternion.copy(r),this.dragging?c.position.copy(this.worldPositionStart):c.position.copy(this.worldPosition),this.axis&&(c.visible=this.axis.search(c.name)!==-1));continue}c.quaternion.copy(r),this.mode==="translate"||this.mode==="scale"?(c.name==="X"&&Math.abs(we.copy(hs).applyQuaternion(r).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="Y"&&Math.abs(we.copy(Nt).applyQuaternion(r).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="Z"&&Math.abs(we.copy(us).applyQuaternion(r).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="XY"&&Math.abs(we.copy(us).applyQuaternion(r).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="YZ"&&Math.abs(we.copy(hs).applyQuaternion(r).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="XZ"&&Math.abs(we.copy(Nt).applyQuaternion(r).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1)):this.mode==="rotate"&&(As.copy(r),we.copy(this.eye).applyQuaternion(Te.copy(r).invert()),c.name.search("E")!==-1&&c.quaternion.setFromRotationMatrix(Pi.lookAt(this.eye,Ni,Nt)),c.name==="X"&&(Te.setFromAxisAngle(hs,Math.atan2(-we.y,we.z)),Te.multiplyQuaternions(As,Te),c.quaternion.copy(Te)),c.name==="Y"&&(Te.setFromAxisAngle(Nt,Math.atan2(we.x,we.z)),Te.multiplyQuaternions(As,Te),c.quaternion.copy(Te)),c.name==="Z"&&(Te.setFromAxisAngle(us,Math.atan2(we.y,we.x)),Te.multiplyQuaternions(As,Te),c.quaternion.copy(Te))),c.visible=c.visible&&(c.name.indexOf("X")===-1||this.showX),c.visible=c.visible&&(c.name.indexOf("Y")===-1||this.showY),c.visible=c.visible&&(c.name.indexOf("Z")===-1||this.showZ),c.visible=c.visible&&(c.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),c.material._color=c.material._color||c.material.color.clone(),c.material._opacity=c.material._opacity||c.material.opacity,c.material.color.copy(c.material._color),c.material.opacity=c.material._opacity,this.enabled&&this.axis&&(c.name===this.axis||this.axis.split("").some(function(p){return c.name===p}))&&(c.material.color.setHex(16776960),c.material.opacity=1)}super.updateMatrixWorld(e)}}class u1 extends f.Mesh{constructor(){super(new f.PlaneGeometry(1e5,1e5,2,2),new f.MeshBasicMaterial({visible:!1,wireframe:!0,side:f.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let i=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(i="local"),_s.copy(hs).applyQuaternion(i==="local"?this.worldQuaternion:Us),is.copy(Nt).applyQuaternion(i==="local"?this.worldQuaternion:Us),os.copy(us).applyQuaternion(i==="local"?this.worldQuaternion:Us),we.copy(is),this.mode){case"translate":case"scale":switch(this.axis){case"X":we.copy(this.eye).cross(_s),rt.copy(_s).cross(we);break;case"Y":we.copy(this.eye).cross(is),rt.copy(is).cross(we);break;case"Z":we.copy(this.eye).cross(os),rt.copy(os).cross(we);break;case"XY":rt.copy(os);break;case"YZ":rt.copy(_s);break;case"XZ":we.copy(os),rt.copy(is);break;case"XYZ":case"E":rt.set(0,0,0);break}break;case"rotate":default:rt.set(0,0,0)}rt.length()===0?this.quaternion.copy(this.cameraQuaternion):(Vi.lookAt(Ge.set(0,0,0),rt,we),this.quaternion.setFromRotationMatrix(Vi)),super.updateMatrixWorld(e)}}let p1=class{constructor(e,i){L(this,"renderer");L(this,"element");L(this,"camera");L(this,"globalPlanes");L(this,"localPlanes");L(this,"boxVertices");L(this,"planes");L(this,"boxMeshs");L(this,"localMesh");L(this,"meshs");L(this,"objects");L(this,"control");L(this,"group");L(this,"dragControl");L(this,"transControl");L(this,"clippingType");L(this,"callBack");L(this,"setParam");this.renderer=e.renderer,this.element=e.element,this.camera=e.camera,this.objects=e.objs,this.clippingType="",this.localPlanes=[],this.boxVertices={},this.boxMeshs={},this.planes={},this.globalPlanes=[],this.group=e.containerGroup,e.controlType=="orbit"?this.control=e.orbitControl:e.controlType=="fly"?this.control=e.flyControl:this.control=e.firstControl,this.meshs=[],this.callBack=i.callBackFun,this.setParam=i.set,this.computedClippingPlane(),this.initEvents()}setClippingType(e){if(e=="global"){this.renderer.localClippingEnabled=!0,this.dragControl.enabled=!1;for(const i in this.boxMeshs)this.boxMeshs[i].visible=!1;this.transControl.visible=!0,this.transControl.enabled=!0,this.localMesh.visible=!0,this.transControl.attach(this.localMesh),this.setLocalClipping(!0)}else if(e=="local"){this.renderer.localClippingEnabled=!0,this.dragControl.enabled=!0;for(const i in this.boxMeshs)this.boxMeshs[i].visible=!0;this.transControl.visible=!1,this.transControl.enabled=!1,this.localMesh.visible=!1,this.setLocalClipping(!1)}}setLocalClipping(e){for(const i in this.objects)this.objects[i].traverse(r=>{if(r instanceof f.Mesh||r instanceof f.Line)if(r.material instanceof Array)r.material.forEach(a=>{a.clippingPlanes=e?this.localPlanes:this.globalPlanes,a.clipIntersection=e});else{const a=r.material;a.clipIntersection=e,a.clippingPlanes=e?this.localPlanes:this.globalPlanes}})}computedClippingPlane(){const e=new f.Box3;for(const v in this.objects)e.expandByObject(this.objects[v]);const i=e.min,r=e.max,a=new f.Vector3((r.x+i.x)/2,r.y,(r.z+i.z)/2),l=r.distanceTo(i)/4,c=Math.floor(i.x),h=Math.ceil(r.x),p=Math.floor(i.y),u=Math.ceil(r.y),d=Math.floor(i.z),m=Math.ceil(r.z);this.boxVertices.v7=new f.Vector3(c,p,d),this.boxVertices.v2=new f.Vector3(c,p,m),this.boxVertices.v6=new f.Vector3(c,u,d),this.boxVertices.v1=new f.Vector3(c,u,m),this.boxVertices.v4=new f.Vector3(h,p,d),this.boxVertices.v3=new f.Vector3(h,p,m),this.boxVertices.v5=new f.Vector3(h,u,d),this.boxVertices.v0=new f.Vector3(h,u,m),this.injectMeshsAndLine(this.group),this.updateMeshsAndLine(),this.setGlobalMesh(this.group,a,l),this.callBack&&this.callBack({x:[c,h],y:[p,u],z:[d,m]})}setGlobalMesh(e,i,r){const a=new f.Vector3(r,0,r),l=new f.Vector3(-r,0,r),c=new f.Vector3(-r,0,-r),h=new f.Vector3(r,0,-r);this.localMesh=this.createMesh("global",.2,2),this.localMesh.geometry.setFromPoints([l,a,h,h,c,l]),this.localMesh.position.copy(i),this.localMesh.visible=!1,e.add(this.localMesh);const p=new f.Plane;a.y=i.y,l.y=i.y,c.y=i.y,p.setFromCoplanarPoints(a,l,c),this.localPlanes.push(p),this.setLocalClipping(!0)}createMesh(e,i,r){const a=new f.BufferGeometry,l=new f.MeshBasicMaterial({color:6799930,transparent:!0,opacity:i||0,side:r||0}),c=new f.Mesh(a,l);switch(c.name=e,e){case"left":this.planes[e]=new f.Plane(new f.Vector3(1,0,0),100);break;case"right":this.planes[e]=new f.Plane(new f.Vector3(-1,0,0),100);break;case"top":this.planes[e]=new f.Plane(new f.Vector3(0,-1,0),100);break;case"bottom":this.planes[e]=new f.Plane(new f.Vector3(0,1,0),100);break;case"front":this.planes[e]=new f.Plane(new f.Vector3(0,0,-1),100);break;case"back":this.planes[e]=new f.Plane(new f.Vector3(0,0,1),100);break}return c}createLine(){const e=new f.BufferGeometry,i=new f.LineBasicMaterial({color:3309539});return new f.Line(e,i)}injectMeshsAndLine(e){this.boxMeshs.left=this.createMesh("left"),this.boxMeshs.right=this.createMesh("right"),this.boxMeshs.bottom=this.createMesh("bottom"),this.boxMeshs.top=this.createMesh("top"),this.boxMeshs.front=this.createMesh("front"),this.boxMeshs.back=this.createMesh("back"),this.boxMeshs.line=this.createLine();for(const i in this.boxMeshs)this.boxMeshs[i].visible=!1;for(const i in this.planes)this.globalPlanes.push(this.planes[i]);e.add(this.boxMeshs.left,this.boxMeshs.right,this.boxMeshs.bottom,this.boxMeshs.top,this.boxMeshs.front,this.boxMeshs.back,this.boxMeshs.line),this.meshs.push(this.boxMeshs.left,this.boxMeshs.right,this.boxMeshs.bottom,this.boxMeshs.top,this.boxMeshs.front,this.boxMeshs.back)}updateMeshsAndLine(){const e=[this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v6,this.boxVertices.v6,this.boxVertices.v2,this.boxVertices.v1],i=[this.boxVertices.v4,this.boxVertices.v5,this.boxVertices.v3,this.boxVertices.v5,this.boxVertices.v0,this.boxVertices.v3],r=[this.boxVertices.v4,this.boxVertices.v3,this.boxVertices.v2,this.boxVertices.v2,this.boxVertices.v7,this.boxVertices.v4],a=[this.boxVertices.v1,this.boxVertices.v0,this.boxVertices.v5,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v1],l=[this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v0,this.boxVertices.v2,this.boxVertices.v0,this.boxVertices.v1],c=[this.boxVertices.v5,this.boxVertices.v4,this.boxVertices.v7,this.boxVertices.v7,this.boxVertices.v6,this.boxVertices.v5],h=[this.boxVertices.v0,this.boxVertices.v1,this.boxVertices.v0,this.boxVertices.v3,this.boxVertices.v0,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v1,this.boxVertices.v6,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v1,this.boxVertices.v2,this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v4,this.boxVertices.v3,this.boxVertices.v4,this.boxVertices.v5,this.boxVertices.v4,this.boxVertices.v7];this.boxMeshs.left.geometry.setFromPoints(e),this.boxMeshs.right.geometry.setFromPoints(i),this.boxMeshs.bottom.geometry.setFromPoints(r),this.boxMeshs.top.geometry.setFromPoints(a),this.boxMeshs.front.geometry.setFromPoints(l),this.boxMeshs.back.geometry.setFromPoints(c),this.boxMeshs.line.geometry.setFromPoints(h);for(const p in this.boxMeshs)this.boxMeshs[p].geometry.computeBoundingSphere();this.planes.left.setFromCoplanarPoints(this.boxVertices.v6,this.boxVertices.v2,this.boxVertices.v7),this.planes.right.setFromCoplanarPoints(this.boxVertices.v3,this.boxVertices.v5,this.boxVertices.v4),this.planes.top.setFromCoplanarPoints(this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v4),this.planes.bottom.setFromCoplanarPoints(this.boxVertices.v5,this.boxVertices.v0,this.boxVertices.v1),this.planes.front.setFromCoplanarPoints(this.boxVertices.v0,this.boxVertices.v3,this.boxVertices.v2),this.planes.back.setFromCoplanarPoints(this.boxVertices.v7,this.boxVertices.v4,this.boxVertices.v5)}changeBoxCutting(e,i){i=="x"?(this.boxVertices.v2.x=e.x[0],this.boxVertices.v7.x=e.x[0],this.boxVertices.v6.x=e.x[0],this.boxVertices.v1.x=e.x[0],this.boxVertices.v0.x=e.x[1],this.boxVertices.v3.x=e.x[1],this.boxVertices.v4.x=e.x[1],this.boxVertices.v5.x=e.x[1]):i=="y"?(this.boxVertices.v0.y=e.y[1],this.boxVertices.v1.y=e.y[1],this.boxVertices.v6.y=e.y[1],this.boxVertices.v5.y=e.y[1],this.boxVertices.v2.y=e.y[0],this.boxVertices.v3.y=e.y[0],this.boxVertices.v4.y=e.y[0],this.boxVertices.v7.y=e.y[0]):i=="z"&&(this.boxVertices.v0.z=e.z[1],this.boxVertices.v1.z=e.z[1],this.boxVertices.v2.z=e.z[1],this.boxVertices.v3.z=e.z[1],this.boxVertices.v4.z=e.z[0],this.boxVertices.v5.z=e.z[0],this.boxVertices.v6.z=e.z[0],this.boxVertices.v7.z=e.z[0]),this.updateMeshsAndLine()}initEvents(){this.dragControl=new Xo(this.meshs,this.camera,this.element),this.dragControl.enabled=!1,this.dragControl.addEventListener("dragstart",()=>{this.control.enabled=!1}),this.dragControl.addEventListener("dragend",()=>{this.control.enabled=!0}),this.dragControl.addEventListener("hoveron",e=>{this.resetMaterial();const i=e.object;i.material.opacity=.5}),this.dragControl.addEventListener("hoveroff",()=>{this.resetMaterial()}),this.dragControl.addEventListener("drag",e=>{const i=e.object,r=e.point;switch(i.name){case"left":this.boxVertices.v7.x=r.x,this.boxVertices.v6.x=r.x,this.boxVertices.v2.x=r.x,this.boxVertices.v1.x=r.x;break;case"right":this.boxVertices.v0.x=r.x,this.boxVertices.v3.x=r.x,this.boxVertices.v4.x=r.x,this.boxVertices.v5.x=r.x;break;case"top":this.boxVertices.v0.y=r.y,this.boxVertices.v1.y=r.y,this.boxVertices.v6.y=r.y,this.boxVertices.v5.y=r.y;break;case"bottom":this.boxVertices.v2.y=r.y,this.boxVertices.v3.y=r.y,this.boxVertices.v4.y=r.y,this.boxVertices.v7.y=r.y;break;case"front":this.boxVertices.v0.z=r.z,this.boxVertices.v1.z=r.z,this.boxVertices.v2.z=r.z,this.boxVertices.v3.z=r.z;break;case"back":this.boxVertices.v4.z=r.z,this.boxVertices.v5.z=r.z,this.boxVertices.v6.z=r.z,this.boxVertices.v7.z=r.z;break}this.updateMeshsAndLine(),this.setParam&&this.setParam({x:[this.boxVertices.v7.x,this.boxVertices.v0.x],y:[this.boxVertices.v7.y,this.boxVertices.v0.y],z:[this.boxVertices.v7.z,this.boxVertices.v0.z]})}),this.transControl=new Zo(this.camera,this.element),this.transControl.setMode("rotate"),this.transControl.enabled=!1,this.transControl.addEventListener("objectChange",()=>{this.updateLocalPlane()}),this.transControl.addEventListener("dragging-changed",e=>{this.control.enabled=!e.value}),this.group.add(this.transControl),this.transControl.visible=!1}resetMaterial(){this.meshs.forEach(e=>{e.material.opacity=0})}updateLocalPlane(){const e=this.localMesh.geometry.attributes.position,i=new f.Vector3(e.getX(0),e.getY(0),e.getZ(0)),r=new f.Vector3(e.getX(1),e.getY(1),e.getZ(1)),a=new f.Vector3(e.getX(2),e.getY(2),e.getZ(2));i.applyMatrix4(this.localMesh.matrix),r.applyMatrix4(this.localMesh.matrix),a.applyMatrix4(this.localMesh.matrix),this.localPlanes[0].setFromCoplanarPoints(a,r,i)}detory(){this.renderer.localClippingEnabled=!1,this.setLocalClipping(!1);for(const e in this.boxMeshs)this.boxMeshs[e].geometry.dispose(),this.boxMeshs[e].material.dispose(),this.group.remove(this.boxMeshs[e]);this.localMesh.geometry.dispose(),this.localMesh.material.dispose(),this.group.remove(this.localMesh),this.globalPlanes.length=0,this.localPlanes.length=0,this.dragControl.dispose(),this.transControl.dispose(),this.group.remove(this.transControl)}};const d1={class:"cutting-box"},f1={class:"cutting-item"},m1={class:"slider"},g1={class:"cutting-item"},y1={class:"slider"},v1={class:"cutting-item"},b1={class:"slider"},x1=y.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},currentActive:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a}=y.toRefs(i);let l;const c=y.ref({x:{min:-1e5,max:1e5},y:{min:-1e5,max:1e5},z:{min:-1e5,max:1e5}}),h=y.ref(""),p=v=>{h.value=v,l&&l.setClippingType(v)},u=y.ref({x:[0,0],y:[0,0],z:[0,0]}),d=(v,g)=>{const x={x:[0,0],y:[0,0],z:[0,0]};x[v]=g,l&&l.changeBoxCutting(x,v)};function m(v){var g,x;(g=a.value)!=null&&g.closeCallback&&((x=a.value)==null||x.closeCallback(v))}return y.onMounted(()=>{r.value&&r.value.rayCasterManager.setEventHandler(null),l=new p1(r.value,{callBackFun:v=>{Object.entries(v).forEach(([g,x])=>{c.value[g]={min:x[0],max:x[1]},u.value[g]=x})},set:v=>{Object.entries(v).forEach(([g,x])=>{u.value[g]=x})}})}),y.onBeforeUnmount(()=>{var v,g,x,b,C;l&&l.detory(),!((v=i.currentActive)!=null&&v.measure||(g=i.currentActive)!=null&&g.comInfo)&&r.value&&(Array.isArray((x=r.value.options)==null?void 0:x.rayCaster)?(b=r.value.options.rayCaster)!=null&&b.length:(C=r.value.options.rayCaster)!=null&&C.type)&&r.value&&r.value.rayCasterManager.setEventHandler(r.value.options.rayCaster)}),e({setCurrentType:p}),(v,g)=>y.unref(h)==="local"?(y.openBlock(),y.createBlock(zt,y.mergeProps({key:0,ref:"CardRef","close-callback":m},{resize:!1,drag:!0,close:!0,title:"局部剖切",...y.unref(a)}),{default:y.withCtx(()=>[y.createElementVNode("div",d1,[y.createElementVNode("div",f1,[g[6]||(g[6]=y.createElementVNode("div",{class:"label"},"x",-1)),y.createElementVNode("div",m1,[y.createVNode(y.unref(Ee.ElSlider),{modelValue:y.unref(u).x,"onUpdate:modelValue":g[0]||(g[0]=x=>y.unref(u).x=x),range:"",size:"small",min:y.unref(c).x.min,max:y.unref(c).x.max,"show-tooltip":!1,onInput:g[1]||(g[1]=x=>d("x",y.unref(u).x))},null,8,["modelValue","min","max"])])]),y.createElementVNode("div",g1,[g[7]||(g[7]=y.createElementVNode("div",{class:"label"},"y",-1)),y.createElementVNode("div",y1,[y.createVNode(y.unref(Ee.ElSlider),{modelValue:y.unref(u).y,"onUpdate:modelValue":g[2]||(g[2]=x=>y.unref(u).y=x),range:"",size:"small",min:y.unref(c).y.min,max:y.unref(c).y.max,"show-tooltip":!1,onInput:g[3]||(g[3]=x=>d("y",y.unref(u).y))},null,8,["modelValue","min","max"])])]),y.createElementVNode("div",v1,[g[8]||(g[8]=y.createElementVNode("div",{class:"label"},"z",-1)),y.createElementVNode("div",b1,[y.createVNode(y.unref(Ee.ElSlider),{modelValue:y.unref(u).z,"onUpdate:modelValue":g[4]||(g[4]=x=>y.unref(u).z=x),range:"",size:"small",min:y.unref(c).z.min,max:y.unref(c).z.max,"show-tooltip":!1,onInput:g[5]||(g[5]=x=>d("z",y.unref(u).z))},null,8,["modelValue","min","max"])])])])]),_:1},16)):y.createCommentVNode("",!0)}});const C1=Ue(x1,[["__scopeId","data-v-021484ab"]]),w1={class:"base-info-box"},E1={class:"descriptions-box"},S1={class:"label"},T1={class:"content"},L1=y.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},otherInfo:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a}=y.toRefs(i),l=y.ref(),c=()=>{var d;return(d=l.value)==null?void 0:d.getBoundingClientRect()};function h(d){var m,v;(m=a.value)!=null&&m.closeCallback&&((v=a.value)==null||v.closeCallback(d))}const p=y.ref([{label:"构件数量",value:0},{label:"三角面数量",value:0},{label:"顶点数量",value:0}]);function u(){var g,x,b,C;if(!r.value)return;const d=new Set(Object.keys((g=r.value)==null?void 0:g.allMesh)).size;d&&(p.value[0].value=d);let m=0,v=0;for(let T in(x=r.value)==null?void 0:x.objs)((b=r.value)==null?void 0:b.objs[T]).children.forEach(O=>{var P;if(O!=null&&O.isMesh){const V=O==null?void 0:O.geometry;V.index?m+=((P=V.index)==null?void 0:P.count)/3:m+=V.attributes.position.count/3}if(O!=null&&O.isMesh||O!=null&&O.isLine||O.isPoints){const V=O==null?void 0:O.geometry;V!=null&&V.isBufferGeometry?v+=V.attributes.position.count:V!=null&&V.isGeometry&&(v+=V.vertices.length)}});m&&(p.value[1].value=m),v&&(p.value[2].value=m),v&&(p.value[2].value=v),(C=i.otherInfo)!=null&&C.length&&p.value.push(...i.otherInfo)}return y.onMounted(()=>{u()}),e({getCardDOMRect:c}),(d,m)=>(y.openBlock(),y.createBlock(zt,y.mergeProps({ref_key:"CardRef",ref:l,"close-callback":h},{resize:!1,drag:!0,close:!0,title:"基础信息",...y.unref(a)}),{default:y.withCtx(()=>[y.createElementVNode("div",w1,[y.createElementVNode("div",E1,[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(y.unref(p),v=>(y.openBlock(),y.createElementBlock("div",{class:"descriptions-item",key:v.label},[y.createElementVNode("div",S1,[y.createVNode(vt,{text:v.label},null,8,["text"])]),y.createElementVNode("div",T1,[y.createVNode(vt,{text:v.value},null,8,["text"])])]))),128))])])]),_:1},16))}});const k1=Ue(L1,[["__scopeId","data-v-102dd608"]]),M1={class:"config-box"},I1={class:"inner-config-box"},A1={class:"config-item"},_1={class:"value-box"},B1={class:"config-item"},R1={class:"color-box"},O1=["onClick"],D1={class:"color-item"},N1=y.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},otherInfo:{}},setup(o,{expose:e}){var b;const i=o,{viewer:r,cardConfig:a,otherInfo:l}=y.toRefs(i),c=y.ref(!1);function h(C){c.value=C}function p(C){var T;h(!1),(T=a.value)!=null&&T.closeCallback&&a.value.closeCallback(C)}const u=y.ref(["linear-gradient(lightblue, white)","linear-gradient(#5c5c5c, white)","linear-gradient(#272727, white)","linear-gradient(#32475b, white)","linear-gradient(#32475b, white)"]);let d=!0;const m=y.ref({modelLine:((b=l.value)==null?void 0:b.modelLine)||!1,activeBg:0}),v=C=>{if(C)if(d){for(let T in r.value.objs)r.value.objs[T].children.map(O=>{const P=O.geometry.clone(),V=new f.EdgesGeometry(P),R=new f.LineSegments(V,new f.LineBasicMaterial({color:"#5c5c5c"}));R.userData.type="edge",r.value.scene.add(R)});d=!1}else r.value.scene.children.map(T=>{T.userData.type==="edge"&&(T.visible=!0)});else r.value.scene.children.map(T=>{T.userData.type==="edge"&&(T.visible=!1)})},g=C=>{var O;const T=(O=C.target)==null?void 0:O.files,A=new FileReader;A.readAsDataURL(T[0]),A.onload=()=>{if(A.result.startsWith("data:image/"))u.value.push(`url(${A.result})`),x(u.value.length-1);else return Ee.ElMessage("文件类型错误.")}},x=C=>{r.value.element.style.backgroundImage=u.value[C],m.value.activeBg=C};return y.onMounted(async()=>{var C;h(!0),(C=l.value)!=null&&C.bgColor&&u.value.push(...l.value.bgColor)}),e({show:c,setShow:h,close}),(C,T)=>(y.openBlock(),y.createBlock(zt,y.mergeProps({style:{visibility:y.unref(c)?"visible":"hidden"},"close-callback":p},{resize:!1,drag:!0,close:!0,title:"基础信息",...y.unref(a)}),{default:y.withCtx(()=>[y.createElementVNode("div",M1,[y.createElementVNode("div",I1,[y.createElementVNode("div",A1,[T[1]||(T[1]=y.createElementVNode("div",{class:"label"},"模型线框",-1)),y.createElementVNode("div",_1,[y.createVNode(y.unref(Ee.ElCheckbox),{modelValue:y.unref(m).modelLine,"onUpdate:modelValue":T[0]||(T[0]=A=>y.unref(m).modelLine=A),onChange:v,label:"显示模型线框"},null,8,["modelValue"])])]),y.createElementVNode("div",B1,[T[2]||(T[2]=y.createElementVNode("div",{class:"label"},"背景颜色",-1)),y.createElementVNode("div",R1,[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(y.unref(u),(A,O)=>(y.openBlock(),y.createElementBlock("div",{class:"color-item",key:O,style:y.normalizeStyle({backgroundImage:A,border:y.unref(m).activeBg===O?"1px solid var(--el-color-primary)":"transparent"}),onClick:P=>x(O)},null,12,O1))),128)),y.createElementVNode("div",D1,[y.createVNode(ht,{name:"upload",size:"20px",color:"var(--el-color-primary)",cur:"pointer"}),y.createElementVNode("input",{type:"file",accept:"image/*",class:"upload-btn",onChange:g},null,32)])])])])])]),_:1},16,["style"]))}});const P1=Ue(N1,[["__scopeId","data-v-464a671e"]]),V1={class:"roam-box"},F1={class:"option-card-box"},U1={class:"descriptions-box"},G1={class:"label"},z1={class:"content"},H1={class:"option-btn-box"},j1={class:"option-item"},W1={class:"option-btn"},X1={class:"option-item"},Z1={class:"option-btn"},Y1={class:"exit-btn"},K1=y.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},state:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a,state:l}=y.toRefs(i),c=y.ref(!0),h=b=>{c.value=b},p=y.ref(),u=()=>{var b;return(b=p.value)==null?void 0:b.getBoundingClientRect()};function d(b){var C,T;(C=a.value)!=null&&C.closeCallback&&((T=a.value)==null||T.closeCallback(b))}const m=y.ref([{label:"W",value:"向前移动"},{label:"S",value:"向后移动"},{label:"A",value:"向左移动"},{label:"D",value:"向右移动"},{label:"Q",value:"视角向左转动"},{label:"E",value:"视角向右转动"},{label:"R",value:"整体向上移动"},{label:"F",value:"整体向下移动"},{label:"鼠标中键",value:"滚轮放大缩小"},{label:"鼠标右键",value:"拖拽改变视角"}]),v=y.ref(0),g=y.ref(0),x=()=>{r.value.setControl(l.value,{moveSpeed:v.value,rotateSpeed:g.value})};return y.onMounted(()=>{r.value&&r.value.rayCasterManager.setEventHandler(void 0),x()}),y.onBeforeUnmount(()=>{var b,C;r.value.setControl("exist",{}),r.value&&(Array.isArray(r.value.options.rayCaster)?(b=r.value.options.rayCaster)!=null&&b.length:(C=r.value.options.rayCaster)!=null&&C.type)&&r.value&&r.value.rayCasterManager.setEventHandler(r.value.options.rayCaster)}),e({getCardDOMRect:u}),(b,C)=>(y.openBlock(),y.createElementBlock("div",V1,[y.createVNode(zt,y.mergeProps({style:{visibility:y.unref(c)?"visible":"hidden"},ref_key:"CardRef",ref:p},{resize:!1,drag:!0,close:!0,title:"操作说明",...y.unref(a)},{"close-callback":()=>h(!1)}),{default:y.withCtx(()=>[y.createElementVNode("div",F1,[y.createElementVNode("div",U1,[(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(y.unref(m),T=>(y.openBlock(),y.createElementBlock("div",{class:"descriptions-item",key:T.label},[y.createElementVNode("div",G1,[y.createVNode(vt,{text:T.label},null,8,["text"])]),y.createElementVNode("div",z1,[y.createVNode(vt,{text:T.value},null,8,["text"])])]))),128))])])]),_:1},16,["style","close-callback"]),y.createElementVNode("div",H1,[y.createElementVNode("div",j1,[C[4]||(C[4]=y.createElementVNode("div",{class:"option-label"},"飞行速度",-1)),y.createElementVNode("div",W1,[y.createVNode(y.unref(Ee.ElInputNumber),{modelValue:y.unref(v),"onUpdate:modelValue":C[0]||(C[0]=T=>y.isRef(v)?v.value=T:null),step:5,min:5,max:200,"controls-position":"right",size:"small","value-on-clear":5,onChange:x,style:{width:"80px"}},null,8,["modelValue"])])]),y.createElementVNode("div",X1,[C[5]||(C[5]=y.createElementVNode("div",{class:"option-label"},"镜头灵敏度",-1)),y.createElementVNode("div",Z1,[y.createVNode(y.unref(Ee.ElInputNumber),{modelValue:y.unref(g),"onUpdate:modelValue":C[1]||(C[1]=T=>y.isRef(g)?g.value=T:null),step:5,min:5,max:200,"controls-position":"right",size:"small","value-on-clear":5,onChange:x,style:{width:"80px"}},null,8,["modelValue"])])]),y.createElementVNode("span",{onClick:C[2]||(C[2]=T=>h(!y.unref(c)))},[y.createVNode(ht,{name:"instruction","tool-tip-content":"操作说明",color:y.unref(c)?"var(--el-color-primary)":"",cur:"pointer"},null,8,["color"])]),y.createElementVNode("div",Y1,[y.createVNode(y.unref(Ee.ElButton),{type:"danger",plain:"",size:"small",onClick:C[3]||(C[3]=T=>d())},{default:y.withCtx(()=>C[6]||(C[6]=[y.createTextVNode("退出")])),_:1})])])]))}});const q1=Ue(K1,[["__scopeId","data-v-17942138"]]),Q1=["onClick"],J1=["onClick"],$1=["onClick"],Bs="20px",Yo=y.defineComponent({__name:"index",props:{leave:{default:1},utils:{},keyPath:{default:()=>[]},currentActive:{}},emits:["handleSelect"],setup(o,{emit:e}){const i=e,r=o,a=(h,p)=>{var u;if(p&&((u=r.currentActive)!=null&&u[p]))return!0;if(h.children&&Object.keys(h.children).length>0)for(const d in h.children){const m=h.children[d];if(a(m,d))return!0}return!1};function l(h){let p=[];u(h),p!=null&&p.length&&c(p);function u(d,m){var v;if(m&&((v=r.currentActive)!=null&&v[m])&&p.push(m),d.children&&Object.keys(d.children).length>0)for(const g in d.children)u(d.children[g],g)}}function c(h,p){i("handleSelect",h,p)}return(h,p)=>(y.openBlock(!0),y.createElementBlock(y.Fragment,null,y.renderList(h.utils,(u,d)=>(y.openBlock(),y.createElementBlock(y.Fragment,{key:u.name},[u.children?(y.openBlock(),y.createBlock(y.unref(Ee.ElSubMenu),{key:0,index:u.name,class:y.normalizeClass({"is-active2":a(u)})},{title:y.withCtx(()=>[y.createElementVNode("div",{class:"icon-box",onClick:m=>l(u)},[h.leave>1?(y.openBlock(),y.createBlock(ht,{key:0,name:u.icon,size:Bs,"right-text":u.name,"icon-style":{marginRight:"8px"}},null,8,["name","right-text"])):(y.openBlock(),y.createBlock(ht,{key:1,name:u.icon,size:Bs,"use-parent-trigger":""},null,8,["name"]))],8,Q1)]),default:y.withCtx(()=>[y.createVNode(Yo,{utils:u==null?void 0:u.children,leave:h.leave+1,"key-path":[...h.keyPath,d],"current-active":h.currentActive,onHandleSelect:c},null,8,["utils","leave","key-path","current-active"])]),_:2},1032,["index","class"])):(y.openBlock(),y.createBlock(y.unref(Ee.ElMenuItem),{key:1,index:u.name,class:y.normalizeClass({"is-active2":h.currentActive[d]})},{default:y.withCtx(()=>[h.leave>1?(y.openBlock(),y.createElementBlock("div",{key:0,class:"icon-box",onClick:m=>c(d,[...h.keyPath,d])},[y.createVNode(ht,{name:u.icon,size:Bs,"right-text":u.name,"icon-style":{marginRight:"8px"}},null,8,["name","right-text"])],8,J1)):(y.openBlock(),y.createElementBlock("div",{key:1,class:"icon-box",onClick:m=>c(d,[...h.keyPath,d])},[y.createVNode(ht,{name:u.icon,size:Bs,"tool-tip-content":u.name,"use-parent-trigger":""},null,8,["name","tool-tip-content"])],8,$1))]),_:2},1032,["index","class"]))],64))),128))}}),ec={class:"utils-menu-box"},tc=y.defineComponent({__name:"index",props:{show:{type:Boolean},viewer:{},options:{}},setup(o,{expose:e}){const i=o,{viewer:r}=y.toRefs(i),a=y.ref(!0),l=y.ref({}),c=y.ref({}),h=y.ref({}),p=(V,R,I)=>{var G,X,j,z;if(R){const{left:J,top:Q}=r.value.element.getBoundingClientRect(),{width:de,height:ie,left:me,top:W}=R;h.value[V]={size:{height:ie+"px",width:de+"px"},position:{left:me-J+"px",top:W-Q+"px"}},(X=(G=I==null?void 0:I.cardConfig)==null?void 0:G.size)!=null&&X.width||delete h.value[V].size.width,(z=(j=I==null?void 0:I.cardConfig)==null?void 0:j.size)!=null&&z.height||delete h.value[V].size.height}},u=y.ref(),d=y.ref(),m=y.ref(),v=y.ref(),g=y.ref(),x=y.ref(),b=y.ref(),C=(V,R)=>{(Array.isArray(V)?V:[V]).forEach(X=>{var J;const j=!c.value[X];let z;j?(z=P(l.value,R),!(z!=null&&z.children)&&(z!=null&&z.active)&&(c.value[X]=z,(J=z.conflictKey)!=null&&J.length&&T(z.conflictKey)),G(X,j?z:c.value[X])):T([X])}),A();function G(X,j){var z,J,Q,de,ie;switch(j!=null&&j.activeCallback&&(j==null||j.activeCallback()),X){case"review":(z=r.value)==null||z.resetView();break;case"tree":u.value?u.value.open():u.value=St(Ol,{viewer:r.value,config:j.config,cardConfig:{closeCallback:()=>C(["tree"]),...j.cardConfig}},r.value.element.parentElement);break;case"fly":case"person":b.value=St(q1,{viewer:r.value,cardConfig:{closeCallback:()=>C([X]),...j.cardConfig},state:X},r.value.element.parentElement),a.value=!1;break;case"screenshot":(J=r.value)==null||J.renderScene();const me=r.value.element.toDataURL((j==null?void 0:j.type)||"image/png",(j==null?void 0:j.quality)||1);if((j==null?void 0:j.download)!==!1){const W=atob(me.split(",")[1]),$=me.split(",")[0].split(":")[1].split(";")[0],q=new ArrayBuffer(W.length),ae=new Uint8Array(q);for(let fe=0;fe<W.length;fe++)ae[fe]=W.charCodeAt(fe);const ce=new Blob([ae],{type:$}),te=URL.createObjectURL(ce),ue=document.createElement("a");ue.href=te,ue.download="scene.png",ue.click(),URL.revokeObjectURL(te)}j!=null&&j.screenshotCallback&&(j==null||j.screenshotCallback(me));break;case"global":case"local":v.value||(v.value=St(C1,{viewer:r.value,cardConfig:{closeCallback:W=>{C(["local"])},...j.cardConfig,...h.value[X]},currentActive:c.value},r.value.element.parentElement)),(Q=r.value)==null||Q.resetView(),(de=v.value)==null||de.setCurrentType(X);break;case"measure":d.value=St(Xl,{viewer:r.value,cardConfig:{closeCallback:W=>{C([X])},...j.cardConfig,...h.value[X]}},r.value.element.parentElement);break;case"comInfo":m.value=St(i1,{viewer:r.value,cardConfig:{closeCallback:W=>{C([X])},...j.cardConfig,...h.value[X]}},r.value.element.parentElement);break;case"fullScreen":document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen();break;case"baseInfo":g.value=St(k1,{viewer:r.value,cardConfig:{closeCallback:W=>{C([X])},...j.cardConfig,...h.value[X]},otherInfo:j==null?void 0:j.otherInfo},r.value.element.parentElement);break;case"config":x.value?(ie=x.value)==null||ie.setShow(!0):x.value=St(P1,{viewer:r.value,cardConfig:{closeCallback:()=>C(["config"]),...j.cardConfig},otherInfo:j==null?void 0:j.otherInfo},r.value.element.parentElement);break;default:return}}};function T(V){V.forEach(R=>{var I,G,X,j,z;switch(R){case"tree":u.value&&u.value.show&&u.value.setShow(!1);break;case"fly":case"person":b.value&&(p(R,b.value.getCardDOMRect(),c.value[R]),(I=b.value)==null||I.destroy(),b.value=void 0),a.value=!0;break;case"measure":d.value&&(p(R,d.value.getCardDOMRect(),c.value[R]),(G=d.value)==null||G.destroy(),d.value=void 0);break;case"comInfo":m.value&&(p(R,m.value.getCardDOMRect(),c.value[R]),(X=m.value)==null||X.destroy(),m.value=void 0);break;case"global":case"local":v.value&&((j=v.value)==null||j.setCurrentType(""));break;case"baseInfo":g.value&&(p(R,g.value.getCardDOMRect(),c.value[R]),(z=g.value)==null||z.destroy(),g.value=void 0);break;case"config":x.value&&x.value.show&&x.value.setShow(!1);break}c.value[R]=void 0})}function A(){var V,R,I;switch(!0){case(!((V=c.value)!=null&&V.global)&&!((R=c.value)!=null&&R.local)):v.value&&((I=v.value)==null||I.destroy(),v.value=void 0);break}}function O(){const V=Object.keys(c.value);T(V),A()}function P(V,R){if(!(R!=null&&R.length))return;let I=V[R[0]];if(R.length<=1)return I;for(let G=1;G<R.length;G++){const X=R[G];if(I.children[X])I=I.children[X];else return}return I}return y.onMounted(()=>{Object.entries(i.options).forEach(([V,R])=>{(!R.hasOwnProperty("show")||R!=null&&R.show)&&(l.value[V]=R)})}),e({handleSelect:C,currentActive:c,treeRef:u,measureRef:d,comInfoRef:m,cuttingRef:v,baseInfoRef:g,configRef:x,RoamRef:b,batchDeselectAll:O}),(V,R)=>(y.openBlock(),y.createElementBlock("div",ec,[Object.keys(l.value).length?y.withDirectives((y.openBlock(),y.createBlock(y.unref(Ee.ElMenu),{key:0,"menu-trigger":"hover",class:"utils-menu","popper-class":"utils-menu-popper",mode:"horizontal",ellipsis:!1,"unique-opened":!1},{default:y.withCtx(()=>[y.createVNode(Yo,{utils:l.value,leave:1,onHandleSelect:C,"current-active":c.value},null,8,["utils","current-active"])]),_:1},512)),[[y.vShow,a.value]]):y.createCommentVNode("",!0)]))}});const sc=Ue(tc,[["__scopeId","data-v-b6ef63b9"]]),Ko="ZnVuY3Rpb24gRShyKSB7CiAgaWYgKHIubGVuZ3RoID09PSAwKQogICAgcmV0dXJuIC0xIC8gMDsKICBsZXQgdSA9IHJbMF07CiAgZm9yIChsZXQgaSA9IDEsIGMgPSByLmxlbmd0aDsgaSA8IGM7ICsraSkKICAgIHJbaV0gPiB1ICYmICh1ID0gcltpXSk7CiAgcmV0dXJuIHU7Cn0KZnVuY3Rpb24gRyhyLCB1ID0gIVtdKSB7CiAgY29uc3QgaSA9IHJbMF0uaW5kZXggIT09IG51bGwsIGMgPSBuZXcgU2V0KE9iamVjdC5rZXlzKHJbMF0uYXR0cmlidXRlcykpLCBoID0gbmV3IFNldChPYmplY3Qua2V5cyhyWzBdLm1vcnBoQXR0cmlidXRlcykpLCBkID0ge30sIGwgPSB7fSwgZiA9IHJbMF0ubW9ycGhUYXJnZXRzUmVsYXRpdmUsIG8gPSB7IHVzZXJEYXRhOiB7fSwgZ3JvdXBzOiBbXSwgYXR0cmlidXRlczoge30gfTsKICBsZXQgcCA9IDAsIHkgPSAwLCBiID0gMDsKICBmb3IgKGxldCB0ID0gMDsgdCA8IHIubGVuZ3RoOyArK3QpIHsKICAgIGNvbnN0IGUgPSByW3RdOwogICAgbGV0IHMgPSAwOwogICAgaWYgKGkgIT09IChlLmluZGV4ICE9PSBudWxsKSkKICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoCiAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICIg55qE5Yeg5L2V5L2T44CC5omA5pyJ5Yeg5L2V5L2T5b+F6aG75YW35pyJ5YW85a6555qE5bGe5oCn77yb56Gu5L+d5omA5pyJ5Yeg5L2V5L2T6YO95pyJ57Si5byV5bGe5oCn77yM5oiW6ICF6YO95rKh5pyJ57Si5byV5bGe5oCn44CCIgogICAgICApLCBudWxsOwogICAgZm9yIChjb25zdCBuIGluIGUuYXR0cmlidXRlcykgewogICAgICBpZiAoIWMuaGFzKG4pKQogICAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKAogICAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICcg55qE5Yeg5L2V5L2T44CC5omA5pyJ5Yeg5L2V5L2T5b+F6aG75YW35pyJ5YW85a6555qE5bGe5oCn77yb56Gu5L+d5bGe5oCnICInICsgbiArICciIOWcqOaJgOacieWHoOS9leS9k+S4remDveWtmOWcqO+8jOaIluiAhemDveS4jeWtmOWcqOOAgicKICAgICAgICApLCBudWxsOwogICAgICBkW25dID09PSB2b2lkIDAgJiYgKGRbbl0gPSBbXSksIGRbbl0ucHVzaChlLmF0dHJpYnV0ZXNbbl0pLCBzKys7CiAgICB9CiAgICBpZiAocyAhPT0gYy5zaXplKQogICAgICByZXR1cm4gY29uc29sZS5lcnJvcigKICAgICAgICAiVEhSRUUuQnVmZmVyR2VvbWV0cnlVdGlsczogbWVyZ2VHZW9tZXRyaWVzKCkg5aSx6LSl77yM57Si5byV5Li6ICIgKyB0ICsgIiDnmoTlh6DkvZXkvZPjgILor7fnoa7kv53miYDmnInlh6DkvZXkvZPlhbfmnInnm7jlkIzmlbDph4/nmoTlsZ7mgKfjgIIiCiAgICAgICksIG51bGw7CiAgICBpZiAoZiAhPT0gZS5tb3JwaFRhcmdldHNSZWxhdGl2ZSkKICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoCiAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICIg55qE5Yeg5L2V5L2T44CC5omA5pyJ5Yeg5L2V5L2T55qEIG1vcnBoVGFyZ2V0c1JlbGF0aXZlIOW/hemhu+S4gOiHtOOAgiIKICAgICAgKSwgbnVsbDsKICAgIGZvciAoY29uc3QgbiBpbiBlLm1vcnBoQXR0cmlidXRlcykgewogICAgICBpZiAoIWguaGFzKG4pKQogICAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKAogICAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICIg55qE5Yeg5L2V5L2T44CC5omA5pyJ5Yeg5L2V5L2T55qEIG1vcnBoQXR0cmlidXRlcyDlv4XpobvkuIDoh7TjgIIiCiAgICAgICAgKSwgbnVsbDsKICAgICAgbFtuXSA9PT0gdm9pZCAwICYmIChsW25dID0gW10pLCBsW25dLnB1c2goZS5tb3JwaEF0dHJpYnV0ZXNbbl0pOwogICAgfQogICAgbGV0IGEgPSAwLCBtID0gMDsKICAgIGlmICh1KSB7CiAgICAgIGxldCBuOwogICAgICBpZiAoaSkKICAgICAgICBuID0gZS5pbmRleC5jb3VudDsKICAgICAgZWxzZSBpZiAoZS5hdHRyaWJ1dGVzLnBvc2l0aW9uICE9PSB2b2lkIDApCiAgICAgICAgbiA9IGUuYXR0cmlidXRlcy5wb3NpdGlvbi5jb3VudDsKICAgICAgZWxzZQogICAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKAogICAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICIg55qE5Yeg5L2V5L2T44CC5Yeg5L2V5L2T5b+F6aG75YW35pyJ57Si5byV5oiW5L2N572u5bGe5oCn44CCIgogICAgICAgICksIG51bGw7CiAgICAgIGEgPSBwLCBtID0gbiwgby5ncm91cHMucHVzaCh7CiAgICAgICAgc3RhcnQ6IGEsCiAgICAgICAgY291bnQ6IG0sCiAgICAgICAgbWF0ZXJpYWxJbmRleDogdAogICAgICB9KSwgcCArPSBuOwogICAgfQogICAgY29uc3QgZyA9IGUudXNlckRhdGEuZ3VpZDsKICAgIHkgPSBiLCBiICs9IGUuYXR0cmlidXRlcy5wb3NpdGlvbi5jb3VudCwgIW8udXNlckRhdGFbZ10gJiYgKG8udXNlckRhdGFbZ10gPSBbXSksIG8udXNlckRhdGFbZ10ucHVzaCh7CiAgICAgIHV1aWQ6IGUudXNlckRhdGEubWVzaCwKICAgICAgZmFjZV9zdGFydDogYSwKICAgICAgZmFjZV9lbmQ6IGEgKyBtLAogICAgICBnZW9fc3RhcnQ6IHksCiAgICAgIGdlb19lbmQ6IGIKICAgIH0pOwogIH0KICBpZiAoaSkgewogICAgbGV0IHQgPSAwOwogICAgY29uc3QgZSA9IFtdOwogICAgZm9yIChsZXQgcyA9IDA7IHMgPCByLmxlbmd0aDsgKytzKSB7CiAgICAgIGNvbnN0IGEgPSByW3NdLmluZGV4OwogICAgICBmb3IgKGxldCBtID0gMDsgbSA8IGEuY291bnQ7ICsrbSkKICAgICAgICBlLnB1c2goYS5hcnJheVttXSArIHQpOwogICAgICB0ICs9IHJbc10uYXR0cmlidXRlcy5wb3NpdGlvbi5jb3VudDsKICAgIH0KICAgIEFycmF5LmlzQXJyYXkoZSkgPyBvLmluZGV4ID0gRShlKSA+IDY1NTM1ID8gbmV3IFVpbnQzMkFycmF5KGUsIDApIDogbmV3IFVpbnQxNkFycmF5KGUsIDApIDogby5tZXJnZWRJbmRleCA9IGU7CiAgfQogIGZvciAoY29uc3QgdCBpbiBkKSB7CiAgICBjb25zdCBlID0gQShkW3RdKTsKICAgIGlmICghZSkKICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoJ1RIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOaXoOazleWQiOW5tuWxnuaApyAiJyArIHQgKyAnIuOAgicpLCBudWxsOwogICAgby5hdHRyaWJ1dGVzW3RdID0gZTsKICB9CiAgZm9yIChjb25zdCB0IGluIGwpIHsKICAgIGNvbnN0IGUgPSBsW3RdWzBdLmxlbmd0aDsKICAgIGlmIChlID09PSAwKQogICAgICBicmVhazsKICAgIG8ubW9ycGhBdHRyaWJ1dGVzID0gby5tb3JwaEF0dHJpYnV0ZXMgfHwge30sIG8ubW9ycGhBdHRyaWJ1dGVzW3RdID0gW107CiAgICBmb3IgKGxldCBzID0gMDsgcyA8IGU7ICsrcykgewogICAgICBjb25zdCBhID0gW107CiAgICAgIGZvciAobGV0IGcgPSAwOyBnIDwgbFt0XS5sZW5ndGg7ICsrZykKICAgICAgICBhLnB1c2gobFt0XVtnXVtzXSk7CiAgICAgIGNvbnN0IG0gPSBBKGEpOwogICAgICBpZiAoIW0pCiAgICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoJ1RIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOaXoOazleWQiOW5tuWPmOW9ouWxnuaApyAiJyArIHQgKyAnIuOAgicpLCBudWxsOwogICAgICBvLm1vcnBoQXR0cmlidXRlc1t0XS5wdXNoKG0pOwogICAgfQogIH0KICByZXR1cm4gbzsKfQpmdW5jdGlvbiBBKHIpIHsKICBsZXQgdSwgaSwgYywgaCA9IDA7CiAgZm9yIChsZXQgZiA9IDA7IGYgPCByLmxlbmd0aDsgKytmKSB7CiAgICBjb25zdCBvID0gcltmXTsKICAgIGlmIChvLmlzSW50ZXJsZWF2ZWRCdWZmZXJBdHRyaWJ1dGUpCiAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKCJUSFJFRS5CdWZmZXJHZW9tZXRyeVV0aWxzOiBtZXJnZUF0dHJpYnV0ZSgpIOWksei0peOAguS4jeaUr+aMgSBJbnRlcmxlYXZlZEJ1ZmZlckF0dHJpYnV0ZXPjgIIiKSwgbnVsbDsKICAgIGlmICh1ID09PSB2b2lkIDAgJiYgKHUgPSBvLmFycmF5LmNvbnN0cnVjdG9yKSwgdSAhPT0gby5hcnJheS5jb25zdHJ1Y3RvcikKICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoCiAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlQXR0cmlidXRlKCkg5aSx6LSl44CC5omA5pyJ5Yy56YWN5bGe5oCn55qEIEJ1ZmZlckF0dHJpYnV0ZS5hcnJheSDlv4XpobvmmK/nm7jlkIznmoTmlbDnu4TnsbvlnovjgIIiCiAgICAgICksIG51bGw7CiAgICBpZiAoaSA9PT0gdm9pZCAwICYmIChpID0gby5pdGVtU2l6ZSksIGkgIT09IG8uaXRlbVNpemUpCiAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKCJUSFJFRS5CdWZmZXJHZW9tZXRyeVV0aWxzOiBtZXJnZUF0dHJpYnV0ZSgpIOWksei0peOAguaJgOacieWMuemFjeWxnuaAp+eahCBCdWZmZXJBdHRyaWJ1dGUuaXRlbVNpemUg5b+F6aG75LiA6Ie044CCIiksIG51bGw7CiAgICBpZiAoYyA9PT0gdm9pZCAwICYmIChjID0gby5ub3JtYWxpemVkKSwgYyAhPT0gby5ub3JtYWxpemVkKQogICAgICByZXR1cm4gY29uc29sZS5lcnJvcigiVEhSRUUuQnVmZmVyR2VvbWV0cnlVdGlsczogbWVyZ2VBdHRyaWJ1dGUoKSDlpLHotKXjgILmiYDmnInljLnphY3lsZ7mgKfnmoQgQnVmZmVyQXR0cmlidXRlLm5vcm1hbGl6ZWQg5b+F6aG75LiA6Ie044CCIiksIG51bGw7CiAgICBoICs9IG8uYXJyYXkubGVuZ3RoOwogIH0KICBjb25zdCBkID0gbmV3IHUoaCk7CiAgbGV0IGwgPSAwOwogIGZvciAobGV0IGYgPSAwOyBmIDwgci5sZW5ndGg7ICsrZikKICAgIGQuc2V0KHJbZl0uYXJyYXksIGwpLCBsICs9IHJbZl0uYXJyYXkubGVuZ3RoOwogIHJldHVybiB7IGFycmF5OiBkLCBpdGVtU2l6ZTogaSwgbm9ybWFsaXplZDogYyB9Owp9CnNlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsICh7IGRhdGE6IHIgfSkgPT4gewogIGNvbnN0IGkgPSBHKHIsICEhW10pOwogIHBvc3RNZXNzYWdlKGkpOwp9KTsK",Fi=typeof window<"u"&&window.Blob&&new Blob([atob(Ko)],{type:"text/javascript;charset=utf-8"});function nc(){let o;try{if(o=Fi&&(window.URL||window.webkitURL).createObjectURL(Fi),!o)throw"";return new Worker(o)}catch{return new Worker("data:application/javascript;base64,"+Ko,{type:"module"})}finally{o&&(window.URL||window.webkitURL).revokeObjectURL(o)}}const Ui={baseConfig:{transparent:0,clickHighlight:!1},cube:{show:!0,size:160},utilsMenu:{show:!0,options:{review:{name:"重置视角",icon:"review"},tree:{name:"模型树",icon:"tree",active:!0,config:{tabs:["floor","category","model"]},cardConfig:{title:"模型树",size:{width:"280px",height:"550px"},position:{left:"20px",top:"20px"},z:10}},roam:{name:"漫游",icon:"roam",children:{fly:{name:"飞行模式",icon:"fly",active:!0,conflictKey:["local","global","measure","comInfo","person","tree"],cardConfig:{title:"操作说明",size:{width:"280px"},position:{right:"20px",bottom:"300px"}}},person:{name:"第一人称",icon:"person",active:!0,conflictKey:["local","global","measure","comInfo","fly","tree"],cardConfig:{title:"操作说明",size:{width:"280px"},position:{right:"20px",bottom:"300px"}}}}},screenshot:{name:"截图",icon:"screenshot",config:{download:!0}},cutting:{name:"剖切",icon:"cuttingGlobal",children:{global:{name:"全局剖切",icon:"cuttingGlobal",active:!0,conflictKey:["local","person","fly","measure","comInfo"],cardConfig:{title:"局部剖切",size:{width:"320px"},position:{left:"50%",bottom:"120px"}}},local:{name:"局部剖切",icon:"cuttingLocal",active:!0,conflictKey:["global","person","fly","measure","comInfo"],cardConfig:{title:"局部剖切",size:{width:"320px"},position:{left:"50%",bottom:"120px"}}}}},measure:{name:"测量",icon:"measure",active:!0,conflictKey:["local","global","person","fly","comInfo"],cardConfig:{title:"测量",size:{width:"280px"},position:{right:"20px",bottom:"90px"}}},comInfo:{name:"构件信息 ",icon:"comInfo",active:!0,conflictKey:["local","global","person","fly","measure"],cardConfig:{title:"构件信息",size:{width:"300px"},position:{right:"20px",bottom:"230px"}}},fullScreen:{name:"全屏",icon:"fullScreen"},baseInfo:{name:"基础信息",icon:"baseInfo",active:!0,cardConfig:{title:"基础信息",size:{width:"280px"},position:{right:"20px",bottom:"90px"}}},config:{name:"设置",icon:"config",active:!0,cardConfig:{title:"设置",size:{width:"280px"},position:{right:"20px",bottom:"90px"}}}}},rayCaster:{type:"click"},maximumNumberOfThreads:4};class jn{constructor(e,i){L(this,"allMesh");L(this,"workerPool");L(this,"clock");L(this,"time",0);L(this,"animationFrameId");L(this,"person");L(this,"cubeCamera");L(this,"cubeScene");L(this,"tempFileUrls",[]);L(this,"lightManager");L(this,"highLightMeshManager");L(this,"rayCasterManager");L(this,"perspectiveCamera");L(this,"orthographicCamera");L(this,"floorGroup",new f.Group);L(this,"orbitControl");L(this,"flyControl");L(this,"firstControl");L(this,"renderer");L(this,"camera");L(this,"scene");L(this,"element");L(this,"objs");L(this,"objects");L(this,"resizeFlag");L(this,"containerGroup",new f.Group);L(this,"controlType");L(this,"flag");L(this,"stopRender");L(this,"options");L(this,"initOptions");L(this,"utilsMenuRef");L(this,"resizeObserver");L(this,"resizeRafId",0);L(this,"lastResize",{width:0,height:0});this.options=i?Ys(Ui,i):Ui,this.initOptions=Zs(this.options),this.element=e,this.element.id="viewer-3d",this.element.parentElement.style.position="relative",this.element.style.width||(this.element.style.width="100%"),this.element.style.height||(this.element.style.height="100%"),this.element.style.display="block";const r=this.element.clientWidth,a=this.element.clientHeight;this.scene=new f.Scene,this.highLightMeshManager=new Wa(this),this.perspectiveCamera=new f.PerspectiveCamera(65,r/a,.1,1e4),this.orthographicCamera=new f.OrthographicCamera(r/-2,r/2,a/2,a/-2,.1,5e3),this.allMesh={},this.objs={},this.objects={},this.resizeFlag=!0,this.clock=new f.Clock,this.stopRender=!1,this.workerPool=new Wo(nc,this.options.maximumNumberOfThreads),this.init(this.options),this.controlType="orbit",this.flag=!1,this.resizeObserver=new ResizeObserver(l=>{var h;const c=(h=l[0])==null?void 0:h.contentRect;c&&this.scheduleResize(c.width,c.height)}),this.resizeObserver.observe(e.parentElement),this.element.addEventListener("beforeunload",()=>{this.destroy()})}setOptions(e,i){this.options=Ys(this.options,e),this.init(this.options),i()}init(e){const{baseConfig:i,light:r,cube:a}=e,l=this.element.clientWidth,c=this.element.clientHeight;this.camera=this.perspectiveCamera,this.camera.position.set(-10,10,10),this.renderer=new f.WebGLRenderer({canvas:this.element,antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(l,c,!1),i.clearColor&&this.renderer.setClearColor(i.clearColor),i.transparent&&this.renderer.setClearAlpha(i.transparent),i.background&&(this.scene.background=i.background),this.renderer.outputEncoding=f.sRGBEncoding,this.renderer.autoClear=!1,this.scene.add(this.containerGroup,this.camera,this.floorGroup),this.containerGroup.addEventListener("clear",()=>{this.containerGroup.children.forEach(p=>{const u=p.geometry,d=p.material;u.dispose&&u.dispose(),d.dispose&&d.dispose()}),this.containerGroup.clear()}),this.addPerson(a.show?this.initCube(a.size||200):void 0),this.lightManager=new ja(this),this.lightManager.addAmbientLight((r==null?void 0:r.ambient)||{color:16777215,intensity:.4}),this.lightManager.addDirectionalLight((r==null?void 0:r.direct)||{color:16777215,intensity:.9});const h=()=>{this.animationFrameId=requestAnimationFrame(h),!this.stopRender&&(this.renderScene(),Oe.update())};h(),this.element.addEventListener("resize",()=>{var d,m;const p=((d=this.element.parentElement)==null?void 0:d.clientWidth)||250,u=((m=this.element.parentElement)==null?void 0:m.clientHeight)||250;this.resizeFlag&&this.resize(p,u)})}initCube(e){this.cubeCamera=new f.OrthographicCamera(-25,25,25,-25,1,1e3),this.cubeCamera.position.z+=30,this.cubeScene=new f.Scene,this.cubeScene.add(this.cubeCamera);const i=new Fa(this.camera,this.cubeCamera,this.renderer.domElement,this.getAllObjectBox.bind(this),e);return this.cubeScene.add(i.group),i}renderScene(){const e=this.element.clientWidth,i=this.element.clientHeight,r=this.clock.getDelta();switch(this.controlType){case"orbit":this.orbitControl&&this.orbitControl.update();break;case"fly":this.flyControl&&this.flyControl.update(r);break;case"person":this.firstControl&&this.firstControl.update(r);break}this.renderer.setViewport(0,0,e,i),this.renderer.render(this.scene,this.camera);const a=this.options.cube.size||200;this.cubeCamera&&(this.renderer.setViewport(e-a,i-a,a,a),this.renderer.render(this.cubeScene,this.cubeCamera))}addPerson(e){const i=this;i.person=new f.Object3D,i.initControl(),e&&e.setControl(i.orbitControl)}setControl(e,i){if(this.controlType=e,e=="orbit")this.orbitControl.enabled=!0,this.firstControl.enabled=!1,this.flyControl.enabled=!1,this.person.visible=!1,i.translate&&(this.orbitControl.panSpeed=i.translate/50),i.scale&&(this.orbitControl.zoomSpeed=i.scale/50);else if(e=="fly")this.orbitControl.enabled=!1,this.firstControl.enabled=!1,this.flyControl.enabled=!0,this.person.visible=!1,i.moveSpeed&&(this.flyControl.movementSpeed=i.moveSpeed/1),i.rotateSpeed&&(this.flyControl.rollSpeed=i.rotateSpeed/50*2);else if(e=="person"){if(!this.firstControl.enabled){const a=this.getAllObjectBox().getCenter(new f.Vector3),l=this.camera.position;a.sub(l).negate().normalize(),this.firstControl.lookAt(a.x,a.y,a.z)}this.orbitControl.enabled=!1,this.firstControl.enabled=!0,this.flyControl.enabled=!1,this.person.visible=!0,i.moveSpeed&&(this.firstControl.movementSpeed=i.moveSpeed/2),i.rotateSpeed&&(this.firstControl.lookSpeed=i.rotateSpeed/50*.5),this.person.userData.time==0&&this.person.position.copy(this.camera.position),this.person.userData.time++}else e=="exist"&&(this.controlType="orbit",this.perspectiveCamera.fov=65,this.perspectiveCamera.updateProjectionMatrix(),this.orbitControl.enabled=!0,this.firstControl.enabled=!1,this.flyControl.enabled=!1,this.person.visible=!1)}screenShoot(e,i){return this.renderScene(),this.element.toDataURL(e||"image/png",i||1)}lookingDownEntity(e,i){this.toggleCamera("orthogonal"),this.orbitControl.enableRotate=!1,this.floorGroup.clear();const r=new f.Box3;e.forEach(u=>{this.allMesh[u]&&(this.allMesh[u].visible=!0,this.floorGroup.add(this.allMesh[u]))});const a=new f.Vector3;r.expandByObject(this.floorGroup),r.getSize(a),a.multiplyScalar(.9);const l=r.getCenter(new f.Vector3),c=r.max.distanceTo(r.min)/1.5,h=new f.Vector3(l.x,l.y+c,l.z);let p;a.x>a.y?p=this.orthographicCamera.right/a.x:p=this.orthographicCamera.top/a.y,this.orthographicCamera.zoom=p,this.orthographicCamera.updateProjectionMatrix(),this.animate(h,l,i,1)}initControl(){this.orbitControl=new Oa.OrbitControls(this.camera,this.element),this.orbitControl.mouseButtons={LEFT:f.MOUSE.ROTATE,MIDDLE:f.MOUSE.PAN,RIGHT:null},this.flyControl=new Ws(this.camera,this.element),this.flyControl.autoForward=!1,this.flyControl.movementSpeed=5,this.flyControl.rollSpeed=.4,this.flyControl.dragToLook=!0,this.flyControl.enabled=!1,this.firstControl=new Xs(this.person,this.camera,this.element),this.firstControl.enabled=!1;const e=this,i=function(r){const a=r.target.target,l=e.camera.position.clone();l.sub(a).normalize(),l.multiplyScalar(60),e.cubeCamera.position.copy(l),e.cubeCamera.quaternion.copy(e.camera.quaternion)};this.cubeCamera&&i({target:{target:new f.Vector3}}),this.cubeCamera&&this.orbitControl.addEventListener("change",i)}addObject(e){this.objs[e.uuid]=e,this.scene.add(e)}addRays(e){this.objs[e.uuid]=e,this.containerGroup.add(e)}scheduleResize(e,i){this.resizeRafId||(this.resizeRafId=requestAnimationFrame(()=>{this.resizeRafId=0,this.resize(e,i)}))}resize(e,i){!e||!i||(this.flag&&(e/=2),!(Math.abs(e-this.lastResize.width)<.5&&Math.abs(i-this.lastResize.height)<.5)&&(this.lastResize={width:e,height:i},this.perspectiveCamera.aspect=e/i,this.orthographicCamera.left=e/-2,this.orthographicCamera.right=e/2,this.orthographicCamera.top=i/2,this.orthographicCamera.bottom=i/-2,this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.renderer.setSize(e,i,!1)))}_createGroup(){const e=new f.Group;return e.name="",e.userData.name="",e.userData.ModelId="",e.userData.uuids=[],this.addObject(e),e.addEventListener("destory",()=>{var a;const i=e.uuid;e.userData.uuids.forEach(l=>{const c=this.allMesh[l];c.geometry.dispose(),c.material.dispose&&c.material.dispose(),delete this.allMesh[l]}),e.children.forEach(l=>{l.geometry.dispose(),l.material.dispose&&l.material.dispose()}),e.clear(),(a=e.parent)==null||a.remove(e),delete this.objs[i]}),e}create2DLabel(e,i,r){const a=document.createElement("div");a.style.pointerEvents="auto",a.style.position="relative",a.innerHTML=e,a.onclick=()=>{r&&r()};const l=new Po.CSS2DObject(a);return l.position.set(i.x,i.y,i.z),this.addObject(l),l}async loadZipModel(e,i,r,a){return this.destroy(!0),fetch(e).then(l=>l.arrayBuffer()).then(async l=>{const c=new Da,h=await c.loadAsync(l),p=[],u=[];let d="";const m={};try{for(const g in h.files)switch(g.substring(g.lastIndexOf(".")+1,g.length).toLowerCase()){case"glb":p.push(new Promise(b=>{var C;(C=c.file(g))==null||C.async("arraybuffer").then(T=>{const A=new Blob([T]),O=URL.createObjectURL(A);u.push(O),this.tempFileUrls.push(O),b(T)})}));break;case"jpg":case"png":case"jpeg":case"gif":case"bmp":p.push(new Promise(b=>{var C;(C=c.file(g))==null||C.async("arraybuffer").then(T=>{const A=new Blob([T]),O=URL.createObjectURL(A);m[g]=O,this.tempFileUrls.push(O),b(T)})}));break;case"json":p.push(new Promise(b=>{var C;(C=c.file(g))==null||C.async("arraybuffer").then(T=>{const A=new Blob([T]);d=URL.createObjectURL(A),this.tempFileUrls.push(d),b(T)})}));break;default:break}}catch(g){console.log(g)}await Promise.all(p);let v=this.loadModel(u,new Set(Object.keys(m)).size>0?m:null,g=>this.loadModelCallBack(g,d,x=>{r(x)}));return v.userData.file_id=i,new Promise(g=>{g(v)})}).catch(l=>(a(l),null))}async loadMultipleGlbModel(e,i,r,a){this.destroy(!0);try{const l=[];let c="";const h={};for(let u=0;u<e.length;u++){const d=e[u];switch(d.substring(d.lastIndexOf(".")+1,d.length).toLowerCase()){case"glb":l.push(d);break;case"jpg":case"png":case"jpeg":case"gif":case"bmp":h[d]=d;break;case"json":c=d;break;default:break}}let p=this.loadModel(l,new Set(Object.keys(h)).size>0?h:null,u=>this.loadModelCallBack(u,c,d=>{r(d)}));return p.userData.file_id=i,new Promise(u=>{u(p)})}catch(l){return a(l),null}}loadModel(e,i,r){const a=this._createGroup(),l=[];let c=performance.now(),h=performance.now();console.log("开始加载模型");let p;return e.forEach(u=>{l.push(new Promise(d=>{this._loadGlbByUrl(u,i,a,()=>{p=performance.now(),console.log(`执行时长: ${(p-c)/1e3} 毫秒`),c=performance.now(),d(u)})}))}),Promise.all(l).then(()=>{let u=performance.now();console.log("加载模型结束,",`执行时长: ${(u-h)/1e3} 毫秒`),this.resetView(10),r(a)}),a}loadModelCallBack(e,i,r){var a,l,c,h,p,u,d;this.utilsMenuRef&&((a=this.utilsMenuRef)==null||a.batchDeselectAll(),(l=this.utilsMenuRef)==null||l.destroy(),this.utilsMenuRef=void 0),this.options=Zs(this.initOptions),this.rayCasterManager=new Ya(this,(c=this.options)==null?void 0:c.rayCaster),this.options.utilsMenu.show&&(((p=(h=this.options.utilsMenu.options)==null?void 0:h.tree)==null?void 0:p.show)!==!1&&(i?this.options.utilsMenu.options.tree.config={jsonFileUrl:i,model:e,hiddenMeshGuids:(u=this.options)==null?void 0:u.hiddenMeshGuids,...this.options.utilsMenu.options.tree.config}:(d=this.options.utilsMenu.options)==null||delete d.tree),this.utilsMenuRef=St(sc,{viewer:this,options:this.options.utilsMenu.options},this.element.parentElement)),this.hiddenObjectPartsByHiddenMeshGuids(),r&&r(this.utilsMenuRef)}_loadGlbByUrl(e,i,r,a){const l=new Fo;l.setImageJson(i),l.load(e,c=>{const h=function(g){var x,b;if(g.userData.InfoFileName){let C=((b=(x=g.userData)==null?void 0:x.ModelTitle)==null?void 0:b.split(".").shift())||"模型";return r.userData.name=r.name=C,r.userData.ModelId=g.userData.ModelId,!0}else for(let C=0;C<g.children.length;C++){const T=g.children[C];if(h(T))return!0}return!1};!r.name&&h(c.scene);const p=this,u={};c.scene.traverse(g=>{var x,b;if(g instanceof f.Mesh){g.updateMatrix();const C=new f.BufferGeometry().copy(g.geometry);C.applyMatrix4(g.matrix),C.attributes.normal||C.computeVertexNormals(),p.allMesh[g.uuid]=g,(b=(x=r==null?void 0:r.userData)==null?void 0:x.uuids)==null||b.push(g.uuid),C.userData={mesh:g.uuid,guid:g.userData.ExId};const T=g.material.uuid,A=Object.getOwnPropertyNames(C.attributes).length;!u[T]&&(u[T]={material:g.material,geos:[],length:A}),A==u[T].length&&u[T].geos.push(C),g.geometry.dispose(),g.visible=!1}else if(g instanceof f.Line){const C=new f.BufferGeometry().copy(g.geometry);C.applyMatrix4(g.matrix),p.allMesh[g.uuid]=g,r.userData.uuids.push(g.uuid),C.userData={mesh:g.uuid,guid:g.userData.ExId};const T=g.material.uuid;!u[T]&&(u[T]={material:g.material,geos:[],type:"lineSegments"}),u[T].geos.push(C),g.geometry.dispose(),g.visible=!1}});const d=[];for(const g in u)if(u[g].geos.length<=1e4)d.push(u[g]);else{const x=u[g].geos.length,b=Math.ceil(x/1e4);for(let C=0;C<b;C++){const T=C*1e4;let A=(C+1)*1e4;A>x&&(A=x);const O=u[g].geos.slice(T,A);d.push({geos:O,material:u[g].material})}}if(!d.length){a();return}v(0),console.log("开始合并几何体");function v(g){d[g]?p.mergeBufferGeometries(d[g].geos,x=>{if(x){let b;d[g].type=="lineSegments"?b=new f.LineSegments(x,d[g].material):(b=new f.Mesh(x,d[g].material),p.setControlRays(b)),r.add(b),p.objects[b.uuid]=b}g++,v(g)}):a()}})}setControlRays(e){e instanceof f.Mesh?this.firstControl.meshs.push(e):this.firstControl.meshs.push(...e)}resetView(e=200){const i=new f.Box3;for(const h in this.objs)this.objs[h].visible&&i.expandByObject(this.objs[h]);const r=i.min.distanceTo(i.max);if(!r||r==0||r==1/0)return;const a=new f.Vector3,l=new f.Vector3;i.getCenter(a),l.set(a.x-r/2,a.y+r/2,a.z+r/2);const c=()=>{this.camera.updateMatrix(),this.renderScene()};new Oe.Tween(this.camera.position).to(l,e).onUpdate(()=>{c()}).start(),new Oe.Tween(this.camera.up).to({x:0,y:1,z:0},e).onUpdate(()=>{c()}).start(),this.controlType=="orbit"&&new Oe.Tween(this.orbitControl.target).to(a,e).onUpdate(()=>{c()}).start()}setColorGroup(e,i){const r=[];e.forEach(a=>{for(const l in this.objs){let c=!1;if(this.objs[l].children.forEach(p=>{const u=p.geometry.userData[a];u!=null&&u.length&&u.forEach(d=>{const m=d.uuid;if(this.allMesh[m]){const v=new f.BufferGeometry().copy(this.allMesh[m].geometry);v.applyMatrix4(this.allMesh[m].matrix),v.deleteAttribute("normal"),v.deleteAttribute("uv"),r.push(v),c=!0;return}})}),c)break}}),!(r.length<1)&&this.mergeBufferGeometries(r,a=>{const l=new f.Mesh(a,new f.MeshBasicMaterial({color:i,transparent:!0,opacity:.9}));this.containerGroup.add(l),l.addEventListener("destory",()=>{var c;(c=l.parent)==null||c.remove(l),l.geometry.dispose(),l.material.dispose()})})}hiddenObjectPartsByHiddenMeshGuids(){var e,i;if((e=this.options)!=null&&e.hiddenMeshGuids){const r={};(i=this.options)==null||i.hiddenMeshGuids.forEach(a=>{for(const l in this.objects){const c=this.objects[l];this.setObjectPartsToBeVisibleAndHiddenByGuid(c.geometry,a,!1)&&(r[l]=c)}});for(const a in r){const l=r[a].geometry,c=r[a].children[0];c instanceof f.LineSegments&&(c.geometry.dispose(),c.geometry=new f.EdgesGeometry(l))}}}setObjectPartsToBeVisibleAndHiddenByGuid(e,i,r){let a=!1;const l=e.attributes.position;return e.userData[i]&&(e.userData[i].forEach(c=>{const h=c.geo_start,p=c.geo_end;if(r){if(c.position)for(let u=h;u<p;u++){const d=(u-h)*3;l.setXYZ(u,c.position[d],c.position[d+1],c.position[d+2])}}else{!c.position&&(c.position=[]);for(let u=h;u<p;u++)c.position.push(l.getX(u),l.getY(u),l.getZ(u)),l.setXYZ(u,0,0,0)}}),a=!0,l.needsUpdate=!0),a}animate(e,i,r,a){a=a||e.distanceTo(this.camera.position)*5,a>500&&(a=500),r=r||new f.Vector3(0,1,0);const l=new Oe.Tween(this.camera.position).to(e,a).easing(Oe.Easing.Exponential.Out).onUpdate(()=>{p()}),c=new Oe.Tween(this.camera.up).to(r,a).easing(Oe.Easing.Exponential.Out).onUpdate(()=>{p()}),h=new Oe.Tween(this.orbitControl.target).to(i,a).easing(Oe.Easing.Exponential.Out).onUpdate(()=>{p()}),p=()=>{this.camera.updateProjectionMatrix(),this.camera.updateMatrix()};l.start(),c.start(),h.start()}toggleCamera(e){const i=new f.Vector3,r=new f.Box3;let a=1;for(const l in this.objs){const c=this.objs[l];r.expandByObject(c)}r.getSize(i),i.x>i.y?a=(-this.orthographicCamera.left+this.orthographicCamera.right)/i.x:a=(this.orthographicCamera.top-this.orthographicCamera.bottom)/i.y,e=="orthogonal"&&this.camera instanceof f.PerspectiveCamera?(this.orthographicCamera.position.copy(this.perspectiveCamera.position),this.camera=this.orthographicCamera):e=="perspective"&&this.camera instanceof f.OrthographicCamera&&(this.perspectiveCamera.position.copy(this.orthographicCamera.position),this.camera=this.perspectiveCamera),e=="orthogonal"&&(this.camera.zoom=a),e=="perspective"&&(this.camera.zoom=1),this.orbitControl.object=this.camera,this.orbitControl.update(),this.camera.updateProjectionMatrix()}getAllObjectBox(){const e=new f.Box3;for(const i in this.objs)e.expandByObject(this.objs[i]);return e}setCameraAndControl(e,i){this.perspectiveCamera&&this.orbitControl&&this.controlType=="orbit"&&(this.perspectiveCamera.position.copy(e),this.orbitControl.target.copy(i),this.perspectiveCamera.updateMatrix(),this.perspectiveCamera.updateProjectionMatrix(),this.orbitControl.update())}mergeBufferGeometries(e,i){if(e.length<1){i&&i(void 0);return}e&&this.workerPool.run(e).then(r=>{const{data:a}=r;if(!a){i&&i(void 0);return}const l=new f.BufferGeometry;for(const c in a.attributes){const h=a.attributes[c],p=new Float32Array(h.array);l.setAttribute(c,new f.BufferAttribute(p,h.itemSize,h.normalized))}l.groups=a.groups,l.userData=a.userData,a.index&&l.setIndex(new f.BufferAttribute(a.index,1,!1)),l.computeBoundingSphere(),i&&i(l)}).catch(r=>{console.error("当前模型部分顶点有问题,合并失败,请检查建模!"),i&&i(void 0)})}focusOnTheMesh(e){let i=45,r=window.innerWidth/window.innerHeight,a=1.2;const l=new f.Box3().setFromObject(e),c=new f.Vector3;l.getSize(c);const h=new f.Vector3;l.getCenter(h);const p=i*Math.PI/180;let u;r>=1?u=a*c.y/(2*Math.tan(p/2)):u=a*c.x/(2*Math.tan(p/2)*r);const d=a*c.x/(2*Math.tan(p*r/2)),m=a*c.y/(2*Math.tan(p/2));u=Math.max(u,d,m);const v=h.clone();v.z+=u*2,v.y+=u*.8,v.x-=u*.6,this.animate(v,h,new f.Vector3(0,1,0))}setAllMaterialsTransparent(e){for(const i in this.objs)this.objs[i].traverse(r=>{r instanceof f.Mesh&&(r.material.transparent=!0,r.material.opacity=e,r.material.needsUpdate=!0)})}destroy(e=!1){var r;const i=["map","aoMap","emissiveMap","glossinessMap","metalnessMap","normalMap","roughnessMap","specularMap"];(r=this.resizeObserver)==null||r.disconnect(),this.resizeObserver=void 0,this.resizeRafId&&(cancelAnimationFrame(this.resizeRafId),this.resizeRafId=0),this.scene.traverse(a=>{a!=null&&a.isMesh&&(a.userData={},a.geometry&&a.geometry.dispose(),(Array.isArray(a.material)?a.material:[a.material]).forEach(l=>{i.forEach(c=>{l[c]&&l[c].dispose()})}))}),f.Cache.clear(),this.tempFileUrls.forEach(a=>URL.revokeObjectURL(a)),e||(cancelAnimationFrame(this.animationFrameId),this.renderer.dispose(),this.renderer.forceContextLoss(),this.scene.clear(),this.scene=null,this.workerPool.terminateAll()),this.allMesh={},this.objs={},this.objects={}}}const ic={class:"viewer-box"},oc=y.defineComponent({__name:"index",props:{url:{},options:{},loadZipModelCallback:{},loadCallback:{},errorCallback:{}},setup(o,{expose:e}){const i=o,r=y.ref();let a,l,c;async function h(){c&&(c==null||c.dispatchEvent({type:"destory"}),c=void 0),r.value&&(c=await(Array.isArray(i.url)?a.loadMultipleGlbModel(i.url,"44",u=>{l=u,i.loadZipModelCallback&&i.loadZipModelCallback(u)},u=>{console.log(u),i.errorCallback&&i.errorCallback(u)}):a.loadZipModel(i.url,"44",u=>{l=u,i.loadZipModelCallback&&i.loadZipModelCallback(u)},u=>{console.log(u),i.errorCallback&&i.errorCallback(u)})))}y.onMounted(()=>{a=new jn(r.value,i.options),h(),y.watch(()=>i.url,()=>{h()})}),y.onBeforeUnmount(()=>{a==null||a.destroy()});const p=y.computed(()=>a);return e({viewer:p,menuUtilsRef:l,model:c,loadModel:h}),(u,d)=>(y.openBlock(),y.createElementBlock("div",ic,[y.createElementVNode("canvas",{id:"viewer-3d",ref_key:"viewerDom",ref:r},null,512)]))}});const rc=Ue(oc,[["__scopeId","data-v-0f333327"]]);class pe{constructor(e,i,r,a,l){this.layerName=e??null,this.blockName=i??null,this.geometryType=r??null,this.color=a,this.lineType=l??null}Compare(e){let i=mt(this.layerName,e.layerName);return i!==0||(i=mt(this.blockName,e.blockName),i!==0)||(i=mt(this.geometryType,e.geometryType),i!==0)||(i=mt(this.color,e.color),i!==0)?i:mt(this.lineType,e.lineType)}IsIndexed(){return this.geometryType===pe.GeometryType.INDEXED_LINES||this.geometryType===pe.GeometryType.INDEXED_TRIANGLES}IsInstanced(){return this.geometryType===pe.GeometryType.BLOCK_INSTANCE||this.geometryType===pe.GeometryType.POINT_INSTANCE}}pe.GeometryType=Object.freeze({POINTS:0,LINES:1,INDEXED_LINES:2,TRIANGLES:3,INDEXED_TRIANGLES:4,BLOCK_INSTANCE:5,POINT_INSTANCE:6});function mt(o,e){return o===null?e===null?0:-1:e===null?1:o<e?-1:o>e?1:0}function es(o){this._pointer=0,this._data=o,this._eof=!1}es.prototype.next=function(){let o;if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);return o={code:parseInt(this._data[this._pointer])},this._pointer++,o.value=qo(o.code,this._data[this._pointer]),this._pointer++,o.code===0&&o.value==="EOF"&&(this._eof=!0),this.lastReadGroup=o,o};es.prototype.peek=function(){if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let o={code:parseInt(this._data[this._pointer])};return o.value=qo(o.code,this._data[this._pointer+1]),o};es.prototype.rewind=function(o){o=o||1,this._pointer=this._pointer-o*2};es.prototype.hasNext=function(){return!(this._eof||this._pointer>this._data.length-2)};es.prototype.isEOF=function(){return this._eof};function qo(o,e){return o<=9?e:o>=10&&o<=59?parseFloat(e.trim()):o>=60&&o<=99?parseInt(e.trim()):o>=100&&o<=109?e:o>=110&&o<=149?parseFloat(e.trim()):o>=160&&o<=179?parseInt(e.trim()):o>=210&&o<=239?parseFloat(e.trim()):o>=270&&o<=289?parseInt(e.trim()):o>=290&&o<=299?ac(e.trim()):o>=300&&o<=369?e:o>=370&&o<=389?parseInt(e.trim()):o>=390&&o<=399?e:o>=400&&o<=409?parseInt(e.trim()):o>=410&&o<=419?e:o>=420&&o<=429?parseInt(e.trim()):o>=430&&o<=439?e:o>=440&&o<=459?parseInt(e.trim()):o>=460&&o<=469?parseFloat(e.trim()):o>=470&&o<=481||o===999||o>=1e3&&o<=1009?e:o>=1010&&o<=1059?parseFloat(e.trim()):o>=1060&&o<=1071?parseInt(e.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:o,value:e}),e)}function ac(o){if(o==="0")return!1;if(o==="1")return!0;throw TypeError("String '"+o+"' cannot be cast to Boolean type")}const Qo=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function lc(o){return Qo[o]}function ge(o){let e={};o.rewind();let i=o.next(),r=i.code;if(e.x=i.value,r+=10,i=o.next(),i.code!==r)throw new Error("Expected code for point value to be "+r+" but got "+i.code+".");return e.y=i.value,r+=10,i=o.next(),i.code!==r?(o.rewind(),e):(e.z=i.value,e)}function Jo(o){o.rewind();let e=o.next();if(e.code!==101)throw new Error("Bad call for skipEmbeddedObject()");do e=o.next();while(e.code!==0);o.rewind()}function Be(o,e){switch(e.code){case 0:o.type=e.value;break;case 5:o.handle=e.value;break;case 6:o.lineType=e.value;break;case 8:o.layer=e.value;break;case 48:o.lineTypeScale=e.value;break;case 60:o.visible=e.value===0;break;case 62:o.colorIndex=e.value,o.color=lc(Math.abs(e.value));break;case 67:o.inPaperSpace=e.value!==0;break;case 100:break;case 330:o.ownerHandle=e.value;break;case 347:o.materialObjectHandle=e.value;break;case 370:o.lineweight=e.value;break;case 420:o.color=e.value;break;case 1e3:o.extendedData=o.extendedData||{},o.extendedData.customStrings=o.extendedData.customStrings||[],o.extendedData.customStrings.push(e.value);break;case 1001:o.extendedData=o.extendedData||{},o.extendedData.applicationName=e.value;break;default:return!1}return!0}function Wn(){}Wn.ForEntityName="3DFACE";Wn.prototype.parseEntity=function(o,e){let i={type:e.value,vertices:[]};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 70:i.shape=(e.value&1)===1,i.hasContinuousLinetypePattern=(e.value&128)===128;break;case 10:i.vertices=cc(o,e),e=o.lastReadGroup;break;default:Be(i,e);break}e=o.next()}return i};function cc(o,e){let i=[],r,a=!1,l=!1,c=4;for(r=0;r<=c;r++){let h={};for(;e!=="EOF"&&!(e.code===0||l);){switch(e.code){case 10:case 11:case 12:case 13:if(a){l=!0;continue}h.x=e.value,a=!0;break;case 20:case 21:case 22:case 23:h.y=e.value;break;case 30:case 31:case 32:case 33:h.z=e.value;break;default:return i}e=o.next()}i.push(h),a=!1,l=!1}return o.rewind(),i}function Xn(){}Xn.ForEntityName="ARC";Xn.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.center=ge(o);break;case 40:i.radius=e.value;break;case 50:i.startAngle=Math.PI/180*e.value;break;case 51:i.endAngle=Math.PI/180*e.value,i.angleLength=i.endAngle-i.startAngle;break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i};function Zn(){}Zn.ForEntityName="ATTDEF";Zn.prototype.parseEntity=function(o,e){let i={type:e.value,scale:1,textStyle:"STANDARD"};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 1:i.text=e.value;break;case 2:i.tag=e.value;break;case 3:i.prompt=e.value;break;case 7:i.textStyle=e.value;break;case 10:i.startPoint=ge(o);break;case 11:i.endPoint=ge(o);break;case 39:i.thickness=e.value;break;case 40:i.textHeight=e.value;break;case 41:i.scale=e.value;break;case 50:i.rotation=e.value;break;case 51:i.obliqueAngle=e.value;break;case 70:i.invisible=!!(e.value&1),i.constant=!!(e.value&2),i.verificationRequired=!!(e.value&4),i.preset=!!(e.value&8);break;case 71:i.backwards=!!(e.value&2),i.mirrored=!!(e.value&4);break;case 72:i.horizontalJustification=e.value;break;case 73:i.fieldLength=e.value;break;case 74:i.verticalJustification=e.value;break;case 100:break;case 101:Jo(o);break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i};function Yn(){}Yn.ForEntityName="CIRCLE";Yn.prototype.parseEntity=function(o,e){let i,r;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.center=ge(o);break;case 40:i.radius=e.value;break;case 50:i.startAngle=Math.PI/180*e.value;break;case 51:r=Math.PI/180*e.value,r<i.startAngle?i.angleLength=r+2*Math.PI-i.startAngle:i.angleLength=r-i.startAngle,i.endAngle=r;break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i};function Kn(){}Kn.ForEntityName="DIMENSION";Kn.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 2:i.block=e.value;break;case 10:i.anchorPoint=ge(o);break;case 11:i.middleOfText=ge(o);break;case 12:i.insertionPoint=ge(o);break;case 13:i.linearOrAngularPoint1=ge(o);break;case 14:i.linearOrAngularPoint2=ge(o);break;case 15:i.diameterOrRadiusPoint=ge(o);break;case 16:i.arcPoint=ge(o);break;case 70:i.dimensionType=e.value;break;case 71:i.attachmentPoint=e.value;break;case 42:i.actualMeasurement=e.value;break;case 1:i.text=e.value;break;case 50:i.angle=e.value;break;default:Be(i,e);break}e=o.next()}return i};function qn(){}qn.ForEntityName="ELLIPSE";qn.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.center=ge(o);break;case 11:i.majorAxisEndPoint=ge(o);break;case 40:i.axisRatio=e.value;break;case 41:i.startAngle=e.value;break;case 42:i.endAngle=e.value;break;case 2:i.name=e.value;break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i};function Qn(){}Qn.ForEntityName="INSERT";Qn.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 2:i.name=e.value;break;case 41:i.xScale=e.value;break;case 42:i.yScale=e.value;break;case 43:i.zScale=e.value;break;case 10:i.position=ge(o);break;case 50:i.rotation=e.value;break;case 70:i.columnCount=e.value;break;case 71:i.rowCount=e.value;break;case 44:i.columnSpacing=e.value;break;case 45:i.rowSpacing=e.value;break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i};function Jn(){}Jn.ForEntityName="LINE";Jn.prototype.parseEntity=function(o,e){let i={type:e.value,vertices:[]};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.vertices.unshift(ge(o));break;case 11:i.vertices.push(ge(o));break;case 210:i.extrusionDirection=ge(o);break;case 100:break;default:Be(i,e);break}e=o.next()}return i};function $n(){}$n.ForEntityName="LWPOLYLINE";$n.prototype.parseEntity=function(o,e){let i={type:e.value,vertices:[]},r=0;for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 38:i.elevation=e.value;break;case 39:i.depth=e.value;break;case 70:i.shape=(e.value&1)===1,i.hasContinuousLinetypePattern=(e.value&128)===128;break;case 90:r=e.value;break;case 10:i.vertices=hc(r,o);break;case 43:e.value!==0&&(i.width=e.value);break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i};function hc(o,e){if(!o||o<=0)throw Error("n must be greater than 0 verticies");let i=[],r,a=!1,l=!1,c=e.lastReadGroup;for(r=0;r<o;r++){let h={};for(;c!=="EOF"&&!(c.code===0||l);){switch(c.code){case 10:if(a){l=!0;continue}h.x=c.value,a=!0;break;case 20:h.y=c.value;break;case 30:h.z=c.value;break;case 40:h.startWidth=c.value;break;case 41:h.endWidth=c.value;break;case 42:c.value!=0&&(h.bulge=c.value);break;default:return a&&i.push(h),e.rewind(),i}c=e.next()}i.push(h),a=!1,l=!1}return e.rewind(),i}function ei(){}ei.ForEntityName="MTEXT";ei.prototype.parseEntity=function(o,e){let i={type:e.value};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 3:case 1:i.text?i.text+=e.value:i.text=e.value;break;case 10:i.position=ge(o);break;case 11:i.direction=ge(o);break;case 40:i.height=e.value;break;case 41:i.width=e.value;break;case 44:i.lineSpacing=e.value;break;case 50:i.rotation=e.value;break;case 71:i.attachmentPoint=e.value;break;case 72:i.drawingDirection=e.value;break;case 101:Jo(o);break;default:Be(i,e);break}e=o.next()}return i};function ti(){}ti.ForEntityName="POINT";ti.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.position=ge(o);break;case 39:i.thickness=e.value;break;case 210:i.extrusionDirection=ge(o);break;case 100:break;default:Be(i,e);break}e=o.next()}return i};function si(){}si.ForEntityName="VERTEX";si.prototype.parseEntity=function(o,e){let i={type:e.value};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.x=e.value;break;case 20:i.y=e.value;break;case 30:i.z=e.value;break;case 40:break;case 41:break;case 42:e.value!=0&&(i.bulge=e.value);break;case 70:i.curveFittingVertex=(e.value&1)!==0,i.curveFitTangent=(e.value&2)!==0,i.splineVertex=(e.value&8)!==0,i.splineControlPoint=(e.value&16)!==0,i.threeDPolylineVertex=(e.value&32)!==0,i.threeDPolylineMesh=(e.value&64)!==0,i.polyfaceMeshVertex=(e.value&128)!==0;break;case 50:break;case 71:i.faceA=e.value;break;case 72:i.faceB=e.value;break;case 73:i.faceC=e.value;break;case 74:i.faceD=e.value;break;default:Be(i,e);break}e=o.next()}return i};function ni(){}ni.ForEntityName="POLYLINE";ni.prototype.parseEntity=function(o,e){let i={type:e.value,vertices:[]};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:break;case 20:break;case 30:break;case 39:i.thickness=e.value;break;case 40:break;case 41:break;case 70:i.shape=(e.value&1)!==0,i.includesCurveFitVertices=(e.value&2)!==0,i.includesSplineFitVertices=(e.value&4)!==0,i.is3dPolyline=(e.value&8)!==0,i.is3dPolygonMesh=(e.value&16)!==0,i.is3dPolygonMeshClosed=(e.value&32)!==0,i.isPolyfaceMesh=(e.value&64)!==0,i.hasContinuousLinetypePattern=(e.value&128)!==0;break;case 71:break;case 72:break;case 73:break;case 74:break;case 75:break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i.vertices=uc(o,e),i};function uc(o,e){let i=new si,r=[];for(;!o.isEOF();)if(e.code===0){if(e.value==="VERTEX")r.push(i.parseEntity(o,e)),e=o.lastReadGroup;else if(e.value==="SEQEND"){pc(o,e);break}}return r}function pc(o,e){let i={type:e.value};for(e=o.next();e!="EOF"&&e.code!=0;)Be(i,e),e=o.next();return i}function ii(){}ii.ForEntityName="SOLID";ii.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},i.points=[],e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.points[0]=ge(o);break;case 11:i.points[1]=ge(o);break;case 12:i.points[2]=ge(o);break;case 13:i.points[3]=ge(o);break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i};function oi(){}oi.ForEntityName="SPLINE";oi.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.controlPoints||(i.controlPoints=[]),i.controlPoints.push(ge(o));break;case 11:i.fitPoints||(i.fitPoints=[]),i.fitPoints.push(ge(o));break;case 12:i.startTangent=ge(o);break;case 13:i.endTangent=ge(o);break;case 40:i.knotValues||(i.knotValues=[]),i.knotValues.push(e.value);break;case 70:e.value&1&&(i.closed=!0),e.value&2&&(i.periodic=!0),e.value&4&&(i.rational=!0),e.value&8&&(i.planar=!0),e.value&16&&(i.planar=!0,i.linear=!0);break;case 71:i.degreeOfSplineCurve=e.value;break;case 72:i.numberOfKnots=e.value;break;case 73:i.numberOfControlPoints=e.value;break;case 74:i.numberOfFitPoints=e.value;break;case 210:i.extrusionDirection=ge(o);break;default:Be(i,e);break}e=o.next()}return i};function ri(){}ri.ForEntityName="TEXT";ri.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.startPoint=ge(o);break;case 11:i.endPoint=ge(o);break;case 40:i.textHeight=e.value;break;case 41:i.xScale=e.value;break;case 50:i.rotation=e.value;break;case 1:i.text=e.value;break;case 72:i.halign=e.value;break;case 73:i.valign=e.value;break;default:Be(i,e);break}e=o.next()}return i};function dc(o){o.registerEntityHandler(Wn),o.registerEntityHandler(Xn),o.registerEntityHandler(Zn),o.registerEntityHandler(Yn),o.registerEntityHandler(Kn),o.registerEntityHandler(qn),o.registerEntityHandler(Qn),o.registerEntityHandler(Jn),o.registerEntityHandler($n),o.registerEntityHandler(ei),o.registerEntityHandler(ti),o.registerEntityHandler(ni),o.registerEntityHandler(ii),o.registerEntityHandler(oi),o.registerEntityHandler(ri)}function ts(){this._entityHandlers={},dc(this)}ts.prototype.parse=function(o,e){throw new Error("read() not implemented. Use readSync()")};ts.prototype.registerEntityHandler=function(o){let e=new o;this._entityHandlers[o.ForEntityName]=e};ts.prototype.parseSync=function(o){return typeof o=="string"?this._parse(o):(console.error("Cannot read dxf source of type `"+typeof o),null)};ts.prototype.parseStream=function(o,e){let i="",r=this;o.on("data",a),o.on("end",l),o.on("error",c);function a(h){i+=h}function l(){try{let h=r._parse(i)}catch(h){return e(h)}e(null,dxf)}function c(h){e(h)}};ts.prototype._parse=function(o){let e,i,r={},a=0,l=o.split(/\r\n|\r|\n/g);if(e=new es(l),!e.hasNext())throw Error("Empty file");let c=this,h=function(){for(i=e.next();!e.isEOF();)if(i.code===0&&i.value==="SECTION"){if(i=e.next(),i.code!==2){console.error("Unexpected code %s after 0:SECTION",$o(i)),i=e.next();continue}i.value==="HEADER"?r.header=u():i.value==="BLOCKS"?r.blocks=d():i.value==="ENTITIES"?r.entities=O(!1):i.value==="TABLES"?r.tables=v():i.value}else i=e.next()},p=function(R,I){return i.code===R&&i.value===I},u=function(){let R=null,I=null,G={};for(i=e.next();;){if(p(0,"ENDSEC")){R&&(G[R]=I);break}else i.code===9?(R&&(G[R]=I),R=i.value):i.code===10?I={x:i.value}:i.code===20?I.y=i.value:i.code===30?I.z=i.value:I=i.value;i=e.next()}return i=e.next(),G},d=function(){let R={},I;for(i=e.next();i.value!=="EOF"&&!p(0,"ENDSEC");)p(0,"BLOCK")?(I=m(),V(I),I.name?R[I.name]=I:console.error('block with handle "'+I.handle+'" is missing a name.')):(Ot(i),i=e.next());return R},m=function(){let R={};for(i=e.next();i.value!=="EOF";){switch(i.code){case 1:R.xrefPath=i.value,i=e.next();break;case 2:R.name=i.value,i=e.next();break;case 3:R.name2=i.value,i=e.next();break;case 5:R.handle=i.value,i=e.next();break;case 8:R.layer=i.value,i=e.next();break;case 10:R.position=P(),i=e.next();break;case 67:R.paperSpace=!!(i.value&&i.value==1),i=e.next();break;case 70:i.value!=0&&(R.type=i.value),i=e.next();break;case 100:i=e.next();break;case 330:R.ownerHandle=i.value,i=e.next();break;case 0:if(i.value=="ENDBLK")break;R.entities=O(!0);break;default:Ot(i),i=e.next()}if(p(0,"ENDBLK")){i=e.next();break}}return R},v=function(){let R={};for(i=e.next();i.value!=="EOF"&&!p(0,"ENDSEC");)p(0,"TABLE")?(i=e.next(),A[i.value]&&(R[A[i.value].tableName]=x())):i=e.next();return i=e.next(),R};const g="ENDTAB";let x=function(){let R=A[i.value],I={},G=0,X;for(i=e.next();!p(0,g);)switch(i.code){case 5:I.handle=i.value,i=e.next();break;case 330:I.ownerHandle=i.value,i=e.next();break;case 100:i.value==="AcDbSymbolTable"||Ot(i),i=e.next();break;case 70:G=i.value,i=e.next();break;case 0:i.value===R.dxfSymbolName?I[R.tableRecordsProperty]=R.parseTableRecords():(Ot(i),i=e.next());break;default:Ot(i),i=e.next()}let j=I[R.tableRecordsProperty];return j&&(j.constructor===Array?X=j.length:typeof j=="object"&&(X=Object.keys(j).length),G!==X&&console.warn("Parsed "+X+" "+R.dxfSymbolName+"'s but expected "+G)),i=e.next(),I},A={VPORT:{tableRecordsProperty:"viewPorts",tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:function(){let R=[],I={};for(i=e.next();!p(0,g);)switch(i.code){case 2:I.name=i.value,i=e.next();break;case 10:I.lowerLeftCorner=P(),i=e.next();break;case 11:I.upperRightCorner=P(),i=e.next();break;case 12:I.center=P(),i=e.next();break;case 13:I.snapBasePoint=P(),i=e.next();break;case 14:I.snapSpacing=P(),i=e.next();break;case 15:I.gridSpacing=P(),i=e.next();break;case 16:I.viewDirectionFromTarget=P(),i=e.next();break;case 17:I.viewTarget=P(),i=e.next();break;case 42:I.lensLength=i.value,i=e.next();break;case 43:I.frontClippingPlane=i.value,i=e.next();break;case 44:I.backClippingPlane=i.value,i=e.next();break;case 45:I.viewHeight=i.value,i=e.next();break;case 50:I.snapRotationAngle=i.value,i=e.next();break;case 51:I.viewTwistAngle=i.value,i=e.next();break;case 79:I.orthographicType=i.value,i=e.next();break;case 110:I.ucsOrigin=P(),i=e.next();break;case 111:I.ucsXAxis=P(),i=e.next();break;case 112:I.ucsYAxis=P(),i=e.next();break;case 110:I.ucsOrigin=P(),i=e.next();break;case 281:I.renderMode=i.value,i=e.next();break;case 281:I.defaultLightingType=i.value,i=e.next();break;case 292:I.defaultLightingOn=i.value,i=e.next();break;case 330:I.ownerHandle=i.value,i=e.next();break;case 63:case 421:case 431:I.ambientColor=i.value,i=e.next();break;case 0:i.value==="VPORT"&&(R.push(I),I={},i=e.next());break;default:Ot(i),i=e.next();break}return R.push(I),R}},LTYPE:{tableRecordsProperty:"lineTypes",tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:function(){let R={},I,G={},X;for(i=e.next();!p(0,"ENDTAB");)switch(i.code){case 2:G.name=i.value,I=i.value,i=e.next();break;case 3:G.description=i.value,i=e.next();break;case 73:X=i.value,X>0&&(G.pattern=[]),i=e.next();break;case 40:G.patternLength=i.value,i=e.next();break;case 49:G.pattern.push(i.value),i=e.next();break;case 0:X>0&&X!==G.pattern.length&&console.warn("lengths do not match on LTYPE pattern"),R[I]=G,G={},i=e.next();break;default:i=e.next()}return R[I]=G,R}},LAYER:{tableRecordsProperty:"layers",tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:function(){let R={},I,G={};for(i=e.next();!p(0,"ENDTAB");)switch(i.code){case 2:G.name=i.value,I=i.value,i=e.next();break;case 62:G.visible=i.value>=0,G.colorIndex=Math.abs(i.value),G.color=fc(G.colorIndex),i=e.next();break;case 70:G.frozen=(i.value&1)!==0||(i.value&2)!==0,i=e.next();break;case 420:G.color=i.value,i=e.next();break;case 0:i.value==="LAYER"&&(R[I]=G,G={},I=void 0,i=e.next());break;default:Ot(i),i=e.next();break}return R[I]=G,R}}},O=function(R){let I=[],G=R?"ENDBLK":"ENDSEC";for(R||(i=e.next());;)if(i.code===0){if(i.value===G)break;let X;(i.value=="TEXT"||i.value=="MTEXT")&&console.log("curr.value",i.value);let j=c._entityHandlers[i.value];if(j!=null)X=j.parseEntity(e,i),i=e.lastReadGroup;else{i=e.next();continue}V(X),I.push(X)}else i=e.next();return G=="ENDSEC"&&(i=e.next()),I},P=function(){let R={},I=i.code;if(R.x=i.value,I+=10,i=e.next(),i.code!=I)throw new Error("Expected code for point value to be "+I+" but got "+i.code+".");return R.y=i.value,I+=10,i=e.next(),i.code!=I?(e.rewind(),R):(R.z=i.value,R)},V=function(R){if(!R)throw new TypeError("entity cannot be undefined or null");R.handle||(R.handle=a++)};return h(),r};function Ot(o){console.debug("unhandled group "+$o(o))}function $o(o){return o.code+":"+o.value}function fc(o){return Qo[o]}class mc{constructor(e){this.url=e}async Fetch(){const e=await fetch(this.url).then(l=>l.arrayBuffer()),r=new TextDecoder("utf-8").decode(e);return new ts().parseSync(r)}}class qs{constructor(e,i=16){this.type=e,this.capacity=i,this.size=0,this.buffer=new(mn(e))(i)}GetSize(){return this.size}Push(e){this._CheckGrow();const i=this.size;return this.buffer[i]=e,this.size++,i}Get(e){if(e>=this.size)throw new Error(`Index out of range: ${e}/${this.size}`);return this.buffer[e]}CopyTo(e,i,r=0,a=-1){a===-1&&(a=this.size-r);const l=new(mn(this.type))(this.buffer.buffer,r,a);e.set(l,i)}_CheckGrow(){if(this.size<this.capacity)return;this.capacity*=2;const e=new(mn(this.type))(this.capacity);e.set(this.buffer),this.buffer=e}}const Xe={INT8:0,UINT8:1,UINT8_CLAMPED:2,INT16:3,UINT16:4,INT32:5,UINT32:6,INT64:7,UINT64:8,FLOAT32:9,FLOAT64:10};function mn(o){switch(o){case Xe.INT8:return Int8Array;case Xe.UINT8:return Uint8Array;case Xe.UINT8_CLAMPED:return Uint8ClampedArray;case Xe.INT16:return Int16Array;case Xe.UINT16:return Uint16Array;case Xe.INT32:return Int32Array;case Xe.UINT32:return Uint32Array;case Xe.FLOAT32:return Float32Array;case Xe.FLOAT64:return Float64Array;default:throw new Error("Unrecognized native type: "+o)}}const rs=65536;function*gn(o,e){for(let i=0;i<o-1;i++)yield i,yield i+1;e&&o>2&&(yield o-1,yield 0)}class be{constructor({type:e,vertices:i,indices:r=null,layer:a=null,color:l,lineType:c=0,shape:h=!1}){this.type=e,this.vertices=i,this.indices=r,this.layer=a,this.color=l,this.lineType=c,this.shape=h}*_IterateVertices(e,i){for(let r=e;r<e+i;r++)yield this.vertices[r]}*_IterateLineChunks(){const e=this.vertices.length;if(e<2)return;const i=this;for(let r=0;r<=e;r+=rs){let a=e-r,l;if(a>rs?(a=rs,l=!1):l=!0,l&&this.shape&&r>0&&a===rs&&(l=!1),r===e&&!this.shape)break;let c,h,p;a<2?(a===1&&this.shape?c=function*(){yield this.vertices[r],yield this.vertices[0]}():a===1?c=function*(){yield this.vertices[r-1],yield this.vertices[r]}():c=function*(){yield this.vertices[e-1],yield this.vertices[0]}(),h=gn(2,!1),p=2):l&&this.shape&&r>0&&a<rs?(c=function*(){yield*i._IterateVertices(r,a),yield this.vertices[0]}(),h=gn(a+1,!1),p=a+1):(c=this._IterateVertices(r,a),h=gn(a,l&&r===0&&this.shape),p=a),yield{verticesCount:p,vertices:c,indices:h}}}}be.Type=Object.freeze({POINTS:0,LINE_SEGMENTS:1,POLYLINE:2,TRIANGLES:3});const Ie=Object.freeze({TEXT:0,ESCAPE:1,SKIP_FORMAT:2,PARAGRAPH1:3,PARAGRAPH2:4,PARAGRAPH3:5}),Tt=Object.freeze({TEXT:0,SCOPE:1,PARAGRAPH:2,NON_BREAKING_SPACE:3,PARAGRAPH_ALIGNMENT:4}),gc=new Set(["L","l","O","o","K","k","P","X","~"]),yc=new Set(["f","F","p","Q","H","W","S","A","C","T"]),vc=new Set(["\\","{","}"]);class Lt{constructor(){this.entities=[]}Parse(e){const i=e.length;let r=0,a=Ie.TEXT,l=[],c=this.entities,h=0;const p=this;function u(){a!==Ie.TEXT||r===h||(c.push({type:Tt.TEXT,content:e.slice(r,h)}),r=h)}function d(g){c.push({type:g})}function m(){const g={type:Tt.SCOPE,content:[]};c.push(g),c=g.content,l.push(g)}function v(){l.length!==0&&(l.pop(),l.length===0?c=p.entities:c=l[l.length-1].content)}for(;h<i;h++){const g=e.charAt(h);switch(a){case Ie.TEXT:if(g==="{"){u(),m(),r=h+1;continue}if(g==="}"){u(),v(),r=h+1;continue}if(g==="\\"){u(),a=Ie.ESCAPE;continue}continue;case Ie.ESCAPE:if(gc.has(g)){switch(g){case"P":d(Tt.PARAGRAPH);break;case"~":d(Tt.NON_BREAKING_SPACE);break}a=Ie.TEXT,r=h+1;continue}if(yc.has(g)){switch(g){case"p":a=Ie.PARAGRAPH1;continue}a=Ie.SKIP_FORMAT;continue}vc.has(g)?r=h:r=h-1,a=Ie.TEXT;continue;case Ie.PARAGRAPH1:a=g==="x"?Ie.PARAGRAPH2:Ie.SKIP_FORMAT;continue;case Ie.PARAGRAPH2:a=g==="q"?Ie.PARAGRAPH3:Ie.SKIP_FORMAT;continue;case Ie.PARAGRAPH3:c.push({type:Tt.PARAGRAPH_ALIGNMENT,alignment:g}),a=Ie.SKIP_FORMAT;continue;case Ie.SKIP_FORMAT:g===";"&&(r=h+1,a=Ie.TEXT);continue;default:throw new Error("Unhandled state")}}u()}GetContent(){return this.entities}*GetText(){function*e(i){for(const r of i)r.type===Tt.TEXT?yield r.content:r.type===Tt.SCOPE&&(yield*e(r.content))}yield*e(this.GetContent())}}Lt.EntityType=Tt;class vs{constructor(e,i=null){this.fontFetchers=e,this.fonts=[],this.font=null,this.options={arcTessellationAngle:10/180*Math.PI,minArcTessellationSubdivisions:8,wireframeMesh:!1,textOptions:vs.DefaultOptions},i&&Object.assign(this.options,i),this.shapes=new Map,this.stubShapeLoaded=!1,this.stubShape=null}async FetchFonts(e){if(!this.stubShapeLoaded){this.stubShapeLoaded=!0;for(const r of Array.from(this.options.fallbackChar))if(await this.FetchFonts(r)){this.stubShape=this._CreateCharShape(r);break}}let i=!1;for(const r of e){if(r.codePointAt(0)<32)continue;let a=!1;for(const l of this.fonts)if(l.HasChar(r)){a=!0;break}if(!a){if(!this.fontFetchers)return!1;for(;this.fontFetchers.length>0;){const l=this.fontFetchers.shift(),c=await this._FetchFont(l);if(this.fonts.push(c),c.HasChar(r)){a=!0;break}}a||(i=!0)}}return!i}get canRender(){return this.fonts!==null&&this.fonts.length>0}*Render({text:e,startPos:i,endPos:r,rotation:a=0,widthFactor:l=1,hAlign:c=0,vAlign:h=0,color:p,layer:u=null,fontSize:d}){const m=new er(d);for(const v of e){const g=this._GetCharShape(v);g&&m.PushChar(v,g)}yield*m.Render(i,r,a,l,c,h,p,u)}*RenderMText({formattedText:e,position:i,fontSize:r,width:a=null,rotation:l=0,direction:c=null,attachment:h,lineSpacing:p=1,color:u,layer:d=null}){const m=new ke(r,this._GetCharShape.bind(this));m.FeedText(e),yield*m.Render(i,a,l,c,h,p,u,d)}_GetCharShape(e){let i=this.shapes.get(e);return i||(i=this._CreateCharShape(e),this.shapes.set(e,i),i)}_CreateCharShape(e){for(const i of this.fonts){const r=i.GetCharPath(e);if(r)return new bc(i,r,this.options)}return this.stubShape}async _FetchFont(e){return new xc(await e())}}vs.DefaultOptions={curveSubdivision:2,fallbackChar:"�?"};class bc{constructor(e,i,r){if(this.font=e,this.advance=i.advance,this.bounds=i.bounds,i.path){const a=i.path.toShapes(!1);this.vertices=[],this.indices=[];for(const l of a){let d=function(m){for(const v of m)p.vertices.push(v)};const c=l.extractPoints(r.curveSubdivision);if(!pn.ShapeUtils.isClockWise(c.shape)){c.shape=c.shape.reverse();for(const m of c.holes)pn.ShapeUtils.isClockWise(m)&&(c.holes[y.h]=m.reverse())}const h=pn.ShapeUtils.triangulateShape(c.shape,c.holes),p=this,u=this.vertices.length;d(c.shape);for(const m of c.holes)d(m);for(const m of h)for(const v of m)this.indices.push(u+v)}}else this.vertices=null}GetVertices(e,i){return this.vertices.map(r=>r.clone().multiplyScalar(i).add(e))}}class xc{constructor(e){this.data=e,this.charMap=new Map;for(const i of Object.values(e.glyphs.glyphs))i.unicode!==void 0&&this.charMap.set(String.fromCodePoint(i.unicode),i);this.scale=100/((this.data.unitsPerEm||2048)*72)}HasChar(e){return this.charMap.has(e)}GetCharPath(e){const i=this.charMap.get(e);if(!i)return null;const r=this.scale,a=new Pa.ShapePath;for(const l of i.path.commands)switch(l.type){case"M":a.moveTo(l.x*r,l.y*r);break;case"L":a.lineTo(l.x*r,l.y*r);break;case"Q":a.quadraticCurveTo(l.x1*r,l.y1*r,l.x*r,l.y*r);break;case"C":a.bezierCurveTo(l.x1*r,l.y1*r,l.x2*r,l.y2*r,l.x*r,l.y*r);break}return{advance:i.advanceWidth*r,path:a,bounds:{xMin:i.xMin*r,xMax:i.xMax*r,yMin:i.yMin*r,yMax:i.yMax*r}}}GetKerning(e,i){const r=this.data.charToGlyphIndex(e);if(r===0)return 0;const a=this.data.charToGlyphIndex(e);return a===0?0:this.data.getKerningValue(r,a)*this.scale}}const tt=Object.freeze({LEFT:0,CENTER:1,RIGHT:2,ALIGNED:3,MIDDLE:4,FIT:5}),Pt=Object.freeze({BASELINE:0,BOTTOM:1,MIDDLE:2,TOP:3}),Pe=Object.freeze({TOP_LEFT:1,TOP_CENTER:2,TOP_RIGHT:3,MIDDLE_LEFT:4,MIDDLE_CENTER:5,MIDDLE_RIGHT:6,BOTTOM_LEFT:7,BOTTOM_CENTER:8,BOTTOM_RIGHT:9});class ke{constructor(e,i){this.fontSize=e,this.charShapeProvider=i,this.curParagraph=new ke.Paragraph(this),this.paragraphs=[this.curParagraph],this.spaceShape=i(" ")}FeedText(e){function*i(a){for(const l of a)l.type===Lt.EntityType.SCOPE?yield*i(l.content):yield l}let r=null;for(const a of i(e))switch(a.type){case Lt.EntityType.TEXT:for(const c of a.content)c===" "?this.curParagraph.FeedSpace():this.curParagraph.FeedChar(c);break;case Lt.EntityType.PARAGRAPH:this.curParagraph=new ke.Paragraph(this),this.curParagraph.SetAlignment(r),this.paragraphs.push(this.curParagraph);break;case Lt.EntityType.NON_BREAKING_SPACE:this.curParagraph.FeedChar(" ");break;case Lt.EntityType.PARAGRAPH_ALIGNMENT:let l=null;switch(a.alignment){case"l":l=ke.Paragraph.Alignment.LEFT;break;case"c":l=ke.Paragraph.Alignment.CENTER;break;case"r":l=ke.Paragraph.Alignment.RIGHT;break;case"d":l=ke.Paragraph.Alignment.JUSTIFY;break;case"j":l=null;break}this.curParagraph.SetAlignment(l),r=l;break}}*Render(e,i,r,a,l,c,h,p){for(const b of this.paragraphs)b.BuildLines(i);if(i===null||i===0){i=0;for(const b of this.paragraphs){const C=b.GetMaxLineWidth();C>i&&(i=C)}}let u=ke.Paragraph.Alignment.LEFT;switch(l){case Pe.TOP_CENTER:case Pe.MIDDLE_CENTER:case Pe.BOTTOM_CENTER:u=ke.Paragraph.Alignment.CENTER;break;case Pe.TOP_RIGHT:case Pe.MIDDLE_RIGHT:case Pe.BOTTOM_RIGHT:u=ke.Paragraph.Alignment.RIGHT;break}for(const b of this.paragraphs)b.ApplyAlignment(i,u);a!==null&&(r=Math.atan2(a.y,a.x)*180/Math.PI);const d=c*5*this.fontSize/3;let m=0;for(const b of this.paragraphs)b.lines===null?m++:m+=b.lines.length;m*=d;let v=new f.Vector2;switch(l){case Pe.TOP_LEFT:break;case Pe.TOP_CENTER:v.x=i/2;break;case Pe.TOP_RIGHT:v.x=i;break;case Pe.MIDDLE_LEFT:v.y=-m/2;break;case Pe.MIDDLE_CENTER:v.x=i/2,v.y=-m/2;break;case Pe.MIDDLE_RIGHT:v.x=i,v.y=-m/2;break;case Pe.BOTTOM_LEFT:v.y=-m;break;case Pe.BOTTOM_CENTER:v.x=i/2,v.y=-m;break;case Pe.BOTTOM_RIGHT:v.x=i,v.y=-m;break;default:throw new Error("Unhandled alignment")}const g=new f.Matrix3().translate(-v.x,-v.y).rotate(-r*Math.PI/180).translate(e.x,e.y);let x=-this.fontSize;for(const b of this.paragraphs){if(b.lines===null){x-=d;continue}for(const C of b.lines){for(let T=C.startChunkIdx;T<C.startChunkIdx+C.numChunks;T++){const A=b.chunks[T];let O=A.position;(T===0||T!==C.startChunkIdx)&&(O+=A.GetSpacingWidth());const P=new f.Vector2(O,x);P.applyMatrix3(g),A.block&&(yield*A.block.Render(P,null,r,null,tt.LEFT,Pt.BASELINE,h,p))}x-=d}}}}ke.Paragraph=class{constructor(o){this.textBox=o,this.chunks=[],this.curChunk=null,this.alignment=null,this.lines=null}FeedChar(o){const e=this.textBox.charShapeProvider(o);e!==null&&(this.curChunk===null&&this._AddChunk(),this.curChunk.PushChar(o,e))}FeedSpace(){(this.curChunk===null||this.curChunk.lastChar!==null)&&this._AddChunk(),this.curChunk.PushSpace()}SetAlignment(o){this.alignment=o}BuildLines(o){if(this.curChunk===null)return;this.lines=[];let e=0,i=0,r=0;const a=()=>{this.lines.push(new ke.Paragraph.Line(this,e,i-e,r)),e=i,r=0};for(;i<this.chunks.length;i++){const l=this.chunks[i],c=l.GetWidth(e===0||i!==e);o!==null&&o!==0&&r!==0&&r+c>o&&a(),l.position=r,r+=c}e!==i&&r!==0&&a()}GetMaxLineWidth(){if(this.lines===null)return 0;let o=0;for(const e of this.lines)e.width>o&&(o=e.width);return o}ApplyAlignment(o,e){if(this.lines)for(const i of this.lines)i.ApplyAlignment(o,e)}_AddChunk(){this.curChunk=new ke.Paragraph.Chunk(this,this.textBox.fontSize,this.curChunk),this.chunks.push(this.curChunk)}};ke.Paragraph.Alignment=Object.freeze({LEFT:0,CENTER:1,RIGHT:2,JUSTIFY:3});ke.Paragraph.Chunk=class{constructor(o,e,i){this.paragraph=o,this.fontSize=e,this.prevChunk=i,this.lastChar=null,this.lastShape=null,this.leadingSpaces=0,this.spaceStartKerning=null,this.spaceEndKerning=null,this.block=null,this.position=null}PushSpace(){if(this.block)throw new Error("Illegal operation");this.leadingSpaces++}PushChar(o,e){this.spaceStartKerning===null&&(this.leadingSpaces===0?(this.spaceStartKerning=0,this.spaceEndKerning=0):(this.prevChunk&&this.prevChunk.lastShape&&this.prevChunk.fontSize===this.fontSize&&this.prevChunk.lastShape.font===this.paragraph.textBox.spaceShape.font?this.spaceStartKerning=this.prevChunk.lastShape.font.GetKerning(this.prevChunk.lastChar," "):this.spaceStartKerning=0,e.font===this.paragraph.textBox.spaceShape.font?this.spaceEndKerning=e.font.GetKerning(" ",o):this.spaceEndKerning=0)),this.block===null&&(this.block=new er(this.fontSize)),this.block.PushChar(o,e),this.lastChar=o,this.lastShape=e}GetSpacingWidth(){return(this.leadingSpaces*this.paragraph.textBox.spaceShape.advance+this.spaceStartKerning+this.spaceEndKerning)*this.fontSize}GetWidth(o){if(this.block===null)return 0;let e=this.block.GetCurrentPosition();return o&&(e+=this.GetSpacingWidth()),e}};ke.Paragraph.Line=class{constructor(o,e,i,r){this.paragraph=o,this.startChunkIdx=e,this.numChunks=i,this.width=r}ApplyAlignment(o,e){switch(this.paragraph.alignment??e){case ke.Paragraph.Alignment.LEFT:break;case ke.Paragraph.Alignment.CENTER:{const r=(o-this.width)/2;this.ForEachChunk(a=>a.position+=r);break}case ke.Paragraph.Alignment.RIGHT:{const r=o-this.width;this.ForEachChunk(a=>a.position+=r);break}case ke.Paragraph.Alignment.JUSTIFY:{const r=o-this.width;if(r<=0||this.numChunks===1)break;const a=r/(this.numChunks-1);let l=0;this.ForEachChunk(c=>{c.position+=l,l+=a});break}default:throw new Error("Unhandled alignment: "+this.paragraph.alignment)}}ForEachChunk(o){for(let e=0;e<this.numChunks;e++)o(this.paragraph.chunks[this.startChunkIdx+e])}};class er{constructor(e){this.fontSize=e,this.glyphs=[],this.bounds=null,this.curX=0,this.prevChar=null,this.prevFont=null}PushChar(e,i){let r;this.prevChar!==null&&this.prevFont===i.font?r=this.prevFont.GetKerning(this.prevChar,e):r=0;const a=this.curX+r*this.fontSize;let l;if(i.vertices){l=i.GetVertices({x:a,y:0},this.fontSize);const c=a+i.bounds.xMin*this.fontSize,h=a+i.bounds.xMax*this.fontSize,p=i.bounds.yMin*this.fontSize,u=i.bounds.yMax*this.fontSize;this.bounds===null?this.bounds={xMin:c,xMax:h,yMin:p,yMax:u}:(c<this.bounds.xMin&&(this.bounds.xMin=c),p<this.bounds.yMin&&(this.bounds.yMin=p),h>this.bounds.xMax&&(this.bounds.xMax=h),u>this.bounds.yMax&&(this.bounds.yMax=u))}else l=null;this.curX=a+i.advance*this.fontSize,this.glyphs.push({shape:i,vertices:l}),this.prevChar=e,this.prevFont=i.font}GetCurrentPosition(){return this.curX}*Render(e,i,r,a,l,c,h,p){if(this.bounds===null)return;i=i??e,r?r*=-Math.PI/180:r=0,a=a??1,l=l??tt.LEFT,c=c??Pt.BASELINE;let u=new f.Vector2,d=new f.Vector2(a,1),m=l===tt.LEFT&&c===Pt.BASELINE||l===tt.FIT||l===tt.ALIGNED?new f.Vector2(e.x,e.y):new f.Vector2(i.x,i.y);const v=()=>{const b=i.x-e.x;return b<Number.MIN_VALUE*2?a:b/(this.bounds.xMax-this.bounds.xMin)},g=()=>-Math.atan2(i.y-e.y,i.x-e.x);switch(l){case tt.LEFT:u.x=this.bounds.xMin;break;case tt.CENTER:u.x=(this.bounds.xMax-this.bounds.xMin)/2;break;case tt.RIGHT:u.x=this.bounds.xMax;break;case tt.MIDDLE:u.x=(this.bounds.xMax-this.bounds.xMin)/2,u.y=(this.bounds.yMax-this.bounds.yMin)/2;break;case tt.ALIGNED:{const b=v();d.x=b,d.y=b,r=g();break}case tt.FIT:d.x=v(),r=g();break;default:console.warn("Unrecognized hAlign value: "+l)}switch(c){case Pt.BASELINE:break;case Pt.BOTTOM:u.y=this.bounds.yMin;break;case Pt.MIDDLE:u.y=(this.bounds.yMax-this.bounds.yMin)/2;break;case Pt.TOP:u.y=this.bounds.yMax;break;default:console.warn("Unrecognized vAlign value: "+c)}const x=new f.Matrix3().translate(-u.x,-u.y).scale(d.x,d.y).rotate(r).translate(m.x,m.y);for(const b of this.glyphs)if(b.vertices){for(const C of b.vertices)C.applyMatrix3(x);yield new be({type:be.Type.TRIANGLES,vertices:b.vertices,indices:b.shape.indices,layer:p,color:h})}}}class Cc{constructor(){}clear(){this._root=null,this.size=0}find(e){let i=this._root;for(;i!==null;){let r=this._comparator(e,i.data);if(r===0)return i.data;i=i.get_child(r>0)}return null}findIter(e){let i=this._root,r=this.iterator();for(;i!==null;){let a=this._comparator(e,i.data);if(a===0)return r._cursor=i,r;r._ancestors.push(i),i=i.get_child(a>0)}return null}lowerBound(e){let i=this._root,r=this.iterator(),a=this._comparator;for(;i!==null;){let l=a(e,i.data);if(l===0)return r._cursor=i,r;r._ancestors.push(i),i=i.get_child(l>0)}for(let l=r._ancestors.length-1;l>=0;--l)if(i=r._ancestors[l],a(e,i.data)<0)return r._cursor=i,r._ancestors.length=l,r;return r._ancestors.length=0,r}upperBound(e){let i=this.lowerBound(e),r=this._comparator;for(;i.data()!==null&&r(i.data(),e)===0;)i.next();return i}min(){let e=this._root;if(e===null)return null;for(;e.left!==null;)e=e.left;return e.data}max(){let e=this._root;if(e===null)return null;for(;e.right!==null;)e=e.right;return e.data}iterator(){return new wc(this)}each(e){let i=this.iterator(),r;for(;(r=i.next())!==null;)e(r)}reach(e){let i=this.iterator(),r;for(;(r=i.prev())!==null;)e(r)}}class wc{constructor(e){this._tree=e,this._ancestors=[],this._cursor=null}data(){return this._cursor!==null?this._cursor.data:null}next(){if(this._cursor===null){let e=this._tree._root;e!==null&&this._minNode(e)}else if(this._cursor.right===null){let e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.right===e)}else this._ancestors.push(this._cursor),this._minNode(this._cursor.right);return this._cursor!==null?this._cursor.data:null}prev(){if(this._cursor===null){let e=this._tree._root;e!==null&&this._maxNode(e)}else if(this._cursor.left===null){let e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.left===e)}else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left);return this._cursor!==null?this._cursor.data:null}_minNode(e){for(;e.left!==null;)this._ancestors.push(e),e=e.left;this._cursor=e}_maxNode(e){for(;e.right!==null;)this._ancestors.push(e),e=e.right;this._cursor=e}}class Rs{constructor(e){this.data=e,this.left=null,this.right=null,this.red=!0}get_child(e){return e?this.right:this.left}set_child(e,i){e?this.right=i:this.left=i}}class tr extends Cc{constructor(e){super(),this._root=null,this._comparator=e,this.size=0}insert(e){let i=!1;if(this._root===null)this._root=new Rs(e),i=!0,this.size++;else{let r=new Rs(void 0),a=0,l=0,c=null,h=r,p=null,u=this._root;for(h.right=this._root;;){if(u===null?(u=new Rs(e),p.set_child(a,u),i=!0,this.size++):Qe(u.left)&&Qe(u.right)&&(u.red=!0,u.left.red=!1,u.right.red=!1),Qe(u)&&Qe(p)){let m=h.right===c;u===p.get_child(l)?h.set_child(m,ps(c,!l)):h.set_child(m,Gi(c,!l))}let d=this._comparator(u.data,e);if(d===0)break;l=a,a=d<0,c!==null&&(h=c),c=p,p=u,u=u.get_child(a)}this._root=r.right}return this._root.red=!1,i}remove(e){if(this._root===null)return!1;let i=new Rs(void 0),r=i;r.right=this._root;let a=null,l=null,c=null,h=1;for(;r.get_child(h)!==null;){let p=h;l=a,a=r,r=r.get_child(h);let u=this._comparator(e,r.data);if(h=u>0,u===0&&(c=r),!Qe(r)&&!Qe(r.get_child(h))){if(Qe(r.get_child(!h))){let d=ps(r,h);a.set_child(p,d),a=d}else if(!Qe(r.get_child(!h))){let d=a.get_child(!p);if(d!==null)if(!Qe(d.get_child(!p))&&!Qe(d.get_child(p)))a.red=!1,d.red=!0,r.red=!0;else{let m=l.right===a;Qe(d.get_child(p))?l.set_child(m,Gi(a,p)):Qe(d.get_child(!p))&&l.set_child(m,ps(a,p));let v=l.get_child(m);v.red=!0,r.red=!0,v.left.red=!1,v.right.red=!1}}}}return c!==null&&(c.data=r.data,a.set_child(a.right===r,r.get_child(r.left===null)),this.size--),this._root=i.right,this._root!==null&&(this._root.red=!1),c!==null}}function Qe(o){return o!==null&&o.red}function ps(o,e){let i=o.get_child(!e);return o.set_child(!e,i.get_child(e)),i.set_child(e,o),o.red=!0,i.red=!1,i}function Gi(o,e){return o.set_child(!e,ps(o.get_child(!e),!e)),ps(o,e)}const zi=65536,Ec=15*Math.PI/180,Hi="__point_shape",Sc=1024,Tc=4;class bs{constructor(e){this.options=Object.create(bs.DefaultOptions),e&&Object.assign(this.options,e.sceneOptions),this.origin=null,this.batches=new tr((i,r)=>i.key.Compare(r.key)),this.layers=new Map,this.blocks=new Map,this.bounds=null,this.pointShapeBlock=null,this.numBlocksFlattened=0}async Build(e,i){const r=e.header||{};if(this.angBase=r.$ANGBASE||0,this.angDir=r.$ANGDIR||0,this.pdMode=r.$PDMODE||0,this.pdSize=r.$PDSIZE||0,e.tables&&e.tables.layer)for(const[,a]of Object.entries(e.tables.layer.layers))this.layers.set(a.name,a);if(e.blocks)for(const[,a]of Object.entries(e.blocks))this.blocks.set(a.name,new ji(a));this.textRenderer=new vs(i,this.options.textOptions),this.hasMissingChars=!1,await this._FetchFonts(e);for(const a of e.entities)if(a.type==="INSERT"){const l=this.blocks.get(a.name);l==null||l.RegisterInsert(a)}for(const a of this.blocks.values()){if(a.data.hasOwnProperty("entities")){const l=a.DefinitionContext();for(const c of a.data.entities)this._ProcessDxfEntity(c,l)}a.SetFlatten()&&this.numBlocksFlattened++}console.log(`${this.numBlocksFlattened} blocks flattened`);for(const a of e.entities)this._ProcessDxfEntity(a);this.scene=this._BuildScene(),delete this.batches,delete this.layers,delete this.blocks,delete this.textRenderer}async _FetchFonts(e){const i=async r=>{let a;if(r.type==="TEXT")a=await this.textRenderer.FetchFonts(r.text);else if(r.type==="MTEXT"){const l=new Lt;l.Parse(r.text);for(const c of l.GetText())if(!await this.textRenderer.FetchFonts(c)){a=!1;break}a=!0}else throw new Error("Bad entity type");return a||(this.hasMissingChars=!0),a};for(const r of e.entities)if((r.type==="TEXT"||r.type==="MTEXT")&&!await i(r))return;for(const r of this.blocks.values())if(r.data.hasOwnProperty("entities")){for(const a of r.data.entities)if((a.type==="TEXT"||a.type==="MTEXT")&&!await i(a))return}}_ProcessDxfEntity(e,i=null){let r;switch(e.type){case"LINE":r=this._DecomposeLine(e,i);break;case"POLYLINE":case"LWPOLYLINE":r=this._DecomposePolyline(e,i);break;case"ARC":r=this._DecomposeArc(e,i);break;case"CIRCLE":r=this._DecomposeCircle(e,i);break;case"ELLIPSE":r=this._DecomposeEllipse(e,i);break;case"POINT":r=this._DecomposePoint(e,i);break;case"SPLINE":r=this._DecomposeSpline(e,i);break;case"INSERT":this._ProcessInsert(e,i);return;case"TEXT":r=this._DecomposeText(e,i);break;case"MTEXT":r=this._DecomposeMText(e,i);break;case"3DFACE":r=this._Decompose3DFace(e,i);break;case"SOLID":r=this._DecomposeSolid(e,i);break;default:console.log("Unhandled entity type: "+e.type);return}for(const a of r)this._ProcessEntity(a,i)}_ProcessEntity(e,i=null){switch(e.type){case be.Type.POINTS:this._ProcessPoints(e,i);break;case be.Type.LINE_SEGMENTS:this._ProcessLineSegments(e,i);break;case be.Type.POLYLINE:this._ProcessPolyline(e,i);break;case be.Type.TRIANGLES:this._ProcessTriangles(e,i);break;default:throw new Error("Unhandled entity type: "+e.type)}}_GetLineType(e,i=null,r=null){return 0}_IsPlainLine(e){return!(e.startWidth||e.endWidth)}*_DecomposeLine(e,i){if(e.vertices.length!==2)return;const r=this._GetEntityLayer(e,i),a=this._GetEntityColor(e,i);yield new be({type:be.Type.LINE_SEGMENTS,vertices:e.vertices,layer:r,color:a,lineType:this._GetLineType(e,e.vertices[0])})}_GenerateBulgeVertices(e,i,r,a){const l=4*Math.atan(a),c=Math.abs(l);if(c<this.options.arcTessellationAngle){e.push(r);return}const h=l/2,p=Math.sin(h),u=Math.cos(h),d={x:r.x-i.x,y:r.y-i.y},m=d.x*d.x+d.y*d.y;if(m<Number.MIN_VALUE*2)return;const v=Math.sqrt(m);let g=v/2/p;d.x/=v,d.y/=v;const x={x:(d.x*p-d.y*u)*g+i.x,y:(d.x*u+d.y*p)*g+i.y};let b=Math.floor(c/this.options.arcTessellationAngle);if(b<this.options.minArcTessellationSubdivisions&&(b=this.options.minArcTessellationSubdivisions),b>1){const C=Math.atan2(i.y-x.y,i.x-x.x),T=l/b;l<0&&(g=-g);for(let A=1;A<b;A++){const O=C+A*T,P={x:x.x+g*Math.cos(O),y:x.y+g*Math.sin(O)};e.push(P)}}e.push(r)}_GenerateArcVertices({vertices:e,center:i,radius:r,startAngle:a=null,endAngle:l=null,tessellationAngle:c=null,yRadius:h=null,transform:p=null}){if(!i||!r)return;c||(c=this.options.arcTessellationAngle),h===null&&(h=r),a==null?a=0:a+=this.angBase;let u=!1;if(l==null?(l=a+2*Math.PI,u=!0):l+=this.angBase,this.angDir){const g=a;a=l,l=g}for(;l<=a;)l+=Math.PI*2;const d=l-a;let m=Math.floor(d/c);m===0&&(m=1);const v=d/m;for(let g=0;g<=m&&!(g===m&&u);g++){const x=a+g*v,b=new f.Vector2(r*Math.cos(x),h*Math.sin(x));b.add(i),p&&b.applyMatrix3(p),e.push(b)}}*_DecomposeArc(e,i){const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this._GetLineType(e,null,i),c=[];this._GenerateArcVertices({vertices:c,center:e.center,radius:e.radius,startAngle:e.startAngle,endAngle:e.endAngle,transform:this._GetEntityExtrusionTransform(e)}),yield new be({type:be.Type.POLYLINE,vertices:c,layer:a,color:r,lineType:l,shape:e.endAngle===void 0})}*_DecomposeCircle(e,i){const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this._GetLineType(e,null,i),c=[];this._GenerateArcVertices({vertices:c,center:e.center,radius:e.radius,transform:this._GetEntityExtrusionTransform(e)}),yield new be({type:be.Type.POLYLINE,vertices:c,layer:a,color:r,lineType:l,shape:!0})}*_DecomposeEllipse(e,i){const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this._GetLineType(e,null,i),c=[],h=Math.sqrt(e.majorAxisEndPoint.x*e.majorAxisEndPoint.x+e.majorAxisEndPoint.y*e.majorAxisEndPoint.y),p=h*e.axisRatio,u=Math.atan2(e.majorAxisEndPoint.y,e.majorAxisEndPoint.x);if(this._GenerateArcVertices({vertices:c,center:e.center,radius:h,startAngle:e.startAngle,endAngle:e.endAngle,yRadius:p,transform:this._GetEntityExtrusionTransform(e)}),u!==0){const d=Math.cos(u),m=Math.sin(u);for(const v of c){const g=v.x-e.center.x,x=v.y-e.center.y;v.x=g*d-x*m+e.center.x,v.y=g*m+x*d+e.center.y}}yield new be({type:be.Type.POLYLINE,vertices:c,layer:a,color:r,lineType:l,shape:e.endAngle===void 0})}*_DecomposePoint(e,i){if(this.pdMode===Ve.NONE||this.pdMode!==Ve.DOT&&this.pdSize<=0)return;const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this.pdMode&Ve.MARK_MASK;if((this.pdMode&Ve.SHAPE_MASK)!==0){const p=new pe(a,Hi,pe.GeometryType.POINT_INSTANCE,r,0);this._GetBatch(p).PushVertex(this._TransformVertex(e.position)),this._CreatePointShapeBlock();return}if(l===Ve.DOT){yield new be({type:be.Type.POINTS,vertices:[e.position],layer:a,color:r,lineType:null});return}const h=[];this._CreatePointMarker(h,l,e.position),yield new be({type:be.Type.LINE_SEGMENTS,vertices:h,layer:a,color:r,lineType:null})}_CreatePointMarker(e,i,r=null){const a=this;function l(c,h){e.push({x:((r==null?void 0:r.x)??0)+c*a.pdSize*.5,y:((r==null?void 0:r.y)??0)+h*a.pdSize*.5})}switch(i){case Ve.PLUS:l(0,1.5),l(0,-1.5),l(-1.5,0),l(1.5,0);break;case Ve.CROSS:l(-1,1),l(1,-1),l(1,1),l(-1,-1);break;case Ve.TICK:l(0,1),l(0,0);break;default:console.warn("Unsupported point display type: "+i)}}_CreatePointShapeBlock(){if(this.pointShapeBlock)return;this.pointShapeBlock=new ji({name:Hi,position:{x:0,y:0}}),this.pointShapeBlock.offset=new f.Vector2(0,0);const e=this.pointShapeBlock.DefinitionContext(),i=this.pdMode&Ve.MARK_MASK;if(i!==Ve.DOT&&i!==Ve.NONE){const r=[];this._CreatePointMarker(r,i);const a=new be({type:be.Type.LINE_SEGMENTS,vertices:r,color:Je.BY_BLOCK});this._ProcessEntity(a,e)}if(this.pdMode&Ve.SQUARE){const r=this.pdSize*.5,a=[{x:-r,y:r},{x:r,y:r},{x:r,y:-r},{x:-r,y:-r}],l=new be({type:be.Type.POLYLINE,vertices:a,color:Je.BY_BLOCK,shape:!0});this._ProcessEntity(l,e)}if(this.pdMode&Ve.CIRCLE){const r=[];this._GenerateArcVertices({vertices:r,center:{x:0,y:0},radius:this.pdSize*.5,tessellationAngle:Ec});const a=new be({type:be.Type.POLYLINE,vertices:r,color:Je.BY_BLOCK,shape:!0});this._ProcessEntity(a,e)}}*_Decompose3DFace(e,i){yield*this._DecomposeFace(e,e.vertices,i,this.options.wireframeMesh)}*_DecomposeSolid(e,i){yield*this._DecomposeFace(e,e.points,i,!1,this._GetEntityExtrusionTransform(e))}*_DecomposeFace(e,i,r,a,l=null){const c=this._GetEntityLayer(e,r),h=this._GetEntityColor(e,r);function p(b,C,T){const A=new f.Vector2().subVectors(C,b),O=new f.Vector2().subVectors(T,b);return Math.abs(A.cross(O))>Number.EPSILON}const u=new f.Vector2(i[0].x,i[0].y),d=new f.Vector2(i[1].x,i[1].y),m=new f.Vector2(i[2].x,i[2].y);let v=null,g=p(u,d,m),x=!1;if(i.length>3&&(v=new f.Vector2(i[3].x,i[3].y),x=p(d,v,m),l&&v.applyMatrix3(l)),l&&(u.applyMatrix3(l),d.applyMatrix3(l),m.applyMatrix3(l)),!(!g&&!x))if(a){const b=[];g&&!x&&b.push(u,d,m),!g&&x?b.push(d,v,m):b.push(u,d,v,m),yield new be({type:be.Type.POLYLINE,vertices:b,layer:c,color:h,shape:!0})}else{const b=[],C=[];g&&(b.push(u,d,m),C.push(0,1,2)),x&&(g?C.push(1,2,3):(b.push(d,m),C.push(0,1,2)),b.push(v)),yield new be({type:be.Type.TRIANGLES,vertices:b,indices:C,layer:c,color:h})}}*_DecomposeText(e,i){const r=this._GetEntityLayer(e,i),a=this._GetEntityColor(e,i);yield*this.textRenderer.Render({text:e.text,fontSize:e.textHeight,startPos:e.startPoint,endPos:e.endPoint,rotation:e.rotation,hAlign:e.halign,vAlign:e.valign,widthFactor:e.xScale,color:a,layer:r})}*_DecomposeMText(e,i){if(!this.textRenderer.canRender)return;const r=this._GetEntityLayer(e,i),a=this._GetEntityColor(e,i),l=new Lt;l.Parse(e.text),yield*this.textRenderer.RenderMText({formattedText:l.GetContent(),fontSize:e.height,position:e.position,rotation:e.rotation,direction:e.direction,attachment:e.attachmentPoint,lineSpacing:e.lineSpacing,width:e.width,color:a,layer:r})}_ProcessInsert(e,i=null){if(i){if(i.name===e.name){console.warn("Recursive block reference: "+i.name);return}const p=this.blocks.get(e.name);p||console.warn("Unresolved nested block reference: "+e.name);const u=i.NestedBlockContext(p,e);if(p.data.entities)for(const d of p.data.entities)this._ProcessDxfEntity(d,u);return}const r=this.blocks.get(e.name);if(r===null){console.warn("Unresolved block reference in INSERT: "+e.name);return}if(!r.HasGeometry())return;const a=this._GetEntityLayer(e,null),l=this._GetEntityColor(e,null),c=this._GetLineType(e,null,null),h=r.InstantiationContext().GetInsertionTransform(e);if(this._UpdateBounds(new f.Vector2().applyMatrix3(h)),h.translate(-this.origin.x,-this.origin.y),r.flatten)for(const p of r.batches)this._FlattenBatch(p,a,l,c,h);else{const p=new pe(a,e.name,pe.GeometryType.BLOCK_INSTANCE,l,c);this._GetBatch(p).PushInstanceTransform(h)}}_FlattenBatch(e,i,r,a,l){const c=this.layers.get(i);let h,p=0;e.key.color===Je.BY_BLOCK?h=r:e.key.color===Je.BY_LAYER?h=(c==null?void 0:c.color)??0:h=e.key.color;const u=new pe(i,null,e.key.geometryType,h,p);this._GetBatch(u).Merge(e,l)}*_GenerateShapedPolyline(e,i,r,a,l){yield new be({type:be.Type.POLYLINE,vertices:e,layer:i,color:r,lineType:a,shape:l})}_MirrorEntityVertices(e,i=null){if(!e.extrusionDirection||e.extrusionDirection.z>=0)return i??e.vertices;(!i||i===e.vertices)&&(i=e.vertices.slice());const r=i.length;for(let a=0;a<r;a++){const l=i[a],c={x:-l.x};for(const h in l)l.hasOwnProperty(h)&&h!=="x"&&(c[h]=l[h]);i[a]=c}return i}*_DecomposePolyline(e,i=null){let r,a;if(e.includesCurveFitVertices||e.includesSplineFitVertices?(r=e.vertices.filter(g=>g.splineVertex||g.curveFittingVertex),a=r.length):(r=e.vertices,a=e.vertices.length),a<2)return;r=this._MirrorEntityVertices(e,r);const l=this._GetEntityColor(e,i),c=this._GetEntityLayer(e,i),h=this;let p=0,u=this._IsPlainLine(r[0]),d=this._GetLineType(e,r[0],i),m=null;function*v(g){if(g===p)return;let x=!1,b=m;g===a&&p===0?(x=!0,b===null&&(b=r)):g===a-1&&p===0?b===null&&(b=r):g===a?b===null&&(b=r.slice(p,g),b.push(r[0])):b===null&&(b=r.slice(p,g+1)),u?yield new be({type:be.Type.POLYLINE,vertices:b,layer:c,color:l,lineType:d,shape:x}):yield*h._GenerateShapedPolyline(b,c,l,d,x),p=g,g!==a&&(u=h._IsPlainLine(r[g]),d=h._GetLineType(e,r[g])),m=null}for(let g=1;g<=a;g++){const x=r[g-1];let b;if(g===a){if(!e.shape){yield*v(g-1);break}b=r[0]}else b=r[g];if(x.bulge&&u?(m===null&&(m=r.slice(p,g)),this._GenerateBulgeVertices(m,x,b,x.bulge)):m!==null&&m.push(b),g===a){yield*v(g);break}const C=this._IsPlainLine(b),T=this._GetLineType(e,b);(C!==u||u&&T!==d)&&(yield*v(g))}}*_DecomposeSpline(e,i=null){const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this._GetLineType(e,null,i),c=e.controlPoints.map(d=>[d.x,d.y]),h=[],p=c.length*Tc,u=1/p;for(let d=0;d<=p;d++){const m=this._InterpolateSpline(d*u,e.degreeOfSplineCurve,c,e.knotValues);h.push({x:m[0],y:m[1]})}yield new be({type:be.Type.POLYLINE,vertices:h,layer:a,color:r,lineType:l})}_InterpolateSpline(e,i,r,a=null,l=null){let c,h,p,u;const d=r.length,m=r[0].length;if(i<1)throw new Error("Degree must be at least 1 (linear)");if(i>d-1)throw new Error("Degree must be less than or equal to point count - 1");if(!l)for(l=[],c=0;c<d;c++)l[c]=1;if(a){if(a.length!==d+i+1)throw new Error("Bad knot vector length")}else for(a=[],c=0;c<d+i+1;c++)a[c]=c;const v=[i,a.length-1-i],g=a[v[0]],x=a[v[1]];for(e=e*(x-g)+g,e<g?e=g:e>x&&(e=x),p=v[0];p<v[1]&&!(e>=a[p]&&e<=a[p+1]);p++);const b=[];for(c=0;c<d;c++){for(b[c]=[],h=0;h<m;h++)b[c][h]=r[c][h]*l[c];b[c][m]=l[c]}let C;for(u=1;u<=i+1;u++)for(c=p;c>p-i-1+u;c--)for(C=(e-a[c])/(a[c+i+1-u]-a[c]),h=0;h<m+1;h++)b[c][h]=(1-C)*b[c-1][h]+C*b[c][h];const T=[];for(c=0;c<m;c++)T[c]=b[p][c]/b[p][m];return T}_ProcessPoints(e,i=null){const r=new pe(e.layer,i==null?void 0:i.name,pe.GeometryType.POINTS,e.color,0),a=this._GetBatch(r);for(const l of e.vertices)a.PushVertex(this._TransformVertex(l,i))}_ProcessLineSegments(e,i=null){if(e.vertices.length%2!==0)throw Error("Even number of vertices expected");const r=new pe(e.layer,i==null?void 0:i.name,pe.GeometryType.LINES,e.color,e.lineType),a=this._GetBatch(r);for(const l of e.vertices)a.PushVertex(this._TransformVertex(l,i))}_ProcessPolyline(e,i=null){if(e.vertices.length<2)return;const r=e.vertices.length;if(r<=3){const c=new pe(e.layer,i==null?void 0:i.name,pe.GeometryType.LINES,e.color,e.lineType),h=this._GetBatch(c);let p=null;for(const u of e.vertices)p!==null&&(h.PushVertex(this._TransformVertex(p,i)),h.PushVertex(this._TransformVertex(u,i))),p=u;e.shape&&r>2&&(h.PushVertex(this._TransformVertex(e.vertices[r-1],i)),h.PushVertex(this._TransformVertex(e.vertices[0],i)));return}const a=new pe(e.layer,i==null?void 0:i.name,pe.GeometryType.INDEXED_LINES,e.color,e.lineType),l=this._GetBatch(a);for(const c of e._IterateLineChunks()){const h=l.PushChunk(c.verticesCount);for(const p of c.vertices)h.PushVertex(this._TransformVertex(p,i));for(const p of c.indices)h.PushIndex(p);h.Finish()}}_ProcessTriangles(e,i=null){if(e.vertices.length<3)return;if(e.indices.length%3!==0){console.error("Unexpected size of indices array: "+e.indices.length);return}const r=new pe(e.layer,i==null?void 0:i.name,pe.GeometryType.INDEXED_TRIANGLES,e.color,0),l=this._GetBatch(r).PushChunk(e.vertices.length);for(const c of e.vertices)l.PushVertex(this._TransformVertex(c,i));for(const c of e.indices)l.PushIndex(c);l.Finish()}_GetEntityColor(e,i=null){let r=Je.BY_LAYER;if(e.colorIndex===0?r=Je.BY_BLOCK:e.colorIndex===256?r=Je.BY_LAYER:e.hasOwnProperty("color")&&(r=e.color),i)return r;if(r===Je.BY_LAYER||r===Je.BY_BLOCK){if(e.hasOwnProperty("layer")){const a=this.layers.get(e.layer);if(a)return a.color}}else return r;return 0}_GetEntityLayer(e,i=null){return i?null:e.hasOwnProperty("layer")?e.layer:"0"}_GetEntityExtrusionTransform(e){return!e.hasOwnProperty("extrusionDirection")||e.extrusionDirection.z>0?null:new f.Matrix3().scale(-1,1)}_GetBatch(e){let i=this.batches.find({key:e});if(i!==null)return i;if(i=new Lc(e),this.batches.insert(i),e.blockName!==null&&!e.IsInstanced()){const r=this.blocks.get(e.blockName);r&&r.batches.push(i)}return i}_TransformVertex(e,i=null){return i?i.TransformVertex(e):(this._UpdateBounds(e),{x:e.x-this.origin.x,y:e.y-this.origin.y})}_UpdateBounds(e){this.bounds===null?this.bounds={minX:e.x,maxX:e.x,minY:e.y,maxY:e.y}:(e.x<this.bounds.minX?this.bounds.minX=e.x:e.x>this.bounds.maxX&&(this.bounds.maxX=e.x),e.y<this.bounds.minY?this.bounds.minY=e.y:e.y>this.bounds.maxY&&(this.bounds.maxY=e.y)),this.origin===null&&(this.origin={x:e.x,y:e.y})}_BuildScene(){let e=0,i=0,r=0;this.batches.each(c=>{e+=c.GetVerticesBufferSize(),i+=c.GetIndicesBufferSize(),r+=c.GetTransformsSize()});const a={vertices:new ArrayBuffer(e),indices:new ArrayBuffer(i),transforms:new ArrayBuffer(r),batches:[],layers:[],origin:this.origin,bounds:this.bounds,hasMissingChars:this.hasMissingChars},l={vertices:new Float32Array(a.vertices),verticesOffset:0,indices:new Uint16Array(a.indices),indicesOffset:0,transforms:new Float32Array(a.transforms),transformsOffset:0};this.batches.each(c=>{a.batches.push(c.Serialize(l))});for(const c of this.layers.values())a.layers.push({name:c.name,color:c.color});return a.pointShapeHasDot=(this.pdMode&Ve.MARK_MASK)===Ve.DOT,a}}class Lc{constructor(e){this.key=e,e.IsIndexed()?this.chunks=[]:e.geometryType===pe.GeometryType.BLOCK_INSTANCE?this.transforms=new qs(Xe.FLOAT32):this.vertices=new qs(Xe.FLOAT32)}PushVertex(e){const i=this.vertices.Push(e.x);return this.vertices.Push(e.y),i}PushInstanceTransform(e){for(let i=0;i<2;i++)for(let r=0;r<3;r++)this.transforms.Push(e.elements[r*3+i])}PushChunk(e){if(e>zi)throw new Error("Vertices count exceeds chunk limit: "+e);let i=null,r=0;for(const a of this.chunks){const l=zi-a.vertices.GetSize()/2;l<e||(i===null||l<r)&&(i=a,r=l)}return i===null&&(i=this._NewChunk(e)),new Mc(i,e)}Merge(e,i=null){if(this.key.geometryType!==e.key.geometryType)throw new Error(`Rendering batch merging geometry type mismatch: ${this.key.geometryType} !== ${e.key.geometryType}`);if(this.key.IsInstanced())throw new Error("Attempted to merge instanced batch");if(this.key.IsIndexed())for(const r of e.chunks){const a=r.vertices.size,l=this.PushChunk(a/2);for(let h=0;h<a;h+=2){const p=new f.Vector2(r.vertices.Get(h),r.vertices.Get(h+1));i&&p.applyMatrix3(i),l.PushVertex(p)}const c=r.indices.size;for(let h=0;h<c;h++)l.PushIndex(r.indices.Get(h));l.Finish()}else{const r=e.vertices.size;for(let a=0;a<r;a+=2){const l=new f.Vector2(e.vertices.Get(a),e.vertices.Get(a+1));i&&l.applyMatrix3(i),this.PushVertex(l)}}}GetVerticesBufferSize(){if(this.key.IsIndexed()){let e=0;for(const i of this.chunks)e+=i.vertices.GetSize();return e*Float32Array.BYTES_PER_ELEMENT}else return this.key.geometryType===pe.GeometryType.BLOCK_INSTANCE?0:this.vertices.GetSize()*Float32Array.BYTES_PER_ELEMENT}GetIndicesBufferSize(){if(this.key.IsIndexed()){let e=0;for(const i of this.chunks)e+=i.indices.GetSize();return e*Uint16Array.BYTES_PER_ELEMENT}else return 0}GetTransformsSize(){return this.key.geometryType===pe.GeometryType.BLOCK_INSTANCE?this.transforms.GetSize()*Float32Array.BYTES_PER_ELEMENT:0}Serialize(e){if(this.key.IsIndexed()){const i={key:this.key,chunks:[]};for(const r of this.chunks)i.chunks.push(r.Serialize(e));return i}else if(this.key.geometryType===pe.GeometryType.BLOCK_INSTANCE){const i=this.transforms.GetSize(),r={key:this.key,transformsOffset:e.transformsOffset,transformsSize:i};return this.transforms.CopyTo(e.transforms,e.transformsOffset),e.transformsOffset+=i,r}else{const i=this.vertices.GetSize(),r={key:this.key,verticesOffset:e.verticesOffset,verticesSize:i};return this.vertices.CopyTo(e.vertices,e.verticesOffset),e.verticesOffset+=i,r}}_NewChunk(e){const i=new kc(e);return this.chunks.push(i),i}}let ji=class{constructor(e){this.data=e,this.useCount=0,this.nestedUseCount=0,this.verticesCount=0,this.offset=null,this.batches=[],this.flatten=!1}SetFlatten(){return this.HasGeometry()?(this.flatten=this.useCount===1||this.useCount*this.verticesCount<=Sc,this.flatten):!1}HasGeometry(){return this.offset!==null}RegisterInsert(e){this.useCount++}RegisterNestedUse(e){this.nestedUseCount++}DefinitionContext(){return new Ye(this,Ye.Type.DEFINITION)}InstantiationContext(){return new Ye(this,Ye.Type.INSTANTIATION)}};class Ye{constructor(e,i){this.block=e,this.type=i,this.origin=this.block.data.position,this.transform=new f.Matrix3}get name(){return this.block.data.name}TransformVertex(e){const i=new f.Vector2(e.x,e.y).applyMatrix3(this.transform);if(this.type!==Ye.Type.DEFINITION&&this.type!==Ye.Type.NESTED_DEFINITION)throw new Error("Unexpected transform type");return this.block.verticesCount++,this.block.offset===null?(this.block.offset=i,new f.Vector2):(i.sub(this.block.offset),i)}GetInsertionTransform(e){const i=new f.Matrix3().translate(-this.origin.x,-this.origin.y),r=e.yScale||1,a=e.xScale||1,l=-(e.rotation||0)*Math.PI/180;let c=e.position.x;const h=e.position.y;if(i.scale(a,r),i.rotate(l),i.translate(c,h),e.extrusionDirection&&e.extrusionDirection.z<0&&i.scale(-1,1),this.type!==Ye.Type.INSTANTIATION)return i;const p=new f.Matrix3().translate(this.block.offset.x,this.block.offset.y);return i.multiply(p)}NestedBlockContext(e,i){e.RegisterNestedUse(this.block);const a=new Ye(e,Ye.Type.NESTED_DEFINITION).GetInsertionTransform(i),l=new Ye(this.block,Ye.Type.NESTED_DEFINITION);return l.transform=new f.Matrix3().multiplyMatrices(this.transform,a),l}}Ye.Type=Object.freeze({DEFINITION:0,NESTED_DEFINITION:1,INSTANTIATION:2});class kc{constructor(e){e<16&&(e=16),this.indices=new qs(Xe.UINT16,e*2),this.vertices=new qs(Xe.FLOAT32,e*2)}Serialize(e){const i={};{const r=this.vertices.GetSize();i.verticesOffset=e.verticesOffset,i.verticesSize=r,this.vertices.CopyTo(e.vertices,e.verticesOffset),e.verticesOffset+=r}{const r=this.indices.GetSize();i.indicesOffset=e.indicesOffset,i.indicesSize=r,this.indices.CopyTo(e.indices,e.indicesOffset),e.indicesOffset+=r}return i}}class Mc{constructor(e,i){this.chunk=e,this.verticesCount=i,this.verticesOffset=this.chunk.vertices.GetSize()/2,this.numVerticesPushed=0}PushVertex(e){if(this.numVerticesPushed===this.verticesCount)throw new Error;this.chunk.vertices.Push(e.x),this.chunk.vertices.Push(e.y),this.numVerticesPushed++}PushIndex(e){if(e<0||e>=this.verticesCount)throw new Error(`Index out of range: ${e}/${this.verticesCount}`);this.chunk.indices.Push(e+this.verticesOffset)}Finish(){if(this.numVerticesPushed!==this.verticesCount)throw new Error(`Not all vertices pushed: ${this.numVerticesPushed}/${this.verticesCount}`)}}const Ve=Object.freeze({DOT:0,NONE:1,PLUS:2,CROSS:3,TICK:4,MARK_MASK:15,CIRCLE:32,SQUARE:64,SHAPE_MASK:240}),Je=Object.freeze({BY_LAYER:-1,BY_BLOCK:-2});bs.DefaultOptions={arcTessellationAngle:10/180*Math.PI,minArcTessellationSubdivisions:8,wireframeMesh:!1,textOptions:vs.DefaultOptions};let Ic=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')}),ai=0,sr=-3;class ms{constructor(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}}function Ac(o,e){this.source=o,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new ms,this.dtree=new ms}let nr=new ms,ir=new ms,li=new Uint8Array(30),ci=new Uint16Array(30),or=new Uint8Array(30),rr=new Uint16Array(30),_c=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wi=new ms,at=new Uint8Array(288+32);function ar(o,e,i,r){let a,l;for(a=0;a<i;++a)o[a]=0;for(a=0;a<30-i;++a)o[a+i]=a/i|0;for(l=r,a=0;a<30;++a)e[a]=l,l+=1<<o[a]}function Bc(o,e){let i;for(i=0;i<7;++i)o.table[i]=0;for(o.table[7]=24,o.table[8]=152,o.table[9]=112,i=0;i<24;++i)o.trans[i]=256+i;for(i=0;i<144;++i)o.trans[24+i]=i;for(i=0;i<8;++i)o.trans[24+144+i]=280+i;for(i=0;i<112;++i)o.trans[24+144+8+i]=144+i;for(i=0;i<5;++i)e.table[i]=0;for(e.table[5]=32,i=0;i<32;++i)e.trans[i]=i}let Xi=new Uint16Array(16);function yn(o,e,i,r){let a,l;for(a=0;a<16;++a)o.table[a]=0;for(a=0;a<r;++a)o.table[e[i+a]]++;for(o.table[0]=0,l=0,a=0;a<16;++a)Xi[a]=l,l+=o.table[a];for(a=0;a<r;++a)e[i+a]&&(o.trans[Xi[e[i+a]]++]=a)}function Rc(o){o.bitcount--||(o.tag=o.source[o.sourceIndex++],o.bitcount=7);let e=o.tag&1;return o.tag>>>=1,e}function ct(o,e,i){if(!e)return i;for(;o.bitcount<24;)o.tag|=o.source[o.sourceIndex++]<<o.bitcount,o.bitcount+=8;let r=o.tag&65535>>>16-e;return o.tag>>>=e,o.bitcount-=e,r+i}function In(o,e){for(;o.bitcount<24;)o.tag|=o.source[o.sourceIndex++]<<o.bitcount,o.bitcount+=8;let i=0,r=0,a=0,l=o.tag;do r=2*r+(l&1),l>>>=1,++a,i+=e.table[a],r-=e.table[a];while(r>=0);return o.tag=l,o.bitcount-=a,e.trans[i+r]}function Oc(o,e,i){let r,a,l,c,h,p;for(r=ct(o,5,257),a=ct(o,5,1),l=ct(o,4,4),c=0;c<19;++c)at[c]=0;for(c=0;c<l;++c){let u=ct(o,3,0);at[_c[c]]=u}for(yn(Wi,at,0,19),h=0;h<r+a;){let u=In(o,Wi);switch(u){case 16:let d=at[h-1];for(p=ct(o,2,3);p;--p)at[h++]=d;break;case 17:for(p=ct(o,3,3);p;--p)at[h++]=0;break;case 18:for(p=ct(o,7,11);p;--p)at[h++]=0;break;default:at[h++]=u;break}}yn(e,at,0,r),yn(i,at,r,a)}function Zi(o,e,i){for(;;){let r=In(o,e);if(r===256)return ai;if(r<256)o.dest[o.destLen++]=r;else{let a,l,c,h;for(r-=257,a=ct(o,li[r],ci[r]),l=In(o,i),c=o.destLen-ct(o,or[l],rr[l]),h=c;h<c+a;++h)o.dest[o.destLen++]=o.dest[h]}}}function Dc(o){for(let e,i,r;o.bitcount>8;)o.sourceIndex--,o.bitcount-=8;if(t=o.source[o.sourceIndex+1],t=256*t+o.source[o.sourceIndex],n=o.source[o.sourceIndex+3],n=256*n+o.source[o.sourceIndex+2],t!==(~n&65535))return sr;for(o.sourceIndex+=4,s=t;s;--s)o.dest[o.destLen++]=o.source[o.sourceIndex++];return o.bitcount=0,ai}function Nc(o,e){let i=new Ac(o,e),r,a,l;do{switch(r=Rc(i),a=ct(i,2,0),a){case 0:l=Dc(i);break;case 1:l=Zi(i,nr,ir);break;case 2:Oc(i,i.ltree,i.dtree),l=Zi(i,i.ltree,i.dtree);break;default:l=sr}if(l!==ai)throw new Error("Data error")}while(!r);return i.destLen<i.dest.length?typeof i.dest.slice=="function"?i.dest.slice(0,i.destLen):i.dest.subarray(0,i.destLen):i.dest}Bc(nr,ir);ar(li,ci,4,3);ar(or,rr,2,1);li[28]=0;ci[28]=258;function Zt(o,e,i,r,a){return Math.pow(1-a,3)*o+3*Math.pow(1-a,2)*a*e+3*(1-a)*Math.pow(a,2)*i+Math.pow(a,3)*r}function Ht(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Ht.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)};Ht.prototype.addPoint=function(o,e){typeof o=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=o,this.x2=o),o<this.x1&&(this.x1=o),o>this.x2&&(this.x2=o)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))};Ht.prototype.addX=function(o){this.addPoint(o,null)};Ht.prototype.addY=function(o){this.addPoint(null,o)};Ht.prototype.addBezier=function(o,e,i,r,a,l,c,h){let p=[o,e],u=[i,r],d=[a,l],m=[c,h];this.addPoint(o,e),this.addPoint(c,h);for(let v=0;v<=1;v++){let g=6*p[v]-12*u[v]+6*d[v],x=-3*p[v]+9*u[v]-9*d[v]+3*m[v],b=3*u[v]-3*p[v];if(x===0){if(g===0)continue;let O=-b/g;0<O&&O<1&&(v===0&&this.addX(Zt(p[v],u[v],d[v],m[v],O)),v===1&&this.addY(Zt(p[v],u[v],d[v],m[v],O)));continue}let C=Math.pow(g,2)-4*b*x;if(C<0)continue;let T=(-g+Math.sqrt(C))/(2*x);0<T&&T<1&&(v===0&&this.addX(Zt(p[v],u[v],d[v],m[v],T)),v===1&&this.addY(Zt(p[v],u[v],d[v],m[v],T)));let A=(-g-Math.sqrt(C))/(2*x);0<A&&A<1&&(v===0&&this.addX(Zt(p[v],u[v],d[v],m[v],A)),v===1&&this.addY(Zt(p[v],u[v],d[v],m[v],A)))}};Ht.prototype.addQuad=function(o,e,i,r,a,l){let c=o+.6666666666666666*(i-o),h=e+2/3*(r-e),p=c+1/3*(a-o),u=h+1/3*(l-e);this.addBezier(o,e,c,h,p,u,a,l)};let lr=Ht;function Ae(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}function Gs(o,e){return+(Math.round(o+"e+"+e)+"e-"+e)}function cr(o){let e=[[]];for(let i=0;i<o.length;i+=1){let r=e[e.length-1],a=o[i],l=r[0],c=r[1],h=r[r.length-1];r.push(a),a.type==="Z"?(l&&c&&h&&l.type==="M"&&c.type==="L"&&h.type==="L"&&h.x===l.x&&h.y===l.y&&(r.shift(),r[0].type="M"),i+1<o.length&&e.push([])):a.type==="L"&&h&&h.x===a.x&&h.y===a.y&&r.pop()}return o=[].concat.apply([],e),o}function Pc(o){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},o)}function Vc(o){return parseInt(o)===o&&(o={decimalPlaces:o,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},o)}Ae.prototype.fromSVG=function(o,e={}){typeof SVGPathElement<"u"&&o instanceof SVGPathElement&&(o=o.getAttribute("d")),e=Pc(e),this.commands=[];let i="0123456789",r="MmLlQqCcZzHhVv",a="SsTtAa",l="-+",c={},h=[""],p=!1;function u(x){return x.filter(b=>b.length).map(b=>{let C=parseFloat(b);return(e.decimalPlaces||e.decimalPlaces===0)&&(C=Gs(C,e.decimalPlaces)),C})}function d(x){if(!this.commands.length)return x;let b=this.commands[this.commands.length-1];for(let C=0;C<x.length;C++)x[C]+=b[C&1?"y":"x"];return x}function m(){if(c.type===void 0)return;let x=c.type.toUpperCase(),b=x!=="Z"&&c.type.toUpperCase()!==c.type,C=u(h);if(h=[""],!C.length&&x!=="Z")return;b&&x!=="H"&&x!=="V"&&(C=d.apply(this,[C]));let T=this.commands.length&&this.commands[this.commands.length-1].x||0,A=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(x){case"M":this.moveTo(...C);break;case"L":this.lineTo(...C);break;case"V":for(let O=0;O<C.length;O++){let P=0;b&&(P=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(T,C[O]+P)}break;case"H":for(let O=0;O<C.length;O++){let P=0;b&&(P=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(C[O]+P,A)}break;case"C":this.bezierCurveTo(...C);break;case"Q":this.quadraticCurveTo(...C);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let O in this.commands[this.commands.length-1])this.commands[this.commands.length-1][O]===void 0&&(this.commands[this.commands.length-1][O]=0)}for(let x=0;x<o.length;x++){let b=o.charAt(x),C=h[h.length-1];if(i.indexOf(b)>-1)h[h.length-1]+=b;else if(l.indexOf(b)>-1)if(!c.type&&!this.commands.length&&(c.type="L"),b==="-")!c.type||C.indexOf("-")>0?p=!0:C.length?h.push("-"):h[h.length-1]=b;else if(!c.type||C.length>0)p=!0;else continue;else if(r.indexOf(b)>-1)c.type?(m.apply(this),c={type:b}):c.type=b;else{if(a.indexOf(b)>-1)throw new Error("Unsupported path command: "+b+". Currently supported commands are "+r.split("").join(", ")+".");` ,
7
- \r\f\v`.indexOf(b)>-1?h.push(""):b==="."?!c.type||C.indexOf(b)>-1?p=!0:h[h.length-1]+=b:p=!0}if(p)throw new Error("Unexpected character: "+b+" at offset "+x)}m.apply(this),e.optimize&&(this.commands=cr(this.commands));let v=e.flipY,g=e.flipYBase;if(v===!0&&e.flipYBase===void 0){let x=this.getBoundingBox();g=x.y1+x.y2}for(let x in this.commands){let b=this.commands[x];for(let C in b)["x","x1","x2"].includes(C)?this.commands[x][C]=e.x+b[C]*e.scale:["y","y1","y2"].includes(C)&&(this.commands[x][C]=e.y+(v?g-b[C]:b[C])*e.scale)}return this};Ae.fromSVG=function(o,e){return new Ae().fromSVG(o,e)};Ae.prototype.moveTo=function(o,e){this.commands.push({type:"M",x:o,y:e})};Ae.prototype.lineTo=function(o,e){this.commands.push({type:"L",x:o,y:e})};Ae.prototype.curveTo=Ae.prototype.bezierCurveTo=function(o,e,i,r,a,l){this.commands.push({type:"C",x1:o,y1:e,x2:i,y2:r,x:a,y:l})};Ae.prototype.quadTo=Ae.prototype.quadraticCurveTo=function(o,e,i,r){this.commands.push({type:"Q",x1:o,y1:e,x:i,y:r})};Ae.prototype.close=Ae.prototype.closePath=function(){this.commands.push({type:"Z"})};Ae.prototype.extend=function(o){if(o.commands)o=o.commands;else if(o instanceof lr){let e=o;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,o)};Ae.prototype.getBoundingBox=function(){let o=new lr,e=0,i=0,r=0,a=0;for(let l=0;l<this.commands.length;l++){let c=this.commands[l];switch(c.type){case"M":o.addPoint(c.x,c.y),e=r=c.x,i=a=c.y;break;case"L":o.addPoint(c.x,c.y),r=c.x,a=c.y;break;case"Q":o.addQuad(r,a,c.x1,c.y1,c.x,c.y),r=c.x,a=c.y;break;case"C":o.addBezier(r,a,c.x1,c.y1,c.x2,c.y2,c.x,c.y),r=c.x,a=c.y;break;case"Z":r=e,a=i;break;default:throw new Error("Unexpected path command "+c.type)}}return o.isEmpty()&&o.addPoint(0,0),o};Ae.prototype.draw=function(o){o.beginPath();for(let e=0;e<this.commands.length;e+=1){let i=this.commands[e];i.type==="M"?o.moveTo(i.x,i.y):i.type==="L"?o.lineTo(i.x,i.y):i.type==="C"?o.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y):i.type==="Q"?o.quadraticCurveTo(i.x1,i.y1,i.x,i.y):i.type==="Z"&&o.closePath()}this.fill&&(o.fillStyle=this.fill,o.fill()),this.stroke&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeWidth,o.stroke())};Ae.prototype.toPathData=function(o){o=Vc(o);function e(h){return Math.round(h)===Gs(h,o.decimalPlaces)?""+Gs(h,o.decimalPlaces):Gs(h,o.decimalPlaces).toFixed(o.decimalPlaces)}function i(){let h="";for(let p=0;p<arguments.length;p+=1){let u=arguments[p];u>=0&&p>0&&(h+=" "),h+=e(u)}return h}let r=this.commands;o.optimize&&(r=JSON.parse(JSON.stringify(this.commands)),r=cr(r));let a=o.flipY,l=o.flipYBase;if(a===!0&&l===void 0){let h=new Ae;h.extend(r);let p=h.getBoundingBox();l=p.y1+p.y2}let c="";for(let h=0;h<r.length;h+=1){let p=r[h];p.type==="M"?c+="M"+i(p.x,a?l-p.y:p.y):p.type==="L"?c+="L"+i(p.x,a?l-p.y:p.y):p.type==="C"?c+="C"+i(p.x1,a?l-p.y1:p.y1,p.x2,a?l-p.y2:p.y2,p.x,a?l-p.y:p.y):p.type==="Q"?c+="Q"+i(p.x1,a?l-p.y1:p.y1,p.x,a?l-p.y:p.y):p.type==="Z"&&(c+="Z")}return c};Ae.prototype.toSVG=function(o,e){e||(e=this.toPathData(o));let i='<path d="';return i+=e,i+='"',this.fill&&this.fill!=="black"&&(this.fill===null?i+=' fill="none"':i+=' fill="'+this.fill+'"'),this.stroke&&(i+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),i+="/>",i};Ae.prototype.toDOMElement=function(o,e){e||(e=this.toPathData(o));let i=e,r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",i),r};let xs=Ae;function hr(o){throw new Error(o)}function Yi(o,e){o||hr(e)}let ne={fail:hr,argument:Yi,assert:Yi},Ki=32768,qi=2147483648,Fc=-32768,Uc=32768-1+1/65536,Qt={},K={},le={};function it(o){return function(){return o}}K.BYTE=function(o){return ne.argument(o>=0&&o<=255,"Byte value should be between 0 and 255."),[o]};le.BYTE=it(1);K.CHAR=function(o){return[o.charCodeAt(0)]};le.CHAR=it(1);K.CHARARRAY=function(o){typeof o>"u"&&(o="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));let e=[];for(let i=0;i<o.length;i+=1)e[i]=o.charCodeAt(i);return e};le.CHARARRAY=function(o){return typeof o>"u"?0:o.length};K.USHORT=function(o){return[o>>8&255,o&255]};le.USHORT=it(2);K.SHORT=function(o){return o>=Ki&&(o=-(2*Ki-o)),[o>>8&255,o&255]};le.SHORT=it(2);K.UINT24=function(o){return[o>>16&255,o>>8&255,o&255]};le.UINT24=it(3);K.ULONG=function(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]};le.ULONG=it(4);K.LONG=function(o){return o>=qi&&(o=-(2*qi-o)),[o>>24&255,o>>16&255,o>>8&255,o&255]};le.LONG=it(4);K.FLOAT=function(o){if(o>Uc||o<Fc)throw new Error(`Value ${o} is outside the range of representable values in 16.16 format`);let e=Math.round(o*65536)<<0;return K.ULONG(e)};le.FLOAT=le.ULONG;K.FIXED=K.ULONG;le.FIXED=le.ULONG;K.FWORD=K.SHORT;le.FWORD=le.SHORT;K.UFWORD=K.USHORT;le.UFWORD=le.USHORT;K.F2DOT14=function(o){return K.USHORT(o*16384)};le.F2DOT14=le.USHORT;K.LONGDATETIME=function(o){return[0,0,0,0,o>>24&255,o>>16&255,o>>8&255,o&255]};le.LONGDATETIME=it(8);K.TAG=function(o){return ne.argument(o.length===4,"Tag should be exactly 4 ASCII characters."),[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]};le.TAG=it(4);K.Card8=K.BYTE;le.Card8=le.BYTE;K.Card16=K.USHORT;le.Card16=le.USHORT;K.OffSize=K.BYTE;le.OffSize=le.BYTE;K.SID=K.USHORT;le.SID=le.USHORT;K.NUMBER=function(o){return o>=-107&&o<=107?[o+139]:o>=108&&o<=1131?(o=o-108,[(o>>8)+247,o&255]):o>=-1131&&o<=-108?(o=-o-108,[(o>>8)+251,o&255]):o>=-32768&&o<=32767?K.NUMBER16(o):K.NUMBER32(o)};le.NUMBER=function(o){return K.NUMBER(o).length};K.NUMBER16=function(o){return[28,o>>8&255,o&255]};le.NUMBER16=it(3);K.NUMBER32=function(o){return[29,o>>24&255,o>>16&255,o>>8&255,o&255]};le.NUMBER32=it(5);K.REAL=function(o){let e=o.toString(),i=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(i){let l=parseFloat("1e"+((i[2]?+i[2]:0)+i[1].length));e=(Math.round(o*l)/l).toString()}let r="";for(let l=0,c=e.length;l<c;l+=1){let h=e[l];h==="e"?r+=e[++l]==="-"?"c":"b":h==="."?r+="a":h==="-"?r+="e":r+=h}r+=r.length&1?"f":"ff";let a=[30];for(let l=0,c=r.length;l<c;l+=2)a.push(parseInt(r.substr(l,2),16));return a};le.REAL=function(o){return K.REAL(o).length};K.NAME=K.CHARARRAY;le.NAME=le.CHARARRAY;K.STRING=K.CHARARRAY;le.STRING=le.CHARARRAY;Qt.UTF8=function(o,e,i){let r=[],a=i;for(let l=0;l<a;l++,e+=1)r[l]=o.getUint8(e);return String.fromCharCode.apply(null,r)};Qt.UTF16=function(o,e,i){let r=[],a=i/2;for(let l=0;l<a;l++,e+=2)r[l]=o.getUint16(e);return String.fromCharCode.apply(null,r)};K.UTF16=function(o){let e=[];for(let i=0;i<o.length;i+=1){let r=o.charCodeAt(i);e[e.length]=r>>8&255,e[e.length]=r&255}return e};le.UTF16=function(o){return o.length*2};let An={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Qt.MACSTRING=function(o,e,i,r){let a=An[r];if(a===void 0)return;let l="";for(let c=0;c<i;c++){let h=o.getUint8(e+c);h<=127?l+=String.fromCharCode(h):l+=a[h&127]}return l};let Os=typeof WeakMap=="function"&&new WeakMap,Ds,Gc=function(o){if(!Ds){Ds={};for(let a in An)Ds[a]=new String(a)}let e=Ds[o];if(e===void 0)return;if(Os){let a=Os.get(e);if(a!==void 0)return a}let i=An[o];if(i===void 0)return;let r={};for(let a=0;a<i.length;a++)r[i.charCodeAt(a)]=a+128;return Os&&Os.set(e,r),r};K.MACSTRING=function(o,e){let i=Gc(e);if(i===void 0)return;let r=[];for(let a=0;a<o.length;a++){let l=o.charCodeAt(a);if(l>=128&&(l=i[l],l===void 0))return;r[a]=l}return r};le.MACSTRING=function(o,e){let i=K.MACSTRING(o,e);return i!==void 0?i.length:0};function _n(o){return o>=-128&&o<=127}function zc(o,e,i){let r=0,a=o.length;for(;e<a&&r<64&&o[e]===0;)++e,++r;return i.push(128|r-1),e}function Hc(o,e,i){let r=0,a=o.length,l=e;for(;l<a&&r<64;){let c=o[l];if(!_n(c)||c===0&&l+1<a&&o[l+1]===0)break;++l,++r}i.push(r-1);for(let c=e;c<l;++c)i.push(o[c]+256&255);return l}function jc(o,e,i){let r=0,a=o.length,l=e;for(;l<a&&r<64;){let c=o[l];if(c===0||_n(c)&&l+1<a&&_n(o[l+1]))break;++l,++r}i.push(64|r-1);for(let c=e;c<l;++c){let h=o[c];i.push(h+65536>>8&255,h+256&255)}return l}K.VARDELTAS=function(o){let e=0,i=[];for(;e<o.length;){let r=o[e];r===0?e=zc(o,e,i):r>=-128&&r<=127?e=Hc(o,e,i):e=jc(o,e,i)}return i};K.INDEX=function(o){let e=1,i=[e],r=[];for(let h=0;h<o.length;h+=1){let p=K.OBJECT(o[h]);Array.prototype.push.apply(r,p),e+=p.length,i.push(e)}if(r.length===0)return[0,0];let a=[],l=1+Math.floor(Math.log(e)/Math.log(2))/8|0,c=[void 0,K.BYTE,K.USHORT,K.UINT24,K.ULONG][l];for(let h=0;h<i.length;h+=1){let p=c(i[h]);Array.prototype.push.apply(a,p)}return Array.prototype.concat(K.Card16(o.length),K.OffSize(l),a,r)};le.INDEX=function(o){return K.INDEX(o).length};K.DICT=function(o){let e=[],i=Object.keys(o),r=i.length;for(let a=0;a<r;a+=1){let l=parseInt(i[a],0),c=o[l],h=K.OPERAND(c.value,c.type),p=K.OPERATOR(l);for(let u=0;u<h.length;u++)e.push(h[u]);for(let u=0;u<p.length;u++)e.push(p[u])}return e};le.DICT=function(o){return K.DICT(o).length};K.OPERATOR=function(o){return o<1200?[o]:[12,o-1200]};K.OPERAND=function(o,e){let i=[];if(Array.isArray(e))for(let r=0;r<e.length;r+=1){ne.argument(o.length===e.length,"Not enough arguments given for type"+e);let a=K.OPERAND(o[r],e[r]);for(let l=0;l<a.length;l++)i.push(a[l])}else if(e==="SID"){let r=K.NUMBER(o);for(let a=0;a<r.length;a++)i.push(r[a])}else if(e==="offset"){let r=K.NUMBER32(o);for(let a=0;a<r.length;a++)i.push(r[a])}else if(e==="number"){let r=K.NUMBER(o);for(let a=0;a<r.length;a++)i.push(r[a])}else if(e==="real"){let r=K.REAL(o);for(let a=0;a<r.length;a++)i.push(r[a])}else throw new Error("Unknown operand type "+e);return i};K.OP=K.BYTE;le.OP=le.BYTE;let Ns=typeof WeakMap=="function"&&new WeakMap;K.CHARSTRING=function(o){if(Ns){let r=Ns.get(o);if(r!==void 0)return r}let e=[],i=o.length;for(let r=0;r<i;r+=1){let a=o[r],l=K[a.type](a.value);for(let c=0;c<l.length;c++)e.push(l[c])}return Ns&&Ns.set(o,e),e};le.CHARSTRING=function(o){return K.CHARSTRING(o).length};K.OBJECT=function(o){let e=K[o.type];return ne.argument(e!==void 0,"No encoding function for type "+o.type),e(o.value)};le.OBJECT=function(o){let e=le[o.type];return ne.argument(e!==void 0,"No sizeOf function for type "+o.type),e(o.value)};K.TABLE=function(o){let e=[],i=(o.fields||[]).length,r=[],a=[];for(let l=0;l<i;l+=1){let c=o.fields[l],h=K[c.type];ne.argument(h!==void 0,"No encoding function for field type "+c.type+" ("+c.name+")");let p=o[c.name];p===void 0&&(p=c.value);let u=h(p);if(c.type==="TABLE")p.fields!==null&&(a.push(e.length),r.push(u)),e.push(0,0);else for(let d=0;d<u.length;d++)e.push(u[d])}for(let l=0;l<r.length;l+=1){let c=a[l],h=e.length;ne.argument(h<65536,"Table "+o.tableName+" too big."),e[c]=h>>8,e[c+1]=h&255;for(let p=0;p<r[l].length;p++)e.push(r[l][p])}return e};le.TABLE=function(o){let e=0,i=(o.fields||[]).length;for(let r=0;r<i;r+=1){let a=o.fields[r],l=le[a.type];ne.argument(l!==void 0,"No sizeOf function for field type "+a.type+" ("+a.name+")");let c=o[a.name];c===void 0&&(c=a.value),e+=l(c),a.type==="TABLE"&&(e+=2)}return e};K.RECORD=K.TABLE;le.RECORD=le.TABLE;K.LITERAL=function(o){return o};le.LITERAL=function(o){return o.length};function Me(o,e,i){if(e&&e.length)for(let r=0;r<e.length;r+=1){let a=e[r];this[a.name]=a.value}if(this.tableName=o,this.fields=e,i){let r=Object.keys(i);for(let a=0;a<r.length;a+=1){let l=r[a],c=i[l];this[l]!==void 0&&(this[l]=c)}}}Me.prototype.encode=function(){return K.TABLE(this)};Me.prototype.sizeOf=function(){return le.TABLE(this)};function Jt(o,e,i){i===void 0&&(i=e.length);let r=new Array(e.length+1);r[0]={name:o+"Count",type:"USHORT",value:i};for(let a=0;a<e.length;a++)r[a+1]={name:o+a,type:"USHORT",value:e[a]};return r}function Bn(o,e,i){let r=e.length,a=new Array(r+1);a[0]={name:o+"Count",type:"USHORT",value:r};for(let l=0;l<r;l++)a[l+1]={name:o+l,type:"TABLE",value:i(e[l],l)};return a}function $t(o,e,i){let r=e.length,a=[];a[0]={name:o+"Count",type:"USHORT",value:r};for(let l=0;l<r;l++)a=a.concat(i(e[l],l));return a}function Qs(o){o.format===1?Me.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Jt("glyph",o.glyphs))):o.format===2?Me.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat($t("rangeRecord",o.ranges,function(e,i){return[{name:"startGlyphID"+i,type:"USHORT",value:e.start},{name:"endGlyphID"+i,type:"USHORT",value:e.end},{name:"startCoverageIndex"+i,type:"USHORT",value:e.index}]}))):ne.assert(!1,"Coverage format must be 1 or 2.")}Qs.prototype=Object.create(Me.prototype);Qs.prototype.constructor=Qs;function Js(o){Me.call(this,"scriptListTable",$t("scriptRecord",o,function(e,i){let r=e.script,a=r.defaultLangSys;return ne.assert(!!a,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+i,type:"TAG",value:e.tag},{name:"script"+i,type:"TABLE",value:new Me("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Me("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:a.reqFeatureIndex}].concat(Jt("featureIndex",a.featureIndexes)))}].concat($t("langSys",r.langSysRecords,function(l,c){let h=l.langSys;return[{name:"langSysTag"+c,type:"TAG",value:l.tag},{name:"langSys"+c,type:"TABLE",value:new Me("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:h.reqFeatureIndex}].concat(Jt("featureIndex",h.featureIndexes)))}]})))}]}))}Js.prototype=Object.create(Me.prototype);Js.prototype.constructor=Js;function $s(o){Me.call(this,"featureListTable",$t("featureRecord",o,function(e,i){let r=e.feature;return[{name:"featureTag"+i,type:"TAG",value:e.tag},{name:"feature"+i,type:"TABLE",value:new Me("featureTable",[{name:"featureParams",type:"USHORT",value:r.featureParams}].concat(Jt("lookupListIndex",r.lookupListIndexes)))}]}))}$s.prototype=Object.create(Me.prototype);$s.prototype.constructor=$s;function en(o,e){Me.call(this,"lookupListTable",Bn("lookup",o,function(i){let r=e[i.lookupType];return ne.assert(!!r,"Unable to write GSUB lookup type "+i.lookupType+" tables."),new Me("lookupTable",[{name:"lookupType",type:"USHORT",value:i.lookupType},{name:"lookupFlag",type:"USHORT",value:i.lookupFlag}].concat(Bn("subtable",i.subtables,r)))}))}en.prototype=Object.create(Me.prototype);en.prototype.constructor=en;function tn(o){o.format===1?Me.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:o.startGlyph}].concat(Jt("glyph",o.classes))):o.format===2?Me.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat($t("rangeRecord",o.ranges,function(e,i){return[{name:"startGlyphID"+i,type:"USHORT",value:e.start},{name:"endGlyphID"+i,type:"USHORT",value:e.end},{name:"class"+i,type:"USHORT",value:e.classId}]}))):ne.assert(!1,"Class format must be 1 or 2.")}tn.prototype=Object.create(Me.prototype);tn.prototype.constructor=tn;let Z={Table:Me,Record:Me,Coverage:Qs,ClassDef:tn,ScriptList:Js,FeatureList:$s,LookupList:en,ushortList:Jt,tableList:Bn,recordList:$t};function Qi(o,e){return o.getUint8(e)}function sn(o,e){return o.getUint16(e,!1)}function Wc(o,e){return o.getInt16(e,!1)}function ur(o,e){return(o.getUint16(e)<<8)+o.getUint8(e+2)}function hi(o,e){return o.getUint32(e,!1)}function pr(o,e){let i=o.getInt16(e,!1),r=o.getUint16(e+2,!1);return i+r/65535}function Xc(o,e){let i="";for(let r=e;r<e+4;r+=1)i+=String.fromCharCode(o.getInt8(r));return i}function Zc(o,e,i){let r=0;for(let a=0;a<i;a+=1)r<<=8,r+=o.getUint8(e+a);return r}function Yc(o,e,i){let r=[];for(let a=e;a<i;a+=1)r.push(o.getUint8(a));return r}function Kc(o){let e="";for(let i=0;i<o.length;i+=1)e+=String.fromCharCode(o[i]);return e}let qc={byte:1,uShort:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},Ji={LONG_WORDS:32768,WORD_DELTA_COUNT_MASK:32767};function N(o,e){this.data=o,this.offset=e,this.relativeOffset=0}N.prototype.parseByte=function(){let o=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,o};N.prototype.parseChar=function(){let o=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,o};N.prototype.parseCard8=N.prototype.parseByte;N.prototype.parseUShort=function(){let o=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,o};N.prototype.parseCard16=N.prototype.parseUShort;N.prototype.parseSID=N.prototype.parseUShort;N.prototype.parseOffset16=N.prototype.parseUShort;N.prototype.parseShort=function(){let o=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,o};N.prototype.parseF2Dot14=function(){let o=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,o};N.prototype.parseUInt24=function(){let o=ur(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,o};N.prototype.parseULong=function(){let o=hi(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,o};N.prototype.parseOffset32=N.prototype.parseULong;N.prototype.parseFixed=function(){let o=pr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,o};N.prototype.parseString=function(o){let e=this.data,i=this.offset+this.relativeOffset,r="";this.relativeOffset+=o;for(let a=0;a<o;a++)r+=String.fromCharCode(e.getUint8(i+a));return r};N.prototype.parseTag=function(){return this.parseString(4)};N.prototype.parseLongDateTime=function(){let o=hi(this.data,this.offset+this.relativeOffset+4);return o-=2082844800,this.relativeOffset+=8,o};N.prototype.parseVersion=function(o){let e=sn(this.data,this.offset+this.relativeOffset),i=sn(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,o===void 0&&(o=4096),e+i/o/10};N.prototype.skip=function(o,e){e===void 0&&(e=1),this.relativeOffset+=qc[o]*e};N.prototype.parseULongList=function(o){o===void 0&&(o=this.parseULong());let e=new Array(o),i=this.data,r=this.offset+this.relativeOffset;for(let a=0;a<o;a++)e[a]=i.getUint32(r),r+=4;return this.relativeOffset+=o*4,e};N.prototype.parseOffset16List=N.prototype.parseUShortList=function(o){o===void 0&&(o=this.parseUShort());let e=new Array(o),i=this.data,r=this.offset+this.relativeOffset;for(let a=0;a<o;a++)e[a]=i.getUint16(r),r+=2;return this.relativeOffset+=o*2,e};N.prototype.parseShortList=function(o){let e=new Array(o),i=this.data,r=this.offset+this.relativeOffset;for(let a=0;a<o;a++)e[a]=i.getInt16(r),r+=2;return this.relativeOffset+=o*2,e};N.prototype.parseByteList=function(o){let e=new Array(o),i=this.data,r=this.offset+this.relativeOffset;for(let a=0;a<o;a++)e[a]=i.getUint8(r++);return this.relativeOffset+=o,e};N.prototype.parseList=function(o,e){e||(e=o,o=this.parseUShort());let i=new Array(o);for(let r=0;r<o;r++)i[r]=e.call(this);return i};N.prototype.parseList32=function(o,e){e||(e=o,o=this.parseULong());let i=new Array(o);for(let r=0;r<o;r++)i[r]=e.call(this);return i};N.prototype.parseRecordList=function(o,e){e||(e=o,o=this.parseUShort());let i=new Array(o),r=Object.keys(e);for(let a=0;a<o;a++){let l={};for(let c=0;c<r.length;c++){let h=r[c],p=e[h];l[h]=p.call(this)}i[a]=l}return i};N.prototype.parseRecordList32=function(o,e){e||(e=o,o=this.parseULong());let i=new Array(o),r=Object.keys(e);for(let a=0;a<o;a++){let l={};for(let c=0;c<r.length;c++){let h=r[c],p=e[h];l[h]=p.call(this)}i[a]=l}return i};N.prototype.parseStruct=function(o){if(typeof o=="function")return o.call(this);{let e=Object.keys(o),i={};for(let r=0;r<e.length;r++){let a=e[r],l=o[a];i[a]=l.call(this)}return i}};N.prototype.parseValueRecord=function(o){if(o===void 0&&(o=this.parseUShort()),o===0)return;let e={};return o&1&&(e.xPlacement=this.parseShort()),o&2&&(e.yPlacement=this.parseShort()),o&4&&(e.xAdvance=this.parseShort()),o&8&&(e.yAdvance=this.parseShort()),o&16&&(e.xPlaDevice=void 0,this.parseShort()),o&32&&(e.yPlaDevice=void 0,this.parseShort()),o&64&&(e.xAdvDevice=void 0,this.parseShort()),o&128&&(e.yAdvDevice=void 0,this.parseShort()),e};N.prototype.parseValueRecordList=function(){let o=this.parseUShort(),e=this.parseUShort(),i=new Array(e);for(let r=0;r<e;r++)i[r]=this.parseValueRecord(o);return i};N.prototype.parsePointer=function(o){let e=this.parseOffset16();if(e>0)return new N(this.data,this.offset+e).parseStruct(o)};N.prototype.parsePointer32=function(o){let e=this.parseOffset32();if(e>0)return new N(this.data,this.offset+e).parseStruct(o)};N.prototype.parseListOfLists=function(o){let e=this.parseOffset16List(),i=e.length,r=this.relativeOffset,a=new Array(i);for(let l=0;l<i;l++){let c=e[l];if(c===0){a[l]=void 0;continue}if(this.relativeOffset=c,o){let h=this.parseOffset16List(),p=new Array(h.length);for(let u=0;u<h.length;u++)this.relativeOffset=c+h[u],p[u]=o.call(this);a[l]=p}else a[l]=this.parseUShortList()}return this.relativeOffset=r,a};N.prototype.parseCoverage=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort(),i=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(i)};if(e===2){let r=new Array(i);for(let a=0;a<i;a++)r[a]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:r}}throw new Error("0x"+o.toString(16)+": Coverage format must be 1 or 2.")};N.prototype.parseClassDef=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();return e===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:e===2?{format:2,ranges:this.parseRecordList({start:N.uShort,end:N.uShort,classId:N.uShort})}:(console.warn(`0x${o.toString(16)}: This font file uses an invalid ClassDef format of ${e}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:e})};N.list=function(o,e){return function(){return this.parseList(o,e)}};N.list32=function(o,e){return function(){return this.parseList32(o,e)}};N.recordList=function(o,e){return function(){return this.parseRecordList(o,e)}};N.recordList32=function(o,e){return function(){return this.parseRecordList32(o,e)}};N.pointer=function(o){return function(){return this.parsePointer(o)}};N.pointer32=function(o){return function(){return this.parsePointer32(o)}};N.tag=N.prototype.parseTag;N.byte=N.prototype.parseByte;N.uShort=N.offset16=N.prototype.parseUShort;N.uShortList=N.prototype.parseUShortList;N.uInt24=N.prototype.parseUInt24;N.uLong=N.offset32=N.prototype.parseULong;N.uLongList=N.prototype.parseULongList;N.fixed=N.prototype.parseFixed;N.f2Dot14=N.prototype.parseF2Dot14;N.struct=N.prototype.parseStruct;N.coverage=N.prototype.parseCoverage;N.classDef=N.prototype.parseClassDef;let $i={reserved:N.uShort,reqFeatureIndex:N.uShort,featureIndexes:N.uShortList};N.prototype.parseScriptList=function(){return this.parsePointer(N.recordList({tag:N.tag,script:N.pointer({defaultLangSys:N.pointer($i),langSysRecords:N.recordList({tag:N.tag,langSys:N.pointer($i)})})}))||[]};N.prototype.parseFeatureList=function(){return this.parsePointer(N.recordList({tag:N.tag,feature:N.pointer({featureParams:N.offset16,lookupListIndexes:N.uShortList})}))||[]};N.prototype.parseLookupList=function(o){return this.parsePointer(N.list(N.pointer(function(){let e=this.parseUShort();ne.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");let i=this.parseUShort(),r=i&16;return{lookupType:e,lookupFlag:i,subtables:this.parseList(N.pointer(o[e])),markFilteringSet:r?this.parseUShort():void 0}})))||[]};N.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let o=this.parseUShort(),e=this.parseUShort();return ne.argument(o===1&&e<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:N.offset32,featureTableSubstitutionOffset:N.offset32})})||[]};N.prototype.parseVariationStore=function(){let o=this.relativeOffset,e=this.parseUShort(),i={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=o+e+2,i};N.prototype.parseItemVariationStore=function(){let o=this.relativeOffset,e={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},i=this.parseOffset32(),r=this.parseUShort(),a=this.parseULongList(r);this.relativeOffset=o+i,e.variationRegions=this.parseVariationRegionList();for(let l=0;l<r;l++){let c=a[l];this.relativeOffset=o+c,e.itemVariationSubtables.push(this.parseItemVariationSubtable())}return e};N.prototype.parseVariationRegionList=function(){let o=this.parseUShort(),e=this.parseUShort();return this.parseRecordList(e,{regionAxes:N.recordList(o,{startCoord:N.f2Dot14,peakCoord:N.f2Dot14,endCoord:N.f2Dot14})})};N.prototype.parseItemVariationSubtable=function(){let o=this.parseUShort(),e=this.parseUShort();return{regionIndexes:this.parseUShortList(),deltaSets:this.parseDeltaSets(o,e)}};N.prototype.parseDeltaSets=function(o,e){let i=[],r=e&Ji.LONG_WORDS,a=e&Ji.WORD_DELTA_COUNT_MASK,l=(r?this.parseULong:this.parseUShort).bind(this),c=(r?this.parseUShort:this.parseByte).bind(this);for(let h=0;h<o;h++){let p=h<a?l:c;i.push(p())}return i};let ee={getByte:Qi,getCard8:Qi,getUShort:sn,getCard16:sn,getShort:Wc,getUInt24:ur,getULong:hi,getFixed:pr,getTag:Xc,getOffset:Zc,getBytes:Yc,bytesToString:Kc,Parser:N};function Qc(o,e){e.parseUShort(),o.length=e.parseULong(),o.language=e.parseULong();let i;o.groupCount=i=e.parseULong(),o.glyphIndexMap={};for(let r=0;r<i;r+=1){let a=e.parseULong(),l=e.parseULong(),c=e.parseULong();for(let h=a;h<=l;h+=1)o.glyphIndexMap[h]=c,c++}}function Jc(o,e,i,r,a){o.length=e.parseUShort(),o.language=e.parseUShort();let l;o.segCount=l=e.parseUShort()>>1,e.skip("uShort",3),o.glyphIndexMap={};let c=new ee.Parser(i,r+a+14),h=new ee.Parser(i,r+a+16+l*2),p=new ee.Parser(i,r+a+16+l*4),u=new ee.Parser(i,r+a+16+l*6),d=r+a+16+l*8;for(let m=0;m<l-1;m+=1){let v,g=c.parseUShort(),x=h.parseUShort(),b=p.parseShort(),C=u.parseUShort();for(let T=x;T<=g;T+=1)C!==0?(d=u.offset+u.relativeOffset-2,d+=C,d+=(T-x)*2,v=ee.getUShort(i,d),v!==0&&(v=v+b&65535)):v=T+b&65535,o.glyphIndexMap[T]=v}}function $c(o,e){let i={};e.skip("uLong");let r=e.parseULong();for(let a=0;a<r;a+=1){let l=e.parseUInt24(),c={varSelector:l},h=e.parseOffset32(),p=e.parseOffset32(),u=e.relativeOffset;h&&(e.relativeOffset=h,c.defaultUVS=e.parseStruct({ranges:function(){return e.parseRecordList32({startUnicodeValue:e.parseUInt24,additionalCount:e.parseByte})}})),p&&(e.relativeOffset=p,c.nonDefaultUVS=e.parseStruct({uvsMappings:function(){let d={},m=e.parseRecordList32({unicodeValue:e.parseUInt24,glyphID:e.parseUShort});for(let v=0;v<m.length;v+=1)d[m[v].unicodeValue]=m[v];return d}})),i[l]=c,e.relativeOffset=u}o.varSelectorList=i}function eh(o,e){let i={};i.version=ee.getUShort(o,e),ne.argument(i.version===0,"cmap table version should be 0."),i.numTables=ee.getUShort(o,e+2);let r=null,a=-1,l=-1;for(let h=i.numTables-1;h>=0;h-=1){let p=ee.getUShort(o,e+4+h*8),u=ee.getUShort(o,e+4+h*8+2);if(p===3&&(u===0||u===1||u===10)||p===0&&(u===0||u===1||u===2||u===3||u===4)){if(l=ee.getULong(o,e+4+h*8+4),r)break}else p===0&&u===5&&(a=ee.getULong(o,e+4+h*8+4),r=new ee.Parser(o,e+a),r.parseUShort()!==14&&(a=-1,r=null))}if(l===-1)throw new Error("No valid cmap sub-tables found.");let c=new ee.Parser(o,e+l);if(i.format=c.parseUShort(),i.format===12)Qc(i,c);else if(i.format===4)Jc(i,c,o,e,l);else throw new Error("Only format 4, 12 and 14 cmap tables are supported (found format "+i.format+").");return r&&$c(i,r),i}function th(o,e,i){o.segments.push({end:e,start:e,delta:-(e-i),offset:0,glyphIndex:i})}function sh(o){o.segments.push({end:65535,start:65535,delta:1,offset:0})}function nh(o){let e=!0,i;for(i=o.length-1;i>0;i-=1)if(o.get(i).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}let r=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:12+8}];e||(r=r.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),r=r.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);let a=new Z.Table("cmap",r);for(a.segments=[],i=0;i<o.length;i+=1){let g=o.get(i);for(let x=0;x<g.unicodes.length;x+=1)th(a,g.unicodes[x],i);a.segments=a.segments.sort(function(x,b){return x.start-b.start})}sh(a);let l=a.segments.length,c=0,h=[],p=[],u=[],d=[],m=[],v=[];for(i=0;i<l;i+=1){let g=a.segments[i];g.end<=65535&&g.start<=65535?(h=h.concat({name:"end_"+i,type:"USHORT",value:g.end}),p=p.concat({name:"start_"+i,type:"USHORT",value:g.start}),u=u.concat({name:"idDelta_"+i,type:"SHORT",value:g.delta}),d=d.concat({name:"idRangeOffset_"+i,type:"USHORT",value:g.offset}),g.glyphId!==void 0&&(m=m.concat({name:"glyph_"+i,type:"USHORT",value:g.glyphId}))):c+=1,!e&&g.glyphIndex!==void 0&&(v=v.concat({name:"cmap12Start_"+i,type:"ULONG",value:g.start}),v=v.concat({name:"cmap12End_"+i,type:"ULONG",value:g.end}),v=v.concat({name:"cmap12Glyph_"+i,type:"ULONG",value:g.glyphIndex}))}if(a.segCountX2=(l-c)*2,a.searchRange=Math.pow(2,Math.floor(Math.log(l-c)/Math.log(2)))*2,a.entrySelector=Math.log(a.searchRange/2)/Math.log(2),a.rangeShift=a.segCountX2-a.searchRange,a.fields=a.fields.concat(h),a.fields.push({name:"reservedPad",type:"USHORT",value:0}),a.fields=a.fields.concat(p),a.fields=a.fields.concat(u),a.fields=a.fields.concat(d),a.fields=a.fields.concat(m),a.cmap4Length=14+h.length*2+2+p.length*2+u.length*2+d.length*2+m.length*2,!e){let g=16+v.length*4;a.cmap12Offset=12+2*2+4+a.cmap4Length,a.fields=a.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:g},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:v.length/3}]),a.fields=a.fields.concat(v)}return a}let dr={parse:eh,make:nh},zs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],ih=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],oh=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Vt=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function fr(o){this.font=o}fr.prototype.charToGlyphIndex=function(o){let e=o.codePointAt(0),i=this.font.glyphs;if(i)for(let r=0;r<i.length;r+=1){let a=i.get(r);for(let l=0;l<a.unicodes.length;l+=1)if(a.unicodes[l]===e)return r}return null};function mr(o){this.cmap=o}mr.prototype.charToGlyphIndex=function(o){return this.cmap.glyphIndexMap[o.codePointAt(0)]||0};function nn(o,e){this.encoding=o,this.charset=e}nn.prototype.charToGlyphIndex=function(o){let e=o.codePointAt(0),i=this.encoding[e];return this.charset.indexOf(i)};function ui(o){switch(o.version){case 1:this.names=Vt.slice();break;case 2:this.names=new Array(o.numberOfGlyphs);for(let e=0;e<o.numberOfGlyphs;e++)o.glyphNameIndex[e]<Vt.length?this.names[e]=Vt[o.glyphNameIndex[e]]:this.names[e]=o.names[o.glyphNameIndex[e]-Vt.length];break;case 2.5:this.names=new Array(o.numberOfGlyphs);for(let e=0;e<o.numberOfGlyphs;e++)this.names[e]=Vt[e+o.glyphNameIndex[e]];break;case 3:this.names=[];break;default:this.names=[];break}}ui.prototype.nameToGlyphIndex=function(o){return this.names.indexOf(o)};ui.prototype.glyphIndexToName=function(o){return this.names[o]};function rh(o){let e,i=o.tables.cmap.glyphIndexMap,r=Object.keys(i);for(let a=0;a<r.length;a+=1){let l=r[a],c=i[l];e=o.glyphs.get(c),e.addUnicode(parseInt(l))}for(let a=0;a<o.glyphs.length;a+=1)e=o.glyphs.get(a),o.cffEncoding?o.isCIDFont?e.name="gid"+a:e.name=o.cffEncoding.charset[a]:o.glyphNames.names&&(e.name=o.glyphNames.glyphIndexToName(a))}function ah(o){o._IndexToUnicodeMap={};let e=o.tables.cmap.glyphIndexMap,i=Object.keys(e);for(let r=0;r<i.length;r+=1){let a=i[r],l=e[a];o._IndexToUnicodeMap[l]===void 0?o._IndexToUnicodeMap[l]={unicodes:[parseInt(a)]}:o._IndexToUnicodeMap[l].unicodes.push(parseInt(a))}}function lh(o,e){e.lowMemory?ah(o):rh(o)}function ch(o,e,i,r,a){o.beginPath(),o.moveTo(e,i),o.lineTo(r,a),o.stroke()}let Dt={line:ch};function hh(o,e){let i=e||new xs;return{configurable:!0,get:function(){return typeof i=="function"&&(i=i()),i},set:function(r){i=r}}}function je(o){this.bindConstructorValues(o)}je.prototype.bindConstructorValues=function(o){if(this.index=o.index||0,o.name===".notdef"?o.unicode=void 0:o.name===".null"&&(o.unicode=0),o.unicode===0&&o.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=o.name||null,this.unicode=o.unicode,this.unicodes=o.unicodes||(o.unicode!==void 0?[o.unicode]:[]),"xMin"in o&&(this.xMin=o.xMin),"yMin"in o&&(this.yMin=o.yMin),"xMax"in o&&(this.xMax=o.xMax),"yMax"in o&&(this.yMax=o.yMax),"advanceWidth"in o&&(this.advanceWidth=o.advanceWidth),"leftSideBearing"in o&&(this.leftSideBearing=o.leftSideBearing),Object.defineProperty(this,"path",hh(this,o.path))};je.prototype.addUnicode=function(o){this.unicodes.length===0&&(this.unicode=o),this.unicodes.push(o)};je.prototype.getBoundingBox=function(){return this.path.getBoundingBox()};je.prototype.getPath=function(o,e,i,r,a){o=o!==void 0?o:0,e=e!==void 0?e:0,i=i!==void 0?i:72;let l,c;r||(r={});let h=r.xScale,p=r.yScale;if(r.hinting&&a&&a.hinting&&(c=this.path&&a.hinting.exec(this,i)),c)l=a.hinting.getCommands(c),o=Math.round(o),e=Math.round(e),h=p=1;else{l=this.path.commands;let d=1/(this.path.unitsPerEm||1e3)*i;h===void 0&&(h=d),p===void 0&&(p=d)}let u=new xs;for(let d=0;d<l.length;d+=1){let m=l[d];m.type==="M"?u.moveTo(o+m.x*h,e+-m.y*p):m.type==="L"?u.lineTo(o+m.x*h,e+-m.y*p):m.type==="Q"?u.quadraticCurveTo(o+m.x1*h,e+-m.y1*p,o+m.x*h,e+-m.y*p):m.type==="C"?u.curveTo(o+m.x1*h,e+-m.y1*p,o+m.x2*h,e+-m.y2*p,o+m.x*h,e+-m.y*p):m.type==="Z"&&u.closePath()}return u};je.prototype.getContours=function(){if(this.points===void 0)return[];let o=[],e=[];for(let i=0;i<this.points.length;i+=1){let r=this.points[i];e.push(r),r.lastPointOfContour&&(o.push(e),e=[])}return ne.argument(e.length===0,"There are still points left in the current contour."),o};je.prototype.getMetrics=function(){let o=this.path.commands,e=[],i=[];for(let a=0;a<o.length;a+=1){let l=o[a];l.type!=="Z"&&(e.push(l.x),i.push(l.y)),(l.type==="Q"||l.type==="C")&&(e.push(l.x1),i.push(l.y1)),l.type==="C"&&(e.push(l.x2),i.push(l.y2))}let r={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,i),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,i),leftSideBearing:this.leftSideBearing};return isFinite(r.xMin)||(r.xMin=0),isFinite(r.xMax)||(r.xMax=this.advanceWidth),isFinite(r.yMin)||(r.yMin=0),isFinite(r.yMax)||(r.yMax=0),r.rightSideBearing=this.advanceWidth-r.leftSideBearing-(r.xMax-r.xMin),r};je.prototype.draw=function(o,e,i,r,a){this.getPath(e,i,r,a).draw(o)};je.prototype.drawPoints=function(o,e,i,r){function a(u,d,m,v){o.beginPath();for(let g=0;g<u.length;g+=1)o.moveTo(d+u[g].x*v,m+u[g].y*v),o.arc(d+u[g].x*v,m+u[g].y*v,2,0,Math.PI*2,!1);o.closePath(),o.fill()}e=e!==void 0?e:0,i=i!==void 0?i:0,r=r!==void 0?r:24;let l=1/this.path.unitsPerEm*r,c=[],h=[],p=this.path;for(let u=0;u<p.commands.length;u+=1){let d=p.commands[u];d.x!==void 0&&c.push({x:d.x,y:-d.y}),d.x1!==void 0&&h.push({x:d.x1,y:-d.y1}),d.x2!==void 0&&h.push({x:d.x2,y:-d.y2})}o.fillStyle="blue",a(c,e,i,l),o.fillStyle="red",a(h,e,i,l)};je.prototype.drawMetrics=function(o,e,i,r){let a;e=e!==void 0?e:0,i=i!==void 0?i:0,r=r!==void 0?r:24,a=1/this.path.unitsPerEm*r,o.lineWidth=1,o.strokeStyle="black",Dt.line(o,e,-1e4,e,1e4),Dt.line(o,-1e4,i,1e4,i);let l=this.xMin||0,c=this.yMin||0,h=this.xMax||0,p=this.yMax||0,u=this.advanceWidth||0;o.strokeStyle="blue",Dt.line(o,e+l*a,-1e4,e+l*a,1e4),Dt.line(o,e+h*a,-1e4,e+h*a,1e4),Dt.line(o,-1e4,i+-c*a,1e4,i+-c*a),Dt.line(o,-1e4,i+-p*a,1e4,i+-p*a),o.strokeStyle="green",Dt.line(o,e+u*a,-1e4,e+u*a,1e4)};je.prototype.toPathData=function(o){return this.path.toPathData(o)};je.prototype.fromSVG=function(o,e={}){return this.path.fromSVG(o,e)};je.prototype.toSVG=function(o){return this.path.toSVG(o,this.toPathData.apply(this,[o]))};je.prototype.toDOMElement=function(o){return this.path.toDOMElement(o)};let pi=je;function Ps(o,e,i){Object.defineProperty(o,e,{get:function(){return o.path,o[i]},set:function(r){o[i]=r},enumerable:!0,configurable:!0})}function di(o,e){if(this.font=o,this.glyphs={},Array.isArray(e))for(let i=0;i<e.length;i++){let r=e[i];r.path.unitsPerEm=o.unitsPerEm,this.glyphs[i]=r}this.length=e&&e.length||0}di.prototype.get=function(o){if(this.glyphs[o]===void 0){this.font._push(o),typeof this.glyphs[o]=="function"&&(this.glyphs[o]=this.glyphs[o]());let e=this.glyphs[o],i=this.font._IndexToUnicodeMap[o];if(i)for(let r=0;r<i.unicodes.length;r++)e.addUnicode(i.unicodes[r]);this.font.cffEncoding?this.font.isCIDFont?e.name="gid"+o:e.name=this.font.cffEncoding.charset[o]:this.font.glyphNames.names&&(e.name=this.font.glyphNames.glyphIndexToName(o)),this.glyphs[o].advanceWidth=this.font._hmtxTableData[o].advanceWidth,this.glyphs[o].leftSideBearing=this.font._hmtxTableData[o].leftSideBearing}else typeof this.glyphs[o]=="function"&&(this.glyphs[o]=this.glyphs[o]());return this.glyphs[o]};di.prototype.push=function(o,e){this.glyphs[o]=e,this.length++};function uh(o,e){return new pi({index:e,font:o})}function ph(o,e,i,r,a,l){return function(){let c=new pi({index:e,font:o});return c.path=function(){i(c,r,a);let h=l(o.glyphs,c);return h.unitsPerEm=o.unitsPerEm,h},Ps(c,"xMin","_xMin"),Ps(c,"xMax","_xMax"),Ps(c,"yMin","_yMin"),Ps(c,"yMax","_yMax"),c}}function dh(o,e,i,r,a){return function(){let l=new pi({index:e,font:o});return l.path=function(){let c=i(o,l,r,a);return c.unitsPerEm=o.unitsPerEm,c},l}}let pt={GlyphSet:di,glyphLoader:uh,ttfGlyphLoader:ph,cffGlyphLoader:dh};function gr(o,e){if(o===e)return!0;if(Array.isArray(o)&&Array.isArray(e)){if(o.length!==e.length)return!1;for(let i=0;i<o.length;i+=1)if(!gr(o[i],e[i]))return!1;return!0}else return!1}function on(o){let e;return o.length<1240?e=107:o.length<33900?e=1131:e=32768,e}function lt(o,e,i,r){let a=[],l=[],c=r>1?ee.getULong(o,e):ee.getCard16(o,e),h=r>1?4:2,p,u;if(c!==0){let d=ee.getByte(o,e+h);p=e+(c+1)*d+h;let m=e+h+1;for(let v=0;v<c+1;v+=1)a.push(ee.getOffset(o,m,d)),m+=d;u=p+a[c]}else u=e+h;for(let d=0;d<a.length-1;d+=1){let m=ee.getBytes(o,p+a[d],p+a[d+1]);i&&(m=i(m,o,e,r)),l.push(m)}return{objects:l,startOffset:e,endOffset:u}}function fh(o,e,i){let r=[],a=i>1?ee.getULong(o,e):ee.getCard16(o,e),l=i>1?4:2,c,h;if(a!==0){let p=ee.getByte(o,e+l);c=e+(a+1)*p+l;let u=e+l+1;for(let d=0;d<a+1;d+=1)r.push(ee.getOffset(o,u,p)),u+=p;h=c+r[a]}else h=e+l;return{offsets:r,startOffset:e,endOffset:h}}function mh(o,e,i,r,a,l){let c=l>1?ee.getULong(i,r):ee.getCard16(i,r),h=l>1?4:2,p=0;if(c!==0){let d=ee.getByte(i,r+h);p=r+(c+1)*d+h}let u=ee.getBytes(i,p+e[o],p+e[o+1]);return a&&(u=a(u)),u}function gh(o){let e="",i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let r=o.parseByte(),a=r>>4,l=r&15;if(a===15||(e+=i[a],l===15))break;e+=i[l]}return parseFloat(e)}function yh(o,e){let i,r,a,l;if(e===28)return i=o.parseByte(),r=o.parseByte(),i<<8|r;if(e===29)return i=o.parseByte(),r=o.parseByte(),a=o.parseByte(),l=o.parseByte(),i<<24|r<<16|a<<8|l;if(e===30)return gh(o);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return i=o.parseByte(),(e-247)*256+i+108;if(e>=251&&e<=254)return i=o.parseByte(),-(e-251)*256-i-108;throw new Error("Invalid b0 "+e)}function vh(o){let e={};for(let i=0;i<o.length;i+=1){let r=o[i][0],a=o[i][1],l;if(a.length===1?l=a[0]:l=a,Object.prototype.hasOwnProperty.call(e,r)&&!isNaN(e[r]))throw new Error("Object "+e+" already has key "+r);e[r]=l}return e}function fi(o,e,i,r){e=e!==void 0?e:0;let a=new ee.Parser(o,e),l=[],c=[];i=i!==void 0?i:o.byteLength;let h=r<2?22:28;for(;a.relativeOffset<i;){let p=a.parseByte();if(p<h){if(p===12&&(p=1200+a.parseByte()),r>1&&p===23){Lh(c);continue}l.push([p,c]),c=[]}else c.push(yh(a,p))}return vh(l)}function ds(o,e){return e<=390?e=zs[e]:o?e=o[e-391]:e=void 0,e}function mi(o,e,i){let r={},a;for(let l=0;l<e.length;l+=1){let c=e[l];if(Array.isArray(c.type)){let h=[];h.length=c.type.length;for(let p=0;p<c.type.length;p++)a=o[c.op]!==void 0?o[c.op][p]:void 0,a===void 0&&(a=c.value!==void 0&&c.value[p]!==void 0?c.value[p]:null),c.type[p]==="SID"&&(a=ds(i,a)),h[p]=a;r[c.name]=h}else a=o[c.op],a===void 0&&(a=c.value!==void 0?c.value:null),c.type==="SID"&&(a=ds(i,a)),r[c.name]=a}return r}function bh(o,e){let i={};if(i.formatMajor=ee.getCard8(o,e),i.formatMinor=ee.getCard8(o,e+1),i.formatMajor>2)throw new Error(`Unsupported CFF table version ${i.formatMajor}.${i.formatMinor}`);return i.size=ee.getCard8(o,e+2),i.formatMajor<2?(i.offsetSize=ee.getCard8(o,e+3),i.startOffset=e,i.endOffset=e+4):(i.topDictLength=ee.getCard16(o,e+3),i.endOffset=e+8),i}let yr=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],vr=[{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"charStrings",op:17,type:"offset"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"vstore",op:24,type:"offset"}],br=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],xr=[{name:"blueValues",op:6,type:"delta"},{name:"otherBlues",op:7,type:"delta"},{name:"familyBlues",op:7,type:"delta"},{name:"familyBlues",op:8,type:"delta"},{name:"familyOtherBlues",op:9,type:"delta"},{name:"blueScale",op:1209,type:"number",value:.039625},{name:"blueShift",op:1210,type:"number",value:7},{name:"blueFuzz",op:1211,type:"number",value:1},{name:"stdHW",op:10,type:"number"},{name:"stdVW",op:11,type:"number"},{name:"stemSnapH",op:1212,type:"number"},{name:"stemSnapV",op:1213,type:"number"},{name:"languageGroup",op:1217,type:"number",value:0},{name:"expansionFactor",op:1218,type:"number",value:.06},{name:"vsindex",op:22,type:"number",value:0},{name:"subrs",op:19,type:"offset"}],xh=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function Ch(o,e,i,r){let a=fi(o,e,o.byteLength,r);return mi(a,r>1?vr:yr,i)}function gi(o,e,i,r,a){let l=fi(o,e,i,a);return mi(l,a>1?xr:br,r)}function wh(o,e,i){let r=fi(o,e,void 0,i);return mi(r,xh)}function Eh(o,e,i){let r=[];for(let a=0;a<i.length;a++){let l=new DataView(new Uint8Array(i[a]).buffer),c=wh(l,0,2),h=c.private[0],p=c.private[1];if(h!==0&&p!==0){let u=gi(o,p+e,h,[],2);if(u.subrs){let d=p+u.subrs,m=lt(o,d+e,void 0,2);c._subrs=m.objects,c._subrsBias=on(c._subrs)}c._privateDict=u}r.push(c)}return r}function vn(o,e,i,r,a){let l=[];for(let c=0;c<i.length;c+=1){let h=new DataView(new Uint8Array(i[c]).buffer),p=Ch(h,0,r,a);p._subrs=[],p._subrsBias=0,p._defaultWidthX=0,p._nominalWidthX=0;let u=a<2?p.private[0]:0,d=a<2?p.private[1]:0;if(u!==0&&d!==0){let m=gi(o,d+e,u,r,a);if(p._defaultWidthX=m.defaultWidthX,p._nominalWidthX=m.nominalWidthX,m.subrs!==0){let v=d+m.subrs,g=lt(o,v+e,void 0,a);p._subrs=g.objects,p._subrsBias=on(p._subrs)}p._privateDict=m}l.push(p)}return l}function Sh(o,e,i,r){let a,l,c=new ee.Parser(o,e);i-=1;let h=[".notdef"],p=c.parseCard8();if(p===0)for(let u=0;u<i;u+=1)a=c.parseSID(),h.push(ds(r,a)||a);else if(p===1)for(;h.length<=i;){a=c.parseSID(),l=c.parseCard8();for(let u=0;u<=l;u+=1)h.push(ds(r,a)||a),a+=1}else if(p===2)for(;h.length<=i;){a=c.parseSID(),l=c.parseCard16();for(let u=0;u<=l;u+=1)h.push(ds(r,a)||a),a+=1}else throw new Error("Unknown charset format "+p);return h}function Th(o,e,i){let r,a={},l=new ee.Parser(o,e),c=l.parseCard8();if(c===0){let h=l.parseCard8();for(let p=0;p<h;p+=1)r=l.parseCard8(),a[r]=p}else if(c===1){let h=l.parseCard8();r=1;for(let p=0;p<h;p+=1){let u=l.parseCard8(),d=l.parseCard8();for(let m=u;m<=u+d;m+=1)a[m]=r,r+=1}}else throw new Error("Unknown encoding format "+c);return new nn(a,i)}function Lh(o){let e=o.pop();for(;o.length>e;)o.pop()}function eo(o,e,i,r){let a,l,c,h,p=new xs,u=[],d=0,m=!1,v=!1,g=0,x=0,b,C,T,A,O=0,P=[],V=o.tables.cff2||o.tables.cff;if(T=V.topDict._defaultWidthX,A=V.topDict._nominalWidthX,o.isCIDFont||r>1){let j=V.topDict._fdSelect?V.topDict._fdSelect[e.index]:0,z=V.topDict._fdArray[j];b=z._subrs,C=z._subrsBias,r>1?(P=V.topDict._vstore.itemVariationStore.itemVariationSubtables,O=z._privateDict.vsindex):(T=z._defaultWidthX,A=z._nominalWidthX)}else b=V.topDict._subrs,C=V.topDict._subrsBias;let R=T;function I(j,z){v&&p.closePath(),p.moveTo(j,z),v=!0}function G(){let j;j=(u.length&1)!==0,j&&!m&&(R=u.shift()+A),d+=u.length>>1,u.length=0,m=!0}function X(j){let z,J,Q,de,ie,me,W,$,q,ae,ce,te,ue=0;for(;ue<j.length;){let fe=j[ue];switch(ue+=1,fe){case 1:G();break;case 3:G();break;case 4:u.length>1&&!m&&(R=u.shift()+A,m=!0),x+=u.pop(),I(g,x);break;case 5:for(;u.length>0;)g+=u.shift(),x+=u.shift(),p.lineTo(g,x);break;case 6:for(;u.length>0&&(g+=u.shift(),p.lineTo(g,x),u.length!==0);)x+=u.shift(),p.lineTo(g,x);break;case 7:for(;u.length>0&&(x+=u.shift(),p.lineTo(g,x),u.length!==0);)g+=u.shift(),p.lineTo(g,x);break;case 8:for(;u.length>0;)a=g+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),g=c+u.shift(),x=h+u.shift(),p.curveTo(a,l,c,h,g,x);break;case 10:ie=u.pop()+C,me=b[ie],me&&X(me);break;case 11:if(r>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(fe=j[ue],ue+=1,fe){case 35:a=g+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),W=c+u.shift(),$=h+u.shift(),q=W+u.shift(),ae=$+u.shift(),ce=q+u.shift(),te=ae+u.shift(),g=ce+u.shift(),x=te+u.shift(),u.shift(),p.curveTo(a,l,c,h,W,$),p.curveTo(q,ae,ce,te,g,x);break;case 34:a=g+u.shift(),l=x,c=a+u.shift(),h=l+u.shift(),W=c+u.shift(),$=h,q=W+u.shift(),ae=h,ce=q+u.shift(),te=x,g=ce+u.shift(),p.curveTo(a,l,c,h,W,$),p.curveTo(q,ae,ce,te,g,x);break;case 36:a=g+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),W=c+u.shift(),$=h,q=W+u.shift(),ae=h,ce=q+u.shift(),te=ae+u.shift(),g=ce+u.shift(),p.curveTo(a,l,c,h,W,$),p.curveTo(q,ae,ce,te,g,x);break;case 37:a=g+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),W=c+u.shift(),$=h+u.shift(),q=W+u.shift(),ae=$+u.shift(),ce=q+u.shift(),te=ae+u.shift(),Math.abs(ce-g)>Math.abs(te-x)?g=ce+u.shift():x=te+u.shift(),p.curveTo(a,l,c,h,W,$),p.curveTo(q,ae,ce,te,g,x);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+fe),u.length=0}break;case 14:if(r>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}u.length>0&&!m&&(R=u.shift()+A,m=!0),v&&(p.closePath(),v=!1);break;case 15:if(r<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}O=u.pop();break;case 16:if(r<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}let _e=P[O],w=u.pop(),E=w*_e.regionIndexes.length,M=u.length-E,S=M-w;for(let k=0;k<w;k++){let D=u[S+k];for(let B=0;B<w.length;B++)D+=1*u[M++];u[S+k]=D}for(;E--;)u.pop();break;case 18:G();break;case 19:case 20:G(),ue+=d+7>>3;break;case 21:u.length>2&&!m&&(R=u.shift()+A,m=!0),x+=u.pop(),g+=u.pop(),I(g,x);break;case 22:u.length>1&&!m&&(R=u.shift()+A,m=!0),g+=u.pop(),I(g,x);break;case 23:G();break;case 24:for(;u.length>2;)a=g+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),g=c+u.shift(),x=h+u.shift(),p.curveTo(a,l,c,h,g,x);g+=u.shift(),x+=u.shift(),p.lineTo(g,x);break;case 25:for(;u.length>6;)g+=u.shift(),x+=u.shift(),p.lineTo(g,x);a=g+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),g=c+u.shift(),x=h+u.shift(),p.curveTo(a,l,c,h,g,x);break;case 26:for(u.length&1&&(g+=u.shift());u.length>0;)a=g,l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),g=c,x=h+u.shift(),p.curveTo(a,l,c,h,g,x);break;case 27:for(u.length&1&&(x+=u.shift());u.length>0;)a=g+u.shift(),l=x,c=a+u.shift(),h=l+u.shift(),g=c+u.shift(),x=h,p.curveTo(a,l,c,h,g,x);break;case 28:z=j[ue],J=j[ue+1],u.push((z<<24|J<<16)>>16),ue+=2;break;case 29:ie=u.pop()+o.gsubrsBias,me=o.gsubrs[ie],me&&X(me);break;case 30:for(;u.length>0&&(a=g,l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),g=c+u.shift(),x=h+(u.length===1?u.shift():0),p.curveTo(a,l,c,h,g,x),u.length!==0);)a=g+u.shift(),l=x,c=a+u.shift(),h=l+u.shift(),x=h+u.shift(),g=c+(u.length===1?u.shift():0),p.curveTo(a,l,c,h,g,x);break;case 31:for(;u.length>0&&(a=g+u.shift(),l=x,c=a+u.shift(),h=l+u.shift(),x=h+u.shift(),g=c+(u.length===1?u.shift():0),p.curveTo(a,l,c,h,g,x),u.length!==0);)a=g,l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),g=c+u.shift(),x=h+(u.length===1?u.shift():0),p.curveTo(a,l,c,h,g,x);break;default:fe<32?console.log("Glyph "+e.index+": unknown operator "+fe):fe<247?u.push(fe-139):fe<251?(z=j[ue],ue+=1,u.push((fe-247)*256+z+108)):fe<255?(z=j[ue],ue+=1,u.push(-(fe-251)*256-z-108)):(z=j[ue],J=j[ue+1],Q=j[ue+2],de=j[ue+3],ue+=4,u.push((z<<24|J<<16|Q<<8|de)/65536))}}}return X(i),m&&(e.advanceWidth=R),p}function to(o,e,i,r,a){let l=[],c,h=new ee.Parser(o,e),p=h.parseCard8();if(p===0)for(let u=0;u<i;u++){if(c=h.parseCard8(),c>=r)throw new Error("CFF table CID Font FDSelect has bad FD index value "+c+" (FD count "+r+")");l.push(c)}else if(p===3||a>1&&p===4){let u=p===4?h.parseULong():h.parseCard16(),d=p===4?h.parseULong():h.parseCard16();if(d!==0)throw new Error(`CFF Table CID Font FDSelect format ${p} range has bad initial GID ${d}`);let m;for(let v=0;v<u;v++){if(c=p===4?h.parseUShort():h.parseCard8(),m=p===4?h.parseULong():h.parseCard16(),c>=r)throw new Error("CFF table CID Font FDSelect has bad FD index value "+c+" (FD count "+r+")");if(m>i)throw new Error(`CFF Table CID Font FDSelect format ${a} range has bad GID ${m}`);for(;d<m;d++)l.push(c);d=m}if(m!==i)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+m)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+p);return l}function kh(o,e,i,r){let a,l=bh(o,e);l.formatMajor===2?a=i.tables.cff2={}:a=i.tables.cff={};let c=l.formatMajor>1?null:lt(o,l.endOffset,ee.bytesToString),h=l.formatMajor>1?null:lt(o,c.endOffset),p=l.formatMajor>1?null:lt(o,h.endOffset,ee.bytesToString),u=lt(o,l.formatMajor>1?e+l.size+l.topDictLength:p.endOffset,void 0,l.formatMajor);i.gsubrs=u.objects,i.gsubrsBias=on(i.gsubrs);let d;if(l.formatMajor>1){let v=e+l.size,g=ee.getBytes(o,v,v+l.topDictLength);d=vn(o,0,[g],void 0,l.formatMajor)[0]}else{let v=vn(o,e,h.objects,p.objects,l.formatMajor);if(v.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+v.length);d=v[0]}if(a.topDict=d,d._privateDict&&(i.defaultWidthX=d._privateDict.defaultWidthX,i.nominalWidthX=d._privateDict.nominalWidthX),l.formatMajor<2&&d.ros[0]!==void 0&&d.ros[1]!==void 0&&(i.isCIDFont=!0),l.formatMajor>1){let v=d.fdArray,g=d.fdSelect;if(!v)throw new Error("This is a CFF2 font, but FDArray information is missing");let x=lt(o,e+v,null,l.formatMajor),b=Eh(o,e,x.objects);d._fdArray=b,g&&(d._fdSelect=to(o,e+g,i.numGlyphs,b.length,l.formatMajor))}else if(i.isCIDFont){let v=d.fdArray,g=d.fdSelect;if(v===0||g===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");v+=e;let x=lt(o,v),b=vn(o,e,x.objects,p.objects,l.formatMajor);d._fdArray=b,g+=e,d._fdSelect=to(o,g,i.numGlyphs,b.length,l.formatMajor)}if(l.formatMajor<2){let v=e+d.private[1],g=gi(o,v,d.private[0],p.objects,l.formatMajor);if(i.defaultWidthX=g.defaultWidthX,i.nominalWidthX=g.nominalWidthX,g.subrs!==0){let x=v+g.subrs,b=lt(o,x);i.subrs=b.objects,i.subrsBias=on(i.subrs)}else i.subrs=[],i.subrsBias=0}let m;if(r.lowMemory?(m=fh(o,e+d.charStrings,l.formatMajor),i.nGlyphs=m.offsets.length-(l.formatMajor>1?1:0)):(m=lt(o,e+d.charStrings,null,l.formatMajor),i.nGlyphs=m.objects.length),l.formatMajor>1&&i.tables.maxp&&i.nGlyphs!==i.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${i.nGlyphs}) must correspond to the glyph count in the maxp table (${i.tables.maxp.numGlyphs})`),l.formatMajor<2){let v=Sh(o,e+d.charset,i.nGlyphs,p.objects);d.encoding===0?i.cffEncoding=new nn(ih,v):d.encoding===1?i.cffEncoding=new nn(oh,v):i.cffEncoding=Th(o,e+d.encoding,v),i.encoding=i.encoding||i.cffEncoding}if(i.glyphs=new pt.GlyphSet(i),r.lowMemory)i._push=function(v){let g=mh(v,m.offsets,o,e+d.charStrings,void 0,l.formatMajor);i.glyphs.push(v,pt.cffGlyphLoader(i,v,eo,g,l.formatMajor))};else for(let v=0;v<i.nGlyphs;v+=1){let g=m.objects[v];i.glyphs.push(v,pt.cffGlyphLoader(i,v,eo,g,l.formatMajor))}if(d.vstore){let v=new ee.Parser(o,e+d.vstore);d._vstore=v.parseVariationStore()}}function Cr(o,e){let i,r=zs.indexOf(o);return r>=0&&(i=r),r=e.indexOf(o),r>=0?i=r+zs.length:(i=zs.length+e.length,e.push(o)),i}function Mh(){return new Z.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Ih(o){let e=new Z.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(let i=0;i<o.length;i+=1)e.names.push({name:"name_"+i,type:"NAME",value:o[i]});return e}function wr(o,e,i){let r={};for(let a=0;a<o.length;a+=1){let l=o[a],c=e[l.name];c!==void 0&&!gr(c,l.value)&&(l.type==="SID"&&(c=Cr(c,i)),r[l.op]={name:l.name,type:l.type,value:c})}return r}function so(o,e,i){let r=new Z.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=wr(i>1?vr:yr,o,e),r}function no(o){let e=new Z.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:o}],e}function Ah(o){let e=new Z.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(let i=0;i<o.length;i+=1)e.strings.push({name:"string_"+i,type:"STRING",value:o[i]});return e}function _h(){return new Z.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Bh(o,e){let i=new Z.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let r=0;r<o.length;r+=1){let a=o[r],l=Cr(a,e);i.fields.push({name:"glyph_"+r,type:"SID",value:l})}return i}function Rh(o,e){let i=[],r=o.path;e<2&&i.push({name:"width",type:"NUMBER",value:o.advanceWidth});let a=0,l=0;for(let c=0;c<r.commands.length;c+=1){let h,p,u=r.commands[c];if(u.type==="Q"){let d=.3333333333333333,m=2/3;u={type:"C",x:u.x,y:u.y,x1:Math.round(d*a+m*u.x1),y1:Math.round(d*l+m*u.y1),x2:Math.round(d*u.x+m*u.x1),y2:Math.round(d*u.y+m*u.y1)}}if(u.type==="M")h=Math.round(u.x-a),p=Math.round(u.y-l),i.push({name:"dx",type:"NUMBER",value:h}),i.push({name:"dy",type:"NUMBER",value:p}),i.push({name:"rmoveto",type:"OP",value:21}),a=Math.round(u.x),l=Math.round(u.y);else if(u.type==="L")h=Math.round(u.x-a),p=Math.round(u.y-l),i.push({name:"dx",type:"NUMBER",value:h}),i.push({name:"dy",type:"NUMBER",value:p}),i.push({name:"rlineto",type:"OP",value:5}),a=Math.round(u.x),l=Math.round(u.y);else if(u.type==="C"){let d=Math.round(u.x1-a),m=Math.round(u.y1-l),v=Math.round(u.x2-u.x1),g=Math.round(u.y2-u.y1);h=Math.round(u.x-u.x2),p=Math.round(u.y-u.y2),i.push({name:"dx1",type:"NUMBER",value:d}),i.push({name:"dy1",type:"NUMBER",value:m}),i.push({name:"dx2",type:"NUMBER",value:v}),i.push({name:"dy2",type:"NUMBER",value:g}),i.push({name:"dx",type:"NUMBER",value:h}),i.push({name:"dy",type:"NUMBER",value:p}),i.push({name:"rrcurveto",type:"OP",value:8}),a=Math.round(u.x),l=Math.round(u.y)}}return e<2&&i.push({name:"endchar",type:"OP",value:14}),i}function Oh(o,e){let i=new Z.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let r=0;r<o.length;r+=1){let a=o.get(r),l=Rh(a,e);i.charStrings.push({name:a.name,type:"CHARSTRING",value:l})}return i}function Dh(o,e,i){let r=new Z.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=wr(i>1?xr:br,o,e),r}function Nh(o,e){let i=new Z.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),r=1/e.unitsPerEm,a={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[r,0,0,r,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},l={},c=[],h;for(let m=1;m<o.length;m+=1)h=o.get(m),c.push(h.name);let p=[];i.header=Mh(),i.nameIndex=Ih([e.postScriptName]);let u=so(a,p);i.topDictIndex=no(u),i.globalSubrIndex=_h(),i.charsets=Bh(c,p),i.charStringsIndex=Oh(o,1),i.privateDict=Dh(l,p),i.stringIndex=Ah(p);let d=i.header.sizeOf()+i.nameIndex.sizeOf()+i.topDictIndex.sizeOf()+i.stringIndex.sizeOf()+i.globalSubrIndex.sizeOf();return a.charset=d,a.encoding=0,a.charStrings=a.charset+i.charsets.sizeOf(),a.private[1]=a.charStrings+i.charStringsIndex.sizeOf(),u=so(a,p),i.topDictIndex=no(u),i}let Rn={parse:kh,make:Nh};function Ph(o,e){let i={},r=new ee.Parser(o,e);return i.version=r.parseVersion(),i.fontRevision=Math.round(r.parseFixed()*1e3)/1e3,i.checkSumAdjustment=r.parseULong(),i.magicNumber=r.parseULong(),ne.argument(i.magicNumber===1594834165,"Font header has wrong magic number."),i.flags=r.parseUShort(),i.unitsPerEm=r.parseUShort(),i.created=r.parseLongDateTime(),i.modified=r.parseLongDateTime(),i.xMin=r.parseShort(),i.yMin=r.parseShort(),i.xMax=r.parseShort(),i.yMax=r.parseShort(),i.macStyle=r.parseUShort(),i.lowestRecPPEM=r.parseUShort(),i.fontDirectionHint=r.parseShort(),i.indexToLocFormat=r.parseShort(),i.glyphDataFormat=r.parseShort(),i}function Vh(o){let e=Math.round(new Date().getTime()/1e3)+2082844800,i=e;return o.createdTimestamp&&(i=o.createdTimestamp+2082844800),new Z.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:i},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],o)}let Er={parse:Ph,make:Vh};function Fh(o,e){let i={},r=new ee.Parser(o,e);return i.version=r.parseVersion(),i.ascender=r.parseShort(),i.descender=r.parseShort(),i.lineGap=r.parseShort(),i.advanceWidthMax=r.parseUShort(),i.minLeftSideBearing=r.parseShort(),i.minRightSideBearing=r.parseShort(),i.xMaxExtent=r.parseShort(),i.caretSlopeRise=r.parseShort(),i.caretSlopeRun=r.parseShort(),i.caretOffset=r.parseShort(),r.relativeOffset+=8,i.metricDataFormat=r.parseShort(),i.numberOfHMetrics=r.parseUShort(),i}function Uh(o){return new Z.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],o)}let Sr={parse:Fh,make:Uh};function Gh(o,e,i,r,a){let l,c,h=new ee.Parser(o,e);for(let p=0;p<r;p+=1){p<i&&(l=h.parseUShort(),c=h.parseShort());let u=a.get(p);u.advanceWidth=l,u.leftSideBearing=c}}function zh(o,e,i,r,a){o._hmtxTableData={};let l,c,h=new ee.Parser(e,i);for(let p=0;p<a;p+=1)p<r&&(l=h.parseUShort(),c=h.parseShort()),o._hmtxTableData[p]={advanceWidth:l,leftSideBearing:c}}function Hh(o,e,i,r,a,l,c){c.lowMemory?zh(o,e,i,r,a):Gh(e,i,r,a,l)}function jh(o){let e=new Z.Table("hmtx",[]);for(let i=0;i<o.length;i+=1){let r=o.get(i),a=r.advanceWidth||0,l=r.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+i,type:"USHORT",value:a}),e.fields.push({name:"leftSideBearing_"+i,type:"SHORT",value:l})}return e}let Tr={parse:Hh,make:jh};function Wh(o){let e=new Z.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:o.length}]),i="",r=12+o.length*4;for(let a=0;a<o.length;++a){let l=i.indexOf(o[a]);l<0&&(l=i.length,i+=o[a]),e.fields.push({name:"offset "+a,type:"USHORT",value:r+l}),e.fields.push({name:"length "+a,type:"USHORT",value:o[a].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:i}),e}function Xh(o,e){let i=new ee.Parser(o,e),r=i.parseULong();ne.argument(r===1,"Unsupported ltag table version."),i.skip("uLong",1);let a=i.parseULong(),l=[];for(let c=0;c<a;c++){let h="",p=e+i.parseUShort(),u=i.parseUShort();for(let d=p;d<p+u;++d)h+=String.fromCharCode(o.getInt8(d));l.push(h)}return l}let Lr={make:Wh,parse:Xh};function Zh(o,e){let i={},r=new ee.Parser(o,e);return i.version=r.parseVersion(),i.numGlyphs=r.parseUShort(),i.version===1&&(i.maxPoints=r.parseUShort(),i.maxContours=r.parseUShort(),i.maxCompositePoints=r.parseUShort(),i.maxCompositeContours=r.parseUShort(),i.maxZones=r.parseUShort(),i.maxTwilightPoints=r.parseUShort(),i.maxStorage=r.parseUShort(),i.maxFunctionDefs=r.parseUShort(),i.maxInstructionDefs=r.parseUShort(),i.maxStackElements=r.parseUShort(),i.maxSizeOfInstructions=r.parseUShort(),i.maxComponentElements=r.parseUShort(),i.maxComponentDepth=r.parseUShort()),i}function Yh(o){return new Z.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:o}])}let kr={parse:Zh,make:Yh},Mr=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Ir={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},Kh={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Ar={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function qh(o,e,i){switch(o){case 0:if(e===65535)return"und";if(i)return i[e];break;case 1:return Ir[e];case 3:return Ar[e]}}let On="utf-16",Qh={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Jh={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function _r(o,e,i){switch(o){case 0:return On;case 1:return Jh[i]||Qh[e];case 3:if(e===1||e===10)return On;break}}let Br={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function $h(o){return Br[o]}function e0(o,e,i){let r={},a=new ee.Parser(o,e),l=a.parseUShort(),c=a.parseUShort(),h=a.offset+a.parseUShort();for(let p=0;p<c;p++){let u=a.parseUShort(),d=a.parseUShort(),m=a.parseUShort(),v=a.parseUShort(),g=Mr[v]||v,x=a.parseUShort(),b=a.parseUShort(),C=qh(u,m,i),T=_r(u,d,m),A=$h(u);if(T!==void 0&&C!==void 0&&A!==void 0){let O;if(T===On?O=Qt.UTF16(o,h+b,x):O=Qt.MACSTRING(o,h+b,x,T),O){let P=r[A];P===void 0&&(P=r[A]={});let V=P[g];V===void 0&&(V=P[g]={}),V[C]=O}}}return l===1&&a.parseUShort(),r}function Vs(o){let e={};for(let i in o)e[o[i]]=parseInt(i);return e}function io(o,e,i,r,a,l){return new Z.Record("NameRecord",[{name:"platformID",type:"USHORT",value:o},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:i},{name:"nameID",type:"USHORT",value:r},{name:"length",type:"USHORT",value:a},{name:"offset",type:"USHORT",value:l}])}function t0(o,e){let i=o.length,r=e.length-i+1;e:for(let a=0;a<r;a++)for(;a<r;a++){for(let l=0;l<i;l++)if(e[a+l]!==o[l])continue e;return a}return-1}function oo(o,e){let i=t0(o,e);if(i<0){i=e.length;let r=0,a=o.length;for(;r<a;++r)e.push(o[r])}return i}function s0(o,e){let i=Vs(Br),r=Vs(Ir),a=Vs(Ar),l=[],c=[];for(let p in o){let u,d=[],m={},v=Vs(Mr),g=i[p];for(let x in o[p]){let b=v[x];if(b===void 0&&(b=x),u=parseInt(b),isNaN(u))throw new Error('Name table entry "'+x+'" does not exist, see nameTableNames for complete list.');m[u]=o[p][x],d.push(u)}for(let x=0;x<d.length;x++){u=d[x];let b=m[u];for(let C in b){let T=b[C];if(g===1||g===0){let A=r[C],O=Kh[A],P=_r(g,O,A),V=K.MACSTRING(T,P);if(g===0&&(A=e.indexOf(C),A<0&&(A=e.length,e.push(C)),O=4,V=K.UTF16(T)),V!==void 0){let R=oo(V,c);l.push(io(g,O,A,u,V.length,R))}}if(g===3){let A=a[C];if(A!==void 0){let O=K.UTF16(T),P=oo(O,c);l.push(io(3,1,A,u,O.length,P))}}}}}l.sort(function(p,u){return p.platformID-u.platformID||p.encodingID-u.encodingID||p.languageID-u.languageID||p.nameID-u.nameID});let h=new Z.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:l.length},{name:"stringOffset",type:"USHORT",value:6+l.length*12}]);for(let p=0;p<l.length;p++)h.fields.push({name:"record_"+p,type:"RECORD",value:l[p]});return h.fields.push({name:"strings",type:"LITERAL",value:c}),h}let Rr={parse:e0,make:s0},Dn=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function n0(o){for(let e=0;e<Dn.length;e+=1){let i=Dn[e];if(o>=i.begin&&o<i.end)return e}return-1}function i0(o,e){let i={},r=new ee.Parser(o,e);i.version=r.parseUShort(),i.xAvgCharWidth=r.parseShort(),i.usWeightClass=r.parseUShort(),i.usWidthClass=r.parseUShort(),i.fsType=r.parseUShort(),i.ySubscriptXSize=r.parseShort(),i.ySubscriptYSize=r.parseShort(),i.ySubscriptXOffset=r.parseShort(),i.ySubscriptYOffset=r.parseShort(),i.ySuperscriptXSize=r.parseShort(),i.ySuperscriptYSize=r.parseShort(),i.ySuperscriptXOffset=r.parseShort(),i.ySuperscriptYOffset=r.parseShort(),i.yStrikeoutSize=r.parseShort(),i.yStrikeoutPosition=r.parseShort(),i.sFamilyClass=r.parseShort(),i.panose=[];for(let a=0;a<10;a++)i.panose[a]=r.parseByte();return i.ulUnicodeRange1=r.parseULong(),i.ulUnicodeRange2=r.parseULong(),i.ulUnicodeRange3=r.parseULong(),i.ulUnicodeRange4=r.parseULong(),i.achVendID=String.fromCharCode(r.parseByte(),r.parseByte(),r.parseByte(),r.parseByte()),i.fsSelection=r.parseUShort(),i.usFirstCharIndex=r.parseUShort(),i.usLastCharIndex=r.parseUShort(),i.sTypoAscender=r.parseShort(),i.sTypoDescender=r.parseShort(),i.sTypoLineGap=r.parseShort(),i.usWinAscent=r.parseUShort(),i.usWinDescent=r.parseUShort(),i.version>=1&&(i.ulCodePageRange1=r.parseULong(),i.ulCodePageRange2=r.parseULong()),i.version>=2&&(i.sxHeight=r.parseShort(),i.sCapHeight=r.parseShort(),i.usDefaultChar=r.parseUShort(),i.usBreakChar=r.parseUShort(),i.usMaxContent=r.parseUShort()),i}function o0(o){return new Z.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],o)}let Nn={parse:i0,make:o0,unicodeRanges:Dn,getUnicodeRange:n0};function r0(o,e){let i={},r=new ee.Parser(o,e);switch(i.version=r.parseVersion(),i.italicAngle=r.parseFixed(),i.underlinePosition=r.parseShort(),i.underlineThickness=r.parseShort(),i.isFixedPitch=r.parseULong(),i.minMemType42=r.parseULong(),i.maxMemType42=r.parseULong(),i.minMemType1=r.parseULong(),i.maxMemType1=r.parseULong(),i.version){case 1:i.names=Vt.slice();break;case 2:i.numberOfGlyphs=r.parseUShort(),i.glyphNameIndex=new Array(i.numberOfGlyphs);for(let a=0;a<i.numberOfGlyphs;a++)i.glyphNameIndex[a]=r.parseUShort();i.names=[];for(let a=0;a<i.numberOfGlyphs;a++)if(i.glyphNameIndex[a]>=Vt.length){let l=r.parseChar();i.names.push(r.parseString(l))}break;case 2.5:i.numberOfGlyphs=r.parseUShort(),i.offset=new Array(i.numberOfGlyphs);for(let a=0;a<i.numberOfGlyphs;a++)i.offset[a]=r.parseChar();break}return i}function a0(o){let{italicAngle:e=0,underlinePosition:i=0,underlineThickness:r=0,isFixedPitch:a=0,minMemType42:l=0,maxMemType42:c=0,minMemType1:h=0,maxMemType1:p=0}=o||{};return new Z.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:e},{name:"underlinePosition",type:"FWORD",value:i},{name:"underlineThickness",type:"FWORD",value:r},{name:"isFixedPitch",type:"ULONG",value:a},{name:"minMemType42",type:"ULONG",value:l},{name:"maxMemType42",type:"ULONG",value:c},{name:"minMemType1",type:"ULONG",value:h},{name:"maxMemType1",type:"ULONG",value:p}])}let Or={parse:r0,make:a0},st=new Array(9);st[1]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:1,coverage:this.parsePointer(N.coverage),deltaGlyphId:this.parseShort()};if(e===2)return{substFormat:2,coverage:this.parsePointer(N.coverage),substitute:this.parseOffset16List()};ne.assert(!1,"0x"+o.toString(16)+": lookup type 1 format must be 1 or 2.")};st[2]=function(){let o=this.parseUShort();return ne.argument(o===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:o,coverage:this.parsePointer(N.coverage),sequences:this.parseListOfLists()}};st[3]=function(){let o=this.parseUShort();return ne.argument(o===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:o,coverage:this.parsePointer(N.coverage),alternateSets:this.parseListOfLists()}};st[4]=function(){let o=this.parseUShort();return ne.argument(o===1,"GSUB ligature table identifier-format must be 1"),{substFormat:o,coverage:this.parsePointer(N.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};let Kt={sequenceIndex:N.uShort,lookupListIndex:N.uShort};st[5]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:e,coverage:this.parsePointer(N.coverage),ruleSets:this.parseListOfLists(function(){let i=this.parseUShort(),r=this.parseUShort();return{input:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(r,Kt)}})};if(e===2)return{substFormat:e,coverage:this.parsePointer(N.coverage),classDef:this.parsePointer(N.classDef),classSets:this.parseListOfLists(function(){let i=this.parseUShort(),r=this.parseUShort();return{classes:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(r,Kt)}})};if(e===3){let i=this.parseUShort(),r=this.parseUShort();return{substFormat:e,coverages:this.parseList(i,N.pointer(N.coverage)),lookupRecords:this.parseRecordList(r,Kt)}}ne.assert(!1,"0x"+o.toString(16)+": lookup type 5 format must be 1, 2 or 3.")};st[6]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:1,coverage:this.parsePointer(N.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Kt)}})};if(e===2)return{substFormat:2,coverage:this.parsePointer(N.coverage),backtrackClassDef:this.parsePointer(N.classDef),inputClassDef:this.parsePointer(N.classDef),lookaheadClassDef:this.parsePointer(N.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Kt)}})};if(e===3)return{substFormat:3,backtrackCoverage:this.parseList(N.pointer(N.coverage)),inputCoverage:this.parseList(N.pointer(N.coverage)),lookaheadCoverage:this.parseList(N.pointer(N.coverage)),lookupRecords:this.parseRecordList(Kt)};ne.assert(!1,"0x"+o.toString(16)+": lookup type 6 format must be 1, 2 or 3.")};st[7]=function(){let o=this.parseUShort();ne.argument(o===1,"GSUB Extension Substitution subtable identifier-format must be 1");let e=this.parseUShort(),i=new N(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:e,extension:st[e].call(i)}};st[8]=function(){let o=this.parseUShort();return ne.argument(o===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:o,coverage:this.parsePointer(N.coverage),backtrackCoverage:this.parseList(N.pointer(N.coverage)),lookaheadCoverage:this.parseList(N.pointer(N.coverage)),substitutes:this.parseUShortList()}};function l0(o,e){e=e||0;let i=new N(o,e),r=i.parseVersion(1);return ne.argument(r===1||r===1.1,"Unsupported GSUB table version."),r===1?{version:r,scripts:i.parseScriptList(),features:i.parseFeatureList(),lookups:i.parseLookupList(st)}:{version:r,scripts:i.parseScriptList(),features:i.parseFeatureList(),lookups:i.parseLookupList(st),variations:i.parseFeatureVariationsList()}}let jt=new Array(9);jt[1]=function(o){if(o.substFormat===1)return new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(o.coverage)},{name:"deltaGlyphID",type:"SHORT",value:o.deltaGlyphId}]);if(o.substFormat===2)return new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Z.Coverage(o.coverage)}].concat(Z.ushortList("substitute",o.substitute)));ne.fail("Lookup type 1 substFormat must be 1 or 2.")};jt[2]=function(o){return ne.assert(o.substFormat===1,"Lookup type 2 substFormat must be 1."),new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(o.coverage)}].concat(Z.tableList("seqSet",o.sequences,function(e){return new Z.Table("sequenceSetTable",Z.ushortList("sequence",e))})))};jt[3]=function(o){return ne.assert(o.substFormat===1,"Lookup type 3 substFormat must be 1."),new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(o.coverage)}].concat(Z.tableList("altSet",o.alternateSets,function(e){return new Z.Table("alternateSetTable",Z.ushortList("alternate",e))})))};jt[4]=function(o){return ne.assert(o.substFormat===1,"Lookup type 4 substFormat must be 1."),new Z.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Z.Coverage(o.coverage)}].concat(Z.tableList("ligSet",o.ligatureSets,function(e){return new Z.Table("ligatureSetTable",Z.tableList("ligature",e,function(i){return new Z.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:i.ligGlyph}].concat(Z.ushortList("component",i.components,i.components.length+1)))}))})))};jt[5]=function(o){if(o.substFormat===1)return new Z.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:o.substFormat},{name:"coverage",type:"TABLE",value:new Z.Coverage(o.coverage)}].concat(Z.tableList("sequenceRuleSet",o.ruleSets,function(e){return e?new Z.Table("sequenceRuleSetTable",Z.tableList("sequenceRule",e,function(i){let r=Z.ushortList("seqLookup",[],i.lookupRecords.length).concat(Z.ushortList("inputSequence",i.input,i.input.length+1));[r[0],r[1]]=[r[1],r[0]];for(let a=0;a<i.lookupRecords.length;a++){let l=i.lookupRecords[a];r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:l.lookupListIndex})}return new Z.Table("sequenceRuleTable",r)})):new Z.Table("NULL",null)})));if(o.substFormat===2)return new Z.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:o.substFormat},{name:"coverage",type:"TABLE",value:new Z.Coverage(o.coverage)},{name:"classDef",type:"TABLE",value:new Z.ClassDef(o.classDef)}].concat(Z.tableList("classSeqRuleSet",o.classSets,function(e){return e?new Z.Table("classSeqRuleSetTable",Z.tableList("classSeqRule",e,function(i){let r=Z.ushortList("classes",i.classes,i.classes.length+1).concat(Z.ushortList("seqLookupCount",[],i.lookupRecords.length));for(let a=0;a<i.lookupRecords.length;a++){let l=i.lookupRecords[a];r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:l.lookupListIndex})}return new Z.Table("classSeqRuleTable",r)})):new Z.Table("NULL",null)})));if(o.substFormat===3){let e=[{name:"substFormat",type:"USHORT",value:o.substFormat}];e.push({name:"inputGlyphCount",type:"USHORT",value:o.coverages.length}),e.push({name:"substitutionCount",type:"USHORT",value:o.lookupRecords.length});for(let i=0;i<o.coverages.length;i++){let r=o.coverages[i];e.push({name:"inputCoverage"+i,type:"TABLE",value:new Z.Coverage(r)})}for(let i=0;i<o.lookupRecords.length;i++){let r=o.lookupRecords[i];e=e.concat({name:"sequenceIndex"+i,type:"USHORT",value:r.sequenceIndex}).concat({name:"lookupListIndex"+i,type:"USHORT",value:r.lookupListIndex})}return new Z.Table("contextualSubstitutionTable",e)}ne.assert(!1,"lookup type 5 format must be 1, 2 or 3.")};jt[6]=function(o){if(o.substFormat===1)return new Z.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:o.substFormat},{name:"coverage",type:"TABLE",value:new Z.Coverage(o.coverage)}].concat(Z.tableList("chainRuleSet",o.chainRuleSets,function(e){return new Z.Table("chainRuleSetTable",Z.tableList("chainRule",e,function(i){let r=Z.ushortList("backtrackGlyph",i.backtrack,i.backtrack.length).concat(Z.ushortList("inputGlyph",i.input,i.input.length+1)).concat(Z.ushortList("lookaheadGlyph",i.lookahead,i.lookahead.length)).concat(Z.ushortList("substitution",[],i.lookupRecords.length));for(let a=0;a<i.lookupRecords.length;a++){let l=i.lookupRecords[a];r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:l.lookupListIndex})}return new Z.Table("chainRuleTable",r)}))})));if(o.substFormat===2)ne.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(o.substFormat===3){let e=[{name:"substFormat",type:"USHORT",value:o.substFormat}];e.push({name:"backtrackGlyphCount",type:"USHORT",value:o.backtrackCoverage.length});for(let i=0;i<o.backtrackCoverage.length;i++){let r=o.backtrackCoverage[i];e.push({name:"backtrackCoverage"+i,type:"TABLE",value:new Z.Coverage(r)})}e.push({name:"inputGlyphCount",type:"USHORT",value:o.inputCoverage.length});for(let i=0;i<o.inputCoverage.length;i++){let r=o.inputCoverage[i];e.push({name:"inputCoverage"+i,type:"TABLE",value:new Z.Coverage(r)})}e.push({name:"lookaheadGlyphCount",type:"USHORT",value:o.lookaheadCoverage.length});for(let i=0;i<o.lookaheadCoverage.length;i++){let r=o.lookaheadCoverage[i];e.push({name:"lookaheadCoverage"+i,type:"TABLE",value:new Z.Coverage(r)})}e.push({name:"substitutionCount",type:"USHORT",value:o.lookupRecords.length});for(let i=0;i<o.lookupRecords.length;i++){let r=o.lookupRecords[i];e=e.concat({name:"sequenceIndex"+i,type:"USHORT",value:r.sequenceIndex}).concat({name:"lookupListIndex"+i,type:"USHORT",value:r.lookupListIndex})}return new Z.Table("chainContextTable",e)}ne.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function c0(o){return new Z.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Z.ScriptList(o.scripts)},{name:"features",type:"TABLE",value:new Z.FeatureList(o.features)},{name:"lookups",type:"TABLE",value:new Z.LookupList(o.lookups,jt)}])}let Dr={parse:l0,make:c0};function h0(o,e){let i=new ee.Parser(o,e),r=i.parseULong();ne.argument(r===1,"Unsupported META table version."),i.parseULong(),i.parseULong();let a=i.parseULong(),l={};for(let c=0;c<a;c++){let h=i.parseTag(),p=i.parseULong(),u=i.parseULong();if(h==="appl"||h==="bild")continue;let d=Qt.UTF8(o,e+p,u);l[h]=d}return l}function u0(o){let e=Object.keys(o).length,i="",r=16+e*12,a=new Z.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:r},{name:"numTags",type:"ULONG",value:e}]);for(let l in o){let c=i.length;i+=o[l],a.fields.push({name:"tag "+l,type:"TAG",value:l}),a.fields.push({name:"offset "+l,type:"ULONG",value:r+c}),a.fields.push({name:"length "+l,type:"ULONG",value:o[l].length})}return a.fields.push({name:"stringPool",type:"CHARARRAY",value:i}),a}let Nr={parse:h0,make:u0};function p0(o,e){let i=new N(o,e),r=i.parseUShort();ne.argument(r===0,"Only COLRv0 supported.");let a=i.parseUShort(),l=i.parseOffset32(),c=i.parseOffset32(),h=i.parseUShort();i.relativeOffset=l;let p=i.parseRecordList(a,{glyphID:N.uShort,firstLayerIndex:N.uShort,numLayers:N.uShort});i.relativeOffset=c;let u=i.parseRecordList(h,{glyphID:N.uShort,paletteIndex:N.uShort});return{version:r,baseGlyphRecords:p,layerRecords:u}}function d0({version:o=0,baseGlyphRecords:e=[],layerRecords:i=[]}){ne.argument(o===0,"Only COLRv0 supported.");let r=14,a=r+e.length*6;return new Z.Table("COLR",[{name:"version",type:"USHORT",value:o},{name:"numBaseGlyphRecords",type:"USHORT",value:e.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:r},{name:"layerRecordsOffset",type:"ULONG",value:a},{name:"numLayerRecords",type:"USHORT",value:i.length},...e.map((l,c)=>[{name:"glyphID_"+c,type:"USHORT",value:l.glyphID},{name:"firstLayerIndex_"+c,type:"USHORT",value:l.firstLayerIndex},{name:"numLayers_"+c,type:"USHORT",value:l.numLayers}]).flat(),...i.map((l,c)=>[{name:"LayerGlyphID_"+c,type:"USHORT",value:l.glyphID},{name:"paletteIndex_"+c,type:"USHORT",value:l.paletteIndex}]).flat()])}let Pr={parse:p0,make:d0};function f0(o,e){let i=new N(o,e),r=i.parseShort(),a=i.parseShort(),l=i.parseShort(),c=i.parseShort(),h=i.parseOffset32(),p=i.parseUShortList(l);i.relativeOffset=h;let u=i.parseULongList(c);return{version:r,numPaletteEntries:a,colorRecords:u,colorRecordIndices:p}}function m0({version:o=0,numPaletteEntries:e=0,colorRecords:i=[],colorRecordIndices:r=[0]}){return ne.argument(o===0,"Only CPALv0 are supported."),ne.argument(i.length,"No colorRecords given."),ne.argument(r.length,"No colorRecordIndices given."),r.length>1&&ne.argument(e,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new Z.Table("CPAL",[{name:"version",type:"USHORT",value:o},{name:"numPaletteEntries",type:"USHORT",value:e||i.length},{name:"numPalettes",type:"USHORT",value:r.length},{name:"numColorRecords",type:"USHORT",value:i.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*r.length},...r.map((a,l)=>({name:"colorRecordIndices_"+l,type:"USHORT",value:a})),...i.map((a,l)=>({name:"colorRecords_"+l,type:"ULONG",value:a}))])}let Vr={parse:f0,make:m0};function g0(){return typeof window<"u"}function as(o,e){if(!o)throw e}function Pn(o,e){let i=o.length;if(i!==e.length)return!1;for(let r=0;r<i;r++)if(o[r]!==e[r])return!1;return!0}function y0(o,e){let i=Object.values(o),r=Object.values(e),a=Object.values(o),l=Object.values(e);return Pn(i,r)&&Pn(a,l)}function Fr(o,e){let i=256;for(let r in e){for(let a in e[r]){let l=parseInt(a);if(!(!l||l<256)){if(y0(e[r][a],o))return l;i<=l&&(i=l+1)}}e[r][i]=o}return i}function v0(o,e,i){let r=Fr(e.name,i);return[{name:"tag_"+o,type:"TAG",value:e.tag},{name:"minValue_"+o,type:"FIXED",value:e.minValue<<16},{name:"defaultValue_"+o,type:"FIXED",value:e.defaultValue<<16},{name:"maxValue_"+o,type:"FIXED",value:e.maxValue<<16},{name:"flags_"+o,type:"USHORT",value:0},{name:"nameID_"+o,type:"USHORT",value:r}]}function b0(o,e,i){let r={},a=new ee.Parser(o,e);return r.tag=a.parseTag(),r.minValue=a.parseFixed(),r.defaultValue=a.parseFixed(),r.maxValue=a.parseFixed(),a.skip("uShort",1),r.name=(i.macintosh||i.windows||i.unicode)[a.parseUShort()]||{},r}function x0(o,e,i,r){let a=Fr(e.name,r),l=[{name:"nameID_"+o,type:"USHORT",value:a},{name:"flags_"+o,type:"USHORT",value:0}];for(let c=0;c<i.length;++c){let h=i[c].tag;l.push({name:"axis_"+o+" "+h,type:"FIXED",value:e.coordinates[h]<<16})}return l}function C0(o,e,i,r){let a={},l=new ee.Parser(o,e);a.name=(r.macintosh||r.windows||r.unicode)[l.parseUShort()]||{},l.skip("uShort",1),a.coordinates={};for(let c=0;c<i.length;++c)a.coordinates[i[c].tag]=l.parseFixed();return a}function w0(o,e){let i=new Z.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:o.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:o.instances.length},{name:"instanceSize",type:"USHORT",value:4+o.axes.length*4}]);i.offsetToData=i.sizeOf();for(let r=0;r<o.axes.length;r++)i.fields=i.fields.concat(v0(r,o.axes[r],e));for(let r=0;r<o.instances.length;r++)i.fields=i.fields.concat(x0(r,o.instances[r],o.axes,e));return i}function E0(o,e,i){let r=new ee.Parser(o,e),a=r.parseULong();ne.argument(a===65536,"Unsupported fvar table version.");let l=r.parseOffset16();r.skip("uShort",1);let c=r.parseUShort(),h=r.parseUShort(),p=r.parseUShort(),u=r.parseUShort(),d=[];for(let g=0;g<c;g++)d.push(b0(o,e+l+g*h,i));let m=[],v=e+l+c*h;for(let g=0;g<p;g++)m.push(C0(o,v+g*u,d,i));return{axes:d,instances:m}}let Ur={make:w0,parse:E0},S0={tag:N.tag,nameID:N.uShort,ordering:N.uShort},Cs=new Array(5);Cs[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}};Cs[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}};Cs[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}};Cs[4]=function(){let o=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(o,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function T0(){let o=this.parseUShort(),e=Cs[o],i={format:o};return e===void 0?(console.warn(`Unknown axis value table format ${o}`),i):Object.assign(i,this.parseStruct(e.bind(this)))}function L0(o,e,i){e||(e=0);let r=new ee.Parser(o,e),a=r.parseUShort(),l=r.parseUShort();a!==1&&console.warn(`Unsupported STAT table version ${a}.${l}`);let c=[a,l],h=r.parseUShort(),p=r.parseUShort(),u=r.parseOffset32(),d=r.parseUShort(),m=r.parseOffset32(),v=a>1||l>0?r.parseUShort():void 0;i!==void 0&&ne.argument(p>=i.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),d>0&&ne.argument(p>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let g=[];for(let C=0;C<p;C++)r.offset=e+u,r.relativeOffset=C*h,g.push(r.parseStruct(S0));r.offset=e,r.relativeOffset=m;let x=r.parseUShortList(d),b=[];for(let C=0;C<d;C++)r.offset=e+m,r.relativeOffset=x[C],b.push(T0.apply(r));return{version:c,axes:g,values:b,elidedFallbackNameID:v}}let ws=new Array(5);ws[1]=function(o,e){return[{name:`format${o}`,type:"USHORT",value:1},{name:`axisIndex${o}`,type:"USHORT",value:e.axisIndex},{name:`flags${o}`,type:"USHORT",value:e.flags},{name:`valueNameID${o}`,type:"USHORT",value:e.valueNameID},{name:`value${o}`,type:"FLOAT",value:e.value}]};ws[2]=function(o,e){return[{name:`format${o}`,type:"USHORT",value:2},{name:`axisIndex${o}`,type:"USHORT",value:e.axisIndex},{name:`flags${o}`,type:"USHORT",value:e.flags},{name:`valueNameID${o}`,type:"USHORT",value:e.valueNameID},{name:`nominalValue${o}`,type:"FLOAT",value:e.nominalValue},{name:`rangeMinValue${o}`,type:"FLOAT",value:e.rangeMinValue},{name:`rangeMaxValue${o}`,type:"FLOAT",value:e.rangeMaxValue}]};ws[3]=function(o,e){return[{name:`format${o}`,type:"USHORT",value:3},{name:`axisIndex${o}`,type:"USHORT",value:e.axisIndex},{name:`flags${o}`,type:"USHORT",value:e.flags},{name:`valueNameID${o}`,type:"USHORT",value:e.valueNameID},{name:`value${o}`,type:"FLOAT",value:e.value},{name:`linkedValue${o}`,type:"FLOAT",value:e.linkedValue}]};ws[4]=function(o,e){let i=[{name:`format${o}`,type:"USHORT",value:4},{name:`axisCount${o}`,type:"USHORT",value:e.axisValues.length},{name:`flags${o}`,type:"USHORT",value:e.flags},{name:`valueNameID${o}`,type:"USHORT",value:e.valueNameID}];for(let r=0;r<e.axisValues.length;r++)i=i.concat([{name:`format${o}axisIndex${r}`,type:"USHORT",value:e.axisValues[r].axisIndex},{name:`format${o}value${r}`,type:"FLOAT",value:e.axisValues[r].value}]);return i};function k0(o,e){return new Z.Record("axisRecord_"+o,[{name:"axisTag_"+o,type:"TAG",value:e.tag},{name:"axisNameID_"+o,type:"USHORT",value:e.nameID},{name:"axisOrdering_"+o,type:"USHORT",value:e.ordering}])}function M0(o,e){let i=e.format,r=ws[i];ne.argument(r!==void 0,`Unknown axis value table format ${i}`);let a=r(o,e);return new Z.Table("axisValueTable_"+o,a)}function I0(o){let e=new Z.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:o.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:o.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:o.elidedFallbackNameID}]);e.designAxesOffset=e.offsetToAxisValueOffsets=e.sizeOf();for(let l=0;l<o.axes.length;l++){let c=k0(l,o.axes[l]);e.offsetToAxisValueOffsets+=c.sizeOf(),e.fields=e.fields.concat(c.fields)}let i=[],r=[],a=o.values.length*2;for(let l=0;l<o.values.length;l++){let c=M0(l,o.values[l]);i.push({name:"offset_"+l,type:"USHORT",value:a}),a+=c.sizeOf(),r=r.concat(c.fields)}return e.fields=e.fields.concat(i),e.fields=e.fields.concat(r),e}let Gr={make:I0,parse:L0};function A0(o,e){return new Z.Record("axisValueMap_"+o,[{name:"fromCoordinate_"+o,type:"F2DOT14",value:e.fromCoordinate},{name:"toCoordinate_"+o,type:"F2DOT14",value:e.toCoordinate}])}function _0(o,e){let i=new Z.Record("segmentMap_"+o,[{name:"positionMapCount_"+o,type:"USHORT",value:e.axisValueMaps.length}]),r=[];for(let a=0;a<e.axisValueMaps.length;a++){let l=A0(`${o}_${a}`,e.axisValueMaps[a]);r=r.concat(l.fields)}return i.fields=i.fields.concat(r),i}function B0(o,e){ne.argument(o.axisSegmentMaps.length===e.axes.length,"avar axis count must correspond to fvar axis count");let i=new Z.Table("avar",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:0},{name:"reserved",type:"USHORT",value:0},{name:"axisCount",type:"USHORT",value:o.axisSegmentMaps.length}]);for(let r=0;r<o.axisSegmentMaps.length;r++){let a=_0(r,o.axisSegmentMaps[r]);i.fields=i.fields.concat(a.fields)}return i}function R0(o,e,i){e||(e=0);let r=new N(o,e),a=r.parseUShort(),l=r.parseUShort();a!==1&&console.warn(`Unsupported avar table version ${a}.${l}`),r.skip("uShort",1);let c=r.parseUShort();ne.argument(c===i.axes.length,"avar axis count must correspond to fvar axis count");let h=[];for(let p=0;p<c;p++){let u=[],d=r.parseUShort();for(let m=0;m<d;m++){let v=r.parseF2Dot14(),g=r.parseF2Dot14();u.push({fromCoordinate:v,toCoordinate:g})}h.push({axisValueMaps:u})}return{version:[a,l],axisSegmentMaps:h}}let zr={make:B0,parse:R0};function O0(o,e){let i={},r=new ee.Parser(o,e);i.version=r.parseUShort(),ne.argument(i.version<=1,"Unsupported gasp table version."),i.numRanges=r.parseUShort(),i.gaspRanges=[];for(let a=0;a<i.numRanges;a++)i.gaspRanges[a]={rangeMaxPPEM:r.parseUShort(),rangeGaspBehavior:r.parseUShort()};return i}function D0(o){let e=new Z.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:o.numRanges}]);for(let i in o.numRanges)e.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:o.numRanges[i].rangeMaxPPEM}),e.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:o.numRanges[i].rangeGaspBehavior});return e}let Hr={parse:O0,make:D0};function ro(o){return Math.log(o)/Math.log(2)|0}function yi(o){for(;o.length%4!==0;)o.push(0);let e=0;for(let i=0;i<o.length;i+=4)e+=(o[i]<<24)+(o[i+1]<<16)+(o[i+2]<<8)+o[i+3];return e%=Math.pow(2,32),e}function ao(o,e,i,r){return new Z.Record("Table Record",[{name:"tag",type:"TAG",value:o!==void 0?o:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:i!==void 0?i:0},{name:"length",type:"ULONG",value:r!==void 0?r:0}])}function jr(o){let e=new Z.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=o,e.numTables=o.length;let i=Math.pow(2,ro(e.numTables));e.searchRange=16*i,e.entrySelector=ro(i),e.rangeShift=e.numTables*16-e.searchRange;let r=[],a=[],l=e.sizeOf()+ao().sizeOf()*e.numTables;for(;l%4!==0;)l+=1,a.push({name:"padding",type:"BYTE",value:0});for(let c=0;c<o.length;c+=1){let h=o[c];ne.argument(h.tableName.length===4,"Table name"+h.tableName+" is invalid.");let p=h.sizeOf(),u=ao(h.tableName,yi(h.encode()),l,p);for(r.push({name:u.tag+" Table Record",type:"RECORD",value:u}),a.push({name:h.tableName+" table",type:"RECORD",value:h}),l+=p,ne.argument(!isNaN(l),"Something went wrong calculating the offset.");l%4!==0;)l+=1,a.push({name:"padding",type:"BYTE",value:0})}return r.sort(function(c,h){return c.value.tag>h.value.tag?1:-1}),e.fields=e.fields.concat(r),e.fields=e.fields.concat(a),e}function lo(o,e,i){for(let r=0;r<e.length;r+=1){let a=o.charToGlyphIndex(e[r]);if(a>0)return o.glyphs.get(a).getMetrics()}return i}function N0(o){let e=0;for(let i=0;i<o.length;i+=1)e+=o[i];return e/o.length}function P0(o){let e=[],i=[],r=[],a=[],l=[],c=[],h=[],p,u=0,d=0,m=0,v=0,g=0;for(let S=0;S<o.glyphs.length;S+=1){let k=o.glyphs.get(S),D=k.unicode|0;if(isNaN(k.advanceWidth))throw new Error("Glyph "+k.name+" ("+S+"): advanceWidth is not a number.");(p>D||p===void 0)&&D>0&&(p=D),u<D&&(u=D);let B=Nn.getUnicodeRange(D);if(B<32)d|=1<<B;else if(B<64)m|=1<<B-32;else if(B<96)v|=1<<B-64;else if(B<123)g|=1<<B-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(k.name===".notdef")continue;let _=k.getMetrics();e.push(_.xMin),i.push(_.yMin),r.push(_.xMax),a.push(_.yMax),c.push(_.leftSideBearing),h.push(_.rightSideBearing),l.push(k.advanceWidth)}let x={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,i),xMax:Math.max.apply(null,r),yMax:Math.max.apply(null,a),advanceWidthMax:Math.max.apply(null,l),advanceWidthAvg:N0(l),minLeftSideBearing:Math.min.apply(null,c),maxLeftSideBearing:Math.max.apply(null,c),minRightSideBearing:Math.min.apply(null,h)};x.ascender=o.ascender,x.descender=o.descender;let b=Er.make({flags:3,unitsPerEm:o.unitsPerEm,xMin:x.xMin,yMin:x.yMin,xMax:x.xMax,yMax:x.yMax,lowestRecPPEM:3,createdTimestamp:o.createdTimestamp}),C=Sr.make({ascender:x.ascender,descender:x.descender,advanceWidthMax:x.advanceWidthMax,minLeftSideBearing:x.minLeftSideBearing,minRightSideBearing:x.minRightSideBearing,xMaxExtent:x.maxLeftSideBearing+(x.xMax-x.xMin),numberOfHMetrics:o.glyphs.length}),T=kr.make(o.glyphs.length),A=Nn.make(Object.assign({xAvgCharWidth:Math.round(x.advanceWidthAvg),usFirstCharIndex:p,usLastCharIndex:u,ulUnicodeRange1:d,ulUnicodeRange2:m,ulUnicodeRange3:v,ulUnicodeRange4:g,sTypoAscender:x.ascender,sTypoDescender:x.descender,sTypoLineGap:0,usWinAscent:x.yMax,usWinDescent:Math.abs(x.yMin),ulCodePageRange1:1,sxHeight:lo(o,"xyvw",{yMax:Math.round(x.ascender/2)}).yMax,sCapHeight:lo(o,"HIKLEFJMNTZBDPRAGOQSUVWXY",x).yMax,usDefaultChar:o.hasChar(" ")?32:0,usBreakChar:o.hasChar(" ")?32:0},o.tables.os2)),O=Tr.make(o.glyphs),P=dr.make(o.glyphs),V=o.getEnglishName("fontFamily"),R=o.getEnglishName("fontSubfamily"),I=V+" "+R,G=o.getEnglishName("postScriptName");G||(G=V.replace(/\s/g,"")+"-"+R);let X={};for(let S in o.names)X[S]=o.names[S];X.unicode=X.unicode||{},X.macintosh=X.macintosh||{},X.windows=X.windows||{};let j=o.names.unicode||{},z=o.names.macintosh||{},J=o.names.windows||{};for(let S in["unicode","macintosh","windows"])X[S]=X[S]||{},X[S].uniqueID||(X.unicode.uniqueID={en:o.getEnglishName("manufacturer")+":"+I}),X[S].postScriptName||(X.unicode.postScriptName={en:G});X.unicode.preferredFamily||(X.unicode.preferredFamily=j.fontFamily||z.fontFamily||J.fontFamily),X.macintosh.preferredFamily||(X.macintosh.preferredFamily=z.fontFamily||j.fontFamily||J.fontFamily),X.windows.preferredFamily||(X.windows.preferredFamily=J.fontFamily||j.fontFamily||z.fontFamily),X.unicode.preferredSubfamily||(X.unicode.preferredSubfamily=j.fontSubFamily||z.fontSubFamily||J.fontSubFamily),X.macintosh.preferredSubfamily||(X.macintosh.preferredSubfamily=z.fontSubFamily||j.fontSubFamily||J.fontSubFamily),X.windows.preferredSubfamily||(X.windows.preferredSubfamily=J.fontSubFamily||j.fontSubFamily||z.fontSubFamily);let Q=o.tables.fvar?Ur.make(o.tables.fvar,o.names):void 0,de=o.tables.gasp?Hr.make(o.tables.gasp):void 0,ie=[],me=Rr.make(X,ie),W=ie.length>0?Lr.make(ie):void 0,$=Or.make(o.tables.post),q=Rn.make(o.glyphs,{version:o.getEnglishName("version"),fullName:I,familyName:V,weightName:R,postScriptName:G,unitsPerEm:o.unitsPerEm,fontBBox:[0,x.yMin,x.ascender,x.advanceWidthMax]}),ae=o.metas&&Object.keys(o.metas).length>0?Nr.make(o.metas):void 0,ce=[b,C,T,A,me,P,$,q,O];W&&ce.push(W);let te={gsub:Dr,cpal:Vr,colr:Pr,stat:Gr,avar:zr},ue={avar:[o.tables.fvar]};Q&&ce.push(Q);for(let S in te){let k=o.tables[S];k&&ce.push(te[S].make.call(o,k,...ue[S]||[]))}ae&&ce.push(ae),de&&ce.push(de);let fe=jr(ce),_e=fe.encode(),w=yi(_e),E=fe.fields,M=!1;for(let S=0;S<E.length;S+=1)if(E[S].name==="head table"){E[S].value.checkSumAdjustment=2981146554-w,M=!0;break}if(!M)throw new Error("Could not find head table with checkSum to adjust.");return fe}let V0={make:jr,fontToTable:P0,computeCheckSum:yi};function bn(o,e){let i=0,r=o.length-1;for(;i<=r;){let a=i+r>>>1,l=o[a].tag;if(l===e)return a;l<e?i=a+1:r=a-1}return-i-1}function co(o,e){let i=0,r=o.length-1;for(;i<=r;){let a=i+r>>>1,l=o[a];if(l===e)return a;l<e?i=a+1:r=a-1}return-i-1}function ho(o,e){let i,r=0,a=o.length-1;for(;r<=a;){let l=r+a>>>1;i=o[l];let c=i.start;if(c===e)return i;c<e?r=l+1:a=l-1}if(r>0)return i=o[r-1],e>i.end?0:i}function Wr(o,e){this.font=o,this.tableName=e}Wr.prototype={searchTag:bn,binSearch:co,getTable:function(o){let e=this.font.tables[this.tableName];return!e&&o&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){let o=this.getTable();return o?o.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){let o=this.getTable();if(!o)return;let e=!1;for(let i=0;i<o.scripts.length;i++){let r=o.scripts[i].tag;if(r==="DFLT")return r;r==="latn"&&(e=!0)}if(e)return"latn"},getScriptTable:function(o,e){let i=this.getTable(e);if(i){o=o||"DFLT";let r=i.scripts,a=bn(i.scripts,o);if(a>=0)return r[a].script;if(e){let l={tag:o,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return r.splice(-1-a,0,l),l.script}}},getLangSysTable:function(o,e,i){let r=this.getScriptTable(o,i);if(r){if(!e||e==="dflt"||e==="DFLT")return r.defaultLangSys;let a=bn(r.langSysRecords,e);if(a>=0)return r.langSysRecords[a].langSys;if(i){let l={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return r.langSysRecords.splice(-1-a,0,l),l.langSys}}},getFeatureTable:function(o,e,i,r){let a=this.getLangSysTable(o,e,r);if(a){let l,c=a.featureIndexes,h=this.font.tables[this.tableName].features;for(let p=0;p<c.length;p++)if(l=h[c[p]],l.tag===i)return l.feature;if(r){let p=h.length;return ne.assert(p===0||i>=h[p-1].tag,"Features must be added in alphabetical order."),l={tag:i,feature:{params:0,lookupListIndexes:[]}},h.push(l),c.push(p),l.feature}}},getLookupTables:function(o,e,i,r,a){let l=this.getFeatureTable(o,e,i,a),c=[];if(l){let h,p=l.lookupListIndexes,u=this.font.tables[this.tableName].lookups;for(let d=0;d<p.length;d++)h=u[p[d]],h.lookupType===r&&c.push(h);if(c.length===0&&a){h={lookupType:r,lookupFlag:0,subtables:[],markFilteringSet:void 0};let d=u.length;return u.push(h),p.push(d),[h]}}return c},getGlyphClass:function(o,e){switch(o.format){case 1:return o.startGlyph<=e&&e<o.startGlyph+o.classes.length?o.classes[e-o.startGlyph]:0;case 2:{let i=ho(o.ranges,e);return i?i.classId:0}}},getCoverageIndex:function(o,e){switch(o.format){case 1:{let i=co(o.glyphs,e);return i>=0?i:-1}case 2:{let i=ho(o.ranges,e);return i?i.index+e-i.start:-1}}},expandCoverage:function(o){if(o.format===1)return o.glyphs;{let e=[],i=o.ranges;for(let r=0;r<i.length;r++){let a=i[r],l=a.start,c=a.end;for(let h=l;h<=c;h++)e.push(h)}return e}}};let an=Wr;function Es(o){an.call(this,o,"gpos")}Es.prototype=an.prototype;Es.prototype.init=function(){let o=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(o)};Es.prototype.getKerningValue=function(o,e,i){for(let r=0;r<o.length;r++){let a=o[r].subtables;for(let l=0;l<a.length;l++){let c=a[l],h=this.getCoverageIndex(c.coverage,e);if(!(h<0))switch(c.posFormat){case 1:{let p=c.pairSets[h];for(let u=0;u<p.length;u++){let d=p[u];if(d.secondGlyph===i)return d.value1&&d.value1.xAdvance||0}break}case 2:{let p=this.getGlyphClass(c.classDef1,e),u=this.getGlyphClass(c.classDef2,i),d=c.classRecords[p][u];return d.value1&&d.value1.xAdvance||0}}}}return 0};Es.prototype.getKerningTables=function(o,e){if(this.font.tables.gpos)return this.getLookupTables(o,e,"kern",2)};let F0=Es;function Ke(o){an.call(this,o,"gsub")}function vi(o,e,i){let r=o.subtables;for(let a=0;a<r.length;a++){let l=r[a];if(l.substFormat===e)return l}if(i)return r.push(i),i}Ke.prototype=an.prototype;Ke.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}};Ke.prototype.getSingle=function(o,e,i){let r=[],a=this.getLookupTables(e,i,o,1);for(let l=0;l<a.length;l++){let c=a[l].subtables;for(let h=0;h<c.length;h++){let p=c[h],u=this.expandCoverage(p.coverage),d;if(p.substFormat===1){let m=p.deltaGlyphId;for(d=0;d<u.length;d++){let v=u[d];r.push({sub:v,by:v+m})}}else{let m=p.substitute;for(d=0;d<u.length;d++)r.push({sub:u[d],by:m[d]})}}}return r};Ke.prototype.getMultiple=function(o,e,i){let r=[],a=this.getLookupTables(e,i,o,2);for(let l=0;l<a.length;l++){let c=a[l].subtables;for(let h=0;h<c.length;h++){let p=c[h],u=this.expandCoverage(p.coverage),d;for(d=0;d<u.length;d++){let m=u[d],v=p.sequences[d];r.push({sub:m,by:v})}}}return r};Ke.prototype.getAlternates=function(o,e,i){let r=[],a=this.getLookupTables(e,i,o,3);for(let l=0;l<a.length;l++){let c=a[l].subtables;for(let h=0;h<c.length;h++){let p=c[h],u=this.expandCoverage(p.coverage),d=p.alternateSets;for(let m=0;m<u.length;m++)r.push({sub:u[m],by:d[m]})}}return r};Ke.prototype.getLigatures=function(o,e,i){let r=[],a=this.getLookupTables(e,i,o,4);for(let l=0;l<a.length;l++){let c=a[l].subtables;for(let h=0;h<c.length;h++){let p=c[h],u=this.expandCoverage(p.coverage),d=p.ligatureSets;for(let m=0;m<u.length;m++){let v=u[m],g=d[m];for(let x=0;x<g.length;x++){let b=g[x];r.push({sub:[v].concat(b.components),by:b.ligGlyph})}}}}return r};Ke.prototype.addSingle=function(o,e,i,r){let a=this.getLookupTables(i,r,o,1,!0)[0],l=vi(a,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ne.assert(l.coverage.format===1,"Single: unable to modify coverage table format "+l.coverage.format);let c=e.sub,h=this.binSearch(l.coverage.glyphs,c);h<0&&(h=-1-h,l.coverage.glyphs.splice(h,0,c),l.substitute.splice(h,0,0)),l.substitute[h]=e.by};Ke.prototype.addMultiple=function(o,e,i,r){ne.assert(e.by instanceof Array&&e.by.length>1,'Multiple: "by" must be an array of two or more ids');let a=this.getLookupTables(i,r,o,2,!0)[0],l=vi(a,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});ne.assert(l.coverage.format===1,"Multiple: unable to modify coverage table format "+l.coverage.format);let c=e.sub,h=this.binSearch(l.coverage.glyphs,c);h<0&&(h=-1-h,l.coverage.glyphs.splice(h,0,c),l.sequences.splice(h,0,0)),l.sequences[h]=e.by};Ke.prototype.addAlternate=function(o,e,i,r){let a=this.getLookupTables(i,r,o,3,!0)[0],l=vi(a,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ne.assert(l.coverage.format===1,"Alternate: unable to modify coverage table format "+l.coverage.format);let c=e.sub,h=this.binSearch(l.coverage.glyphs,c);h<0&&(h=-1-h,l.coverage.glyphs.splice(h,0,c),l.alternateSets.splice(h,0,0)),l.alternateSets[h]=e.by};Ke.prototype.addLigature=function(o,e,i,r){let a=this.getLookupTables(i,r,o,4,!0)[0],l=a.subtables[0];l||(l={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},a.subtables[0]=l),ne.assert(l.coverage.format===1,"Ligature: unable to modify coverage table format "+l.coverage.format);let c=e.sub[0],h=e.sub.slice(1),p={ligGlyph:e.by,components:h},u=this.binSearch(l.coverage.glyphs,c);if(u>=0){let d=l.ligatureSets[u];for(let m=0;m<d.length;m++)if(Pn(d[m].components,h))return;d.push(p)}else u=-1-u,l.coverage.glyphs.splice(u,0,c),l.ligatureSets.splice(u,0,[p])};Ke.prototype.getFeature=function(o,e,i){if(/ss\d\d/.test(o))return this.getSingle(o,e,i);switch(o){case"aalt":case"salt":return this.getSingle(o,e,i).concat(this.getAlternates(o,e,i));case"dlig":case"liga":case"rlig":return this.getLigatures(o,e,i);case"ccmp":return this.getMultiple(o,e,i).concat(this.getLigatures(o,e,i));case"stch":return this.getMultiple(o,e,i)}};Ke.prototype.add=function(o,e,i,r){if(/ss\d\d/.test(o))return this.addSingle(o,e,i,r);switch(o){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(o,e,i,r):this.addAlternate(o,e,i,r);case"dlig":case"liga":case"rlig":return this.addLigature(o,e,i,r);case"ccmp":return e.by instanceof Array?this.addMultiple(o,e,i,r):this.addLigature(o,e,i,r)}};let U0=Ke;function uo(o,e,i,r,a){let l;return(e&r)>0?(l=o.parseByte(),e&a||(l=-l),l=i+l):(e&a)>0?l=i:l=i+o.parseShort(),l}function Xr(o,e,i){let r=new ee.Parser(e,i);o.numberOfContours=r.parseShort(),o._xMin=r.parseShort(),o._yMin=r.parseShort(),o._xMax=r.parseShort(),o._yMax=r.parseShort();let a,l;if(o.numberOfContours>0){let c=o.endPointIndices=[];for(let p=0;p<o.numberOfContours;p+=1)c.push(r.parseUShort());o.instructionLength=r.parseUShort(),o.instructions=[];for(let p=0;p<o.instructionLength;p+=1)o.instructions.push(r.parseByte());let h=c[c.length-1]+1;a=[];for(let p=0;p<h;p+=1)if(l=r.parseByte(),a.push(l),(l&8)>0){let u=r.parseByte();for(let d=0;d<u;d+=1)a.push(l),p+=1}if(ne.argument(a.length===h,"Bad flags."),c.length>0){let p=[],u;if(h>0){for(let v=0;v<h;v+=1)l=a[v],u={},u.onCurve=!!(l&1),u.lastPointOfContour=c.indexOf(v)>=0,p.push(u);let d=0;for(let v=0;v<h;v+=1)l=a[v],u=p[v],u.x=uo(r,l,d,2,16),d=u.x;let m=0;for(let v=0;v<h;v+=1)l=a[v],u=p[v],u.y=uo(r,l,m,4,32),m=u.y}o.points=p}else o.points=[]}else if(o.numberOfContours===0)o.points=[];else{o.isComposite=!0,o.points=[],o.components=[];let c=!0;for(;c;){a=r.parseUShort();let h={glyphIndex:r.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=r.parseShort(),h.dy=r.parseShort()):h.matchedPoints=[r.parseUShort(),r.parseUShort()]:(a&2)>0?(h.dx=r.parseChar(),h.dy=r.parseChar()):h.matchedPoints=[r.parseByte(),r.parseByte()],(a&8)>0?h.xScale=h.yScale=r.parseF2Dot14():(a&64)>0?(h.xScale=r.parseF2Dot14(),h.yScale=r.parseF2Dot14()):(a&128)>0&&(h.xScale=r.parseF2Dot14(),h.scale01=r.parseF2Dot14(),h.scale10=r.parseF2Dot14(),h.yScale=r.parseF2Dot14()),o.components.push(h),c=!!(a&32)}if(a&256){o.instructionLength=r.parseUShort(),o.instructions=[];for(let h=0;h<o.instructionLength;h+=1)o.instructions.push(r.parseByte())}}}function xn(o,e){let i=[];for(let r=0;r<o.length;r+=1){let a=o[r],l={x:e.xScale*a.x+e.scale01*a.y+e.dx,y:e.scale10*a.x+e.yScale*a.y+e.dy,onCurve:a.onCurve,lastPointOfContour:a.lastPointOfContour};i.push(l)}return i}function G0(o){let e=[],i=[];for(let r=0;r<o.length;r+=1){let a=o[r];i.push(a),a.lastPointOfContour&&(e.push(i),i=[])}return ne.argument(i.length===0,"There are still points left in the current contour."),e}function Zr(o){let e=new xs;if(!o)return e;let i=G0(o);for(let r=0;r<i.length;++r){let a=i[r],l=a[a.length-1],c=a[0];if(l.onCurve)e.moveTo(l.x,l.y);else if(c.onCurve)e.moveTo(c.x,c.y);else{let h={x:(l.x+c.x)*.5,y:(l.y+c.y)*.5};e.moveTo(h.x,h.y)}for(let h=0;h<a.length;++h)if(l=c,c=a[(h+1)%a.length],l.onCurve)e.lineTo(l.x,l.y);else{let p=c;c.onCurve||(p={x:(l.x+c.x)*.5,y:(l.y+c.y)*.5}),e.quadraticCurveTo(l.x,l.y,p.x,p.y)}e.closePath()}return e}function Yr(o,e){if(e.isComposite)for(let i=0;i<e.components.length;i+=1){let r=e.components[i],a=o.get(r.glyphIndex);if(a.getPath(),a.points){let l;if(r.matchedPoints===void 0)l=xn(a.points,r);else{if(r.matchedPoints[0]>e.points.length-1||r.matchedPoints[1]>a.points.length-1)throw Error("Matched points out of range in "+e.name);let c=e.points[r.matchedPoints[0]],h=a.points[r.matchedPoints[1]],p={xScale:r.xScale,scale01:r.scale01,scale10:r.scale10,yScale:r.yScale,dx:0,dy:0};h=xn([h],p)[0],p.dx=c.x-h.x,p.dy=c.y-h.y,l=xn(a.points,p)}e.points=e.points.concat(l)}}return Zr(e.points)}function z0(o,e,i,r){let a=new pt.GlyphSet(r);for(let l=0;l<i.length-1;l+=1){let c=i[l],h=i[l+1];c!==h?a.push(l,pt.ttfGlyphLoader(r,l,Xr,o,e+c,Yr)):a.push(l,pt.glyphLoader(r,l))}return a}function H0(o,e,i,r){let a=new pt.GlyphSet(r);return r._push=function(l){let c=i[l],h=i[l+1];c!==h?a.push(l,pt.ttfGlyphLoader(r,l,Xr,o,e+c,Yr)):a.push(l,pt.glyphLoader(r,l))},a}function j0(o,e,i,r,a){return a.lowMemory?H0(o,e,i,r):z0(o,e,i,r)}let Kr={getPath:Zr,parse:j0},qr,Ut,Qr,Vn;function Jr(o){this.font=o,this.getCommands=function(e){return Kr.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function W0(o){return o}function $r(o){return Math.sign(o)*Math.round(Math.abs(o))}function X0(o){return Math.sign(o)*Math.round(Math.abs(o*2))/2}function Z0(o){return Math.sign(o)*(Math.round(Math.abs(o)+.5)-.5)}function Y0(o){return Math.sign(o)*Math.ceil(Math.abs(o))}function K0(o){return Math.sign(o)*Math.floor(Math.abs(o))}let ea=function(o){let e=this.srPeriod,i=this.srPhase,r=this.srThreshold,a=1;return o<0&&(o=-o,a=-1),o+=r-i,o=Math.trunc(o/e)*e,o+=i,o<0?i*a:o*a},ut={x:1,y:0,axis:"x",distance:function(o,e,i,r){return(i?o.xo:o.x)-(r?e.xo:e.x)},interpolate:function(o,e,i,r){let a,l,c,h,p,u,d;if(!r||r===this){if(a=o.xo-e.xo,l=o.xo-i.xo,p=e.x-e.xo,u=i.x-i.xo,c=Math.abs(a),h=Math.abs(l),d=c+h,d===0){o.x=o.xo+(p+u)/2;return}o.x=o.xo+(p*h+u*c)/d;return}if(a=r.distance(o,e,!0,!0),l=r.distance(o,i,!0,!0),p=r.distance(e,e,!1,!0),u=r.distance(i,i,!1,!0),c=Math.abs(a),h=Math.abs(l),d=c+h,d===0){ut.setRelative(o,o,(p+u)/2,r,!0);return}ut.setRelative(o,o,(p*h+u*c)/d,r,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(o,e,i,r,a){if(!r||r===this){o.x=(a?e.xo:e.x)+i;return}let l=a?e.xo:e.x,c=a?e.yo:e.y,h=l+i*r.x,p=c+i*r.y;o.x=h+(o.y-p)/r.normalSlope},slope:0,touch:function(o){o.xTouched=!0},touched:function(o){return o.xTouched},untouch:function(o){o.xTouched=!1}},gt={x:0,y:1,axis:"y",distance:function(o,e,i,r){return(i?o.yo:o.y)-(r?e.yo:e.y)},interpolate:function(o,e,i,r){let a,l,c,h,p,u,d;if(!r||r===this){if(a=o.yo-e.yo,l=o.yo-i.yo,p=e.y-e.yo,u=i.y-i.yo,c=Math.abs(a),h=Math.abs(l),d=c+h,d===0){o.y=o.yo+(p+u)/2;return}o.y=o.yo+(p*h+u*c)/d;return}if(a=r.distance(o,e,!0,!0),l=r.distance(o,i,!0,!0),p=r.distance(e,e,!1,!0),u=r.distance(i,i,!1,!0),c=Math.abs(a),h=Math.abs(l),d=c+h,d===0){gt.setRelative(o,o,(p+u)/2,r,!0);return}gt.setRelative(o,o,(p*h+u*c)/d,r,!0)},normalSlope:0,setRelative:function(o,e,i,r,a){if(!r||r===this){o.y=(a?e.yo:e.y)+i;return}let l=a?e.xo:e.x,c=a?e.yo:e.y,h=l+i*r.x,p=c+i*r.y;o.y=p+r.normalSlope*(o.x-h)},slope:Number.POSITIVE_INFINITY,touch:function(o){o.yTouched=!0},touched:function(o){return o.yTouched},untouch:function(o){o.yTouched=!1}};Object.freeze(ut);Object.freeze(gt);function Ss(o,e){this.x=o,this.y=e,this.axis=void 0,this.slope=e/o,this.normalSlope=-o/e,Object.freeze(this)}Ss.prototype.distance=function(o,e,i,r){return this.x*ut.distance(o,e,i,r)+this.y*gt.distance(o,e,i,r)};Ss.prototype.interpolate=function(o,e,i,r){let a,l,c,h,p,u,d;if(c=r.distance(o,e,!0,!0),h=r.distance(o,i,!0,!0),a=r.distance(e,e,!1,!0),l=r.distance(i,i,!1,!0),p=Math.abs(c),u=Math.abs(h),d=p+u,d===0){this.setRelative(o,o,(a+l)/2,r,!0);return}this.setRelative(o,o,(a*u+l*p)/d,r,!0)};Ss.prototype.setRelative=function(o,e,i,r,a){r=r||this;let l=a?e.xo:e.x,c=a?e.yo:e.y,h=l+i*r.x,p=c+i*r.y,u=r.normalSlope,d=this.slope,m=o.x,v=o.y;o.x=(d*m-u*h+p-v)/(d-u),o.y=d*(o.x-m)+v};Ss.prototype.touch=function(o){o.xTouched=!0,o.yTouched=!0};function Ts(o,e){let i=Math.sqrt(o*o+e*e);return o/=i,e/=i,o===1&&e===0?ut:o===0&&e===1?gt:new Ss(o,e)}function yt(o,e,i,r){this.x=this.xo=Math.round(o*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=i,this.onCurve=r,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}yt.prototype.nextTouched=function(o){let e=this.nextPointOnContour;for(;!o.touched(e)&&e!==this;)e=e.nextPointOnContour;return e};yt.prototype.prevTouched=function(o){let e=this.prevPointOnContour;for(;!o.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};let gs=Object.freeze(new yt(0,0)),q0={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function It(o,e){switch(this.env=o,this.stack=[],this.prog=e,o){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=ut,this.round=$r}}Jr.prototype.exec=function(o,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let i=this.font,r=this._prepState;if(!r||r.ppem!==e){let a=this._fpgmState;if(!a){It.prototype=q0,a=this._fpgmState=new It("fpgm",i.tables.fpgm),a.funcs=[],a.font=i,exports.DEBUG&&(console.log("---EXEC FPGM---"),a.step=-1);try{Ut(a)}catch(c){console.log("Hinting error in FPGM:"+c),this._errorState=3;return}}It.prototype=a,r=this._prepState=new It("prep",i.tables.prep),r.ppem=e;let l=i.tables.cvt;if(l){let c=r.cvt=new Array(l.length),h=e/i.unitsPerEm;for(let p=0;p<l.length;p++)c[p]=l[p]*h}else r.cvt=[];exports.DEBUG&&(console.log("---EXEC PREP---"),r.step=-1);try{Ut(r)}catch(c){this._errorState<2&&console.log("Hinting error in PREP:"+c),this._errorState=2}}if(!(this._errorState>1))try{return Qr(o,r)}catch(a){this._errorState<1&&(console.log("Hinting error:"+a),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}};Qr=function(o,e){let i=e.ppem/e.font.unitsPerEm,r=i,a=o.components,l,c,h;if(It.prototype=e,!a)h=new It("glyf",o.instructions),exports.DEBUG&&(console.log("---EXEC GLYPH---"),h.step=-1),Vn(o,h,i,r),c=h.gZone;else{let p=e.font;c=[],l=[];for(let u=0;u<a.length;u++){let d=a[u],m=p.glyphs.get(d.glyphIndex);h=new It("glyf",m.instructions),exports.DEBUG&&(console.log("---EXEC COMP "+u+"---"),h.step=-1),Vn(m,h,i,r);let v=Math.round(d.dx*i),g=Math.round(d.dy*r),x=h.gZone,b=h.contours;for(let T=0;T<x.length;T++){let A=x[T];A.xTouched=A.yTouched=!1,A.xo=A.x=A.x+v,A.yo=A.y=A.y+g}let C=c.length;c.push.apply(c,x);for(let T=0;T<b.length;T++)l.push(b[T]+C)}o.instructions&&!h.inhibitGridFit&&(h=new It("glyf",o.instructions),h.gZone=h.z0=h.z1=h.z2=c,h.contours=l,c.push(new yt(0,0),new yt(Math.round(o.advanceWidth*i),0)),exports.DEBUG&&(console.log("---EXEC COMPOSITE---"),h.step=-1),Ut(h),c.length-=2)}return c};Vn=function(o,e,i,r){let a=o.points||[],l=a.length,c=e.gZone=e.z0=e.z1=e.z2=[],h=e.contours=[],p;for(let m=0;m<l;m++)p=a[m],c[m]=new yt(p.x*i,p.y*r,p.lastPointOfContour,p.onCurve);let u,d;for(let m=0;m<l;m++)p=c[m],u||(u=p,h.push(m)),p.lastPointOfContour?(p.nextPointOnContour=u,u.prevPointOnContour=p,u=void 0):(d=c[m+1],p.nextPointOnContour=d,d.prevPointOnContour=p);if(!e.inhibitGridFit){if(exports.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(let m=0;m<l;m++)console.log(m,c[m].x,c[m].y)}if(c.push(new yt(0,0),new yt(Math.round(o.advanceWidth*i),0)),Ut(e),c.length-=2,exports.DEBUG){console.log("FINISHED GLYPH",e.stack);for(let m=0;m<l;m++)console.log(m,c[m].x,c[m].y)}}};Ut=function(o){let e=o.prog;if(!e)return;let i=e.length,r;for(o.ip=0;o.ip<i;o.ip++){if(exports.DEBUG&&o.step++,r=qr[e[o.ip]],!r)throw new Error("unknown instruction: 0x"+Number(e[o.ip]).toString(16));r(o)}};function ln(o){let e=o.tZone=new Array(o.gZone.length);for(let i=0;i<e.length;i++)e[i]=new yt(0,0)}function ta(o,e){let i=o.prog,r=o.ip,a=1,l;do if(l=i[++r],l===88)a++;else if(l===89)a--;else if(l===64)r+=i[r+1]+1;else if(l===65)r+=2*i[r+1]+1;else if(l>=176&&l<=183)r+=l-176+1;else if(l>=184&&l<=191)r+=(l-184+1)*2;else if(e&&a===1&&l===27)break;while(a>0);o.ip=r}function po(o,e){exports.DEBUG&&console.log(e.step,"SVTCA["+o.axis+"]"),e.fv=e.pv=e.dpv=o}function fo(o,e){exports.DEBUG&&console.log(e.step,"SPVTCA["+o.axis+"]"),e.pv=e.dpv=o}function mo(o,e){exports.DEBUG&&console.log(e.step,"SFVTCA["+o.axis+"]"),e.fv=o}function go(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z2[r],c=e.z1[a];exports.DEBUG&&console.log("SPVTL["+o+"]",r,a);let h,p;o?(h=l.y-c.y,p=c.x-l.x):(h=c.x-l.x,p=c.y-l.y),e.pv=e.dpv=Ts(h,p)}function yo(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z2[r],c=e.z1[a];exports.DEBUG&&console.log("SFVTL["+o+"]",r,a);let h,p;o?(h=l.y-c.y,p=c.x-l.x):(h=c.x-l.x,p=c.y-l.y),e.fv=Ts(h,p)}function Q0(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"SPVFS[]",i,r),o.pv=o.dpv=Ts(r,i)}function J0(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"SPVFS[]",i,r),o.fv=Ts(r,i)}function $0(o){let e=o.stack,i=o.pv;exports.DEBUG&&console.log(o.step,"GPV[]"),e.push(i.x*16384),e.push(i.y*16384)}function eu(o){let e=o.stack,i=o.fv;exports.DEBUG&&console.log(o.step,"GFV[]"),e.push(i.x*16384),e.push(i.y*16384)}function tu(o){o.fv=o.pv,exports.DEBUG&&console.log(o.step,"SFVTPV[]")}function su(o){let e=o.stack,i=e.pop(),r=e.pop(),a=e.pop(),l=e.pop(),c=e.pop(),h=o.z0,p=o.z1,u=h[i],d=h[r],m=p[a],v=p[l],g=o.z2[c];exports.DEBUG&&console.log("ISECT[], ",i,r,a,l,c);let x=u.x,b=u.y,C=d.x,T=d.y,A=m.x,O=m.y,P=v.x,V=v.y,R=(x-C)*(O-V)-(b-T)*(A-P),I=x*T-b*C,G=A*V-O*P;g.x=(I*(A-P)-G*(x-C))/R,g.y=(I*(O-V)-G*(b-T))/R}function nu(o){o.rp0=o.stack.pop(),exports.DEBUG&&console.log(o.step,"SRP0[]",o.rp0)}function iu(o){o.rp1=o.stack.pop(),exports.DEBUG&&console.log(o.step,"SRP1[]",o.rp1)}function ou(o){o.rp2=o.stack.pop(),exports.DEBUG&&console.log(o.step,"SRP2[]",o.rp2)}function ru(o){let e=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"SZP0[]",e),o.zp0=e,e){case 0:o.tZone||ln(o),o.z0=o.tZone;break;case 1:o.z0=o.gZone;break;default:throw new Error("Invalid zone pointer")}}function au(o){let e=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"SZP1[]",e),o.zp1=e,e){case 0:o.tZone||ln(o),o.z1=o.tZone;break;case 1:o.z1=o.gZone;break;default:throw new Error("Invalid zone pointer")}}function lu(o){let e=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"SZP2[]",e),o.zp2=e,e){case 0:o.tZone||ln(o),o.z2=o.tZone;break;case 1:o.z2=o.gZone;break;default:throw new Error("Invalid zone pointer")}}function cu(o){let e=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"SZPS[]",e),o.zp0=o.zp1=o.zp2=e,e){case 0:o.tZone||ln(o),o.z0=o.z1=o.z2=o.tZone;break;case 1:o.z0=o.z1=o.z2=o.gZone;break;default:throw new Error("Invalid zone pointer")}}function hu(o){o.loop=o.stack.pop(),exports.DEBUG&&console.log(o.step,"SLOOP[]",o.loop)}function uu(o){exports.DEBUG&&console.log(o.step,"RTG[]"),o.round=$r}function pu(o){exports.DEBUG&&console.log(o.step,"RTHG[]"),o.round=Z0}function du(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SMD[]",e),o.minDis=e/64}function fu(o){exports.DEBUG&&console.log(o.step,"ELSE[]"),ta(o,!1)}function mu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"JMPR[]",e),o.ip+=e-1}function gu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SCVTCI[]",e),o.cvCutIn=e/64}function yu(o){let e=o.stack;exports.DEBUG&&console.log(o.step,"DUP[]"),e.push(e[e.length-1])}function Cn(o){exports.DEBUG&&console.log(o.step,"POP[]"),o.stack.pop()}function vu(o){exports.DEBUG&&console.log(o.step,"CLEAR[]"),o.stack.length=0}function bu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"SWAP[]"),e.push(i),e.push(r)}function xu(o){let e=o.stack;exports.DEBUG&&console.log(o.step,"DEPTH[]"),e.push(e.length)}function Cu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"LOOPCALL[]",i,r);let a=o.ip,l=o.prog;o.prog=o.funcs[i];for(let c=0;c<r;c++)Ut(o),exports.DEBUG&&console.log(++o.step,c+1<r?"next loopcall":"done loopcall",c);o.ip=a,o.prog=l}function wu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"CALL[]",e);let i=o.ip,r=o.prog;o.prog=o.funcs[e],Ut(o),o.ip=i,o.prog=r,exports.DEBUG&&console.log(++o.step,"returning from",e)}function Eu(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"CINDEX[]",i),e.push(e[e.length-i])}function Su(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"MINDEX[]",i),e.push(e.splice(e.length-i,1)[0])}function Tu(o){if(o.env!=="fpgm")throw new Error("FDEF not allowed here");let e=o.stack,i=o.prog,r=o.ip,a=e.pop(),l=r;for(exports.DEBUG&&console.log(o.step,"FDEF[]",a);i[++r]!==45;);o.ip=r,o.funcs[a]=i.slice(l+1,r)}function vo(o,e){let i=e.stack.pop(),r=e.z0[i],a=e.fv,l=e.pv;exports.DEBUG&&console.log(e.step,"MDAP["+o+"]",i);let c=l.distance(r,gs);o&&(c=e.round(c)),a.setRelative(r,gs,c,l),a.touch(r),e.rp0=e.rp1=i}function bo(o,e){let i=e.z2,r=i.length-2,a,l,c;exports.DEBUG&&console.log(e.step,"IUP["+o.axis+"]");for(let h=0;h<r;h++)a=i[h],!o.touched(a)&&(l=a.prevTouched(o),l!==a&&(c=a.nextTouched(o),l===c&&o.setRelative(a,a,o.distance(l,l,!1,!0),o,!0),o.interpolate(a,l,c,o)))}function xo(o,e){let i=e.stack,r=o?e.rp1:e.rp2,a=(o?e.z0:e.z1)[r],l=e.fv,c=e.pv,h=e.loop,p=e.z2;for(;h--;){let u=i.pop(),d=p[u],m=c.distance(a,a,!1,!0);l.setRelative(d,d,m,c),l.touch(d),exports.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-h)+": ":"")+"SHP["+(o?"rp1":"rp2")+"]",u)}e.loop=1}function Co(o,e){let i=e.stack,r=o?e.rp1:e.rp2,a=(o?e.z0:e.z1)[r],l=e.fv,c=e.pv,h=i.pop(),p=e.z2[e.contours[h]],u=p;exports.DEBUG&&console.log(e.step,"SHC["+o+"]",h);let d=c.distance(a,a,!1,!0);do u!==a&&l.setRelative(u,u,d,c),u=u.nextPointOnContour;while(u!==p)}function wo(o,e){let i=e.stack,r=o?e.rp1:e.rp2,a=(o?e.z0:e.z1)[r],l=e.fv,c=e.pv,h=i.pop();exports.DEBUG&&console.log(e.step,"SHZ["+o+"]",h);let p;switch(h){case 0:p=e.tZone;break;case 1:p=e.gZone;break;default:throw new Error("Invalid zone")}let u,d=c.distance(a,a,!1,!0),m=p.length-2;for(let v=0;v<m;v++)u=p[v],l.setRelative(u,u,d,c)}function Lu(o){let e=o.stack,i=o.loop,r=o.fv,a=e.pop()/64,l=o.z2;for(;i--;){let c=e.pop(),h=l[c];exports.DEBUG&&console.log(o.step,(o.loop>1?"loop "+(o.loop-i)+": ":"")+"SHPIX[]",c,a),r.setRelative(h,h,a),r.touch(h)}o.loop=1}function ku(o){let e=o.stack,i=o.rp1,r=o.rp2,a=o.loop,l=o.z0[i],c=o.z1[r],h=o.fv,p=o.dpv,u=o.z2;for(;a--;){let d=e.pop(),m=u[d];exports.DEBUG&&console.log(o.step,(o.loop>1?"loop "+(o.loop-a)+": ":"")+"IP[]",d,i,"<->",r),h.interpolate(m,l,c,p),h.touch(m)}o.loop=1}function Eo(o,e){let i=e.stack,r=i.pop()/64,a=i.pop(),l=e.z1[a],c=e.z0[e.rp0],h=e.fv,p=e.pv;h.setRelative(l,c,r,p),h.touch(l),exports.DEBUG&&console.log(e.step,"MSIRP["+o+"]",r,a),e.rp1=e.rp0,e.rp2=a,o&&(e.rp0=a)}function Mu(o){let e=o.stack,i=o.rp0,r=o.z0[i],a=o.loop,l=o.fv,c=o.pv,h=o.z1;for(;a--;){let p=e.pop(),u=h[p];exports.DEBUG&&console.log(o.step,(o.loop>1?"loop "+(o.loop-a)+": ":"")+"ALIGNRP[]",p),l.setRelative(u,r,0,c),l.touch(u)}o.loop=1}function Iu(o){exports.DEBUG&&console.log(o.step,"RTDG[]"),o.round=X0}function So(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z0[a],c=e.fv,h=e.pv,p=e.cvt[r];exports.DEBUG&&console.log(e.step,"MIAP["+o+"]",r,"(",p,")",a);let u=h.distance(l,gs);o&&(Math.abs(u-p)<e.cvCutIn&&(u=p),u=e.round(u)),c.setRelative(l,gs,u,h),e.zp0===0&&(l.xo=l.x,l.yo=l.y),c.touch(l),e.rp0=e.rp1=a}function Au(o){let e=o.prog,i=o.ip,r=o.stack,a=e[++i];exports.DEBUG&&console.log(o.step,"NPUSHB[]",a);for(let l=0;l<a;l++)r.push(e[++i]);o.ip=i}function _u(o){let e=o.ip,i=o.prog,r=o.stack,a=i[++e];exports.DEBUG&&console.log(o.step,"NPUSHW[]",a);for(let l=0;l<a;l++){let c=i[++e]<<8|i[++e];c&32768&&(c=-((c^65535)+1)),r.push(c)}o.ip=e}function Bu(o){let e=o.stack,i=o.store;i||(i=o.store=[]);let r=e.pop(),a=e.pop();exports.DEBUG&&console.log(o.step,"WS",r,a),i[a]=r}function Ru(o){let e=o.stack,i=o.store,r=e.pop();exports.DEBUG&&console.log(o.step,"RS",r);let a=i&&i[r]||0;e.push(a)}function Ou(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"WCVTP",i,r),o.cvt[r]=i/64}function Du(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"RCVT",i),e.push(o.cvt[i]*64)}function To(o,e){let i=e.stack,r=i.pop(),a=e.z2[r];exports.DEBUG&&console.log(e.step,"GC["+o+"]",r),i.push(e.dpv.distance(a,gs,o,!1)*64)}function Lo(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z1[r],c=e.z0[a],h=e.dpv.distance(c,l,o,o);exports.DEBUG&&console.log(e.step,"MD["+o+"]",r,a,"->",h),e.stack.push(Math.round(h*64))}function Nu(o){exports.DEBUG&&console.log(o.step,"MPPEM[]"),o.stack.push(o.ppem)}function Pu(o){exports.DEBUG&&console.log(o.step,"FLIPON[]"),o.autoFlip=!0}function Vu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"LT[]",i,r),e.push(r<i?1:0)}function Fu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"LTEQ[]",i,r),e.push(r<=i?1:0)}function Uu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"GT[]",i,r),e.push(r>i?1:0)}function Gu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"GTEQ[]",i,r),e.push(r>=i?1:0)}function zu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"EQ[]",i,r),e.push(i===r?1:0)}function Hu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"NEQ[]",i,r),e.push(i!==r?1:0)}function ju(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"ODD[]",i),e.push(Math.trunc(i)&1?1:0)}function Wu(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"EVEN[]",i),e.push(Math.trunc(i)&1?0:1)}function Xu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"IF[]",e),e||(ta(o,!0),exports.DEBUG&&console.log(o.step,"EIF[]"))}function Zu(o){exports.DEBUG&&console.log(o.step,"EIF[]")}function Yu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"AND[]",i,r),e.push(i&&r?1:0)}function Ku(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"OR[]",i,r),e.push(i||r?1:0)}function qu(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"NOT[]",i),e.push(i?0:1)}function wn(o,e){let i=e.stack,r=i.pop(),a=e.fv,l=e.pv,c=e.ppem,h=e.deltaBase+(o-1)*16,p=e.deltaShift,u=e.z0;exports.DEBUG&&console.log(e.step,"DELTAP["+o+"]",r,i);for(let d=0;d<r;d++){let m=i.pop(),v=i.pop();if(h+((v&240)>>4)!==c)continue;let g=(v&15)-8;g>=0&&g++,exports.DEBUG&&console.log(e.step,"DELTAPFIX",m,"by",g*p);let x=u[m];a.setRelative(x,x,g*p,l)}}function Qu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SDB[]",e),o.deltaBase=e}function Ju(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SDS[]",e),o.deltaShift=Math.pow(.5,e)}function $u(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"ADD[]",i,r),e.push(r+i)}function e2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"SUB[]",i,r),e.push(r-i)}function t2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"DIV[]",i,r),e.push(r*64/i)}function s2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"MUL[]",i,r),e.push(r*i/64)}function n2(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"ABS[]",i),e.push(Math.abs(i))}function i2(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"NEG[]",i),e.push(-i)}function o2(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"FLOOR[]",i),e.push(Math.floor(i/64)*64)}function r2(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"CEILING[]",i),e.push(Math.ceil(i/64)*64)}function Fs(o,e){let i=e.stack,r=i.pop();exports.DEBUG&&console.log(e.step,"ROUND[]"),i.push(e.round(r/64)*64)}function a2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"WCVTF[]",i,r),o.cvt[r]=i*o.ppem/o.font.unitsPerEm}function En(o,e){let i=e.stack,r=i.pop(),a=e.ppem,l=e.deltaBase+(o-1)*16,c=e.deltaShift;exports.DEBUG&&console.log(e.step,"DELTAC["+o+"]",r,i);for(let h=0;h<r;h++){let p=i.pop(),u=i.pop();if(l+((u&240)>>4)!==a)continue;let d=(u&15)-8;d>=0&&d++;let m=d*c;exports.DEBUG&&console.log(e.step,"DELTACFIX",p,"by",m),e.cvt[p]+=m}}function l2(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SROUND[]",e),o.round=ea;let i;switch(e&192){case 0:i=.5;break;case 64:i=1;break;case 128:i=2;break;default:throw new Error("invalid SROUND value")}switch(o.srPeriod=i,e&48){case 0:o.srPhase=0;break;case 16:o.srPhase=.25*i;break;case 32:o.srPhase=.5*i;break;case 48:o.srPhase=.75*i;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?o.srThreshold=0:o.srThreshold=(e/8-.5)*i}function c2(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"S45ROUND[]",e),o.round=ea;let i;switch(e&192){case 0:i=Math.sqrt(2)/2;break;case 64:i=Math.sqrt(2);break;case 128:i=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(o.srPeriod=i,e&48){case 0:o.srPhase=0;break;case 16:o.srPhase=.25*i;break;case 32:o.srPhase=.5*i;break;case 48:o.srPhase=.75*i;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?o.srThreshold=0:o.srThreshold=(e/8-.5)*i}function h2(o){exports.DEBUG&&console.log(o.step,"ROFF[]"),o.round=W0}function u2(o){exports.DEBUG&&console.log(o.step,"RUTG[]"),o.round=Y0}function p2(o){exports.DEBUG&&console.log(o.step,"RDTG[]"),o.round=K0}function d2(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SCANCTRL[]",e)}function ko(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z2[r],c=e.z1[a];exports.DEBUG&&console.log(e.step,"SDPVTL["+o+"]",r,a);let h,p;o?(h=l.y-c.y,p=c.x-l.x):(h=c.x-l.x,p=c.y-l.y),e.dpv=Ts(h,p)}function f2(o){let e=o.stack,i=e.pop(),r=0;exports.DEBUG&&console.log(o.step,"GETINFO[]",i),i&1&&(r=35),i&32&&(r|=4096),e.push(r)}function m2(o){let e=o.stack,i=e.pop(),r=e.pop(),a=e.pop();exports.DEBUG&&console.log(o.step,"ROLL[]"),e.push(r),e.push(i),e.push(a)}function g2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"MAX[]",i,r),e.push(Math.max(r,i))}function y2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"MIN[]",i,r),e.push(Math.min(r,i))}function v2(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SCANTYPE[]",e)}function b2(o){let e=o.stack.pop(),i=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"INSTCTRL[]",e,i),e){case 1:o.inhibitGridFit=!!i;return;case 2:o.ignoreCvt=!!i;return;default:throw new Error("invalid INSTCTRL[] selector")}}function wt(o,e){let i=e.stack,r=e.prog,a=e.ip;exports.DEBUG&&console.log(e.step,"PUSHB["+o+"]");for(let l=0;l<o;l++)i.push(r[++a]);e.ip=a}function Et(o,e){let i=e.ip,r=e.prog,a=e.stack;exports.DEBUG&&console.log(e.ip,"PUSHW["+o+"]");for(let l=0;l<o;l++){let c=r[++i]<<8|r[++i];c&32768&&(c=-((c^65535)+1)),a.push(c)}e.ip=i}function se(o,e,i,r,a,l){let c=l.stack,h=o&&c.pop(),p=c.pop(),u=l.rp0,d=l.z0[u],m=l.z1[p],v=l.minDis,g=l.fv,x=l.dpv,b,C,T,A;C=b=x.distance(m,d,!0,!0),T=C>=0?1:-1,C=Math.abs(C),o&&(A=l.cvt[h],r&&Math.abs(C-A)<l.cvCutIn&&(C=A)),i&&C<v&&(C=v),r&&(C=l.round(C)),g.setRelative(m,d,T*C,x),g.touch(m),exports.DEBUG&&console.log(l.step,(o?"MIRP[":"MDRP[")+(e?"M":"m")+(i?">":"_")+(r?"R":"_")+(a===0?"Gr":a===1?"Bl":a===2?"Wh":"")+"]",o?h+"("+l.cvt[h]+","+A+")":"",p,"(d =",b,"->",T*C,")"),l.rp1=l.rp0,l.rp2=p,e&&(l.rp0=p)}qr=[po.bind(void 0,gt),po.bind(void 0,ut),fo.bind(void 0,gt),fo.bind(void 0,ut),mo.bind(void 0,gt),mo.bind(void 0,ut),go.bind(void 0,0),go.bind(void 0,1),yo.bind(void 0,0),yo.bind(void 0,1),Q0,J0,$0,eu,tu,su,nu,iu,ou,ru,au,lu,cu,hu,uu,pu,du,fu,mu,gu,void 0,void 0,yu,Cn,vu,bu,xu,Eu,Su,void 0,void 0,void 0,Cu,wu,Tu,void 0,vo.bind(void 0,0),vo.bind(void 0,1),bo.bind(void 0,gt),bo.bind(void 0,ut),xo.bind(void 0,0),xo.bind(void 0,1),Co.bind(void 0,0),Co.bind(void 0,1),wo.bind(void 0,0),wo.bind(void 0,1),Lu,ku,Eo.bind(void 0,0),Eo.bind(void 0,1),Mu,Iu,So.bind(void 0,0),So.bind(void 0,1),Au,_u,Bu,Ru,Ou,Du,To.bind(void 0,0),To.bind(void 0,1),void 0,Lo.bind(void 0,0),Lo.bind(void 0,1),Nu,void 0,Pu,void 0,void 0,Vu,Fu,Uu,Gu,zu,Hu,ju,Wu,Xu,Zu,Yu,Ku,qu,wn.bind(void 0,1),Qu,Ju,$u,e2,t2,s2,n2,i2,o2,r2,Fs.bind(void 0,0),Fs.bind(void 0,1),Fs.bind(void 0,2),Fs.bind(void 0,3),void 0,void 0,void 0,void 0,a2,wn.bind(void 0,2),wn.bind(void 0,3),En.bind(void 0,1),En.bind(void 0,2),En.bind(void 0,3),l2,c2,void 0,void 0,h2,void 0,u2,p2,Cn,Cn,void 0,void 0,void 0,void 0,void 0,d2,ko.bind(void 0,0),ko.bind(void 0,1),f2,void 0,m2,g2,y2,v2,b2,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,wt.bind(void 0,1),wt.bind(void 0,2),wt.bind(void 0,3),wt.bind(void 0,4),wt.bind(void 0,5),wt.bind(void 0,6),wt.bind(void 0,7),wt.bind(void 0,8),Et.bind(void 0,1),Et.bind(void 0,2),Et.bind(void 0,3),Et.bind(void 0,4),Et.bind(void 0,5),Et.bind(void 0,6),Et.bind(void 0,7),Et.bind(void 0,8),se.bind(void 0,0,0,0,0,0),se.bind(void 0,0,0,0,0,1),se.bind(void 0,0,0,0,0,2),se.bind(void 0,0,0,0,0,3),se.bind(void 0,0,0,0,1,0),se.bind(void 0,0,0,0,1,1),se.bind(void 0,0,0,0,1,2),se.bind(void 0,0,0,0,1,3),se.bind(void 0,0,0,1,0,0),se.bind(void 0,0,0,1,0,1),se.bind(void 0,0,0,1,0,2),se.bind(void 0,0,0,1,0,3),se.bind(void 0,0,0,1,1,0),se.bind(void 0,0,0,1,1,1),se.bind(void 0,0,0,1,1,2),se.bind(void 0,0,0,1,1,3),se.bind(void 0,0,1,0,0,0),se.bind(void 0,0,1,0,0,1),se.bind(void 0,0,1,0,0,2),se.bind(void 0,0,1,0,0,3),se.bind(void 0,0,1,0,1,0),se.bind(void 0,0,1,0,1,1),se.bind(void 0,0,1,0,1,2),se.bind(void 0,0,1,0,1,3),se.bind(void 0,0,1,1,0,0),se.bind(void 0,0,1,1,0,1),se.bind(void 0,0,1,1,0,2),se.bind(void 0,0,1,1,0,3),se.bind(void 0,0,1,1,1,0),se.bind(void 0,0,1,1,1,1),se.bind(void 0,0,1,1,1,2),se.bind(void 0,0,1,1,1,3),se.bind(void 0,1,0,0,0,0),se.bind(void 0,1,0,0,0,1),se.bind(void 0,1,0,0,0,2),se.bind(void 0,1,0,0,0,3),se.bind(void 0,1,0,0,1,0),se.bind(void 0,1,0,0,1,1),se.bind(void 0,1,0,0,1,2),se.bind(void 0,1,0,0,1,3),se.bind(void 0,1,0,1,0,0),se.bind(void 0,1,0,1,0,1),se.bind(void 0,1,0,1,0,2),se.bind(void 0,1,0,1,0,3),se.bind(void 0,1,0,1,1,0),se.bind(void 0,1,0,1,1,1),se.bind(void 0,1,0,1,1,2),se.bind(void 0,1,0,1,1,3),se.bind(void 0,1,1,0,0,0),se.bind(void 0,1,1,0,0,1),se.bind(void 0,1,1,0,0,2),se.bind(void 0,1,1,0,0,3),se.bind(void 0,1,1,0,1,0),se.bind(void 0,1,1,0,1,1),se.bind(void 0,1,1,0,1,2),se.bind(void 0,1,1,0,1,3),se.bind(void 0,1,1,1,0,0),se.bind(void 0,1,1,1,0,1),se.bind(void 0,1,1,1,0,2),se.bind(void 0,1,1,1,0,3),se.bind(void 0,1,1,1,1,0),se.bind(void 0,1,1,1,1,1),se.bind(void 0,1,1,1,1,2),se.bind(void 0,1,1,1,1,3)];let x2=Jr;function ss(o){this.char=o,this.state={},this.activeState=null}function bi(o,e,i){this.contextName=i,this.startIndex=o,this.endOffset=e}function C2(o,e,i){this.contextName=o,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=i}function He(o,e){this.context=o,this.index=e,this.length=o.length,this.current=o[e],this.backtrack=o.slice(0,e),this.lookahead=o.slice(e+1)}function cn(o){this.eventId=o,this.subscribers=[]}function w2(o){let e=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let r=0;r<e.length;r++){let a=e[r];Object.defineProperty(this.events,a,{value:new cn(a)})}if(o)for(let r=0;r<e.length;r++){let a=e[r],l=o[a];typeof l=="function"&&this.events[a].subscribe(l)}let i=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let r=0;r<i.length;r++){let a=i[r];this.events[a].subscribe(this.updateContextsRanges)}}function Le(o){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],w2.call(this,o)}ss.prototype.setState=function(o,e){return this.state[o]=e,this.activeState={key:o,value:this.state[o]},this.activeState};ss.prototype.getState=function(o){return this.state[o]||null};Le.prototype.inboundIndex=function(o){return o>=0&&o<this.tokens.length};Le.prototype.composeRUD=function(o){let e=o.map(r=>this[r[0]].apply(this,r.slice(1).concat(!0))),i=r=>typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,"FAIL");if(e.every(i))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:e.filter(i)};this.dispatch("composeRUD",[e.filter(r=>!i(r))])};Le.prototype.replaceRange=function(o,e,i,r){e=e!==null?e:this.tokens.length;let a=i.every(l=>l instanceof ss);if(!isNaN(o)&&this.inboundIndex(o)&&a){let l=this.tokens.splice.apply(this.tokens,[o,e].concat(i));return r||this.dispatch("replaceToken",[o,e,i]),[l,i]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}};Le.prototype.replaceToken=function(o,e,i){if(!isNaN(o)&&this.inboundIndex(o)&&e instanceof ss){let r=this.tokens.splice(o,1,e);return i||this.dispatch("replaceToken",[o,e]),[r[0],e]}else return{FAIL:"replaceToken: invalid token or index."}};Le.prototype.removeRange=function(o,e,i){e=isNaN(e)?this.tokens.length:e;let r=this.tokens.splice(o,e);return i||this.dispatch("removeRange",[r,o,e]),r};Le.prototype.removeToken=function(o,e){if(!isNaN(o)&&this.inboundIndex(o)){let i=this.tokens.splice(o,1);return e||this.dispatch("removeToken",[i,o]),i}else return{FAIL:"removeToken: invalid token index."}};Le.prototype.insertToken=function(o,e,i){return o.every(r=>r instanceof ss)?(this.tokens.splice.apply(this.tokens,[e,0].concat(o)),i||this.dispatch("insertToken",[o,e]),o):{FAIL:"insertToken: invalid token(s)."}};Le.prototype.registerModifier=function(o,e,i){this.events.newToken.subscribe(function(r,a){let l=[r,a],c=e===null||e.apply(this,l)===!0,h=[r,a];if(c){let p=i.apply(this,h);r.setState(o,p)}}),this.registeredModifiers.push(o)};cn.prototype.subscribe=function(o){return typeof o=="function"?this.subscribers.push(o)-1:{FAIL:`invalid '${this.eventId}' event handler`}};cn.prototype.unsubscribe=function(o){this.subscribers.splice(o,1)};He.prototype.setCurrentIndex=function(o){this.index=o,this.current=this.context[o],this.backtrack=this.context.slice(0,o),this.lookahead=this.context.slice(o+1)};He.prototype.get=function(o){switch(!0){case o===0:return this.current;case(o<0&&Math.abs(o)<=this.backtrack.length):return this.backtrack.slice(o)[0];case(o>0&&o<=this.lookahead.length):return this.lookahead[o-1];default:return null}};Le.prototype.rangeToText=function(o){if(o instanceof bi)return this.getRangeTokens(o).map(e=>e.char).join("")};Le.prototype.getText=function(){return this.tokens.map(o=>o.char).join("")};Le.prototype.getContext=function(o){return this.registeredContexts[o]||null};Le.prototype.on=function(o,e){let i=this.events[o];return i?i.subscribe(e):null};Le.prototype.dispatch=function(o,e){let i=this.events[o];if(i instanceof cn)for(let r=0;r<i.subscribers.length;r++)i.subscribers[r].apply(this,e||[])};Le.prototype.registerContextChecker=function(o,e,i){if(this.getContext(o))return{FAIL:`context name '${o}' is already registered.`};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof i!="function")return{FAIL:"missing context end check."};let r=new C2(o,e,i);return this.registeredContexts[o]=r,this.contextCheckers.push(r),r};Le.prototype.getRangeTokens=function(o){let e=o.startIndex+o.endOffset;return[].concat(this.tokens.slice(o.startIndex,e))};Le.prototype.getContextRanges=function(o){let e=this.getContext(o);return e?e.ranges:{FAIL:`context checker '${o}' is not registered.`}};Le.prototype.resetContextsRanges=function(){let o=this.registeredContexts;for(let e in o)if(Object.prototype.hasOwnProperty.call(o,e)){let i=o[e];i.ranges=[]}};Le.prototype.updateContextsRanges=function(){this.resetContextsRanges();let o=this.tokens.map(e=>e.char);for(let e=0;e<o.length;e++){let i=new He(o,e);this.runContextCheck(i)}this.dispatch("updateContextsRanges",[this.registeredContexts])};Le.prototype.setEndOffset=function(o,e){let i=this.getContext(e).openRange.startIndex,r=new bi(i,o,e),a=this.getContext(e).ranges;return r.rangeId=`${e}.${a.length}`,a.push(r),this.getContext(e).openRange=null,r};Le.prototype.runContextCheck=function(o){let e=o.index;for(let i=0;i<this.contextCheckers.length;i++){let r=this.contextCheckers[i],a=r.contextName,l=this.getContext(a).openRange;if(!l&&r.checkStart(o)&&(l=new bi(e,null,a),this.getContext(a).openRange=l,this.dispatch("contextStart",[a,e])),l&&r.checkEnd(o)){let c=e-l.startIndex+1,h=this.setEndOffset(c,a);this.dispatch("contextEnd",[a,h])}}};Le.prototype.tokenize=function(o){this.tokens=[],this.resetContextsRanges();let e=Array.from(o);this.dispatch("start");for(let i=0;i<e.length;i++){let r=e[i],a=new He(e,i);this.dispatch("next",[a]),this.runContextCheck(a);let l=new ss(r);this.tokens.push(l),this.dispatch("newToken",[l,a])}return this.dispatch("end",[this.tokens]),this.tokens};let E2=Le;function At(o){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(o)}function sa(o){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(o)}function _t(o){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(o)}function Hs(o){return/[\u0E00-\u0E7F]/.test(o)}function js(o){return/[A-z]/.test(o)}function S2(o){return/\s/.test(o)}function qe(o){this.font=o,this.features={}}function Ft(o){this.id=o.id,this.tag=o.tag,this.substitution=o.substitution}function Ls(o,e){if(!o)return-1;switch(e.format){case 1:return e.glyphs.indexOf(o);case 2:{let i=e.ranges;for(let r=0;r<i.length;r++){let a=i[r];if(o>=a.start&&o<=a.end){let l=o-a.start;return a.index+l}}break}default:return-1}return-1}function T2(o,e){return Ls(o,e.coverage)===-1?null:o+e.deltaGlyphId}function L2(o,e){let i=Ls(o,e.coverage);return i===-1?null:e.substitute[i]}function Sn(o,e){let i=[];for(let r=0;r<o.length;r++){let a=o[r],l=e.current;l=Array.isArray(l)?l[0]:l;let c=Ls(l,a);c!==-1&&i.push(c)}return i.length!==o.length?-1:i}function k2(o,e){let i=e.inputCoverage.length+e.lookaheadCoverage.length+e.backtrackCoverage.length;if(o.context.length<i)return[];let r=Sn(e.inputCoverage,o);if(r===-1)return[];let a=e.inputCoverage.length-1;if(o.lookahead.length<e.lookaheadCoverage.length)return[];let l=o.lookahead.slice(a);for(;l.length&&_t(l[0].char);)l.shift();let c=new He(l,0),h=Sn(e.lookaheadCoverage,c),p=[].concat(o.backtrack);for(p.reverse();p.length&&_t(p[0].char);)p.shift();if(p.length<e.backtrackCoverage.length)return[];let u=new He(p,0),d=Sn(e.backtrackCoverage,u),m=r.length===e.inputCoverage.length&&h.length===e.lookaheadCoverage.length&&d.length===e.backtrackCoverage.length,v=[];if(m)for(let g=0;g<e.lookupRecords.length;g++){let x=e.lookupRecords[g].lookupListIndex,b=this.getLookupByIndex(x);for(let C=0;C<b.subtables.length;C++){let T=b.subtables[C],A,O=this.getSubstitutionType(b,T);if(O==="71"?(O=this.getSubstitutionType(T,T.extension),A=this.getLookupMethod(T,T.extension),T=T.extension):A=this.getLookupMethod(b,T),O==="12")for(let P=0;P<r.length;P++){let V=o.get(P),R=A(V);R&&v.push(R)}else throw new Error(`Substitution type ${O} is not supported in chaining substitution`)}}return v}function M2(o,e){let i=o.current,r=Ls(i,e.coverage);if(r===-1)return null;let a,l=e.ligatureSets[r];for(let c=0;c<l.length;c++){a=l[c];for(let h=0;h<a.components.length;h++){let p=o.lookahead[h],u=a.components[h];if(p!==u)break;if(h===a.components.length-1)return a}}return null}function I2(o,e){let i=Ls(o,e.coverage);return i===-1?null:e.sequences[i]}qe.prototype.getDefaultScriptFeaturesIndexes=function(){let o=this.font.tables.gsub.scripts;for(let e=0;e<o.length;e++){let i=o[e];if(i.tag==="DFLT")return i.script.defaultLangSys.featureIndexes}return[]};qe.prototype.getScriptFeaturesIndexes=function(o){if(!this.font.tables.gsub)return[];if(!o)return this.getDefaultScriptFeaturesIndexes();let e=this.font.tables.gsub.scripts;for(let i=0;i<e.length;i++){let r=e[i];if(r.tag===o&&r.script.defaultLangSys)return r.script.defaultLangSys.featureIndexes;{let a=r.langSysRecords;if(a)for(let l=0;l<a.length;l++){let c=a[l];if(c.tag===o)return c.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()};qe.prototype.mapTagsToFeatures=function(o,e){let i={};for(let r=0;r<o.length;r++){let a=o[r].tag,l=o[r].feature;i[a]=l}this.features[e].tags=i};qe.prototype.getScriptFeatures=function(o){let e=this.features[o];if(Object.prototype.hasOwnProperty.call(this.features,o))return e;let i=this.getScriptFeaturesIndexes(o);if(!i)return null;let r=this.font.tables.gsub;return e=i.map(a=>r.features[a]),this.features[o]=e,this.mapTagsToFeatures(e,o),e};qe.prototype.getSubstitutionType=function(o,e){let i=o.lookupType.toString(),r=e.substFormat.toString();return i+r};qe.prototype.getLookupMethod=function(o,e){switch(this.getSubstitutionType(o,e)){case"11":return i=>T2.apply(this,[i,e]);case"12":return i=>L2.apply(this,[i,e]);case"63":return i=>k2.apply(this,[i,e]);case"41":return i=>M2.apply(this,[i,e]);case"21":return i=>I2.apply(this,[i,e]);default:throw new Error(`lookupType: ${o.lookupType} - substFormat: ${e.substFormat} is not yet supported`)}};qe.prototype.lookupFeature=function(o){let e=o.contextParams,i=e.index,r=this.getFeature({tag:o.tag,script:o.script});if(!r)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${o.tag}' for script '${o.script}'.`);let a=this.getFeatureLookups(r),l=[].concat(e.context);for(let c=0;c<a.length;c++){let h=a[c],p=this.getLookupSubtables(h);for(let u=0;u<p.length;u++){let d=p[u],m=this.getSubstitutionType(h,d),v;m==="71"?(m=this.getSubstitutionType(d,d.extension),v=this.getLookupMethod(d,d.extension),d=d.extension):v=this.getLookupMethod(h,d);let g;switch(m){case"11":g=v(e.current),g&&l.splice(i,1,new Ft({id:11,tag:o.tag,substitution:g}));break;case"12":g=v(e.current),g&&l.splice(i,1,new Ft({id:12,tag:o.tag,substitution:g}));break;case"63":g=v(e),Array.isArray(g)&&g.length&&l.splice(i,1,new Ft({id:63,tag:o.tag,substitution:g}));break;case"41":g=v(e),g&&l.splice(i,1,new Ft({id:41,tag:o.tag,substitution:g}));break;case"21":g=v(e.current),g&&l.splice(i,1,new Ft({id:21,tag:o.tag,substitution:g}));break}e=new He(l,i),!(Array.isArray(g)&&!g.length)&&(g=null)}}return l.length?l:null};qe.prototype.supports=function(o){if(!o.script)return!1;this.getScriptFeatures(o.script);let e=Object.prototype.hasOwnProperty.call(this.features,o.script);if(!o.tag)return e;let i=this.features[o.script].some(r=>r.tag===o.tag);return e&&i};qe.prototype.getLookupSubtables=function(o){return o.subtables||null};qe.prototype.getLookupByIndex=function(o){return this.font.tables.gsub.lookups[o]||null};qe.prototype.getFeatureLookups=function(o){return o.lookupListIndexes.map(this.getLookupByIndex.bind(this))};qe.prototype.getFeature=function(o){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,o.script)||this.getScriptFeatures(o.script);let e=this.features[o.script];return e?e.tags[o.tag]?this.features[o.script].tags[o.tag]:null:{FAIL:`No feature for script ${o.script}`}};let A2=qe;function _2(o){let e=o.current,i=o.get(-1);return i===null&&At(e)||!At(i)&&At(e)}function B2(o){let e=o.get(1);return e===null||!At(e)}let R2={startCheck:_2,endCheck:B2};function O2(o){let e=o.current,i=o.get(-1);return(At(e)||_t(e))&&!At(i)}function D2(o){let e=o.get(1);switch(!0){case e===null:return!0;case(!At(e)&&!_t(e)):{let i=S2(e);if(!i)return!0;if(i){let r=!1;if(r=o.lookahead.some(a=>At(a)||_t(a)),!r)return!0}break}default:return!1}}let N2={startCheck:O2,endCheck:D2};function P2(o,e,i){e[i].setState(o.tag,o.substitution)}function V2(o,e,i){e[i].setState(o.tag,o.substitution)}function F2(o,e,i){for(let r=0;r<o.substitution.length;r++){let a=o.substitution[r];e[i+r].setState(o.tag,a)}}function U2(o,e,i){let r=e[i];r.setState(o.tag,o.substitution.ligGlyph);let a=o.substitution.components.length;for(let l=0;l<a;l++)r=e[i+l+1],r.setState("deleted",!0)}let Mo={11:P2,12:V2,63:F2,41:U2};function G2(o,e,i){o instanceof Ft&&Mo[o.id]&&Mo[o.id](o,e,i)}let ns=G2;function z2(o){let e=[].concat(o.backtrack);for(let i=e.length-1;i>=0;i--){let r=e[i],a=sa(r),l=_t(r);if(!a&&!l)return!0;if(a)return!1}return!1}function H2(o){if(sa(o.current))return!1;for(let e=0;e<o.lookahead.length;e++){let i=o.lookahead[e];if(!_t(i))return!0}return!1}function j2(o){let e="arab",i=this.featuresTags[e],r=this.tokenizer.getRangeTokens(o);if(r.length===1)return;let a=new He(r.map(c=>c.getState("glyphIndex")),0),l=new He(r.map(c=>c.char),0);for(let c=0;c<r.length;c++){let h=r[c];if(_t(h.char))continue;a.setCurrentIndex(c),l.setCurrentIndex(c);let p=0;z2(l)&&(p|=1),H2(l)&&(p|=2);let u;switch(p){case 1:u="fina";break;case 2:u="init";break;case 3:u="medi";break}if(i.indexOf(u)===-1)continue;let d=this.query.lookupFeature({tag:u,script:e,contextParams:a});if(d instanceof Error){console.info(d.message);continue}for(let m=0;m<d.length;m++){let v=d[m];v instanceof Ft&&(ns(v,r,m),a.context[m]=v.substitution)}}}let W2=j2;function Io(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function X2(o){let e="arab",i=this.tokenizer.getRangeTokens(o),r=Io(i);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"rlig",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];ns(h,i,a)}r=Io(i)}}}let Z2=X2;function Y2(o){let e=o.current,i=o.get(-1);return i===null&&js(e)||!js(i)&&js(e)}function K2(o){let e=o.get(1);return e===null||!js(e)}let q2={startCheck:Y2,endCheck:K2};function Ao(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function Q2(o){let e="latn",i=this.tokenizer.getRangeTokens(o),r=Ao(i);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"liga",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];ns(h,i,a)}r=Ao(i)}}}let J2=Q2;function $2(o){let e=o.current,i=o.get(-1);return i===null&&Hs(e)||!Hs(i)&&Hs(e)}function ep(o){let e=o.get(1);return e===null||!Hs(e)}let tp={startCheck:$2,endCheck:ep};function _o(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function sp(o){let e="thai",i=this.tokenizer.getRangeTokens(o),r=_o(i,0);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"ccmp",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];ns(h,i,a)}r=_o(i,a)}}}let np=sp;function Bo(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function ip(o){let e="thai",i=this.tokenizer.getRangeTokens(o),r=Bo(i,0);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"liga",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];ns(h,i,a)}r=Bo(i,a)}}}let op=ip;function Ro(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function rp(o){let e="thai",i=this.tokenizer.getRangeTokens(o),r=Ro(i,0);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"rlig",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];ns(h,i,a)}r=Ro(i,a)}}}let ap=rp;function Fn(o){if(o===null)return!1;let e=o.codePointAt(0);return e>=6155&&e<=6157||e>=65024&&e<=65039||e>=917760&&e<=917999}function lp(o){let e=o.current,i=o.get(1);return i===null&&Fn(e)||Fn(i)}function cp(o){let e=o.get(1);return e===null||!Fn(e)}let hp={startCheck:lp,endCheck:cp};function up(o){let e=this.query.font,i=this.tokenizer.getRangeTokens(o);if(i[1].setState("deleted",!0),e.tables.cmap&&e.tables.cmap.varSelectorList){let r=i[0].char.codePointAt(0),a=i[1].char.codePointAt(0),l=e.tables.cmap.varSelectorList[a];if(l!==void 0&&l.nonDefaultUVS){let c=l.nonDefaultUVS.uvsMappings;if(c[r]){let h=c[r].glyphID;e.glyphs.glyphs[h]!==void 0&&i[0].setState("glyphIndex",h)}}}}let pp=up;function $e(o){this.baseDir=o||"ltr",this.tokenizer=new E2,this.featuresTags={}}$e.prototype.setText=function(o){this.text=o};$e.prototype.contextChecks={latinWordCheck:q2,arabicWordCheck:R2,arabicSentenceCheck:N2,thaiWordCheck:tp,unicodeVariationSequenceCheck:hp};function ls(o){let e=this.contextChecks[`${o}Check`];return this.tokenizer.registerContextChecker(o,e.startCheck,e.endCheck)}function dp(){return ls.call(this,"latinWord"),ls.call(this,"arabicWord"),ls.call(this,"arabicSentence"),ls.call(this,"thaiWord"),ls.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function fp(){let o=this.tokenizer.getContextRanges("arabicSentence");for(let e=0;e<o.length;e++){let i=o[e],r=this.tokenizer.getRangeTokens(i);this.tokenizer.replaceRange(i.startIndex,i.endOffset,r.reverse())}}$e.prototype.registerFeatures=function(o,e){let i=e.filter(r=>this.query.supports({script:o,tag:r}));Object.prototype.hasOwnProperty.call(this.featuresTags,o)?this.featuresTags[o]=this.featuresTags[o].concat(i):this.featuresTags[o]=i};$e.prototype.applyFeatures=function(o,e){if(!o)throw new Error("No valid font was provided to apply features");this.query||(this.query=new A2(o));for(let i=0;i<e.length;i++){let r=e[i];this.query.supports({script:r.script})&&this.registerFeatures(r.script,r.tags)}};$e.prototype.registerModifier=function(o,e,i){this.tokenizer.registerModifier(o,e,i)};function hn(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function mp(){let o="arab";if(!Object.prototype.hasOwnProperty.call(this.featuresTags,o))return;hn.call(this);let e=this.tokenizer.getContextRanges("arabicWord");for(let i=0;i<e.length;i++){let r=e[i];W2.call(this,r)}}function gp(){if(!this.hasFeatureEnabled("arab","rlig"))return;hn.call(this);let o=this.tokenizer.getContextRanges("arabicWord");for(let e=0;e<o.length;e++){let i=o[e];Z2.call(this,i)}}function yp(){if(!this.hasFeatureEnabled("latn","liga"))return;hn.call(this);let o=this.tokenizer.getContextRanges("latinWord");for(let e=0;e<o.length;e++){let i=o[e];J2.call(this,i)}}function vp(){let o=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let e=0;e<o.length;e++){let i=o[e];pp.call(this,i)}}function bp(){hn.call(this);let o=this.tokenizer.getContextRanges("thaiWord");for(let e=0;e<o.length;e++){let i=o[e];this.hasFeatureEnabled("thai","liga")&&op.call(this,i),this.hasFeatureEnabled("thai","rlig")&&ap.call(this,i),this.hasFeatureEnabled("thai","ccmp")&&np.call(this,i)}}$e.prototype.checkContextReady=function(o){return!!this.tokenizer.getContext(o)};$e.prototype.applyFeaturesToContexts=function(){this.checkContextReady("arabicWord")&&(mp.call(this),gp.call(this)),this.checkContextReady("latinWord")&&yp.call(this),this.checkContextReady("arabicSentence")&&fp.call(this),this.checkContextReady("thaiWord")&&bp.call(this),this.checkContextReady("unicodeVariationSequence")&&vp.call(this)};$e.prototype.hasFeatureEnabled=function(o,e){return(this.featuresTags[o]||[]).indexOf(e)!==-1};$e.prototype.processText=function(o){(!this.text||this.text!==o)&&(this.setText(o),dp.call(this),this.applyFeaturesToContexts())};$e.prototype.getBidiText=function(o){return this.processText(o),this.tokenizer.getText()};$e.prototype.getTextGlyphs=function(o){this.processText(o);let e=[];for(let i=0;i<this.tokenizer.tokens.length;i++){let r=this.tokenizer.tokens[i];if(r.state.deleted)continue;let a=r.activeState.value;e.push(Array.isArray(a)?a[0]:a)}return e};let xp=$e;function Tn(o){return{fontFamily:{en:o.familyName||" "},fontSubfamily:{en:o.styleName||" "},fullName:{en:o.fullName||o.familyName+" "+o.styleName},postScriptName:{en:o.postScriptName||(o.familyName+o.styleName).replace(/\s/g,"")},designer:{en:o.designer||" "},designerURL:{en:o.designerURL||" "},manufacturer:{en:o.manufacturer||" "},manufacturerURL:{en:o.manufacturerURL||" "},license:{en:o.license||" "},licenseURL:{en:o.licenseURL||" "},version:{en:o.version||"Version 0.1"},description:{en:o.description||" "},copyright:{en:o.copyright||" "},trademark:{en:o.trademark||" "}}}function Ce(o){o=o||{},o.tables=o.tables||{},o.empty||(as(o.familyName,"When creating a new Font object, familyName is required."),as(o.styleName,"When creating a new Font object, styleName is required."),as(o.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),as(o.ascender,"When creating a new Font object, ascender is required."),as(o.descender<=0,"When creating a new Font object, negative descender value is required."),this.names={},this.names.unicode=Tn(o),this.names.macintosh=Tn(o),this.names.windows=Tn(o),this.unitsPerEm=o.unitsPerEm||1e3,this.ascender=o.ascender,this.descender=o.descender,this.createdTimestamp=o.createdTimestamp,this.tables=Object.assign(o.tables,{os2:Object.assign({usWeightClass:o.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:o.widthClass||this.usWidthClasses.MEDIUM,fsSelection:o.fsSelection||this.fsSelectionValues.REGULAR},o.tables.os2)})),this.supported=!0,this.glyphs=new pt.GlyphSet(this,o.glyphs||[]),this.encoding=new fr(this),this.position=new F0(this),this.substitution=new U0(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new x2(this):null}})}Ce.prototype.hasChar=function(o){return this.encoding.charToGlyphIndex(o)!==null};Ce.prototype.charToGlyphIndex=function(o){return this.encoding.charToGlyphIndex(o)};Ce.prototype.charToGlyph=function(o){let e=this.charToGlyphIndex(o),i=this.glyphs.get(e);return i||(i=this.glyphs.get(0)),i};Ce.prototype.updateFeatures=function(o){return this.defaultRenderOptions.features.map(e=>e.script==="latn"?{script:"latn",tags:e.tags.filter(i=>o[i])}:e)};Ce.prototype.stringToGlyphIndexes=function(o,e){let i=new xp,r=l=>this.charToGlyphIndex(l.char);i.registerModifier("glyphIndex",null,r);let a=e?this.updateFeatures(e.features):this.defaultRenderOptions.features;return i.applyFeatures(this,a),i.getTextGlyphs(o)};Ce.prototype.stringToGlyphs=function(o,e){let i=this.stringToGlyphIndexes(o,e),r=i.length,a=new Array(r),l=this.glyphs.get(0);for(let c=0;c<r;c+=1)a[c]=this.glyphs.get(i[c])||l;return a};Ce.prototype.nameToGlyphIndex=function(o){return this.glyphNames.nameToGlyphIndex(o)};Ce.prototype.nameToGlyph=function(o){let e=this.nameToGlyphIndex(o),i=this.glyphs.get(e);return i||(i=this.glyphs.get(0)),i};Ce.prototype.glyphIndexToName=function(o){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(o):""};Ce.prototype.getKerningValue=function(o,e){o=o.index||o,e=e.index||e;let i=this.position.defaultKerningTables;return i?this.position.getKerningValue(i,o,e):this.kerningPairs[o+","+e]||0};Ce.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]},{script:"thai",tags:["liga","rlig","ccmp"]}]};Ce.prototype.forEachGlyph=function(o,e,i,r,a,l){e=e!==void 0?e:0,i=i!==void 0?i:0,r=r!==void 0?r:72,a=Object.assign({},this.defaultRenderOptions,a);let c=1/this.unitsPerEm*r,h=this.stringToGlyphs(o,a),p;if(a.kerning){let u=a.script||this.position.getDefaultScriptName();p=this.position.getKerningTables(u,a.language)}for(let u=0;u<h.length;u+=1){let d=h[u];if(l.call(this,d,e,i,r,a),d.advanceWidth&&(e+=d.advanceWidth*c),a.kerning&&u<h.length-1){let m=p?this.position.getKerningValue(p,d.index,h[u+1].index):this.getKerningValue(d,h[u+1]);e+=m*c}a.letterSpacing?e+=a.letterSpacing*r:a.tracking&&(e+=a.tracking/1e3*r)}return e};Ce.prototype.getPath=function(o,e,i,r,a){let l=new xs;return this.forEachGlyph(o,e,i,r,a,function(c,h,p,u){let d=c.getPath(h,p,u,a,this);l.extend(d)}),l};Ce.prototype.getPaths=function(o,e,i,r,a){let l=[];return this.forEachGlyph(o,e,i,r,a,function(c,h,p,u){let d=c.getPath(h,p,u,a,this);l.push(d)}),l};Ce.prototype.getAdvanceWidth=function(o,e,i){return this.forEachGlyph(o,0,0,e,i,function(){})};Ce.prototype.draw=function(o,e,i,r,a,l){this.getPath(e,i,r,a,l).draw(o)};Ce.prototype.drawPoints=function(o,e,i,r,a,l){this.forEachGlyph(e,i,r,a,l,function(c,h,p,u){c.drawPoints(o,h,p,u)})};Ce.prototype.drawMetrics=function(o,e,i,r,a,l){this.forEachGlyph(e,i,r,a,l,function(c,h,p,u){c.drawMetrics(o,h,p,u)})};Ce.prototype.getEnglishName=function(o){let e=(this.names.unicode||this.names.macintosh||this.names.windows)[o];if(e)return e.en};Ce.prototype.validate=function(){let o=this;function e(r,a){}function i(r){let a=o.getEnglishName(r);a&&a.trim().length>0}i("fontFamily"),i("weightName"),i("manufacturer"),i("copyright"),i("version"),this.unitsPerEm>0};Ce.prototype.toTables=function(){return V0.fontToTable(this)};Ce.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()};Ce.prototype.toArrayBuffer=function(){let o=this.toTables().encode(),e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(let r=0;r<o.length;r++)i[r]=o[r];return e};Ce.prototype.download=function(o){let e=this.getEnglishName("fontFamily"),i=this.getEnglishName("fontSubfamily");o=o||e.replace(/\s/g,"")+"-"+i+".otf";let r=this.toArrayBuffer();if(g0())if(window.URL=window.URL||window.webkitURL,window.URL){let a=new DataView(r),l=new Blob([a],{type:"font/opentype"}),c=document.createElement("a");c.href=window.URL.createObjectURL(l),c.download=o;let h=document.createEvent("MouseEvents");h.initEvent("click",!0,!1),c.dispatchEvent(h)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{let a=Ic("fs"),l=Buffer.alloc(r.byteLength),c=new Uint8Array(r);for(let h=0;h<l.length;++h)l[h]=c[h];a.writeFileSync(o,l)}};Ce.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512};Ce.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9};Ce.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};let Cp=Ce;function wp(){console.warn("Writing of gvar tables is not yet supported.")}function Ep(){console.warn("Parsing of gvar tables is not yet supported.")}let Sp={make:wp,parse:Ep},Tp=function(){return{coverage:this.parsePointer(N.coverage),attachPoints:this.parseList(N.pointer(N.uShortList))}},Lp=function(){let o=this.parseUShort();if(ne.argument(o===1||o===2||o===3,"Unsupported CaretValue table version."),o===1)return{coordinate:this.parseShort()};if(o===2)return{pointindex:this.parseShort()};if(o===3)return{coordinate:this.parseShort()}},kp=function(){return this.parseList(N.pointer(Lp))},Mp=function(){return{coverage:this.parsePointer(N.coverage),ligGlyphs:this.parseList(N.pointer(kp))}},Ip=function(){return this.parseUShort(),this.parseList(N.pointer(N.coverage))};function Ap(o,e){e=e||0;let i=new N(o,e),r=i.parseVersion(1);ne.argument(r===1||r===1.2||r===1.3,"Unsupported GDEF table version.");let a={version:r,classDef:i.parsePointer(N.classDef),attachList:i.parsePointer(Tp),ligCaretList:i.parsePointer(Mp),markAttachClassDef:i.parsePointer(N.classDef)};return r>=1.2&&(a.markGlyphSets=i.parsePointer(Ip)),a}let _p={parse:Ap},nt=new Array(10);nt[1]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{posFormat:1,coverage:this.parsePointer(N.coverage),value:this.parseValueRecord()};if(e===2)return{posFormat:2,coverage:this.parsePointer(N.coverage),values:this.parseValueRecordList()};ne.assert(!1,"0x"+o.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")};nt[2]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();ne.assert(e===1||e===2,"0x"+o.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let i=this.parsePointer(N.coverage),r=this.parseUShort(),a=this.parseUShort();if(e===1)return{posFormat:e,coverage:i,valueFormat1:r,valueFormat2:a,pairSets:this.parseList(N.pointer(N.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(r),value2:this.parseValueRecord(a)}})))};if(e===2){let l=this.parsePointer(N.classDef),c=this.parsePointer(N.classDef),h=this.parseUShort(),p=this.parseUShort();return{posFormat:e,coverage:i,valueFormat1:r,valueFormat2:a,classDef1:l,classDef2:c,class1Count:h,class2Count:p,classRecords:this.parseList(h,N.list(p,function(){return{value1:this.parseValueRecord(r),value2:this.parseValueRecord(a)}}))}}};nt[3]=function(){return{error:"GPOS Lookup 3 not supported"}};nt[4]=function(){return{error:"GPOS Lookup 4 not supported"}};nt[5]=function(){return{error:"GPOS Lookup 5 not supported"}};nt[6]=function(){return{error:"GPOS Lookup 6 not supported"}};nt[7]=function(){return{error:"GPOS Lookup 7 not supported"}};nt[8]=function(){return{error:"GPOS Lookup 8 not supported"}};nt[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function Bp(o,e){e=e||0;let i=new N(o,e),r=i.parseVersion(1);return ne.argument(r===1||r===1.1,"Unsupported GPOS table version "+r),r===1?{version:r,scripts:i.parseScriptList(),features:i.parseFeatureList(),lookups:i.parseLookupList(nt)}:{version:r,scripts:i.parseScriptList(),features:i.parseFeatureList(),lookups:i.parseLookupList(nt),variations:i.parseFeatureVariationsList()}}let Rp=new Array(10);function Op(o){return new Z.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Z.ScriptList(o.scripts)},{name:"features",type:"TABLE",value:new Z.FeatureList(o.features)},{name:"lookups",type:"TABLE",value:new Z.LookupList(o.lookups,Rp)}])}let Dp={parse:Bp,make:Op};function Np(o){let e={};o.skip("uShort");let i=o.parseUShort();ne.argument(i===0,"Unsupported kern sub-table version."),o.skip("uShort",2);let r=o.parseUShort();o.skip("uShort",3);for(let a=0;a<r;a+=1){let l=o.parseUShort(),c=o.parseUShort(),h=o.parseShort();e[l+","+c]=h}return e}function Pp(o){let e={};o.skip("uShort"),o.parseULong()>1&&console.warn("Only the first kern subtable is supported."),o.skip("uLong");let i=o.parseUShort()&255;if(o.skip("uShort"),i===0){let r=o.parseUShort();o.skip("uShort",3);for(let a=0;a<r;a+=1){let l=o.parseUShort(),c=o.parseUShort(),h=o.parseShort();e[l+","+c]=h}}return e}function Vp(o,e){let i=new ee.Parser(o,e),r=i.parseUShort();if(r===0)return Np(i);if(r===1)return Pp(i);throw new Error("Unsupported kern table version ("+r+").")}let Fp={parse:Vp};function Up(o,e,i,r){let a=new ee.Parser(o,e),l=r?a.parseUShort:a.parseULong,c=[];for(let h=0;h<i+1;h+=1){let p=l.call(a);r&&(p*=2),c.push(p)}return c}let Gp={parse:Up};function Oo(o,e){let i=[],r=12;for(let a=0;a<e;a+=1){let l=ee.getTag(o,r),c=ee.getULong(o,r+4),h=ee.getULong(o,r+8),p=ee.getULong(o,r+12);i.push({tag:l,checksum:c,offset:h,length:p,compression:!1}),r+=16}return i}function zp(o,e){let i=[],r=44;for(let a=0;a<e;a+=1){let l=ee.getTag(o,r),c=ee.getULong(o,r+4),h=ee.getULong(o,r+8),p=ee.getULong(o,r+12),u;h<p?u="WOFF":u=!1,i.push({tag:l,offset:c,compression:u,compressedLength:h,length:p}),r+=20}return i}function xe(o,e){if(e.compression==="WOFF"){let i=new Uint8Array(o.buffer,e.offset+2,e.compressedLength-2),r=new Uint8Array(e.length);if(Nc(i,r),r.byteLength!==e.length)throw new Error("Decompression error: "+e.tag+" decompressed length doesn't match recorded length");return{data:new DataView(r.buffer,0),offset:0}}else return{data:o,offset:e.offset}}function Hp(o,e={}){let i,r,a=new Cp({empty:!0});o.constructor!==ArrayBuffer&&(o=new Uint8Array(o).buffer);let l=new DataView(o,0),c,h=[],p=ee.getTag(l,0);if(p===String.fromCharCode(0,1,0,0)||p==="true"||p==="typ1")a.outlinesFormat="truetype",c=ee.getUShort(l,4),h=Oo(l,c);else if(p==="OTTO")a.outlinesFormat="cff",c=ee.getUShort(l,4),h=Oo(l,c);else if(p==="wOFF"){let z=ee.getTag(l,4);if(z===String.fromCharCode(0,1,0,0))a.outlinesFormat="truetype";else if(z==="OTTO")a.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+p);c=ee.getUShort(l,12),h=zp(l,c)}else if(p==="wOF2"){let z="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+z)}else throw new Error("Unsupported OpenType signature "+p);let u,d,m,v,g,x,b,C,T,A,O,P,V,R,I,G;for(let z=0;z<c;z+=1){let J=h[z],Q;switch(J.tag){case"avar":x=J;break;case"cmap":Q=xe(l,J),a.tables.cmap=dr.parse(Q.data,Q.offset),a.encoding=new mr(a.tables.cmap);break;case"cvt ":Q=xe(l,J),G=new ee.Parser(Q.data,Q.offset),a.tables.cvt=G.parseShortList(J.length/2);break;case"fvar":m=J;break;case"STAT":v=J;break;case"gvar":g=J;break;case"fpgm":Q=xe(l,J),G=new ee.Parser(Q.data,Q.offset),a.tables.fpgm=G.parseByteList(J.length);break;case"head":Q=xe(l,J),a.tables.head=Er.parse(Q.data,Q.offset),a.unitsPerEm=a.tables.head.unitsPerEm,i=a.tables.head.indexToLocFormat;break;case"hhea":Q=xe(l,J),a.tables.hhea=Sr.parse(Q.data,Q.offset),a.ascender=a.tables.hhea.ascender,a.descender=a.tables.hhea.descender,a.numberOfHMetrics=a.tables.hhea.numberOfHMetrics;break;case"hmtx":O=J;break;case"ltag":Q=xe(l,J),r=Lr.parse(Q.data,Q.offset);break;case"COLR":Q=xe(l,J),a.tables.colr=Pr.parse(Q.data,Q.offset);break;case"CPAL":Q=xe(l,J),a.tables.cpal=Vr.parse(Q.data,Q.offset);break;case"maxp":Q=xe(l,J),a.tables.maxp=kr.parse(Q.data,Q.offset),a.numGlyphs=a.tables.maxp.numGlyphs;break;case"name":R=J;break;case"OS/2":Q=xe(l,J),a.tables.os2=Nn.parse(Q.data,Q.offset);break;case"post":Q=xe(l,J),a.tables.post=Or.parse(Q.data,Q.offset),a.glyphNames=new ui(a.tables.post);break;case"prep":Q=xe(l,J),G=new ee.Parser(Q.data,Q.offset),a.tables.prep=G.parseByteList(J.length);break;case"glyf":b=J;break;case"loca":V=J;break;case"CFF ":u=J;break;case"CFF2":d=J;break;case"kern":P=J;break;case"GDEF":C=J;break;case"GPOS":T=J;break;case"GSUB":A=J;break;case"meta":I=J;break;case"gasp":Q=xe(l,J),a.tables.gasp=Hr.parse(Q.data,Q.offset);break}}let X=xe(l,R);if(a.tables.name=Rr.parse(X.data,X.offset,r),a.names=a.tables.name,b&&V){let z=i===0,J=xe(l,V),Q=Gp.parse(J.data,J.offset,a.numGlyphs,z),de=xe(l,b);a.glyphs=Kr.parse(de.data,de.offset,Q,a,e)}else if(u){let z=xe(l,u);Rn.parse(z.data,z.offset,a,e)}else if(d){let z=xe(l,d);Rn.parse(z.data,z.offset,a,e)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let j=xe(l,O);if(Tr.parse(a,j.data,j.offset,a.numberOfHMetrics,a.numGlyphs,a.glyphs,e),lh(a,e),P){let z=xe(l,P);a.kerningPairs=Fp.parse(z.data,z.offset)}else a.kerningPairs={};if(C){let z=xe(l,C);a.tables.gdef=_p.parse(z.data,z.offset)}if(T){let z=xe(l,T);a.tables.gpos=Dp.parse(z.data,z.offset),a.position.init()}if(A){let z=xe(l,A);a.tables.gsub=Dr.parse(z.data,z.offset)}if(m){let z=xe(l,m);a.tables.fvar=Ur.parse(z.data,z.offset,a.names)}if(v){let z=xe(l,v);a.tables.stat=Gr.parse(z.data,z.offset,a.tables.fvar)}if(g){m||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),b||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let z=xe(l,g);a.tables.gvar=Sp.parse(z.data,z.offset,a.names)}if(x){m||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let z=xe(l,x);a.tables.avar=zr.parse(z.data,z.offset,a.tables.fvar)}if(I){let z=xe(l,I);a.tables.meta=Nr.parse(z.data,z.offset),a.metas=a.tables.meta}return a}const cs="DxfWorkerMsg";class Ze{constructor(e,i=!1){this.worker=e,i?e.onmessage=this._ProcessRequest.bind(this):e&&(e.addEventListener("message",this._ProcessResponse.bind(this),!1),e.addEventListener("error",this._OnError.bind(this),!1),this.reqSeq=1,this.requests=new Map,this.progressCbk=null)}async Load(e,i,r,a){return this.worker?this._SendRequest(Ze.WorkerMsg.LOAD,{url:e,fonts:i,options:this._CloneOptions(r)},a):this._Load(e,i,r,a)}async Destroy(e=!1){this.worker&&(e||await this._SendRequest(Ze.WorkerMsg.DESTROY),this.worker.terminate())}async _ProcessRequest(e){const i=e.data;if(i.signature!==cs)return;const r={seq:i.seq,type:i.type,signature:cs},a=[];try{r.data=await this._ProcessRequestMessage(i.type,i.data,a,i.seq)}catch(l){console.error(l),r.error=String(l)}this.worker.postMessage(r,a),i.type===Ze.WorkerMsg.DESTROY&&(this.worker.onmessage=null,this.worker.close(),this.worker=null)}async _ProcessRequestMessage(e,i,r,a){switch(e){case Ze.WorkerMsg.LOAD:{const l=await this._Load(i.url,i.fonts,i.options,(c,h,p)=>this._SendProgress(a,c,h,p));return r.push(l.vertices),r.push(l.indices),r.push(l.transforms),l}case Ze.WorkerMsg.DESTROY:return null;default:throw"Unknown message type: "+e}}async _ProcessResponse(e){const i=e.data;if(i.signature!==cs)return;const r=i.seq,a=this.requests.get(r);if(!a){console.error("Unmatched message sequence: ",r);return}const l=i.data;if(i.type===Ze.WorkerMsg.PROGRESS&&a.progressCbk){a.progressCbk(l.phase,l.size,l.totalSize);return}this.requests.delete(r),i.hasOwnProperty("error")?a.SetError(i.error):a.SetResponse(l)}async _OnError(e){console.error("DxfWorker worker error",e);const i=Array.from(this.requests.values);this.requests.clear(),i.forEach(r=>r.SetError(e))}async _SendRequest(e,i=null,r=null){const a=this.reqSeq++,l=new Ze.Request(a,r);return this.requests.set(a,l),this.worker.postMessage({seq:a,type:e,data:i,signature:cs}),await l.GetResponse()}_SendProgress(e,i,r,a){this.worker.postMessage({seq:e,type:Ze.WorkerMsg.PROGRESS,data:{phase:i,size:r,totalSize:a},signature:cs})}async _Load(e,i,r,a){let l;i?l=this._CreateFontFetchers(i,a):l=[];const c=await new mc(e).Fetch(a);a&&a("prepare",0,null);const h=new bs(r);return await h.Build(c,l),h.scene}_CreateFontFetchers(e,i){function r(l){return async function(){i&&i("font",0,null);const c=await fetch(l).then(h=>h.arrayBuffer());return i&&i("prepare",0,null),Hp(c)}}const a=[];for(const l of e)a.push(r(l));return a}_CloneOptions(e){if(Array.isArray(e))return e.map(i=>this._CloneOptions(i));if(typeof e=="object"&&e!==null){const i={};for(const r in e)i[r]=this._CloneOptions(e[r]);return i}else return e}}Ze.WorkerMsg={LOAD:"LOAD",PROGRESS:"PROGRESS",DESTROY:"DESTROY"};Ze.Request=class{constructor(o,e){this.seq=o,this.progressCbk=e,this.promise=new Promise((i,r)=>{this._Resolve=i,this._Reject=r})}async GetResponse(){return await this.promise}SetResponse(o){this._Resolve(o)}SetError(o){this._Reject(o)}};class Do{constructor(e,i,r,a){this.instanceType=e,this.geometryType=i??null,this.color=r,this.lineType=a??null}Compare(e){let i=mt(this.instanceType,e.instanceType);return i!==0||(i=mt(this.geometryType,e.geometryType),i!==0)||(i=mt(this.color,e.color),i!==0)?i:mt(this.lineType,e.lineType)}}function qt(o){return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}function Ln(o){return o<.003?o*12.92:Math.pow(o,1/2.4)*1.055-.055}function Un(o){const e=qt(((o&16711680)>>>16)/255),i=qt(((o&65280)>>>8)/255),r=qt((o&255)/255);return e*.2126+i*.7152+r*.0722}function jp(o,e){return(Un(o)+.05)/(Un(e)+.05)}function xi({h:o,l:e,s:i}){let r,a,l;if(i===0)r=a=l=e;else{let c=function(u,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?u+(d-u)*6*m:m<1/2?d:m<2/3?u+(d-u)*(2/3-m)*6:u};const h=e<.5?e*(1+i):e+i-e*i,p=2*e-h;r=c(p,h,o+1/3),a=c(p,h,o),l=c(p,h,o-1/3)}return Math.min(Math.floor(Ln(r)*256),255)<<16|Math.min(Math.floor(Ln(a)*256),255)<<8|Math.min(Math.floor(Ln(l)*256),255)}function Ci(o){const e=qt(((o&16711680)>>>16)/255),i=qt(((o&65280)>>>8)/255),r=qt((o&255)/255),a=Math.max(e,i,r),l=Math.min(e,i,r);let c=0,h=0;const p=(a+l)/2;if(a===l)c=h=0;else{const u=a-l;switch(h=p>.5?u/(2-a-l):u/(a+l),a){case e:c=(i-r)/u+(i<r?6:0);break;case i:c=(r-e)/u+2;break;case r:c=(e-i)/u+4;break}c/=6}return{h:c,l:p,s:h}}function Wp(o,e){const i=Ci(o);return i.l*=e,i.l>1&&(i.l=1),xi(i)}function Xp(o,e){const i=Ci(o);return i.l/=e,xi(i)}const Zp={HlsToRgb:xi,RgbToHls:Ci,Lighten:Wp,Darken:Xp,Luminance:Un,ContrastRatio:jp},Yt=Zp;class un extends Se.Group{constructor(){super();L(this,"dxfLayers");this.addEventListener("destory",()=>{this.traverse(i=>{i.geometry&&i.material&&(i.geometry.dispose(),i.material.dispose&&i.material.dispose())}),this.clear(),this.parent&&this.parent.remove(this)})}GetLayers(){const i=[];for(const r of this.dxfLayers.values())i.push({name:r.name,color:r.color,state:!0});return i}ShowLayer(i,r){const a=this.dxfLayers.get(i);if(a)for(const l of a.objects)l.visible=r}}class Gt{constructor(){L(this,"clearColor",0);L(this,"scene",new un);this.options=Object.create(Gt.DefaultOptions),this.scene.rotateX(-Math.PI/2),this.simpleColorMaterial=[],this.simplePointMaterial=[];for(let e=0;e<Fe.MAX;e++)this.simpleColorMaterial[e]=this._CreateSimpleColorMaterial(e),this.simplePointMaterial[e]=this._CreateSimplePointMaterial(e);this.materials=new tr((e,i)=>e.key.Compare(i.key)),this.layers=new Map,this.blocks=new Map,this.worker=null}async Load({url:e,fonts:i=null,progressCbk:r=null,workerFactory:a=null}){this.worker=new Ze(a?a():null);const l=await this.worker.Load(e,i,this.options,r);await this.worker.Destroy(),this.worker=null,this.origin=l.origin,this.bounds=l.bounds,this.hasMissingChars=l.hasMissingChars;for(const c of l.layers)this.layers.set(c.name,new Yp(c.name,c.color));for(const c of l.batches)if(c.key.blockName!==null&&c.key.geometryType!==pe.GeometryType.BLOCK_INSTANCE&&c.key.geometryType!==pe.GeometryType.POINT_INSTANCE){let h=this.blocks.get(c.key.blockName);h||(h=new Kp,this.blocks.set(c.key.blockName,h)),h.PushBatch(new No(this,l,c))}for(const c of l.batches)this._LoadBatch(l,c);return this.scene.dxfLayers=this.layers,this.scene}_LoadBatch(e,i){if(i.key.blockName!==null&&i.key.geometryType!==pe.GeometryType.BLOCK_INSTANCE&&i.key.geometryType!==pe.GeometryType.POINT_INSTANCE)return;const r=new No(this,e,i).CreateObjects(),a=this.layers.get(i.key.layerName);for(const l of r)this.scene.add(l),a&&a.PushObject(l)}_GetSimpleColorMaterial(e,i=Fe.NONE){const r=new Do(i,null,e,0);let a=this.materials.find({key:r});return a!==null||(a={key:r,material:this._CreateSimpleColorMaterialInstance(e,i)},this.materials.insert(a)),a.material}_CreateSimpleColorMaterial(e=Fe.NONE){const i=this._GenerateShaders(e,!1);return new Se.RawShaderMaterial({uniforms:{color:{value:new Se.Color(16711935)}},vertexShader:i.vertex,fragmentShader:i.fragment,depthTest:!1,depthWrite:!1,glslVersion:Se.GLSL3,side:Se.DoubleSide})}_CreateSimpleColorMaterialInstance(e,i=Fe.NONE){const a=this.simpleColorMaterial[i].clone();return a.uniforms.color={value:new Se.Color(e)},a}_GetSimplePointMaterial(e,i=Fe.NONE){const r=new Do(i,pe.GeometryType.POINTS,e,0);let a=this.materials.find({key:r});return a!==null||(a={key:r,material:this._CreateSimplePointMaterialInstance(e,this.options.pointSize,i)},this.materials.insert(a)),a.material}_CreateSimplePointMaterial(e=Fe.NONE){const i=this._GenerateShaders(e,!0);return new Se.RawShaderMaterial({uniforms:{color:{value:new Se.Color(16711935)},pointSize:{value:2}},vertexShader:i.vertex,fragmentShader:i.fragment,depthTest:!1,depthWrite:!1,glslVersion:Se.GLSL3})}_CreateSimplePointMaterialInstance(e,i=2,r=Fe.NONE){const l=this.simplePointMaterial[r].clone();return l.uniforms.color={value:new Se.Color(e)},l.uniforms.size={value:i},l}_GenerateShaders(e,i){const r=e===Fe.FULL?`
6
+ `),R={specular:{value:new f.Color().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=R,this.onBeforeCompile=function(_){for(let F in R)_.uniforms[F]=R[F];_.fragmentShader=_.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",E).replace("#include <metalnessmap_pars_fragment>",M).replace("#include <roughnessmap_fragment>",S).replace("#include <metalnessmap_fragment>",k).replace("#include <lights_physical_fragment>",D)},Object.defineProperties(this,{specular:{get:function(){return R.specular.value},set:function(_){R.specular.value=_}},specularMap:{get:function(){return R.specularMap.value},set:function(_){R.specularMap.value=_,_?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return R.glossiness.value},set:function(_){R.glossiness.value=_}},glossinessMap:{get:function(){return R.glossinessMap.value},set:function(_){R.glossinessMap.value=_,_?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(w)}T.prototype=Object.create(f.MeshStandardMaterial.prototype),T.prototype.constructor=T,T.prototype.copy=function(w){return f.MeshStandardMaterial.prototype.copy.call(this,w),this.specularMap=w.specularMap,this.specular.copy(w.specular),this.glossinessMap=w.glossinessMap,this.glossiness=w.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this};function A(){return{name:i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return T},extendParams:function(w,E,M){let S=E.extensions[this.name];w.color=new f.Color(1,1,1),w.opacity=1;let k=[];if(Array.isArray(S.diffuseFactor)){let D=S.diffuseFactor;w.color.fromArray(D),w.opacity=D[3]}if(S.diffuseTexture!==void 0&&k.push(M.assignTexture(w,"map",S.diffuseTexture)),w.emissive=new f.Color(0,0,0),w.glossiness=S.glossinessFactor!==void 0?S.glossinessFactor:1,w.specular=new f.Color(1,1,1),Array.isArray(S.specularFactor)&&w.specular.fromArray(S.specularFactor),S.specularGlossinessTexture!==void 0){let D=S.specularGlossinessTexture;k.push(M.assignTexture(w,"glossinessMap",D)),k.push(M.assignTexture(w,"specularMap",D))}return Promise.all(k)},createMaterial:function(w){let E=new T(w);return E.fog=!0,E.color=w.color,E.map=w.map===void 0?null:w.map,E.lightMap=null,E.lightMapIntensity=1,E.aoMap=w.aoMap===void 0?null:w.aoMap,E.aoMapIntensity=1,E.emissive=w.emissive,E.emissiveIntensity=1,E.emissiveMap=w.emissiveMap===void 0?null:w.emissiveMap,E.bumpMap=w.bumpMap===void 0?null:w.bumpMap,E.bumpScale=1,E.normalMap=w.normalMap===void 0?null:w.normalMap,E.normalMapType=f.TangentSpaceNormalMap,w.normalScale&&(E.normalScale=w.normalScale),E.displacementMap=null,E.displacementScale=1,E.displacementBias=0,E.specularMap=w.specularMap===void 0?null:w.specularMap,E.specular=w.specular,E.glossinessMap=w.glossinessMap===void 0?null:w.glossinessMap,E.glossiness=w.glossiness,E.alphaMap=null,E.envMap=w.envMap===void 0?null:w.envMap,E.envMapIntensity=1,E.refractionRatio=.98,E}}}function O(){this.name=i.KHR_MESH_QUANTIZATION}function P(w,E,M,S){f.Interpolant.call(this,w,E,M,S)}P.prototype=Object.create(f.Interpolant.prototype),P.prototype.constructor=P,P.prototype.copySampleValue_=function(w){let E=this.resultBuffer,M=this.sampleValues,S=this.valueSize,k=w*S*3+S;for(let D=0;D!==S;D++)E[D]=M[k+D];return E},P.prototype.beforeStart_=P.prototype.copySampleValue_,P.prototype.afterEnd_=P.prototype.copySampleValue_,P.prototype.interpolate_=function(w,E,M,S){let k=this.resultBuffer,D=this.sampleValues,R=this.valueSize,_=R*2,F=R*3,z=S-E,U=(M-E)/z,q=U*U,ae=q*U,le=w*F,oe=le-F,pe=-2*ae+3*q,ge=ae-q,Re=1-pe,Oe=ge-q+U;for(let et=0;et!==R;et++){let Bt=D[oe+et+R],ot=D[oe+et+_]*z,We=D[le+et+R],bt=D[le+et]*z;k[et]=Re*Bt+Oe*ot+pe*We+ge*bt}return k};let V={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},B={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},I={9728:f.NearestFilter,9729:f.LinearFilter,9984:f.NearestMipmapNearestFilter,9985:f.LinearMipmapNearestFilter,9986:f.NearestMipmapLinearFilter,9987:f.LinearMipmapLinearFilter},G={33071:f.ClampToEdgeWrapping,33648:f.MirroredRepeatWrapping,10497:f.RepeatWrapping},W={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},j={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},H={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ee={CUBICSPLINE:void 0,LINEAR:f.InterpolateLinear,STEP:f.InterpolateDiscrete},$={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function de(w,E){return typeof w!="string"||w===""?"":(/^https?:\/\//i.test(E)&&/^\//.test(w)&&(E=E.replace(/(^https?:\/\/[^]+).*/i,"$1")),/^(https?:)?\/\//i.test(w)||/^data:.*,.*$/i.test(w)||/^blob:.*$/i.test(w)?w:E+w)}function ie(w){return w.DefaultMaterial===void 0&&(w.DefaultMaterial=new f.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:f.FrontSide})),w.DefaultMaterial}function me(w,E,M){for(let S in M.extensions)w[S]===void 0&&(E.userData.gltfExtensions=E.userData.gltfExtensions||{},E.userData.gltfExtensions[S]=M.extensions[S])}function re(w,E){E.extras!==void 0&&(typeof E.extras=="object"?Object.assign(w.userData,E.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+E.extras))}function be(w,E,M){let S=!1,k=!1;for(let _=0,F=E.length;_<F;_++){let z=E[_];if(z.POSITION!==void 0&&(S=!0),z.NORMAL!==void 0&&(k=!0),S&&k)break}if(!S&&!k)return Promise.resolve(w);let D=[],R=[];for(let _=0,F=E.length;_<F;_++){let z=E[_];if(S){let U=z.POSITION!==void 0?M.getDependency("accessor",z.POSITION):w.attributes.position;D.push(U)}if(k){let U=z.NORMAL!==void 0?M.getDependency("accessor",z.NORMAL):w.attributes.normal;R.push(U)}}return Promise.all([Promise.all(D),Promise.all(R)]).then(function(_){let F=_[0],z=_[1];return S&&(w.morphAttributes.position=F),k&&(w.morphAttributes.normal=z),w.morphTargetsRelative=!0,w})}function Z(w,E){if(w.updateMorphTargets(),E.weights!==void 0)for(let M=0,S=E.weights.length;M<S;M++)w.morphTargetInfluences[M]=E.weights[M];if(E.extras&&Array.isArray(E.extras.targetNames)){let M=E.extras.targetNames;if(w.morphTargetInfluences.length===M.length){w.morphTargetDictionary={};for(let S=0,k=M.length;S<k;S++)w.morphTargetDictionary[M[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function K(w){let E=w.extensions&&w.extensions[i.KHR_DRACO_MESH_COMPRESSION],M;return E?M="draco:"+E.bufferView+":"+E.indices+":"+J(E.attributes):M=w.indices+":"+J(w.attributes)+":"+w.mode,M}function J(w){let E="",M=Object.keys(w).sort();for(let S=0,k=M.length;S<k;S++)E+=M[S]+":"+w[M[S]]+";";return E}function Y(w,E,M){this.json=w||{},this.extensions={},this.plugins={},this.options=E||{},this.imageJson=M,this.cache=new e,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},typeof createImageBitmap<"u"&&/Firefox/.test(navigator.userAgent)===!1?this.textureLoader=new f.ImageBitmapLoader(this.options.manager):this.textureLoader=new f.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new f.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}Y.prototype.setExtensions=function(w){this.extensions=w},Y.prototype.setPlugins=function(w){this.plugins=w},Y.prototype.parse=function(w,E){let M=this,S=this.json,k=this.extensions;this.cache.removeAll(),this._invokeAll(function(D){return D._markDefs&&D._markDefs()}),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then(function(D){let R={scene:D[0][S.scene||0],scenes:D[0],animations:D[1],cameras:D[2],asset:S.asset,parser:M,userData:{}};me(k,R,S),re(R,S),w(R)}).catch(E)},Y.prototype._markDefs=function(){let w=this.json.nodes||[],E=this.json.skins||[],M=this.json.meshes||[];for(let S=0,k=E.length;S<k;S++){let D=E[S].joints;for(let R=0,_=D.length;R<_;R++)w[D[R]].isBone=!0}for(let S=0,k=w.length;S<k;S++){let D=w[S];D.mesh!==void 0&&(this._addNodeRef(this.meshCache,D.mesh),D.skin!==void 0&&(M[D.mesh].isSkinnedMesh=!0)),D.camera!==void 0&&this._addNodeRef(this.cameraCache,D.camera)}},Y.prototype._addNodeRef=function(w,E){E!==void 0&&(w.refs[E]===void 0&&(w.refs[E]=w.uses[E]=0),w.refs[E]++)},Y.prototype._getNodeRef=function(w,E,M){if(w.refs[E]<=1)return M;let S=M.clone();return S.name+="_instance_"+w.uses[E]++,S},Y.prototype._invokeOne=function(w){let E=Object.values(this.plugins);E.push(this);for(let M=0;M<E.length;M++){let S=w(E[M]);if(S)return S}},Y.prototype._invokeAll=function(w){let E=Object.values(this.plugins);E.unshift(this);let M=[];for(let S=0;S<E.length;S++){let k=w(E[S]);k&&M.push(k)}return M},Y.prototype.getDependency=function(w,E){let M=w+":"+E,S=this.cache.get(M);if(!S){switch(w){case"scene":S=this.loadScene(E);break;case"node":S=this.loadNode(E);break;case"mesh":S=this._invokeOne(function(k){return k.loadMesh&&k.loadMesh(E)});break;case"accessor":S=this.loadAccessor(E);break;case"bufferView":S=this._invokeOne(function(k){return k.loadBufferView&&k.loadBufferView(E)});break;case"buffer":S=this.loadBuffer(E);break;case"material":S=this._invokeOne(function(k){return k.loadMaterial&&k.loadMaterial(E)});break;case"texture":S=this._invokeOne(function(k){return k.loadTexture&&k.loadTexture(E)});break;case"skin":S=this.loadSkin(E);break;case"animation":S=this.loadAnimation(E);break;case"camera":S=this.loadCamera(E);break;default:throw new Error("Unknown type: "+w)}this.cache.add(M,S)}return S},Y.prototype.getDependencies=function(w){let E=this.cache.get(w);if(!E){let M=this,S=this.json[w+(w==="mesh"?"es":"s")]||[];E=Promise.all(S.map(function(k,D){return M.getDependency(w,D)})),this.cache.add(w,E)}return E},Y.prototype.loadBuffer=function(w){let E=this.json.buffers[w],M=this.fileLoader;if(E.type&&E.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+E.type+" buffer type is not supported.");if(E.uri===void 0&&w===0)return Promise.resolve(this.extensions[i.KHR_BINARY_GLTF].body);let S=this.options;return new Promise(function(k,D){M.load(de(E.uri,S.path),k,void 0,function(){D(new Error('THREE.GLTFLoader: Failed to load buffer "'+E.uri+'".'))})})},Y.prototype.loadBufferView=function(w){let E=this.json.bufferViews[w];return this.getDependency("buffer",E.buffer).then(function(M){let S=E.byteLength||0,k=E.byteOffset||0;return M.slice(k,k+S)})},Y.prototype.loadAccessor=function(w){let E=this,M=this.json,S=this.json.accessors[w];if(S.bufferView===void 0&&S.sparse===void 0)return Promise.resolve(null);let k=[];return S.bufferView!==void 0?k.push(this.getDependency("bufferView",S.bufferView)):k.push(null),S.sparse!==void 0&&(k.push(this.getDependency("bufferView",S.sparse.indices.bufferView)),k.push(this.getDependency("bufferView",S.sparse.values.bufferView))),Promise.all(k).then(function(D){let R=D[0],_=W[S.type],F=B[S.componentType],z=F.BYTES_PER_ELEMENT,U=z*_,q=S.byteOffset||0,ae=S.bufferView!==void 0?M.bufferViews[S.bufferView].byteStride:void 0,le=S.normalized===!0,oe,pe;if(ae&&ae!==U){let ge=Math.floor(q/ae),Re="InterleavedBuffer:"+S.bufferView+":"+S.componentType+":"+ge+":"+S.count,Oe=E.cache.get(Re);Oe||(oe=new F(R,ge*ae,S.count*ae/z),Oe=new f.InterleavedBuffer(oe,ae/z),E.cache.add(Re,Oe)),pe=new f.InterleavedBufferAttribute(Oe,_,q%ae/z,le)}else R===null?oe=new F(S.count*_):oe=new F(R,q,S.count*_),pe=new f.BufferAttribute(oe,_,le);if(S.sparse!==void 0){let ge=W.SCALAR,Re=B[S.sparse.indices.componentType],Oe=S.sparse.indices.byteOffset||0,et=S.sparse.values.byteOffset||0,Bt=new Re(D[1],Oe,S.sparse.count*ge),ot=new F(D[2],et,S.sparse.count*_);R!==null&&(pe=new f.BufferAttribute(pe.array.slice(),pe.itemSize,pe.normalized));for(let We=0,bt=Bt.length;We<bt;We++){let Wt=Bt[We];if(pe.setX(Wt,ot[We*_]),_>=2&&pe.setY(Wt,ot[We*_+1]),_>=3&&pe.setZ(Wt,ot[We*_+2]),_>=4&&pe.setW(Wt,ot[We*_+3]),_>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return pe})},Y.prototype.loadTexture=function(w){let E=this,M=this.json,S=this.options,k=M.textures[w],D=k.extensions||{},R;D[i.MSFT_TEXTURE_DDS]?R=M.images[D[i.MSFT_TEXTURE_DDS].source]:R=M.images[k.source];let _;return R.uri&&(_=S.manager.getHandler(R.uri)),_||(_=D[i.MSFT_TEXTURE_DDS]?E.extensions[i.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(w,R,_)},Y.prototype.loadTextureImage=function(w,E,M){let S=this,k=this.json,D=this.options,R=k.textures[w],_=self.URL||self.webkitURL;this.imageJson&&(E.uri=this.imageJson[E.uri]);let F=E.uri,z=!1,U=!0;return E.mimeType==="image/jpeg"&&(U=!1),E.bufferView!==void 0&&(F=S.getDependency("bufferView",E.bufferView).then(function(q){if(E.mimeType==="image/png"){let le=new DataView(q,25,1).getUint8(0,!1);U=le===6||le===4||le===3}z=!0;let ae=new Blob([q],{type:E.mimeType});return F=_.createObjectURL(ae),F})),Promise.resolve(F).then(function(q){return new Promise(function(ae,le){let oe=ae;M.isImageBitmapLoader===!0&&(oe=function(pe){ae(new f.CanvasTexture(pe))}),M.load(de(q,D.path),oe,void 0,le)})}).then(function(q){z===!0&&_.revokeObjectURL(F),q.flipY=!1,R.name&&(q.name=R.name),U||(q.format=f.RGBFormat);let le=(k.samplers||{})[R.sampler]||{};return q.magFilter=I[le.magFilter]||f.LinearFilter,q.minFilter=I[le.minFilter]||f.LinearMipmapLinearFilter,q.wrapS=G[le.wrapS]||f.RepeatWrapping,q.wrapT=G[le.wrapT]||f.RepeatWrapping,S.associations.set(q,{type:"textures",index:w}),q})},Y.prototype.assignTexture=function(w,E,M){let S=this;return this.getDependency("texture",M.index).then(function(k){if(M.texCoord!==void 0&&M.texCoord!=0&&!(E==="aoMap"&&M.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+M.texCoord+" for texture "+E+" not yet supported."),S.extensions[i.KHR_TEXTURE_TRANSFORM]){let D=M.extensions!==void 0?M.extensions[i.KHR_TEXTURE_TRANSFORM]:void 0;if(D){let R=S.associations.get(k);k=S.extensions[i.KHR_TEXTURE_TRANSFORM].extendTexture(k,D),S.associations.set(k,R)}}w[E]=k})},Y.prototype.assignFinalMaterial=function(w){let E=w.geometry,M=w.material,S=E.attributes.tangent!==void 0,k=E.attributes.color!==void 0,D=E.attributes.normal===void 0,R=w.isSkinnedMesh===!0,_=Object.keys(E.morphAttributes).length>0,F=_&&E.morphAttributes.normal!==void 0;if(w.isPoints){let z="PointsMaterial:"+M.uuid,U=this.cache.get(z);U||(U=new f.PointsMaterial,f.Material.prototype.copy.call(U,M),U.color.copy(M.color),U.map=M.map,U.sizeAttenuation=!1,this.cache.add(z,U)),M=U}else if(w.isLine){let z="LineBasicMaterial:"+M.uuid,U=this.cache.get(z);U||(U=new f.LineBasicMaterial,f.Material.prototype.copy.call(U,M),U.color.copy(M.color),this.cache.add(z,U)),M=U}if(S||k||D||R||_){let z="ClonedMaterial:"+M.uuid+":";M.isGLTFSpecularGlossinessMaterial&&(z+="specular-glossiness:"),R&&(z+="skinning:"),S&&(z+="vertex-tangents:"),k&&(z+="vertex-colors:"),D&&(z+="flat-shading:"),_&&(z+="morph-targets:"),F&&(z+="morph-normals:");let U=this.cache.get(z);U||(U=M.clone(),R&&(U.skinning=!0),S&&(U.vertexTangents=!0),k&&(U.vertexColors=!0),D&&(U.flatShading=!0),_&&(U.morphTargets=!0),F&&(U.morphNormals=!0),this.cache.add(z,U),this.associations.set(U,this.associations.get(M))),M=U}M.aoMap&&E.attributes.uv2===void 0&&E.attributes.uv!==void 0&&E.setAttribute("uv2",E.attributes.uv),M.normalScale&&!S&&(M.normalScale.y=-M.normalScale.y),M.clearcoatNormalScale&&!S&&(M.clearcoatNormalScale.y=-M.clearcoatNormalScale.y),w.material=M},Y.prototype.getMaterialType=function(){return f.MeshStandardMaterial},Y.prototype.loadMaterial=function(w){let E=this,M=this.json,S=this.extensions,k=M.materials[w],D,R={},_=k.extensions||{},F=[];if(_[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){let U=S[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];D=U.getMaterialType(),F.push(U.extendParams(R,k,E))}else if(_[i.KHR_MATERIALS_UNLIT]){let U=S[i.KHR_MATERIALS_UNLIT];D=U.getMaterialType(),F.push(U.extendParams(R,k,E))}else{let U=k.pbrMetallicRoughness||{};if(R.color=new f.Color(1,1,1),R.opacity=1,Array.isArray(U.baseColorFactor)){let q=U.baseColorFactor;R.color.fromArray(q),R.opacity=q[3]}U.baseColorTexture!==void 0&&F.push(E.assignTexture(R,"map",U.baseColorTexture)),R.metalness=U.metallicFactor!==void 0?U.metallicFactor:1,R.roughness=U.roughnessFactor!==void 0?U.roughnessFactor:1,U.metallicRoughnessTexture!==void 0&&(F.push(E.assignTexture(R,"metalnessMap",U.metallicRoughnessTexture)),F.push(E.assignTexture(R,"roughnessMap",U.metallicRoughnessTexture))),D=this._invokeOne(function(q){return q.getMaterialType&&q.getMaterialType(w)}),F.push(Promise.all(this._invokeAll(function(q){return q.extendMaterialParams&&q.extendMaterialParams(w,R)})))}k.doubleSided===!0&&(R.side=f.DoubleSide);let z=k.alphaMode||$.OPAQUE;return z===$.BLEND?(R.transparent=!0,R.depthWrite=!1):(R.transparent=!1,z===$.MASK&&(R.alphaTest=k.alphaCutoff!==void 0?k.alphaCutoff:.5)),k.normalTexture!==void 0&&D!==f.MeshBasicMaterial&&(F.push(E.assignTexture(R,"normalMap",k.normalTexture)),R.normalScale=new f.Vector2(1,1),k.normalTexture.scale!==void 0&&R.normalScale.set(k.normalTexture.scale,k.normalTexture.scale)),k.occlusionTexture!==void 0&&D!==f.MeshBasicMaterial&&(F.push(E.assignTexture(R,"aoMap",k.occlusionTexture)),k.occlusionTexture.strength!==void 0&&(R.aoMapIntensity=k.occlusionTexture.strength)),k.emissiveFactor!==void 0&&D!==f.MeshBasicMaterial&&(R.emissive=new f.Color().fromArray(k.emissiveFactor)),k.emissiveTexture!==void 0&&D!==f.MeshBasicMaterial&&F.push(E.assignTexture(R,"emissiveMap",k.emissiveTexture)),Promise.all(F).then(function(){let U;return D===T?U=S[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(R):U=new D(R),k.name&&(U.name=k.name),U.map&&(U.map.encoding=f.sRGBEncoding),U.emissiveMap&&(U.emissiveMap.encoding=f.sRGBEncoding),re(U,k),E.associations.set(U,{type:"materials",index:w}),k.extensions&&me(S,U,k),U})},Y.prototype.createUniqueName=function(w){let E=f.PropertyBinding.sanitizeNodeName(w||""),M=E;for(let S=1;this.nodeNamesUsed[M];++S)M=E+"_"+S;return this.nodeNamesUsed[M]=!0,M};function ce(w,E,M){let S=E.attributes,k=new f.Box3;if(S.POSITION!==void 0){let _=M.json.accessors[S.POSITION],F=_.min,z=_.max;if(F!==void 0&&z!==void 0)k.set(new f.Vector3(F[0],F[1],F[2]),new f.Vector3(z[0],z[1],z[2]));else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let D=E.targets;if(D!==void 0){let _=new f.Vector3,F=new f.Vector3;for(let z=0,U=D.length;z<U;z++){let q=D[z];if(q.POSITION!==void 0){let ae=M.json.accessors[q.POSITION],le=ae.min,oe=ae.max;le!==void 0&&oe!==void 0?(F.setX(Math.max(Math.abs(le[0]),Math.abs(oe[0]))),F.setY(Math.max(Math.abs(le[1]),Math.abs(oe[1]))),F.setZ(Math.max(Math.abs(le[2]),Math.abs(oe[2]))),_.max(F)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}k.expandByVector(_)}w.boundingBox=k;let R=new f.Sphere;k.getCenter(R.center),R.radius=k.min.distanceTo(k.max)/2,w.boundingSphere=R}function he(w,E,M){let S=E.attributes,k=[];function D(R,_){return M.getDependency("accessor",R).then(function(F){if(F.isInterleavedBufferAttribute){if(_=="position"){const z=F.data.stride,U=F.data.count,q=new Float32Array(U*3),ae=new Float32Array(U*3),le=new Float32Array(U*2);for(let oe=0;oe<U;oe++)q[oe*3]=F.data.array[oe*z],q[oe*3+1]=F.data.array[oe*z+1],q[oe*3+2]=F.data.array[oe*z+2],ae[oe*3]=F.data.array[oe*z+3],ae[oe*3+1]=F.data.array[oe*z+4],ae[oe*3+2]=F.data.array[oe*z+5],z==8&&(le[oe*2]=F.data.array[oe*z+6],le[oe*2+1]=F.data.array[oe*z+7]);w.setAttribute("position",new f.BufferAttribute(q,3)),w.setAttribute("normal",new f.BufferAttribute(ae,3)),z==8&&w.setAttribute("uv",new f.BufferAttribute(le,2))}}else w.setAttribute(_,F)})}for(let R in S){let _=j[R]||R.toLowerCase();_ in w.attributes||k.push(D(S[R],_))}if(E.indices!==void 0&&!w.index){let R=M.getDependency("accessor",E.indices).then(function(_){w.setIndex(_)});k.push(R)}return re(w,E),ce(w,E,M),Promise.all(k).then(function(){return E.targets!==void 0?be(w,E.targets,M):w})}function xe(w,E){let M=w.getIndex();if(M===null){let R=[],_=w.getAttribute("position");if(_!==void 0){for(let F=0;F<_.count;F++)R.push(F);w.setIndex(R),M=w.getIndex()}else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),w}let S=M.count-2,k=[];if(E===f.TriangleFanDrawMode)for(let R=1;R<=S;R++)k.push(M.getX(0)),k.push(M.getX(R)),k.push(M.getX(R+1));else for(let R=0;R<S;R++)R%2===0?(k.push(M.getX(R)),k.push(M.getX(R+1)),k.push(M.getX(R+2))):(k.push(M.getX(R+2)),k.push(M.getX(R+1)),k.push(M.getX(R)));k.length/3!==S&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let D=w.clone();return D.setIndex(k),D}return Y.prototype.loadGeometries=function(w){let E=this,M=this.extensions,S=this.primitiveCache;function k(R){return M[i.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(R,E).then(function(_){return he(_,R,E)})}let D=[];for(let R=0,_=w.length;R<_;R++){let F=w[R],z=K(F),U=S[z];if(U)D.push(U.promise);else{let q;F.extensions&&F.extensions[i.KHR_DRACO_MESH_COMPRESSION]?q=k(F):q=he(new f.BufferGeometry,F,E),S[z]={primitive:F,promise:q},D.push(q)}}return Promise.all(D)},Y.prototype.loadMesh=function(w){let E=this,M=this.json,S=this.extensions,k=M.meshes[w],D=k.primitives,R=[];for(let _=0,F=D.length;_<F;_++){let z=D[_].material===void 0?ie(this.cache):this.getDependency("material",D[_].material);R.push(z)}return R.push(E.loadGeometries(D)),Promise.all(R).then(function(_){let F=_.slice(0,_.length-1),z=_[_.length-1],U=[];for(let ae=0,le=z.length;ae<le;ae++){let oe=z[ae],pe=D[ae],ge,Re=F[ae];if(pe.mode===V.TRIANGLES||pe.mode===V.TRIANGLE_STRIP||pe.mode===V.TRIANGLE_FAN||pe.mode===void 0)ge=k.isSkinnedMesh===!0?new f.SkinnedMesh(oe,Re):new f.Mesh(oe,Re),ge.isSkinnedMesh===!0&&!ge.geometry.attributes.skinWeight.normalized&&ge.normalizeSkinWeights(),pe.mode===V.TRIANGLE_STRIP?ge.geometry=xe(ge.geometry,f.TriangleStripDrawMode):pe.mode===V.TRIANGLE_FAN&&(ge.geometry=xe(ge.geometry,f.TriangleFanDrawMode));else if(pe.mode===V.LINES)ge=new f.LineSegments(oe,Re);else if(pe.mode===V.LINE_STRIP)ge=new f.Line(oe,Re);else if(pe.mode===V.LINE_LOOP)ge=new f.LineLoop(oe,Re);else if(pe.mode===V.POINTS)ge=new f.Points(oe,Re);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+pe.mode);Object.keys(ge.geometry.morphAttributes).length>0&&Z(ge,k),ge.name=E.createUniqueName(k.name||"mesh_"+w),re(ge,k),pe.extensions&&me(S,ge,pe),E.assignFinalMaterial(ge),U.push(ge)}if(U.length===1)return U[0];let q=new f.Group;for(let ae=0,le=U.length;ae<le;ae++)q.add(U[ae]);return q})},Y.prototype.loadCamera=function(w){let E,M=this.json.cameras[w],S=M[M.type];if(!S){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return M.type==="perspective"?E=new f.PerspectiveCamera(f.MathUtils.radToDeg(S.yfov),S.aspectRatio||1,S.znear||1,S.zfar||2e6):M.type==="orthographic"&&(E=new f.OrthographicCamera(-S.xmag,S.xmag,S.ymag,-S.ymag,S.znear,S.zfar)),M.name&&(E.name=this.createUniqueName(M.name)),re(E,M),Promise.resolve(E)},Y.prototype.loadSkin=function(w){let E=this.json.skins[w],M={joints:E.joints};return E.inverseBindMatrices===void 0?Promise.resolve(M):this.getDependency("accessor",E.inverseBindMatrices).then(function(S){return M.inverseBindMatrices=S,M})},Y.prototype.loadAnimation=function(w){let M=this.json.animations[w],S=[],k=[],D=[],R=[],_=[];for(let F=0,z=M.channels.length;F<z;F++){let U=M.channels[F],q=M.samplers[U.sampler],ae=U.target,le=ae.node!==void 0?ae.node:ae.id,oe=M.parameters!==void 0?M.parameters[q.input]:q.input,pe=M.parameters!==void 0?M.parameters[q.output]:q.output;S.push(this.getDependency("node",le)),k.push(this.getDependency("accessor",oe)),D.push(this.getDependency("accessor",pe)),R.push(q),_.push(ae)}return Promise.all([Promise.all(S),Promise.all(k),Promise.all(D),Promise.all(R),Promise.all(_)]).then(function(F){let z=F[0],U=F[1],q=F[2],ae=F[3],le=F[4],oe=[];for(let ge=0,Re=z.length;ge<Re;ge++){let Oe=z[ge],et=U[ge],Bt=q[ge],ot=ae[ge],We=le[ge];if(Oe===void 0)continue;Oe.updateMatrix(),Oe.matrixAutoUpdate=!0;let bt;switch(H[We.path]){case H.weights:bt=f.NumberKeyframeTrack;break;case H.rotation:bt=f.QuaternionKeyframeTrack;break;case H.position:case H.scale:default:bt=f.VectorKeyframeTrack;break}let Wt=Oe.name?Oe.name:Oe.uuid,Aa=ot.interpolation!==void 0?ee[ot.interpolation]:f.InterpolateLinear,Ms=[];H[We.path]===H.weights?Oe.traverse(function(Ne){Ne.isMesh===!0&&Ne.morphTargetInfluences&&Ms.push(Ne.name?Ne.name:Ne.uuid)}):Ms.push(Wt);let dt=Bt.array;if(Bt.normalized){let Ne;if(dt.constructor===Int8Array)Ne=1/127;else if(dt.constructor===Uint8Array)Ne=1/255;else if(dt.constructor==Int16Array)Ne=1/32767;else if(dt.constructor===Uint16Array)Ne=1/65535;else throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");let Is=new Float32Array(dt.length);for(let xt=0,Ii=dt.length;xt<Ii;xt++)Is[xt]=dt[xt]*Ne;dt=Is}for(let Ne=0,Is=Ms.length;Ne<Is;Ne++){let xt=new bt(Ms[Ne]+"."+H[We.path],et.array,dt,Aa);ot.interpolation==="CUBICSPLINE"&&(xt.createInterpolant=function(_a){return new P(this.times,this.values,this.getValueSize()/3,_a)},xt.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),oe.push(xt)}}let pe=M.name?M.name:"animation_"+w;return new f.AnimationClip(pe,void 0,oe)})},Y.prototype.loadNode=function(w){let E=this.json,M=this.extensions,S=this,k=E.nodes[w],D=k.name?S.createUniqueName(k.name):"";return function(){let R=[];return k.mesh!==void 0&&R.push(S.getDependency("mesh",k.mesh).then(function(_){let F=S._getNodeRef(S.meshCache,k.mesh,_);return k.weights!==void 0&&F.traverse(function(z){if(z.isMesh)for(let U=0,q=k.weights.length;U<q;U++)z.morphTargetInfluences[U]=k.weights[U]}),F})),k.camera!==void 0&&R.push(S.getDependency("camera",k.camera).then(function(_){return S._getNodeRef(S.cameraCache,k.camera,_)})),S._invokeAll(function(_){return _.createNodeAttachment&&_.createNodeAttachment(w)}).forEach(function(_){R.push(_)}),Promise.all(R)}().then(function(R){let _;if(k.isBone===!0?_=new f.Bone:R.length>1?_=new f.Group:R.length===1?_=R[0]:_=new f.Object3D,_!==R[0])for(let F=0,z=R.length;F<z;F++)_.add(R[F]);if(k.name&&(_.userData.name=k.name,_.name=D),re(_,k),k.extensions&&me(M,_,k),k.matrix!==void 0){let F=new f.Matrix4;F.fromArray(k.matrix),_.applyMatrix4(F)}else k.translation!==void 0&&_.position.fromArray(k.translation),k.rotation!==void 0&&_.quaternion.fromArray(k.rotation),k.scale!==void 0&&_.scale.fromArray(k.scale);return S.associations.set(_,{type:"nodes",index:w}),_})},Y.prototype.loadScene=function(){function w(E,M,S,k){let D=S.nodes[E];return k.getDependency("node",E).then(function(R){if(D.skin===void 0)return R;let _;return k.getDependency("skin",D.skin).then(function(F){_=F;let z=[];for(let U=0,q=_.joints.length;U<q;U++)z.push(k.getDependency("node",_.joints[U]));return Promise.all(z)}).then(function(F){return R.traverse(function(z){if(!z.isMesh)return;let U=[],q=[];for(let ae=0,le=F.length;ae<le;ae++){let oe=F[ae];if(oe){U.push(oe);let pe=new f.Matrix4;_.inverseBindMatrices!==void 0&&pe.fromArray(_.inverseBindMatrices.array,ae*16),q.push(pe)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',_.joints[ae])}z.bind(new f.Skeleton(U,q),z.matrixWorld)}),R})}).then(function(R){M.add(R);let _=[];if(D.children){let F=D.children;for(let z=0,U=F.length;z<U;z++){let q=F[z];_.push(w(q,R,S,k))}}return Promise.all(_)})}return function(M){let S=this.json,k=this.extensions,D=this.json.scenes[M],R=this,_=new f.Group;D.name&&(_.name=R.createUniqueName(D.name)),re(_,D),D.extensions&&me(k,_,D);let F=D.nodes||[],z=[];for(let U=0,q=F.length;U<q;U++)z.push(w(F[U],_,S,R));return Promise.all(z).then(function(){return _})}}(),o}();class Fa{constructor(e,i,r,a,l=200){L(this,"group");L(this,"sceneCamera");L(this,"cubeCamera");L(this,"element");L(this,"meshs");L(this,"currentMesh");L(this,"raycaster",new f.Raycaster);L(this,"control");L(this,"moveMesh");L(this,"size");L(this,"getAllObjectBox");this.group=new f.Group;const c=new f.DirectionalLight(16777215,1.2);i.add(c),this.moveMesh=new f.Mesh(new f.BufferGeometry,new f.MeshStandardMaterial({color:57599,transparent:!0,opacity:.45,depthTest:!1})),this.group.add(this.moveMesh),this.sceneCamera=e,this.cubeCamera=i,this.element=r,this.meshs=[],this.getAllObjectBox=a;const h=["前","后","上","下","左","右"],p=[{vertex:[-10,-6,6,-10,-6,-6,-6,-10,-6,-6,-10,-6,-6,-10,6,-10,-6,6],color:15856112,name:"EDGE_BACK_LEFT"},{vertex:[-10,-6,-6,-10,6,-6,-6,6,-10,-6,6,-10,-6,-6,-10,-10,-6,-6],color:15856112,name:"EDGE_BACK_BOTTOM"},{vertex:[-6,6,10,-10,6,6,-10,-6,6,-10,-6,6,-6,-6,10,-6,6,10],color:15856112,name:"EDGE_BACK_TOP"},{vertex:[-10,6,-6,-10,6,6,-6,10,6,-6,10,6,-6,10,-6,-10,6,-6],color:15856112,name:"EDGE_BACK_RIGHT"},{vertex:[-6,-6,-10,6,-6,-10,6,-10,-6,6,-10,-6,-6,-10,-6,-6,-6,-10],color:15856112,name:"EDGE_BOTTOM_LEFT"},{vertex:[6,-6,10,-6,-6,10,-6,-10,6,-6,-10,6,6,-10,6,6,-6,10],color:15856112,name:"EDGE_TOP_LEFT"},{vertex:[10,-6,-6,10,-6,6,6,-10,6,6,-10,6,6,-10,-6,10,-6,-6],color:15856112,name:"EDGE_LEFT_FRONT"},{vertex:[-6,10,-6,6,10,-6,6,6,-10,6,6,-10,-6,6,-10,-6,10,-6],color:15856112,name:"EDGE_RIGHT_BOTTOM"},{vertex:[6,6,-10,10,6,-6,10,-6,-6,10,-6,-6,6,-6,-10,6,6,-10],color:15856112,name:"EDGE_FRONT_BOTTOM"},{vertex:[6,10,6,-6,10,6,-6,6,10,-6,6,10,6,6,10,6,10,6],color:15856112,name:"EDGE_TOP_RIGHT"},{vertex:[10,6,6,6,6,10,6,-6,10,6,-6,10,10,-6,6,10,6,6],color:15856112,name:"EDGE_TOP_FRONT"},{vertex:[6,10,-6,6,10,6,10,6,6,10,6,6,10,6,-6,6,10,-6],color:15856112,name:"EDGE_FRONT_RIGHT"},{vertex:[-10,-6,-6,-6,-6,-10,-6,-10,-6],color:15856112,name:"CORNER_BACK_LEFT_BOTTOM"},{vertex:[-6,-6,10,-10,-6,6,-6,-10,6],color:15856112,name:"CORNER_BACK_LEFT_TOP"},{vertex:[-6,10,-6,-6,6,-10,-10,6,-6],color:15856112,name:"CORNER_BACK_RIGHT_BOTTOM"},{vertex:[-6,10,6,-10,6,6,-6,6,10],color:15856112,name:"CORNER_BACK_RIGHT_TOP"},{vertex:[6,-6,-10,10,-6,-6,6,-10,-6],color:15856112,name:"CORNER_FRONT_BOTTOM_LEFT"},{vertex:[10,-6,6,6,-6,10,6,-10,6],color:15856112,name:"CORNER_FRONT_TOP_LEFT"},{vertex:[6,10,-6,10,6,-6,6,6,-10],color:15856112,name:"CORNER_RIGHT_FRONT_BOTTOM"},{vertex:[6,10,6,6,6,10,10,6,6],color:15856112,name:"CORNER_TOP_FRONT_RIGHT"}];h.forEach(u=>{const d=Ua(u);this.group.add(d),this.meshs.push(d)}),p.forEach(u=>{const d=Ga(u.vertex,u.color,u.name);this.group.add(d),this.meshs.push(d)}),this.group.add(Ha()),this.size=l,this.element.addEventListener("mousemove",this.mouseEvent.bind(this)),this.element.addEventListener("click",this.clickEvent.bind(this))}mouseEvent(e){var p;const i=this.element.getBoundingClientRect(),r=i.width,a=i.left,l=i.top,c={x:0,y:0};c.x=(e.clientX-a-r+this.size)/this.size*2-1,c.y=(e.clientY-l)/this.size*-2+1,this.raycaster.setFromCamera(c,this.cubeCamera);const h=this.raycaster.intersectObjects(this.meshs,!1);if(h.length<1){this.moveMesh.geometry.setFromPoints([]),this.currentMesh=null;return}h[0].object.uuid!=((p=this.currentMesh)==null?void 0:p.uuid)&&(this.currentMesh=h[0].object,this.moveMesh.geometry.copy(this.currentMesh.geometry))}clickEvent(){if(this.currentMesh==null)return;const e=this.currentMesh.name;this.changeCamera(e)}changeCamera(e){const i=new f.Vector3,r=new f.Vector3(0,1,0),a=this,l=function(){a.sceneCamera.updateMatrix(),a.sceneCamera.updateProjectionMatrix()},c=function(d,m,v){const y=d.distanceTo(a.sceneCamera.position)*2,x=new De.Tween(a.sceneCamera.position).to(d,y).easing(De.Easing.Circular.Out).onUpdate(()=>{l()}),b=new De.Tween(a.sceneCamera.up).to(m,y).easing(De.Easing.Circular.Out).onUpdate(()=>{l()}),C=new De.Tween(a.control.target).to(v,y).easing(De.Easing.Circular.Out).onUpdate(()=>{l()});x.start(),b.start(),C.start()},h=this.getAllObjectBox(),p=h.getCenter(new f.Vector3),u=h.max.distanceTo(h.min);if(u!=1/0){switch(e){case"qian":i.set(p.x,p.y,h.max.z);break;case"EDGE_FRONT_RIGHT":i.set(p.x+5,p.y+5,p.z);break;case"you":i.set(h.max.x,p.y,p.z);break;case"EDGE_BACK_RIGHT":i.set(p.x-5,p.y+5,p.z);break;case"hou":i.set(p.x,p.y,p.z-10);break;case"EDGE_BACK_LEFT":i.set(p.x-5,p.y-5,p.z);break;case"zuo":i.set(p.x-10,p.y,p.z);break;case"EDGE_LEFT_FRONT":i.set(p.x+5,p.y-5,p.z);break;case"EDGE_TOP_FRONT":i.set(p.x+5,p.y,p.z+5);break;case"CORNER_TOP_FRONT_RIGHT":i.set(p.x+5,p.y+5,p.z+5);break;case"EDGE_TOP_RIGHT":i.set(p.x,p.y+5,p.z+5);break;case"CORNER_BACK_RIGHT_TOP":i.set(p.x-5,p.y+5,p.z+5);break;case"EDGE_BACK_TOP":i.set(p.x-5,p.y,p.z+5);break;case"CORNER_BACK_LEFT_TOP":i.set(p.x-5,p.y-5,p.z+5);break;case"EDGE_TOP_LEFT":i.set(p.x,p.y-5,p.z+5);break;case"CORNER_FRONT_TOP_LEFT":i.set(p.x+5,p.y-5,p.z+5);break;case"EDGE_FRONT_BOTTOM":i.set(p.x+5,p.y,p.z-5);break;case"CORNER_RIGHT_FRONT_BOTTOM":i.set(p.x+5,p.y+5,p.z-5);break;case"EDGE_RIGHT_BOTTOM":i.set(p.x,p.y+5,p.z-5);break;case"CORNER_BACK_RIGHT_BOTTOM":i.set(p.x-5,p.y+5,p.z-5);break;case"EDGE_BACK_BOTTOM":i.set(p.x-5,p.y,p.z-5);break;case"EDGE_BOTTOM_LEFT":i.set(p.x,p.y-5,p.z-5);break;case"CORNER_FRONT_BOTTOM_LEFT":i.set(p.x+5,p.y-5,p.z-5);break;case"CORNER_BACK_LEFT_BOTTOM":i.set(p.x-5,p.y-5,p.z-5);break;case"shang":i.set(p.x,p.y+5,p.z);break;case"xia":i.set(p.x,p.y-5,p.z);break}i.sub(p),i.setLength(u/1.2),i.add(p),c(i,r,p)}}setControl(e){this.control=e}}function Ua(o){const e=new f.PlaneBufferGeometry(12,12),i=new f.MeshStandardMaterial({map:null}),r=new f.Mesh(e,i);r.userData.color=16777215;let a;switch(o){case"上":a=new f.CanvasTexture(Xt("前")),a.encoding=f.sRGBEncoding,i.map=a,r.name="qian",e.translate(0,0,10);break;case"下":a=new f.CanvasTexture(Xt("后")),a.encoding=f.sRGBEncoding,i.map=a,r.name="hou",e.rotateY(Math.PI),e.translate(0,0,-10);break;case"前":a=new f.CanvasTexture(Xt("下")),a.encoding=f.sRGBEncoding,i.map=a,r.name="xia",e.rotateX(Math.PI/2),e.translate(0,-10,0);break;case"后":a=new f.CanvasTexture(Xt("上")),a.encoding=f.sRGBEncoding,i.map=a,r.name="shang",e.rotateX(-Math.PI/2),e.translate(0,10,0);break;case"右":a=new f.CanvasTexture(Xt("右")),a.encoding=f.sRGBEncoding,i.map=a,r.name="you",e.rotateY(Math.PI/2),e.translate(10,0,0);break;case"左":a=new f.CanvasTexture(Xt("左")),a.encoding=f.sRGBEncoding,i.map=a,r.name="zuo",e.rotateY(-Math.PI/2),e.translate(-10,0,0);break}return r}function Ga(o,e=16711680,i){const r=new f.BufferGeometry;r.setAttribute("position",new f.Float32BufferAttribute(o,3)),r.computeVertexNormals();const a=new f.MeshStandardMaterial({color:e}),l=new f.Mesh(r,a);if(o.length>10){const c=new f.Line(r,new f.LineBasicMaterial({color:5005417}));l.add(c)}return l.name=i,l.userData.color=e,l}function Xt(o){const r=document.createElement("canvas");r.width=512,r.height=512;const a=r.getContext("2d");return a.fillStyle="rgba(241, 241, 240, 1)",a.fillRect(0,0,512,512),a.font="220px blod",a.fillStyle="#6D8994",a.textAlign="center",a.textBaseline="middle",a.fillText(o,512/2,512/2),r}function za(){const o=document.createElement("canvas"),e=o.getContext("2d"),i=512,r=512;o.width=i,o.height=r;const a=e.createLinearGradient(0,0,512,512);a.addColorStop(0,"#F0F0F0"),a.addColorStop(1,"#D6DEEB"),e.fillStyle=a,e.fillRect(0,0,i,r),e.font="50px blod",e.fillStyle="#6D8994",e.textAlign="center",e.textBaseline="middle",e.fillText("西",50,r/2),e.font="50px blod",e.fillStyle="#6D8994",e.textAlign="center",e.textBaseline="middle",e.fillText("南",i/2,462),e.font="50px blod",e.fillStyle="#6D8994",e.textAlign="center",e.textBaseline="middle",e.fillText("东",462,r/2),e.font="50px blod",e.fillStyle="#6D8994",e.textAlign="center",e.textBaseline="middle",e.fillText("北",i/2,50);const l=new f.CanvasTexture(o);return l.encoding=f.sRGBEncoding,new f.MeshStandardMaterial({map:l,transparent:!0,side:2})}function Ha(){const o=new f.RingBufferGeometry(.6,1,100),e=za(),i=new f.Mesh(o,e);return i.scale.set(20,20,1),i.rotateX(-Math.PI/2),i.position.y=-15,i}class ja{constructor(e){L(this,"viewer");this.viewer=e}addAmbientLight(e){const i=new f.AmbientLight(e.color,e.intensity);return this.viewer.scene.add(i),i}addPointLight(e){const i=new f.PointLight(e.color,e.intensity,e.distance,e.decay);return e.position&&i.position.copy(e.position),this.viewer.scene.add(i),i}addSpotLight(e){const i=new f.SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);return e.position&&i.position.copy(e.position),this.viewer.scene.add(i),i}addDirectionalLight(e){const i=new f.DirectionalLight(e.color,e.intensity);return e.position&&i.position.copy(e.position),this.viewer.scene.add(i),i}updateLightIntensity(e,i){e.intensity=i}}class Wa{constructor(e){L(this,"viewer");L(this,"highLightMesh");L(this,"highLightMeshLine");L(this,"sparklingMesh");L(this,"keyDisplay");this.viewer=e;const i=new f.BufferGeometry;let r=new f.MeshBasicMaterial({color:4977407,transparent:!0,opacity:.5,depthTest:!1,depthWrite:!1});this.highLightMesh=new f.Mesh(i,r),this.highLightMesh.renderOrder=99,this.viewer.scene.add(this.highLightMesh);const a=new f.LineBasicMaterial({color:4977407,transparent:!0,depthTest:!1,depthWrite:!1});this.highLightMeshLine=new f.LineSegments(new f.BufferGeometry,a),this.highLightMeshLine.renderOrder=99,this.viewer.scene.add(this.highLightMeshLine),this.viewer.element.onpointerup=l=>{l.button==2&&(this.clearHeightMeshAndTreeHeightLight(),window.onpointerup=null)},this.viewer.element.onkeydown=l=>{l.key==="Escape"&&this.clearHeightMeshAndTreeHeightLight()}}setHighLightMeshMaterial(e,i){const r={color:4977407,transparent:!0,depthTest:!1,depthWrite:!1};try{e instanceof f.MeshBasicMaterial?this.highLightMesh.material=e:this.highLightMesh.material=new f.MeshBasicMaterial({...r,...e}),i instanceof f.LineBasicMaterial?this.highLightMeshLine.material=i:(i!=null&&i.color||(r.color=this.highLightMesh.material.color.clone()),i!=null&&i.opacity||(r.opacity=.5),this.highLightMeshLine.material=new f.LineBasicMaterial({...r,...i||e}))}catch(a){console.log(a)}}setHighLightById(e,i="uuid",r=!0,a=!1){var p,u,d,m,v,y,x;const l=[];let c=[],h=!!((u=(p=this.viewer)==null?void 0:p.utilsMenuRef)!=null&&u.comInfoRef)||a;return i==="uuid"?e.forEach(b=>{var C;if(this.viewer.allMesh[b]){h&&["Mesh","LineSegments"].includes((C=this.viewer.allMesh[b])==null?void 0:C.type)&&c.push(this.viewer.allMesh[b]);const T=new f.BufferGeometry().copy(this.viewer.allMesh[b].geometry);T.applyMatrix4(this.viewer.allMesh[b].matrix),T.deleteAttribute("normal"),T.deleteAttribute("uv"),T.userData={mesh:this.viewer.allMesh[b].uuid,guid:this.viewer.allMesh[b].userData.ExId},l.push(T)}}):i==="guid"&&e.forEach(b=>{for(const C in this.viewer.objs){let T=!1;if(this.viewer.objs[C].children.forEach(O=>{const P=O.geometry.userData[b];P&&P.forEach(V=>{var I;const B=V.uuid;if(this.viewer.allMesh[B]){h&&["Mesh","LineSegments"].includes((I=this.viewer.allMesh[b])==null?void 0:I.type)&&c.push(this.viewer.allMesh[b]);const G=new f.BufferGeometry().copy(this.viewer.allMesh[B].geometry);G.applyMatrix4(this.viewer.allMesh[B].matrix),G.deleteAttribute("normal"),G.deleteAttribute("uv"),G.userData={mesh:this.viewer.allMesh[B].uuid,guid:this.viewer.allMesh[B].userData.ExId},l.push(G),T=!0;return}})}),T)break}}),l.length?(this.viewer.mergeBufferGeometries(l,b=>{this.setHighLightMesh(b),r&&this.viewer.focusOnTheMesh(this.highLightMesh)}),(m=(d=this.viewer)==null?void 0:d.utilsMenuRef)!=null&&m.comInfoRef&&((x=(y=(v=this.viewer)==null?void 0:v.utilsMenuRef)==null?void 0:y.comInfoRef)==null||x.setComGroup(c))):this.clearHighLightMesh(),c}setHighLightMesh(e){if(!e.attributes.position){console.error("Geometry is empty. Cannot create EdgesGeometry.");return}this.highLightMesh.geometry.copy(e),this.updateHighLightMeshLine(),this.viewer.setAllMaterialsTransparent(.5)}updateHighLightMeshLine(){var e;this.highLightMeshLine.geometry.setFromPoints([]),this.highLightMeshLine.geometry.dispose(),(e=this.highLightMesh.geometry)!=null&&e.attributes.position&&this.highLightMeshLine.geometry.copy(new f.EdgesGeometry(this.highLightMesh.geometry,Math.PI*6.137))}clearHeightMeshAndTreeHeightLight(){var e,i,r,a,l,c,h,p,u,d,m,v,y,x,b;(i=(e=this.viewer)==null?void 0:e.rayCasterManager)!=null&&i.raycasterResultGuid&&(this.viewer.rayCasterManager.raycasterResultGuid=""),(h=(c=(l=(a=(r=this.viewer.highLightMeshManager.highLightMesh)==null?void 0:r.geometry)==null?void 0:a.attributes)==null?void 0:l.position)==null?void 0:c.array)!=null&&h.length&&(((u=(p=this.viewer.options.utilsMenu)==null?void 0:p.options.tree)==null?void 0:u.show)!==!1&&((m=(d=this.viewer.utilsMenuRef)==null?void 0:d.treeRef)!=null&&m.show)&&((y=(v=this.viewer.utilsMenuRef)==null?void 0:v.treeRef)!=null&&y.onTreeNodePointerClick)?(b=(x=this.viewer.utilsMenuRef)==null?void 0:x.treeRef)==null||b.onTreeNodePointerClick(null,!0,!1):this.clearHighLightMesh(!1))}clearHighLightMesh(e=!0){var i,r,a,l;(i=this.keyDisplay)!=null&&i.length&&this.keyDisplay.forEach(c=>{c.parent&&c.parent.remove(c),c.geometry.dispose(),c.material&&(Array.isArray(c.material)?c.material.forEach(h=>h.dispose()):c.material.dispose())}),this.highLightMesh.geometry.setFromPoints([]),this.highLightMesh.geometry.dispose(),this.highLightMeshLine.geometry.setFromPoints([]),this.highLightMeshLine.geometry.dispose(),e&&this.viewer.resetView(500),this.viewer.setAllMaterialsTransparent(1),(l=(a=(r=this.viewer)==null?void 0:r.utilsMenuRef)==null?void 0:a.comInfoRef)==null||l.setComGroup([])}}function Xa(){let o="";for(let e=0;e<32;e++){let i=Math.random()*16|0;(e===8||e===12||e===16||e===20)&&(o+="-"),o+=(e===12?4:e===16?i&3|8:i).toString(16)}return o}const Ys=o=>{if(typeof o!="object"||o===null)return o;let e;if(Array.isArray(o)){e=[];for(let i=0;i<o.length;i++)e[i]=Ys(o[i])}else{e={};for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=Ys(o[i]))}return e};function Kt(o,e,i="id"){if(Object.prototype.toString.call(o)==="[object Object]"){if(o[i]===e)return o;if(o.children&&Array.isArray(o.children))for(let r of o.children){const a=Kt(r,e,i);if(a)return a}return null}}function Ks(o,e){const i={...o};for(const r in e)e.hasOwnProperty(r)&&(typeof e[r]=="object"&&e[r]!==null&&!Array.isArray(e[r])&&typeof o[r]=="object"&&o[r]!==null&&!Array.isArray(o[r])?i[r]=Ks(o[r],e[r]):i[r]=e[r]);return i}function kt(o){return getComputedStyle(document.documentElement).getPropertyValue(o)}function Za(o,e){const i=o.getBoundingClientRect(),r=i.width,a=i.height,l=e.clientY-i.top,c=e.clientX-i.left,h={x:0,y:0};return h.x=c/r*2-1,h.y=-(l/a)*2+1,h}class Ya{constructor(e,i){L(this,"viewer");L(this,"raycaster",new f.Raycaster);L(this,"eventHandler");L(this,"raycasterResultGuid");L(this,"objs",[]);this.viewer=e;for(const r in this.viewer.objs)Object.prototype.hasOwnProperty.call(this.viewer.objs,r)&&this.viewer.objs[r].traverse(a=>{a instanceof f.Mesh&&this.objs.push(a)});this.setEventHandler(i)}setEventHandler(e){var l,c,h;if(this.raycasterResultGuid="",(c=(l=this.viewer)==null?void 0:l.highLightMeshManager)==null||c.clearHeightMeshAndTreeHeightLight(),(h=this.eventHandler)!=null&&h.length&&this.eventHandler.forEach(p=>{this.viewer.element.removeEventListener(p.type,p.handler)}),this.eventHandler=[],!e)return;const i=Array.isArray(e)?e:[e],r=i.map(p=>p.type);if(r.includes("click")&&!(r.includes("mousedown")||r.includes("mouseup"))){const p=i.findIndex(u=>u.type==="click");if(p!==-1){let u;const d={rayResultOption:{highLightMesh:!1,focus:!1,useDefault:!0,useRaycasterResult:!1},type:"pointerdown",callback:v=>{v.button===0&&(u=Date.now())}},m={...i[p],type:"pointerup",executeBeforeCallback:v=>v.button===0?Date.now()-u<200:!1};i.splice(p,1,d,m)}}let a={highLightMesh:!0,focus:!0,useDefault:!1,useRaycasterResult:!0,intersectObjectsParams:{objects:this.objs}};i.forEach(p=>{const u=d=>{var v;let m=(p.executeBeforeCallback&&p.executeBeforeCallback(d))??!0;if(((v=p.rayResultOption)==null?void 0:v.useRaycasterResult)!==!1&&m!==!1){const y=this.getRaycasterResult(d,Ks(a,p.rayResultOption));p!=null&&p.callback&&p.callback(y)}else p!=null&&p.callback&&p.callback(d)};this.eventHandler.push({handler:u,type:p.type}),this.viewer.element.addEventListener(p.type,u,p==null?void 0:p.options)})}getRaycasterResult(e,i){var c,h,p,u,d,m,v,y,x,b,C,T,A;const{intersectObjectsParams:r}=i;let a=Za(this.viewer.renderer.domElement,e);this.raycaster.setFromCamera(a,this.viewer.camera);const l=this.raycaster.intersectObjects(r.objects,(r==null?void 0:r.recursive)||!1,(r==null?void 0:r.optionalTarget)||void 0);if(i.useDefault)return l;if(l.length>0&&l[0].object.type=="Mesh"&&l[0].faceIndex!==void 0){const O={},P=l[0].faceIndex*3,V=l[0].object,B=V.geometry;O.point=l[0].point,O.default=l;const I=B.userData;e:for(const G in I){const W=I[G];for(let j=0;j<W.length;j++){const H=W[j];if(P<H.face_end&&P>=H.face_start){const ee=H.uuid,$=this.viewer.allMesh[ee],de=(c=$==null?void 0:$.userData)==null?void 0:c.ExId;if(O.uuid=ee,O.guid=de,O.object=$,O.userData=(h=V.parent)==null?void 0:h.userData,i.highLightMesh){const ie=(p=this.viewer.utilsMenuRef)==null?void 0:p.treeRef,me=!!(ie!=null&&ie.show),re=!!((u=this.viewer.utilsMenuRef)!=null&&u.comInfoRef),be=me||re||!!((m=(d=this.viewer.options)==null?void 0:d.baseConfig)!=null&&m.clickHighlight);if(this.raycasterResultGuid="",be){const K=((x=(y=(v=this.viewer.options.utilsMenu)==null?void 0:v.options)==null?void 0:y.tree)==null?void 0:x.show)!==!1&&me&&!!(ie!=null&&ie.onTreeNodePointerClick)&&(ie==null?void 0:ie.activeName)!=="model"&&!!((b=ie==null?void 0:ie.currentTreeData)!=null&&b.length)?Kt(ie.currentTreeData[0],de,"guid"):void 0;K?ie.onTreeNodePointerClick(K,!0):(((A=(T=(C=this.viewer.options.utilsMenu)==null?void 0:C.options)==null?void 0:T.tree)==null?void 0:A.show)!==!1&&(this.raycasterResultGuid=de),this.viewer.highLightMeshManager.setHighLightById([ee]))}}break e}}}return O}else return null}destroy(){var e;(e=this.eventHandler)!=null&&e.length&&(this.eventHandler.forEach(i=>{this.viewer.element.removeEventListener(i.type,i.handler)}),this.eventHandler=[]),this.raycaster=null}}const St=(o,e,i)=>{const r=g.ref(null),a=document.createElement("div");i.appendChild(a);const l=g.defineComponent({setup(){return()=>g.h(o,{ref:r,...e})}});return g.render(g.h(l),a),r.value&&(r.value.destroy=function(){g.render(null,a),i.removeChild(a),r.value=null}),r.value},Ka=g.defineComponent({__name:"index",props:{text:{default:()=>"-"},customStyle:{},enterable:{type:Boolean,default:()=>!0}},setup(o){const e=g.ref(!1),i=l=>{e.value=a(l.target)},r=()=>{e.value=!1},a=l=>{const c=l,h=c.getBoundingClientRect().width,p=document.createRange();return p.setStart(c,0),p.setEnd(c,c.childNodes.length),p.getBoundingClientRect().width>h};return(l,c)=>(g.openBlock(),g.createBlock(g.unref(Se.ElTooltip),{"popper-class":"custom-over-flow",visible:g.unref(e),content:l.text.toString(),effect:"light",placement:"top",enterable:l.enterable,"hide-after":100},{default:g.withCtx(()=>[g.createElementVNode("div",{class:"text",style:g.normalizeStyle(l.customStyle),onMouseenter:c[0]||(c[0]=h=>i(h)),onMouseout:r},g.toDisplayString(l.text),37)]),_:1},8,["visible","content","enterable"]))}});const Ue=(o,e)=>{const i=o.__vccOpts||o;for(const[r,a]of e)i[r]=a;return i},vt=Ue(Ka,[["__scopeId","data-v-c466b0fc"]]),qa="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADCCAYAAAAMw434AAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQmMJUd5/qvf3DM7e3l3Zuc+dnaAxcQ2xiHExoAVYoIsAg4KIUEON1gxAouIBHNsOJyExME2QgYZxBGCyIJsRIKJIYqRMSDHNsYGO+s95r53Z9az1+zMvHkVVXdXd1V1dXd1v+43/XqqJXt3X9fx/99fXx3/X1WNYJMejHE7ANwEADcAwBUA0LhJouhqqwOBMwDwJAAcBoDvIoROVkJsVIlKxDowxu8GgLs0KTYD/VzUOQ8ANyOE7ktbm4oTBGN8CAA+KSpWKpVgYwMDxhhw2lrr8qsWAdJgEUJQKBhgGOhDCKE701SmogTBGL8VAP6NVai4UYLV1XWTHPrRCERBoKbGWEdgvKqpqfYXUfJFSVsxgmCM6wHgBAB0UgFXV4uwulaMIq9OqxHgEMAAv93R2nhpWrBUkiBvthdYpi6EGIQg+tEIlItAaaN0xc6dzWQBn/hTSYLcDQC3EA02Nkpw/sJa4sroArcmArgEt+3Y0Xh7GtpXkiAPAMDriBIrF9dhfX0jDX10mVsRAQz3bN/eeHMaqleSIA8BwKswBjh77mIauugyty4CX9/e2vj2NNSvOEGIO/fceT29SsOYW7jM/BBErz+2cDNOT3VNkPSw1SXnAAFNkBwYUauQHgKaIOlhq0vOAQKaIDkwolYhPQQ0QdLDVpecAwQ0QXJgRK1CeghogqSHrS45BwhoguTAiFqF9BDQBEkPW11yDhDQBMmBEbUK6SGgCZIetrrkHCCgCZIDI2oV0kNAEyQ9bHXJOUBAEyQHRtQqpIeAJkh62OqSc4CAJoiKEVHFjn+pSKPTUATIKdKUH02QMIANA0FLM7lZSD9ZQ+DM2dSPWGuChBldEyQMoc17rwmigD3G2Ly0Ia0jt5ogCkbYpCSaIArAa4IogJTTJJogCobVBFEAKadJNEEUDJs2QYgHq7GhTkESnaTSCFxYSf2ap+pZpP/kJ49vr2+tvxqM0p8ijPoAYCcxyEteNNjf2tzUnNYapNJG1/VlB4Hls+dOj0/PTpsSIXy+hOFRMIwfnpldfeSGG668UI6kiUUODmFsvObRp98EBfR1BNAsCnXpcD9s39ai7+Utx1o6rxSBpeUzMDVHvqkjPBgWSgZ627VXXvrjuNAlQhBCjuv+9zf3ggHv8BNEEySuiXS+MAR8CWJnRGDcevXLXvz5sHJk7xMhyCOPPf1eDPClIAE0QeKYR+dRQSCMIGYZJfSma3730vtVymPTlE2QX/z6uc6N9dUjANCiCRIVfp0+CQRUCIIxzG2cX+x/9atfHSmsXzZBfvbYU7cBoM+EKapHkDCE9Pu4CKgQhJSNEbr5lVdeek+UesomyMOPPf0Esj7jHPhogoQhpN/HRUCZIAAPvPJlL3l9lHrKJsjPHnt6FQBCAxCaIFHMotNGQUCVIIDx0Wuu+p3hKGUnQRClzcyaIFHMotNGQUCVIBjD2Cuvekl/lLI1QaKgpdNmEgFNkEyaRQuVFQQ0QbJiCS1HJhHQBMmkWbRQWUFAEyQrltByZBIBTZBMmkULlRUENEGyYgktRyYR0ARRMAs5k97cFBqvVChJJ0kagbPnSCw5vUcTRAFbfWmDAkiblCTtI7eaIAqG1QRRAGmTkmiCKACf9lYTTRAFI2xSEk0QBeA1QRRAymkSTRAFw6ZNEITI1aN6ka5gioon0Yt0BcjTJoiCCDpJThHQi/ScGlarlQwCmiDJ4KhLySkCmiA5NaxWKxkENEGSwVGXklMENEFyalitVjIIaIIkg6MuJacIaILk1LBarWQQ0ARJBkddSk4R0ATJqWG1WskgoAmSDI66lJwioAmSU8NqtZJBQBMkGRx1KTlFQBMkp4bVaiWDgCZIMjjqUnKKgCZITg2r1UoGgUoTBC0vL+9c2djoKG3g3yuA0QpQghIY5DtWAOaf5CG/GLCw9Pw/s9e7+92G3b5nFzTW10EJY1hb2+CQQYAAA39JvOw3mom8Iw/JE5SOpjcMA+pqC1AwEJCDVfqpLAKrgr2Trr1iBFlYWGjfgNrvAMC1Zvsj/8MYgdkgMW1c2PrNeqqtwbU0NUBzU33VyZ10o6pkebk4cjszv/iHAOi/goEjPTDhjD9B6DiQ5X6akPqSXdugYNDRsJLNZevVVfUEmVlYugYwPBxmOtKwMFb6Xo4zutjDEBlrCLm4h7yTEcnv9zD5orwnuuzd3apHkiigxUxb1QQ5fPhw4eprr1tEyGhlRwZhkWBPuGIi5JMtKuEs1tmFURaxQ5YKd5n8DfW1sKO1WZMkWbN6SqtqgszOL92MAb5oryeYdYcXNYQQN71KGdeKFL+8vAjD+wc1SVJEu6oJMjO/9CAAvJbgQ6ZP1bboLteuR08cg+amRjh4INK3HcutdkvlXy8S72d6T6perJn5xTkM0Oa4Ti2SsMsAbklgk6gSy4T0EGVKnj+5AM8eew6G+gbgwIAeSSoCesKVpEqQ6fklDDYp6BqEGUVMIpgLc7LCthfo5lTLXg1k2VulYocz587Cr5/5jenRGujphcHe/i03iqrglOU0qRJkZn5pEQB2Ogt0K+TBEYKuT1gCWaQxfVNZxi5UtmKxCI8++TgUCiSQaEBvVzf0dfVokoQil50EKRPk9BMY8BVkfKAqm0SwRwzqafJ4nHJADjpPfOypX5mjo2GTpHtfJ3R3dGqSZIcDgZKkSpDpucVvI4TewowOUk+VPe3yvDOJYw05jP/VHHPMf1sDkvXeGZzoICWoXemFjSkXBnj26BG4uLZqjiCGUYBCwYCOtnbobNunSVIFJEmVIFNzp25HgP42VRcuZYbLmxiws4UwXIw0w3PLMPdw2WuqkYkxOHvurEUQexQhRGnfs9f8b6t59mIYZ1OzpEqQybnF9xgAX5asM3IX8/Cz4uzCHCwuLXLkIBscyX97d++Bvbt3a5JsKgWCK0+VIFNziy9HAL+MoX/sGVGsCHoMAVWzLD1/GuZOzjtTLEoOa8plwJ5dl8DunTtVi9PpKoxAqgQZHV1or2sszNJlgUqrpwHFVKdlFQR55eIKTExPmusPjhwFAwxkkWT3zl2ws3V7BaXSVakikCpBiBDTc4unMeAddF7OzrnpOQ3bnWvFRexzGKoKcOkkS4lY5SSYqbhRhNGJcZ4c9uhBCUP+JATZvq01wZp1UUkgUAmCPIkxvoyuQ8ifxKtFPVT0UBL7ZxKKZamM0clxUxw6rWKJwf59e8s22NbckiXRt7wsFSDIqfsxhj+mSNOpExcDscMkwpaU3BhnZn4WSNDQjxjm7wiZ77c1tUBzU1NudK92RSpAkKW/B8AfYUYOy4PFBi6cSIYXTneXuffYrFmmz7mPLBnm1NIiXFy96E8QmxxkTYIMBM2NTdDU0JglFbasLKkTZGp+6b1QKn2JTrEwYBL9cx8hjsGfA/dZVAis4KdpbgDR+l1+cMoilzzI6Ab+eeHcwCS/DUaujnum/czZM3D+wgUvQcxFujVyUHKYfyJkEqShvn7LNsysKJ46QWZnT1+7ARs/VVZYOLTkEMZp6e7GRqdMSUBPvHBB5QIGPxmleSXM86Sz01xYWTGDhdwUK4AcJB0hSUNdPdTX6a/rKredFBKmThDi6q1tMIirN/BRil/E8VLFyOPIwhJP5UShj4YbpQ0g8RCeIPKRg65HiAwIGVBfWwu1tbVh8On3KSGQOkGI3FOzJ1cAUIN9Aw/f38t2eSRwuEqJcCmBKit2de2COakzRwfq5qVrD2aRThbr5nv7HdGjjpCkpqaC0lZPVVV9opDCPDWz+CRGpcvE7es+64NsrLtjjDyeZsWUUSptQLG05rp6KRFCyEEIQshCCEK2zeuHRyAXBJmcO3U/Yly9rIpsYNC5rC0n50HExlzCRTMUSkcH1r0rGzkoOcw/DcMhlyaJi0A+CDKzcCdCxgfcE4SWf5bdTmIFDpkt7Nb7nLUFoiE5GwIcSSgBTJLYIwadZllrEfd3uoDPGTCx1ckFQaZmTr4PI7iHkoKg4cRC7BiIcycW51l1CSKe/aCIZmM+Ft2+ZElRU1OwCGFPs+jf2ZGDJQdLlug15jNHLggyOblwPdSgHyFyBF2Mg8jsJgQRw0xL4x1WOja2wd6vy7ukxBiJe38vexjLKpE/rsXHTthLvXg5qCxUejc26v4i18xU37mUlU3j3hxMpLIca0RH6//W8TI+jd901u1g3HGbXyO6v/MouBiznZQrhxUjUtlT503jdnd8x8cfmnP/hcz7mOmVBirzDRez4BiZoxtpsfbZHjZoLbY5hFAJAJ3jrWX+axZB4c6ujl1mLFDyHmBs7OS+Qh3MhDV0szHK7scSNaeSqiCiUmnaaap1mEsbl2oqn21zostf5tDx/IbWAMEnuvdd8o+yDhJNzpwkfs4G+9of++LqEISieJLYUSeNBplGmXz3HhTy938Xt5HJ9AnTUdYxheXxDjju/iB2kPLr7MTy/RpnWvYXB1K/YYCRy7qZR9gxYuUjqb7T3bHnreZgwJY1OXPyCAAMs1vcfbEld2cxl1jHbQO5yBelk8iFwjlRgs4ybXW46SQufaq7s+2TIkG+DwBvsGjErw2chEKhOYFKq7HFEPDr+BmSlNZW1vs5goxPL9yFEBBXr/k4CzlztLBGG6XRZYuBrdWtLgR4J4DXdWK2cyvOdztPkJmTHzQAPs9cCudse2fPgdBt8PmLgVSXobW00RHgO3hxsWQOCuZQgEsYGQj9ip9iTS5cjw34Eesz9fVY2WVTkvBVsY5M602138AY3RQ6R6URcNfqdFTg72Uz19/+i2qTF8I5qBWOIGNjMy80amuedQ5K0amWdZm169WyblV0CxMzBCAji22wUQE+RuJV0D82wk4MXQH4S+2sSaL78G4VvygFHZL5y/Cssljii+msery+R+95GiqRZT0acHXTeeMzbFRF1JxtA2LsSBaDYs3FfyvSjS7JOjhv/ytvfW4pfMOlU/Zk7R9CS5kr2M/JYse52BLRxPSC5656x+0ruMUcV1mluwpPfdqNVM5Zmk03XyUFcGc+ZgfvzJCYJkTbNcZ43OPZnpheOIoQ2u/7tSmOToJmfNfFv6yWgGEljaXrShYBcXQQ4y7WXN9xOLnjNj8TcIRC8LCXIDMLDwK2P6gTcL1P4ndisYNA3AGh3DL88rMoyYbocswcMLxzM7Sodcgah9VAvJ/TU8XNr0yZbFFtqCpDVBzE9H5hCllcD8M3PAQZn164GwHcIu7BcWlnTsys4anKP31QLtap5Y/auFITJH8F24tpaxc6v1VOuILd3Kr+UckIcvJDgPG/uDct2l4oOxaissEtf7BqjfKAgBP/sPcSOtdb+XX0BfRnHoJMTi68DhvwQ7oNhfdqeGHSo0gemk7+dZB79iy9fS8PMWoOeqdY47MvgoLxjJ3Tcufa3itkIEwCKBRONgbCTk/zD7fWMOsIsPsXWTcz53V3yEG0sWMk1m51cyX//Km5Fg9BDh06ZLz9Xe/fYBdzvgtylyrMaQe7Mg+C4kkG3mfOr4PFQA+/q1L0tnvXS/z5EJG8sru2XI8G7VX4CAarlbc8Nw9bjmsY7+eFnE7G/otv/Ep479VdvonYf6+R+qZjMWIkw4jiwupq9cr8I7MZm6pc+3utJqGwLYQTw7MFNaPn9p3TZi5roTLZ29XeI3W+jk/NW67egINTnP84693JlpBPr+xVzMyRQ5bBZcTPejvbXiknyPT8jwHDH0jzi4elpCWoiKrTaAQqjEA0F/03erva/tKHIHN3A0a3OOIzbl2pF0ucS4h7EPJMorC5kawNxMnj15aSLKvC7TWx6tgFh1ioPO7jCRZy2cw8+KO9Xe1/L226Y1PztwLAHXxcyG312nPFwKlnNom180oVJHzzxlstMtcWb+3pbP+OlCDHJ2feWIOM+zwH++3ACt3DQs+IVEoxXU+KCGwRojuzLGFWZK3X3Yss1orFlw71dfLb3Sn8Y9PTlwMu/Io1B90nb6/yzRNUtNAUzba1i94ijbaSRhbjejSMQT1ZRBaS5nydse3g3r3npCPIU0891bx9dxt3PYq/Eu5WbL+lSJ6XIJU0rq7LH4Ewt7a7THE6diu+J33Qyb6utr3WAODzjE/Nz2HAbeawY18z6jlKEcNi7HmOoPWld91l/cL7272/+SnEAuQ9w2H1G2L5sjgGVVkWI+CjtVZKv1hIUNlUGvfMh/WL/EwGfzgtbH0YFkNiTSoG2/xu9PKLl4jNw73nwN0zGW4vFnF/+7MjQ+DWf1tY7qgGGx+xSPPzvq72qwMJMjI5998GgusoKTzXpLAr+BhEqVwW9wCSMGV0zte7v+d5TpNn3SK2JpsQztearUAhaQ/mKhsh9K3erra3BRJkbHLuKwDwTucDUCzz2Ot+9PwponV08k1FgB/u7EGNEIS5IwvhT/d17ftEMEGm5j4KAJ8J8lSZRNQE2VR768oZBMLmesL0il5XKpmW/nlfd/u3g6dYU7N/gjB811kz2B4w9r4s8yiufR2QI6Y4kssDNfzNfTRzFLKJE35ZXsenJ4AYNj30K9s7gecXGuICxU+muN6MoPqDVqniYijQ8rYSfguqOLiLC0o+wMbPcFUZL5OPbUcsWcQywy49NNDv93W2/SIQpuPjMy+tMYzHeZvbC0J9eZyqGXW6jCHghCeY802Oc8Zu1yuoeMkLu7oWAwlCXL2tu/Y6rl4/z0CY1yRj+GhxtiACssGVvznUHTURQqf6utv3KE1qRidnFwDASWwyStisKLsqhzJPNsPZgvbRKlcAAdGN7z9D9J972UuGJ/q621+mRpCJmYcBoWvcxPyN2PRgie+JLAYYMfbATs8tkb3+fK8f3r0ni71LyTult0qUpbFqYuMTPjdaMOn81n5BSxVZm2CXYzL9qXY8Vi4K4mgtkytYJm9fKi7HxLMy/tN6v7hMOLbypVR8+3tvoVBdjDBWsoVCgL7V191uungDp1jk5cjEzFcQIOLqld9I57cwrECPoauoBgSqKPZit2WM8WcHejo+pkSQsYm52wDBp61eV/IthShep2qwp5Yx/wiwrl7z4jhzo4h7gRzAO/p79n1NiSAj47NvRggOO2MNu6gwP3kluZsx/xBrDasZAWFeyp8wJB9vLVzd29n2cyWCPDcyeVVdTc2jzhzPiXsEzK28k1r1Q9DVDLyWffMQCIx52GIxaeioYS0deFfS6oX1zhe8oMf5FGHgJOmZZyZ3NW0rmP5ge7Tg7o+zCo85z+J3HXrBFVexaUxnw4Kafu+DAn2iscLKsOav3lsd/PT1ru5d7Pze+XkHaN1RmrZfByjzqASVu1n2N2MdmHyzWwhym4Zb6u/p2M2KHdq6iasXY7xHvuWP3f8aBWWdNnMIpNEBZU5Jc2uUueZw2MFE1RGgJ/p69l0ZiSAjEzOPIoCrnI7RdYf5uLZkXWIoDzMIpRYpjwhQYvATK3rTD3xvoLfjzdEIMj7zr4DgL6wgivVlcDsKaV8fzy5ngiaD9jTNTC6Kx4oUZdqWRFpxbpD1ZiGLIqh0QFGwEjGQ5S23PLY9lGN/t/2xjd89xue1J2tx4e3tAz0dt0UjyMTsxwHwp5wbFu3cdH1jfiCe/Y0pXWX6zQuY1DgfVE5SdYjAq5armi5sAh9gZierrC52EaFSRpQOo1zdouf3o65fIzfbqnnmQ2i35IVhvGugu/2r0QgyNfM22IBvmnM3upRkPLx+5JBVEoVINKpcwhiKxQ0oYc93faJYTqfNOAIGMqC2tsaU0hoPLbKozElEmgeu/yV9Aj0MWBBcvH5jHAclcfXW1hQetRObCxxG/thOLBV7ra8X4dTpZSAk0U/+ETAMA/bs3A41NQWuiSWquWwIsSvYWCt1Dw11TUUaQWZnZ/esrGGyadESmo4k1tFE9+C7ZFkhHTCZMVE2TWOFO7n0PKytFxPFRxeWbQQa6+tg145Wr5DlLIPYvL59LV775tfubTx06BA3VVFZ3cHI+MwyALalFp3tIUXIxrswH7gNz+zJRT16ZLs9Jy5dbU0N7N21w1uuGMvxa+hByy6nVLc3d4KGAL8d6O24VKxYiSAnxqcfQwCcfzj8XooA7BTXYgtLp2G9uJG4EXSB2UWgoa4OdstGkMRF5ockhOC+/p6OG2MSZOZ7CPCNZpHscUXZkdsEFVlcPgMXV9cSLFEXlXUEmhsbYMe2lvTEpJF05vseZrvG6I6Bvo4PxyLIyMTMZzDGt7HnPpSGHqc2vzmVOG6y4mF4/ux5OL9yMT2wdMmZQ6C1pRm2NTVKv2fv9vmiq5qqwbYz7zSF86Jya2GES6XS+/f3d305FkGOj0/dhAB9nRXDdBvTr08JpcrWRKxKohCs541Nd/bCCpw5dyFzRtQCpYfAztZt0NhQ5/kYryx6Q6RglyJ+acR0Ip3IvzdK6Pqh/o4HYxHkxPjM1QjgYfdiLf/goCp0fmsu9ncyvVpaPqtapE6XAwSIm5fGQ1h1VNfoYRB4PKd271wDxcHe3t6RWAQZGZlvw4XinH3rnOnapRXF3cwbpgh5T+IgJ08vqyTVaXKCQPslO4HEQ5J6PBMt9hyTO/ysDfR2NCKEPNFo5aXEibHpcwC42YnRB82ZEtKuVCrB3KnTCZWmi8k6AqTX3beH222erMjc8Qxr6LB6ejg60Nc5LKtMmSDHxyYfR4Be6hbCnCaUBAmddOI7MeAT9B4DzJ5asi7P1k/uEagpFKwYiOjTEdfedFEhW5OLLdqzv8mMcNv7Gp2X9w/2db6pLIKcGJv6HgDcKL+vXChaMc7B5fLJQ6ZY60UdTc89OwCAxEB2bd+WrqqeSw/Nzz/fOdjf9aGyCHJ8bPJzAOivXYKq+KXK13WJxELW1ssvSJeQeQRIDGR7S3OKclqjB/lCmoEQLpFLG6xTt++TuXiJIOpTrNGpmxACx9Xr1ULmZHN3Y3orstKLLmGRgMvnLuhYSIpNJktFtzY3QUtTgy2SbEoRZ2piNXPmrLjjZKK6l3Dp+qH+Ho+LNxJBjo1OXosQ+mmQ2CwJxFWD37RSNJC4JDm/sgrL585nyY5alpQQ2NnaAg31dWbpYlsKWlrIliRBIlqfW7O+LkXaWwltDB6QuHgjEWRkZKSthOrm6E0/bHCPCiOSIAqOfn0D8WQtLC4rnAyIUptOmzUECgVrqzu5qCrqE7ndmSebyIkp80KstYHeTqmLNxJBDh8+XLjiqlecAQxNKhOzsMFQfB+UvlgswrkLF6FYIrT0uCUEPNmSxHWSCq1ledguwC/uz4ohq0c0e9gUIuy9XzPy63v9dBd/lzU3cfrM1i2bG6jo75ZRYxjQ2tLkG/8Ia0tRCGXSwvlkBwZkoBODvV37VdAMref46OQRAMT7i6MTPrSezU6QpEFkuviVn3a9m43rptcvCxcg9MD+vq7XJ0KQY6NTP0CAb3AP9NpD1WZqLsZVNlOWcupOQI/IBEugznJUTiRvFB3MyYc7vbKnUHcN9nd/MBGCnBibuqOE8a3coCHOGWUCy+J8QSt62aJGtkoTZ1M0n+gao5NJmefA341mleaXJ2hoEGckfrMWmby0TjZPlPziDJAtTzab8vuNYsZiIJsXizhk3P72iVjbthiBYXxgf2/nFxIhyLGx6ZsRLn2RL0wyx4rcldklxs3n0S5Kt5JIP6ZYSIhcyvrH0S9OHkW1xGTKeggZ4+ZTtr8bB3H6nCJ+w9BQzw+SIcjIxGsBoQe9nZv1i/N5K2Gzsmsavy4oqJv2osabOmhRqW45b5myxThbnt/CVSZPUEOTYSI6Ivg0skHCPeGp2qiDW6NVh6uj+410v8V+NdifcfHYB/9K6xsvOnCg7/8SIciRI2P9hfqCuSU4rKmHzRDYMtimJs46ZLMzdvSXzVJkzYsFgH0v/i7KzZJb/GKpXzOW6R40c5IZRzbz8epqIRckh9+4If7u3+xd6VhbVLP9aTSd6LB64Uz9wYMHfY+tSuZH/j0QcfVefuXLVwChWvoptiCg2HdB/VViI6tA3Ch9uaqsKv2z39gSlleUN+lyZPWXi3312d/tGjDgkQP9PYNh43uY3bj3R0cnjyCAYfknp9ykqsaVGShKw07D6LIRMhJICSUut/GqTzD9BQ7qOFQ6vTAdKm1/5hYTovT/DPV3X5c0QX6IAP7IKjR44RcGTkLtaEsWUw3YZl5GBPcO9XW/J1GCHBuZuAMQulWFIFul5Wa+IWwVQ6jraW7EwoBuHervujNRghwfmbwFA77bOoqlH41AtSFAPlJgOZkQgjfu7+/5fqIEOWa6esHeGqxJUm3NQ8trHpCyng18cGio99lECXL06PgA1KATzgVygSOJ6FBlhLMPA1vLGJtozC5La0OktePSHa3sXcrmO6ZsJ43MWUnVZ8jMpnfqt8tj/80uscTfWVQ5DESnq60HZwW7YLo3yNHfvMHM0duqUu7usFSQ6WRjw+JKsLInFU6Zzl39dvmOrmx9FGZqA8Z+jlpBnWTW7G/JY2OHl+sLLVd2dATeKxV5CMAYF46PTq5ggFrHdnS57mArzMqFYIbMB2/i7XyT11aCa4T8bx7fv+hucYCwhHPS25yj9vXz/8t8/jKXppifBZTTk3HNySjk0JjtGNg+wk7gV58fr2nAKjAfAwbXXzBYcXhJOMvny779EaDJoYHunrARNTJBSIHHRiaeAwRDZJUjtH1PfZ52K3RYYflZw7CNKOo9DioLaXZQswjLfARVgiT7nvs7498TB6Ewg8j0FfqJWN/MKLdeGfZKmIrfE8uI/THGDw0P9r4mDJe4BHkQA7w2rPCg9yrgxs0f1rDLkbsckqrUWwnZVeRQ6SBUy5Gl20z7k4lKCeOvDg/0vjtMh1gEeW5k4gsI4K/CCt/M9+UaIO0GklVsskTQcjAKtj9ZUxkfOdDf/bmwOmIR5Ojo5AcA47vCCo/zPi8GiqO7zhM+rU0MI1y68cBg331h5cUjyImx1wNC/2kVHquIMLlo850DAAAD5klEQVT0e41AKghQP9DaevGyFw8PPBVWSazWfezY+EFcQL+xfIexigiTS7/XCKSCgHkgHQGcaahtDnPxxu7+Hzh2rH5/oY5cu17rjiIS56Xt+7OEYnyD7vdyGRBE36HoMBV9ycxOMNHnz8VPRIctqdLX0WzLI3P+UlEZfy276d/Pp8tVJ58ZW1lZ/WmmoDbi46/2HESI2s4Y3KV2os2GxUj0VdqYZ87+FhbkRtvhgd4OFWRid/9HT0yMA4JuMoqwLteguCEb83NiguwkTWy3zhSODfCoqOWm4eKMtPlL2j9d+4gxS1qSJ6bnexzfaixSXel3tG3UZbKZBmS+422WZrc3LmbI6iKJtdKWwA7wnvpk/YQQm6UcoX0Q+2+TKmKsJKBFbbr97XgYQvDLAwO9r1BpSfEJMjLxIMbYdPVyfSpjfFEApxHKjnr7xBziLtplhvOLnQTVwRInLPYSJmvYexWDydKoyO/JF+DmMU3oFwNi8rH2dAbKKrA/Bvy1Fwz2vUMF79gEee74+L3IQO8EjEODhSqC+PVGYY0ycBISQjq/hiX7PW7jjptPFbPNTpeEO53qEKVTU9HbD3vDgEND/b1/p1SGSiJZmiMnxj+CAP4hbv6tmq+ShEm6weXGZgZ6y3B/z7+r6BN7BDk2OvGGUqn0/XK9WJVsMCqA6DSVRWAz7F/CcOUL9/c+oaJpbII8c3T0spqC8aRKJTqNRiBTCBQv7hkeHj6lIlNsgjw0OtrQUTJWVCrJSprN6K2yoruWw0YAw6nh/b17VPGITRBSwXMnxkYBUJ9qZbJ01dpoq1XucmyVRt5NwPGR4cHea1R1KYsgR0+M34MBv6/cdYiqsDqdRqBcBBBCHzsw0PNZ1XLKIsizx4+/2IDaJxGCGtUKqzndJvR21QxXFmW/WIsa+gYG2uZVhSuLIKSSoyMT/4Qx/rBqheWky00DTTJ4UA6gVZY3vv2dzTwfPDDYG2kXetkEeeihh2r2dff/B0Lo+irDW4u7hRBAAHceGOyVfsk2CIayCUIKJyTp6Bm4DQD+BgDq9R74LdTyMquqPWogOI0Bf3x4oE/4KoGa4IkQhFb1zDOj7YUG4yYEcDVC0GVeq8xu8qUJnd/ozjjywpp3kA8smnv6ZDvbzPzujjNORXHHJPdvrnyr9JL1EUfzcTbSynbe+ezos3YEW9eF2Dv5zLMGpFxxM5P9b1K6pYFdN7ch1hZCsknWvEHGvu/EEpjBScCYVG7fxM7gKPlyHauzWSTdSWkDYu/AJjuxrVtlbMGcnZTuLmlbPvPTNLQcKsdm2R9jfNww0CPnny994/LL+59Xo4M31f8D7yiCh0k/HrcAAAAASUVORK5CYII=",Qa={class:"title"},Ja=g.defineComponent({__name:"index",props:{width:{default:()=>"100%"},height:{default:()=>"100%"},imgStyle:{default:()=>({})},title:{default:()=>"暂无数据"}},setup(o){const e=g.ref(),i=g.ref({height:"30%"});return g.watchEffect(()=>{e.value&&(i.value=e.value.offsetHeight>e.value.offsetWidth?{width:"30%"}:{height:"30%"})}),(r,a)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"emptyRef",ref:e,class:"empty-box flx-center",style:g.normalizeStyle({width:r.width,height:r.height})},[g.createElementVNode("img",{src:qa,alt:"",style:g.normalizeStyle(g.unref(i))},null,4),g.createElementVNode("p",Qa,g.toDisplayString(r.title),1)],4))}});const Gn=Ue(Ja,[["__scopeId","data-v-7f559bc0"]]),$a=["innerHTML"],el=g.defineComponent({__name:"SvgPathIcon",props:{svgContent:{},iconStyle:{},className:{default:""}},setup(o){const e=o,{svgContent:i,iconStyle:r}=g.toRefs(e),a=g.ref("");function l(){var p,u,d,m;const c=parseInt((p=r.value)==null?void 0:p.width),h=parseInt((u=r.value)==null?void 0:u.height);!c||!h||(c&&(a.value=i.value.replace(/width="[^"]*"/,`width="${c}"`),(d=r.value)==null||delete d.width),h&&(a.value=(a.value||i.value).replace(/height="[^"]*"/,`height="${h}"`),(m=r.value)==null||delete m.height))}return g.onBeforeMount(()=>{l()}),(c,h)=>(g.openBlock(),g.createElementBlock("span",{innerHTML:g.unref(a)||g.unref(i),style:g.normalizeStyle(g.unref(r)),class:g.normalizeClass(["svg-container",c.className])},null,14,$a))}});const tl=Ue(el,[["__scopeId","data-v-e4df4dc8"]]),sl='<svg t="1755848457184" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9235" width="256" height="256"><path d="M469.333333 85.333333m42.666667 0l0 0q42.666667 0 42.666667 42.666667l0 128q0 42.666667-42.666667 42.666667l0 0q-42.666667 0-42.666667-42.666667l0-128q0-42.666667 42.666667-42.666667Z" fill="#2c2c2c" opacity=".8" p-id="9236"></path><path d="M469.333333 725.333333m42.666667 0l0 0q42.666667 0 42.666667 42.666667l0 128q0 42.666667-42.666667 42.666667l0 0q-42.666667 0-42.666667-42.666667l0-128q0-42.666667 42.666667-42.666667Z" fill="#2c2c2c" opacity=".4" p-id="9237"></path><path d="M938.666667 469.333333m0 42.666667l0 0q0 42.666667-42.666667 42.666667l-128 0q-42.666667 0-42.666667-42.666667l0 0q0-42.666667 42.666667-42.666667l128 0q42.666667 0 42.666667 42.666667Z" fill="#2c2c2c" opacity=".2" p-id="9238"></path><path d="M298.666667 469.333333m0 42.666667l0 0q0 42.666667-42.666667 42.666667l-128 0q-42.666667 0-42.666667-42.666667l0 0q0-42.666667 42.666667-42.666667l128 0q42.666667 0 42.666667 42.666667Z" fill="#2c2c2c" opacity=".6" p-id="9239"></path><path d="M783.530667 180.138667m30.169889 30.169889l0 0q30.169889 30.169889 0 60.339779l-90.509668 90.509668q-30.169889 30.169889-60.339779 0l0 0q-30.169889-30.169889 0-60.339779l90.509668-90.509668q30.169889-30.169889 60.339779 0Z" fill="#2c2c2c" opacity=".1" p-id="9240"></path><path d="M330.965333 632.661333m30.16989 30.16989l0 0q30.169889 30.169889 0 60.339778l-90.509668 90.509668q-30.169889 30.169889-60.339779 0l0 0q-30.169889-30.169889 0-60.339778l90.509668-90.509668q30.169889-30.169889 60.339779 0Z" fill="#2c2c2c" opacity=".5" p-id="9241"></path><path d="M843.861333 783.530667m-30.169889 30.169889l0 0q-30.169889 30.169889-60.339779 0l-90.509668-90.509668q-30.169889-30.169889 0-60.339779l0 0q30.169889-30.169889 60.339779 0l90.509668 90.509668q30.169889 30.169889 0 60.339779Z" fill="#2c2c2c" opacity=".3" p-id="9242"></path><path d="M391.338667 330.965333m-30.16989 30.16989l0 0q-30.169889 30.169889-60.339778 0l-90.509668-90.509668q-30.169889-30.169889 0-60.339779l0 0q30.169889-30.169889 60.339778 0l90.509668 90.509668q30.169889 30.169889 0 60.339779Z" fill="#2c2c2c" opacity=".7" p-id="9243"></path></svg>',nl='<svg t="1747118667412" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4123" width="256" height="256"><path d="M804 832.2H220c-65.1 0-118.1-53-118.1-118.1V309.8c0-31.6 12.3-61.2 34.6-83.5 22-22 52.4-34.6 83.5-34.6h584c31.5 0 61.2 12.3 83.5 34.6l5.5 6.5c18.8 21.6 29.1 49 29.1 77v404.3c0 28-10.3 55.3-29.1 77-22.6 26.2-55.1 41.1-89 41.1zM220 248.3c-16.3 0-32.1 6.6-43.6 18-11.6 11.6-18 27.1-18 43.6v404.3c0 34 27.6 61.6 61.6 61.6h584c17.8 0 34.3-7.6 46.3-21.5 7-8.1 15.3-21.6 15.3-40.1V309.8c0-18.5-8.3-32-15.3-40l-4.5-5.5c-9.9-9.7-25.3-16.1-41.8-16.1H220z" p-id="4124"></path><path d="M405.1 503.2H279.9c-27.7 0-50.4-22.6-50.4-50.4v-68.7c0-27.8 22.6-50.4 50.4-50.4h125.2c27.7 0 50.4 22.6 50.4 50.4v68.7c0 27.8-22.6 50.4-50.4 50.4z m-119-56.5h113v-56.5h-113v56.5z m119-56.5h0.6-0.6zM713.6 483.7H551.3c-15.6 0-28.2-12.6-28.2-28.2s12.6-28.2 28.2-28.2h162.3c15.6 0 28.2 12.6 28.2 28.2s-12.6 28.2-28.2 28.2zM750.6 649.2H273.4c-15.6 0-28.2-12.6-28.2-28.2s12.6-28.2 28.2-28.2h477.2c15.6 0 28.2 12.6 28.2 28.2s-12.6 28.2-28.2 28.2z" p-id="4125"></path></svg>',il='<svg t="1747118726217" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4285" width="256" height="256"><path d="M653.897143 618.0864l0.146286 3.335314v62.756572a93.447314 93.447314 0 0 1-0.585143 173.494857l0.468114 3.159771 0.117029 3.393829v66.911086a35.079314 35.079314 0 0 1-69.895315 3.364571l-0.175543-3.364571v-66.911086a35.108571 35.108571 0 0 1 0.643658-6.612114 93.418057 93.418057 0 0 1-0.585143-173.436343V621.421714c0-19.309714 15.652571-35.0208 34.991543-35.050057 18.0224 0 33.119086 13.7216 34.845257 31.685486z m268.756114 83.3536a93.447314 93.447314 0 0 1-59.684571 86.454857c0.555886 1.989486 0.906971 4.008229 1.111771 6.056229l0.146286 3.335314v133.851429a35.079314 35.079314 0 0 1-69.866057 3.364571l-0.175543-3.364571V797.257143c0-3.247543 0.468114-6.436571 1.2288-9.391543a93.418057 93.418057 0 0 1-1.2288-173.787429v-59.567542a35.079314 35.079314 0 0 1 69.895314-3.423086l0.146286 3.423086v59.567542a93.447314 93.447314 0 0 1 58.426514 87.332572zM887.456914 181.774629l0.146286 5.178514v283.560228h-83.968V194.442971c0-30.72-23.873829-56.232229-54.564571-58.250971l-3.832686-0.117029H214.103771c-30.72 0-56.232229 23.844571-58.250971 54.535315l-0.117029 3.832685v611.210972c0 30.72 23.844571 56.232229 54.535315 58.250971l3.803428 0.117029h271.301486v81.92h-286.72a128.438857 128.438857 0 0 1-128.321829-123.260343l-0.117028-5.178514V186.953143a128.438857 128.438857 0 0 1 123.260343-128.321829L198.656 58.514286h560.566857a128.438857 128.438857 0 0 1 128.234057 123.260343zM617.618286 724.114286a46.6944 46.6944 0 1 0 1.404343 0l1.4336 0.087771h-1.462858l-1.375085-0.087771z m211.587657-70.100115a46.723657 46.723657 0 1 0 0 93.447315 46.723657 46.723657 0 0 0 0-93.447315z m-274.753829-175.133257a35.079314 35.079314 0 0 1 3.306057 69.895315l-3.306057 0.146285H221.944686a35.079314 35.079314 0 0 1-3.335315-69.866057l3.335315-0.175543h332.507428z m168.901486-165.098057c0.877714 18.402743-12.639086 34.347886-30.954057 36.483657l-3.335314 0.175543H222.0032a35.079314 35.079314 0 0 1-3.335314-69.895314l3.335314-0.146286h467.090286c18.402743 0.380343 33.353143 14.979657 34.230857 33.353143z" p-id="4286"></path></svg>',ol='<svg t="1747118758801" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4442" width="256" height="256"><path d="M615.04 64a444.992 444.992 0 0 1 223.04 132.416 134.464 134.464 0 0 0 6.464 118.336c21.12 37.632 57.6 60.416 96.64 64.96C953.408 421.632 960 465.92 960 512c0 46.016-6.592 90.368-18.816 132.288-39.04 4.48-75.52 27.328-96.64 64.96a134.464 134.464 0 0 0-6.4 118.4A444.992 444.992 0 0 1 615.04 960 126.72 126.72 0 0 0 512 906.496 126.72 126.72 0 0 0 408.96 960a444.992 444.992 0 0 1-223.04-132.416 134.464 134.464 0 0 0-6.464-118.336c-21.12-37.632-57.6-60.416-96.64-64.96A471.936 471.936 0 0 1 64 512c0-46.016 6.592-90.368 18.816-132.288 39.04-4.48 75.52-27.328 96.64-64.96 21.12-37.568 22.144-81.408 6.4-118.4A444.992 444.992 0 0 1 408.96 64c23.296 32.448 60.8 53.504 103.04 53.504A126.72 126.72 0 0 0 615.04 64z m19.648 72.384a189.44 189.44 0 0 1-245.376 0 380.928 380.928 0 0 0-131.584 78.72c7.68 44.224 0.256 90.56-22.464 131.008-22.72 40.32-58.112 70.4-99.456 86.016a410.56 410.56 0 0 0 0 159.744c41.344 15.68 76.8 45.632 99.456 86.016 22.72 40.448 30.08 86.784 22.4 131.008 38.4 35.008 83.072 61.824 131.648 78.72a189.44 189.44 0 0 1 245.376 0 380.928 380.928 0 0 0 131.584-78.72 198.144 198.144 0 0 1 22.464-131.008c22.72-40.32 58.112-70.4 99.456-86.016a410.56 410.56 0 0 0 0-159.744 192.576 192.576 0 0 1-99.456-86.016 198.144 198.144 0 0 1-22.4-131.008 380.928 380.928 0 0 0-131.648-78.72zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384z m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256z" p-id="4443"></path></svg>',rl='<svg t="1747118776141" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4603" width="256" height="256"><path d="M605.440831 444.871267a32.779988 32.779988 0 0 1-12.784195-2.762885L191.757381 249.783509a30.157589 30.157589 0 0 1 0-54.508437L528.033231 2.90337a30.719532 30.719532 0 0 1 26.130333 0l393.219372 192.371702a29.548818 29.548818 0 0 1 16.670965 27.254219 30.532217 30.532217 0 0 1-16.670965 27.254218l-328.595967 191.997074a29.595646 29.595646 0 0 1-13.346138 3.324827zM274.597094 222.529291l330.796909 158.467828L865.198823 222.529291l-324.240911-158.467829z" p-id="4604"></path><path d="M605.440831 843.56958a32.779988 32.779988 0 0 1-12.784195-2.762885l-400.852426-192.371702a30.157589 30.157589 0 0 1 0-54.508437L528.033231 401.554854a30.719532 30.719532 0 0 1 26.130333 0l393.078886 192.371702a29.548818 29.548818 0 0 1 16.670965 27.254219 30.532217 30.532217 0 0 1-16.670965 27.254218l-328.595966 191.997074c-4.448713 2.200942-73.380345 3.324827-77.829058 3.324827z m-328.595966-222.388805l328.595966 158.467828L865.198823 621.180775l-324.240911-158.467829z" p-id="4605"></path><path d="M605.440831 845.81735a38.2121 38.2121 0 0 1-13.346138-2.762884l-395.326656-192.418531A30.344903 30.344903 0 1 1 223.647627 596.174327L605.440831 782.036859l315.249829-185.722047a30.344903 30.344903 0 0 1 26.692276 54.508438L618.786969 842.91398a28.84639 28.84639 0 0 1-13.346138 2.762885z" p-id="4606"></path><path d="M934.036798 645.110166a29.876618 29.876618 0 0 1-30.017104-30.017103V227.539946a30.017103 30.017103 0 0 1 60.034207 0v386.991174a30.017103 30.017103 0 0 1-30.017103 30.579046z m-732.820049 3.324827a29.876618 29.876618 0 0 1-30.017103-30.017103V227.539946a30.017103 30.017103 0 0 1 60.034207 0v390.877944a29.876618 29.876618 0 0 1-30.017104 30.017103zM90.045761 713.479855a29.876618 29.876618 0 0 1-30.017103-30.017103V292.584808a30.017103 30.017103 0 1 1 60.034206 0v390.877944a29.876618 29.876618 0 0 1-30.017103 30.017103z" p-id="4607"></path><path d="M90.045761 469.971372a29.876618 29.876618 0 0 1-30.063932-30.017103V49.076325a30.017103 30.017103 0 1 1 60.034207 0v390.877944a30.251246 30.251246 0 0 1-30.017104 30.017103zM62.791542 674.331184a30.43856 30.43856 0 0 1 40.600357-14.048566l350.83953 171.813966a30.344903 30.344903 0 1 1-26.692276 54.508437L76.699623 715.165683a30.43856 30.43856 0 0 1-14.048566-40.600356z" p-id="4608"></path><path d="M337.441014 808.541821a30.43856 30.43856 0 0 1 40.600357-14.048566l350.83953 171.813966a30.344903 30.344903 0 0 1-26.692276 54.508437l-350.83953-171.67348a30.43856 30.43856 0 0 1-14.048567-40.600357zM62.791542 29.033704a30.43856 30.43856 0 0 1 40.600357-14.048567l350.792701 171.954452a30.344903 30.344903 0 1 1-26.692276 54.508438L76.699623 69.63406A30.625875 30.625875 0 0 1 62.791542 29.033704z" p-id="4609"></path><path d="M337.441014 163.057027a30.43856 30.43856 0 0 1 40.600357-14.048567l350.83953 171.813966a30.344903 30.344903 0 0 1-26.692276 54.508438L351.349095 203.095441a29.829789 29.829789 0 0 1-14.048567-40.038414z m378.093749 856.962546a29.876618 29.876618 0 0 1-30.017104-30.017104V598.937211a30.017103 30.017103 0 1 1 60.034207 0v390.877944a29.876618 29.876618 0 0 1-30.204418 30.017104z" p-id="4610"></path><path d="M715.347448 791.870856a29.876618 29.876618 0 0 1-30.017103-30.017104V370.975808a30.017103 30.017103 0 1 1 60.034207 0v390.877944a30.251246 30.251246 0 0 1-30.017104 30.017104z m-84.291398-374.628436l4.448713 390.877944-60.596149 0.561943L570.17893 417.710706z" p-id="4611"></path><path d="M566.526302 26.832762l4.448713 390.877944-60.596149 0.561942-4.448713-390.877944z" p-id="4612"></path></svg>',al='<svg t="1747118806738" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4772" width="256" height="256"><path d="M534.598127 955.955046l429.178794-229.368665 0.464027-193.963386-426.441033 215.169431-3.248191 208.16262z m-48.212431-1.206471l3.248191-205.332054-1.392082-0.696041-428.111531-219.948911L59.573441 726.679186l426.765853 228.069389z m-396.140054-469.13154l421.800761 216.700721 425.837798-214.844612-425.559382-227.41975-422.079177 225.517239z m434.375899-278.18433l478.133668 255.539801c8.538101 4.547467 13.828012 13.410387 13.828012 23.062154l-0.649639 256.282244a26.078331 26.078331 0 0 1-13.781609 22.969349L523.9255 1020.872456a26.078331 26.078331 0 0 1-24.593444 0L21.151986 765.332655a26.124734 26.124734 0 0 1-13.781609-23.062153l0.649638-256.328648c0-9.605364 5.289911-18.421881 13.781609-22.969348L500.028097 207.432705a26.124734 26.124734 0 0 1 24.593444 0z" p-id="4773"></path><path d="M538.078331 954.052534l425.69859-227.466153 0.51043-400.409105-416.696462 210.250742c-3.108983 1.577693-6.264368 2.784163-9.512558 3.712218v413.912298z m-52.156662 0.464027v-425.559382L60.176677 310.214739 59.573441 726.679186l426.301825 227.837375zM992.964234 253.232194l2.088123-1.067263 1.484887 2.969774 6.217965 3.294594c8.538101 4.547467 13.828012 13.45679 13.828012 23.108556v13.271179l1.995317 3.944232-2.04172 1.02086-0.603236 442.496376a26.078331 26.078331 0 0 1-13.781609 22.969348L523.9255 1020.872456a26.078331 26.078331 0 0 1-24.593444 0L21.151986 765.332655a26.124734 26.124734 0 0 1-13.781609-23.062153l0.649638-460.77905c0-9.605364 5.289911-18.421881 13.781609-22.969348L500.028097 2.982303a26.124734 26.124734 0 0 1 24.593444 0l468.342693 250.296293z m-889.2154 20.649212l420.269472 215.911874 411.963383-207.8378-423.65687-226.445293-408.575985 218.371219z" p-id="4774"></path></svg>',ll='<svg t="1747118819652" class="icon" viewBox="0 0 2353 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4930" width="256" height="256"><path d="M41.840281 1011.047298S-65.841404-121.173333 2346.576842 122.107509C1843.146105-4.706807-266.796912-278.707649 41.840281 1011.029333z" p-id="4931"></path><path d="M1726.805333 365.442246L1445.205333 769.598877V1012.143158H1256.861193V769.598877L975.961825 365.442246h238.753684l138.293895 226.663298 146.575719-226.663298H1726.787368zM998.310175 541.462456L567.26007 850.189474h413.049263v161.953684h-713.386666v-161.953684l450.506105-322.811509h-386.065965c55.475649-56.212211 124.96393-111.292632 212.129684-161.953684h332.027509l122.790175 176.002245zM2318.156351 527.018667h-469.962105v97.262035h375.969684v129.041965h-375.969684V1012.143158H1659.850105V603.189895l166.03172-237.747649h492.274526v161.576421z" p-id="4932"></path></svg>',cl='<svg t="1747118858016" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5249" width="256" height="256"><path d="M925.753792 109.082187v-1.083598-1.083598c0-0.722399 0-1.083598-0.361199-1.805996v-1.083598-0.722399c0-0.722399-0.361199-1.083598-0.3612-1.444797 0-0.361199-0.361199-1.083598-0.361199-1.444797 0-0.361199-0.361199-0.722399-0.361199-0.722399 0-0.361199-0.361199-0.722399-0.722399-1.083598-0.361199-0.361199-0.722399-1.083598-0.722398-1.444797 0-0.361199-0.361199-0.722399-0.3612-0.722398s0-0.361199-0.361199-0.3612l-0.361199-0.361199c-0.361199-0.722399-1.083598-1.083598-1.444798-1.805996l-0.361199-0.3612-0.361199-0.361199c-0.722399-0.361199-1.083598-1.083598-1.805997-1.444797-0.361199-0.361199-0.722399-0.722399-1.083597-0.722399h-0.3612c-0.722399-0.361199-1.083598-0.722399-1.805996-1.083598-0.361199-0.361199-0.722399-0.361199-1.444797-0.722398h-0.3612-0.361199c-0.361199 0-0.722399-0.361199-1.083598-0.3612h-0.361199c-0.361199 0-0.722399-0.361199-1.444797-0.361199h-0.722399c-0.361199 0-0.722399 0-1.444797-0.361199H902.275838c-0.361199 0-0.722399 0-1.083598 0.361199-0.361199 0-0.722399 0-1.444797 0.361199-0.361199 0-0.722399 0-0.722399 0.3612-0.361199 0-0.722399 0.361199-1.083598 0.361199-0.361199 0-0.361199 0-0.722398 0.361199-0.361199 0-0.722399 0.361199-1.083598 0.3612-0.361199 0-0.361199 0.361199-0.722399 0.361199h-0.361199L57.069489 494.843034c-7.585185 3.611993-12.280776 11.197178-12.280776 19.504761 0 8.307584 4.695591 15.892769 11.919576 19.504762L340.972134 675.442681l64.654674 248.143915c2.167196 8.307584 9.391182 14.809171 18.059964 15.892769 1.083598 0 2.167196 0.361199 2.889595 0.361199 7.585185 0 14.809171-3.973192 18.782363-10.835978l89.938624-152.426103c0.361199-0.722399 1.083598-1.805996 1.444798-2.528395l244.170723 156.038095c3.611993 2.167196 7.585185 3.250794 11.558377 3.250794 3.250794 0 6.140388-0.722399 9.029983-2.167196 6.862787-3.250794 11.197178-9.391182 12.280776-16.615167l111.971781-804.02963v-0.722398-0.722399z m-125.336155 73.684656l-445.35873 451.499118L115.583774 514.708995l684.833863-331.942152zM497.732628 754.906526l-63.571076 107.637389-50.929101-195.408818 265.481482-268.732275 69.711464-70.795062-265.120282 365.533686c-3.611993 4.695591-5.417989 10.835979-4.334392 16.976367 1.083598 6.140388 4.695591 11.197178 9.752381 14.447972l41.899118 26.728748c-1.083598 1.083598-2.167196 2.167196-2.889594 3.611993z m277.762257 121.001763L502.067019 700.726631 871.573898 185.295238l-96.079013 690.613051z" p-id="5250"></path></svg>',hl='<svg t="1747118871130" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5410" width="256" height="256"><path d="M368.896 192H224a32 32 0 0 0-32 32v137.888a32 32 0 0 0 64 0V256h112.896a32 32 0 0 0 0-64zM784.864 192H640a32 32 0 1 0 0 64h112.864v105.888a32 32 0 1 0 64 0V224a32 32 0 0 0-32-32zM368.896 777.92H256V672a32 32 0 1 0-64 0v137.92a32 32 0 0 0 32 32h144.896a32 32 0 1 0 0-64zM784.864 640a32 32 0 0 0-32 32v105.92H640a32 32 0 1 0 0 64h144.864a32 32 0 0 0 32-32V672a32 32 0 0 0-32-32z" p-id="5411"></path><path d="M912 48h-800c-35.296 0-64 28.704-64 64v800c0 35.296 28.704 64 64 64h800c35.296 0 64-28.704 64-64v-800c0-35.296-28.704-64-64-64z m-800 864v-800h800l0.064 800H112z" p-id="5412"></path></svg>',ul='<svg t="1747118881671" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5572" width="256" height="256"><path d="M512 1023.99986A511.99993 511.99993 0 1 0 512 0a511.99993 511.99993 0 0 0 0 1023.99986z m6.582856-731.428471c20.04114 0 46.591994 5.851428 66.559991 11.702855s39.862852 17.554283 53.17485 40.959995c13.311998 17.554283 19.967997 40.959994 19.967997 64.365705v17.554284c0 5.851428-6.582856 11.702856-6.582856 17.554283q-6.729142 5.851428-6.729142 11.702855c0 5.851428 0 11.702856-6.582856 17.554284l-6.729142 5.851427-13.238855 11.702856c-6.655999 5.851428-6.655999 11.702856-13.311999 11.702856l-13.311998 11.702855c-19.967997 11.702856-33.279995 23.405711-46.518851 29.257139-6.655999 5.851428-6.655999 17.554283-6.655999 29.257139v29.257139q0 5.851428-6.655999 5.851428h-59.830849q-6.655999 0-6.655999-5.851428v-35.108567c0-23.405711 6.582856-40.959994 19.894855-58.514278l46.591993-40.959994c19.894854-11.702856 33.206853-23.405711 39.862852-35.108567 6.655999-5.851428 6.655999-17.554283 6.655999-29.257139 0-17.554283-6.582856-29.257139-19.967997-35.108566-6.582856-5.851428-26.550854-11.702856-46.518851-11.702856-26.623996 0-39.862852 5.851428-53.17485 17.554284A62.17142 62.17142 0 0 0 438.857153 421.3028v5.851428q0 5.851428-6.582856 5.851427h-59.977135Q365.714306 433.005655 365.714306 427.154228v-5.851428c0-23.405711 0-46.811422 13.311998-64.365706 6.582856-11.702856 19.967997-29.257139 33.206852-35.108566 19.967997-11.702856 33.279995-17.554283 53.247993-23.405712C485.376004 292.571389 498.688002 292.571389 518.582856 292.571389z m-46.445708 368.639949c6.582856-5.851428 19.894854-11.702856 33.206853-11.702855s26.623996 5.851428 33.279995 5.851428c6.582856 11.702856 13.238855 23.405711 13.238856 35.108566 0 11.702856-6.582856 23.405711-13.238856 29.257139a54.637707 54.637707 0 0 1-33.279995 11.702856 54.637707 54.637707 0 0 1-33.206853-11.702856 42.057137 42.057137 0 0 1-13.311998-29.257139c0-11.702856 6.582856-17.554283 13.311998-29.257139z" p-id="5573"></path></svg>',pl='<svg t="1747118889578" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5733" width="256" height="256"><path d="M0 1024h1024V0L0 1024z" p-id="5734"></path></svg>',dl='<svg t="1747118897788" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5890" width="256" height="256"><path d="M606.171429 921.6c26.697143-96.182857 20.48-174.08-20.48-235.52s-112.64-94.171429-165.12-108.617143L763.977143 57.417143 677.851429 0 0 1024h1024v-102.4z m-53.211429 2.011429H190.537143L389.12 621.714286c47.177143 10.24 116.662857 32.731429 153.6 91.428571 32.731429 52.845714 36.937143 122.514286 10.24 210.468572z" p-id="5891"></path></svg>',fl='<svg t="1747118919514" class="icon" viewBox="0 0 1187 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6047" width="256" height="256"><path d="M557.769568 0v1009.233236H0V700.828379h309.834603v-84.102769H0V476.610396h247.850862v-84.10277H0V252.308309h309.834603V168.205539H0V0h557.769568z m612.856883 802.340422q14.297471-57.105781-1.429747-94.279204l-54.498595-2.691289a198.398434 198.398434 0 0 0-20.689281-48.190887l36.837013-41.799077q-30.276997-50.461662-67.70273-65.60016l-40.537535 36.668808a198.482536 198.482536 0 0 0-48.695504-20.184665l-3.36411-54.835006q-57.105781-14.297471-94.279205 1.429747l-2.607186 52.732437c-17.072862 4.205138-33.220594 10.596949-48.190887 18.923123l-38.350863-34.734444q-37.425732 15.138499-67.618627 65.60016c9.587716 10.93336 28.510839 23.464673 29.604175 39.528302 0.336411 3.868727-18.166198 50.629867-19.007226 50.71397l-49.031914 2.438981q-15.727218 37.173424-1.429748 94.195102l48.611401 3.111802c4.625652 19.343637 11.942593 37.509835 21.698515 54.246287l-31.959053 35.323163q15.138499 37.425732 65.600161 67.618627l36.500602-32.127258c16.568246 9.924127 34.566238 17.493376 53.825772 22.287234l2.354878 48.274989q37.173424 15.727218 94.195102 1.429747l3.195905-50.461661c19.42774-5.046166 37.678041-13.035929 54.330389-23.464673l38.687274 34.061622q50.461662-30.276997 65.600161-67.618627l-35.239061-38.85548c8.746688-15.643115 15.222601-32.547772 19.511843-50.461662l54.078081-3.36411zM925.130466 873.995982a117.155158 117.155158 0 1 1 0-234.310316 117.155158 117.155158 0 0 1 0 234.310316z" p-id="6048"></path></svg>',ml='<svg t="1747118950929" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6222" width="256" height="256"><path d="M979.30091 188.371816L835.506169 44.621874 828.158992 38.042695c-60.396607-53.158231-151.711516-50.27824-208.639335 6.579179L44.41109 619.544841l-6.579179 7.532776c-52.972631 60.428607-49.971041 151.577117 6.867179 208.383336l143.794741 143.858741 7.347177 6.860779c60.447807 52.959831 151.621917 49.958241 208.447335-6.860779l575.012567-575.217366 6.867179-7.340777c52.972631-60.422207 49.971041-151.577117-6.867179-208.383335z m-53.875028 162.060283l-575.486165 574.929367c-29.791905 29.759905-78.060551 29.759905-107.852457 0l-143.897141-143.756341c-29.759905-29.779105-29.759905-78.041351 0-107.814057l45.011057-44.710257 53.875028 53.862228a38.150278 38.150278 0 0 0 53.926228-1.337596 38.124678 38.124678 0 0 0 0.0512-52.524632l-53.977428-54.246227 89.926113-89.791714 90.015713 89.702114 1.907194 1.900794a38.150278 38.150278 0 0 0 53.945428-0.064 38.124678 38.124678 0 0 0-1.971193-55.699022l-89.919714-89.894114 89.919714-89.894113 53.971027 53.951828 1.907194 1.811194a38.150278 38.150278 0 0 0 53.945428-0.064 38.124678 38.124678 0 0 0-1.977593-55.699022l-53.875029-53.862229 89.830114-89.894113 90.015713 89.894113 1.907194 1.907194a38.150278 38.150278 0 0 0 53.811029-3.750388 38.124678 38.124678 0 0 0-1.843195-52.019034L629.055627 143.475959l45.004656-44.991857c29.791905-29.759905 78.060551-29.759905 107.852457 0l143.513142 143.845942c29.766305 29.779105 29.766305 78.041351 0 107.820456v0.281599z" p-id="6223"></path></svg>',gl='<svg t="1747118975051" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6383" width="256" height="256"><path d="M938.666667 565.333333a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32H85.333333A32 32 0 0 1 53.333333 853.333333V597.333333A32 32 0 0 1 85.333333 565.333333z m-32 64h-789.333334v192h789.333334v-192z m32-448a32 32 0 0 1 3.072 63.850667L938.666667 245.333333H567.893333L342.613333 470.613333a32 32 0 0 1-45.226666 0l-234.666667-234.666666-0.512-0.512a32.213333 32.213333 0 0 1-0.917333-1.002667l1.408 1.536a34.176 34.176 0 0 1-2.645334-2.986667L59.733333 232.533333a31.274667 31.274667 0 0 1-5.205333-27.925333l0.085333-0.256 0.426667-1.365333 0.341333-0.938667 0.576-1.450667 0.533334-1.130666a31.381333 31.381333 0 0 1 25.557333-17.984h0.213333A31.36 31.36 0 0 1 85.333333 181.333333h853.333334z m-461.248 64H162.56L320 402.752l157.418667-157.418667z" p-id="6384"></path></svg>',yl='<svg t="1747118993460" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6544" width="256" height="256"><path d="M958.1 717.3L723.8 483l203-206c32.4-32.9 32.4-86.5 0-119.4l-59.1-60c-15.8-16-36.9-24.9-59.3-24.9s-43.4 8.8-59.2 24.9L545.3 304.5 305.1 64.3c-7.3-7.3-19.2-7.3-26.5 0L68.3 274.5c-7.3 7.3-7.3 19.2 0 26.5l213 213 29 29-104.1 105.7c-1.8 1.3-3.4 2.9-4.7 4.7l-11.3 11.5 5.1 5.2-55.1 172.5-36.7 37.2c-7.2 7.3-7.2 19 0 26.3l22.8 23.1c3.5 3.6 8.3 5.6 13.4 5.6s9.8-2 13.4-5.6l31.5-32 177.2-58.3 5.5 5.6 121.4-123.2 232.5 232.5c3.7 3.7 8.5 5.5 13.3 5.5s9.6-1.8 13.3-5.5L958 743.6c7.4-7.1 7.4-19 0.1-26.3zM775.9 124c8.7-8.8 20.2-13.7 32.5-13.7s23.8 4.9 32.5 13.7l59.1 60c18.1 18.4 18.1 48.3 0 66.7L697.3 456.5 571.9 331.1l204-207.1zM223.3 845.2c-0.8-3.1-2.3-6.1-4.7-8.6l-22.8-23.1c-1.6-1.6-3.5-2.9-5.6-3.8l34.9-109.3 107.3 108.9-109.1 35.9zM368 790.6L243.6 664.3l93.3-94.7 62.1 62.1 63.2 63.2-94.2 95.7z m366.6 123.7L674.3 854l48.4-48.4c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0l-48.4 48.4-91.2-91.2 76.4-76.4c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0L530 709.6l-28-28-63.1-63.1 48.4-48.4c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0L412.4 592l-62.3-62.3-28.9-28.9L392 430c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0l-70.8 70.8-91.3-91.3 48.4-48.4c7.3-7.3 7.3-19.2 0-26.5-7.3-7.3-19.2-7.3-26.5 0l-48.4 48.4-68.8-68.8L291.8 104l240.4 240.4 151.9 151.9 234.2 234.2-183.7 183.8z" p-id="6545"></path></svg>',vl='<svg t="1747119002108" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6711" width="256" height="256"><path d="M592.554667 51.2c68.36419 0 123.855238 50.176 123.855238 111.811048 0 55.344762-44.665905 101.424762-103.180191 110.250666 30.573714 16.091429 52.857905 41.252571 66.169905 74.898286 27.794286 69.632 90.940952 98.742857 139.068952 110.933333 16.237714 4.096 29.793524 11.751619 39.253334 22.186667 9.752381 10.678857 14.09219 23.161905 12.288 35.05981-2.584381 16.871619-18.578286 34.962286-55.686095 34.962285-5.558857 0-11.50781-0.390095-17.65181-1.219047a390.582857 390.582857 0 0 1-117.808762-36.181334c-19.748571-9.947429-42.76419-24.283429-58.12419-42.617904-9.752381 19.504762-20.772571 47.201524-20.772572 73.289142 0 30.866286 39.009524 67.584 73.386667 99.961905 15.311238 14.433524 29.744762 28.086857 41.593905 41.642667 38.960762 44.373333 36.815238 141.604571 35.742476 193.828571-0.146286 7.168-0.292571 13.360762-0.292572 18.285715 0 30.037333-24.527238 74.50819-58.368 74.50819-8.582095 0-21.065143-2.925714-31.890285-16.822857-7.41181-9.557333-13.06819-23.015619-17.359238-41.106286a1735.68 1735.68 0 0 1-9.801143-45.251047c-14.238476-68.266667-26.477714-127.21981-79.872-168.131048l-45.153524-34.523429c-3.023238 23.79581-8.825905 57.197714-19.212191 81.92-10.581333 24.917333-60.123429 79.530667-99.376761 118.784-20.918857 21.113905-42.812952 41.252571-65.633524 60.464762-31.158857 25.746286-43.739429 30.232381-51.931429 31.207619a60.562286 60.562286 0 0 1-7.119238 0.438857c-19.114667 0-43.25181-9.557333-54.223238-30.866285-9.654857-18.870857-11.702857-51.492571 33.499429-99.766857 17.554286-18.773333 33.255619-33.401905 47.055238-46.32381 40.17981-37.546667 62.366476-58.319238 69.729523-125.074286 10.922667-98.108952 28.867048-142.238476 47.932953-182.320762 10.727619-22.625524 12.53181-57.295238 12.336762-80.262095-28.769524 14.823619-75.971048 43.836952-88.746667 79.481905-4.681143 13.165714-8.533333 25.84381-12.190476 38.034286-5.948952 19.602286-11.02019 36.522667-18.041905 49.444571-9.752381 17.993143-23.405714 27.160381-40.472381 27.160381a50.224762 50.224762 0 0 1-10.727619-1.219048c-8.679619-1.80419-20.23619-8.143238-25.648762-27.599238-6.290286-22.479238-3.900952-60.952381 6.290286-102.985143 5.022476-20.772571 19.260952-71.094857 42.812952-89.916952a20.48 20.48 0 0 1 1.365334-0.975238c0.438857-0.24381 44.178286-28.525714 93.866666-56.417524 103.619048-58.172952 132.144762-58.172952 141.55581-58.172952h6.631619c-29.744762-20.382476-48.956952-52.662857-48.956953-88.941714 0-61.68381 55.588571-111.85981 123.855239-111.85981h-0.048762z" p-id="6712"></path></svg>',bl='<svg t="1747119024586" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6868" width="256" height="256"><path d="M204.8 204.8v3.84c2.304 4.693333 7.68 10.24 0-3.84zM512 742.4h230.4V512h-76.8v153.6H512z" p-id="6869"></path><path d="M834.944 128H189.056A61.098667 61.098667 0 0 0 128 189.141333v645.717334c0 33.749333 27.306667 61.098667 61.056 61.141333h645.888A61.098667 61.098667 0 0 0 896 834.858667V189.141333c0-33.749333-27.306667-61.098667-61.056-61.141333zM819.2 819.2H204.8V208.64c-1.152-2.005333-1.536-3.84 0-3.84h614.4v614.4z" p-id="6870"></path><path d="M358.4 358.4H512V281.6H281.6V512h76.8z" p-id="6871"></path></svg>',xl='<svg t="1747120237899" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13155" width="256" height="256"><path d="M466.72 861.44l-72.96 58.816a32.448 32.448 0 0 1-45.76-4.928 32.544 32.544 0 0 1 4.928-45.76l13.984-11.264c-62.848-11.744-119.552-31.104-164.16-56.416-32.32-18.304-57.856-39.36-75.872-62.496-20.48-26.304-30.88-54.56-30.88-84 0-61.568 45.504-117.504 128.224-157.76v15.424a68.48 68.48 0 0 0 19.36 47.68c-52.608 27.584-82.528 61.696-82.528 94.656 0 31.008 26.208 62.944 73.76 89.92 39.2 22.176 89.888 39.2 146.656 49.536l-15.264-24a32.544 32.544 0 0 1 54.912-34.912l52.64 82.72a32.544 32.544 0 0 1-7.04 42.784z" p-id="13156"></path><path d="M243.68 560.672l-0.096 0.064a68.48 68.48 0 0 1-19.36-47.68v-15.424l0.064-0.032v15.456c0 17.984 7.136 35.04 19.392 47.616z m483.2-356.576l-162.944-94.08a101.12 101.12 0 0 0-100.864 0L300.16 204.096a101.12 101.12 0 0 0-50.4 87.36v188.16a101.184 101.184 0 0 0 50.432 87.36l162.912 94.016c15.552 8.96 32.992 13.472 50.432 13.472 17.44 0 34.88-4.48 50.432-13.44l162.944-94.08a101.216 101.216 0 0 0 50.432-87.36v-188.16a101.12 101.12 0 0 0-50.432-87.328zM495.616 166.4a35.776 35.776 0 0 1 35.776 0l150.4 86.816-149.248 83.968a38.72 38.72 0 0 1-38.848-0.576L350.272 250.24 495.616 166.4z m-143.36 355.52l-19.584-11.296c-11.04-6.4-17.92-18.24-17.92-31.008v-174.72l145.408 87.456c6.048 3.648 12.384 6.624 18.88 8.896v193.888l-126.784-73.216z m360-42.304c0 12.736-6.88 24.64-17.92 31.008l-20.448 11.808-129.76 74.912V402.56c6.976-2.144 13.792-5.056 20.32-8.704l147.776-83.136v168.864zM928 655.392c0 58.24-41.408 112.192-116.576 151.872-67.648 35.712-159.04 58.08-257.376 63.04a32.544 32.544 0 0 1-3.264-64.96c89.056-4.48 170.848-24.256 230.272-55.616 27.072-14.272 48.768-30.848 62.816-47.872 12.64-15.392 19.072-31.04 19.072-46.464 0-32.544-29.152-66.208-80.544-93.632l-0.096-0.032c12.864-12.672 20.416-30.176 20.416-48.64v-14.016l0.064 0.032C883.616 539.232 928 594.592 928 655.392z" p-id="13157"></path><path d="M224.32 513.056v-15.456h-0.096v15.456a68.48 68.48 0 0 0 19.36 47.68l0.096-0.064a68.448 68.448 0 0 1-19.392-47.616z m578.4-13.984v13.984c0 18.496-7.552 36-20.416 48.64l0.096 0.064a68.416 68.416 0 0 0 20.384-48.704v-13.952l-0.064-0.032z" p-id="13158"></path></svg>',Cl='<svg t="1747119042485" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7190" width="256" height="256"><path d="M370.47 556.68c62.48 78.41 123.99 139.25 126.58 141.8 12.46 12.29 32.48 12.29 44.93 0 2.59-2.55 64.09-63.39 126.58-141.8 37.09-46.54 66.76-89.62 88.18-128.02 28.81-51.64 42.81-94.46 42.81-130.91 0-73.22-29.24-142.01-82.33-193.7-52.86-51.46-123.07-79.81-197.71-79.81-74.64 0-144.86 28.34-197.71 79.81-53.09 51.69-82.32 120.48-82.32 193.69 0 36.45 14 79.27 42.81 130.91 21.42 38.41 51.09 81.48 88.18 128.03zM519.52 88.24c119.12 0 216.04 93.98 216.04 209.5 0 46.45-41.43 124.08-116.66 218.57-37.84 47.53-76.08 89.11-99.37 113.54-23.29-24.44-61.53-66.01-99.37-113.54C344.93 421.82 303.5 344.2 303.5 297.74c-0.02-115.52 96.89-209.5 216.02-209.5z" p-id="7191"></path><path d="M519.52 438.03c66.75 0 121.06-54.33 121.06-121.12s-54.31-121.12-121.06-121.12-121.06 54.33-121.06 121.12 54.31 121.12 121.06 121.12z m0-170.24c27.05 0 49.06 22.04 49.06 49.12s-22.01 49.12-49.06 49.12-49.06-22.04-49.06-49.12 22.01-49.12 49.06-49.12zM847.65 724.52L731.86 650c-3.95-2.55-9.3-1.52-11.94 2.3l-33.45 48.37c-2.64 3.82-1.57 8.97 2.38 11.52l63.46 40.85L512 915.78 271.69 753.03l75.97-48.9c3.95-2.55 5.02-7.7 2.38-11.52l-33.46-48.37c-2.64-3.81-7.98-4.84-11.94-2.3l-128.3 82.57c-20.14 12.96-20.49 41.4-0.68 54.82L492.2 993.71c11.87 8.04 27.7 8.04 39.58 0l316.54-214.38c19.82-13.41 19.47-41.85-0.67-54.81z" p-id="7192"></path></svg>',wl='<svg t="1747119052739" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7348" width="256" height="256"><path d="M512 384c55.6 0 107.8 21.6 147.1 60.9S720 536.4 720 592s-21.6 107.8-60.9 147.1S567.6 800 512 800s-107.8-21.6-147.1-60.9S304 647.6 304 592s21.6-107.8 60.9-147.1S456.4 384 512 384z m0-64c-150.2 0-272 121.8-272 272s121.8 272 272 272 272-121.8 272-272-121.8-272-272-272z" p-id="7349"></path><path d="M650.9 128l4.4 23.6C666.7 212.1 719.6 256 781.1 256H896c35.3 0 64 28.7 64 64v512c0 35.3-28.7 64-64 64H128c-35.3 0-64-28.7-64-64V320c0-35.3 28.7-64 64-64h114.9c61.6 0 114.5-43.9 125.8-104.4l4.4-23.6h277.8z m39.8-64H333.3c-7.7 0-14.3 5.5-15.7 13.1l-11.8 62.7c-5.7 30.3-32.1 52.2-62.9 52.2H128C57.3 192 0 249.3 0 320v512c0 70.7 57.3 128 128 128h768c70.7 0 128-57.3 128-128V320c0-70.7-57.3-128-128-128H781.1c-30.8 0-57.2-21.9-62.9-52.2l-11.8-62.7c-1.4-7.6-8-13.1-15.7-13.1z" p-id="7350"></path><path d="M224 352h-64c-17.7 0-32-14.3-32-32s14.3-32 32-32h64c17.7 0 32 14.3 32 32s-14.3 32-32 32zM512 560c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32z m0-64c-53 0-96 43-96 96s43 96 96 96 96-43 96-96-43-96-96-96z" p-id="7351"></path></svg>',El='<svg t="1747119058409" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7511" width="256" height="256"><path d="M554.666667 682.666667h85.333333v128h-213.333333v-128h85.333333v-128H256v128h85.333333v128H128v-128h85.333333v-170.666667h298.666667V384h-85.333333V256h213.333333v128h-85.333333v128h298.666666v170.666667h85.333334v128h-213.333334v-128h85.333334v-128h-256v128z m42.666666-384h-128v42.666666h128V298.666667zM298.666667 725.333333H170.666667v42.666667h128v-42.666667z m597.333333 0h-128v42.666667h128v-42.666667z m-298.666667 0h-128v42.666667h128v-42.666667z" p-id="7512"></path></svg>',Sl='<svg t="1747119094287" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9625" width="256" height="256"><path d="M835.907368 902.036211H229.591579a60.631579 60.631579 0 0 1-60.577684-60.631579v-121.263158H229.591579v121.263158h606.315789v-121.263158h60.631579v121.263158a60.631579 60.631579 0 0 1-60.631579 60.631579z m-272.815157-151.552H502.460632v-520.623158L274.378105 458.105263l-42.846316-42.846316L511.461053 135.275789a30.288842 30.288842 0 0 1 42.846315 0l279.929264 279.983158-42.846316 42.846316-228.298105-228.24421v520.623158z" p-id="9626"></path></svg>',Ai=Object.freeze(Object.defineProperty({__proto__:null,baseInfo:nl,comInfo:il,config:ol,cuttingGlobal:rl,cuttingLocal:al,demo:ll,fly:cl,fullScreen:hl,instruction:ul,loading:sl,lowerRightTriangle:pl,measure:yl,measureAngle:dl,measureConfig:fl,measureDistance:ml,measureElevation:gl,person:vl,refresh:bl,review:xl,roam:Cl,screenshot:wl,tree:El,upload:Sl},Symbol.toStringTag,{value:"Module"})),Tl=g.defineComponent({__name:"index",props:{svgContent:{},name:{},toolTipContent:{default:""},cur:{default:""},size:{default:"16"},color:{default:""},iconStyle:{default:()=>({})},leftText:{default:""},rightText:{default:""},textColor:{default:""},titleStyle:{default:null},centered:{type:Boolean,default:!1},useParentTrigger:{type:Boolean}},setup(o){const e=o,i=g.ref(!1),r=g.ref(null),a=l=>{e.toolTipContent&&(i.value=l)};return g.onMounted(()=>{r.value&&(e.useParentTrigger&&r.value.parentElement?(r.value.parentElement.onmouseenter=()=>a(!0),r.value.parentElement.onmouseleave=()=>a(!1)):(r.value.onmouseenter=()=>a(!0),r.value.onmouseleave=()=>a(!1)))}),g.onUnmounted(()=>{r.value&&(e.useParentTrigger&&r.value.parentElement?(r.value.parentElement.onmouseenter=null,r.value.parentElement.onmouseleave=null):(r.value.onmouseenter=null,r.value.onmouseleave=null))}),(l,c)=>typeof l.name=="string"&&Ai[l.name]||typeof l.svgContent=="string"&&l.svgContent.startsWith("<svg ")?(g.openBlock(),g.createBlock(g.unref(Se.ElTooltip),{key:0,class:"tooltip-box",effect:"light",content:l.toolTipContent,placement:"top","hide-after":100,visible:g.unref(i)},{default:g.withCtx(()=>[g.createElementVNode("div",{ref_key:"svgIconBoxRef",ref:r,class:"svg-icon-box",onMouseenter:c[0]||(c[0]=h=>a(!0)),onMouseleave:c[1]||(c[1]=h=>a(!1)),style:g.normalizeStyle({cursor:l.cur})},[l.leftText?(g.openBlock(),g.createElementBlock("div",{key:0,class:"left-text text",style:g.normalizeStyle({color:l.textColor||l.color,...l.titleStyle})},[g.createVNode(vt,{text:l.leftText},null,8,["text"])],4)):g.createCommentVNode("",!0),g.createVNode(tl,{class:"icon","icon-style":{width:l.size,height:l.size,color:l.color,...l.iconStyle},"svg-content":Ai[l.name]||l.svgContent},null,8,["icon-style","svg-content"]),l.rightText?(g.openBlock(),g.createElementBlock("div",{key:1,class:"right-text text",style:g.normalizeStyle({color:l.textColor||l.color,...l.titleStyle})},[g.createVNode(vt,{text:l.rightText},null,8,["text"])],4)):g.createCommentVNode("",!0)],36)]),_:1},8,["content","visible"])):g.createCommentVNode("",!0)}});const ht=Ue(Tl,[["__scopeId","data-v-621d0d75"]]),Ll={key:2,class:"base-panel__header-title"},kl={class:"base-panel__body"},Ml={class:"base-panel__footer"},Il=g.defineComponent({__name:"index",props:{title:{},render:{},z:{default:10},size:{default:()=>({width:"280px",height:"auto"})},position:{default:()=>({left:"20px",top:"20px"})},resize:{type:Boolean,default:!0},resizeCallback:{},drag:{type:Boolean,default:!0},dragCallback:{},close:{type:Boolean,default:!0},closeCallback:{}},setup(o,{expose:e}){const i=o,r=!!g.useSlots().header,a=g.ref(),l=v=>{if(!i.drag)return;const y=a.value;if(!y)return;y.style.top||(y.style.top=`${y.offsetTop}px`),y.style.left||(y.style.left=`${y.offsetLeft}px`);const x=p(y);if(!x)return;const b=v.clientX-parseInt(y.style.left,10),C=v.clientY-parseInt(y.style.top,10);y.classList.add("dragging");const T=O=>{O.preventDefault();let P=O.clientX-b,V=O.clientY-C;const B=x.offsetWidth,I=x.offsetHeight,G=y.offsetWidth,W=y.offsetHeight;P=Math.min(Math.max(P,0),B-G),V=Math.min(Math.max(V,0),I-W),y.style.left=`${P}px`,y.style.top=`${V}px`},A=()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",A),y.classList.remove("dragging")};document.addEventListener("mousemove",T),document.addEventListener("mouseup",A),i!=null&&i.dragCallback&&i.dragCallback(d())},c=v=>{if(!a.value)return;const y=d(),x=y.width,b=y.height,C=v.clientX,T=v.clientY;a.value.classList.add("unselectable"),document.onpointermove=function(A){const O=A.clientX-C,P=A.clientY-T,V=Math.max(x+O,50),B=Math.max(b+P,50);a.value.style.width=`${V}px`,a.value.style.height=`${B}px`},document.onpointerup=function(){a.value.classList.remove("unselectable"),document.onpointermove=null,document.onpointerup=null,i!=null&&i.resizeCallback&&i.resizeCallback(d())}},h=()=>{a.value&&(a.value.classList.remove("unselectable"),document.onpointermove=null,i!=null&&i.resizeCallback&&i.resizeCallback(d()))};function p(v){let y=v.parentElement;for(;y;){if(getComputedStyle(y).position!=="static")return y;y=y.parentElement}return document.body}const u=()=>{i!=null&&i.closeCallback&&i.closeCallback(d())};function d(){var v;return(v=a.value)==null?void 0:v.getBoundingClientRect()}function m(){if(!a.value)return;const y=p(a.value).getBoundingClientRect(),x=a.value.offsetWidth,b=a.value.offsetHeight;let C={...i.position,zIndex:i.z};if(C.left!==void 0&&(C.left=C.left.includes("%")?`${parseFloat(C.left)/100*y.width}px`:C.left),C.top!==void 0&&(C.top=C.top.includes("%")?`${parseFloat(C.top)/100*y.height}px`:C.top),C.right!==void 0){const T=C.right.includes("%")?parseFloat(C.right)/100*y.width:parseFloat(C.right);C.left=`${y.width-T-x}px`,delete C.right}if(C.bottom!==void 0){const T=C.bottom.includes("%")?parseFloat(C.bottom)/100*y.height:parseFloat(C.bottom);C.top=`${y.height-T-b}px`,delete C.bottom}Object.entries(C).forEach(([T,A])=>{a.value.style[T]=A})}return g.onMounted(()=>{var v;if(a.value){const x=p(a.value).getBoundingClientRect();if(i.size){let b=typeof i.size.width&&((v=i.size.width)!=null&&v.includes("%"))?parseFloat(i.size.width)/100*x.width:parseFloat(i.size.width);a.value.style.width=b+"px";let C=i.size.height&&i.size.height.includes("%")?parseFloat(i.size.height)/100*x.height:parseFloat(i.size.height);a.value.style.height=C+"px"}}m(),window.addEventListener("resize",m)}),g.onUnmounted(()=>{window.removeEventListener("resize",m)}),e({getBoundingClientRect:d}),(v,y)=>(g.openBlock(),g.createElementBlock("div",{class:"base-panel",ref_key:"basePanel",ref:a},[r||v.title||v.render?(g.openBlock(),g.createElementBlock("div",{key:0,class:"base-panel__header",style:g.normalizeStyle({cursor:v.drag?"move":"auto"}),onMousedown:l},[r?g.renderSlot(v.$slots,"header",{key:0},void 0,!0):v.render?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(v.render),{key:1})):(g.openBlock(),g.createElementBlock("span",Ll,g.toDisplayString(v.title),1))],36)):g.createCommentVNode("",!0),v.close?(g.openBlock(),g.createElementBlock("span",{key:1,class:"close-btn",onClick:u},[g.createVNode(g.unref(Vo.Close),{style:{width:"1em",height:"1em"}})])):g.createCommentVNode("",!0),g.createElementVNode("div",kl,[g.renderSlot(v.$slots,"default",{},void 0,!0)]),g.createElementVNode("div",Ml,[r?g.renderSlot(v.$slots,"footer",{key:0},void 0,!0):g.createCommentVNode("",!0)]),v.resize?(g.openBlock(),g.createElementBlock("div",{key:2,class:"base-panel__resize",onPointerdown:c,onPointerup:h},[g.createVNode(ht,{name:"lowerRightTriangle",size:"15px"})],32)):g.createCommentVNode("",!0)],512))}});const zt=Ue(Il,[["__scopeId","data-v-a0e4f5c1"]]);function Al(o,e,i=[],r=!1){return fetch(o).then(a=>a.json()).then(a=>{var y,x;const l=[],c={};if(!(a!=null&&a.length))return;a[0].name=e,a[0].visible=!i.includes((y=a[0])==null?void 0:y.guid),v(a[0]);const h={},p=[],u=function(b,C){C&&C.length>0&&C.forEach(T=>{if(!h[T.id]){const A=Object.assign({},T);A.children=[],h[A.id]=A,h[A.parent_id]&&(h[A.parent_id].children.push(A),A.parent=h[A.parent_id],A.category=="Revit Category"?(A.parent=null,p.push(A)):!T.children&&A.parent.category=="Revit Level"&&["Revit FamilyInstance","Revit Duct","Revit Element","Revit Pipe"].includes(T.category)&&(h.other||(h.other={guid:"",id:"",name:"其它",parent:null,parent_id:0,revit_level:0,children:[]},p.push(h.other)),A.parent=h.other,h.other.children.push(A)))}T.parent=b,T.children&&T.children.length>0&&u(T,T.children)})};u(a[0],(x=a[0])==null?void 0:x.children);const d=Object.assign({},a[0]);d.children=[],p.forEach(b=>{b.parent=d,d.children.push(b)});const m=Object.assign({},a[0]);m.children=[];function v(b){var C;b.secondId=Xa(),b.visible=!0,i.includes(b.guid)&&(c[b.guid]=b.secondId,r&&(b.visible=!1)),l.push(b.secondId),b.children&&((C=b.children)!=null&&C.length)&&b.children.forEach(T=>{v(T)})}return{category:d,floor:a[0],model:m,secondUuids:l,hiddenSecondIds:c}})}const _l={class:"tree-box"},Bl=["onPointerover","onPointerout","onClick","onContextmenu"],Rl=g.defineComponent({__name:"index",props:{viewer:{},config:{},cardConfig:{}},setup(o,{expose:e}){const i=o,{config:r,viewer:a,cardConfig:l}=g.toRefs(i),{model:c}=g.toRefs(r.value),h=g.ref(!1);function p(Z){h.value=Z,Z||I(null,!1,!1)}const u=g.ref(""),d=g.computed(()=>{const Z={model:"模型",floor:"楼层",category:"构件"};return r.value.tabs.map(K=>({label:Z[K],name:K}))}),m=(Z,K)=>{var J;return K&&(j(P.value[0],!0),K==="model"&&(c.value.visible=!0,((J=a.value.highLightMeshManager.highLightMesh)==null?void 0:J.visible)===!1&&(a.value.highLightMeshManager.highLightMesh.visible=!0,a.value.highLightMeshManager.highLightMeshLine.visible=!0)),H()),!0},v=async(Z,K=!1)=>{var J;if(u.value=Z,P.value=O.value[u.value],x.value&&x.value.setData(P.value),(J=r.value)!=null&&J.changeTabSaveHiddenMesh||K){if(!$.value)return;let Y=setTimeout(()=>{Object.entries($.value).forEach(([ce,he])=>{try{x.value&&x.value.setChecked(he,!1)}catch(xe){console.log(xe)}}),!K&&a.value.hiddenObjectPartsByHiddenMeshGuids(),clearTimeout(Y),Y=null},1e3)}},y=g.ref(""),x=g.ref(),b=Z=>{x.value.filter(Z)},C=(Z,K)=>{var J,Y,ce;return K[((ce=(Y=(J=r.value)==null?void 0:J.treeConfig)==null?void 0:Y.props)==null?void 0:ce.label)||"name"].includes(Z)},T=g.ref(400);function A(){var Z,K;T.value=((K=(Z=x.value)==null?void 0:Z.$el)==null?void 0:K.clientHeight)||400}const O=g.ref({model:[],floor:[],category:[]}),P=g.ref([]);let V=[];const B=g.ref([]),I=(Z,K=!1,J=!0)=>{var Y,ce;if(a.value){if(V=[],B.value=[],console.log(Z),(Z==null?void 0:Z.parent)==null||!Z.visible)a.value.highLightMeshManager.clearHighLightMesh(J);else{const he=function(xe){if(!xe.visible){x.value&&x.value.setCurrentKey("");return}if(B.value.push(xe.secondId),xe.children&&xe.children.length>0)xe.children.forEach(w=>{he(w)});else for(const w in a.value.objects){const M=a.value.objects[w].geometry;M.userData[xe.guid]&&M.userData[xe.guid].forEach(S=>{V.push(S==null?void 0:S.uuid)})}};he(Z),V.length?a.value.highLightMeshManager.setHighLightById(V,"uuid",J):(a.value.highLightMeshManager.clearHighLightMesh(),B.value=[],Se.ElMessage("未查询到对应构件."))}x.value&&K&&(Z!=null&&Z.secondId)&&u.value!=="model"&&(x.value.setCurrentKey(Z.secondId),g.nextTick(()=>{var xe,w,E;const he=(xe=x.value)==null?void 0:xe.getCurrentNode();he&&((w=x.value)==null||w.setExpandedKeys([he.secondId]),(E=x.value)==null||E.scrollToNode(he.secondId,"center"))})),(Y=r.value)!=null&&Y.nodeClickCallback&&((ce=r.value)==null||ce.nodeClickCallback(Z))}},G=(Z,K)=>{if(Z.preventDefault(),K){if(K.secondId===B.value[0]){H();return}const J=function(Y){const ce=B.value.indexOf(Y.secondId);if(ce>-1&&B.value.splice(ce,1),Y.children&&Y.children.length>0)Y.children.forEach(he=>{J(he)});else for(const he in a.value.objects){const w=a.value.objects[he].geometry;w.userData[Y.guid]&&w.userData[Y.guid].forEach(E=>{const M=V.indexOf(E.uuid);M>-1&&V.splice(M,1)})}};J(K),V.length?a.value.highLightMeshManager.setHighLightById(V,"uuid",!1):(a.value.highLightMeshManager.clearHighLightMesh(),B.value=[])}},W=(Z,K)=>{var J,Y;!((J=r.value)!=null&&J.model)||Z.parent||(Y=r.value)==null||Y.model.children.forEach(ce=>{ce instanceof f.Mesh&&(ce.material.depthTest=K,ce.material.depthWrite=K)})},j=(Z,K)=>{var J,Y,ce,he,xe,w,E,M,S,k,D,R;try{if(a.value&&c.value){if(u.value==="model")Z.visible=K,c.value.visible=K,(xe=(he=(ce=(Y=(J=a.value.highLightMeshManager.highLightMesh)==null?void 0:J.geometry)==null?void 0:Y.attributes)==null?void 0:ce.position)==null?void 0:he.array)!=null&&xe.length&&(a.value.highLightMeshManager.highLightMesh.visible=K,a.value.highLightMeshManager.highLightMeshLine.visible=K);else{let _=function(le,oe){var pe;le.visible=oe,(pe=le==null?void 0:le.children)!=null&&pe.length&&(le==null||le.children.forEach(ge=>{_(ge,oe)}))};const F=!(Z!=null&&Z.parent);_(Z,K);const z={};let U=null;(k=(S=(M=(E=(w=a.value.highLightMeshManager.highLightMesh)==null?void 0:w.geometry)==null?void 0:E.attributes)==null?void 0:M.position)==null?void 0:S.array)!=null&&k.length&&(U=a.value.highLightMeshManager.highLightMesh.geometry);let q=!1;const ae=function(le,oe){if(le.children&&le.children.length>0)le.children.forEach(pe=>{ae(pe,oe)});else{for(const pe in a.value.objects){const ge=a.value.objects[pe];a.value.setObjectPartsToBeVisibleAndHiddenByGuid(ge.geometry,le.guid,oe)&&(z[pe]=ge)}U&&(a.value.setObjectPartsToBeVisibleAndHiddenByGuid(U,le.guid,oe),q=!0)}};ae(Z,F?K:Z.visible),q&&a.value.highLightMeshManager.updateHighLightMeshLine();for(const le in z){const oe=z[le].geometry,pe=z[le].children[0];pe instanceof f.LineSegments&&(pe.geometry.dispose(),pe.geometry=new f.EdgesGeometry(oe))}}(D=r.value)!=null&&D.nodeCheckCallback&&((R=r.value)==null||R.nodeCheckCallback(Z,K))}}catch(_){console.log(_)}};function H(Z=!0){V=[],B.value=[],a.value.highLightMeshManager.clearHighLightMesh(Z),x.value&&x.value.setCurrentKey("")}const ee=g.ref([]),$=g.ref({}),de=g.ref([]),ie=Z=>{var J,Y;if(!((J=P.value)!=null&&J.length)){de.value=Z;return}let K=null;for(const ce of Z){const he=Kt(P.value[0],ce,"guid");he&&(K=he)}if(!K)for(const ce of Object.keys(O.value)){if(ce===u.value)continue;const he=(Y=O.value[ce])==null?void 0:Y[0];if(he){for(const xe of Z){const w=Kt(he,xe,"guid");if(w){K=w,v(ce);break}}if(K)break}}K&&I(K,!0,!1)};async function me(){var Z,K,J,Y,ce,he,xe,w,E,M;if((K=(Z=r.value)==null?void 0:Z.tabs)!=null&&K.length&&((J=a.value)!=null&&J.objects)){u.value=(Y=r.value)==null?void 0:Y.tabs[0];const S=await Al((ce=r.value)==null?void 0:ce.jsonFileUrl,(he=r.value)==null?void 0:he.model.name,(xe=r.value)==null?void 0:xe.hiddenMeshGuids,(w=r.value)==null?void 0:w.changeTabSaveHiddenMesh);if((E=r.value)==null||E.tabs.forEach(k=>{O.value[k]=S!=null&&S.hasOwnProperty(k)?[S[k]]:[]}),ee.value=S==null?void 0:S.secondUuids,$.value=S==null?void 0:S.hiddenSecondIds,v((M=r.value)==null?void 0:M.tabs[0],!0),de.value.length){const k=de.value;de.value=[],g.nextTick(()=>ie(k))}}}function re(){p(!0),g.nextTick(()=>{if(a.value.rayCasterManager.raycasterResultGuid){const Z=Kt(P.value[0],a.value.rayCasterManager.raycasterResultGuid,"guid");Z&&I(Z,!0,!1)}})}function be(Z){var K;p(!1),(K=l.value)!=null&&K.closeCallback&&l.value.closeCallback(Z)}return g.onMounted(async()=>{await me(),A(),re(),g.nextTick(()=>{var Z,K;(Z=r.value)!=null&&Z.loadCallback&&((K=r.value)==null||K.loadCallback())})}),e({show:h,setShow:p,open:re,activeName:u,treeRef:x,onTreeNodePointerClick:I,locateByGuids:ie,currentTreeData:P,heightLightSecondIds:B,secondUuids:ee,treeData:O}),(Z,K)=>(g.openBlock(),g.createBlock(zt,g.mergeProps({style:{visibility:h.value?"visible":"hidden"},"resize-callback":A,"close-callback":be},{resize:!0,drag:!0,close:!0,...g.unref(l)}),{default:g.withCtx(()=>[g.createElementVNode("div",{class:"model-tree-box",style:g.normalizeStyle({contentVisibility:h.value?"visible":"hidden"})},[u.value?(g.openBlock(),g.createBlock(g.unref(Se.ElTabs),{key:0,modelValue:u.value,"onUpdate:modelValue":K[0]||(K[0]=J=>u.value=J),class:"tree-tabs","before-leave":m,onTabChange:K[1]||(K[1]=J=>v(J))},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(d.value,J=>(g.openBlock(),g.createBlock(g.unref(Se.ElTabPane),{key:J.name,label:J.label,name:J.name},null,8,["label","name"]))),128))]),_:1},8,["modelValue"])):g.createCommentVNode("",!0),g.createElementVNode("div",_l,[g.createVNode(g.unref(Se.ElInput),{modelValue:y.value,"onUpdate:modelValue":K[2]||(K[2]=J=>y.value=J),style:{width:"100%"},placeholder:"过滤关键字",onChange:b,clearable:""},null,8,["modelValue"]),g.createVNode(g.unref(Se.ElTreeV2),g.mergeProps({ref_key:"treeRef",ref:x,style:{width:"100%"},class:"filter-tree",icon:g.unref(Vo.ArrowRightBold),"filter-method":C,"highlight-current":"","expand-on-click-node":!1,"show-checkbox":"",height:T.value,onCheckChange:j,"default-checked-keys":ee.value,"check-on-click-node":!1,"check-on-click-leaf":!1,props:{label:"name",value:"secondId",children:"children"}},g.unref(r).treeConfig),{default:g.withCtx(({data:J})=>[g.createElementVNode("div",{class:g.normalizeClass({"tree-node-box":!0,"row-hover":J.visible,"height-light":B.value.includes(J.secondId)&&J.visible}),onPointerover:Y=>W(J,!1),onPointerout:Y=>W(J,!0),onClick:Y=>I(J,!1),onContextmenu:Y=>G(Y,B.value.includes(J.secondId)&&J.visible?J:void 0)},[g.createVNode(vt,{text:J.name},null,8,["text"])],42,Bl)]),empty:g.withCtx(()=>[g.createVNode(Gn)]),_:1},16,["icon","height","default-checked-keys"])])],4)]),_:1},16,["style"]))}});const Ol=Ue(Rl,[["__scopeId","data-v-94ef88f8"]]),Mt=function(o){const e=o.text,i=o.hPxText?o.hPxText:50,r=o.fgColor?o.fgColor:"#ffffff",a=o.fontFamily?o.fontFamily:"sans-serif",l=o.bold?"bold ":"",c=o.italic?"italic":"",h=o.bgColor?o.bgColor:kt("--el-color-primary"),p=document.createElement("canvas"),u=p.getContext("2d");if(u==null)return;u.font=c+l+i+"px "+a;const d=u.measureText(e),m=d.width+30,v=d.fontBoundingBoxAscent+d.fontBoundingBoxDescent,y=d.actualBoundingBoxAscent+d.actualBoundingBoxDescent,x=(v-y)/4;p.width=m,p.height=v;const b=20;u.fillStyle=h,u.beginPath(),u.moveTo(b,0),u.arcTo(m,0,m,v,b),u.arcTo(m,v,0,v,b),u.arcTo(0,v,0,0,b),u.arcTo(0,0,b,0,b),u.lineWidth=5,u.strokeStyle="#fff",u.fill(),u.stroke(),u.textAlign="center",u.textBaseline="middle",u.fillStyle=r,u.font=c+l+i+"px "+a,u.fillText(e,m/2,v/2+x);const C=new f.CanvasTexture(p),T=new f.SpriteMaterial({map:C,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),A=new f.Sprite(T);return A.scale.set(m/2200,v/2200,1),A},Uo=function(o){const e=o.text,i=o.hPxText?o.hPxText:150,r=o.hWorldAll?o.hWorldAll:200,a=o.fgColor?o.fgColor:"#ffffff",l=o.fontFamily?o.fontFamily:"sans-serif",c=o.bold?"bold ":"",h=o.textAlign?o.textAlign:"start",p=o.bgColor?o.bgColor:kt("--el-color-primary");let u=200;const d=document.createElement("canvas"),m=d.getContext("2d");if(m==null)return;m.font=c+i+"px "+l,u=m.measureText(e).width;const y=u+30>900?900:u+30,x=y/4+50;d.width=u+30,d.height=r+x,m.fillStyle=p,m.fillRect(0,0,u+30,r),m.textAlign=h,m.textBaseline="top",m.fillStyle=a,m.font=c+i+"px "+l,m.fillText(e,15,40),m.beginPath(),m.moveTo(y,r+40),m.lineTo(40,r+40),m.lineTo(y*3/16-20,r+x-40),m.lineTo(y*2/8+40,r+40),m.closePath(),m.strokeStyle=kt("--el-color-primary"),m.lineWidth=30,m.stroke();const b=new f.CanvasTexture(d),C=new f.SpriteMaterial({map:b,transparent:!0,depthTest:!0,depthWrite:!0,sizeAttenuation:!1}),T=new f.Sprite(C);return T.scale.set(d.width/8e3,d.height/8e3,1),T.center.set((y*3/16-40)/d.width,0),T};class ze extends ft.Line2{constructor(i){super();L(this,"name","cline");L(this,"geometry",new kn.LineGeometry);L(this,"material",new Na.LineMaterial({depthTest:!1,depthWrite:!1,color:parseInt(kt("--el-color-primary").replace("#","0x"))}));i!=null&&i.name&&(this.name=i.name),this.initUI(i),this.frustumCulled=!1}initUI(i){i&&i.vertexs!==void 0&&this.setVertexs(i.vertexs),i&&i.color!==void 0&&this.setColor(i.color),i&&i.dashed!==void 0&&this.setDashed(i.dashed),i&&i.lineWidth!==void 0&&this.setLineWidth(i.lineWidth),i&&i.opacity!==void 0&&this.setOpacity(i.opacity),i&&i.transparent!==void 0&&this.setTransparent(i.transparent),this.setDashSize(i&&i.dashSize!==void 0?i.dashSize:30),this.setGapSize(i&&i.gapSize!==void 0?i.gapSize:30)}setVertexs(i){let r=[];if(!i||i.length==0)throw new Error("vertexs is not defined or vertexs array is empty.");return i[0].isVector3?i.forEach(a=>{r.push(a.x,a.y,a.z)}):i[0]instanceof Array?i.forEach(a=>{r.push(a[0],a[1],a[2])}):r=i.slice(),this.geometry.dispose(),this.geometry=new kn.LineGeometry,this.geometry.setPositions(r),this.computeLineDistances(),this}getVertexs(){const i=[];if(!this.geometry.attributes.instanceStart)return[];const r=this.geometry.attributes.instanceStart.data.array;for(let a=0;a<r.length;a+=3)i.push(new f.Vector3(r[a],r[a+1],r[a+2]));return i}setDashed(i){this.material.dashed=i,i?this.material.defines.USE_DASH="":delete this.material.defines.USE_DASH,this.material.needsUpdate=!0}setDashSize(i){this.userData.dashSize=i}setGapSize(i){this.userData.gapSize=i}setLineWidth(i=.001){this.material.linewidth=i}setTransparent(i){this.material.transparent=i}setOpacity(i=1){this.material.opacity=i}setColor(i=9945056){this.material.color.set(i)}}const qs=o=>{let e=0;for(let i=0,r=1,a=2;a<o.length;r++,a++){const l=o[i].distanceTo(o[r]),c=o[r].distanceTo(o[a]),h=o[a].distanceTo(o[i]),p=(l+c+h)/2;e+=Math.sqrt(p*(p-l)*(p-c)*(p-h))}return e},ms=o=>{if(o.length!=3)throw new Error("角度点数量只能为3个!");const e=new f.Vector3().subVectors(o[0],o[1]),i=new f.Vector3().subVectors(o[2],o[1]);return e.angleTo(i)/Math.PI*180},Go=new f.MeshBasicMaterial({color:16358667,transparent:!0,opacity:.2,depthTest:!1,depthWrite:!1,side:2}),zo=new f.MeshBasicMaterial({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,side:2});function Dl(o,e=!1){if(o.length<3)throw new Error("点的数量必须大于等于3个!");const i=new f.Shape;o.forEach((c,h)=>{h==0?i.moveTo(c.x,c.y):i.lineTo(c.x,c.y)});const r=new f.ExtrudeGeometry(i,{bevelEnabled:!1,bevelThickness:0}),a=e?zo:Go;return new f.Mesh(r,a)}const zn=(o,e)=>{if(o.length<3)throw new Error("点的数量必须大于等于3个!");const i=new f.BufferGeometry,r=[];for(let c=1;c<o.length;c++)o[c+1]&&(r.push(o[0].x,o[0].y,o[0].z),r.push(o[c].x,o[c].y,o[c].z),r.push(o[c+1].x,o[c+1].y,o[c+1].z));const a=new Float32Array(r);i.setAttribute("position",new f.BufferAttribute(a,3));const l=e?zo:Go;return new f.Mesh(i,l)};function Ho(o,e,i,r,a,l=!0){const c=document.createElement("div");c.innerHTML=o,c.id=o,c.style.padding="3px 6px",c.style.color=r||"#fff",c.style.fontSize=i||"12px",c.style.backgroundColor=a||"#777777",c.style.position="absolute",c.style.top="0px",c.style.left="0px",c.style.textShadow="-1px 1px 0 #000, 1px 1px 0 #000, 1px -1px 0 #000,-1px -1px 0 #000";const h=new Po.CSS2DObject(c);return e&&h.position.copy(e),h.position.y=h.position.y+13,h.name=o,h.visible=l,h}const Mn=function(){const o=document.createElement("canvas"),e=o.getContext("2d");o.width=100,o.height=100,e.arc(50,50,50,0,360,!1),e.fillStyle="#ffffff",e.fill();const i=new f.CanvasTexture(o);return new f.SpriteMaterial({map:i,transparent:!0,sizeAttenuation:!1,depthTest:!1,color:255})}();let Hn=class{constructor(e,i){L(this,"rays");L(this,"step");L(this,"state");L(this,"element");L(this,"raycaster",new f.Raycaster);L(this,"camera");L(this,"point",new f.Vector3);L(this,"currentObj");L(this,"group");L(this,"points");L(this,"curr_line");L(this,"down");L(this,"pointMesh");L(this,"callback");L(this,"viewer");L(this,"start",new f.Vector2);L(this,"end",new f.Vector2);L(this,"events");L(this,"UNIT");this.rays=[],this.viewer=e,this.step=0,this.state="",this.element=e.element,this.camera=e.camera,this.currentObj=null,this.group=e.containerGroup,this.points=[],this.down=!1,this.callback=i.callback;const r=e.containerGroup.getObjectByName("curr_line");if(r)this.curr_line=r,this.pointMesh=e.containerGroup.getObjectByName("move_point");else{this.curr_line=new ze({vertexs:[0,0,0,0,0,0],color:16358667,lineWidth:.002,name:"curr_line",transparent:!0});const a=Ho("");this.curr_line.add(a),this.curr_line.visible=!1,a.visible=!1,e.containerGroup.add(this.curr_line),this.pointMesh=new f.Sprite(Mn),this.pointMesh.scale.set(.01,.01,1),this.pointMesh.name="move_point",this.pointMesh.visible=!1,e.containerGroup.add(this.pointMesh)}this.events={pointerup:this.upEvent.bind(this),pointerdown:this.downEvent.bind(this),pointermove:this.mouseMoveEvent.bind(this)},this.UNIT={unit:"m",precision:"1"},this.initEvents()}initEvents(){for(const e in this.viewer.objs)this.viewer.objs[e].traverse(r=>{r instanceof f.Mesh&&this.rays.push(r)});this.element.addEventListener("pointerup",this.events.pointerup),this.element.addEventListener("pointerdown",this.events.pointerdown),this.element.addEventListener("pointermove",this.events.pointermove),this.group.children.forEach(e=>{e.userData.type=="measure"&&(e.visible=!0)})}mouseMoveEvent(e){if(this.state=="")return;if(this.down){this.end.set(e.clientX,e.clientY);return}const i=this.element.getBoundingClientRect(),r=i.width,a=i.height,l=e.clientY-i.top,c=e.clientX-i.left,h={x:0,y:0};h.x=c/r*2-1,h.y=-(l/a)*2+1,this.raycaster.setFromCamera(h,this.camera);const p=this.raycaster.intersectObjects(this.rays,!1);if(this.currentObj=null,p.length<1||!p[0].point)return;const u=this.computedEdegPoint(p[0].object.matrix,p[0].object.geometry,p[0].face,p[0].point);if(this.point.copy(u),this.pointMesh.position.copy(u),this.currentObj=p[0].object,this.points[this.step]=u,this.state=="elevation"){const d=this.judeUnit(this.UNIT.unit,u.y,Number(this.UNIT.precision))+this.UNIT.unit;this.curr_line.children[0].element.innerHTML=d,this.curr_line.children[0].position.set(u.x,u.y+.1,u.z);return}if(this.curr_line.setVertexs(this.points),this.state=="angle"&&this.step>1){const d=ms(this.points).toFixed(Number(this.UNIT.precision));this.curr_line.children[0].element.innerHTML=d+"°",this.curr_line.children[0].position.lerpVectors(this.points[1],this.points[2],.5)}else if(this.state=="distance"&&this.step>0){const d=this.points[0].distanceTo(this.points[1]),m=this.judeUnit(this.UNIT.unit,d,Number(this.UNIT.precision))+this.UNIT.unit;this.curr_line.children[0].element.innerHTML=m,this.curr_line.children[0].position.lerpVectors(this.points[0],this.points[1],.5)}}upEvent(e){if(this.down=!1,this.start.distanceTo(this.end)>0){this.start.multiplyScalar(0),this.end.multiplyScalar(0);return}if(this.currentObj!=null&&e.button==0)if(this.curr_line.children[0].visible=!0,this.state=="distance"){if(this.step<1)this.step++;else if(this.step==1){this.points.sort((c,h)=>h.y-c.y);const i=this.points[0].clone(),r=this.points[1].clone(),a=[{x:i.x,y:i.y,z:i.z},{x:i.x,y:i.y,z:r.z},{x:r.x,y:i.y,z:r.z},{x:r.x,y:r.y,z:r.z}].map(c=>new f.Vector3(c.x,c.y,c.z)),l=[{points:[a[3],a[0]],color:parseInt(kt("--el-color-primary").replace("#","0x")),label:"直线距离",useLabel:!0,dashed:!1,lineWidth:.002,opacity:1},{points:[a[1],a[2]],color:65280,label:"x(横轴)",dashed:!1,opacity:.7,lineWidth:.001},{points:[a[2],a[3]],color:8388736,label:"y(纵轴)",dashed:!1,opacity:.7,lineWidth:.001},{points:[a[0],a[1]],color:16711680,label:"z(竖轴)",dashed:!1,opacity:.7,lineWidth:.001}];this.createDistanceLine(l),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText=""}}else this.state=="angle"?this.step<2?this.step++:this.step==2&&(this.createAngleLine(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText=""):this.state=="elevation"&&(this.step++,this.step===1&&(this.createHeight(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText=""))}downEvent(e){this.down=!0,this.start.set(e.clientX,e.clientY),this.end.set(e.clientX,e.clientY)}createDistanceLine(e){const i=new f.Group,r=[];e.forEach((a,l)=>{const c=a.points[0].distanceTo(a.points[1]),h=new ze({vertexs:[a.points[0],a.points[1]],color:a.color,lineWidth:a.lineWidth,transparent:!0,opacity:a.opacity,dashed:a.dashed}),p=this.judeUnit(this.UNIT.unit,Number(c),Number(this.UNIT.precision))+this.UNIT.unit;if(a.useLabel){const u=Mt({text:p});u.position.lerpVectors(a.points[0],a.points[1],.5),h.add(u)}h.userData.type="measure",i.add(h),r.push({label:a.label,color:`#${a.color.toString(16).padStart(6,"0")}`,value:p})}),i.userData.type="measure",this.group.add(i),this.callback&&this.callback(r)}createAngleLine(e){if(e.length<3)throw new Error("角度测量点必须是三个!");e.length>3&&(e=e.slice(0,3));const i=new ze({vertexs:e,lineWidth:.002,transparent:!0}),a=ms(e).toFixed(Number(this.UNIT.precision))+"°",l=Mt({text:a}),c=e[0],h=e[1],p=e[2],u=new f.Vector3().subVectors(c,h),d=new f.Vector3().subVectors(p,h),m=new f.Vector3,v=u.angleTo(d);if(m.crossVectors(u,d),m.normalize(),d.applyAxisAngle(m,-v/2),d.multiplyScalar(.5),d.add(h),!l)return;new f.Box3().expandByObject(i),l.position.copy(d),i.add(l),this.group.add(i),i.userData.type="measure",this.callback&&this.callback([{label:"角度",color:kt("--el-color-primary"),value:a}])}createAreaLine(e){if(e.length<3)throw new Error("面积测量点不能少于三个!");const r=qs(e)+"",a=zn(e),l=new ze({vertexs:[...e,e[0]],color:kt("--el-color-primary").replace("#","0x"),lineWidth:.002,transparent:!0}),c=Mt({text:r});if(!c)return;const h=new f.Box3;h.expandByObject(l),h.getCenter(c.position),l.add(a,c),this.group.add(l),l.userData.type="measure",this.callback&&this.callback(r)}createElevationLine(e){const i=new ze({vertexs:[e[1],e[0]],lineWidth:.002,transparent:!0}),a=e[0].distanceTo(e[1]).toFixed(Number(this.UNIT.precision))+this.UNIT.unit,l=Mt({text:a});if(!l){i.material.dispose(),i.geometry.dispose();return}l.position.lerpVectors(e[0],e[1],.5),i.add(l),i.userData.type="measure",this.group.add(i)}createHeight(e){if(!e[0])return;const i=this.judeUnit(this.UNIT.unit,e[0].y,Number(this.UNIT.precision))+this.UNIT.unit,r=Uo({text:i});r&&(r.position.copy(e[0]),r.userData.type="measure",this.group.add(r),this.callback&&this.callback([{label:"标高",color:kt("--el-color-primary"),value:i}]))}computedEdegPoint(e,i,r,a){const l=i.attributes.position,c=new f.Vector3(l.getX(r.a),l.getY(r.a),l.getZ(r.a)).applyMatrix4(e),h=new f.Vector3(l.getX(r.b),l.getY(r.b),l.getZ(r.b)).applyMatrix4(e),p=new f.Vector3(l.getX(r.c),l.getY(r.c),l.getZ(r.c)).applyMatrix4(e),u=c.distanceTo(a),d=h.distanceTo(a),m=p.distanceTo(a),v=[{dis:u,point:c},{dis:d,point:h},{dis:m,point:p}];return v.sort((y,x)=>y.dis-x.dis),v[0].dis<.2?v[0].point:a}adjustSetting(e){this.UNIT.unit=e.unit,this.UNIT.precision=e.precision}judeUnit(e,i,r){return e=="m"?i.toFixed(r):e=="cm"?(i*100).toFixed(r):e=="mm"?(i*1e3).toFixed(r):""}setType(e){this.state=e,this.step=0,e==""?(this.curr_line.visible=!1,this.pointMesh.visible=!1,this.curr_line.children[0].visible=!1,this.points.length=0):(this.curr_line.visible=!0,this.pointMesh.visible=!0,this.curr_line.children[0].visible=!0)}clearAll(){const e=[];this.group.children.forEach(r=>{r.userData.type=="measure"&&e.push(r)}),this.curr_line.children[0].visible=!0,this.curr_line.children[0].element.innerHTML="",this.curr_line.children[0].visible=!1,e.forEach(r=>{if(this.curr_line.children[0].visible=!1,r instanceof ze){const a=r;a.geometry.dispose(),a.material.dispose(),r.children[0].material.dispose()}else r instanceof f.Sprite&&r.material.dispose();this.group.remove(r)});let i="";(this.state=="distance"||this.state=="elevation")&&(i="0"+this.UNIT.unit),this.state=="angle"&&(i="0°"),this.callback&&this.callback({num1:i})}destory(){this.element.removeEventListener("pointerup",this.events.pointerup),this.element.removeEventListener("pointerdown",this.events.pointerdown),this.element.removeEventListener("pointermove",this.events.pointermove),this.step=0,this.currentObj=null,this.state="",this.curr_line.visible=!1,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerHTML="",this.pointMesh.visible=!1,this.group.children.forEach(e=>{e.userData.type=="measure"&&(e.visible=!1)})}};const Nl={class:"measure-box"},Pl={class:"measure-types-box"},Vl={class:"measure-types"},Fl=["onMouseup"],Ul={class:"label"},Gl={class:"measure-result"},zl={key:0,class:"measure-result-box"},Hl={class:"label"},jl={class:"clear-btn"},Wl=g.defineComponent({__name:"index",props:{viewer:{},cardConfig:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a}=g.toRefs(i),l=g.ref(),c=()=>{var P;return(P=l.value)==null?void 0:P.getBoundingClientRect()},h=g.ref(!1),p=()=>{h.value=!h.value};function u(P){var V,B;(V=a.value)!=null&&V.closeCallback&&((B=a.value)==null||B.closeCallback(P))}const d={distance:{name:"距离",icon:"measureDistance"},angle:{name:"角度",icon:"measureAngle"},elevation:{name:"标高",icon:"measureElevation"}},m=g.ref([{bindValue:"m",label:"单位",key:["distance","elevation"],options:[{name:"m",value:"m"},{name:"cm",value:"cm"},{name:"mm",value:"mm"}]},{bindValue:"1",label:"精度",key:["distance","angle","elevation"],options:[{name:"0.0",value:"1"},{name:"0.00",value:"2"},{name:"0.000",value:"3"}]}]);let v;function y(){v&&v.adjustSetting({unit:m.value[0].bindValue,precision:m.value[1].bindValue})}const x=g.ref(""),b=P=>{P!==x.value&&(x.value=P,v.setType(P),O())};function C(){r.value&&r.value.rayCasterManager.setEventHandler(null),v=new Hn(r.value,{callback:A.bind(this)}),b("distance")}const T=g.ref([]);function A(P){T.value=P}function O(){v&&v.clearAll()}return g.onMounted(()=>{C()}),g.onBeforeUnmount(()=>{var P,V;O(),v&&v.destory(),r.value&&(Array.isArray(r.value.options.rayCaster)?(P=r.value.options.rayCaster)!=null&&P.length:(V=r.value.options.rayCaster)!=null&&V.type)&&r.value&&r.value.rayCasterManager.setEventHandler(r.value.options.rayCaster)}),e({getCardDOMRect:c}),(P,V)=>(g.openBlock(),g.createBlock(zt,g.mergeProps({ref_key:"CardRef",ref:l,"close-callback":u},{resize:!1,drag:!0,close:!0,...g.unref(a)}),{default:g.withCtx(()=>{var B;return[g.createElementVNode("div",Nl,[g.createElementVNode("div",Pl,[g.createElementVNode("div",Vl,[(g.openBlock(),g.createElementBlock(g.Fragment,null,g.renderList(d,(I,G)=>g.createElementVNode("div",{class:g.normalizeClass(["measure-type",{active:g.unref(x)===G}]),key:I.name,onMouseup:W=>b(G)},[g.createVNode(ht,{"use-parent-trigger":"",name:I.icon,"tool-tip-content":I.name,size:"25px"},null,8,["name","tool-tip-content"])],42,Fl)),64))]),g.createElementVNode("span",{class:g.normalizeClass(["arrow-right",{active:g.unref(h)}]),onClick:p},[g.createVNode(ht,{name:"config",size:"20px"})],2)]),g.createElementVNode("div",{class:"measure-config",style:g.normalizeStyle({height:g.unref(h)?g.unref(x)==="angle"?"39px":"68px":"0"})},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(m),I=>g.withDirectives((g.openBlock(),g.createElementBlock("div",{class:"unit-box config",key:I.label},[g.createElementVNode("span",Ul,g.toDisplayString(I.label),1),g.createVNode(g.unref(Se.ElSelect),{modelValue:I.bindValue,"onUpdate:modelValue":G=>I.bindValue=G,size:"small",onChange:y},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(I.options,G=>(g.openBlock(),g.createBlock(g.unref(Se.ElOption),{key:G.value,label:G.name,value:G.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])),[[g.vShow,I.key.includes(g.unref(x))]])),128))],4),g.createElementVNode("div",Gl,[(B=g.unref(T))!=null&&B.length?(g.openBlock(),g.createElementBlock("div",zl,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(T),(I,G)=>(g.openBlock(),g.createElementBlock("div",{class:"measure-item",key:G},[g.createElementVNode("div",Hl,g.toDisplayString(I.label),1),g.createElementVNode("div",{class:"value",style:g.normalizeStyle({color:I.color})},g.toDisplayString(I.value),5)]))),128))])):(g.openBlock(),g.createBlock(Gn,{key:1,height:"100px",title:"暂无测试数据"}))]),g.createElementVNode("div",jl,[g.createVNode(g.unref(Se.ElButton),{size:"small",onClick:V[0]||(V[0]=I=>O())},{default:g.withCtx(()=>V[1]||(V[1]=[g.createTextVNode("清除")])),_:1})])])]}),_:1},16))}});const Xl=Ue(Wl,[["__scopeId","data-v-39b67b39"]]);function Zl(o){let e=new f.Box3;return e.setFromObject(o),e.getSize(new f.Vector3)}const jo="c2VsZi5vbm1lc3NhZ2UgPSBhc3luYyAobikgPT4gewogIGNvbnN0IHsgY2FudmFzOiBlLCBpbWFnZVNvdXJjZTogcyB9ID0gbi5kYXRhOwogIGlmICghZSB8IHMpCiAgICB0aHJvdyBwb3N0TWVzc2FnZShudWxsKSwgbmV3IEVycm9yKCLnvLrlsJHlj4LmlbAhIik7CiAgdHJ5IHsKICAgIGNvbnN0IHQgPSBhd2FpdCBjcmVhdGVJbWFnZUJpdG1hcChzKTsKICAgIGUud2lkdGggPSB0LndpZHRoLCBlLmhlaWdodCA9IHQuaGVpZ2h0LCBlLmdldENvbnRleHQoIjJkIikuZHJhd0ltYWdlKHQsIDAsIDAsIGUud2lkdGgsIGUuaGVpZ2h0KSwgdC5jbG9zZSgpLCBlLmNvbnZlcnRUb0Jsb2IoKS50aGVuKChvKSA9PiBuZXcgUHJvbWlzZSgociwgYykgPT4gewogICAgICBjb25zdCBhID0gbmV3IEZpbGVSZWFkZXIoKTsKICAgICAgYS5vbmVycm9yID0gYywgYS5vbmxvYWQgPSBmdW5jdGlvbigpIHsKICAgICAgICByKGEucmVzdWx0KTsKICAgICAgfSwgYS5yZWFkQXNEYXRhVVJMKG8pOwogICAgfSkpLnRoZW4oKG8pID0+IHsKICAgICAgcG9zdE1lc3NhZ2Uobyk7CiAgICB9KS5jYXRjaCgobykgPT4gewogICAgICBjb25zb2xlLmxvZyhvKSwgcG9zdE1lc3NhZ2UobnVsbCk7CiAgICB9KTsKICB9IGNhdGNoICh0KSB7CiAgICBjb25zb2xlLmxvZyh0KSwgcG9zdE1lc3NhZ2UobnVsbCk7CiAgfQp9Owo=",_i=typeof window<"u"&&window.Blob&&new Blob([atob(jo)],{type:"text/javascript;charset=utf-8"});function Yl(){let o;try{if(o=_i&&(window.URL||window.webkitURL).createObjectURL(_i),!o)throw"";return new Worker(o)}catch{return new Worker("data:application/javascript;base64,"+jo,{type:"module"})}finally{o&&(window.URL||window.webkitURL).revokeObjectURL(o)}}class Kl{constructor(e,i=4){L(this,"WorkerScript");L(this,"maxSize");L(this,"destructionTimer",null);L(this,"idleDestructionCountdownDuration",60*1e3);L(this,"workers",[]);L(this,"queue",[]);this.WorkerScript=e,this.maxSize=i}run(e,i){return this.destructionTimer&&(clearTimeout(this.destructionTimer),this.destructionTimer=null),new Promise((r,a)=>{const l={data:e,transferable:i,resolve:r,reject:a},c=this.obtainIdleWorker();c?this.executeTask(c,l):this.queue.push(l)})}obtainIdleWorker(){const e=this.workers.find(i=>!i.busy);if(e)return e;if(this.workers.length<this.maxSize){const i=new this.WorkerScript;let r={worker:i,busy:!1};return i.onmessage=a=>{r.busy=!1,r==null||r.resolve(a),this.nextTask(r)},i.onerror=a=>{r.busy=!1,r==null||r.reject(a),this.nextTask(r)},this.workers.push(r),r}else return null}executeTask(e,i){e.busy=!0,e.resolve=i.resolve,e.reject=i.reject,e.worker.postMessage(i.data,i.transferable)}nextTask(e){if(this.queue.length>0){const i=this.queue.shift();this.executeTask(e,i)}else this.workers.every(i=>!i.busy)&&(this.destructionTimer=setTimeout(()=>{this.terminateAll(),clearTimeout(this.destructionTimer),this.destructionTimer=null},this.idleDestructionCountdownDuration))}terminateAll(){this.workers.forEach(e=>e.worker.terminate()),this.workers=[],this.queue=[]}}const Wo=Kl,ql={class:"com-info-box"},Ql={key:0},Jl={key:1,class:"descriptions-box"},$l={class:"label"},e1={class:"content"},t1={key:0,class:"material-box"},s1={key:0,class:"loading-box"},n1=g.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},otherInfo:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a}=g.toRefs(i),l=g.ref(),c=()=>{var b;return(b=l.value)==null?void 0:b.getBoundingClientRect()};function h(b){var C,T;(C=a.value)!=null&&C.closeCallback&&((T=a.value)==null||T.closeCallback(b))}const p=g.ref([]),u=g.ref(0);async function d(b){p.value=b,u.value=0,await x(p.value[0])}async function m(b){var C,T,A,O,P,V,B,I,G,W,j,H,ee,$,de;if(await x(p.value[b]),p.value[b]instanceof f.Mesh&&(r.value.focusOnTheMesh(p.value[b]),((C=r.value.options.utilsMenu.options.tree)==null?void 0:C.show)!==!1&&((T=r.value.utilsMenuRef.treeRef)!=null&&T.show)&&((O=(A=r.value.utilsMenuRef)==null?void 0:A.treeRef)!=null&&O.onTreeNodePointerClick)&&((V=(P=r.value.utilsMenuRef)==null?void 0:P.treeRef)==null?void 0:V.activeName)!=="model"&&((I=(B=r.value.utilsMenuRef.treeRef)==null?void 0:B.currentTreeData)!=null&&I.length))){const ie=Kt((G=r.value.utilsMenuRef.treeRef)==null?void 0:G.currentTreeData[0],p.value[b].userData.ExId,"guid");if(ie&&(ie!=null&&ie.secondId)){(H=(j=(W=r.value.utilsMenuRef)==null?void 0:W.treeRef)==null?void 0:j.treeRef)==null||H.setExpandedKeys([ie==null?void 0:ie.secondId]),(de=($=(ee=r.value.utilsMenuRef)==null?void 0:ee.treeRef)==null?void 0:$.treeRef)==null||de.scrollToNode(ie==null?void 0:ie.secondId,"center");const me=p.value[b].clone(),re=new f.BufferGeometry().copy(me.geometry);re.applyMatrix4(me.matrix),re.deleteAttribute("normal"),re.deleteAttribute("uv"),re.userData={mesh:me.geometry.uuid,guid:me.geometry.userData.ExId};const be=new f.Mesh(re,new f.MeshBasicMaterial({color:14365695,transparent:!0,opacity:.5,depthTest:!1,depthWrite:!1}));r.value.highLightMeshManager.highLightMesh.add(be)}}}const v=g.ref([]),y=new Wo(Yl,4);async function x(b){var C,T,A,O;v.value=[];try{if(b!=null&&b.isObject3D)switch(b==null?void 0:b.type){case"Mesh":if(v.value.push({label:"构件名称",value:(b==null?void 0:b.name)||"暂无"}),v.value.push({label:"构件分类",value:b==null?void 0:b.type}),b!=null&&b.material){let V=[b==null?void 0:b.material].flat(1/0);const B=v.value.push({label:"构件材质",value:V.length?[]:"暂无"})-1;for(let I=0;I<V.length;I++){v.value[B].value[I]={loading:!0};let G=V[I];try{if(G!=null&&G.map&&((C=G==null?void 0:G.map)!=null&&C.image))if((T=G==null?void 0:G.map.image)!=null&&T.currentSrc)v.value[B].value[I]={map:(O=(A=G.map)==null?void 0:A.image)==null?void 0:O.currentSrc};else{const j=document.createElement("canvas").transferControlToOffscreen(),H=G==null?void 0:G.map.image,ee={canvas:j,imageSource:H},$=[j];(H instanceof Blob||H instanceof File)&&$.push(H),y.run(ee,$).then(de=>{const ie=de==null?void 0:de.data;v.value[B].value[I]=ie?{map:ie}:null}).catch(de=>{v.value[B].value[I]=null})}else{let W=G==null?void 0:G.color.getStyle();v.value[B].value[I]=W?{color:W}:null}}catch{v.value[B].value[I]=null}}}let P=Zl(b);if(P!=null&&P.isVector3){let V=`${Math.round(P.x*10)/10}m*${Math.round(P.y*10)/10}m*${Math.round(P.z*10)/10}m`;v.value.push({label:"构件尺寸",value:V})}break;default:v.value=[];break}}catch(P){console.log({error:P})}}return g.onMounted(()=>{r.value&&r.value.rayCasterManager.setEventHandler({type:"click"})}),g.onBeforeUnmount(()=>{var b,C;r.value&&(Array.isArray(r.value.options.rayCaster)?(b=r.value.options.rayCaster)!=null&&b.length:(C=r.value.options.rayCaster)!=null&&C.type)&&r.value&&r.value.rayCasterManager.setEventHandler(r.value.options.rayCaster)}),e({getCardDOMRect:c,comInfo:v,setComInfo:x,setComGroup:d}),(b,C)=>(g.openBlock(),g.createBlock(zt,g.mergeProps({ref_key:"CardRef",ref:l,"close-callback":h},{resize:!1,drag:!0,close:!0,title:"构件信息",...g.unref(a)}),{default:g.withCtx(()=>{var T;return[g.createElementVNode("div",ql,[((T=g.unref(p))==null?void 0:T.length)>1?(g.openBlock(),g.createElementBlock("div",Ql,[g.createVNode(g.unref(Se.ElSelect),{modelValue:g.unref(u),"onUpdate:modelValue":C[0]||(C[0]=A=>g.isRef(u)?u.value=A:null),placeholder:"请选择",style:{width:"100%"},onChange:m},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(p),(A,O)=>(g.openBlock(),g.createBlock(g.unref(Se.ElOption),{key:O,label:A.name,value:O,disabled:g.unref(u)===O},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"])])):g.createCommentVNode("",!0),g.unref(v).length?(g.openBlock(),g.createElementBlock("div",Jl,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(v),A=>{var O;return g.openBlock(),g.createElementBlock("div",{class:"descriptions-item",key:A.label},[g.createElementVNode("div",$l,[g.createVNode(vt,{text:A.label},null,8,["text"])]),g.createElementVNode("div",e1,[A.label==="构件材质"&&((O=A.value.filter(P=>!!(P!=null&&P.loading)||!!(P!=null&&P.map)||!!(P!=null&&P.color)))!=null&&O.length)?(g.openBlock(),g.createElementBlock("div",t1,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(A.value,(P,V)=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:V},[P.loading?(g.openBlock(),g.createElementBlock("div",s1,[g.createVNode(ht,{name:"loading",size:"16px"})])):P.map?(g.openBlock(),g.createBlock(g.unref(Se.ElTooltip),{key:1,content:"贴图",placement:"top"},{default:g.withCtx(()=>[g.createVNode(g.unref(Se.ElImage),{class:"material-item",src:P.map,fit:"cover","preview-src-list":[P.map]},null,8,["src","preview-src-list"])]),_:2},1024)):P.color?(g.openBlock(),g.createBlock(g.unref(Se.ElTooltip),{key:2,content:P.color,placement:"top"},{default:g.withCtx(()=>[g.createElementVNode("div",{class:"material-item",style:g.normalizeStyle({backgroundColor:P})},null,4)]),_:2},1032,["content"])):g.createCommentVNode("",!0)],64))),128))])):(g.openBlock(),g.createBlock(vt,{key:1,text:Array.isArray(A.value)?"暂无":A.value},null,8,["text"]))])])}),128))])):(g.openBlock(),g.createBlock(Gn,{key:2,height:"150px",title:"点击模型获取构件数据"}))])]}),_:1},16))}});const i1=Ue(n1,[["__scopeId","data-v-9386eb37"]]);class Xo extends f.EventDispatcher{constructor(i,r,a){super();L(this,"_plane",new f.Plane);L(this,"_raycaster",new f.Raycaster);L(this,"_mouse",new f.Vector2);L(this,"_offset",new f.Vector3);L(this,"_intersection",new f.Vector3);L(this,"_worldPosition",new f.Vector3);L(this,"_inverseMatrix",new f.Matrix4);L(this,"origin",new f.Vector3);L(this,"direction",new f.Vector3);L(this,"_selected");L(this,"_hovered");L(this,"enabled",!0);L(this,"events");L(this,"element");L(this,"camera");L(this,"objects");this._selected=null,this._hovered=null,this.element=a,this.objects=i,this.camera=r,this.events={},this.activate(a)}activate(i){this.events.pointermove=this.onDocumentMouseMove.bind(this),this.events.pointerdown=this.onDocumentMouseDown.bind(this),this.events.pointerup=this.onDocumentMouseCancel.bind(this),this.events.mouseout=this.onDocumentMouseCancel.bind(this),i.addEventListener("pointermove",this.events.pointermove,!1),i.addEventListener("pointerdown",this.events.pointerdown,!1),i.addEventListener("pointerup",this.events.pointerup,!1),i.addEventListener("mouseout",this.events.mouseout,!1)}dispose(){for(const i in this.events)this.element.removeEventListener(i,this.events[i],!1)}onDocumentMouseMove(i){if(i.preventDefault(),!this.enabled)return;const r=this.element.getBoundingClientRect();if(this._mouse.x=(i.clientX-r.left)/r.width*2-1,this._mouse.y=-((i.clientY-r.top)/r.height)*2+1,this._raycaster.setFromCamera(this._mouse,this.camera),this._selected){const l=new f.Vector3;if(this._raycaster.ray.intersectPlane(this._plane,this._intersection)){const h=this._intersection.sub(this._offset).applyMatrix4(this._inverseMatrix);l.subVectors(h,this.origin),l.projectOnVector(this.direction),l.add(this.origin),l.add(this.origin)}this.dispatchEvent({type:"drag",object:this._selected,point:l});return}this._raycaster.setFromCamera(this._mouse,this.camera);const a=this._raycaster.intersectObjects(this.objects,!0);if(a.length>0){const l=a[0].object;this._plane.setFromNormalAndCoplanarPoint(this.camera.getWorldDirection(this._plane.normal),l.getWorldPosition(this._worldPosition)),this._hovered!==l&&(this.dispatchEvent({type:"hoveron",object:l}),this.element.style.cursor="pointer",this._hovered=l)}else this._hovered!==null&&(this.dispatchEvent({type:"hoveroff",object:this._hovered}),this.element.style.cursor="auto",this._hovered=null)}onDocumentMouseDown(i){if(!this.enabled)return;this._raycaster.setFromCamera(this._mouse,this.camera);const r=this._raycaster.intersectObjects(this.objects,!0);r.length>0&&(i.preventDefault(),this._selected=r[0].object,this.origin.copy(r[0].object.geometry.boundingSphere.center),this.direction.copy(r[0].face.normal),this._raycaster.ray.intersectPlane(this._plane,this._intersection)&&(this._inverseMatrix.copy(this._selected.parent.matrixWorld).invert(),this._offset.copy(this._intersection).sub(this._worldPosition.setFromMatrixPosition(this._selected.matrixWorld))),this.element.style.cursor="move",this.dispatchEvent({type:"dragstart",object:this._selected,plane:this._plane,intersection:this._intersection}))}onDocumentMouseCancel(i){this._selected&&(i.preventDefault(),this.dispatchEvent({type:"dragend",object:this._selected}),this._selected=null),this.element.style.cursor=this._hovered?"pointer":"auto"}}const Rt=new f.Raycaster,Ge=new f.Vector3,Ct=new f.Vector3,Le=new f.Quaternion,Bi={X:new f.Vector3(1,0,0),Y:new f.Vector3(0,1,0),Z:new f.Vector3(0,0,1)},dn={type:"change"},Ri={type:"mouseDown"},Oi={type:"mouseUp",mode:null},Di={type:"objectChange"};class Zo extends f.Object3D{constructor(e,i){super(),i===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),i=document),this.isTransformControls=!0,this.visible=!1,this.domElement=i,this.domElement.style.touchAction="none";const r=new h1;this._gizmo=r,this.add(r);const a=new u1;this._plane=a,this.add(a);const l=this;function c(A,O){let P=O;Object.defineProperty(l,A,{get:function(){return P!==void 0?P:O},set:function(V){P!==V&&(P=V,a[A]=V,r[A]=V,l.dispatchEvent({type:A+"-changed",value:V}),l.dispatchEvent(dn))}}),l[A]=O,a[A]=O,r[A]=O}c("camera",e),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0);const h=new f.Vector3,p=new f.Vector3,u=new f.Quaternion,d=new f.Quaternion,m=new f.Vector3,v=new f.Quaternion,y=new f.Vector3,x=new f.Vector3,b=new f.Vector3,C=0,T=new f.Vector3;c("worldPosition",h),c("worldPositionStart",p),c("worldQuaternion",u),c("worldQuaternionStart",d),c("cameraPosition",m),c("cameraQuaternion",v),c("pointStart",y),c("pointEnd",x),c("rotationAxis",b),c("rotationAngle",C),c("eye",T),this._offset=new f.Vector3,this._startNorm=new f.Vector3,this._endNorm=new f.Vector3,this._cameraScale=new f.Vector3,this._parentPosition=new f.Vector3,this._parentQuaternion=new f.Quaternion,this._parentQuaternionInv=new f.Quaternion,this._parentScale=new f.Vector3,this._worldScaleStart=new f.Vector3,this._worldQuaternionInv=new f.Quaternion,this._worldScale=new f.Vector3,this._positionStart=new f.Vector3,this._quaternionStart=new f.Quaternion,this._scaleStart=new f.Vector3,this._getPointer=o1.bind(this),this._onPointerDown=a1.bind(this),this._onPointerHover=r1.bind(this),this._onPointerMove=l1.bind(this),this._onPointerUp=c1.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;Rt.setFromCamera(e,this.camera);const i=fn(this._gizmo.picker[this.mode],Rt);i?this.axis=i.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){Rt.setFromCamera(e,this.camera);const i=fn(this._plane,Rt,!0);i&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(i.point).sub(this.worldPositionStart)),this.dragging=!0,Ri.mode=this.mode,this.dispatchEvent(Ri)}}pointerMove(e){const i=this.axis,r=this.mode,a=this.object;let l=this.space;if(r==="scale"?l="local":(i==="E"||i==="XYZE"||i==="XYZ")&&(l="world"),a===void 0||i===null||this.dragging===!1||e.button!==-1)return;Rt.setFromCamera(e,this.camera);const c=fn(this._plane,Rt,!0);if(c){if(this.pointEnd.copy(c.point).sub(this.worldPositionStart),r==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),l==="local"&&i!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),i.indexOf("X")===-1&&(this._offset.x=0),i.indexOf("Y")===-1&&(this._offset.y=0),i.indexOf("Z")===-1&&(this._offset.z=0),l==="local"&&i!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),a.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(l==="local"&&(a.position.applyQuaternion(Le.copy(this._quaternionStart).invert()),i.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),i.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),i.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.position.applyQuaternion(this._quaternionStart)),l==="world"&&(a.parent&&a.position.add(Ge.setFromMatrixPosition(a.parent.matrixWorld)),i.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),i.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),i.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.parent&&a.position.sub(Ge.setFromMatrixPosition(a.parent.matrixWorld))));else if(r==="scale"){if(i.search("XYZ")!==-1){let h=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(h*=-1),Ct.set(h,h,h)}else Ge.copy(this.pointStart),Ct.copy(this.pointEnd),Ge.applyQuaternion(this._worldQuaternionInv),Ct.applyQuaternion(this._worldQuaternionInv),Ct.divide(Ge),i.search("X")===-1&&(Ct.x=1),i.search("Y")===-1&&(Ct.y=1),i.search("Z")===-1&&(Ct.z=1);a.scale.copy(this._scaleStart).multiply(Ct),this.scaleSnap&&(i.search("X")!==-1&&(a.scale.x=Math.round(a.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),i.search("Y")!==-1&&(a.scale.y=Math.round(a.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),i.search("Z")!==-1&&(a.scale.z=Math.round(a.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(r==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const h=20/this.worldPosition.distanceTo(Ge.setFromMatrixPosition(this.camera.matrixWorld));i==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):i==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Ge.copy(this.rotationAxis).cross(this.eye))*h):(i==="X"||i==="Y"||i==="Z")&&(this.rotationAxis.copy(Bi[i]),Ge.copy(Bi[i]),l==="local"&&Ge.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(Ge.cross(this.eye).normalize())*h),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),l==="local"&&i!=="E"&&i!=="XYZE"?(a.quaternion.copy(this._quaternionStart),a.quaternion.multiply(Le.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),a.quaternion.copy(Le.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),a.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(dn),this.dispatchEvent(Di)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(Oi.mode=this.mode,this.dispatchEvent(Oi)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(dn),this.dispatchEvent(Di),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Rt}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function o1(o){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:o.button};{const e=this.domElement.getBoundingClientRect();return{x:(o.clientX-e.left)/e.width*2-1,y:-(o.clientY-e.top)/e.height*2+1,button:o.button}}}function r1(o){if(this.enabled)switch(o.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(o));break}}function a1(o){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(o.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(o)),this.pointerDown(this._getPointer(o)))}function l1(o){this.enabled&&this.pointerMove(this._getPointer(o))}function c1(o){this.enabled&&(this.domElement.releasePointerCapture(o.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(o)))}function fn(o,e,i){const r=e.intersectObject(o,!0);for(let a=0;a<r.length;a++)if(r[a].object.visible||i)return r[a];return!1}const As=new f.Euler,Ee=new f.Vector3(0,1,0),Ni=new f.Vector3(0,0,0),Pi=new f.Matrix4,_s=new f.Quaternion,Gs=new f.Quaternion,rt=new f.Vector3,Vi=new f.Matrix4,us=new f.Vector3(1,0,0),Nt=new f.Vector3(0,1,0),ps=new f.Vector3(0,0,1),Bs=new f.Vector3,os=new f.Vector3,rs=new f.Vector3;class h1 extends f.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new f.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=new f.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:.008,opacity:1,fog:!1,toneMapped:!1,side:2}),r=e.clone();r.opacity=.15;const a=i.clone();a.opacity=.5;const l=e.clone();l.color.setHex(16711680);const c=e.clone();c.color.setHex(65280);const h=e.clone();h.color.setHex(255);const p=e.clone();p.color.setHex(16711680),p.opacity=.5;const u=e.clone();u.color.setHex(65280),u.opacity=.5;const d=e.clone();d.color.setHex(255),d.opacity=.5;const m=e.clone();m.opacity=.25;const v=e.clone();v.color.setHex(16776960),v.opacity=.25,e.clone().color.setHex(16776960);const x=e.clone();x.color.setHex(7895160);const b=new f.CylinderGeometry(0,.04,.1,12);b.translate(0,.05,0);const C=new f.BoxGeometry(.08,.08,.08);C.translate(0,.04,0);const T=new kn.LineGeometry;T.setPositions([0,0,0,1,0,0]);const A=new f.CylinderGeometry(.0075,.0075,.5,3);A.translate(0,.25,0);function O(ie,me){const re=new f.TorusGeometry(ie,.0075,3,64,me*Math.PI*2);return re.rotateY(Math.PI/2),re.rotateX(Math.PI/2),re}function P(){const ie=new f.BufferGeometry;return ie.setAttribute("position",new f.Float32BufferAttribute([0,0,0,1,1,1],3)),ie}const V={X:[[new f.Mesh(b,l),[.5,0,0],[0,0,-Math.PI/2]],[new f.Mesh(b,l),[-.5,0,0],[0,0,Math.PI/2]],[new f.Mesh(A,l),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new f.Mesh(b,c),[0,.5,0]],[new f.Mesh(b,c),[0,-.5,0],[Math.PI,0,0]],[new f.Mesh(A,c)]],Z:[[new f.Mesh(b,h),[0,0,.5],[Math.PI/2,0,0]],[new f.Mesh(b,h),[0,0,-.5],[-Math.PI/2,0,0]],[new f.Mesh(A,h),null,[Math.PI/2,0,0]]],XYZ:[[new f.Mesh(new f.OctahedronGeometry(.1,0),m.clone()),[0,0,0]]],XY:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),d.clone()),[.15,.15,0]]],YZ:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),p.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},B={X:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[.3,0,0],[0,0,-Math.PI/2]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,.3,0]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,-.3,0],[0,0,Math.PI]]],Z:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,0,.3],[Math.PI/2,0,0]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new f.Mesh(new f.OctahedronGeometry(.2,0),r)]],XY:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[.15,.15,0]]],YZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[.15,0,.15],[-Math.PI/2,0,0]]]},I={START:[[new f.Mesh(new f.OctahedronGeometry(.01,2),a),null,null,null,"helper"]],END:[[new f.Mesh(new f.OctahedronGeometry(.01,2),a),null,null,null,"helper"]],DELTA:[[new ft.Line2(P(),a),null,null,null,"helper"]],X:[[new ft.Line2(T,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ft.Line2(T,a.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ft.Line2(T,a.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},G={XYZE:[[new f.Mesh(O(.5,1),x),null,[0,Math.PI/2,0]]],X:[[new f.Mesh(O(.5,.5),l)]],Y:[[new f.Mesh(O(.5,.5),c),null,[0,0,-Math.PI/2]]],Z:[[new f.Mesh(O(.5,.5),h),null,[0,Math.PI/2,0]]],E:[[new f.Mesh(O(.75,1),v),null,[0,Math.PI/2,0]]]},W={AXIS:[[new ft.Line2(T,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},j={XYZE:[[new f.Mesh(new f.SphereGeometry(.25,10,8),r)]],X:[[new f.Mesh(new f.TorusGeometry(.5,.1,4,24),r),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new f.Mesh(new f.TorusGeometry(.5,.1,4,24),r),[0,0,0],[Math.PI/2,0,0]]],Z:[[new f.Mesh(new f.TorusGeometry(.5,.1,4,24),r),[0,0,0],[0,0,-Math.PI/2]]],E:[[new f.Mesh(new f.TorusGeometry(.75,.1,2,24),r)]]},H={X:[[new f.Mesh(C,l),[.5,0,0],[0,0,-Math.PI/2]],[new f.Mesh(A,l),[0,0,0],[0,0,-Math.PI/2]],[new f.Mesh(C,l),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new f.Mesh(C,c),[0,.5,0]],[new f.Mesh(A,c)],[new f.Mesh(C,c),[0,-.5,0],[0,0,Math.PI]]],Z:[[new f.Mesh(C,h),[0,0,.5],[Math.PI/2,0,0]],[new f.Mesh(A,h),[0,0,0],[Math.PI/2,0,0]],[new f.Mesh(C,h),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),p),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new f.Mesh(new f.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new f.Mesh(new f.BoxGeometry(.1,.1,.1),m.clone())]]},ee={X:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[.3,0,0],[0,0,-Math.PI/2]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,.3,0]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,-.3,0],[0,0,Math.PI]]],Z:[[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,0,.3],[Math.PI/2,0,0]],[new f.Mesh(new f.CylinderGeometry(.2,0,.6,4),r),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[.15,.15,0]]],YZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.01),r),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new f.Mesh(new f.BoxGeometry(.2,.2,.2),r),[0,0,0]]]},$={X:[[new ft.Line2(T,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ft.Line2(T,a.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ft.Line2(T,a.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function de(ie){const me=new f.Object3D;for(const re in ie)for(let be=ie[re].length;be--;){const Z=ie[re][be][0].clone(),K=ie[re][be][1],J=ie[re][be][2],Y=ie[re][be][3],ce=ie[re][be][4];Z.name=re,Z.tag=ce,K&&Z.position.set(K[0],K[1],K[2]),J&&Z.rotation.set(J[0],J[1],J[2]),Y&&Z.scale.set(Y[0],Y[1],Y[2]),Z.updateMatrix();const he=Z.geometry.clone();he.applyMatrix4(Z.matrix),Z.geometry=he,Z.renderOrder=1/0,Z.position.set(0,0,0),Z.rotation.set(0,0,0),Z.scale.set(1,1,1),me.add(Z)}return me}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=de(V)),this.add(this.gizmo.rotate=de(G)),this.add(this.gizmo.scale=de(H)),this.add(this.picker.translate=de(B)),this.add(this.picker.rotate=de(j)),this.add(this.picker.scale=de(ee)),this.add(this.helper.translate=de(I)),this.add(this.helper.rotate=de(W)),this.add(this.helper.scale=de($)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const r=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Gs;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let a=[];a=a.concat(this.picker[this.mode].children),a=a.concat(this.gizmo[this.mode].children),a=a.concat(this.helper[this.mode].children);for(let l=0;l<a.length;l++){const c=a[l];c.visible=!0,c.rotation.set(0,0,0),c.position.copy(this.worldPosition);let h;if(this.camera.isOrthographicCamera?h=(this.camera.top-this.camera.bottom)/this.camera.zoom:h=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),c.scale.set(1,1,1).multiplyScalar(h*this.size/4),c.tag==="helper"){c.visible=!1,c.name==="AXIS"?(c.position.copy(this.worldPositionStart),c.visible=!!this.axis,this.axis==="X"&&(Le.setFromEuler(As.set(0,0,0)),c.quaternion.copy(r).multiply(Le),Math.abs(Ee.copy(us).applyQuaternion(r).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="Y"&&(Le.setFromEuler(As.set(0,0,Math.PI/2)),c.quaternion.copy(r).multiply(Le),Math.abs(Ee.copy(Nt).applyQuaternion(r).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="Z"&&(Le.setFromEuler(As.set(0,Math.PI/2,0)),c.quaternion.copy(r).multiply(Le),Math.abs(Ee.copy(ps).applyQuaternion(r).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="XYZE"&&(Le.setFromEuler(As.set(0,Math.PI/2,0)),Ee.copy(this.rotationAxis),c.quaternion.setFromRotationMatrix(Pi.lookAt(Ni,Ee,Nt)),c.quaternion.multiply(Le),c.visible=this.dragging),this.axis==="E"&&(c.visible=!1)):c.name==="START"?(c.position.copy(this.worldPositionStart),c.visible=this.dragging):c.name==="END"?(c.position.copy(this.worldPosition),c.visible=this.dragging):c.name==="DELTA"?(c.position.copy(this.worldPositionStart),c.quaternion.copy(this.worldQuaternionStart),Ge.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Ge.applyQuaternion(this.worldQuaternionStart.clone().invert()),c.scale.copy(Ge),c.visible=this.dragging):(c.quaternion.copy(r),this.dragging?c.position.copy(this.worldPositionStart):c.position.copy(this.worldPosition),this.axis&&(c.visible=this.axis.search(c.name)!==-1));continue}c.quaternion.copy(r),this.mode==="translate"||this.mode==="scale"?(c.name==="X"&&Math.abs(Ee.copy(us).applyQuaternion(r).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="Y"&&Math.abs(Ee.copy(Nt).applyQuaternion(r).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="Z"&&Math.abs(Ee.copy(ps).applyQuaternion(r).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="XY"&&Math.abs(Ee.copy(ps).applyQuaternion(r).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="YZ"&&Math.abs(Ee.copy(us).applyQuaternion(r).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="XZ"&&Math.abs(Ee.copy(Nt).applyQuaternion(r).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1)):this.mode==="rotate"&&(_s.copy(r),Ee.copy(this.eye).applyQuaternion(Le.copy(r).invert()),c.name.search("E")!==-1&&c.quaternion.setFromRotationMatrix(Pi.lookAt(this.eye,Ni,Nt)),c.name==="X"&&(Le.setFromAxisAngle(us,Math.atan2(-Ee.y,Ee.z)),Le.multiplyQuaternions(_s,Le),c.quaternion.copy(Le)),c.name==="Y"&&(Le.setFromAxisAngle(Nt,Math.atan2(Ee.x,Ee.z)),Le.multiplyQuaternions(_s,Le),c.quaternion.copy(Le)),c.name==="Z"&&(Le.setFromAxisAngle(ps,Math.atan2(Ee.y,Ee.x)),Le.multiplyQuaternions(_s,Le),c.quaternion.copy(Le))),c.visible=c.visible&&(c.name.indexOf("X")===-1||this.showX),c.visible=c.visible&&(c.name.indexOf("Y")===-1||this.showY),c.visible=c.visible&&(c.name.indexOf("Z")===-1||this.showZ),c.visible=c.visible&&(c.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),c.material._color=c.material._color||c.material.color.clone(),c.material._opacity=c.material._opacity||c.material.opacity,c.material.color.copy(c.material._color),c.material.opacity=c.material._opacity,this.enabled&&this.axis&&(c.name===this.axis||this.axis.split("").some(function(p){return c.name===p}))&&(c.material.color.setHex(16776960),c.material.opacity=1)}super.updateMatrixWorld(e)}}class u1 extends f.Mesh{constructor(){super(new f.PlaneGeometry(1e5,1e5,2,2),new f.MeshBasicMaterial({visible:!1,wireframe:!0,side:f.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let i=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(i="local"),Bs.copy(us).applyQuaternion(i==="local"?this.worldQuaternion:Gs),os.copy(Nt).applyQuaternion(i==="local"?this.worldQuaternion:Gs),rs.copy(ps).applyQuaternion(i==="local"?this.worldQuaternion:Gs),Ee.copy(os),this.mode){case"translate":case"scale":switch(this.axis){case"X":Ee.copy(this.eye).cross(Bs),rt.copy(Bs).cross(Ee);break;case"Y":Ee.copy(this.eye).cross(os),rt.copy(os).cross(Ee);break;case"Z":Ee.copy(this.eye).cross(rs),rt.copy(rs).cross(Ee);break;case"XY":rt.copy(rs);break;case"YZ":rt.copy(Bs);break;case"XZ":Ee.copy(rs),rt.copy(os);break;case"XYZ":case"E":rt.set(0,0,0);break}break;case"rotate":default:rt.set(0,0,0)}rt.length()===0?this.quaternion.copy(this.cameraQuaternion):(Vi.lookAt(Ge.set(0,0,0),rt,Ee),this.quaternion.setFromRotationMatrix(Vi)),super.updateMatrixWorld(e)}}let p1=class{constructor(e,i){L(this,"renderer");L(this,"element");L(this,"camera");L(this,"globalPlanes");L(this,"localPlanes");L(this,"boxVertices");L(this,"planes");L(this,"boxMeshs");L(this,"localMesh");L(this,"meshs");L(this,"objects");L(this,"control");L(this,"group");L(this,"dragControl");L(this,"transControl");L(this,"clippingType");L(this,"callBack");L(this,"setParam");this.renderer=e.renderer,this.element=e.element,this.camera=e.camera,this.objects=e.objs,this.clippingType="",this.localPlanes=[],this.boxVertices={},this.boxMeshs={},this.planes={},this.globalPlanes=[],this.group=e.containerGroup,e.controlType=="orbit"?this.control=e.orbitControl:e.controlType=="fly"?this.control=e.flyControl:this.control=e.firstControl,this.meshs=[],this.callBack=i.callBackFun,this.setParam=i.set,this.computedClippingPlane(),this.initEvents()}setClippingType(e){if(e=="global"){this.renderer.localClippingEnabled=!0,this.dragControl.enabled=!1;for(const i in this.boxMeshs)this.boxMeshs[i].visible=!1;this.transControl.visible=!0,this.transControl.enabled=!0,this.localMesh.visible=!0,this.transControl.attach(this.localMesh),this.setLocalClipping(!0)}else if(e=="local"){this.renderer.localClippingEnabled=!0,this.dragControl.enabled=!0;for(const i in this.boxMeshs)this.boxMeshs[i].visible=!0;this.transControl.visible=!1,this.transControl.enabled=!1,this.localMesh.visible=!1,this.setLocalClipping(!1)}}setLocalClipping(e){for(const i in this.objects)this.objects[i].traverse(r=>{if(r instanceof f.Mesh||r instanceof f.Line)if(r.material instanceof Array)r.material.forEach(a=>{a.clippingPlanes=e?this.localPlanes:this.globalPlanes,a.clipIntersection=e});else{const a=r.material;a.clipIntersection=e,a.clippingPlanes=e?this.localPlanes:this.globalPlanes}})}computedClippingPlane(){const e=new f.Box3;for(const v in this.objects)e.expandByObject(this.objects[v]);const i=e.min,r=e.max,a=new f.Vector3((r.x+i.x)/2,r.y,(r.z+i.z)/2),l=r.distanceTo(i)/4,c=Math.floor(i.x),h=Math.ceil(r.x),p=Math.floor(i.y),u=Math.ceil(r.y),d=Math.floor(i.z),m=Math.ceil(r.z);this.boxVertices.v7=new f.Vector3(c,p,d),this.boxVertices.v2=new f.Vector3(c,p,m),this.boxVertices.v6=new f.Vector3(c,u,d),this.boxVertices.v1=new f.Vector3(c,u,m),this.boxVertices.v4=new f.Vector3(h,p,d),this.boxVertices.v3=new f.Vector3(h,p,m),this.boxVertices.v5=new f.Vector3(h,u,d),this.boxVertices.v0=new f.Vector3(h,u,m),this.injectMeshsAndLine(this.group),this.updateMeshsAndLine(),this.setGlobalMesh(this.group,a,l),this.callBack&&this.callBack({x:[c,h],y:[p,u],z:[d,m]})}setGlobalMesh(e,i,r){const a=new f.Vector3(r,0,r),l=new f.Vector3(-r,0,r),c=new f.Vector3(-r,0,-r),h=new f.Vector3(r,0,-r);this.localMesh=this.createMesh("global",.2,2),this.localMesh.geometry.setFromPoints([l,a,h,h,c,l]),this.localMesh.position.copy(i),this.localMesh.visible=!1,e.add(this.localMesh);const p=new f.Plane;a.y=i.y,l.y=i.y,c.y=i.y,p.setFromCoplanarPoints(a,l,c),this.localPlanes.push(p),this.setLocalClipping(!0)}createMesh(e,i,r){const a=new f.BufferGeometry,l=new f.MeshBasicMaterial({color:6799930,transparent:!0,opacity:i||0,side:r||0}),c=new f.Mesh(a,l);switch(c.name=e,e){case"left":this.planes[e]=new f.Plane(new f.Vector3(1,0,0),100);break;case"right":this.planes[e]=new f.Plane(new f.Vector3(-1,0,0),100);break;case"top":this.planes[e]=new f.Plane(new f.Vector3(0,-1,0),100);break;case"bottom":this.planes[e]=new f.Plane(new f.Vector3(0,1,0),100);break;case"front":this.planes[e]=new f.Plane(new f.Vector3(0,0,-1),100);break;case"back":this.planes[e]=new f.Plane(new f.Vector3(0,0,1),100);break}return c}createLine(){const e=new f.BufferGeometry,i=new f.LineBasicMaterial({color:3309539});return new f.Line(e,i)}injectMeshsAndLine(e){this.boxMeshs.left=this.createMesh("left"),this.boxMeshs.right=this.createMesh("right"),this.boxMeshs.bottom=this.createMesh("bottom"),this.boxMeshs.top=this.createMesh("top"),this.boxMeshs.front=this.createMesh("front"),this.boxMeshs.back=this.createMesh("back"),this.boxMeshs.line=this.createLine();for(const i in this.boxMeshs)this.boxMeshs[i].visible=!1;for(const i in this.planes)this.globalPlanes.push(this.planes[i]);e.add(this.boxMeshs.left,this.boxMeshs.right,this.boxMeshs.bottom,this.boxMeshs.top,this.boxMeshs.front,this.boxMeshs.back,this.boxMeshs.line),this.meshs.push(this.boxMeshs.left,this.boxMeshs.right,this.boxMeshs.bottom,this.boxMeshs.top,this.boxMeshs.front,this.boxMeshs.back)}updateMeshsAndLine(){const e=[this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v6,this.boxVertices.v6,this.boxVertices.v2,this.boxVertices.v1],i=[this.boxVertices.v4,this.boxVertices.v5,this.boxVertices.v3,this.boxVertices.v5,this.boxVertices.v0,this.boxVertices.v3],r=[this.boxVertices.v4,this.boxVertices.v3,this.boxVertices.v2,this.boxVertices.v2,this.boxVertices.v7,this.boxVertices.v4],a=[this.boxVertices.v1,this.boxVertices.v0,this.boxVertices.v5,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v1],l=[this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v0,this.boxVertices.v2,this.boxVertices.v0,this.boxVertices.v1],c=[this.boxVertices.v5,this.boxVertices.v4,this.boxVertices.v7,this.boxVertices.v7,this.boxVertices.v6,this.boxVertices.v5],h=[this.boxVertices.v0,this.boxVertices.v1,this.boxVertices.v0,this.boxVertices.v3,this.boxVertices.v0,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v1,this.boxVertices.v6,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v1,this.boxVertices.v2,this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v4,this.boxVertices.v3,this.boxVertices.v4,this.boxVertices.v5,this.boxVertices.v4,this.boxVertices.v7];this.boxMeshs.left.geometry.setFromPoints(e),this.boxMeshs.right.geometry.setFromPoints(i),this.boxMeshs.bottom.geometry.setFromPoints(r),this.boxMeshs.top.geometry.setFromPoints(a),this.boxMeshs.front.geometry.setFromPoints(l),this.boxMeshs.back.geometry.setFromPoints(c),this.boxMeshs.line.geometry.setFromPoints(h);for(const p in this.boxMeshs)this.boxMeshs[p].geometry.computeBoundingSphere();this.planes.left.setFromCoplanarPoints(this.boxVertices.v6,this.boxVertices.v2,this.boxVertices.v7),this.planes.right.setFromCoplanarPoints(this.boxVertices.v3,this.boxVertices.v5,this.boxVertices.v4),this.planes.top.setFromCoplanarPoints(this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v4),this.planes.bottom.setFromCoplanarPoints(this.boxVertices.v5,this.boxVertices.v0,this.boxVertices.v1),this.planes.front.setFromCoplanarPoints(this.boxVertices.v0,this.boxVertices.v3,this.boxVertices.v2),this.planes.back.setFromCoplanarPoints(this.boxVertices.v7,this.boxVertices.v4,this.boxVertices.v5)}changeBoxCutting(e,i){i=="x"?(this.boxVertices.v2.x=e.x[0],this.boxVertices.v7.x=e.x[0],this.boxVertices.v6.x=e.x[0],this.boxVertices.v1.x=e.x[0],this.boxVertices.v0.x=e.x[1],this.boxVertices.v3.x=e.x[1],this.boxVertices.v4.x=e.x[1],this.boxVertices.v5.x=e.x[1]):i=="y"?(this.boxVertices.v0.y=e.y[1],this.boxVertices.v1.y=e.y[1],this.boxVertices.v6.y=e.y[1],this.boxVertices.v5.y=e.y[1],this.boxVertices.v2.y=e.y[0],this.boxVertices.v3.y=e.y[0],this.boxVertices.v4.y=e.y[0],this.boxVertices.v7.y=e.y[0]):i=="z"&&(this.boxVertices.v0.z=e.z[1],this.boxVertices.v1.z=e.z[1],this.boxVertices.v2.z=e.z[1],this.boxVertices.v3.z=e.z[1],this.boxVertices.v4.z=e.z[0],this.boxVertices.v5.z=e.z[0],this.boxVertices.v6.z=e.z[0],this.boxVertices.v7.z=e.z[0]),this.updateMeshsAndLine()}initEvents(){this.dragControl=new Xo(this.meshs,this.camera,this.element),this.dragControl.enabled=!1,this.dragControl.addEventListener("dragstart",()=>{this.control.enabled=!1}),this.dragControl.addEventListener("dragend",()=>{this.control.enabled=!0}),this.dragControl.addEventListener("hoveron",e=>{this.resetMaterial();const i=e.object;i.material.opacity=.5}),this.dragControl.addEventListener("hoveroff",()=>{this.resetMaterial()}),this.dragControl.addEventListener("drag",e=>{const i=e.object,r=e.point;switch(i.name){case"left":this.boxVertices.v7.x=r.x,this.boxVertices.v6.x=r.x,this.boxVertices.v2.x=r.x,this.boxVertices.v1.x=r.x;break;case"right":this.boxVertices.v0.x=r.x,this.boxVertices.v3.x=r.x,this.boxVertices.v4.x=r.x,this.boxVertices.v5.x=r.x;break;case"top":this.boxVertices.v0.y=r.y,this.boxVertices.v1.y=r.y,this.boxVertices.v6.y=r.y,this.boxVertices.v5.y=r.y;break;case"bottom":this.boxVertices.v2.y=r.y,this.boxVertices.v3.y=r.y,this.boxVertices.v4.y=r.y,this.boxVertices.v7.y=r.y;break;case"front":this.boxVertices.v0.z=r.z,this.boxVertices.v1.z=r.z,this.boxVertices.v2.z=r.z,this.boxVertices.v3.z=r.z;break;case"back":this.boxVertices.v4.z=r.z,this.boxVertices.v5.z=r.z,this.boxVertices.v6.z=r.z,this.boxVertices.v7.z=r.z;break}this.updateMeshsAndLine(),this.setParam&&this.setParam({x:[this.boxVertices.v7.x,this.boxVertices.v0.x],y:[this.boxVertices.v7.y,this.boxVertices.v0.y],z:[this.boxVertices.v7.z,this.boxVertices.v0.z]})}),this.transControl=new Zo(this.camera,this.element),this.transControl.setMode("rotate"),this.transControl.enabled=!1,this.transControl.addEventListener("objectChange",()=>{this.updateLocalPlane()}),this.transControl.addEventListener("dragging-changed",e=>{this.control.enabled=!e.value}),this.group.add(this.transControl),this.transControl.visible=!1}resetMaterial(){this.meshs.forEach(e=>{e.material.opacity=0})}updateLocalPlane(){const e=this.localMesh.geometry.attributes.position,i=new f.Vector3(e.getX(0),e.getY(0),e.getZ(0)),r=new f.Vector3(e.getX(1),e.getY(1),e.getZ(1)),a=new f.Vector3(e.getX(2),e.getY(2),e.getZ(2));i.applyMatrix4(this.localMesh.matrix),r.applyMatrix4(this.localMesh.matrix),a.applyMatrix4(this.localMesh.matrix),this.localPlanes[0].setFromCoplanarPoints(a,r,i)}detory(){this.renderer.localClippingEnabled=!1,this.setLocalClipping(!1);for(const e in this.boxMeshs)this.boxMeshs[e].geometry.dispose(),this.boxMeshs[e].material.dispose(),this.group.remove(this.boxMeshs[e]);this.localMesh.geometry.dispose(),this.localMesh.material.dispose(),this.group.remove(this.localMesh),this.globalPlanes.length=0,this.localPlanes.length=0,this.dragControl.dispose(),this.transControl.dispose(),this.group.remove(this.transControl)}};const d1={class:"cutting-box"},f1={class:"cutting-item"},m1={class:"slider"},g1={class:"cutting-item"},y1={class:"slider"},v1={class:"cutting-item"},b1={class:"slider"},x1=g.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},currentActive:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a}=g.toRefs(i);let l;const c=g.ref({x:{min:-1e5,max:1e5},y:{min:-1e5,max:1e5},z:{min:-1e5,max:1e5}}),h=g.ref(""),p=v=>{h.value=v,l&&l.setClippingType(v)},u=g.ref({x:[0,0],y:[0,0],z:[0,0]}),d=(v,y)=>{const x={x:[0,0],y:[0,0],z:[0,0]};x[v]=y,l&&l.changeBoxCutting(x,v)};function m(v){var y,x;(y=a.value)!=null&&y.closeCallback&&((x=a.value)==null||x.closeCallback(v))}return g.onMounted(()=>{r.value&&r.value.rayCasterManager.setEventHandler(null),l=new p1(r.value,{callBackFun:v=>{Object.entries(v).forEach(([y,x])=>{c.value[y]={min:x[0],max:x[1]},u.value[y]=x})},set:v=>{Object.entries(v).forEach(([y,x])=>{u.value[y]=x})}})}),g.onBeforeUnmount(()=>{var v,y,x,b,C;l&&l.detory(),!((v=i.currentActive)!=null&&v.measure||(y=i.currentActive)!=null&&y.comInfo)&&r.value&&(Array.isArray((x=r.value.options)==null?void 0:x.rayCaster)?(b=r.value.options.rayCaster)!=null&&b.length:(C=r.value.options.rayCaster)!=null&&C.type)&&r.value&&r.value.rayCasterManager.setEventHandler(r.value.options.rayCaster)}),e({setCurrentType:p}),(v,y)=>g.unref(h)==="local"?(g.openBlock(),g.createBlock(zt,g.mergeProps({key:0,ref:"CardRef","close-callback":m},{resize:!1,drag:!0,close:!0,title:"局部剖切",...g.unref(a)}),{default:g.withCtx(()=>[g.createElementVNode("div",d1,[g.createElementVNode("div",f1,[y[6]||(y[6]=g.createElementVNode("div",{class:"label"},"x",-1)),g.createElementVNode("div",m1,[g.createVNode(g.unref(Se.ElSlider),{modelValue:g.unref(u).x,"onUpdate:modelValue":y[0]||(y[0]=x=>g.unref(u).x=x),range:"",size:"small",min:g.unref(c).x.min,max:g.unref(c).x.max,"show-tooltip":!1,onInput:y[1]||(y[1]=x=>d("x",g.unref(u).x))},null,8,["modelValue","min","max"])])]),g.createElementVNode("div",g1,[y[7]||(y[7]=g.createElementVNode("div",{class:"label"},"y",-1)),g.createElementVNode("div",y1,[g.createVNode(g.unref(Se.ElSlider),{modelValue:g.unref(u).y,"onUpdate:modelValue":y[2]||(y[2]=x=>g.unref(u).y=x),range:"",size:"small",min:g.unref(c).y.min,max:g.unref(c).y.max,"show-tooltip":!1,onInput:y[3]||(y[3]=x=>d("y",g.unref(u).y))},null,8,["modelValue","min","max"])])]),g.createElementVNode("div",v1,[y[8]||(y[8]=g.createElementVNode("div",{class:"label"},"z",-1)),g.createElementVNode("div",b1,[g.createVNode(g.unref(Se.ElSlider),{modelValue:g.unref(u).z,"onUpdate:modelValue":y[4]||(y[4]=x=>g.unref(u).z=x),range:"",size:"small",min:g.unref(c).z.min,max:g.unref(c).z.max,"show-tooltip":!1,onInput:y[5]||(y[5]=x=>d("z",g.unref(u).z))},null,8,["modelValue","min","max"])])])])]),_:1},16)):g.createCommentVNode("",!0)}});const C1=Ue(x1,[["__scopeId","data-v-021484ab"]]),w1={class:"base-info-box"},E1={class:"descriptions-box"},S1={class:"label"},T1={class:"content"},L1=g.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},otherInfo:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a}=g.toRefs(i),l=g.ref(),c=()=>{var d;return(d=l.value)==null?void 0:d.getBoundingClientRect()};function h(d){var m,v;(m=a.value)!=null&&m.closeCallback&&((v=a.value)==null||v.closeCallback(d))}const p=g.ref([{label:"构件数量",value:0},{label:"三角面数量",value:0},{label:"顶点数量",value:0}]);function u(){var y,x,b,C;if(!r.value)return;const d=new Set(Object.keys((y=r.value)==null?void 0:y.allMesh)).size;d&&(p.value[0].value=d);let m=0,v=0;for(let T in(x=r.value)==null?void 0:x.objs)((b=r.value)==null?void 0:b.objs[T]).children.forEach(O=>{var P;if(O!=null&&O.isMesh){const V=O==null?void 0:O.geometry;V.index?m+=((P=V.index)==null?void 0:P.count)/3:m+=V.attributes.position.count/3}if(O!=null&&O.isMesh||O!=null&&O.isLine||O.isPoints){const V=O==null?void 0:O.geometry;V!=null&&V.isBufferGeometry?v+=V.attributes.position.count:V!=null&&V.isGeometry&&(v+=V.vertices.length)}});m&&(p.value[1].value=m),v&&(p.value[2].value=m),v&&(p.value[2].value=v),(C=i.otherInfo)!=null&&C.length&&p.value.push(...i.otherInfo)}return g.onMounted(()=>{u()}),e({getCardDOMRect:c}),(d,m)=>(g.openBlock(),g.createBlock(zt,g.mergeProps({ref_key:"CardRef",ref:l,"close-callback":h},{resize:!1,drag:!0,close:!0,title:"基础信息",...g.unref(a)}),{default:g.withCtx(()=>[g.createElementVNode("div",w1,[g.createElementVNode("div",E1,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(p),v=>(g.openBlock(),g.createElementBlock("div",{class:"descriptions-item",key:v.label},[g.createElementVNode("div",S1,[g.createVNode(vt,{text:v.label},null,8,["text"])]),g.createElementVNode("div",T1,[g.createVNode(vt,{text:v.value},null,8,["text"])])]))),128))])])]),_:1},16))}});const k1=Ue(L1,[["__scopeId","data-v-102dd608"]]),M1={class:"config-box"},I1={class:"inner-config-box"},A1={class:"config-item"},_1={class:"value-box"},B1={class:"config-item"},R1={class:"color-box"},O1=["onClick"],D1={class:"color-item"},N1=g.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},otherInfo:{}},setup(o,{expose:e}){var b;const i=o,{viewer:r,cardConfig:a,otherInfo:l}=g.toRefs(i),c=g.ref(!1);function h(C){c.value=C}function p(C){var T;h(!1),(T=a.value)!=null&&T.closeCallback&&a.value.closeCallback(C)}const u=g.ref(["linear-gradient(lightblue, white)","linear-gradient(#5c5c5c, white)","linear-gradient(#272727, white)","linear-gradient(#32475b, white)","linear-gradient(#32475b, white)"]);let d=!0;const m=g.ref({modelLine:((b=l.value)==null?void 0:b.modelLine)||!1,activeBg:0}),v=C=>{if(C)if(d){for(let T in r.value.objs)r.value.objs[T].children.map(O=>{const P=O.geometry.clone(),V=new f.EdgesGeometry(P),B=new f.LineSegments(V,new f.LineBasicMaterial({color:"#5c5c5c"}));B.userData.type="edge",r.value.scene.add(B)});d=!1}else r.value.scene.children.map(T=>{T.userData.type==="edge"&&(T.visible=!0)});else r.value.scene.children.map(T=>{T.userData.type==="edge"&&(T.visible=!1)})},y=C=>{var O;const T=(O=C.target)==null?void 0:O.files,A=new FileReader;A.readAsDataURL(T[0]),A.onload=()=>{if(A.result.startsWith("data:image/"))u.value.push(`url(${A.result})`),x(u.value.length-1);else return Se.ElMessage("文件类型错误.")}},x=C=>{r.value.element.style.backgroundImage=u.value[C],m.value.activeBg=C};return g.onMounted(async()=>{var C;h(!0),(C=l.value)!=null&&C.bgColor&&u.value.push(...l.value.bgColor)}),e({show:c,setShow:h,close}),(C,T)=>(g.openBlock(),g.createBlock(zt,g.mergeProps({style:{visibility:g.unref(c)?"visible":"hidden"},"close-callback":p},{resize:!1,drag:!0,close:!0,title:"基础信息",...g.unref(a)}),{default:g.withCtx(()=>[g.createElementVNode("div",M1,[g.createElementVNode("div",I1,[g.createElementVNode("div",A1,[T[1]||(T[1]=g.createElementVNode("div",{class:"label"},"模型线框",-1)),g.createElementVNode("div",_1,[g.createVNode(g.unref(Se.ElCheckbox),{modelValue:g.unref(m).modelLine,"onUpdate:modelValue":T[0]||(T[0]=A=>g.unref(m).modelLine=A),onChange:v,label:"显示模型线框"},null,8,["modelValue"])])]),g.createElementVNode("div",B1,[T[2]||(T[2]=g.createElementVNode("div",{class:"label"},"背景颜色",-1)),g.createElementVNode("div",R1,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(u),(A,O)=>(g.openBlock(),g.createElementBlock("div",{class:"color-item",key:O,style:g.normalizeStyle({backgroundImage:A,border:g.unref(m).activeBg===O?"1px solid var(--el-color-primary)":"transparent"}),onClick:P=>x(O)},null,12,O1))),128)),g.createElementVNode("div",D1,[g.createVNode(ht,{name:"upload",size:"20px",color:"var(--el-color-primary)",cur:"pointer"}),g.createElementVNode("input",{type:"file",accept:"image/*",class:"upload-btn",onChange:y},null,32)])])])])])]),_:1},16,["style"]))}});const P1=Ue(N1,[["__scopeId","data-v-464a671e"]]),V1={class:"roam-box"},F1={class:"option-card-box"},U1={class:"descriptions-box"},G1={class:"label"},z1={class:"content"},H1={class:"option-btn-box"},j1={class:"option-item"},W1={class:"option-btn"},X1={class:"option-item"},Z1={class:"option-btn"},Y1={class:"exit-btn"},K1=g.defineComponent({__name:"index",props:{viewer:{},cardConfig:{},state:{}},setup(o,{expose:e}){const i=o,{viewer:r,cardConfig:a,state:l}=g.toRefs(i),c=g.ref(!0),h=b=>{c.value=b},p=g.ref(),u=()=>{var b;return(b=p.value)==null?void 0:b.getBoundingClientRect()};function d(b){var C,T;(C=a.value)!=null&&C.closeCallback&&((T=a.value)==null||T.closeCallback(b))}const m=g.ref([{label:"W",value:"向前移动"},{label:"S",value:"向后移动"},{label:"A",value:"向左移动"},{label:"D",value:"向右移动"},{label:"Q",value:"视角向左转动"},{label:"E",value:"视角向右转动"},{label:"R",value:"整体向上移动"},{label:"F",value:"整体向下移动"},{label:"鼠标中键",value:"滚轮放大缩小"},{label:"鼠标右键",value:"拖拽改变视角"}]),v=g.ref(0),y=g.ref(0),x=()=>{r.value.setControl(l.value,{moveSpeed:v.value,rotateSpeed:y.value})};return g.onMounted(()=>{r.value&&r.value.rayCasterManager.setEventHandler(void 0),x()}),g.onBeforeUnmount(()=>{var b,C;r.value.setControl("exist",{}),r.value&&(Array.isArray(r.value.options.rayCaster)?(b=r.value.options.rayCaster)!=null&&b.length:(C=r.value.options.rayCaster)!=null&&C.type)&&r.value&&r.value.rayCasterManager.setEventHandler(r.value.options.rayCaster)}),e({getCardDOMRect:u}),(b,C)=>(g.openBlock(),g.createElementBlock("div",V1,[g.createVNode(zt,g.mergeProps({style:{visibility:g.unref(c)?"visible":"hidden"},ref_key:"CardRef",ref:p},{resize:!1,drag:!0,close:!0,title:"操作说明",...g.unref(a)},{"close-callback":()=>h(!1)}),{default:g.withCtx(()=>[g.createElementVNode("div",F1,[g.createElementVNode("div",U1,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(m),T=>(g.openBlock(),g.createElementBlock("div",{class:"descriptions-item",key:T.label},[g.createElementVNode("div",G1,[g.createVNode(vt,{text:T.label},null,8,["text"])]),g.createElementVNode("div",z1,[g.createVNode(vt,{text:T.value},null,8,["text"])])]))),128))])])]),_:1},16,["style","close-callback"]),g.createElementVNode("div",H1,[g.createElementVNode("div",j1,[C[4]||(C[4]=g.createElementVNode("div",{class:"option-label"},"飞行速度",-1)),g.createElementVNode("div",W1,[g.createVNode(g.unref(Se.ElInputNumber),{modelValue:g.unref(v),"onUpdate:modelValue":C[0]||(C[0]=T=>g.isRef(v)?v.value=T:null),step:5,min:5,max:200,"controls-position":"right",size:"small","value-on-clear":5,onChange:x,style:{width:"80px"}},null,8,["modelValue"])])]),g.createElementVNode("div",X1,[C[5]||(C[5]=g.createElementVNode("div",{class:"option-label"},"镜头灵敏度",-1)),g.createElementVNode("div",Z1,[g.createVNode(g.unref(Se.ElInputNumber),{modelValue:g.unref(y),"onUpdate:modelValue":C[1]||(C[1]=T=>g.isRef(y)?y.value=T:null),step:5,min:5,max:200,"controls-position":"right",size:"small","value-on-clear":5,onChange:x,style:{width:"80px"}},null,8,["modelValue"])])]),g.createElementVNode("span",{onClick:C[2]||(C[2]=T=>h(!g.unref(c)))},[g.createVNode(ht,{name:"instruction","tool-tip-content":"操作说明",color:g.unref(c)?"var(--el-color-primary)":"",cur:"pointer"},null,8,["color"])]),g.createElementVNode("div",Y1,[g.createVNode(g.unref(Se.ElButton),{type:"danger",plain:"",size:"small",onClick:C[3]||(C[3]=T=>d())},{default:g.withCtx(()=>C[6]||(C[6]=[g.createTextVNode("退出")])),_:1})])])]))}});const q1=Ue(K1,[["__scopeId","data-v-17942138"]]),Q1=["onClick"],J1=["onClick"],$1=["onClick"],Rs="20px",Yo=g.defineComponent({__name:"index",props:{leave:{default:1},utils:{},keyPath:{default:()=>[]},currentActive:{}},emits:["handleSelect"],setup(o,{emit:e}){const i=e,r=o,a=(h,p)=>{var u;if(p&&((u=r.currentActive)!=null&&u[p]))return!0;if(h.children&&Object.keys(h.children).length>0)for(const d in h.children){const m=h.children[d];if(a(m,d))return!0}return!1};function l(h){let p=[];u(h),p!=null&&p.length&&c(p);function u(d,m){var v;if(m&&((v=r.currentActive)!=null&&v[m])&&p.push(m),d.children&&Object.keys(d.children).length>0)for(const y in d.children)u(d.children[y],y)}}function c(h,p){i("handleSelect",h,p)}return(h,p)=>(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(h.utils,(u,d)=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:u.name},[u.children?(g.openBlock(),g.createBlock(g.unref(Se.ElSubMenu),{key:0,index:u.name,class:g.normalizeClass({"is-active2":a(u)})},{title:g.withCtx(()=>[g.createElementVNode("div",{class:"icon-box",onClick:m=>l(u)},[h.leave>1?(g.openBlock(),g.createBlock(ht,{key:0,name:u.icon,size:Rs,"right-text":u.name,"icon-style":{marginRight:"8px"}},null,8,["name","right-text"])):(g.openBlock(),g.createBlock(ht,{key:1,name:u.icon,size:Rs,"use-parent-trigger":""},null,8,["name"]))],8,Q1)]),default:g.withCtx(()=>[g.createVNode(Yo,{utils:u==null?void 0:u.children,leave:h.leave+1,"key-path":[...h.keyPath,d],"current-active":h.currentActive,onHandleSelect:c},null,8,["utils","leave","key-path","current-active"])]),_:2},1032,["index","class"])):(g.openBlock(),g.createBlock(g.unref(Se.ElMenuItem),{key:1,index:u.name,class:g.normalizeClass({"is-active2":h.currentActive[d]})},{default:g.withCtx(()=>[h.leave>1?(g.openBlock(),g.createElementBlock("div",{key:0,class:"icon-box",onClick:m=>c(d,[...h.keyPath,d])},[g.createVNode(ht,{name:u.icon,size:Rs,"right-text":u.name,"icon-style":{marginRight:"8px"}},null,8,["name","right-text"])],8,J1)):(g.openBlock(),g.createElementBlock("div",{key:1,class:"icon-box",onClick:m=>c(d,[...h.keyPath,d])},[g.createVNode(ht,{name:u.icon,size:Rs,"tool-tip-content":u.name,"use-parent-trigger":""},null,8,["name","tool-tip-content"])],8,$1))]),_:2},1032,["index","class"]))],64))),128))}}),ec={class:"utils-menu-box"},tc=g.defineComponent({__name:"index",props:{show:{type:Boolean},viewer:{},options:{}},setup(o,{expose:e}){const i=o,{viewer:r}=g.toRefs(i),a=g.ref(!0),l=g.ref({}),c=g.ref({}),h=g.ref({}),p=(V,B,I)=>{var G,W,j,H;if(B){const{left:ee,top:$}=r.value.element.getBoundingClientRect(),{width:de,height:ie,left:me,top:re}=B;h.value[V]={size:{height:ie+"px",width:de+"px"},position:{left:me-ee+"px",top:re-$+"px"}},(W=(G=I==null?void 0:I.cardConfig)==null?void 0:G.size)!=null&&W.width||delete h.value[V].size.width,(H=(j=I==null?void 0:I.cardConfig)==null?void 0:j.size)!=null&&H.height||delete h.value[V].size.height}},u=g.ref(),d=g.ref(),m=g.ref(),v=g.ref(),y=g.ref(),x=g.ref(),b=g.ref(),C=(V,B)=>{(Array.isArray(V)?V:[V]).forEach(W=>{var ee;const j=!c.value[W];let H;j?(H=P(l.value,B!=null&&B.length?B:[W]),!(H!=null&&H.children)&&(H!=null&&H.active)&&(c.value[W]=H,(ee=H.conflictKey)!=null&&ee.length&&T(H.conflictKey)),G(W,j?H:c.value[W])):T([W])}),A();function G(W,j){var H,ee,$,de,ie;switch(j!=null&&j.activeCallback&&(j==null||j.activeCallback()),W){case"review":(H=r.value)==null||H.resetView();break;case"tree":u.value?u.value.open():u.value=St(Ol,{viewer:r.value,config:j.config,cardConfig:{closeCallback:()=>C(["tree"]),...j.cardConfig}},r.value.element.parentElement);break;case"fly":case"person":b.value=St(q1,{viewer:r.value,cardConfig:{closeCallback:()=>C([W]),...j.cardConfig},state:W},r.value.element.parentElement),a.value=!1;break;case"screenshot":(ee=r.value)==null||ee.renderScene();const me=r.value.element.toDataURL((j==null?void 0:j.type)||"image/png",(j==null?void 0:j.quality)||1);if((j==null?void 0:j.download)!==!1){const re=atob(me.split(",")[1]),be=me.split(",")[0].split(":")[1].split(";")[0],Z=new ArrayBuffer(re.length),K=new Uint8Array(Z);for(let he=0;he<re.length;he++)K[he]=re.charCodeAt(he);const J=new Blob([K],{type:be}),Y=URL.createObjectURL(J),ce=document.createElement("a");ce.href=Y,ce.download="scene.png",ce.click(),URL.revokeObjectURL(Y)}j!=null&&j.screenshotCallback&&(j==null||j.screenshotCallback(me));break;case"global":case"local":v.value||(v.value=St(C1,{viewer:r.value,cardConfig:{closeCallback:re=>{C(["local"])},...j.cardConfig,...h.value[W]},currentActive:c.value},r.value.element.parentElement)),($=r.value)==null||$.resetView(),(de=v.value)==null||de.setCurrentType(W);break;case"measure":d.value=St(Xl,{viewer:r.value,cardConfig:{closeCallback:re=>{C([W])},...j.cardConfig,...h.value[W]}},r.value.element.parentElement);break;case"comInfo":m.value=St(i1,{viewer:r.value,cardConfig:{closeCallback:re=>{C([W])},...j.cardConfig,...h.value[W]}},r.value.element.parentElement);break;case"fullScreen":document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen();break;case"baseInfo":y.value=St(k1,{viewer:r.value,cardConfig:{closeCallback:re=>{C([W])},...j.cardConfig,...h.value[W]},otherInfo:j==null?void 0:j.otherInfo},r.value.element.parentElement);break;case"config":x.value?(ie=x.value)==null||ie.setShow(!0):x.value=St(P1,{viewer:r.value,cardConfig:{closeCallback:()=>C(["config"]),...j.cardConfig},otherInfo:j==null?void 0:j.otherInfo},r.value.element.parentElement);break;default:return}}};function T(V){V.forEach(B=>{var I,G,W,j,H;switch(B){case"tree":u.value&&u.value.show&&u.value.setShow(!1);break;case"fly":case"person":b.value&&(p(B,b.value.getCardDOMRect(),c.value[B]),(I=b.value)==null||I.destroy(),b.value=void 0),a.value=!0;break;case"measure":d.value&&(p(B,d.value.getCardDOMRect(),c.value[B]),(G=d.value)==null||G.destroy(),d.value=void 0);break;case"comInfo":m.value&&(p(B,m.value.getCardDOMRect(),c.value[B]),(W=m.value)==null||W.destroy(),m.value=void 0);break;case"global":case"local":v.value&&((j=v.value)==null||j.setCurrentType(""));break;case"baseInfo":y.value&&(p(B,y.value.getCardDOMRect(),c.value[B]),(H=y.value)==null||H.destroy(),y.value=void 0);break;case"config":x.value&&x.value.show&&x.value.setShow(!1);break}c.value[B]=void 0})}function A(){var V,B,I;switch(!0){case(!((V=c.value)!=null&&V.global)&&!((B=c.value)!=null&&B.local)):v.value&&((I=v.value)==null||I.destroy(),v.value=void 0);break}}function O(){const V=Object.keys(c.value);T(V),A()}function P(V,B){if(!(B!=null&&B.length))return;let I=V[B[0]];if(B.length<=1)return I;for(let G=1;G<B.length;G++){const W=B[G];if(I.children[W])I=I.children[W];else return}return I}return g.onMounted(()=>{Object.entries(i.options).forEach(([V,B])=>{(!B.hasOwnProperty("show")||B!=null&&B.show)&&(l.value[V]=B)})}),e({handleSelect:C,currentActive:c,treeRef:u,measureRef:d,comInfoRef:m,cuttingRef:v,baseInfoRef:y,configRef:x,RoamRef:b,batchDeselectAll:O}),(V,B)=>(g.openBlock(),g.createElementBlock("div",ec,[Object.keys(l.value).length?g.withDirectives((g.openBlock(),g.createBlock(g.unref(Se.ElMenu),{key:0,"menu-trigger":"hover",class:"utils-menu","popper-class":"utils-menu-popper",mode:"horizontal",ellipsis:!1,"unique-opened":!1},{default:g.withCtx(()=>[g.createVNode(Yo,{utils:l.value,leave:1,onHandleSelect:C,"current-active":c.value},null,8,["utils","current-active"])]),_:1},512)),[[g.vShow,a.value]]):g.createCommentVNode("",!0)]))}});const sc=Ue(tc,[["__scopeId","data-v-504a5267"]]),Ko="ZnVuY3Rpb24gRShyKSB7CiAgaWYgKHIubGVuZ3RoID09PSAwKQogICAgcmV0dXJuIC0xIC8gMDsKICBsZXQgdSA9IHJbMF07CiAgZm9yIChsZXQgaSA9IDEsIGMgPSByLmxlbmd0aDsgaSA8IGM7ICsraSkKICAgIHJbaV0gPiB1ICYmICh1ID0gcltpXSk7CiAgcmV0dXJuIHU7Cn0KZnVuY3Rpb24gRyhyLCB1ID0gIVtdKSB7CiAgY29uc3QgaSA9IHJbMF0uaW5kZXggIT09IG51bGwsIGMgPSBuZXcgU2V0KE9iamVjdC5rZXlzKHJbMF0uYXR0cmlidXRlcykpLCBoID0gbmV3IFNldChPYmplY3Qua2V5cyhyWzBdLm1vcnBoQXR0cmlidXRlcykpLCBkID0ge30sIGwgPSB7fSwgZiA9IHJbMF0ubW9ycGhUYXJnZXRzUmVsYXRpdmUsIG8gPSB7IHVzZXJEYXRhOiB7fSwgZ3JvdXBzOiBbXSwgYXR0cmlidXRlczoge30gfTsKICBsZXQgcCA9IDAsIHkgPSAwLCBiID0gMDsKICBmb3IgKGxldCB0ID0gMDsgdCA8IHIubGVuZ3RoOyArK3QpIHsKICAgIGNvbnN0IGUgPSByW3RdOwogICAgbGV0IHMgPSAwOwogICAgaWYgKGkgIT09IChlLmluZGV4ICE9PSBudWxsKSkKICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoCiAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICIg55qE5Yeg5L2V5L2T44CC5omA5pyJ5Yeg5L2V5L2T5b+F6aG75YW35pyJ5YW85a6555qE5bGe5oCn77yb56Gu5L+d5omA5pyJ5Yeg5L2V5L2T6YO95pyJ57Si5byV5bGe5oCn77yM5oiW6ICF6YO95rKh5pyJ57Si5byV5bGe5oCn44CCIgogICAgICApLCBudWxsOwogICAgZm9yIChjb25zdCBuIGluIGUuYXR0cmlidXRlcykgewogICAgICBpZiAoIWMuaGFzKG4pKQogICAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKAogICAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICcg55qE5Yeg5L2V5L2T44CC5omA5pyJ5Yeg5L2V5L2T5b+F6aG75YW35pyJ5YW85a6555qE5bGe5oCn77yb56Gu5L+d5bGe5oCnICInICsgbiArICciIOWcqOaJgOacieWHoOS9leS9k+S4remDveWtmOWcqO+8jOaIluiAhemDveS4jeWtmOWcqOOAgicKICAgICAgICApLCBudWxsOwogICAgICBkW25dID09PSB2b2lkIDAgJiYgKGRbbl0gPSBbXSksIGRbbl0ucHVzaChlLmF0dHJpYnV0ZXNbbl0pLCBzKys7CiAgICB9CiAgICBpZiAocyAhPT0gYy5zaXplKQogICAgICByZXR1cm4gY29uc29sZS5lcnJvcigKICAgICAgICAiVEhSRUUuQnVmZmVyR2VvbWV0cnlVdGlsczogbWVyZ2VHZW9tZXRyaWVzKCkg5aSx6LSl77yM57Si5byV5Li6ICIgKyB0ICsgIiDnmoTlh6DkvZXkvZPjgILor7fnoa7kv53miYDmnInlh6DkvZXkvZPlhbfmnInnm7jlkIzmlbDph4/nmoTlsZ7mgKfjgIIiCiAgICAgICksIG51bGw7CiAgICBpZiAoZiAhPT0gZS5tb3JwaFRhcmdldHNSZWxhdGl2ZSkKICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoCiAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICIg55qE5Yeg5L2V5L2T44CC5omA5pyJ5Yeg5L2V5L2T55qEIG1vcnBoVGFyZ2V0c1JlbGF0aXZlIOW/hemhu+S4gOiHtOOAgiIKICAgICAgKSwgbnVsbDsKICAgIGZvciAoY29uc3QgbiBpbiBlLm1vcnBoQXR0cmlidXRlcykgewogICAgICBpZiAoIWguaGFzKG4pKQogICAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKAogICAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICIg55qE5Yeg5L2V5L2T44CC5omA5pyJ5Yeg5L2V5L2T55qEIG1vcnBoQXR0cmlidXRlcyDlv4XpobvkuIDoh7TjgIIiCiAgICAgICAgKSwgbnVsbDsKICAgICAgbFtuXSA9PT0gdm9pZCAwICYmIChsW25dID0gW10pLCBsW25dLnB1c2goZS5tb3JwaEF0dHJpYnV0ZXNbbl0pOwogICAgfQogICAgbGV0IGEgPSAwLCBtID0gMDsKICAgIGlmICh1KSB7CiAgICAgIGxldCBuOwogICAgICBpZiAoaSkKICAgICAgICBuID0gZS5pbmRleC5jb3VudDsKICAgICAgZWxzZSBpZiAoZS5hdHRyaWJ1dGVzLnBvc2l0aW9uICE9PSB2b2lkIDApCiAgICAgICAgbiA9IGUuYXR0cmlidXRlcy5wb3NpdGlvbi5jb3VudDsKICAgICAgZWxzZQogICAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKAogICAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOe0ouW8leS4uiAiICsgdCArICIg55qE5Yeg5L2V5L2T44CC5Yeg5L2V5L2T5b+F6aG75YW35pyJ57Si5byV5oiW5L2N572u5bGe5oCn44CCIgogICAgICAgICksIG51bGw7CiAgICAgIGEgPSBwLCBtID0gbiwgby5ncm91cHMucHVzaCh7CiAgICAgICAgc3RhcnQ6IGEsCiAgICAgICAgY291bnQ6IG0sCiAgICAgICAgbWF0ZXJpYWxJbmRleDogdAogICAgICB9KSwgcCArPSBuOwogICAgfQogICAgY29uc3QgZyA9IGUudXNlckRhdGEuZ3VpZDsKICAgIHkgPSBiLCBiICs9IGUuYXR0cmlidXRlcy5wb3NpdGlvbi5jb3VudCwgIW8udXNlckRhdGFbZ10gJiYgKG8udXNlckRhdGFbZ10gPSBbXSksIG8udXNlckRhdGFbZ10ucHVzaCh7CiAgICAgIHV1aWQ6IGUudXNlckRhdGEubWVzaCwKICAgICAgZmFjZV9zdGFydDogYSwKICAgICAgZmFjZV9lbmQ6IGEgKyBtLAogICAgICBnZW9fc3RhcnQ6IHksCiAgICAgIGdlb19lbmQ6IGIKICAgIH0pOwogIH0KICBpZiAoaSkgewogICAgbGV0IHQgPSAwOwogICAgY29uc3QgZSA9IFtdOwogICAgZm9yIChsZXQgcyA9IDA7IHMgPCByLmxlbmd0aDsgKytzKSB7CiAgICAgIGNvbnN0IGEgPSByW3NdLmluZGV4OwogICAgICBmb3IgKGxldCBtID0gMDsgbSA8IGEuY291bnQ7ICsrbSkKICAgICAgICBlLnB1c2goYS5hcnJheVttXSArIHQpOwogICAgICB0ICs9IHJbc10uYXR0cmlidXRlcy5wb3NpdGlvbi5jb3VudDsKICAgIH0KICAgIEFycmF5LmlzQXJyYXkoZSkgPyBvLmluZGV4ID0gRShlKSA+IDY1NTM1ID8gbmV3IFVpbnQzMkFycmF5KGUsIDApIDogbmV3IFVpbnQxNkFycmF5KGUsIDApIDogby5tZXJnZWRJbmRleCA9IGU7CiAgfQogIGZvciAoY29uc3QgdCBpbiBkKSB7CiAgICBjb25zdCBlID0gQShkW3RdKTsKICAgIGlmICghZSkKICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoJ1RIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOaXoOazleWQiOW5tuWxnuaApyAiJyArIHQgKyAnIuOAgicpLCBudWxsOwogICAgby5hdHRyaWJ1dGVzW3RdID0gZTsKICB9CiAgZm9yIChjb25zdCB0IGluIGwpIHsKICAgIGNvbnN0IGUgPSBsW3RdWzBdLmxlbmd0aDsKICAgIGlmIChlID09PSAwKQogICAgICBicmVhazsKICAgIG8ubW9ycGhBdHRyaWJ1dGVzID0gby5tb3JwaEF0dHJpYnV0ZXMgfHwge30sIG8ubW9ycGhBdHRyaWJ1dGVzW3RdID0gW107CiAgICBmb3IgKGxldCBzID0gMDsgcyA8IGU7ICsrcykgewogICAgICBjb25zdCBhID0gW107CiAgICAgIGZvciAobGV0IGcgPSAwOyBnIDwgbFt0XS5sZW5ndGg7ICsrZykKICAgICAgICBhLnB1c2gobFt0XVtnXVtzXSk7CiAgICAgIGNvbnN0IG0gPSBBKGEpOwogICAgICBpZiAoIW0pCiAgICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoJ1RIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlR2VvbWV0cmllcygpIOWksei0pe+8jOaXoOazleWQiOW5tuWPmOW9ouWxnuaApyAiJyArIHQgKyAnIuOAgicpLCBudWxsOwogICAgICBvLm1vcnBoQXR0cmlidXRlc1t0XS5wdXNoKG0pOwogICAgfQogIH0KICByZXR1cm4gbzsKfQpmdW5jdGlvbiBBKHIpIHsKICBsZXQgdSwgaSwgYywgaCA9IDA7CiAgZm9yIChsZXQgZiA9IDA7IGYgPCByLmxlbmd0aDsgKytmKSB7CiAgICBjb25zdCBvID0gcltmXTsKICAgIGlmIChvLmlzSW50ZXJsZWF2ZWRCdWZmZXJBdHRyaWJ1dGUpCiAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKCJUSFJFRS5CdWZmZXJHZW9tZXRyeVV0aWxzOiBtZXJnZUF0dHJpYnV0ZSgpIOWksei0peOAguS4jeaUr+aMgSBJbnRlcmxlYXZlZEJ1ZmZlckF0dHJpYnV0ZXPjgIIiKSwgbnVsbDsKICAgIGlmICh1ID09PSB2b2lkIDAgJiYgKHUgPSBvLmFycmF5LmNvbnN0cnVjdG9yKSwgdSAhPT0gby5hcnJheS5jb25zdHJ1Y3RvcikKICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoCiAgICAgICAgIlRIUkVFLkJ1ZmZlckdlb21ldHJ5VXRpbHM6IG1lcmdlQXR0cmlidXRlKCkg5aSx6LSl44CC5omA5pyJ5Yy56YWN5bGe5oCn55qEIEJ1ZmZlckF0dHJpYnV0ZS5hcnJheSDlv4XpobvmmK/nm7jlkIznmoTmlbDnu4TnsbvlnovjgIIiCiAgICAgICksIG51bGw7CiAgICBpZiAoaSA9PT0gdm9pZCAwICYmIChpID0gby5pdGVtU2l6ZSksIGkgIT09IG8uaXRlbVNpemUpCiAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKCJUSFJFRS5CdWZmZXJHZW9tZXRyeVV0aWxzOiBtZXJnZUF0dHJpYnV0ZSgpIOWksei0peOAguaJgOacieWMuemFjeWxnuaAp+eahCBCdWZmZXJBdHRyaWJ1dGUuaXRlbVNpemUg5b+F6aG75LiA6Ie044CCIiksIG51bGw7CiAgICBpZiAoYyA9PT0gdm9pZCAwICYmIChjID0gby5ub3JtYWxpemVkKSwgYyAhPT0gby5ub3JtYWxpemVkKQogICAgICByZXR1cm4gY29uc29sZS5lcnJvcigiVEhSRUUuQnVmZmVyR2VvbWV0cnlVdGlsczogbWVyZ2VBdHRyaWJ1dGUoKSDlpLHotKXjgILmiYDmnInljLnphY3lsZ7mgKfnmoQgQnVmZmVyQXR0cmlidXRlLm5vcm1hbGl6ZWQg5b+F6aG75LiA6Ie044CCIiksIG51bGw7CiAgICBoICs9IG8uYXJyYXkubGVuZ3RoOwogIH0KICBjb25zdCBkID0gbmV3IHUoaCk7CiAgbGV0IGwgPSAwOwogIGZvciAobGV0IGYgPSAwOyBmIDwgci5sZW5ndGg7ICsrZikKICAgIGQuc2V0KHJbZl0uYXJyYXksIGwpLCBsICs9IHJbZl0uYXJyYXkubGVuZ3RoOwogIHJldHVybiB7IGFycmF5OiBkLCBpdGVtU2l6ZTogaSwgbm9ybWFsaXplZDogYyB9Owp9CnNlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsICh7IGRhdGE6IHIgfSkgPT4gewogIGNvbnN0IGkgPSBHKHIsICEhW10pOwogIHBvc3RNZXNzYWdlKGkpOwp9KTsK",Fi=typeof window<"u"&&window.Blob&&new Blob([atob(Ko)],{type:"text/javascript;charset=utf-8"});function nc(){let o;try{if(o=Fi&&(window.URL||window.webkitURL).createObjectURL(Fi),!o)throw"";return new Worker(o)}catch{return new Worker("data:application/javascript;base64,"+Ko,{type:"module"})}finally{o&&(window.URL||window.webkitURL).revokeObjectURL(o)}}const Ui={baseConfig:{transparent:0,clickHighlight:!1},cube:{show:!0,size:160},utilsMenu:{show:!0,options:{review:{name:"重置视角",icon:"review"},tree:{name:"模型树",icon:"tree",active:!0,config:{tabs:["floor","category","model"]},cardConfig:{title:"模型树",size:{width:"280px",height:"550px"},position:{left:"20px",top:"20px"},z:10}},roam:{name:"漫游",icon:"roam",children:{fly:{name:"飞行模式",icon:"fly",active:!0,conflictKey:["local","global","measure","comInfo","person","tree"],cardConfig:{title:"操作说明",size:{width:"280px"},position:{right:"20px",bottom:"300px"}}},person:{name:"第一人称",icon:"person",active:!0,conflictKey:["local","global","measure","comInfo","fly","tree"],cardConfig:{title:"操作说明",size:{width:"280px"},position:{right:"20px",bottom:"300px"}}}}},screenshot:{name:"截图",icon:"screenshot",config:{download:!0}},cutting:{name:"剖切",icon:"cuttingGlobal",children:{global:{name:"全局剖切",icon:"cuttingGlobal",active:!0,conflictKey:["local","person","fly","measure","comInfo"],cardConfig:{title:"局部剖切",size:{width:"320px"},position:{left:"50%",bottom:"120px"}}},local:{name:"局部剖切",icon:"cuttingLocal",active:!0,conflictKey:["global","person","fly","measure","comInfo"],cardConfig:{title:"局部剖切",size:{width:"320px"},position:{left:"50%",bottom:"120px"}}}}},measure:{name:"测量",icon:"measure",active:!0,conflictKey:["local","global","person","fly","comInfo"],cardConfig:{title:"测量",size:{width:"280px"},position:{right:"20px",bottom:"90px"}}},comInfo:{name:"构件信息 ",icon:"comInfo",active:!0,conflictKey:["local","global","person","fly","measure"],cardConfig:{title:"构件信息",size:{width:"300px"},position:{right:"20px",bottom:"230px"}}},fullScreen:{name:"全屏",icon:"fullScreen"},baseInfo:{name:"基础信息",icon:"baseInfo",active:!0,cardConfig:{title:"基础信息",size:{width:"280px"},position:{right:"20px",bottom:"90px"}}},config:{name:"设置",icon:"config",active:!0,cardConfig:{title:"设置",size:{width:"280px"},position:{right:"20px",bottom:"90px"}}}}},rayCaster:{type:"click"},maximumNumberOfThreads:4};class jn{constructor(e,i){L(this,"allMesh");L(this,"workerPool");L(this,"clock");L(this,"time",0);L(this,"animationFrameId");L(this,"person");L(this,"cubeCamera");L(this,"cubeScene");L(this,"tempFileUrls",[]);L(this,"lightManager");L(this,"highLightMeshManager");L(this,"rayCasterManager");L(this,"perspectiveCamera");L(this,"orthographicCamera");L(this,"floorGroup",new f.Group);L(this,"orbitControl");L(this,"flyControl");L(this,"firstControl");L(this,"renderer");L(this,"camera");L(this,"scene");L(this,"element");L(this,"objs");L(this,"objects");L(this,"resizeFlag");L(this,"containerGroup",new f.Group);L(this,"colorGroupMeshes",[]);L(this,"controlType");L(this,"flag");L(this,"stopRender");L(this,"options");L(this,"initOptions");L(this,"utilsMenuRef");L(this,"resizeObserver");L(this,"resizeRafId",0);L(this,"lastResize",{width:0,height:0});this.options=i?Ks(Ui,i):Ui,this.initOptions=Ys(this.options),this.element=e,this.element.id="viewer-3d",this.element.parentElement.style.position="relative",this.element.style.width||(this.element.style.width="100%"),this.element.style.height||(this.element.style.height="100%"),this.element.style.display="block";const r=this.element.clientWidth,a=this.element.clientHeight;this.scene=new f.Scene,this.highLightMeshManager=new Wa(this),this.perspectiveCamera=new f.PerspectiveCamera(65,r/a,.1,1e4),this.orthographicCamera=new f.OrthographicCamera(r/-2,r/2,a/2,a/-2,.1,5e3),this.allMesh={},this.objs={},this.objects={},this.resizeFlag=!0,this.clock=new f.Clock,this.stopRender=!1,this.workerPool=new Wo(nc,this.options.maximumNumberOfThreads),this.init(this.options),this.controlType="orbit",this.flag=!1,this.resizeObserver=new ResizeObserver(l=>{var h;const c=(h=l[0])==null?void 0:h.contentRect;c&&this.scheduleResize(c.width,c.height)}),this.resizeObserver.observe(e.parentElement),this.element.addEventListener("beforeunload",()=>{this.destroy()})}setOptions(e,i){this.options=Ks(this.options,e),this.init(this.options),i()}init(e){const{baseConfig:i,light:r,cube:a}=e,l=this.element.clientWidth,c=this.element.clientHeight;this.camera=this.perspectiveCamera,this.camera.position.set(-10,10,10),this.renderer=new f.WebGLRenderer({canvas:this.element,antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(l,c,!1),i.clearColor&&this.renderer.setClearColor(i.clearColor),i.transparent&&this.renderer.setClearAlpha(i.transparent),i.background&&(this.scene.background=i.background),this.renderer.outputEncoding=f.sRGBEncoding,this.renderer.autoClear=!1,this.scene.add(this.containerGroup,this.camera,this.floorGroup),this.containerGroup.addEventListener("clear",()=>{this.containerGroup.children.forEach(p=>{const u=p.geometry,d=p.material;u.dispose&&u.dispose(),d.dispose&&d.dispose()}),this.containerGroup.clear()}),this.addPerson(a.show?this.initCube(a.size||200):void 0),this.lightManager=new ja(this),this.lightManager.addAmbientLight((r==null?void 0:r.ambient)||{color:16777215,intensity:.4}),this.lightManager.addDirectionalLight((r==null?void 0:r.direct)||{color:16777215,intensity:.9});const h=()=>{this.animationFrameId=requestAnimationFrame(h),!this.stopRender&&(this.renderScene(),De.update())};h(),this.element.addEventListener("resize",()=>{var d,m;const p=((d=this.element.parentElement)==null?void 0:d.clientWidth)||250,u=((m=this.element.parentElement)==null?void 0:m.clientHeight)||250;this.resizeFlag&&this.resize(p,u)})}initCube(e){this.cubeCamera=new f.OrthographicCamera(-25,25,25,-25,1,1e3),this.cubeCamera.position.z+=30,this.cubeScene=new f.Scene,this.cubeScene.add(this.cubeCamera);const i=new Fa(this.camera,this.cubeCamera,this.renderer.domElement,this.getAllObjectBox.bind(this),e);return this.cubeScene.add(i.group),i}renderScene(){const e=this.element.clientWidth,i=this.element.clientHeight,r=this.clock.getDelta();switch(this.controlType){case"orbit":this.orbitControl&&this.orbitControl.update();break;case"fly":this.flyControl&&this.flyControl.update(r);break;case"person":this.firstControl&&this.firstControl.update(r);break}this.renderer.setViewport(0,0,e,i),this.renderer.render(this.scene,this.camera);const a=this.options.cube.size||200;this.cubeCamera&&(this.renderer.setViewport(e-a,i-a,a,a),this.renderer.render(this.cubeScene,this.cubeCamera))}addPerson(e){const i=this;i.person=new f.Object3D,i.initControl(),e&&e.setControl(i.orbitControl)}setControl(e,i){if(this.controlType=e,e=="orbit")this.orbitControl.enabled=!0,this.firstControl.enabled=!1,this.flyControl.enabled=!1,this.person.visible=!1,i.translate&&(this.orbitControl.panSpeed=i.translate/50),i.scale&&(this.orbitControl.zoomSpeed=i.scale/50);else if(e=="fly")this.orbitControl.enabled=!1,this.firstControl.enabled=!1,this.flyControl.enabled=!0,this.person.visible=!1,i.moveSpeed&&(this.flyControl.movementSpeed=i.moveSpeed/1),i.rotateSpeed&&(this.flyControl.rollSpeed=i.rotateSpeed/50*2);else if(e=="person"){if(!this.firstControl.enabled){const a=this.getAllObjectBox().getCenter(new f.Vector3),l=this.camera.position;a.sub(l).negate().normalize(),this.firstControl.lookAt(a.x,a.y,a.z)}this.orbitControl.enabled=!1,this.firstControl.enabled=!0,this.flyControl.enabled=!1,this.person.visible=!0,i.moveSpeed&&(this.firstControl.movementSpeed=i.moveSpeed/2),i.rotateSpeed&&(this.firstControl.lookSpeed=i.rotateSpeed/50*.5),this.person.userData.time==0&&this.person.position.copy(this.camera.position),this.person.userData.time++}else e=="exist"&&(this.controlType="orbit",this.perspectiveCamera.fov=65,this.perspectiveCamera.updateProjectionMatrix(),this.orbitControl.enabled=!0,this.firstControl.enabled=!1,this.flyControl.enabled=!1,this.person.visible=!1)}screenShoot(e,i){return this.renderScene(),this.element.toDataURL(e||"image/png",i||1)}lookingDownEntity(e,i){this.toggleCamera("orthogonal"),this.orbitControl.enableRotate=!1,this.floorGroup.clear();const r=new f.Box3;e.forEach(u=>{this.allMesh[u]&&(this.allMesh[u].visible=!0,this.floorGroup.add(this.allMesh[u]))});const a=new f.Vector3;r.expandByObject(this.floorGroup),r.getSize(a),a.multiplyScalar(.9);const l=r.getCenter(new f.Vector3),c=r.max.distanceTo(r.min)/1.5,h=new f.Vector3(l.x,l.y+c,l.z);let p;a.x>a.y?p=this.orthographicCamera.right/a.x:p=this.orthographicCamera.top/a.y,this.orthographicCamera.zoom=p,this.orthographicCamera.updateProjectionMatrix(),this.animate(h,l,i,1)}initControl(){this.orbitControl=new Oa.OrbitControls(this.camera,this.element),this.orbitControl.mouseButtons={LEFT:f.MOUSE.ROTATE,MIDDLE:f.MOUSE.PAN,RIGHT:null},this.flyControl=new Xs(this.camera,this.element),this.flyControl.autoForward=!1,this.flyControl.movementSpeed=5,this.flyControl.rollSpeed=.4,this.flyControl.dragToLook=!0,this.flyControl.enabled=!1,this.firstControl=new Zs(this.person,this.camera,this.element),this.firstControl.enabled=!1;const e=this,i=function(r){const a=r.target.target,l=e.camera.position.clone();l.sub(a).normalize(),l.multiplyScalar(60),e.cubeCamera.position.copy(l),e.cubeCamera.quaternion.copy(e.camera.quaternion)};this.cubeCamera&&i({target:{target:new f.Vector3}}),this.cubeCamera&&this.orbitControl.addEventListener("change",i)}addObject(e){this.objs[e.uuid]=e,this.scene.add(e)}addRays(e){this.objs[e.uuid]=e,this.containerGroup.add(e)}scheduleResize(e,i){this.resizeRafId||(this.resizeRafId=requestAnimationFrame(()=>{this.resizeRafId=0,this.resize(e,i)}))}resize(e,i){!e||!i||(this.flag&&(e/=2),!(Math.abs(e-this.lastResize.width)<.5&&Math.abs(i-this.lastResize.height)<.5)&&(this.lastResize={width:e,height:i},this.perspectiveCamera.aspect=e/i,this.orthographicCamera.left=e/-2,this.orthographicCamera.right=e/2,this.orthographicCamera.top=i/2,this.orthographicCamera.bottom=i/-2,this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.renderer.setSize(e,i,!1)))}_createGroup(){const e=new f.Group;return e.name="",e.userData.name="",e.userData.ModelId="",e.userData.uuids=[],this.addObject(e),e.addEventListener("destory",()=>{var a;const i=e.uuid;e.userData.uuids.forEach(l=>{const c=this.allMesh[l];c.geometry.dispose(),c.material.dispose&&c.material.dispose(),delete this.allMesh[l]}),e.children.forEach(l=>{l.geometry.dispose(),l.material.dispose&&l.material.dispose()}),e.clear(),(a=e.parent)==null||a.remove(e),delete this.objs[i]}),e}create2DLabel(e,i,r){const a=document.createElement("div");a.style.pointerEvents="auto",a.style.position="relative",a.innerHTML=e,a.onclick=()=>{r&&r()};const l=new Po.CSS2DObject(a);return l.position.set(i.x,i.y,i.z),this.addObject(l),l}async loadZipModel(e,i,r,a){return this.destroy(!0),fetch(e).then(l=>l.arrayBuffer()).then(async l=>{const c=new Da,h=await c.loadAsync(l),p=[],u=[];let d="";const m={};try{for(const y in h.files)switch(y.substring(y.lastIndexOf(".")+1,y.length).toLowerCase()){case"glb":p.push(new Promise(b=>{var C;(C=c.file(y))==null||C.async("arraybuffer").then(T=>{const A=new Blob([T]),O=URL.createObjectURL(A);u.push(O),this.tempFileUrls.push(O),b(T)})}));break;case"jpg":case"png":case"jpeg":case"gif":case"bmp":p.push(new Promise(b=>{var C;(C=c.file(y))==null||C.async("arraybuffer").then(T=>{const A=new Blob([T]),O=URL.createObjectURL(A);m[y]=O,this.tempFileUrls.push(O),b(T)})}));break;case"json":p.push(new Promise(b=>{var C;(C=c.file(y))==null||C.async("arraybuffer").then(T=>{const A=new Blob([T]);d=URL.createObjectURL(A),this.tempFileUrls.push(d),b(T)})}));break;default:break}}catch(y){console.log(y)}await Promise.all(p);let v=this.loadModel(u,new Set(Object.keys(m)).size>0?m:null,y=>this.loadModelCallBack(y,d,x=>{r(x)}));return v.userData.file_id=i,new Promise(y=>{y(v)})}).catch(l=>(a(l),null))}async loadMultipleGlbModel(e,i,r,a){this.destroy(!0);try{const l=[];let c="";const h={};for(let u=0;u<e.length;u++){const d=e[u];switch(d.substring(d.lastIndexOf(".")+1,d.length).toLowerCase()){case"glb":l.push(d);break;case"jpg":case"png":case"jpeg":case"gif":case"bmp":h[d]=d;break;case"json":c=d;break;default:break}}let p=this.loadModel(l,new Set(Object.keys(h)).size>0?h:null,u=>this.loadModelCallBack(u,c,d=>{r(d)}));return p.userData.file_id=i,new Promise(u=>{u(p)})}catch(l){return a(l),null}}loadModel(e,i,r){const a=this._createGroup(),l=[];let c=performance.now(),h=performance.now();console.log("开始加载模型");let p;return e.forEach(u=>{l.push(new Promise(d=>{this._loadGlbByUrl(u,i,a,()=>{p=performance.now(),console.log(`执行时长: ${(p-c)/1e3} 毫秒`),c=performance.now(),d(u)})}))}),Promise.all(l).then(()=>{let u=performance.now();console.log("加载模型结束,",`执行时长: ${(u-h)/1e3} 毫秒`),this.resetView(10),r(a)}),a}loadModelCallBack(e,i,r){var a,l,c,h,p,u,d;this.utilsMenuRef&&((a=this.utilsMenuRef)==null||a.batchDeselectAll(),(l=this.utilsMenuRef)==null||l.destroy(),this.utilsMenuRef=void 0),this.options=Ys(this.initOptions),this.rayCasterManager=new Ya(this,(c=this.options)==null?void 0:c.rayCaster),this.options.utilsMenu.show&&(((p=(h=this.options.utilsMenu.options)==null?void 0:h.tree)==null?void 0:p.show)!==!1&&(i?this.options.utilsMenu.options.tree.config={jsonFileUrl:i,model:e,hiddenMeshGuids:(u=this.options)==null?void 0:u.hiddenMeshGuids,...this.options.utilsMenu.options.tree.config}:(d=this.options.utilsMenu.options)==null||delete d.tree),this.utilsMenuRef=St(sc,{viewer:this,options:this.options.utilsMenu.options},this.element.parentElement)),this.hiddenObjectPartsByHiddenMeshGuids(),r&&r(this.utilsMenuRef)}_loadGlbByUrl(e,i,r,a){const l=new Fo;l.setImageJson(i),l.load(e,c=>{const h=function(y){var x,b;if(y.userData.InfoFileName){let C=((b=(x=y.userData)==null?void 0:x.ModelTitle)==null?void 0:b.split(".").shift())||"模型";return r.userData.name=r.name=C,r.userData.ModelId=y.userData.ModelId,!0}else for(let C=0;C<y.children.length;C++){const T=y.children[C];if(h(T))return!0}return!1};!r.name&&h(c.scene);const p=this,u={};c.scene.traverse(y=>{var x,b;if(y instanceof f.Mesh){y.updateMatrix();const C=new f.BufferGeometry().copy(y.geometry);C.applyMatrix4(y.matrix),C.attributes.normal||C.computeVertexNormals(),p.allMesh[y.uuid]=y,(b=(x=r==null?void 0:r.userData)==null?void 0:x.uuids)==null||b.push(y.uuid),C.userData={mesh:y.uuid,guid:y.userData.ExId};const T=y.material.uuid,A=Object.getOwnPropertyNames(C.attributes).length;!u[T]&&(u[T]={material:y.material,geos:[],length:A}),A==u[T].length&&u[T].geos.push(C),y.geometry.dispose(),y.visible=!1}else if(y instanceof f.Line){const C=new f.BufferGeometry().copy(y.geometry);C.applyMatrix4(y.matrix),p.allMesh[y.uuid]=y,r.userData.uuids.push(y.uuid),C.userData={mesh:y.uuid,guid:y.userData.ExId};const T=y.material.uuid;!u[T]&&(u[T]={material:y.material,geos:[],type:"lineSegments"}),u[T].geos.push(C),y.geometry.dispose(),y.visible=!1}});const d=[];for(const y in u)if(u[y].geos.length<=1e4)d.push(u[y]);else{const x=u[y].geos.length,b=Math.ceil(x/1e4);for(let C=0;C<b;C++){const T=C*1e4;let A=(C+1)*1e4;A>x&&(A=x);const O=u[y].geos.slice(T,A);d.push({geos:O,material:u[y].material})}}if(!d.length){a();return}v(0),console.log("开始合并几何体");function v(y){d[y]?p.mergeBufferGeometries(d[y].geos,x=>{if(x){let b;d[y].type=="lineSegments"?b=new f.LineSegments(x,d[y].material):(b=new f.Mesh(x,d[y].material),p.setControlRays(b)),r.add(b),p.objects[b.uuid]=b}y++,v(y)}):a()}})}setControlRays(e){e instanceof f.Mesh?this.firstControl.meshs.push(e):this.firstControl.meshs.push(...e)}resetView(e=200){const i=new f.Box3;for(const h in this.objs)this.objs[h].visible&&i.expandByObject(this.objs[h]);const r=i.min.distanceTo(i.max);if(!r||r==0||r==1/0)return;const a=new f.Vector3,l=new f.Vector3;i.getCenter(a),l.set(a.x-r/2,a.y+r/2,a.z+r/2);const c=()=>{this.camera.updateMatrix(),this.renderScene()};new De.Tween(this.camera.position).to(l,e).onUpdate(()=>{c()}).start(),new De.Tween(this.camera.up).to({x:0,y:1,z:0},e).onUpdate(()=>{c()}).start(),this.controlType=="orbit"&&new De.Tween(this.orbitControl.target).to(a,e).onUpdate(()=>{c()}).start()}setColorGroup(e,i){const r=[];e.forEach(a=>{for(const l in this.objs){let c=!1;if(this.objs[l].children.forEach(p=>{const u=p.geometry.userData[a];u!=null&&u.length&&u.forEach(d=>{const m=d.uuid;if(this.allMesh[m]){const v=new f.BufferGeometry().copy(this.allMesh[m].geometry);v.applyMatrix4(this.allMesh[m].matrix),v.deleteAttribute("normal"),v.deleteAttribute("uv"),r.push(v),c=!0;return}})}),c)break}}),!(r.length<1)&&this.mergeBufferGeometries(r,a=>{const l=new f.Mesh(a,new f.MeshBasicMaterial({color:i,transparent:!0,opacity:.9}));l.name="__color_group_mesh__",this.containerGroup.add(l),this.colorGroupMeshes.push(l),l.addEventListener("destory",()=>{var c;(c=l.parent)==null||c.remove(l),l.geometry.dispose(),l.material.dispose(),this.colorGroupMeshes=this.colorGroupMeshes.filter(h=>h!==l)})})}removeColorGroup(){this.colorGroupMeshes.forEach(e=>{var i;(i=e.parent)==null||i.remove(e),e.geometry.dispose(),e.material.dispose()}),this.colorGroupMeshes=[]}highlightByGuids(e,i){var l,c;const r=Array.isArray(e)?e:[e];if(!r.length)return;this.highLightMeshManager.setHighLightById(r,"guid",(i==null?void 0:i.animation)??!0);const a=(l=this.utilsMenuRef)==null?void 0:l.treeRef;(c=a==null?void 0:a.locateByGuids)==null||c.call(a,r)}hiddenObjectPartsByHiddenMeshGuids(){var e,i;if((e=this.options)!=null&&e.hiddenMeshGuids){const r={};(i=this.options)==null||i.hiddenMeshGuids.forEach(a=>{for(const l in this.objects){const c=this.objects[l];this.setObjectPartsToBeVisibleAndHiddenByGuid(c.geometry,a,!1)&&(r[l]=c)}});for(const a in r){const l=r[a].geometry,c=r[a].children[0];c instanceof f.LineSegments&&(c.geometry.dispose(),c.geometry=new f.EdgesGeometry(l))}}}setObjectPartsToBeVisibleAndHiddenByGuid(e,i,r){let a=!1;const l=e.attributes.position;return e.userData[i]&&(e.userData[i].forEach(c=>{const h=c.geo_start,p=c.geo_end;if(r){if(c.position)for(let u=h;u<p;u++){const d=(u-h)*3;l.setXYZ(u,c.position[d],c.position[d+1],c.position[d+2])}}else{!c.position&&(c.position=[]);for(let u=h;u<p;u++)c.position.push(l.getX(u),l.getY(u),l.getZ(u)),l.setXYZ(u,0,0,0)}}),a=!0,l.needsUpdate=!0),a}animate(e,i,r,a){a=a||e.distanceTo(this.camera.position)*5,a>500&&(a=500),r=r||new f.Vector3(0,1,0);const l=new De.Tween(this.camera.position).to(e,a).easing(De.Easing.Exponential.Out).onUpdate(()=>{p()}),c=new De.Tween(this.camera.up).to(r,a).easing(De.Easing.Exponential.Out).onUpdate(()=>{p()}),h=new De.Tween(this.orbitControl.target).to(i,a).easing(De.Easing.Exponential.Out).onUpdate(()=>{p()}),p=()=>{this.camera.updateProjectionMatrix(),this.camera.updateMatrix()};l.start(),c.start(),h.start()}toggleCamera(e){const i=new f.Vector3,r=new f.Box3;let a=1;for(const l in this.objs){const c=this.objs[l];r.expandByObject(c)}r.getSize(i),i.x>i.y?a=(-this.orthographicCamera.left+this.orthographicCamera.right)/i.x:a=(this.orthographicCamera.top-this.orthographicCamera.bottom)/i.y,e=="orthogonal"&&this.camera instanceof f.PerspectiveCamera?(this.orthographicCamera.position.copy(this.perspectiveCamera.position),this.camera=this.orthographicCamera):e=="perspective"&&this.camera instanceof f.OrthographicCamera&&(this.perspectiveCamera.position.copy(this.orthographicCamera.position),this.camera=this.perspectiveCamera),e=="orthogonal"&&(this.camera.zoom=a),e=="perspective"&&(this.camera.zoom=1),this.orbitControl.object=this.camera,this.orbitControl.update(),this.camera.updateProjectionMatrix()}getAllObjectBox(){const e=new f.Box3;for(const i in this.objs)e.expandByObject(this.objs[i]);return e}setCameraAndControl(e,i){this.perspectiveCamera&&this.orbitControl&&this.controlType=="orbit"&&(this.perspectiveCamera.position.copy(e),this.orbitControl.target.copy(i),this.perspectiveCamera.updateMatrix(),this.perspectiveCamera.updateProjectionMatrix(),this.orbitControl.update())}mergeBufferGeometries(e,i){if(e.length<1){i&&i(void 0);return}e&&this.workerPool.run(e).then(r=>{const{data:a}=r;if(!a){i&&i(void 0);return}const l=new f.BufferGeometry;for(const c in a.attributes){const h=a.attributes[c],p=new Float32Array(h.array);l.setAttribute(c,new f.BufferAttribute(p,h.itemSize,h.normalized))}l.groups=a.groups,l.userData=a.userData,a.index&&l.setIndex(new f.BufferAttribute(a.index,1,!1)),l.computeBoundingSphere(),i&&i(l)}).catch(r=>{console.error("当前模型部分顶点有问题,合并失败,请检查建模!"),i&&i(void 0)})}focusOnTheMesh(e){let i=45,r=window.innerWidth/window.innerHeight,a=1.2;const l=new f.Box3().setFromObject(e),c=new f.Vector3;l.getSize(c);const h=new f.Vector3;l.getCenter(h);const p=i*Math.PI/180;let u;r>=1?u=a*c.y/(2*Math.tan(p/2)):u=a*c.x/(2*Math.tan(p/2)*r);const d=a*c.x/(2*Math.tan(p*r/2)),m=a*c.y/(2*Math.tan(p/2));u=Math.max(u,d,m);const v=h.clone();v.z+=u*2,v.y+=u*.8,v.x-=u*.6,this.animate(v,h,new f.Vector3(0,1,0))}setAllMaterialsTransparent(e){for(const i in this.objs)this.objs[i].traverse(r=>{r instanceof f.Mesh&&(r.material.transparent=!0,r.material.opacity=e,r.material.needsUpdate=!0)})}destroy(e=!1){var r;const i=["map","aoMap","emissiveMap","glossinessMap","metalnessMap","normalMap","roughnessMap","specularMap"];(r=this.resizeObserver)==null||r.disconnect(),this.resizeObserver=void 0,this.resizeRafId&&(cancelAnimationFrame(this.resizeRafId),this.resizeRafId=0),this.scene.traverse(a=>{a!=null&&a.isMesh&&(a.userData={},a.geometry&&a.geometry.dispose(),(Array.isArray(a.material)?a.material:[a.material]).forEach(l=>{i.forEach(c=>{l[c]&&l[c].dispose()})}))}),f.Cache.clear(),this.tempFileUrls.forEach(a=>URL.revokeObjectURL(a)),e||(cancelAnimationFrame(this.animationFrameId),this.renderer.dispose(),this.renderer.forceContextLoss(),this.scene.clear(),this.scene=null,this.workerPool.terminateAll()),this.allMesh={},this.objs={},this.objects={}}}const ic={class:"viewer-box"},oc=g.defineComponent({__name:"index",props:{url:{},options:{},loadZipModelCallback:{},errorCallback:{}},setup(o,{expose:e}){const i=o,r=g.ref();let a,l,c;async function h(){c&&(c==null||c.dispatchEvent({type:"destory"}),c=void 0),r.value&&(c=await(Array.isArray(i.url)?a.loadMultipleGlbModel(i.url,"44",u=>{l=u,i.loadZipModelCallback&&i.loadZipModelCallback(u)},u=>{console.log(u),i.errorCallback&&i.errorCallback(u)}):a.loadZipModel(i.url,"44",u=>{l=u,i.loadZipModelCallback&&i.loadZipModelCallback(u)},u=>{console.log(u),i.errorCallback&&i.errorCallback(u)})))}g.onMounted(()=>{a=new jn(r.value,i.options),h(),g.watch(()=>i.url,()=>{h()})}),g.onBeforeUnmount(()=>{a==null||a.destroy()});const p=g.computed(()=>a);return e({viewer:p,menuUtilsRef:l,model:c,loadModel:h}),(u,d)=>(g.openBlock(),g.createElementBlock("div",ic,[g.createElementVNode("canvas",{id:"viewer-3d",ref_key:"viewerDom",ref:r},null,512)]))}});const rc=Ue(oc,[["__scopeId","data-v-b13645b6"]]);class fe{constructor(e,i,r,a,l){this.layerName=e??null,this.blockName=i??null,this.geometryType=r??null,this.color=a,this.lineType=l??null}Compare(e){let i=mt(this.layerName,e.layerName);return i!==0||(i=mt(this.blockName,e.blockName),i!==0)||(i=mt(this.geometryType,e.geometryType),i!==0)||(i=mt(this.color,e.color),i!==0)?i:mt(this.lineType,e.lineType)}IsIndexed(){return this.geometryType===fe.GeometryType.INDEXED_LINES||this.geometryType===fe.GeometryType.INDEXED_TRIANGLES}IsInstanced(){return this.geometryType===fe.GeometryType.BLOCK_INSTANCE||this.geometryType===fe.GeometryType.POINT_INSTANCE}}fe.GeometryType=Object.freeze({POINTS:0,LINES:1,INDEXED_LINES:2,TRIANGLES:3,INDEXED_TRIANGLES:4,BLOCK_INSTANCE:5,POINT_INSTANCE:6});function mt(o,e){return o===null?e===null?0:-1:e===null?1:o<e?-1:o>e?1:0}function ts(o){this._pointer=0,this._data=o,this._eof=!1}ts.prototype.next=function(){let o;if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);return o={code:parseInt(this._data[this._pointer])},this._pointer++,o.value=qo(o.code,this._data[this._pointer]),this._pointer++,o.code===0&&o.value==="EOF"&&(this._eof=!0),this.lastReadGroup=o,o};ts.prototype.peek=function(){if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let o={code:parseInt(this._data[this._pointer])};return o.value=qo(o.code,this._data[this._pointer+1]),o};ts.prototype.rewind=function(o){o=o||1,this._pointer=this._pointer-o*2};ts.prototype.hasNext=function(){return!(this._eof||this._pointer>this._data.length-2)};ts.prototype.isEOF=function(){return this._eof};function qo(o,e){return o<=9?e:o>=10&&o<=59?parseFloat(e.trim()):o>=60&&o<=99?parseInt(e.trim()):o>=100&&o<=109?e:o>=110&&o<=149?parseFloat(e.trim()):o>=160&&o<=179?parseInt(e.trim()):o>=210&&o<=239?parseFloat(e.trim()):o>=270&&o<=289?parseInt(e.trim()):o>=290&&o<=299?ac(e.trim()):o>=300&&o<=369?e:o>=370&&o<=389?parseInt(e.trim()):o>=390&&o<=399?e:o>=400&&o<=409?parseInt(e.trim()):o>=410&&o<=419?e:o>=420&&o<=429?parseInt(e.trim()):o>=430&&o<=439?e:o>=440&&o<=459?parseInt(e.trim()):o>=460&&o<=469?parseFloat(e.trim()):o>=470&&o<=481||o===999||o>=1e3&&o<=1009?e:o>=1010&&o<=1059?parseFloat(e.trim()):o>=1060&&o<=1071?parseInt(e.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:o,value:e}),e)}function ac(o){if(o==="0")return!1;if(o==="1")return!0;throw TypeError("String '"+o+"' cannot be cast to Boolean type")}const Qo=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function lc(o){return Qo[o]}function ye(o){let e={};o.rewind();let i=o.next(),r=i.code;if(e.x=i.value,r+=10,i=o.next(),i.code!==r)throw new Error("Expected code for point value to be "+r+" but got "+i.code+".");return e.y=i.value,r+=10,i=o.next(),i.code!==r?(o.rewind(),e):(e.z=i.value,e)}function Jo(o){o.rewind();let e=o.next();if(e.code!==101)throw new Error("Bad call for skipEmbeddedObject()");do e=o.next();while(e.code!==0);o.rewind()}function Be(o,e){switch(e.code){case 0:o.type=e.value;break;case 5:o.handle=e.value;break;case 6:o.lineType=e.value;break;case 8:o.layer=e.value;break;case 48:o.lineTypeScale=e.value;break;case 60:o.visible=e.value===0;break;case 62:o.colorIndex=e.value,o.color=lc(Math.abs(e.value));break;case 67:o.inPaperSpace=e.value!==0;break;case 100:break;case 330:o.ownerHandle=e.value;break;case 347:o.materialObjectHandle=e.value;break;case 370:o.lineweight=e.value;break;case 420:o.color=e.value;break;case 1e3:o.extendedData=o.extendedData||{},o.extendedData.customStrings=o.extendedData.customStrings||[],o.extendedData.customStrings.push(e.value);break;case 1001:o.extendedData=o.extendedData||{},o.extendedData.applicationName=e.value;break;default:return!1}return!0}function Wn(){}Wn.ForEntityName="3DFACE";Wn.prototype.parseEntity=function(o,e){let i={type:e.value,vertices:[]};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 70:i.shape=(e.value&1)===1,i.hasContinuousLinetypePattern=(e.value&128)===128;break;case 10:i.vertices=cc(o,e),e=o.lastReadGroup;break;default:Be(i,e);break}e=o.next()}return i};function cc(o,e){let i=[],r,a=!1,l=!1,c=4;for(r=0;r<=c;r++){let h={};for(;e!=="EOF"&&!(e.code===0||l);){switch(e.code){case 10:case 11:case 12:case 13:if(a){l=!0;continue}h.x=e.value,a=!0;break;case 20:case 21:case 22:case 23:h.y=e.value;break;case 30:case 31:case 32:case 33:h.z=e.value;break;default:return i}e=o.next()}i.push(h),a=!1,l=!1}return o.rewind(),i}function Xn(){}Xn.ForEntityName="ARC";Xn.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.center=ye(o);break;case 40:i.radius=e.value;break;case 50:i.startAngle=Math.PI/180*e.value;break;case 51:i.endAngle=Math.PI/180*e.value,i.angleLength=i.endAngle-i.startAngle;break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i};function Zn(){}Zn.ForEntityName="ATTDEF";Zn.prototype.parseEntity=function(o,e){let i={type:e.value,scale:1,textStyle:"STANDARD"};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 1:i.text=e.value;break;case 2:i.tag=e.value;break;case 3:i.prompt=e.value;break;case 7:i.textStyle=e.value;break;case 10:i.startPoint=ye(o);break;case 11:i.endPoint=ye(o);break;case 39:i.thickness=e.value;break;case 40:i.textHeight=e.value;break;case 41:i.scale=e.value;break;case 50:i.rotation=e.value;break;case 51:i.obliqueAngle=e.value;break;case 70:i.invisible=!!(e.value&1),i.constant=!!(e.value&2),i.verificationRequired=!!(e.value&4),i.preset=!!(e.value&8);break;case 71:i.backwards=!!(e.value&2),i.mirrored=!!(e.value&4);break;case 72:i.horizontalJustification=e.value;break;case 73:i.fieldLength=e.value;break;case 74:i.verticalJustification=e.value;break;case 100:break;case 101:Jo(o);break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i};function Yn(){}Yn.ForEntityName="CIRCLE";Yn.prototype.parseEntity=function(o,e){let i,r;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.center=ye(o);break;case 40:i.radius=e.value;break;case 50:i.startAngle=Math.PI/180*e.value;break;case 51:r=Math.PI/180*e.value,r<i.startAngle?i.angleLength=r+2*Math.PI-i.startAngle:i.angleLength=r-i.startAngle,i.endAngle=r;break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i};function Kn(){}Kn.ForEntityName="DIMENSION";Kn.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 2:i.block=e.value;break;case 10:i.anchorPoint=ye(o);break;case 11:i.middleOfText=ye(o);break;case 12:i.insertionPoint=ye(o);break;case 13:i.linearOrAngularPoint1=ye(o);break;case 14:i.linearOrAngularPoint2=ye(o);break;case 15:i.diameterOrRadiusPoint=ye(o);break;case 16:i.arcPoint=ye(o);break;case 70:i.dimensionType=e.value;break;case 71:i.attachmentPoint=e.value;break;case 42:i.actualMeasurement=e.value;break;case 1:i.text=e.value;break;case 50:i.angle=e.value;break;default:Be(i,e);break}e=o.next()}return i};function qn(){}qn.ForEntityName="ELLIPSE";qn.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.center=ye(o);break;case 11:i.majorAxisEndPoint=ye(o);break;case 40:i.axisRatio=e.value;break;case 41:i.startAngle=e.value;break;case 42:i.endAngle=e.value;break;case 2:i.name=e.value;break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i};function Qn(){}Qn.ForEntityName="INSERT";Qn.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 2:i.name=e.value;break;case 41:i.xScale=e.value;break;case 42:i.yScale=e.value;break;case 43:i.zScale=e.value;break;case 10:i.position=ye(o);break;case 50:i.rotation=e.value;break;case 70:i.columnCount=e.value;break;case 71:i.rowCount=e.value;break;case 44:i.columnSpacing=e.value;break;case 45:i.rowSpacing=e.value;break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i};function Jn(){}Jn.ForEntityName="LINE";Jn.prototype.parseEntity=function(o,e){let i={type:e.value,vertices:[]};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.vertices.unshift(ye(o));break;case 11:i.vertices.push(ye(o));break;case 210:i.extrusionDirection=ye(o);break;case 100:break;default:Be(i,e);break}e=o.next()}return i};function $n(){}$n.ForEntityName="LWPOLYLINE";$n.prototype.parseEntity=function(o,e){let i={type:e.value,vertices:[]},r=0;for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 38:i.elevation=e.value;break;case 39:i.depth=e.value;break;case 70:i.shape=(e.value&1)===1,i.hasContinuousLinetypePattern=(e.value&128)===128;break;case 90:r=e.value;break;case 10:i.vertices=hc(r,o);break;case 43:e.value!==0&&(i.width=e.value);break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i};function hc(o,e){if(!o||o<=0)throw Error("n must be greater than 0 verticies");let i=[],r,a=!1,l=!1,c=e.lastReadGroup;for(r=0;r<o;r++){let h={};for(;c!=="EOF"&&!(c.code===0||l);){switch(c.code){case 10:if(a){l=!0;continue}h.x=c.value,a=!0;break;case 20:h.y=c.value;break;case 30:h.z=c.value;break;case 40:h.startWidth=c.value;break;case 41:h.endWidth=c.value;break;case 42:c.value!=0&&(h.bulge=c.value);break;default:return a&&i.push(h),e.rewind(),i}c=e.next()}i.push(h),a=!1,l=!1}return e.rewind(),i}function ei(){}ei.ForEntityName="MTEXT";ei.prototype.parseEntity=function(o,e){let i={type:e.value};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 3:case 1:i.text?i.text+=e.value:i.text=e.value;break;case 10:i.position=ye(o);break;case 11:i.direction=ye(o);break;case 40:i.height=e.value;break;case 41:i.width=e.value;break;case 44:i.lineSpacing=e.value;break;case 50:i.rotation=e.value;break;case 71:i.attachmentPoint=e.value;break;case 72:i.drawingDirection=e.value;break;case 101:Jo(o);break;default:Be(i,e);break}e=o.next()}return i};function ti(){}ti.ForEntityName="POINT";ti.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.position=ye(o);break;case 39:i.thickness=e.value;break;case 210:i.extrusionDirection=ye(o);break;case 100:break;default:Be(i,e);break}e=o.next()}return i};function si(){}si.ForEntityName="VERTEX";si.prototype.parseEntity=function(o,e){let i={type:e.value};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.x=e.value;break;case 20:i.y=e.value;break;case 30:i.z=e.value;break;case 40:break;case 41:break;case 42:e.value!=0&&(i.bulge=e.value);break;case 70:i.curveFittingVertex=(e.value&1)!==0,i.curveFitTangent=(e.value&2)!==0,i.splineVertex=(e.value&8)!==0,i.splineControlPoint=(e.value&16)!==0,i.threeDPolylineVertex=(e.value&32)!==0,i.threeDPolylineMesh=(e.value&64)!==0,i.polyfaceMeshVertex=(e.value&128)!==0;break;case 50:break;case 71:i.faceA=e.value;break;case 72:i.faceB=e.value;break;case 73:i.faceC=e.value;break;case 74:i.faceD=e.value;break;default:Be(i,e);break}e=o.next()}return i};function ni(){}ni.ForEntityName="POLYLINE";ni.prototype.parseEntity=function(o,e){let i={type:e.value,vertices:[]};for(e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:break;case 20:break;case 30:break;case 39:i.thickness=e.value;break;case 40:break;case 41:break;case 70:i.shape=(e.value&1)!==0,i.includesCurveFitVertices=(e.value&2)!==0,i.includesSplineFitVertices=(e.value&4)!==0,i.is3dPolyline=(e.value&8)!==0,i.is3dPolygonMesh=(e.value&16)!==0,i.is3dPolygonMeshClosed=(e.value&32)!==0,i.isPolyfaceMesh=(e.value&64)!==0,i.hasContinuousLinetypePattern=(e.value&128)!==0;break;case 71:break;case 72:break;case 73:break;case 74:break;case 75:break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i.vertices=uc(o,e),i};function uc(o,e){let i=new si,r=[];for(;!o.isEOF();)if(e.code===0){if(e.value==="VERTEX")r.push(i.parseEntity(o,e)),e=o.lastReadGroup;else if(e.value==="SEQEND"){pc(o,e);break}}return r}function pc(o,e){let i={type:e.value};for(e=o.next();e!="EOF"&&e.code!=0;)Be(i,e),e=o.next();return i}function ii(){}ii.ForEntityName="SOLID";ii.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},i.points=[],e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.points[0]=ye(o);break;case 11:i.points[1]=ye(o);break;case 12:i.points[2]=ye(o);break;case 13:i.points[3]=ye(o);break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i};function oi(){}oi.ForEntityName="SPLINE";oi.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.controlPoints||(i.controlPoints=[]),i.controlPoints.push(ye(o));break;case 11:i.fitPoints||(i.fitPoints=[]),i.fitPoints.push(ye(o));break;case 12:i.startTangent=ye(o);break;case 13:i.endTangent=ye(o);break;case 40:i.knotValues||(i.knotValues=[]),i.knotValues.push(e.value);break;case 70:e.value&1&&(i.closed=!0),e.value&2&&(i.periodic=!0),e.value&4&&(i.rational=!0),e.value&8&&(i.planar=!0),e.value&16&&(i.planar=!0,i.linear=!0);break;case 71:i.degreeOfSplineCurve=e.value;break;case 72:i.numberOfKnots=e.value;break;case 73:i.numberOfControlPoints=e.value;break;case 74:i.numberOfFitPoints=e.value;break;case 210:i.extrusionDirection=ye(o);break;default:Be(i,e);break}e=o.next()}return i};function ri(){}ri.ForEntityName="TEXT";ri.prototype.parseEntity=function(o,e){let i;for(i={type:e.value},e=o.next();e!=="EOF"&&e.code!==0;){switch(e.code){case 10:i.startPoint=ye(o);break;case 11:i.endPoint=ye(o);break;case 40:i.textHeight=e.value;break;case 41:i.xScale=e.value;break;case 50:i.rotation=e.value;break;case 1:i.text=e.value;break;case 72:i.halign=e.value;break;case 73:i.valign=e.value;break;default:Be(i,e);break}e=o.next()}return i};function dc(o){o.registerEntityHandler(Wn),o.registerEntityHandler(Xn),o.registerEntityHandler(Zn),o.registerEntityHandler(Yn),o.registerEntityHandler(Kn),o.registerEntityHandler(qn),o.registerEntityHandler(Qn),o.registerEntityHandler(Jn),o.registerEntityHandler($n),o.registerEntityHandler(ei),o.registerEntityHandler(ti),o.registerEntityHandler(ni),o.registerEntityHandler(ii),o.registerEntityHandler(oi),o.registerEntityHandler(ri)}function ss(){this._entityHandlers={},dc(this)}ss.prototype.parse=function(o,e){throw new Error("read() not implemented. Use readSync()")};ss.prototype.registerEntityHandler=function(o){let e=new o;this._entityHandlers[o.ForEntityName]=e};ss.prototype.parseSync=function(o){return typeof o=="string"?this._parse(o):(console.error("Cannot read dxf source of type `"+typeof o),null)};ss.prototype.parseStream=function(o,e){let i="",r=this;o.on("data",a),o.on("end",l),o.on("error",c);function a(h){i+=h}function l(){try{let h=r._parse(i)}catch(h){return e(h)}e(null,dxf)}function c(h){e(h)}};ss.prototype._parse=function(o){let e,i,r={},a=0,l=o.split(/\r\n|\r|\n/g);if(e=new ts(l),!e.hasNext())throw Error("Empty file");let c=this,h=function(){for(i=e.next();!e.isEOF();)if(i.code===0&&i.value==="SECTION"){if(i=e.next(),i.code!==2){console.error("Unexpected code %s after 0:SECTION",$o(i)),i=e.next();continue}i.value==="HEADER"?r.header=u():i.value==="BLOCKS"?r.blocks=d():i.value==="ENTITIES"?r.entities=O(!1):i.value==="TABLES"?r.tables=v():i.value}else i=e.next()},p=function(B,I){return i.code===B&&i.value===I},u=function(){let B=null,I=null,G={};for(i=e.next();;){if(p(0,"ENDSEC")){B&&(G[B]=I);break}else i.code===9?(B&&(G[B]=I),B=i.value):i.code===10?I={x:i.value}:i.code===20?I.y=i.value:i.code===30?I.z=i.value:I=i.value;i=e.next()}return i=e.next(),G},d=function(){let B={},I;for(i=e.next();i.value!=="EOF"&&!p(0,"ENDSEC");)p(0,"BLOCK")?(I=m(),V(I),I.name?B[I.name]=I:console.error('block with handle "'+I.handle+'" is missing a name.')):(Ot(i),i=e.next());return B},m=function(){let B={};for(i=e.next();i.value!=="EOF";){switch(i.code){case 1:B.xrefPath=i.value,i=e.next();break;case 2:B.name=i.value,i=e.next();break;case 3:B.name2=i.value,i=e.next();break;case 5:B.handle=i.value,i=e.next();break;case 8:B.layer=i.value,i=e.next();break;case 10:B.position=P(),i=e.next();break;case 67:B.paperSpace=!!(i.value&&i.value==1),i=e.next();break;case 70:i.value!=0&&(B.type=i.value),i=e.next();break;case 100:i=e.next();break;case 330:B.ownerHandle=i.value,i=e.next();break;case 0:if(i.value=="ENDBLK")break;B.entities=O(!0);break;default:Ot(i),i=e.next()}if(p(0,"ENDBLK")){i=e.next();break}}return B},v=function(){let B={};for(i=e.next();i.value!=="EOF"&&!p(0,"ENDSEC");)p(0,"TABLE")?(i=e.next(),A[i.value]&&(B[A[i.value].tableName]=x())):i=e.next();return i=e.next(),B};const y="ENDTAB";let x=function(){let B=A[i.value],I={},G=0,W;for(i=e.next();!p(0,y);)switch(i.code){case 5:I.handle=i.value,i=e.next();break;case 330:I.ownerHandle=i.value,i=e.next();break;case 100:i.value==="AcDbSymbolTable"||Ot(i),i=e.next();break;case 70:G=i.value,i=e.next();break;case 0:i.value===B.dxfSymbolName?I[B.tableRecordsProperty]=B.parseTableRecords():(Ot(i),i=e.next());break;default:Ot(i),i=e.next()}let j=I[B.tableRecordsProperty];return j&&(j.constructor===Array?W=j.length:typeof j=="object"&&(W=Object.keys(j).length),G!==W&&console.warn("Parsed "+W+" "+B.dxfSymbolName+"'s but expected "+G)),i=e.next(),I},A={VPORT:{tableRecordsProperty:"viewPorts",tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:function(){let B=[],I={};for(i=e.next();!p(0,y);)switch(i.code){case 2:I.name=i.value,i=e.next();break;case 10:I.lowerLeftCorner=P(),i=e.next();break;case 11:I.upperRightCorner=P(),i=e.next();break;case 12:I.center=P(),i=e.next();break;case 13:I.snapBasePoint=P(),i=e.next();break;case 14:I.snapSpacing=P(),i=e.next();break;case 15:I.gridSpacing=P(),i=e.next();break;case 16:I.viewDirectionFromTarget=P(),i=e.next();break;case 17:I.viewTarget=P(),i=e.next();break;case 42:I.lensLength=i.value,i=e.next();break;case 43:I.frontClippingPlane=i.value,i=e.next();break;case 44:I.backClippingPlane=i.value,i=e.next();break;case 45:I.viewHeight=i.value,i=e.next();break;case 50:I.snapRotationAngle=i.value,i=e.next();break;case 51:I.viewTwistAngle=i.value,i=e.next();break;case 79:I.orthographicType=i.value,i=e.next();break;case 110:I.ucsOrigin=P(),i=e.next();break;case 111:I.ucsXAxis=P(),i=e.next();break;case 112:I.ucsYAxis=P(),i=e.next();break;case 110:I.ucsOrigin=P(),i=e.next();break;case 281:I.renderMode=i.value,i=e.next();break;case 281:I.defaultLightingType=i.value,i=e.next();break;case 292:I.defaultLightingOn=i.value,i=e.next();break;case 330:I.ownerHandle=i.value,i=e.next();break;case 63:case 421:case 431:I.ambientColor=i.value,i=e.next();break;case 0:i.value==="VPORT"&&(B.push(I),I={},i=e.next());break;default:Ot(i),i=e.next();break}return B.push(I),B}},LTYPE:{tableRecordsProperty:"lineTypes",tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:function(){let B={},I,G={},W;for(i=e.next();!p(0,"ENDTAB");)switch(i.code){case 2:G.name=i.value,I=i.value,i=e.next();break;case 3:G.description=i.value,i=e.next();break;case 73:W=i.value,W>0&&(G.pattern=[]),i=e.next();break;case 40:G.patternLength=i.value,i=e.next();break;case 49:G.pattern.push(i.value),i=e.next();break;case 0:W>0&&W!==G.pattern.length&&console.warn("lengths do not match on LTYPE pattern"),B[I]=G,G={},i=e.next();break;default:i=e.next()}return B[I]=G,B}},LAYER:{tableRecordsProperty:"layers",tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:function(){let B={},I,G={};for(i=e.next();!p(0,"ENDTAB");)switch(i.code){case 2:G.name=i.value,I=i.value,i=e.next();break;case 62:G.visible=i.value>=0,G.colorIndex=Math.abs(i.value),G.color=fc(G.colorIndex),i=e.next();break;case 70:G.frozen=(i.value&1)!==0||(i.value&2)!==0,i=e.next();break;case 420:G.color=i.value,i=e.next();break;case 0:i.value==="LAYER"&&(B[I]=G,G={},I=void 0,i=e.next());break;default:Ot(i),i=e.next();break}return B[I]=G,B}}},O=function(B){let I=[],G=B?"ENDBLK":"ENDSEC";for(B||(i=e.next());;)if(i.code===0){if(i.value===G)break;let W;(i.value=="TEXT"||i.value=="MTEXT")&&console.log("curr.value",i.value);let j=c._entityHandlers[i.value];if(j!=null)W=j.parseEntity(e,i),i=e.lastReadGroup;else{i=e.next();continue}V(W),I.push(W)}else i=e.next();return G=="ENDSEC"&&(i=e.next()),I},P=function(){let B={},I=i.code;if(B.x=i.value,I+=10,i=e.next(),i.code!=I)throw new Error("Expected code for point value to be "+I+" but got "+i.code+".");return B.y=i.value,I+=10,i=e.next(),i.code!=I?(e.rewind(),B):(B.z=i.value,B)},V=function(B){if(!B)throw new TypeError("entity cannot be undefined or null");B.handle||(B.handle=a++)};return h(),r};function Ot(o){console.debug("unhandled group "+$o(o))}function $o(o){return o.code+":"+o.value}function fc(o){return Qo[o]}class mc{constructor(e){this.url=e}async Fetch(){const e=await fetch(this.url).then(l=>l.arrayBuffer()),r=new TextDecoder("utf-8").decode(e);return new ss().parseSync(r)}}class Qs{constructor(e,i=16){this.type=e,this.capacity=i,this.size=0,this.buffer=new(mn(e))(i)}GetSize(){return this.size}Push(e){this._CheckGrow();const i=this.size;return this.buffer[i]=e,this.size++,i}Get(e){if(e>=this.size)throw new Error(`Index out of range: ${e}/${this.size}`);return this.buffer[e]}CopyTo(e,i,r=0,a=-1){a===-1&&(a=this.size-r);const l=new(mn(this.type))(this.buffer.buffer,r,a);e.set(l,i)}_CheckGrow(){if(this.size<this.capacity)return;this.capacity*=2;const e=new(mn(this.type))(this.capacity);e.set(this.buffer),this.buffer=e}}const Xe={INT8:0,UINT8:1,UINT8_CLAMPED:2,INT16:3,UINT16:4,INT32:5,UINT32:6,INT64:7,UINT64:8,FLOAT32:9,FLOAT64:10};function mn(o){switch(o){case Xe.INT8:return Int8Array;case Xe.UINT8:return Uint8Array;case Xe.UINT8_CLAMPED:return Uint8ClampedArray;case Xe.INT16:return Int16Array;case Xe.UINT16:return Uint16Array;case Xe.INT32:return Int32Array;case Xe.UINT32:return Uint32Array;case Xe.FLOAT32:return Float32Array;case Xe.FLOAT64:return Float64Array;default:throw new Error("Unrecognized native type: "+o)}}const as=65536;function*gn(o,e){for(let i=0;i<o-1;i++)yield i,yield i+1;e&&o>2&&(yield o-1,yield 0)}class ve{constructor({type:e,vertices:i,indices:r=null,layer:a=null,color:l,lineType:c=0,shape:h=!1}){this.type=e,this.vertices=i,this.indices=r,this.layer=a,this.color=l,this.lineType=c,this.shape=h}*_IterateVertices(e,i){for(let r=e;r<e+i;r++)yield this.vertices[r]}*_IterateLineChunks(){const e=this.vertices.length;if(e<2)return;const i=this;for(let r=0;r<=e;r+=as){let a=e-r,l;if(a>as?(a=as,l=!1):l=!0,l&&this.shape&&r>0&&a===as&&(l=!1),r===e&&!this.shape)break;let c,h,p;a<2?(a===1&&this.shape?c=function*(){yield this.vertices[r],yield this.vertices[0]}():a===1?c=function*(){yield this.vertices[r-1],yield this.vertices[r]}():c=function*(){yield this.vertices[e-1],yield this.vertices[0]}(),h=gn(2,!1),p=2):l&&this.shape&&r>0&&a<as?(c=function*(){yield*i._IterateVertices(r,a),yield this.vertices[0]}(),h=gn(a+1,!1),p=a+1):(c=this._IterateVertices(r,a),h=gn(a,l&&r===0&&this.shape),p=a),yield{verticesCount:p,vertices:c,indices:h}}}}ve.Type=Object.freeze({POINTS:0,LINE_SEGMENTS:1,POLYLINE:2,TRIANGLES:3});const Ae=Object.freeze({TEXT:0,ESCAPE:1,SKIP_FORMAT:2,PARAGRAPH1:3,PARAGRAPH2:4,PARAGRAPH3:5}),Tt=Object.freeze({TEXT:0,SCOPE:1,PARAGRAPH:2,NON_BREAKING_SPACE:3,PARAGRAPH_ALIGNMENT:4}),gc=new Set(["L","l","O","o","K","k","P","X","~"]),yc=new Set(["f","F","p","Q","H","W","S","A","C","T"]),vc=new Set(["\\","{","}"]);class Lt{constructor(){this.entities=[]}Parse(e){const i=e.length;let r=0,a=Ae.TEXT,l=[],c=this.entities,h=0;const p=this;function u(){a!==Ae.TEXT||r===h||(c.push({type:Tt.TEXT,content:e.slice(r,h)}),r=h)}function d(y){c.push({type:y})}function m(){const y={type:Tt.SCOPE,content:[]};c.push(y),c=y.content,l.push(y)}function v(){l.length!==0&&(l.pop(),l.length===0?c=p.entities:c=l[l.length-1].content)}for(;h<i;h++){const y=e.charAt(h);switch(a){case Ae.TEXT:if(y==="{"){u(),m(),r=h+1;continue}if(y==="}"){u(),v(),r=h+1;continue}if(y==="\\"){u(),a=Ae.ESCAPE;continue}continue;case Ae.ESCAPE:if(gc.has(y)){switch(y){case"P":d(Tt.PARAGRAPH);break;case"~":d(Tt.NON_BREAKING_SPACE);break}a=Ae.TEXT,r=h+1;continue}if(yc.has(y)){switch(y){case"p":a=Ae.PARAGRAPH1;continue}a=Ae.SKIP_FORMAT;continue}vc.has(y)?r=h:r=h-1,a=Ae.TEXT;continue;case Ae.PARAGRAPH1:a=y==="x"?Ae.PARAGRAPH2:Ae.SKIP_FORMAT;continue;case Ae.PARAGRAPH2:a=y==="q"?Ae.PARAGRAPH3:Ae.SKIP_FORMAT;continue;case Ae.PARAGRAPH3:c.push({type:Tt.PARAGRAPH_ALIGNMENT,alignment:y}),a=Ae.SKIP_FORMAT;continue;case Ae.SKIP_FORMAT:y===";"&&(r=h+1,a=Ae.TEXT);continue;default:throw new Error("Unhandled state")}}u()}GetContent(){return this.entities}*GetText(){function*e(i){for(const r of i)r.type===Tt.TEXT?yield r.content:r.type===Tt.SCOPE&&(yield*e(r.content))}yield*e(this.GetContent())}}Lt.EntityType=Tt;class bs{constructor(e,i=null){this.fontFetchers=e,this.fonts=[],this.font=null,this.options={arcTessellationAngle:10/180*Math.PI,minArcTessellationSubdivisions:8,wireframeMesh:!1,textOptions:bs.DefaultOptions},i&&Object.assign(this.options,i),this.shapes=new Map,this.stubShapeLoaded=!1,this.stubShape=null}async FetchFonts(e){if(!this.stubShapeLoaded){this.stubShapeLoaded=!0;for(const r of Array.from(this.options.fallbackChar))if(await this.FetchFonts(r)){this.stubShape=this._CreateCharShape(r);break}}let i=!1;for(const r of e){if(r.codePointAt(0)<32)continue;let a=!1;for(const l of this.fonts)if(l.HasChar(r)){a=!0;break}if(!a){if(!this.fontFetchers)return!1;for(;this.fontFetchers.length>0;){const l=this.fontFetchers.shift(),c=await this._FetchFont(l);if(this.fonts.push(c),c.HasChar(r)){a=!0;break}}a||(i=!0)}}return!i}get canRender(){return this.fonts!==null&&this.fonts.length>0}*Render({text:e,startPos:i,endPos:r,rotation:a=0,widthFactor:l=1,hAlign:c=0,vAlign:h=0,color:p,layer:u=null,fontSize:d}){const m=new er(d);for(const v of e){const y=this._GetCharShape(v);y&&m.PushChar(v,y)}yield*m.Render(i,r,a,l,c,h,p,u)}*RenderMText({formattedText:e,position:i,fontSize:r,width:a=null,rotation:l=0,direction:c=null,attachment:h,lineSpacing:p=1,color:u,layer:d=null}){const m=new Me(r,this._GetCharShape.bind(this));m.FeedText(e),yield*m.Render(i,a,l,c,h,p,u,d)}_GetCharShape(e){let i=this.shapes.get(e);return i||(i=this._CreateCharShape(e),this.shapes.set(e,i),i)}_CreateCharShape(e){for(const i of this.fonts){const r=i.GetCharPath(e);if(r)return new bc(i,r,this.options)}return this.stubShape}async _FetchFont(e){return new xc(await e())}}bs.DefaultOptions={curveSubdivision:2,fallbackChar:"�?"};class bc{constructor(e,i,r){if(this.font=e,this.advance=i.advance,this.bounds=i.bounds,i.path){const a=i.path.toShapes(!1);this.vertices=[],this.indices=[];for(const l of a){let d=function(m){for(const v of m)p.vertices.push(v)};const c=l.extractPoints(r.curveSubdivision);if(!pn.ShapeUtils.isClockWise(c.shape)){c.shape=c.shape.reverse();for(const m of c.holes)pn.ShapeUtils.isClockWise(m)&&(c.holes[g.h]=m.reverse())}const h=pn.ShapeUtils.triangulateShape(c.shape,c.holes),p=this,u=this.vertices.length;d(c.shape);for(const m of c.holes)d(m);for(const m of h)for(const v of m)this.indices.push(u+v)}}else this.vertices=null}GetVertices(e,i){return this.vertices.map(r=>r.clone().multiplyScalar(i).add(e))}}class xc{constructor(e){this.data=e,this.charMap=new Map;for(const i of Object.values(e.glyphs.glyphs))i.unicode!==void 0&&this.charMap.set(String.fromCodePoint(i.unicode),i);this.scale=100/((this.data.unitsPerEm||2048)*72)}HasChar(e){return this.charMap.has(e)}GetCharPath(e){const i=this.charMap.get(e);if(!i)return null;const r=this.scale,a=new Pa.ShapePath;for(const l of i.path.commands)switch(l.type){case"M":a.moveTo(l.x*r,l.y*r);break;case"L":a.lineTo(l.x*r,l.y*r);break;case"Q":a.quadraticCurveTo(l.x1*r,l.y1*r,l.x*r,l.y*r);break;case"C":a.bezierCurveTo(l.x1*r,l.y1*r,l.x2*r,l.y2*r,l.x*r,l.y*r);break}return{advance:i.advanceWidth*r,path:a,bounds:{xMin:i.xMin*r,xMax:i.xMax*r,yMin:i.yMin*r,yMax:i.yMax*r}}}GetKerning(e,i){const r=this.data.charToGlyphIndex(e);if(r===0)return 0;const a=this.data.charToGlyphIndex(e);return a===0?0:this.data.getKerningValue(r,a)*this.scale}}const tt=Object.freeze({LEFT:0,CENTER:1,RIGHT:2,ALIGNED:3,MIDDLE:4,FIT:5}),Pt=Object.freeze({BASELINE:0,BOTTOM:1,MIDDLE:2,TOP:3}),Pe=Object.freeze({TOP_LEFT:1,TOP_CENTER:2,TOP_RIGHT:3,MIDDLE_LEFT:4,MIDDLE_CENTER:5,MIDDLE_RIGHT:6,BOTTOM_LEFT:7,BOTTOM_CENTER:8,BOTTOM_RIGHT:9});class Me{constructor(e,i){this.fontSize=e,this.charShapeProvider=i,this.curParagraph=new Me.Paragraph(this),this.paragraphs=[this.curParagraph],this.spaceShape=i(" ")}FeedText(e){function*i(a){for(const l of a)l.type===Lt.EntityType.SCOPE?yield*i(l.content):yield l}let r=null;for(const a of i(e))switch(a.type){case Lt.EntityType.TEXT:for(const c of a.content)c===" "?this.curParagraph.FeedSpace():this.curParagraph.FeedChar(c);break;case Lt.EntityType.PARAGRAPH:this.curParagraph=new Me.Paragraph(this),this.curParagraph.SetAlignment(r),this.paragraphs.push(this.curParagraph);break;case Lt.EntityType.NON_BREAKING_SPACE:this.curParagraph.FeedChar(" ");break;case Lt.EntityType.PARAGRAPH_ALIGNMENT:let l=null;switch(a.alignment){case"l":l=Me.Paragraph.Alignment.LEFT;break;case"c":l=Me.Paragraph.Alignment.CENTER;break;case"r":l=Me.Paragraph.Alignment.RIGHT;break;case"d":l=Me.Paragraph.Alignment.JUSTIFY;break;case"j":l=null;break}this.curParagraph.SetAlignment(l),r=l;break}}*Render(e,i,r,a,l,c,h,p){for(const b of this.paragraphs)b.BuildLines(i);if(i===null||i===0){i=0;for(const b of this.paragraphs){const C=b.GetMaxLineWidth();C>i&&(i=C)}}let u=Me.Paragraph.Alignment.LEFT;switch(l){case Pe.TOP_CENTER:case Pe.MIDDLE_CENTER:case Pe.BOTTOM_CENTER:u=Me.Paragraph.Alignment.CENTER;break;case Pe.TOP_RIGHT:case Pe.MIDDLE_RIGHT:case Pe.BOTTOM_RIGHT:u=Me.Paragraph.Alignment.RIGHT;break}for(const b of this.paragraphs)b.ApplyAlignment(i,u);a!==null&&(r=Math.atan2(a.y,a.x)*180/Math.PI);const d=c*5*this.fontSize/3;let m=0;for(const b of this.paragraphs)b.lines===null?m++:m+=b.lines.length;m*=d;let v=new f.Vector2;switch(l){case Pe.TOP_LEFT:break;case Pe.TOP_CENTER:v.x=i/2;break;case Pe.TOP_RIGHT:v.x=i;break;case Pe.MIDDLE_LEFT:v.y=-m/2;break;case Pe.MIDDLE_CENTER:v.x=i/2,v.y=-m/2;break;case Pe.MIDDLE_RIGHT:v.x=i,v.y=-m/2;break;case Pe.BOTTOM_LEFT:v.y=-m;break;case Pe.BOTTOM_CENTER:v.x=i/2,v.y=-m;break;case Pe.BOTTOM_RIGHT:v.x=i,v.y=-m;break;default:throw new Error("Unhandled alignment")}const y=new f.Matrix3().translate(-v.x,-v.y).rotate(-r*Math.PI/180).translate(e.x,e.y);let x=-this.fontSize;for(const b of this.paragraphs){if(b.lines===null){x-=d;continue}for(const C of b.lines){for(let T=C.startChunkIdx;T<C.startChunkIdx+C.numChunks;T++){const A=b.chunks[T];let O=A.position;(T===0||T!==C.startChunkIdx)&&(O+=A.GetSpacingWidth());const P=new f.Vector2(O,x);P.applyMatrix3(y),A.block&&(yield*A.block.Render(P,null,r,null,tt.LEFT,Pt.BASELINE,h,p))}x-=d}}}}Me.Paragraph=class{constructor(o){this.textBox=o,this.chunks=[],this.curChunk=null,this.alignment=null,this.lines=null}FeedChar(o){const e=this.textBox.charShapeProvider(o);e!==null&&(this.curChunk===null&&this._AddChunk(),this.curChunk.PushChar(o,e))}FeedSpace(){(this.curChunk===null||this.curChunk.lastChar!==null)&&this._AddChunk(),this.curChunk.PushSpace()}SetAlignment(o){this.alignment=o}BuildLines(o){if(this.curChunk===null)return;this.lines=[];let e=0,i=0,r=0;const a=()=>{this.lines.push(new Me.Paragraph.Line(this,e,i-e,r)),e=i,r=0};for(;i<this.chunks.length;i++){const l=this.chunks[i],c=l.GetWidth(e===0||i!==e);o!==null&&o!==0&&r!==0&&r+c>o&&a(),l.position=r,r+=c}e!==i&&r!==0&&a()}GetMaxLineWidth(){if(this.lines===null)return 0;let o=0;for(const e of this.lines)e.width>o&&(o=e.width);return o}ApplyAlignment(o,e){if(this.lines)for(const i of this.lines)i.ApplyAlignment(o,e)}_AddChunk(){this.curChunk=new Me.Paragraph.Chunk(this,this.textBox.fontSize,this.curChunk),this.chunks.push(this.curChunk)}};Me.Paragraph.Alignment=Object.freeze({LEFT:0,CENTER:1,RIGHT:2,JUSTIFY:3});Me.Paragraph.Chunk=class{constructor(o,e,i){this.paragraph=o,this.fontSize=e,this.prevChunk=i,this.lastChar=null,this.lastShape=null,this.leadingSpaces=0,this.spaceStartKerning=null,this.spaceEndKerning=null,this.block=null,this.position=null}PushSpace(){if(this.block)throw new Error("Illegal operation");this.leadingSpaces++}PushChar(o,e){this.spaceStartKerning===null&&(this.leadingSpaces===0?(this.spaceStartKerning=0,this.spaceEndKerning=0):(this.prevChunk&&this.prevChunk.lastShape&&this.prevChunk.fontSize===this.fontSize&&this.prevChunk.lastShape.font===this.paragraph.textBox.spaceShape.font?this.spaceStartKerning=this.prevChunk.lastShape.font.GetKerning(this.prevChunk.lastChar," "):this.spaceStartKerning=0,e.font===this.paragraph.textBox.spaceShape.font?this.spaceEndKerning=e.font.GetKerning(" ",o):this.spaceEndKerning=0)),this.block===null&&(this.block=new er(this.fontSize)),this.block.PushChar(o,e),this.lastChar=o,this.lastShape=e}GetSpacingWidth(){return(this.leadingSpaces*this.paragraph.textBox.spaceShape.advance+this.spaceStartKerning+this.spaceEndKerning)*this.fontSize}GetWidth(o){if(this.block===null)return 0;let e=this.block.GetCurrentPosition();return o&&(e+=this.GetSpacingWidth()),e}};Me.Paragraph.Line=class{constructor(o,e,i,r){this.paragraph=o,this.startChunkIdx=e,this.numChunks=i,this.width=r}ApplyAlignment(o,e){switch(this.paragraph.alignment??e){case Me.Paragraph.Alignment.LEFT:break;case Me.Paragraph.Alignment.CENTER:{const r=(o-this.width)/2;this.ForEachChunk(a=>a.position+=r);break}case Me.Paragraph.Alignment.RIGHT:{const r=o-this.width;this.ForEachChunk(a=>a.position+=r);break}case Me.Paragraph.Alignment.JUSTIFY:{const r=o-this.width;if(r<=0||this.numChunks===1)break;const a=r/(this.numChunks-1);let l=0;this.ForEachChunk(c=>{c.position+=l,l+=a});break}default:throw new Error("Unhandled alignment: "+this.paragraph.alignment)}}ForEachChunk(o){for(let e=0;e<this.numChunks;e++)o(this.paragraph.chunks[this.startChunkIdx+e])}};class er{constructor(e){this.fontSize=e,this.glyphs=[],this.bounds=null,this.curX=0,this.prevChar=null,this.prevFont=null}PushChar(e,i){let r;this.prevChar!==null&&this.prevFont===i.font?r=this.prevFont.GetKerning(this.prevChar,e):r=0;const a=this.curX+r*this.fontSize;let l;if(i.vertices){l=i.GetVertices({x:a,y:0},this.fontSize);const c=a+i.bounds.xMin*this.fontSize,h=a+i.bounds.xMax*this.fontSize,p=i.bounds.yMin*this.fontSize,u=i.bounds.yMax*this.fontSize;this.bounds===null?this.bounds={xMin:c,xMax:h,yMin:p,yMax:u}:(c<this.bounds.xMin&&(this.bounds.xMin=c),p<this.bounds.yMin&&(this.bounds.yMin=p),h>this.bounds.xMax&&(this.bounds.xMax=h),u>this.bounds.yMax&&(this.bounds.yMax=u))}else l=null;this.curX=a+i.advance*this.fontSize,this.glyphs.push({shape:i,vertices:l}),this.prevChar=e,this.prevFont=i.font}GetCurrentPosition(){return this.curX}*Render(e,i,r,a,l,c,h,p){if(this.bounds===null)return;i=i??e,r?r*=-Math.PI/180:r=0,a=a??1,l=l??tt.LEFT,c=c??Pt.BASELINE;let u=new f.Vector2,d=new f.Vector2(a,1),m=l===tt.LEFT&&c===Pt.BASELINE||l===tt.FIT||l===tt.ALIGNED?new f.Vector2(e.x,e.y):new f.Vector2(i.x,i.y);const v=()=>{const b=i.x-e.x;return b<Number.MIN_VALUE*2?a:b/(this.bounds.xMax-this.bounds.xMin)},y=()=>-Math.atan2(i.y-e.y,i.x-e.x);switch(l){case tt.LEFT:u.x=this.bounds.xMin;break;case tt.CENTER:u.x=(this.bounds.xMax-this.bounds.xMin)/2;break;case tt.RIGHT:u.x=this.bounds.xMax;break;case tt.MIDDLE:u.x=(this.bounds.xMax-this.bounds.xMin)/2,u.y=(this.bounds.yMax-this.bounds.yMin)/2;break;case tt.ALIGNED:{const b=v();d.x=b,d.y=b,r=y();break}case tt.FIT:d.x=v(),r=y();break;default:console.warn("Unrecognized hAlign value: "+l)}switch(c){case Pt.BASELINE:break;case Pt.BOTTOM:u.y=this.bounds.yMin;break;case Pt.MIDDLE:u.y=(this.bounds.yMax-this.bounds.yMin)/2;break;case Pt.TOP:u.y=this.bounds.yMax;break;default:console.warn("Unrecognized vAlign value: "+c)}const x=new f.Matrix3().translate(-u.x,-u.y).scale(d.x,d.y).rotate(r).translate(m.x,m.y);for(const b of this.glyphs)if(b.vertices){for(const C of b.vertices)C.applyMatrix3(x);yield new ve({type:ve.Type.TRIANGLES,vertices:b.vertices,indices:b.shape.indices,layer:p,color:h})}}}class Cc{constructor(){}clear(){this._root=null,this.size=0}find(e){let i=this._root;for(;i!==null;){let r=this._comparator(e,i.data);if(r===0)return i.data;i=i.get_child(r>0)}return null}findIter(e){let i=this._root,r=this.iterator();for(;i!==null;){let a=this._comparator(e,i.data);if(a===0)return r._cursor=i,r;r._ancestors.push(i),i=i.get_child(a>0)}return null}lowerBound(e){let i=this._root,r=this.iterator(),a=this._comparator;for(;i!==null;){let l=a(e,i.data);if(l===0)return r._cursor=i,r;r._ancestors.push(i),i=i.get_child(l>0)}for(let l=r._ancestors.length-1;l>=0;--l)if(i=r._ancestors[l],a(e,i.data)<0)return r._cursor=i,r._ancestors.length=l,r;return r._ancestors.length=0,r}upperBound(e){let i=this.lowerBound(e),r=this._comparator;for(;i.data()!==null&&r(i.data(),e)===0;)i.next();return i}min(){let e=this._root;if(e===null)return null;for(;e.left!==null;)e=e.left;return e.data}max(){let e=this._root;if(e===null)return null;for(;e.right!==null;)e=e.right;return e.data}iterator(){return new wc(this)}each(e){let i=this.iterator(),r;for(;(r=i.next())!==null;)e(r)}reach(e){let i=this.iterator(),r;for(;(r=i.prev())!==null;)e(r)}}class wc{constructor(e){this._tree=e,this._ancestors=[],this._cursor=null}data(){return this._cursor!==null?this._cursor.data:null}next(){if(this._cursor===null){let e=this._tree._root;e!==null&&this._minNode(e)}else if(this._cursor.right===null){let e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.right===e)}else this._ancestors.push(this._cursor),this._minNode(this._cursor.right);return this._cursor!==null?this._cursor.data:null}prev(){if(this._cursor===null){let e=this._tree._root;e!==null&&this._maxNode(e)}else if(this._cursor.left===null){let e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.left===e)}else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left);return this._cursor!==null?this._cursor.data:null}_minNode(e){for(;e.left!==null;)this._ancestors.push(e),e=e.left;this._cursor=e}_maxNode(e){for(;e.right!==null;)this._ancestors.push(e),e=e.right;this._cursor=e}}class Os{constructor(e){this.data=e,this.left=null,this.right=null,this.red=!0}get_child(e){return e?this.right:this.left}set_child(e,i){e?this.right=i:this.left=i}}class tr extends Cc{constructor(e){super(),this._root=null,this._comparator=e,this.size=0}insert(e){let i=!1;if(this._root===null)this._root=new Os(e),i=!0,this.size++;else{let r=new Os(void 0),a=0,l=0,c=null,h=r,p=null,u=this._root;for(h.right=this._root;;){if(u===null?(u=new Os(e),p.set_child(a,u),i=!0,this.size++):Qe(u.left)&&Qe(u.right)&&(u.red=!0,u.left.red=!1,u.right.red=!1),Qe(u)&&Qe(p)){let m=h.right===c;u===p.get_child(l)?h.set_child(m,ds(c,!l)):h.set_child(m,Gi(c,!l))}let d=this._comparator(u.data,e);if(d===0)break;l=a,a=d<0,c!==null&&(h=c),c=p,p=u,u=u.get_child(a)}this._root=r.right}return this._root.red=!1,i}remove(e){if(this._root===null)return!1;let i=new Os(void 0),r=i;r.right=this._root;let a=null,l=null,c=null,h=1;for(;r.get_child(h)!==null;){let p=h;l=a,a=r,r=r.get_child(h);let u=this._comparator(e,r.data);if(h=u>0,u===0&&(c=r),!Qe(r)&&!Qe(r.get_child(h))){if(Qe(r.get_child(!h))){let d=ds(r,h);a.set_child(p,d),a=d}else if(!Qe(r.get_child(!h))){let d=a.get_child(!p);if(d!==null)if(!Qe(d.get_child(!p))&&!Qe(d.get_child(p)))a.red=!1,d.red=!0,r.red=!0;else{let m=l.right===a;Qe(d.get_child(p))?l.set_child(m,Gi(a,p)):Qe(d.get_child(!p))&&l.set_child(m,ds(a,p));let v=l.get_child(m);v.red=!0,r.red=!0,v.left.red=!1,v.right.red=!1}}}}return c!==null&&(c.data=r.data,a.set_child(a.right===r,r.get_child(r.left===null)),this.size--),this._root=i.right,this._root!==null&&(this._root.red=!1),c!==null}}function Qe(o){return o!==null&&o.red}function ds(o,e){let i=o.get_child(!e);return o.set_child(!e,i.get_child(e)),i.set_child(e,o),o.red=!0,i.red=!1,i}function Gi(o,e){return o.set_child(!e,ds(o.get_child(!e),!e)),ds(o,e)}const zi=65536,Ec=15*Math.PI/180,Hi="__point_shape",Sc=1024,Tc=4;class xs{constructor(e){this.options=Object.create(xs.DefaultOptions),e&&Object.assign(this.options,e.sceneOptions),this.origin=null,this.batches=new tr((i,r)=>i.key.Compare(r.key)),this.layers=new Map,this.blocks=new Map,this.bounds=null,this.pointShapeBlock=null,this.numBlocksFlattened=0}async Build(e,i){const r=e.header||{};if(this.angBase=r.$ANGBASE||0,this.angDir=r.$ANGDIR||0,this.pdMode=r.$PDMODE||0,this.pdSize=r.$PDSIZE||0,e.tables&&e.tables.layer)for(const[,a]of Object.entries(e.tables.layer.layers))this.layers.set(a.name,a);if(e.blocks)for(const[,a]of Object.entries(e.blocks))this.blocks.set(a.name,new ji(a));this.textRenderer=new bs(i,this.options.textOptions),this.hasMissingChars=!1,await this._FetchFonts(e);for(const a of e.entities)if(a.type==="INSERT"){const l=this.blocks.get(a.name);l==null||l.RegisterInsert(a)}for(const a of this.blocks.values()){if(a.data.hasOwnProperty("entities")){const l=a.DefinitionContext();for(const c of a.data.entities)this._ProcessDxfEntity(c,l)}a.SetFlatten()&&this.numBlocksFlattened++}console.log(`${this.numBlocksFlattened} blocks flattened`);for(const a of e.entities)this._ProcessDxfEntity(a);this.scene=this._BuildScene(),delete this.batches,delete this.layers,delete this.blocks,delete this.textRenderer}async _FetchFonts(e){const i=async r=>{let a;if(r.type==="TEXT")a=await this.textRenderer.FetchFonts(r.text);else if(r.type==="MTEXT"){const l=new Lt;l.Parse(r.text);for(const c of l.GetText())if(!await this.textRenderer.FetchFonts(c)){a=!1;break}a=!0}else throw new Error("Bad entity type");return a||(this.hasMissingChars=!0),a};for(const r of e.entities)if((r.type==="TEXT"||r.type==="MTEXT")&&!await i(r))return;for(const r of this.blocks.values())if(r.data.hasOwnProperty("entities")){for(const a of r.data.entities)if((a.type==="TEXT"||a.type==="MTEXT")&&!await i(a))return}}_ProcessDxfEntity(e,i=null){let r;switch(e.type){case"LINE":r=this._DecomposeLine(e,i);break;case"POLYLINE":case"LWPOLYLINE":r=this._DecomposePolyline(e,i);break;case"ARC":r=this._DecomposeArc(e,i);break;case"CIRCLE":r=this._DecomposeCircle(e,i);break;case"ELLIPSE":r=this._DecomposeEllipse(e,i);break;case"POINT":r=this._DecomposePoint(e,i);break;case"SPLINE":r=this._DecomposeSpline(e,i);break;case"INSERT":this._ProcessInsert(e,i);return;case"TEXT":r=this._DecomposeText(e,i);break;case"MTEXT":r=this._DecomposeMText(e,i);break;case"3DFACE":r=this._Decompose3DFace(e,i);break;case"SOLID":r=this._DecomposeSolid(e,i);break;default:console.log("Unhandled entity type: "+e.type);return}for(const a of r)this._ProcessEntity(a,i)}_ProcessEntity(e,i=null){switch(e.type){case ve.Type.POINTS:this._ProcessPoints(e,i);break;case ve.Type.LINE_SEGMENTS:this._ProcessLineSegments(e,i);break;case ve.Type.POLYLINE:this._ProcessPolyline(e,i);break;case ve.Type.TRIANGLES:this._ProcessTriangles(e,i);break;default:throw new Error("Unhandled entity type: "+e.type)}}_GetLineType(e,i=null,r=null){return 0}_IsPlainLine(e){return!(e.startWidth||e.endWidth)}*_DecomposeLine(e,i){if(e.vertices.length!==2)return;const r=this._GetEntityLayer(e,i),a=this._GetEntityColor(e,i);yield new ve({type:ve.Type.LINE_SEGMENTS,vertices:e.vertices,layer:r,color:a,lineType:this._GetLineType(e,e.vertices[0])})}_GenerateBulgeVertices(e,i,r,a){const l=4*Math.atan(a),c=Math.abs(l);if(c<this.options.arcTessellationAngle){e.push(r);return}const h=l/2,p=Math.sin(h),u=Math.cos(h),d={x:r.x-i.x,y:r.y-i.y},m=d.x*d.x+d.y*d.y;if(m<Number.MIN_VALUE*2)return;const v=Math.sqrt(m);let y=v/2/p;d.x/=v,d.y/=v;const x={x:(d.x*p-d.y*u)*y+i.x,y:(d.x*u+d.y*p)*y+i.y};let b=Math.floor(c/this.options.arcTessellationAngle);if(b<this.options.minArcTessellationSubdivisions&&(b=this.options.minArcTessellationSubdivisions),b>1){const C=Math.atan2(i.y-x.y,i.x-x.x),T=l/b;l<0&&(y=-y);for(let A=1;A<b;A++){const O=C+A*T,P={x:x.x+y*Math.cos(O),y:x.y+y*Math.sin(O)};e.push(P)}}e.push(r)}_GenerateArcVertices({vertices:e,center:i,radius:r,startAngle:a=null,endAngle:l=null,tessellationAngle:c=null,yRadius:h=null,transform:p=null}){if(!i||!r)return;c||(c=this.options.arcTessellationAngle),h===null&&(h=r),a==null?a=0:a+=this.angBase;let u=!1;if(l==null?(l=a+2*Math.PI,u=!0):l+=this.angBase,this.angDir){const y=a;a=l,l=y}for(;l<=a;)l+=Math.PI*2;const d=l-a;let m=Math.floor(d/c);m===0&&(m=1);const v=d/m;for(let y=0;y<=m&&!(y===m&&u);y++){const x=a+y*v,b=new f.Vector2(r*Math.cos(x),h*Math.sin(x));b.add(i),p&&b.applyMatrix3(p),e.push(b)}}*_DecomposeArc(e,i){const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this._GetLineType(e,null,i),c=[];this._GenerateArcVertices({vertices:c,center:e.center,radius:e.radius,startAngle:e.startAngle,endAngle:e.endAngle,transform:this._GetEntityExtrusionTransform(e)}),yield new ve({type:ve.Type.POLYLINE,vertices:c,layer:a,color:r,lineType:l,shape:e.endAngle===void 0})}*_DecomposeCircle(e,i){const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this._GetLineType(e,null,i),c=[];this._GenerateArcVertices({vertices:c,center:e.center,radius:e.radius,transform:this._GetEntityExtrusionTransform(e)}),yield new ve({type:ve.Type.POLYLINE,vertices:c,layer:a,color:r,lineType:l,shape:!0})}*_DecomposeEllipse(e,i){const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this._GetLineType(e,null,i),c=[],h=Math.sqrt(e.majorAxisEndPoint.x*e.majorAxisEndPoint.x+e.majorAxisEndPoint.y*e.majorAxisEndPoint.y),p=h*e.axisRatio,u=Math.atan2(e.majorAxisEndPoint.y,e.majorAxisEndPoint.x);if(this._GenerateArcVertices({vertices:c,center:e.center,radius:h,startAngle:e.startAngle,endAngle:e.endAngle,yRadius:p,transform:this._GetEntityExtrusionTransform(e)}),u!==0){const d=Math.cos(u),m=Math.sin(u);for(const v of c){const y=v.x-e.center.x,x=v.y-e.center.y;v.x=y*d-x*m+e.center.x,v.y=y*m+x*d+e.center.y}}yield new ve({type:ve.Type.POLYLINE,vertices:c,layer:a,color:r,lineType:l,shape:e.endAngle===void 0})}*_DecomposePoint(e,i){if(this.pdMode===Ve.NONE||this.pdMode!==Ve.DOT&&this.pdSize<=0)return;const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this.pdMode&Ve.MARK_MASK;if((this.pdMode&Ve.SHAPE_MASK)!==0){const p=new fe(a,Hi,fe.GeometryType.POINT_INSTANCE,r,0);this._GetBatch(p).PushVertex(this._TransformVertex(e.position)),this._CreatePointShapeBlock();return}if(l===Ve.DOT){yield new ve({type:ve.Type.POINTS,vertices:[e.position],layer:a,color:r,lineType:null});return}const h=[];this._CreatePointMarker(h,l,e.position),yield new ve({type:ve.Type.LINE_SEGMENTS,vertices:h,layer:a,color:r,lineType:null})}_CreatePointMarker(e,i,r=null){const a=this;function l(c,h){e.push({x:((r==null?void 0:r.x)??0)+c*a.pdSize*.5,y:((r==null?void 0:r.y)??0)+h*a.pdSize*.5})}switch(i){case Ve.PLUS:l(0,1.5),l(0,-1.5),l(-1.5,0),l(1.5,0);break;case Ve.CROSS:l(-1,1),l(1,-1),l(1,1),l(-1,-1);break;case Ve.TICK:l(0,1),l(0,0);break;default:console.warn("Unsupported point display type: "+i)}}_CreatePointShapeBlock(){if(this.pointShapeBlock)return;this.pointShapeBlock=new ji({name:Hi,position:{x:0,y:0}}),this.pointShapeBlock.offset=new f.Vector2(0,0);const e=this.pointShapeBlock.DefinitionContext(),i=this.pdMode&Ve.MARK_MASK;if(i!==Ve.DOT&&i!==Ve.NONE){const r=[];this._CreatePointMarker(r,i);const a=new ve({type:ve.Type.LINE_SEGMENTS,vertices:r,color:Je.BY_BLOCK});this._ProcessEntity(a,e)}if(this.pdMode&Ve.SQUARE){const r=this.pdSize*.5,a=[{x:-r,y:r},{x:r,y:r},{x:r,y:-r},{x:-r,y:-r}],l=new ve({type:ve.Type.POLYLINE,vertices:a,color:Je.BY_BLOCK,shape:!0});this._ProcessEntity(l,e)}if(this.pdMode&Ve.CIRCLE){const r=[];this._GenerateArcVertices({vertices:r,center:{x:0,y:0},radius:this.pdSize*.5,tessellationAngle:Ec});const a=new ve({type:ve.Type.POLYLINE,vertices:r,color:Je.BY_BLOCK,shape:!0});this._ProcessEntity(a,e)}}*_Decompose3DFace(e,i){yield*this._DecomposeFace(e,e.vertices,i,this.options.wireframeMesh)}*_DecomposeSolid(e,i){yield*this._DecomposeFace(e,e.points,i,!1,this._GetEntityExtrusionTransform(e))}*_DecomposeFace(e,i,r,a,l=null){const c=this._GetEntityLayer(e,r),h=this._GetEntityColor(e,r);function p(b,C,T){const A=new f.Vector2().subVectors(C,b),O=new f.Vector2().subVectors(T,b);return Math.abs(A.cross(O))>Number.EPSILON}const u=new f.Vector2(i[0].x,i[0].y),d=new f.Vector2(i[1].x,i[1].y),m=new f.Vector2(i[2].x,i[2].y);let v=null,y=p(u,d,m),x=!1;if(i.length>3&&(v=new f.Vector2(i[3].x,i[3].y),x=p(d,v,m),l&&v.applyMatrix3(l)),l&&(u.applyMatrix3(l),d.applyMatrix3(l),m.applyMatrix3(l)),!(!y&&!x))if(a){const b=[];y&&!x&&b.push(u,d,m),!y&&x?b.push(d,v,m):b.push(u,d,v,m),yield new ve({type:ve.Type.POLYLINE,vertices:b,layer:c,color:h,shape:!0})}else{const b=[],C=[];y&&(b.push(u,d,m),C.push(0,1,2)),x&&(y?C.push(1,2,3):(b.push(d,m),C.push(0,1,2)),b.push(v)),yield new ve({type:ve.Type.TRIANGLES,vertices:b,indices:C,layer:c,color:h})}}*_DecomposeText(e,i){const r=this._GetEntityLayer(e,i),a=this._GetEntityColor(e,i);yield*this.textRenderer.Render({text:e.text,fontSize:e.textHeight,startPos:e.startPoint,endPos:e.endPoint,rotation:e.rotation,hAlign:e.halign,vAlign:e.valign,widthFactor:e.xScale,color:a,layer:r})}*_DecomposeMText(e,i){if(!this.textRenderer.canRender)return;const r=this._GetEntityLayer(e,i),a=this._GetEntityColor(e,i),l=new Lt;l.Parse(e.text),yield*this.textRenderer.RenderMText({formattedText:l.GetContent(),fontSize:e.height,position:e.position,rotation:e.rotation,direction:e.direction,attachment:e.attachmentPoint,lineSpacing:e.lineSpacing,width:e.width,color:a,layer:r})}_ProcessInsert(e,i=null){if(i){if(i.name===e.name){console.warn("Recursive block reference: "+i.name);return}const p=this.blocks.get(e.name);p||console.warn("Unresolved nested block reference: "+e.name);const u=i.NestedBlockContext(p,e);if(p.data.entities)for(const d of p.data.entities)this._ProcessDxfEntity(d,u);return}const r=this.blocks.get(e.name);if(r===null){console.warn("Unresolved block reference in INSERT: "+e.name);return}if(!r.HasGeometry())return;const a=this._GetEntityLayer(e,null),l=this._GetEntityColor(e,null),c=this._GetLineType(e,null,null),h=r.InstantiationContext().GetInsertionTransform(e);if(this._UpdateBounds(new f.Vector2().applyMatrix3(h)),h.translate(-this.origin.x,-this.origin.y),r.flatten)for(const p of r.batches)this._FlattenBatch(p,a,l,c,h);else{const p=new fe(a,e.name,fe.GeometryType.BLOCK_INSTANCE,l,c);this._GetBatch(p).PushInstanceTransform(h)}}_FlattenBatch(e,i,r,a,l){const c=this.layers.get(i);let h,p=0;e.key.color===Je.BY_BLOCK?h=r:e.key.color===Je.BY_LAYER?h=(c==null?void 0:c.color)??0:h=e.key.color;const u=new fe(i,null,e.key.geometryType,h,p);this._GetBatch(u).Merge(e,l)}*_GenerateShapedPolyline(e,i,r,a,l){yield new ve({type:ve.Type.POLYLINE,vertices:e,layer:i,color:r,lineType:a,shape:l})}_MirrorEntityVertices(e,i=null){if(!e.extrusionDirection||e.extrusionDirection.z>=0)return i??e.vertices;(!i||i===e.vertices)&&(i=e.vertices.slice());const r=i.length;for(let a=0;a<r;a++){const l=i[a],c={x:-l.x};for(const h in l)l.hasOwnProperty(h)&&h!=="x"&&(c[h]=l[h]);i[a]=c}return i}*_DecomposePolyline(e,i=null){let r,a;if(e.includesCurveFitVertices||e.includesSplineFitVertices?(r=e.vertices.filter(y=>y.splineVertex||y.curveFittingVertex),a=r.length):(r=e.vertices,a=e.vertices.length),a<2)return;r=this._MirrorEntityVertices(e,r);const l=this._GetEntityColor(e,i),c=this._GetEntityLayer(e,i),h=this;let p=0,u=this._IsPlainLine(r[0]),d=this._GetLineType(e,r[0],i),m=null;function*v(y){if(y===p)return;let x=!1,b=m;y===a&&p===0?(x=!0,b===null&&(b=r)):y===a-1&&p===0?b===null&&(b=r):y===a?b===null&&(b=r.slice(p,y),b.push(r[0])):b===null&&(b=r.slice(p,y+1)),u?yield new ve({type:ve.Type.POLYLINE,vertices:b,layer:c,color:l,lineType:d,shape:x}):yield*h._GenerateShapedPolyline(b,c,l,d,x),p=y,y!==a&&(u=h._IsPlainLine(r[y]),d=h._GetLineType(e,r[y])),m=null}for(let y=1;y<=a;y++){const x=r[y-1];let b;if(y===a){if(!e.shape){yield*v(y-1);break}b=r[0]}else b=r[y];if(x.bulge&&u?(m===null&&(m=r.slice(p,y)),this._GenerateBulgeVertices(m,x,b,x.bulge)):m!==null&&m.push(b),y===a){yield*v(y);break}const C=this._IsPlainLine(b),T=this._GetLineType(e,b);(C!==u||u&&T!==d)&&(yield*v(y))}}*_DecomposeSpline(e,i=null){const r=this._GetEntityColor(e,i),a=this._GetEntityLayer(e,i),l=this._GetLineType(e,null,i),c=e.controlPoints.map(d=>[d.x,d.y]),h=[],p=c.length*Tc,u=1/p;for(let d=0;d<=p;d++){const m=this._InterpolateSpline(d*u,e.degreeOfSplineCurve,c,e.knotValues);h.push({x:m[0],y:m[1]})}yield new ve({type:ve.Type.POLYLINE,vertices:h,layer:a,color:r,lineType:l})}_InterpolateSpline(e,i,r,a=null,l=null){let c,h,p,u;const d=r.length,m=r[0].length;if(i<1)throw new Error("Degree must be at least 1 (linear)");if(i>d-1)throw new Error("Degree must be less than or equal to point count - 1");if(!l)for(l=[],c=0;c<d;c++)l[c]=1;if(a){if(a.length!==d+i+1)throw new Error("Bad knot vector length")}else for(a=[],c=0;c<d+i+1;c++)a[c]=c;const v=[i,a.length-1-i],y=a[v[0]],x=a[v[1]];for(e=e*(x-y)+y,e<y?e=y:e>x&&(e=x),p=v[0];p<v[1]&&!(e>=a[p]&&e<=a[p+1]);p++);const b=[];for(c=0;c<d;c++){for(b[c]=[],h=0;h<m;h++)b[c][h]=r[c][h]*l[c];b[c][m]=l[c]}let C;for(u=1;u<=i+1;u++)for(c=p;c>p-i-1+u;c--)for(C=(e-a[c])/(a[c+i+1-u]-a[c]),h=0;h<m+1;h++)b[c][h]=(1-C)*b[c-1][h]+C*b[c][h];const T=[];for(c=0;c<m;c++)T[c]=b[p][c]/b[p][m];return T}_ProcessPoints(e,i=null){const r=new fe(e.layer,i==null?void 0:i.name,fe.GeometryType.POINTS,e.color,0),a=this._GetBatch(r);for(const l of e.vertices)a.PushVertex(this._TransformVertex(l,i))}_ProcessLineSegments(e,i=null){if(e.vertices.length%2!==0)throw Error("Even number of vertices expected");const r=new fe(e.layer,i==null?void 0:i.name,fe.GeometryType.LINES,e.color,e.lineType),a=this._GetBatch(r);for(const l of e.vertices)a.PushVertex(this._TransformVertex(l,i))}_ProcessPolyline(e,i=null){if(e.vertices.length<2)return;const r=e.vertices.length;if(r<=3){const c=new fe(e.layer,i==null?void 0:i.name,fe.GeometryType.LINES,e.color,e.lineType),h=this._GetBatch(c);let p=null;for(const u of e.vertices)p!==null&&(h.PushVertex(this._TransformVertex(p,i)),h.PushVertex(this._TransformVertex(u,i))),p=u;e.shape&&r>2&&(h.PushVertex(this._TransformVertex(e.vertices[r-1],i)),h.PushVertex(this._TransformVertex(e.vertices[0],i)));return}const a=new fe(e.layer,i==null?void 0:i.name,fe.GeometryType.INDEXED_LINES,e.color,e.lineType),l=this._GetBatch(a);for(const c of e._IterateLineChunks()){const h=l.PushChunk(c.verticesCount);for(const p of c.vertices)h.PushVertex(this._TransformVertex(p,i));for(const p of c.indices)h.PushIndex(p);h.Finish()}}_ProcessTriangles(e,i=null){if(e.vertices.length<3)return;if(e.indices.length%3!==0){console.error("Unexpected size of indices array: "+e.indices.length);return}const r=new fe(e.layer,i==null?void 0:i.name,fe.GeometryType.INDEXED_TRIANGLES,e.color,0),l=this._GetBatch(r).PushChunk(e.vertices.length);for(const c of e.vertices)l.PushVertex(this._TransformVertex(c,i));for(const c of e.indices)l.PushIndex(c);l.Finish()}_GetEntityColor(e,i=null){let r=Je.BY_LAYER;if(e.colorIndex===0?r=Je.BY_BLOCK:e.colorIndex===256?r=Je.BY_LAYER:e.hasOwnProperty("color")&&(r=e.color),i)return r;if(r===Je.BY_LAYER||r===Je.BY_BLOCK){if(e.hasOwnProperty("layer")){const a=this.layers.get(e.layer);if(a)return a.color}}else return r;return 0}_GetEntityLayer(e,i=null){return i?null:e.hasOwnProperty("layer")?e.layer:"0"}_GetEntityExtrusionTransform(e){return!e.hasOwnProperty("extrusionDirection")||e.extrusionDirection.z>0?null:new f.Matrix3().scale(-1,1)}_GetBatch(e){let i=this.batches.find({key:e});if(i!==null)return i;if(i=new Lc(e),this.batches.insert(i),e.blockName!==null&&!e.IsInstanced()){const r=this.blocks.get(e.blockName);r&&r.batches.push(i)}return i}_TransformVertex(e,i=null){return i?i.TransformVertex(e):(this._UpdateBounds(e),{x:e.x-this.origin.x,y:e.y-this.origin.y})}_UpdateBounds(e){this.bounds===null?this.bounds={minX:e.x,maxX:e.x,minY:e.y,maxY:e.y}:(e.x<this.bounds.minX?this.bounds.minX=e.x:e.x>this.bounds.maxX&&(this.bounds.maxX=e.x),e.y<this.bounds.minY?this.bounds.minY=e.y:e.y>this.bounds.maxY&&(this.bounds.maxY=e.y)),this.origin===null&&(this.origin={x:e.x,y:e.y})}_BuildScene(){let e=0,i=0,r=0;this.batches.each(c=>{e+=c.GetVerticesBufferSize(),i+=c.GetIndicesBufferSize(),r+=c.GetTransformsSize()});const a={vertices:new ArrayBuffer(e),indices:new ArrayBuffer(i),transforms:new ArrayBuffer(r),batches:[],layers:[],origin:this.origin,bounds:this.bounds,hasMissingChars:this.hasMissingChars},l={vertices:new Float32Array(a.vertices),verticesOffset:0,indices:new Uint16Array(a.indices),indicesOffset:0,transforms:new Float32Array(a.transforms),transformsOffset:0};this.batches.each(c=>{a.batches.push(c.Serialize(l))});for(const c of this.layers.values())a.layers.push({name:c.name,color:c.color});return a.pointShapeHasDot=(this.pdMode&Ve.MARK_MASK)===Ve.DOT,a}}class Lc{constructor(e){this.key=e,e.IsIndexed()?this.chunks=[]:e.geometryType===fe.GeometryType.BLOCK_INSTANCE?this.transforms=new Qs(Xe.FLOAT32):this.vertices=new Qs(Xe.FLOAT32)}PushVertex(e){const i=this.vertices.Push(e.x);return this.vertices.Push(e.y),i}PushInstanceTransform(e){for(let i=0;i<2;i++)for(let r=0;r<3;r++)this.transforms.Push(e.elements[r*3+i])}PushChunk(e){if(e>zi)throw new Error("Vertices count exceeds chunk limit: "+e);let i=null,r=0;for(const a of this.chunks){const l=zi-a.vertices.GetSize()/2;l<e||(i===null||l<r)&&(i=a,r=l)}return i===null&&(i=this._NewChunk(e)),new Mc(i,e)}Merge(e,i=null){if(this.key.geometryType!==e.key.geometryType)throw new Error(`Rendering batch merging geometry type mismatch: ${this.key.geometryType} !== ${e.key.geometryType}`);if(this.key.IsInstanced())throw new Error("Attempted to merge instanced batch");if(this.key.IsIndexed())for(const r of e.chunks){const a=r.vertices.size,l=this.PushChunk(a/2);for(let h=0;h<a;h+=2){const p=new f.Vector2(r.vertices.Get(h),r.vertices.Get(h+1));i&&p.applyMatrix3(i),l.PushVertex(p)}const c=r.indices.size;for(let h=0;h<c;h++)l.PushIndex(r.indices.Get(h));l.Finish()}else{const r=e.vertices.size;for(let a=0;a<r;a+=2){const l=new f.Vector2(e.vertices.Get(a),e.vertices.Get(a+1));i&&l.applyMatrix3(i),this.PushVertex(l)}}}GetVerticesBufferSize(){if(this.key.IsIndexed()){let e=0;for(const i of this.chunks)e+=i.vertices.GetSize();return e*Float32Array.BYTES_PER_ELEMENT}else return this.key.geometryType===fe.GeometryType.BLOCK_INSTANCE?0:this.vertices.GetSize()*Float32Array.BYTES_PER_ELEMENT}GetIndicesBufferSize(){if(this.key.IsIndexed()){let e=0;for(const i of this.chunks)e+=i.indices.GetSize();return e*Uint16Array.BYTES_PER_ELEMENT}else return 0}GetTransformsSize(){return this.key.geometryType===fe.GeometryType.BLOCK_INSTANCE?this.transforms.GetSize()*Float32Array.BYTES_PER_ELEMENT:0}Serialize(e){if(this.key.IsIndexed()){const i={key:this.key,chunks:[]};for(const r of this.chunks)i.chunks.push(r.Serialize(e));return i}else if(this.key.geometryType===fe.GeometryType.BLOCK_INSTANCE){const i=this.transforms.GetSize(),r={key:this.key,transformsOffset:e.transformsOffset,transformsSize:i};return this.transforms.CopyTo(e.transforms,e.transformsOffset),e.transformsOffset+=i,r}else{const i=this.vertices.GetSize(),r={key:this.key,verticesOffset:e.verticesOffset,verticesSize:i};return this.vertices.CopyTo(e.vertices,e.verticesOffset),e.verticesOffset+=i,r}}_NewChunk(e){const i=new kc(e);return this.chunks.push(i),i}}let ji=class{constructor(e){this.data=e,this.useCount=0,this.nestedUseCount=0,this.verticesCount=0,this.offset=null,this.batches=[],this.flatten=!1}SetFlatten(){return this.HasGeometry()?(this.flatten=this.useCount===1||this.useCount*this.verticesCount<=Sc,this.flatten):!1}HasGeometry(){return this.offset!==null}RegisterInsert(e){this.useCount++}RegisterNestedUse(e){this.nestedUseCount++}DefinitionContext(){return new Ye(this,Ye.Type.DEFINITION)}InstantiationContext(){return new Ye(this,Ye.Type.INSTANTIATION)}};class Ye{constructor(e,i){this.block=e,this.type=i,this.origin=this.block.data.position,this.transform=new f.Matrix3}get name(){return this.block.data.name}TransformVertex(e){const i=new f.Vector2(e.x,e.y).applyMatrix3(this.transform);if(this.type!==Ye.Type.DEFINITION&&this.type!==Ye.Type.NESTED_DEFINITION)throw new Error("Unexpected transform type");return this.block.verticesCount++,this.block.offset===null?(this.block.offset=i,new f.Vector2):(i.sub(this.block.offset),i)}GetInsertionTransform(e){const i=new f.Matrix3().translate(-this.origin.x,-this.origin.y),r=e.yScale||1,a=e.xScale||1,l=-(e.rotation||0)*Math.PI/180;let c=e.position.x;const h=e.position.y;if(i.scale(a,r),i.rotate(l),i.translate(c,h),e.extrusionDirection&&e.extrusionDirection.z<0&&i.scale(-1,1),this.type!==Ye.Type.INSTANTIATION)return i;const p=new f.Matrix3().translate(this.block.offset.x,this.block.offset.y);return i.multiply(p)}NestedBlockContext(e,i){e.RegisterNestedUse(this.block);const a=new Ye(e,Ye.Type.NESTED_DEFINITION).GetInsertionTransform(i),l=new Ye(this.block,Ye.Type.NESTED_DEFINITION);return l.transform=new f.Matrix3().multiplyMatrices(this.transform,a),l}}Ye.Type=Object.freeze({DEFINITION:0,NESTED_DEFINITION:1,INSTANTIATION:2});class kc{constructor(e){e<16&&(e=16),this.indices=new Qs(Xe.UINT16,e*2),this.vertices=new Qs(Xe.FLOAT32,e*2)}Serialize(e){const i={};{const r=this.vertices.GetSize();i.verticesOffset=e.verticesOffset,i.verticesSize=r,this.vertices.CopyTo(e.vertices,e.verticesOffset),e.verticesOffset+=r}{const r=this.indices.GetSize();i.indicesOffset=e.indicesOffset,i.indicesSize=r,this.indices.CopyTo(e.indices,e.indicesOffset),e.indicesOffset+=r}return i}}class Mc{constructor(e,i){this.chunk=e,this.verticesCount=i,this.verticesOffset=this.chunk.vertices.GetSize()/2,this.numVerticesPushed=0}PushVertex(e){if(this.numVerticesPushed===this.verticesCount)throw new Error;this.chunk.vertices.Push(e.x),this.chunk.vertices.Push(e.y),this.numVerticesPushed++}PushIndex(e){if(e<0||e>=this.verticesCount)throw new Error(`Index out of range: ${e}/${this.verticesCount}`);this.chunk.indices.Push(e+this.verticesOffset)}Finish(){if(this.numVerticesPushed!==this.verticesCount)throw new Error(`Not all vertices pushed: ${this.numVerticesPushed}/${this.verticesCount}`)}}const Ve=Object.freeze({DOT:0,NONE:1,PLUS:2,CROSS:3,TICK:4,MARK_MASK:15,CIRCLE:32,SQUARE:64,SHAPE_MASK:240}),Je=Object.freeze({BY_LAYER:-1,BY_BLOCK:-2});xs.DefaultOptions={arcTessellationAngle:10/180*Math.PI,minArcTessellationSubdivisions:8,wireframeMesh:!1,textOptions:bs.DefaultOptions};let Ic=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')}),ai=0,sr=-3;class gs{constructor(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}}function Ac(o,e){this.source=o,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new gs,this.dtree=new gs}let nr=new gs,ir=new gs,li=new Uint8Array(30),ci=new Uint16Array(30),or=new Uint8Array(30),rr=new Uint16Array(30),_c=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wi=new gs,at=new Uint8Array(288+32);function ar(o,e,i,r){let a,l;for(a=0;a<i;++a)o[a]=0;for(a=0;a<30-i;++a)o[a+i]=a/i|0;for(l=r,a=0;a<30;++a)e[a]=l,l+=1<<o[a]}function Bc(o,e){let i;for(i=0;i<7;++i)o.table[i]=0;for(o.table[7]=24,o.table[8]=152,o.table[9]=112,i=0;i<24;++i)o.trans[i]=256+i;for(i=0;i<144;++i)o.trans[24+i]=i;for(i=0;i<8;++i)o.trans[24+144+i]=280+i;for(i=0;i<112;++i)o.trans[24+144+8+i]=144+i;for(i=0;i<5;++i)e.table[i]=0;for(e.table[5]=32,i=0;i<32;++i)e.trans[i]=i}let Xi=new Uint16Array(16);function yn(o,e,i,r){let a,l;for(a=0;a<16;++a)o.table[a]=0;for(a=0;a<r;++a)o.table[e[i+a]]++;for(o.table[0]=0,l=0,a=0;a<16;++a)Xi[a]=l,l+=o.table[a];for(a=0;a<r;++a)e[i+a]&&(o.trans[Xi[e[i+a]]++]=a)}function Rc(o){o.bitcount--||(o.tag=o.source[o.sourceIndex++],o.bitcount=7);let e=o.tag&1;return o.tag>>>=1,e}function ct(o,e,i){if(!e)return i;for(;o.bitcount<24;)o.tag|=o.source[o.sourceIndex++]<<o.bitcount,o.bitcount+=8;let r=o.tag&65535>>>16-e;return o.tag>>>=e,o.bitcount-=e,r+i}function In(o,e){for(;o.bitcount<24;)o.tag|=o.source[o.sourceIndex++]<<o.bitcount,o.bitcount+=8;let i=0,r=0,a=0,l=o.tag;do r=2*r+(l&1),l>>>=1,++a,i+=e.table[a],r-=e.table[a];while(r>=0);return o.tag=l,o.bitcount-=a,e.trans[i+r]}function Oc(o,e,i){let r,a,l,c,h,p;for(r=ct(o,5,257),a=ct(o,5,1),l=ct(o,4,4),c=0;c<19;++c)at[c]=0;for(c=0;c<l;++c){let u=ct(o,3,0);at[_c[c]]=u}for(yn(Wi,at,0,19),h=0;h<r+a;){let u=In(o,Wi);switch(u){case 16:let d=at[h-1];for(p=ct(o,2,3);p;--p)at[h++]=d;break;case 17:for(p=ct(o,3,3);p;--p)at[h++]=0;break;case 18:for(p=ct(o,7,11);p;--p)at[h++]=0;break;default:at[h++]=u;break}}yn(e,at,0,r),yn(i,at,r,a)}function Zi(o,e,i){for(;;){let r=In(o,e);if(r===256)return ai;if(r<256)o.dest[o.destLen++]=r;else{let a,l,c,h;for(r-=257,a=ct(o,li[r],ci[r]),l=In(o,i),c=o.destLen-ct(o,or[l],rr[l]),h=c;h<c+a;++h)o.dest[o.destLen++]=o.dest[h]}}}function Dc(o){for(let e,i,r;o.bitcount>8;)o.sourceIndex--,o.bitcount-=8;if(t=o.source[o.sourceIndex+1],t=256*t+o.source[o.sourceIndex],n=o.source[o.sourceIndex+3],n=256*n+o.source[o.sourceIndex+2],t!==(~n&65535))return sr;for(o.sourceIndex+=4,s=t;s;--s)o.dest[o.destLen++]=o.source[o.sourceIndex++];return o.bitcount=0,ai}function Nc(o,e){let i=new Ac(o,e),r,a,l;do{switch(r=Rc(i),a=ct(i,2,0),a){case 0:l=Dc(i);break;case 1:l=Zi(i,nr,ir);break;case 2:Oc(i,i.ltree,i.dtree),l=Zi(i,i.ltree,i.dtree);break;default:l=sr}if(l!==ai)throw new Error("Data error")}while(!r);return i.destLen<i.dest.length?typeof i.dest.slice=="function"?i.dest.slice(0,i.destLen):i.dest.subarray(0,i.destLen):i.dest}Bc(nr,ir);ar(li,ci,4,3);ar(or,rr,2,1);li[28]=0;ci[28]=258;function Zt(o,e,i,r,a){return Math.pow(1-a,3)*o+3*Math.pow(1-a,2)*a*e+3*(1-a)*Math.pow(a,2)*i+Math.pow(a,3)*r}function Ht(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Ht.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)};Ht.prototype.addPoint=function(o,e){typeof o=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=o,this.x2=o),o<this.x1&&(this.x1=o),o>this.x2&&(this.x2=o)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))};Ht.prototype.addX=function(o){this.addPoint(o,null)};Ht.prototype.addY=function(o){this.addPoint(null,o)};Ht.prototype.addBezier=function(o,e,i,r,a,l,c,h){let p=[o,e],u=[i,r],d=[a,l],m=[c,h];this.addPoint(o,e),this.addPoint(c,h);for(let v=0;v<=1;v++){let y=6*p[v]-12*u[v]+6*d[v],x=-3*p[v]+9*u[v]-9*d[v]+3*m[v],b=3*u[v]-3*p[v];if(x===0){if(y===0)continue;let O=-b/y;0<O&&O<1&&(v===0&&this.addX(Zt(p[v],u[v],d[v],m[v],O)),v===1&&this.addY(Zt(p[v],u[v],d[v],m[v],O)));continue}let C=Math.pow(y,2)-4*b*x;if(C<0)continue;let T=(-y+Math.sqrt(C))/(2*x);0<T&&T<1&&(v===0&&this.addX(Zt(p[v],u[v],d[v],m[v],T)),v===1&&this.addY(Zt(p[v],u[v],d[v],m[v],T)));let A=(-y-Math.sqrt(C))/(2*x);0<A&&A<1&&(v===0&&this.addX(Zt(p[v],u[v],d[v],m[v],A)),v===1&&this.addY(Zt(p[v],u[v],d[v],m[v],A)))}};Ht.prototype.addQuad=function(o,e,i,r,a,l){let c=o+.6666666666666666*(i-o),h=e+2/3*(r-e),p=c+1/3*(a-o),u=h+1/3*(l-e);this.addBezier(o,e,c,h,p,u,a,l)};let lr=Ht;function _e(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}function zs(o,e){return+(Math.round(o+"e+"+e)+"e-"+e)}function cr(o){let e=[[]];for(let i=0;i<o.length;i+=1){let r=e[e.length-1],a=o[i],l=r[0],c=r[1],h=r[r.length-1];r.push(a),a.type==="Z"?(l&&c&&h&&l.type==="M"&&c.type==="L"&&h.type==="L"&&h.x===l.x&&h.y===l.y&&(r.shift(),r[0].type="M"),i+1<o.length&&e.push([])):a.type==="L"&&h&&h.x===a.x&&h.y===a.y&&r.pop()}return o=[].concat.apply([],e),o}function Pc(o){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},o)}function Vc(o){return parseInt(o)===o&&(o={decimalPlaces:o,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},o)}_e.prototype.fromSVG=function(o,e={}){typeof SVGPathElement<"u"&&o instanceof SVGPathElement&&(o=o.getAttribute("d")),e=Pc(e),this.commands=[];let i="0123456789",r="MmLlQqCcZzHhVv",a="SsTtAa",l="-+",c={},h=[""],p=!1;function u(x){return x.filter(b=>b.length).map(b=>{let C=parseFloat(b);return(e.decimalPlaces||e.decimalPlaces===0)&&(C=zs(C,e.decimalPlaces)),C})}function d(x){if(!this.commands.length)return x;let b=this.commands[this.commands.length-1];for(let C=0;C<x.length;C++)x[C]+=b[C&1?"y":"x"];return x}function m(){if(c.type===void 0)return;let x=c.type.toUpperCase(),b=x!=="Z"&&c.type.toUpperCase()!==c.type,C=u(h);if(h=[""],!C.length&&x!=="Z")return;b&&x!=="H"&&x!=="V"&&(C=d.apply(this,[C]));let T=this.commands.length&&this.commands[this.commands.length-1].x||0,A=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(x){case"M":this.moveTo(...C);break;case"L":this.lineTo(...C);break;case"V":for(let O=0;O<C.length;O++){let P=0;b&&(P=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(T,C[O]+P)}break;case"H":for(let O=0;O<C.length;O++){let P=0;b&&(P=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(C[O]+P,A)}break;case"C":this.bezierCurveTo(...C);break;case"Q":this.quadraticCurveTo(...C);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let O in this.commands[this.commands.length-1])this.commands[this.commands.length-1][O]===void 0&&(this.commands[this.commands.length-1][O]=0)}for(let x=0;x<o.length;x++){let b=o.charAt(x),C=h[h.length-1];if(i.indexOf(b)>-1)h[h.length-1]+=b;else if(l.indexOf(b)>-1)if(!c.type&&!this.commands.length&&(c.type="L"),b==="-")!c.type||C.indexOf("-")>0?p=!0:C.length?h.push("-"):h[h.length-1]=b;else if(!c.type||C.length>0)p=!0;else continue;else if(r.indexOf(b)>-1)c.type?(m.apply(this),c={type:b}):c.type=b;else{if(a.indexOf(b)>-1)throw new Error("Unsupported path command: "+b+". Currently supported commands are "+r.split("").join(", ")+".");` ,
7
+ \r\f\v`.indexOf(b)>-1?h.push(""):b==="."?!c.type||C.indexOf(b)>-1?p=!0:h[h.length-1]+=b:p=!0}if(p)throw new Error("Unexpected character: "+b+" at offset "+x)}m.apply(this),e.optimize&&(this.commands=cr(this.commands));let v=e.flipY,y=e.flipYBase;if(v===!0&&e.flipYBase===void 0){let x=this.getBoundingBox();y=x.y1+x.y2}for(let x in this.commands){let b=this.commands[x];for(let C in b)["x","x1","x2"].includes(C)?this.commands[x][C]=e.x+b[C]*e.scale:["y","y1","y2"].includes(C)&&(this.commands[x][C]=e.y+(v?y-b[C]:b[C])*e.scale)}return this};_e.fromSVG=function(o,e){return new _e().fromSVG(o,e)};_e.prototype.moveTo=function(o,e){this.commands.push({type:"M",x:o,y:e})};_e.prototype.lineTo=function(o,e){this.commands.push({type:"L",x:o,y:e})};_e.prototype.curveTo=_e.prototype.bezierCurveTo=function(o,e,i,r,a,l){this.commands.push({type:"C",x1:o,y1:e,x2:i,y2:r,x:a,y:l})};_e.prototype.quadTo=_e.prototype.quadraticCurveTo=function(o,e,i,r){this.commands.push({type:"Q",x1:o,y1:e,x:i,y:r})};_e.prototype.close=_e.prototype.closePath=function(){this.commands.push({type:"Z"})};_e.prototype.extend=function(o){if(o.commands)o=o.commands;else if(o instanceof lr){let e=o;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,o)};_e.prototype.getBoundingBox=function(){let o=new lr,e=0,i=0,r=0,a=0;for(let l=0;l<this.commands.length;l++){let c=this.commands[l];switch(c.type){case"M":o.addPoint(c.x,c.y),e=r=c.x,i=a=c.y;break;case"L":o.addPoint(c.x,c.y),r=c.x,a=c.y;break;case"Q":o.addQuad(r,a,c.x1,c.y1,c.x,c.y),r=c.x,a=c.y;break;case"C":o.addBezier(r,a,c.x1,c.y1,c.x2,c.y2,c.x,c.y),r=c.x,a=c.y;break;case"Z":r=e,a=i;break;default:throw new Error("Unexpected path command "+c.type)}}return o.isEmpty()&&o.addPoint(0,0),o};_e.prototype.draw=function(o){o.beginPath();for(let e=0;e<this.commands.length;e+=1){let i=this.commands[e];i.type==="M"?o.moveTo(i.x,i.y):i.type==="L"?o.lineTo(i.x,i.y):i.type==="C"?o.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y):i.type==="Q"?o.quadraticCurveTo(i.x1,i.y1,i.x,i.y):i.type==="Z"&&o.closePath()}this.fill&&(o.fillStyle=this.fill,o.fill()),this.stroke&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeWidth,o.stroke())};_e.prototype.toPathData=function(o){o=Vc(o);function e(h){return Math.round(h)===zs(h,o.decimalPlaces)?""+zs(h,o.decimalPlaces):zs(h,o.decimalPlaces).toFixed(o.decimalPlaces)}function i(){let h="";for(let p=0;p<arguments.length;p+=1){let u=arguments[p];u>=0&&p>0&&(h+=" "),h+=e(u)}return h}let r=this.commands;o.optimize&&(r=JSON.parse(JSON.stringify(this.commands)),r=cr(r));let a=o.flipY,l=o.flipYBase;if(a===!0&&l===void 0){let h=new _e;h.extend(r);let p=h.getBoundingBox();l=p.y1+p.y2}let c="";for(let h=0;h<r.length;h+=1){let p=r[h];p.type==="M"?c+="M"+i(p.x,a?l-p.y:p.y):p.type==="L"?c+="L"+i(p.x,a?l-p.y:p.y):p.type==="C"?c+="C"+i(p.x1,a?l-p.y1:p.y1,p.x2,a?l-p.y2:p.y2,p.x,a?l-p.y:p.y):p.type==="Q"?c+="Q"+i(p.x1,a?l-p.y1:p.y1,p.x,a?l-p.y:p.y):p.type==="Z"&&(c+="Z")}return c};_e.prototype.toSVG=function(o,e){e||(e=this.toPathData(o));let i='<path d="';return i+=e,i+='"',this.fill&&this.fill!=="black"&&(this.fill===null?i+=' fill="none"':i+=' fill="'+this.fill+'"'),this.stroke&&(i+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),i+="/>",i};_e.prototype.toDOMElement=function(o,e){e||(e=this.toPathData(o));let i=e,r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",i),r};let Cs=_e;function hr(o){throw new Error(o)}function Yi(o,e){o||hr(e)}let ne={fail:hr,argument:Yi,assert:Yi},Ki=32768,qi=2147483648,Fc=-32768,Uc=32768-1+1/65536,Jt={},Q={},ue={};function it(o){return function(){return o}}Q.BYTE=function(o){return ne.argument(o>=0&&o<=255,"Byte value should be between 0 and 255."),[o]};ue.BYTE=it(1);Q.CHAR=function(o){return[o.charCodeAt(0)]};ue.CHAR=it(1);Q.CHARARRAY=function(o){typeof o>"u"&&(o="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));let e=[];for(let i=0;i<o.length;i+=1)e[i]=o.charCodeAt(i);return e};ue.CHARARRAY=function(o){return typeof o>"u"?0:o.length};Q.USHORT=function(o){return[o>>8&255,o&255]};ue.USHORT=it(2);Q.SHORT=function(o){return o>=Ki&&(o=-(2*Ki-o)),[o>>8&255,o&255]};ue.SHORT=it(2);Q.UINT24=function(o){return[o>>16&255,o>>8&255,o&255]};ue.UINT24=it(3);Q.ULONG=function(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]};ue.ULONG=it(4);Q.LONG=function(o){return o>=qi&&(o=-(2*qi-o)),[o>>24&255,o>>16&255,o>>8&255,o&255]};ue.LONG=it(4);Q.FLOAT=function(o){if(o>Uc||o<Fc)throw new Error(`Value ${o} is outside the range of representable values in 16.16 format`);let e=Math.round(o*65536)<<0;return Q.ULONG(e)};ue.FLOAT=ue.ULONG;Q.FIXED=Q.ULONG;ue.FIXED=ue.ULONG;Q.FWORD=Q.SHORT;ue.FWORD=ue.SHORT;Q.UFWORD=Q.USHORT;ue.UFWORD=ue.USHORT;Q.F2DOT14=function(o){return Q.USHORT(o*16384)};ue.F2DOT14=ue.USHORT;Q.LONGDATETIME=function(o){return[0,0,0,0,o>>24&255,o>>16&255,o>>8&255,o&255]};ue.LONGDATETIME=it(8);Q.TAG=function(o){return ne.argument(o.length===4,"Tag should be exactly 4 ASCII characters."),[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]};ue.TAG=it(4);Q.Card8=Q.BYTE;ue.Card8=ue.BYTE;Q.Card16=Q.USHORT;ue.Card16=ue.USHORT;Q.OffSize=Q.BYTE;ue.OffSize=ue.BYTE;Q.SID=Q.USHORT;ue.SID=ue.USHORT;Q.NUMBER=function(o){return o>=-107&&o<=107?[o+139]:o>=108&&o<=1131?(o=o-108,[(o>>8)+247,o&255]):o>=-1131&&o<=-108?(o=-o-108,[(o>>8)+251,o&255]):o>=-32768&&o<=32767?Q.NUMBER16(o):Q.NUMBER32(o)};ue.NUMBER=function(o){return Q.NUMBER(o).length};Q.NUMBER16=function(o){return[28,o>>8&255,o&255]};ue.NUMBER16=it(3);Q.NUMBER32=function(o){return[29,o>>24&255,o>>16&255,o>>8&255,o&255]};ue.NUMBER32=it(5);Q.REAL=function(o){let e=o.toString(),i=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(i){let l=parseFloat("1e"+((i[2]?+i[2]:0)+i[1].length));e=(Math.round(o*l)/l).toString()}let r="";for(let l=0,c=e.length;l<c;l+=1){let h=e[l];h==="e"?r+=e[++l]==="-"?"c":"b":h==="."?r+="a":h==="-"?r+="e":r+=h}r+=r.length&1?"f":"ff";let a=[30];for(let l=0,c=r.length;l<c;l+=2)a.push(parseInt(r.substr(l,2),16));return a};ue.REAL=function(o){return Q.REAL(o).length};Q.NAME=Q.CHARARRAY;ue.NAME=ue.CHARARRAY;Q.STRING=Q.CHARARRAY;ue.STRING=ue.CHARARRAY;Jt.UTF8=function(o,e,i){let r=[],a=i;for(let l=0;l<a;l++,e+=1)r[l]=o.getUint8(e);return String.fromCharCode.apply(null,r)};Jt.UTF16=function(o,e,i){let r=[],a=i/2;for(let l=0;l<a;l++,e+=2)r[l]=o.getUint16(e);return String.fromCharCode.apply(null,r)};Q.UTF16=function(o){let e=[];for(let i=0;i<o.length;i+=1){let r=o.charCodeAt(i);e[e.length]=r>>8&255,e[e.length]=r&255}return e};ue.UTF16=function(o){return o.length*2};let An={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Jt.MACSTRING=function(o,e,i,r){let a=An[r];if(a===void 0)return;let l="";for(let c=0;c<i;c++){let h=o.getUint8(e+c);h<=127?l+=String.fromCharCode(h):l+=a[h&127]}return l};let Ds=typeof WeakMap=="function"&&new WeakMap,Ns,Gc=function(o){if(!Ns){Ns={};for(let a in An)Ns[a]=new String(a)}let e=Ns[o];if(e===void 0)return;if(Ds){let a=Ds.get(e);if(a!==void 0)return a}let i=An[o];if(i===void 0)return;let r={};for(let a=0;a<i.length;a++)r[i.charCodeAt(a)]=a+128;return Ds&&Ds.set(e,r),r};Q.MACSTRING=function(o,e){let i=Gc(e);if(i===void 0)return;let r=[];for(let a=0;a<o.length;a++){let l=o.charCodeAt(a);if(l>=128&&(l=i[l],l===void 0))return;r[a]=l}return r};ue.MACSTRING=function(o,e){let i=Q.MACSTRING(o,e);return i!==void 0?i.length:0};function _n(o){return o>=-128&&o<=127}function zc(o,e,i){let r=0,a=o.length;for(;e<a&&r<64&&o[e]===0;)++e,++r;return i.push(128|r-1),e}function Hc(o,e,i){let r=0,a=o.length,l=e;for(;l<a&&r<64;){let c=o[l];if(!_n(c)||c===0&&l+1<a&&o[l+1]===0)break;++l,++r}i.push(r-1);for(let c=e;c<l;++c)i.push(o[c]+256&255);return l}function jc(o,e,i){let r=0,a=o.length,l=e;for(;l<a&&r<64;){let c=o[l];if(c===0||_n(c)&&l+1<a&&_n(o[l+1]))break;++l,++r}i.push(64|r-1);for(let c=e;c<l;++c){let h=o[c];i.push(h+65536>>8&255,h+256&255)}return l}Q.VARDELTAS=function(o){let e=0,i=[];for(;e<o.length;){let r=o[e];r===0?e=zc(o,e,i):r>=-128&&r<=127?e=Hc(o,e,i):e=jc(o,e,i)}return i};Q.INDEX=function(o){let e=1,i=[e],r=[];for(let h=0;h<o.length;h+=1){let p=Q.OBJECT(o[h]);Array.prototype.push.apply(r,p),e+=p.length,i.push(e)}if(r.length===0)return[0,0];let a=[],l=1+Math.floor(Math.log(e)/Math.log(2))/8|0,c=[void 0,Q.BYTE,Q.USHORT,Q.UINT24,Q.ULONG][l];for(let h=0;h<i.length;h+=1){let p=c(i[h]);Array.prototype.push.apply(a,p)}return Array.prototype.concat(Q.Card16(o.length),Q.OffSize(l),a,r)};ue.INDEX=function(o){return Q.INDEX(o).length};Q.DICT=function(o){let e=[],i=Object.keys(o),r=i.length;for(let a=0;a<r;a+=1){let l=parseInt(i[a],0),c=o[l],h=Q.OPERAND(c.value,c.type),p=Q.OPERATOR(l);for(let u=0;u<h.length;u++)e.push(h[u]);for(let u=0;u<p.length;u++)e.push(p[u])}return e};ue.DICT=function(o){return Q.DICT(o).length};Q.OPERATOR=function(o){return o<1200?[o]:[12,o-1200]};Q.OPERAND=function(o,e){let i=[];if(Array.isArray(e))for(let r=0;r<e.length;r+=1){ne.argument(o.length===e.length,"Not enough arguments given for type"+e);let a=Q.OPERAND(o[r],e[r]);for(let l=0;l<a.length;l++)i.push(a[l])}else if(e==="SID"){let r=Q.NUMBER(o);for(let a=0;a<r.length;a++)i.push(r[a])}else if(e==="offset"){let r=Q.NUMBER32(o);for(let a=0;a<r.length;a++)i.push(r[a])}else if(e==="number"){let r=Q.NUMBER(o);for(let a=0;a<r.length;a++)i.push(r[a])}else if(e==="real"){let r=Q.REAL(o);for(let a=0;a<r.length;a++)i.push(r[a])}else throw new Error("Unknown operand type "+e);return i};Q.OP=Q.BYTE;ue.OP=ue.BYTE;let Ps=typeof WeakMap=="function"&&new WeakMap;Q.CHARSTRING=function(o){if(Ps){let r=Ps.get(o);if(r!==void 0)return r}let e=[],i=o.length;for(let r=0;r<i;r+=1){let a=o[r],l=Q[a.type](a.value);for(let c=0;c<l.length;c++)e.push(l[c])}return Ps&&Ps.set(o,e),e};ue.CHARSTRING=function(o){return Q.CHARSTRING(o).length};Q.OBJECT=function(o){let e=Q[o.type];return ne.argument(e!==void 0,"No encoding function for type "+o.type),e(o.value)};ue.OBJECT=function(o){let e=ue[o.type];return ne.argument(e!==void 0,"No sizeOf function for type "+o.type),e(o.value)};Q.TABLE=function(o){let e=[],i=(o.fields||[]).length,r=[],a=[];for(let l=0;l<i;l+=1){let c=o.fields[l],h=Q[c.type];ne.argument(h!==void 0,"No encoding function for field type "+c.type+" ("+c.name+")");let p=o[c.name];p===void 0&&(p=c.value);let u=h(p);if(c.type==="TABLE")p.fields!==null&&(a.push(e.length),r.push(u)),e.push(0,0);else for(let d=0;d<u.length;d++)e.push(u[d])}for(let l=0;l<r.length;l+=1){let c=a[l],h=e.length;ne.argument(h<65536,"Table "+o.tableName+" too big."),e[c]=h>>8,e[c+1]=h&255;for(let p=0;p<r[l].length;p++)e.push(r[l][p])}return e};ue.TABLE=function(o){let e=0,i=(o.fields||[]).length;for(let r=0;r<i;r+=1){let a=o.fields[r],l=ue[a.type];ne.argument(l!==void 0,"No sizeOf function for field type "+a.type+" ("+a.name+")");let c=o[a.name];c===void 0&&(c=a.value),e+=l(c),a.type==="TABLE"&&(e+=2)}return e};Q.RECORD=Q.TABLE;ue.RECORD=ue.TABLE;Q.LITERAL=function(o){return o};ue.LITERAL=function(o){return o.length};function Ie(o,e,i){if(e&&e.length)for(let r=0;r<e.length;r+=1){let a=e[r];this[a.name]=a.value}if(this.tableName=o,this.fields=e,i){let r=Object.keys(i);for(let a=0;a<r.length;a+=1){let l=r[a],c=i[l];this[l]!==void 0&&(this[l]=c)}}}Ie.prototype.encode=function(){return Q.TABLE(this)};Ie.prototype.sizeOf=function(){return ue.TABLE(this)};function $t(o,e,i){i===void 0&&(i=e.length);let r=new Array(e.length+1);r[0]={name:o+"Count",type:"USHORT",value:i};for(let a=0;a<e.length;a++)r[a+1]={name:o+a,type:"USHORT",value:e[a]};return r}function Bn(o,e,i){let r=e.length,a=new Array(r+1);a[0]={name:o+"Count",type:"USHORT",value:r};for(let l=0;l<r;l++)a[l+1]={name:o+l,type:"TABLE",value:i(e[l],l)};return a}function es(o,e,i){let r=e.length,a=[];a[0]={name:o+"Count",type:"USHORT",value:r};for(let l=0;l<r;l++)a=a.concat(i(e[l],l));return a}function Js(o){o.format===1?Ie.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat($t("glyph",o.glyphs))):o.format===2?Ie.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(es("rangeRecord",o.ranges,function(e,i){return[{name:"startGlyphID"+i,type:"USHORT",value:e.start},{name:"endGlyphID"+i,type:"USHORT",value:e.end},{name:"startCoverageIndex"+i,type:"USHORT",value:e.index}]}))):ne.assert(!1,"Coverage format must be 1 or 2.")}Js.prototype=Object.create(Ie.prototype);Js.prototype.constructor=Js;function $s(o){Ie.call(this,"scriptListTable",es("scriptRecord",o,function(e,i){let r=e.script,a=r.defaultLangSys;return ne.assert(!!a,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+i,type:"TAG",value:e.tag},{name:"script"+i,type:"TABLE",value:new Ie("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Ie("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:a.reqFeatureIndex}].concat($t("featureIndex",a.featureIndexes)))}].concat(es("langSys",r.langSysRecords,function(l,c){let h=l.langSys;return[{name:"langSysTag"+c,type:"TAG",value:l.tag},{name:"langSys"+c,type:"TABLE",value:new Ie("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:h.reqFeatureIndex}].concat($t("featureIndex",h.featureIndexes)))}]})))}]}))}$s.prototype=Object.create(Ie.prototype);$s.prototype.constructor=$s;function en(o){Ie.call(this,"featureListTable",es("featureRecord",o,function(e,i){let r=e.feature;return[{name:"featureTag"+i,type:"TAG",value:e.tag},{name:"feature"+i,type:"TABLE",value:new Ie("featureTable",[{name:"featureParams",type:"USHORT",value:r.featureParams}].concat($t("lookupListIndex",r.lookupListIndexes)))}]}))}en.prototype=Object.create(Ie.prototype);en.prototype.constructor=en;function tn(o,e){Ie.call(this,"lookupListTable",Bn("lookup",o,function(i){let r=e[i.lookupType];return ne.assert(!!r,"Unable to write GSUB lookup type "+i.lookupType+" tables."),new Ie("lookupTable",[{name:"lookupType",type:"USHORT",value:i.lookupType},{name:"lookupFlag",type:"USHORT",value:i.lookupFlag}].concat(Bn("subtable",i.subtables,r)))}))}tn.prototype=Object.create(Ie.prototype);tn.prototype.constructor=tn;function sn(o){o.format===1?Ie.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:o.startGlyph}].concat($t("glyph",o.classes))):o.format===2?Ie.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(es("rangeRecord",o.ranges,function(e,i){return[{name:"startGlyphID"+i,type:"USHORT",value:e.start},{name:"endGlyphID"+i,type:"USHORT",value:e.end},{name:"class"+i,type:"USHORT",value:e.classId}]}))):ne.assert(!1,"Class format must be 1 or 2.")}sn.prototype=Object.create(Ie.prototype);sn.prototype.constructor=sn;let X={Table:Ie,Record:Ie,Coverage:Js,ClassDef:sn,ScriptList:$s,FeatureList:en,LookupList:tn,ushortList:$t,tableList:Bn,recordList:es};function Qi(o,e){return o.getUint8(e)}function nn(o,e){return o.getUint16(e,!1)}function Wc(o,e){return o.getInt16(e,!1)}function ur(o,e){return(o.getUint16(e)<<8)+o.getUint8(e+2)}function hi(o,e){return o.getUint32(e,!1)}function pr(o,e){let i=o.getInt16(e,!1),r=o.getUint16(e+2,!1);return i+r/65535}function Xc(o,e){let i="";for(let r=e;r<e+4;r+=1)i+=String.fromCharCode(o.getInt8(r));return i}function Zc(o,e,i){let r=0;for(let a=0;a<i;a+=1)r<<=8,r+=o.getUint8(e+a);return r}function Yc(o,e,i){let r=[];for(let a=e;a<i;a+=1)r.push(o.getUint8(a));return r}function Kc(o){let e="";for(let i=0;i<o.length;i+=1)e+=String.fromCharCode(o[i]);return e}let qc={byte:1,uShort:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},Ji={LONG_WORDS:32768,WORD_DELTA_COUNT_MASK:32767};function N(o,e){this.data=o,this.offset=e,this.relativeOffset=0}N.prototype.parseByte=function(){let o=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,o};N.prototype.parseChar=function(){let o=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,o};N.prototype.parseCard8=N.prototype.parseByte;N.prototype.parseUShort=function(){let o=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,o};N.prototype.parseCard16=N.prototype.parseUShort;N.prototype.parseSID=N.prototype.parseUShort;N.prototype.parseOffset16=N.prototype.parseUShort;N.prototype.parseShort=function(){let o=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,o};N.prototype.parseF2Dot14=function(){let o=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,o};N.prototype.parseUInt24=function(){let o=ur(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,o};N.prototype.parseULong=function(){let o=hi(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,o};N.prototype.parseOffset32=N.prototype.parseULong;N.prototype.parseFixed=function(){let o=pr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,o};N.prototype.parseString=function(o){let e=this.data,i=this.offset+this.relativeOffset,r="";this.relativeOffset+=o;for(let a=0;a<o;a++)r+=String.fromCharCode(e.getUint8(i+a));return r};N.prototype.parseTag=function(){return this.parseString(4)};N.prototype.parseLongDateTime=function(){let o=hi(this.data,this.offset+this.relativeOffset+4);return o-=2082844800,this.relativeOffset+=8,o};N.prototype.parseVersion=function(o){let e=nn(this.data,this.offset+this.relativeOffset),i=nn(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,o===void 0&&(o=4096),e+i/o/10};N.prototype.skip=function(o,e){e===void 0&&(e=1),this.relativeOffset+=qc[o]*e};N.prototype.parseULongList=function(o){o===void 0&&(o=this.parseULong());let e=new Array(o),i=this.data,r=this.offset+this.relativeOffset;for(let a=0;a<o;a++)e[a]=i.getUint32(r),r+=4;return this.relativeOffset+=o*4,e};N.prototype.parseOffset16List=N.prototype.parseUShortList=function(o){o===void 0&&(o=this.parseUShort());let e=new Array(o),i=this.data,r=this.offset+this.relativeOffset;for(let a=0;a<o;a++)e[a]=i.getUint16(r),r+=2;return this.relativeOffset+=o*2,e};N.prototype.parseShortList=function(o){let e=new Array(o),i=this.data,r=this.offset+this.relativeOffset;for(let a=0;a<o;a++)e[a]=i.getInt16(r),r+=2;return this.relativeOffset+=o*2,e};N.prototype.parseByteList=function(o){let e=new Array(o),i=this.data,r=this.offset+this.relativeOffset;for(let a=0;a<o;a++)e[a]=i.getUint8(r++);return this.relativeOffset+=o,e};N.prototype.parseList=function(o,e){e||(e=o,o=this.parseUShort());let i=new Array(o);for(let r=0;r<o;r++)i[r]=e.call(this);return i};N.prototype.parseList32=function(o,e){e||(e=o,o=this.parseULong());let i=new Array(o);for(let r=0;r<o;r++)i[r]=e.call(this);return i};N.prototype.parseRecordList=function(o,e){e||(e=o,o=this.parseUShort());let i=new Array(o),r=Object.keys(e);for(let a=0;a<o;a++){let l={};for(let c=0;c<r.length;c++){let h=r[c],p=e[h];l[h]=p.call(this)}i[a]=l}return i};N.prototype.parseRecordList32=function(o,e){e||(e=o,o=this.parseULong());let i=new Array(o),r=Object.keys(e);for(let a=0;a<o;a++){let l={};for(let c=0;c<r.length;c++){let h=r[c],p=e[h];l[h]=p.call(this)}i[a]=l}return i};N.prototype.parseStruct=function(o){if(typeof o=="function")return o.call(this);{let e=Object.keys(o),i={};for(let r=0;r<e.length;r++){let a=e[r],l=o[a];i[a]=l.call(this)}return i}};N.prototype.parseValueRecord=function(o){if(o===void 0&&(o=this.parseUShort()),o===0)return;let e={};return o&1&&(e.xPlacement=this.parseShort()),o&2&&(e.yPlacement=this.parseShort()),o&4&&(e.xAdvance=this.parseShort()),o&8&&(e.yAdvance=this.parseShort()),o&16&&(e.xPlaDevice=void 0,this.parseShort()),o&32&&(e.yPlaDevice=void 0,this.parseShort()),o&64&&(e.xAdvDevice=void 0,this.parseShort()),o&128&&(e.yAdvDevice=void 0,this.parseShort()),e};N.prototype.parseValueRecordList=function(){let o=this.parseUShort(),e=this.parseUShort(),i=new Array(e);for(let r=0;r<e;r++)i[r]=this.parseValueRecord(o);return i};N.prototype.parsePointer=function(o){let e=this.parseOffset16();if(e>0)return new N(this.data,this.offset+e).parseStruct(o)};N.prototype.parsePointer32=function(o){let e=this.parseOffset32();if(e>0)return new N(this.data,this.offset+e).parseStruct(o)};N.prototype.parseListOfLists=function(o){let e=this.parseOffset16List(),i=e.length,r=this.relativeOffset,a=new Array(i);for(let l=0;l<i;l++){let c=e[l];if(c===0){a[l]=void 0;continue}if(this.relativeOffset=c,o){let h=this.parseOffset16List(),p=new Array(h.length);for(let u=0;u<h.length;u++)this.relativeOffset=c+h[u],p[u]=o.call(this);a[l]=p}else a[l]=this.parseUShortList()}return this.relativeOffset=r,a};N.prototype.parseCoverage=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort(),i=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(i)};if(e===2){let r=new Array(i);for(let a=0;a<i;a++)r[a]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:r}}throw new Error("0x"+o.toString(16)+": Coverage format must be 1 or 2.")};N.prototype.parseClassDef=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();return e===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:e===2?{format:2,ranges:this.parseRecordList({start:N.uShort,end:N.uShort,classId:N.uShort})}:(console.warn(`0x${o.toString(16)}: This font file uses an invalid ClassDef format of ${e}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:e})};N.list=function(o,e){return function(){return this.parseList(o,e)}};N.list32=function(o,e){return function(){return this.parseList32(o,e)}};N.recordList=function(o,e){return function(){return this.parseRecordList(o,e)}};N.recordList32=function(o,e){return function(){return this.parseRecordList32(o,e)}};N.pointer=function(o){return function(){return this.parsePointer(o)}};N.pointer32=function(o){return function(){return this.parsePointer32(o)}};N.tag=N.prototype.parseTag;N.byte=N.prototype.parseByte;N.uShort=N.offset16=N.prototype.parseUShort;N.uShortList=N.prototype.parseUShortList;N.uInt24=N.prototype.parseUInt24;N.uLong=N.offset32=N.prototype.parseULong;N.uLongList=N.prototype.parseULongList;N.fixed=N.prototype.parseFixed;N.f2Dot14=N.prototype.parseF2Dot14;N.struct=N.prototype.parseStruct;N.coverage=N.prototype.parseCoverage;N.classDef=N.prototype.parseClassDef;let $i={reserved:N.uShort,reqFeatureIndex:N.uShort,featureIndexes:N.uShortList};N.prototype.parseScriptList=function(){return this.parsePointer(N.recordList({tag:N.tag,script:N.pointer({defaultLangSys:N.pointer($i),langSysRecords:N.recordList({tag:N.tag,langSys:N.pointer($i)})})}))||[]};N.prototype.parseFeatureList=function(){return this.parsePointer(N.recordList({tag:N.tag,feature:N.pointer({featureParams:N.offset16,lookupListIndexes:N.uShortList})}))||[]};N.prototype.parseLookupList=function(o){return this.parsePointer(N.list(N.pointer(function(){let e=this.parseUShort();ne.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");let i=this.parseUShort(),r=i&16;return{lookupType:e,lookupFlag:i,subtables:this.parseList(N.pointer(o[e])),markFilteringSet:r?this.parseUShort():void 0}})))||[]};N.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let o=this.parseUShort(),e=this.parseUShort();return ne.argument(o===1&&e<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:N.offset32,featureTableSubstitutionOffset:N.offset32})})||[]};N.prototype.parseVariationStore=function(){let o=this.relativeOffset,e=this.parseUShort(),i={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=o+e+2,i};N.prototype.parseItemVariationStore=function(){let o=this.relativeOffset,e={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},i=this.parseOffset32(),r=this.parseUShort(),a=this.parseULongList(r);this.relativeOffset=o+i,e.variationRegions=this.parseVariationRegionList();for(let l=0;l<r;l++){let c=a[l];this.relativeOffset=o+c,e.itemVariationSubtables.push(this.parseItemVariationSubtable())}return e};N.prototype.parseVariationRegionList=function(){let o=this.parseUShort(),e=this.parseUShort();return this.parseRecordList(e,{regionAxes:N.recordList(o,{startCoord:N.f2Dot14,peakCoord:N.f2Dot14,endCoord:N.f2Dot14})})};N.prototype.parseItemVariationSubtable=function(){let o=this.parseUShort(),e=this.parseUShort();return{regionIndexes:this.parseUShortList(),deltaSets:this.parseDeltaSets(o,e)}};N.prototype.parseDeltaSets=function(o,e){let i=[],r=e&Ji.LONG_WORDS,a=e&Ji.WORD_DELTA_COUNT_MASK,l=(r?this.parseULong:this.parseUShort).bind(this),c=(r?this.parseUShort:this.parseByte).bind(this);for(let h=0;h<o;h++){let p=h<a?l:c;i.push(p())}return i};let te={getByte:Qi,getCard8:Qi,getUShort:nn,getCard16:nn,getShort:Wc,getUInt24:ur,getULong:hi,getFixed:pr,getTag:Xc,getOffset:Zc,getBytes:Yc,bytesToString:Kc,Parser:N};function Qc(o,e){e.parseUShort(),o.length=e.parseULong(),o.language=e.parseULong();let i;o.groupCount=i=e.parseULong(),o.glyphIndexMap={};for(let r=0;r<i;r+=1){let a=e.parseULong(),l=e.parseULong(),c=e.parseULong();for(let h=a;h<=l;h+=1)o.glyphIndexMap[h]=c,c++}}function Jc(o,e,i,r,a){o.length=e.parseUShort(),o.language=e.parseUShort();let l;o.segCount=l=e.parseUShort()>>1,e.skip("uShort",3),o.glyphIndexMap={};let c=new te.Parser(i,r+a+14),h=new te.Parser(i,r+a+16+l*2),p=new te.Parser(i,r+a+16+l*4),u=new te.Parser(i,r+a+16+l*6),d=r+a+16+l*8;for(let m=0;m<l-1;m+=1){let v,y=c.parseUShort(),x=h.parseUShort(),b=p.parseShort(),C=u.parseUShort();for(let T=x;T<=y;T+=1)C!==0?(d=u.offset+u.relativeOffset-2,d+=C,d+=(T-x)*2,v=te.getUShort(i,d),v!==0&&(v=v+b&65535)):v=T+b&65535,o.glyphIndexMap[T]=v}}function $c(o,e){let i={};e.skip("uLong");let r=e.parseULong();for(let a=0;a<r;a+=1){let l=e.parseUInt24(),c={varSelector:l},h=e.parseOffset32(),p=e.parseOffset32(),u=e.relativeOffset;h&&(e.relativeOffset=h,c.defaultUVS=e.parseStruct({ranges:function(){return e.parseRecordList32({startUnicodeValue:e.parseUInt24,additionalCount:e.parseByte})}})),p&&(e.relativeOffset=p,c.nonDefaultUVS=e.parseStruct({uvsMappings:function(){let d={},m=e.parseRecordList32({unicodeValue:e.parseUInt24,glyphID:e.parseUShort});for(let v=0;v<m.length;v+=1)d[m[v].unicodeValue]=m[v];return d}})),i[l]=c,e.relativeOffset=u}o.varSelectorList=i}function eh(o,e){let i={};i.version=te.getUShort(o,e),ne.argument(i.version===0,"cmap table version should be 0."),i.numTables=te.getUShort(o,e+2);let r=null,a=-1,l=-1;for(let h=i.numTables-1;h>=0;h-=1){let p=te.getUShort(o,e+4+h*8),u=te.getUShort(o,e+4+h*8+2);if(p===3&&(u===0||u===1||u===10)||p===0&&(u===0||u===1||u===2||u===3||u===4)){if(l=te.getULong(o,e+4+h*8+4),r)break}else p===0&&u===5&&(a=te.getULong(o,e+4+h*8+4),r=new te.Parser(o,e+a),r.parseUShort()!==14&&(a=-1,r=null))}if(l===-1)throw new Error("No valid cmap sub-tables found.");let c=new te.Parser(o,e+l);if(i.format=c.parseUShort(),i.format===12)Qc(i,c);else if(i.format===4)Jc(i,c,o,e,l);else throw new Error("Only format 4, 12 and 14 cmap tables are supported (found format "+i.format+").");return r&&$c(i,r),i}function th(o,e,i){o.segments.push({end:e,start:e,delta:-(e-i),offset:0,glyphIndex:i})}function sh(o){o.segments.push({end:65535,start:65535,delta:1,offset:0})}function nh(o){let e=!0,i;for(i=o.length-1;i>0;i-=1)if(o.get(i).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}let r=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:12+8}];e||(r=r.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),r=r.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);let a=new X.Table("cmap",r);for(a.segments=[],i=0;i<o.length;i+=1){let y=o.get(i);for(let x=0;x<y.unicodes.length;x+=1)th(a,y.unicodes[x],i);a.segments=a.segments.sort(function(x,b){return x.start-b.start})}sh(a);let l=a.segments.length,c=0,h=[],p=[],u=[],d=[],m=[],v=[];for(i=0;i<l;i+=1){let y=a.segments[i];y.end<=65535&&y.start<=65535?(h=h.concat({name:"end_"+i,type:"USHORT",value:y.end}),p=p.concat({name:"start_"+i,type:"USHORT",value:y.start}),u=u.concat({name:"idDelta_"+i,type:"SHORT",value:y.delta}),d=d.concat({name:"idRangeOffset_"+i,type:"USHORT",value:y.offset}),y.glyphId!==void 0&&(m=m.concat({name:"glyph_"+i,type:"USHORT",value:y.glyphId}))):c+=1,!e&&y.glyphIndex!==void 0&&(v=v.concat({name:"cmap12Start_"+i,type:"ULONG",value:y.start}),v=v.concat({name:"cmap12End_"+i,type:"ULONG",value:y.end}),v=v.concat({name:"cmap12Glyph_"+i,type:"ULONG",value:y.glyphIndex}))}if(a.segCountX2=(l-c)*2,a.searchRange=Math.pow(2,Math.floor(Math.log(l-c)/Math.log(2)))*2,a.entrySelector=Math.log(a.searchRange/2)/Math.log(2),a.rangeShift=a.segCountX2-a.searchRange,a.fields=a.fields.concat(h),a.fields.push({name:"reservedPad",type:"USHORT",value:0}),a.fields=a.fields.concat(p),a.fields=a.fields.concat(u),a.fields=a.fields.concat(d),a.fields=a.fields.concat(m),a.cmap4Length=14+h.length*2+2+p.length*2+u.length*2+d.length*2+m.length*2,!e){let y=16+v.length*4;a.cmap12Offset=12+2*2+4+a.cmap4Length,a.fields=a.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:y},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:v.length/3}]),a.fields=a.fields.concat(v)}return a}let dr={parse:eh,make:nh},Hs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],ih=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],oh=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Vt=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function fr(o){this.font=o}fr.prototype.charToGlyphIndex=function(o){let e=o.codePointAt(0),i=this.font.glyphs;if(i)for(let r=0;r<i.length;r+=1){let a=i.get(r);for(let l=0;l<a.unicodes.length;l+=1)if(a.unicodes[l]===e)return r}return null};function mr(o){this.cmap=o}mr.prototype.charToGlyphIndex=function(o){return this.cmap.glyphIndexMap[o.codePointAt(0)]||0};function on(o,e){this.encoding=o,this.charset=e}on.prototype.charToGlyphIndex=function(o){let e=o.codePointAt(0),i=this.encoding[e];return this.charset.indexOf(i)};function ui(o){switch(o.version){case 1:this.names=Vt.slice();break;case 2:this.names=new Array(o.numberOfGlyphs);for(let e=0;e<o.numberOfGlyphs;e++)o.glyphNameIndex[e]<Vt.length?this.names[e]=Vt[o.glyphNameIndex[e]]:this.names[e]=o.names[o.glyphNameIndex[e]-Vt.length];break;case 2.5:this.names=new Array(o.numberOfGlyphs);for(let e=0;e<o.numberOfGlyphs;e++)this.names[e]=Vt[e+o.glyphNameIndex[e]];break;case 3:this.names=[];break;default:this.names=[];break}}ui.prototype.nameToGlyphIndex=function(o){return this.names.indexOf(o)};ui.prototype.glyphIndexToName=function(o){return this.names[o]};function rh(o){let e,i=o.tables.cmap.glyphIndexMap,r=Object.keys(i);for(let a=0;a<r.length;a+=1){let l=r[a],c=i[l];e=o.glyphs.get(c),e.addUnicode(parseInt(l))}for(let a=0;a<o.glyphs.length;a+=1)e=o.glyphs.get(a),o.cffEncoding?o.isCIDFont?e.name="gid"+a:e.name=o.cffEncoding.charset[a]:o.glyphNames.names&&(e.name=o.glyphNames.glyphIndexToName(a))}function ah(o){o._IndexToUnicodeMap={};let e=o.tables.cmap.glyphIndexMap,i=Object.keys(e);for(let r=0;r<i.length;r+=1){let a=i[r],l=e[a];o._IndexToUnicodeMap[l]===void 0?o._IndexToUnicodeMap[l]={unicodes:[parseInt(a)]}:o._IndexToUnicodeMap[l].unicodes.push(parseInt(a))}}function lh(o,e){e.lowMemory?ah(o):rh(o)}function ch(o,e,i,r,a){o.beginPath(),o.moveTo(e,i),o.lineTo(r,a),o.stroke()}let Dt={line:ch};function hh(o,e){let i=e||new Cs;return{configurable:!0,get:function(){return typeof i=="function"&&(i=i()),i},set:function(r){i=r}}}function je(o){this.bindConstructorValues(o)}je.prototype.bindConstructorValues=function(o){if(this.index=o.index||0,o.name===".notdef"?o.unicode=void 0:o.name===".null"&&(o.unicode=0),o.unicode===0&&o.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=o.name||null,this.unicode=o.unicode,this.unicodes=o.unicodes||(o.unicode!==void 0?[o.unicode]:[]),"xMin"in o&&(this.xMin=o.xMin),"yMin"in o&&(this.yMin=o.yMin),"xMax"in o&&(this.xMax=o.xMax),"yMax"in o&&(this.yMax=o.yMax),"advanceWidth"in o&&(this.advanceWidth=o.advanceWidth),"leftSideBearing"in o&&(this.leftSideBearing=o.leftSideBearing),Object.defineProperty(this,"path",hh(this,o.path))};je.prototype.addUnicode=function(o){this.unicodes.length===0&&(this.unicode=o),this.unicodes.push(o)};je.prototype.getBoundingBox=function(){return this.path.getBoundingBox()};je.prototype.getPath=function(o,e,i,r,a){o=o!==void 0?o:0,e=e!==void 0?e:0,i=i!==void 0?i:72;let l,c;r||(r={});let h=r.xScale,p=r.yScale;if(r.hinting&&a&&a.hinting&&(c=this.path&&a.hinting.exec(this,i)),c)l=a.hinting.getCommands(c),o=Math.round(o),e=Math.round(e),h=p=1;else{l=this.path.commands;let d=1/(this.path.unitsPerEm||1e3)*i;h===void 0&&(h=d),p===void 0&&(p=d)}let u=new Cs;for(let d=0;d<l.length;d+=1){let m=l[d];m.type==="M"?u.moveTo(o+m.x*h,e+-m.y*p):m.type==="L"?u.lineTo(o+m.x*h,e+-m.y*p):m.type==="Q"?u.quadraticCurveTo(o+m.x1*h,e+-m.y1*p,o+m.x*h,e+-m.y*p):m.type==="C"?u.curveTo(o+m.x1*h,e+-m.y1*p,o+m.x2*h,e+-m.y2*p,o+m.x*h,e+-m.y*p):m.type==="Z"&&u.closePath()}return u};je.prototype.getContours=function(){if(this.points===void 0)return[];let o=[],e=[];for(let i=0;i<this.points.length;i+=1){let r=this.points[i];e.push(r),r.lastPointOfContour&&(o.push(e),e=[])}return ne.argument(e.length===0,"There are still points left in the current contour."),o};je.prototype.getMetrics=function(){let o=this.path.commands,e=[],i=[];for(let a=0;a<o.length;a+=1){let l=o[a];l.type!=="Z"&&(e.push(l.x),i.push(l.y)),(l.type==="Q"||l.type==="C")&&(e.push(l.x1),i.push(l.y1)),l.type==="C"&&(e.push(l.x2),i.push(l.y2))}let r={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,i),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,i),leftSideBearing:this.leftSideBearing};return isFinite(r.xMin)||(r.xMin=0),isFinite(r.xMax)||(r.xMax=this.advanceWidth),isFinite(r.yMin)||(r.yMin=0),isFinite(r.yMax)||(r.yMax=0),r.rightSideBearing=this.advanceWidth-r.leftSideBearing-(r.xMax-r.xMin),r};je.prototype.draw=function(o,e,i,r,a){this.getPath(e,i,r,a).draw(o)};je.prototype.drawPoints=function(o,e,i,r){function a(u,d,m,v){o.beginPath();for(let y=0;y<u.length;y+=1)o.moveTo(d+u[y].x*v,m+u[y].y*v),o.arc(d+u[y].x*v,m+u[y].y*v,2,0,Math.PI*2,!1);o.closePath(),o.fill()}e=e!==void 0?e:0,i=i!==void 0?i:0,r=r!==void 0?r:24;let l=1/this.path.unitsPerEm*r,c=[],h=[],p=this.path;for(let u=0;u<p.commands.length;u+=1){let d=p.commands[u];d.x!==void 0&&c.push({x:d.x,y:-d.y}),d.x1!==void 0&&h.push({x:d.x1,y:-d.y1}),d.x2!==void 0&&h.push({x:d.x2,y:-d.y2})}o.fillStyle="blue",a(c,e,i,l),o.fillStyle="red",a(h,e,i,l)};je.prototype.drawMetrics=function(o,e,i,r){let a;e=e!==void 0?e:0,i=i!==void 0?i:0,r=r!==void 0?r:24,a=1/this.path.unitsPerEm*r,o.lineWidth=1,o.strokeStyle="black",Dt.line(o,e,-1e4,e,1e4),Dt.line(o,-1e4,i,1e4,i);let l=this.xMin||0,c=this.yMin||0,h=this.xMax||0,p=this.yMax||0,u=this.advanceWidth||0;o.strokeStyle="blue",Dt.line(o,e+l*a,-1e4,e+l*a,1e4),Dt.line(o,e+h*a,-1e4,e+h*a,1e4),Dt.line(o,-1e4,i+-c*a,1e4,i+-c*a),Dt.line(o,-1e4,i+-p*a,1e4,i+-p*a),o.strokeStyle="green",Dt.line(o,e+u*a,-1e4,e+u*a,1e4)};je.prototype.toPathData=function(o){return this.path.toPathData(o)};je.prototype.fromSVG=function(o,e={}){return this.path.fromSVG(o,e)};je.prototype.toSVG=function(o){return this.path.toSVG(o,this.toPathData.apply(this,[o]))};je.prototype.toDOMElement=function(o){return this.path.toDOMElement(o)};let pi=je;function Vs(o,e,i){Object.defineProperty(o,e,{get:function(){return o.path,o[i]},set:function(r){o[i]=r},enumerable:!0,configurable:!0})}function di(o,e){if(this.font=o,this.glyphs={},Array.isArray(e))for(let i=0;i<e.length;i++){let r=e[i];r.path.unitsPerEm=o.unitsPerEm,this.glyphs[i]=r}this.length=e&&e.length||0}di.prototype.get=function(o){if(this.glyphs[o]===void 0){this.font._push(o),typeof this.glyphs[o]=="function"&&(this.glyphs[o]=this.glyphs[o]());let e=this.glyphs[o],i=this.font._IndexToUnicodeMap[o];if(i)for(let r=0;r<i.unicodes.length;r++)e.addUnicode(i.unicodes[r]);this.font.cffEncoding?this.font.isCIDFont?e.name="gid"+o:e.name=this.font.cffEncoding.charset[o]:this.font.glyphNames.names&&(e.name=this.font.glyphNames.glyphIndexToName(o)),this.glyphs[o].advanceWidth=this.font._hmtxTableData[o].advanceWidth,this.glyphs[o].leftSideBearing=this.font._hmtxTableData[o].leftSideBearing}else typeof this.glyphs[o]=="function"&&(this.glyphs[o]=this.glyphs[o]());return this.glyphs[o]};di.prototype.push=function(o,e){this.glyphs[o]=e,this.length++};function uh(o,e){return new pi({index:e,font:o})}function ph(o,e,i,r,a,l){return function(){let c=new pi({index:e,font:o});return c.path=function(){i(c,r,a);let h=l(o.glyphs,c);return h.unitsPerEm=o.unitsPerEm,h},Vs(c,"xMin","_xMin"),Vs(c,"xMax","_xMax"),Vs(c,"yMin","_yMin"),Vs(c,"yMax","_yMax"),c}}function dh(o,e,i,r,a){return function(){let l=new pi({index:e,font:o});return l.path=function(){let c=i(o,l,r,a);return c.unitsPerEm=o.unitsPerEm,c},l}}let pt={GlyphSet:di,glyphLoader:uh,ttfGlyphLoader:ph,cffGlyphLoader:dh};function gr(o,e){if(o===e)return!0;if(Array.isArray(o)&&Array.isArray(e)){if(o.length!==e.length)return!1;for(let i=0;i<o.length;i+=1)if(!gr(o[i],e[i]))return!1;return!0}else return!1}function rn(o){let e;return o.length<1240?e=107:o.length<33900?e=1131:e=32768,e}function lt(o,e,i,r){let a=[],l=[],c=r>1?te.getULong(o,e):te.getCard16(o,e),h=r>1?4:2,p,u;if(c!==0){let d=te.getByte(o,e+h);p=e+(c+1)*d+h;let m=e+h+1;for(let v=0;v<c+1;v+=1)a.push(te.getOffset(o,m,d)),m+=d;u=p+a[c]}else u=e+h;for(let d=0;d<a.length-1;d+=1){let m=te.getBytes(o,p+a[d],p+a[d+1]);i&&(m=i(m,o,e,r)),l.push(m)}return{objects:l,startOffset:e,endOffset:u}}function fh(o,e,i){let r=[],a=i>1?te.getULong(o,e):te.getCard16(o,e),l=i>1?4:2,c,h;if(a!==0){let p=te.getByte(o,e+l);c=e+(a+1)*p+l;let u=e+l+1;for(let d=0;d<a+1;d+=1)r.push(te.getOffset(o,u,p)),u+=p;h=c+r[a]}else h=e+l;return{offsets:r,startOffset:e,endOffset:h}}function mh(o,e,i,r,a,l){let c=l>1?te.getULong(i,r):te.getCard16(i,r),h=l>1?4:2,p=0;if(c!==0){let d=te.getByte(i,r+h);p=r+(c+1)*d+h}let u=te.getBytes(i,p+e[o],p+e[o+1]);return a&&(u=a(u)),u}function gh(o){let e="",i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let r=o.parseByte(),a=r>>4,l=r&15;if(a===15||(e+=i[a],l===15))break;e+=i[l]}return parseFloat(e)}function yh(o,e){let i,r,a,l;if(e===28)return i=o.parseByte(),r=o.parseByte(),i<<8|r;if(e===29)return i=o.parseByte(),r=o.parseByte(),a=o.parseByte(),l=o.parseByte(),i<<24|r<<16|a<<8|l;if(e===30)return gh(o);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return i=o.parseByte(),(e-247)*256+i+108;if(e>=251&&e<=254)return i=o.parseByte(),-(e-251)*256-i-108;throw new Error("Invalid b0 "+e)}function vh(o){let e={};for(let i=0;i<o.length;i+=1){let r=o[i][0],a=o[i][1],l;if(a.length===1?l=a[0]:l=a,Object.prototype.hasOwnProperty.call(e,r)&&!isNaN(e[r]))throw new Error("Object "+e+" already has key "+r);e[r]=l}return e}function fi(o,e,i,r){e=e!==void 0?e:0;let a=new te.Parser(o,e),l=[],c=[];i=i!==void 0?i:o.byteLength;let h=r<2?22:28;for(;a.relativeOffset<i;){let p=a.parseByte();if(p<h){if(p===12&&(p=1200+a.parseByte()),r>1&&p===23){Lh(c);continue}l.push([p,c]),c=[]}else c.push(yh(a,p))}return vh(l)}function fs(o,e){return e<=390?e=Hs[e]:o?e=o[e-391]:e=void 0,e}function mi(o,e,i){let r={},a;for(let l=0;l<e.length;l+=1){let c=e[l];if(Array.isArray(c.type)){let h=[];h.length=c.type.length;for(let p=0;p<c.type.length;p++)a=o[c.op]!==void 0?o[c.op][p]:void 0,a===void 0&&(a=c.value!==void 0&&c.value[p]!==void 0?c.value[p]:null),c.type[p]==="SID"&&(a=fs(i,a)),h[p]=a;r[c.name]=h}else a=o[c.op],a===void 0&&(a=c.value!==void 0?c.value:null),c.type==="SID"&&(a=fs(i,a)),r[c.name]=a}return r}function bh(o,e){let i={};if(i.formatMajor=te.getCard8(o,e),i.formatMinor=te.getCard8(o,e+1),i.formatMajor>2)throw new Error(`Unsupported CFF table version ${i.formatMajor}.${i.formatMinor}`);return i.size=te.getCard8(o,e+2),i.formatMajor<2?(i.offsetSize=te.getCard8(o,e+3),i.startOffset=e,i.endOffset=e+4):(i.topDictLength=te.getCard16(o,e+3),i.endOffset=e+8),i}let yr=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],vr=[{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"charStrings",op:17,type:"offset"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"vstore",op:24,type:"offset"}],br=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],xr=[{name:"blueValues",op:6,type:"delta"},{name:"otherBlues",op:7,type:"delta"},{name:"familyBlues",op:7,type:"delta"},{name:"familyBlues",op:8,type:"delta"},{name:"familyOtherBlues",op:9,type:"delta"},{name:"blueScale",op:1209,type:"number",value:.039625},{name:"blueShift",op:1210,type:"number",value:7},{name:"blueFuzz",op:1211,type:"number",value:1},{name:"stdHW",op:10,type:"number"},{name:"stdVW",op:11,type:"number"},{name:"stemSnapH",op:1212,type:"number"},{name:"stemSnapV",op:1213,type:"number"},{name:"languageGroup",op:1217,type:"number",value:0},{name:"expansionFactor",op:1218,type:"number",value:.06},{name:"vsindex",op:22,type:"number",value:0},{name:"subrs",op:19,type:"offset"}],xh=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function Ch(o,e,i,r){let a=fi(o,e,o.byteLength,r);return mi(a,r>1?vr:yr,i)}function gi(o,e,i,r,a){let l=fi(o,e,i,a);return mi(l,a>1?xr:br,r)}function wh(o,e,i){let r=fi(o,e,void 0,i);return mi(r,xh)}function Eh(o,e,i){let r=[];for(let a=0;a<i.length;a++){let l=new DataView(new Uint8Array(i[a]).buffer),c=wh(l,0,2),h=c.private[0],p=c.private[1];if(h!==0&&p!==0){let u=gi(o,p+e,h,[],2);if(u.subrs){let d=p+u.subrs,m=lt(o,d+e,void 0,2);c._subrs=m.objects,c._subrsBias=rn(c._subrs)}c._privateDict=u}r.push(c)}return r}function vn(o,e,i,r,a){let l=[];for(let c=0;c<i.length;c+=1){let h=new DataView(new Uint8Array(i[c]).buffer),p=Ch(h,0,r,a);p._subrs=[],p._subrsBias=0,p._defaultWidthX=0,p._nominalWidthX=0;let u=a<2?p.private[0]:0,d=a<2?p.private[1]:0;if(u!==0&&d!==0){let m=gi(o,d+e,u,r,a);if(p._defaultWidthX=m.defaultWidthX,p._nominalWidthX=m.nominalWidthX,m.subrs!==0){let v=d+m.subrs,y=lt(o,v+e,void 0,a);p._subrs=y.objects,p._subrsBias=rn(p._subrs)}p._privateDict=m}l.push(p)}return l}function Sh(o,e,i,r){let a,l,c=new te.Parser(o,e);i-=1;let h=[".notdef"],p=c.parseCard8();if(p===0)for(let u=0;u<i;u+=1)a=c.parseSID(),h.push(fs(r,a)||a);else if(p===1)for(;h.length<=i;){a=c.parseSID(),l=c.parseCard8();for(let u=0;u<=l;u+=1)h.push(fs(r,a)||a),a+=1}else if(p===2)for(;h.length<=i;){a=c.parseSID(),l=c.parseCard16();for(let u=0;u<=l;u+=1)h.push(fs(r,a)||a),a+=1}else throw new Error("Unknown charset format "+p);return h}function Th(o,e,i){let r,a={},l=new te.Parser(o,e),c=l.parseCard8();if(c===0){let h=l.parseCard8();for(let p=0;p<h;p+=1)r=l.parseCard8(),a[r]=p}else if(c===1){let h=l.parseCard8();r=1;for(let p=0;p<h;p+=1){let u=l.parseCard8(),d=l.parseCard8();for(let m=u;m<=u+d;m+=1)a[m]=r,r+=1}}else throw new Error("Unknown encoding format "+c);return new on(a,i)}function Lh(o){let e=o.pop();for(;o.length>e;)o.pop()}function eo(o,e,i,r){let a,l,c,h,p=new Cs,u=[],d=0,m=!1,v=!1,y=0,x=0,b,C,T,A,O=0,P=[],V=o.tables.cff2||o.tables.cff;if(T=V.topDict._defaultWidthX,A=V.topDict._nominalWidthX,o.isCIDFont||r>1){let j=V.topDict._fdSelect?V.topDict._fdSelect[e.index]:0,H=V.topDict._fdArray[j];b=H._subrs,C=H._subrsBias,r>1?(P=V.topDict._vstore.itemVariationStore.itemVariationSubtables,O=H._privateDict.vsindex):(T=H._defaultWidthX,A=H._nominalWidthX)}else b=V.topDict._subrs,C=V.topDict._subrsBias;let B=T;function I(j,H){v&&p.closePath(),p.moveTo(j,H),v=!0}function G(){let j;j=(u.length&1)!==0,j&&!m&&(B=u.shift()+A),d+=u.length>>1,u.length=0,m=!0}function W(j){let H,ee,$,de,ie,me,re,be,Z,K,J,Y,ce=0;for(;ce<j.length;){let he=j[ce];switch(ce+=1,he){case 1:G();break;case 3:G();break;case 4:u.length>1&&!m&&(B=u.shift()+A,m=!0),x+=u.pop(),I(y,x);break;case 5:for(;u.length>0;)y+=u.shift(),x+=u.shift(),p.lineTo(y,x);break;case 6:for(;u.length>0&&(y+=u.shift(),p.lineTo(y,x),u.length!==0);)x+=u.shift(),p.lineTo(y,x);break;case 7:for(;u.length>0&&(x+=u.shift(),p.lineTo(y,x),u.length!==0);)y+=u.shift(),p.lineTo(y,x);break;case 8:for(;u.length>0;)a=y+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),y=c+u.shift(),x=h+u.shift(),p.curveTo(a,l,c,h,y,x);break;case 10:ie=u.pop()+C,me=b[ie],me&&W(me);break;case 11:if(r>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(he=j[ce],ce+=1,he){case 35:a=y+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),re=c+u.shift(),be=h+u.shift(),Z=re+u.shift(),K=be+u.shift(),J=Z+u.shift(),Y=K+u.shift(),y=J+u.shift(),x=Y+u.shift(),u.shift(),p.curveTo(a,l,c,h,re,be),p.curveTo(Z,K,J,Y,y,x);break;case 34:a=y+u.shift(),l=x,c=a+u.shift(),h=l+u.shift(),re=c+u.shift(),be=h,Z=re+u.shift(),K=h,J=Z+u.shift(),Y=x,y=J+u.shift(),p.curveTo(a,l,c,h,re,be),p.curveTo(Z,K,J,Y,y,x);break;case 36:a=y+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),re=c+u.shift(),be=h,Z=re+u.shift(),K=h,J=Z+u.shift(),Y=K+u.shift(),y=J+u.shift(),p.curveTo(a,l,c,h,re,be),p.curveTo(Z,K,J,Y,y,x);break;case 37:a=y+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),re=c+u.shift(),be=h+u.shift(),Z=re+u.shift(),K=be+u.shift(),J=Z+u.shift(),Y=K+u.shift(),Math.abs(J-y)>Math.abs(Y-x)?y=J+u.shift():x=Y+u.shift(),p.curveTo(a,l,c,h,re,be),p.curveTo(Z,K,J,Y,y,x);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+he),u.length=0}break;case 14:if(r>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}u.length>0&&!m&&(B=u.shift()+A,m=!0),v&&(p.closePath(),v=!1);break;case 15:if(r<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}O=u.pop();break;case 16:if(r<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}let xe=P[O],w=u.pop(),E=w*xe.regionIndexes.length,M=u.length-E,S=M-w;for(let k=0;k<w;k++){let D=u[S+k];for(let R=0;R<w.length;R++)D+=1*u[M++];u[S+k]=D}for(;E--;)u.pop();break;case 18:G();break;case 19:case 20:G(),ce+=d+7>>3;break;case 21:u.length>2&&!m&&(B=u.shift()+A,m=!0),x+=u.pop(),y+=u.pop(),I(y,x);break;case 22:u.length>1&&!m&&(B=u.shift()+A,m=!0),y+=u.pop(),I(y,x);break;case 23:G();break;case 24:for(;u.length>2;)a=y+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),y=c+u.shift(),x=h+u.shift(),p.curveTo(a,l,c,h,y,x);y+=u.shift(),x+=u.shift(),p.lineTo(y,x);break;case 25:for(;u.length>6;)y+=u.shift(),x+=u.shift(),p.lineTo(y,x);a=y+u.shift(),l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),y=c+u.shift(),x=h+u.shift(),p.curveTo(a,l,c,h,y,x);break;case 26:for(u.length&1&&(y+=u.shift());u.length>0;)a=y,l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),y=c,x=h+u.shift(),p.curveTo(a,l,c,h,y,x);break;case 27:for(u.length&1&&(x+=u.shift());u.length>0;)a=y+u.shift(),l=x,c=a+u.shift(),h=l+u.shift(),y=c+u.shift(),x=h,p.curveTo(a,l,c,h,y,x);break;case 28:H=j[ce],ee=j[ce+1],u.push((H<<24|ee<<16)>>16),ce+=2;break;case 29:ie=u.pop()+o.gsubrsBias,me=o.gsubrs[ie],me&&W(me);break;case 30:for(;u.length>0&&(a=y,l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),y=c+u.shift(),x=h+(u.length===1?u.shift():0),p.curveTo(a,l,c,h,y,x),u.length!==0);)a=y+u.shift(),l=x,c=a+u.shift(),h=l+u.shift(),x=h+u.shift(),y=c+(u.length===1?u.shift():0),p.curveTo(a,l,c,h,y,x);break;case 31:for(;u.length>0&&(a=y+u.shift(),l=x,c=a+u.shift(),h=l+u.shift(),x=h+u.shift(),y=c+(u.length===1?u.shift():0),p.curveTo(a,l,c,h,y,x),u.length!==0);)a=y,l=x+u.shift(),c=a+u.shift(),h=l+u.shift(),y=c+u.shift(),x=h+(u.length===1?u.shift():0),p.curveTo(a,l,c,h,y,x);break;default:he<32?console.log("Glyph "+e.index+": unknown operator "+he):he<247?u.push(he-139):he<251?(H=j[ce],ce+=1,u.push((he-247)*256+H+108)):he<255?(H=j[ce],ce+=1,u.push(-(he-251)*256-H-108)):(H=j[ce],ee=j[ce+1],$=j[ce+2],de=j[ce+3],ce+=4,u.push((H<<24|ee<<16|$<<8|de)/65536))}}}return W(i),m&&(e.advanceWidth=B),p}function to(o,e,i,r,a){let l=[],c,h=new te.Parser(o,e),p=h.parseCard8();if(p===0)for(let u=0;u<i;u++){if(c=h.parseCard8(),c>=r)throw new Error("CFF table CID Font FDSelect has bad FD index value "+c+" (FD count "+r+")");l.push(c)}else if(p===3||a>1&&p===4){let u=p===4?h.parseULong():h.parseCard16(),d=p===4?h.parseULong():h.parseCard16();if(d!==0)throw new Error(`CFF Table CID Font FDSelect format ${p} range has bad initial GID ${d}`);let m;for(let v=0;v<u;v++){if(c=p===4?h.parseUShort():h.parseCard8(),m=p===4?h.parseULong():h.parseCard16(),c>=r)throw new Error("CFF table CID Font FDSelect has bad FD index value "+c+" (FD count "+r+")");if(m>i)throw new Error(`CFF Table CID Font FDSelect format ${a} range has bad GID ${m}`);for(;d<m;d++)l.push(c);d=m}if(m!==i)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+m)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+p);return l}function kh(o,e,i,r){let a,l=bh(o,e);l.formatMajor===2?a=i.tables.cff2={}:a=i.tables.cff={};let c=l.formatMajor>1?null:lt(o,l.endOffset,te.bytesToString),h=l.formatMajor>1?null:lt(o,c.endOffset),p=l.formatMajor>1?null:lt(o,h.endOffset,te.bytesToString),u=lt(o,l.formatMajor>1?e+l.size+l.topDictLength:p.endOffset,void 0,l.formatMajor);i.gsubrs=u.objects,i.gsubrsBias=rn(i.gsubrs);let d;if(l.formatMajor>1){let v=e+l.size,y=te.getBytes(o,v,v+l.topDictLength);d=vn(o,0,[y],void 0,l.formatMajor)[0]}else{let v=vn(o,e,h.objects,p.objects,l.formatMajor);if(v.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+v.length);d=v[0]}if(a.topDict=d,d._privateDict&&(i.defaultWidthX=d._privateDict.defaultWidthX,i.nominalWidthX=d._privateDict.nominalWidthX),l.formatMajor<2&&d.ros[0]!==void 0&&d.ros[1]!==void 0&&(i.isCIDFont=!0),l.formatMajor>1){let v=d.fdArray,y=d.fdSelect;if(!v)throw new Error("This is a CFF2 font, but FDArray information is missing");let x=lt(o,e+v,null,l.formatMajor),b=Eh(o,e,x.objects);d._fdArray=b,y&&(d._fdSelect=to(o,e+y,i.numGlyphs,b.length,l.formatMajor))}else if(i.isCIDFont){let v=d.fdArray,y=d.fdSelect;if(v===0||y===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");v+=e;let x=lt(o,v),b=vn(o,e,x.objects,p.objects,l.formatMajor);d._fdArray=b,y+=e,d._fdSelect=to(o,y,i.numGlyphs,b.length,l.formatMajor)}if(l.formatMajor<2){let v=e+d.private[1],y=gi(o,v,d.private[0],p.objects,l.formatMajor);if(i.defaultWidthX=y.defaultWidthX,i.nominalWidthX=y.nominalWidthX,y.subrs!==0){let x=v+y.subrs,b=lt(o,x);i.subrs=b.objects,i.subrsBias=rn(i.subrs)}else i.subrs=[],i.subrsBias=0}let m;if(r.lowMemory?(m=fh(o,e+d.charStrings,l.formatMajor),i.nGlyphs=m.offsets.length-(l.formatMajor>1?1:0)):(m=lt(o,e+d.charStrings,null,l.formatMajor),i.nGlyphs=m.objects.length),l.formatMajor>1&&i.tables.maxp&&i.nGlyphs!==i.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${i.nGlyphs}) must correspond to the glyph count in the maxp table (${i.tables.maxp.numGlyphs})`),l.formatMajor<2){let v=Sh(o,e+d.charset,i.nGlyphs,p.objects);d.encoding===0?i.cffEncoding=new on(ih,v):d.encoding===1?i.cffEncoding=new on(oh,v):i.cffEncoding=Th(o,e+d.encoding,v),i.encoding=i.encoding||i.cffEncoding}if(i.glyphs=new pt.GlyphSet(i),r.lowMemory)i._push=function(v){let y=mh(v,m.offsets,o,e+d.charStrings,void 0,l.formatMajor);i.glyphs.push(v,pt.cffGlyphLoader(i,v,eo,y,l.formatMajor))};else for(let v=0;v<i.nGlyphs;v+=1){let y=m.objects[v];i.glyphs.push(v,pt.cffGlyphLoader(i,v,eo,y,l.formatMajor))}if(d.vstore){let v=new te.Parser(o,e+d.vstore);d._vstore=v.parseVariationStore()}}function Cr(o,e){let i,r=Hs.indexOf(o);return r>=0&&(i=r),r=e.indexOf(o),r>=0?i=r+Hs.length:(i=Hs.length+e.length,e.push(o)),i}function Mh(){return new X.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Ih(o){let e=new X.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(let i=0;i<o.length;i+=1)e.names.push({name:"name_"+i,type:"NAME",value:o[i]});return e}function wr(o,e,i){let r={};for(let a=0;a<o.length;a+=1){let l=o[a],c=e[l.name];c!==void 0&&!gr(c,l.value)&&(l.type==="SID"&&(c=Cr(c,i)),r[l.op]={name:l.name,type:l.type,value:c})}return r}function so(o,e,i){let r=new X.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=wr(i>1?vr:yr,o,e),r}function no(o){let e=new X.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:o}],e}function Ah(o){let e=new X.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(let i=0;i<o.length;i+=1)e.strings.push({name:"string_"+i,type:"STRING",value:o[i]});return e}function _h(){return new X.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Bh(o,e){let i=new X.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let r=0;r<o.length;r+=1){let a=o[r],l=Cr(a,e);i.fields.push({name:"glyph_"+r,type:"SID",value:l})}return i}function Rh(o,e){let i=[],r=o.path;e<2&&i.push({name:"width",type:"NUMBER",value:o.advanceWidth});let a=0,l=0;for(let c=0;c<r.commands.length;c+=1){let h,p,u=r.commands[c];if(u.type==="Q"){let d=.3333333333333333,m=2/3;u={type:"C",x:u.x,y:u.y,x1:Math.round(d*a+m*u.x1),y1:Math.round(d*l+m*u.y1),x2:Math.round(d*u.x+m*u.x1),y2:Math.round(d*u.y+m*u.y1)}}if(u.type==="M")h=Math.round(u.x-a),p=Math.round(u.y-l),i.push({name:"dx",type:"NUMBER",value:h}),i.push({name:"dy",type:"NUMBER",value:p}),i.push({name:"rmoveto",type:"OP",value:21}),a=Math.round(u.x),l=Math.round(u.y);else if(u.type==="L")h=Math.round(u.x-a),p=Math.round(u.y-l),i.push({name:"dx",type:"NUMBER",value:h}),i.push({name:"dy",type:"NUMBER",value:p}),i.push({name:"rlineto",type:"OP",value:5}),a=Math.round(u.x),l=Math.round(u.y);else if(u.type==="C"){let d=Math.round(u.x1-a),m=Math.round(u.y1-l),v=Math.round(u.x2-u.x1),y=Math.round(u.y2-u.y1);h=Math.round(u.x-u.x2),p=Math.round(u.y-u.y2),i.push({name:"dx1",type:"NUMBER",value:d}),i.push({name:"dy1",type:"NUMBER",value:m}),i.push({name:"dx2",type:"NUMBER",value:v}),i.push({name:"dy2",type:"NUMBER",value:y}),i.push({name:"dx",type:"NUMBER",value:h}),i.push({name:"dy",type:"NUMBER",value:p}),i.push({name:"rrcurveto",type:"OP",value:8}),a=Math.round(u.x),l=Math.round(u.y)}}return e<2&&i.push({name:"endchar",type:"OP",value:14}),i}function Oh(o,e){let i=new X.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let r=0;r<o.length;r+=1){let a=o.get(r),l=Rh(a,e);i.charStrings.push({name:a.name,type:"CHARSTRING",value:l})}return i}function Dh(o,e,i){let r=new X.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=wr(i>1?xr:br,o,e),r}function Nh(o,e){let i=new X.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),r=1/e.unitsPerEm,a={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[r,0,0,r,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},l={},c=[],h;for(let m=1;m<o.length;m+=1)h=o.get(m),c.push(h.name);let p=[];i.header=Mh(),i.nameIndex=Ih([e.postScriptName]);let u=so(a,p);i.topDictIndex=no(u),i.globalSubrIndex=_h(),i.charsets=Bh(c,p),i.charStringsIndex=Oh(o,1),i.privateDict=Dh(l,p),i.stringIndex=Ah(p);let d=i.header.sizeOf()+i.nameIndex.sizeOf()+i.topDictIndex.sizeOf()+i.stringIndex.sizeOf()+i.globalSubrIndex.sizeOf();return a.charset=d,a.encoding=0,a.charStrings=a.charset+i.charsets.sizeOf(),a.private[1]=a.charStrings+i.charStringsIndex.sizeOf(),u=so(a,p),i.topDictIndex=no(u),i}let Rn={parse:kh,make:Nh};function Ph(o,e){let i={},r=new te.Parser(o,e);return i.version=r.parseVersion(),i.fontRevision=Math.round(r.parseFixed()*1e3)/1e3,i.checkSumAdjustment=r.parseULong(),i.magicNumber=r.parseULong(),ne.argument(i.magicNumber===1594834165,"Font header has wrong magic number."),i.flags=r.parseUShort(),i.unitsPerEm=r.parseUShort(),i.created=r.parseLongDateTime(),i.modified=r.parseLongDateTime(),i.xMin=r.parseShort(),i.yMin=r.parseShort(),i.xMax=r.parseShort(),i.yMax=r.parseShort(),i.macStyle=r.parseUShort(),i.lowestRecPPEM=r.parseUShort(),i.fontDirectionHint=r.parseShort(),i.indexToLocFormat=r.parseShort(),i.glyphDataFormat=r.parseShort(),i}function Vh(o){let e=Math.round(new Date().getTime()/1e3)+2082844800,i=e;return o.createdTimestamp&&(i=o.createdTimestamp+2082844800),new X.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:i},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],o)}let Er={parse:Ph,make:Vh};function Fh(o,e){let i={},r=new te.Parser(o,e);return i.version=r.parseVersion(),i.ascender=r.parseShort(),i.descender=r.parseShort(),i.lineGap=r.parseShort(),i.advanceWidthMax=r.parseUShort(),i.minLeftSideBearing=r.parseShort(),i.minRightSideBearing=r.parseShort(),i.xMaxExtent=r.parseShort(),i.caretSlopeRise=r.parseShort(),i.caretSlopeRun=r.parseShort(),i.caretOffset=r.parseShort(),r.relativeOffset+=8,i.metricDataFormat=r.parseShort(),i.numberOfHMetrics=r.parseUShort(),i}function Uh(o){return new X.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],o)}let Sr={parse:Fh,make:Uh};function Gh(o,e,i,r,a){let l,c,h=new te.Parser(o,e);for(let p=0;p<r;p+=1){p<i&&(l=h.parseUShort(),c=h.parseShort());let u=a.get(p);u.advanceWidth=l,u.leftSideBearing=c}}function zh(o,e,i,r,a){o._hmtxTableData={};let l,c,h=new te.Parser(e,i);for(let p=0;p<a;p+=1)p<r&&(l=h.parseUShort(),c=h.parseShort()),o._hmtxTableData[p]={advanceWidth:l,leftSideBearing:c}}function Hh(o,e,i,r,a,l,c){c.lowMemory?zh(o,e,i,r,a):Gh(e,i,r,a,l)}function jh(o){let e=new X.Table("hmtx",[]);for(let i=0;i<o.length;i+=1){let r=o.get(i),a=r.advanceWidth||0,l=r.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+i,type:"USHORT",value:a}),e.fields.push({name:"leftSideBearing_"+i,type:"SHORT",value:l})}return e}let Tr={parse:Hh,make:jh};function Wh(o){let e=new X.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:o.length}]),i="",r=12+o.length*4;for(let a=0;a<o.length;++a){let l=i.indexOf(o[a]);l<0&&(l=i.length,i+=o[a]),e.fields.push({name:"offset "+a,type:"USHORT",value:r+l}),e.fields.push({name:"length "+a,type:"USHORT",value:o[a].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:i}),e}function Xh(o,e){let i=new te.Parser(o,e),r=i.parseULong();ne.argument(r===1,"Unsupported ltag table version."),i.skip("uLong",1);let a=i.parseULong(),l=[];for(let c=0;c<a;c++){let h="",p=e+i.parseUShort(),u=i.parseUShort();for(let d=p;d<p+u;++d)h+=String.fromCharCode(o.getInt8(d));l.push(h)}return l}let Lr={make:Wh,parse:Xh};function Zh(o,e){let i={},r=new te.Parser(o,e);return i.version=r.parseVersion(),i.numGlyphs=r.parseUShort(),i.version===1&&(i.maxPoints=r.parseUShort(),i.maxContours=r.parseUShort(),i.maxCompositePoints=r.parseUShort(),i.maxCompositeContours=r.parseUShort(),i.maxZones=r.parseUShort(),i.maxTwilightPoints=r.parseUShort(),i.maxStorage=r.parseUShort(),i.maxFunctionDefs=r.parseUShort(),i.maxInstructionDefs=r.parseUShort(),i.maxStackElements=r.parseUShort(),i.maxSizeOfInstructions=r.parseUShort(),i.maxComponentElements=r.parseUShort(),i.maxComponentDepth=r.parseUShort()),i}function Yh(o){return new X.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:o}])}let kr={parse:Zh,make:Yh},Mr=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Ir={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},Kh={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Ar={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function qh(o,e,i){switch(o){case 0:if(e===65535)return"und";if(i)return i[e];break;case 1:return Ir[e];case 3:return Ar[e]}}let On="utf-16",Qh={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Jh={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function _r(o,e,i){switch(o){case 0:return On;case 1:return Jh[i]||Qh[e];case 3:if(e===1||e===10)return On;break}}let Br={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function $h(o){return Br[o]}function e0(o,e,i){let r={},a=new te.Parser(o,e),l=a.parseUShort(),c=a.parseUShort(),h=a.offset+a.parseUShort();for(let p=0;p<c;p++){let u=a.parseUShort(),d=a.parseUShort(),m=a.parseUShort(),v=a.parseUShort(),y=Mr[v]||v,x=a.parseUShort(),b=a.parseUShort(),C=qh(u,m,i),T=_r(u,d,m),A=$h(u);if(T!==void 0&&C!==void 0&&A!==void 0){let O;if(T===On?O=Jt.UTF16(o,h+b,x):O=Jt.MACSTRING(o,h+b,x,T),O){let P=r[A];P===void 0&&(P=r[A]={});let V=P[y];V===void 0&&(V=P[y]={}),V[C]=O}}}return l===1&&a.parseUShort(),r}function Fs(o){let e={};for(let i in o)e[o[i]]=parseInt(i);return e}function io(o,e,i,r,a,l){return new X.Record("NameRecord",[{name:"platformID",type:"USHORT",value:o},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:i},{name:"nameID",type:"USHORT",value:r},{name:"length",type:"USHORT",value:a},{name:"offset",type:"USHORT",value:l}])}function t0(o,e){let i=o.length,r=e.length-i+1;e:for(let a=0;a<r;a++)for(;a<r;a++){for(let l=0;l<i;l++)if(e[a+l]!==o[l])continue e;return a}return-1}function oo(o,e){let i=t0(o,e);if(i<0){i=e.length;let r=0,a=o.length;for(;r<a;++r)e.push(o[r])}return i}function s0(o,e){let i=Fs(Br),r=Fs(Ir),a=Fs(Ar),l=[],c=[];for(let p in o){let u,d=[],m={},v=Fs(Mr),y=i[p];for(let x in o[p]){let b=v[x];if(b===void 0&&(b=x),u=parseInt(b),isNaN(u))throw new Error('Name table entry "'+x+'" does not exist, see nameTableNames for complete list.');m[u]=o[p][x],d.push(u)}for(let x=0;x<d.length;x++){u=d[x];let b=m[u];for(let C in b){let T=b[C];if(y===1||y===0){let A=r[C],O=Kh[A],P=_r(y,O,A),V=Q.MACSTRING(T,P);if(y===0&&(A=e.indexOf(C),A<0&&(A=e.length,e.push(C)),O=4,V=Q.UTF16(T)),V!==void 0){let B=oo(V,c);l.push(io(y,O,A,u,V.length,B))}}if(y===3){let A=a[C];if(A!==void 0){let O=Q.UTF16(T),P=oo(O,c);l.push(io(3,1,A,u,O.length,P))}}}}}l.sort(function(p,u){return p.platformID-u.platformID||p.encodingID-u.encodingID||p.languageID-u.languageID||p.nameID-u.nameID});let h=new X.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:l.length},{name:"stringOffset",type:"USHORT",value:6+l.length*12}]);for(let p=0;p<l.length;p++)h.fields.push({name:"record_"+p,type:"RECORD",value:l[p]});return h.fields.push({name:"strings",type:"LITERAL",value:c}),h}let Rr={parse:e0,make:s0},Dn=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function n0(o){for(let e=0;e<Dn.length;e+=1){let i=Dn[e];if(o>=i.begin&&o<i.end)return e}return-1}function i0(o,e){let i={},r=new te.Parser(o,e);i.version=r.parseUShort(),i.xAvgCharWidth=r.parseShort(),i.usWeightClass=r.parseUShort(),i.usWidthClass=r.parseUShort(),i.fsType=r.parseUShort(),i.ySubscriptXSize=r.parseShort(),i.ySubscriptYSize=r.parseShort(),i.ySubscriptXOffset=r.parseShort(),i.ySubscriptYOffset=r.parseShort(),i.ySuperscriptXSize=r.parseShort(),i.ySuperscriptYSize=r.parseShort(),i.ySuperscriptXOffset=r.parseShort(),i.ySuperscriptYOffset=r.parseShort(),i.yStrikeoutSize=r.parseShort(),i.yStrikeoutPosition=r.parseShort(),i.sFamilyClass=r.parseShort(),i.panose=[];for(let a=0;a<10;a++)i.panose[a]=r.parseByte();return i.ulUnicodeRange1=r.parseULong(),i.ulUnicodeRange2=r.parseULong(),i.ulUnicodeRange3=r.parseULong(),i.ulUnicodeRange4=r.parseULong(),i.achVendID=String.fromCharCode(r.parseByte(),r.parseByte(),r.parseByte(),r.parseByte()),i.fsSelection=r.parseUShort(),i.usFirstCharIndex=r.parseUShort(),i.usLastCharIndex=r.parseUShort(),i.sTypoAscender=r.parseShort(),i.sTypoDescender=r.parseShort(),i.sTypoLineGap=r.parseShort(),i.usWinAscent=r.parseUShort(),i.usWinDescent=r.parseUShort(),i.version>=1&&(i.ulCodePageRange1=r.parseULong(),i.ulCodePageRange2=r.parseULong()),i.version>=2&&(i.sxHeight=r.parseShort(),i.sCapHeight=r.parseShort(),i.usDefaultChar=r.parseUShort(),i.usBreakChar=r.parseUShort(),i.usMaxContent=r.parseUShort()),i}function o0(o){return new X.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],o)}let Nn={parse:i0,make:o0,unicodeRanges:Dn,getUnicodeRange:n0};function r0(o,e){let i={},r=new te.Parser(o,e);switch(i.version=r.parseVersion(),i.italicAngle=r.parseFixed(),i.underlinePosition=r.parseShort(),i.underlineThickness=r.parseShort(),i.isFixedPitch=r.parseULong(),i.minMemType42=r.parseULong(),i.maxMemType42=r.parseULong(),i.minMemType1=r.parseULong(),i.maxMemType1=r.parseULong(),i.version){case 1:i.names=Vt.slice();break;case 2:i.numberOfGlyphs=r.parseUShort(),i.glyphNameIndex=new Array(i.numberOfGlyphs);for(let a=0;a<i.numberOfGlyphs;a++)i.glyphNameIndex[a]=r.parseUShort();i.names=[];for(let a=0;a<i.numberOfGlyphs;a++)if(i.glyphNameIndex[a]>=Vt.length){let l=r.parseChar();i.names.push(r.parseString(l))}break;case 2.5:i.numberOfGlyphs=r.parseUShort(),i.offset=new Array(i.numberOfGlyphs);for(let a=0;a<i.numberOfGlyphs;a++)i.offset[a]=r.parseChar();break}return i}function a0(o){let{italicAngle:e=0,underlinePosition:i=0,underlineThickness:r=0,isFixedPitch:a=0,minMemType42:l=0,maxMemType42:c=0,minMemType1:h=0,maxMemType1:p=0}=o||{};return new X.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:e},{name:"underlinePosition",type:"FWORD",value:i},{name:"underlineThickness",type:"FWORD",value:r},{name:"isFixedPitch",type:"ULONG",value:a},{name:"minMemType42",type:"ULONG",value:l},{name:"maxMemType42",type:"ULONG",value:c},{name:"minMemType1",type:"ULONG",value:h},{name:"maxMemType1",type:"ULONG",value:p}])}let Or={parse:r0,make:a0},st=new Array(9);st[1]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:1,coverage:this.parsePointer(N.coverage),deltaGlyphId:this.parseShort()};if(e===2)return{substFormat:2,coverage:this.parsePointer(N.coverage),substitute:this.parseOffset16List()};ne.assert(!1,"0x"+o.toString(16)+": lookup type 1 format must be 1 or 2.")};st[2]=function(){let o=this.parseUShort();return ne.argument(o===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:o,coverage:this.parsePointer(N.coverage),sequences:this.parseListOfLists()}};st[3]=function(){let o=this.parseUShort();return ne.argument(o===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:o,coverage:this.parsePointer(N.coverage),alternateSets:this.parseListOfLists()}};st[4]=function(){let o=this.parseUShort();return ne.argument(o===1,"GSUB ligature table identifier-format must be 1"),{substFormat:o,coverage:this.parsePointer(N.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};let qt={sequenceIndex:N.uShort,lookupListIndex:N.uShort};st[5]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:e,coverage:this.parsePointer(N.coverage),ruleSets:this.parseListOfLists(function(){let i=this.parseUShort(),r=this.parseUShort();return{input:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(r,qt)}})};if(e===2)return{substFormat:e,coverage:this.parsePointer(N.coverage),classDef:this.parsePointer(N.classDef),classSets:this.parseListOfLists(function(){let i=this.parseUShort(),r=this.parseUShort();return{classes:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(r,qt)}})};if(e===3){let i=this.parseUShort(),r=this.parseUShort();return{substFormat:e,coverages:this.parseList(i,N.pointer(N.coverage)),lookupRecords:this.parseRecordList(r,qt)}}ne.assert(!1,"0x"+o.toString(16)+": lookup type 5 format must be 1, 2 or 3.")};st[6]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:1,coverage:this.parsePointer(N.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(qt)}})};if(e===2)return{substFormat:2,coverage:this.parsePointer(N.coverage),backtrackClassDef:this.parsePointer(N.classDef),inputClassDef:this.parsePointer(N.classDef),lookaheadClassDef:this.parsePointer(N.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(qt)}})};if(e===3)return{substFormat:3,backtrackCoverage:this.parseList(N.pointer(N.coverage)),inputCoverage:this.parseList(N.pointer(N.coverage)),lookaheadCoverage:this.parseList(N.pointer(N.coverage)),lookupRecords:this.parseRecordList(qt)};ne.assert(!1,"0x"+o.toString(16)+": lookup type 6 format must be 1, 2 or 3.")};st[7]=function(){let o=this.parseUShort();ne.argument(o===1,"GSUB Extension Substitution subtable identifier-format must be 1");let e=this.parseUShort(),i=new N(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:e,extension:st[e].call(i)}};st[8]=function(){let o=this.parseUShort();return ne.argument(o===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:o,coverage:this.parsePointer(N.coverage),backtrackCoverage:this.parseList(N.pointer(N.coverage)),lookaheadCoverage:this.parseList(N.pointer(N.coverage)),substitutes:this.parseUShortList()}};function l0(o,e){e=e||0;let i=new N(o,e),r=i.parseVersion(1);return ne.argument(r===1||r===1.1,"Unsupported GSUB table version."),r===1?{version:r,scripts:i.parseScriptList(),features:i.parseFeatureList(),lookups:i.parseLookupList(st)}:{version:r,scripts:i.parseScriptList(),features:i.parseFeatureList(),lookups:i.parseLookupList(st),variations:i.parseFeatureVariationsList()}}let jt=new Array(9);jt[1]=function(o){if(o.substFormat===1)return new X.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new X.Coverage(o.coverage)},{name:"deltaGlyphID",type:"SHORT",value:o.deltaGlyphId}]);if(o.substFormat===2)return new X.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new X.Coverage(o.coverage)}].concat(X.ushortList("substitute",o.substitute)));ne.fail("Lookup type 1 substFormat must be 1 or 2.")};jt[2]=function(o){return ne.assert(o.substFormat===1,"Lookup type 2 substFormat must be 1."),new X.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new X.Coverage(o.coverage)}].concat(X.tableList("seqSet",o.sequences,function(e){return new X.Table("sequenceSetTable",X.ushortList("sequence",e))})))};jt[3]=function(o){return ne.assert(o.substFormat===1,"Lookup type 3 substFormat must be 1."),new X.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new X.Coverage(o.coverage)}].concat(X.tableList("altSet",o.alternateSets,function(e){return new X.Table("alternateSetTable",X.ushortList("alternate",e))})))};jt[4]=function(o){return ne.assert(o.substFormat===1,"Lookup type 4 substFormat must be 1."),new X.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new X.Coverage(o.coverage)}].concat(X.tableList("ligSet",o.ligatureSets,function(e){return new X.Table("ligatureSetTable",X.tableList("ligature",e,function(i){return new X.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:i.ligGlyph}].concat(X.ushortList("component",i.components,i.components.length+1)))}))})))};jt[5]=function(o){if(o.substFormat===1)return new X.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:o.substFormat},{name:"coverage",type:"TABLE",value:new X.Coverage(o.coverage)}].concat(X.tableList("sequenceRuleSet",o.ruleSets,function(e){return e?new X.Table("sequenceRuleSetTable",X.tableList("sequenceRule",e,function(i){let r=X.ushortList("seqLookup",[],i.lookupRecords.length).concat(X.ushortList("inputSequence",i.input,i.input.length+1));[r[0],r[1]]=[r[1],r[0]];for(let a=0;a<i.lookupRecords.length;a++){let l=i.lookupRecords[a];r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:l.lookupListIndex})}return new X.Table("sequenceRuleTable",r)})):new X.Table("NULL",null)})));if(o.substFormat===2)return new X.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:o.substFormat},{name:"coverage",type:"TABLE",value:new X.Coverage(o.coverage)},{name:"classDef",type:"TABLE",value:new X.ClassDef(o.classDef)}].concat(X.tableList("classSeqRuleSet",o.classSets,function(e){return e?new X.Table("classSeqRuleSetTable",X.tableList("classSeqRule",e,function(i){let r=X.ushortList("classes",i.classes,i.classes.length+1).concat(X.ushortList("seqLookupCount",[],i.lookupRecords.length));for(let a=0;a<i.lookupRecords.length;a++){let l=i.lookupRecords[a];r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:l.lookupListIndex})}return new X.Table("classSeqRuleTable",r)})):new X.Table("NULL",null)})));if(o.substFormat===3){let e=[{name:"substFormat",type:"USHORT",value:o.substFormat}];e.push({name:"inputGlyphCount",type:"USHORT",value:o.coverages.length}),e.push({name:"substitutionCount",type:"USHORT",value:o.lookupRecords.length});for(let i=0;i<o.coverages.length;i++){let r=o.coverages[i];e.push({name:"inputCoverage"+i,type:"TABLE",value:new X.Coverage(r)})}for(let i=0;i<o.lookupRecords.length;i++){let r=o.lookupRecords[i];e=e.concat({name:"sequenceIndex"+i,type:"USHORT",value:r.sequenceIndex}).concat({name:"lookupListIndex"+i,type:"USHORT",value:r.lookupListIndex})}return new X.Table("contextualSubstitutionTable",e)}ne.assert(!1,"lookup type 5 format must be 1, 2 or 3.")};jt[6]=function(o){if(o.substFormat===1)return new X.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:o.substFormat},{name:"coverage",type:"TABLE",value:new X.Coverage(o.coverage)}].concat(X.tableList("chainRuleSet",o.chainRuleSets,function(e){return new X.Table("chainRuleSetTable",X.tableList("chainRule",e,function(i){let r=X.ushortList("backtrackGlyph",i.backtrack,i.backtrack.length).concat(X.ushortList("inputGlyph",i.input,i.input.length+1)).concat(X.ushortList("lookaheadGlyph",i.lookahead,i.lookahead.length)).concat(X.ushortList("substitution",[],i.lookupRecords.length));for(let a=0;a<i.lookupRecords.length;a++){let l=i.lookupRecords[a];r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:l.lookupListIndex})}return new X.Table("chainRuleTable",r)}))})));if(o.substFormat===2)ne.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(o.substFormat===3){let e=[{name:"substFormat",type:"USHORT",value:o.substFormat}];e.push({name:"backtrackGlyphCount",type:"USHORT",value:o.backtrackCoverage.length});for(let i=0;i<o.backtrackCoverage.length;i++){let r=o.backtrackCoverage[i];e.push({name:"backtrackCoverage"+i,type:"TABLE",value:new X.Coverage(r)})}e.push({name:"inputGlyphCount",type:"USHORT",value:o.inputCoverage.length});for(let i=0;i<o.inputCoverage.length;i++){let r=o.inputCoverage[i];e.push({name:"inputCoverage"+i,type:"TABLE",value:new X.Coverage(r)})}e.push({name:"lookaheadGlyphCount",type:"USHORT",value:o.lookaheadCoverage.length});for(let i=0;i<o.lookaheadCoverage.length;i++){let r=o.lookaheadCoverage[i];e.push({name:"lookaheadCoverage"+i,type:"TABLE",value:new X.Coverage(r)})}e.push({name:"substitutionCount",type:"USHORT",value:o.lookupRecords.length});for(let i=0;i<o.lookupRecords.length;i++){let r=o.lookupRecords[i];e=e.concat({name:"sequenceIndex"+i,type:"USHORT",value:r.sequenceIndex}).concat({name:"lookupListIndex"+i,type:"USHORT",value:r.lookupListIndex})}return new X.Table("chainContextTable",e)}ne.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function c0(o){return new X.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new X.ScriptList(o.scripts)},{name:"features",type:"TABLE",value:new X.FeatureList(o.features)},{name:"lookups",type:"TABLE",value:new X.LookupList(o.lookups,jt)}])}let Dr={parse:l0,make:c0};function h0(o,e){let i=new te.Parser(o,e),r=i.parseULong();ne.argument(r===1,"Unsupported META table version."),i.parseULong(),i.parseULong();let a=i.parseULong(),l={};for(let c=0;c<a;c++){let h=i.parseTag(),p=i.parseULong(),u=i.parseULong();if(h==="appl"||h==="bild")continue;let d=Jt.UTF8(o,e+p,u);l[h]=d}return l}function u0(o){let e=Object.keys(o).length,i="",r=16+e*12,a=new X.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:r},{name:"numTags",type:"ULONG",value:e}]);for(let l in o){let c=i.length;i+=o[l],a.fields.push({name:"tag "+l,type:"TAG",value:l}),a.fields.push({name:"offset "+l,type:"ULONG",value:r+c}),a.fields.push({name:"length "+l,type:"ULONG",value:o[l].length})}return a.fields.push({name:"stringPool",type:"CHARARRAY",value:i}),a}let Nr={parse:h0,make:u0};function p0(o,e){let i=new N(o,e),r=i.parseUShort();ne.argument(r===0,"Only COLRv0 supported.");let a=i.parseUShort(),l=i.parseOffset32(),c=i.parseOffset32(),h=i.parseUShort();i.relativeOffset=l;let p=i.parseRecordList(a,{glyphID:N.uShort,firstLayerIndex:N.uShort,numLayers:N.uShort});i.relativeOffset=c;let u=i.parseRecordList(h,{glyphID:N.uShort,paletteIndex:N.uShort});return{version:r,baseGlyphRecords:p,layerRecords:u}}function d0({version:o=0,baseGlyphRecords:e=[],layerRecords:i=[]}){ne.argument(o===0,"Only COLRv0 supported.");let r=14,a=r+e.length*6;return new X.Table("COLR",[{name:"version",type:"USHORT",value:o},{name:"numBaseGlyphRecords",type:"USHORT",value:e.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:r},{name:"layerRecordsOffset",type:"ULONG",value:a},{name:"numLayerRecords",type:"USHORT",value:i.length},...e.map((l,c)=>[{name:"glyphID_"+c,type:"USHORT",value:l.glyphID},{name:"firstLayerIndex_"+c,type:"USHORT",value:l.firstLayerIndex},{name:"numLayers_"+c,type:"USHORT",value:l.numLayers}]).flat(),...i.map((l,c)=>[{name:"LayerGlyphID_"+c,type:"USHORT",value:l.glyphID},{name:"paletteIndex_"+c,type:"USHORT",value:l.paletteIndex}]).flat()])}let Pr={parse:p0,make:d0};function f0(o,e){let i=new N(o,e),r=i.parseShort(),a=i.parseShort(),l=i.parseShort(),c=i.parseShort(),h=i.parseOffset32(),p=i.parseUShortList(l);i.relativeOffset=h;let u=i.parseULongList(c);return{version:r,numPaletteEntries:a,colorRecords:u,colorRecordIndices:p}}function m0({version:o=0,numPaletteEntries:e=0,colorRecords:i=[],colorRecordIndices:r=[0]}){return ne.argument(o===0,"Only CPALv0 are supported."),ne.argument(i.length,"No colorRecords given."),ne.argument(r.length,"No colorRecordIndices given."),r.length>1&&ne.argument(e,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new X.Table("CPAL",[{name:"version",type:"USHORT",value:o},{name:"numPaletteEntries",type:"USHORT",value:e||i.length},{name:"numPalettes",type:"USHORT",value:r.length},{name:"numColorRecords",type:"USHORT",value:i.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*r.length},...r.map((a,l)=>({name:"colorRecordIndices_"+l,type:"USHORT",value:a})),...i.map((a,l)=>({name:"colorRecords_"+l,type:"ULONG",value:a}))])}let Vr={parse:f0,make:m0};function g0(){return typeof window<"u"}function ls(o,e){if(!o)throw e}function Pn(o,e){let i=o.length;if(i!==e.length)return!1;for(let r=0;r<i;r++)if(o[r]!==e[r])return!1;return!0}function y0(o,e){let i=Object.values(o),r=Object.values(e),a=Object.values(o),l=Object.values(e);return Pn(i,r)&&Pn(a,l)}function Fr(o,e){let i=256;for(let r in e){for(let a in e[r]){let l=parseInt(a);if(!(!l||l<256)){if(y0(e[r][a],o))return l;i<=l&&(i=l+1)}}e[r][i]=o}return i}function v0(o,e,i){let r=Fr(e.name,i);return[{name:"tag_"+o,type:"TAG",value:e.tag},{name:"minValue_"+o,type:"FIXED",value:e.minValue<<16},{name:"defaultValue_"+o,type:"FIXED",value:e.defaultValue<<16},{name:"maxValue_"+o,type:"FIXED",value:e.maxValue<<16},{name:"flags_"+o,type:"USHORT",value:0},{name:"nameID_"+o,type:"USHORT",value:r}]}function b0(o,e,i){let r={},a=new te.Parser(o,e);return r.tag=a.parseTag(),r.minValue=a.parseFixed(),r.defaultValue=a.parseFixed(),r.maxValue=a.parseFixed(),a.skip("uShort",1),r.name=(i.macintosh||i.windows||i.unicode)[a.parseUShort()]||{},r}function x0(o,e,i,r){let a=Fr(e.name,r),l=[{name:"nameID_"+o,type:"USHORT",value:a},{name:"flags_"+o,type:"USHORT",value:0}];for(let c=0;c<i.length;++c){let h=i[c].tag;l.push({name:"axis_"+o+" "+h,type:"FIXED",value:e.coordinates[h]<<16})}return l}function C0(o,e,i,r){let a={},l=new te.Parser(o,e);a.name=(r.macintosh||r.windows||r.unicode)[l.parseUShort()]||{},l.skip("uShort",1),a.coordinates={};for(let c=0;c<i.length;++c)a.coordinates[i[c].tag]=l.parseFixed();return a}function w0(o,e){let i=new X.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:o.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:o.instances.length},{name:"instanceSize",type:"USHORT",value:4+o.axes.length*4}]);i.offsetToData=i.sizeOf();for(let r=0;r<o.axes.length;r++)i.fields=i.fields.concat(v0(r,o.axes[r],e));for(let r=0;r<o.instances.length;r++)i.fields=i.fields.concat(x0(r,o.instances[r],o.axes,e));return i}function E0(o,e,i){let r=new te.Parser(o,e),a=r.parseULong();ne.argument(a===65536,"Unsupported fvar table version.");let l=r.parseOffset16();r.skip("uShort",1);let c=r.parseUShort(),h=r.parseUShort(),p=r.parseUShort(),u=r.parseUShort(),d=[];for(let y=0;y<c;y++)d.push(b0(o,e+l+y*h,i));let m=[],v=e+l+c*h;for(let y=0;y<p;y++)m.push(C0(o,v+y*u,d,i));return{axes:d,instances:m}}let Ur={make:w0,parse:E0},S0={tag:N.tag,nameID:N.uShort,ordering:N.uShort},ws=new Array(5);ws[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}};ws[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}};ws[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}};ws[4]=function(){let o=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(o,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function T0(){let o=this.parseUShort(),e=ws[o],i={format:o};return e===void 0?(console.warn(`Unknown axis value table format ${o}`),i):Object.assign(i,this.parseStruct(e.bind(this)))}function L0(o,e,i){e||(e=0);let r=new te.Parser(o,e),a=r.parseUShort(),l=r.parseUShort();a!==1&&console.warn(`Unsupported STAT table version ${a}.${l}`);let c=[a,l],h=r.parseUShort(),p=r.parseUShort(),u=r.parseOffset32(),d=r.parseUShort(),m=r.parseOffset32(),v=a>1||l>0?r.parseUShort():void 0;i!==void 0&&ne.argument(p>=i.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),d>0&&ne.argument(p>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let y=[];for(let C=0;C<p;C++)r.offset=e+u,r.relativeOffset=C*h,y.push(r.parseStruct(S0));r.offset=e,r.relativeOffset=m;let x=r.parseUShortList(d),b=[];for(let C=0;C<d;C++)r.offset=e+m,r.relativeOffset=x[C],b.push(T0.apply(r));return{version:c,axes:y,values:b,elidedFallbackNameID:v}}let Es=new Array(5);Es[1]=function(o,e){return[{name:`format${o}`,type:"USHORT",value:1},{name:`axisIndex${o}`,type:"USHORT",value:e.axisIndex},{name:`flags${o}`,type:"USHORT",value:e.flags},{name:`valueNameID${o}`,type:"USHORT",value:e.valueNameID},{name:`value${o}`,type:"FLOAT",value:e.value}]};Es[2]=function(o,e){return[{name:`format${o}`,type:"USHORT",value:2},{name:`axisIndex${o}`,type:"USHORT",value:e.axisIndex},{name:`flags${o}`,type:"USHORT",value:e.flags},{name:`valueNameID${o}`,type:"USHORT",value:e.valueNameID},{name:`nominalValue${o}`,type:"FLOAT",value:e.nominalValue},{name:`rangeMinValue${o}`,type:"FLOAT",value:e.rangeMinValue},{name:`rangeMaxValue${o}`,type:"FLOAT",value:e.rangeMaxValue}]};Es[3]=function(o,e){return[{name:`format${o}`,type:"USHORT",value:3},{name:`axisIndex${o}`,type:"USHORT",value:e.axisIndex},{name:`flags${o}`,type:"USHORT",value:e.flags},{name:`valueNameID${o}`,type:"USHORT",value:e.valueNameID},{name:`value${o}`,type:"FLOAT",value:e.value},{name:`linkedValue${o}`,type:"FLOAT",value:e.linkedValue}]};Es[4]=function(o,e){let i=[{name:`format${o}`,type:"USHORT",value:4},{name:`axisCount${o}`,type:"USHORT",value:e.axisValues.length},{name:`flags${o}`,type:"USHORT",value:e.flags},{name:`valueNameID${o}`,type:"USHORT",value:e.valueNameID}];for(let r=0;r<e.axisValues.length;r++)i=i.concat([{name:`format${o}axisIndex${r}`,type:"USHORT",value:e.axisValues[r].axisIndex},{name:`format${o}value${r}`,type:"FLOAT",value:e.axisValues[r].value}]);return i};function k0(o,e){return new X.Record("axisRecord_"+o,[{name:"axisTag_"+o,type:"TAG",value:e.tag},{name:"axisNameID_"+o,type:"USHORT",value:e.nameID},{name:"axisOrdering_"+o,type:"USHORT",value:e.ordering}])}function M0(o,e){let i=e.format,r=Es[i];ne.argument(r!==void 0,`Unknown axis value table format ${i}`);let a=r(o,e);return new X.Table("axisValueTable_"+o,a)}function I0(o){let e=new X.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:o.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:o.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:o.elidedFallbackNameID}]);e.designAxesOffset=e.offsetToAxisValueOffsets=e.sizeOf();for(let l=0;l<o.axes.length;l++){let c=k0(l,o.axes[l]);e.offsetToAxisValueOffsets+=c.sizeOf(),e.fields=e.fields.concat(c.fields)}let i=[],r=[],a=o.values.length*2;for(let l=0;l<o.values.length;l++){let c=M0(l,o.values[l]);i.push({name:"offset_"+l,type:"USHORT",value:a}),a+=c.sizeOf(),r=r.concat(c.fields)}return e.fields=e.fields.concat(i),e.fields=e.fields.concat(r),e}let Gr={make:I0,parse:L0};function A0(o,e){return new X.Record("axisValueMap_"+o,[{name:"fromCoordinate_"+o,type:"F2DOT14",value:e.fromCoordinate},{name:"toCoordinate_"+o,type:"F2DOT14",value:e.toCoordinate}])}function _0(o,e){let i=new X.Record("segmentMap_"+o,[{name:"positionMapCount_"+o,type:"USHORT",value:e.axisValueMaps.length}]),r=[];for(let a=0;a<e.axisValueMaps.length;a++){let l=A0(`${o}_${a}`,e.axisValueMaps[a]);r=r.concat(l.fields)}return i.fields=i.fields.concat(r),i}function B0(o,e){ne.argument(o.axisSegmentMaps.length===e.axes.length,"avar axis count must correspond to fvar axis count");let i=new X.Table("avar",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:0},{name:"reserved",type:"USHORT",value:0},{name:"axisCount",type:"USHORT",value:o.axisSegmentMaps.length}]);for(let r=0;r<o.axisSegmentMaps.length;r++){let a=_0(r,o.axisSegmentMaps[r]);i.fields=i.fields.concat(a.fields)}return i}function R0(o,e,i){e||(e=0);let r=new N(o,e),a=r.parseUShort(),l=r.parseUShort();a!==1&&console.warn(`Unsupported avar table version ${a}.${l}`),r.skip("uShort",1);let c=r.parseUShort();ne.argument(c===i.axes.length,"avar axis count must correspond to fvar axis count");let h=[];for(let p=0;p<c;p++){let u=[],d=r.parseUShort();for(let m=0;m<d;m++){let v=r.parseF2Dot14(),y=r.parseF2Dot14();u.push({fromCoordinate:v,toCoordinate:y})}h.push({axisValueMaps:u})}return{version:[a,l],axisSegmentMaps:h}}let zr={make:B0,parse:R0};function O0(o,e){let i={},r=new te.Parser(o,e);i.version=r.parseUShort(),ne.argument(i.version<=1,"Unsupported gasp table version."),i.numRanges=r.parseUShort(),i.gaspRanges=[];for(let a=0;a<i.numRanges;a++)i.gaspRanges[a]={rangeMaxPPEM:r.parseUShort(),rangeGaspBehavior:r.parseUShort()};return i}function D0(o){let e=new X.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:o.numRanges}]);for(let i in o.numRanges)e.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:o.numRanges[i].rangeMaxPPEM}),e.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:o.numRanges[i].rangeGaspBehavior});return e}let Hr={parse:O0,make:D0};function ro(o){return Math.log(o)/Math.log(2)|0}function yi(o){for(;o.length%4!==0;)o.push(0);let e=0;for(let i=0;i<o.length;i+=4)e+=(o[i]<<24)+(o[i+1]<<16)+(o[i+2]<<8)+o[i+3];return e%=Math.pow(2,32),e}function ao(o,e,i,r){return new X.Record("Table Record",[{name:"tag",type:"TAG",value:o!==void 0?o:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:i!==void 0?i:0},{name:"length",type:"ULONG",value:r!==void 0?r:0}])}function jr(o){let e=new X.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=o,e.numTables=o.length;let i=Math.pow(2,ro(e.numTables));e.searchRange=16*i,e.entrySelector=ro(i),e.rangeShift=e.numTables*16-e.searchRange;let r=[],a=[],l=e.sizeOf()+ao().sizeOf()*e.numTables;for(;l%4!==0;)l+=1,a.push({name:"padding",type:"BYTE",value:0});for(let c=0;c<o.length;c+=1){let h=o[c];ne.argument(h.tableName.length===4,"Table name"+h.tableName+" is invalid.");let p=h.sizeOf(),u=ao(h.tableName,yi(h.encode()),l,p);for(r.push({name:u.tag+" Table Record",type:"RECORD",value:u}),a.push({name:h.tableName+" table",type:"RECORD",value:h}),l+=p,ne.argument(!isNaN(l),"Something went wrong calculating the offset.");l%4!==0;)l+=1,a.push({name:"padding",type:"BYTE",value:0})}return r.sort(function(c,h){return c.value.tag>h.value.tag?1:-1}),e.fields=e.fields.concat(r),e.fields=e.fields.concat(a),e}function lo(o,e,i){for(let r=0;r<e.length;r+=1){let a=o.charToGlyphIndex(e[r]);if(a>0)return o.glyphs.get(a).getMetrics()}return i}function N0(o){let e=0;for(let i=0;i<o.length;i+=1)e+=o[i];return e/o.length}function P0(o){let e=[],i=[],r=[],a=[],l=[],c=[],h=[],p,u=0,d=0,m=0,v=0,y=0;for(let S=0;S<o.glyphs.length;S+=1){let k=o.glyphs.get(S),D=k.unicode|0;if(isNaN(k.advanceWidth))throw new Error("Glyph "+k.name+" ("+S+"): advanceWidth is not a number.");(p>D||p===void 0)&&D>0&&(p=D),u<D&&(u=D);let R=Nn.getUnicodeRange(D);if(R<32)d|=1<<R;else if(R<64)m|=1<<R-32;else if(R<96)v|=1<<R-64;else if(R<123)y|=1<<R-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(k.name===".notdef")continue;let _=k.getMetrics();e.push(_.xMin),i.push(_.yMin),r.push(_.xMax),a.push(_.yMax),c.push(_.leftSideBearing),h.push(_.rightSideBearing),l.push(k.advanceWidth)}let x={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,i),xMax:Math.max.apply(null,r),yMax:Math.max.apply(null,a),advanceWidthMax:Math.max.apply(null,l),advanceWidthAvg:N0(l),minLeftSideBearing:Math.min.apply(null,c),maxLeftSideBearing:Math.max.apply(null,c),minRightSideBearing:Math.min.apply(null,h)};x.ascender=o.ascender,x.descender=o.descender;let b=Er.make({flags:3,unitsPerEm:o.unitsPerEm,xMin:x.xMin,yMin:x.yMin,xMax:x.xMax,yMax:x.yMax,lowestRecPPEM:3,createdTimestamp:o.createdTimestamp}),C=Sr.make({ascender:x.ascender,descender:x.descender,advanceWidthMax:x.advanceWidthMax,minLeftSideBearing:x.minLeftSideBearing,minRightSideBearing:x.minRightSideBearing,xMaxExtent:x.maxLeftSideBearing+(x.xMax-x.xMin),numberOfHMetrics:o.glyphs.length}),T=kr.make(o.glyphs.length),A=Nn.make(Object.assign({xAvgCharWidth:Math.round(x.advanceWidthAvg),usFirstCharIndex:p,usLastCharIndex:u,ulUnicodeRange1:d,ulUnicodeRange2:m,ulUnicodeRange3:v,ulUnicodeRange4:y,sTypoAscender:x.ascender,sTypoDescender:x.descender,sTypoLineGap:0,usWinAscent:x.yMax,usWinDescent:Math.abs(x.yMin),ulCodePageRange1:1,sxHeight:lo(o,"xyvw",{yMax:Math.round(x.ascender/2)}).yMax,sCapHeight:lo(o,"HIKLEFJMNTZBDPRAGOQSUVWXY",x).yMax,usDefaultChar:o.hasChar(" ")?32:0,usBreakChar:o.hasChar(" ")?32:0},o.tables.os2)),O=Tr.make(o.glyphs),P=dr.make(o.glyphs),V=o.getEnglishName("fontFamily"),B=o.getEnglishName("fontSubfamily"),I=V+" "+B,G=o.getEnglishName("postScriptName");G||(G=V.replace(/\s/g,"")+"-"+B);let W={};for(let S in o.names)W[S]=o.names[S];W.unicode=W.unicode||{},W.macintosh=W.macintosh||{},W.windows=W.windows||{};let j=o.names.unicode||{},H=o.names.macintosh||{},ee=o.names.windows||{};for(let S in["unicode","macintosh","windows"])W[S]=W[S]||{},W[S].uniqueID||(W.unicode.uniqueID={en:o.getEnglishName("manufacturer")+":"+I}),W[S].postScriptName||(W.unicode.postScriptName={en:G});W.unicode.preferredFamily||(W.unicode.preferredFamily=j.fontFamily||H.fontFamily||ee.fontFamily),W.macintosh.preferredFamily||(W.macintosh.preferredFamily=H.fontFamily||j.fontFamily||ee.fontFamily),W.windows.preferredFamily||(W.windows.preferredFamily=ee.fontFamily||j.fontFamily||H.fontFamily),W.unicode.preferredSubfamily||(W.unicode.preferredSubfamily=j.fontSubFamily||H.fontSubFamily||ee.fontSubFamily),W.macintosh.preferredSubfamily||(W.macintosh.preferredSubfamily=H.fontSubFamily||j.fontSubFamily||ee.fontSubFamily),W.windows.preferredSubfamily||(W.windows.preferredSubfamily=ee.fontSubFamily||j.fontSubFamily||H.fontSubFamily);let $=o.tables.fvar?Ur.make(o.tables.fvar,o.names):void 0,de=o.tables.gasp?Hr.make(o.tables.gasp):void 0,ie=[],me=Rr.make(W,ie),re=ie.length>0?Lr.make(ie):void 0,be=Or.make(o.tables.post),Z=Rn.make(o.glyphs,{version:o.getEnglishName("version"),fullName:I,familyName:V,weightName:B,postScriptName:G,unitsPerEm:o.unitsPerEm,fontBBox:[0,x.yMin,x.ascender,x.advanceWidthMax]}),K=o.metas&&Object.keys(o.metas).length>0?Nr.make(o.metas):void 0,J=[b,C,T,A,me,P,be,Z,O];re&&J.push(re);let Y={gsub:Dr,cpal:Vr,colr:Pr,stat:Gr,avar:zr},ce={avar:[o.tables.fvar]};$&&J.push($);for(let S in Y){let k=o.tables[S];k&&J.push(Y[S].make.call(o,k,...ce[S]||[]))}K&&J.push(K),de&&J.push(de);let he=jr(J),xe=he.encode(),w=yi(xe),E=he.fields,M=!1;for(let S=0;S<E.length;S+=1)if(E[S].name==="head table"){E[S].value.checkSumAdjustment=2981146554-w,M=!0;break}if(!M)throw new Error("Could not find head table with checkSum to adjust.");return he}let V0={make:jr,fontToTable:P0,computeCheckSum:yi};function bn(o,e){let i=0,r=o.length-1;for(;i<=r;){let a=i+r>>>1,l=o[a].tag;if(l===e)return a;l<e?i=a+1:r=a-1}return-i-1}function co(o,e){let i=0,r=o.length-1;for(;i<=r;){let a=i+r>>>1,l=o[a];if(l===e)return a;l<e?i=a+1:r=a-1}return-i-1}function ho(o,e){let i,r=0,a=o.length-1;for(;r<=a;){let l=r+a>>>1;i=o[l];let c=i.start;if(c===e)return i;c<e?r=l+1:a=l-1}if(r>0)return i=o[r-1],e>i.end?0:i}function Wr(o,e){this.font=o,this.tableName=e}Wr.prototype={searchTag:bn,binSearch:co,getTable:function(o){let e=this.font.tables[this.tableName];return!e&&o&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){let o=this.getTable();return o?o.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){let o=this.getTable();if(!o)return;let e=!1;for(let i=0;i<o.scripts.length;i++){let r=o.scripts[i].tag;if(r==="DFLT")return r;r==="latn"&&(e=!0)}if(e)return"latn"},getScriptTable:function(o,e){let i=this.getTable(e);if(i){o=o||"DFLT";let r=i.scripts,a=bn(i.scripts,o);if(a>=0)return r[a].script;if(e){let l={tag:o,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return r.splice(-1-a,0,l),l.script}}},getLangSysTable:function(o,e,i){let r=this.getScriptTable(o,i);if(r){if(!e||e==="dflt"||e==="DFLT")return r.defaultLangSys;let a=bn(r.langSysRecords,e);if(a>=0)return r.langSysRecords[a].langSys;if(i){let l={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return r.langSysRecords.splice(-1-a,0,l),l.langSys}}},getFeatureTable:function(o,e,i,r){let a=this.getLangSysTable(o,e,r);if(a){let l,c=a.featureIndexes,h=this.font.tables[this.tableName].features;for(let p=0;p<c.length;p++)if(l=h[c[p]],l.tag===i)return l.feature;if(r){let p=h.length;return ne.assert(p===0||i>=h[p-1].tag,"Features must be added in alphabetical order."),l={tag:i,feature:{params:0,lookupListIndexes:[]}},h.push(l),c.push(p),l.feature}}},getLookupTables:function(o,e,i,r,a){let l=this.getFeatureTable(o,e,i,a),c=[];if(l){let h,p=l.lookupListIndexes,u=this.font.tables[this.tableName].lookups;for(let d=0;d<p.length;d++)h=u[p[d]],h.lookupType===r&&c.push(h);if(c.length===0&&a){h={lookupType:r,lookupFlag:0,subtables:[],markFilteringSet:void 0};let d=u.length;return u.push(h),p.push(d),[h]}}return c},getGlyphClass:function(o,e){switch(o.format){case 1:return o.startGlyph<=e&&e<o.startGlyph+o.classes.length?o.classes[e-o.startGlyph]:0;case 2:{let i=ho(o.ranges,e);return i?i.classId:0}}},getCoverageIndex:function(o,e){switch(o.format){case 1:{let i=co(o.glyphs,e);return i>=0?i:-1}case 2:{let i=ho(o.ranges,e);return i?i.index+e-i.start:-1}}},expandCoverage:function(o){if(o.format===1)return o.glyphs;{let e=[],i=o.ranges;for(let r=0;r<i.length;r++){let a=i[r],l=a.start,c=a.end;for(let h=l;h<=c;h++)e.push(h)}return e}}};let an=Wr;function Ss(o){an.call(this,o,"gpos")}Ss.prototype=an.prototype;Ss.prototype.init=function(){let o=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(o)};Ss.prototype.getKerningValue=function(o,e,i){for(let r=0;r<o.length;r++){let a=o[r].subtables;for(let l=0;l<a.length;l++){let c=a[l],h=this.getCoverageIndex(c.coverage,e);if(!(h<0))switch(c.posFormat){case 1:{let p=c.pairSets[h];for(let u=0;u<p.length;u++){let d=p[u];if(d.secondGlyph===i)return d.value1&&d.value1.xAdvance||0}break}case 2:{let p=this.getGlyphClass(c.classDef1,e),u=this.getGlyphClass(c.classDef2,i),d=c.classRecords[p][u];return d.value1&&d.value1.xAdvance||0}}}}return 0};Ss.prototype.getKerningTables=function(o,e){if(this.font.tables.gpos)return this.getLookupTables(o,e,"kern",2)};let F0=Ss;function Ke(o){an.call(this,o,"gsub")}function vi(o,e,i){let r=o.subtables;for(let a=0;a<r.length;a++){let l=r[a];if(l.substFormat===e)return l}if(i)return r.push(i),i}Ke.prototype=an.prototype;Ke.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}};Ke.prototype.getSingle=function(o,e,i){let r=[],a=this.getLookupTables(e,i,o,1);for(let l=0;l<a.length;l++){let c=a[l].subtables;for(let h=0;h<c.length;h++){let p=c[h],u=this.expandCoverage(p.coverage),d;if(p.substFormat===1){let m=p.deltaGlyphId;for(d=0;d<u.length;d++){let v=u[d];r.push({sub:v,by:v+m})}}else{let m=p.substitute;for(d=0;d<u.length;d++)r.push({sub:u[d],by:m[d]})}}}return r};Ke.prototype.getMultiple=function(o,e,i){let r=[],a=this.getLookupTables(e,i,o,2);for(let l=0;l<a.length;l++){let c=a[l].subtables;for(let h=0;h<c.length;h++){let p=c[h],u=this.expandCoverage(p.coverage),d;for(d=0;d<u.length;d++){let m=u[d],v=p.sequences[d];r.push({sub:m,by:v})}}}return r};Ke.prototype.getAlternates=function(o,e,i){let r=[],a=this.getLookupTables(e,i,o,3);for(let l=0;l<a.length;l++){let c=a[l].subtables;for(let h=0;h<c.length;h++){let p=c[h],u=this.expandCoverage(p.coverage),d=p.alternateSets;for(let m=0;m<u.length;m++)r.push({sub:u[m],by:d[m]})}}return r};Ke.prototype.getLigatures=function(o,e,i){let r=[],a=this.getLookupTables(e,i,o,4);for(let l=0;l<a.length;l++){let c=a[l].subtables;for(let h=0;h<c.length;h++){let p=c[h],u=this.expandCoverage(p.coverage),d=p.ligatureSets;for(let m=0;m<u.length;m++){let v=u[m],y=d[m];for(let x=0;x<y.length;x++){let b=y[x];r.push({sub:[v].concat(b.components),by:b.ligGlyph})}}}}return r};Ke.prototype.addSingle=function(o,e,i,r){let a=this.getLookupTables(i,r,o,1,!0)[0],l=vi(a,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ne.assert(l.coverage.format===1,"Single: unable to modify coverage table format "+l.coverage.format);let c=e.sub,h=this.binSearch(l.coverage.glyphs,c);h<0&&(h=-1-h,l.coverage.glyphs.splice(h,0,c),l.substitute.splice(h,0,0)),l.substitute[h]=e.by};Ke.prototype.addMultiple=function(o,e,i,r){ne.assert(e.by instanceof Array&&e.by.length>1,'Multiple: "by" must be an array of two or more ids');let a=this.getLookupTables(i,r,o,2,!0)[0],l=vi(a,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});ne.assert(l.coverage.format===1,"Multiple: unable to modify coverage table format "+l.coverage.format);let c=e.sub,h=this.binSearch(l.coverage.glyphs,c);h<0&&(h=-1-h,l.coverage.glyphs.splice(h,0,c),l.sequences.splice(h,0,0)),l.sequences[h]=e.by};Ke.prototype.addAlternate=function(o,e,i,r){let a=this.getLookupTables(i,r,o,3,!0)[0],l=vi(a,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ne.assert(l.coverage.format===1,"Alternate: unable to modify coverage table format "+l.coverage.format);let c=e.sub,h=this.binSearch(l.coverage.glyphs,c);h<0&&(h=-1-h,l.coverage.glyphs.splice(h,0,c),l.alternateSets.splice(h,0,0)),l.alternateSets[h]=e.by};Ke.prototype.addLigature=function(o,e,i,r){let a=this.getLookupTables(i,r,o,4,!0)[0],l=a.subtables[0];l||(l={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},a.subtables[0]=l),ne.assert(l.coverage.format===1,"Ligature: unable to modify coverage table format "+l.coverage.format);let c=e.sub[0],h=e.sub.slice(1),p={ligGlyph:e.by,components:h},u=this.binSearch(l.coverage.glyphs,c);if(u>=0){let d=l.ligatureSets[u];for(let m=0;m<d.length;m++)if(Pn(d[m].components,h))return;d.push(p)}else u=-1-u,l.coverage.glyphs.splice(u,0,c),l.ligatureSets.splice(u,0,[p])};Ke.prototype.getFeature=function(o,e,i){if(/ss\d\d/.test(o))return this.getSingle(o,e,i);switch(o){case"aalt":case"salt":return this.getSingle(o,e,i).concat(this.getAlternates(o,e,i));case"dlig":case"liga":case"rlig":return this.getLigatures(o,e,i);case"ccmp":return this.getMultiple(o,e,i).concat(this.getLigatures(o,e,i));case"stch":return this.getMultiple(o,e,i)}};Ke.prototype.add=function(o,e,i,r){if(/ss\d\d/.test(o))return this.addSingle(o,e,i,r);switch(o){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(o,e,i,r):this.addAlternate(o,e,i,r);case"dlig":case"liga":case"rlig":return this.addLigature(o,e,i,r);case"ccmp":return e.by instanceof Array?this.addMultiple(o,e,i,r):this.addLigature(o,e,i,r)}};let U0=Ke;function uo(o,e,i,r,a){let l;return(e&r)>0?(l=o.parseByte(),e&a||(l=-l),l=i+l):(e&a)>0?l=i:l=i+o.parseShort(),l}function Xr(o,e,i){let r=new te.Parser(e,i);o.numberOfContours=r.parseShort(),o._xMin=r.parseShort(),o._yMin=r.parseShort(),o._xMax=r.parseShort(),o._yMax=r.parseShort();let a,l;if(o.numberOfContours>0){let c=o.endPointIndices=[];for(let p=0;p<o.numberOfContours;p+=1)c.push(r.parseUShort());o.instructionLength=r.parseUShort(),o.instructions=[];for(let p=0;p<o.instructionLength;p+=1)o.instructions.push(r.parseByte());let h=c[c.length-1]+1;a=[];for(let p=0;p<h;p+=1)if(l=r.parseByte(),a.push(l),(l&8)>0){let u=r.parseByte();for(let d=0;d<u;d+=1)a.push(l),p+=1}if(ne.argument(a.length===h,"Bad flags."),c.length>0){let p=[],u;if(h>0){for(let v=0;v<h;v+=1)l=a[v],u={},u.onCurve=!!(l&1),u.lastPointOfContour=c.indexOf(v)>=0,p.push(u);let d=0;for(let v=0;v<h;v+=1)l=a[v],u=p[v],u.x=uo(r,l,d,2,16),d=u.x;let m=0;for(let v=0;v<h;v+=1)l=a[v],u=p[v],u.y=uo(r,l,m,4,32),m=u.y}o.points=p}else o.points=[]}else if(o.numberOfContours===0)o.points=[];else{o.isComposite=!0,o.points=[],o.components=[];let c=!0;for(;c;){a=r.parseUShort();let h={glyphIndex:r.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=r.parseShort(),h.dy=r.parseShort()):h.matchedPoints=[r.parseUShort(),r.parseUShort()]:(a&2)>0?(h.dx=r.parseChar(),h.dy=r.parseChar()):h.matchedPoints=[r.parseByte(),r.parseByte()],(a&8)>0?h.xScale=h.yScale=r.parseF2Dot14():(a&64)>0?(h.xScale=r.parseF2Dot14(),h.yScale=r.parseF2Dot14()):(a&128)>0&&(h.xScale=r.parseF2Dot14(),h.scale01=r.parseF2Dot14(),h.scale10=r.parseF2Dot14(),h.yScale=r.parseF2Dot14()),o.components.push(h),c=!!(a&32)}if(a&256){o.instructionLength=r.parseUShort(),o.instructions=[];for(let h=0;h<o.instructionLength;h+=1)o.instructions.push(r.parseByte())}}}function xn(o,e){let i=[];for(let r=0;r<o.length;r+=1){let a=o[r],l={x:e.xScale*a.x+e.scale01*a.y+e.dx,y:e.scale10*a.x+e.yScale*a.y+e.dy,onCurve:a.onCurve,lastPointOfContour:a.lastPointOfContour};i.push(l)}return i}function G0(o){let e=[],i=[];for(let r=0;r<o.length;r+=1){let a=o[r];i.push(a),a.lastPointOfContour&&(e.push(i),i=[])}return ne.argument(i.length===0,"There are still points left in the current contour."),e}function Zr(o){let e=new Cs;if(!o)return e;let i=G0(o);for(let r=0;r<i.length;++r){let a=i[r],l=a[a.length-1],c=a[0];if(l.onCurve)e.moveTo(l.x,l.y);else if(c.onCurve)e.moveTo(c.x,c.y);else{let h={x:(l.x+c.x)*.5,y:(l.y+c.y)*.5};e.moveTo(h.x,h.y)}for(let h=0;h<a.length;++h)if(l=c,c=a[(h+1)%a.length],l.onCurve)e.lineTo(l.x,l.y);else{let p=c;c.onCurve||(p={x:(l.x+c.x)*.5,y:(l.y+c.y)*.5}),e.quadraticCurveTo(l.x,l.y,p.x,p.y)}e.closePath()}return e}function Yr(o,e){if(e.isComposite)for(let i=0;i<e.components.length;i+=1){let r=e.components[i],a=o.get(r.glyphIndex);if(a.getPath(),a.points){let l;if(r.matchedPoints===void 0)l=xn(a.points,r);else{if(r.matchedPoints[0]>e.points.length-1||r.matchedPoints[1]>a.points.length-1)throw Error("Matched points out of range in "+e.name);let c=e.points[r.matchedPoints[0]],h=a.points[r.matchedPoints[1]],p={xScale:r.xScale,scale01:r.scale01,scale10:r.scale10,yScale:r.yScale,dx:0,dy:0};h=xn([h],p)[0],p.dx=c.x-h.x,p.dy=c.y-h.y,l=xn(a.points,p)}e.points=e.points.concat(l)}}return Zr(e.points)}function z0(o,e,i,r){let a=new pt.GlyphSet(r);for(let l=0;l<i.length-1;l+=1){let c=i[l],h=i[l+1];c!==h?a.push(l,pt.ttfGlyphLoader(r,l,Xr,o,e+c,Yr)):a.push(l,pt.glyphLoader(r,l))}return a}function H0(o,e,i,r){let a=new pt.GlyphSet(r);return r._push=function(l){let c=i[l],h=i[l+1];c!==h?a.push(l,pt.ttfGlyphLoader(r,l,Xr,o,e+c,Yr)):a.push(l,pt.glyphLoader(r,l))},a}function j0(o,e,i,r,a){return a.lowMemory?H0(o,e,i,r):z0(o,e,i,r)}let Kr={getPath:Zr,parse:j0},qr,Ut,Qr,Vn;function Jr(o){this.font=o,this.getCommands=function(e){return Kr.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function W0(o){return o}function $r(o){return Math.sign(o)*Math.round(Math.abs(o))}function X0(o){return Math.sign(o)*Math.round(Math.abs(o*2))/2}function Z0(o){return Math.sign(o)*(Math.round(Math.abs(o)+.5)-.5)}function Y0(o){return Math.sign(o)*Math.ceil(Math.abs(o))}function K0(o){return Math.sign(o)*Math.floor(Math.abs(o))}let ea=function(o){let e=this.srPeriod,i=this.srPhase,r=this.srThreshold,a=1;return o<0&&(o=-o,a=-1),o+=r-i,o=Math.trunc(o/e)*e,o+=i,o<0?i*a:o*a},ut={x:1,y:0,axis:"x",distance:function(o,e,i,r){return(i?o.xo:o.x)-(r?e.xo:e.x)},interpolate:function(o,e,i,r){let a,l,c,h,p,u,d;if(!r||r===this){if(a=o.xo-e.xo,l=o.xo-i.xo,p=e.x-e.xo,u=i.x-i.xo,c=Math.abs(a),h=Math.abs(l),d=c+h,d===0){o.x=o.xo+(p+u)/2;return}o.x=o.xo+(p*h+u*c)/d;return}if(a=r.distance(o,e,!0,!0),l=r.distance(o,i,!0,!0),p=r.distance(e,e,!1,!0),u=r.distance(i,i,!1,!0),c=Math.abs(a),h=Math.abs(l),d=c+h,d===0){ut.setRelative(o,o,(p+u)/2,r,!0);return}ut.setRelative(o,o,(p*h+u*c)/d,r,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(o,e,i,r,a){if(!r||r===this){o.x=(a?e.xo:e.x)+i;return}let l=a?e.xo:e.x,c=a?e.yo:e.y,h=l+i*r.x,p=c+i*r.y;o.x=h+(o.y-p)/r.normalSlope},slope:0,touch:function(o){o.xTouched=!0},touched:function(o){return o.xTouched},untouch:function(o){o.xTouched=!1}},gt={x:0,y:1,axis:"y",distance:function(o,e,i,r){return(i?o.yo:o.y)-(r?e.yo:e.y)},interpolate:function(o,e,i,r){let a,l,c,h,p,u,d;if(!r||r===this){if(a=o.yo-e.yo,l=o.yo-i.yo,p=e.y-e.yo,u=i.y-i.yo,c=Math.abs(a),h=Math.abs(l),d=c+h,d===0){o.y=o.yo+(p+u)/2;return}o.y=o.yo+(p*h+u*c)/d;return}if(a=r.distance(o,e,!0,!0),l=r.distance(o,i,!0,!0),p=r.distance(e,e,!1,!0),u=r.distance(i,i,!1,!0),c=Math.abs(a),h=Math.abs(l),d=c+h,d===0){gt.setRelative(o,o,(p+u)/2,r,!0);return}gt.setRelative(o,o,(p*h+u*c)/d,r,!0)},normalSlope:0,setRelative:function(o,e,i,r,a){if(!r||r===this){o.y=(a?e.yo:e.y)+i;return}let l=a?e.xo:e.x,c=a?e.yo:e.y,h=l+i*r.x,p=c+i*r.y;o.y=p+r.normalSlope*(o.x-h)},slope:Number.POSITIVE_INFINITY,touch:function(o){o.yTouched=!0},touched:function(o){return o.yTouched},untouch:function(o){o.yTouched=!1}};Object.freeze(ut);Object.freeze(gt);function Ts(o,e){this.x=o,this.y=e,this.axis=void 0,this.slope=e/o,this.normalSlope=-o/e,Object.freeze(this)}Ts.prototype.distance=function(o,e,i,r){return this.x*ut.distance(o,e,i,r)+this.y*gt.distance(o,e,i,r)};Ts.prototype.interpolate=function(o,e,i,r){let a,l,c,h,p,u,d;if(c=r.distance(o,e,!0,!0),h=r.distance(o,i,!0,!0),a=r.distance(e,e,!1,!0),l=r.distance(i,i,!1,!0),p=Math.abs(c),u=Math.abs(h),d=p+u,d===0){this.setRelative(o,o,(a+l)/2,r,!0);return}this.setRelative(o,o,(a*u+l*p)/d,r,!0)};Ts.prototype.setRelative=function(o,e,i,r,a){r=r||this;let l=a?e.xo:e.x,c=a?e.yo:e.y,h=l+i*r.x,p=c+i*r.y,u=r.normalSlope,d=this.slope,m=o.x,v=o.y;o.x=(d*m-u*h+p-v)/(d-u),o.y=d*(o.x-m)+v};Ts.prototype.touch=function(o){o.xTouched=!0,o.yTouched=!0};function Ls(o,e){let i=Math.sqrt(o*o+e*e);return o/=i,e/=i,o===1&&e===0?ut:o===0&&e===1?gt:new Ts(o,e)}function yt(o,e,i,r){this.x=this.xo=Math.round(o*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=i,this.onCurve=r,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}yt.prototype.nextTouched=function(o){let e=this.nextPointOnContour;for(;!o.touched(e)&&e!==this;)e=e.nextPointOnContour;return e};yt.prototype.prevTouched=function(o){let e=this.prevPointOnContour;for(;!o.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};let ys=Object.freeze(new yt(0,0)),q0={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function It(o,e){switch(this.env=o,this.stack=[],this.prog=e,o){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=ut,this.round=$r}}Jr.prototype.exec=function(o,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let i=this.font,r=this._prepState;if(!r||r.ppem!==e){let a=this._fpgmState;if(!a){It.prototype=q0,a=this._fpgmState=new It("fpgm",i.tables.fpgm),a.funcs=[],a.font=i,exports.DEBUG&&(console.log("---EXEC FPGM---"),a.step=-1);try{Ut(a)}catch(c){console.log("Hinting error in FPGM:"+c),this._errorState=3;return}}It.prototype=a,r=this._prepState=new It("prep",i.tables.prep),r.ppem=e;let l=i.tables.cvt;if(l){let c=r.cvt=new Array(l.length),h=e/i.unitsPerEm;for(let p=0;p<l.length;p++)c[p]=l[p]*h}else r.cvt=[];exports.DEBUG&&(console.log("---EXEC PREP---"),r.step=-1);try{Ut(r)}catch(c){this._errorState<2&&console.log("Hinting error in PREP:"+c),this._errorState=2}}if(!(this._errorState>1))try{return Qr(o,r)}catch(a){this._errorState<1&&(console.log("Hinting error:"+a),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}};Qr=function(o,e){let i=e.ppem/e.font.unitsPerEm,r=i,a=o.components,l,c,h;if(It.prototype=e,!a)h=new It("glyf",o.instructions),exports.DEBUG&&(console.log("---EXEC GLYPH---"),h.step=-1),Vn(o,h,i,r),c=h.gZone;else{let p=e.font;c=[],l=[];for(let u=0;u<a.length;u++){let d=a[u],m=p.glyphs.get(d.glyphIndex);h=new It("glyf",m.instructions),exports.DEBUG&&(console.log("---EXEC COMP "+u+"---"),h.step=-1),Vn(m,h,i,r);let v=Math.round(d.dx*i),y=Math.round(d.dy*r),x=h.gZone,b=h.contours;for(let T=0;T<x.length;T++){let A=x[T];A.xTouched=A.yTouched=!1,A.xo=A.x=A.x+v,A.yo=A.y=A.y+y}let C=c.length;c.push.apply(c,x);for(let T=0;T<b.length;T++)l.push(b[T]+C)}o.instructions&&!h.inhibitGridFit&&(h=new It("glyf",o.instructions),h.gZone=h.z0=h.z1=h.z2=c,h.contours=l,c.push(new yt(0,0),new yt(Math.round(o.advanceWidth*i),0)),exports.DEBUG&&(console.log("---EXEC COMPOSITE---"),h.step=-1),Ut(h),c.length-=2)}return c};Vn=function(o,e,i,r){let a=o.points||[],l=a.length,c=e.gZone=e.z0=e.z1=e.z2=[],h=e.contours=[],p;for(let m=0;m<l;m++)p=a[m],c[m]=new yt(p.x*i,p.y*r,p.lastPointOfContour,p.onCurve);let u,d;for(let m=0;m<l;m++)p=c[m],u||(u=p,h.push(m)),p.lastPointOfContour?(p.nextPointOnContour=u,u.prevPointOnContour=p,u=void 0):(d=c[m+1],p.nextPointOnContour=d,d.prevPointOnContour=p);if(!e.inhibitGridFit){if(exports.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(let m=0;m<l;m++)console.log(m,c[m].x,c[m].y)}if(c.push(new yt(0,0),new yt(Math.round(o.advanceWidth*i),0)),Ut(e),c.length-=2,exports.DEBUG){console.log("FINISHED GLYPH",e.stack);for(let m=0;m<l;m++)console.log(m,c[m].x,c[m].y)}}};Ut=function(o){let e=o.prog;if(!e)return;let i=e.length,r;for(o.ip=0;o.ip<i;o.ip++){if(exports.DEBUG&&o.step++,r=qr[e[o.ip]],!r)throw new Error("unknown instruction: 0x"+Number(e[o.ip]).toString(16));r(o)}};function ln(o){let e=o.tZone=new Array(o.gZone.length);for(let i=0;i<e.length;i++)e[i]=new yt(0,0)}function ta(o,e){let i=o.prog,r=o.ip,a=1,l;do if(l=i[++r],l===88)a++;else if(l===89)a--;else if(l===64)r+=i[r+1]+1;else if(l===65)r+=2*i[r+1]+1;else if(l>=176&&l<=183)r+=l-176+1;else if(l>=184&&l<=191)r+=(l-184+1)*2;else if(e&&a===1&&l===27)break;while(a>0);o.ip=r}function po(o,e){exports.DEBUG&&console.log(e.step,"SVTCA["+o.axis+"]"),e.fv=e.pv=e.dpv=o}function fo(o,e){exports.DEBUG&&console.log(e.step,"SPVTCA["+o.axis+"]"),e.pv=e.dpv=o}function mo(o,e){exports.DEBUG&&console.log(e.step,"SFVTCA["+o.axis+"]"),e.fv=o}function go(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z2[r],c=e.z1[a];exports.DEBUG&&console.log("SPVTL["+o+"]",r,a);let h,p;o?(h=l.y-c.y,p=c.x-l.x):(h=c.x-l.x,p=c.y-l.y),e.pv=e.dpv=Ls(h,p)}function yo(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z2[r],c=e.z1[a];exports.DEBUG&&console.log("SFVTL["+o+"]",r,a);let h,p;o?(h=l.y-c.y,p=c.x-l.x):(h=c.x-l.x,p=c.y-l.y),e.fv=Ls(h,p)}function Q0(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"SPVFS[]",i,r),o.pv=o.dpv=Ls(r,i)}function J0(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"SPVFS[]",i,r),o.fv=Ls(r,i)}function $0(o){let e=o.stack,i=o.pv;exports.DEBUG&&console.log(o.step,"GPV[]"),e.push(i.x*16384),e.push(i.y*16384)}function eu(o){let e=o.stack,i=o.fv;exports.DEBUG&&console.log(o.step,"GFV[]"),e.push(i.x*16384),e.push(i.y*16384)}function tu(o){o.fv=o.pv,exports.DEBUG&&console.log(o.step,"SFVTPV[]")}function su(o){let e=o.stack,i=e.pop(),r=e.pop(),a=e.pop(),l=e.pop(),c=e.pop(),h=o.z0,p=o.z1,u=h[i],d=h[r],m=p[a],v=p[l],y=o.z2[c];exports.DEBUG&&console.log("ISECT[], ",i,r,a,l,c);let x=u.x,b=u.y,C=d.x,T=d.y,A=m.x,O=m.y,P=v.x,V=v.y,B=(x-C)*(O-V)-(b-T)*(A-P),I=x*T-b*C,G=A*V-O*P;y.x=(I*(A-P)-G*(x-C))/B,y.y=(I*(O-V)-G*(b-T))/B}function nu(o){o.rp0=o.stack.pop(),exports.DEBUG&&console.log(o.step,"SRP0[]",o.rp0)}function iu(o){o.rp1=o.stack.pop(),exports.DEBUG&&console.log(o.step,"SRP1[]",o.rp1)}function ou(o){o.rp2=o.stack.pop(),exports.DEBUG&&console.log(o.step,"SRP2[]",o.rp2)}function ru(o){let e=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"SZP0[]",e),o.zp0=e,e){case 0:o.tZone||ln(o),o.z0=o.tZone;break;case 1:o.z0=o.gZone;break;default:throw new Error("Invalid zone pointer")}}function au(o){let e=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"SZP1[]",e),o.zp1=e,e){case 0:o.tZone||ln(o),o.z1=o.tZone;break;case 1:o.z1=o.gZone;break;default:throw new Error("Invalid zone pointer")}}function lu(o){let e=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"SZP2[]",e),o.zp2=e,e){case 0:o.tZone||ln(o),o.z2=o.tZone;break;case 1:o.z2=o.gZone;break;default:throw new Error("Invalid zone pointer")}}function cu(o){let e=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"SZPS[]",e),o.zp0=o.zp1=o.zp2=e,e){case 0:o.tZone||ln(o),o.z0=o.z1=o.z2=o.tZone;break;case 1:o.z0=o.z1=o.z2=o.gZone;break;default:throw new Error("Invalid zone pointer")}}function hu(o){o.loop=o.stack.pop(),exports.DEBUG&&console.log(o.step,"SLOOP[]",o.loop)}function uu(o){exports.DEBUG&&console.log(o.step,"RTG[]"),o.round=$r}function pu(o){exports.DEBUG&&console.log(o.step,"RTHG[]"),o.round=Z0}function du(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SMD[]",e),o.minDis=e/64}function fu(o){exports.DEBUG&&console.log(o.step,"ELSE[]"),ta(o,!1)}function mu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"JMPR[]",e),o.ip+=e-1}function gu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SCVTCI[]",e),o.cvCutIn=e/64}function yu(o){let e=o.stack;exports.DEBUG&&console.log(o.step,"DUP[]"),e.push(e[e.length-1])}function Cn(o){exports.DEBUG&&console.log(o.step,"POP[]"),o.stack.pop()}function vu(o){exports.DEBUG&&console.log(o.step,"CLEAR[]"),o.stack.length=0}function bu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"SWAP[]"),e.push(i),e.push(r)}function xu(o){let e=o.stack;exports.DEBUG&&console.log(o.step,"DEPTH[]"),e.push(e.length)}function Cu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"LOOPCALL[]",i,r);let a=o.ip,l=o.prog;o.prog=o.funcs[i];for(let c=0;c<r;c++)Ut(o),exports.DEBUG&&console.log(++o.step,c+1<r?"next loopcall":"done loopcall",c);o.ip=a,o.prog=l}function wu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"CALL[]",e);let i=o.ip,r=o.prog;o.prog=o.funcs[e],Ut(o),o.ip=i,o.prog=r,exports.DEBUG&&console.log(++o.step,"returning from",e)}function Eu(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"CINDEX[]",i),e.push(e[e.length-i])}function Su(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"MINDEX[]",i),e.push(e.splice(e.length-i,1)[0])}function Tu(o){if(o.env!=="fpgm")throw new Error("FDEF not allowed here");let e=o.stack,i=o.prog,r=o.ip,a=e.pop(),l=r;for(exports.DEBUG&&console.log(o.step,"FDEF[]",a);i[++r]!==45;);o.ip=r,o.funcs[a]=i.slice(l+1,r)}function vo(o,e){let i=e.stack.pop(),r=e.z0[i],a=e.fv,l=e.pv;exports.DEBUG&&console.log(e.step,"MDAP["+o+"]",i);let c=l.distance(r,ys);o&&(c=e.round(c)),a.setRelative(r,ys,c,l),a.touch(r),e.rp0=e.rp1=i}function bo(o,e){let i=e.z2,r=i.length-2,a,l,c;exports.DEBUG&&console.log(e.step,"IUP["+o.axis+"]");for(let h=0;h<r;h++)a=i[h],!o.touched(a)&&(l=a.prevTouched(o),l!==a&&(c=a.nextTouched(o),l===c&&o.setRelative(a,a,o.distance(l,l,!1,!0),o,!0),o.interpolate(a,l,c,o)))}function xo(o,e){let i=e.stack,r=o?e.rp1:e.rp2,a=(o?e.z0:e.z1)[r],l=e.fv,c=e.pv,h=e.loop,p=e.z2;for(;h--;){let u=i.pop(),d=p[u],m=c.distance(a,a,!1,!0);l.setRelative(d,d,m,c),l.touch(d),exports.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-h)+": ":"")+"SHP["+(o?"rp1":"rp2")+"]",u)}e.loop=1}function Co(o,e){let i=e.stack,r=o?e.rp1:e.rp2,a=(o?e.z0:e.z1)[r],l=e.fv,c=e.pv,h=i.pop(),p=e.z2[e.contours[h]],u=p;exports.DEBUG&&console.log(e.step,"SHC["+o+"]",h);let d=c.distance(a,a,!1,!0);do u!==a&&l.setRelative(u,u,d,c),u=u.nextPointOnContour;while(u!==p)}function wo(o,e){let i=e.stack,r=o?e.rp1:e.rp2,a=(o?e.z0:e.z1)[r],l=e.fv,c=e.pv,h=i.pop();exports.DEBUG&&console.log(e.step,"SHZ["+o+"]",h);let p;switch(h){case 0:p=e.tZone;break;case 1:p=e.gZone;break;default:throw new Error("Invalid zone")}let u,d=c.distance(a,a,!1,!0),m=p.length-2;for(let v=0;v<m;v++)u=p[v],l.setRelative(u,u,d,c)}function Lu(o){let e=o.stack,i=o.loop,r=o.fv,a=e.pop()/64,l=o.z2;for(;i--;){let c=e.pop(),h=l[c];exports.DEBUG&&console.log(o.step,(o.loop>1?"loop "+(o.loop-i)+": ":"")+"SHPIX[]",c,a),r.setRelative(h,h,a),r.touch(h)}o.loop=1}function ku(o){let e=o.stack,i=o.rp1,r=o.rp2,a=o.loop,l=o.z0[i],c=o.z1[r],h=o.fv,p=o.dpv,u=o.z2;for(;a--;){let d=e.pop(),m=u[d];exports.DEBUG&&console.log(o.step,(o.loop>1?"loop "+(o.loop-a)+": ":"")+"IP[]",d,i,"<->",r),h.interpolate(m,l,c,p),h.touch(m)}o.loop=1}function Eo(o,e){let i=e.stack,r=i.pop()/64,a=i.pop(),l=e.z1[a],c=e.z0[e.rp0],h=e.fv,p=e.pv;h.setRelative(l,c,r,p),h.touch(l),exports.DEBUG&&console.log(e.step,"MSIRP["+o+"]",r,a),e.rp1=e.rp0,e.rp2=a,o&&(e.rp0=a)}function Mu(o){let e=o.stack,i=o.rp0,r=o.z0[i],a=o.loop,l=o.fv,c=o.pv,h=o.z1;for(;a--;){let p=e.pop(),u=h[p];exports.DEBUG&&console.log(o.step,(o.loop>1?"loop "+(o.loop-a)+": ":"")+"ALIGNRP[]",p),l.setRelative(u,r,0,c),l.touch(u)}o.loop=1}function Iu(o){exports.DEBUG&&console.log(o.step,"RTDG[]"),o.round=X0}function So(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z0[a],c=e.fv,h=e.pv,p=e.cvt[r];exports.DEBUG&&console.log(e.step,"MIAP["+o+"]",r,"(",p,")",a);let u=h.distance(l,ys);o&&(Math.abs(u-p)<e.cvCutIn&&(u=p),u=e.round(u)),c.setRelative(l,ys,u,h),e.zp0===0&&(l.xo=l.x,l.yo=l.y),c.touch(l),e.rp0=e.rp1=a}function Au(o){let e=o.prog,i=o.ip,r=o.stack,a=e[++i];exports.DEBUG&&console.log(o.step,"NPUSHB[]",a);for(let l=0;l<a;l++)r.push(e[++i]);o.ip=i}function _u(o){let e=o.ip,i=o.prog,r=o.stack,a=i[++e];exports.DEBUG&&console.log(o.step,"NPUSHW[]",a);for(let l=0;l<a;l++){let c=i[++e]<<8|i[++e];c&32768&&(c=-((c^65535)+1)),r.push(c)}o.ip=e}function Bu(o){let e=o.stack,i=o.store;i||(i=o.store=[]);let r=e.pop(),a=e.pop();exports.DEBUG&&console.log(o.step,"WS",r,a),i[a]=r}function Ru(o){let e=o.stack,i=o.store,r=e.pop();exports.DEBUG&&console.log(o.step,"RS",r);let a=i&&i[r]||0;e.push(a)}function Ou(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"WCVTP",i,r),o.cvt[r]=i/64}function Du(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"RCVT",i),e.push(o.cvt[i]*64)}function To(o,e){let i=e.stack,r=i.pop(),a=e.z2[r];exports.DEBUG&&console.log(e.step,"GC["+o+"]",r),i.push(e.dpv.distance(a,ys,o,!1)*64)}function Lo(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z1[r],c=e.z0[a],h=e.dpv.distance(c,l,o,o);exports.DEBUG&&console.log(e.step,"MD["+o+"]",r,a,"->",h),e.stack.push(Math.round(h*64))}function Nu(o){exports.DEBUG&&console.log(o.step,"MPPEM[]"),o.stack.push(o.ppem)}function Pu(o){exports.DEBUG&&console.log(o.step,"FLIPON[]"),o.autoFlip=!0}function Vu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"LT[]",i,r),e.push(r<i?1:0)}function Fu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"LTEQ[]",i,r),e.push(r<=i?1:0)}function Uu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"GT[]",i,r),e.push(r>i?1:0)}function Gu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"GTEQ[]",i,r),e.push(r>=i?1:0)}function zu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"EQ[]",i,r),e.push(i===r?1:0)}function Hu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"NEQ[]",i,r),e.push(i!==r?1:0)}function ju(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"ODD[]",i),e.push(Math.trunc(i)&1?1:0)}function Wu(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"EVEN[]",i),e.push(Math.trunc(i)&1?0:1)}function Xu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"IF[]",e),e||(ta(o,!0),exports.DEBUG&&console.log(o.step,"EIF[]"))}function Zu(o){exports.DEBUG&&console.log(o.step,"EIF[]")}function Yu(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"AND[]",i,r),e.push(i&&r?1:0)}function Ku(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"OR[]",i,r),e.push(i||r?1:0)}function qu(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"NOT[]",i),e.push(i?0:1)}function wn(o,e){let i=e.stack,r=i.pop(),a=e.fv,l=e.pv,c=e.ppem,h=e.deltaBase+(o-1)*16,p=e.deltaShift,u=e.z0;exports.DEBUG&&console.log(e.step,"DELTAP["+o+"]",r,i);for(let d=0;d<r;d++){let m=i.pop(),v=i.pop();if(h+((v&240)>>4)!==c)continue;let y=(v&15)-8;y>=0&&y++,exports.DEBUG&&console.log(e.step,"DELTAPFIX",m,"by",y*p);let x=u[m];a.setRelative(x,x,y*p,l)}}function Qu(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SDB[]",e),o.deltaBase=e}function Ju(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SDS[]",e),o.deltaShift=Math.pow(.5,e)}function $u(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"ADD[]",i,r),e.push(r+i)}function e2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"SUB[]",i,r),e.push(r-i)}function t2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"DIV[]",i,r),e.push(r*64/i)}function s2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"MUL[]",i,r),e.push(r*i/64)}function n2(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"ABS[]",i),e.push(Math.abs(i))}function i2(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"NEG[]",i),e.push(-i)}function o2(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"FLOOR[]",i),e.push(Math.floor(i/64)*64)}function r2(o){let e=o.stack,i=e.pop();exports.DEBUG&&console.log(o.step,"CEILING[]",i),e.push(Math.ceil(i/64)*64)}function Us(o,e){let i=e.stack,r=i.pop();exports.DEBUG&&console.log(e.step,"ROUND[]"),i.push(e.round(r/64)*64)}function a2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"WCVTF[]",i,r),o.cvt[r]=i*o.ppem/o.font.unitsPerEm}function En(o,e){let i=e.stack,r=i.pop(),a=e.ppem,l=e.deltaBase+(o-1)*16,c=e.deltaShift;exports.DEBUG&&console.log(e.step,"DELTAC["+o+"]",r,i);for(let h=0;h<r;h++){let p=i.pop(),u=i.pop();if(l+((u&240)>>4)!==a)continue;let d=(u&15)-8;d>=0&&d++;let m=d*c;exports.DEBUG&&console.log(e.step,"DELTACFIX",p,"by",m),e.cvt[p]+=m}}function l2(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SROUND[]",e),o.round=ea;let i;switch(e&192){case 0:i=.5;break;case 64:i=1;break;case 128:i=2;break;default:throw new Error("invalid SROUND value")}switch(o.srPeriod=i,e&48){case 0:o.srPhase=0;break;case 16:o.srPhase=.25*i;break;case 32:o.srPhase=.5*i;break;case 48:o.srPhase=.75*i;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?o.srThreshold=0:o.srThreshold=(e/8-.5)*i}function c2(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"S45ROUND[]",e),o.round=ea;let i;switch(e&192){case 0:i=Math.sqrt(2)/2;break;case 64:i=Math.sqrt(2);break;case 128:i=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(o.srPeriod=i,e&48){case 0:o.srPhase=0;break;case 16:o.srPhase=.25*i;break;case 32:o.srPhase=.5*i;break;case 48:o.srPhase=.75*i;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?o.srThreshold=0:o.srThreshold=(e/8-.5)*i}function h2(o){exports.DEBUG&&console.log(o.step,"ROFF[]"),o.round=W0}function u2(o){exports.DEBUG&&console.log(o.step,"RUTG[]"),o.round=Y0}function p2(o){exports.DEBUG&&console.log(o.step,"RDTG[]"),o.round=K0}function d2(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SCANCTRL[]",e)}function ko(o,e){let i=e.stack,r=i.pop(),a=i.pop(),l=e.z2[r],c=e.z1[a];exports.DEBUG&&console.log(e.step,"SDPVTL["+o+"]",r,a);let h,p;o?(h=l.y-c.y,p=c.x-l.x):(h=c.x-l.x,p=c.y-l.y),e.dpv=Ls(h,p)}function f2(o){let e=o.stack,i=e.pop(),r=0;exports.DEBUG&&console.log(o.step,"GETINFO[]",i),i&1&&(r=35),i&32&&(r|=4096),e.push(r)}function m2(o){let e=o.stack,i=e.pop(),r=e.pop(),a=e.pop();exports.DEBUG&&console.log(o.step,"ROLL[]"),e.push(r),e.push(i),e.push(a)}function g2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"MAX[]",i,r),e.push(Math.max(r,i))}function y2(o){let e=o.stack,i=e.pop(),r=e.pop();exports.DEBUG&&console.log(o.step,"MIN[]",i,r),e.push(Math.min(r,i))}function v2(o){let e=o.stack.pop();exports.DEBUG&&console.log(o.step,"SCANTYPE[]",e)}function b2(o){let e=o.stack.pop(),i=o.stack.pop();switch(exports.DEBUG&&console.log(o.step,"INSTCTRL[]",e,i),e){case 1:o.inhibitGridFit=!!i;return;case 2:o.ignoreCvt=!!i;return;default:throw new Error("invalid INSTCTRL[] selector")}}function wt(o,e){let i=e.stack,r=e.prog,a=e.ip;exports.DEBUG&&console.log(e.step,"PUSHB["+o+"]");for(let l=0;l<o;l++)i.push(r[++a]);e.ip=a}function Et(o,e){let i=e.ip,r=e.prog,a=e.stack;exports.DEBUG&&console.log(e.ip,"PUSHW["+o+"]");for(let l=0;l<o;l++){let c=r[++i]<<8|r[++i];c&32768&&(c=-((c^65535)+1)),a.push(c)}e.ip=i}function se(o,e,i,r,a,l){let c=l.stack,h=o&&c.pop(),p=c.pop(),u=l.rp0,d=l.z0[u],m=l.z1[p],v=l.minDis,y=l.fv,x=l.dpv,b,C,T,A;C=b=x.distance(m,d,!0,!0),T=C>=0?1:-1,C=Math.abs(C),o&&(A=l.cvt[h],r&&Math.abs(C-A)<l.cvCutIn&&(C=A)),i&&C<v&&(C=v),r&&(C=l.round(C)),y.setRelative(m,d,T*C,x),y.touch(m),exports.DEBUG&&console.log(l.step,(o?"MIRP[":"MDRP[")+(e?"M":"m")+(i?">":"_")+(r?"R":"_")+(a===0?"Gr":a===1?"Bl":a===2?"Wh":"")+"]",o?h+"("+l.cvt[h]+","+A+")":"",p,"(d =",b,"->",T*C,")"),l.rp1=l.rp0,l.rp2=p,e&&(l.rp0=p)}qr=[po.bind(void 0,gt),po.bind(void 0,ut),fo.bind(void 0,gt),fo.bind(void 0,ut),mo.bind(void 0,gt),mo.bind(void 0,ut),go.bind(void 0,0),go.bind(void 0,1),yo.bind(void 0,0),yo.bind(void 0,1),Q0,J0,$0,eu,tu,su,nu,iu,ou,ru,au,lu,cu,hu,uu,pu,du,fu,mu,gu,void 0,void 0,yu,Cn,vu,bu,xu,Eu,Su,void 0,void 0,void 0,Cu,wu,Tu,void 0,vo.bind(void 0,0),vo.bind(void 0,1),bo.bind(void 0,gt),bo.bind(void 0,ut),xo.bind(void 0,0),xo.bind(void 0,1),Co.bind(void 0,0),Co.bind(void 0,1),wo.bind(void 0,0),wo.bind(void 0,1),Lu,ku,Eo.bind(void 0,0),Eo.bind(void 0,1),Mu,Iu,So.bind(void 0,0),So.bind(void 0,1),Au,_u,Bu,Ru,Ou,Du,To.bind(void 0,0),To.bind(void 0,1),void 0,Lo.bind(void 0,0),Lo.bind(void 0,1),Nu,void 0,Pu,void 0,void 0,Vu,Fu,Uu,Gu,zu,Hu,ju,Wu,Xu,Zu,Yu,Ku,qu,wn.bind(void 0,1),Qu,Ju,$u,e2,t2,s2,n2,i2,o2,r2,Us.bind(void 0,0),Us.bind(void 0,1),Us.bind(void 0,2),Us.bind(void 0,3),void 0,void 0,void 0,void 0,a2,wn.bind(void 0,2),wn.bind(void 0,3),En.bind(void 0,1),En.bind(void 0,2),En.bind(void 0,3),l2,c2,void 0,void 0,h2,void 0,u2,p2,Cn,Cn,void 0,void 0,void 0,void 0,void 0,d2,ko.bind(void 0,0),ko.bind(void 0,1),f2,void 0,m2,g2,y2,v2,b2,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,wt.bind(void 0,1),wt.bind(void 0,2),wt.bind(void 0,3),wt.bind(void 0,4),wt.bind(void 0,5),wt.bind(void 0,6),wt.bind(void 0,7),wt.bind(void 0,8),Et.bind(void 0,1),Et.bind(void 0,2),Et.bind(void 0,3),Et.bind(void 0,4),Et.bind(void 0,5),Et.bind(void 0,6),Et.bind(void 0,7),Et.bind(void 0,8),se.bind(void 0,0,0,0,0,0),se.bind(void 0,0,0,0,0,1),se.bind(void 0,0,0,0,0,2),se.bind(void 0,0,0,0,0,3),se.bind(void 0,0,0,0,1,0),se.bind(void 0,0,0,0,1,1),se.bind(void 0,0,0,0,1,2),se.bind(void 0,0,0,0,1,3),se.bind(void 0,0,0,1,0,0),se.bind(void 0,0,0,1,0,1),se.bind(void 0,0,0,1,0,2),se.bind(void 0,0,0,1,0,3),se.bind(void 0,0,0,1,1,0),se.bind(void 0,0,0,1,1,1),se.bind(void 0,0,0,1,1,2),se.bind(void 0,0,0,1,1,3),se.bind(void 0,0,1,0,0,0),se.bind(void 0,0,1,0,0,1),se.bind(void 0,0,1,0,0,2),se.bind(void 0,0,1,0,0,3),se.bind(void 0,0,1,0,1,0),se.bind(void 0,0,1,0,1,1),se.bind(void 0,0,1,0,1,2),se.bind(void 0,0,1,0,1,3),se.bind(void 0,0,1,1,0,0),se.bind(void 0,0,1,1,0,1),se.bind(void 0,0,1,1,0,2),se.bind(void 0,0,1,1,0,3),se.bind(void 0,0,1,1,1,0),se.bind(void 0,0,1,1,1,1),se.bind(void 0,0,1,1,1,2),se.bind(void 0,0,1,1,1,3),se.bind(void 0,1,0,0,0,0),se.bind(void 0,1,0,0,0,1),se.bind(void 0,1,0,0,0,2),se.bind(void 0,1,0,0,0,3),se.bind(void 0,1,0,0,1,0),se.bind(void 0,1,0,0,1,1),se.bind(void 0,1,0,0,1,2),se.bind(void 0,1,0,0,1,3),se.bind(void 0,1,0,1,0,0),se.bind(void 0,1,0,1,0,1),se.bind(void 0,1,0,1,0,2),se.bind(void 0,1,0,1,0,3),se.bind(void 0,1,0,1,1,0),se.bind(void 0,1,0,1,1,1),se.bind(void 0,1,0,1,1,2),se.bind(void 0,1,0,1,1,3),se.bind(void 0,1,1,0,0,0),se.bind(void 0,1,1,0,0,1),se.bind(void 0,1,1,0,0,2),se.bind(void 0,1,1,0,0,3),se.bind(void 0,1,1,0,1,0),se.bind(void 0,1,1,0,1,1),se.bind(void 0,1,1,0,1,2),se.bind(void 0,1,1,0,1,3),se.bind(void 0,1,1,1,0,0),se.bind(void 0,1,1,1,0,1),se.bind(void 0,1,1,1,0,2),se.bind(void 0,1,1,1,0,3),se.bind(void 0,1,1,1,1,0),se.bind(void 0,1,1,1,1,1),se.bind(void 0,1,1,1,1,2),se.bind(void 0,1,1,1,1,3)];let x2=Jr;function ns(o){this.char=o,this.state={},this.activeState=null}function bi(o,e,i){this.contextName=i,this.startIndex=o,this.endOffset=e}function C2(o,e,i){this.contextName=o,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=i}function He(o,e){this.context=o,this.index=e,this.length=o.length,this.current=o[e],this.backtrack=o.slice(0,e),this.lookahead=o.slice(e+1)}function cn(o){this.eventId=o,this.subscribers=[]}function w2(o){let e=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let r=0;r<e.length;r++){let a=e[r];Object.defineProperty(this.events,a,{value:new cn(a)})}if(o)for(let r=0;r<e.length;r++){let a=e[r],l=o[a];typeof l=="function"&&this.events[a].subscribe(l)}let i=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let r=0;r<i.length;r++){let a=i[r];this.events[a].subscribe(this.updateContextsRanges)}}function ke(o){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],w2.call(this,o)}ns.prototype.setState=function(o,e){return this.state[o]=e,this.activeState={key:o,value:this.state[o]},this.activeState};ns.prototype.getState=function(o){return this.state[o]||null};ke.prototype.inboundIndex=function(o){return o>=0&&o<this.tokens.length};ke.prototype.composeRUD=function(o){let e=o.map(r=>this[r[0]].apply(this,r.slice(1).concat(!0))),i=r=>typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,"FAIL");if(e.every(i))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:e.filter(i)};this.dispatch("composeRUD",[e.filter(r=>!i(r))])};ke.prototype.replaceRange=function(o,e,i,r){e=e!==null?e:this.tokens.length;let a=i.every(l=>l instanceof ns);if(!isNaN(o)&&this.inboundIndex(o)&&a){let l=this.tokens.splice.apply(this.tokens,[o,e].concat(i));return r||this.dispatch("replaceToken",[o,e,i]),[l,i]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}};ke.prototype.replaceToken=function(o,e,i){if(!isNaN(o)&&this.inboundIndex(o)&&e instanceof ns){let r=this.tokens.splice(o,1,e);return i||this.dispatch("replaceToken",[o,e]),[r[0],e]}else return{FAIL:"replaceToken: invalid token or index."}};ke.prototype.removeRange=function(o,e,i){e=isNaN(e)?this.tokens.length:e;let r=this.tokens.splice(o,e);return i||this.dispatch("removeRange",[r,o,e]),r};ke.prototype.removeToken=function(o,e){if(!isNaN(o)&&this.inboundIndex(o)){let i=this.tokens.splice(o,1);return e||this.dispatch("removeToken",[i,o]),i}else return{FAIL:"removeToken: invalid token index."}};ke.prototype.insertToken=function(o,e,i){return o.every(r=>r instanceof ns)?(this.tokens.splice.apply(this.tokens,[e,0].concat(o)),i||this.dispatch("insertToken",[o,e]),o):{FAIL:"insertToken: invalid token(s)."}};ke.prototype.registerModifier=function(o,e,i){this.events.newToken.subscribe(function(r,a){let l=[r,a],c=e===null||e.apply(this,l)===!0,h=[r,a];if(c){let p=i.apply(this,h);r.setState(o,p)}}),this.registeredModifiers.push(o)};cn.prototype.subscribe=function(o){return typeof o=="function"?this.subscribers.push(o)-1:{FAIL:`invalid '${this.eventId}' event handler`}};cn.prototype.unsubscribe=function(o){this.subscribers.splice(o,1)};He.prototype.setCurrentIndex=function(o){this.index=o,this.current=this.context[o],this.backtrack=this.context.slice(0,o),this.lookahead=this.context.slice(o+1)};He.prototype.get=function(o){switch(!0){case o===0:return this.current;case(o<0&&Math.abs(o)<=this.backtrack.length):return this.backtrack.slice(o)[0];case(o>0&&o<=this.lookahead.length):return this.lookahead[o-1];default:return null}};ke.prototype.rangeToText=function(o){if(o instanceof bi)return this.getRangeTokens(o).map(e=>e.char).join("")};ke.prototype.getText=function(){return this.tokens.map(o=>o.char).join("")};ke.prototype.getContext=function(o){return this.registeredContexts[o]||null};ke.prototype.on=function(o,e){let i=this.events[o];return i?i.subscribe(e):null};ke.prototype.dispatch=function(o,e){let i=this.events[o];if(i instanceof cn)for(let r=0;r<i.subscribers.length;r++)i.subscribers[r].apply(this,e||[])};ke.prototype.registerContextChecker=function(o,e,i){if(this.getContext(o))return{FAIL:`context name '${o}' is already registered.`};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof i!="function")return{FAIL:"missing context end check."};let r=new C2(o,e,i);return this.registeredContexts[o]=r,this.contextCheckers.push(r),r};ke.prototype.getRangeTokens=function(o){let e=o.startIndex+o.endOffset;return[].concat(this.tokens.slice(o.startIndex,e))};ke.prototype.getContextRanges=function(o){let e=this.getContext(o);return e?e.ranges:{FAIL:`context checker '${o}' is not registered.`}};ke.prototype.resetContextsRanges=function(){let o=this.registeredContexts;for(let e in o)if(Object.prototype.hasOwnProperty.call(o,e)){let i=o[e];i.ranges=[]}};ke.prototype.updateContextsRanges=function(){this.resetContextsRanges();let o=this.tokens.map(e=>e.char);for(let e=0;e<o.length;e++){let i=new He(o,e);this.runContextCheck(i)}this.dispatch("updateContextsRanges",[this.registeredContexts])};ke.prototype.setEndOffset=function(o,e){let i=this.getContext(e).openRange.startIndex,r=new bi(i,o,e),a=this.getContext(e).ranges;return r.rangeId=`${e}.${a.length}`,a.push(r),this.getContext(e).openRange=null,r};ke.prototype.runContextCheck=function(o){let e=o.index;for(let i=0;i<this.contextCheckers.length;i++){let r=this.contextCheckers[i],a=r.contextName,l=this.getContext(a).openRange;if(!l&&r.checkStart(o)&&(l=new bi(e,null,a),this.getContext(a).openRange=l,this.dispatch("contextStart",[a,e])),l&&r.checkEnd(o)){let c=e-l.startIndex+1,h=this.setEndOffset(c,a);this.dispatch("contextEnd",[a,h])}}};ke.prototype.tokenize=function(o){this.tokens=[],this.resetContextsRanges();let e=Array.from(o);this.dispatch("start");for(let i=0;i<e.length;i++){let r=e[i],a=new He(e,i);this.dispatch("next",[a]),this.runContextCheck(a);let l=new ns(r);this.tokens.push(l),this.dispatch("newToken",[l,a])}return this.dispatch("end",[this.tokens]),this.tokens};let E2=ke;function At(o){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(o)}function sa(o){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(o)}function _t(o){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(o)}function js(o){return/[\u0E00-\u0E7F]/.test(o)}function Ws(o){return/[A-z]/.test(o)}function S2(o){return/\s/.test(o)}function qe(o){this.font=o,this.features={}}function Ft(o){this.id=o.id,this.tag=o.tag,this.substitution=o.substitution}function ks(o,e){if(!o)return-1;switch(e.format){case 1:return e.glyphs.indexOf(o);case 2:{let i=e.ranges;for(let r=0;r<i.length;r++){let a=i[r];if(o>=a.start&&o<=a.end){let l=o-a.start;return a.index+l}}break}default:return-1}return-1}function T2(o,e){return ks(o,e.coverage)===-1?null:o+e.deltaGlyphId}function L2(o,e){let i=ks(o,e.coverage);return i===-1?null:e.substitute[i]}function Sn(o,e){let i=[];for(let r=0;r<o.length;r++){let a=o[r],l=e.current;l=Array.isArray(l)?l[0]:l;let c=ks(l,a);c!==-1&&i.push(c)}return i.length!==o.length?-1:i}function k2(o,e){let i=e.inputCoverage.length+e.lookaheadCoverage.length+e.backtrackCoverage.length;if(o.context.length<i)return[];let r=Sn(e.inputCoverage,o);if(r===-1)return[];let a=e.inputCoverage.length-1;if(o.lookahead.length<e.lookaheadCoverage.length)return[];let l=o.lookahead.slice(a);for(;l.length&&_t(l[0].char);)l.shift();let c=new He(l,0),h=Sn(e.lookaheadCoverage,c),p=[].concat(o.backtrack);for(p.reverse();p.length&&_t(p[0].char);)p.shift();if(p.length<e.backtrackCoverage.length)return[];let u=new He(p,0),d=Sn(e.backtrackCoverage,u),m=r.length===e.inputCoverage.length&&h.length===e.lookaheadCoverage.length&&d.length===e.backtrackCoverage.length,v=[];if(m)for(let y=0;y<e.lookupRecords.length;y++){let x=e.lookupRecords[y].lookupListIndex,b=this.getLookupByIndex(x);for(let C=0;C<b.subtables.length;C++){let T=b.subtables[C],A,O=this.getSubstitutionType(b,T);if(O==="71"?(O=this.getSubstitutionType(T,T.extension),A=this.getLookupMethod(T,T.extension),T=T.extension):A=this.getLookupMethod(b,T),O==="12")for(let P=0;P<r.length;P++){let V=o.get(P),B=A(V);B&&v.push(B)}else throw new Error(`Substitution type ${O} is not supported in chaining substitution`)}}return v}function M2(o,e){let i=o.current,r=ks(i,e.coverage);if(r===-1)return null;let a,l=e.ligatureSets[r];for(let c=0;c<l.length;c++){a=l[c];for(let h=0;h<a.components.length;h++){let p=o.lookahead[h],u=a.components[h];if(p!==u)break;if(h===a.components.length-1)return a}}return null}function I2(o,e){let i=ks(o,e.coverage);return i===-1?null:e.sequences[i]}qe.prototype.getDefaultScriptFeaturesIndexes=function(){let o=this.font.tables.gsub.scripts;for(let e=0;e<o.length;e++){let i=o[e];if(i.tag==="DFLT")return i.script.defaultLangSys.featureIndexes}return[]};qe.prototype.getScriptFeaturesIndexes=function(o){if(!this.font.tables.gsub)return[];if(!o)return this.getDefaultScriptFeaturesIndexes();let e=this.font.tables.gsub.scripts;for(let i=0;i<e.length;i++){let r=e[i];if(r.tag===o&&r.script.defaultLangSys)return r.script.defaultLangSys.featureIndexes;{let a=r.langSysRecords;if(a)for(let l=0;l<a.length;l++){let c=a[l];if(c.tag===o)return c.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()};qe.prototype.mapTagsToFeatures=function(o,e){let i={};for(let r=0;r<o.length;r++){let a=o[r].tag,l=o[r].feature;i[a]=l}this.features[e].tags=i};qe.prototype.getScriptFeatures=function(o){let e=this.features[o];if(Object.prototype.hasOwnProperty.call(this.features,o))return e;let i=this.getScriptFeaturesIndexes(o);if(!i)return null;let r=this.font.tables.gsub;return e=i.map(a=>r.features[a]),this.features[o]=e,this.mapTagsToFeatures(e,o),e};qe.prototype.getSubstitutionType=function(o,e){let i=o.lookupType.toString(),r=e.substFormat.toString();return i+r};qe.prototype.getLookupMethod=function(o,e){switch(this.getSubstitutionType(o,e)){case"11":return i=>T2.apply(this,[i,e]);case"12":return i=>L2.apply(this,[i,e]);case"63":return i=>k2.apply(this,[i,e]);case"41":return i=>M2.apply(this,[i,e]);case"21":return i=>I2.apply(this,[i,e]);default:throw new Error(`lookupType: ${o.lookupType} - substFormat: ${e.substFormat} is not yet supported`)}};qe.prototype.lookupFeature=function(o){let e=o.contextParams,i=e.index,r=this.getFeature({tag:o.tag,script:o.script});if(!r)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${o.tag}' for script '${o.script}'.`);let a=this.getFeatureLookups(r),l=[].concat(e.context);for(let c=0;c<a.length;c++){let h=a[c],p=this.getLookupSubtables(h);for(let u=0;u<p.length;u++){let d=p[u],m=this.getSubstitutionType(h,d),v;m==="71"?(m=this.getSubstitutionType(d,d.extension),v=this.getLookupMethod(d,d.extension),d=d.extension):v=this.getLookupMethod(h,d);let y;switch(m){case"11":y=v(e.current),y&&l.splice(i,1,new Ft({id:11,tag:o.tag,substitution:y}));break;case"12":y=v(e.current),y&&l.splice(i,1,new Ft({id:12,tag:o.tag,substitution:y}));break;case"63":y=v(e),Array.isArray(y)&&y.length&&l.splice(i,1,new Ft({id:63,tag:o.tag,substitution:y}));break;case"41":y=v(e),y&&l.splice(i,1,new Ft({id:41,tag:o.tag,substitution:y}));break;case"21":y=v(e.current),y&&l.splice(i,1,new Ft({id:21,tag:o.tag,substitution:y}));break}e=new He(l,i),!(Array.isArray(y)&&!y.length)&&(y=null)}}return l.length?l:null};qe.prototype.supports=function(o){if(!o.script)return!1;this.getScriptFeatures(o.script);let e=Object.prototype.hasOwnProperty.call(this.features,o.script);if(!o.tag)return e;let i=this.features[o.script].some(r=>r.tag===o.tag);return e&&i};qe.prototype.getLookupSubtables=function(o){return o.subtables||null};qe.prototype.getLookupByIndex=function(o){return this.font.tables.gsub.lookups[o]||null};qe.prototype.getFeatureLookups=function(o){return o.lookupListIndexes.map(this.getLookupByIndex.bind(this))};qe.prototype.getFeature=function(o){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,o.script)||this.getScriptFeatures(o.script);let e=this.features[o.script];return e?e.tags[o.tag]?this.features[o.script].tags[o.tag]:null:{FAIL:`No feature for script ${o.script}`}};let A2=qe;function _2(o){let e=o.current,i=o.get(-1);return i===null&&At(e)||!At(i)&&At(e)}function B2(o){let e=o.get(1);return e===null||!At(e)}let R2={startCheck:_2,endCheck:B2};function O2(o){let e=o.current,i=o.get(-1);return(At(e)||_t(e))&&!At(i)}function D2(o){let e=o.get(1);switch(!0){case e===null:return!0;case(!At(e)&&!_t(e)):{let i=S2(e);if(!i)return!0;if(i){let r=!1;if(r=o.lookahead.some(a=>At(a)||_t(a)),!r)return!0}break}default:return!1}}let N2={startCheck:O2,endCheck:D2};function P2(o,e,i){e[i].setState(o.tag,o.substitution)}function V2(o,e,i){e[i].setState(o.tag,o.substitution)}function F2(o,e,i){for(let r=0;r<o.substitution.length;r++){let a=o.substitution[r];e[i+r].setState(o.tag,a)}}function U2(o,e,i){let r=e[i];r.setState(o.tag,o.substitution.ligGlyph);let a=o.substitution.components.length;for(let l=0;l<a;l++)r=e[i+l+1],r.setState("deleted",!0)}let Mo={11:P2,12:V2,63:F2,41:U2};function G2(o,e,i){o instanceof Ft&&Mo[o.id]&&Mo[o.id](o,e,i)}let is=G2;function z2(o){let e=[].concat(o.backtrack);for(let i=e.length-1;i>=0;i--){let r=e[i],a=sa(r),l=_t(r);if(!a&&!l)return!0;if(a)return!1}return!1}function H2(o){if(sa(o.current))return!1;for(let e=0;e<o.lookahead.length;e++){let i=o.lookahead[e];if(!_t(i))return!0}return!1}function j2(o){let e="arab",i=this.featuresTags[e],r=this.tokenizer.getRangeTokens(o);if(r.length===1)return;let a=new He(r.map(c=>c.getState("glyphIndex")),0),l=new He(r.map(c=>c.char),0);for(let c=0;c<r.length;c++){let h=r[c];if(_t(h.char))continue;a.setCurrentIndex(c),l.setCurrentIndex(c);let p=0;z2(l)&&(p|=1),H2(l)&&(p|=2);let u;switch(p){case 1:u="fina";break;case 2:u="init";break;case 3:u="medi";break}if(i.indexOf(u)===-1)continue;let d=this.query.lookupFeature({tag:u,script:e,contextParams:a});if(d instanceof Error){console.info(d.message);continue}for(let m=0;m<d.length;m++){let v=d[m];v instanceof Ft&&(is(v,r,m),a.context[m]=v.substitution)}}}let W2=j2;function Io(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function X2(o){let e="arab",i=this.tokenizer.getRangeTokens(o),r=Io(i);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"rlig",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];is(h,i,a)}r=Io(i)}}}let Z2=X2;function Y2(o){let e=o.current,i=o.get(-1);return i===null&&Ws(e)||!Ws(i)&&Ws(e)}function K2(o){let e=o.get(1);return e===null||!Ws(e)}let q2={startCheck:Y2,endCheck:K2};function Ao(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function Q2(o){let e="latn",i=this.tokenizer.getRangeTokens(o),r=Ao(i);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"liga",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];is(h,i,a)}r=Ao(i)}}}let J2=Q2;function $2(o){let e=o.current,i=o.get(-1);return i===null&&js(e)||!js(i)&&js(e)}function ep(o){let e=o.get(1);return e===null||!js(e)}let tp={startCheck:$2,endCheck:ep};function _o(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function sp(o){let e="thai",i=this.tokenizer.getRangeTokens(o),r=_o(i,0);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"ccmp",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];is(h,i,a)}r=_o(i,a)}}}let np=sp;function Bo(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function ip(o){let e="thai",i=this.tokenizer.getRangeTokens(o),r=Bo(i,0);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"liga",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];is(h,i,a)}r=Bo(i,a)}}}let op=ip;function Ro(o,e){let i=o.map(r=>r.activeState.value);return new He(i,e||0)}function rp(o){let e="thai",i=this.tokenizer.getRangeTokens(o),r=Ro(i,0);for(let a=0;a<r.context.length;a++){r.setCurrentIndex(a);let l=this.query.lookupFeature({tag:"rlig",script:e,contextParams:r});if(l.length){for(let c=0;c<l.length;c++){let h=l[c];is(h,i,a)}r=Ro(i,a)}}}let ap=rp;function Fn(o){if(o===null)return!1;let e=o.codePointAt(0);return e>=6155&&e<=6157||e>=65024&&e<=65039||e>=917760&&e<=917999}function lp(o){let e=o.current,i=o.get(1);return i===null&&Fn(e)||Fn(i)}function cp(o){let e=o.get(1);return e===null||!Fn(e)}let hp={startCheck:lp,endCheck:cp};function up(o){let e=this.query.font,i=this.tokenizer.getRangeTokens(o);if(i[1].setState("deleted",!0),e.tables.cmap&&e.tables.cmap.varSelectorList){let r=i[0].char.codePointAt(0),a=i[1].char.codePointAt(0),l=e.tables.cmap.varSelectorList[a];if(l!==void 0&&l.nonDefaultUVS){let c=l.nonDefaultUVS.uvsMappings;if(c[r]){let h=c[r].glyphID;e.glyphs.glyphs[h]!==void 0&&i[0].setState("glyphIndex",h)}}}}let pp=up;function $e(o){this.baseDir=o||"ltr",this.tokenizer=new E2,this.featuresTags={}}$e.prototype.setText=function(o){this.text=o};$e.prototype.contextChecks={latinWordCheck:q2,arabicWordCheck:R2,arabicSentenceCheck:N2,thaiWordCheck:tp,unicodeVariationSequenceCheck:hp};function cs(o){let e=this.contextChecks[`${o}Check`];return this.tokenizer.registerContextChecker(o,e.startCheck,e.endCheck)}function dp(){return cs.call(this,"latinWord"),cs.call(this,"arabicWord"),cs.call(this,"arabicSentence"),cs.call(this,"thaiWord"),cs.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function fp(){let o=this.tokenizer.getContextRanges("arabicSentence");for(let e=0;e<o.length;e++){let i=o[e],r=this.tokenizer.getRangeTokens(i);this.tokenizer.replaceRange(i.startIndex,i.endOffset,r.reverse())}}$e.prototype.registerFeatures=function(o,e){let i=e.filter(r=>this.query.supports({script:o,tag:r}));Object.prototype.hasOwnProperty.call(this.featuresTags,o)?this.featuresTags[o]=this.featuresTags[o].concat(i):this.featuresTags[o]=i};$e.prototype.applyFeatures=function(o,e){if(!o)throw new Error("No valid font was provided to apply features");this.query||(this.query=new A2(o));for(let i=0;i<e.length;i++){let r=e[i];this.query.supports({script:r.script})&&this.registerFeatures(r.script,r.tags)}};$e.prototype.registerModifier=function(o,e,i){this.tokenizer.registerModifier(o,e,i)};function hn(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function mp(){let o="arab";if(!Object.prototype.hasOwnProperty.call(this.featuresTags,o))return;hn.call(this);let e=this.tokenizer.getContextRanges("arabicWord");for(let i=0;i<e.length;i++){let r=e[i];W2.call(this,r)}}function gp(){if(!this.hasFeatureEnabled("arab","rlig"))return;hn.call(this);let o=this.tokenizer.getContextRanges("arabicWord");for(let e=0;e<o.length;e++){let i=o[e];Z2.call(this,i)}}function yp(){if(!this.hasFeatureEnabled("latn","liga"))return;hn.call(this);let o=this.tokenizer.getContextRanges("latinWord");for(let e=0;e<o.length;e++){let i=o[e];J2.call(this,i)}}function vp(){let o=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let e=0;e<o.length;e++){let i=o[e];pp.call(this,i)}}function bp(){hn.call(this);let o=this.tokenizer.getContextRanges("thaiWord");for(let e=0;e<o.length;e++){let i=o[e];this.hasFeatureEnabled("thai","liga")&&op.call(this,i),this.hasFeatureEnabled("thai","rlig")&&ap.call(this,i),this.hasFeatureEnabled("thai","ccmp")&&np.call(this,i)}}$e.prototype.checkContextReady=function(o){return!!this.tokenizer.getContext(o)};$e.prototype.applyFeaturesToContexts=function(){this.checkContextReady("arabicWord")&&(mp.call(this),gp.call(this)),this.checkContextReady("latinWord")&&yp.call(this),this.checkContextReady("arabicSentence")&&fp.call(this),this.checkContextReady("thaiWord")&&bp.call(this),this.checkContextReady("unicodeVariationSequence")&&vp.call(this)};$e.prototype.hasFeatureEnabled=function(o,e){return(this.featuresTags[o]||[]).indexOf(e)!==-1};$e.prototype.processText=function(o){(!this.text||this.text!==o)&&(this.setText(o),dp.call(this),this.applyFeaturesToContexts())};$e.prototype.getBidiText=function(o){return this.processText(o),this.tokenizer.getText()};$e.prototype.getTextGlyphs=function(o){this.processText(o);let e=[];for(let i=0;i<this.tokenizer.tokens.length;i++){let r=this.tokenizer.tokens[i];if(r.state.deleted)continue;let a=r.activeState.value;e.push(Array.isArray(a)?a[0]:a)}return e};let xp=$e;function Tn(o){return{fontFamily:{en:o.familyName||" "},fontSubfamily:{en:o.styleName||" "},fullName:{en:o.fullName||o.familyName+" "+o.styleName},postScriptName:{en:o.postScriptName||(o.familyName+o.styleName).replace(/\s/g,"")},designer:{en:o.designer||" "},designerURL:{en:o.designerURL||" "},manufacturer:{en:o.manufacturer||" "},manufacturerURL:{en:o.manufacturerURL||" "},license:{en:o.license||" "},licenseURL:{en:o.licenseURL||" "},version:{en:o.version||"Version 0.1"},description:{en:o.description||" "},copyright:{en:o.copyright||" "},trademark:{en:o.trademark||" "}}}function we(o){o=o||{},o.tables=o.tables||{},o.empty||(ls(o.familyName,"When creating a new Font object, familyName is required."),ls(o.styleName,"When creating a new Font object, styleName is required."),ls(o.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),ls(o.ascender,"When creating a new Font object, ascender is required."),ls(o.descender<=0,"When creating a new Font object, negative descender value is required."),this.names={},this.names.unicode=Tn(o),this.names.macintosh=Tn(o),this.names.windows=Tn(o),this.unitsPerEm=o.unitsPerEm||1e3,this.ascender=o.ascender,this.descender=o.descender,this.createdTimestamp=o.createdTimestamp,this.tables=Object.assign(o.tables,{os2:Object.assign({usWeightClass:o.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:o.widthClass||this.usWidthClasses.MEDIUM,fsSelection:o.fsSelection||this.fsSelectionValues.REGULAR},o.tables.os2)})),this.supported=!0,this.glyphs=new pt.GlyphSet(this,o.glyphs||[]),this.encoding=new fr(this),this.position=new F0(this),this.substitution=new U0(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new x2(this):null}})}we.prototype.hasChar=function(o){return this.encoding.charToGlyphIndex(o)!==null};we.prototype.charToGlyphIndex=function(o){return this.encoding.charToGlyphIndex(o)};we.prototype.charToGlyph=function(o){let e=this.charToGlyphIndex(o),i=this.glyphs.get(e);return i||(i=this.glyphs.get(0)),i};we.prototype.updateFeatures=function(o){return this.defaultRenderOptions.features.map(e=>e.script==="latn"?{script:"latn",tags:e.tags.filter(i=>o[i])}:e)};we.prototype.stringToGlyphIndexes=function(o,e){let i=new xp,r=l=>this.charToGlyphIndex(l.char);i.registerModifier("glyphIndex",null,r);let a=e?this.updateFeatures(e.features):this.defaultRenderOptions.features;return i.applyFeatures(this,a),i.getTextGlyphs(o)};we.prototype.stringToGlyphs=function(o,e){let i=this.stringToGlyphIndexes(o,e),r=i.length,a=new Array(r),l=this.glyphs.get(0);for(let c=0;c<r;c+=1)a[c]=this.glyphs.get(i[c])||l;return a};we.prototype.nameToGlyphIndex=function(o){return this.glyphNames.nameToGlyphIndex(o)};we.prototype.nameToGlyph=function(o){let e=this.nameToGlyphIndex(o),i=this.glyphs.get(e);return i||(i=this.glyphs.get(0)),i};we.prototype.glyphIndexToName=function(o){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(o):""};we.prototype.getKerningValue=function(o,e){o=o.index||o,e=e.index||e;let i=this.position.defaultKerningTables;return i?this.position.getKerningValue(i,o,e):this.kerningPairs[o+","+e]||0};we.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]},{script:"thai",tags:["liga","rlig","ccmp"]}]};we.prototype.forEachGlyph=function(o,e,i,r,a,l){e=e!==void 0?e:0,i=i!==void 0?i:0,r=r!==void 0?r:72,a=Object.assign({},this.defaultRenderOptions,a);let c=1/this.unitsPerEm*r,h=this.stringToGlyphs(o,a),p;if(a.kerning){let u=a.script||this.position.getDefaultScriptName();p=this.position.getKerningTables(u,a.language)}for(let u=0;u<h.length;u+=1){let d=h[u];if(l.call(this,d,e,i,r,a),d.advanceWidth&&(e+=d.advanceWidth*c),a.kerning&&u<h.length-1){let m=p?this.position.getKerningValue(p,d.index,h[u+1].index):this.getKerningValue(d,h[u+1]);e+=m*c}a.letterSpacing?e+=a.letterSpacing*r:a.tracking&&(e+=a.tracking/1e3*r)}return e};we.prototype.getPath=function(o,e,i,r,a){let l=new Cs;return this.forEachGlyph(o,e,i,r,a,function(c,h,p,u){let d=c.getPath(h,p,u,a,this);l.extend(d)}),l};we.prototype.getPaths=function(o,e,i,r,a){let l=[];return this.forEachGlyph(o,e,i,r,a,function(c,h,p,u){let d=c.getPath(h,p,u,a,this);l.push(d)}),l};we.prototype.getAdvanceWidth=function(o,e,i){return this.forEachGlyph(o,0,0,e,i,function(){})};we.prototype.draw=function(o,e,i,r,a,l){this.getPath(e,i,r,a,l).draw(o)};we.prototype.drawPoints=function(o,e,i,r,a,l){this.forEachGlyph(e,i,r,a,l,function(c,h,p,u){c.drawPoints(o,h,p,u)})};we.prototype.drawMetrics=function(o,e,i,r,a,l){this.forEachGlyph(e,i,r,a,l,function(c,h,p,u){c.drawMetrics(o,h,p,u)})};we.prototype.getEnglishName=function(o){let e=(this.names.unicode||this.names.macintosh||this.names.windows)[o];if(e)return e.en};we.prototype.validate=function(){let o=this;function e(r,a){}function i(r){let a=o.getEnglishName(r);a&&a.trim().length>0}i("fontFamily"),i("weightName"),i("manufacturer"),i("copyright"),i("version"),this.unitsPerEm>0};we.prototype.toTables=function(){return V0.fontToTable(this)};we.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()};we.prototype.toArrayBuffer=function(){let o=this.toTables().encode(),e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(let r=0;r<o.length;r++)i[r]=o[r];return e};we.prototype.download=function(o){let e=this.getEnglishName("fontFamily"),i=this.getEnglishName("fontSubfamily");o=o||e.replace(/\s/g,"")+"-"+i+".otf";let r=this.toArrayBuffer();if(g0())if(window.URL=window.URL||window.webkitURL,window.URL){let a=new DataView(r),l=new Blob([a],{type:"font/opentype"}),c=document.createElement("a");c.href=window.URL.createObjectURL(l),c.download=o;let h=document.createEvent("MouseEvents");h.initEvent("click",!0,!1),c.dispatchEvent(h)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{let a=Ic("fs"),l=Buffer.alloc(r.byteLength),c=new Uint8Array(r);for(let h=0;h<l.length;++h)l[h]=c[h];a.writeFileSync(o,l)}};we.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512};we.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9};we.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};let Cp=we;function wp(){console.warn("Writing of gvar tables is not yet supported.")}function Ep(){console.warn("Parsing of gvar tables is not yet supported.")}let Sp={make:wp,parse:Ep},Tp=function(){return{coverage:this.parsePointer(N.coverage),attachPoints:this.parseList(N.pointer(N.uShortList))}},Lp=function(){let o=this.parseUShort();if(ne.argument(o===1||o===2||o===3,"Unsupported CaretValue table version."),o===1)return{coordinate:this.parseShort()};if(o===2)return{pointindex:this.parseShort()};if(o===3)return{coordinate:this.parseShort()}},kp=function(){return this.parseList(N.pointer(Lp))},Mp=function(){return{coverage:this.parsePointer(N.coverage),ligGlyphs:this.parseList(N.pointer(kp))}},Ip=function(){return this.parseUShort(),this.parseList(N.pointer(N.coverage))};function Ap(o,e){e=e||0;let i=new N(o,e),r=i.parseVersion(1);ne.argument(r===1||r===1.2||r===1.3,"Unsupported GDEF table version.");let a={version:r,classDef:i.parsePointer(N.classDef),attachList:i.parsePointer(Tp),ligCaretList:i.parsePointer(Mp),markAttachClassDef:i.parsePointer(N.classDef)};return r>=1.2&&(a.markGlyphSets=i.parsePointer(Ip)),a}let _p={parse:Ap},nt=new Array(10);nt[1]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{posFormat:1,coverage:this.parsePointer(N.coverage),value:this.parseValueRecord()};if(e===2)return{posFormat:2,coverage:this.parsePointer(N.coverage),values:this.parseValueRecordList()};ne.assert(!1,"0x"+o.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")};nt[2]=function(){let o=this.offset+this.relativeOffset,e=this.parseUShort();ne.assert(e===1||e===2,"0x"+o.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let i=this.parsePointer(N.coverage),r=this.parseUShort(),a=this.parseUShort();if(e===1)return{posFormat:e,coverage:i,valueFormat1:r,valueFormat2:a,pairSets:this.parseList(N.pointer(N.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(r),value2:this.parseValueRecord(a)}})))};if(e===2){let l=this.parsePointer(N.classDef),c=this.parsePointer(N.classDef),h=this.parseUShort(),p=this.parseUShort();return{posFormat:e,coverage:i,valueFormat1:r,valueFormat2:a,classDef1:l,classDef2:c,class1Count:h,class2Count:p,classRecords:this.parseList(h,N.list(p,function(){return{value1:this.parseValueRecord(r),value2:this.parseValueRecord(a)}}))}}};nt[3]=function(){return{error:"GPOS Lookup 3 not supported"}};nt[4]=function(){return{error:"GPOS Lookup 4 not supported"}};nt[5]=function(){return{error:"GPOS Lookup 5 not supported"}};nt[6]=function(){return{error:"GPOS Lookup 6 not supported"}};nt[7]=function(){return{error:"GPOS Lookup 7 not supported"}};nt[8]=function(){return{error:"GPOS Lookup 8 not supported"}};nt[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function Bp(o,e){e=e||0;let i=new N(o,e),r=i.parseVersion(1);return ne.argument(r===1||r===1.1,"Unsupported GPOS table version "+r),r===1?{version:r,scripts:i.parseScriptList(),features:i.parseFeatureList(),lookups:i.parseLookupList(nt)}:{version:r,scripts:i.parseScriptList(),features:i.parseFeatureList(),lookups:i.parseLookupList(nt),variations:i.parseFeatureVariationsList()}}let Rp=new Array(10);function Op(o){return new X.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new X.ScriptList(o.scripts)},{name:"features",type:"TABLE",value:new X.FeatureList(o.features)},{name:"lookups",type:"TABLE",value:new X.LookupList(o.lookups,Rp)}])}let Dp={parse:Bp,make:Op};function Np(o){let e={};o.skip("uShort");let i=o.parseUShort();ne.argument(i===0,"Unsupported kern sub-table version."),o.skip("uShort",2);let r=o.parseUShort();o.skip("uShort",3);for(let a=0;a<r;a+=1){let l=o.parseUShort(),c=o.parseUShort(),h=o.parseShort();e[l+","+c]=h}return e}function Pp(o){let e={};o.skip("uShort"),o.parseULong()>1&&console.warn("Only the first kern subtable is supported."),o.skip("uLong");let i=o.parseUShort()&255;if(o.skip("uShort"),i===0){let r=o.parseUShort();o.skip("uShort",3);for(let a=0;a<r;a+=1){let l=o.parseUShort(),c=o.parseUShort(),h=o.parseShort();e[l+","+c]=h}}return e}function Vp(o,e){let i=new te.Parser(o,e),r=i.parseUShort();if(r===0)return Np(i);if(r===1)return Pp(i);throw new Error("Unsupported kern table version ("+r+").")}let Fp={parse:Vp};function Up(o,e,i,r){let a=new te.Parser(o,e),l=r?a.parseUShort:a.parseULong,c=[];for(let h=0;h<i+1;h+=1){let p=l.call(a);r&&(p*=2),c.push(p)}return c}let Gp={parse:Up};function Oo(o,e){let i=[],r=12;for(let a=0;a<e;a+=1){let l=te.getTag(o,r),c=te.getULong(o,r+4),h=te.getULong(o,r+8),p=te.getULong(o,r+12);i.push({tag:l,checksum:c,offset:h,length:p,compression:!1}),r+=16}return i}function zp(o,e){let i=[],r=44;for(let a=0;a<e;a+=1){let l=te.getTag(o,r),c=te.getULong(o,r+4),h=te.getULong(o,r+8),p=te.getULong(o,r+12),u;h<p?u="WOFF":u=!1,i.push({tag:l,offset:c,compression:u,compressedLength:h,length:p}),r+=20}return i}function Ce(o,e){if(e.compression==="WOFF"){let i=new Uint8Array(o.buffer,e.offset+2,e.compressedLength-2),r=new Uint8Array(e.length);if(Nc(i,r),r.byteLength!==e.length)throw new Error("Decompression error: "+e.tag+" decompressed length doesn't match recorded length");return{data:new DataView(r.buffer,0),offset:0}}else return{data:o,offset:e.offset}}function Hp(o,e={}){let i,r,a=new Cp({empty:!0});o.constructor!==ArrayBuffer&&(o=new Uint8Array(o).buffer);let l=new DataView(o,0),c,h=[],p=te.getTag(l,0);if(p===String.fromCharCode(0,1,0,0)||p==="true"||p==="typ1")a.outlinesFormat="truetype",c=te.getUShort(l,4),h=Oo(l,c);else if(p==="OTTO")a.outlinesFormat="cff",c=te.getUShort(l,4),h=Oo(l,c);else if(p==="wOFF"){let H=te.getTag(l,4);if(H===String.fromCharCode(0,1,0,0))a.outlinesFormat="truetype";else if(H==="OTTO")a.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+p);c=te.getUShort(l,12),h=zp(l,c)}else if(p==="wOF2"){let H="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+H)}else throw new Error("Unsupported OpenType signature "+p);let u,d,m,v,y,x,b,C,T,A,O,P,V,B,I,G;for(let H=0;H<c;H+=1){let ee=h[H],$;switch(ee.tag){case"avar":x=ee;break;case"cmap":$=Ce(l,ee),a.tables.cmap=dr.parse($.data,$.offset),a.encoding=new mr(a.tables.cmap);break;case"cvt ":$=Ce(l,ee),G=new te.Parser($.data,$.offset),a.tables.cvt=G.parseShortList(ee.length/2);break;case"fvar":m=ee;break;case"STAT":v=ee;break;case"gvar":y=ee;break;case"fpgm":$=Ce(l,ee),G=new te.Parser($.data,$.offset),a.tables.fpgm=G.parseByteList(ee.length);break;case"head":$=Ce(l,ee),a.tables.head=Er.parse($.data,$.offset),a.unitsPerEm=a.tables.head.unitsPerEm,i=a.tables.head.indexToLocFormat;break;case"hhea":$=Ce(l,ee),a.tables.hhea=Sr.parse($.data,$.offset),a.ascender=a.tables.hhea.ascender,a.descender=a.tables.hhea.descender,a.numberOfHMetrics=a.tables.hhea.numberOfHMetrics;break;case"hmtx":O=ee;break;case"ltag":$=Ce(l,ee),r=Lr.parse($.data,$.offset);break;case"COLR":$=Ce(l,ee),a.tables.colr=Pr.parse($.data,$.offset);break;case"CPAL":$=Ce(l,ee),a.tables.cpal=Vr.parse($.data,$.offset);break;case"maxp":$=Ce(l,ee),a.tables.maxp=kr.parse($.data,$.offset),a.numGlyphs=a.tables.maxp.numGlyphs;break;case"name":B=ee;break;case"OS/2":$=Ce(l,ee),a.tables.os2=Nn.parse($.data,$.offset);break;case"post":$=Ce(l,ee),a.tables.post=Or.parse($.data,$.offset),a.glyphNames=new ui(a.tables.post);break;case"prep":$=Ce(l,ee),G=new te.Parser($.data,$.offset),a.tables.prep=G.parseByteList(ee.length);break;case"glyf":b=ee;break;case"loca":V=ee;break;case"CFF ":u=ee;break;case"CFF2":d=ee;break;case"kern":P=ee;break;case"GDEF":C=ee;break;case"GPOS":T=ee;break;case"GSUB":A=ee;break;case"meta":I=ee;break;case"gasp":$=Ce(l,ee),a.tables.gasp=Hr.parse($.data,$.offset);break}}let W=Ce(l,B);if(a.tables.name=Rr.parse(W.data,W.offset,r),a.names=a.tables.name,b&&V){let H=i===0,ee=Ce(l,V),$=Gp.parse(ee.data,ee.offset,a.numGlyphs,H),de=Ce(l,b);a.glyphs=Kr.parse(de.data,de.offset,$,a,e)}else if(u){let H=Ce(l,u);Rn.parse(H.data,H.offset,a,e)}else if(d){let H=Ce(l,d);Rn.parse(H.data,H.offset,a,e)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let j=Ce(l,O);if(Tr.parse(a,j.data,j.offset,a.numberOfHMetrics,a.numGlyphs,a.glyphs,e),lh(a,e),P){let H=Ce(l,P);a.kerningPairs=Fp.parse(H.data,H.offset)}else a.kerningPairs={};if(C){let H=Ce(l,C);a.tables.gdef=_p.parse(H.data,H.offset)}if(T){let H=Ce(l,T);a.tables.gpos=Dp.parse(H.data,H.offset),a.position.init()}if(A){let H=Ce(l,A);a.tables.gsub=Dr.parse(H.data,H.offset)}if(m){let H=Ce(l,m);a.tables.fvar=Ur.parse(H.data,H.offset,a.names)}if(v){let H=Ce(l,v);a.tables.stat=Gr.parse(H.data,H.offset,a.tables.fvar)}if(y){m||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),b||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let H=Ce(l,y);a.tables.gvar=Sp.parse(H.data,H.offset,a.names)}if(x){m||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let H=Ce(l,x);a.tables.avar=zr.parse(H.data,H.offset,a.tables.fvar)}if(I){let H=Ce(l,I);a.tables.meta=Nr.parse(H.data,H.offset),a.metas=a.tables.meta}return a}const hs="DxfWorkerMsg";class Ze{constructor(e,i=!1){this.worker=e,i?e.onmessage=this._ProcessRequest.bind(this):e&&(e.addEventListener("message",this._ProcessResponse.bind(this),!1),e.addEventListener("error",this._OnError.bind(this),!1),this.reqSeq=1,this.requests=new Map,this.progressCbk=null)}async Load(e,i,r,a){return this.worker?this._SendRequest(Ze.WorkerMsg.LOAD,{url:e,fonts:i,options:this._CloneOptions(r)},a):this._Load(e,i,r,a)}async Destroy(e=!1){this.worker&&(e||await this._SendRequest(Ze.WorkerMsg.DESTROY),this.worker.terminate())}async _ProcessRequest(e){const i=e.data;if(i.signature!==hs)return;const r={seq:i.seq,type:i.type,signature:hs},a=[];try{r.data=await this._ProcessRequestMessage(i.type,i.data,a,i.seq)}catch(l){console.error(l),r.error=String(l)}this.worker.postMessage(r,a),i.type===Ze.WorkerMsg.DESTROY&&(this.worker.onmessage=null,this.worker.close(),this.worker=null)}async _ProcessRequestMessage(e,i,r,a){switch(e){case Ze.WorkerMsg.LOAD:{const l=await this._Load(i.url,i.fonts,i.options,(c,h,p)=>this._SendProgress(a,c,h,p));return r.push(l.vertices),r.push(l.indices),r.push(l.transforms),l}case Ze.WorkerMsg.DESTROY:return null;default:throw"Unknown message type: "+e}}async _ProcessResponse(e){const i=e.data;if(i.signature!==hs)return;const r=i.seq,a=this.requests.get(r);if(!a){console.error("Unmatched message sequence: ",r);return}const l=i.data;if(i.type===Ze.WorkerMsg.PROGRESS&&a.progressCbk){a.progressCbk(l.phase,l.size,l.totalSize);return}this.requests.delete(r),i.hasOwnProperty("error")?a.SetError(i.error):a.SetResponse(l)}async _OnError(e){console.error("DxfWorker worker error",e);const i=Array.from(this.requests.values);this.requests.clear(),i.forEach(r=>r.SetError(e))}async _SendRequest(e,i=null,r=null){const a=this.reqSeq++,l=new Ze.Request(a,r);return this.requests.set(a,l),this.worker.postMessage({seq:a,type:e,data:i,signature:hs}),await l.GetResponse()}_SendProgress(e,i,r,a){this.worker.postMessage({seq:e,type:Ze.WorkerMsg.PROGRESS,data:{phase:i,size:r,totalSize:a},signature:hs})}async _Load(e,i,r,a){let l;i?l=this._CreateFontFetchers(i,a):l=[];const c=await new mc(e).Fetch(a);a&&a("prepare",0,null);const h=new xs(r);return await h.Build(c,l),h.scene}_CreateFontFetchers(e,i){function r(l){return async function(){i&&i("font",0,null);const c=await fetch(l).then(h=>h.arrayBuffer());return i&&i("prepare",0,null),Hp(c)}}const a=[];for(const l of e)a.push(r(l));return a}_CloneOptions(e){if(Array.isArray(e))return e.map(i=>this._CloneOptions(i));if(typeof e=="object"&&e!==null){const i={};for(const r in e)i[r]=this._CloneOptions(e[r]);return i}else return e}}Ze.WorkerMsg={LOAD:"LOAD",PROGRESS:"PROGRESS",DESTROY:"DESTROY"};Ze.Request=class{constructor(o,e){this.seq=o,this.progressCbk=e,this.promise=new Promise((i,r)=>{this._Resolve=i,this._Reject=r})}async GetResponse(){return await this.promise}SetResponse(o){this._Resolve(o)}SetError(o){this._Reject(o)}};class Do{constructor(e,i,r,a){this.instanceType=e,this.geometryType=i??null,this.color=r,this.lineType=a??null}Compare(e){let i=mt(this.instanceType,e.instanceType);return i!==0||(i=mt(this.geometryType,e.geometryType),i!==0)||(i=mt(this.color,e.color),i!==0)?i:mt(this.lineType,e.lineType)}}function Qt(o){return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}function Ln(o){return o<.003?o*12.92:Math.pow(o,1/2.4)*1.055-.055}function Un(o){const e=Qt(((o&16711680)>>>16)/255),i=Qt(((o&65280)>>>8)/255),r=Qt((o&255)/255);return e*.2126+i*.7152+r*.0722}function jp(o,e){return(Un(o)+.05)/(Un(e)+.05)}function xi({h:o,l:e,s:i}){let r,a,l;if(i===0)r=a=l=e;else{let c=function(u,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?u+(d-u)*6*m:m<1/2?d:m<2/3?u+(d-u)*(2/3-m)*6:u};const h=e<.5?e*(1+i):e+i-e*i,p=2*e-h;r=c(p,h,o+1/3),a=c(p,h,o),l=c(p,h,o-1/3)}return Math.min(Math.floor(Ln(r)*256),255)<<16|Math.min(Math.floor(Ln(a)*256),255)<<8|Math.min(Math.floor(Ln(l)*256),255)}function Ci(o){const e=Qt(((o&16711680)>>>16)/255),i=Qt(((o&65280)>>>8)/255),r=Qt((o&255)/255),a=Math.max(e,i,r),l=Math.min(e,i,r);let c=0,h=0;const p=(a+l)/2;if(a===l)c=h=0;else{const u=a-l;switch(h=p>.5?u/(2-a-l):u/(a+l),a){case e:c=(i-r)/u+(i<r?6:0);break;case i:c=(r-e)/u+2;break;case r:c=(e-i)/u+4;break}c/=6}return{h:c,l:p,s:h}}function Wp(o,e){const i=Ci(o);return i.l*=e,i.l>1&&(i.l=1),xi(i)}function Xp(o,e){const i=Ci(o);return i.l/=e,xi(i)}const Zp={HlsToRgb:xi,RgbToHls:Ci,Lighten:Wp,Darken:Xp,Luminance:Un,ContrastRatio:jp},Yt=Zp;class un extends Te.Group{constructor(){super();L(this,"dxfLayers");this.addEventListener("destory",()=>{this.traverse(i=>{i.geometry&&i.material&&(i.geometry.dispose(),i.material.dispose&&i.material.dispose())}),this.clear(),this.parent&&this.parent.remove(this)})}GetLayers(){const i=[];for(const r of this.dxfLayers.values())i.push({name:r.name,color:r.color,state:!0});return i}ShowLayer(i,r){const a=this.dxfLayers.get(i);if(a)for(const l of a.objects)l.visible=r}}class Gt{constructor(){L(this,"clearColor",0);L(this,"scene",new un);this.options=Object.create(Gt.DefaultOptions),this.scene.rotateX(-Math.PI/2),this.simpleColorMaterial=[],this.simplePointMaterial=[];for(let e=0;e<Fe.MAX;e++)this.simpleColorMaterial[e]=this._CreateSimpleColorMaterial(e),this.simplePointMaterial[e]=this._CreateSimplePointMaterial(e);this.materials=new tr((e,i)=>e.key.Compare(i.key)),this.layers=new Map,this.blocks=new Map,this.worker=null}async Load({url:e,fonts:i=null,progressCbk:r=null,workerFactory:a=null}){this.worker=new Ze(a?a():null);const l=await this.worker.Load(e,i,this.options,r);await this.worker.Destroy(),this.worker=null,this.origin=l.origin,this.bounds=l.bounds,this.hasMissingChars=l.hasMissingChars;for(const c of l.layers)this.layers.set(c.name,new Yp(c.name,c.color));for(const c of l.batches)if(c.key.blockName!==null&&c.key.geometryType!==fe.GeometryType.BLOCK_INSTANCE&&c.key.geometryType!==fe.GeometryType.POINT_INSTANCE){let h=this.blocks.get(c.key.blockName);h||(h=new Kp,this.blocks.set(c.key.blockName,h)),h.PushBatch(new No(this,l,c))}for(const c of l.batches)this._LoadBatch(l,c);return this.scene.dxfLayers=this.layers,this.scene}_LoadBatch(e,i){if(i.key.blockName!==null&&i.key.geometryType!==fe.GeometryType.BLOCK_INSTANCE&&i.key.geometryType!==fe.GeometryType.POINT_INSTANCE)return;const r=new No(this,e,i).CreateObjects(),a=this.layers.get(i.key.layerName);for(const l of r)this.scene.add(l),a&&a.PushObject(l)}_GetSimpleColorMaterial(e,i=Fe.NONE){const r=new Do(i,null,e,0);let a=this.materials.find({key:r});return a!==null||(a={key:r,material:this._CreateSimpleColorMaterialInstance(e,i)},this.materials.insert(a)),a.material}_CreateSimpleColorMaterial(e=Fe.NONE){const i=this._GenerateShaders(e,!1);return new Te.RawShaderMaterial({uniforms:{color:{value:new Te.Color(16711935)}},vertexShader:i.vertex,fragmentShader:i.fragment,depthTest:!1,depthWrite:!1,glslVersion:Te.GLSL3,side:Te.DoubleSide})}_CreateSimpleColorMaterialInstance(e,i=Fe.NONE){const a=this.simpleColorMaterial[i].clone();return a.uniforms.color={value:new Te.Color(e)},a}_GetSimplePointMaterial(e,i=Fe.NONE){const r=new Do(i,fe.GeometryType.POINTS,e,0);let a=this.materials.find({key:r});return a!==null||(a={key:r,material:this._CreateSimplePointMaterialInstance(e,this.options.pointSize,i)},this.materials.insert(a)),a.material}_CreateSimplePointMaterial(e=Fe.NONE){const i=this._GenerateShaders(e,!0);return new Te.RawShaderMaterial({uniforms:{color:{value:new Te.Color(16711935)},pointSize:{value:2}},vertexShader:i.vertex,fragmentShader:i.fragment,depthTest:!1,depthWrite:!1,glslVersion:Te.GLSL3})}_CreateSimplePointMaterialInstance(e,i=2,r=Fe.NONE){const l=this.simplePointMaterial[r].clone();return l.uniforms.color={value:new Te.Color(e)},l.uniforms.size={value:i},l}_GenerateShaders(e,i){const r=e===Fe.FULL?`
8
8
  /* First row. */
9
9
  in vec3 instanceTransform0;
10
10
  /* Second row. */
@@ -45,7 +45,7 @@
45
45
  void main() {
46
46
  fragColor = vec4(color, 1.0);
47
47
  }
48
- `}}_TransformColor(e){if(!this.options.colorCorrection&&!this.options.blackWhiteInversion)return e;const i=Yt.Luminance(this.clearColor);if(e===16777215&&i>=.8)return 0;if(e===0&&i<=.2)return 16777215;if(!this.options.colorCorrection)return e;const r=Yt.Luminance(e),a=1.5,l=Yt.ContrastRatio(e,this.clearColor);if((l>=1?l:1/l)<a){let h;i>.5?h=i/2:h=i*2,h>r?e=Yt.Lighten(e,h/r):e=Yt.Darken(e,r/h)}return e}}Gt.DefaultOptions={canvasWidth:400,canvasHeight:300,autoResize:!1,clearColor:new Se.Color("#000"),clearAlpha:1,canvasAlpha:!1,canvasPremultipliedAlpha:!0,antialias:!0,colorCorrection:!1,blackWhiteInversion:!0,pointSize:2,arcTessellationAngle:6/180*Math.PI,sceneOptions:bs.DefaultOptions};Gt.SetupWorker=function(){new Ze(self,!0)};const Fe=Object.freeze({NONE:0,FULL:1,POINT:2,MAX:3});class No{constructor(e,i,r){if(this.viewer=e,this.key=r.key,r.hasOwnProperty("verticesOffset")){const a=new Float32Array(i.vertices,r.verticesOffset*Float32Array.BYTES_PER_ELEMENT,r.verticesSize);(this.key.geometryType!==pe.GeometryType.POINT_INSTANCE||i.pointShapeHasDot)&&(this.vertices=new Se.BufferAttribute(a,2)),this.key.geometryType===pe.GeometryType.POINT_INSTANCE&&(this.transforms=new Se.InstancedBufferAttribute(a,2))}if(r.hasOwnProperty("chunks")){this.chunks=[];for(const a of r.chunks){const l=new Float32Array(i.vertices,a.verticesOffset*Float32Array.BYTES_PER_ELEMENT,a.verticesSize),c=new Uint16Array(i.indices,a.indicesOffset*Uint16Array.BYTES_PER_ELEMENT,a.indicesSize);this.chunks.push({vertices:new Se.BufferAttribute(l,2),indices:new Se.BufferAttribute(c,1)})}}if(r.hasOwnProperty("transformsOffset")){const a=new Float32Array(i.transforms,r.transformsOffset*Float32Array.BYTES_PER_ELEMENT,r.transformsSize),l=new Se.InstancedInterleavedBuffer(a,6);this.transforms0=new Se.InterleavedBufferAttribute(l,3,0),this.transforms1=new Se.InterleavedBufferAttribute(l,3,3)}if(this.key.geometryType===pe.GeometryType.BLOCK_INSTANCE||this.key.geometryType===pe.GeometryType.POINT_INSTANCE){const a=this.viewer.layers.get(this.key.layerName);a?this.layerColor=a.color:this.layerColor=0}}GetInstanceType(){switch(this.key.geometryType){case pe.GeometryType.BLOCK_INSTANCE:return Fe.FULL;case pe.GeometryType.POINT_INSTANCE:return Fe.POINT;default:return Fe.NONE}}*CreateObjects(e=null){if(this.key.geometryType===pe.GeometryType.BLOCK_INSTANCE||this.key.geometryType===pe.GeometryType.POINT_INSTANCE){if(e!==null)throw new Error("Unexpected instance batch specified for instance batch");yield*this._CreateBlockInstanceObjects();return}yield*this._CreateObjects(e)}*_CreateObjects(e){const i=e?e._GetInstanceColor(this.key.color):this.key.color,a=(this.key.geometryType===pe.GeometryType.POINTS||this.key.geometryType===pe.GeometryType.POINT_INSTANCE?this.viewer._GetSimplePointMaterial:this.viewer._GetSimpleColorMaterial).call(this.viewer,this.viewer._TransformColor(i),(e==null?void 0:e.GetInstanceType())??Fe.NONE);let l;switch(this.key.geometryType){case pe.GeometryType.POINTS:case pe.GeometryType.POINT_INSTANCE:l=Se.Points;break;case pe.GeometryType.LINES:case pe.GeometryType.INDEXED_LINES:l=Se.LineSegments;break;case pe.GeometryType.TRIANGLES:case pe.GeometryType.INDEXED_TRIANGLES:l=Se.Mesh;break;default:throw new Error("Unexpected geometry type:"+this.key.geometryType)}function c(h,p){const u=e?new Se.InstancedBufferGeometry:new Se.BufferGeometry,d=h.array,m=[];for(let g=0;g<d.length;g+=2)m.push(new Se.Vector3(d[g],d[g+1],0));u.setFromPoints(m),e==null||e._SetInstanceTransformAttribute(u),p&&u.setIndex(p),u.computeBoundingSphere();const v=new l(u,a);return v.frustumCulled=!1,v.matrixAutoUpdate=!1,v.userData={vertices:m},v}if(this.chunks)for(const h of this.chunks)yield c(h.vertices,h.indices);else yield c(this.vertices)}_SetInstanceTransformAttribute(e){if(!e.isInstancedBufferGeometry)throw new Error("InstancedBufferGeometry expected");this.key.geometryType===pe.GeometryType.POINT_INSTANCE?e.setAttribute("instanceTransform",this.transforms):(e.setAttribute("instanceTransform0",this.transforms0),e.setAttribute("instanceTransform1",this.transforms1))}*_CreateBlockInstanceObjects(){const e=this.viewer.blocks.get(this.key.blockName);if(e){for(const i of e.batches)yield*i.CreateObjects(this);this.hasOwnProperty("vertices")&&(yield*this._CreateObjects())}}_GetInstanceColor(e){return e===Je.BY_BLOCK?this.key.color:e===Je.BY_LAYER?this.layerColor:e}}class Yp{constructor(e,i){this.name=e,this.color=i,this.objects=[]}PushObject(e){this.objects.push(e)}Dispose(){for(const e of this.objects)e.geometry.dispose();this.objects=null}}class Kp{constructor(){this.batches=[]}PushBatch(e){this.batches.push(e)}}class na{constructor(e,i){L(this,"rays");L(this,"step");L(this,"state");L(this,"element");L(this,"raycaster",new f.Raycaster);L(this,"camera");L(this,"point",new f.Vector3);L(this,"currentObj");L(this,"group");L(this,"points");L(this,"curr_line");L(this,"down");L(this,"pointMesh");L(this,"callback");L(this,"viewer");L(this,"start",new f.Vector2);L(this,"end",new f.Vector2);L(this,"events");L(this,"plane",new f.Plane(new f.Vector3(0,1,0)));L(this,"lastClickPos",new f.Vector2(-9999,-9999));L(this,"lastClickTime",0);L(this,"UNIT");this.rays=[],this.viewer=e,this.step=0,this.state="",this.element=e.element,this.camera=e.camera,this.currentObj=null,this.group=e.containerGroup,this.points=[],this.down=!1,this.raycaster.params.Line.threshold=100,this.callback=i.callback;const r=e.containerGroup.getObjectByName("curr_line");if(r)this.curr_line=r,this.pointMesh=e.containerGroup.getObjectByName("move_point");else{this.curr_line=new ze({vertexs:[0,0,0,0,0,0],color:16358667,lineWidth:.002,name:"curr_line",transparent:!0});const a=Ho("");this.curr_line.add(a),this.curr_line.visible=!1,a.visible=!1,e.containerGroup.add(this.curr_line),Mn.sizeAttenuation=!1,this.pointMesh=new f.Sprite(Mn),this.pointMesh.name="move_point",this.pointMesh.visible=!1,e.containerGroup.add(this.pointMesh)}this.events={pointerup:this.upEvent.bind(this),pointerdown:this.downEvent.bind(this),pointermove:this.mouseMoveEvent.bind(this),keydown:this.handleKeyDown.bind(this)},this.UNIT={unit:"mm",precision:"2"},this.initEvents()}initEvents(){for(const e in this.viewer.objs)this.viewer.objs[e]instanceof un&&this.viewer.objs[e].traverse(i=>{i instanceof f.Line&&this.rays.push(i)});this.element.addEventListener("pointerup",this.events.pointerup),this.element.addEventListener("pointerdown",this.events.pointerdown),this.element.addEventListener("pointermove",this.events.pointermove),window.addEventListener("keydown",this.events.keydown),this.group.children.forEach(e=>{e.userData.type=="measure"&&(e.visible=!0)})}mouseMoveEvent(e){if(this.state=="")return;if(this.down){this.end.set(e.clientX,e.clientY);return}if(this.viewer.camera instanceof f.OrthographicCamera){const u=1/this.viewer.camera.zoom,d=this.viewer.camera.top-this.viewer.camera.bottom,m=u*d/150;this.pointMesh.scale.set(m,m,1)}const i=this.element.getBoundingClientRect(),r=i.width,a=i.height,l=e.clientY-i.top,c=e.clientX-i.left,h={x:0,y:0};h.x=c/r*2-1,h.y=-(l/a)*2+1,this.raycaster.setFromCamera(h,this.camera);const p=this.raycaster.intersectObjects(this.rays,!1);if(this.currentObj=null,p.length<1||!p[0].point)this.raycaster.ray.intersectPlane(this.plane,this.point),this.pointMesh.material.color.set(255);else{const u=p[0].point;this.point.copy(u),this.currentObj=p[0].object,this.pointMesh.material.color.set(16773120)}if(this.points[this.step]=this.point.clone(),this.pointMesh.position.copy(this.point),this.curr_line.setVertexs(this.points),this.state=="angle"&&this.step>1){const u=fs(this.points).toFixed(Number(this.UNIT.precision));this.curr_line.children[0].element.innerHTML=u+"°",this.curr_line.children[0].position.lerpVectors(this.points[1],this.points[2],.5)}else if(this.state=="distance"&&this.step>0){const u=this.points[0].distanceTo(this.points[1]),d=this.judeUnit(this.UNIT.unit,u,Number(this.UNIT.precision))+this.UNIT.unit;this.curr_line.children[0].element.innerHTML=d,this.curr_line.children[0].position.lerpVectors(this.points[0],this.points[1],.5)}else if(this.state=="area"&&this.step>=2){const u=this.points.slice(0,this.step);if(u.length>=3){const d=Ks(u),m=this.judeAreaUnit(this.UNIT.unit,Number(d),Number(this.UNIT.precision));this.curr_line.children[0].element.innerHTML=m;const v=new f.Vector3;u.forEach(g=>v.add(g)),v.divideScalar(u.length),this.curr_line.children[0].position.copy(v)}}}upEvent(e){if(this.down=!1,this.start.distanceTo(this.end)>0){this.start.multiplyScalar(0),this.end.multiplyScalar(0);return}if(e.button==0){if(this.currentObj==null&&this.state!="area")return;if(this.curr_line.children[0].visible=!0,this.state=="distance")this.step<1?this.step++:this.step==1&&(this.createDistanceLine(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="");else if(this.state=="angle")this.step<2?this.step++:this.step==2&&(this.createAngleLine(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="");else if(this.state=="area"){const i=performance.now(),r=new f.Vector2(e.clientX,e.clientY),a=this.step>=3&&i-this.lastClickTime<300&&r.distanceTo(this.lastClickPos)<15;if(this.lastClickTime=i,this.lastClickPos.copy(r),a)this.createAreaLine(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="",this.lastClickTime=0,this.lastClickPos.set(-9999,-9999);else{if(this.currentObj==null)return;this.step++}}}else e.button==2&&this.cancelMeasure()}cancelMeasure(){this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="",this.lastClickTime=0,this.lastClickPos.set(-9999,-9999)}downEvent(e){this.down=!0,this.start.set(e.clientX,e.clientY),this.end.set(e.clientX,e.clientY)}handleKeyDown(e){e.key==="Escape"&&this.state!==""&&this.cancelMeasure()}computeScale(){let e=1;if(this.viewer.camera instanceof f.OrthographicCamera){const i=1/this.viewer.camera.zoom,r=this.viewer.camera.top-this.viewer.camera.bottom;e=i*r}return e}createDistanceLine(e){const i=new f.Vector3(e[0].x,0,e[1].z),r=i.distanceTo(e[0]),a=this.judeUnit(this.UNIT.unit,Number(r),Number(this.UNIT.precision))+this.UNIT.unit,l=new ze({vertexs:[e[0],i],color:16711680,lineWidth:.001,transparent:!0,dashed:!0}),c=i.distanceTo(e[1]),h=this.judeUnit(this.UNIT.unit,Number(c),Number(this.UNIT.precision))+this.UNIT.unit,p=new ze({vertexs:[e[1],i],color:65280,lineWidth:.001,transparent:!0,dashed:!0}),u=e[0].distanceTo(e[1]),d=new ze({vertexs:[e[1],e[0]],color:41874,lineWidth:.002,transparent:!0}),m=this.judeUnit(this.UNIT.unit,Number(u),Number(this.UNIT.precision))+this.UNIT.unit,v=Mt({text:m});v&&(v.scale.multiplyScalar(this.computeScale()),v.position.lerpVectors(e[0],e[1],.5),d.add(v),this.group.add(d,l,p),l.userData.type="measure",p.userData.type="measure",d.userData.type="measure",this.callback&&this.callback({num1:m,num_x:h,num_y:a}))}createAngleLine(e){if(e.length<3)throw new Error("角度测量点必须是三个!");e.length>3&&(e=e.slice(0,3));const i=new ze({vertexs:e,color:41874,lineWidth:.002,transparent:!0}),a=fs(e).toFixed(Number(this.UNIT.precision))+"°",l=Mt({text:a}),c=e[0],h=e[1],p=e[2],u=new f.Vector3().subVectors(c,h),d=new f.Vector3().subVectors(p,h),m=new f.Vector3,v=u.angleTo(d);if(m.crossVectors(u,d),m.normalize(),d.applyAxisAngle(m,-v/2),d.multiplyScalar(.5),d.add(h),!l)return;new f.Box3().expandByObject(i),l.position.copy(d),l.scale.multiplyScalar(this.computeScale()),i.add(l),this.group.add(i),i.userData.type="measure",this.callback&&this.callback({num1:a})}createAreaLine(e){if(e.length<3)throw new Error("面积测量点不能少于三个!");e.pop();const i=Ks(e),r=this.judeAreaUnit(this.UNIT.unit,Number(i),Number(this.UNIT.precision)),a=zn(e),l=new ze({vertexs:[...e,e[0]],color:41874,lineWidth:.002,transparent:!0}),c=Mt({text:r});if(!c)return;c.scale.multiplyScalar(this.computeScale());const h=new f.Box3;h.expandByObject(l),h.getCenter(c.position),l.add(a,c),this.group.add(l),l.userData.type="measure",this.callback&&this.callback({num1:r})}adjustSetting(e){this.UNIT.unit=e.unit,this.UNIT.precision=e.precision}judeUnit(e,i,r){return e=="m"?i.toFixed(r):e=="cm"?(i*100).toFixed(r):e=="mm"?(i*1e3).toFixed(r):""}judeAreaUnit(e,i,r){return e=="m"?i.toFixed(r)+"㎡":e=="cm"?(i*1e4).toFixed(r)+"㎝²":e=="mm"?(i*1e6).toFixed(r)+"㎜²":""}setType(e){this.state=e,this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="",e==""?(this.curr_line.visible=!1,this.pointMesh.visible=!1,this.curr_line.children[0].visible=!1,this.points.length=0):(this.curr_line.visible=!0,this.pointMesh.visible=!0,this.curr_line.children[0].visible=!0)}destory(){this.element.removeEventListener("pointerup",this.events.pointerup),this.element.removeEventListener("pointerdown",this.events.pointerdown),this.element.removeEventListener("pointermove",this.events.pointermove),window.removeEventListener("keydown",this.events.keydown),this.step=0,this.currentObj=null,this.state="",this.lastClickTime=0,this.lastClickPos.set(-9999,-9999),this.curr_line.visible=!1,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerHTML="",this.pointMesh.visible=!1,this.group.children.forEach(e=>{e.userData.type=="measure"&&(e.visible=!1)})}clearAll(){const e=[];this.group.children.forEach(i=>{i.userData.type=="measure"&&e.push(i)}),this.curr_line.children[0].visible=!0,this.curr_line.children[0].element.innerHTML="",this.curr_line.children[0].visible=!1,e.forEach(i=>{if(i instanceof ze){const r=i;r.geometry.dispose(),r.material.dispose();const a=i.children[0];a&&a.material.dispose()}else i instanceof f.Sprite&&i.material.dispose();this.group.remove(i)}),this.callback&&this.callback({num1:"0"})}}const wi=function(){const o=document.createElement("div");return o.className="svg-wrapper",o.innerHTML=`
48
+ `}}_TransformColor(e){if(!this.options.colorCorrection&&!this.options.blackWhiteInversion)return e;const i=Yt.Luminance(this.clearColor);if(e===16777215&&i>=.8)return 0;if(e===0&&i<=.2)return 16777215;if(!this.options.colorCorrection)return e;const r=Yt.Luminance(e),a=1.5,l=Yt.ContrastRatio(e,this.clearColor);if((l>=1?l:1/l)<a){let h;i>.5?h=i/2:h=i*2,h>r?e=Yt.Lighten(e,h/r):e=Yt.Darken(e,r/h)}return e}}Gt.DefaultOptions={canvasWidth:400,canvasHeight:300,autoResize:!1,clearColor:new Te.Color("#000"),clearAlpha:1,canvasAlpha:!1,canvasPremultipliedAlpha:!0,antialias:!0,colorCorrection:!1,blackWhiteInversion:!0,pointSize:2,arcTessellationAngle:6/180*Math.PI,sceneOptions:xs.DefaultOptions};Gt.SetupWorker=function(){new Ze(self,!0)};const Fe=Object.freeze({NONE:0,FULL:1,POINT:2,MAX:3});class No{constructor(e,i,r){if(this.viewer=e,this.key=r.key,r.hasOwnProperty("verticesOffset")){const a=new Float32Array(i.vertices,r.verticesOffset*Float32Array.BYTES_PER_ELEMENT,r.verticesSize);(this.key.geometryType!==fe.GeometryType.POINT_INSTANCE||i.pointShapeHasDot)&&(this.vertices=new Te.BufferAttribute(a,2)),this.key.geometryType===fe.GeometryType.POINT_INSTANCE&&(this.transforms=new Te.InstancedBufferAttribute(a,2))}if(r.hasOwnProperty("chunks")){this.chunks=[];for(const a of r.chunks){const l=new Float32Array(i.vertices,a.verticesOffset*Float32Array.BYTES_PER_ELEMENT,a.verticesSize),c=new Uint16Array(i.indices,a.indicesOffset*Uint16Array.BYTES_PER_ELEMENT,a.indicesSize);this.chunks.push({vertices:new Te.BufferAttribute(l,2),indices:new Te.BufferAttribute(c,1)})}}if(r.hasOwnProperty("transformsOffset")){const a=new Float32Array(i.transforms,r.transformsOffset*Float32Array.BYTES_PER_ELEMENT,r.transformsSize),l=new Te.InstancedInterleavedBuffer(a,6);this.transforms0=new Te.InterleavedBufferAttribute(l,3,0),this.transforms1=new Te.InterleavedBufferAttribute(l,3,3)}if(this.key.geometryType===fe.GeometryType.BLOCK_INSTANCE||this.key.geometryType===fe.GeometryType.POINT_INSTANCE){const a=this.viewer.layers.get(this.key.layerName);a?this.layerColor=a.color:this.layerColor=0}}GetInstanceType(){switch(this.key.geometryType){case fe.GeometryType.BLOCK_INSTANCE:return Fe.FULL;case fe.GeometryType.POINT_INSTANCE:return Fe.POINT;default:return Fe.NONE}}*CreateObjects(e=null){if(this.key.geometryType===fe.GeometryType.BLOCK_INSTANCE||this.key.geometryType===fe.GeometryType.POINT_INSTANCE){if(e!==null)throw new Error("Unexpected instance batch specified for instance batch");yield*this._CreateBlockInstanceObjects();return}yield*this._CreateObjects(e)}*_CreateObjects(e){const i=e?e._GetInstanceColor(this.key.color):this.key.color,a=(this.key.geometryType===fe.GeometryType.POINTS||this.key.geometryType===fe.GeometryType.POINT_INSTANCE?this.viewer._GetSimplePointMaterial:this.viewer._GetSimpleColorMaterial).call(this.viewer,this.viewer._TransformColor(i),(e==null?void 0:e.GetInstanceType())??Fe.NONE);let l;switch(this.key.geometryType){case fe.GeometryType.POINTS:case fe.GeometryType.POINT_INSTANCE:l=Te.Points;break;case fe.GeometryType.LINES:case fe.GeometryType.INDEXED_LINES:l=Te.LineSegments;break;case fe.GeometryType.TRIANGLES:case fe.GeometryType.INDEXED_TRIANGLES:l=Te.Mesh;break;default:throw new Error("Unexpected geometry type:"+this.key.geometryType)}function c(h,p){const u=e?new Te.InstancedBufferGeometry:new Te.BufferGeometry,d=h.array,m=[];for(let y=0;y<d.length;y+=2)m.push(new Te.Vector3(d[y],d[y+1],0));u.setFromPoints(m),e==null||e._SetInstanceTransformAttribute(u),p&&u.setIndex(p),u.computeBoundingSphere();const v=new l(u,a);return v.frustumCulled=!1,v.matrixAutoUpdate=!1,v.userData={vertices:m},v}if(this.chunks)for(const h of this.chunks)yield c(h.vertices,h.indices);else yield c(this.vertices)}_SetInstanceTransformAttribute(e){if(!e.isInstancedBufferGeometry)throw new Error("InstancedBufferGeometry expected");this.key.geometryType===fe.GeometryType.POINT_INSTANCE?e.setAttribute("instanceTransform",this.transforms):(e.setAttribute("instanceTransform0",this.transforms0),e.setAttribute("instanceTransform1",this.transforms1))}*_CreateBlockInstanceObjects(){const e=this.viewer.blocks.get(this.key.blockName);if(e){for(const i of e.batches)yield*i.CreateObjects(this);this.hasOwnProperty("vertices")&&(yield*this._CreateObjects())}}_GetInstanceColor(e){return e===Je.BY_BLOCK?this.key.color:e===Je.BY_LAYER?this.layerColor:e}}class Yp{constructor(e,i){this.name=e,this.color=i,this.objects=[]}PushObject(e){this.objects.push(e)}Dispose(){for(const e of this.objects)e.geometry.dispose();this.objects=null}}class Kp{constructor(){this.batches=[]}PushBatch(e){this.batches.push(e)}}class na{constructor(e,i){L(this,"rays");L(this,"step");L(this,"state");L(this,"element");L(this,"raycaster",new f.Raycaster);L(this,"camera");L(this,"point",new f.Vector3);L(this,"currentObj");L(this,"group");L(this,"points");L(this,"curr_line");L(this,"down");L(this,"pointMesh");L(this,"callback");L(this,"viewer");L(this,"start",new f.Vector2);L(this,"end",new f.Vector2);L(this,"events");L(this,"plane",new f.Plane(new f.Vector3(0,1,0)));L(this,"lastClickPos",new f.Vector2(-9999,-9999));L(this,"lastClickTime",0);L(this,"UNIT");this.rays=[],this.viewer=e,this.step=0,this.state="",this.element=e.element,this.camera=e.camera,this.currentObj=null,this.group=e.containerGroup,this.points=[],this.down=!1,this.raycaster.params.Line.threshold=100,this.callback=i.callback;const r=e.containerGroup.getObjectByName("curr_line");if(r)this.curr_line=r,this.pointMesh=e.containerGroup.getObjectByName("move_point");else{this.curr_line=new ze({vertexs:[0,0,0,0,0,0],color:16358667,lineWidth:.002,name:"curr_line",transparent:!0});const a=Ho("");this.curr_line.add(a),this.curr_line.visible=!1,a.visible=!1,e.containerGroup.add(this.curr_line),Mn.sizeAttenuation=!1,this.pointMesh=new f.Sprite(Mn),this.pointMesh.name="move_point",this.pointMesh.visible=!1,e.containerGroup.add(this.pointMesh)}this.events={pointerup:this.upEvent.bind(this),pointerdown:this.downEvent.bind(this),pointermove:this.mouseMoveEvent.bind(this),keydown:this.handleKeyDown.bind(this)},this.UNIT={unit:"mm",precision:"2"},this.initEvents()}initEvents(){for(const e in this.viewer.objs)this.viewer.objs[e]instanceof un&&this.viewer.objs[e].traverse(i=>{i instanceof f.Line&&this.rays.push(i)});this.element.addEventListener("pointerup",this.events.pointerup),this.element.addEventListener("pointerdown",this.events.pointerdown),this.element.addEventListener("pointermove",this.events.pointermove),window.addEventListener("keydown",this.events.keydown),this.group.children.forEach(e=>{e.userData.type=="measure"&&(e.visible=!0)})}mouseMoveEvent(e){if(this.state=="")return;if(this.down){this.end.set(e.clientX,e.clientY);return}if(this.viewer.camera instanceof f.OrthographicCamera){const u=1/this.viewer.camera.zoom,d=this.viewer.camera.top-this.viewer.camera.bottom,m=u*d/150;this.pointMesh.scale.set(m,m,1)}const i=this.element.getBoundingClientRect(),r=i.width,a=i.height,l=e.clientY-i.top,c=e.clientX-i.left,h={x:0,y:0};h.x=c/r*2-1,h.y=-(l/a)*2+1,this.raycaster.setFromCamera(h,this.camera);const p=this.raycaster.intersectObjects(this.rays,!1);if(this.currentObj=null,p.length<1||!p[0].point)this.raycaster.ray.intersectPlane(this.plane,this.point),this.pointMesh.material.color.set(255);else{const u=p[0].point;this.point.copy(u),this.currentObj=p[0].object,this.pointMesh.material.color.set(16773120)}if(this.points[this.step]=this.point.clone(),this.pointMesh.position.copy(this.point),this.curr_line.setVertexs(this.points),this.state=="angle"&&this.step>1){const u=ms(this.points).toFixed(Number(this.UNIT.precision));this.curr_line.children[0].element.innerHTML=u+"°",this.curr_line.children[0].position.lerpVectors(this.points[1],this.points[2],.5)}else if(this.state=="distance"&&this.step>0){const u=this.points[0].distanceTo(this.points[1]),d=this.judeUnit(this.UNIT.unit,u,Number(this.UNIT.precision))+this.UNIT.unit;this.curr_line.children[0].element.innerHTML=d,this.curr_line.children[0].position.lerpVectors(this.points[0],this.points[1],.5)}else if(this.state=="area"&&this.step>=2){const u=this.points.slice(0,this.step);if(u.length>=3){const d=qs(u),m=this.judeAreaUnit(this.UNIT.unit,Number(d),Number(this.UNIT.precision));this.curr_line.children[0].element.innerHTML=m;const v=new f.Vector3;u.forEach(y=>v.add(y)),v.divideScalar(u.length),this.curr_line.children[0].position.copy(v)}}}upEvent(e){if(this.down=!1,this.start.distanceTo(this.end)>0){this.start.multiplyScalar(0),this.end.multiplyScalar(0);return}if(e.button==0){if(this.currentObj==null&&this.state!="area")return;if(this.curr_line.children[0].visible=!0,this.state=="distance")this.step<1?this.step++:this.step==1&&(this.createDistanceLine(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="");else if(this.state=="angle")this.step<2?this.step++:this.step==2&&(this.createAngleLine(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="");else if(this.state=="area"){const i=performance.now(),r=new f.Vector2(e.clientX,e.clientY),a=this.step>=3&&i-this.lastClickTime<300&&r.distanceTo(this.lastClickPos)<15;if(this.lastClickTime=i,this.lastClickPos.copy(r),a)this.createAreaLine(this.points),this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="",this.lastClickTime=0,this.lastClickPos.set(-9999,-9999);else{if(this.currentObj==null)return;this.step++}}}else e.button==2&&this.cancelMeasure()}cancelMeasure(){this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="",this.lastClickTime=0,this.lastClickPos.set(-9999,-9999)}downEvent(e){this.down=!0,this.start.set(e.clientX,e.clientY),this.end.set(e.clientX,e.clientY)}handleKeyDown(e){e.key==="Escape"&&this.state!==""&&this.cancelMeasure()}computeScale(){let e=1;if(this.viewer.camera instanceof f.OrthographicCamera){const i=1/this.viewer.camera.zoom,r=this.viewer.camera.top-this.viewer.camera.bottom;e=i*r}return e}createDistanceLine(e){const i=new f.Vector3(e[0].x,0,e[1].z),r=i.distanceTo(e[0]),a=this.judeUnit(this.UNIT.unit,Number(r),Number(this.UNIT.precision))+this.UNIT.unit,l=new ze({vertexs:[e[0],i],color:16711680,lineWidth:.001,transparent:!0,dashed:!0}),c=i.distanceTo(e[1]),h=this.judeUnit(this.UNIT.unit,Number(c),Number(this.UNIT.precision))+this.UNIT.unit,p=new ze({vertexs:[e[1],i],color:65280,lineWidth:.001,transparent:!0,dashed:!0}),u=e[0].distanceTo(e[1]),d=new ze({vertexs:[e[1],e[0]],color:41874,lineWidth:.002,transparent:!0}),m=this.judeUnit(this.UNIT.unit,Number(u),Number(this.UNIT.precision))+this.UNIT.unit,v=Mt({text:m});v&&(v.scale.multiplyScalar(this.computeScale()),v.position.lerpVectors(e[0],e[1],.5),d.add(v),this.group.add(d,l,p),l.userData.type="measure",p.userData.type="measure",d.userData.type="measure",this.callback&&this.callback({num1:m,num_x:h,num_y:a}))}createAngleLine(e){if(e.length<3)throw new Error("角度测量点必须是三个!");e.length>3&&(e=e.slice(0,3));const i=new ze({vertexs:e,color:41874,lineWidth:.002,transparent:!0}),a=ms(e).toFixed(Number(this.UNIT.precision))+"°",l=Mt({text:a}),c=e[0],h=e[1],p=e[2],u=new f.Vector3().subVectors(c,h),d=new f.Vector3().subVectors(p,h),m=new f.Vector3,v=u.angleTo(d);if(m.crossVectors(u,d),m.normalize(),d.applyAxisAngle(m,-v/2),d.multiplyScalar(.5),d.add(h),!l)return;new f.Box3().expandByObject(i),l.position.copy(d),l.scale.multiplyScalar(this.computeScale()),i.add(l),this.group.add(i),i.userData.type="measure",this.callback&&this.callback({num1:a})}createAreaLine(e){if(e.length<3)throw new Error("面积测量点不能少于三个!");e.pop();const i=qs(e),r=this.judeAreaUnit(this.UNIT.unit,Number(i),Number(this.UNIT.precision)),a=zn(e),l=new ze({vertexs:[...e,e[0]],color:41874,lineWidth:.002,transparent:!0}),c=Mt({text:r});if(!c)return;c.scale.multiplyScalar(this.computeScale());const h=new f.Box3;h.expandByObject(l),h.getCenter(c.position),l.add(a,c),this.group.add(l),l.userData.type="measure",this.callback&&this.callback({num1:r})}adjustSetting(e){this.UNIT.unit=e.unit,this.UNIT.precision=e.precision}judeUnit(e,i,r){return e=="m"?i.toFixed(r):e=="cm"?(i*100).toFixed(r):e=="mm"?(i*1e3).toFixed(r):""}judeAreaUnit(e,i,r){return e=="m"?i.toFixed(r)+"㎡":e=="cm"?(i*1e4).toFixed(r)+"㎝²":e=="mm"?(i*1e6).toFixed(r)+"㎜²":""}setType(e){this.state=e,this.step=0,this.points.length=0,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerText="",e==""?(this.curr_line.visible=!1,this.pointMesh.visible=!1,this.curr_line.children[0].visible=!1,this.points.length=0):(this.curr_line.visible=!0,this.pointMesh.visible=!0,this.curr_line.children[0].visible=!0)}destory(){this.element.removeEventListener("pointerup",this.events.pointerup),this.element.removeEventListener("pointerdown",this.events.pointerdown),this.element.removeEventListener("pointermove",this.events.pointermove),window.removeEventListener("keydown",this.events.keydown),this.step=0,this.currentObj=null,this.state="",this.lastClickTime=0,this.lastClickPos.set(-9999,-9999),this.curr_line.visible=!1,this.curr_line.children[0].visible=!1,this.curr_line.children[0].element.innerHTML="",this.pointMesh.visible=!1,this.group.children.forEach(e=>{e.userData.type=="measure"&&(e.visible=!1)})}clearAll(){const e=[];this.group.children.forEach(i=>{i.userData.type=="measure"&&e.push(i)}),this.curr_line.children[0].visible=!0,this.curr_line.children[0].element.innerHTML="",this.curr_line.children[0].visible=!1,e.forEach(i=>{if(i instanceof ze){const r=i;r.geometry.dispose(),r.material.dispose();const a=i.children[0];a&&a.material.dispose()}else i instanceof f.Sprite&&i.material.dispose();this.group.remove(i)}),this.callback&&this.callback({num1:"0"})}}const wi=function(){const o=document.createElement("div");return o.className="svg-wrapper",o.innerHTML=`
49
49
  <svg width="13" height="12" viewBox="0 0 13 12" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.8356 4.6237L7.34238 0.281301C6.86947 -0.0937669 6.12865 -0.0937669 5.65574 0.281301L0.164836 4.6237C-0.0238625 4.7728 -0.0541475 5.04536 0.0926182 5.23173C0.239384 5.4181 0.507289 5.45071 0.695988 5.30395L0.86605 5.16417V10.4128C0.86605 11.1559 1.65113 11.7127 2.33837 11.7127H11.0045C11.6848 11.7127 12.1321 11.1909 12.1321 10.4128V5.18281L12.2905 5.30395C12.3697 5.36685 12.4675 5.39713 12.563 5.39713C12.6912 5.39713 12.8193 5.34122 12.9055 5.23173C13.0546 5.04536 13.0243 4.7728 12.8356 4.6237ZM6.06587 10.8459V8.44176C6.06587 8.32295 6.28252 8.26238 6.49917 8.26238C6.71583 8.26238 6.93248 8.32295 6.93248 8.44176V10.8436L6.06587 10.8459ZM11.007 10.8463C11.1888 10.8463 11.268 10.6995 11.268 10.413H11.2656V4.49807L6.7951 0.961711C6.63669 0.835912 6.34781 0.835912 6.18707 0.961711L1.73518 4.4771V10.413C1.73518 10.611 2.06831 10.8463 2.34088 10.8463H5.21096C5.21096 10.8428 5.20805 10.8399 5.20514 10.8369C5.20223 10.834 5.19931 10.8311 5.19931 10.8276V8.4421C5.19931 7.93891 5.60467 7.39611 6.49924 7.39611C7.39381 7.39611 7.79916 7.93891 7.79916 8.4421V10.8276C7.79916 10.8311 7.80149 10.834 7.80382 10.8369C7.80615 10.8399 7.80848 10.8428 7.80848 10.8463H11.007Z" fill="white"/></svg>
50
50
  `,o},ia=function(){const o=document.createElement("div");return o.style.padding="10px",o.style.border="none",o.className="flex control",o.innerHTML=`
51
51
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M14.9419 1.28805C14.9419 1.28656 14.9405 1.28656 14.9405 1.28507C14.9092 1.22409 14.8646 1.16905 14.8096 1.12443C14.756 1.07981 14.695 1.04709 14.6311 1.02626C14.6296 1.02626 14.6281 1.02478 14.6266 1.02478C14.6013 1.01585 14.5746 1.01139 14.5478 1.00693C14.5403 1.00544 14.5329 1.00246 14.524 1.00246C14.4987 0.99949 14.4749 0.99949 14.4496 1.00098C14.4392 1.00098 14.4303 0.99949 14.4199 1.00098C14.3485 1.00544 14.2771 1.02626 14.2116 1.05899L1.29938 7.46231C1.17295 7.52329 1.07627 7.63336 1.03165 7.76723C1.01826 7.80441 1.01231 7.84457 1.00785 7.88325C0.99446 7.96208 0.997435 8.04389 1.02272 8.12123C1.06437 8.25659 1.15808 8.36814 1.28451 8.4321L4.56128 10.1545C4.64011 10.1962 4.72638 10.217 4.81563 10.217C5.01346 10.2185 5.19492 10.1114 5.2916 9.93885C5.43291 9.68153 5.33325 9.36174 5.07146 9.22341L2.67673 7.96505L12.3077 3.18748L6.43394 9.9329C6.42947 9.93737 6.42799 9.94331 6.42352 9.94778C6.27776 10.043 6.18256 10.2036 6.18256 10.3881V14.2717C6.18405 14.413 6.24206 14.5484 6.3432 14.648C6.44435 14.7477 6.58119 14.8012 6.72249 14.7997V14.8012C7.01998 14.8012 7.26094 14.5647 7.26094 14.2732V10.6112L13.6732 3.244L12.3405 12.9613L8.95957 11.337C8.69332 11.2091 8.37353 11.3162 8.23817 11.578C8.1757 11.7044 8.16677 11.8502 8.21288 11.984C8.25899 12.1179 8.35716 12.2265 8.48508 12.286L12.5026 14.2181C12.577 14.2538 12.6573 14.2717 12.7406 14.2717C12.7436 14.2717 12.7465 14.2702 12.7495 14.2702C12.7584 14.2702 12.7688 14.2732 12.7778 14.2732C13.0455 14.2747 13.2731 14.0798 13.3117 13.8151L14.9776 1.67626C15.0148 1.55132 15.0074 1.41299 14.9419 1.28805Z" fill="#333333"/></svg>
@@ -98,7 +98,7 @@
98
98
  <path d="M750.92992 580.2496v122.39872L584.3968 536.1152l-48.27136 48.26112L702.6688 750.91968l-122.39872 0.03072v68.27008l204.8-0.04096A34.1504 34.1504 0 0 0 819.2 785.0496v-204.8h-68.27008zM487.87456 439.58272L321.3312 273.0496l122.39872-0.03072v-68.23936h-204.8A34.1504 34.1504 0 0 0 204.8 238.91968v204.8h68.27008V321.32096L439.6032 487.85408l48.27136-48.27136z">
99
99
  </path>
100
100
  </svg>
101
- `;const i=this;return e.onpointerdown=function(r){const a=i.layerElement.getBoundingClientRect(),l=a.width,c=a.height,h=r.clientX,p=r.clientY;document.onpointermove=function(u){const d=u.clientX,m=u.clientY;i.layerElement.style.width=l+(d-h)+"px",i.layerElement.style.height=c+(m-p)+"px"}},e.onpointerup=function(){document.onpointermove=null},e}handleLayers(){if(this.time>0)return;const e=[];let i=null;for(const u in this.viewer.objs){const d=this.viewer.objs[u];d instanceof un&&d.type=="Group"&&(i=d,e.push(...d.GetLayers()))}e.length>0&&this.time++;const r=u=>{let d=u.toString(16);for(;d.length<6;)d="0"+d;return"#"+d},a=document.createElement("div");a.className="layer-box",this.layerElement.appendChild(a);const l=document.createElement("div"),c=this.createCheckBox();l.appendChild(c),l.className="layer-header";const h=document.createElement("span");h.innerHTML="所有图层",l.appendChild(h),l.setAttribute("visible","1");const p=document.createElement("div");a.append(l,p),p.className="layer-content",e.forEach(u=>{const d=document.createElement("div");d.className="line-item";const m=this.createCheckBox();d.appendChild(m);const v=document.createElement("span");v.className="color-span",v.style.background=r(u.color),d.appendChild(v);const g=document.createElement("span");g.innerText=u.name,g.className="text-span",g.title=u.name,d.appendChild(g),p.appendChild(d),d.onpointerup=function(){u.state=!u.state,u.setVisible(u.state)},u.setVisible=function(x){i!=null&&(i.ShowLayer(u.name,x),x?(m.children[0].setAttribute("opacity","1"),m.style.borderColor="rgba(10, 10, 10, 0)"):(m.children[0].setAttribute("opacity","0"),m.style.borderColor="rgba(10, 10, 10, 0.5)"))}}),l.onpointerup=function(){const u=l.getAttribute("visible")=="1";l.setAttribute("visible",u?"0":"1"),u?(c.children[0].setAttribute("opacity","0"),c.style.borderColor="rgba(10, 10, 10, 0.5)"):(c.children[0].setAttribute("opacity","1"),c.style.borderColor="rgba(10, 10, 10, 0)"),e.forEach(d=>{d.state=!u,d.setVisible(d.state)})}}createCheckBox(){const e=document.createElement("div");return e.innerHTML=`
101
+ `;const i=this;return e.onpointerdown=function(r){const a=i.layerElement.getBoundingClientRect(),l=a.width,c=a.height,h=r.clientX,p=r.clientY;document.onpointermove=function(u){const d=u.clientX,m=u.clientY;i.layerElement.style.width=l+(d-h)+"px",i.layerElement.style.height=c+(m-p)+"px"}},e.onpointerup=function(){document.onpointermove=null},e}handleLayers(){if(this.time>0)return;const e=[];let i=null;for(const u in this.viewer.objs){const d=this.viewer.objs[u];d instanceof un&&d.type=="Group"&&(i=d,e.push(...d.GetLayers()))}e.length>0&&this.time++;const r=u=>{let d=u.toString(16);for(;d.length<6;)d="0"+d;return"#"+d},a=document.createElement("div");a.className="layer-box",this.layerElement.appendChild(a);const l=document.createElement("div"),c=this.createCheckBox();l.appendChild(c),l.className="layer-header";const h=document.createElement("span");h.innerHTML="所有图层",l.appendChild(h),l.setAttribute("visible","1");const p=document.createElement("div");a.append(l,p),p.className="layer-content",e.forEach(u=>{const d=document.createElement("div");d.className="line-item";const m=this.createCheckBox();d.appendChild(m);const v=document.createElement("span");v.className="color-span",v.style.background=r(u.color),d.appendChild(v);const y=document.createElement("span");y.innerText=u.name,y.className="text-span",y.title=u.name,d.appendChild(y),p.appendChild(d),d.onpointerup=function(){u.state=!u.state,u.setVisible(u.state)},u.setVisible=function(x){i!=null&&(i.ShowLayer(u.name,x),x?(m.children[0].setAttribute("opacity","1"),m.style.borderColor="rgba(10, 10, 10, 0)"):(m.children[0].setAttribute("opacity","0"),m.style.borderColor="rgba(10, 10, 10, 0.5)"))}}),l.onpointerup=function(){const u=l.getAttribute("visible")=="1";l.setAttribute("visible",u?"0":"1"),u?(c.children[0].setAttribute("opacity","0"),c.style.borderColor="rgba(10, 10, 10, 0.5)"):(c.children[0].setAttribute("opacity","1"),c.style.borderColor="rgba(10, 10, 10, 0)"),e.forEach(d=>{d.state=!u,d.setVisible(d.state)})}}createCheckBox(){const e=document.createElement("div");return e.innerHTML=`
102
102
  <svg viewBox="0 0 1024 1024" width="18" height="18"><path d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM695.5 365.7l-210.6 292c-12.7 17.7-39 17.7-51.7 0L308.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H689c6.5 0 10.3 7.4 6.5 12.7z" fill="currentColor"></path></svg>
103
103
  `,e.style.width="18px",e.style.height="18px",e.style.border="1px solid rgba(0, 0, 0, 0)",e}}class ba{constructor(e,i,r){L(this,"dom");L(this,"viewer");L(this,"measure");L(this,"toolsWrapper");if(this.viewer=e,this.dom=document.createElement("div"),i){const c=document.createElement("img");c.src=i,this.dom.appendChild(c)}else this.dom.appendChild(Ti());this.dom.setAttribute("data-attr",r||"测量");const a=this.toolsWrapper=this._initToolsWrapper(),l=this;this.dom.onmouseup=function(){a.style.display=="none"?(a.style.display="block",l.measure=new na(e,{callback:l._meaCallBack.bind(l)})):(a.style.display="none",l.measure.destory())}}_initToolsWrapper(){var m;const e=document.createElement("div");e.style.display="none",e.className="measure-wrapper dxf-measure-wrapper",(m=this.viewer.element.parentElement)==null||m.appendChild(e);const i=document.createElement("div");i.className="header";const r=document.createElement("span");r.className="header-title",r.innerText="测量",i.appendChild(r);const a=Mi();a.className="header-setting",i.appendChild(a),e.appendChild(i);const l=document.createElement("div");l.className="content-tab",l.appendChild(this._distanceIcon()),l.appendChild(this._angleIcon()),l.appendChild(this._areaIcon()),e.appendChild(l);const c=document.createElement("div");c.className="measure-text",c.innerHTML=`
104
104
  <div class="measure-line">
@@ -113,7 +113,7 @@
113
113
  <span class="measure-text-num-y">Y:</span>
114
114
  <span class="measure-text-num-y-val"></span>
115
115
  </div>
116
- `,e.appendChild(c);const h=document.createElement("div");h.className="clear-btn",h.innerText="清除",e.appendChild(h),h.onmouseup=()=>{this.measure&&this.measure.clearAll()};const p=this;let u;e.onmousedown=function(v){var V;const g=v.clientX,x=v.clientY,b=e.getBoundingClientRect(),C=(V=p.viewer.element.parentElement)==null?void 0:V.getBoundingClientRect();if(!C)return;const T=C.height-b.height,A=C.width-b.width,O=Number(e.style.right.split("p")[0])||0,P=Number(e.style.bottom.split("p")[0])||0;clearTimeout(u),u=setTimeout(()=>{e.style.cursor="grabbing",document.onmousemove=function(R){const I=R.clientX,G=R.clientY;let X=g-I+O,j=x-G+P;X<0&&(X=0),j<0&&(j=0),X>A&&(X=A),j>T&&(j=T),e.style.right=X+"px",e.style.bottom=j+"px"}},1e3),e.onmouseup=function(){document.onmousemove=null,clearTimeout(u),e.style.cursor="default"}};const d=this._unitAccuracy(a);return e.appendChild(d),a.onpointerup=function(){d.style.display=="none"?(d.style.display="block",a.classList.add("is-active")):(d.style.display="none",a.classList.remove("is-active"))},e}_unitAccuracy(e){const i=document.createElement("div");i.className="measure-setting",i.style.display="none",i.innerHTML=`
116
+ `,e.appendChild(c);const h=document.createElement("div");h.className="clear-btn",h.innerText="清除",e.appendChild(h),h.onmouseup=()=>{this.measure&&this.measure.clearAll()};const p=this;let u;e.onmousedown=function(v){var V;const y=v.clientX,x=v.clientY,b=e.getBoundingClientRect(),C=(V=p.viewer.element.parentElement)==null?void 0:V.getBoundingClientRect();if(!C)return;const T=C.height-b.height,A=C.width-b.width,O=Number(e.style.right.split("p")[0])||0,P=Number(e.style.bottom.split("p")[0])||0;clearTimeout(u),u=setTimeout(()=>{e.style.cursor="grabbing",document.onmousemove=function(B){const I=B.clientX,G=B.clientY;let W=y-I+O,j=x-G+P;W<0&&(W=0),j<0&&(j=0),W>A&&(W=A),j>T&&(j=T),e.style.right=W+"px",e.style.bottom=j+"px"}},1e3),e.onmouseup=function(){document.onmousemove=null,clearTimeout(u),e.style.cursor="default"}};const d=this._unitAccuracy(a);return e.appendChild(d),a.onpointerup=function(){d.style.display=="none"?(d.style.display="block",a.classList.add("is-active")):(d.style.display="none",a.classList.remove("is-active"))},e}_unitAccuracy(e){const i=document.createElement("div");i.className="measure-setting",i.style.display="none",i.innerHTML=`
117
117
  <div class="setting-header">
118
118
  <span >测量设置</span>
119
119
  <span class="setting-close">x</span>
@@ -133,7 +133,7 @@
133
133
  <option selected value="2">0.00</option>
134
134
  <option value="3">0.000</option>
135
135
  </select>
136
- </div>`;const r=i.getElementsByClassName("setting-close")[0];r&&(r.onmouseup=()=>{i.style.display="none",e==null||e.classList.remove("is-active")}),i.onmousedown=function(p){p.stopPropagation()};const a=i.getElementsByClassName("unit-select")[0],l=i.getElementsByClassName("accuracy-select")[0],c=this,h={unit:"mm",precision:"2"};return a.onchange=function(p){h.unit=p.target.value,c.measure.adjustSetting(h)},l.onchange=function(p){h.precision=p.target.value,c.measure.adjustSetting(h)},i}_meaCallBack(e){if(e.num1){const i=this.toolsWrapper.getElementsByClassName("measure-text-num")[0];i.innerText=e.num1}if(e.num_x){const i=this.toolsWrapper.getElementsByClassName("measure-text-num-x-val")[0];i.innerText=e.num_x}if(e.num_y){const i=this.toolsWrapper.getElementsByClassName("measure-text-num-y-val")[0];i.innerText=e.num_y}}_distanceIcon(){const e=Ei();return this._elementEvent(e,"distance"),e}_angleIcon(){const e=Si();return this._elementEvent(e,"angle"),e}_areaIcon(){const e=fa();return this._elementEvent(e,"area"),e}_elementEvent(e,i){const r=this;e.onmousedown=function(a){a.stopPropagation()},e.onpointerup=function(){var m;const a=(m=e.parentElement)==null?void 0:m.getElementsByClassName("measure-active")[0];a&&a.classList.remove("measure-active");const l=r.toolsWrapper.getElementsByClassName("measure-line-x")[0],c=r.toolsWrapper.getElementsByClassName("measure-line-y")[0],h=r.toolsWrapper.getElementsByClassName("measure-text-type")[0],p=r.toolsWrapper.getElementsByClassName("measure-text-num")[0],u=r.toolsWrapper.getElementsByClassName("measure-text-num-x-val")[0],d=r.toolsWrapper.getElementsByClassName("measure-text-num-y-val")[0];p.innerText="",u.innerText="",d.innerText="",i=="distance"?(h.innerText="距离:",l.style.display="flex",c.style.display="flex"):(i=="angle"&&(h.innerText="角度:"),i=="area"&&(h.innerText="面积:"),l.style.display="none",c.style.display="none"),e.classList.add("measure-active"),r.measure.setType(i)}}destory(){this.toolsWrapper.style.display="none",this.measure.destory()}}let nd=class{constructor(e,i,r){L(this,"dom");L(this,"fullFlag");L(this,"target");if(this.fullFlag=!0,this.target=r||document.documentElement,this.dom=document.createElement("div"),e){const a=document.createElement("img");a.src=e,this.dom.appendChild(a)}else this.dom.appendChild(ki());this.dom.setAttribute("data-attr",i||"全屏"),document.addEventListener("fullscreenchange",()=>{this.fullFlag=!document.fullscreenElement}),this.dom.onmouseup=()=>{document.fullscreenElement?document.exitFullscreen():this.target.requestFullscreen()}}};class xa extends jn{constructor(e,i){super(e,{baseConfig:{background:new f.Color(i||0)},cube:{show:!1}}),e.parentElement.id="viewer-3d-dxf",this._Toggle2DMode()}_Toggle2DMode(){this.orbitControl.enableRotate=!1,this.camera=this.orthographicCamera,this.camera.position.set(0,100,0),this.camera.lookAt(0,0,0),this.camera.updateProjectionMatrix(),this.orbitControl.object=this.camera}centerView(e=.1){const i=new f.Box3;i.expandByObject(this.scene),!(i.min.x==i.max.x||i.min.z==i.max.z)&&this.fitView(i,e)}fitView(e,i){const r=new f.Vector3;e.getSize(r),r.multiplyScalar(1-i);const a=e.getCenter(new f.Vector3),l=e.max.distanceTo(e.min)/1.5,c=new f.Vector3(a.x,a.y+l,a.z);let h;r.x>r.y?h=this.orthographicCamera.right/r.x:h=this.orthographicCamera.top/r.y,this.orthographicCamera.zoom=h,this.camera.position.copy(c),this.orthographicCamera.updateProjectionMatrix(),this.orbitControl.target.copy(a),this.orbitControl.update()}}const id={class:"viewer-box"},od=y.defineComponent({__name:"index-dxf",props:{url:{default:"/A-1F-研发楼.dxf"},showTools:{type:Boolean,default:!0}},setup(o,{expose:e}){const i=o,r=y.ref(null),a=y.ref(null),l=y.ref(!1),c=["/fonts/Roboto-LightItalic.ttf","/fonts/NotoSansDisplay-SemiCondensedLightItalic.ttf","/fonts/HanaMinA.ttf","/fonts/NanumGothic-Regular.ttf","/fonts/msyh.ttf"];let h,p,u=null,d=null,m=null;function v(C){const T=C[0].pageX-C[1].pageX,A=C[0].pageY-C[1].pageY;return Math.sqrt(T*T+A*A)}function g(C){C.touches.length===1&&(C.preventDefault(),d=C.touches[0].pageX,m=C.touches[0].pageY),C.touches.length===2&&(C.preventDefault(),u=v(C.touches))}function x(C){if(C.preventDefault(),C.touches.length===1&&d!==null&&m!==null){const T=C.touches[0].pageX,A=C.touches[0].pageY,O=T-d,P=A-m;for(const V in h.objs)if(Object.hasOwnProperty.call(h.objs,V)){const R=h.objs[V];R.position.x+=O/2/h.camera.zoom,R.position.z+=P/2/h.camera.zoom}d=T,m=A}if(C.touches.length===2){const T=v(C.touches);if(u!==null){const A=T/u;h.camera.zoom*=A,h.camera.updateProjectionMatrix(),u=T}}}const b=function(C){p&&(p.dispatchEvent({type:"destory"}),delete h.objs[p.uuid]),l.value=!0;const T=Gt.SetupWorker();new Gt().Load({url:C,fonts:c,progressCbk:void 0,workerFactory:T}).then(O=>{let P=new f.Box3;P.setFromObject(O);const V=P.getSize(new f.Vector3),R=600/Math.max(V.x,V.z);p=O,O.scale.set(R,R,R),h.addObject(O),h.centerView(),h.renderer.domElement.addEventListener("touchstart",g,!1),h.renderer.domElement.addEventListener("touchmove",x,!1),l.value=!1})};return y.onMounted(()=>{h=new xa(r.value),a.value&&new ga(h,{wrapper:a.value,fitView:{padding:.35},handleLayers:{},dxfMeasure:{},fullScreen:{},colorTurn:{}}),i.url&&b(i.url),y.watch(()=>i.url,C=>{h&&b(C)})}),y.onUnmounted(()=>{h.destroy()}),e({viewer:()=>h}),(C,T)=>{const A=y.resolveDirective("loading");return y.withDirectives((y.openBlock(),y.createElementBlock("div",id,[C.showTools?(y.openBlock(),y.createElementBlock("div",{key:0,class:"dxf-tools",ref_key:"dxfTools",ref:a},null,512)):y.createCommentVNode("",!0),y.createElementVNode("canvas",{id:"viewer-3d-dxf",ref_key:"viewerDom",ref:r},null,512)])),[[A,y.unref(l)]])}}});const rd=Ue(od,[["__scopeId","data-v-696004c1"]]);class Ca{constructor(e,i){L(this,"renderer");L(this,"element");L(this,"camera");L(this,"globalPlanes");L(this,"localPlanes");L(this,"boxVertices");L(this,"planes");L(this,"boxMeshs");L(this,"localMesh");L(this,"meshs");L(this,"objects");L(this,"control");L(this,"group");L(this,"dragControl");L(this,"transControl");L(this,"clippingType");L(this,"callBack");L(this,"setParam");this.renderer=e.renderer,this.element=e.element,this.camera=e.camera,this.objects=e.objs,this.clippingType="",this.localPlanes=[],this.boxVertices={},this.boxMeshs={},this.planes={},this.globalPlanes=[],this.group=e.containerGroup,e.controlType=="orbit"?this.control=e.orbitControl:e.controlType=="fly"?this.control=e.flyControl:this.control=e.firstControl,this.meshs=[],this.callBack=i.callBackFun,this.setParam=i.set,this.computedClippingPlane(),this.initEvents()}setClippingType(e){if(e=="global"){this.renderer.localClippingEnabled=!0,this.dragControl.enabled=!1;for(const i in this.boxMeshs)this.boxMeshs[i].visible=!1;this.transControl.visible=!0,this.transControl.enabled=!0,this.localMesh.visible=!0,this.transControl.attach(this.localMesh),this.setLocalClipping(!0)}else if(e=="local"){this.renderer.localClippingEnabled=!0,this.dragControl.enabled=!0;for(const i in this.boxMeshs)this.boxMeshs[i].visible=!0;this.transControl.visible=!1,this.transControl.enabled=!1,this.localMesh.visible=!1,this.setLocalClipping(!1)}}setLocalClipping(e){for(const i in this.objects)this.objects[i].traverse(r=>{if(r instanceof f.Mesh||r instanceof f.Line)if(r.material instanceof Array)r.material.forEach(a=>{a.clippingPlanes=e?this.localPlanes:this.globalPlanes,a.clipIntersection=e});else{const a=r.material;a.clipIntersection=e,a.clippingPlanes=e?this.localPlanes:this.globalPlanes}})}computedClippingPlane(){const e=new f.Box3;for(const v in this.objects)e.expandByObject(this.objects[v]);const i=e.min,r=e.max,a=new f.Vector3((r.x+i.x)/2,r.y,(r.z+i.z)/2),l=r.distanceTo(i)/4,c=Math.floor(i.x),h=Math.ceil(r.x),p=Math.floor(i.y),u=Math.ceil(r.y),d=Math.floor(i.z),m=Math.ceil(r.z);this.boxVertices.v7=new f.Vector3(c,p,d),this.boxVertices.v2=new f.Vector3(c,p,m),this.boxVertices.v6=new f.Vector3(c,u,d),this.boxVertices.v1=new f.Vector3(c,u,m),this.boxVertices.v4=new f.Vector3(h,p,d),this.boxVertices.v3=new f.Vector3(h,p,m),this.boxVertices.v5=new f.Vector3(h,u,d),this.boxVertices.v0=new f.Vector3(h,u,m),this.injectMeshsAndLine(this.group),this.updateMeshsAndLine(),this.setGlobalMesh(this.group,a,l),this.callBack&&this.callBack({x:[c,h],y:[p,u],z:[d,m]})}setGlobalMesh(e,i,r){const a=new f.Vector3(r,0,r),l=new f.Vector3(-r,0,r),c=new f.Vector3(-r,0,-r),h=new f.Vector3(r,0,-r);this.localMesh=this.createMesh("global",.2,2),this.localMesh.geometry.setFromPoints([l,a,h,h,c,l]),this.localMesh.position.copy(i),this.localMesh.visible=!1,e.add(this.localMesh);const p=new f.Plane;a.y=i.y,l.y=i.y,c.y=i.y,p.setFromCoplanarPoints(a,l,c),this.localPlanes.push(p),this.setLocalClipping(!0)}createMesh(e,i,r){const a=new f.BufferGeometry,l=new f.MeshBasicMaterial({color:6799930,transparent:!0,opacity:i||0,side:r||0}),c=new f.Mesh(a,l);switch(c.name=e,e){case"left":this.planes[e]=new f.Plane(new f.Vector3(1,0,0),100);break;case"right":this.planes[e]=new f.Plane(new f.Vector3(-1,0,0),100);break;case"top":this.planes[e]=new f.Plane(new f.Vector3(0,-1,0),100);break;case"bottom":this.planes[e]=new f.Plane(new f.Vector3(0,1,0),100);break;case"front":this.planes[e]=new f.Plane(new f.Vector3(0,0,-1),100);break;case"back":this.planes[e]=new f.Plane(new f.Vector3(0,0,1),100);break}return c}createLine(){const e=new f.BufferGeometry,i=new f.LineBasicMaterial({color:3309539});return new f.Line(e,i)}injectMeshsAndLine(e){this.boxMeshs.left=this.createMesh("left"),this.boxMeshs.right=this.createMesh("right"),this.boxMeshs.bottom=this.createMesh("bottom"),this.boxMeshs.top=this.createMesh("top"),this.boxMeshs.front=this.createMesh("front"),this.boxMeshs.back=this.createMesh("back"),this.boxMeshs.line=this.createLine();for(const i in this.boxMeshs)this.boxMeshs[i].visible=!1;for(const i in this.planes)this.globalPlanes.push(this.planes[i]);e.add(this.boxMeshs.left,this.boxMeshs.right,this.boxMeshs.bottom,this.boxMeshs.top,this.boxMeshs.front,this.boxMeshs.back,this.boxMeshs.line),this.meshs.push(this.boxMeshs.left,this.boxMeshs.right,this.boxMeshs.bottom,this.boxMeshs.top,this.boxMeshs.front,this.boxMeshs.back)}updateMeshsAndLine(){const e=[this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v6,this.boxVertices.v6,this.boxVertices.v2,this.boxVertices.v1],i=[this.boxVertices.v4,this.boxVertices.v5,this.boxVertices.v3,this.boxVertices.v5,this.boxVertices.v0,this.boxVertices.v3],r=[this.boxVertices.v4,this.boxVertices.v3,this.boxVertices.v2,this.boxVertices.v2,this.boxVertices.v7,this.boxVertices.v4],a=[this.boxVertices.v1,this.boxVertices.v0,this.boxVertices.v5,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v1],l=[this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v0,this.boxVertices.v2,this.boxVertices.v0,this.boxVertices.v1],c=[this.boxVertices.v5,this.boxVertices.v4,this.boxVertices.v7,this.boxVertices.v7,this.boxVertices.v6,this.boxVertices.v5],h=[this.boxVertices.v0,this.boxVertices.v1,this.boxVertices.v0,this.boxVertices.v3,this.boxVertices.v0,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v1,this.boxVertices.v6,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v1,this.boxVertices.v2,this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v4,this.boxVertices.v3,this.boxVertices.v4,this.boxVertices.v5,this.boxVertices.v4,this.boxVertices.v7];this.boxMeshs.left.geometry.setFromPoints(e),this.boxMeshs.right.geometry.setFromPoints(i),this.boxMeshs.bottom.geometry.setFromPoints(r),this.boxMeshs.top.geometry.setFromPoints(a),this.boxMeshs.front.geometry.setFromPoints(l),this.boxMeshs.back.geometry.setFromPoints(c),this.boxMeshs.line.geometry.setFromPoints(h);for(const p in this.boxMeshs)this.boxMeshs[p].geometry.computeBoundingSphere();this.planes.left.setFromCoplanarPoints(this.boxVertices.v6,this.boxVertices.v2,this.boxVertices.v7),this.planes.right.setFromCoplanarPoints(this.boxVertices.v3,this.boxVertices.v5,this.boxVertices.v4),this.planes.top.setFromCoplanarPoints(this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v4),this.planes.bottom.setFromCoplanarPoints(this.boxVertices.v5,this.boxVertices.v0,this.boxVertices.v1),this.planes.front.setFromCoplanarPoints(this.boxVertices.v0,this.boxVertices.v3,this.boxVertices.v2),this.planes.back.setFromCoplanarPoints(this.boxVertices.v7,this.boxVertices.v4,this.boxVertices.v5)}changeBoxCutting(e,i){i=="x"?(this.boxVertices.v2.x=e.x[0],this.boxVertices.v7.x=e.x[0],this.boxVertices.v6.x=e.x[0],this.boxVertices.v1.x=e.x[0],this.boxVertices.v0.x=e.x[1],this.boxVertices.v3.x=e.x[1],this.boxVertices.v4.x=e.x[1],this.boxVertices.v5.x=e.x[1]):i=="y"?(this.boxVertices.v0.y=e.y[1],this.boxVertices.v1.y=e.y[1],this.boxVertices.v6.y=e.y[1],this.boxVertices.v5.y=e.y[1],this.boxVertices.v2.y=e.y[0],this.boxVertices.v3.y=e.y[0],this.boxVertices.v4.y=e.y[0],this.boxVertices.v7.y=e.y[0]):i=="z"&&(this.boxVertices.v0.z=e.z[1],this.boxVertices.v1.z=e.z[1],this.boxVertices.v2.z=e.z[1],this.boxVertices.v3.z=e.z[1],this.boxVertices.v4.z=e.z[0],this.boxVertices.v5.z=e.z[0],this.boxVertices.v6.z=e.z[0],this.boxVertices.v7.z=e.z[0]),this.updateMeshsAndLine()}initEvents(){this.dragControl=new Xo(this.meshs,this.camera,this.element),this.dragControl.enabled=!1,this.dragControl.addEventListener("dragstart",()=>{this.control.enabled=!1}),this.dragControl.addEventListener("dragend",()=>{this.control.enabled=!0}),this.dragControl.addEventListener("hoveron",e=>{this.resetMaterial();const i=e.object;i.material.opacity=.5}),this.dragControl.addEventListener("hoveroff",()=>{this.resetMaterial()}),this.dragControl.addEventListener("drag",e=>{const i=e.object,r=e.point;switch(i.name){case"left":this.boxVertices.v7.x=r.x,this.boxVertices.v6.x=r.x,this.boxVertices.v2.x=r.x,this.boxVertices.v1.x=r.x;break;case"right":this.boxVertices.v0.x=r.x,this.boxVertices.v3.x=r.x,this.boxVertices.v4.x=r.x,this.boxVertices.v5.x=r.x;break;case"top":this.boxVertices.v0.y=r.y,this.boxVertices.v1.y=r.y,this.boxVertices.v6.y=r.y,this.boxVertices.v5.y=r.y;break;case"bottom":this.boxVertices.v2.y=r.y,this.boxVertices.v3.y=r.y,this.boxVertices.v4.y=r.y,this.boxVertices.v7.y=r.y;break;case"front":this.boxVertices.v0.z=r.z,this.boxVertices.v1.z=r.z,this.boxVertices.v2.z=r.z,this.boxVertices.v3.z=r.z;break;case"back":this.boxVertices.v4.z=r.z,this.boxVertices.v5.z=r.z,this.boxVertices.v6.z=r.z,this.boxVertices.v7.z=r.z;break}this.updateMeshsAndLine(),this.setParam&&this.setParam({x:[this.boxVertices.v7.x,this.boxVertices.v0.x],y:[this.boxVertices.v7.y,this.boxVertices.v0.y],z:[this.boxVertices.v7.z,this.boxVertices.v0.z]})}),this.transControl=new Zo(this.camera,this.element),this.transControl.setMode("rotate"),this.transControl.enabled=!1,this.transControl.addEventListener("objectChange",()=>{this.updateLocalPlane()}),this.transControl.addEventListener("dragging-changed",e=>{this.control.enabled=!e.value}),this.group.add(this.transControl),this.transControl.visible=!1}resetMaterial(){this.meshs.forEach(e=>{e.material.opacity=0})}updateLocalPlane(){const e=this.localMesh.geometry.attributes.position,i=new f.Vector3(e.getX(0),e.getY(0),e.getZ(0)),r=new f.Vector3(e.getX(1),e.getY(1),e.getZ(1)),a=new f.Vector3(e.getX(2),e.getY(2),e.getZ(2));i.applyMatrix4(this.localMesh.matrix),r.applyMatrix4(this.localMesh.matrix),a.applyMatrix4(this.localMesh.matrix),this.localPlanes[0].setFromCoplanarPoints(a,r,i)}detory(){this.renderer.localClippingEnabled=!1,this.setLocalClipping(!1);for(const e in this.boxMeshs)this.boxMeshs[e].geometry.dispose(),this.boxMeshs[e].material.dispose(),this.group.remove(this.boxMeshs[e]);this.localMesh.geometry.dispose(),this.localMesh.material.dispose(),this.group.remove(this.localMesh),this.globalPlanes.length=0,this.localPlanes.length=0,this.dragControl.dispose(),this.transControl.dispose(),this.group.remove(this.transControl)}}class wa{constructor(e,i){L(this,"cameraInfo");L(this,"raysInfo");L(this,"elementInfo");L(this,"raycaster",new f.Raycaster);L(this,"funDes");L(this,"objectMesh");L(this,"newMesh");L(this,"resultBack");var l;this.raysInfo=[];for(const c in e.objs){const h=e.objs[c];h.visible&&h.traverse(p=>{p.visible&&p instanceof f.Mesh&&this.raysInfo.push(p)})}this.cameraInfo=e.camera,this.elementInfo=e.element,this.objectMesh=e.allMesh,this.resultBack=i.callback;const r=new f.BufferGeometry,a=new f.MeshBasicMaterial({color:i.color||4286945,transparent:!0,opacity:i.opacity||.5,depthTest:!1});this.newMesh=new f.Mesh(r,a),this.newMesh.renderOrder=1e3,(l=this.cameraInfo.parent)==null||l.add(this.newMesh),this.funDes="",this.initEvents()}mouseClick(e){const i=this.elementInfo.getBoundingClientRect(),r=i.width,a=i.height,l=e.clientY-i.top,c=e.clientX-i.left,h={x:0,y:0};h.x=c/r*2-1,h.y=-(l/a)*2+1,this.raycaster.setFromCamera(h,this.cameraInfo);const p=this.raycaster.intersectObjects(this.raysInfo,!1);if(p.length==0){this.newMesh.geometry.setFromPoints([]);return}if(p.length>0&&p[0].object.type=="Mesh"&&p[0].faceIndex){const u=p[0].faceIndex*3,d=p[0].object,v=d.geometry.userData;for(const g in v){const x=v[g];let b=!1;for(let C=0;C<x.length;C++){const T=x[C];if(u<T.face_end&&u>T.face_start){const A=T.uuid;this.newMesh.geometry.copy(this.objectMesh[A].geometry),this.newMesh.geometry.applyMatrix4(this.objectMesh[A].matrix),b=!0;break}}if(b){const C=d.parent.userData.file_id;this.resultBack(g,C);break}}}}initEvents(){this.funDes=this.mouseClick.bind(this),this.elementInfo.addEventListener("click",this.funDes)}destory(){var e;this.newMesh.geometry.dispose(),this.newMesh.material.dispose(),(e=this.newMesh.parent)==null||e.remove(this.newMesh),this.elementInfo.removeEventListener("click",this.funDes)}}class ad{constructor(){L(this,"handlers");this.handlers={}}on(e,i){this.handlers[e]==null&&(this.handlers[e]=[]),this.handlers[e].push(i)}off(e,i){if(this.handlers[e]instanceof Array){let r=this.handlers[e];for(let a=0;a<r.length;a++)if(r[a]==i){r.splice(a,1);break}}}emit(e){e.target||(e.target=this),this.handlers[e.type]instanceof Array&&this.handlers[e.type].forEach(r=>{r(e)})}}const ys=new ad;class ld{constructor(e,i){L(this,"viewer");L(this,"wrapper");L(this,"model");L(this,"floor");L(this,"artifact");L(this,"config",{model:{show:!0,name:"模型"},floor:{show:!0,name:"楼层",layer:99},component:{show:!0,name:"构件",layer:99},background:"#ffffff",highLightMeshs:!0,eventName:"",triangleClickCallBack:void 0,inputPointerupCallBack:void 0});L(this,"mountTree");L(this,"selectName");this.viewer=e,this.wrapper=document.createElement("div"),i.wrapper.appendChild(this.wrapper),this.mountTree={},this.selectName="",i.config&&(this.config.model.show=!!i.config.model.show,this.config.model.name=i.config.model.name||"模型",this.config.floor.show=!!i.config.floor.show,this.config.floor.name=i.config.floor.name||"楼层",this.config.floor.layer=i.config.floor.layer||99,this.config.component.name=i.config.component.name||"构件",this.config.component.show=!!i.config.component.show,this.config.component.layer=i.config.component.layer||99,this.config.background=i.config.background||"#fff",this.config.highLightMeshs=!!(i.config.highLightMeshs===void 0||i.config.highLightMeshs),this.config.triangleClickCallBack=i.triangleClickCallBack,this.config.inputPointerupCallBack=i.inputPointerupCallBack),i.eventName&&(this.config.eventName=i.eventName),this.wrapper.style.width="100%",this.wrapper.style.height="100%",this.wrapper.style.backgroundColor=this.config.background,this.wrapper.style.boxShadow="0px 1px 4px 0px rgba(0,0,0,0.1)",this.wrapper.style.position="relative",this.wrapper.style.userSelect="none",this.appendHeader(),this.wrapper.appendChild(this.appendStretch())}appendHeader(){const e=document.createElement("div");e.className="tree-header";const i=document.createElement("div"),r=document.createElement("div"),a=document.createElement("div");i.innerText=this.config.model.name||"模型",r.innerText=this.config.floor.name||"楼层",a.innerText=this.config.component.name||"构件",this.wrapper.appendChild(e);const{model:l,floor:c,artifact:h}=this.appendContent();this.config.model.show&&(e.appendChild(i),i.className="header-active",r.className="",a.className="",l.className="tree-active",c.className="",h.className=""),this.config.floor.show&&(e.appendChild(r),i.className="",r.className="header-active",a.className="",l.className="",c.className="tree-active",h.className=""),this.config.component.show&&(e.appendChild(a),i.className="",r.className="",a.className="header-active",l.className="",c.className="",h.className="tree-active");const p=function(){for(let m=0;m<l.children[0].children.length;m++){const g=l.children[0].children[m].children[0];if(g&&g.getAttribute("checked")=="0"){const b=new Event("pointerup");g.dispatchEvent(b)}}},u=function(){for(let m=0;m<c.children[0].children.length;m++){const g=c.children[0].children[m].children[1];if(g&&g.getAttribute("checked")=="0"){const b=new Event("pointerup");g.dispatchEvent(b)}}},d=function(){for(let m=0;m<h.children[0].children.length;m++){const g=h.children[0].children[m].children[1];if(g&&g.getAttribute("checked")=="0"){const b=new Event("pointerup");g.dispatchEvent(b)}}};i.onclick=function(){i.className="header-active",r.className="",a.className="",l.className="tree-active",c.className="",h.className="",u(),d()},r.onclick=function(){i.className="",r.className="header-active",a.className="",l.className="",c.className="tree-active",h.className="",p(),d()},a.onclick=function(){i.className="",r.className="",a.className="header-active",l.className="",c.className="",h.className="tree-active",p(),u()}}appendContent(){const e=document.createElement("div");e.className="tree-content",this.wrapper.appendChild(e);const i=document.createElement("div"),r=document.createElement("div"),a=document.createElement("div");return e.appendChild(i),e.appendChild(r),e.appendChild(a),this.model=i,this.floor=r,this.artifact=a,{model:i,floor:r,artifact:a}}findIndex(e,i){return e.parent?(i++,this.findIndex(e.parent,i)):i}createNode(e,i,r=!1){const a=this,l=this.findIndex(e,0),c=document.createElement("div");c.className="tree-parent";const h=document.createElement("div");c.appendChild(h),h.className="tree-item",h.style.paddingLeft=l*26+"px";const p=ua();p.setAttribute("checked","1");const u=document.createElement("span");if(u.innerText=e.name,u.style.width="calc(100% - 26px)",e.children&&e.children.length>0&&(a.config.floor.show&&a.config.floor.layer-1>=l||a.config.component.show&&a.config.component.layer-1>=l)){const m=ha();m.setAttribute("rotate","off"),m.style.transform="rotateZ(-90deg)",h.appendChild(m),m.onclick=function(){m.getAttribute("rotate")=="on"?(m.style.transform="rotateZ(-90deg)",c.style.height="30px",m.setAttribute("rotate","off")):(c.childNodes.length<e.children.length+1&&(e.children.forEach(g=>{const x=a.createNode(g,i,!1);c.appendChild(x)}),e.visible||a.findAllChildNode(c,!1,1)),a.config.triangleClickCallBack&&a.config.triangleClickCallBack(e,i,c.childNodes.length<e.children.length+1),m.style.transform="rotateZ(0)",c.style.height="auto",m.setAttribute("rotate","on"))}}else l!=0&&(h.style.paddingLeft=(l+1)*26+"px");h.appendChild(p),h.appendChild(u),p.onpointerup=d;function d(){let m=!1;const v=p.getAttribute("checked"),g=p.children[0];if(v=="0"?(p.setAttribute("checked","1"),m=!0,g.setAttribute("opacity","1"),p.style.borderColor="rgba(0, 0, 0, 0)"):(p.setAttribute("checked","0"),m=!1,g.setAttribute("opacity","0"),p.style.borderColor="rgba(0, 0, 0, 0.15)"),r){i.model.visible=m;return}e.visible=m,a.findAllChildNode(c,e.visible,1),x(e,m);function x(T,A){var O;T.visible=A,(O=T==null?void 0:T.children)!=null&&O.length&&(T==null||T.children.forEach(P=>{x(P,A)}))}if(e.visible){if(e.parent){const T=e.parent.children.length;let A=0;if(e.parent.children.forEach(O=>{O.visible&&A++}),A==T){const O=c.parentElement.firstChild;O.childNodes[1].setAttribute("checked","1"),O.childNodes[1].children[0].setAttribute("opacity","1"),O.childNodes[1].style.borderColor="rgba(0, 0, 0, 0)",e.parent.visible=!0}}}else{if(e.parent){e.parent.visible=!1;const T=c.parentElement.firstChild;T.childNodes[1].setAttribute("checked","0"),T.childNodes[1].children[0].setAttribute("opacity","0"),T.childNodes[1].style.borderColor="rgba(0, 0, 0, 0.15)"}(a.selectName==e.name||e.category=="Root")&&(a.viewer.highLightMeshManager.highLightMesh.geometry.setFromPoints([]),window.onpointerup=null)}const b={},C=function(T,A){if(T.children&&T.children.length>0)T.children.forEach(O=>{C(O,A)});else for(const O in i){if(O=="model")continue;const P=i[O],V=P.geometry,R=V.attributes.position;V.userData[T.guid]&&(V.userData[T.guid].forEach(I=>{const G=I.geo_start,X=I.geo_end;if(A){if(I.position)for(let j=G;j<X;j++){const z=(j-G)*3;R.setXYZ(j,I.position[z],I.position[z+1],I.position[z+2])}}else{!I.position&&(I.position=[]);for(let j=G;j<X;j++)I.position.push(R.getX(j),R.getY(j),R.getZ(j)),R.setXYZ(j,0,0,0)}}),b[O]=P,R.needsUpdate=!0)}};C(e,e.visible);for(const T in b){const A=b[T].geometry,O=b[T].children[0];O instanceof f.LineSegments&&(O.geometry.dispose(),O.geometry=new f.EdgesGeometry(A))}a.config.inputPointerupCallBack&&a.config.inputPointerupCallBack(e,i)}return u.onpointerup=function(){if(e.parent==null||!e.visible)return;const m=[],v=function(g){if(g.children&&g.children.length>0)g.children.forEach(x=>{v(x)});else for(const x in i){if(x=="model")continue;const C=i[x].geometry;C.userData[g.guid]&&C.userData[g.guid].forEach(T=>{m.push(T.uuid)})}};a.selectName=e.name,v(e),a.config.eventName!=""&&ys.emit({type:a.config.eventName,data:m}),a.config.highLightMeshs?a.viewer.highLightMeshManager.setHighLightById(m,"uuid"):u.getAttribute("state")=="1"?(u.style.color="",u.setAttribute("state","0")):(u.style.color="#029183",u.setAttribute("state","1"))},u.onpointerover=function(){e.parent||i.model&&i.model.children.forEach(m=>{m instanceof f.Mesh&&(m.material.depthTest=!1,m.material.depthWrite=!1)})},u.onpointerout=function(){e.parent||i.model&&i.model.children.forEach(m=>{m instanceof f.Mesh&&(m.material.depthTest=!0,m.material.depthWrite=!0)})},c}findAllChildNode(e,i,r=0){if(e.children.length>=r+1)for(let a=r;a<e.children.length;a++){const l=e.children[a];switch(l.className){case"tree-item":if(l!=null&&l.children.length){const c=l==null?void 0:l.children[(l==null?void 0:l.children.length)-2];if(c){const h=c.children[0];i?(c.setAttribute("checked","1"),h&&h.setAttribute("opacity","1"),c.style.borderColor="rgba(0, 0, 0, 0)"):(c.setAttribute("checked","0"),h&&h.setAttribute("opacity","0"),c.style.borderColor="rgba(0, 0, 0, 0.15)")}}break;case"tree-parent":this.findAllChildNode(l,i,0);break}}}addTree(e,i,r){const a=Object.assign({},i);a.children=[];const l=this.createNode(a,r,!0);this.model.appendChild(l);const c=this.createNode(i,r);this.floor.appendChild(c);const h=this.createNode(e,r);this.artifact.appendChild(h),this.mountTree={},i.children&&i.children.forEach(u=>{const m=Number((Math.random()*1e6).toFixed(6)).toString(16).split(".").join("-").toLocaleUpperCase();this.mountTree[m]=Object.assign({},u),this.mountTree[m].model=r.model});const p=this;return r.model.addEventListener("destory",()=>{p.model.removeChild(l),p.floor.removeChild(c),p.artifact.removeChild(h)}),ys.emit({type:"getFloorData",data:this.mountTree}),this.mountTree}selectFloor(e,i){const r=[];this.mountTree[e].model.visible=!1;const a=this.mountTree[e].model.children,l=function(c){c.children&&c.children.length>0?c.children.forEach(h=>{l(h)}):a.forEach(h=>{const u=h.geometry;u.userData[c.guid]&&u.userData[c.guid].forEach(d=>{r.push(d.uuid)})})};l(this.mountTree[e]),this.viewer.lookingDownEntity(r,i)}showAllModel(e){this.mountTree[e].model.visible=!0,this.viewer.orbitControl.enableRotate=!0,this.viewer.floorGroup.clear(),this.viewer.toggleCamera("perspective"),this.viewer.resetView(400)}showOrHideMeshs(e,i,r){const a=function(l,c){l.children&&l.children.length>0?l.children.forEach(h=>{a(h,c)}):i.traverse(h=>{if(h instanceof f.Mesh){const p=h.geometry,u=p.attributes.position;p.userData[l.guid]&&(p.userData[l.guid].forEach(d=>{const m=d.geo_start,v=d.geo_end;if(c){if(d.position)for(let g=m;g<v;g++){const x=(g-m)*3;u.setXYZ(g,d.position[x],d.position[x+1],d.position[x+2])}}else{!d.position&&(d.position=[]);for(let g=m;g<v;g++)d.position.push(u.getX(g),u.getY(g),u.getZ(g)),u.setXYZ(g,0,0,0)}}),u.needsUpdate=!0)}})};a(e,r)}appendStretch(){const e=document.createElement("div");e.style.width="16px",e.style.height="16px",e.style.position="absolute",e.style.right="0",e.style.bottom="0",e.style.cursor="nwse-resize",e.innerHTML=`
136
+ </div>`;const r=i.getElementsByClassName("setting-close")[0];r&&(r.onmouseup=()=>{i.style.display="none",e==null||e.classList.remove("is-active")}),i.onmousedown=function(p){p.stopPropagation()};const a=i.getElementsByClassName("unit-select")[0],l=i.getElementsByClassName("accuracy-select")[0],c=this,h={unit:"mm",precision:"2"};return a.onchange=function(p){h.unit=p.target.value,c.measure.adjustSetting(h)},l.onchange=function(p){h.precision=p.target.value,c.measure.adjustSetting(h)},i}_meaCallBack(e){if(e.num1){const i=this.toolsWrapper.getElementsByClassName("measure-text-num")[0];i.innerText=e.num1}if(e.num_x){const i=this.toolsWrapper.getElementsByClassName("measure-text-num-x-val")[0];i.innerText=e.num_x}if(e.num_y){const i=this.toolsWrapper.getElementsByClassName("measure-text-num-y-val")[0];i.innerText=e.num_y}}_distanceIcon(){const e=Ei();return this._elementEvent(e,"distance"),e}_angleIcon(){const e=Si();return this._elementEvent(e,"angle"),e}_areaIcon(){const e=fa();return this._elementEvent(e,"area"),e}_elementEvent(e,i){const r=this;e.onmousedown=function(a){a.stopPropagation()},e.onpointerup=function(){var m;const a=(m=e.parentElement)==null?void 0:m.getElementsByClassName("measure-active")[0];a&&a.classList.remove("measure-active");const l=r.toolsWrapper.getElementsByClassName("measure-line-x")[0],c=r.toolsWrapper.getElementsByClassName("measure-line-y")[0],h=r.toolsWrapper.getElementsByClassName("measure-text-type")[0],p=r.toolsWrapper.getElementsByClassName("measure-text-num")[0],u=r.toolsWrapper.getElementsByClassName("measure-text-num-x-val")[0],d=r.toolsWrapper.getElementsByClassName("measure-text-num-y-val")[0];p.innerText="",u.innerText="",d.innerText="",i=="distance"?(h.innerText="距离:",l.style.display="flex",c.style.display="flex"):(i=="angle"&&(h.innerText="角度:"),i=="area"&&(h.innerText="面积:"),l.style.display="none",c.style.display="none"),e.classList.add("measure-active"),r.measure.setType(i)}}destory(){this.toolsWrapper.style.display="none",this.measure.destory()}}let nd=class{constructor(e,i,r){L(this,"dom");L(this,"fullFlag");L(this,"target");if(this.fullFlag=!0,this.target=r||document.documentElement,this.dom=document.createElement("div"),e){const a=document.createElement("img");a.src=e,this.dom.appendChild(a)}else this.dom.appendChild(ki());this.dom.setAttribute("data-attr",i||"全屏"),document.addEventListener("fullscreenchange",()=>{this.fullFlag=!document.fullscreenElement}),this.dom.onmouseup=()=>{document.fullscreenElement?document.exitFullscreen():this.target.requestFullscreen()}}};class xa extends jn{constructor(e,i){super(e,{baseConfig:{background:new f.Color(i||0)},cube:{show:!1}}),e.parentElement.id="viewer-3d-dxf",this._Toggle2DMode()}_Toggle2DMode(){this.orbitControl.enableRotate=!1,this.camera=this.orthographicCamera,this.camera.position.set(0,100,0),this.camera.lookAt(0,0,0),this.camera.updateProjectionMatrix(),this.orbitControl.object=this.camera}centerView(e=.1){const i=new f.Box3;i.expandByObject(this.scene),!(i.min.x==i.max.x||i.min.z==i.max.z)&&this.fitView(i,e)}fitView(e,i){const r=new f.Vector3;e.getSize(r),r.multiplyScalar(1-i);const a=e.getCenter(new f.Vector3),l=e.max.distanceTo(e.min)/1.5,c=new f.Vector3(a.x,a.y+l,a.z);let h;r.x>r.y?h=this.orthographicCamera.right/r.x:h=this.orthographicCamera.top/r.y,this.orthographicCamera.zoom=h,this.camera.position.copy(c),this.orthographicCamera.updateProjectionMatrix(),this.orbitControl.target.copy(a),this.orbitControl.update()}}const id={class:"viewer-box"},od=g.defineComponent({__name:"index-dxf",props:{url:{default:"/A-1F-研发楼.dxf"},showTools:{type:Boolean,default:!0}},setup(o,{expose:e}){const i=o,r=g.ref(null),a=g.ref(null),l=g.ref(!1),c=["/fonts/Roboto-LightItalic.ttf","/fonts/NotoSansDisplay-SemiCondensedLightItalic.ttf","/fonts/HanaMinA.ttf","/fonts/NanumGothic-Regular.ttf","/fonts/msyh.ttf"];let h,p,u=null,d=null,m=null;function v(C){const T=C[0].pageX-C[1].pageX,A=C[0].pageY-C[1].pageY;return Math.sqrt(T*T+A*A)}function y(C){C.touches.length===1&&(C.preventDefault(),d=C.touches[0].pageX,m=C.touches[0].pageY),C.touches.length===2&&(C.preventDefault(),u=v(C.touches))}function x(C){if(C.preventDefault(),C.touches.length===1&&d!==null&&m!==null){const T=C.touches[0].pageX,A=C.touches[0].pageY,O=T-d,P=A-m;for(const V in h.objs)if(Object.hasOwnProperty.call(h.objs,V)){const B=h.objs[V];B.position.x+=O/2/h.camera.zoom,B.position.z+=P/2/h.camera.zoom}d=T,m=A}if(C.touches.length===2){const T=v(C.touches);if(u!==null){const A=T/u;h.camera.zoom*=A,h.camera.updateProjectionMatrix(),u=T}}}const b=function(C){p&&(p.dispatchEvent({type:"destory"}),delete h.objs[p.uuid]),l.value=!0;const T=Gt.SetupWorker();new Gt().Load({url:C,fonts:c,progressCbk:void 0,workerFactory:T}).then(O=>{let P=new f.Box3;P.setFromObject(O);const V=P.getSize(new f.Vector3),B=600/Math.max(V.x,V.z);p=O,O.scale.set(B,B,B),h.addObject(O),h.centerView(),h.renderer.domElement.addEventListener("touchstart",y,!1),h.renderer.domElement.addEventListener("touchmove",x,!1),l.value=!1})};return g.onMounted(()=>{h=new xa(r.value),a.value&&new ga(h,{wrapper:a.value,fitView:{padding:.35},handleLayers:{},dxfMeasure:{},fullScreen:{},colorTurn:{}}),i.url&&b(i.url),g.watch(()=>i.url,C=>{h&&b(C)})}),g.onUnmounted(()=>{h.destroy()}),e({viewer:()=>h}),(C,T)=>{const A=g.resolveDirective("loading");return g.withDirectives((g.openBlock(),g.createElementBlock("div",id,[C.showTools?(g.openBlock(),g.createElementBlock("div",{key:0,class:"dxf-tools",ref_key:"dxfTools",ref:a},null,512)):g.createCommentVNode("",!0),g.createElementVNode("canvas",{id:"viewer-3d-dxf",ref_key:"viewerDom",ref:r},null,512)])),[[A,g.unref(l)]])}}});const rd=Ue(od,[["__scopeId","data-v-696004c1"]]);class Ca{constructor(e,i){L(this,"renderer");L(this,"element");L(this,"camera");L(this,"globalPlanes");L(this,"localPlanes");L(this,"boxVertices");L(this,"planes");L(this,"boxMeshs");L(this,"localMesh");L(this,"meshs");L(this,"objects");L(this,"control");L(this,"group");L(this,"dragControl");L(this,"transControl");L(this,"clippingType");L(this,"callBack");L(this,"setParam");this.renderer=e.renderer,this.element=e.element,this.camera=e.camera,this.objects=e.objs,this.clippingType="",this.localPlanes=[],this.boxVertices={},this.boxMeshs={},this.planes={},this.globalPlanes=[],this.group=e.containerGroup,e.controlType=="orbit"?this.control=e.orbitControl:e.controlType=="fly"?this.control=e.flyControl:this.control=e.firstControl,this.meshs=[],this.callBack=i.callBackFun,this.setParam=i.set,this.computedClippingPlane(),this.initEvents()}setClippingType(e){if(e=="global"){this.renderer.localClippingEnabled=!0,this.dragControl.enabled=!1;for(const i in this.boxMeshs)this.boxMeshs[i].visible=!1;this.transControl.visible=!0,this.transControl.enabled=!0,this.localMesh.visible=!0,this.transControl.attach(this.localMesh),this.setLocalClipping(!0)}else if(e=="local"){this.renderer.localClippingEnabled=!0,this.dragControl.enabled=!0;for(const i in this.boxMeshs)this.boxMeshs[i].visible=!0;this.transControl.visible=!1,this.transControl.enabled=!1,this.localMesh.visible=!1,this.setLocalClipping(!1)}}setLocalClipping(e){for(const i in this.objects)this.objects[i].traverse(r=>{if(r instanceof f.Mesh||r instanceof f.Line)if(r.material instanceof Array)r.material.forEach(a=>{a.clippingPlanes=e?this.localPlanes:this.globalPlanes,a.clipIntersection=e});else{const a=r.material;a.clipIntersection=e,a.clippingPlanes=e?this.localPlanes:this.globalPlanes}})}computedClippingPlane(){const e=new f.Box3;for(const v in this.objects)e.expandByObject(this.objects[v]);const i=e.min,r=e.max,a=new f.Vector3((r.x+i.x)/2,r.y,(r.z+i.z)/2),l=r.distanceTo(i)/4,c=Math.floor(i.x),h=Math.ceil(r.x),p=Math.floor(i.y),u=Math.ceil(r.y),d=Math.floor(i.z),m=Math.ceil(r.z);this.boxVertices.v7=new f.Vector3(c,p,d),this.boxVertices.v2=new f.Vector3(c,p,m),this.boxVertices.v6=new f.Vector3(c,u,d),this.boxVertices.v1=new f.Vector3(c,u,m),this.boxVertices.v4=new f.Vector3(h,p,d),this.boxVertices.v3=new f.Vector3(h,p,m),this.boxVertices.v5=new f.Vector3(h,u,d),this.boxVertices.v0=new f.Vector3(h,u,m),this.injectMeshsAndLine(this.group),this.updateMeshsAndLine(),this.setGlobalMesh(this.group,a,l),this.callBack&&this.callBack({x:[c,h],y:[p,u],z:[d,m]})}setGlobalMesh(e,i,r){const a=new f.Vector3(r,0,r),l=new f.Vector3(-r,0,r),c=new f.Vector3(-r,0,-r),h=new f.Vector3(r,0,-r);this.localMesh=this.createMesh("global",.2,2),this.localMesh.geometry.setFromPoints([l,a,h,h,c,l]),this.localMesh.position.copy(i),this.localMesh.visible=!1,e.add(this.localMesh);const p=new f.Plane;a.y=i.y,l.y=i.y,c.y=i.y,p.setFromCoplanarPoints(a,l,c),this.localPlanes.push(p),this.setLocalClipping(!0)}createMesh(e,i,r){const a=new f.BufferGeometry,l=new f.MeshBasicMaterial({color:6799930,transparent:!0,opacity:i||0,side:r||0}),c=new f.Mesh(a,l);switch(c.name=e,e){case"left":this.planes[e]=new f.Plane(new f.Vector3(1,0,0),100);break;case"right":this.planes[e]=new f.Plane(new f.Vector3(-1,0,0),100);break;case"top":this.planes[e]=new f.Plane(new f.Vector3(0,-1,0),100);break;case"bottom":this.planes[e]=new f.Plane(new f.Vector3(0,1,0),100);break;case"front":this.planes[e]=new f.Plane(new f.Vector3(0,0,-1),100);break;case"back":this.planes[e]=new f.Plane(new f.Vector3(0,0,1),100);break}return c}createLine(){const e=new f.BufferGeometry,i=new f.LineBasicMaterial({color:3309539});return new f.Line(e,i)}injectMeshsAndLine(e){this.boxMeshs.left=this.createMesh("left"),this.boxMeshs.right=this.createMesh("right"),this.boxMeshs.bottom=this.createMesh("bottom"),this.boxMeshs.top=this.createMesh("top"),this.boxMeshs.front=this.createMesh("front"),this.boxMeshs.back=this.createMesh("back"),this.boxMeshs.line=this.createLine();for(const i in this.boxMeshs)this.boxMeshs[i].visible=!1;for(const i in this.planes)this.globalPlanes.push(this.planes[i]);e.add(this.boxMeshs.left,this.boxMeshs.right,this.boxMeshs.bottom,this.boxMeshs.top,this.boxMeshs.front,this.boxMeshs.back,this.boxMeshs.line),this.meshs.push(this.boxMeshs.left,this.boxMeshs.right,this.boxMeshs.bottom,this.boxMeshs.top,this.boxMeshs.front,this.boxMeshs.back)}updateMeshsAndLine(){const e=[this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v6,this.boxVertices.v6,this.boxVertices.v2,this.boxVertices.v1],i=[this.boxVertices.v4,this.boxVertices.v5,this.boxVertices.v3,this.boxVertices.v5,this.boxVertices.v0,this.boxVertices.v3],r=[this.boxVertices.v4,this.boxVertices.v3,this.boxVertices.v2,this.boxVertices.v2,this.boxVertices.v7,this.boxVertices.v4],a=[this.boxVertices.v1,this.boxVertices.v0,this.boxVertices.v5,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v1],l=[this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v0,this.boxVertices.v2,this.boxVertices.v0,this.boxVertices.v1],c=[this.boxVertices.v5,this.boxVertices.v4,this.boxVertices.v7,this.boxVertices.v7,this.boxVertices.v6,this.boxVertices.v5],h=[this.boxVertices.v0,this.boxVertices.v1,this.boxVertices.v0,this.boxVertices.v3,this.boxVertices.v0,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v1,this.boxVertices.v6,this.boxVertices.v5,this.boxVertices.v6,this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v1,this.boxVertices.v2,this.boxVertices.v7,this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v4,this.boxVertices.v3,this.boxVertices.v4,this.boxVertices.v5,this.boxVertices.v4,this.boxVertices.v7];this.boxMeshs.left.geometry.setFromPoints(e),this.boxMeshs.right.geometry.setFromPoints(i),this.boxMeshs.bottom.geometry.setFromPoints(r),this.boxMeshs.top.geometry.setFromPoints(a),this.boxMeshs.front.geometry.setFromPoints(l),this.boxMeshs.back.geometry.setFromPoints(c),this.boxMeshs.line.geometry.setFromPoints(h);for(const p in this.boxMeshs)this.boxMeshs[p].geometry.computeBoundingSphere();this.planes.left.setFromCoplanarPoints(this.boxVertices.v6,this.boxVertices.v2,this.boxVertices.v7),this.planes.right.setFromCoplanarPoints(this.boxVertices.v3,this.boxVertices.v5,this.boxVertices.v4),this.planes.top.setFromCoplanarPoints(this.boxVertices.v2,this.boxVertices.v3,this.boxVertices.v4),this.planes.bottom.setFromCoplanarPoints(this.boxVertices.v5,this.boxVertices.v0,this.boxVertices.v1),this.planes.front.setFromCoplanarPoints(this.boxVertices.v0,this.boxVertices.v3,this.boxVertices.v2),this.planes.back.setFromCoplanarPoints(this.boxVertices.v7,this.boxVertices.v4,this.boxVertices.v5)}changeBoxCutting(e,i){i=="x"?(this.boxVertices.v2.x=e.x[0],this.boxVertices.v7.x=e.x[0],this.boxVertices.v6.x=e.x[0],this.boxVertices.v1.x=e.x[0],this.boxVertices.v0.x=e.x[1],this.boxVertices.v3.x=e.x[1],this.boxVertices.v4.x=e.x[1],this.boxVertices.v5.x=e.x[1]):i=="y"?(this.boxVertices.v0.y=e.y[1],this.boxVertices.v1.y=e.y[1],this.boxVertices.v6.y=e.y[1],this.boxVertices.v5.y=e.y[1],this.boxVertices.v2.y=e.y[0],this.boxVertices.v3.y=e.y[0],this.boxVertices.v4.y=e.y[0],this.boxVertices.v7.y=e.y[0]):i=="z"&&(this.boxVertices.v0.z=e.z[1],this.boxVertices.v1.z=e.z[1],this.boxVertices.v2.z=e.z[1],this.boxVertices.v3.z=e.z[1],this.boxVertices.v4.z=e.z[0],this.boxVertices.v5.z=e.z[0],this.boxVertices.v6.z=e.z[0],this.boxVertices.v7.z=e.z[0]),this.updateMeshsAndLine()}initEvents(){this.dragControl=new Xo(this.meshs,this.camera,this.element),this.dragControl.enabled=!1,this.dragControl.addEventListener("dragstart",()=>{this.control.enabled=!1}),this.dragControl.addEventListener("dragend",()=>{this.control.enabled=!0}),this.dragControl.addEventListener("hoveron",e=>{this.resetMaterial();const i=e.object;i.material.opacity=.5}),this.dragControl.addEventListener("hoveroff",()=>{this.resetMaterial()}),this.dragControl.addEventListener("drag",e=>{const i=e.object,r=e.point;switch(i.name){case"left":this.boxVertices.v7.x=r.x,this.boxVertices.v6.x=r.x,this.boxVertices.v2.x=r.x,this.boxVertices.v1.x=r.x;break;case"right":this.boxVertices.v0.x=r.x,this.boxVertices.v3.x=r.x,this.boxVertices.v4.x=r.x,this.boxVertices.v5.x=r.x;break;case"top":this.boxVertices.v0.y=r.y,this.boxVertices.v1.y=r.y,this.boxVertices.v6.y=r.y,this.boxVertices.v5.y=r.y;break;case"bottom":this.boxVertices.v2.y=r.y,this.boxVertices.v3.y=r.y,this.boxVertices.v4.y=r.y,this.boxVertices.v7.y=r.y;break;case"front":this.boxVertices.v0.z=r.z,this.boxVertices.v1.z=r.z,this.boxVertices.v2.z=r.z,this.boxVertices.v3.z=r.z;break;case"back":this.boxVertices.v4.z=r.z,this.boxVertices.v5.z=r.z,this.boxVertices.v6.z=r.z,this.boxVertices.v7.z=r.z;break}this.updateMeshsAndLine(),this.setParam&&this.setParam({x:[this.boxVertices.v7.x,this.boxVertices.v0.x],y:[this.boxVertices.v7.y,this.boxVertices.v0.y],z:[this.boxVertices.v7.z,this.boxVertices.v0.z]})}),this.transControl=new Zo(this.camera,this.element),this.transControl.setMode("rotate"),this.transControl.enabled=!1,this.transControl.addEventListener("objectChange",()=>{this.updateLocalPlane()}),this.transControl.addEventListener("dragging-changed",e=>{this.control.enabled=!e.value}),this.group.add(this.transControl),this.transControl.visible=!1}resetMaterial(){this.meshs.forEach(e=>{e.material.opacity=0})}updateLocalPlane(){const e=this.localMesh.geometry.attributes.position,i=new f.Vector3(e.getX(0),e.getY(0),e.getZ(0)),r=new f.Vector3(e.getX(1),e.getY(1),e.getZ(1)),a=new f.Vector3(e.getX(2),e.getY(2),e.getZ(2));i.applyMatrix4(this.localMesh.matrix),r.applyMatrix4(this.localMesh.matrix),a.applyMatrix4(this.localMesh.matrix),this.localPlanes[0].setFromCoplanarPoints(a,r,i)}detory(){this.renderer.localClippingEnabled=!1,this.setLocalClipping(!1);for(const e in this.boxMeshs)this.boxMeshs[e].geometry.dispose(),this.boxMeshs[e].material.dispose(),this.group.remove(this.boxMeshs[e]);this.localMesh.geometry.dispose(),this.localMesh.material.dispose(),this.group.remove(this.localMesh),this.globalPlanes.length=0,this.localPlanes.length=0,this.dragControl.dispose(),this.transControl.dispose(),this.group.remove(this.transControl)}}class wa{constructor(e,i){L(this,"cameraInfo");L(this,"raysInfo");L(this,"elementInfo");L(this,"raycaster",new f.Raycaster);L(this,"funDes");L(this,"objectMesh");L(this,"newMesh");L(this,"resultBack");var l;this.raysInfo=[];for(const c in e.objs){const h=e.objs[c];h.visible&&h.traverse(p=>{p.visible&&p instanceof f.Mesh&&this.raysInfo.push(p)})}this.cameraInfo=e.camera,this.elementInfo=e.element,this.objectMesh=e.allMesh,this.resultBack=i.callback;const r=new f.BufferGeometry,a=new f.MeshBasicMaterial({color:i.color||4286945,transparent:!0,opacity:i.opacity||.5,depthTest:!1});this.newMesh=new f.Mesh(r,a),this.newMesh.renderOrder=1e3,(l=this.cameraInfo.parent)==null||l.add(this.newMesh),this.funDes="",this.initEvents()}mouseClick(e){const i=this.elementInfo.getBoundingClientRect(),r=i.width,a=i.height,l=e.clientY-i.top,c=e.clientX-i.left,h={x:0,y:0};h.x=c/r*2-1,h.y=-(l/a)*2+1,this.raycaster.setFromCamera(h,this.cameraInfo);const p=this.raycaster.intersectObjects(this.raysInfo,!1);if(p.length==0){this.newMesh.geometry.setFromPoints([]);return}if(p.length>0&&p[0].object.type=="Mesh"&&p[0].faceIndex){const u=p[0].faceIndex*3,d=p[0].object,v=d.geometry.userData;for(const y in v){const x=v[y];let b=!1;for(let C=0;C<x.length;C++){const T=x[C];if(u<T.face_end&&u>T.face_start){const A=T.uuid;this.newMesh.geometry.copy(this.objectMesh[A].geometry),this.newMesh.geometry.applyMatrix4(this.objectMesh[A].matrix),b=!0;break}}if(b){const C=d.parent.userData.file_id;this.resultBack(y,C);break}}}}initEvents(){this.funDes=this.mouseClick.bind(this),this.elementInfo.addEventListener("click",this.funDes)}destory(){var e;this.newMesh.geometry.dispose(),this.newMesh.material.dispose(),(e=this.newMesh.parent)==null||e.remove(this.newMesh),this.elementInfo.removeEventListener("click",this.funDes)}}class ad{constructor(){L(this,"handlers");this.handlers={}}on(e,i){this.handlers[e]==null&&(this.handlers[e]=[]),this.handlers[e].push(i)}off(e,i){if(this.handlers[e]instanceof Array){let r=this.handlers[e];for(let a=0;a<r.length;a++)if(r[a]==i){r.splice(a,1);break}}}emit(e){e.target||(e.target=this),this.handlers[e.type]instanceof Array&&this.handlers[e.type].forEach(r=>{r(e)})}}const vs=new ad;class ld{constructor(e,i){L(this,"viewer");L(this,"wrapper");L(this,"model");L(this,"floor");L(this,"artifact");L(this,"config",{model:{show:!0,name:"模型"},floor:{show:!0,name:"楼层",layer:99},component:{show:!0,name:"构件",layer:99},background:"#ffffff",highLightMeshs:!0,eventName:"",triangleClickCallBack:void 0,inputPointerupCallBack:void 0});L(this,"mountTree");L(this,"selectName");this.viewer=e,this.wrapper=document.createElement("div"),i.wrapper.appendChild(this.wrapper),this.mountTree={},this.selectName="",i.config&&(this.config.model.show=!!i.config.model.show,this.config.model.name=i.config.model.name||"模型",this.config.floor.show=!!i.config.floor.show,this.config.floor.name=i.config.floor.name||"楼层",this.config.floor.layer=i.config.floor.layer||99,this.config.component.name=i.config.component.name||"构件",this.config.component.show=!!i.config.component.show,this.config.component.layer=i.config.component.layer||99,this.config.background=i.config.background||"#fff",this.config.highLightMeshs=!!(i.config.highLightMeshs===void 0||i.config.highLightMeshs),this.config.triangleClickCallBack=i.triangleClickCallBack,this.config.inputPointerupCallBack=i.inputPointerupCallBack),i.eventName&&(this.config.eventName=i.eventName),this.wrapper.style.width="100%",this.wrapper.style.height="100%",this.wrapper.style.backgroundColor=this.config.background,this.wrapper.style.boxShadow="0px 1px 4px 0px rgba(0,0,0,0.1)",this.wrapper.style.position="relative",this.wrapper.style.userSelect="none",this.appendHeader(),this.wrapper.appendChild(this.appendStretch())}appendHeader(){const e=document.createElement("div");e.className="tree-header";const i=document.createElement("div"),r=document.createElement("div"),a=document.createElement("div");i.innerText=this.config.model.name||"模型",r.innerText=this.config.floor.name||"楼层",a.innerText=this.config.component.name||"构件",this.wrapper.appendChild(e);const{model:l,floor:c,artifact:h}=this.appendContent();this.config.model.show&&(e.appendChild(i),i.className="header-active",r.className="",a.className="",l.className="tree-active",c.className="",h.className=""),this.config.floor.show&&(e.appendChild(r),i.className="",r.className="header-active",a.className="",l.className="",c.className="tree-active",h.className=""),this.config.component.show&&(e.appendChild(a),i.className="",r.className="",a.className="header-active",l.className="",c.className="",h.className="tree-active");const p=function(){for(let m=0;m<l.children[0].children.length;m++){const y=l.children[0].children[m].children[0];if(y&&y.getAttribute("checked")=="0"){const b=new Event("pointerup");y.dispatchEvent(b)}}},u=function(){for(let m=0;m<c.children[0].children.length;m++){const y=c.children[0].children[m].children[1];if(y&&y.getAttribute("checked")=="0"){const b=new Event("pointerup");y.dispatchEvent(b)}}},d=function(){for(let m=0;m<h.children[0].children.length;m++){const y=h.children[0].children[m].children[1];if(y&&y.getAttribute("checked")=="0"){const b=new Event("pointerup");y.dispatchEvent(b)}}};i.onclick=function(){i.className="header-active",r.className="",a.className="",l.className="tree-active",c.className="",h.className="",u(),d()},r.onclick=function(){i.className="",r.className="header-active",a.className="",l.className="",c.className="tree-active",h.className="",p(),d()},a.onclick=function(){i.className="",r.className="",a.className="header-active",l.className="",c.className="",h.className="tree-active",p(),u()}}appendContent(){const e=document.createElement("div");e.className="tree-content",this.wrapper.appendChild(e);const i=document.createElement("div"),r=document.createElement("div"),a=document.createElement("div");return e.appendChild(i),e.appendChild(r),e.appendChild(a),this.model=i,this.floor=r,this.artifact=a,{model:i,floor:r,artifact:a}}findIndex(e,i){return e.parent?(i++,this.findIndex(e.parent,i)):i}createNode(e,i,r=!1){const a=this,l=this.findIndex(e,0),c=document.createElement("div");c.className="tree-parent";const h=document.createElement("div");c.appendChild(h),h.className="tree-item",h.style.paddingLeft=l*26+"px";const p=ua();p.setAttribute("checked","1");const u=document.createElement("span");if(u.innerText=e.name,u.style.width="calc(100% - 26px)",e.children&&e.children.length>0&&(a.config.floor.show&&a.config.floor.layer-1>=l||a.config.component.show&&a.config.component.layer-1>=l)){const m=ha();m.setAttribute("rotate","off"),m.style.transform="rotateZ(-90deg)",h.appendChild(m),m.onclick=function(){m.getAttribute("rotate")=="on"?(m.style.transform="rotateZ(-90deg)",c.style.height="30px",m.setAttribute("rotate","off")):(c.childNodes.length<e.children.length+1&&(e.children.forEach(y=>{const x=a.createNode(y,i,!1);c.appendChild(x)}),e.visible||a.findAllChildNode(c,!1,1)),a.config.triangleClickCallBack&&a.config.triangleClickCallBack(e,i,c.childNodes.length<e.children.length+1),m.style.transform="rotateZ(0)",c.style.height="auto",m.setAttribute("rotate","on"))}}else l!=0&&(h.style.paddingLeft=(l+1)*26+"px");h.appendChild(p),h.appendChild(u),p.onpointerup=d;function d(){let m=!1;const v=p.getAttribute("checked"),y=p.children[0];if(v=="0"?(p.setAttribute("checked","1"),m=!0,y.setAttribute("opacity","1"),p.style.borderColor="rgba(0, 0, 0, 0)"):(p.setAttribute("checked","0"),m=!1,y.setAttribute("opacity","0"),p.style.borderColor="rgba(0, 0, 0, 0.15)"),r){i.model.visible=m;return}e.visible=m,a.findAllChildNode(c,e.visible,1),x(e,m);function x(T,A){var O;T.visible=A,(O=T==null?void 0:T.children)!=null&&O.length&&(T==null||T.children.forEach(P=>{x(P,A)}))}if(e.visible){if(e.parent){const T=e.parent.children.length;let A=0;if(e.parent.children.forEach(O=>{O.visible&&A++}),A==T){const O=c.parentElement.firstChild;O.childNodes[1].setAttribute("checked","1"),O.childNodes[1].children[0].setAttribute("opacity","1"),O.childNodes[1].style.borderColor="rgba(0, 0, 0, 0)",e.parent.visible=!0}}}else{if(e.parent){e.parent.visible=!1;const T=c.parentElement.firstChild;T.childNodes[1].setAttribute("checked","0"),T.childNodes[1].children[0].setAttribute("opacity","0"),T.childNodes[1].style.borderColor="rgba(0, 0, 0, 0.15)"}(a.selectName==e.name||e.category=="Root")&&(a.viewer.highLightMeshManager.highLightMesh.geometry.setFromPoints([]),window.onpointerup=null)}const b={},C=function(T,A){if(T.children&&T.children.length>0)T.children.forEach(O=>{C(O,A)});else for(const O in i){if(O=="model")continue;const P=i[O],V=P.geometry,B=V.attributes.position;V.userData[T.guid]&&(V.userData[T.guid].forEach(I=>{const G=I.geo_start,W=I.geo_end;if(A){if(I.position)for(let j=G;j<W;j++){const H=(j-G)*3;B.setXYZ(j,I.position[H],I.position[H+1],I.position[H+2])}}else{!I.position&&(I.position=[]);for(let j=G;j<W;j++)I.position.push(B.getX(j),B.getY(j),B.getZ(j)),B.setXYZ(j,0,0,0)}}),b[O]=P,B.needsUpdate=!0)}};C(e,e.visible);for(const T in b){const A=b[T].geometry,O=b[T].children[0];O instanceof f.LineSegments&&(O.geometry.dispose(),O.geometry=new f.EdgesGeometry(A))}a.config.inputPointerupCallBack&&a.config.inputPointerupCallBack(e,i)}return u.onpointerup=function(){if(e.parent==null||!e.visible)return;const m=[],v=function(y){if(y.children&&y.children.length>0)y.children.forEach(x=>{v(x)});else for(const x in i){if(x=="model")continue;const C=i[x].geometry;C.userData[y.guid]&&C.userData[y.guid].forEach(T=>{m.push(T.uuid)})}};a.selectName=e.name,v(e),a.config.eventName!=""&&vs.emit({type:a.config.eventName,data:m}),a.config.highLightMeshs?a.viewer.highLightMeshManager.setHighLightById(m,"uuid"):u.getAttribute("state")=="1"?(u.style.color="",u.setAttribute("state","0")):(u.style.color="#029183",u.setAttribute("state","1"))},u.onpointerover=function(){e.parent||i.model&&i.model.children.forEach(m=>{m instanceof f.Mesh&&(m.material.depthTest=!1,m.material.depthWrite=!1)})},u.onpointerout=function(){e.parent||i.model&&i.model.children.forEach(m=>{m instanceof f.Mesh&&(m.material.depthTest=!0,m.material.depthWrite=!0)})},c}findAllChildNode(e,i,r=0){if(e.children.length>=r+1)for(let a=r;a<e.children.length;a++){const l=e.children[a];switch(l.className){case"tree-item":if(l!=null&&l.children.length){const c=l==null?void 0:l.children[(l==null?void 0:l.children.length)-2];if(c){const h=c.children[0];i?(c.setAttribute("checked","1"),h&&h.setAttribute("opacity","1"),c.style.borderColor="rgba(0, 0, 0, 0)"):(c.setAttribute("checked","0"),h&&h.setAttribute("opacity","0"),c.style.borderColor="rgba(0, 0, 0, 0.15)")}}break;case"tree-parent":this.findAllChildNode(l,i,0);break}}}addTree(e,i,r){const a=Object.assign({},i);a.children=[];const l=this.createNode(a,r,!0);this.model.appendChild(l);const c=this.createNode(i,r);this.floor.appendChild(c);const h=this.createNode(e,r);this.artifact.appendChild(h),this.mountTree={},i.children&&i.children.forEach(u=>{const m=Number((Math.random()*1e6).toFixed(6)).toString(16).split(".").join("-").toLocaleUpperCase();this.mountTree[m]=Object.assign({},u),this.mountTree[m].model=r.model});const p=this;return r.model.addEventListener("destory",()=>{p.model.removeChild(l),p.floor.removeChild(c),p.artifact.removeChild(h)}),vs.emit({type:"getFloorData",data:this.mountTree}),this.mountTree}selectFloor(e,i){const r=[];this.mountTree[e].model.visible=!1;const a=this.mountTree[e].model.children,l=function(c){c.children&&c.children.length>0?c.children.forEach(h=>{l(h)}):a.forEach(h=>{const u=h.geometry;u.userData[c.guid]&&u.userData[c.guid].forEach(d=>{r.push(d.uuid)})})};l(this.mountTree[e]),this.viewer.lookingDownEntity(r,i)}showAllModel(e){this.mountTree[e].model.visible=!0,this.viewer.orbitControl.enableRotate=!0,this.viewer.floorGroup.clear(),this.viewer.toggleCamera("perspective"),this.viewer.resetView(400)}showOrHideMeshs(e,i,r){const a=function(l,c){l.children&&l.children.length>0?l.children.forEach(h=>{a(h,c)}):i.traverse(h=>{if(h instanceof f.Mesh){const p=h.geometry,u=p.attributes.position;p.userData[l.guid]&&(p.userData[l.guid].forEach(d=>{const m=d.geo_start,v=d.geo_end;if(c){if(d.position)for(let y=m;y<v;y++){const x=(y-m)*3;u.setXYZ(y,d.position[x],d.position[x+1],d.position[x+2])}}else{!d.position&&(d.position=[]);for(let y=m;y<v;y++)d.position.push(u.getX(y),u.getY(y),u.getZ(y)),u.setXYZ(y,0,0,0)}}),u.needsUpdate=!0)}})};a(e,r)}appendStretch(){const e=document.createElement("div");e.style.width="16px",e.style.height="16px",e.style.position="absolute",e.style.right="0",e.style.bottom="0",e.style.cursor="nwse-resize",e.innerHTML=`
137
137
  <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
138
138
  <path d="M750.92992 580.2496v122.39872L584.3968 536.1152l-48.27136 48.26112L702.6688 750.91968l-122.39872 0.03072v68.27008l204.8-0.04096A34.1504 34.1504 0 0 0 819.2 785.0496v-204.8h-68.27008zM487.87456 439.58272L321.3312 273.0496l122.39872-0.03072v-68.23936h-204.8A34.1504 34.1504 0 0 0 204.8 238.91968v204.8h68.27008V321.32096L439.6032 487.85408l48.27136-48.27136z">
139
139
  </path>
@@ -150,7 +150,7 @@
150
150
  <div class="list-value">${this.triangles}</div>
151
151
  </div>
152
152
  </div>
153
- `}}destory(){this.infoBox.style.display="none",this.baseFlag=!1,this.dom.className=""}}const hd=[{type:"模型线框:",label:"显示模型线框",isChecked:!1},{type:"剖面线框:",label:"显示剖面线框",isChecked:!1}],ud=[{color:"linear-gradient(lightblue, white)"},{color:"linear-gradient(#5c5c5c, white)"},{color:"linear-gradient(#272727, white)"},{color:"linear-gradient(#32475b, white)"}];class pd{constructor(e,i,r){L(this,"dom");L(this,"baseFlag");L(this,"viewer");L(this,"infoBox");L(this,"activeBg");L(this,"edgeFlag");if(this.viewer=e,this.baseFlag=!1,this.dom=document.createElement("div"),this.activeBg=0,this.edgeFlag=!0,i){const a=document.createElement("img");a.src=i,this.dom.appendChild(a)}else this.dom.appendChild(td());this.dom.setAttribute("data-attr",r||"设置"),this.dom.setAttribute("data-class","baseSetting"),this.createBox(),this.dom.onmouseup=()=>{this.flagBox()}}createBox(){var p;this.infoBox=document.createElement("div"),this.infoBox.className="setting-wrapper",this.infoBox.style.display="none",(p=this.viewer.element.parentElement)==null||p.appendChild(this.infoBox);const e=document.createElement("div");e.className="mark-title",this.infoBox.appendChild(e);const i=document.createElement("div");i.className="title-text",i.innerHTML="设置",e.appendChild(i),hd.map(u=>{const d=document.createElement("div");d.className="setting-list",e.appendChild(d);const m=document.createElement("div");m.innerHTML=u.type,m.className="setting-type",d.appendChild(m);const v=document.createElement("div");v.className="setting-value",d.appendChild(v);const g=document.createElement("input");g.type="checkbox",g.checked=u.isChecked,g.onchange=b=>{this.onChange(b,u.type)},v.appendChild(g);const x=document.createElement("label");x.innerHTML=u.label,x.style.paddingLeft="12px",v.appendChild(x)});const r=document.createElement("div");r.className="setting-list",e.appendChild(r);const a=document.createElement("div");a.innerHTML="背景:",a.className="setting-type",r.appendChild(a);const l=document.createElement("div");l.className="setting-value",r.appendChild(l),ud.forEach((u,d)=>{const m=document.createElement("div");d===this.activeBg?m.className="setting-bg setting-active":m.className="setting-bg",m.style.backgroundImage=u.color,l.appendChild(m),m.onmouseup=()=>{this.changeBg(d,u.color),m.className="setting-bg setting-active"}});const c=document.createElement("div");c.className="setting-bg",c.style.backgroundColor="black",c.setAttribute("data-attr","自定义背景图片");const h=document.createElement("input");h.type="file",h.accept="image/*",h.style.opacity="0",h.style.width="100%",h.style.height="100%",h.style.position="absolute",h.style.top="0",c.appendChild(h),l.appendChild(c),h.onchange=u=>{var v;const d=(v=u.target)==null?void 0:v.files,m=new FileReader;m.readAsDataURL(d[0]),m.onload=()=>{this.changeBg(4,m.result),this.viewer.element.style.background=`url(${m.result})`}}}onChange(e,i){switch(i){case"剖面线框:":this.tagEdgeLine(e.target.checked);break;case"模型线框:":this.tagEdgeLine(e.target.checked);break}}changeBg(e,i){const r=document.querySelector(".setting-active");r==null||r.classList.remove("setting-active"),this.viewer.element.style.backgroundImage=i,this.activeBg=e}tagEdgeLine(e){if(e)if(this.edgeFlag){for(let i in this.viewer.objs)this.viewer.objs[i].children.map(a=>{const l=a.geometry.clone(),c=new f.EdgesGeometry(l),h=new f.LineSegments(c,new f.LineBasicMaterial({color:"#5c5c5c"}));h.userData.type="edge",this.viewer.scene.add(h)});this.edgeFlag=!1}else this.viewer.scene.children.map(i=>{i.userData.type==="edge"&&(i.visible=!0)});else this.viewer.scene.children.map(i=>{i.userData.type==="edge"&&(i.visible=!1)})}flagBox(){this.baseFlag?this.destory():this.baseFlag||(this.dom.className="function-active",this.infoBox.style.display="inline",this.baseFlag=!0)}destory(){this.infoBox.style.display="none",this.baseFlag=!1,this.dom.className=""}}class dd{constructor(e,i){L(this,"viewer");L(this,"content");L(this,"classWrapper");this.viewer=e,this.classWrapper={},this.content=document.createElement("div"),this.content.className="function-wrapper",i.wrapper.appendChild(this.content),this._init(i),this._mouseupEvent()}_init(e){let i,r,a;e.resetView&&(i=new Ea(this.viewer,e.resetView.img,e.resetView.text))&&this.content.appendChild(i.dom),e.roaming&&(this.classWrapper.roaming=new Sa(this.viewer,e.roaming.img,e.roaming.text,e.roaming.moveMax,e.roaming.rotateMax))&&this.content.appendChild(this.classWrapper.roaming.dom),e.screenshot&&(r=new Ta(this.viewer,e.screenshot.img,e.screenshot.text,e.screenshot.download,e.screenshot.eventName))&&this.content.appendChild(r.dom),e.cutting&&(this.classWrapper.cutting=new La(this.viewer,e.cutting.img,e.cutting.text))&&this.content.appendChild(this.classWrapper.cutting.dom),e.measure&&(this.classWrapper.measure=new Ia(this.viewer,e.measure.img,e.measure.text))&&this.content.appendChild(this.classWrapper.measure.dom),e.information&&(this.classWrapper.constructInfo=new Ma(this.viewer,e.information.callback,e.information.img,e.information.text,e.information.color,e.information.opacity))&&this.content.appendChild(this.classWrapper.constructInfo.dom),e.fullScreen&&(a=new ka(e.fullScreen.img,e.fullScreen.text,this.viewer.element.parentElement))&&this.content.appendChild(a.dom),e.baseInfo&&(this.classWrapper.baseInfo=new cd(this.viewer,e.baseInfo.img,e.baseInfo.text))&&this.content.appendChild(this.classWrapper.baseInfo.dom),e.baseSetting&&(this.classWrapper.baseSetting=new pd(this.viewer,e.baseSetting.img,e.baseSetting.text))&&this.content.appendChild(this.classWrapper.baseSetting.dom)}_mouseupEvent(){const e=function(r){const a=r.getAttribute("data-class");return a||!r.parentElement?a:e(r.parentElement)},i=this;this.content.onclick=function(r){const a=e(r.target);for(const l in i.classWrapper)Object.prototype.hasOwnProperty.call(i.classWrapper,l)&&l!=a&&(a==="measure"?window.addEventListener("keydown",function(c){var h;c.key==="Escape"&&(h=i.classWrapper.measure)!=null&&h.distanceMea&&i.classWrapper.measure.distanceMea.clearAll()}):window.removeEventListener("keydown",function(c){var h;c.key==="Escape"&&(h=i.classWrapper.measure)!=null&&h.distanceMea&&i.classWrapper.measure.distanceMea.clearAll()}))}}}class Ea{constructor(e,i,r){L(this,"dom");if(this.dom=document.createElement("div"),i){const a=document.createElement("img");a.src=i,this.dom.appendChild(a)}else this.dom.appendChild(wi());this.dom.setAttribute("data-attr",r||"重置视角"),this.dom.setAttribute("data-class","resetView"),this.dom.onmouseup=function(){e.resetView(800)}}}class Sa{constructor(e,i,r,a,l){L(this,"viewer");L(this,"typeBox");L(this,"flyBox");L(this,"personBox");L(this,"flyControlBox");L(this,"personControlBox");L(this,"flyParams",{moveSpeed:5,rotateSpeed:5});L(this,"personParams",{moveSpeed:5,rotateSpeed:5});L(this,"floorData");L(this,"moveMax");L(this,"rotateMax");L(this,"currentType");L(this,"dom");if(this.viewer=e,this.dom=document.createElement("div"),this.moveMax=a||200,this.rotateMax=l||200,i){const c=document.createElement("img");c.src=i,this.dom.appendChild(c)}else this.dom.appendChild(aa());this.dom.setAttribute("data-attr",r||"漫游"),this.dom.setAttribute("data-class","roaming"),this.dom.addEventListener("click",c=>{c.stopPropagation()}),this.dom.onmouseup=()=>{if(this.typeBox.style.display=="none"){const h=document.getElementById("img-wrapper"),p=new f.Vector3(0,0,-1),u=[];for(const v in this.floorData)Object.prototype.hasOwnProperty.call(this.floorData,v)&&u.push(v);const d=this,m=function(v){u[v]?(d.selectFloor(u[v],p),setTimeout(()=>{const g=new Image;g.src=d.viewer.screenShoot(),h==null||h.appendChild(g),v++,m(v)},20)):d.showAllModel(u[0])};m(0),this.dom.className="function-active",this.typeBox.style.display="block"}else this.dom.className="",this.typeBox.style.display="none"},this._initUI(),this._initFlyUI(),this._initPersonUI(),this._initFylControlUI(),this._initPersonControlUI()}set state(e){this.typeBox.style.display="none",this.currentType=e,e=="fly"?(this.viewer.setControl("fly",this.flyParams),this.flyBox.style.display="flex",this.flyControlBox.style.display="block",this.personBox.style.display="none",this.personControlBox.style.display="none"):e=="person"?(this.viewer.setControl("person",this.personParams),this.flyBox.style.display="none",this.flyControlBox.style.display="none",this.personBox.style.display="flex",this.personControlBox.style.display="block"):(this.viewer.setControl("exist",{}),this.flyBox.style.display="none",this.personBox.style.display="none",this.flyControlBox.style.display="none",this.personControlBox.style.display="none",this.dom.className="")}selectFloor(e,i){if(!this.floorData)return;const r=[];this.floorData[e].model.visible=!1;const a=this.floorData[e].model.children,l=function(c){c.children&&c.children.length>0?c.children.forEach(h=>{l(h)}):a.forEach(h=>{const u=h.geometry;u.userData[c.guid]&&u.userData[c.guid].forEach(d=>{r.push(d.uuid)})})};l(this.floorData[e]),this.viewer.lookingDownEntity(r,i)}showAllModel(e){this.floorData&&(this.floorData[e].model.visible=!0,this.viewer.orbitControl.enableRotate=!0,this.viewer.floorGroup.clear(),this.viewer.toggleCamera("perspective"),this.viewer.resetView(400))}_initUI(){this._getFloorData(),this.typeBox=document.createElement("div"),this.typeBox.style.height="auto",this.typeBox.style.borderRadius="2px",this.typeBox.style.display="none",this.typeBox.className="cutting-box",this.typeBox.addEventListener("click",a=>{a.stopPropagation()});const e=ia(),i=oa(),r=this;e.onmouseup=function(a){a.stopPropagation(),r.state="fly"},i.onmouseup=function(a){a.stopPropagation(),r.state="person"},this.typeBox.appendChild(e),this.typeBox.appendChild(i),this.dom.appendChild(this.typeBox)}_initFlyUI(){this.flyBox=document.createElement("div"),this.flyBox.className="fly-box",this.flyBox.onmouseup=function(r){r.stopPropagation()},this.flyBox.addEventListener("click",r=>{r.stopPropagation()}),this.flyBox.innerHTML=`
153
+ `}}destory(){this.infoBox.style.display="none",this.baseFlag=!1,this.dom.className=""}}const hd=[{type:"模型线框:",label:"显示模型线框",isChecked:!1},{type:"剖面线框:",label:"显示剖面线框",isChecked:!1}],ud=[{color:"linear-gradient(lightblue, white)"},{color:"linear-gradient(#5c5c5c, white)"},{color:"linear-gradient(#272727, white)"},{color:"linear-gradient(#32475b, white)"}];class pd{constructor(e,i,r){L(this,"dom");L(this,"baseFlag");L(this,"viewer");L(this,"infoBox");L(this,"activeBg");L(this,"edgeFlag");if(this.viewer=e,this.baseFlag=!1,this.dom=document.createElement("div"),this.activeBg=0,this.edgeFlag=!0,i){const a=document.createElement("img");a.src=i,this.dom.appendChild(a)}else this.dom.appendChild(td());this.dom.setAttribute("data-attr",r||"设置"),this.dom.setAttribute("data-class","baseSetting"),this.createBox(),this.dom.onmouseup=()=>{this.flagBox()}}createBox(){var p;this.infoBox=document.createElement("div"),this.infoBox.className="setting-wrapper",this.infoBox.style.display="none",(p=this.viewer.element.parentElement)==null||p.appendChild(this.infoBox);const e=document.createElement("div");e.className="mark-title",this.infoBox.appendChild(e);const i=document.createElement("div");i.className="title-text",i.innerHTML="设置",e.appendChild(i),hd.map(u=>{const d=document.createElement("div");d.className="setting-list",e.appendChild(d);const m=document.createElement("div");m.innerHTML=u.type,m.className="setting-type",d.appendChild(m);const v=document.createElement("div");v.className="setting-value",d.appendChild(v);const y=document.createElement("input");y.type="checkbox",y.checked=u.isChecked,y.onchange=b=>{this.onChange(b,u.type)},v.appendChild(y);const x=document.createElement("label");x.innerHTML=u.label,x.style.paddingLeft="12px",v.appendChild(x)});const r=document.createElement("div");r.className="setting-list",e.appendChild(r);const a=document.createElement("div");a.innerHTML="背景:",a.className="setting-type",r.appendChild(a);const l=document.createElement("div");l.className="setting-value",r.appendChild(l),ud.forEach((u,d)=>{const m=document.createElement("div");d===this.activeBg?m.className="setting-bg setting-active":m.className="setting-bg",m.style.backgroundImage=u.color,l.appendChild(m),m.onmouseup=()=>{this.changeBg(d,u.color),m.className="setting-bg setting-active"}});const c=document.createElement("div");c.className="setting-bg",c.style.backgroundColor="black",c.setAttribute("data-attr","自定义背景图片");const h=document.createElement("input");h.type="file",h.accept="image/*",h.style.opacity="0",h.style.width="100%",h.style.height="100%",h.style.position="absolute",h.style.top="0",c.appendChild(h),l.appendChild(c),h.onchange=u=>{var v;const d=(v=u.target)==null?void 0:v.files,m=new FileReader;m.readAsDataURL(d[0]),m.onload=()=>{this.changeBg(4,m.result),this.viewer.element.style.background=`url(${m.result})`}}}onChange(e,i){switch(i){case"剖面线框:":this.tagEdgeLine(e.target.checked);break;case"模型线框:":this.tagEdgeLine(e.target.checked);break}}changeBg(e,i){const r=document.querySelector(".setting-active");r==null||r.classList.remove("setting-active"),this.viewer.element.style.backgroundImage=i,this.activeBg=e}tagEdgeLine(e){if(e)if(this.edgeFlag){for(let i in this.viewer.objs)this.viewer.objs[i].children.map(a=>{const l=a.geometry.clone(),c=new f.EdgesGeometry(l),h=new f.LineSegments(c,new f.LineBasicMaterial({color:"#5c5c5c"}));h.userData.type="edge",this.viewer.scene.add(h)});this.edgeFlag=!1}else this.viewer.scene.children.map(i=>{i.userData.type==="edge"&&(i.visible=!0)});else this.viewer.scene.children.map(i=>{i.userData.type==="edge"&&(i.visible=!1)})}flagBox(){this.baseFlag?this.destory():this.baseFlag||(this.dom.className="function-active",this.infoBox.style.display="inline",this.baseFlag=!0)}destory(){this.infoBox.style.display="none",this.baseFlag=!1,this.dom.className=""}}class dd{constructor(e,i){L(this,"viewer");L(this,"content");L(this,"classWrapper");this.viewer=e,this.classWrapper={},this.content=document.createElement("div"),this.content.className="function-wrapper",i.wrapper.appendChild(this.content),this._init(i),this._mouseupEvent()}_init(e){let i,r,a;e.resetView&&(i=new Ea(this.viewer,e.resetView.img,e.resetView.text))&&this.content.appendChild(i.dom),e.roaming&&(this.classWrapper.roaming=new Sa(this.viewer,e.roaming.img,e.roaming.text,e.roaming.moveMax,e.roaming.rotateMax))&&this.content.appendChild(this.classWrapper.roaming.dom),e.screenshot&&(r=new Ta(this.viewer,e.screenshot.img,e.screenshot.text,e.screenshot.download,e.screenshot.eventName))&&this.content.appendChild(r.dom),e.cutting&&(this.classWrapper.cutting=new La(this.viewer,e.cutting.img,e.cutting.text))&&this.content.appendChild(this.classWrapper.cutting.dom),e.measure&&(this.classWrapper.measure=new Ia(this.viewer,e.measure.img,e.measure.text))&&this.content.appendChild(this.classWrapper.measure.dom),e.information&&(this.classWrapper.constructInfo=new Ma(this.viewer,e.information.callback,e.information.img,e.information.text,e.information.color,e.information.opacity))&&this.content.appendChild(this.classWrapper.constructInfo.dom),e.fullScreen&&(a=new ka(e.fullScreen.img,e.fullScreen.text,this.viewer.element.parentElement))&&this.content.appendChild(a.dom),e.baseInfo&&(this.classWrapper.baseInfo=new cd(this.viewer,e.baseInfo.img,e.baseInfo.text))&&this.content.appendChild(this.classWrapper.baseInfo.dom),e.baseSetting&&(this.classWrapper.baseSetting=new pd(this.viewer,e.baseSetting.img,e.baseSetting.text))&&this.content.appendChild(this.classWrapper.baseSetting.dom)}_mouseupEvent(){const e=function(r){const a=r.getAttribute("data-class");return a||!r.parentElement?a:e(r.parentElement)},i=this;this.content.onclick=function(r){const a=e(r.target);for(const l in i.classWrapper)Object.prototype.hasOwnProperty.call(i.classWrapper,l)&&l!=a&&(a==="measure"?window.addEventListener("keydown",function(c){var h;c.key==="Escape"&&(h=i.classWrapper.measure)!=null&&h.distanceMea&&i.classWrapper.measure.distanceMea.clearAll()}):window.removeEventListener("keydown",function(c){var h;c.key==="Escape"&&(h=i.classWrapper.measure)!=null&&h.distanceMea&&i.classWrapper.measure.distanceMea.clearAll()}))}}}class Ea{constructor(e,i,r){L(this,"dom");if(this.dom=document.createElement("div"),i){const a=document.createElement("img");a.src=i,this.dom.appendChild(a)}else this.dom.appendChild(wi());this.dom.setAttribute("data-attr",r||"重置视角"),this.dom.setAttribute("data-class","resetView"),this.dom.onmouseup=function(){e.resetView(800)}}}class Sa{constructor(e,i,r,a,l){L(this,"viewer");L(this,"typeBox");L(this,"flyBox");L(this,"personBox");L(this,"flyControlBox");L(this,"personControlBox");L(this,"flyParams",{moveSpeed:5,rotateSpeed:5});L(this,"personParams",{moveSpeed:5,rotateSpeed:5});L(this,"floorData");L(this,"moveMax");L(this,"rotateMax");L(this,"currentType");L(this,"dom");if(this.viewer=e,this.dom=document.createElement("div"),this.moveMax=a||200,this.rotateMax=l||200,i){const c=document.createElement("img");c.src=i,this.dom.appendChild(c)}else this.dom.appendChild(aa());this.dom.setAttribute("data-attr",r||"漫游"),this.dom.setAttribute("data-class","roaming"),this.dom.addEventListener("click",c=>{c.stopPropagation()}),this.dom.onmouseup=()=>{if(this.typeBox.style.display=="none"){const h=document.getElementById("img-wrapper"),p=new f.Vector3(0,0,-1),u=[];for(const v in this.floorData)Object.prototype.hasOwnProperty.call(this.floorData,v)&&u.push(v);const d=this,m=function(v){u[v]?(d.selectFloor(u[v],p),setTimeout(()=>{const y=new Image;y.src=d.viewer.screenShoot(),h==null||h.appendChild(y),v++,m(v)},20)):d.showAllModel(u[0])};m(0),this.dom.className="function-active",this.typeBox.style.display="block"}else this.dom.className="",this.typeBox.style.display="none"},this._initUI(),this._initFlyUI(),this._initPersonUI(),this._initFylControlUI(),this._initPersonControlUI()}set state(e){this.typeBox.style.display="none",this.currentType=e,e=="fly"?(this.viewer.setControl("fly",this.flyParams),this.flyBox.style.display="flex",this.flyControlBox.style.display="block",this.personBox.style.display="none",this.personControlBox.style.display="none"):e=="person"?(this.viewer.setControl("person",this.personParams),this.flyBox.style.display="none",this.flyControlBox.style.display="none",this.personBox.style.display="flex",this.personControlBox.style.display="block"):(this.viewer.setControl("exist",{}),this.flyBox.style.display="none",this.personBox.style.display="none",this.flyControlBox.style.display="none",this.personControlBox.style.display="none",this.dom.className="")}selectFloor(e,i){if(!this.floorData)return;const r=[];this.floorData[e].model.visible=!1;const a=this.floorData[e].model.children,l=function(c){c.children&&c.children.length>0?c.children.forEach(h=>{l(h)}):a.forEach(h=>{const u=h.geometry;u.userData[c.guid]&&u.userData[c.guid].forEach(d=>{r.push(d.uuid)})})};l(this.floorData[e]),this.viewer.lookingDownEntity(r,i)}showAllModel(e){this.floorData&&(this.floorData[e].model.visible=!0,this.viewer.orbitControl.enableRotate=!0,this.viewer.floorGroup.clear(),this.viewer.toggleCamera("perspective"),this.viewer.resetView(400))}_initUI(){this._getFloorData(),this.typeBox=document.createElement("div"),this.typeBox.style.height="auto",this.typeBox.style.borderRadius="2px",this.typeBox.style.display="none",this.typeBox.className="cutting-box",this.typeBox.addEventListener("click",a=>{a.stopPropagation()});const e=ia(),i=oa(),r=this;e.onmouseup=function(a){a.stopPropagation(),r.state="fly"},i.onmouseup=function(a){a.stopPropagation(),r.state="person"},this.typeBox.appendChild(e),this.typeBox.appendChild(i),this.dom.appendChild(this.typeBox)}_initFlyUI(){this.flyBox=document.createElement("div"),this.flyBox.className="fly-box",this.flyBox.onmouseup=function(r){r.stopPropagation()},this.flyBox.addEventListener("click",r=>{r.stopPropagation()}),this.flyBox.innerHTML=`
154
154
  <div class="flex">
155
155
  <span>飞行速度: </span>
156
156
  <div class="flex fly-item">
@@ -209,7 +209,7 @@
209
209
  <div class="control-info-item"><span>Space(空格)</span><span>向上跳跃</span></div>
210
210
  <div class="control-info-item"><span>鼠标中键</span><span>滚轮放大缩小</span></div>
211
211
  <div class="control-info-item"><span>鼠标右键</span><span>拖拽改变视角</span></div>
212
- `,setTimeout(()=>{var r;(r=this.dom.parentElement)==null||r.appendChild(this.personControlBox)},1e3);const e=this,i=this.personControlBox.getElementsByClassName("control-close")[0];i.onclick=function(){e.personControlBox.style.display="none"}}_changeParam(e,i,r){e=="add"?i=="speed"?(r.moveSpeed*=2,r.moveSpeed>this.moveMax&&(r.moveSpeed=this.moveMax)):(r.rotateSpeed*=2,r.moveSpeed>this.rotateMax&&(r.rotateSpeed=this.rotateMax)):e=="sub"&&(i=="speed"?(r.moveSpeed/=2,r.moveSpeed<5&&(r.moveSpeed=5)):(r.rotateSpeed/=2,r.rotateSpeed<5&&(r.rotateSpeed=5))),this.currentType=="fly"&&this.viewer.setControl("fly",r),this.currentType=="person"&&this.viewer.setControl("person",r)}_getFloorData(){ys.on("getFloorData",e=>{this.floorData=e.data})}destory(){this.state="",this.dom.className="",this.typeBox.style.display="none"}}class Ta{constructor(e,i,r,a,l){L(this,"dom");if(this.dom=document.createElement("div"),i){const c=document.createElement("img");c.src=i,this.dom.appendChild(c)}else this.dom.appendChild(la());this.dom.setAttribute("data-attr",r||"截屏"),this.dom.setAttribute("data-class","screenShot"),this.dom.onmouseup=function(){const c=e.screenShoot();if(a){const h=document.createElement("a");h.href=c,h.download="scene",h.click()}l&&ys.emit({type:l,img:c})}}}class La{constructor(e,i,r){L(this,"viewer");L(this,"displayBox");L(this,"globalBox");L(this,"localBox");L(this,"localContent");L(this,"clipping");L(this,"dom");if(this.viewer=e,this.dom=document.createElement("div"),i){const a=document.createElement("img");a.src=i,this.dom.appendChild(a)}else this.dom.appendChild(ca());this.dom.setAttribute("data-attr",r||"剖切"),this.dom.setAttribute("data-class","cutting"),this.dom.onmouseup=()=>{this.displayBox?this.destory():(this.initBoxUI(),this.initContentUI(),this.dom.className="function-active")}}initBoxUI(){this.displayBox=document.createElement("div"),this.displayBox.onmouseup=a=>{a.stopPropagation()},this.dom.appendChild(this.displayBox),this.displayBox.className="cutting-box";const e=document.createElement("div");e.style.pointerEvents="none",e.className="cut-wrapper",e.style.border="none",this.displayBox.appendChild(e),this.globalBox=document.createElement("div"),this.globalBox.style.pointerEvents="auto",this.globalBox.appendChild(da());const i=document.createElement("span");i.innerText="全局剖切",this.globalBox.appendChild(i),this.localBox=document.createElement("div"),this.localBox.style.pointerEvents="auto",this.localBox.appendChild(pa());const r=document.createElement("span");r.innerText="局部剖切",this.localBox.appendChild(r),e.appendChild(this.globalBox),e.appendChild(this.localBox),this.globalBox.onmouseup=()=>{this.globalBox.className="cutting-active",this.localBox.className="",this.localContent.style.display="none",this.clipping&&this.clipping.setClippingType("global")},this.localBox.onmouseup=()=>{this.globalBox.className="",this.localBox.className="cutting-active",this.localContent.style.display="block",this.clipping&&this.clipping.setClippingType("local")}}initContentUI(){var p;this.localContent=document.createElement("div"),this.localContent.className="cutting-silder",this.localContent.style.display="none",(p=this.displayBox)==null||p.appendChild(this.localContent);const e=document.createElement("div"),i=document.createElement("div"),r=document.createElement("div");this.localContent.appendChild(e),this.localContent.appendChild(i),this.localContent.appendChild(r),e.className=i.className=r.className="local-content";const a=this,l={x:{min:-1e5,max:1e5,_current_min:-1e5,_current_max:1e5,get current_min(){return this._current_min},get current_max(){return this._current_max},set current_min(u){u>this._current_max||u<this.min||(this._current_min=u,a.changeMin(0,this))},set current_max(u){u<this._current_min||u>this.max||(this._current_max=u,a.changeMax(0,this))},get percent_min(){return(this._current_min-this.min)/(this.max-this.min)*100},get percent_max(){return(this._current_max-this.min)/(this.max-this.min)*100}},y:{min:-1e5,max:1e5,_current_min:-1e5,_current_max:1e5,get current_min(){return this._current_min},get current_max(){return this._current_max},set current_min(u){u>this._current_max||u<this.min||(this._current_min=u,a.changeMin(1,this))},set current_max(u){u<this._current_min||u>this.max||(this._current_max=u,a.changeMax(1,this))},get percent_min(){return(this._current_min-this.min)/(this.max-this.min)*100},get percent_max(){return(this._current_max-this.min)/(this.max-this.min)*100}},z:{min:-1e5,max:1e5,_current_min:-1e5,_current_max:1e5,get current_min(){return this._current_min},get current_max(){return this._current_max},set current_min(u){u>this._current_max||u<this.min||(this._current_min=u,a.changeMin(2,this))},set current_max(u){u<this._current_min||u>this.max||(this._current_max=u,a.changeMax(2,this))},get percent_min(){return(this._current_min-this.min)/(this.max-this.min)*100},get percent_max(){return(this._current_max-this.min)/(this.max-this.min)*100}}};e.innerHTML=`
212
+ `,setTimeout(()=>{var r;(r=this.dom.parentElement)==null||r.appendChild(this.personControlBox)},1e3);const e=this,i=this.personControlBox.getElementsByClassName("control-close")[0];i.onclick=function(){e.personControlBox.style.display="none"}}_changeParam(e,i,r){e=="add"?i=="speed"?(r.moveSpeed*=2,r.moveSpeed>this.moveMax&&(r.moveSpeed=this.moveMax)):(r.rotateSpeed*=2,r.moveSpeed>this.rotateMax&&(r.rotateSpeed=this.rotateMax)):e=="sub"&&(i=="speed"?(r.moveSpeed/=2,r.moveSpeed<5&&(r.moveSpeed=5)):(r.rotateSpeed/=2,r.rotateSpeed<5&&(r.rotateSpeed=5))),this.currentType=="fly"&&this.viewer.setControl("fly",r),this.currentType=="person"&&this.viewer.setControl("person",r)}_getFloorData(){vs.on("getFloorData",e=>{this.floorData=e.data})}destory(){this.state="",this.dom.className="",this.typeBox.style.display="none"}}class Ta{constructor(e,i,r,a,l){L(this,"dom");if(this.dom=document.createElement("div"),i){const c=document.createElement("img");c.src=i,this.dom.appendChild(c)}else this.dom.appendChild(la());this.dom.setAttribute("data-attr",r||"截屏"),this.dom.setAttribute("data-class","screenShot"),this.dom.onmouseup=function(){const c=e.screenShoot();if(a){const h=document.createElement("a");h.href=c,h.download="scene",h.click()}l&&vs.emit({type:l,img:c})}}}class La{constructor(e,i,r){L(this,"viewer");L(this,"displayBox");L(this,"globalBox");L(this,"localBox");L(this,"localContent");L(this,"clipping");L(this,"dom");if(this.viewer=e,this.dom=document.createElement("div"),i){const a=document.createElement("img");a.src=i,this.dom.appendChild(a)}else this.dom.appendChild(ca());this.dom.setAttribute("data-attr",r||"剖切"),this.dom.setAttribute("data-class","cutting"),this.dom.onmouseup=()=>{this.displayBox?this.destory():(this.initBoxUI(),this.initContentUI(),this.dom.className="function-active")}}initBoxUI(){this.displayBox=document.createElement("div"),this.displayBox.onmouseup=a=>{a.stopPropagation()},this.dom.appendChild(this.displayBox),this.displayBox.className="cutting-box";const e=document.createElement("div");e.style.pointerEvents="none",e.className="cut-wrapper",e.style.border="none",this.displayBox.appendChild(e),this.globalBox=document.createElement("div"),this.globalBox.style.pointerEvents="auto",this.globalBox.appendChild(da());const i=document.createElement("span");i.innerText="全局剖切",this.globalBox.appendChild(i),this.localBox=document.createElement("div"),this.localBox.style.pointerEvents="auto",this.localBox.appendChild(pa());const r=document.createElement("span");r.innerText="局部剖切",this.localBox.appendChild(r),e.appendChild(this.globalBox),e.appendChild(this.localBox),this.globalBox.onmouseup=()=>{this.globalBox.className="cutting-active",this.localBox.className="",this.localContent.style.display="none",this.clipping&&this.clipping.setClippingType("global")},this.localBox.onmouseup=()=>{this.globalBox.className="",this.localBox.className="cutting-active",this.localContent.style.display="block",this.clipping&&this.clipping.setClippingType("local")}}initContentUI(){var p;this.localContent=document.createElement("div"),this.localContent.className="cutting-silder",this.localContent.style.display="none",(p=this.displayBox)==null||p.appendChild(this.localContent);const e=document.createElement("div"),i=document.createElement("div"),r=document.createElement("div");this.localContent.appendChild(e),this.localContent.appendChild(i),this.localContent.appendChild(r),e.className=i.className=r.className="local-content";const a=this,l={x:{min:-1e5,max:1e5,_current_min:-1e5,_current_max:1e5,get current_min(){return this._current_min},get current_max(){return this._current_max},set current_min(u){u>this._current_max||u<this.min||(this._current_min=u,a.changeMin(0,this))},set current_max(u){u<this._current_min||u>this.max||(this._current_max=u,a.changeMax(0,this))},get percent_min(){return(this._current_min-this.min)/(this.max-this.min)*100},get percent_max(){return(this._current_max-this.min)/(this.max-this.min)*100}},y:{min:-1e5,max:1e5,_current_min:-1e5,_current_max:1e5,get current_min(){return this._current_min},get current_max(){return this._current_max},set current_min(u){u>this._current_max||u<this.min||(this._current_min=u,a.changeMin(1,this))},set current_max(u){u<this._current_min||u>this.max||(this._current_max=u,a.changeMax(1,this))},get percent_min(){return(this._current_min-this.min)/(this.max-this.min)*100},get percent_max(){return(this._current_max-this.min)/(this.max-this.min)*100}},z:{min:-1e5,max:1e5,_current_min:-1e5,_current_max:1e5,get current_min(){return this._current_min},get current_max(){return this._current_max},set current_min(u){u>this._current_max||u<this.min||(this._current_min=u,a.changeMin(2,this))},set current_max(u){u<this._current_min||u>this.max||(this._current_max=u,a.changeMax(2,this))},get percent_min(){return(this._current_min-this.min)/(this.max-this.min)*100},get percent_max(){return(this._current_max-this.min)/(this.max-this.min)*100}}};e.innerHTML=`
213
213
  <div>X</div>
214
214
  <div style="background-image: linear-gradient(90deg, #e4e7ed 0, #e4e7ed ${l.x.percent_min}%, #00a392 0, #00a392 ${l.x.percent_max}%, #e4e7ed 0, #e4e7ed)">
215
215
  <div class="_*_move_min" style="left: ${l.x.percent_min}%"></div>
@@ -227,7 +227,7 @@
227
227
  <div class="_*_move_min" style="left: ${l.z.percent_min}%"></div>
228
228
  <div class="_*_move_max" style="left: ${l.z.percent_max}%"></div>
229
229
  </div>
230
- `;const c=document.getElementsByClassName("_*_move_min");for(let u=0;u<c.length;u++){const d=c[u];u==0&&this.addMoveEvent(d,this.localContent,"min",l.x),u==1&&this.addMoveEvent(d,this.localContent,"min",l.y),u==2&&this.addMoveEvent(d,this.localContent,"min",l.z)}const h=document.getElementsByClassName("_*_move_max");for(let u=0;u<h.length;u++){const d=h[u];u==0&&this.addMoveEvent(d,this.localContent,"max",l.x),u==1&&this.addMoveEvent(d,this.localContent,"max",l.y),u==2&&this.addMoveEvent(d,this.localContent,"max",l.z)}this.clipping=new Ca(this.viewer,{callBackFun:u=>{l.x.min=u.x[0],l.y.min=u.y[0],l.z.min=u.z[0],l.x.max=u.x[1],l.y.max=u.y[1],l.z.max=u.z[1],l.x.current_min=u.x[0],l.y.current_min=u.y[0],l.z.current_min=u.z[0],l.x.current_max=u.x[1],l.y.current_max=u.y[1],l.z.current_max=u.z[1]},set:u=>{l.x.current_min=u.x[0],l.y.current_min=u.y[0],l.z.current_min=u.z[0],l.x.current_max=u.x[1],l.y.current_max=u.y[1],l.z.current_max=u.z[1]}})}changeMin(e,i){const r=document.getElementsByClassName("_*_move_min")[e];r.style.left=i.percent_min+"%",r.setAttribute("data-attr",i.current_min);const a={x:[0,0],y:[0,0],z:[0,0]};let l="";e==0&&(a.x[0]=i.current_min,a.x[1]=i.current_max,l="x"),e==1&&(a.y[0]=i.current_min,a.y[1]=i.current_max,l="y"),e==2&&(a.z[0]=i.current_min,a.z[1]=i.current_max,l="z"),this.clipping&&this.clipping.changeBoxCutting(a,l),r.parentElement&&(r.parentElement.style.backgroundImage=`linear-gradient(90deg, #e4e7ed 0, #e4e7ed ${i.percent_min}%, #00a392 0, #00a392 ${i.percent_max}%, #e4e7ed 0, #e4e7ed)`)}changeMax(e,i){const r=document.getElementsByClassName("_*_move_max")[e];r.style.left=i.percent_max+"%",r.setAttribute("data-attr",i.current_max);const a={x:[0,0],y:[0,0],z:[0,0]};let l="";e==0&&(a.x[0]=i.current_min,a.x[1]=i.current_max,l="x"),e==1&&(a.y[0]=i.current_min,a.y[1]=i.current_max,l="y"),e==2&&(a.z[0]=i.current_min,a.z[1]=i.current_max,l="z"),this.clipping&&this.clipping.changeBoxCutting(a,l),r.parentElement&&(r.parentElement.style.backgroundImage=`linear-gradient(90deg, #e4e7ed 0, #e4e7ed ${i.percent_min}%, #00a392 0, #00a392 ${i.percent_max}%, #e4e7ed 0, #e4e7ed)`)}addMoveEvent(e,i,r,a){e.onmousedown=function(l){const c=r=="min"?a.current_min:a.current_max,h=l.clientX;document.onmousemove=function(p){const m=(p.clientX-h)/230,g=(a.max-a.min)*m;r=="min"&&(a.current_min=c+g),r=="max"&&(a.current_max=c+g)}},e.onmouseleave=null,i.onmouseup=function(){document.onmousemove=null},i.onmouseleave=function(){document.onmousemove=null}}destory(){this.displayBox&&this.displayBox.remove(),this.displayBox=void 0,this.clipping&&this.clipping.detory(),this.dom.className=""}}class ka{constructor(e,i,r){L(this,"dom");L(this,"fullFlag");L(this,"target");if(this.fullFlag=!0,this.target=r||document.documentElement,this.dom=document.createElement("div"),e){const a=document.createElement("img");a.src=e,this.dom.appendChild(a)}else this.dom.appendChild(ki());this.dom.setAttribute("data-attr",i||"全屏"),this.dom.setAttribute("data-class","fullScreen"),document.addEventListener("fullscreenchange",()=>{this.fullFlag=!document.fullscreenElement}),this.dom.onmouseup=()=>{document.fullscreenElement?document.exitFullscreen():this.target.requestFullscreen()}}}class Ma{constructor(e,i,r,a,l,c){L(this,"dom");L(this,"boxFlag");L(this,"viewer");L(this,"clickInfo");L(this,"infoBox");L(this,"callback");L(this,"color");L(this,"opacity");if(this.viewer=e,this.boxFlag=!1,this.dom=document.createElement("div"),this.callback=i,this.color=l,this.opacity=c,r){const h=document.createElement("img");h.src=r,this.dom.appendChild(h)}else this.dom.appendChild(Li());this.dom.setAttribute("data-attr",a||"构件信息"),this.dom.setAttribute("data-class","constructInfo"),this.createBox(),this.drawEvent(),this.dom.onmouseup=()=>{this.flagBox()}}createBox(){var e;this.infoBox=document.createElement("div"),this.infoBox.className="mark-wrapper",this.infoBox.style.display="none",(e=this.viewer.element.parentElement)==null||e.appendChild(this.infoBox),this.infoBox.innerHTML=`
230
+ `;const c=document.getElementsByClassName("_*_move_min");for(let u=0;u<c.length;u++){const d=c[u];u==0&&this.addMoveEvent(d,this.localContent,"min",l.x),u==1&&this.addMoveEvent(d,this.localContent,"min",l.y),u==2&&this.addMoveEvent(d,this.localContent,"min",l.z)}const h=document.getElementsByClassName("_*_move_max");for(let u=0;u<h.length;u++){const d=h[u];u==0&&this.addMoveEvent(d,this.localContent,"max",l.x),u==1&&this.addMoveEvent(d,this.localContent,"max",l.y),u==2&&this.addMoveEvent(d,this.localContent,"max",l.z)}this.clipping=new Ca(this.viewer,{callBackFun:u=>{l.x.min=u.x[0],l.y.min=u.y[0],l.z.min=u.z[0],l.x.max=u.x[1],l.y.max=u.y[1],l.z.max=u.z[1],l.x.current_min=u.x[0],l.y.current_min=u.y[0],l.z.current_min=u.z[0],l.x.current_max=u.x[1],l.y.current_max=u.y[1],l.z.current_max=u.z[1]},set:u=>{l.x.current_min=u.x[0],l.y.current_min=u.y[0],l.z.current_min=u.z[0],l.x.current_max=u.x[1],l.y.current_max=u.y[1],l.z.current_max=u.z[1]}})}changeMin(e,i){const r=document.getElementsByClassName("_*_move_min")[e];r.style.left=i.percent_min+"%",r.setAttribute("data-attr",i.current_min);const a={x:[0,0],y:[0,0],z:[0,0]};let l="";e==0&&(a.x[0]=i.current_min,a.x[1]=i.current_max,l="x"),e==1&&(a.y[0]=i.current_min,a.y[1]=i.current_max,l="y"),e==2&&(a.z[0]=i.current_min,a.z[1]=i.current_max,l="z"),this.clipping&&this.clipping.changeBoxCutting(a,l),r.parentElement&&(r.parentElement.style.backgroundImage=`linear-gradient(90deg, #e4e7ed 0, #e4e7ed ${i.percent_min}%, #00a392 0, #00a392 ${i.percent_max}%, #e4e7ed 0, #e4e7ed)`)}changeMax(e,i){const r=document.getElementsByClassName("_*_move_max")[e];r.style.left=i.percent_max+"%",r.setAttribute("data-attr",i.current_max);const a={x:[0,0],y:[0,0],z:[0,0]};let l="";e==0&&(a.x[0]=i.current_min,a.x[1]=i.current_max,l="x"),e==1&&(a.y[0]=i.current_min,a.y[1]=i.current_max,l="y"),e==2&&(a.z[0]=i.current_min,a.z[1]=i.current_max,l="z"),this.clipping&&this.clipping.changeBoxCutting(a,l),r.parentElement&&(r.parentElement.style.backgroundImage=`linear-gradient(90deg, #e4e7ed 0, #e4e7ed ${i.percent_min}%, #00a392 0, #00a392 ${i.percent_max}%, #e4e7ed 0, #e4e7ed)`)}addMoveEvent(e,i,r,a){e.onmousedown=function(l){const c=r=="min"?a.current_min:a.current_max,h=l.clientX;document.onmousemove=function(p){const m=(p.clientX-h)/230,y=(a.max-a.min)*m;r=="min"&&(a.current_min=c+y),r=="max"&&(a.current_max=c+y)}},e.onmouseleave=null,i.onmouseup=function(){document.onmousemove=null},i.onmouseleave=function(){document.onmousemove=null}}destory(){this.displayBox&&this.displayBox.remove(),this.displayBox=void 0,this.clipping&&this.clipping.detory(),this.dom.className=""}}class ka{constructor(e,i,r){L(this,"dom");L(this,"fullFlag");L(this,"target");if(this.fullFlag=!0,this.target=r||document.documentElement,this.dom=document.createElement("div"),e){const a=document.createElement("img");a.src=e,this.dom.appendChild(a)}else this.dom.appendChild(ki());this.dom.setAttribute("data-attr",i||"全屏"),this.dom.setAttribute("data-class","fullScreen"),document.addEventListener("fullscreenchange",()=>{this.fullFlag=!document.fullscreenElement}),this.dom.onmouseup=()=>{document.fullscreenElement?document.exitFullscreen():this.target.requestFullscreen()}}}class Ma{constructor(e,i,r,a,l,c){L(this,"dom");L(this,"boxFlag");L(this,"viewer");L(this,"clickInfo");L(this,"infoBox");L(this,"callback");L(this,"color");L(this,"opacity");if(this.viewer=e,this.boxFlag=!1,this.dom=document.createElement("div"),this.callback=i,this.color=l,this.opacity=c,r){const h=document.createElement("img");h.src=r,this.dom.appendChild(h)}else this.dom.appendChild(Li());this.dom.setAttribute("data-attr",a||"构件信息"),this.dom.setAttribute("data-class","constructInfo"),this.createBox(),this.drawEvent(),this.dom.onmouseup=()=>{this.flagBox()}}createBox(){var e;this.infoBox=document.createElement("div"),this.infoBox.className="mark-wrapper",this.infoBox.style.display="none",(e=this.viewer.element.parentElement)==null||e.appendChild(this.infoBox),this.infoBox.innerHTML=`
231
231
  <div class="mark-title">
232
232
  <div class="title-text">构件属性</div>
233
233
  <div class="mark-list">
@@ -255,7 +255,7 @@
255
255
  <div class="mark-list">
256
256
  <div class="list-type">${l}</div>
257
257
  <div class="list-value">${a.val[l]}</div>
258
- </div>`,this.infoBox.appendChild(c)}})}flagBox(){this.boxFlag?this.destory():this.boxFlag||(this.dom.className="function-active",this.infoBox.style.display="inline",this.clickInfo=new wa(this.viewer,{callback:this.resultCallBack.bind(this),color:this.color,opacity:this.opacity}),this.boxFlag=!0)}drawEvent(){const e=this;this.infoBox.onmousedown=function(i){var m;const r=i.clientX,a=i.clientY,l=e.infoBox.getBoundingClientRect(),c=(m=e.viewer.element.parentElement)==null?void 0:m.getBoundingClientRect();if(!c)return;const h=c.height-l.height,p=c.width-l.width,u=Number(e.infoBox.style.right.split("p")[0])||20,d=Number(e.infoBox.style.bottom.split("p")[0])||50;document.onmousemove=function(v){const g=v.clientX,x=v.clientY;let b=r-g+u,C=a-x+d;b<0&&(b=0),C<0&&(C=0),b>p&&(b=p),C>h&&(C=h),e.infoBox.style.right=b+"px",e.infoBox.style.bottom=C+"px"},e.infoBox.onmouseup=function(){document.onmousemove=null}}}destory(){this.infoBox.style.display="none",this.clickInfo&&this.clickInfo.destory(),this.boxFlag=!1,this.dom.className=""}}class Ia{constructor(e,i,r){L(this,"dom");L(this,"viewer");L(this,"measureFlag");L(this,"measureDio");L(this,"unitDio");L(this,"distanceMea");L(this,"measureTextNum");L(this,"measureTextX");L(this,"measureTextY");L(this,"measureUnit");if(this.viewer=e,this.measureFlag=!0,this.measureUnit={unit:"mm",precision:"2"},this.dom=document.createElement("div"),i){const a=document.createElement("img");a.src=i,this.dom.appendChild(a)}else this.dom.appendChild(Ti());this.createMeaDio(),this.unitAccuracy(),this.dom.setAttribute("data-attr",r||"测量"),this.dom.setAttribute("data-class","measure"),this.dom.onmouseup=()=>{this.measureFlag?(this.funButton(),this.showMeaDio(!0),this.measureFlag=!1):(this.showMeaDio(!1),this.measureFlag=!0)}}createMeaDio(){var p;this.measureDio=document.createElement("div"),this.measureDio.style.display="none",this.measureDio.className="measure-wrapper",(p=this.viewer.element.parentElement)==null||p.appendChild(this.measureDio);const e=document.createElement("div");e.className="header";const i=document.createElement("span");i.className="header-title",i.innerText="测量";const r=Mi();r.className="header-setting",e.appendChild(i),e.appendChild(r),this.measureDio.appendChild(e);const a=document.createElement("div");a.className="content-tab",a.appendChild(Ei()),a.appendChild(Si()),a.appendChild(ra()),this.measureDio.appendChild(a);const l=document.createElement("div");l.className="measure-text",l.innerHTML=`
258
+ </div>`,this.infoBox.appendChild(c)}})}flagBox(){this.boxFlag?this.destory():this.boxFlag||(this.dom.className="function-active",this.infoBox.style.display="inline",this.clickInfo=new wa(this.viewer,{callback:this.resultCallBack.bind(this),color:this.color,opacity:this.opacity}),this.boxFlag=!0)}drawEvent(){const e=this;this.infoBox.onmousedown=function(i){var m;const r=i.clientX,a=i.clientY,l=e.infoBox.getBoundingClientRect(),c=(m=e.viewer.element.parentElement)==null?void 0:m.getBoundingClientRect();if(!c)return;const h=c.height-l.height,p=c.width-l.width,u=Number(e.infoBox.style.right.split("p")[0])||20,d=Number(e.infoBox.style.bottom.split("p")[0])||50;document.onmousemove=function(v){const y=v.clientX,x=v.clientY;let b=r-y+u,C=a-x+d;b<0&&(b=0),C<0&&(C=0),b>p&&(b=p),C>h&&(C=h),e.infoBox.style.right=b+"px",e.infoBox.style.bottom=C+"px"},e.infoBox.onmouseup=function(){document.onmousemove=null}}}destory(){this.infoBox.style.display="none",this.clickInfo&&this.clickInfo.destory(),this.boxFlag=!1,this.dom.className=""}}class Ia{constructor(e,i,r){L(this,"dom");L(this,"viewer");L(this,"measureFlag");L(this,"measureDio");L(this,"unitDio");L(this,"distanceMea");L(this,"measureTextNum");L(this,"measureTextX");L(this,"measureTextY");L(this,"measureUnit");if(this.viewer=e,this.measureFlag=!0,this.measureUnit={unit:"mm",precision:"2"},this.dom=document.createElement("div"),i){const a=document.createElement("img");a.src=i,this.dom.appendChild(a)}else this.dom.appendChild(Ti());this.createMeaDio(),this.unitAccuracy(),this.dom.setAttribute("data-attr",r||"测量"),this.dom.setAttribute("data-class","measure"),this.dom.onmouseup=()=>{this.measureFlag?(this.funButton(),this.showMeaDio(!0),this.measureFlag=!1):(this.showMeaDio(!1),this.measureFlag=!0)}}createMeaDio(){var p;this.measureDio=document.createElement("div"),this.measureDio.style.display="none",this.measureDio.className="measure-wrapper",(p=this.viewer.element.parentElement)==null||p.appendChild(this.measureDio);const e=document.createElement("div");e.className="header";const i=document.createElement("span");i.className="header-title",i.innerText="测量";const r=Mi();r.className="header-setting",e.appendChild(i),e.appendChild(r),this.measureDio.appendChild(e);const a=document.createElement("div");a.className="content-tab",a.appendChild(Ei()),a.appendChild(Si()),a.appendChild(ra()),this.measureDio.appendChild(a);const l=document.createElement("div");l.className="measure-text",l.innerHTML=`
259
259
  <div class="measure-item">
260
260
  <div class="label"></div>
261
261
  <div class="value measure-text-num"></div>
@@ -268,7 +268,7 @@
268
268
  <div class="label">Y:</div>
269
269
  <div class="value"></div>
270
270
  </div>
271
- `,this.measureDio.appendChild(l),this.measureTextNum=l.getElementsByClassName("measure-text-num")[0],this.measureTextX=l.getElementsByClassName("measure-text-x")[0],this.measureTextY=l.getElementsByClassName("measure-text-y")[0];const c=document.createElement("div");c.className="clear-btn",c.innerText="清除",this.measureDio.appendChild(c),c.onmouseup=()=>{this.distanceMea&&this.distanceMea.clearAll()};const h=this;this.measureDio.onmousedown=function(u){var A;const d=u.clientX,m=u.clientY,v=h.measureDio.getBoundingClientRect(),g=(A=h.viewer.element.parentElement)==null?void 0:A.getBoundingClientRect();if(!g)return;const x=g.height-v.height,b=g.width-v.width,C=Number(h.measureDio.style.right.split("p")[0])||20,T=Number(h.measureDio.style.bottom.split("p")[0])||50;document.onmousemove=function(O){const P=O.clientX,V=O.clientY;let R=d-P+C,I=m-V+T;R<0&&(R=0),I<0&&(I=0),R>b&&(R=b),I>x&&(I=x),h.measureDio.style.right=R+"px",h.measureDio.style.bottom=I+"px"},h.measureDio.onmouseup=function(){document.onmousemove=null}}}funButton(){this.distanceMea=new Hn(this.viewer,{callback:this.meaCallBack.bind(this)});const e=this.measureDio.getElementsByClassName("content-tab")[0].children,i=this.measureDio.getElementsByClassName("measure-item")[0].getElementsByClassName("label")[0],r=this.measureDio.getElementsByClassName("setting-unit")[0],a=function(){for(let l=0;l<e.length;l++){const c=e[l];c.className="flex-center"}};for(let l=0;l<e.length;l++){const c=e[l];c.onmousedown=h=>{h.stopPropagation()},c.onmouseup=h=>{a(),h.stopPropagation(),c.className="flex-center measure-active",this.distanceMea&&this.distanceMea.clearAll(),l==0?(this.distanceMea.setType("distance"),i&&(i.innerText="距离:",this.measureTextNum.innerText="0mm"),this.measureTextX.style.display="flex",this.measureTextY.style.display="flex",this.measureTextX.getElementsByClassName("value")[0].innerText="-",this.measureTextY.getElementsByClassName("value")[0].innerText="-",r.style.display="flex"):l==1?(this.distanceMea.setType("angle"),i&&(i.innerText="角度:",this.measureTextNum.innerText="0°"),this.measureTextX.style.display="none",this.measureTextY.style.display="none",r.style.display="none"):l==2&&(this.distanceMea.setType("elevation"),i&&(i.innerText="标高:",this.measureTextNum.innerText="0m"),this.measureTextX.style.display="none",this.measureTextY.style.display="none",r.style.display="flex")}}this.clickSetting()}showMeaDio(e){this.unitDio.style.display="none",e?(this.dom.className="function-active",this.measureDio.style.display="inline"):this.destory()}clickSetting(){const e=this.measureDio.getElementsByClassName("header-setting")[0];e&&(e.onmouseup=()=>{this.unitDio.style.display="inline"}),this.selecChoose()}unitAccuracy(){this.unitDio=document.createElement("div"),this.unitDio.className="measure-setting",this.unitDio.style.display="none",this.unitDio.innerHTML=`
271
+ `,this.measureDio.appendChild(l),this.measureTextNum=l.getElementsByClassName("measure-text-num")[0],this.measureTextX=l.getElementsByClassName("measure-text-x")[0],this.measureTextY=l.getElementsByClassName("measure-text-y")[0];const c=document.createElement("div");c.className="clear-btn",c.innerText="清除",this.measureDio.appendChild(c),c.onmouseup=()=>{this.distanceMea&&this.distanceMea.clearAll()};const h=this;this.measureDio.onmousedown=function(u){var A;const d=u.clientX,m=u.clientY,v=h.measureDio.getBoundingClientRect(),y=(A=h.viewer.element.parentElement)==null?void 0:A.getBoundingClientRect();if(!y)return;const x=y.height-v.height,b=y.width-v.width,C=Number(h.measureDio.style.right.split("p")[0])||20,T=Number(h.measureDio.style.bottom.split("p")[0])||50;document.onmousemove=function(O){const P=O.clientX,V=O.clientY;let B=d-P+C,I=m-V+T;B<0&&(B=0),I<0&&(I=0),B>b&&(B=b),I>x&&(I=x),h.measureDio.style.right=B+"px",h.measureDio.style.bottom=I+"px"},h.measureDio.onmouseup=function(){document.onmousemove=null}}}funButton(){this.distanceMea=new Hn(this.viewer,{callback:this.meaCallBack.bind(this)});const e=this.measureDio.getElementsByClassName("content-tab")[0].children,i=this.measureDio.getElementsByClassName("measure-item")[0].getElementsByClassName("label")[0],r=this.measureDio.getElementsByClassName("setting-unit")[0],a=function(){for(let l=0;l<e.length;l++){const c=e[l];c.className="flex-center"}};for(let l=0;l<e.length;l++){const c=e[l];c.onmousedown=h=>{h.stopPropagation()},c.onmouseup=h=>{a(),h.stopPropagation(),c.className="flex-center measure-active",this.distanceMea&&this.distanceMea.clearAll(),l==0?(this.distanceMea.setType("distance"),i&&(i.innerText="距离:",this.measureTextNum.innerText="0mm"),this.measureTextX.style.display="flex",this.measureTextY.style.display="flex",this.measureTextX.getElementsByClassName("value")[0].innerText="-",this.measureTextY.getElementsByClassName("value")[0].innerText="-",r.style.display="flex"):l==1?(this.distanceMea.setType("angle"),i&&(i.innerText="角度:",this.measureTextNum.innerText="0°"),this.measureTextX.style.display="none",this.measureTextY.style.display="none",r.style.display="none"):l==2&&(this.distanceMea.setType("elevation"),i&&(i.innerText="标高:",this.measureTextNum.innerText="0m"),this.measureTextX.style.display="none",this.measureTextY.style.display="none",r.style.display="flex")}}this.clickSetting()}showMeaDio(e){this.unitDio.style.display="none",e?(this.dom.className="function-active",this.measureDio.style.display="inline"):this.destory()}clickSetting(){const e=this.measureDio.getElementsByClassName("header-setting")[0];e&&(e.onmouseup=()=>{this.unitDio.style.display="inline"}),this.selecChoose()}unitAccuracy(){this.unitDio=document.createElement("div"),this.unitDio.className="measure-setting",this.unitDio.style.display="none",this.unitDio.innerHTML=`
272
272
  <div class="setting-header">
273
273
  <span >测量设置</span>
274
274
  <span class="setting-close">x</span>
@@ -288,6 +288,6 @@
288
288
  <option selected value="2">0.00</option>
289
289
  <option value="3">0.000</option>
290
290
  </select>
291
- </div>`,this.measureDio.appendChild(this.unitDio);const e=this.unitDio.getElementsByClassName("setting-close")[0];e&&(e.onmouseup=()=>{this.unitDio.style.display="none"})}selecChoose(){const e=this,i=this.unitDio.getElementsByClassName("unit-select")[0];i&&(i.onchange=()=>{const a=i.selectedIndex;e.measureUnit.unit=i.options[a].value,e.distanceMea.adjustSetting(e.measureUnit)});const r=this.unitDio.getElementsByClassName("accuracy-select")[0];r&&(r.onchange=()=>{const a=r.selectedIndex;e.measureUnit.precision=r.options[a].value,e.distanceMea.adjustSetting(e.measureUnit)})}meaCallBack(e){this.measureTextNum&&(this.measureTextNum.innerText=e.num1),this.measureTextX&&e.num_x!==void 0&&(this.measureTextX.getElementsByClassName("value")[0].innerText=e.num_x),this.measureTextY&&e.num_y!==void 0&&(this.measureTextY.getElementsByClassName("value")[0].innerText=e.num_y)}destory(){this.measureDio.style.display="none",this.dom.className="",this.distanceMea&&this.distanceMea.destory()}}exports.THREE=Se;exports.CLine=ze;exports.Clipping=Ca;exports.DXFMeasure=na;exports.DxfParser=Gt;exports.DxfTools=ga;exports.DxfViewer=xa;exports.DxfViewerCom=rd;exports.Event=ys;exports.FitView=ya;exports.FunctionalComponent=dd;exports.GLTFLoader=Fo;exports.HandleLayers=va;exports.MathUtils=Yt;exports.Measure=Hn;exports.ModelTree=ld;exports.Viewer=jn;exports.ViewerCom=rc;exports.angleImg=Si;exports.areaImg=fa;exports.calculateAngle=fs;exports.calculateArea=Ks;exports.checkBox=ua;exports.constructInfo=Ma;exports.createHeightText=Uo;exports.createText=Mt;exports.createThreeFace=zn;exports.createTwoFace=Dl;exports.cutBox=pa;exports.cutting=La;exports.cuttingImg=ca;exports.distanceImg=Ei;exports.dxfMeasure=ba;exports.flyImg=ia;exports.fullImg=ki;exports.fullScreen=ka;exports.globalCutting=Jp;exports.heightImg=ra;exports.iconSet=Mi;exports.iconSetting=$p;exports.infoImg=Li;exports.information=wa;exports.layersImg=ma;exports.localCutting=Qp;exports.measureFun=Ia;exports.measureImg=Ti;exports.measureImg2=qp;exports.personImg=oa;exports.resetView=Ea;exports.roaming=Sa;exports.roamingImg=aa;exports.screenImg=la;exports.screenShot=Ta;exports.triangleRound=ha;exports.verCut=da;exports.viewImg=wi;
291
+ </div>`,this.measureDio.appendChild(this.unitDio);const e=this.unitDio.getElementsByClassName("setting-close")[0];e&&(e.onmouseup=()=>{this.unitDio.style.display="none"})}selecChoose(){const e=this,i=this.unitDio.getElementsByClassName("unit-select")[0];i&&(i.onchange=()=>{const a=i.selectedIndex;e.measureUnit.unit=i.options[a].value,e.distanceMea.adjustSetting(e.measureUnit)});const r=this.unitDio.getElementsByClassName("accuracy-select")[0];r&&(r.onchange=()=>{const a=r.selectedIndex;e.measureUnit.precision=r.options[a].value,e.distanceMea.adjustSetting(e.measureUnit)})}meaCallBack(e){this.measureTextNum&&(this.measureTextNum.innerText=e.num1),this.measureTextX&&e.num_x!==void 0&&(this.measureTextX.getElementsByClassName("value")[0].innerText=e.num_x),this.measureTextY&&e.num_y!==void 0&&(this.measureTextY.getElementsByClassName("value")[0].innerText=e.num_y)}destory(){this.measureDio.style.display="none",this.dom.className="",this.distanceMea&&this.distanceMea.destory()}}exports.THREE=Te;exports.CLine=ze;exports.Clipping=Ca;exports.DXFMeasure=na;exports.DxfParser=Gt;exports.DxfTools=ga;exports.DxfViewer=xa;exports.DxfViewerCom=rd;exports.Event=vs;exports.FitView=ya;exports.FunctionalComponent=dd;exports.GLTFLoader=Fo;exports.HandleLayers=va;exports.MathUtils=Yt;exports.Measure=Hn;exports.ModelTree=ld;exports.Viewer=jn;exports.ViewerCom=rc;exports.angleImg=Si;exports.areaImg=fa;exports.calculateAngle=ms;exports.calculateArea=qs;exports.checkBox=ua;exports.constructInfo=Ma;exports.createHeightText=Uo;exports.createText=Mt;exports.createThreeFace=zn;exports.createTwoFace=Dl;exports.cutBox=pa;exports.cutting=La;exports.cuttingImg=ca;exports.distanceImg=Ei;exports.dxfMeasure=ba;exports.flyImg=ia;exports.fullImg=ki;exports.fullScreen=ka;exports.globalCutting=Jp;exports.heightImg=ra;exports.iconSet=Mi;exports.iconSetting=$p;exports.infoImg=Li;exports.information=wa;exports.layersImg=ma;exports.localCutting=Qp;exports.measureFun=Ia;exports.measureImg=Ti;exports.measureImg2=qp;exports.personImg=oa;exports.resetView=Ea;exports.roaming=Sa;exports.roamingImg=aa;exports.screenImg=la;exports.screenShot=Ta;exports.triangleRound=ha;exports.verCut=da;exports.viewImg=wi;
292
292
 
293
- ;(function(){try{if(typeof document==="undefined")return;if(document.querySelector("style[data-threejs-viewer-style]"))return;var el=document.createElement("style");el.setAttribute("data-threejs-viewer-style","");el.textContent=".text[data-v-c466b0fc]{box-sizing:border-box;flex:1;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.text[data-v-c466b0fc]>*{vertical-align:middle}p[data-v-c466b0fc]{margin:0}.empty-box[data-v-7f559bc0]{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%}.empty-box p[data-v-7f559bc0]{margin:9px 0 0;font-size:14px;font-weight:400;line-height:16px;color:#999}.svg-container[data-v-e4df4dc8]{display:inline-block;fill:currentColor}.svg-icon-box[data-v-621d0d75]{display:flex;align-items:center;max-width:100%;overflow:hidden;vertical-align:middle}.svg-icon-box .text[data-v-621d0d75]{flex:1;overflow:hidden;font-family:MiSans-Normal,MiSans;font-size:14px;font-weight:400;line-height:16px}.svg-icon-box .icon[data-v-621d0d75]{display:flex;align-items:center;overflow:hidden;vertical-align:-.15em;fill:currentColor}.custom-over-flow>span:nth-child(1){display:inline-block;max-width:800px!important}.base-panel[data-v-a0e4f5c1]{position:absolute;z-index:10;display:flex;flex-direction:column;overflow:hidden;background:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow-light);opacity:.7;transition:opacity .2s ease}.base-panel[data-v-a0e4f5c1]:hover{opacity:1}.base-panel__header[data-v-a0e4f5c1]{position:relative;display:flex;align-items:center;background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.base-panel__header-title[data-v-a0e4f5c1]{display:inline-block;width:100%;height:40px;font-size:14px;font-weight:500;line-height:40px;color:var(--el-text-color-primary);text-align:center}.base-panel .close-btn[data-v-a0e4f5c1]{position:absolute;top:4px;right:8px;padding:0;font-size:18px;line-height:36px;color:var(--el-text-color-secondary);cursor:pointer}.base-panel .close-btn[data-v-a0e4f5c1]:hover{color:var(--el-color-primary)}.base-panel__body[data-v-a0e4f5c1]{position:relative;display:flex;flex:1;overflow:hidden}.base-panel__resize[data-v-a0e4f5c1]{position:absolute;right:5px;bottom:5px;z-index:20;color:var(--el-border-color-light);cursor:nwse-resize}.base-panel__resize[data-v-a0e4f5c1]:hover{color:var(--el-color-primary)}.dragging[data-v-a0e4f5c1]{cursor:move!important}.unselectable[data-v-a0e4f5c1] *{-webkit-user-select:none;user-select:none}.model-tree-box[data-v-54e25803]{z-index:10;display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.model-tree-box[data-v-54e25803] .tree-tabs .el-tabs__header{margin:0}.model-tree-box[data-v-54e25803] .tree-tabs .el-tabs__item:nth-child(2){padding-left:20px}.model-tree-box[data-v-54e25803] .tree-tabs .el-tabs__item:last-child{padding-right:20px}.model-tree-box .tree-box[data-v-54e25803]{position:relative;display:flex;flex:1;flex-direction:column;padding:10px;overflow:hidden}.model-tree-box .tree-box[data-v-54e25803] .filter-tree{flex:1;margin-top:10px;overflow:hidden}.model-tree-box .tree-box[data-v-54e25803] .filter-tree .el-tree-node .el-tree-node__content .tree-node-box{flex:1;overflow:hidden}.model-tree-box .tree-box[data-v-54e25803] .filter-tree .el-tree-node .el-tree-node__content .height-light{color:var(--el-color-primary)}.model-tree-box .tree-box[data-v-54e25803] .filter-tree .el-tree__empty-block{width:100%;height:200px;overflow:hidden}.measure-box[data-v-39b67b39]{display:flex;flex-direction:column;width:100%;height:100%;padding:10px;overflow:hidden}.measure-box .measure-types-box[data-v-39b67b39]{display:flex;align-items:center;justify-content:space-between;padding:0 0 10px}.measure-box .measure-types-box .measure-types[data-v-39b67b39]{display:flex;gap:10px;align-items:center;cursor:pointer}.measure-box .measure-types-box .measure-types .measure-type[data-v-39b67b39]{padding:10px;color:#9b9a9a;border-radius:2px}.measure-box .measure-types-box .measure-types .measure-type[data-v-39b67b39]:hover,.measure-box .measure-types-box .measure-types .measure-type.active[data-v-39b67b39]{color:var(--el-color-primary);background-color:var(--el-color-primary-light-9)}.measure-box .measure-types-box .arrow-right[data-v-39b67b39]{margin-right:10px;cursor:pointer}.measure-box .measure-types-box .arrow-right.active[data-v-39b67b39],.measure-box .measure-types-box .arrow-right[data-v-39b67b39]:hover{color:var(--el-color-primary)}.measure-box[data-v-39b67b39] .measure-config{display:flex;flex-direction:column;flex-shrink:0;gap:10px;padding:0 10px;overflow:hidden;transition:height .3s}.measure-box[data-v-39b67b39] .measure-config .config{display:flex;gap:10px;align-items:center;overflow:hidden}.measure-box[data-v-39b67b39] .measure-config .config .label{font-size:12px}.measure-box[data-v-39b67b39] .measure-config .config .el-select{flex:1}.measure-box .measure-result[data-v-39b67b39]{padding:10px 10px 0}.measure-box .measure-result .measure-result-box[data-v-39b67b39]{display:flex;flex-direction:column;gap:10px}.measure-box .measure-result .measure-result-box .measure-item[data-v-39b67b39]{display:flex;gap:10px;align-items:center}.measure-box .measure-result .measure-result-box .measure-item .label[data-v-39b67b39]{width:60px;font-size:14px;color:var(--el-text-color-regular);text-align:right}.measure-box .clear-btn[data-v-39b67b39]{display:flex;justify-content:flex-end}.com-info-box[data-v-9386eb37]{width:100%;overflow:hidden}.com-info-box .descriptions-box[data-v-9386eb37]{border-top:1px solid var(--el-border-color-darker)}.com-info-box .descriptions-box .descriptions-item[data-v-9386eb37]{display:flex;width:100%;overflow:hidden}.com-info-box .descriptions-box .descriptions-item .label[data-v-9386eb37]{flex-shrink:0;width:40%;padding:10px;overflow:hidden;font-size:14px;font-weight:700;color:var(--el-text-color-regular);text-align:right;background:rgb(245,247,250);border:1px solid var(--el-border-color-darker);border-top:unset}.com-info-box .descriptions-box .descriptions-item .content[data-v-9386eb37]{flex:1;padding:10px;overflow:hidden;font-size:14px;border:1px solid var(--el-border-color-darker);border-top:unset;border-left:unset}.com-info-box .descriptions-box .descriptions-item .content[data-v-9386eb37] .material-box{display:flex;gap:10px;align-items:center;width:100%;height:100%}.com-info-box .descriptions-box .descriptions-item .content[data-v-9386eb37] .material-box .material-item{width:16px;height:16px;overflow:hidden;border:1px solid #000000;border-radius:3px}.com-info-box .descriptions-box .descriptions-item .content[data-v-9386eb37] .material-box .loading-box{animation:spin-clockwise-9386eb37 1s linear infinite}@keyframes spin-clockwise-9386eb37{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.cutting-box[data-v-021484ab]{display:flex;flex-direction:column;gap:20px;width:100%;padding:10px}.cutting-box .cutting-item[data-v-021484ab]{display:flex;gap:10px;align-items:center;width:100%;overflow:hidden}.cutting-box .cutting-item .label[data-v-021484ab]{font-size:14px}.cutting-box .cutting-item[data-v-021484ab] .slider{flex:1;overflow:hidden}.cutting-box .cutting-item[data-v-021484ab] .slider .el-slider{padding-left:10px}.cutting-box .cutting-item[data-v-021484ab] .slider .el-slider .el-slider__runway{margin-right:20px}.cutting-box .cutting-item[data-v-021484ab] .slider .el-slider .el-slider__runway .el-slider__button-wrapper .el-slider__button{width:15px;height:15px}.base-info-box[data-v-102dd608]{width:100%;overflow:hidden}.base-info-box .descriptions-box .descriptions-item[data-v-102dd608]{display:flex;width:100%;overflow:hidden}.base-info-box .descriptions-box .descriptions-item .label[data-v-102dd608]{flex-shrink:0;width:40%;padding:10px;overflow:hidden;font-size:14px;font-weight:700;color:var(--el-text-color-regular);text-align:right;background:rgb(245,247,250);border:1px solid var(--el-border-color-darker);border-top:unset}.base-info-box .descriptions-box .descriptions-item .content[data-v-102dd608]{flex-shrink:0;width:60%;padding:10px;overflow:hidden;font-size:14px;border:1px solid var(--el-border-color-darker);border-top:unset;border-left:unset}.base-info-box .descriptions-box .descriptions-item .content .color[data-v-102dd608]{display:flex;gap:10px;align-items:center;width:100%;height:100%}.base-info-box .descriptions-box .descriptions-item .content .color .color-item[data-v-102dd608]{width:16px;height:16px;overflow:hidden;border-radius:3px}.config-box[data-v-464a671e]{width:100%;padding:10px;overflow:hidden}.config-box .inner-config-box[data-v-464a671e]{display:flex;flex-direction:column;gap:10px}.config-box .inner-config-box .config-item[data-v-464a671e]{display:flex;gap:20px;align-items:center;overflow:hidden}.config-box .inner-config-box .config-item .label[data-v-464a671e]{font-size:14px}.config-box .inner-config-box .config-item .color-box[data-v-464a671e]{display:flex;flex:1;flex-wrap:wrap;gap:10px;overflow:hidden}.config-box .inner-config-box .config-item .color-box .color-item[data-v-464a671e]{position:relative;width:20px;height:20px;overflow:hidden;cursor:pointer}.config-box .inner-config-box .config-item .color-box .color-item .upload-btn[data-v-464a671e]{position:absolute;top:0;z-index:10;width:100%;height:100%;cursor:pointer;opacity:0}.option-card-box[data-v-17942138]{width:100%;overflow:hidden}.option-card-box .descriptions-box[data-v-17942138]{border-top:1px solid var(--el-border-color-darker)}.option-card-box .descriptions-box .descriptions-item[data-v-17942138]{display:flex;width:100%;overflow:hidden}.option-card-box .descriptions-box .descriptions-item .label[data-v-17942138]{flex-shrink:0;width:40%;padding:10px;overflow:hidden;font-size:14px;font-weight:700;color:var(--el-text-color-regular);text-align:center;background:rgb(245,247,250);border:1px solid var(--el-border-color-darker);border-top:unset}.option-card-box .descriptions-box .descriptions-item .content[data-v-17942138]{flex:1;padding:10px;overflow:hidden;font-size:14px;text-align:center;border:1px solid var(--el-border-color-darker);border-top:unset;border-left:unset}.option-btn-box[data-v-17942138]{position:absolute;bottom:50px;left:50%;z-index:10;display:flex;gap:20px;align-items:center;padding:10px 20px;background-color:rgb(var(--el-menu-bg-color-rgb) .6);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow);transform:translate(-50%)}.option-btn-box .option-item[data-v-17942138]{display:flex;gap:10px;align-items:center}.option-btn-box .option-item .option-label[data-v-17942138]{font-size:14px;font-weight:700;color:var(--el-text-color-regular)}.utils-menu-box[data-v-b6ef63b9]{position:absolute;bottom:50px;left:50%;z-index:10;transform:translate(-50%)}.utils-menu-box[data-v-b6ef63b9] .el-menu{background-color:rgb(var(--el-menu-bg-color-rgb) .6);border:1px solid var(--el-border-color);border-radius:2px;box-shadow:var(--el-box-shadow)}.utils-menu-box[data-v-b6ef63b9] .el-menu .el-menu-item,.utils-menu-box[data-v-b6ef63b9] .el-menu>.el-sub-menu{padding:0 10px;border-bottom:unset}.utils-menu-box[data-v-b6ef63b9] .el-menu .el-menu-item .el-sub-menu__title,.utils-menu-box[data-v-b6ef63b9] .el-menu>.el-sub-menu .el-sub-menu__title{padding:0}.utils-menu-box[data-v-b6ef63b9] .el-menu .el-menu-item .el-sub-menu__title:hover,.utils-menu-box[data-v-b6ef63b9] .el-menu>.el-sub-menu .el-sub-menu__title:hover{color:unset!important;background-color:unset}.utils-menu-box[data-v-b6ef63b9] .el-menu .el-menu-item .el-sub-menu__title .el-icon,.utils-menu-box[data-v-b6ef63b9] .el-menu>.el-sub-menu .el-sub-menu__title .el-icon{display:none}.utils-menu-box[data-v-b6ef63b9] .el-menu .el-menu-item:hover,.utils-menu-box[data-v-b6ef63b9] .el-menu>.el-sub-menu:hover{color:var(--el-menu-hover-text-color)!important;background-color:rgb(var(--el-color-primary-light-9) .9)!important}.utils-menu-box[data-v-b6ef63b9] .el-menu .el-menu-item:hover .icon-box,.utils-menu-box[data-v-b6ef63b9] .el-menu>.el-sub-menu:hover .icon-box{color:#fff;background-color:var(--el-color-primary);border-radius:50%}.utils-menu-box[data-v-b6ef63b9] .el-menu .el-menu-item .icon-box,.utils-menu-box[data-v-b6ef63b9] .el-menu>.el-sub-menu .icon-box{display:flex;align-items:center;justify-content:center;width:35px;height:35px}.utils-menu-box[data-v-b6ef63b9] .el-menu .is-active{color:unset!important;background-color:unset!important;border-bottom:unset!important}.utils-menu-box[data-v-b6ef63b9] .el-menu .is-active .el-sub-menu__title{color:unset!important;background-color:unset!important;border-bottom:unset}.utils-menu-box[data-v-b6ef63b9] .el-menu .is-active2{color:var(--el-menu-hover-text-color)!important;background-color:rgb(var(--el-color-primary-light-9) .8)!important}.utils-menu-box[data-v-b6ef63b9] .el-menu .is-active2 .icon-box{color:#fff;background-color:var(--el-color-primary);border-radius:50%}.utils-menu-box[data-v-b6ef63b9] .el-menu .is-active2 .el-sub-menu__title{color:var(--el-menu-text-color);background-color:var(--el-menu-bg-color);background-color:unset!important}.utils-menu-popper .el-menu{min-width:unset}.utils-menu-popper .el-menu .icon-box{display:flex;align-items:center;width:100%;height:100%}.utils-menu-popper .el-menu .is-active,.utils-menu-popper .el-menu .is-active .el-sub-menu__title{color:unset!important;background-color:unset!important;border-bottom:unset}.utils-menu-popper .el-menu .is-active2{color:var(--el-menu-hover-text-color)!important;background-color:rgb(var(--el-menu-bg-color-rgb) .8)!important}.utils-menu-popper .el-menu .is-active2 .icon-box{background-color:rgb(var(--el-menu-bg-color-rgb) .8)!important}.utils-menu-popper .el-menu .is-active2 .el-sub-menu__title{color:var(--el-menu-text-color);background-color:var(--el-menu-bg-color);background-color:unset!important}.viewer-box[data-v-0f333327]{position:relative;width:100%;height:100%}.viewer-box #viewer-3d[data-v-0f333327]{width:100%;height:100%;background-image:linear-gradient(lightblue,white);outline:none}.viewer-box[data-v-696004c1]{position:relative;width:100%;height:100%}.viewer-box #viewer-3d[data-v-696004c1]{width:100%;height:100%;background-image:linear-gradient(lightblue,white);outline:none}.viewer-box .dxf-tools[data-v-696004c1]{position:absolute;bottom:25px;left:50%;transform:translate(-50%)}.viewer-box .function-wrapper{display:flex;align-items:center;justify-content:space-around;width:auto;height:48px;padding:0 12px;background-color:rgb(var(--el-menu-bg-color-rgb) .6);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow)}.viewer-box .function-wrapper>div{position:relative;display:flex;align-items:center;justify-content:center;width:35px;height:35px;margin:0 8px;cursor:pointer;background-color:transparent;border-radius:50%;transition:background-color .2s ease}.viewer-box .function-wrapper>div:hover{color:#fff;background-color:var(--el-color-primary);border-color:transparent}.viewer-box .function-active{color:#fff;background-color:var(--el-color-primary)!important}.viewer-box .function-wrapper>div>.svg-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:50%}.viewer-box .svg-wrapper:hover{background-color:transparent!important}.viewer-box .control>span{color:var(--el-text-color-primary)!important}.viewer-box .control:hover{background-color:rgb(var(--el-color-primary-rgb) .08)}.viewer-box .control:hover>span{color:var(--el-color-primary)!important}.viewer-box .text-active{margin-left:4px;font-size:14px;font-weight:500;color:var(--el-color-primary)}.viewer-box .function-wrapper>div:after{position:absolute;top:-30px;left:50%;z-index:10;display:none;padding:4px 8px;font-size:12px;line-height:1.4;color:#fff;white-space:nowrap;content:attr(data-attr);background-color:#000000bf;border-radius:4px;box-shadow:0 2px 8px #0000001f;transform:translate(-50%)}.viewer-box .function-wrapper>div:before{position:absolute;top:-10px;left:50%;z-index:10;display:none;width:0;height:0;content:\"\";border-top:6px solid rgba(0,0,0,.75);border-right:6px solid transparent;border-left:6px solid transparent;transform:translate(-50%)}.viewer-box .function-wrapper>div:hover:after,.viewer-box .function-wrapper>div:hover:before{display:block}.viewer-box .mark-wrapper,.viewer-box .info-wrapper,.viewer-box .setting-wrapper,.viewer-box .measure-wrapper,.viewer-box .layer-wrapper,.viewer-box .fly-box-control-info,.viewer-box .person-box-control-info,.viewer-box .cutting-box{background:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow-light)}.viewer-box .layer-wrapper{position:absolute;top:20px;left:20px;box-sizing:border-box;width:340px;height:600px;padding:0;overflow:hidden}.viewer-box .layer-box{width:100%;height:100%}.viewer-box .layer-header{display:flex;align-items:center;width:100%;height:40px;padding:0 12px;font-size:14px;font-weight:500;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .layer-box>.layer-content{box-sizing:border-box;width:100%;height:calc(100% - 40px);padding:4px 12px;overflow-y:auto}.viewer-box .line-item{display:flex;align-items:center;width:100%;height:28px;margin-bottom:4px;border-radius:4px;transition:background-color .15s}.viewer-box .line-item:hover{background-color:var(--el-fill-color-light)}.viewer-box .layer-header>div,.viewer-box .line-item>div{width:18px;height:18px;color:var(--el-color-primary)}.viewer-box .line-item>span{display:block}.viewer-box .line-item>.color-span{width:20px;height:20px;margin-left:6px;border:1px solid var(--el-border-color);border-radius:2px}.viewer-box .line-item>.text-span{width:calc(100% - 58px);margin-left:6px;overflow:hidden;font-size:14px;color:var(--el-text-color-primary);text-overflow:ellipsis;white-space:nowrap}.viewer-box .measure-wrapper{position:absolute;right:20px;bottom:50px;box-sizing:border-box;width:298px;height:290px;padding:0;overflow:visible;-webkit-user-select:none;user-select:none}.viewer-box .header{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:40px;font-size:14px;font-weight:500;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .header .header-title{font-size:14px;font-weight:500;color:var(--el-text-color-primary)}.viewer-box .header-setting{position:absolute;top:0;right:0;display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:var(--el-text-color-secondary);cursor:pointer}.viewer-box .header-setting:hover,.viewer-box .header-setting.is-active{color:var(--el-color-primary)}.viewer-box .content-tab{display:flex;gap:10px;align-items:center;padding:14px 10px 10px}.viewer-box .content-tab>div{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:#9b9a9a;cursor:pointer;border-radius:4px;transition:all .2s}.viewer-box .content-tab>div:hover{color:var(--el-color-primary);background:var(--el-color-primary-light-9)}.viewer-box .content-tab>.measure-active{color:var(--el-color-primary);background:var(--el-color-primary-light-9)}.viewer-box .dxf-measure-wrapper .clear-btn{position:absolute;right:12px;bottom:10px;padding:4px 12px;font-size:12px;line-height:1;color:var(--el-text-color-regular);cursor:pointer;background:var(--el-fill-color);border:1px solid var(--el-border-color);border-radius:4px;transition:color .2s,border-color .2s}.viewer-box .dxf-measure-wrapper .clear-btn:hover{color:var(--el-color-primary);border-color:var(--el-color-primary)}.viewer-box .measure-text{display:flex;flex-direction:column;gap:4px;padding:10px 12px;font-size:14px}.viewer-box .measure-line{display:flex;flex-direction:row;gap:4px;align-items:center}.viewer-box .measure-text-type{color:var(--el-text-color-secondary)}.viewer-box .measure-text-num{font-weight:500;color:var(--el-color-primary)}.viewer-box .measure-line-x .measure-text-num-x-val{color:var(--el-color-danger)}.viewer-box .measure-line-y .measure-text-num-y-val{color:var(--el-color-success)}.viewer-box .measure-setting{position:absolute;right:0;bottom:calc(100% + 8px);z-index:20;box-sizing:border-box;width:260px;overflow:hidden;background:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow-light)}.viewer-box ::-webkit-scrollbar{width:6px;height:6px}.viewer-box ::-webkit-scrollbar-thumb{background:rgb(var(--el-scrollbar-bg-color-rgb, 144, 147, 153) .3);border-radius:3px}.viewer-box ::-webkit-scrollbar-thumb:hover{background:rgb(var(--el-color-primary-rgb) .5)}.viewer-box .flex{display:flex;align-items:center;justify-content:space-between}.viewer-box .flex-center{display:flex;align-items:center;justify-content:center}.viewer-box .function-wrapper>.fly-box{position:absolute;top:0;left:50%;display:none;justify-content:space-around;width:498px;height:48px;padding:0 10px;font-family:PingFang SC-Regular,PingFang SC;font-size:14px;font-weight:400;color:#fff;background:#333333;filter:none;border-radius:4px;transform:translate(-50%)}.viewer-box .function-wrapper>.fly-box:after,.viewer-box .function-wrapper>.fly-box:before{width:0;height:0;padding:0;overflow:hidden;border:none}.viewer-box .fly-box div{height:48px;font-size:14px;line-height:48px;white-space:nowrap;-webkit-user-select:none;user-select:none}.viewer-box .fly-box span{display:inline-block}.viewer-box .fly-item{padding:0 8px}.viewer-box .fly-item>span{display:inline-block;width:12px;height:12px;font-size:14px;line-height:12px;text-align:center;cursor:pointer;border:1px solid #ffffff;border-radius:2px}.viewer-box .fly-item>span:hover{color:var(--el-color-primary);border-color:var(--el-color-primary)}.viewer-box .fly-item>span:nth-child(2){width:auto;height:16px;padding:0 5px;margin:0 10px;line-height:16px;pointer-events:none;background:rgba(255,255,255,.2);border:none;border-radius:2px}.viewer-box .fly-box>.fly-out{height:36px;padding-left:22px;font-family:PingFang SC-Regular,PingFang SC;font-size:14px;font-weight:400;line-height:36px;color:var(--el-color-primary);border-left:1px solid;border-image:linear-gradient(to bottom,#000000,#ffffff,#000000) 1}.viewer-box .function-wrapper>.fly-box-control-info{position:absolute;right:0;bottom:54px;display:block;width:272px;height:308px;padding-top:20px;overflow:hidden;font-size:14px;background-color:var(--el-bg-color);border-radius:4px;transform:translate(110%)}.viewer-box .function-wrapper>.person-box-control-info{height:278px!important}.viewer-box .fly-box-control-info>.control-close{position:absolute;top:5px;right:5px;width:18px;height:18px;font-size:12px;line-height:18px;text-align:center;cursor:pointer;-webkit-user-select:none;user-select:none;border:1px solid var(--el-border-color);border-radius:50%}.viewer-box .fly-box-control-info>.control-close:hover{color:var(--el-color-primary);border-color:var(--el-color-primary)}.viewer-box .fly-box-control-info>.control-info-item{display:flex;align-items:center;justify-content:space-between;width:100%;height:30px;border-bottom:1px solid var(--el-border-color-lighter)}.viewer-box .control-info-item>span{display:block;width:55%;color:var(--el-text-color-primary);text-align:center}.viewer-box .control-info-item>span:nth-child(1){width:40%;padding-right:15px;border-right:1px solid var(--el-border-color-lighter)}.viewer-box .cutting-box{position:absolute;bottom:166%;left:50%;z-index:11;box-sizing:border-box;width:100px;height:90px;-webkit-user-select:none;user-select:none;transform:translate(-50%)}.viewer-box .cutting-box:before{position:absolute;bottom:-10px;left:50%;z-index:10;width:0;height:0;content:\"\";border-top:10px solid var(--el-bg-color);border-right:10px solid transparent;border-left:10px solid transparent;transform:translate(-50%)}.viewer-box .cutting-box>div{padding-bottom:4px;border-bottom:1px solid var(--el-border-color-lighter)}.viewer-box .cutting-box>div>img{width:20px;height:20px;margin-right:12px;object-fit:contain}.viewer-box .cutting-box>div>span{font-size:14px;color:var(--el-color-primary)}.viewer-box .cut-wrapper{margin-top:10px}.viewer-box .cut-wrapper>div{box-sizing:content-box!important;display:flex;align-items:center;justify-content:space-between;width:80%;height:20px;padding:8px 10px;margin-right:10px;font-size:14px}.viewer-box .cut-wrapper>div>div{margin-right:4px}.viewer-box .cut-wrapper>div>img{width:16px;height:16px;vertical-align:middle}.viewer-box .cut-wrapper>div:hover{color:var(--el-color-primary);background:var(--el-color-primary-light-9)}.viewer-box .cutting-active{background-color:var(--el-color-primary-light-9)}.viewer-box .cutting-silder{position:absolute;top:50%;left:105%;width:220px;background-color:var(--el-bg-color);border-radius:4px;box-shadow:var(--el-box-shadow-light);transform:translateY(-50%)}.viewer-box .local-content{padding:0 15px;margin:10px 0}.viewer-box .local-content>div{position:relative;width:100%;height:6px;border-radius:5px}.viewer-box .local-content>div:nth-child(1){height:18px;margin-bottom:4px;font-size:14px;font-weight:500;line-height:18px;color:var(--el-text-color-primary);text-align:left}.viewer-box .local-content>div>div{position:absolute;top:50%;width:14px;height:14px;cursor:pointer;background-color:#fff;border:1px solid var(--el-color-primary);border-radius:50%;box-shadow:0 1px 4px #0000002b;transform:translateY(-50%) translate(-50%)}.viewer-box .local-content>div>div:hover{transform:translateY(-50%) translate(-50%) scale(1.1)}.viewer-box .mark-wrapper{position:absolute;right:20px;bottom:30px;box-sizing:border-box;width:350px;height:460px;overflow:hidden auto;pointer-events:auto;cursor:pointer;border-radius:4px;opacity:1}.viewer-box .title-text{display:flex;align-items:center;width:100%;height:40px;padding:0 12px;margin:0;font-size:14px;font-weight:500;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .mark-list,.viewer-box .setting-list{display:flex;padding-left:10px;font-size:14px;font-weight:500;line-height:40px;color:var(--el-text-color-regular);text-align:left}.viewer-box .list-type{width:123px;height:40px;padding-left:11px;border:1px solid var(--el-border-color)}.viewer-box .list-value{width:187px;height:40px;padding-left:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:1px solid var(--el-border-color)}.viewer-box .info-wrapper,.viewer-box .setting-wrapper{position:absolute;right:20px;bottom:30px;box-sizing:border-box;width:350px;overflow:hidden auto;pointer-events:auto;cursor:pointer;border-radius:4px;opacity:1}.viewer-box .info-wrapper{height:170px}.viewer-box .setting-wrapper{height:210px}.viewer-box .setting-type{height:40px;padding-left:11px}.viewer-box .setting-value{position:relative;display:flex;flex-direction:row;align-items:center;justify-content:center;width:187px;height:40px;padding-left:14px}.viewer-box .setting-bg{position:relative;width:24px;height:24px;margin-left:12px}.viewer-box .setting-bg:hover:after{display:block}.viewer-box .setting-bg:after{position:absolute;top:-44px;left:50%;z-index:10;display:none;font-size:12px;color:var(--el-text-color-primary);white-space:nowrap;content:attr(data-attr);background-color:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow-light);transform:translate(-50%)}.viewer-box .setting-active{border:1px solid var(--el-color-primary)}.viewer-box .setting-header,.viewer-box .setting-close{cursor:pointer}.viewer-box .setting-unit,.viewer-box .setting-accuracy{display:flex;align-items:center;justify-content:space-evenly;margin:20px 0;font-size:14px;font-weight:500;color:var(--el-color-primary)}.viewer-box .setting-header{display:flex;align-items:center;justify-content:space-between;width:100%;height:40px;padding:0 12px;font-size:14px;font-weight:500;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .svgDiv{display:flex;align-items:center;justify-content:space-around;width:40px;height:40px;cursor:pointer}.viewer-box .svgDiv:hover{background-color:var(--el-fill-color-light)}.viewer-box .unit-select,.viewer-box .accuracy-select{width:170px;padding:4px 24px 4px 10px;font-size:14px;color:var(--el-text-color-primary);background-color:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;outline:none}.viewer-box .unit-select>option:checked,.viewer-box .setting-accuracy>option:checked{color:var(--el-color-primary)}.viewer-box .tree-header{display:flex;justify-content:flex-start;width:100%;height:40px;padding:0 12px;font-size:14px;font-weight:500;line-height:40px;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .tree-header>div{height:30px;padding:0 5px;margin:0 10px;font-size:14px;font-weight:400;line-height:30px;color:var(--el-color-primary);cursor:pointer;border-bottom:1px solid rgba(0,0,0,0)}.viewer-box .tree-header>div:hover{border-color:var(--el-color-primary)}.viewer-box .tree-content{position:relative;box-sizing:border-box;width:100%;height:calc(100% - 30px);padding-left:12px;overflow:hidden auto}.viewer-box .tree-content::-webkit-scrollbar-thumb{width:100%;height:10px;background-color:var(--el-color-primary);border-radius:15px}.viewer-box .tree-content::-webkit-scrollbar{width:4px;background-color:var(--el-bg-color)}.viewer-box .tree-content>div{position:absolute;top:0;left:12px;display:none;width:calc(100% - 12px);height:auto}.viewer-box .header-active{border-color:var(--el-color-primary)!important}.viewer-box .tree-active{display:block!important}.viewer-box .tree-parent{overflow:hidden;transition:all .5s}.viewer-box .tree-item{box-sizing:border-box;display:flex;align-items:center;justify-content:flex-start;width:100%;height:30px;overflow:hidden;cursor:pointer}.viewer-box .tree-item>div{margin-right:10px;transition:all .5s}.viewer-box .tree-item>input{display:block;width:16px;height:16px;margin-right:5px}.viewer-box .tree-item>span{display:block;overflow:hidden;font-size:14px;color:var(--el-text-color-primary);text-align:left;text-overflow:ellipsis;white-space:nowrap}\n";(document.head||document.documentElement).appendChild(el);}catch(e){}})();
293
+ ;(function(){try{if(typeof document==="undefined")return;if(document.querySelector("style[data-threejs-viewer-style]"))return;var el=document.createElement("style");el.setAttribute("data-threejs-viewer-style","");el.textContent=".text[data-v-c466b0fc]{box-sizing:border-box;flex:1;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.text[data-v-c466b0fc]>*{vertical-align:middle}p[data-v-c466b0fc]{margin:0}.empty-box[data-v-7f559bc0]{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%}.empty-box p[data-v-7f559bc0]{margin:9px 0 0;font-size:14px;font-weight:400;line-height:16px;color:#999}.svg-container[data-v-e4df4dc8]{display:inline-block;fill:currentColor}.svg-icon-box[data-v-621d0d75]{display:flex;align-items:center;max-width:100%;overflow:hidden;vertical-align:middle}.svg-icon-box .text[data-v-621d0d75]{flex:1;overflow:hidden;font-family:MiSans-Normal,MiSans;font-size:14px;font-weight:400;line-height:16px}.svg-icon-box .icon[data-v-621d0d75]{display:flex;align-items:center;overflow:hidden;vertical-align:-.15em;fill:currentColor}.custom-over-flow>span:nth-child(1){display:inline-block;max-width:800px!important}.base-panel[data-v-a0e4f5c1]{position:absolute;z-index:10;display:flex;flex-direction:column;overflow:hidden;background:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow-light);opacity:.7;transition:opacity .2s ease}.base-panel[data-v-a0e4f5c1]:hover{opacity:1}.base-panel__header[data-v-a0e4f5c1]{position:relative;display:flex;align-items:center;background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.base-panel__header-title[data-v-a0e4f5c1]{display:inline-block;width:100%;height:40px;font-size:14px;font-weight:500;line-height:40px;color:var(--el-text-color-primary);text-align:center}.base-panel .close-btn[data-v-a0e4f5c1]{position:absolute;top:4px;right:8px;padding:0;font-size:18px;line-height:36px;color:var(--el-text-color-secondary);cursor:pointer}.base-panel .close-btn[data-v-a0e4f5c1]:hover{color:var(--el-color-primary)}.base-panel__body[data-v-a0e4f5c1]{position:relative;display:flex;flex:1;overflow:hidden}.base-panel__resize[data-v-a0e4f5c1]{position:absolute;right:5px;bottom:5px;z-index:20;color:var(--el-border-color-light);cursor:nwse-resize}.base-panel__resize[data-v-a0e4f5c1]:hover{color:var(--el-color-primary)}.dragging[data-v-a0e4f5c1]{cursor:move!important}.unselectable[data-v-a0e4f5c1] *{-webkit-user-select:none;user-select:none}.model-tree-box[data-v-94ef88f8]{z-index:10;display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.model-tree-box[data-v-94ef88f8] .tree-tabs .el-tabs__header{margin:0}.model-tree-box[data-v-94ef88f8] .tree-tabs .el-tabs__item:nth-child(2){padding-left:20px}.model-tree-box[data-v-94ef88f8] .tree-tabs .el-tabs__item:last-child{padding-right:20px}.model-tree-box .tree-box[data-v-94ef88f8]{position:relative;display:flex;flex:1;flex-direction:column;padding:10px;overflow:hidden}.model-tree-box .tree-box[data-v-94ef88f8] .filter-tree{flex:1;margin-top:10px;overflow:hidden}.model-tree-box .tree-box[data-v-94ef88f8] .filter-tree .el-tree-node .el-tree-node__content .tree-node-box{flex:1;overflow:hidden}.model-tree-box .tree-box[data-v-94ef88f8] .filter-tree .el-tree-node .el-tree-node__content .height-light{color:var(--el-color-primary)}.model-tree-box .tree-box[data-v-94ef88f8] .filter-tree .el-tree__empty-block{width:100%;height:200px;overflow:hidden}.measure-box[data-v-39b67b39]{display:flex;flex-direction:column;width:100%;height:100%;padding:10px;overflow:hidden}.measure-box .measure-types-box[data-v-39b67b39]{display:flex;align-items:center;justify-content:space-between;padding:0 0 10px}.measure-box .measure-types-box .measure-types[data-v-39b67b39]{display:flex;gap:10px;align-items:center;cursor:pointer}.measure-box .measure-types-box .measure-types .measure-type[data-v-39b67b39]{padding:10px;color:#9b9a9a;border-radius:2px}.measure-box .measure-types-box .measure-types .measure-type[data-v-39b67b39]:hover,.measure-box .measure-types-box .measure-types .measure-type.active[data-v-39b67b39]{color:var(--el-color-primary);background-color:var(--el-color-primary-light-9)}.measure-box .measure-types-box .arrow-right[data-v-39b67b39]{margin-right:10px;cursor:pointer}.measure-box .measure-types-box .arrow-right.active[data-v-39b67b39],.measure-box .measure-types-box .arrow-right[data-v-39b67b39]:hover{color:var(--el-color-primary)}.measure-box[data-v-39b67b39] .measure-config{display:flex;flex-direction:column;flex-shrink:0;gap:10px;padding:0 10px;overflow:hidden;transition:height .3s}.measure-box[data-v-39b67b39] .measure-config .config{display:flex;gap:10px;align-items:center;overflow:hidden}.measure-box[data-v-39b67b39] .measure-config .config .label{font-size:12px}.measure-box[data-v-39b67b39] .measure-config .config .el-select{flex:1}.measure-box .measure-result[data-v-39b67b39]{padding:10px 10px 0}.measure-box .measure-result .measure-result-box[data-v-39b67b39]{display:flex;flex-direction:column;gap:10px}.measure-box .measure-result .measure-result-box .measure-item[data-v-39b67b39]{display:flex;gap:10px;align-items:center}.measure-box .measure-result .measure-result-box .measure-item .label[data-v-39b67b39]{width:60px;font-size:14px;color:var(--el-text-color-regular);text-align:right}.measure-box .clear-btn[data-v-39b67b39]{display:flex;justify-content:flex-end}.com-info-box[data-v-9386eb37]{width:100%;overflow:hidden}.com-info-box .descriptions-box[data-v-9386eb37]{border-top:1px solid var(--el-border-color-darker)}.com-info-box .descriptions-box .descriptions-item[data-v-9386eb37]{display:flex;width:100%;overflow:hidden}.com-info-box .descriptions-box .descriptions-item .label[data-v-9386eb37]{flex-shrink:0;width:40%;padding:10px;overflow:hidden;font-size:14px;font-weight:700;color:var(--el-text-color-regular);text-align:right;background:rgb(245,247,250);border:1px solid var(--el-border-color-darker);border-top:unset}.com-info-box .descriptions-box .descriptions-item .content[data-v-9386eb37]{flex:1;padding:10px;overflow:hidden;font-size:14px;border:1px solid var(--el-border-color-darker);border-top:unset;border-left:unset}.com-info-box .descriptions-box .descriptions-item .content[data-v-9386eb37] .material-box{display:flex;gap:10px;align-items:center;width:100%;height:100%}.com-info-box .descriptions-box .descriptions-item .content[data-v-9386eb37] .material-box .material-item{width:16px;height:16px;overflow:hidden;border:1px solid #000000;border-radius:3px}.com-info-box .descriptions-box .descriptions-item .content[data-v-9386eb37] .material-box .loading-box{animation:spin-clockwise-9386eb37 1s linear infinite}@keyframes spin-clockwise-9386eb37{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.cutting-box[data-v-021484ab]{display:flex;flex-direction:column;gap:20px;width:100%;padding:10px}.cutting-box .cutting-item[data-v-021484ab]{display:flex;gap:10px;align-items:center;width:100%;overflow:hidden}.cutting-box .cutting-item .label[data-v-021484ab]{font-size:14px}.cutting-box .cutting-item[data-v-021484ab] .slider{flex:1;overflow:hidden}.cutting-box .cutting-item[data-v-021484ab] .slider .el-slider{padding-left:10px}.cutting-box .cutting-item[data-v-021484ab] .slider .el-slider .el-slider__runway{margin-right:20px}.cutting-box .cutting-item[data-v-021484ab] .slider .el-slider .el-slider__runway .el-slider__button-wrapper .el-slider__button{width:15px;height:15px}.base-info-box[data-v-102dd608]{width:100%;overflow:hidden}.base-info-box .descriptions-box .descriptions-item[data-v-102dd608]{display:flex;width:100%;overflow:hidden}.base-info-box .descriptions-box .descriptions-item .label[data-v-102dd608]{flex-shrink:0;width:40%;padding:10px;overflow:hidden;font-size:14px;font-weight:700;color:var(--el-text-color-regular);text-align:right;background:rgb(245,247,250);border:1px solid var(--el-border-color-darker);border-top:unset}.base-info-box .descriptions-box .descriptions-item .content[data-v-102dd608]{flex-shrink:0;width:60%;padding:10px;overflow:hidden;font-size:14px;border:1px solid var(--el-border-color-darker);border-top:unset;border-left:unset}.base-info-box .descriptions-box .descriptions-item .content .color[data-v-102dd608]{display:flex;gap:10px;align-items:center;width:100%;height:100%}.base-info-box .descriptions-box .descriptions-item .content .color .color-item[data-v-102dd608]{width:16px;height:16px;overflow:hidden;border-radius:3px}.config-box[data-v-464a671e]{width:100%;padding:10px;overflow:hidden}.config-box .inner-config-box[data-v-464a671e]{display:flex;flex-direction:column;gap:10px}.config-box .inner-config-box .config-item[data-v-464a671e]{display:flex;gap:20px;align-items:center;overflow:hidden}.config-box .inner-config-box .config-item .label[data-v-464a671e]{font-size:14px}.config-box .inner-config-box .config-item .color-box[data-v-464a671e]{display:flex;flex:1;flex-wrap:wrap;gap:10px;overflow:hidden}.config-box .inner-config-box .config-item .color-box .color-item[data-v-464a671e]{position:relative;width:20px;height:20px;overflow:hidden;cursor:pointer}.config-box .inner-config-box .config-item .color-box .color-item .upload-btn[data-v-464a671e]{position:absolute;top:0;z-index:10;width:100%;height:100%;cursor:pointer;opacity:0}.option-card-box[data-v-17942138]{width:100%;overflow:hidden}.option-card-box .descriptions-box[data-v-17942138]{border-top:1px solid var(--el-border-color-darker)}.option-card-box .descriptions-box .descriptions-item[data-v-17942138]{display:flex;width:100%;overflow:hidden}.option-card-box .descriptions-box .descriptions-item .label[data-v-17942138]{flex-shrink:0;width:40%;padding:10px;overflow:hidden;font-size:14px;font-weight:700;color:var(--el-text-color-regular);text-align:center;background:rgb(245,247,250);border:1px solid var(--el-border-color-darker);border-top:unset}.option-card-box .descriptions-box .descriptions-item .content[data-v-17942138]{flex:1;padding:10px;overflow:hidden;font-size:14px;text-align:center;border:1px solid var(--el-border-color-darker);border-top:unset;border-left:unset}.option-btn-box[data-v-17942138]{position:absolute;bottom:50px;left:50%;z-index:10;display:flex;gap:20px;align-items:center;padding:10px 20px;background-color:rgb(var(--el-menu-bg-color-rgb) .6);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow);transform:translate(-50%)}.option-btn-box .option-item[data-v-17942138]{display:flex;gap:10px;align-items:center}.option-btn-box .option-item .option-label[data-v-17942138]{font-size:14px;font-weight:700;color:var(--el-text-color-regular)}.utils-menu-box[data-v-504a5267]{position:absolute;bottom:50px;left:50%;z-index:10;transform:translate(-50%)}.utils-menu-box[data-v-504a5267] .el-menu{background-color:rgb(var(--el-menu-bg-color-rgb) .6);border:1px solid var(--el-border-color);border-radius:2px;box-shadow:var(--el-box-shadow)}.utils-menu-box[data-v-504a5267] .el-menu .el-menu-item,.utils-menu-box[data-v-504a5267] .el-menu>.el-sub-menu{padding:0 10px;border-bottom:unset}.utils-menu-box[data-v-504a5267] .el-menu .el-menu-item .el-sub-menu__title,.utils-menu-box[data-v-504a5267] .el-menu>.el-sub-menu .el-sub-menu__title{padding:0}.utils-menu-box[data-v-504a5267] .el-menu .el-menu-item .el-sub-menu__title:hover,.utils-menu-box[data-v-504a5267] .el-menu>.el-sub-menu .el-sub-menu__title:hover{color:unset!important;background-color:unset}.utils-menu-box[data-v-504a5267] .el-menu .el-menu-item .el-sub-menu__title .el-icon,.utils-menu-box[data-v-504a5267] .el-menu>.el-sub-menu .el-sub-menu__title .el-icon{display:none}.utils-menu-box[data-v-504a5267] .el-menu .el-menu-item:hover,.utils-menu-box[data-v-504a5267] .el-menu>.el-sub-menu:hover{color:var(--el-menu-hover-text-color)!important;background-color:rgb(var(--el-color-primary-light-9) .9)!important}.utils-menu-box[data-v-504a5267] .el-menu .el-menu-item:hover .icon-box,.utils-menu-box[data-v-504a5267] .el-menu>.el-sub-menu:hover .icon-box{color:#fff;background-color:var(--el-color-primary);border-radius:50%}.utils-menu-box[data-v-504a5267] .el-menu .el-menu-item .icon-box,.utils-menu-box[data-v-504a5267] .el-menu>.el-sub-menu .icon-box{display:flex;align-items:center;justify-content:center;width:35px;height:35px}.utils-menu-box[data-v-504a5267] .el-menu .is-active{color:unset!important;background-color:unset!important;border-bottom:unset!important}.utils-menu-box[data-v-504a5267] .el-menu .is-active .el-sub-menu__title{color:unset!important;background-color:unset!important;border-bottom:unset}.utils-menu-box[data-v-504a5267] .el-menu .is-active2{color:var(--el-menu-hover-text-color)!important;background-color:rgb(var(--el-color-primary-light-9) .8)!important}.utils-menu-box[data-v-504a5267] .el-menu .is-active2 .icon-box{color:#fff;background-color:var(--el-color-primary);border-radius:50%}.utils-menu-box[data-v-504a5267] .el-menu .is-active2 .el-sub-menu__title{color:var(--el-menu-text-color);background-color:var(--el-menu-bg-color);background-color:unset!important}.utils-menu-popper .el-menu{min-width:unset}.utils-menu-popper .el-menu .icon-box{display:flex;align-items:center;width:100%;height:100%}.utils-menu-popper .el-menu .is-active,.utils-menu-popper .el-menu .is-active .el-sub-menu__title{color:unset!important;background-color:unset!important;border-bottom:unset}.utils-menu-popper .el-menu .is-active2{color:var(--el-menu-hover-text-color)!important;background-color:rgb(var(--el-menu-bg-color-rgb) .8)!important}.utils-menu-popper .el-menu .is-active2 .icon-box{background-color:rgb(var(--el-menu-bg-color-rgb) .8)!important}.utils-menu-popper .el-menu .is-active2 .el-sub-menu__title{color:var(--el-menu-text-color);background-color:var(--el-menu-bg-color);background-color:unset!important}.viewer-box[data-v-b13645b6]{position:relative;width:100%;height:100%}.viewer-box #viewer-3d[data-v-b13645b6]{width:100%;height:100%;background-image:linear-gradient(lightblue,white);outline:none}.viewer-box[data-v-696004c1]{position:relative;width:100%;height:100%}.viewer-box #viewer-3d[data-v-696004c1]{width:100%;height:100%;background-image:linear-gradient(lightblue,white);outline:none}.viewer-box .dxf-tools[data-v-696004c1]{position:absolute;bottom:25px;left:50%;transform:translate(-50%)}.viewer-box .function-wrapper{display:flex;align-items:center;justify-content:space-around;width:auto;height:48px;padding:0 12px;background-color:rgb(var(--el-menu-bg-color-rgb) .6);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow)}.viewer-box .function-wrapper>div{position:relative;display:flex;align-items:center;justify-content:center;width:35px;height:35px;margin:0 8px;cursor:pointer;background-color:transparent;border-radius:50%;transition:background-color .2s ease}.viewer-box .function-wrapper>div:hover{color:#fff;background-color:var(--el-color-primary);border-color:transparent}.viewer-box .function-active{color:#fff;background-color:var(--el-color-primary)!important}.viewer-box .function-wrapper>div>.svg-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:50%}.viewer-box .svg-wrapper:hover{background-color:transparent!important}.viewer-box .control>span{color:var(--el-text-color-primary)!important}.viewer-box .control:hover{background-color:rgb(var(--el-color-primary-rgb) .08)}.viewer-box .control:hover>span{color:var(--el-color-primary)!important}.viewer-box .text-active{margin-left:4px;font-size:14px;font-weight:500;color:var(--el-color-primary)}.viewer-box .function-wrapper>div:after{position:absolute;top:-30px;left:50%;z-index:10;display:none;padding:4px 8px;font-size:12px;line-height:1.4;color:#fff;white-space:nowrap;content:attr(data-attr);background-color:#000000bf;border-radius:4px;box-shadow:0 2px 8px #0000001f;transform:translate(-50%)}.viewer-box .function-wrapper>div:before{position:absolute;top:-10px;left:50%;z-index:10;display:none;width:0;height:0;content:\"\";border-top:6px solid rgba(0,0,0,.75);border-right:6px solid transparent;border-left:6px solid transparent;transform:translate(-50%)}.viewer-box .function-wrapper>div:hover:after,.viewer-box .function-wrapper>div:hover:before{display:block}.viewer-box .mark-wrapper,.viewer-box .info-wrapper,.viewer-box .setting-wrapper,.viewer-box .measure-wrapper,.viewer-box .layer-wrapper,.viewer-box .fly-box-control-info,.viewer-box .person-box-control-info,.viewer-box .cutting-box{background:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow-light)}.viewer-box .layer-wrapper{position:absolute;top:20px;left:20px;box-sizing:border-box;width:340px;height:600px;padding:0;overflow:hidden}.viewer-box .layer-box{width:100%;height:100%}.viewer-box .layer-header{display:flex;align-items:center;width:100%;height:40px;padding:0 12px;font-size:14px;font-weight:500;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .layer-box>.layer-content{box-sizing:border-box;width:100%;height:calc(100% - 40px);padding:4px 12px;overflow-y:auto}.viewer-box .line-item{display:flex;align-items:center;width:100%;height:28px;margin-bottom:4px;border-radius:4px;transition:background-color .15s}.viewer-box .line-item:hover{background-color:var(--el-fill-color-light)}.viewer-box .layer-header>div,.viewer-box .line-item>div{width:18px;height:18px;color:var(--el-color-primary)}.viewer-box .line-item>span{display:block}.viewer-box .line-item>.color-span{width:20px;height:20px;margin-left:6px;border:1px solid var(--el-border-color);border-radius:2px}.viewer-box .line-item>.text-span{width:calc(100% - 58px);margin-left:6px;overflow:hidden;font-size:14px;color:var(--el-text-color-primary);text-overflow:ellipsis;white-space:nowrap}.viewer-box .measure-wrapper{position:absolute;right:20px;bottom:50px;box-sizing:border-box;width:298px;height:290px;padding:0;overflow:visible;-webkit-user-select:none;user-select:none}.viewer-box .header{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:40px;font-size:14px;font-weight:500;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .header .header-title{font-size:14px;font-weight:500;color:var(--el-text-color-primary)}.viewer-box .header-setting{position:absolute;top:0;right:0;display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:var(--el-text-color-secondary);cursor:pointer}.viewer-box .header-setting:hover,.viewer-box .header-setting.is-active{color:var(--el-color-primary)}.viewer-box .content-tab{display:flex;gap:10px;align-items:center;padding:14px 10px 10px}.viewer-box .content-tab>div{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:#9b9a9a;cursor:pointer;border-radius:4px;transition:all .2s}.viewer-box .content-tab>div:hover{color:var(--el-color-primary);background:var(--el-color-primary-light-9)}.viewer-box .content-tab>.measure-active{color:var(--el-color-primary);background:var(--el-color-primary-light-9)}.viewer-box .dxf-measure-wrapper .clear-btn{position:absolute;right:12px;bottom:10px;padding:4px 12px;font-size:12px;line-height:1;color:var(--el-text-color-regular);cursor:pointer;background:var(--el-fill-color);border:1px solid var(--el-border-color);border-radius:4px;transition:color .2s,border-color .2s}.viewer-box .dxf-measure-wrapper .clear-btn:hover{color:var(--el-color-primary);border-color:var(--el-color-primary)}.viewer-box .measure-text{display:flex;flex-direction:column;gap:4px;padding:10px 12px;font-size:14px}.viewer-box .measure-line{display:flex;flex-direction:row;gap:4px;align-items:center}.viewer-box .measure-text-type{color:var(--el-text-color-secondary)}.viewer-box .measure-text-num{font-weight:500;color:var(--el-color-primary)}.viewer-box .measure-line-x .measure-text-num-x-val{color:var(--el-color-danger)}.viewer-box .measure-line-y .measure-text-num-y-val{color:var(--el-color-success)}.viewer-box .measure-setting{position:absolute;right:0;bottom:calc(100% + 8px);z-index:20;box-sizing:border-box;width:260px;overflow:hidden;background:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow-light)}.viewer-box ::-webkit-scrollbar{width:6px;height:6px}.viewer-box ::-webkit-scrollbar-thumb{background:rgb(var(--el-scrollbar-bg-color-rgb, 144, 147, 153) .3);border-radius:3px}.viewer-box ::-webkit-scrollbar-thumb:hover{background:rgb(var(--el-color-primary-rgb) .5)}.viewer-box .flex{display:flex;align-items:center;justify-content:space-between}.viewer-box .flex-center{display:flex;align-items:center;justify-content:center}.viewer-box .function-wrapper>.fly-box{position:absolute;top:0;left:50%;display:none;justify-content:space-around;width:498px;height:48px;padding:0 10px;font-family:PingFang SC-Regular,PingFang SC;font-size:14px;font-weight:400;color:#fff;background:#333333;filter:none;border-radius:4px;transform:translate(-50%)}.viewer-box .function-wrapper>.fly-box:after,.viewer-box .function-wrapper>.fly-box:before{width:0;height:0;padding:0;overflow:hidden;border:none}.viewer-box .fly-box div{height:48px;font-size:14px;line-height:48px;white-space:nowrap;-webkit-user-select:none;user-select:none}.viewer-box .fly-box span{display:inline-block}.viewer-box .fly-item{padding:0 8px}.viewer-box .fly-item>span{display:inline-block;width:12px;height:12px;font-size:14px;line-height:12px;text-align:center;cursor:pointer;border:1px solid #ffffff;border-radius:2px}.viewer-box .fly-item>span:hover{color:var(--el-color-primary);border-color:var(--el-color-primary)}.viewer-box .fly-item>span:nth-child(2){width:auto;height:16px;padding:0 5px;margin:0 10px;line-height:16px;pointer-events:none;background:rgba(255,255,255,.2);border:none;border-radius:2px}.viewer-box .fly-box>.fly-out{height:36px;padding-left:22px;font-family:PingFang SC-Regular,PingFang SC;font-size:14px;font-weight:400;line-height:36px;color:var(--el-color-primary);border-left:1px solid;border-image:linear-gradient(to bottom,#000000,#ffffff,#000000) 1}.viewer-box .function-wrapper>.fly-box-control-info{position:absolute;right:0;bottom:54px;display:block;width:272px;height:308px;padding-top:20px;overflow:hidden;font-size:14px;background-color:var(--el-bg-color);border-radius:4px;transform:translate(110%)}.viewer-box .function-wrapper>.person-box-control-info{height:278px!important}.viewer-box .fly-box-control-info>.control-close{position:absolute;top:5px;right:5px;width:18px;height:18px;font-size:12px;line-height:18px;text-align:center;cursor:pointer;-webkit-user-select:none;user-select:none;border:1px solid var(--el-border-color);border-radius:50%}.viewer-box .fly-box-control-info>.control-close:hover{color:var(--el-color-primary);border-color:var(--el-color-primary)}.viewer-box .fly-box-control-info>.control-info-item{display:flex;align-items:center;justify-content:space-between;width:100%;height:30px;border-bottom:1px solid var(--el-border-color-lighter)}.viewer-box .control-info-item>span{display:block;width:55%;color:var(--el-text-color-primary);text-align:center}.viewer-box .control-info-item>span:nth-child(1){width:40%;padding-right:15px;border-right:1px solid var(--el-border-color-lighter)}.viewer-box .cutting-box{position:absolute;bottom:166%;left:50%;z-index:11;box-sizing:border-box;width:100px;height:90px;-webkit-user-select:none;user-select:none;transform:translate(-50%)}.viewer-box .cutting-box:before{position:absolute;bottom:-10px;left:50%;z-index:10;width:0;height:0;content:\"\";border-top:10px solid var(--el-bg-color);border-right:10px solid transparent;border-left:10px solid transparent;transform:translate(-50%)}.viewer-box .cutting-box>div{padding-bottom:4px;border-bottom:1px solid var(--el-border-color-lighter)}.viewer-box .cutting-box>div>img{width:20px;height:20px;margin-right:12px;object-fit:contain}.viewer-box .cutting-box>div>span{font-size:14px;color:var(--el-color-primary)}.viewer-box .cut-wrapper{margin-top:10px}.viewer-box .cut-wrapper>div{box-sizing:content-box!important;display:flex;align-items:center;justify-content:space-between;width:80%;height:20px;padding:8px 10px;margin-right:10px;font-size:14px}.viewer-box .cut-wrapper>div>div{margin-right:4px}.viewer-box .cut-wrapper>div>img{width:16px;height:16px;vertical-align:middle}.viewer-box .cut-wrapper>div:hover{color:var(--el-color-primary);background:var(--el-color-primary-light-9)}.viewer-box .cutting-active{background-color:var(--el-color-primary-light-9)}.viewer-box .cutting-silder{position:absolute;top:50%;left:105%;width:220px;background-color:var(--el-bg-color);border-radius:4px;box-shadow:var(--el-box-shadow-light);transform:translateY(-50%)}.viewer-box .local-content{padding:0 15px;margin:10px 0}.viewer-box .local-content>div{position:relative;width:100%;height:6px;border-radius:5px}.viewer-box .local-content>div:nth-child(1){height:18px;margin-bottom:4px;font-size:14px;font-weight:500;line-height:18px;color:var(--el-text-color-primary);text-align:left}.viewer-box .local-content>div>div{position:absolute;top:50%;width:14px;height:14px;cursor:pointer;background-color:#fff;border:1px solid var(--el-color-primary);border-radius:50%;box-shadow:0 1px 4px #0000002b;transform:translateY(-50%) translate(-50%)}.viewer-box .local-content>div>div:hover{transform:translateY(-50%) translate(-50%) scale(1.1)}.viewer-box .mark-wrapper{position:absolute;right:20px;bottom:30px;box-sizing:border-box;width:350px;height:460px;overflow:hidden auto;pointer-events:auto;cursor:pointer;border-radius:4px;opacity:1}.viewer-box .title-text{display:flex;align-items:center;width:100%;height:40px;padding:0 12px;margin:0;font-size:14px;font-weight:500;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .mark-list,.viewer-box .setting-list{display:flex;padding-left:10px;font-size:14px;font-weight:500;line-height:40px;color:var(--el-text-color-regular);text-align:left}.viewer-box .list-type{width:123px;height:40px;padding-left:11px;border:1px solid var(--el-border-color)}.viewer-box .list-value{width:187px;height:40px;padding-left:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:1px solid var(--el-border-color)}.viewer-box .info-wrapper,.viewer-box .setting-wrapper{position:absolute;right:20px;bottom:30px;box-sizing:border-box;width:350px;overflow:hidden auto;pointer-events:auto;cursor:pointer;border-radius:4px;opacity:1}.viewer-box .info-wrapper{height:170px}.viewer-box .setting-wrapper{height:210px}.viewer-box .setting-type{height:40px;padding-left:11px}.viewer-box .setting-value{position:relative;display:flex;flex-direction:row;align-items:center;justify-content:center;width:187px;height:40px;padding-left:14px}.viewer-box .setting-bg{position:relative;width:24px;height:24px;margin-left:12px}.viewer-box .setting-bg:hover:after{display:block}.viewer-box .setting-bg:after{position:absolute;top:-44px;left:50%;z-index:10;display:none;font-size:12px;color:var(--el-text-color-primary);white-space:nowrap;content:attr(data-attr);background-color:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;box-shadow:var(--el-box-shadow-light);transform:translate(-50%)}.viewer-box .setting-active{border:1px solid var(--el-color-primary)}.viewer-box .setting-header,.viewer-box .setting-close{cursor:pointer}.viewer-box .setting-unit,.viewer-box .setting-accuracy{display:flex;align-items:center;justify-content:space-evenly;margin:20px 0;font-size:14px;font-weight:500;color:var(--el-color-primary)}.viewer-box .setting-header{display:flex;align-items:center;justify-content:space-between;width:100%;height:40px;padding:0 12px;font-size:14px;font-weight:500;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .svgDiv{display:flex;align-items:center;justify-content:space-around;width:40px;height:40px;cursor:pointer}.viewer-box .svgDiv:hover{background-color:var(--el-fill-color-light)}.viewer-box .unit-select,.viewer-box .accuracy-select{width:170px;padding:4px 24px 4px 10px;font-size:14px;color:var(--el-text-color-primary);background-color:var(--el-bg-color);border:1px solid var(--el-border-color);border-radius:4px;outline:none}.viewer-box .unit-select>option:checked,.viewer-box .setting-accuracy>option:checked{color:var(--el-color-primary)}.viewer-box .tree-header{display:flex;justify-content:flex-start;width:100%;height:40px;padding:0 12px;font-size:14px;font-weight:500;line-height:40px;color:var(--el-text-color-primary);background:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color)}.viewer-box .tree-header>div{height:30px;padding:0 5px;margin:0 10px;font-size:14px;font-weight:400;line-height:30px;color:var(--el-color-primary);cursor:pointer;border-bottom:1px solid rgba(0,0,0,0)}.viewer-box .tree-header>div:hover{border-color:var(--el-color-primary)}.viewer-box .tree-content{position:relative;box-sizing:border-box;width:100%;height:calc(100% - 30px);padding-left:12px;overflow:hidden auto}.viewer-box .tree-content::-webkit-scrollbar-thumb{width:100%;height:10px;background-color:var(--el-color-primary);border-radius:15px}.viewer-box .tree-content::-webkit-scrollbar{width:4px;background-color:var(--el-bg-color)}.viewer-box .tree-content>div{position:absolute;top:0;left:12px;display:none;width:calc(100% - 12px);height:auto}.viewer-box .header-active{border-color:var(--el-color-primary)!important}.viewer-box .tree-active{display:block!important}.viewer-box .tree-parent{overflow:hidden;transition:all .5s}.viewer-box .tree-item{box-sizing:border-box;display:flex;align-items:center;justify-content:flex-start;width:100%;height:30px;overflow:hidden;cursor:pointer}.viewer-box .tree-item>div{margin-right:10px;transition:all .5s}.viewer-box .tree-item>input{display:block;width:16px;height:16px;margin-right:5px}.viewer-box .tree-item>span{display:block;overflow:hidden;font-size:14px;color:var(--el-text-color-primary);text-align:left;text-overflow:ellipsis;white-space:nowrap}\n";(document.head||document.documentElement).appendChild(el);}catch(e){}})();