iflow-engine-base-3d 3.12.13 → 3.12.14
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as a } from "./chunks/engine-3d-
|
|
2
|
-
import { M as d } from "./chunks/engine-3d-
|
|
1
|
+
import { E as a } from "./chunks/engine-3d-NRrj9zJE.js";
|
|
2
|
+
import { M as d } from "./chunks/engine-3d-NRrj9zJE.js";
|
|
3
3
|
import { s, a as t, b as l } from "./chunks/sdk-assets-DWhsnp7n.js";
|
|
4
4
|
async function r(e) {
|
|
5
5
|
e?.assetFiles ? await s(e.assetFiles) : e?.assetFile ? await t(e.assetFile) : e?.assetBaseUrl && await s(null), e?.assetBaseUrl && l(e.assetBaseUrl);
|
|
@@ -5969,7 +5969,7 @@ void main() {
|
|
|
5969
5969
|
${CA}
|
|
5970
5970
|
</g>
|
|
5971
5971
|
</svg>
|
|
5972
|
-
`.trim()}getLayout(A){const t=A.instance.style.leaderPoint??{},e=(t.text??"").trim(),i=Math.max(t.fontSize??14,10),n=Math.max(Math.round(Math.abs(t.offsetX??t.armLength??4)*18),56),o=this.getBoardWidth(A,e,i),g=Math.max(Math.round((t.boardHeight??1.8)*22),i+18,34),r=(t.side??"right")==="right"?22+n-8:22-n-o+8,I=Math.min(22,r)-16,l=Math.max(22,r+o)+16,h=Math.max(l-I,140),B=Math.max(Math.round((t.height??8)*12),48),E=Math.max(B+g+36,120);return{widthPx:h,heightPx:E}}escapeXmlAttribute(A){return A.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}escapeXmlText(A){return A.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}getBoardWidth(A,t,e){const i=A.instance.style.leaderPoint??{},n=!!A.instance.style.point?.icon,o=Array.from(t).reduce((a,r)=>a+(/[^\x00-\xff]/.test(r)?e:e*.62),0),g=t?o+(n?48:24):0;return Math.max(Math.round((i.boardWidth??4.6)*22),Math.ceil(g),78)}}class fv{constructor(A,t){this.engine=A,this.isAnchorOccluded=t,this.container=document.createElement("div"),this.container.className=Bv,this.container.style.cssText=["position:absolute","left:0","top:0","width:100%","height:100%","pointer-events:none","overflow:hidden","z-index:1250"].join(";"),this.engine.container.appendChild(this.container),this.worldToScreen=new ei(this.engine.camera,this.engine.renderer,this.engine.scene)}container;worldToScreen;leaderMarker=new dv;updateProjectionState(){this.worldToScreen.updateCamera(this.engine.camera),this.worldToScreen.updateRenderer(this.engine.renderer),this.worldToScreen.updateScene(this.engine.scene)}createPanelElement(A,t){const e=document.createElement("div");return e.className=`bim-annotation3d-panel ${t.className??""}`.trim(),e.dataset.annotationId=A.id,e.style.cssText=["position:absolute","left:0","top:0","transform:translate(-50%, -100%)","display:none",t.interactive===!1?"pointer-events:none":"pointer-events:auto"].join(";"),t.mode==="html"?e.innerHTML=t.html??"":e.textContent=t.text??"",Object.entries(t.style??{}).forEach(([i,n])=>e.style.setProperty(cv(i),n)),e}createLeaderMarkerElement(A){const t=document.createElement("div");return t.className="bim-annotation3d-leader-marker",t.dataset.annotationId=A.id,t.style.cssText=["position:absolute","left:0","top:0","display:none","pointer-events:none"].join(";"),t}updateRecord(A){if(A.markerElement&&A.instance.type==="leaderPoint"&&this.updateLeaderMarker(A),!A.panelElement||!A.instance.panel)return;const t=A.instance.panel;if(!(t.visible!==!1&&this.shouldShowPanel(A))||!A.instance.visible){A.panelElement.style.display="none";return}const i=this.getPanelAnchorPoint(A),n=this.worldToScreen.worldToScreenIfVisible(i);if(!n||t.occlusion==="hide"&&this.isAnchorOccluded(i)){A.panelElement.style.display="none";return}const o=t.screenOffset??{};A.panelElement.style.display="block",A.panelElement.style.left=`${n.x+(o.x??0)}px`,A.panelElement.style.top=`${n.y+(o.y??0)}px`}dispose(){this.container.remove()}updateLeaderMarker(A){const t=A.markerElement;if(!t)return;if(!A.instance.visible){t.style.display="none";return}const e=se(A.instance.points[0]),i=this.worldToScreen.worldToScreenIfVisible(e);if(!i
|
|
5972
|
+
`.trim()}getLayout(A){const t=A.instance.style.leaderPoint??{},e=(t.text??"").trim(),i=Math.max(t.fontSize??14,10),n=Math.max(Math.round(Math.abs(t.offsetX??t.armLength??4)*18),56),o=this.getBoardWidth(A,e,i),g=Math.max(Math.round((t.boardHeight??1.8)*22),i+18,34),r=(t.side??"right")==="right"?22+n-8:22-n-o+8,I=Math.min(22,r)-16,l=Math.max(22,r+o)+16,h=Math.max(l-I,140),B=Math.max(Math.round((t.height??8)*12),48),E=Math.max(B+g+36,120);return{widthPx:h,heightPx:E}}escapeXmlAttribute(A){return A.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}escapeXmlText(A){return A.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}getBoardWidth(A,t,e){const i=A.instance.style.leaderPoint??{},n=!!A.instance.style.point?.icon,o=Array.from(t).reduce((a,r)=>a+(/[^\x00-\xff]/.test(r)?e:e*.62),0),g=t?o+(n?48:24):0;return Math.max(Math.round((i.boardWidth??4.6)*22),Math.ceil(g),78)}}class fv{constructor(A,t){this.engine=A,this.isAnchorOccluded=t,this.container=document.createElement("div"),this.container.className=Bv,this.container.style.cssText=["position:absolute","left:0","top:0","width:100%","height:100%","pointer-events:none","overflow:hidden","z-index:1250"].join(";"),this.engine.container.appendChild(this.container),this.worldToScreen=new ei(this.engine.camera,this.engine.renderer,this.engine.scene)}container;worldToScreen;leaderMarker=new dv;updateProjectionState(){this.worldToScreen.updateCamera(this.engine.camera),this.worldToScreen.updateRenderer(this.engine.renderer),this.worldToScreen.updateScene(this.engine.scene)}createPanelElement(A,t){const e=document.createElement("div");return e.className=`bim-annotation3d-panel ${t.className??""}`.trim(),e.dataset.annotationId=A.id,e.style.cssText=["position:absolute","left:0","top:0","transform:translate(-50%, -100%)","display:none",t.interactive===!1?"pointer-events:none":"pointer-events:auto"].join(";"),t.mode==="html"?e.innerHTML=t.html??"":e.textContent=t.text??"",Object.entries(t.style??{}).forEach(([i,n])=>e.style.setProperty(cv(i),n)),e}createLeaderMarkerElement(A){const t=document.createElement("div");return t.className="bim-annotation3d-leader-marker",t.dataset.annotationId=A.id,t.style.cssText=["position:absolute","left:0","top:0","display:none","pointer-events:none"].join(";"),t}updateRecord(A){if(A.markerElement&&A.instance.type==="leaderPoint"&&this.updateLeaderMarker(A),!A.panelElement||!A.instance.panel)return;const t=A.instance.panel;if(!(t.visible!==!1&&this.shouldShowPanel(A))||!A.instance.visible){A.panelElement.style.display="none";return}const i=this.getPanelAnchorPoint(A),n=this.worldToScreen.worldToScreenIfVisible(i);if(!n||t.occlusion==="hide"&&this.isAnchorOccluded(i)){A.panelElement.style.display="none";return}const o=t.screenOffset??{};A.panelElement.style.display="block",A.panelElement.style.left=`${n.x+(o.x??0)}px`,A.panelElement.style.top=`${n.y+(o.y??0)}px`}dispose(){this.container.remove()}updateLeaderMarker(A){const t=A.markerElement;if(!t)return;if(!A.instance.visible){t.style.display="none";return}const e=se(A.instance.points[0]),i=this.worldToScreen.worldToScreenIfVisible(e);if(!i){t.style.display="none";return}const n=this.leaderMarker.getLayout(A);t.innerHTML=this.leaderMarker.render(A),t.style.display="block",t.style.left=`${Math.round(i.x)}px`,t.style.top=`${Math.round(i.y-(n.heightPx-18))}px`,t.style.width=`${n.widthPx}px`,t.style.height=`${n.heightPx}px`}shouldShowPanel(A){const t=A.instance.panel?.trigger??"manual";return t==="always"?!0:t==="hover"?A.instance.hovered:t==="click"||t==="manual"?A.instance.panelVisible:!1}getPanelAnchorPoint(A){const t=A.instance.panel?.offset??{};if(A.panelAnchorPoint)return A.panelAnchorPoint.clone().add(new Y(t.x??0,t.y??0,t.z??0));const e=A.instance.panel?.anchor??Qv(A.instance.type);let i=new Y;if(A.instance.type==="point"||A.instance.type==="leaderPoint")i.copy(se(A.instance.points[0])),e==="top"&&(i.y+=A.volumeHeight??A.instance.style.point?.anchorY??0);else if(A.instance.type==="polyline"||A.instance.type==="curve3d")e==="start"?i.copy(se(A.instance.points[0])):e==="end"?i.copy(se(A.instance.points[A.instance.points.length-1])):A.anchorCurve?i.copy(A.anchorCurve.getPoint(.5)):i.copy(sQ(A.instance.points));else if(A.instance.type==="polygon")i.copy(sQ(A.instance.points));else if(A.instance.type==="extrudePolygon")i.copy(sQ(A.instance.points)),e==="top"&&A.anchorNormal&&i.add(A.anchorNormal.clone().multiplyScalar(A.volumeHeight??0));else if(A.instance.type==="box"&&(i.copy(sQ(A.instance.points)),e==="top"&&A.instance.points.length>=2)){const n=se(A.instance.points[0]),o=se(A.instance.points[1]);i.y=Math.max(n.y,o.y)}return i.add(new Y(t.x??0,t.y??0,t.z??0)),i}}class Mv{apply(A,t){A.instance.root.visible=A.instance.visible,A.instance.style.alwaysOnTop&&A.instance.root.traverse(e=>{e.renderOrder=Math.max(e.renderOrder,1200)}),t(A)}}class yv{constructor(A){this.engine=A}createSurfaceMaterial(A){const t=A.style??{},e=A.effect??{},i=this.getGradientStops(A.color,e.gradient?.stops),n=e.gradient?.enabled===!0,o=e.glow?.enabled?e.glow.intensity??.9:0,g=e.flow?.enabled===!0,a=e.pulse?.enabled===!0,r=e.scan?.enabled===!0,I=e.flow?.direction==="backward"?-1:1,l=new vt({transparent:!0,side:Gt,depthTest:t.alwaysOnTop?!1:t.depthTest!==!1,depthWrite:!1,uniforms:{uTime:{value:0},uBaseColor:{value:new UA(A.color)},uBaseOpacity:{value:A.opacity},uGradientEnabled:{value:n?1:0},uGradientAxisMode:{value:this.axisModeToNumber(A.axisMode)},uAxisMin:{value:A.axisMin??0},uAxisMax:{value:A.axisMax??1},uGradientStartColor:{value:new UA(i[0].color)},uGradientEndColor:{value:new UA(i[1].color)},uGradientStartAlpha:{value:i[0].alpha??1},uGradientEndAlpha:{value:i[1].alpha??.1},uGlowIntensity:{value:o},uFlowEnabled:{value:g?1:0},uFlowSpeed:{value:e.flow?.speed??.6},uFlowWidth:{value:e.flow?.width??.18},uFlowDirection:{value:I},uPulseEnabled:{value:a?1:0},uPulseSpeed:{value:e.pulse?.speed??1.4},uPulseMinOpacity:{value:e.pulse?.minOpacity??.55},uPulseMaxOpacity:{value:e.pulse?.maxOpacity??1},uScanEnabled:{value:r?1:0},uScanSpeed:{value:e.scan?.speed??.8},uScanWidth:{value:e.scan?.width??.18}},vertexShader:`
|
|
5973
5973
|
varying vec2 vUv;
|
|
5974
5974
|
varying vec3 vPosition;
|
|
5975
5975
|
void main() {
|
|
@@ -6463,7 +6463,7 @@ void main() {
|
|
|
6463
6463
|
#include <premultiplied_alpha_fragment>
|
|
6464
6464
|
|
|
6465
6465
|
}
|
|
6466
|
-
`};class Fy extends vt{constructor(A){super({type:"LineMaterial",uniforms:ti.clone(Ki.line.uniforms),vertexShader:Ki.line.vertexShader,fragmentShader:Ki.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(A)}get color(){return this.uniforms.diffuse.value}set color(A){this.uniforms.diffuse.value=A}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(A){A===!0!==this.worldUnits&&(this.needsUpdate=!0),A===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(A){this.uniforms.linewidth&&(this.uniforms.linewidth.value=A)}get dashed(){return"USE_DASH"in this.defines}set dashed(A){A===!0!==this.dashed&&(this.needsUpdate=!0),A===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(A){this.uniforms.dashScale.value=A}get dashSize(){return this.uniforms.dashSize.value}set dashSize(A){this.uniforms.dashSize.value=A}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(A){this.uniforms.dashOffset.value=A}get gapSize(){return this.uniforms.gapSize.value}set gapSize(A){this.uniforms.gapSize.value=A}get opacity(){return this.uniforms.opacity.value}set opacity(A){this.uniforms&&(this.uniforms.opacity.value=A)}get resolution(){return this.uniforms.resolution.value}set resolution(A){this.uniforms.resolution.value.copy(A)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(A){this.defines&&(A===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),A===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const by=new Ct,oW=new Y,gW=new Y,hi=new Ct,Ci=new Ct,yn=new Ct,Wy=new Y,Gy=new RA,Ei=new _i,aW=new Y,rQ=new qA,IQ=new Fe,Dn=new Ct;let pn,da;function rW(s,A,t){return Dn.set(0,0,-A,1).applyMatrix4(s.projectionMatrix),Dn.multiplyScalar(1/Dn.w),Dn.x=da/t.width,Dn.y=da/t.height,Dn.applyMatrix4(s.projectionMatrixInverse),Dn.multiplyScalar(1/Dn.w),Math.abs(Math.max(Dn.x,Dn.y))}function zv(s,A){const t=s.matrixWorld,e=s.geometry,i=e.attributes.instanceStart,n=e.attributes.instanceEnd,o=Math.min(e.instanceCount,i.count);for(let g=0,a=o;g<a;g++){Ei.start.fromBufferAttribute(i,g),Ei.end.fromBufferAttribute(n,g),Ei.applyMatrix4(t);const r=new Y,I=new Y;pn.distanceSqToSegment(Ei.start,Ei.end,I,r),I.distanceTo(r)<da*.5&&A.push({point:I,pointOnLine:r,distance:pn.origin.distanceTo(I),object:s,face:null,faceIndex:g,uv:null,uv1:null})}}function vv(s,A,t){const e=A.projectionMatrix,n=s.material.resolution,o=s.matrixWorld,g=s.geometry,a=g.attributes.instanceStart,r=g.attributes.instanceEnd,I=Math.min(g.instanceCount,a.count),l=-A.near;pn.at(1,yn),yn.w=1,yn.applyMatrix4(A.matrixWorldInverse),yn.applyMatrix4(e),yn.multiplyScalar(1/yn.w),yn.x*=n.x/2,yn.y*=n.y/2,yn.z=0,Wy.copy(yn),Gy.multiplyMatrices(A.matrixWorldInverse,o);for(let h=0,B=I;h<B;h++){if(hi.fromBufferAttribute(a,h),Ci.fromBufferAttribute(r,h),hi.w=1,Ci.w=1,hi.applyMatrix4(Gy),Ci.applyMatrix4(Gy),hi.z>l&&Ci.z>l)continue;if(hi.z>l){const M=hi.z-Ci.z,y=(hi.z-l)/M;hi.lerp(Ci,y)}else if(Ci.z>l){const M=Ci.z-hi.z,y=(Ci.z-l)/M;Ci.lerp(hi,y)}hi.applyMatrix4(e),Ci.applyMatrix4(e),hi.multiplyScalar(1/hi.w),Ci.multiplyScalar(1/Ci.w),hi.x*=n.x/2,hi.y*=n.y/2,Ci.x*=n.x/2,Ci.y*=n.y/2,Ei.start.copy(hi),Ei.start.z=0,Ei.end.copy(Ci),Ei.end.z=0;const c=Ei.closestPointToPointParameter(Wy,!0);Ei.at(c,aW);const Q=rt.lerp(hi.z,Ci.z,c),C=Q>=-1&&Q<=1,d=Wy.distanceTo(aW)<da*.5;if(C&&d){Ei.start.fromBufferAttribute(a,h),Ei.end.fromBufferAttribute(r,h),Ei.start.applyMatrix4(o),Ei.end.applyMatrix4(o);const M=new Y,y=new Y;pn.distanceSqToSegment(Ei.start,Ei.end,y,M),t.push({point:y,pointOnLine:M,distance:pn.origin.distanceTo(y),object:s,face:null,faceIndex:h,uv:null,uv1:null})}}}class _v extends bA{constructor(A=new nW,t=new Fy({color:Math.random()*16777215})){super(A,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const A=this.geometry,t=A.attributes.instanceStart,e=A.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let o=0,g=0,a=t.count;o<a;o++,g+=2)oW.fromBufferAttribute(t,o),gW.fromBufferAttribute(e,o),i[g]=g===0?0:i[g-1],i[g+1]=i[g]+oW.distanceTo(gW);const n=new ZC(i,2,1);return A.setAttribute("instanceDistanceStart",new Gi(n,1,0)),A.setAttribute("instanceDistanceEnd",new Gi(n,1,1)),this}raycast(A,t){const e=this.material.worldUnits,i=A.camera;if(i===null&&!e&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),e===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;const n=A.params.Line2!==void 0&&A.params.Line2.threshold||0;pn=A.ray;const o=this.matrixWorld,g=this.geometry,a=this.material;da=a.linewidth+n,g.boundingSphere===null&&g.computeBoundingSphere(),IQ.copy(g.boundingSphere).applyMatrix4(o);let r;if(e)r=da*.5;else{const l=Math.max(i.near,IQ.distanceToPoint(pn.origin));r=rW(i,l,a.resolution)}if(IQ.radius+=r,pn.intersectsSphere(IQ)===!1)return;g.boundingBox===null&&g.computeBoundingBox(),rQ.copy(g.boundingBox).applyMatrix4(o);let I;if(e)I=da*.5;else{const l=Math.max(i.near,rQ.distanceToPoint(pn.origin));I=rW(i,l,a.resolution)}rQ.expandByScalar(I),pn.intersectsBox(rQ)!==!1&&(e?zv(this,t):vv(this,i,t))}onBeforeRender(A){const t=this.material.uniforms;t&&t.resolution&&(A.getViewport(by),this.material.uniforms.resolution.value.set(by.z,by.w))}}class IW extends nW{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(A){const t=A.length-3,e=new Float32Array(2*t);for(let i=0;i<t;i+=3)e[2*i]=A[i],e[2*i+1]=A[i+1],e[2*i+2]=A[i+2],e[2*i+3]=A[i+3],e[2*i+4]=A[i+4],e[2*i+5]=A[i+5];return super.setPositions(e),this}setColors(A){const t=A.length-3,e=new Float32Array(2*t);for(let i=0;i<t;i+=3)e[2*i]=A[i],e[2*i+1]=A[i+1],e[2*i+2]=A[i+2],e[2*i+3]=A[i+3],e[2*i+4]=A[i+4],e[2*i+5]=A[i+5];return super.setColors(e),this}setFromPoints(A){const t=A.length-1,e=new Float32Array(6*t);for(let i=0;i<t;i++)e[6*i]=A[i].x,e[6*i+1]=A[i].y,e[6*i+2]=A[i].z||0,e[6*i+3]=A[i+1].x,e[6*i+4]=A[i+1].y,e[6*i+5]=A[i+1].z||0;return super.setPositions(e),this}fromLine(A){const t=A.geometry;return this.setPositions(t.attributes.position.array),this}}class qv extends _v{constructor(A=new IW,t=new Fy({color:Math.random()*16777215})){super(A,t),this.isLine2=!0,this.type="Line2"}}const lQ={lineType:"bezier",lineColor:"#22c55e",previewColor:"#f59e0b",pointColor:"#ffffff",selectedPointColor:"#f59e0b",pointSize:.34,lineWidth:4,sampleCount:64,roundedRadius:1,historyLimit:100},$v={bezier:"贝塞尔曲线",straight:"直线",rounded:"圆角直线"},A8={bezier:"∿",straight:"╱",rounded:"⌁"};class t8{type="path-draw";engine;root=new Ot;pointsGroup=new Ot;points=[];history=[];options={...lQ};lineType=lQ.lineType;roundedRadius=lQ.roundedRadius;line=null;previewLine=null;previewMarker=null;transformControl=null;transformHelper=null;selectedPointId=null;panel=null;pointsList=null;statusElement=null;addButton=null;completeButton=null;radiusInput=null;mode="editing";active=!1;closing=!1;transformDragging=!1;suppressNextCanvasClick=!1;controlsEnabledBeforeDrag=!0;pointSequence=0;pathId="";onKeyDown;constructor(A){this.engine=A,this.root.name="PathDrawRoot",this.pointsGroup.name="PathDrawPoints",this.root.add(this.pointsGroup),this.onKeyDown=this.handleKeyDown.bind(this)}open(A={}){this.active&&this.close(),this.options={...lQ,...A},this.pathId=A.id??`path-${Date.now()}`,this.lineType=this.options.lineType,this.roundedRadius=Math.max(0,this.options.roundedRadius),this.active=!0,this.mode="editing",this.engine.scene?.add(this.root),this.ensureTransformControl(),this.createPanel(),this.activateBehavior(),window.addEventListener("keydown",this.onKeyDown,!0),this.refreshAll()}startAddPoint(){return!this.active||this.transformDragging?!1:(this.mode="picking",this.clearSelection(),this.setStatus("请在模型上拾取位置"),this.addButton&&(this.addButton.dataset.active="true"),!0)}setLineType(A){!this.active||this.lineType===A||(this.saveHistory(),this.lineType=A,this.refreshAll(),this.emitChange())}undo(){const A=this.history.pop();return A?(this.restoreSnapshot(A),this.mode="editing",this.clearPreview(),this.refreshAll(),this.emitChange(),!0):!1}clear(){this.points.length!==0&&(this.saveHistory(),this.clearPointRecords(),this.mode="editing",this.clearPreview(),this.refreshAll(),this.emitChange())}getPathData(){if(this.points.length<2)return null;const A=this.buildSamplePoints(this.points.map(t=>t.position));return{version:1,id:this.pathId,lineType:this.lineType,coordinateSystem:"world",closed:!1,roundedRadius:this.roundedRadius,points:this.points.map((t,e)=>({id:t.id,order:e,role:this.getPointRole(e),position:this.toPlainVector(t.position)})),samples:A.map(t=>this.toPlainVector(t)),length:this.calculateLength(A)}}complete(){const A=this.getPathData();if(!A)return null;try{this.options.onComplete?.(A)}finally{this.close()}return A}isActive(){return this.active}close(){this.closeInternal(!0)}closeInternal(A){!this.active&&!this.panel||this.closing||(this.closing=!0,this.active=!1,window.removeEventListener("keydown",this.onKeyDown,!0),this.clearPreview(),this.clearPointRecords(),this.disposeLine("line"),this.detachTransformControl(),this.panel?.remove(),this.panel=null,this.pointsList=null,this.statusElement=null,this.addButton=null,this.completeButton=null,this.radiusInput=null,this.history.length=0,this.selectedPointId=null,this.root.parent?.remove(this.root),A&&this.restoreDefaultBehavior(),this.closing=!1)}dispose(){this.closeInternal(!1),this.transformControl?.dispose(),this.transformControl=null,this.transformHelper=null}update(){!this.active||!this.engine.camera||(this.transformControl&&this.transformControl.camera!==this.engine.camera&&(this.transformControl.camera=this.engine.camera),this.syncLineResolution(this.line),this.syncLineResolution(this.previewLine))}disActive(){this.closing||this.closeInternal(!1)}handleMouseMove(A){if(!this.active||this.mode!=="picking")return;const t=this.getCatchPoint(A?.catch);if(!t){this.clearPreview();return}this.updatePreview(t)}handleMouseClick(A){if(!this.active)return;if(this.suppressNextCanvasClick){this.suppressNextCanvasClick=!1;return}if(this.mode==="picking"){const e=this.getCatchPoint(A?.catch);if(!e)return;this.saveHistory();const i=this.createPointRecord(e);this.points.push(i),this.pointsGroup.add(i.mesh),this.mode="editing",this.clearPreview(),this.selectPoint(i.id),this.refreshAll(),this.emitChange();return}const t=this.pickPointMesh(A);t?this.selectPoint(t.userData.pathDrawPointId):this.clearSelection()}handelKeyEscDown(){if(this.mode==="picking"){this.mode="editing",this.clearPreview(),this.refreshPanel();return}this.clearSelection()}activateBehavior(){const A=this.engine.handelBehaved;A?.init?.(this,{showCatch:!0}),A?.active?.()}restoreDefaultBehavior(){const A=this.engine.handelBehaved;A?.self===this&&(A.disActive?.(),this.engine.interactionModule?.init?.(),this.engine.interactionModule?.active?.(),this.engine.catchSvg&&(this.engine.catchSvg.innerHTML=""))}ensureTransformControl(){if(this.transformControl){this.transformHelper&&!this.transformHelper.parent&&this.engine.scene?.add(this.transformHelper);return}!this.engine.camera||!this.engine.renderer||!this.engine.scene||(this.transformControl=new vl(this.engine.camera,this.engine.renderer.domElement),this.transformControl.setMode("translate"),this.transformControl.size=.72,this.transformControl.addEventListener("dragging-changed",A=>{if(this.transformDragging=!!A.value,this.transformDragging){this.saveHistory(),this.controlsEnabledBeforeDrag=this.engine.controls?.enabled!==!1,this.engine.controls&&(this.engine.controls.enabled=!1);return}this.engine.controls&&(this.engine.controls.enabled=this.controlsEnabledBeforeDrag),this.suppressNextCanvasClick=!0,requestAnimationFrame(()=>{this.suppressNextCanvasClick=!1}),this.refreshAll(),this.emitChange()}),this.transformControl.addEventListener("objectChange",()=>{const A=this.getSelectedPoint();A&&(A.position.copy(A.mesh.position),this.refreshLine(),this.refreshPanel(),this.emitChange())}),this.transformHelper=this.transformControl.getHelper(),this.transformHelper.visible=!1,this.engine.scene.add(this.transformHelper))}detachTransformControl(){this.transformControl?.detach(),this.transformHelper&&(this.transformHelper.visible=!1,this.transformHelper.parent?.remove(this.transformHelper))}createPointRecord(A,t){const e=new sn(this.options.pointSize,18,12),i=new Tt({color:this.options.pointColor,depthTest:!1,depthWrite:!1}),n=new bA(e,i),o=t??`path-point-${++this.pointSequence}`;return n.name=o,n.position.copy(A),n.renderOrder=1002,n.userData.pathDrawPointId=o,{id:o,position:A.clone(),mesh:n}}selectPoint(A){const t=this.points.find(e=>e.id===A);!t||!this.transformControl||!this.transformHelper||(this.selectedPointId=A,this.points.forEach(e=>e.mesh.material.color.set(e.id===A?this.options.selectedPointColor:this.options.pointColor)),this.transformControl.attach(t.mesh),this.transformHelper.visible=!0,this.refreshPanel())}clearSelection(){this.selectedPointId=null,this.points.forEach(A=>A.mesh.material.color.set(this.options.pointColor)),this.transformControl?.detach(),this.transformHelper&&(this.transformHelper.visible=!1),this.refreshPanel()}getSelectedPoint(){return this.points.find(A=>A.id===this.selectedPointId)??null}getCatchPoint(A){return A?.point instanceof Y?A.point.clone():null}pickPointMesh(A){if(!this.engine.camera||!this.engine.renderer)return null;const t=this.engine.renderer.domElement.clientWidth,e=this.engine.renderer.domElement.clientHeight;if(!t||!e)return null;const i=new dA(A.offsetX/t*2-1,-(A.offsetY/e)*2+1),n=new be;return n.setFromCamera(i,this.engine.camera),n.intersectObjects(this.pointsGroup.children,!1)[0]?.object??null}updatePreview(A){this.previewMarker||(this.previewMarker=new bA(new sn(this.options.pointSize*.72,14,10),new Tt({color:this.options.previewColor,depthTest:!1,depthWrite:!1})),this.previewMarker.renderOrder=1003,this.root.add(this.previewMarker)),this.previewMarker.position.copy(A),this.previewMarker.visible=!0;const t=[...this.points.map(i=>i.position),A];if(t.length<2){this.disposeLine("previewLine");return}const e=this.buildSamplePoints(t);this.previewLine=this.updateLineObject(this.previewLine,e,!0)}clearPreview(){this.disposeLine("previewLine"),this.previewMarker&&(this.previewMarker.geometry.dispose(),this.previewMarker.material.dispose(),this.previewMarker.parent?.remove(this.previewMarker),this.previewMarker=null)}refreshAll(){this.refreshLine(),this.refreshPanel(),this.requestRender()}refreshLine(){if(this.points.length<2){this.disposeLine("line");return}const A=this.buildSamplePoints(this.points.map(t=>t.position));this.line=this.updateLineObject(this.line,A,!1)}updateLineObject(A,t,e){const i=new IW;if(i.setPositions(t.flatMap(g=>[g.x,g.y,g.z])),A)return A.geometry.dispose(),A.geometry=i,A.computeLineDistances(),this.syncLineResolution(A),this.requestRender(),A;const n=new Fy({color:e?this.options.previewColor:this.options.lineColor,linewidth:this.options.lineWidth,dashed:e,dashSize:.32,gapSize:.2,depthTest:!1,transparent:e,opacity:e?.82:1}),o=new qv(i,n);return o.name=e?"PathDrawPreviewLine":"PathDrawLine",o.renderOrder=e?1001:1e3,o.computeLineDistances(),this.syncLineResolution(o),this.root.add(o),this.requestRender(),o}syncLineResolution(A){const t=A?.material,e=this.engine.renderer?.domElement;!t||!e||t.resolution.set(e.clientWidth,e.clientHeight)}disposeLine(A){const t=this[A];if(!t)return;t.parent?.remove(t),t.geometry.dispose(),(Array.isArray(t.material)?t.material:[t.material]).forEach(i=>i.dispose()),this[A]=null}buildSamplePoints(A){return A.length<2?A.map(t=>t.clone()):this.lineType==="straight"?A.map(t=>t.clone()):this.lineType==="rounded"?this.sampleRoundedPolyline(A):this.sampleBezier(A)}sampleBezier(A){const t=Math.max(2,this.options.sampleCount);return Array.from({length:t+1},(e,i)=>{const n=A.map(g=>g.clone()),o=i/t;for(let g=n.length-1;g>0;g-=1)for(let a=0;a<g;a+=1)n[a].lerp(n[a+1],o);return n[0]})}sampleRoundedPolyline(A){if(A.length<3||this.roundedRadius<=0)return A.map(i=>i.clone());const t=[A[0].clone()],e=Math.max(4,Math.round(this.options.sampleCount/Math.max(1,A.length-2)));for(let i=1;i<A.length-1;i+=1){const n=A[i-1],o=A[i],g=A[i+1],a=n.distanceTo(o),r=o.distanceTo(g);if(a<1e-8||r<1e-8){t.push(o.clone());continue}const I=Math.min(this.roundedRadius,a*.5,r*.5),l=o.clone().lerp(n,I/a),h=o.clone().lerp(g,I/r);t.push(l);for(let B=1;B<=e;B+=1){const E=B/e,c=1-E;t.push(new Y().addScaledVector(l,c*c).addScaledVector(o,2*c*E).addScaledVector(h,E*E))}}return t.push(A[A.length-1].clone()),t}calculateLength(A){let t=0;for(let e=1;e<A.length;e+=1)t+=A[e-1].distanceTo(A[e]);return t}getPointRole(A){return A===0?"start":A===this.points.length-1?"end":"control"}getRoleLabel(A){const t=this.getPointRole(A);return t==="start"?"起点":t==="end"?"终点":`控制点 ${A}`}saveHistory(){this.history.push(this.createSnapshot()),this.history.length>this.options.historyLimit&&this.history.shift()}createSnapshot(){return{lineType:this.lineType,roundedRadius:this.roundedRadius,points:this.points.map(A=>({id:A.id,position:A.position.toArray()}))}}restoreSnapshot(A){this.clearPointRecords(),this.lineType=A.lineType,this.roundedRadius=A.roundedRadius,A.points.forEach(t=>{const e=this.createPointRecord(new Y(...t.position),t.id);this.points.push(e),this.pointsGroup.add(e.mesh)})}clearPointRecords(){this.clearSelection(),this.points.forEach(A=>{A.mesh.parent?.remove(A.mesh),A.mesh.geometry.dispose(),A.mesh.material.dispose()}),this.points.length=0}removePoint(A){const t=this.points.findIndex(i=>i.id===A);if(t<0)return;this.saveHistory();const[e]=this.points.splice(t,1);e.mesh.parent?.remove(e.mesh),e.mesh.geometry.dispose(),e.mesh.material.dispose(),this.selectedPointId===A&&this.clearSelection(),this.refreshAll(),this.emitChange()}updatePointCoordinate(A,t,e){const i=this.points.find(n=>n.id===A);!i||!Number.isFinite(e)||i.position[t]===e||(this.saveHistory(),i.position[t]=e,i.mesh.position[t]=e,this.refreshAll(),this.emitChange())}createPanel(){const A=document.createElement("div");A.dataset.pathDrawPanel="true",Object.assign(A.style,{position:"absolute",top:"56px",right:"16px",width:"310px",maxHeight:"calc(100% - 72px)",display:"flex",flexDirection:"column",background:"rgba(255, 255, 255, 0.98)",color:"#111827",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 12px 28px rgba(15,23,42,0.18)",fontFamily:"Arial, sans-serif",fontSize:"12px",zIndex:"1200",overflow:"hidden"});const t=document.createElement("div");Object.assign(t.style,{display:"flex",alignItems:"center",minHeight:"40px",padding:"0 8px 0 12px",borderBottom:"1px solid #e5e7eb"});const e=document.createElement("strong");e.textContent="路径绘制",e.style.flex="1";const i=document.createElement("span");Object.assign(i.style,{color:"#64748b",marginRight:"8px"});const n=this.createIconButton("×","关闭路径绘制",()=>this.close());t.append(e,i,n),A.appendChild(t),this.statusElement=i;const o=document.createElement("div");Object.assign(o.style,{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"4px",padding:"8px"}),["bezier","straight","rounded"].forEach(Q=>{const C=this.createIconButton(A8[Q],$v[Q],()=>this.setLineType(Q));C.dataset.lineType=Q,C.style.width="100%",C.style.fontSize="18px",o.appendChild(C)}),A.appendChild(o);const g=document.createElement("label");g.dataset.radiusRow="true",Object.assign(g.style,{display:"none",alignItems:"center",gap:"8px",padding:"0 10px 8px",color:"#475569"});const a=document.createElement("span");a.textContent="圆角";const r=document.createElement("input");r.type="number",r.min="0",r.step="0.1",Object.assign(r.style,{flex:"1",minWidth:"0",height:"26px",padding:"0 7px",color:"#111827",background:"#ffffff",border:"1px solid #cbd5e1",borderRadius:"4px"}),r.addEventListener("change",()=>{const Q=Number(r.value);if(!Number.isFinite(Q)||Q<0||Q===this.roundedRadius){r.value=String(this.roundedRadius);return}this.saveHistory(),this.roundedRadius=Q,this.refreshAll(),this.emitChange()}),g.append(a,r),A.appendChild(g),this.radiusInput=r;const I=document.createElement("div");Object.assign(I.style,{flex:"1",minHeight:"72px",maxHeight:"200px",overflowY:"auto",overflowX:"hidden",borderTop:"1px solid #e5e7eb"}),A.appendChild(I),this.pointsList=I;const l=document.createElement("div");Object.assign(l.style,{display:"grid",gridTemplateColumns:"1fr auto auto auto",gap:"6px",padding:"8px",borderTop:"1px solid #e5e7eb"});const h=this.createIconButton("+","添加点",()=>this.startAddPoint());h.style.width="100%";const B=this.createIconButton("↶","撤销 Ctrl+Z",()=>this.undo());B.dataset.undoButton="true";const E=this.createIconButton("⌫","清空路径",()=>this.clear());E.dataset.clearButton="true";const c=this.createIconButton("✓","完成并返回路径",()=>this.complete());c.dataset.primary="true",l.append(h,B,E,c),A.appendChild(l),this.addButton=h,this.completeButton=c,this.engine.container?.appendChild(A),this.panel=A}createIconButton(A,t,e){const i=document.createElement("button");return i.type="button",i.textContent=A,i.title=t,i.setAttribute("aria-label",t),Object.assign(i.style,{width:"32px",height:"30px",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0",border:"1px solid #d1d5db",borderRadius:"4px",background:"#f8fafc",color:"#334155",cursor:"pointer",fontSize:"15px"}),i.addEventListener("click",e),i}refreshPanel(){if(!this.panel||!this.pointsList)return;this.setStatus(this.mode==="picking"?"拾取中":`${this.points.length} 个点`),this.addButton&&(this.addButton.dataset.active=String(this.mode==="picking"),this.addButton.style.background=this.mode==="picking"?"#ffedd5":"#f8fafc",this.addButton.style.borderColor=this.mode==="picking"?"#f97316":"#d1d5db",this.addButton.style.color=this.mode==="picking"?"#9a3412":"#334155"),this.panel.querySelectorAll("[data-line-type]").forEach(i=>{const n=i.dataset.lineType===this.lineType;i.style.background=n?"#dcfce7":"#f8fafc",i.style.borderColor=n?"#22c55e":"#d1d5db",i.style.color=n?"#166534":"#334155"});const A=this.panel.querySelector("[data-radius-row]");A&&(A.style.display=this.lineType==="rounded"?"flex":"none"),this.radiusInput&&(this.radiusInput.value=String(this.roundedRadius));const t=this.panel.querySelector("[data-undo-button]"),e=this.panel.querySelector("[data-clear-button]");this.setButtonDisabled(t,this.history.length===0),this.setButtonDisabled(e,this.points.length===0),this.setButtonDisabled(this.completeButton,this.points.length<2),this.renderPointRows()}renderPointRows(){if(this.pointsList){if(this.pointsList.innerHTML="",this.points.length===0){const A=document.createElement("div");A.textContent="暂无点位",Object.assign(A.style,{padding:"24px 12px",textAlign:"center",color:"#94a3b8"}),this.pointsList.appendChild(A);return}this.points.forEach((A,t)=>{const e=document.createElement("div");Object.assign(e.style,{display:"grid",gridTemplateColumns:"64px repeat(3, minmax(0, 1fr)) 28px",gap:"4px",alignItems:"center",height:"40px",boxSizing:"border-box",padding:"5px 8px",cursor:"pointer",background:A.id===this.selectedPointId?"#fef3c7":"#ffffff",borderBottom:"1px solid #eef2f7"}),e.addEventListener("click",()=>this.selectPoint(A.id));const i=document.createElement("span");i.textContent=this.getRoleLabel(t),i.title=i.textContent,Object.assign(i.style,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#334155"}),e.appendChild(i),["x","y","z"].forEach(o=>{const g=document.createElement("input");g.type="number",g.step="0.001",g.value=A.position[o].toFixed(3),g.title=o.toUpperCase(),Object.assign(g.style,{width:"100%",minWidth:"0",height:"25px",padding:"0 4px",boxSizing:"border-box",color:"#1f2937",background:"#ffffff",border:"1px solid #cbd5e1",borderRadius:"3px",fontSize:"11px"}),g.addEventListener("click",a=>a.stopPropagation()),g.addEventListener("change",()=>this.updatePointCoordinate(A.id,o,Number(g.value))),e.appendChild(g)});const n=this.createIconButton("×",`删除${this.getRoleLabel(t)}`,()=>this.removePoint(A.id));n.style.width="28px",n.style.height="25px",n.addEventListener("click",o=>o.stopPropagation()),e.appendChild(n),this.pointsList?.appendChild(e)})}}setButtonDisabled(A,t){A&&(A.disabled=t,A.style.opacity=t?"0.4":"1",A.style.cursor=t?"not-allowed":"pointer",A.dataset.primary==="true"&&(A.style.background=t?"#f1f5f9":"#16a34a",A.style.color=t?"#94a3b8":"#ffffff",A.style.borderColor=t?"#d1d5db":"#15803d"))}setStatus(A){this.statusElement&&(this.statusElement.textContent=A)}handleKeyDown(A){if(!(!this.active||this.isTextInputTarget(A))){if((A.ctrlKey||A.metaKey)&&!A.shiftKey&&!A.altKey&&A.key.toLowerCase()==="z"){if(this.history.length===0)return;A.preventDefault(),A.stopImmediatePropagation(),this.undo();return}A.key==="Escape"&&this.handelKeyEscDown()}}isTextInputTarget(A){const t=A.target;return!!(t?.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(t?.tagName??""))}emitChange(){this.options.onChange?.(this.getPathData()),this.requestRender()}requestRender(){this.engine.requestComposerRender?.()}toPlainVector(A){return{x:A.x,y:A.y,z:A.z}}}class e8{engine;continusIds=new Map;constructor(A){this.engine=A}buildContinueIds(A){const e=this.engine?.engineStatus?.models?.find(n=>n.url===A)?.properties?.models;if(e==null||typeof e!="object"){this.continusIds.set(A,new Set);return}const i=new Set;Object.keys(e).forEach(n=>{const o=Number(n);Number.isFinite(o)&&this.shouldFilterId(A,n,e[n])&&i.add(o)}),this.continusIds.set(A,i)}setContinueIds(A,t){const e=new Set;t.forEach(i=>{const n=Number(i);Number.isFinite(n)&&e.add(n)}),this.continusIds.set(A,e)}getContinueIds(A){return Array.from(this.continusIds.get(A)??[])}getContinueIdSet(A){return this.continusIds.get(A)??new Set}hasContinueId(A,t){const e=Number(t);return Number.isFinite(e)?this.getContinueIdSet(A).has(e):!1}clear(A){if(typeof A=="string"){this.continusIds.delete(A);return}this.continusIds.clear()}shouldFilterId(A,t,e){const n=this.engine?.engineStatus?.models?.find(I=>I.url===A)?.properties,o=Array.isArray(e)?e:n?.models?.[t];if(n==null||!Array.isArray(o)||o.length===0)return!1;const g=n.categorys??{},a=n.names??{},r=n.values??{};return o.some(I=>{if(!Array.isArray(I)||I.length<3)return!1;const l=String(g[I[0]]??""),h=String(a[I[1]]??""),B=String(r[I[2]]??"");return l.includes("图层信息")&&h.includes("父类别")&&(B.includes("注释")||B.includes("视口范围")||B.includes("剖面"))})}}const ZB={version:"3.12.13"}.version;function Ty(){const s=globalThis.crypto?.subtle;if(!s)throw new Error("[BimEngine] Web Crypto API is required for secure sdkAuth credentials mode");return s}function XB(s){return new TextEncoder().encode(s)}function JB(s){return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}function lW(s){let A="";return s.forEach(t=>{A+=String.fromCharCode(t)}),btoa(A)}function i8(s){const A=s.getUTCFullYear(),t=String(s.getUTCMonth()+1).padStart(2,"0"),e=String(s.getUTCDate()).padStart(2,"0");return`${A}${t}${e}`}async function s8(s){const A=await Ty().digest("SHA-256",JB(XB(s)));return Array.from(new Uint8Array(A)).map(t=>t.toString(16).padStart(2,"0")).join("")}async function n8(s,A){const t=Ty(),e=await t.importKey("raw",JB(s),{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return t.sign("HMAC",e,JB(XB(A)))}function o8(s){return XB([s.appId,s.engineType,s.requestDate,String(s.timestamp),s.nonce].join("|"))}async function g8(s){const A=Ty(),t=new Date,e=t.getTime(),i=i8(t),n=globalThis.crypto.randomUUID(),o=globalThis.crypto.getRandomValues(new Uint8Array(12)),g=await s8(s.appSecret),a=await n8(XB(g),i),r=await A.importKey("raw",a,"AES-GCM",!1,["encrypt"]),I=JSON.stringify({appKey:s.appKey,appSecret:s.appSecret}),l=await A.encrypt({name:"AES-GCM",iv:o,additionalData:JB(o8({appId:s.appId,engineType:s.engineType,requestDate:i,timestamp:e,nonce:n})),tagLength:128},r,JB(XB(I)));return{appId:s.appId,engineType:s.engineType,requestDate:i,timestamp:e,nonce:n,iv:lW(o),cipherText:lW(new Uint8Array(l)),sdkVersion:s.sdkVersion,origin:s.origin,product:s.product}}const Ky=new Map;function BQ(s){return s.replace(/\/+$/,"")}function hQ(s){if(s)return s;if(typeof window<"u"&&typeof window.location?.origin=="string")return window.location.origin}function a8(s,A){return JSON.stringify({endpoint:BQ(s.endpoint),token:s.token??"",appId:s.appId??"",appKey:s.appKey??"",appSecret:s.appSecret??"",origin:hQ(s.origin)??"",product:s.product??"",engineType:A,sdkVersion:ZB})}async function jy(s,A,t){const e=typeof AbortController<"u"?new AbortController:void 0,i=e?setTimeout(()=>e.abort(),t):void 0;try{const n=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A),signal:e?.signal}),o=await n.json().catch(()=>({}));if(!n.ok){const g=o?.error?.message??o?.message??`SDK authentication failed with status ${n.status}`;throw new Error(g)}return o}finally{i!=null&&clearTimeout(i)}}async function r8(s,A){const t=await jy(`${BQ(s.endpoint)}/oauth/sdk-verify`,{sdkToken:s.token,engineType:A,sdkVersion:ZB,origin:hQ(s.origin),product:s.product},s.timeoutMs??8e3);return t.sdkToken=s.token,t}async function I8(s,A){const t=await g8({appId:s.appId,appKey:s.appKey,appSecret:s.appSecret,engineType:A,sdkVersion:ZB,origin:hQ(s.origin),product:s.product}),e=await jy(`${BQ(s.endpoint)}/oauth/sdk-token/secure`,t,s.timeoutMs??8e3),i=await jy(`${BQ(s.endpoint)}/oauth/sdk-verify`,{sdkToken:e.sdkToken,engineType:A,sdkVersion:ZB,origin:hQ(s.origin),product:s.product},s.timeoutMs??8e3);return i.sdkToken=e.sdkToken,i}async function l8(s,A){const t=s?.sdkAuth;if(!t)return null;if(!t.endpoint)throw new Error("[BimEngine] sdkAuth.endpoint is required");if(!t.token&&!(t.appId&&t.appKey&&t.appSecret))return null;const e=a8(t,A),i=Ky.get(e);if(i){const o=await i;return s&&(s.__sdkAuthSession=o),o}const n=(t.token?r8(t,A):I8(t,A)).then(o=>{if(o.authorized!==!0)throw new Error("[BimEngine] SDK authorization rejected");return s&&(s.__sdkAuthSession=o),o}).catch(o=>{throw Ky.delete(e),o});return Ky.set(e,n),n}var Ry,BW;function St(){return BW||(BW=1,Ry={options:{usePureJavaScript:!1}}),Ry}var Zy={exports:{}},Xy,hW;function B8(){if(hW)return Xy;hW=1;var s={};Xy=s;var A={};s.encode=function(e,i,n){if(typeof i!="string")throw new TypeError('"alphabet" must be a string.');if(n!==void 0&&typeof n!="number")throw new TypeError('"maxline" must be a number.');var o="";if(!(e instanceof Uint8Array))o=t(e,i);else{var g=0,a=i.length,r=i.charAt(0),I=[0];for(g=0;g<e.length;++g){for(var l=0,h=e[g];l<I.length;++l)h+=I[l]<<8,I[l]=h%a,h=h/a|0;for(;h>0;)I.push(h%a),h=h/a|0}for(g=0;e[g]===0&&g<e.length-1;++g)o+=r;for(g=I.length-1;g>=0;--g)o+=i[I[g]]}if(n){var B=new RegExp(".{1,"+n+"}","g");o=o.match(B).join(`\r
|
|
6466
|
+
`};class Fy extends vt{constructor(A){super({type:"LineMaterial",uniforms:ti.clone(Ki.line.uniforms),vertexShader:Ki.line.vertexShader,fragmentShader:Ki.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(A)}get color(){return this.uniforms.diffuse.value}set color(A){this.uniforms.diffuse.value=A}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(A){A===!0!==this.worldUnits&&(this.needsUpdate=!0),A===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(A){this.uniforms.linewidth&&(this.uniforms.linewidth.value=A)}get dashed(){return"USE_DASH"in this.defines}set dashed(A){A===!0!==this.dashed&&(this.needsUpdate=!0),A===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(A){this.uniforms.dashScale.value=A}get dashSize(){return this.uniforms.dashSize.value}set dashSize(A){this.uniforms.dashSize.value=A}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(A){this.uniforms.dashOffset.value=A}get gapSize(){return this.uniforms.gapSize.value}set gapSize(A){this.uniforms.gapSize.value=A}get opacity(){return this.uniforms.opacity.value}set opacity(A){this.uniforms&&(this.uniforms.opacity.value=A)}get resolution(){return this.uniforms.resolution.value}set resolution(A){this.uniforms.resolution.value.copy(A)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(A){this.defines&&(A===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),A===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const by=new Ct,oW=new Y,gW=new Y,hi=new Ct,Ci=new Ct,yn=new Ct,Wy=new Y,Gy=new RA,Ei=new _i,aW=new Y,rQ=new qA,IQ=new Fe,Dn=new Ct;let pn,da;function rW(s,A,t){return Dn.set(0,0,-A,1).applyMatrix4(s.projectionMatrix),Dn.multiplyScalar(1/Dn.w),Dn.x=da/t.width,Dn.y=da/t.height,Dn.applyMatrix4(s.projectionMatrixInverse),Dn.multiplyScalar(1/Dn.w),Math.abs(Math.max(Dn.x,Dn.y))}function zv(s,A){const t=s.matrixWorld,e=s.geometry,i=e.attributes.instanceStart,n=e.attributes.instanceEnd,o=Math.min(e.instanceCount,i.count);for(let g=0,a=o;g<a;g++){Ei.start.fromBufferAttribute(i,g),Ei.end.fromBufferAttribute(n,g),Ei.applyMatrix4(t);const r=new Y,I=new Y;pn.distanceSqToSegment(Ei.start,Ei.end,I,r),I.distanceTo(r)<da*.5&&A.push({point:I,pointOnLine:r,distance:pn.origin.distanceTo(I),object:s,face:null,faceIndex:g,uv:null,uv1:null})}}function vv(s,A,t){const e=A.projectionMatrix,n=s.material.resolution,o=s.matrixWorld,g=s.geometry,a=g.attributes.instanceStart,r=g.attributes.instanceEnd,I=Math.min(g.instanceCount,a.count),l=-A.near;pn.at(1,yn),yn.w=1,yn.applyMatrix4(A.matrixWorldInverse),yn.applyMatrix4(e),yn.multiplyScalar(1/yn.w),yn.x*=n.x/2,yn.y*=n.y/2,yn.z=0,Wy.copy(yn),Gy.multiplyMatrices(A.matrixWorldInverse,o);for(let h=0,B=I;h<B;h++){if(hi.fromBufferAttribute(a,h),Ci.fromBufferAttribute(r,h),hi.w=1,Ci.w=1,hi.applyMatrix4(Gy),Ci.applyMatrix4(Gy),hi.z>l&&Ci.z>l)continue;if(hi.z>l){const M=hi.z-Ci.z,y=(hi.z-l)/M;hi.lerp(Ci,y)}else if(Ci.z>l){const M=Ci.z-hi.z,y=(Ci.z-l)/M;Ci.lerp(hi,y)}hi.applyMatrix4(e),Ci.applyMatrix4(e),hi.multiplyScalar(1/hi.w),Ci.multiplyScalar(1/Ci.w),hi.x*=n.x/2,hi.y*=n.y/2,Ci.x*=n.x/2,Ci.y*=n.y/2,Ei.start.copy(hi),Ei.start.z=0,Ei.end.copy(Ci),Ei.end.z=0;const c=Ei.closestPointToPointParameter(Wy,!0);Ei.at(c,aW);const Q=rt.lerp(hi.z,Ci.z,c),C=Q>=-1&&Q<=1,d=Wy.distanceTo(aW)<da*.5;if(C&&d){Ei.start.fromBufferAttribute(a,h),Ei.end.fromBufferAttribute(r,h),Ei.start.applyMatrix4(o),Ei.end.applyMatrix4(o);const M=new Y,y=new Y;pn.distanceSqToSegment(Ei.start,Ei.end,y,M),t.push({point:y,pointOnLine:M,distance:pn.origin.distanceTo(y),object:s,face:null,faceIndex:h,uv:null,uv1:null})}}}class _v extends bA{constructor(A=new nW,t=new Fy({color:Math.random()*16777215})){super(A,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const A=this.geometry,t=A.attributes.instanceStart,e=A.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let o=0,g=0,a=t.count;o<a;o++,g+=2)oW.fromBufferAttribute(t,o),gW.fromBufferAttribute(e,o),i[g]=g===0?0:i[g-1],i[g+1]=i[g]+oW.distanceTo(gW);const n=new ZC(i,2,1);return A.setAttribute("instanceDistanceStart",new Gi(n,1,0)),A.setAttribute("instanceDistanceEnd",new Gi(n,1,1)),this}raycast(A,t){const e=this.material.worldUnits,i=A.camera;if(i===null&&!e&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),e===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;const n=A.params.Line2!==void 0&&A.params.Line2.threshold||0;pn=A.ray;const o=this.matrixWorld,g=this.geometry,a=this.material;da=a.linewidth+n,g.boundingSphere===null&&g.computeBoundingSphere(),IQ.copy(g.boundingSphere).applyMatrix4(o);let r;if(e)r=da*.5;else{const l=Math.max(i.near,IQ.distanceToPoint(pn.origin));r=rW(i,l,a.resolution)}if(IQ.radius+=r,pn.intersectsSphere(IQ)===!1)return;g.boundingBox===null&&g.computeBoundingBox(),rQ.copy(g.boundingBox).applyMatrix4(o);let I;if(e)I=da*.5;else{const l=Math.max(i.near,rQ.distanceToPoint(pn.origin));I=rW(i,l,a.resolution)}rQ.expandByScalar(I),pn.intersectsBox(rQ)!==!1&&(e?zv(this,t):vv(this,i,t))}onBeforeRender(A){const t=this.material.uniforms;t&&t.resolution&&(A.getViewport(by),this.material.uniforms.resolution.value.set(by.z,by.w))}}class IW extends nW{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(A){const t=A.length-3,e=new Float32Array(2*t);for(let i=0;i<t;i+=3)e[2*i]=A[i],e[2*i+1]=A[i+1],e[2*i+2]=A[i+2],e[2*i+3]=A[i+3],e[2*i+4]=A[i+4],e[2*i+5]=A[i+5];return super.setPositions(e),this}setColors(A){const t=A.length-3,e=new Float32Array(2*t);for(let i=0;i<t;i+=3)e[2*i]=A[i],e[2*i+1]=A[i+1],e[2*i+2]=A[i+2],e[2*i+3]=A[i+3],e[2*i+4]=A[i+4],e[2*i+5]=A[i+5];return super.setColors(e),this}setFromPoints(A){const t=A.length-1,e=new Float32Array(6*t);for(let i=0;i<t;i++)e[6*i]=A[i].x,e[6*i+1]=A[i].y,e[6*i+2]=A[i].z||0,e[6*i+3]=A[i+1].x,e[6*i+4]=A[i+1].y,e[6*i+5]=A[i+1].z||0;return super.setPositions(e),this}fromLine(A){const t=A.geometry;return this.setPositions(t.attributes.position.array),this}}class qv extends _v{constructor(A=new IW,t=new Fy({color:Math.random()*16777215})){super(A,t),this.isLine2=!0,this.type="Line2"}}const lQ={lineType:"bezier",lineColor:"#22c55e",previewColor:"#f59e0b",pointColor:"#ffffff",selectedPointColor:"#f59e0b",pointSize:.34,lineWidth:4,sampleCount:64,roundedRadius:1,historyLimit:100},$v={bezier:"贝塞尔曲线",straight:"直线",rounded:"圆角直线"},A8={bezier:"∿",straight:"╱",rounded:"⌁"};class t8{type="path-draw";engine;root=new Ot;pointsGroup=new Ot;points=[];history=[];options={...lQ};lineType=lQ.lineType;roundedRadius=lQ.roundedRadius;line=null;previewLine=null;previewMarker=null;transformControl=null;transformHelper=null;selectedPointId=null;panel=null;pointsList=null;statusElement=null;addButton=null;completeButton=null;radiusInput=null;mode="editing";active=!1;closing=!1;transformDragging=!1;suppressNextCanvasClick=!1;controlsEnabledBeforeDrag=!0;pointSequence=0;pathId="";onKeyDown;constructor(A){this.engine=A,this.root.name="PathDrawRoot",this.pointsGroup.name="PathDrawPoints",this.root.add(this.pointsGroup),this.onKeyDown=this.handleKeyDown.bind(this)}open(A={}){this.active&&this.close(),this.options={...lQ,...A},this.pathId=A.id??`path-${Date.now()}`,this.lineType=this.options.lineType,this.roundedRadius=Math.max(0,this.options.roundedRadius),this.active=!0,this.mode="editing",this.engine.scene?.add(this.root),this.ensureTransformControl(),this.createPanel(),this.activateBehavior(),window.addEventListener("keydown",this.onKeyDown,!0),this.refreshAll()}startAddPoint(){return!this.active||this.transformDragging?!1:(this.mode="picking",this.clearSelection(),this.setStatus("请在模型上拾取位置"),this.addButton&&(this.addButton.dataset.active="true"),!0)}setLineType(A){!this.active||this.lineType===A||(this.saveHistory(),this.lineType=A,this.refreshAll(),this.emitChange())}undo(){const A=this.history.pop();return A?(this.restoreSnapshot(A),this.mode="editing",this.clearPreview(),this.refreshAll(),this.emitChange(),!0):!1}clear(){this.points.length!==0&&(this.saveHistory(),this.clearPointRecords(),this.mode="editing",this.clearPreview(),this.refreshAll(),this.emitChange())}getPathData(){if(this.points.length<2)return null;const A=this.buildSamplePoints(this.points.map(t=>t.position));return{version:1,id:this.pathId,lineType:this.lineType,coordinateSystem:"world",closed:!1,roundedRadius:this.roundedRadius,points:this.points.map((t,e)=>({id:t.id,order:e,role:this.getPointRole(e),position:this.toPlainVector(t.position)})),samples:A.map(t=>this.toPlainVector(t)),length:this.calculateLength(A)}}complete(){const A=this.getPathData();if(!A)return null;try{this.options.onComplete?.(A)}finally{this.close()}return A}isActive(){return this.active}close(){this.closeInternal(!0)}closeInternal(A){!this.active&&!this.panel||this.closing||(this.closing=!0,this.active=!1,window.removeEventListener("keydown",this.onKeyDown,!0),this.clearPreview(),this.clearPointRecords(),this.disposeLine("line"),this.detachTransformControl(),this.panel?.remove(),this.panel=null,this.pointsList=null,this.statusElement=null,this.addButton=null,this.completeButton=null,this.radiusInput=null,this.history.length=0,this.selectedPointId=null,this.root.parent?.remove(this.root),A&&this.restoreDefaultBehavior(),this.closing=!1)}dispose(){this.closeInternal(!1),this.transformControl?.dispose(),this.transformControl=null,this.transformHelper=null}update(){!this.active||!this.engine.camera||(this.transformControl&&this.transformControl.camera!==this.engine.camera&&(this.transformControl.camera=this.engine.camera),this.syncLineResolution(this.line),this.syncLineResolution(this.previewLine))}disActive(){this.closing||this.closeInternal(!1)}handleMouseMove(A){if(!this.active||this.mode!=="picking")return;const t=this.getCatchPoint(A?.catch);if(!t){this.clearPreview();return}this.updatePreview(t)}handleMouseClick(A){if(!this.active)return;if(this.suppressNextCanvasClick){this.suppressNextCanvasClick=!1;return}if(this.mode==="picking"){const e=this.getCatchPoint(A?.catch);if(!e)return;this.saveHistory();const i=this.createPointRecord(e);this.points.push(i),this.pointsGroup.add(i.mesh),this.mode="editing",this.clearPreview(),this.selectPoint(i.id),this.refreshAll(),this.emitChange();return}const t=this.pickPointMesh(A);t?this.selectPoint(t.userData.pathDrawPointId):this.clearSelection()}handelKeyEscDown(){if(this.mode==="picking"){this.mode="editing",this.clearPreview(),this.refreshPanel();return}this.clearSelection()}activateBehavior(){const A=this.engine.handelBehaved;A?.init?.(this,{showCatch:!0}),A?.active?.()}restoreDefaultBehavior(){const A=this.engine.handelBehaved;A?.self===this&&(A.disActive?.(),this.engine.interactionModule?.init?.(),this.engine.interactionModule?.active?.(),this.engine.catchSvg&&(this.engine.catchSvg.innerHTML=""))}ensureTransformControl(){if(this.transformControl){this.transformHelper&&!this.transformHelper.parent&&this.engine.scene?.add(this.transformHelper);return}!this.engine.camera||!this.engine.renderer||!this.engine.scene||(this.transformControl=new vl(this.engine.camera,this.engine.renderer.domElement),this.transformControl.setMode("translate"),this.transformControl.size=.72,this.transformControl.addEventListener("dragging-changed",A=>{if(this.transformDragging=!!A.value,this.transformDragging){this.saveHistory(),this.controlsEnabledBeforeDrag=this.engine.controls?.enabled!==!1,this.engine.controls&&(this.engine.controls.enabled=!1);return}this.engine.controls&&(this.engine.controls.enabled=this.controlsEnabledBeforeDrag),this.suppressNextCanvasClick=!0,requestAnimationFrame(()=>{this.suppressNextCanvasClick=!1}),this.refreshAll(),this.emitChange()}),this.transformControl.addEventListener("objectChange",()=>{const A=this.getSelectedPoint();A&&(A.position.copy(A.mesh.position),this.refreshLine(),this.refreshPanel(),this.emitChange())}),this.transformHelper=this.transformControl.getHelper(),this.transformHelper.visible=!1,this.engine.scene.add(this.transformHelper))}detachTransformControl(){this.transformControl?.detach(),this.transformHelper&&(this.transformHelper.visible=!1,this.transformHelper.parent?.remove(this.transformHelper))}createPointRecord(A,t){const e=new sn(this.options.pointSize,18,12),i=new Tt({color:this.options.pointColor,depthTest:!1,depthWrite:!1}),n=new bA(e,i),o=t??`path-point-${++this.pointSequence}`;return n.name=o,n.position.copy(A),n.renderOrder=1002,n.userData.pathDrawPointId=o,{id:o,position:A.clone(),mesh:n}}selectPoint(A){const t=this.points.find(e=>e.id===A);!t||!this.transformControl||!this.transformHelper||(this.selectedPointId=A,this.points.forEach(e=>e.mesh.material.color.set(e.id===A?this.options.selectedPointColor:this.options.pointColor)),this.transformControl.attach(t.mesh),this.transformHelper.visible=!0,this.refreshPanel())}clearSelection(){this.selectedPointId=null,this.points.forEach(A=>A.mesh.material.color.set(this.options.pointColor)),this.transformControl?.detach(),this.transformHelper&&(this.transformHelper.visible=!1),this.refreshPanel()}getSelectedPoint(){return this.points.find(A=>A.id===this.selectedPointId)??null}getCatchPoint(A){return A?.point instanceof Y?A.point.clone():null}pickPointMesh(A){if(!this.engine.camera||!this.engine.renderer)return null;const t=this.engine.renderer.domElement.clientWidth,e=this.engine.renderer.domElement.clientHeight;if(!t||!e)return null;const i=new dA(A.offsetX/t*2-1,-(A.offsetY/e)*2+1),n=new be;return n.setFromCamera(i,this.engine.camera),n.intersectObjects(this.pointsGroup.children,!1)[0]?.object??null}updatePreview(A){this.previewMarker||(this.previewMarker=new bA(new sn(this.options.pointSize*.72,14,10),new Tt({color:this.options.previewColor,depthTest:!1,depthWrite:!1})),this.previewMarker.renderOrder=1003,this.root.add(this.previewMarker)),this.previewMarker.position.copy(A),this.previewMarker.visible=!0;const t=[...this.points.map(i=>i.position),A];if(t.length<2){this.disposeLine("previewLine");return}const e=this.buildSamplePoints(t);this.previewLine=this.updateLineObject(this.previewLine,e,!0)}clearPreview(){this.disposeLine("previewLine"),this.previewMarker&&(this.previewMarker.geometry.dispose(),this.previewMarker.material.dispose(),this.previewMarker.parent?.remove(this.previewMarker),this.previewMarker=null)}refreshAll(){this.refreshLine(),this.refreshPanel(),this.requestRender()}refreshLine(){if(this.points.length<2){this.disposeLine("line");return}const A=this.buildSamplePoints(this.points.map(t=>t.position));this.line=this.updateLineObject(this.line,A,!1)}updateLineObject(A,t,e){const i=new IW;if(i.setPositions(t.flatMap(g=>[g.x,g.y,g.z])),A)return A.geometry.dispose(),A.geometry=i,A.computeLineDistances(),this.syncLineResolution(A),this.requestRender(),A;const n=new Fy({color:e?this.options.previewColor:this.options.lineColor,linewidth:this.options.lineWidth,dashed:e,dashSize:.32,gapSize:.2,depthTest:!1,transparent:e,opacity:e?.82:1}),o=new qv(i,n);return o.name=e?"PathDrawPreviewLine":"PathDrawLine",o.renderOrder=e?1001:1e3,o.computeLineDistances(),this.syncLineResolution(o),this.root.add(o),this.requestRender(),o}syncLineResolution(A){const t=A?.material,e=this.engine.renderer?.domElement;!t||!e||t.resolution.set(e.clientWidth,e.clientHeight)}disposeLine(A){const t=this[A];if(!t)return;t.parent?.remove(t),t.geometry.dispose(),(Array.isArray(t.material)?t.material:[t.material]).forEach(i=>i.dispose()),this[A]=null}buildSamplePoints(A){return A.length<2?A.map(t=>t.clone()):this.lineType==="straight"?A.map(t=>t.clone()):this.lineType==="rounded"?this.sampleRoundedPolyline(A):this.sampleBezier(A)}sampleBezier(A){const t=Math.max(2,this.options.sampleCount);return Array.from({length:t+1},(e,i)=>{const n=A.map(g=>g.clone()),o=i/t;for(let g=n.length-1;g>0;g-=1)for(let a=0;a<g;a+=1)n[a].lerp(n[a+1],o);return n[0]})}sampleRoundedPolyline(A){if(A.length<3||this.roundedRadius<=0)return A.map(i=>i.clone());const t=[A[0].clone()],e=Math.max(4,Math.round(this.options.sampleCount/Math.max(1,A.length-2)));for(let i=1;i<A.length-1;i+=1){const n=A[i-1],o=A[i],g=A[i+1],a=n.distanceTo(o),r=o.distanceTo(g);if(a<1e-8||r<1e-8){t.push(o.clone());continue}const I=Math.min(this.roundedRadius,a*.5,r*.5),l=o.clone().lerp(n,I/a),h=o.clone().lerp(g,I/r);t.push(l);for(let B=1;B<=e;B+=1){const E=B/e,c=1-E;t.push(new Y().addScaledVector(l,c*c).addScaledVector(o,2*c*E).addScaledVector(h,E*E))}}return t.push(A[A.length-1].clone()),t}calculateLength(A){let t=0;for(let e=1;e<A.length;e+=1)t+=A[e-1].distanceTo(A[e]);return t}getPointRole(A){return A===0?"start":A===this.points.length-1?"end":"control"}getRoleLabel(A){const t=this.getPointRole(A);return t==="start"?"起点":t==="end"?"终点":`控制点 ${A}`}saveHistory(){this.history.push(this.createSnapshot()),this.history.length>this.options.historyLimit&&this.history.shift()}createSnapshot(){return{lineType:this.lineType,roundedRadius:this.roundedRadius,points:this.points.map(A=>({id:A.id,position:A.position.toArray()}))}}restoreSnapshot(A){this.clearPointRecords(),this.lineType=A.lineType,this.roundedRadius=A.roundedRadius,A.points.forEach(t=>{const e=this.createPointRecord(new Y(...t.position),t.id);this.points.push(e),this.pointsGroup.add(e.mesh)})}clearPointRecords(){this.clearSelection(),this.points.forEach(A=>{A.mesh.parent?.remove(A.mesh),A.mesh.geometry.dispose(),A.mesh.material.dispose()}),this.points.length=0}removePoint(A){const t=this.points.findIndex(i=>i.id===A);if(t<0)return;this.saveHistory();const[e]=this.points.splice(t,1);e.mesh.parent?.remove(e.mesh),e.mesh.geometry.dispose(),e.mesh.material.dispose(),this.selectedPointId===A&&this.clearSelection(),this.refreshAll(),this.emitChange()}updatePointCoordinate(A,t,e){const i=this.points.find(n=>n.id===A);!i||!Number.isFinite(e)||i.position[t]===e||(this.saveHistory(),i.position[t]=e,i.mesh.position[t]=e,this.refreshAll(),this.emitChange())}createPanel(){const A=document.createElement("div");A.dataset.pathDrawPanel="true",Object.assign(A.style,{position:"absolute",top:"56px",right:"16px",width:"310px",maxHeight:"calc(100% - 72px)",display:"flex",flexDirection:"column",background:"rgba(255, 255, 255, 0.98)",color:"#111827",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 12px 28px rgba(15,23,42,0.18)",fontFamily:"Arial, sans-serif",fontSize:"12px",zIndex:"1200",overflow:"hidden"});const t=document.createElement("div");Object.assign(t.style,{display:"flex",alignItems:"center",minHeight:"40px",padding:"0 8px 0 12px",borderBottom:"1px solid #e5e7eb"});const e=document.createElement("strong");e.textContent="路径绘制",e.style.flex="1";const i=document.createElement("span");Object.assign(i.style,{color:"#64748b",marginRight:"8px"});const n=this.createIconButton("×","关闭路径绘制",()=>this.close());t.append(e,i,n),A.appendChild(t),this.statusElement=i;const o=document.createElement("div");Object.assign(o.style,{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"4px",padding:"8px"}),["bezier","straight","rounded"].forEach(Q=>{const C=this.createIconButton(A8[Q],$v[Q],()=>this.setLineType(Q));C.dataset.lineType=Q,C.style.width="100%",C.style.fontSize="18px",o.appendChild(C)}),A.appendChild(o);const g=document.createElement("label");g.dataset.radiusRow="true",Object.assign(g.style,{display:"none",alignItems:"center",gap:"8px",padding:"0 10px 8px",color:"#475569"});const a=document.createElement("span");a.textContent="圆角";const r=document.createElement("input");r.type="number",r.min="0",r.step="0.1",Object.assign(r.style,{flex:"1",minWidth:"0",height:"26px",padding:"0 7px",color:"#111827",background:"#ffffff",border:"1px solid #cbd5e1",borderRadius:"4px"}),r.addEventListener("change",()=>{const Q=Number(r.value);if(!Number.isFinite(Q)||Q<0||Q===this.roundedRadius){r.value=String(this.roundedRadius);return}this.saveHistory(),this.roundedRadius=Q,this.refreshAll(),this.emitChange()}),g.append(a,r),A.appendChild(g),this.radiusInput=r;const I=document.createElement("div");Object.assign(I.style,{flex:"1",minHeight:"72px",maxHeight:"200px",overflowY:"auto",overflowX:"hidden",borderTop:"1px solid #e5e7eb"}),A.appendChild(I),this.pointsList=I;const l=document.createElement("div");Object.assign(l.style,{display:"grid",gridTemplateColumns:"1fr auto auto auto",gap:"6px",padding:"8px",borderTop:"1px solid #e5e7eb"});const h=this.createIconButton("+","添加点",()=>this.startAddPoint());h.style.width="100%";const B=this.createIconButton("↶","撤销 Ctrl+Z",()=>this.undo());B.dataset.undoButton="true";const E=this.createIconButton("⌫","清空路径",()=>this.clear());E.dataset.clearButton="true";const c=this.createIconButton("✓","完成并返回路径",()=>this.complete());c.dataset.primary="true",l.append(h,B,E,c),A.appendChild(l),this.addButton=h,this.completeButton=c,this.engine.container?.appendChild(A),this.panel=A}createIconButton(A,t,e){const i=document.createElement("button");return i.type="button",i.textContent=A,i.title=t,i.setAttribute("aria-label",t),Object.assign(i.style,{width:"32px",height:"30px",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0",border:"1px solid #d1d5db",borderRadius:"4px",background:"#f8fafc",color:"#334155",cursor:"pointer",fontSize:"15px"}),i.addEventListener("click",e),i}refreshPanel(){if(!this.panel||!this.pointsList)return;this.setStatus(this.mode==="picking"?"拾取中":`${this.points.length} 个点`),this.addButton&&(this.addButton.dataset.active=String(this.mode==="picking"),this.addButton.style.background=this.mode==="picking"?"#ffedd5":"#f8fafc",this.addButton.style.borderColor=this.mode==="picking"?"#f97316":"#d1d5db",this.addButton.style.color=this.mode==="picking"?"#9a3412":"#334155"),this.panel.querySelectorAll("[data-line-type]").forEach(i=>{const n=i.dataset.lineType===this.lineType;i.style.background=n?"#dcfce7":"#f8fafc",i.style.borderColor=n?"#22c55e":"#d1d5db",i.style.color=n?"#166534":"#334155"});const A=this.panel.querySelector("[data-radius-row]");A&&(A.style.display=this.lineType==="rounded"?"flex":"none"),this.radiusInput&&(this.radiusInput.value=String(this.roundedRadius));const t=this.panel.querySelector("[data-undo-button]"),e=this.panel.querySelector("[data-clear-button]");this.setButtonDisabled(t,this.history.length===0),this.setButtonDisabled(e,this.points.length===0),this.setButtonDisabled(this.completeButton,this.points.length<2),this.renderPointRows()}renderPointRows(){if(this.pointsList){if(this.pointsList.innerHTML="",this.points.length===0){const A=document.createElement("div");A.textContent="暂无点位",Object.assign(A.style,{padding:"24px 12px",textAlign:"center",color:"#94a3b8"}),this.pointsList.appendChild(A);return}this.points.forEach((A,t)=>{const e=document.createElement("div");Object.assign(e.style,{display:"grid",gridTemplateColumns:"64px repeat(3, minmax(0, 1fr)) 28px",gap:"4px",alignItems:"center",height:"40px",boxSizing:"border-box",padding:"5px 8px",cursor:"pointer",background:A.id===this.selectedPointId?"#fef3c7":"#ffffff",borderBottom:"1px solid #eef2f7"}),e.addEventListener("click",()=>this.selectPoint(A.id));const i=document.createElement("span");i.textContent=this.getRoleLabel(t),i.title=i.textContent,Object.assign(i.style,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#334155"}),e.appendChild(i),["x","y","z"].forEach(o=>{const g=document.createElement("input");g.type="number",g.step="0.001",g.value=A.position[o].toFixed(3),g.title=o.toUpperCase(),Object.assign(g.style,{width:"100%",minWidth:"0",height:"25px",padding:"0 4px",boxSizing:"border-box",color:"#1f2937",background:"#ffffff",border:"1px solid #cbd5e1",borderRadius:"3px",fontSize:"11px"}),g.addEventListener("click",a=>a.stopPropagation()),g.addEventListener("change",()=>this.updatePointCoordinate(A.id,o,Number(g.value))),e.appendChild(g)});const n=this.createIconButton("×",`删除${this.getRoleLabel(t)}`,()=>this.removePoint(A.id));n.style.width="28px",n.style.height="25px",n.addEventListener("click",o=>o.stopPropagation()),e.appendChild(n),this.pointsList?.appendChild(e)})}}setButtonDisabled(A,t){A&&(A.disabled=t,A.style.opacity=t?"0.4":"1",A.style.cursor=t?"not-allowed":"pointer",A.dataset.primary==="true"&&(A.style.background=t?"#f1f5f9":"#16a34a",A.style.color=t?"#94a3b8":"#ffffff",A.style.borderColor=t?"#d1d5db":"#15803d"))}setStatus(A){this.statusElement&&(this.statusElement.textContent=A)}handleKeyDown(A){if(!(!this.active||this.isTextInputTarget(A))){if((A.ctrlKey||A.metaKey)&&!A.shiftKey&&!A.altKey&&A.key.toLowerCase()==="z"){if(this.history.length===0)return;A.preventDefault(),A.stopImmediatePropagation(),this.undo();return}A.key==="Escape"&&this.handelKeyEscDown()}}isTextInputTarget(A){const t=A.target;return!!(t?.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(t?.tagName??""))}emitChange(){this.options.onChange?.(this.getPathData()),this.requestRender()}requestRender(){this.engine.requestComposerRender?.()}toPlainVector(A){return{x:A.x,y:A.y,z:A.z}}}class e8{engine;continusIds=new Map;constructor(A){this.engine=A}buildContinueIds(A){const e=this.engine?.engineStatus?.models?.find(n=>n.url===A)?.properties?.models;if(e==null||typeof e!="object"){this.continusIds.set(A,new Set);return}const i=new Set;Object.keys(e).forEach(n=>{const o=Number(n);Number.isFinite(o)&&this.shouldFilterId(A,n,e[n])&&i.add(o)}),this.continusIds.set(A,i)}setContinueIds(A,t){const e=new Set;t.forEach(i=>{const n=Number(i);Number.isFinite(n)&&e.add(n)}),this.continusIds.set(A,e)}getContinueIds(A){return Array.from(this.continusIds.get(A)??[])}getContinueIdSet(A){return this.continusIds.get(A)??new Set}hasContinueId(A,t){const e=Number(t);return Number.isFinite(e)?this.getContinueIdSet(A).has(e):!1}clear(A){if(typeof A=="string"){this.continusIds.delete(A);return}this.continusIds.clear()}shouldFilterId(A,t,e){const n=this.engine?.engineStatus?.models?.find(I=>I.url===A)?.properties,o=Array.isArray(e)?e:n?.models?.[t];if(n==null||!Array.isArray(o)||o.length===0)return!1;const g=n.categorys??{},a=n.names??{},r=n.values??{};return o.some(I=>{if(!Array.isArray(I)||I.length<3)return!1;const l=String(g[I[0]]??""),h=String(a[I[1]]??""),B=String(r[I[2]]??"");return l.includes("图层信息")&&h.includes("父类别")&&(B.includes("注释")||B.includes("视口范围")||B.includes("剖面"))})}}const ZB={version:"3.12.14"}.version;function Ty(){const s=globalThis.crypto?.subtle;if(!s)throw new Error("[BimEngine] Web Crypto API is required for secure sdkAuth credentials mode");return s}function XB(s){return new TextEncoder().encode(s)}function JB(s){return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}function lW(s){let A="";return s.forEach(t=>{A+=String.fromCharCode(t)}),btoa(A)}function i8(s){const A=s.getUTCFullYear(),t=String(s.getUTCMonth()+1).padStart(2,"0"),e=String(s.getUTCDate()).padStart(2,"0");return`${A}${t}${e}`}async function s8(s){const A=await Ty().digest("SHA-256",JB(XB(s)));return Array.from(new Uint8Array(A)).map(t=>t.toString(16).padStart(2,"0")).join("")}async function n8(s,A){const t=Ty(),e=await t.importKey("raw",JB(s),{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return t.sign("HMAC",e,JB(XB(A)))}function o8(s){return XB([s.appId,s.engineType,s.requestDate,String(s.timestamp),s.nonce].join("|"))}async function g8(s){const A=Ty(),t=new Date,e=t.getTime(),i=i8(t),n=globalThis.crypto.randomUUID(),o=globalThis.crypto.getRandomValues(new Uint8Array(12)),g=await s8(s.appSecret),a=await n8(XB(g),i),r=await A.importKey("raw",a,"AES-GCM",!1,["encrypt"]),I=JSON.stringify({appKey:s.appKey,appSecret:s.appSecret}),l=await A.encrypt({name:"AES-GCM",iv:o,additionalData:JB(o8({appId:s.appId,engineType:s.engineType,requestDate:i,timestamp:e,nonce:n})),tagLength:128},r,JB(XB(I)));return{appId:s.appId,engineType:s.engineType,requestDate:i,timestamp:e,nonce:n,iv:lW(o),cipherText:lW(new Uint8Array(l)),sdkVersion:s.sdkVersion,origin:s.origin,product:s.product}}const Ky=new Map;function BQ(s){return s.replace(/\/+$/,"")}function hQ(s){if(s)return s;if(typeof window<"u"&&typeof window.location?.origin=="string")return window.location.origin}function a8(s,A){return JSON.stringify({endpoint:BQ(s.endpoint),token:s.token??"",appId:s.appId??"",appKey:s.appKey??"",appSecret:s.appSecret??"",origin:hQ(s.origin)??"",product:s.product??"",engineType:A,sdkVersion:ZB})}async function jy(s,A,t){const e=typeof AbortController<"u"?new AbortController:void 0,i=e?setTimeout(()=>e.abort(),t):void 0;try{const n=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A),signal:e?.signal}),o=await n.json().catch(()=>({}));if(!n.ok){const g=o?.error?.message??o?.message??`SDK authentication failed with status ${n.status}`;throw new Error(g)}return o}finally{i!=null&&clearTimeout(i)}}async function r8(s,A){const t=await jy(`${BQ(s.endpoint)}/oauth/sdk-verify`,{sdkToken:s.token,engineType:A,sdkVersion:ZB,origin:hQ(s.origin),product:s.product},s.timeoutMs??8e3);return t.sdkToken=s.token,t}async function I8(s,A){const t=await g8({appId:s.appId,appKey:s.appKey,appSecret:s.appSecret,engineType:A,sdkVersion:ZB,origin:hQ(s.origin),product:s.product}),e=await jy(`${BQ(s.endpoint)}/oauth/sdk-token/secure`,t,s.timeoutMs??8e3),i=await jy(`${BQ(s.endpoint)}/oauth/sdk-verify`,{sdkToken:e.sdkToken,engineType:A,sdkVersion:ZB,origin:hQ(s.origin),product:s.product},s.timeoutMs??8e3);return i.sdkToken=e.sdkToken,i}async function l8(s,A){const t=s?.sdkAuth;if(!t)return null;if(!t.endpoint)throw new Error("[BimEngine] sdkAuth.endpoint is required");if(!t.token&&!(t.appId&&t.appKey&&t.appSecret))return null;const e=a8(t,A),i=Ky.get(e);if(i){const o=await i;return s&&(s.__sdkAuthSession=o),o}const n=(t.token?r8(t,A):I8(t,A)).then(o=>{if(o.authorized!==!0)throw new Error("[BimEngine] SDK authorization rejected");return s&&(s.__sdkAuthSession=o),o}).catch(o=>{throw Ky.delete(e),o});return Ky.set(e,n),n}var Ry,BW;function St(){return BW||(BW=1,Ry={options:{usePureJavaScript:!1}}),Ry}var Zy={exports:{}},Xy,hW;function B8(){if(hW)return Xy;hW=1;var s={};Xy=s;var A={};s.encode=function(e,i,n){if(typeof i!="string")throw new TypeError('"alphabet" must be a string.');if(n!==void 0&&typeof n!="number")throw new TypeError('"maxline" must be a number.');var o="";if(!(e instanceof Uint8Array))o=t(e,i);else{var g=0,a=i.length,r=i.charAt(0),I=[0];for(g=0;g<e.length;++g){for(var l=0,h=e[g];l<I.length;++l)h+=I[l]<<8,I[l]=h%a,h=h/a|0;for(;h>0;)I.push(h%a),h=h/a|0}for(g=0;e[g]===0&&g<e.length-1;++g)o+=r;for(g=I.length-1;g>=0;--g)o+=i[I[g]]}if(n){var B=new RegExp(".{1,"+n+"}","g");o=o.match(B).join(`\r
|
|
6467
6467
|
`)}return o},s.decode=function(e,i){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof i!="string")throw new TypeError('"alphabet" must be a string.');var n=A[i];if(!n){n=A[i]=[];for(var o=0;o<i.length;++o)n[i.charCodeAt(o)]=o}e=e.replace(/\s/g,"");for(var g=i.length,a=i.charAt(0),r=[0],o=0;o<e.length;o++){var I=n[e.charCodeAt(o)];if(I===void 0)return;for(var l=0,h=I;l<r.length;++l)h+=r[l]*g,r[l]=h&255,h>>=8;for(;h>0;)r.push(h&255),h>>=8}for(var B=0;e[B]===a&&B<e.length-1;++B)r.push(0);return typeof Buffer<"u"?Buffer.from(r.reverse()):new Uint8Array(r.reverse())};function t(e,i){var n=0,o=i.length,g=i.charAt(0),a=[0];for(n=0;n<e.length();++n){for(var r=0,I=e.at(n);r<a.length;++r)I+=a[r]<<8,a[r]=I%o,I=I/o|0;for(;I>0;)a.push(I%o),I=I/o|0}var l="";for(n=0;e.at(n)===0&&n<e.length()-1;++n)l+=g;for(n=a.length-1;n>=0;--n)l+=i[a[n]];return l}return Xy}var CW;function Jt(){if(CW)return Zy.exports;CW=1;var s=St(),A=B8(),t=Zy.exports=s.util=s.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){t.nextTick=process.nextTick,typeof setImmediate=="function"?t.setImmediate=setImmediate:t.setImmediate=t.nextTick;return}if(typeof setImmediate=="function"){t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},t.nextTick=function(D){return setImmediate(D)};return}if(t.setImmediate=function(D){setTimeout(D,0)},typeof window<"u"&&typeof window.postMessage=="function"){let D=function(f){if(f.source===window&&f.data===C){f.stopPropagation();var u=d.slice();d.length=0,u.forEach(function(S){S()})}};var C="forge.setImmediate",d=[];t.setImmediate=function(f){d.push(f),d.length===1&&window.postMessage(C,"*")},window.addEventListener("message",D,!0)}if(typeof MutationObserver<"u"){var M=Date.now(),y=!0,w=document.createElement("div"),d=[];new MutationObserver(function(){var f=d.slice();d.length=0,f.forEach(function(u){u()})}).observe(w,{attributes:!0});var p=t.setImmediate;t.setImmediate=function(f){Date.now()-M>15?(M=Date.now(),p(f)):(d.push(f),d.length===1&&w.setAttribute("a",y=!y))}}t.nextTick=t.setImmediate})(),t.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,t.globalScope=(function(){return t.isNodejs?wl:typeof self>"u"?window:self})(),t.isArray=Array.isArray||function(C){return Object.prototype.toString.call(C)==="[object Array]"},t.isArrayBuffer=function(C){return typeof ArrayBuffer<"u"&&C instanceof ArrayBuffer},t.isArrayBufferView=function(C){return C&&t.isArrayBuffer(C.buffer)&&C.byteLength!==void 0};function e(C){if(!(C===8||C===16||C===24||C===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+C)}t.ByteBuffer=i;function i(C){if(this.data="",this.read=0,typeof C=="string")this.data=C;else if(t.isArrayBuffer(C)||t.isArrayBufferView(C))if(typeof Buffer<"u"&&C instanceof Buffer)this.data=C.toString("binary");else{var d=new Uint8Array(C);try{this.data=String.fromCharCode.apply(null,d)}catch{for(var M=0;M<d.length;++M)this.putByte(d[M])}}else(C instanceof i||typeof C=="object"&&typeof C.data=="string"&&typeof C.read=="number")&&(this.data=C.data,this.read=C.read);this._constructedStringLength=0}t.ByteStringBuffer=i;var n=4096;t.ByteStringBuffer.prototype._optimizeConstructedString=function(C){this._constructedStringLength+=C,this._constructedStringLength>n&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(C){return this.putBytes(String.fromCharCode(C))},t.ByteStringBuffer.prototype.fillWithByte=function(C,d){C=String.fromCharCode(C);for(var M=this.data;d>0;)d&1&&(M+=C),d>>>=1,d>0&&(C+=C);return this.data=M,this._optimizeConstructedString(d),this},t.ByteStringBuffer.prototype.putBytes=function(C){return this.data+=C,this._optimizeConstructedString(C.length),this},t.ByteStringBuffer.prototype.putString=function(C){return this.putBytes(t.encodeUtf8(C))},t.ByteStringBuffer.prototype.putInt16=function(C){return this.putBytes(String.fromCharCode(C>>8&255)+String.fromCharCode(C&255))},t.ByteStringBuffer.prototype.putInt24=function(C){return this.putBytes(String.fromCharCode(C>>16&255)+String.fromCharCode(C>>8&255)+String.fromCharCode(C&255))},t.ByteStringBuffer.prototype.putInt32=function(C){return this.putBytes(String.fromCharCode(C>>24&255)+String.fromCharCode(C>>16&255)+String.fromCharCode(C>>8&255)+String.fromCharCode(C&255))},t.ByteStringBuffer.prototype.putInt16Le=function(C){return this.putBytes(String.fromCharCode(C&255)+String.fromCharCode(C>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(C){return this.putBytes(String.fromCharCode(C&255)+String.fromCharCode(C>>8&255)+String.fromCharCode(C>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(C){return this.putBytes(String.fromCharCode(C&255)+String.fromCharCode(C>>8&255)+String.fromCharCode(C>>16&255)+String.fromCharCode(C>>24&255))},t.ByteStringBuffer.prototype.putInt=function(C,d){e(d);var M="";do d-=8,M+=String.fromCharCode(C>>d&255);while(d>0);return this.putBytes(M)},t.ByteStringBuffer.prototype.putSignedInt=function(C,d){return C<0&&(C+=2<<d-1),this.putInt(C,d)},t.ByteStringBuffer.prototype.putBuffer=function(C){return this.putBytes(C.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var C=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,C},t.ByteStringBuffer.prototype.getInt24=function(){var C=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,C},t.ByteStringBuffer.prototype.getInt32=function(){var C=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,C},t.ByteStringBuffer.prototype.getInt16Le=function(){var C=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,C},t.ByteStringBuffer.prototype.getInt24Le=function(){var C=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,C},t.ByteStringBuffer.prototype.getInt32Le=function(){var C=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,C},t.ByteStringBuffer.prototype.getInt=function(C){e(C);var d=0;do d=(d<<8)+this.data.charCodeAt(this.read++),C-=8;while(C>0);return d},t.ByteStringBuffer.prototype.getSignedInt=function(C){var d=this.getInt(C),M=2<<C-2;return d>=M&&(d-=M<<1),d},t.ByteStringBuffer.prototype.getBytes=function(C){var d;return C?(C=Math.min(this.length(),C),d=this.data.slice(this.read,this.read+C),this.read+=C):C===0?d="":(d=this.read===0?this.data:this.data.slice(this.read),this.clear()),d},t.ByteStringBuffer.prototype.bytes=function(C){return typeof C>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+C)},t.ByteStringBuffer.prototype.at=function(C){return this.data.charCodeAt(this.read+C)},t.ByteStringBuffer.prototype.setAt=function(C,d){return this.data=this.data.substr(0,this.read+C)+String.fromCharCode(d)+this.data.substr(this.read+C+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var C=t.createBuffer(this.data);return C.read=this.read,C},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(C){var d=Math.max(0,this.length()-C);return this.data=this.data.substr(this.read,d),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var C="",d=this.read;d<this.data.length;++d){var M=this.data.charCodeAt(d);M<16&&(C+="0"),C+=M.toString(16)}return C},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())};function o(C,d){d=d||{},this.read=d.readOffset||0,this.growSize=d.growSize||1024;var M=t.isArrayBuffer(C),y=t.isArrayBufferView(C);if(M||y){M?this.data=new DataView(C):this.data=new DataView(C.buffer,C.byteOffset,C.byteLength),this.write="writeOffset"in d?d.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,C!=null&&this.putBytes(C),"writeOffset"in d&&(this.write=d.writeOffset)}t.DataBuffer=o,t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(C,d){if(this.length()>=C)return this;d=Math.max(d||this.growSize,C);var M=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),y=new Uint8Array(this.length()+d);return y.set(M),this.data=new DataView(y.buffer),this},t.DataBuffer.prototype.putByte=function(C){return this.accommodate(1),this.data.setUint8(this.write++,C),this},t.DataBuffer.prototype.fillWithByte=function(C,d){this.accommodate(d);for(var M=0;M<d;++M)this.data.setUint8(C);return this},t.DataBuffer.prototype.putBytes=function(C,d){if(t.isArrayBufferView(C)){var M=new Uint8Array(C.buffer,C.byteOffset,C.byteLength),y=M.byteLength-M.byteOffset;this.accommodate(y);var w=new Uint8Array(this.data.buffer,this.write);return w.set(M),this.write+=y,this}if(t.isArrayBuffer(C)){var M=new Uint8Array(C);this.accommodate(M.byteLength);var w=new Uint8Array(this.data.buffer);return w.set(M,this.write),this.write+=M.byteLength,this}if(C instanceof t.DataBuffer||typeof C=="object"&&typeof C.read=="number"&&typeof C.write=="number"&&t.isArrayBufferView(C.data)){var M=new Uint8Array(C.data.byteLength,C.read,C.length());this.accommodate(M.byteLength);var w=new Uint8Array(C.data.byteLength,this.write);return w.set(M),this.write+=M.byteLength,this}if(C instanceof t.ByteStringBuffer&&(C=C.data,d="binary"),d=d||"binary",typeof C=="string"){var p;if(d==="hex")return this.accommodate(Math.ceil(C.length/2)),p=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(C,p,this.write),this;if(d==="base64")return this.accommodate(Math.ceil(C.length/4)*3),p=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(C,p,this.write),this;if(d==="utf8"&&(C=t.encodeUtf8(C),d="binary"),d==="binary"||d==="raw")return this.accommodate(C.length),p=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(p),this;if(d==="utf16")return this.accommodate(C.length*2),p=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(p),this;throw new Error("Invalid encoding: "+d)}throw Error("Invalid parameter: "+C)},t.DataBuffer.prototype.putBuffer=function(C){return this.putBytes(C),C.clear(),this},t.DataBuffer.prototype.putString=function(C){return this.putBytes(C,"utf16")},t.DataBuffer.prototype.putInt16=function(C){return this.accommodate(2),this.data.setInt16(this.write,C),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(C){return this.accommodate(3),this.data.setInt16(this.write,C>>8&65535),this.data.setInt8(this.write,C>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(C){return this.accommodate(4),this.data.setInt32(this.write,C),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(C){return this.accommodate(2),this.data.setInt16(this.write,C,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(C){return this.accommodate(3),this.data.setInt8(this.write,C>>16&255),this.data.setInt16(this.write,C>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(C){return this.accommodate(4),this.data.setInt32(this.write,C,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(C,d){e(d),this.accommodate(d/8);do d-=8,this.data.setInt8(this.write++,C>>d&255);while(d>0);return this},t.DataBuffer.prototype.putSignedInt=function(C,d){return e(d),this.accommodate(d/8),C<0&&(C+=2<<d-1),this.putInt(C,d)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var C=this.data.getInt16(this.read);return this.read+=2,C},t.DataBuffer.prototype.getInt24=function(){var C=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,C},t.DataBuffer.prototype.getInt32=function(){var C=this.data.getInt32(this.read);return this.read+=4,C},t.DataBuffer.prototype.getInt16Le=function(){var C=this.data.getInt16(this.read,!0);return this.read+=2,C},t.DataBuffer.prototype.getInt24Le=function(){var C=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,C},t.DataBuffer.prototype.getInt32Le=function(){var C=this.data.getInt32(this.read,!0);return this.read+=4,C},t.DataBuffer.prototype.getInt=function(C){e(C);var d=0;do d=(d<<8)+this.data.getInt8(this.read++),C-=8;while(C>0);return d},t.DataBuffer.prototype.getSignedInt=function(C){var d=this.getInt(C),M=2<<C-2;return d>=M&&(d-=M<<1),d},t.DataBuffer.prototype.getBytes=function(C){var d;return C?(C=Math.min(this.length(),C),d=this.data.slice(this.read,this.read+C),this.read+=C):C===0?d="":(d=this.read===0?this.data:this.data.slice(this.read),this.clear()),d},t.DataBuffer.prototype.bytes=function(C){return typeof C>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+C)},t.DataBuffer.prototype.at=function(C){return this.data.getUint8(this.read+C)},t.DataBuffer.prototype.setAt=function(C,d){return this.data.setUint8(C,d),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var C=new Uint8Array(this.data.buffer,this.read),d=new Uint8Array(C.byteLength);d.set(C),this.data=new DataView(d),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(C){return this.write=Math.max(0,this.length()-C),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var C="",d=this.read;d<this.data.byteLength;++d){var M=this.data.getUint8(d);M<16&&(C+="0"),C+=M.toString(16)}return C},t.DataBuffer.prototype.toString=function(C){var d=new Uint8Array(this.data,this.read,this.length());if(C=C||"utf8",C==="binary"||C==="raw")return t.binary.raw.encode(d);if(C==="hex")return t.binary.hex.encode(d);if(C==="base64")return t.binary.base64.encode(d);if(C==="utf8")return t.text.utf8.decode(d);if(C==="utf16")return t.text.utf16.decode(d);throw new Error("Invalid encoding: "+C)},t.createBuffer=function(C,d){return d=d||"raw",C!==void 0&&d==="utf8"&&(C=t.encodeUtf8(C)),new t.ByteBuffer(C)},t.fillString=function(C,d){for(var M="";d>0;)d&1&&(M+=C),d>>>=1,d>0&&(C+=C);return M},t.xorBytes=function(C,d,M){for(var y="",w="",p="",D=0,f=0;M>0;--M,++D)w=C.charCodeAt(D)^d.charCodeAt(D),f>=10&&(y+=p,p="",f=0),p+=String.fromCharCode(w),++f;return y+=p,y},t.hexToBytes=function(C){var d="",M=0;for(C.length&!0&&(M=1,d+=String.fromCharCode(parseInt(C[0],16)));M<C.length;M+=2)d+=String.fromCharCode(parseInt(C.substr(M,2),16));return d},t.bytesToHex=function(C){return t.createBuffer(C).toHex()},t.int32ToBytes=function(C){return String.fromCharCode(C>>24&255)+String.fromCharCode(C>>16&255)+String.fromCharCode(C>>8&255)+String.fromCharCode(C&255)};var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(C,d){for(var M="",y="",w,p,D,f=0;f<C.length;)w=C.charCodeAt(f++),p=C.charCodeAt(f++),D=C.charCodeAt(f++),M+=g.charAt(w>>2),M+=g.charAt((w&3)<<4|p>>4),isNaN(p)?M+="==":(M+=g.charAt((p&15)<<2|D>>6),M+=isNaN(D)?"=":g.charAt(D&63)),d&&M.length>d&&(y+=M.substr(0,d)+`\r
|
|
6468
6468
|
`,M=M.substr(d));return y+=M,y},t.decode64=function(C){C=C.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var d="",M,y,w,p,D=0;D<C.length;)M=a[C.charCodeAt(D++)-43],y=a[C.charCodeAt(D++)-43],w=a[C.charCodeAt(D++)-43],p=a[C.charCodeAt(D++)-43],d+=String.fromCharCode(M<<2|y>>4),w!==64&&(d+=String.fromCharCode((y&15)<<4|w>>2),p!==64&&(d+=String.fromCharCode((w&3)<<6|p)));return d},t.encodeUtf8=function(C){return unescape(encodeURIComponent(C))},t.decodeUtf8=function(C){return decodeURIComponent(escape(C))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:A.encode,decode:A.decode}},t.binary.raw.encode=function(C){return String.fromCharCode.apply(null,C)},t.binary.raw.decode=function(C,d,M){var y=d;y||(y=new Uint8Array(C.length)),M=M||0;for(var w=M,p=0;p<C.length;++p)y[w++]=C.charCodeAt(p);return d?w-M:y},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(C,d,M){var y=d;y||(y=new Uint8Array(Math.ceil(C.length/2))),M=M||0;var w=0,p=M;for(C.length&1&&(w=1,y[p++]=parseInt(C[0],16));w<C.length;w+=2)y[p++]=parseInt(C.substr(w,2),16);return d?p-M:y},t.binary.base64.encode=function(C,d){for(var M="",y="",w,p,D,f=0;f<C.byteLength;)w=C[f++],p=C[f++],D=C[f++],M+=g.charAt(w>>2),M+=g.charAt((w&3)<<4|p>>4),isNaN(p)?M+="==":(M+=g.charAt((p&15)<<2|D>>6),M+=isNaN(D)?"=":g.charAt(D&63)),d&&M.length>d&&(y+=M.substr(0,d)+`\r
|
|
6469
6469
|
`,M=M.substr(d));return y+=M,y},t.binary.base64.decode=function(C,d,M){var y=d;y||(y=new Uint8Array(Math.ceil(C.length/4)*3)),C=C.replace(/[^A-Za-z0-9\+\/\=]/g,""),M=M||0;for(var w,p,D,f,u=0,S=M;u<C.length;)w=a[C.charCodeAt(u++)-43],p=a[C.charCodeAt(u++)-43],D=a[C.charCodeAt(u++)-43],f=a[C.charCodeAt(u++)-43],y[S++]=w<<2|p>>4,D!==64&&(y[S++]=(p&15)<<4|D>>2,f!==64&&(y[S++]=(D&3)<<6|f));return d?S-M:y.subarray(0,S)},t.binary.base58.encode=function(C,d){return t.binary.baseN.encode(C,r,d)},t.binary.base58.decode=function(C,d){return t.binary.baseN.decode(C,r,d)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(C,d,M){C=t.encodeUtf8(C);var y=d;y||(y=new Uint8Array(C.length)),M=M||0;for(var w=M,p=0;p<C.length;++p)y[w++]=C.charCodeAt(p);return d?w-M:y},t.text.utf8.decode=function(C){return t.decodeUtf8(String.fromCharCode.apply(null,C))},t.text.utf16.encode=function(C,d,M){var y=d;y||(y=new Uint8Array(C.length*2));var w=new Uint16Array(y.buffer);M=M||0;for(var p=M,D=M,f=0;f<C.length;++f)w[D++]=C.charCodeAt(f),p+=2;return d?p-M:y},t.text.utf16.decode=function(C){return String.fromCharCode.apply(null,new Uint16Array(C.buffer))},t.deflate=function(C,d,M){if(d=t.decode64(C.deflate(t.encode64(d)).rval),M){var y=2,w=d.charCodeAt(1);w&32&&(y=6),d=d.substring(y,d.length-4)}return d},t.inflate=function(C,d,M){var y=C.inflate(t.encode64(d)).rval;return y===null?null:t.decode64(y)};var I=function(C,d,M){if(!C)throw new Error("WebStorage not available.");var y;if(M===null?y=C.removeItem(d):(M=t.encode64(JSON.stringify(M)),y=C.setItem(d,M)),typeof y<"u"&&y.rval!==!0){var w=new Error(y.error.message);throw w.id=y.error.id,w.name=y.error.name,w}},l=function(C,d){if(!C)throw new Error("WebStorage not available.");var M=C.getItem(d);if(C.init)if(M.rval===null){if(M.error){var y=new Error(M.error.message);throw y.id=M.error.id,y.name=M.error.name,y}M=null}else M=M.rval;return M!==null&&(M=JSON.parse(t.decode64(M))),M},h=function(C,d,M,y){var w=l(C,d);w===null&&(w={}),w[M]=y,I(C,d,w)},B=function(C,d,M){var y=l(C,d);return y!==null&&(y=M in y?y[M]:null),y},E=function(C,d,M){var y=l(C,d);if(y!==null&&M in y){delete y[M];var w=!0;for(var p in y){w=!1;break}w&&(y=null),I(C,d,y)}},c=function(C,d){I(C,d,null)},Q=function(C,d,M){var y=null;typeof M>"u"&&(M=["web","flash"]);var w,p=!1,D=null;for(var f in M){w=M[f];try{if(w==="flash"||w==="both"){if(d[0]===null)throw new Error("Flash local storage not available.");y=C.apply(this,d),p=w==="flash"}(w==="web"||w==="both")&&(d[0]=localStorage,y=C.apply(this,d),p=!0)}catch(u){D=u}if(p)break}if(!p)throw D;return y};return t.setItem=function(C,d,M,y,w){Q(h,arguments,w)},t.getItem=function(C,d,M,y){return Q(B,arguments,y)},t.removeItem=function(C,d,M,y){Q(E,arguments,y)},t.clearItems=function(C,d,M){Q(c,arguments,M)},t.isEmpty=function(C){for(var d in C)if(C.hasOwnProperty(d))return!1;return!0},t.format=function(C){for(var d=/%./g,M,y,w=0,p=[],D=0;M=d.exec(C);){y=C.substring(D,d.lastIndex-2),y.length>0&&p.push(y),D=d.lastIndex;var f=M[0][1];switch(f){case"s":case"o":w<arguments.length?p.push(arguments[w+++1]):p.push("<?>");break;case"%":p.push("%");break;default:p.push("<%"+f+"?>")}}return p.push(C.substring(D)),p.join("")},t.formatNumber=function(C,d,M,y){var w=C,p=isNaN(d=Math.abs(d))?2:d,D=M===void 0?",":M,f=y===void 0?".":y,u=w<0?"-":"",S=parseInt(w=Math.abs(+w||0).toFixed(p),10)+"",b=S.length>3?S.length%3:0;return u+(b?S.substr(0,b)+f:"")+S.substr(b).replace(/(\d{3})(?=\d)/g,"$1"+f)+(p?D+Math.abs(w-S).toFixed(p).slice(2):"")},t.formatSize=function(C){return C>=1073741824?C=t.formatNumber(C/1073741824,2,".","")+" GiB":C>=1048576?C=t.formatNumber(C/1048576,2,".","")+" MiB":C>=1024?C=t.formatNumber(C/1024,0)+" KiB":C=t.formatNumber(C,0)+" bytes",C},t.bytesFromIP=function(C){return C.indexOf(".")!==-1?t.bytesFromIPv4(C):C.indexOf(":")!==-1?t.bytesFromIPv6(C):null},t.bytesFromIPv4=function(C){if(C=C.split("."),C.length!==4)return null;for(var d=t.createBuffer(),M=0;M<C.length;++M){var y=parseInt(C[M],10);if(isNaN(y))return null;d.putByte(y)}return d.getBytes()},t.bytesFromIPv6=function(C){var d=0;C=C.split(":").filter(function(D){return D.length===0&&++d,!0});for(var M=(8-C.length+d)*2,y=t.createBuffer(),w=0;w<8;++w){if(!C[w]||C[w].length===0){y.fillWithByte(0,M),M=0;continue}var p=t.hexToBytes(C[w]);p.length<2&&y.putByte(0),y.putBytes(p)}return y.getBytes()},t.bytesToIP=function(C){return C.length===4?t.bytesToIPv4(C):C.length===16?t.bytesToIPv6(C):null},t.bytesToIPv4=function(C){if(C.length!==4)return null;for(var d=[],M=0;M<C.length;++M)d.push(C.charCodeAt(M));return d.join(".")},t.bytesToIPv6=function(C){if(C.length!==16)return null;for(var d=[],M=[],y=0,w=0;w<C.length;w+=2){for(var p=t.bytesToHex(C[w]+C[w+1]);p[0]==="0"&&p!=="0";)p=p.substr(1);if(p==="0"){var D=M[M.length-1],f=d.length;!D||f!==D.end+1?M.push({start:f,end:f}):(D.end=f,D.end-D.start>M[y].end-M[y].start&&(y=M.length-1))}d.push(p)}if(M.length>0){var u=M[y];u.end-u.start>0&&(d.splice(u.start,u.end-u.start+1,""),u.start===0&&d.unshift(""),u.end===7&&d.push(""))}return d.join(":")},t.estimateCores=function(C,d){if(typeof C=="function"&&(d=C,C={}),C=C||{},"cores"in t&&!C.update)return d(null,t.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,d(null,t.cores);if(typeof Worker>"u")return t.cores=1,d(null,t.cores);if(typeof Blob>"u")return t.cores=2,d(null,t.cores);var M=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(D){var f=Date.now(),u=f+4;self.postMessage({st:f,et:u})})}).toString(),")()"],{type:"application/javascript"}));y([],5,16);function y(D,f,u){if(f===0){var S=Math.floor(D.reduce(function(b,m){return b+m},0)/D.length);return t.cores=Math.max(1,S),URL.revokeObjectURL(M),d(null,t.cores)}w(u,function(b,m){D.push(p(u,m)),y(D,f-1,u)})}function w(D,f){for(var u=[],S=[],b=0;b<D;++b){var m=new Worker(M);m.addEventListener("message",function(G){if(S.push(G.data),S.length===D){for(var F=0;F<D;++F)u[F].terminate();f(null,S)}}),u.push(m)}for(var b=0;b<D;++b)u[b].postMessage(b)}function p(D,f){for(var u=[],S=0;S<D;++S)for(var b=f[S],m=u[S]=[],G=0;G<D;++G)if(S!==G){var F=f[G];(b.st>F.st&&b.st<F.et||F.st>b.st&&F.st<b.et)&&m.push(G)}return u.reduce(function(K,U){return Math.max(K,U.length)},0)}},Zy.exports}var Jy,EW;function Uy(){if(EW)return Jy;EW=1;var s=St();Jt(),Jy=s.cipher=s.cipher||{},s.cipher.algorithms=s.cipher.algorithms||{},s.cipher.createCipher=function(t,e){var i=t;if(typeof i=="string"&&(i=s.cipher.getAlgorithm(i),i&&(i=i())),!i)throw new Error("Unsupported algorithm: "+t);return new s.cipher.BlockCipher({algorithm:i,key:e,decrypt:!1})},s.cipher.createDecipher=function(t,e){var i=t;if(typeof i=="string"&&(i=s.cipher.getAlgorithm(i),i&&(i=i())),!i)throw new Error("Unsupported algorithm: "+t);return new s.cipher.BlockCipher({algorithm:i,key:e,decrypt:!0})},s.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),s.cipher.algorithms[t]=e},s.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in s.cipher.algorithms?s.cipher.algorithms[t]:null};var A=s.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};return A.prototype.start=function(t){t=t||{};var e={};for(var i in t)e[i]=t[i];e.decrypt=this._decrypt,this._finish=!1,this._input=s.util.createBuffer(),this.output=t.output||s.util.createBuffer(),this.mode.start(e)},A.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},A.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(i){return t(this.blockSize,i,!1)},this.mode.unpad=function(i){return t(this.blockSize,i,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))},Jy}var Ny={exports:{}},cW;function QW(){if(cW)return Ny.exports;cW=1;var s=St();Jt(),s.cipher=s.cipher||{};var A=Ny.exports=s.cipher.modes=s.cipher.modes||{};A.ecb=function(n){n=n||{},this.name="ECB",this.cipher=n.cipher,this.blockSize=n.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},A.ecb.prototype.start=function(n){},A.ecb.prototype.encrypt=function(n,o,g){if(n.length()<this.blockSize&&!(g&&n.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=n.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var a=0;a<this._ints;++a)o.putInt32(this._outBlock[a])},A.ecb.prototype.decrypt=function(n,o,g){if(n.length()<this.blockSize&&!(g&&n.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=n.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var a=0;a<this._ints;++a)o.putInt32(this._outBlock[a])},A.ecb.prototype.pad=function(n,o){var g=n.length()===this.blockSize?this.blockSize:this.blockSize-n.length();return n.fillWithByte(g,g),!0},A.ecb.prototype.unpad=function(n,o){if(o.overflow>0)return!1;var g=n.length(),a=n.at(g-1);return a>this.blockSize<<2?!1:(n.truncate(a),!0)},A.cbc=function(n){n=n||{},this.name="CBC",this.cipher=n.cipher,this.blockSize=n.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},A.cbc.prototype.start=function(n){if(n.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in n)this._iv=t(n.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},A.cbc.prototype.encrypt=function(n,o,g){if(n.length()<this.blockSize&&!(g&&n.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=this._prev[a]^n.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var a=0;a<this._ints;++a)o.putInt32(this._outBlock[a]);this._prev=this._outBlock},A.cbc.prototype.decrypt=function(n,o,g){if(n.length()<this.blockSize&&!(g&&n.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=n.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var a=0;a<this._ints;++a)o.putInt32(this._prev[a]^this._outBlock[a]);this._prev=this._inBlock.slice(0)},A.cbc.prototype.pad=function(n,o){var g=n.length()===this.blockSize?this.blockSize:this.blockSize-n.length();return n.fillWithByte(g,g),!0},A.cbc.prototype.unpad=function(n,o){if(o.overflow>0)return!1;var g=n.length(),a=n.at(g-1);return a>this.blockSize<<2?!1:(n.truncate(a),!0)},A.cfb=function(n){n=n||{},this.name="CFB",this.cipher=n.cipher,this.blockSize=n.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=s.util.createBuffer(),this._partialBytes=0},A.cfb.prototype.start=function(n){if(!("iv"in n))throw new Error("Invalid IV parameter.");this._iv=t(n.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},A.cfb.prototype.encrypt=function(n,o,g){var a=n.length();if(a===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize){for(var r=0;r<this._ints;++r)this._inBlock[r]=n.getInt32()^this._outBlock[r],o.putInt32(this._inBlock[r]);return}var I=(this.blockSize-a)%this.blockSize;I>0&&(I=this.blockSize-I),this._partialOutput.clear();for(var r=0;r<this._ints;++r)this._partialBlock[r]=n.getInt32()^this._outBlock[r],this._partialOutput.putInt32(this._partialBlock[r]);if(I>0)n.read-=this.blockSize;else for(var r=0;r<this._ints;++r)this._inBlock[r]=this._partialBlock[r];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!g)return o.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;o.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0},A.cfb.prototype.decrypt=function(n,o,g){var a=n.length();if(a===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize){for(var r=0;r<this._ints;++r)this._inBlock[r]=n.getInt32(),o.putInt32(this._inBlock[r]^this._outBlock[r]);return}var I=(this.blockSize-a)%this.blockSize;I>0&&(I=this.blockSize-I),this._partialOutput.clear();for(var r=0;r<this._ints;++r)this._partialBlock[r]=n.getInt32(),this._partialOutput.putInt32(this._partialBlock[r]^this._outBlock[r]);if(I>0)n.read-=this.blockSize;else for(var r=0;r<this._ints;++r)this._inBlock[r]=this._partialBlock[r];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!g)return o.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;o.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0},A.ofb=function(n){n=n||{},this.name="OFB",this.cipher=n.cipher,this.blockSize=n.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=s.util.createBuffer(),this._partialBytes=0},A.ofb.prototype.start=function(n){if(!("iv"in n))throw new Error("Invalid IV parameter.");this._iv=t(n.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},A.ofb.prototype.encrypt=function(n,o,g){var a=n.length();if(n.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize){for(var r=0;r<this._ints;++r)o.putInt32(n.getInt32()^this._outBlock[r]),this._inBlock[r]=this._outBlock[r];return}var I=(this.blockSize-a)%this.blockSize;I>0&&(I=this.blockSize-I),this._partialOutput.clear();for(var r=0;r<this._ints;++r)this._partialOutput.putInt32(n.getInt32()^this._outBlock[r]);if(I>0)n.read-=this.blockSize;else for(var r=0;r<this._ints;++r)this._inBlock[r]=this._outBlock[r];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!g)return o.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;o.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0},A.ofb.prototype.decrypt=A.ofb.prototype.encrypt,A.ctr=function(n){n=n||{},this.name="CTR",this.cipher=n.cipher,this.blockSize=n.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=s.util.createBuffer(),this._partialBytes=0},A.ctr.prototype.start=function(n){if(!("iv"in n))throw new Error("Invalid IV parameter.");this._iv=t(n.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},A.ctr.prototype.encrypt=function(n,o,g){var a=n.length();if(a===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize)for(var r=0;r<this._ints;++r)o.putInt32(n.getInt32()^this._outBlock[r]);else{var I=(this.blockSize-a)%this.blockSize;I>0&&(I=this.blockSize-I),this._partialOutput.clear();for(var r=0;r<this._ints;++r)this._partialOutput.putInt32(n.getInt32()^this._outBlock[r]);if(I>0&&(n.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!g)return o.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;o.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}e(this._inBlock)},A.ctr.prototype.decrypt=A.ctr.prototype.encrypt,A.gcm=function(n){n=n||{},this.name="GCM",this.cipher=n.cipher,this.blockSize=n.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=s.util.createBuffer(),this._partialBytes=0,this._R=3774873600},A.gcm.prototype.start=function(n){if(!("iv"in n))throw new Error("Invalid IV parameter.");var o=s.util.createBuffer(n.iv);this._cipherLength=0;var g;if("additionalData"in n?g=s.util.createBuffer(n.additionalData):g=s.util.createBuffer(),"tagLength"in n?this._tagLength=n.tagLength:this._tagLength=128,this._tag=null,n.decrypt&&(this._tag=s.util.createBuffer(n.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var a=o.length();if(a===12)this._j0=[o.getInt32(),o.getInt32(),o.getInt32(),1];else{for(this._j0=[0,0,0,0];o.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[o.getInt32(),o.getInt32(),o.getInt32(),o.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(a*8)))}this._inBlock=this._j0.slice(0),e(this._inBlock),this._partialBytes=0,g=s.util.createBuffer(g),this._aDataLength=i(g.length()*8);var r=g.length()%this.blockSize;for(r&&g.fillWithByte(0,this.blockSize-r),this._s=[0,0,0,0];g.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[g.getInt32(),g.getInt32(),g.getInt32(),g.getInt32()])},A.gcm.prototype.encrypt=function(n,o,g){var a=n.length();if(a===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize){for(var r=0;r<this._ints;++r)o.putInt32(this._outBlock[r]^=n.getInt32());this._cipherLength+=this.blockSize}else{var I=(this.blockSize-a)%this.blockSize;I>0&&(I=this.blockSize-I),this._partialOutput.clear();for(var r=0;r<this._ints;++r)this._partialOutput.putInt32(n.getInt32()^this._outBlock[r]);if(I<=0||g){if(g){var l=a%this.blockSize;this._cipherLength+=l,this._partialOutput.truncate(this.blockSize-l)}else this._cipherLength+=this.blockSize;for(var r=0;r<this._ints;++r)this._outBlock[r]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!g)return n.read-=this.blockSize,o.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;o.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),e(this._inBlock)},A.gcm.prototype.decrypt=function(n,o,g){var a=n.length();if(a<this.blockSize&&!(g&&a>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),e(this._inBlock),this._hashBlock[0]=n.getInt32(),this._hashBlock[1]=n.getInt32(),this._hashBlock[2]=n.getInt32(),this._hashBlock[3]=n.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var r=0;r<this._ints;++r)o.putInt32(this._outBlock[r]^this._hashBlock[r]);a<this.blockSize?this._cipherLength+=a%this.blockSize:this._cipherLength+=this.blockSize},A.gcm.prototype.afterFinish=function(n,o){var g=!0;o.decrypt&&o.overflow&&n.truncate(this.blockSize-o.overflow),this.tag=s.util.createBuffer();var a=this._aDataLength.concat(i(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,a);var r=[];this.cipher.encrypt(this._j0,r);for(var I=0;I<this._ints;++I)this.tag.putInt32(this._s[I]^r[I]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),o.decrypt&&this.tag.bytes()!==this._tag&&(g=!1),g},A.gcm.prototype.multiply=function(n,o){for(var g=[0,0,0,0],a=o.slice(0),r=0;r<128;++r){var I=n[r/32|0]&1<<31-r%32;I&&(g[0]^=a[0],g[1]^=a[1],g[2]^=a[2],g[3]^=a[3]),this.pow(a,a)}return g},A.gcm.prototype.pow=function(n,o){for(var g=n[3]&1,a=3;a>0;--a)o[a]=n[a]>>>1|(n[a-1]&1)<<31;o[0]=n[0]>>>1,g&&(o[0]^=this._R)},A.gcm.prototype.tableMultiply=function(n){for(var o=[0,0,0,0],g=0;g<32;++g){var a=g/8|0,r=n[a]>>>(7-g%8)*4&15,I=this._m[g][r];o[0]^=I[0],o[1]^=I[1],o[2]^=I[2],o[3]^=I[3]}return o},A.gcm.prototype.ghash=function(n,o,g){return o[0]^=g[0],o[1]^=g[1],o[2]^=g[2],o[3]^=g[3],this.tableMultiply(o)},A.gcm.prototype.generateHashTable=function(n,o){for(var g=8/o,a=4*g,r=16*g,I=new Array(r),l=0;l<r;++l){var h=[0,0,0,0],B=l/a|0,E=(a-1-l%a)*o;h[B]=1<<o-1<<E,I[l]=this.generateSubHashTable(this.multiply(h,n),o)}return I},A.gcm.prototype.generateSubHashTable=function(n,o){var g=1<<o,a=g>>>1,r=new Array(g);r[a]=n.slice(0);for(var I=a>>>1;I>0;)this.pow(r[2*I],r[I]=[]),I>>=1;for(I=2;I<a;){for(var l=1;l<I;++l){var h=r[I],B=r[l];r[I+l]=[h[0]^B[0],h[1]^B[1],h[2]^B[2],h[3]^B[3]]}I*=2}for(r[0]=[0,0,0,0],I=a+1;I<g;++I){var E=r[I^a];r[I]=[n[0]^E[0],n[1]^E[1],n[2]^E[2],n[3]^E[3]]}return r};function t(n,o){if(typeof n=="string"&&(n=s.util.createBuffer(n)),s.util.isArray(n)&&n.length>4){var g=n;n=s.util.createBuffer();for(var a=0;a<g.length;++a)n.putByte(g[a])}if(n.length()<o)throw new Error("Invalid IV length; got "+n.length()+" bytes and expected "+o+" bytes.");if(!s.util.isArray(n)){for(var r=[],I=o/4,a=0;a<I;++a)r.push(n.getInt32());n=r}return n}function e(n){n[n.length-1]=n[n.length-1]+1&4294967295}function i(n){return[n/4294967296|0,n&4294967295]}return Ny.exports}var xy,dW;function fa(){if(dW)return xy;dW=1;var s=St();Uy(),QW(),Jt(),xy=s.aes=s.aes||{},s.aes.startEncrypting=function(B,E,c,Q){var C=h({key:B,output:c,decrypt:!1,mode:Q});return C.start(E),C},s.aes.createEncryptionCipher=function(B,E){return h({key:B,output:null,decrypt:!1,mode:E})},s.aes.startDecrypting=function(B,E,c,Q){var C=h({key:B,output:c,decrypt:!0,mode:Q});return C.start(E),C},s.aes.createDecryptionCipher=function(B,E){return h({key:B,output:null,decrypt:!0,mode:E})},s.aes.Algorithm=function(B,E){t||r();var c=this;c.name=B,c.mode=new E({blockSize:16,cipher:{encrypt:function(Q,C){return l(c._w,Q,C,!1)},decrypt:function(Q,C){return l(c._w,Q,C,!0)}}}),c._init=!1},s.aes.Algorithm.prototype.initialize=function(B){if(!this._init){var E=B.key,c;if(typeof E=="string"&&(E.length===16||E.length===24||E.length===32))E=s.util.createBuffer(E);else if(s.util.isArray(E)&&(E.length===16||E.length===24||E.length===32)){c=E,E=s.util.createBuffer();for(var Q=0;Q<c.length;++Q)E.putByte(c[Q])}if(!s.util.isArray(E)){c=E,E=[];var C=c.length();if(C===16||C===24||C===32){C=C>>>2;for(var Q=0;Q<C;++Q)E.push(c.getInt32())}}if(!s.util.isArray(E)||!(E.length===4||E.length===6||E.length===8))throw new Error("Invalid key parameter.");var d=this.mode.name,M=["CFB","OFB","CTR","GCM"].indexOf(d)!==-1;this._w=I(E,B.decrypt&&!M),this._init=!0}},s.aes._expandKey=function(B,E){return t||r(),I(B,E)},s.aes._updateBlock=l,A("AES-ECB",s.cipher.modes.ecb),A("AES-CBC",s.cipher.modes.cbc),A("AES-CFB",s.cipher.modes.cfb),A("AES-OFB",s.cipher.modes.ofb),A("AES-CTR",s.cipher.modes.ctr),A("AES-GCM",s.cipher.modes.gcm);function A(B,E){var c=function(){return new s.aes.Algorithm(B,E)};s.cipher.registerAlgorithm(B,c)}var t=!1,e=4,i,n,o,g,a;function r(){t=!0,o=[0,1,2,4,8,16,32,64,128,27,54];for(var B=new Array(256),E=0;E<128;++E)B[E]=E<<1,B[E+128]=E+128<<1^283;i=new Array(256),n=new Array(256),g=new Array(4),a=new Array(4);for(var E=0;E<4;++E)g[E]=new Array(256),a[E]=new Array(256);for(var c=0,Q=0,C,d,M,y,w,p,D,E=0;E<256;++E){y=Q^Q<<1^Q<<2^Q<<3^Q<<4,y=y>>8^y&255^99,i[c]=y,n[y]=c,w=B[y],C=B[c],d=B[C],M=B[d],p=w<<24^y<<16^y<<8^(y^w),D=(C^d^M)<<24^(c^M)<<16^(c^d^M)<<8^(c^C^M);for(var f=0;f<4;++f)g[f][c]=p,a[f][y]=D,p=p<<24|p>>>8,D=D<<24|D>>>8;c===0?c=Q=1:(c=C^B[B[B[C^M]]],Q^=B[B[Q]])}}function I(B,E){for(var c=B.slice(0),Q,C=1,d=c.length,M=d+6+1,y=e*M,w=d;w<y;++w)Q=c[w-1],w%d===0?(Q=i[Q>>>16&255]<<24^i[Q>>>8&255]<<16^i[Q&255]<<8^i[Q>>>24]^o[C]<<24,C++):d>6&&w%d===4&&(Q=i[Q>>>24]<<24^i[Q>>>16&255]<<16^i[Q>>>8&255]<<8^i[Q&255]),c[w]=c[w-d]^Q;if(E){var p,D=a[0],f=a[1],u=a[2],S=a[3],b=c.slice(0);y=c.length;for(var w=0,m=y-e;w<y;w+=e,m-=e)if(w===0||w===y-e)b[w]=c[m],b[w+1]=c[m+3],b[w+2]=c[m+2],b[w+3]=c[m+1];else for(var G=0;G<e;++G)p=c[m+G],b[w+(3&-G)]=D[i[p>>>24]]^f[i[p>>>16&255]]^u[i[p>>>8&255]]^S[i[p&255]];c=b}return c}function l(B,E,c,Q){var C=B.length/4-1,d,M,y,w,p;Q?(d=a[0],M=a[1],y=a[2],w=a[3],p=n):(d=g[0],M=g[1],y=g[2],w=g[3],p=i);var D,f,u,S,b,m,G;D=E[0]^B[0],f=E[Q?3:1]^B[1],u=E[2]^B[2],S=E[Q?1:3]^B[3];for(var F=3,K=1;K<C;++K)b=d[D>>>24]^M[f>>>16&255]^y[u>>>8&255]^w[S&255]^B[++F],m=d[f>>>24]^M[u>>>16&255]^y[S>>>8&255]^w[D&255]^B[++F],G=d[u>>>24]^M[S>>>16&255]^y[D>>>8&255]^w[f&255]^B[++F],S=d[S>>>24]^M[D>>>16&255]^y[f>>>8&255]^w[u&255]^B[++F],D=b,f=m,u=G;c[0]=p[D>>>24]<<24^p[f>>>16&255]<<16^p[u>>>8&255]<<8^p[S&255]^B[++F],c[Q?3:1]=p[f>>>24]<<24^p[u>>>16&255]<<16^p[S>>>8&255]<<8^p[D&255]^B[++F],c[2]=p[u>>>24]<<24^p[S>>>16&255]<<16^p[D>>>8&255]<<8^p[f&255]^B[++F],c[Q?1:3]=p[S>>>24]<<24^p[D>>>16&255]<<16^p[f>>>8&255]<<8^p[u&255]^B[++F]}function h(B){B=B||{};var E=(B.mode||"CBC").toUpperCase(),c="AES-"+E,Q;B.decrypt?Q=s.cipher.createDecipher(c,B.key):Q=s.cipher.createCipher(c,B.key);var C=Q.start;return Q.start=function(d,M){var y=null;M instanceof s.util.ByteBuffer&&(y=M,M={}),M=M||{},M.output=y,M.iv=d,C.call(Q,M)},Q}return xy}var ky={exports:{}},Vy={exports:{}},Hy={exports:{}},fW;function Ma(){if(fW)return Hy.exports;fW=1;var s=St();s.pki=s.pki||{};var A=Hy.exports=s.pki.oids=s.oids=s.oids||{};function t(i,n){A[i]=n,A[n]=i}function e(i,n){A[i]=n}return t("1.2.840.113549.1.1.1","rsaEncryption"),t("1.2.840.113549.1.1.4","md5WithRSAEncryption"),t("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),t("1.2.840.113549.1.1.7","RSAES-OAEP"),t("1.2.840.113549.1.1.8","mgf1"),t("1.2.840.113549.1.1.9","pSpecified"),t("1.2.840.113549.1.1.10","RSASSA-PSS"),t("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),t("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),t("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),t("1.3.101.112","EdDSA25519"),t("1.2.840.10040.4.3","dsa-with-sha1"),t("1.3.14.3.2.7","desCBC"),t("1.3.14.3.2.26","sha1"),t("1.3.14.3.2.29","sha1WithRSASignature"),t("2.16.840.1.101.3.4.2.1","sha256"),t("2.16.840.1.101.3.4.2.2","sha384"),t("2.16.840.1.101.3.4.2.3","sha512"),t("2.16.840.1.101.3.4.2.4","sha224"),t("2.16.840.1.101.3.4.2.5","sha512-224"),t("2.16.840.1.101.3.4.2.6","sha512-256"),t("1.2.840.113549.2.2","md2"),t("1.2.840.113549.2.5","md5"),t("1.2.840.113549.1.7.1","data"),t("1.2.840.113549.1.7.2","signedData"),t("1.2.840.113549.1.7.3","envelopedData"),t("1.2.840.113549.1.7.4","signedAndEnvelopedData"),t("1.2.840.113549.1.7.5","digestedData"),t("1.2.840.113549.1.7.6","encryptedData"),t("1.2.840.113549.1.9.1","emailAddress"),t("1.2.840.113549.1.9.2","unstructuredName"),t("1.2.840.113549.1.9.3","contentType"),t("1.2.840.113549.1.9.4","messageDigest"),t("1.2.840.113549.1.9.5","signingTime"),t("1.2.840.113549.1.9.6","counterSignature"),t("1.2.840.113549.1.9.7","challengePassword"),t("1.2.840.113549.1.9.8","unstructuredAddress"),t("1.2.840.113549.1.9.14","extensionRequest"),t("1.2.840.113549.1.9.20","friendlyName"),t("1.2.840.113549.1.9.21","localKeyId"),t("1.2.840.113549.1.9.22.1","x509Certificate"),t("1.2.840.113549.1.12.10.1.1","keyBag"),t("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),t("1.2.840.113549.1.12.10.1.3","certBag"),t("1.2.840.113549.1.12.10.1.4","crlBag"),t("1.2.840.113549.1.12.10.1.5","secretBag"),t("1.2.840.113549.1.12.10.1.6","safeContentsBag"),t("1.2.840.113549.1.5.13","pkcs5PBES2"),t("1.2.840.113549.1.5.12","pkcs5PBKDF2"),t("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),t("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),t("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),t("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),t("1.2.840.113549.2.7","hmacWithSHA1"),t("1.2.840.113549.2.8","hmacWithSHA224"),t("1.2.840.113549.2.9","hmacWithSHA256"),t("1.2.840.113549.2.10","hmacWithSHA384"),t("1.2.840.113549.2.11","hmacWithSHA512"),t("1.2.840.113549.3.7","des-EDE3-CBC"),t("2.16.840.1.101.3.4.1.2","aes128-CBC"),t("2.16.840.1.101.3.4.1.22","aes192-CBC"),t("2.16.840.1.101.3.4.1.42","aes256-CBC"),t("2.5.4.3","commonName"),t("2.5.4.4","surname"),t("2.5.4.5","serialNumber"),t("2.5.4.6","countryName"),t("2.5.4.7","localityName"),t("2.5.4.8","stateOrProvinceName"),t("2.5.4.9","streetAddress"),t("2.5.4.10","organizationName"),t("2.5.4.11","organizationalUnitName"),t("2.5.4.12","title"),t("2.5.4.13","description"),t("2.5.4.15","businessCategory"),t("2.5.4.17","postalCode"),t("2.5.4.42","givenName"),t("2.5.4.65","pseudonym"),t("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),t("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),t("2.16.840.1.113730.1.1","nsCertType"),t("2.16.840.1.113730.1.13","nsComment"),e("2.5.29.1","authorityKeyIdentifier"),e("2.5.29.2","keyAttributes"),e("2.5.29.3","certificatePolicies"),e("2.5.29.4","keyUsageRestriction"),e("2.5.29.5","policyMapping"),e("2.5.29.6","subtreesConstraint"),e("2.5.29.7","subjectAltName"),e("2.5.29.8","issuerAltName"),e("2.5.29.9","subjectDirectoryAttributes"),e("2.5.29.10","basicConstraints"),e("2.5.29.11","nameConstraints"),e("2.5.29.12","policyConstraints"),e("2.5.29.13","basicConstraints"),t("2.5.29.14","subjectKeyIdentifier"),t("2.5.29.15","keyUsage"),e("2.5.29.16","privateKeyUsagePeriod"),t("2.5.29.17","subjectAltName"),t("2.5.29.18","issuerAltName"),t("2.5.29.19","basicConstraints"),e("2.5.29.20","cRLNumber"),e("2.5.29.21","cRLReason"),e("2.5.29.22","expirationDate"),e("2.5.29.23","instructionCode"),e("2.5.29.24","invalidityDate"),e("2.5.29.25","cRLDistributionPoints"),e("2.5.29.26","issuingDistributionPoint"),e("2.5.29.27","deltaCRLIndicator"),e("2.5.29.28","issuingDistributionPoint"),e("2.5.29.29","certificateIssuer"),e("2.5.29.30","nameConstraints"),t("2.5.29.31","cRLDistributionPoints"),t("2.5.29.32","certificatePolicies"),e("2.5.29.33","policyMappings"),e("2.5.29.34","policyConstraints"),t("2.5.29.35","authorityKeyIdentifier"),e("2.5.29.36","policyConstraints"),t("2.5.29.37","extKeyUsage"),e("2.5.29.46","freshestCRL"),e("2.5.29.54","inhibitAnyPolicy"),t("1.3.6.1.4.1.11129.2.4.2","timestampList"),t("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),t("1.3.6.1.5.5.7.3.1","serverAuth"),t("1.3.6.1.5.5.7.3.2","clientAuth"),t("1.3.6.1.5.5.7.3.3","codeSigning"),t("1.3.6.1.5.5.7.3.4","emailProtection"),t("1.3.6.1.5.5.7.3.8","timeStamping"),Hy.exports}var MW;function wn(){if(MW)return Vy.exports;MW=1;var s=St();Jt(),Ma();var A=Vy.exports=s.asn1=s.asn1||{};A.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},A.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},A.maxDepth=256,A.create=function(o,g,a,r,I){if(s.util.isArray(r)){for(var l=[],h=0;h<r.length;++h)r[h]!==void 0&&l.push(r[h]);r=l}var B={tagClass:o,type:g,constructed:a,composed:a||s.util.isArray(r),value:r};return I&&"bitStringContents"in I&&(B.bitStringContents=I.bitStringContents,B.original=A.copy(B)),B},A.copy=function(o,g){var a;if(s.util.isArray(o)){a=[];for(var r=0;r<o.length;++r)a.push(A.copy(o[r],g));return a}return typeof o=="string"?o:(a={tagClass:o.tagClass,type:o.type,constructed:o.constructed,composed:o.composed,value:A.copy(o.value,g)},g&&!g.excludeBitStringContents&&(a.bitStringContents=o.bitStringContents),a)},A.equals=function(o,g,a){if(s.util.isArray(o)){if(!s.util.isArray(g)||o.length!==g.length)return!1;for(var r=0;r<o.length;++r)if(!A.equals(o[r],g[r]))return!1;return!0}if(typeof o!=typeof g)return!1;if(typeof o=="string")return o===g;var I=o.tagClass===g.tagClass&&o.type===g.type&&o.constructed===g.constructed&&o.composed===g.composed&&A.equals(o.value,g.value);return a&&a.includeBitStringContents&&(I=I&&o.bitStringContents===g.bitStringContents),I},A.getBerValueLength=function(o){var g=o.getByte();if(g!==128){var a,r=g&128;return r?a=o.getInt((g&127)<<3):a=g,a}};function t(o,g,a){if(a>g){var r=new Error("Too few bytes to parse DER.");throw r.available=o.length(),r.remaining=g,r.requested=a,r}}var e=function(o,g){var a=o.getByte();if(g--,a!==128){var r,I=a&128;if(!I)r=a;else{var l=a&127;t(o,g,l),r=o.getInt(l<<3)}if(r<0)throw new Error("Negative length: "+r);return r}};A.fromDer=function(o,g){g===void 0&&(g={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof g=="boolean"&&(g={strict:g,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in g||(g.strict=!0),"parseAllBytes"in g||(g.parseAllBytes=!0),"decodeBitStrings"in g||(g.decodeBitStrings=!0),"maxDepth"in g||(g.maxDepth=A.maxDepth),typeof o=="string"&&(o=s.util.createBuffer(o));var a=o.length(),r=i(o,o.length(),0,g);if(g.parseAllBytes&&o.length()!==0){var I=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw I.byteCount=a,I.remaining=o.length(),I}return r};function i(o,g,a,r){if(a>=r.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var I;t(o,g,2);var l=o.getByte();g--;var h=l&192,B=l&31;I=o.length();var E=e(o,g);if(g-=I-o.length(),E!==void 0&&E>g){if(r.strict){var c=new Error("Too few bytes to read ASN.1 value.");throw c.available=o.length(),c.remaining=g,c.requested=E,c}E=g}var Q,C,d=(l&32)===32;if(d)if(Q=[],E===void 0)for(;;){if(t(o,g,2),o.bytes(2)==="\0\0"){o.getBytes(2),g-=2;break}I=o.length(),Q.push(i(o,g,a+1,r)),g-=I-o.length()}else for(;E>0;)I=o.length(),Q.push(i(o,E,a+1,r)),g-=I-o.length(),E-=I-o.length();if(Q===void 0&&h===A.Class.UNIVERSAL&&B===A.Type.BITSTRING&&(C=o.bytes(E)),Q===void 0&&r.decodeBitStrings&&h===A.Class.UNIVERSAL&&B===A.Type.BITSTRING&&E>1){var M=o.read,y=g,w=0;if(B===A.Type.BITSTRING&&(t(o,g,1),w=o.getByte(),g--),w===0)try{I=o.length();var p={strict:!0,decodeBitStrings:!0},D=i(o,g,a+1,p),f=I-o.length();g-=f,B==A.Type.BITSTRING&&f++;var u=D.tagClass;f===E&&(u===A.Class.UNIVERSAL||u===A.Class.CONTEXT_SPECIFIC)&&(Q=[D])}catch{}Q===void 0&&(o.read=M,g=y)}if(Q===void 0){if(E===void 0){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");E=g}if(B===A.Type.BMPSTRING)for(Q="";E>0;E-=2)t(o,g,2),Q+=String.fromCharCode(o.getInt16()),g-=2;else Q=o.getBytes(E),g-=E}var S=C===void 0?null:{bitStringContents:C};return A.create(h,B,d,Q,S)}A.toDer=function(o){var g=s.util.createBuffer(),a=o.tagClass|o.type,r=s.util.createBuffer(),I=!1;if("bitStringContents"in o&&(I=!0,o.original&&(I=A.equals(o,o.original))),I)r.putBytes(o.bitStringContents);else if(o.composed){o.constructed?a|=32:r.putByte(0);for(var l=0;l<o.value.length;++l)o.value[l]!==void 0&&r.putBuffer(A.toDer(o.value[l]))}else if(o.type===A.Type.BMPSTRING)for(var l=0;l<o.value.length;++l)r.putInt16(o.value.charCodeAt(l));else o.type===A.Type.INTEGER&&o.value.length>1&&(o.value.charCodeAt(0)===0&&(o.value.charCodeAt(1)&128)===0||o.value.charCodeAt(0)===255&&(o.value.charCodeAt(1)&128)===128)?r.putBytes(o.value.substr(1)):r.putBytes(o.value);if(g.putByte(a),r.length()<=127)g.putByte(r.length()&127);else{var h=r.length(),B="";do B+=String.fromCharCode(h&255),h=h>>>8;while(h>0);g.putByte(B.length|128);for(var l=B.length-1;l>=0;--l)g.putByte(B.charCodeAt(l))}return g.putBuffer(r),g},A.oidToDer=function(o){var g=o.split("."),a=s.util.createBuffer();a.putByte(40*parseInt(g[0],10)+parseInt(g[1],10));for(var r,I,l,h,B=2;B<g.length;++B){if(r=!0,I=[],l=parseInt(g[B],10),l>4294967295)throw new Error("OID value too large; max is 32-bits.");do h=l&127,l=l>>>7,r||(h|=128),I.push(h),r=!1;while(l>0);for(var E=I.length-1;E>=0;--E)a.putByte(I[E])}return a},A.derToOid=function(o){var g;typeof o=="string"&&(o=s.util.createBuffer(o));var a=o.getByte();g=Math.floor(a/40)+"."+a%40;for(var r=0;o.length()>0;){if(r>70368744177663)throw new Error("OID value too large; max is 53-bits.");a=o.getByte(),r=r*128,a&128?r+=a&127:(g+="."+(r+a),r=0)}return g},A.utcTimeToDate=function(o){var g=new Date,a=parseInt(o.substr(0,2),10);a=a>=50?1900+a:2e3+a;var r=parseInt(o.substr(2,2),10)-1,I=parseInt(o.substr(4,2),10),l=parseInt(o.substr(6,2),10),h=parseInt(o.substr(8,2),10),B=0;if(o.length>11){var E=o.charAt(10),c=10;E!=="+"&&E!=="-"&&(B=parseInt(o.substr(10,2),10),c+=2)}if(g.setUTCFullYear(a,r,I),g.setUTCHours(l,h,B,0),c&&(E=o.charAt(c),E==="+"||E==="-")){var Q=parseInt(o.substr(c+1,2),10),C=parseInt(o.substr(c+4,2),10),d=Q*60+C;d*=6e4,E==="+"?g.setTime(+g-d):g.setTime(+g+d)}return g},A.generalizedTimeToDate=function(o){var g=new Date,a=parseInt(o.substr(0,4),10),r=parseInt(o.substr(4,2),10)-1,I=parseInt(o.substr(6,2),10),l=parseInt(o.substr(8,2),10),h=parseInt(o.substr(10,2),10),B=parseInt(o.substr(12,2),10),E=0,c=0,Q=!1;o.charAt(o.length-1)==="Z"&&(Q=!0);var C=o.length-5,d=o.charAt(C);if(d==="+"||d==="-"){var M=parseInt(o.substr(C+1,2),10),y=parseInt(o.substr(C+4,2),10);c=M*60+y,c*=6e4,d==="+"&&(c*=-1),Q=!0}return o.charAt(14)==="."&&(E=parseFloat(o.substr(14),10)*1e3),Q?(g.setUTCFullYear(a,r,I),g.setUTCHours(l,h,B,E),g.setTime(+g+c)):(g.setFullYear(a,r,I),g.setHours(l,h,B,E)),g},A.dateToUtcTime=function(o){if(typeof o=="string")return o;var g="",a=[];a.push((""+o.getUTCFullYear()).substr(2)),a.push(""+(o.getUTCMonth()+1)),a.push(""+o.getUTCDate()),a.push(""+o.getUTCHours()),a.push(""+o.getUTCMinutes()),a.push(""+o.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(g+="0"),g+=a[r];return g+="Z",g},A.dateToGeneralizedTime=function(o){if(typeof o=="string")return o;var g="",a=[];a.push(""+o.getUTCFullYear()),a.push(""+(o.getUTCMonth()+1)),a.push(""+o.getUTCDate()),a.push(""+o.getUTCHours()),a.push(""+o.getUTCMinutes()),a.push(""+o.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(g+="0"),g+=a[r];return g+="Z",g},A.integerToDer=function(o){var g=s.util.createBuffer();if(o>=-128&&o<128)return g.putSignedInt(o,8);if(o>=-32768&&o<32768)return g.putSignedInt(o,16);if(o>=-8388608&&o<8388608)return g.putSignedInt(o,24);if(o>=-2147483648&&o<2147483648)return g.putSignedInt(o,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=o,a},A.derToInteger=function(o){typeof o=="string"&&(o=s.util.createBuffer(o));var g=o.length()*8;if(g>32)throw new Error("Integer too large; max is 32-bits.");return o.getSignedInt(g)},A.validate=function(o,g,a,r){var I=!1;if((o.tagClass===g.tagClass||typeof g.tagClass>"u")&&(o.type===g.type||typeof g.type>"u"))if(o.constructed===g.constructed||typeof g.constructed>"u"){if(I=!0,g.value&&s.util.isArray(g.value))for(var l=0,h=0;I&&h<g.value.length;++h){var B=g.value[h];I=!!B.optional;var E=o.value[l];if(!E){B.optional||(I=!1,r&&r.push("["+g.name+'] Missing required element. Expected tag class "'+B.tagClass+'", type "'+B.type+'"'));continue}var c=typeof B.tagClass<"u"&&typeof B.type<"u";if(c&&(E.tagClass!==B.tagClass||E.type!==B.type))if(B.optional){I=!0;continue}else{I=!1,r&&r.push("["+g.name+"] Tag mismatch. Expected ("+B.tagClass+","+B.type+"), got ("+E.tagClass+","+E.type+")");break}var Q=A.validate(E,B,a,r);if(Q)++l,I=!0;else if(B.optional)I=!0;else{I=!1;break}}if(I&&a&&(g.capture&&(a[g.capture]=o.value),g.captureAsn1&&(a[g.captureAsn1]=o),g.captureBitStringContents&&"bitStringContents"in o&&(a[g.captureBitStringContents]=o.bitStringContents),g.captureBitStringValue&&"bitStringContents"in o))if(o.bitStringContents.length<2)a[g.captureBitStringValue]="";else{var C=o.bitStringContents.charCodeAt(0);if(C!==0)throw new Error("captureBitStringValue only supported for zero unused bits");a[g.captureBitStringValue]=o.bitStringContents.slice(1)}}else r&&r.push("["+g.name+'] Expected constructed "'+g.constructed+'", got "'+o.constructed+'"');else r&&(o.tagClass!==g.tagClass&&r.push("["+g.name+'] Expected tag class "'+g.tagClass+'", got "'+o.tagClass+'"'),o.type!==g.type&&r.push("["+g.name+'] Expected type "'+g.type+'", got "'+o.type+'"'));return I};var n=/[^\\u0000-\\u00ff]/;return A.prettyPrint=function(o,g,a){var r="";g=g||0,a=a||2,g>0&&(r+=`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as Ei, G as de, P as wt, O as Ee, M as z, V as d, e as Qe, T as Ln, C as Cs, W as Si, a as As, b as We, N as Pi, c as Es, d as it, f as G, Q as De, E as kn, R as fe, g as Ti, h as Bn, B as R, i as Ii, A as Ss, j as U, k as O, I as W, l as ti, m as ii, n as zn, o as Rn, L as Gt, p as Ps, q as Ts, r as Is, s as Vi, D as ae, t as Ui, u as _s, F as Ds, v as me, w as On, x as Fn, y as _i, z as Ls, H as Nn, J as ge, K as ks, U as xt, X as Bs, Y as zs, Z as Rs, _ as Os, $ as Ge, a0 as Wt, a1 as Di, a2 as Z, a3 as le, a4 as Fs, a5 as Ke, a6 as Kt, a7 as qt, a8 as Ne, a9 as Pt, aa as Ns, ab as Hn, ac as gi, ad as at, ae as Hs, af as rt, ag as Vs, ah as Us, ai as Vn, aj as jt, ak as bt, al as Yt, am as Gs, an as Gi, ao as lt, ap as Ct, aq as At, ar as Ws, as as Ks, at as Wi, au as qs, av as js, aw as Ys, ax as Xs, ay as Qs, az as $s, aA as Zs, aB as Js, aC as Ki, aD as eo, aE as to, aF as fi, aG as qe, aH as io, aI as no, aJ as so, aK as oo, aL as ro, aM as ao, aN as lo } from "./three-vendor-CKzI3UEa.js";
|
|
2
|
-
import { W as pe, C as co, L as mt, B as qi, g as Le, a as ho, E as uo, r as po } from "./sdk-runtime-
|
|
2
|
+
import { W as pe, C as co, L as mt, B as qi, g as Le, a as ho, E as uo, r as po } from "./sdk-runtime-BYjLeg5n.js";
|
|
3
3
|
import { r as ee, g as mo } from "./sdk-assets-DWhsnp7n.js";
|
|
4
4
|
import { a as Xt, J as yi, c as go, b as fo, P as ni, q as yo, k as Mo, n as ji, E as Yi, S as vo } from "./sdk-vendor-DYgn7sFs.js";
|
|
5
5
|
class wo {
|
|
@@ -15970,7 +15970,7 @@ class oc {
|
|
|
15970
15970
|
return;
|
|
15971
15971
|
}
|
|
15972
15972
|
const i = te(e.instance.points[0]), n = this.worldToScreen.worldToScreenIfVisible(i);
|
|
15973
|
-
if (!n
|
|
15973
|
+
if (!n) {
|
|
15974
15974
|
t.style.display = "none";
|
|
15975
15975
|
return;
|
|
15976
15976
|
}
|