@realsee/dnalogel 2.5.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.js +3 -2
- package/dist/index.umd.js +1 -1
- package/docs/classes/CSS3DRender.html +31 -31
- package/docs/classes/CruisePluginController.html +24 -24
- package/docs/classes/Magnifier.html +20 -20
- package/docs/classes/ModelRoomLabelController.html +11 -11
- package/docs/classes/Object3DHelperController.html +24 -24
- package/docs/classes/PaintBrush.html +15 -15
- package/docs/classes/PanoMeasurePluginLine.html +23 -23
- package/docs/classes/PanoMeasurePluginModel.html +22 -22
- package/docs/classes/PanoMeasurePluginPoint.html +14 -14
- package/docs/classes/PanoMeasurePluginPolyline.html +26 -26
- package/docs/classes/PanoTagPluginController.html +41 -41
- package/docs/classes/Util.BetterTween.html +8 -8
- package/docs/classes/Util.FivePointSelector.html +12 -12
- package/docs/classes/Util.Interval.html +12 -12
- package/docs/classes/Util.Magnifier.html +17 -17
- package/docs/classes/Util.PointDomHelper.html +11 -11
- package/docs/classes/Util.PointHelper.html +11 -11
- package/docs/classes/Util.Rectangle.html +13 -13
- package/docs/enums/CameraMovementEffect.html +7 -7
- package/docs/enums/ContentType.html +16 -16
- package/docs/enums/DIRECTION.html +9 -9
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +9 -9
- package/docs/enums/DimensionType.html +7 -7
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +8 -8
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +9 -9
- package/docs/enums/PaintBrushTypeEnum.html +8 -8
- package/docs/enums/PointType.html +7 -7
- package/docs/enums/Rotation.html +8 -8
- package/docs/functions/CSS3DRenderPlugin.html +4 -4
- package/docs/functions/CameraMovementPlugin.html +4 -4
- package/docs/functions/CruisePlugin.html +4 -4
- package/docs/functions/GuideLinePlugin.html +5 -5
- package/docs/functions/ItemLabelPlugin.html +4 -4
- package/docs/functions/MapviewFloorplanPlugin.html +4 -4
- package/docs/functions/ModelChassisCompassPlugin.html +4 -4
- package/docs/functions/ModelEntryDoorGuidePlugin.html +4 -4
- package/docs/functions/ModelFloorplanPlugin.html +4 -4
- package/docs/functions/ModelItemLabelPlugin.html +4 -4
- package/docs/functions/ModelRoomLabelPlugin.html +4 -4
- package/docs/functions/ModelTVVideoPlugin.html +4 -4
- package/docs/functions/ModelViewPlugin.html +4 -4
- package/docs/functions/Object3DHelperPlugin.html +4 -4
- package/docs/functions/PanoCompassPlugin.html +4 -4
- package/docs/functions/PanoCursorRaycasterPlugin.html +4 -4
- package/docs/functions/PanoDoorLabelPlugin.html +4 -4
- package/docs/functions/PanoFloorplanRadarPlugin.html +4 -4
- package/docs/functions/PanoMeasurePlugin.html +4 -4
- package/docs/functions/PanoRulerPlugin.html +4 -4
- package/docs/functions/PanoRulerProPlugin.html +4 -4
- package/docs/functions/PanoSpatialTagPlugin.html +4 -4
- package/docs/functions/PanoTagPlugin.html +4 -4
- package/docs/functions/TopviewFloorplanPlugin.html +4 -4
- package/docs/functions/Util.getCoordsFromClient.html +5 -5
- package/docs/functions/Util.getCoordsFromElement.html +5 -5
- package/docs/functions/Util.getFrameTime.html +5 -5
- package/docs/functions/Util.getIntersectFromRelativePosition.html +5 -5
- package/docs/functions/Util.getRaycasterFromFivePointer.html +5 -5
- package/docs/functions/Util.isNil.html +5 -5
- package/docs/functions/Util.nextFrame.html +5 -5
- package/docs/functions/Util.notNil.html +5 -5
- package/docs/functions/Util.requestAnimationFrameInterval.html +5 -5
- package/docs/functions/Util.tweenProgress.html +5 -5
- package/docs/functions/pluginFlag.html +5 -5
- package/docs/index.html +4 -4
- package/docs/interfaces/AddTagConfig.html +6 -6
- package/docs/interfaces/CSS3DRenderPluginEventMap.html +11 -11
- package/docs/interfaces/CSS3DRenderPluginState.html +8 -8
- package/docs/interfaces/CameraMovementPluginExportType.html +7 -7
- package/docs/interfaces/EventMap.html +15 -15
- package/docs/interfaces/FloorplanBounding.html +8 -8
- package/docs/interfaces/FloorplanData.html +10 -10
- package/docs/interfaces/FloorplanEntrance.html +11 -11
- package/docs/interfaces/FloorplanExtraObject.html +10 -10
- package/docs/interfaces/FloorplanExtraObject3D.html +8 -8
- package/docs/interfaces/FloorplanFloorData.html +9 -9
- package/docs/interfaces/FloorplanImagePosition.html +7 -7
- package/docs/interfaces/FloorplanObserver.html +9 -9
- package/docs/interfaces/FloorplanOutlineItem.html +9 -9
- package/docs/interfaces/FloorplanPosition.html +7 -7
- package/docs/interfaces/FloorplanRoomItem.html +13 -13
- package/docs/interfaces/FloorplanRoomLabelItem.html +7 -7
- package/docs/interfaces/FloorplanServerBounding.html +8 -8
- package/docs/interfaces/FloorplanServerComputedData.html +10 -10
- package/docs/interfaces/FloorplanServerData.html +7 -7
- package/docs/interfaces/FloorplanServerDoorItem.html +10 -10
- package/docs/interfaces/FloorplanServerDoorPosition.html +8 -8
- package/docs/interfaces/FloorplanServerEntrance.html +11 -11
- package/docs/interfaces/FloorplanServerFloorData.html +9 -9
- package/docs/interfaces/FloorplanServerImagePosition.html +7 -7
- package/docs/interfaces/FloorplanServerObserver.html +9 -9
- package/docs/interfaces/FloorplanServerOutlineItem.html +9 -9
- package/docs/interfaces/FloorplanServerPosition.html +7 -7
- package/docs/interfaces/FloorplanServerRoomItem.html +14 -14
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +7 -7
- package/docs/interfaces/ItemLabelPluginData.html +6 -6
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +11 -11
- package/docs/interfaces/ItemLabelPluginParametersType.html +9 -9
- package/docs/interfaces/MinMax.html +7 -7
- package/docs/interfaces/ModelChassisCompassPluginData.html +7 -7
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +8 -8
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +7 -7
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +8 -8
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +8 -8
- package/docs/interfaces/ModelItemLabelPluginData.html +6 -6
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +11 -11
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +7 -7
- package/docs/interfaces/ModelRoomLabelPluginData.html +6 -6
- package/docs/interfaces/ModelTVVideoPluginData.html +9 -9
- package/docs/interfaces/ModelTVVideoPluginExportType.html +8 -8
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +6 -6
- package/docs/interfaces/ModelViewPluginExportType.html +11 -11
- package/docs/interfaces/Object3DHelperState.html +8 -8
- package/docs/interfaces/PaintBrushAction.html +12 -12
- package/docs/interfaces/PaintBrushConfigs.html +12 -12
- package/docs/interfaces/PaintBrushState.html +10 -10
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +10 -10
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +5 -5
- package/docs/interfaces/PanoMeasureParameterType.html +12 -12
- package/docs/interfaces/PanoMeasurePluginLineJson.html +8 -8
- package/docs/interfaces/PanoMeasurePluginOpenParameter.html +7 -7
- package/docs/interfaces/PanoMeasurePluginPointJson.html +7 -7
- package/docs/interfaces/PanoMeasurePluginPolylineJson.html +8 -8
- package/docs/interfaces/PanoRulerPluginExportType.html +10 -10
- package/docs/interfaces/PanoRulerPluginOptions.html +7 -7
- package/docs/interfaces/PanoRulerPluginParameterType.html +8 -8
- package/docs/interfaces/PanoRulerProPluginExportType.html +9 -9
- package/docs/interfaces/PanoRulerProPluginOptions.html +7 -7
- package/docs/interfaces/PanoRulerProPluginParameterType.html +7 -7
- package/docs/interfaces/PanoRulerProPluginState.html +8 -8
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +5 -5
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +5 -5
- package/docs/interfaces/PanoSpatialTagPluginData.html +11 -11
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +10 -10
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +13 -13
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +10 -10
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +13 -13
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +11 -11
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +10 -10
- package/docs/interfaces/Point.html +8 -8
- package/docs/interfaces/Room.html +9 -9
- package/docs/interfaces/RoomInfo.html +7 -7
- package/docs/interfaces/RoomLabel.html +14 -14
- package/docs/interfaces/RoomRules.html +5 -5
- package/docs/interfaces/Rooms.html +5 -5
- package/docs/interfaces/Scissor.html +9 -9
- package/docs/interfaces/State.html +8 -8
- package/docs/interfaces/TagCache.html +10 -10
- package/docs/interfaces/TagConfig.html +10 -10
- package/docs/interfaces/TagIconUrl.html +9 -9
- package/docs/interfaces/Tags.html +9 -9
- package/docs/interfaces/TemporaryState.html +6 -6
- package/docs/interfaces/Util.MagnifierParameter.html +11 -11
- package/docs/interfaces/Util.MouseGroupParameter.html +8 -8
- package/docs/modules/Util.html +5 -5
- package/docs/modules.html +4 -4
- package/docs/types/ArrayPosition.html +5 -5
- package/docs/types/AudioAppearance.html +5 -5
- package/docs/types/AudioTagTypeConfigKey.html +5 -5
- package/docs/types/CSS3DRenderExportType.html +5 -5
- package/docs/types/CSS3DRenderPluginExportType.html +5 -5
- package/docs/types/CSS3DRenderPluginParameterType.html +5 -5
- package/docs/types/Color.html +5 -5
- package/docs/types/ContentTypeConfigKey.html +5 -5
- package/docs/types/ContentTypeConfigKeySplit.html +5 -5
- package/docs/types/ContentTypeMap.html +5 -5
- package/docs/types/Create3DDomContainerReturnType.html +5 -5
- package/docs/types/Create3DElementReturnType.html +5 -5
- package/docs/types/CruisePluginExportType.html +5 -5
- package/docs/types/Direction-1.html +5 -5
- package/docs/types/Direction4.html +5 -5
- package/docs/types/FloorplanRuleLabels.html +5 -5
- package/docs/types/FloorplanServerRuleLabels.html +5 -5
- package/docs/types/GuideLinePluginExportType.html +5 -5
- package/docs/types/HelperEventMap.html +5 -5
- package/docs/types/LoadTagConfig.html +5 -5
- package/docs/types/MapviewFloorplanPluginParameterType.html +5 -5
- package/docs/types/MapviewFloorplanPluginReturnType.html +5 -5
- package/docs/types/MediaData.html +5 -5
- package/docs/types/MediaStore.html +5 -5
- package/docs/types/ModelEntryDoorGuidePluginParameterType.html +5 -5
- package/docs/types/ModelFloorplanPluginParameterType.html +5 -5
- package/docs/types/ModelFloorplanPluginReturnType.html +5 -5
- package/docs/types/ModelRoomLabelPluginParameters.html +5 -5
- package/docs/types/ModelRoomLabelPluginReturnType.html +5 -5
- package/docs/types/MoveArgs.html +5 -5
- package/docs/types/MoveOpts.html +5 -5
- package/docs/types/Object3DHelperEventMap.html +5 -5
- package/docs/types/ObjectFit.html +5 -5
- package/docs/types/PaintBrushEventMap.html +5 -5
- package/docs/types/PanoCompassPluginData.html +5 -5
- package/docs/types/PanoCompassPluginExportType.html +5 -5
- package/docs/types/PanoCompassPluginParameterType.html +5 -5
- package/docs/types/PanoFloorplanRadarPluginParameterType.html +5 -5
- package/docs/types/PanoFloorplanRadarPluginReturnType.html +5 -5
- package/docs/types/PanoIndex.html +5 -5
- package/docs/types/PanoMeasurePluginEvent.html +5 -5
- package/docs/types/PanoMeasureReturnType.html +5 -5
- package/docs/types/PanoSpatialTagPluginId.html +5 -5
- package/docs/types/PanoTagPluginExportInterface.html +5 -5
- package/docs/types/PanoTagPluginParamsInterface.html +5 -5
- package/docs/types/PlaneTag.html +5 -5
- package/docs/types/PlaneTagElement.html +5 -5
- package/docs/types/Point2DElement.html +5 -5
- package/docs/types/Point2DTag.html +5 -5
- package/docs/types/Point3DElement.html +5 -5
- package/docs/types/Point3DTag.html +5 -5
- package/docs/types/PointTag.html +5 -5
- package/docs/types/PointTagElement.html +5 -5
- package/docs/types/Position.html +5 -5
- package/docs/types/RotateArgs.html +5 -5
- package/docs/types/RotateOpts.html +5 -5
- package/docs/types/RuleLabelsKey.html +5 -5
- package/docs/types/RuleLabelsValue.html +5 -5
- package/docs/types/StickType.html +5 -5
- package/docs/types/Tag.html +5 -5
- package/docs/types/Tag2D.html +5 -5
- package/docs/types/Tag3D.html +5 -5
- package/docs/types/TagContentType.html +5 -5
- package/docs/types/TagDimensionType.html +5 -5
- package/docs/types/TagElement.html +5 -5
- package/docs/types/TagEvents.html +5 -5
- package/docs/types/TagHooks.html +5 -5
- package/docs/types/TagIconSize.html +5 -5
- package/docs/types/TagId.html +5 -5
- package/docs/types/TagPointType.html +5 -5
- package/docs/types/TopviewFloorplanPluginParameterType.html +5 -5
- package/docs/types/TopviewFloorplanPluginReturnType.html +5 -5
- package/docs/types/WorkCode.html +5 -5
- package/docs/variables/FLOOR_TYPE_MAP.html +5 -5
- package/docs/variables/PLUGIN.html +5 -5
- package/docs/variables/ROOM_FETILE_TYPE_MAP.html +5 -5
- package/docs/variables/ROOM_TYPE_MAP.html +5 -5
- package/docs/variables/VERSION.html +5 -5
- package/docs/variables/itemLabelPluginServerParams.html +5 -5
- package/docs/variables/modelItemLabelPluginServerParams.html +5 -5
- package/docs/variables/modelRoomLabelPluginServerParams.html +5 -5
- package/libs/PanoMeasurePlugin/Controller/ViewController.js +25 -24
- package/package.json +1 -1
- package/libs/PanoTagPlugin/mocks/v1/mock-80P6A03eQRQKY3oqLj.d.ts +0 -4
- package/libs/PanoTagPlugin/mocks/v1/mock-80P6A03eQRQKY3oqLj.js +0 -6
- package/libs/PanoTagPlugin/mocks/v1/mock-80QG2vMPboNv5DWrom.d.ts +0 -93
- package/libs/PanoTagPlugin/mocks/v1/mock-80QG2vMPboNv5DWrom.js +0 -5622
- package/libs/PanoTagPlugin/mocks/v1/mock-test3-realsee-cn-4zr0A5.js +0 -1325
- package/libs/PanoTagPlugin/mocks/v1/mock1.d.ts +0 -173
- package/libs/PanoTagPlugin/mocks/v1/mock1.js +0 -122
- package/libs/PanoTagPlugin/mocks/v1/mock2.d.ts +0 -233
- package/libs/PanoTagPlugin/mocks/v1/mock2.js +0 -296
- package/libs/PanoTagPlugin/mocks/v1/mock3.d.ts +0 -22
- package/libs/PanoTagPlugin/mocks/v1/mock3.js +0 -32
- package/libs/PanoTagPlugin/mocks/v1/mock4.d.ts +0 -56
- package/libs/PanoTagPlugin/mocks/v1/mock4.js +0 -60
- package/libs/PanoTagPlugin/mocks/v1/mock5.d.ts +0 -13
- package/libs/PanoTagPlugin/mocks/v1/mock5.js +0 -17
- package/libs/PanoTagPlugin/mocks/v1/mock6.d.ts +0 -16
- package/libs/PanoTagPlugin/mocks/v1/mock6.js +0 -27
- package/libs/PanoTagPlugin/mocks/v1/mock7.d.ts +0 -22
- package/libs/PanoTagPlugin/mocks/v1/mock7.js +0 -228
package/dist/index.cjs.js
CHANGED
|
@@ -205,7 +205,7 @@ transition: all 500ms;
|
|
|
205
205
|
<div class="PanoRulerPlugin-rule-label-name">${e.options.distanceText(g)}</div>
|
|
206
206
|
</div>
|
|
207
207
|
</div>
|
|
208
|
-
`,w=document.createElement("div");return w.setAttribute("class","PanoRulerPlugin-rule"),w.setAttribute("data-name",A),w.setAttribute("style","display: none"),w.innerHTML=v,w},o=document.createElement("div");o.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;");const s=document.createElement("div");s.innerHTML=uf,o.appendChild(s);const r={},a=(A,g)=>{if(e.loaded)throw new Error("\u6807\u5C3A\u88AB\u91CD\u590D\u521D\u59CB\u5316\uFF01");const v=hf(A,i),w=i.work;if(!w)return!1;for(const y in g){const P=g[y],{standingPosition:I}=w.observers[0],C=P.map(({x:L,z:D,observers:B})=>{const N=B.length>0?A.rooms[A.observers[B[0]]].name:"",F=v[N]?v[N].floor:null;let X=1/0,j={index:0,x:I.x,y:I.y,z:I.z};B.forEach(_=>{if(!w.observers[_])return;const{standingPosition:J}=w.observers[_],de={index:_,x:J.x,y:J.y,z:J.z},ue=ff({x:L,z:D},de);F?ue<X&&Math.abs(de.y-F)<.3&&(X=ue,j=de):ue<X&&(X=ue,j=de)});const E=new H.Vector3(L,j.y,D);Object.assign(E,{observers:B});const R=v[N]?v[N].roof:null,O=R?new H.Vector3(L,R,D):null;return O&&Object.assign(O,{observers:B}),{origin:E,vertical:O}});r[y]={origins:C.map(L=>L.origin),rules:[]};for(const{origin:L,vertical:D}of C){if(!D)continue;const B=n(y,L.distanceTo(D));o.append(B),r[y].rules.push({vertical:!0,rule:[L,D],$element:B})}for(let L=0;L<C.length;L++){let D=L+1;D>=C.length&&(D=0);const{origin:B}=C[L],{origin:N}=C[D],F=n(y,B.distanceTo(N));o.append(F),r[y].rules.push({vertical:!1,rule:[B,N],$element:F})}}return e.loaded=!0,!0},l=(A,g,v)=>Y(exports,null,function*(){const w=A||t.roomInfo,y=g||t.roomRules;if(!w||!y)throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");return e.loaded=!1,e.options=G(G({},e.options),v||{}),i.model.loaded?a(w,y):yield new Promise(P=>i.once("modelLoaded",()=>P(a(w,y))))});t.roomInfo&&t.roomRules&&l(t.roomInfo,t.roomRules);const c=(A,g,v,w)=>{const y=[[{x:0,y:0},{x:v,y:0}],[{x:0,y:0},{x:0,y:w}],[{x:v,y:0},{x:v,y:w}],[{x:0,y:w},{x:v,y:w}]],P=[];for(let I=0;I<y.length;I++){const C=Ma([A,g],[y[I][0],y[I][1]],!0);C&&P.push(C)}return P.length===0?!1:P},d=()=>{var B;const A=(B=i.getElement())==null?void 0:B.parentElement;if(!A||!e.loaded||Object.keys(r).length<=0)return;const{panoIndex:g,camera:v,currentMode:w}=i;if(g===void 0)return;let y;for(const N in r)N.split(",").indexOf(g.toString())>=0&&(y=N);if(!y){for(const N in r)for(const{$element:F}of r[N].rules)F.style.display="none";return}const P=v.position,I=v.getWorldDirection(new H.Vector3),C=A.clientWidth,L=A.clientHeight;if(w!==be.Five.Mode.Panorama){for(const N in r)for(const{$element:F}of r[N].rules)F.style.display="none";return}for(const N in r)for(const{$element:F}of r[N].rules)F.style.display=N===y?"block":"none";const[D]=r[y].origins.slice().filter(N=>N.observers.indexOf(g)>=0).sort((N,F)=>{const X=N.clone().setY(0).sub(P).normalize().angleTo(I.clone().setY(0)),j=F.clone().setY(0).sub(P).normalize().angleTo(I.clone().setY(0));return X-j});for(const{rule:N,vertical:F,$element:X}of r[y].rules){const[j,E]=N,R=X.querySelector(".PanoRulerPlugin-rule-line");if(!R)return;if(!D){X.style.display="none";continue}if(j!==D&&E!==D){X.style.display="none";continue}if(j.distanceTo(E)<.3){X.style.display="none";continue}if(j.observers.indexOf(g)===-1||E.observers.indexOf(g)===-1){X.style.display="none";continue}if(j.clone().sub(P).normalize().angleTo(I)>Math.PI/2){X.style.display="none";continue}if(E.clone().sub(P).normalize().angleTo(I)>Math.PI/2){X.style.display="none";continue}const U=j.distanceTo(E);if(E.clone().sub(E.clone().sub(j).divide(new H.Vector3(2,2,2))).distanceTo(P)/U>8){X.style.display="none";continue}const de=j.clone().project(v),ue=(de.x+1)/2*C,me=(-de.y+1)/2*L,Pe=E.clone().project(v),Me=(Pe.x+1)/2*C,Re=(-Pe.y+1)/2*L,ae=Math.sqrt(Math.pow(Me-ue,2)+Math.pow(Re-me,2));let ve=ae,Ce=50;const ce=c({x:~~ue,y:~~me},{x:~~Me,y:~~Re},C,L);if(ce&&ce.length===1&&(D===j?(ve=Math.sqrt(Math.pow(ce[0].x-ue,2)+Math.pow(ce[0].y-me,2)),Ce=ve/ae*50):D===E&&(ve=Math.sqrt(Math.pow(ce[0].x-Me,2)+Math.pow(ce[0].y-Re,2)),Ce=100-ve/ae*50)),ce&&ce.length===2){const ut={x:(ce[0].x+ce[1].x)/2,y:(ce[0].y+ce[1].y)/2};Ce=Math.sqrt(Math.pow(ut.x-ue,2)+Math.pow(ut.y-me,2))/ae*100}const kt=(Math.PI/2-Math.atan2(Me-ue,me-Re))/Math.PI*180,ge=R.querySelector(".PanoRulerPlugin-rule-label"),dt=ge.children[0].clientWidth;dt>=ae||dt/2>=Ce/100*ae||dt/2>=(1-Ce/100)*ae?R.style.display="none":(R.style.display="block",R.style.width=ae+"px",R.style.left=ue+"px",R.style.top=me+"px",R.style.transform=`rotate(${-kt}deg)`,ge.style.left=`${Ce}%`)}},f=()=>za(d),u=()=>{var A,g;return e.loaded?(e.enable||(o.setAttribute("class","PanoRulerPlugin"+(e.options.className?" "+e.options.className:"")),(g=(A=i.getElement())==null?void 0:A.parentElement)==null||g.append(o),d(),i.on("modeChange",d),i.on("cameraUpdate",f),e.enable=!0),!0):!1},h=()=>(e.enable&&(i.off("modeChange",d),i.off("cameraUpdate",f),o&&o.remove(),e.enable=!1),!0);function p(A){if(A.distanceText&&A.distanceText!==e.options.distanceText){const g=A.distanceText;e.options.distanceText=g,Object.values(r).forEach(v=>{v.rules.forEach(w=>{const[y,P]=w.rule,I=y.distanceTo(P),C=w.$element.querySelector(".PanoRulerPlugin-rule-label-name");!C||(C.innerText=g(I))})})}}return{enable:u,disable:h,load:l,state:e,changeConfigs:p}};function pf(i){le(i,"svelte-1h27ktp",".PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp{position:absolute;transform-origin:left 0.0625rem;width:0;height:0.125rem;pointer-events:none}.PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp::after{content:'';position:absolute;left:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-1h27ktp-viewport-rule-point 0.1s 1s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp::before{content:'';position:absolute;right:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-1h27ktp-viewport-rule-point 0.1s 1.5s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-1h27ktp em.svelte-1h27ktp{display:block;height:0.0625rem;animation:svelte-1h27ktp-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;box-shadow:0 0 0.25rem rgb(0 0 0 / 40%);position:relative}.rule-mixed-line.svelte-1h27ktp.svelte-1h27ktp{display:flex;height:0.0625rem;animation:svelte-1h27ktp-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;align-items:center}.em-solid.svelte-1h27ktp.svelte-1h27ktp{height:100%;background:#ffffff}.em-dotted.svelte-1h27ktp.svelte-1h27ktp{height:0.125rem;background:var(--background-image);background-position:center;background-repeat:repeat}.PanoRulerPlugin-rule-label.svelte-1h27ktp.svelte-1h27ktp{position:absolute;width:0;height:0;top:0.0625rem;pointer-events:none}.PanoRulerPlugin-rule-label-name.svelte-1h27ktp.svelte-1h27ktp{position:absolute;padding:0.1875rem 0.375rem;background:rgba(195, 195, 195, 0.3);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem);border-radius:6.25rem;border:0.0625rem solid rgba(255, 255, 255, 0.6);white-space:nowrap;overflow:hidden;color:#ffffff;font-weight:500;font-size:0.75rem;line-height:1;animation:svelte-1h27ktp-viewport-rule-label 0.25s ease 1s;animation-fill-mode:both;box-shadow:inset 0 0 0.625rem 0 rgba(255, 255, 255, 0.3)}@keyframes svelte-1h27ktp-viewport-rule-line{0%{width:0%}100%{width:100%}}@keyframes svelte-1h27ktp-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@keyframes svelte-1h27ktp-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}")}function fs(i,t,e){const n=i.slice();return n[6]=t[e],n}function gf(i){let t,e=i[0].children,n=[];for(let o=0;o<e.length;o+=1)n[o]=hs(fs(i,e,o));return{c(){t=V("div");for(let o=0;o<n.length;o+=1)n[o].c();b(t,"class","rule-mixed-line svelte-1h27ktp")},m(o,s){z(o,t,s);for(let r=0;r<n.length;r+=1)n[r].m(t,null)},p(o,s){if(s&9){e=o[0].children;let r;for(r=0;r<e.length;r+=1){const a=fs(o,e,r);n[r]?n[r].p(a,s):(n[r]=hs(a),n[r].c(),n[r].m(t,null))}for(;r<n.length;r+=1)n[r].d(1);n.length=e.length}},d(o){o&&M(t),lt(n,o)}}}function Af(i){let t,e;return{c(){t=V("em"),b(t,"class",e=je(i[0].state?"em-solid":"em-dotted")+" svelte-1h27ktp"),b(t,"style",i[3])},m(n,o){z(n,t,o)},p(n,o){o&1&&e!==(e=je(n[0].state?"em-solid":"em-dotted")+" svelte-1h27ktp")&&b(t,"class",e),o&8&&b(t,"style",n[3])},d(n){n&&M(t)}}}function hs(i){let t,e,n=`${i[6].width}px`;return{c(){t=V("div"),b(t,"class",e=je(i[6].state?"em-solid":"em-dotted")+" svelte-1h27ktp"),b(t,"style",i[3]),T(t,"width",n)},m(o,s){z(o,t,s)},p(o,s){s&1&&e!==(e=je(o[6].state?"em-solid":"em-dotted")+" svelte-1h27ktp")&&b(t,"class",e),s&8&&b(t,"style",o[3]),s&1&&n!==(n=`${o[6].width}px`)&&T(t,"width",n)},d(o){o&&M(t)}}}function vf(i){let t,e,n,o,s=i[0].labelElement+"",r,a,l=`${i[0].labelOffset}%`,c=`${i[0].width}px`,d=`${i[0].left}px`,f=`${i[0].top}px`,u=`rotate(${i[0].rotateDeg}deg)`;function h(g,v){return g[0].children.length===0?Af:gf}let p=h(i),A=p(i);return{c(){t=V("div"),A.c(),e=ee(),n=V("div"),o=V("div"),r=Ee(s),b(o,"class","PanoRulerPlugin-rule-label-name svelte-1h27ktp"),De(()=>i[4].call(o)),b(n,"class","PanoRulerPlugin-rule-label svelte-1h27ktp"),T(n,"left",l),b(t,"class","PanoRulerPlugin-rule-line svelte-1h27ktp"),T(t,"width",c),T(t,"left",d),T(t,"top",f),T(t,"transform",u),T(t,"display",i[0].visible&&i[2]?"block":"none")},m(g,v){z(g,t,v),A.m(t,null),Q(t,e),Q(t,n),Q(n,o),Q(o,r),a=Et(o,i[4].bind(o))},p(g,[v]){p===(p=h(g))&&A?A.p(g,v):(A.d(1),A=p(g),A&&(A.c(),A.m(t,e))),v&1&&s!==(s=g[0].labelElement+"")&&xe(r,s),v&1&&l!==(l=`${g[0].labelOffset}%`)&&T(n,"left",l),v&1&&c!==(c=`${g[0].width}px`)&&T(t,"width",c),v&1&&d!==(d=`${g[0].left}px`)&&T(t,"left",d),v&1&&f!==(f=`${g[0].top}px`)&&T(t,"top",f),v&1&&u!==(u=`rotate(${g[0].rotateDeg}deg)`)&&T(t,"transform",u),v&5&&T(t,"display",g[0].visible&&g[2]?"block":"none")},i:Z,o:Z,d(g){g&&M(t),A.d(),a()}}}function bf(i,t,e){let n,{rulerItemProp:o}=t,s=!0,r,a="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGZpbHRlciBpZD0icHJlZml4X19hIiBoZWlnaHQ9IjQwMCUiIHdpZHRoPSIxMzcuNCUiIHg9Ii0xOC43JSIgeT0iLTE1MCUiPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0iZGlsYXRlIiByYWRpdXM9Ii41IiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSIvPjxmZU9mZnNldCBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiByYWRpdXM9IjEiIHJlc3VsdD0ic2hhZG93SW5uZXIiLz48ZmVPZmZzZXQgaW49InNoYWRvd0lubmVyIiByZXN1bHQ9InNoYWRvd0lubmVyIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIGluMj0ic2hhZG93SW5uZXIiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIuNSIvPjxmZUNvbG9yTWF0cml4IGluPSJzaGFkb3dCbHVyT3V0ZXIxIiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMiAwIi8+PC9maWx0ZXI+PHBhdGggaWQ9InByZWZpeF9fYiIgZD0iTS44ODkgMkgxMS41OCIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1kYXNoYXJyYXk9IjUgNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIGZpbGw9IiMwMDAiIGZpbHRlcj0idXJsKCNwcmVmaXhfX2EpIiB4bGluazpocmVmPSIjcHJlZml4X19iIi8+PHVzZSBzdHJva2U9IiNmZmYiIHN0cm9rZS1vcGFjaXR5PSIuNCIgeGxpbms6aHJlZj0iI3ByZWZpeF9fYiIvPjwvZz48L3N2Zz4=";function l(){r=this.offsetWidth,e(1,r)}return i.$$set=c=>{"rulerItemProp"in c&&e(0,o=c.rulerItemProp)},i.$$.update=()=>{i.$$.dirty&3&&(r>=o.width||r/2>=o.labelOffset/100*o.width||r/2>=(1-o.labelOffset/100)*o.width?e(2,s=!1):e(2,s=!0))},e(3,n=`--background-image: url(${a})`),[o,r,s,n,l]}class yf extends oe{constructor(t){super(),ie(this,t,bf,vf,ne,{rulerItemProp:0},pf)}}function ms(i,t,e){const n=i.slice();return n[12]=t[e],n}function ps(i){let t,e;return t=new yf({props:{rulerItemProp:i[12]}}),{c(){$(t.$$.fragment)},m(n,o){q(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.rulerItemProp=n[12]),t.$set(s)},i(n){e||(k(t.$$.fragment,n),e=!0)},o(n){S(t.$$.fragment,n),e=!1},d(n){K(t,n)}}}function wf(i){let t,e,n=i[0],o=[];for(let r=0;r<n.length;r+=1)o[r]=ps(ms(i,n,r));const s=r=>S(o[r],1,1,()=>{o[r]=null});return{c(){t=V("div");for(let r=0;r<o.length;r+=1)o[r].c()},m(r,a){z(r,t,a);for(let l=0;l<o.length;l+=1)o[l].m(t,null);e=!0},p(r,[a]){if(a&1){n=r[0];let l;for(l=0;l<n.length;l+=1){const c=ms(r,n,l);o[l]?(o[l].p(c,a),k(o[l],1)):(o[l]=ps(c),o[l].c(),k(o[l],1),o[l].m(t,null))}for(se(),l=n.length;l<o.length;l+=1)s(l);re()}},i(r){if(!e){for(let a=0;a<n.length;a+=1)k(o[a]);e=!0}},o(r){o=o.filter(Boolean);for(let a=0;a<o.length;a+=1)S(o[a]);e=!1},d(r){r&&M(t),lt(o,r)}}}function Cf(i,t,e){var A,g,v,w;let{five:n}=t,{rulerDatas:o}=t,{options:s}=t,r=[];const a=((g=(A=n.getElement())==null?void 0:A.parentElement)==null?void 0:g.clientWidth)||0,l=((w=(v=n.getElement())==null?void 0:v.parentElement)==null?void 0:w.clientHeight)||0,c=(y,P)=>{const I=[[{x:0,y:0},{x:a,y:0}],[{x:0,y:0},{x:0,y:l}],[{x:a,y:0},{x:a,y:l}],[{x:0,y:l},{x:a,y:l}]],C=[];for(let L=0;L<I.length;L++){const D=Ma([y,P],[I[L][0],I[L][1]],!0);D&&C.push(D)}return C.length===0?!1:C},d=(y,P)=>{const I=y.clone().project(n.camera),C=(I.x+1)/2*a,L=(-I.y+1)/2*l,D=P.clone().project(n.camera),B=(D.x+1)/2*a,N=(-D.y+1)/2*l,F=Math.sqrt(Math.pow(B-C,2)+Math.pow(N-L,2));return{startLeft:C,startTop:L,endLeft:B,endTop:N,distance:F}},f=(y,P,I)=>{const C=n.camera.position,L=n.camera.getWorldDirection(new H.Vector3),D=y.clone().sub(C).normalize().angleTo(L),B=P.clone().sub(C).normalize().angleTo(L),N=y.distanceTo(P),X=P.clone().sub(P.clone().sub(y).divide(new H.Vector3(2,2,2))).distanceTo(C),{startLeft:j,startTop:E,endLeft:R,endTop:O,distance:W}=d(y,P),_=-((Math.PI/2-Math.atan2(R-j,E-O))/Math.PI)*180;let J=!0;I||(J=!1),!Je(y,I)&&!Je(P,I)&&(J=!1),N<.3&&(J=!1),D>Math.PI/2&&(J=!1),B>Math.PI/2&&(J=!1),X/N>8&&(J=!1);let de=50,ue=W;const me=c({x:~~j,y:~~E},{x:~~R,y:~~O});if(me&&me.length===1&&(Je(y,I)?(ue=Math.sqrt(Math.pow(me[0].x-j,2)+Math.pow(me[0].y-E,2)),de=ue/W*50):Je(P,I)&&(ue=Math.sqrt(Math.pow(me[0].x-R,2)+Math.pow(me[0].y-O,2)),de=100-ue/W*50)),me&&me.length===2){const Pe={x:(me[0].x+me[1].x)/2,y:(me[0].y+me[1].y)/2};de=Math.sqrt(Math.pow(Pe.x-j,2)+Math.pow(Pe.y-E,2))/W*100}return{startLeft:j,startTop:E,distance:W,deg:_,visible:J,labelOffset:de,ruleLength:N}},u=()=>{const y=n.panoIndex,P=o.find(F=>F.panoIndex===y);if(!P)return e(0,r=[]);if(n.currentMode!==be.Five.Mode.Panorama)return e(0,r=[]);const I=n.camera.position,C=n.camera.getWorldDirection(new H.Vector3),L=P.lines.map(F=>new H.Vector3(F.start[0],-F.start[1],-F.start[2])),D=P.lines.map(F=>new H.Vector3(F.end[0],-F.end[1],-F.end[2])),[B]=L.concat(D).sort((F,X)=>{const j=F.clone().setY(0).sub(I).normalize().angleTo(C.clone().setY(0)),E=X.clone().setY(0).sub(I).normalize().angleTo(C.clone().setY(0));return j-E}),N=P.lines.map(F=>{var ue,me;const X=F.start,j=F.end,{startLeft:E,startTop:R,distance:O,deg:W,visible:U,labelOffset:_,ruleLength:J}=f(new H.Vector3(X[0],-X[1],-X[2]),new H.Vector3(j[0],-j[1],-j[2]),B),de=[];return F.children&&((ue=F.children)==null?void 0:ue.length)>0&&((me=F.children)==null||me.forEach(Pe=>{const Me=Pe.start,Re=Pe.end,{distance:ae}=d(new H.Vector3(Me[0],-Me[1],-Me[2]),new H.Vector3(Re[0],-Re[1],-Re[2]));de.push({width:ae,state:Pe.state})})),{width:O,left:E,top:R,rotateDeg:W,state:F.state,children:de,labelOffset:_,visible:U,labelElement:s.distanceText(J)}});e(0,r=N)},h=()=>ci(u),p=lo(u,80);return Ze(()=>{u(),n.on("panoArrived",u),n.on("modeChange",u),n.on("cameraDirectionUpdate",h),n.on("movingToPano",h),n.on("mouseWheel",()=>p()),n.on("pinchGesture",()=>p())}),It(()=>{n.off("panoArrived",u),n.off("modeChange",u),n.off("cameraDirectionUpdate",h),n.off("movingToPano",h),n.off("mouseWheel",()=>p()),n.off("pinchGesture",()=>p())}),i.$$set=y=>{"five"in y&&e(1,n=y.five),"rulerDatas"in y&&e(2,o=y.rulerDatas),"options"in y&&e(3,s=y.options)},[r,n,o,s]}class Ef extends oe{constructor(t){super(),ie(this,t,Cf,wf,ne,{five:1,rulerDatas:2,options:3})}}class Pf{constructor(t,e){m(this,"five");m(this,"container",document.createElement("div"));m(this,"panoRulerProData");m(this,"rulerItems");m(this,"state",{enabled:!1,loaded:!1,options:{className:"",distanceText:t=>`${t.toFixed(1)}m`}});var n,o;this.five=t,this.container.classList.add("panoRulerProPlugin-container"),this.container.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;"),e&&(e.data&&this.load(e.data),this.state.options=G(G({},this.state.options),e.options||{}),(n=e.options)!=null&&n.className&&this.container.classList.add((o=e.options)==null?void 0:o.className)),this.five.once("modelLoaded",()=>Y(this,null,function*(){var s,r;(r=(s=this.five.getElement())==null?void 0:s.parentNode)==null||r.append(this.container)})),this.five.once("dispose",()=>this.dispose())}load(t){return Y(this,null,function*(){if(!this.five.work)return;const e=t.data;if(!e)throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");this.panoRulerProData=e,this.state.loaded=!0})}enable(){return this.state.loaded?(this.state.enabled||(this.state.enabled=!0,this.render()),!0):!1}disable(){return this.state.enabled&&(this.state.enabled=!1,this.render()),!0}render(){return Y(this,null,function*(){var t;if(this.state.enabled){if(!this.panoRulerProData||!this.container)return;this.rulerItems=new Ef({target:this.container,props:{five:this.five,rulerDatas:this.panoRulerProData,options:this.state.options}})}else(t=this.rulerItems)==null||t.$destroy(),this.rulerItems=void 0})}dispose(){this.container&&(this.rulerItems.$destroy(),this.rulerItems=void 0),this.container.remove()}}const If=(i,t)=>new Pf(i,t),kf="data:image/png;base64,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";function xf(){const i=document.createElement("div"),t=document.createElement("i"),e=document.createElement("span");return i.appendChild(t),i.appendChild(e),i.style.position="relative",i.style.width="100%",i.style.display="flex",i.style.flexDirection="column",i.style.alignItems="center",i.style.marginTop=`${150/16}rem`,i.style.opacity="0",i.style.transition="opacity 1000ms linear",t.style.display="block",t.style.width=`${134/16}rem`,t.style.height=`${22/16}rem`,t.style.backgroundSize="100%",t.style.backgroundRepeat="no-repeat",t.style.backgroundImage=`url(${kf})`,e.style.marginTop=`${10/16}rem`,e.style.fontSize=`${16/16}rem`,e.style.color="#fff",e.style.opacity="0.7",e.style.textShadow="0 2px 16px rgb(22 34 83 / 24%)",e.style.fontWeight="bold",{appendTo(n){n.appendChild(i)},dispose(){i.remove()},setRoom(n){e.innerHTML=n.name+" "+Math.floor(n.size/1e6)+"\u33A1"},show(){i.style.opacity="1"},hide(){i.style.opacity="0"}}}const Df=new x.TextureLoader;function gs(i){return Y(this,null,function*(){return new Promise((t,e)=>{Df.load(i,t,void 0,e)}).then(t=>(t.encoding=x.sRGBEncoding,t))})}const xn={userAction:!0};class Lf extends Ht{constructor(e,n){super(e);m(this,"state",{visible:!0,enabled:!0,config:{compassImageUrl:"//vrlab-image4.ljcdn.com/release/web/v3/north-point-circle.96498e69.png",entryDoorImageUrl:"//vrlab-image4.ljcdn.com/release/web/enterDoor.831b8208.png"}});m(this,"data");m(this,"group",new x.Group);m(this,"roomInfoInstance");m(this,"roomInfoWrapperInstance");m(this,"compassMeshTween");m(this,"compassMesh");m(this,"entryDoorMesh");m(this,"dispose",()=>{var e,n,o,s;this.five.scene.remove(this.group),this.group.remove(...this.group.children),(n=(e=this.compassMesh)==null?void 0:e.material.map)==null||n.dispose(),(s=(o=this.entryDoorMesh)==null?void 0:o.material.map)==null||s.dispose(),this.five.off("dispose",this.dispose),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_addEventListener",()=>{this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("modeChange",this.onFiveModeChange),this.five.on("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_removeEventListener",()=>{this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("modeChange",this.onFiveModeChange),this.five.off("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_enable",()=>{this.five.scene.add(this.group),this.init(),this.onFivePanoArrived(this.five.panoIndex||0),this._addEventListener()});m(this,"_disable",()=>{this._clearCompassIfNeed(),this._clearEntryDoorIfNeed(),this.five.scene.remove(this.group),this._removeEventListener()});m(this,"_toggleVisible",()=>{this.group.visible=this.state.visible,this.five.needsRender=!0});m(this,"_clearCompassIfNeed",()=>{var e;this.compassMesh&&(this.group.remove(this.compassMesh),(e=this.compassMesh.material.map)==null||e.dispose(),this.compassMesh=null)});m(this,"_clearEntryDoorIfNeed",()=>{var e;this.entryDoorMesh&&(this.group.remove(this.entryDoorMesh),(e=this.entryDoorMesh.material.map)==null||e.dispose(),this.entryDoorMesh=null),this.roomInfoInstance&&(this.roomInfoInstance.dispose(),this.roomInfoInstance=null),this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.dispose(),this.roomInfoWrapperInstance=null)});m(this,"onFivePanoWillArrive",e=>{var n,o;e!==this.five.panoIndex&&((n=this.compassMeshTween)==null||n.dispose(),(o=this.compassMesh)==null||o.material.setValues({opacity:0}))});m(this,"onFivePanoArrived",e=>{var o,s,r,a,l,c,d;const n=(r=(s=(o=this.five.work)==null?void 0:o.observers)==null?void 0:s[e])==null?void 0:r.standingPosition;if(this.compassMesh&&(this.compassMesh.position.copy(n.clone().setY(n.y+.01)),this.compassMesh.material.opacity===0&&((a=this.compassMeshTween)==null||a.dispose(),this.compassMeshTween=La(1e3).onUpdate(({progress:f})=>{var u;(u=this.compassMesh)==null||u.material.setValues({opacity:f}),this.five.needsRender=!0}).play())),this.entryDoorMesh){const u=new x.Vector3(this.data.entrance.position.x,this.data.entrance.position.y,this.data.entrance.position.z).clone().setY(n.y).sub(n).normalize(),h=n.clone().add(u.clone().multiplyScalar(.7)).setY(n.y+.01);this.entryDoorMesh.rotation.z=new x.Vector3(0,0,-1).angleTo(u),this.entryDoorMesh.position.copy(h),((l=this.data)==null?void 0:l.room_observers[e].room.type)===1?(c=this.entryDoorMesh)==null||c.material.setValues({opacity:1}):(d=this.entryDoorMesh)==null||d.material.setValues({opacity:0})}this.roomInfoInstance&&this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.css3DObject.position.copy(n.clone().setY(n.y+.01)),this.roomInfoInstance.setRoom(this.data.room_observers[e].room)),this.five.needsRender=!0});m(this,"onFiveCameraDirectionUpdate",({longitude:e,latitude:n})=>{var o,s;!this.roomInfoWrapperInstance||(this.roomInfoWrapperInstance.css3DObject.rotation.z=e,n>.66&&this.five.getCurrentState().mode==="Panorama"?(o=this.roomInfoInstance)==null||o.show():(s=this.roomInfoInstance)==null||s.hide())});m(this,"onFiveModeChange",(e,n,o,s,r)=>{e!==n&&this.setState({visible:e===be.Five.Mode.Panorama},{userAction:r})});this.five.scene.add(this.group),this.five.once("dispose",this.dispose),this.setState({visible:!0,enabled:!0,config:G(G({},this.state.config),n||{})})}enable(e=xn){this.setState({enabled:!0},e)}disable(e=xn){this.setState({enabled:!1},e)}show(e=xn){if(!!this.state.enabled)return this.setState({visible:!0},e),Promise.resolve()}hide(e=xn){if(!!this.state.enabled)return this.setState({visible:!1},e),Promise.resolve()}setState(e,n={userAction:!0}){var s,r;const o=JSON.parse(JSON.stringify(this.state));this.state={visible:(s=e.visible)!=null?s:o.visible,enabled:(r=e.enabled)!=null?r:o.enabled,config:G(G({},o.config),e.config||{})},this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n.userAction}),e.enabled===!0&&(this._enable(),this.hooks.emit("enable",n)),e.enabled===!1&&(this._disable(),this.hooks.emit("disable",n)),e.visible===!1&&(this._toggleVisible(),this.hooks.emit("hide",n)),e.visible===!0&&(this._toggleVisible(),this.hooks.emit("show",n)),e.config&&this.init()}load(e,n,o=!0){return Y(this,null,function*(){const s=yield this.formatData(e);JSON.stringify(this.data)!==JSON.stringify(s)&&(this.hooks.emit("dataChange",s,this.data),this.data=G({},s),this.init(),n&&this.setState(n,{userAction:o}),this.hooks.emit("dataLoaded",this.data))})}formatData(e){return e.version&&e.data?Promise.resolve(e.data):Promise.resolve(e)}init(){return Y(this,null,function*(){var o,s,r,a;const e=(s=(o=this.data)==null?void 0:o.north_rad)!=null?s:null;this._clearCompassIfNeed(),e!==null&&(this.compassMesh=yield this.loadCompassMesh(),this.compassMesh.rotateX(-Math.PI/2),this.compassMesh.rotateZ(e-Math.PI/2),this.group.add(this.compassMesh));const n=(a=(r=this.data)==null?void 0:r.entrance)!=null?a:null;this._clearEntryDoorIfNeed(),n!==null&&(this.entryDoorMesh=yield this.loadEntryDoorMesh(),this.roomInfoWrapperInstance=this.loadRoomInfo(),this.roomInfoInstance=xf(),this.entryDoorMesh.rotateX(-Math.PI/2),this.roomInfoWrapperInstance&&this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container),this.group.add(this.entryDoorMesh)),this.onFivePanoArrived(this.five.panoIndex||0),this.five.needsRender=!0})}loadCompassMesh(){return Y(this,null,function*(){const e=this.state.config.compassImageUrl,n=yield gs(e),o=new x.CircleGeometry(.7,32),s=new x.MeshBasicMaterial({map:n,transparent:!0,opacity:0,depthTest:!1}),r=new x.Mesh(o,s);return r.name="pano-compass-mesh",r})}loadEntryDoorMesh(){return Y(this,null,function*(){const e=this.state.config.entryDoorImageUrl,n=yield gs(e),o=new x.PlaneGeometry(.2,.16),s=new x.MeshBasicMaterial({map:n,transparent:!0,opacity:.8,depthTest:!1}),r=new x.Mesh(o,s);return r.name="pano-compass-entry-door",r})}loadRoomInfo(){const e=[new x.Vector3(-.7,0,-.7),new x.Vector3(.7,0,-.7),new x.Vector3(.7,0,.7),new x.Vector3(-.7,0,.7)];return en(this.five).create3DDomContainer(e)}}const Sf=(i,t)=>new Lf(i,t);function Dn(i,t,e){const n=i[t],o=i[e];n===void 0||o===void 0||(i[t]=o,i[e]=n)}function Tf(i,t,e){const n=e/2;for(let o=1;o<=n;o++){const s=e-(o-1);for(let r=1;r<=t;r++){const a=(o-1)*t+r-1,l=(s-1)*t+r-1;Dn(i,a*4+0,l*4+0),Dn(i,a*4+1,l*4+1),Dn(i,a*4+2,l*4+2),Dn(i,a*4+3,l*4+3)}}}class Ba{constructor(t,e){m(this,"width");m(this,"height");m(this,"containerDom");m(this,"hooks",new be.Subscribe);m(this,"canvas",document.createElement("canvas"));m(this,"five");m(this,"scale");m(this,"config");m(this,"offset",{x:0,y:0});m(this,"context");m(this,"renderCenter",new x.Vector3);m(this,"hammer");m(this,"state",{enabled:!1});m(this,"offsetRange");m(this,"isPanning",!1);m(this,"onPanstart",()=>{this.isPanning=!0,this.canvas.style.boxShadow="0 2px 30px 0 rgba(0,0,0,0.20)"});m(this,"onPan",t=>{if(!this.isPanning||!this.offsetRange||this.hooks.emit("wantsPanGesture",t))return;const{translateX:n,translateY:o}=this.getPanOffset(t,this.offsetRange);this.canvas.style.transform=`translate3d(${n}px, ${o}px, 100px)`});m(this,"onPanend",t=>{if(this.isPanning=!1,this.canvas.style.boxShadow="none",!this.offsetRange)return;const{translateX:e,translateY:n}=this.getPanOffset(t,this.offsetRange);this.canvas.style.transform=`translate3d(${e}px, ${n}px, 100px)`,this.offset={x:e,y:n}});var o,s,r;if(!t.renderer)throw new Error("Five Render \u672A\u521D\u59CB\u5316");this.five=t,this.scale=(o=e==null?void 0:e.scale)!=null?o:2,this.width=(s=e==null?void 0:e.width)!=null?s:190,this.height=(r=e==null?void 0:e.height)!=null?r:190,this.config={dragEnabled:(e==null?void 0:e.dragEnabled)||!1,autoFixPCPosition:(e==null?void 0:e.autoFixPCPosition)||!1,initialPosition:(e==null?void 0:e.initialPosition)||{left:"0",top:"0"}};const n=this.canvas.getContext("2d");if(!n)throw new Error("CANNOT CREATE CONTEXT2D");this.context=n,this.config.dragEnabled&&(this.hammer=new gn.default(this.canvas),this.hammer.on("pan",this.onPan),this.hammer.on("panstart",this.onPanstart),this.hammer.on("panend",this.onPanend)),this.initStyle()}dispose(){var t;this.clear(),this.disable(),(t=this.hammer)==null||t.destroy()}enable(){if(!this.state.enabled)return this.state.enabled=!0,this.containerDom&&this._appendTo(this.containerDom),this}disable(){if(!!this.state.enabled)return this.state.enabled=!1,this.canvas.remove(),this}appendTo(t){return this.containerDom=t,this.state.enabled&&this._appendTo(t),this}clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this}renderWithPoint(t){!this.containerDom||!this.state.enabled||(this.renderCenter=t,this.render(),this.config.autoFixPCPosition&&this.autoFixPCPosition())}renderWithScreenPoint(t){!this.containerDom||!this.state.enabled||(this.renderCenter=t,this.render(),this.config.autoFixPCPosition&&this.autoFixPCPosition())}resetOffset(){this.offset={x:0,y:0},this.canvas.style.transform=`translate3d(${0}px, ${0}px, 100px)`}getCurrentState(){return{enabled:this.state.enabled}}getRenderCenter(){return this.renderCenter}_appendTo(t){if(this.resetOffset(),t.appendChild(this.canvas),!this.offsetRange){const e=this.canvas.getBoundingClientRect(),n=t.getBoundingClientRect(),o=n.right-e.right,s=n.bottom-e.bottom,r=n.left-e.left,a=n.top-e.top;this.offsetRange={min:{x:r,y:a},max:{x:o,y:s}}}}autoFixPCPosition(){if(!this.containerDom)return;const{width:t,height:e}=this,[n,o,s]=(()=>{if(this.renderCenter instanceof x.Vector3){const r=this.renderCenter.clone().project(this.five.camera);return[(r.x+1)/2*this.containerDom.clientWidth,-(r.x-1)/2*this.containerDom.clientWidth,-(r.y-1)/2*this.containerDom.clientHeight]}else return[this.renderCenter.x,this.containerDom.clientWidth-this.renderCenter.x,this.renderCenter.y]})();n<183?(this.canvas.style.top=-e/2+"px",this.canvas.style.left=90+"px"):s<183?(this.canvas.style.top=90+"px",this.canvas.style.left=-t/2+"px"):o<183?(this.canvas.style.top=-e/2+"px",this.canvas.style.left=-t-90+"px"):(this.canvas.style.left=-t/2+"px",this.canvas.style.top=-e-90+"px"),this.canvas.style.transform=`translate3d(${n}px, ${s}px, 10px)`,this.offset={x:n,y:s}}render(){if(!this.five.renderer||!this.containerDom)return;const{scale:t,context:e,width:n,height:o}=this,s=this.five.renderer.getSize(new x.Vector2),[r,a]=(()=>{if(this.renderCenter instanceof x.Vector3){const g=this.renderCenter.clone().project(this.five.camera);return[(g.x+1)/2*s.x,(g.y+1)/2*s.y]}else return[this.renderCenter.x,s.y-this.renderCenter.y]})(),l=1,c=n/t,d=o/t,f=l*t,u=this.five.getPixels(r-c/2,a-c/2,c,d,f),h=Math.floor(n*l),p=Math.floor(o*l);Tf(u,h,p);const A=new ImageData(h,p);A.data.set(u),e.putImageData(A,0,0)}initStyle(){const t=this.canvas;t.classList.add("five-plugin__magnifier"),t.style.position="absolute",t.style.pointerEvents="all",t.style.borderRadius="50%",t.style.zIndex="99";const e=1;t.setAttribute("width",(this.width*e).toString()),t.setAttribute("height",(this.height*e).toString()),t.style.border="2px solid rgba(255,255,255,0.20)",t.style.width=this.width+"px",t.style.height=this.height+"px",t.style.top=this.config.initialPosition.top,t.style.left=this.config.initialPosition.left,t.style.transform="translate(0,0,100px)",this.config.dragEnabled&&(this.canvas.style.cursor="pointer")}getPanOffset(t,e){const{min:{x:n,y:o},max:{x:s,y:r}}=e,a=this.offset.x+t.deltaX,l=this.offset.y+t.deltaY,c=Math.min(Math.max(a,n),s),d=Math.min(Math.max(l,o),r);return{translateX:c,translateY:d}}}class Mf{constructor(t){m(this,"edges",[]);m(this,"five");m(this,"onModelLoaded",()=>{!this.five.model||(this.edges=this.five.model.getEdges())});this.five=t,this.five.model.loaded?this.onModelLoaded():this.five.on("modelLoaded",this.onModelLoaded)}dispose(){}getAdsorbentPoint(t){if(this.edges.length===0)return null;let e=1/0,n;return this.edges.forEach(o=>{const s=o.closestPointToPoint(t.point,!0,new H.Vector3),r=s.distanceTo(t.point);r<e&&(n=s,e=r)}),e>.1?null:n||null}}function zf(i,t){for(let e=0,n=t.length;e<n;e++)if(i===t[e])return t.splice(e,1)[0]}class _e{constructor(t){m(this,"id");m(this,"lines");m(this,"position");m(this,"type","point");this.id=He(),this.lines=[],this.position=new H.Vector3,t instanceof H.Vector3?this.position.copy(t):this.position.fromArray(t)}toJson(){return{id:this.id,position:this.position.toArray()}}addLine(t){this.lines.push(t)}removeLine(t){zf(t,this.lines)}clone(){return new _e(this.position)}}class ui{constructor(t){m(this,"id",He());m(this,"lines",[]);m(this,"points",[]);m(this,"visiblePanoIndexes");m(this,"model");m(this,"type","polyline");m(this,"hook",new be.Subscribe);this.model=t.model}addLine(t){if(this.includes(t)){console.error(new Error("\u4E0D\u80FD\u91CD\u590D\u6DFB\u52A0\u7EBF\u6BB5"));return}const e=this.getLastPoint(),n=e&&t.findAnotherPoint(e);e?e&&n?(this.lines.push(t),this.points.push(...t.points),this.hook.emit("lineAdded",t)):console.error(new Error("\u4F20\u5165\u7EBF\u6BB5\u65E0\u6CD5\u4E0E\u5F53\u524D\u6298\u7EBF\u8FDB\u884C\u8FDE\u63A5")):(this.lines.push(t),this.points.push(...t.points),this.hook.emit("lineAdded",t))}removeLine(t){if(this.lines.length!==0){if(!this.isLastLine(t)){console.error(new Error("\u4F20\u5165\u7EBF\u6BB5\u4E0D\u662F\u5F53\u524D\u6298\u7EBF\u7684\u6700\u540E\u4E00\u6BB5"));return}this.lines.pop(),this.lines.length===0?this.points.slice(0,this.points.length):this.points.pop(),this.hook.emit("lineRemoved",t)}}isLastLine(t){const e=this.getLastLine();return e?t.id===e.id:!1}getLastLine(){return this.lines.slice(-1)[0]}clear(){this.lines.slice(0,this.lines.length),this.points.slice(0,this.points.length)}overlapWith(t){return t.type==="point"?this.includes(t):t.type==="line"?t.points.some(e=>this.includes(e)):t.type==="polyline"?t.points.some(e=>this.includes(e)):!0}includes(t){return t.type==="point"?this.points.find(({id:e})=>e===t.id)!==void 0:t.type==="line"?this.lines.find(({id:e})=>e===t.id)!==void 0:!1}isEmpty(){return this.points.length===0}getLastPoint(){return this.points.slice(-1)[0]}toJson(){return{id:this.id,lines:this.lines.map(t=>t.toJson()),visiblePanoIndexes:this.visiblePanoIndexes}}getPointByID(t){return this.points.find(({id:e})=>e===t)}fromJson(t){this.clear(),this.id=t.id;const{getPoint:e,getAllPoints:n}=r(),o=t.lines.map(a=>{const[l,c]=a.points,d=e(l),f=e(c);if(!d||!f)throw new Error("\u7EBF\u4E0A\u7684\u70B9\u4E0D\u5B58\u5728");const u=new Ft(d,f,this.model);return u.id=a.id,u.text=a.text,u}),s=n();this.points.push(...s),this.lines.push(...o),this.visiblePanoIndexes=t.visiblePanoIndexes;function r(){const a=new Map;function l(d){const f=a.get(d.id);if(f)return f;const u=new _e(d.position);return u.id=d.id,a.set(d.id,u),u}function c(){return Array.from(a.values())}return{getPoint:l,getAllPoints:c}}return this}replace(t){this.id=t.id,this.clear(),this.lines.push(...t.lines),this.points.push(...t.points)}}const Bf=1,Vf=3,jf=new H.Color(16777215),Qf=new H.Color(6522623),Rf=new H.Color(16777215),Of=new H.Color(6522623),Hf=6,Ff=8,Gf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==",Va=new H.TextureLoader().load(Gf),ja={pointTexture:Va,pointSize:Hf,lineWidth:Bf,lineColor:jf,pointColor:Rf,lineRenderOrder:20,pointsRenderOrder:20};he(G({},ja),{dashed:!0});const Nf={pointTexture:Va,pointSize:Ff,lineWidth:Vf,lineColor:Qf,pointColor:Of,lineRenderOrder:10,pointsRenderOrder:10};function Wf(i,t,e){var d,f,u,h,p;const n=(d=e==null?void 0:e.lineWidth)!=null?d:2,o=(f=e==null?void 0:e.lineColor)!=null?f:new H.Color(16777215),s=(u=e==null?void 0:e.pointSize)!=null?u:5,r=(h=e==null?void 0:e.lineRenderOrder)!=null?h:10,a=(p=e==null?void 0:e.lineRenderOrder)!=null?p:20,l=new Ur.Line(i,t);l.setMaterial({linewidth:n,color:o}),l.line.material.depthTest=!1,l.line.material.transparent=!0,l.line.renderOrder=r,l.points.renderOrder=a;const c=l.points.material;return c.depthTest=!1,c.size=s,e!=null&&e.pointColor&&c.color.set(e.pointColor).convertSRGBToLinear(),e!=null&&e.pointTexture&&(c.map=e.pointTexture),l}function As(i,t){const[e,n]=i.points,o=t==="light"?Nf:ja,s=Wf(e.position,n.position,o);return s.name="normalLine_"+i.id,s}function At(i){const{x:t,y:e,z:n}=i;return!(Math.abs(t)>1||Math.abs(e)>1||Math.abs(n)>1)}function _f(){const i=document.createElement("div");return i.setAttribute("style","backdrop-filter: blur(4px);-webkit-backdrop-filter: blur(4px);-webkit-tap-highlight-color: rgba(0,0,0,0);"),i.style.width="max-content",i.style.padding="3px 6px",i.style.lineHeight="1",i.style.textAlign="center",i.style.transform="translate(-50%, -50%)",i.style.borderRadius="100px",i.style.fontSize="14px",i.style.color="#fff",i.style.background="rgba(195,195,195,0.70)",i.style.border="0.5px solid rgba(255,255,255,0.6)",i.style.cursor="pointer",i}function Xf(i){const t=document.createElement("div");return t.id="distance_"+i.id,t.classList.add("five-plugin-measure__distance"),t.style.opacity="0",t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.width="0",t.style.height="0",t.style.transform="translate3d(0, 0, 0)",t.style.transformOrigin="left top",t}function Yf(i){let t=!0;const{line:e}=i,n=e.id,o=_f(),s=Xf(e),r=i.userDistanceItem,a=new H.Vector3(0,0,0),l={lineID:n,ndcPosition:a,update:u,appendTo:h,remove:p,highlight:d,unHighlight:f,getCurrentContent:A,setItemSelectable:g};s.style.pointerEvents=t?"all":"none",r!=null&&r.element?s.appendChild(r.element):s.appendChild(o);function c(){var v;(v=i.clickCallback)==null||v.call(i,l)}function d(){if(r)return r.highlight();o.style.border="0.5px solid #95AEFF",o.style.background="linear-gradient(90deg, #95AEFF 0%, #6386FF 100%)"}function f(){if(r)return r.unHighlight();o.style.border="0.5px solid rgba(255,255,255,0.6)",o.style.background="rgba(195,195,195,0.70)"}function u(v){if(e.mesh.visible===!1){s.style.opacity="0",s.style.pointerEvents="none";return}const w=v.getElement();if(!w)return;const y=w.clientWidth,P=w.clientHeight,I=y/2,C=P/2;if(e.points.length<2)return;const[L,D]=e.points,B=L.position.clone().project(v.camera),N=D.position.clone().project(v.camera),F=B.clone().lerp(N,.5),X=new H.Vector2(B.x*I,B.y*C),j=new H.Vector2(N.x*I,N.y*C),E=X.distanceTo(j);if((()=>!(Math.abs(B.z)>1||Math.abs(N.z)>1||!At(B)&&!At(N)||!At(F)||E===0))()===!1){s.style.opacity="0",s.style.pointerEvents="none";return}const O=(F.x+1)/2*y,W=-(F.y-1)/2*P,_=-(Math.atan((X.y-j.y)/(X.x-j.x))*180)/Math.PI,J=s.parentElement&&o.clientWidth>E?-20:0;s.style.transform=`translate(${O}px, ${W}px) rotate(${_}deg) translateY(${J}px)`,s.style.opacity="1",s.style.pointerEvents=t?"all":"none",r&&r.update({line:e,polyline:e.getPolyline()});const de=A();o.innerText=de}function h(v){v.appendChild(s),s.addEventListener("click",c)}function p(){o.removeEventListener("click",c),s.remove()}function A(){var L,D,B;if(e.points.length<2)return"";const[v,w]=e.points,y=v.position.clone().distanceTo(w.position),P=(L=i.line.text)!=null?L:i.line.model.config.defaultText,I=(B=(D=i.line.model.config)==null?void 0:D.getDistanceText)==null?void 0:B.call(D,y),C=P!=null?P:I;return C!=null?C:y.toFixed(2)+"m"}function g(v){t=v}return l}class Ft{constructor(t,e,n){m(this,"id");m(this,"selected",!1);m(this,"text");m(this,"type","line");m(this,"model");m(this,"mesh");m(this,"points");m(this,"lightMesh");m(this,"hook");m(this,"distanceItem");m(this,"polyline");var o;if(this.id=He(),this.model=n,t.id===e.id)throw new Error("\u65E0\u6548\u7684\u7EBF\u6BB5, \u4E00\u4E2A\u70B9\u65E0\u6CD5\u6784\u6210\u7EBF\u6BB5");typeof n.config.defaultText=="string"&&(this.text=n.config.defaultText),this.hook=new be.Subscribe,this.points=[t,e],this.mesh=As(this,"normal"),this.lightMesh=As(this,"light"),this.distanceItem=Yf({line:this,clickCallback:()=>this.hook.emit("selected",this),userDistanceItem:(o=this.model.config)!=null&&o.userDistanceItemCreator?this.model.config.userDistanceItemCreator():void 0}),t.lines.push(this),e.lines.push(this)}clear(){this.selected=!1,this.polyline=void 0}isEmpty(){return this.points.length===0}getPolyline(){if(this.polyline)return this.polyline;const t=this.model.polylines.find(e=>e.lines.includes(this));if(t)return this.polyline=t,t}findAnotherPoint(t){return this.points.find(({id:e})=>e!==t.id)}setText(t){this.text=t,this.hook.emit("textChanged",t)}toJson(){return{id:this.id,points:this.points.map(t=>t.toJson()),text:this.text}}clone(){const t=new Ft(this.points[0].clone(),this.points[1].clone(),this.model);return t.text=this.text,t}}class fi{constructor(t){m(this,"config");m(this,"polylines",[]);m(this,"hook",new be.Subscribe);this.config=t}addPolyline(t){if(this.includes(t)){console.error(new Error("\u4E0D\u80FD\u91CD\u590D\u6DFB\u52A0 polyline"));return}this.polylines.push(t),this.hook.emit("polylineAdded",t)}replacePolylineByID(t,e){const n=this.getPolylineByID(t);n==null||n.replace(e)}removePolyline(t){const e=this.polylines.findIndex(({id:n})=>n===t.id);if(e===-1){console.error(new Error("polyline \u4E0D\u5B58\u5728"));return}this.polylines.splice(e,1),this.hook.emit("polylineRemoved",t)}getPolylineByID(t){return this.polylines.find(e=>e.id===t)}getPolylineByLine(t){return this.polylines.find(e=>e.includes(t))}getLineByID(t){return this.getAllLines().find(e=>e.id===t)}getAllLines(){return this.polylines.map(t=>t.lines).flat(1)}getAllPoints(){return this.polylines.map(t=>t.points).flat(1)}includes(t){return this.polylines.find(({id:e})=>e===t.id)!==void 0}clear(){this.polylines.forEach(t=>this.hook.emit("polylineRemoved",t)),this.polylines.splice(0,this.polylines.length)}getClosestPoint(){}parse(t){this.clear(),this.polylines.push(...t.polylines.map(e=>new ui({model:this}).fromJson(e))),this.polylines.forEach(e=>this.hook.emit("polylineAdded",e))}toJson(){return{polylines:this.polylines.map(t=>t.toJson()).filter(t=>t.lines.length>0)}}}const Ln=i=>i.preventDefault();class hi{constructor(t){m(this,"model");m(this,"five");m(this,"group");m(this,"config");m(this,"dashed");m(this,"disposed",!1);m(this,"isMobile");m(this,"mouseGroup");m(this,"container");m(this,"fiveHelper");m(this,"hook");m(this,"magnifier");m(this,"userDistanceItemCreator");m(this,"updateDistanceUI",()=>{this.dashed.distanceItem.update(this.five),this.model.getAllLines().forEach(t=>t.distanceItem.update(this.five))});var n,o;this.five=t.five,this.hook=t.hook,this.model=t.model,this.config=t.config,this.magnifier=t.magnifier,this.container=t.container,this.fiveHelper=t.fiveHelper,this.isMobile=(o=(n=t.openParams)==null?void 0:n.isMobile)!=null?o:!1,this.userDistanceItemCreator=t.userDistanceItemCreator,this.group=t.group,this.mouseGroup=t.mouseGroup,this.dashed=new Ft(new _e([0,0,0]),new _e([0,0,0]),this.model),this.dashed.distanceItem.setItemSelectable(!1),this.dashed.mesh.setMaterial({dashed:!0,dashScale:100}),this.dashed.mesh.name="dashLine";const e=this.five.getElement();e&&(e.addEventListener("touchstart",Ln),e.addEventListener("contextmenu",Ln))}removeLine(t){this.group.remove(t.mesh,t.lightMesh),t.distanceItem.remove(),this.five.needsRender=!0}updateMouseGroup(t,e){if(!t)return this.mouseGroup;const n=this.fiveHelper.getAdsorbentPoint(t),o=n||t.point;if(this.mouseGroup.position.copy(o),e)this.mouseGroup.quaternion.copy(e.quaternion);else if(t.face){const r=t.face.normal.clone().multiplyScalar(.05),l=t.point.clone().add(r).clone().add(r);this.mouseGroup.lookAt(l)}return this.mouseGroup}dispose(){this.disposed=!0,this.magnifier.disable(),this.model.getAllLines().forEach(e=>this.removeLine(e));const t=this.five.getElement();t&&(t.removeEventListener("touchstart",Ln),t.removeEventListener("contextmenu",Ln))}}function Hi(i){const{x:t,y:e}=i.center,{clientWidth:n,clientHeight:o}=i.target,s=i.target.getBoundingClientRect(),r=new H.Vector2(t,e).sub(new H.Vector2(s.left,s.top)),a=new H.Vector2(r.x/n*2-1,-(r.y/o)*2+1);return{point:r,ndcPoint:a}}function Pi(i,t){const e=Hi(t).ndcPoint,n=new H.Raycaster;return n.setFromCamera(e,i.camera),i.model.intersectRaycaster(n)}class Sn extends hi{constructor(e){var o;super(e);m(this,"type","edit");m(this,"polyline");m(this,"pressPoint");m(this,"hasAppendDashed",!1);m(this,"hasAppendMouseGroup",!1);m(this,"fiveElement");m(this,"lastPoint",null);m(this,"hammer");m(this,"onIntersectionUpdate",lo((e,n)=>{var s;this.hasAppendMouseGroup===!1&&(this.group.add(this.mouseGroup),this.magnifier.appendTo(this.container),this.magnifier.enable(),this.hasAppendMouseGroup=!0);const o=this.updateMouseGroup(e,n).position;(s=this.pressPoint)==null||s.position.copy(o),this.updateDashed(),requestAnimationFrame(()=>this.magnifier.renderWithPoint(this.mouseGroup.position)),this.five.needsRender=!0},20));m(this,"revoke",()=>{if(this.polyline.lines.length===0&&this.lastPoint){this.lastPoint=null,this.hasAppendDashed=!1,this.dashed.distanceItem.remove(),this.group.remove(this.dashed.mesh),this.hook.emit("anchorChange",null),this.hook.emit("editedDashedLineChange",null),this.five.needsRender=!0;return}if(this.polyline.lines.length===0&&!this.lastPoint||!this.lastPoint)return;const e=this.polyline.lines[this.polyline.lines.length-1],n=e.findAnotherPoint(this.lastPoint);!n||(this.lastPoint=n,this.hook.emit("anchorChange",n.position),this.group.remove(e.mesh),this.polyline.removeLine(e),this.hasAppendMouseGroup=!1,this.mouseGroup.position.copy(this.lastPoint.position),this.group.remove(this.mouseGroup),e.distanceItem.remove(),this.updateDashed(),this.magnifier.disable(),this.five.needsRender=!0)});m(this,"onMouseLeave",()=>{this.magnifier.disable(),this.group.remove(this.mouseGroup),this.hasAppendMouseGroup=!1,this.lastPoint&&(this.mouseGroup.position.copy(this.lastPoint.position),this.updateDashed())});m(this,"onLineChanged",()=>{this.hook.emit("editedPolylineChange",this.polyline)});m(this,"onPress",e=>{const[n]=Pi(this.five,e);if(!(n!=null&&n.face))return;const o=new _e(n.point);this.pressPoint=o,this.onIntersectionUpdate(n)});m(this,"onPan",e=>{if(!this.pressPoint)return;const[n]=Pi(this.five,e);!(n!=null&&n.face)||this.onIntersectionUpdate(n)});m(this,"onPanEnd",e=>{!this.pressPoint||this.onTap(e)});m(this,"onTap",e=>{this.hasAppendDashed||(this.dashed.distanceItem.appendTo(this.container),this.group.add(this.dashed.mesh)),this.hasAppendDashed=!0;const[n]=Pi(this.five,e);this.updateMouseGroup(n);const o=new _e(this.mouseGroup.position),s=this.lastPoint;if(o&&(this.lastPoint=o),o&&s){const r=new Ft(s,o,this.model);r.distanceItem.setItemSelectable(!1),r.distanceItem.appendTo(this.container),this.polyline.addLine(r),this.group.add(r.mesh),r.distanceItem.update(this.five)}this.pressPoint=void 0,this.hasAppendMouseGroup=!1,this.magnifier.disable(),this.group.remove(this.mouseGroup),this.updateDashed(),this.five.needsRender=!0,this.hook.emit("anchorChange",o.position)});m(this,"onWantsTapGesture",()=>!1);m(this,"onWantsToMoveToPano",()=>!1);m(this,"onWantsPanGesture",()=>this.pressPoint?!1:void 0);m(this,"onCameraUpdate",()=>{this.updateDistanceUI(),this.dashed.distanceItem.update(this.five)});m(this,"updateDashed",()=>{!this.lastPoint||(this.dashed.points[0].position.copy(this.lastPoint.position),this.dashed.points[1].position.copy(this.mouseGroup.position),this.dashed.mesh.setPoints(this.lastPoint.position,this.mouseGroup.position),this.dashed.distanceItem.update(this.five),this.hook.emit("editedDashedLineChange",this.dashed))});this.model=new fi(this.config),this.polyline=new ui({model:this.model}),this.model.addPolyline(this.polyline),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("wantsPanGesture",this.onWantsPanGesture),this.five.on("wantsTapGesture",this.onWantsTapGesture),this.five.on("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.on("intersectionOnModelUpdate",this.onIntersectionUpdate),this.polyline.hook.on("lineAdded",this.onLineChanged),this.polyline.hook.on("lineRemoved",this.onLineChanged);const n=this.five.getElement();if(n){this.fiveElement=n;const s=new gn.default(n);this.hammer=s,s.on("tap",this.onTap),s.on("pan",this.onPan),s.on("press",this.onPress),s.on("panend",this.onPanEnd)}this.five.helperVisible=!1,(o=this.fiveElement)==null||o.addEventListener("mouseleave",this.onMouseLeave),this.hook.emit("anchorChange",null),this.hook.emit("editedDashedLineChange",null),this.five.refresh()}dispose(){var e,n;super.dispose(),this.five.helperVisible=!0,this.group.remove(this.mouseGroup,this.dashed.mesh),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("wantsPanGesture",this.onWantsPanGesture),this.five.off("wantsTapGesture",this.onWantsTapGesture),this.five.off("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.off("intersectionOnModelUpdate",this.onIntersectionUpdate),this.polyline.hook.off("lineAdded",this.onLineChanged),this.polyline.hook.off("lineRemoved",this.onLineChanged),(e=this.hammer)==null||e.destroy(),(n=this.fiveElement)==null||n.removeEventListener("mouseleave",this.onMouseLeave),this.magnifier.dispose(),this.dashed.distanceItem.remove(),this.five.needsRender=!0}getEditingLines(){return this.polyline.lines}}class vs extends hi{constructor(e){super(e);m(this,"type","view");m(this,"hammer");m(this,"polylineRemoved",e=>{e.lines.forEach(n=>this.removeLine(n)),this.hook.emit("selectedChange",this.model.getAllLines().filter(n=>n.selected).map(n=>n))});m(this,"polylineAdded",e=>{e.lines.forEach(n=>{n.distanceItem.appendTo(this.container),n.distanceItem.update(this.five),this.group.add(n.mesh)})});m(this,"onCameraUpdate",()=>{this.updateDistanceUI()});m(this,"onFivePanoWillArrive",e=>{this.model.polylines.forEach(n=>{!n.visiblePanoIndexes||n.visiblePanoIndexes.includes(e)||n.lines.forEach(o=>{o.mesh.visible=!1,o.distanceItem.update(this.five)})})});m(this,"onFivePanoArrived",e=>{this.model.polylines.forEach(n=>{!n.visiblePanoIndexes||n.visiblePanoIndexes.includes(e)&&n.lines.forEach(o=>{o.mesh.visible=!0,o.distanceItem.update(this.five)})})});this.model.getAllLines().forEach(o=>{o.distanceItem.appendTo(this.container),o.distanceItem.update(this.five),this.group.add(o.mesh)});const n=this.five.getElement();if(n){const o=new gn.default(n);this.hammer=o}this.updateDistanceUI(),this.five.needsRender=!0,this.model.hook.on("polylineAdded",this.polylineAdded),this.model.hook.on("polylineRemoved",this.polylineRemoved),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive)}dispose(){var e;super.dispose(),this.model.hook.off("polylineAdded",this.polylineAdded),this.model.hook.off("polylineRemoved",this.polylineRemoved),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.needsRender=!0,this.hook.emit("selectedChange",[]),(e=this.hammer)==null||e.destroy()}}const Uf=`
|
|
208
|
+
`,w=document.createElement("div");return w.setAttribute("class","PanoRulerPlugin-rule"),w.setAttribute("data-name",A),w.setAttribute("style","display: none"),w.innerHTML=v,w},o=document.createElement("div");o.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;");const s=document.createElement("div");s.innerHTML=uf,o.appendChild(s);const r={},a=(A,g)=>{if(e.loaded)throw new Error("\u6807\u5C3A\u88AB\u91CD\u590D\u521D\u59CB\u5316\uFF01");const v=hf(A,i),w=i.work;if(!w)return!1;for(const y in g){const P=g[y],{standingPosition:I}=w.observers[0],C=P.map(({x:L,z:D,observers:B})=>{const N=B.length>0?A.rooms[A.observers[B[0]]].name:"",F=v[N]?v[N].floor:null;let X=1/0,j={index:0,x:I.x,y:I.y,z:I.z};B.forEach(_=>{if(!w.observers[_])return;const{standingPosition:J}=w.observers[_],de={index:_,x:J.x,y:J.y,z:J.z},ue=ff({x:L,z:D},de);F?ue<X&&Math.abs(de.y-F)<.3&&(X=ue,j=de):ue<X&&(X=ue,j=de)});const E=new H.Vector3(L,j.y,D);Object.assign(E,{observers:B});const R=v[N]?v[N].roof:null,O=R?new H.Vector3(L,R,D):null;return O&&Object.assign(O,{observers:B}),{origin:E,vertical:O}});r[y]={origins:C.map(L=>L.origin),rules:[]};for(const{origin:L,vertical:D}of C){if(!D)continue;const B=n(y,L.distanceTo(D));o.append(B),r[y].rules.push({vertical:!0,rule:[L,D],$element:B})}for(let L=0;L<C.length;L++){let D=L+1;D>=C.length&&(D=0);const{origin:B}=C[L],{origin:N}=C[D],F=n(y,B.distanceTo(N));o.append(F),r[y].rules.push({vertical:!1,rule:[B,N],$element:F})}}return e.loaded=!0,!0},l=(A,g,v)=>Y(exports,null,function*(){const w=A||t.roomInfo,y=g||t.roomRules;if(!w||!y)throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");return e.loaded=!1,e.options=G(G({},e.options),v||{}),i.model.loaded?a(w,y):yield new Promise(P=>i.once("modelLoaded",()=>P(a(w,y))))});t.roomInfo&&t.roomRules&&l(t.roomInfo,t.roomRules);const c=(A,g,v,w)=>{const y=[[{x:0,y:0},{x:v,y:0}],[{x:0,y:0},{x:0,y:w}],[{x:v,y:0},{x:v,y:w}],[{x:0,y:w},{x:v,y:w}]],P=[];for(let I=0;I<y.length;I++){const C=Ma([A,g],[y[I][0],y[I][1]],!0);C&&P.push(C)}return P.length===0?!1:P},d=()=>{var B;const A=(B=i.getElement())==null?void 0:B.parentElement;if(!A||!e.loaded||Object.keys(r).length<=0)return;const{panoIndex:g,camera:v,currentMode:w}=i;if(g===void 0)return;let y;for(const N in r)N.split(",").indexOf(g.toString())>=0&&(y=N);if(!y){for(const N in r)for(const{$element:F}of r[N].rules)F.style.display="none";return}const P=v.position,I=v.getWorldDirection(new H.Vector3),C=A.clientWidth,L=A.clientHeight;if(w!==be.Five.Mode.Panorama){for(const N in r)for(const{$element:F}of r[N].rules)F.style.display="none";return}for(const N in r)for(const{$element:F}of r[N].rules)F.style.display=N===y?"block":"none";const[D]=r[y].origins.slice().filter(N=>N.observers.indexOf(g)>=0).sort((N,F)=>{const X=N.clone().setY(0).sub(P).normalize().angleTo(I.clone().setY(0)),j=F.clone().setY(0).sub(P).normalize().angleTo(I.clone().setY(0));return X-j});for(const{rule:N,vertical:F,$element:X}of r[y].rules){const[j,E]=N,R=X.querySelector(".PanoRulerPlugin-rule-line");if(!R)return;if(!D){X.style.display="none";continue}if(j!==D&&E!==D){X.style.display="none";continue}if(j.distanceTo(E)<.3){X.style.display="none";continue}if(j.observers.indexOf(g)===-1||E.observers.indexOf(g)===-1){X.style.display="none";continue}if(j.clone().sub(P).normalize().angleTo(I)>Math.PI/2){X.style.display="none";continue}if(E.clone().sub(P).normalize().angleTo(I)>Math.PI/2){X.style.display="none";continue}const U=j.distanceTo(E);if(E.clone().sub(E.clone().sub(j).divide(new H.Vector3(2,2,2))).distanceTo(P)/U>8){X.style.display="none";continue}const de=j.clone().project(v),ue=(de.x+1)/2*C,me=(-de.y+1)/2*L,Pe=E.clone().project(v),Me=(Pe.x+1)/2*C,Re=(-Pe.y+1)/2*L,ae=Math.sqrt(Math.pow(Me-ue,2)+Math.pow(Re-me,2));let ve=ae,Ce=50;const ce=c({x:~~ue,y:~~me},{x:~~Me,y:~~Re},C,L);if(ce&&ce.length===1&&(D===j?(ve=Math.sqrt(Math.pow(ce[0].x-ue,2)+Math.pow(ce[0].y-me,2)),Ce=ve/ae*50):D===E&&(ve=Math.sqrt(Math.pow(ce[0].x-Me,2)+Math.pow(ce[0].y-Re,2)),Ce=100-ve/ae*50)),ce&&ce.length===2){const ut={x:(ce[0].x+ce[1].x)/2,y:(ce[0].y+ce[1].y)/2};Ce=Math.sqrt(Math.pow(ut.x-ue,2)+Math.pow(ut.y-me,2))/ae*100}const kt=(Math.PI/2-Math.atan2(Me-ue,me-Re))/Math.PI*180,ge=R.querySelector(".PanoRulerPlugin-rule-label"),dt=ge.children[0].clientWidth;dt>=ae||dt/2>=Ce/100*ae||dt/2>=(1-Ce/100)*ae?R.style.display="none":(R.style.display="block",R.style.width=ae+"px",R.style.left=ue+"px",R.style.top=me+"px",R.style.transform=`rotate(${-kt}deg)`,ge.style.left=`${Ce}%`)}},f=()=>za(d),u=()=>{var A,g;return e.loaded?(e.enable||(o.setAttribute("class","PanoRulerPlugin"+(e.options.className?" "+e.options.className:"")),(g=(A=i.getElement())==null?void 0:A.parentElement)==null||g.append(o),d(),i.on("modeChange",d),i.on("cameraUpdate",f),e.enable=!0),!0):!1},h=()=>(e.enable&&(i.off("modeChange",d),i.off("cameraUpdate",f),o&&o.remove(),e.enable=!1),!0);function p(A){if(A.distanceText&&A.distanceText!==e.options.distanceText){const g=A.distanceText;e.options.distanceText=g,Object.values(r).forEach(v=>{v.rules.forEach(w=>{const[y,P]=w.rule,I=y.distanceTo(P),C=w.$element.querySelector(".PanoRulerPlugin-rule-label-name");!C||(C.innerText=g(I))})})}}return{enable:u,disable:h,load:l,state:e,changeConfigs:p}};function pf(i){le(i,"svelte-1h27ktp",".PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp{position:absolute;transform-origin:left 0.0625rem;width:0;height:0.125rem;pointer-events:none}.PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp::after{content:'';position:absolute;left:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-1h27ktp-viewport-rule-point 0.1s 1s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp::before{content:'';position:absolute;right:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-1h27ktp-viewport-rule-point 0.1s 1.5s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-1h27ktp em.svelte-1h27ktp{display:block;height:0.0625rem;animation:svelte-1h27ktp-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;box-shadow:0 0 0.25rem rgb(0 0 0 / 40%);position:relative}.rule-mixed-line.svelte-1h27ktp.svelte-1h27ktp{display:flex;height:0.0625rem;animation:svelte-1h27ktp-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;align-items:center}.em-solid.svelte-1h27ktp.svelte-1h27ktp{height:100%;background:#ffffff}.em-dotted.svelte-1h27ktp.svelte-1h27ktp{height:0.125rem;background:var(--background-image);background-position:center;background-repeat:repeat}.PanoRulerPlugin-rule-label.svelte-1h27ktp.svelte-1h27ktp{position:absolute;width:0;height:0;top:0.0625rem;pointer-events:none}.PanoRulerPlugin-rule-label-name.svelte-1h27ktp.svelte-1h27ktp{position:absolute;padding:0.1875rem 0.375rem;background:rgba(195, 195, 195, 0.3);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem);border-radius:6.25rem;border:0.0625rem solid rgba(255, 255, 255, 0.6);white-space:nowrap;overflow:hidden;color:#ffffff;font-weight:500;font-size:0.75rem;line-height:1;animation:svelte-1h27ktp-viewport-rule-label 0.25s ease 1s;animation-fill-mode:both;box-shadow:inset 0 0 0.625rem 0 rgba(255, 255, 255, 0.3)}@keyframes svelte-1h27ktp-viewport-rule-line{0%{width:0%}100%{width:100%}}@keyframes svelte-1h27ktp-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@keyframes svelte-1h27ktp-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}")}function fs(i,t,e){const n=i.slice();return n[6]=t[e],n}function gf(i){let t,e=i[0].children,n=[];for(let o=0;o<e.length;o+=1)n[o]=hs(fs(i,e,o));return{c(){t=V("div");for(let o=0;o<n.length;o+=1)n[o].c();b(t,"class","rule-mixed-line svelte-1h27ktp")},m(o,s){z(o,t,s);for(let r=0;r<n.length;r+=1)n[r].m(t,null)},p(o,s){if(s&9){e=o[0].children;let r;for(r=0;r<e.length;r+=1){const a=fs(o,e,r);n[r]?n[r].p(a,s):(n[r]=hs(a),n[r].c(),n[r].m(t,null))}for(;r<n.length;r+=1)n[r].d(1);n.length=e.length}},d(o){o&&M(t),lt(n,o)}}}function Af(i){let t,e;return{c(){t=V("em"),b(t,"class",e=je(i[0].state?"em-solid":"em-dotted")+" svelte-1h27ktp"),b(t,"style",i[3])},m(n,o){z(n,t,o)},p(n,o){o&1&&e!==(e=je(n[0].state?"em-solid":"em-dotted")+" svelte-1h27ktp")&&b(t,"class",e),o&8&&b(t,"style",n[3])},d(n){n&&M(t)}}}function hs(i){let t,e,n=`${i[6].width}px`;return{c(){t=V("div"),b(t,"class",e=je(i[6].state?"em-solid":"em-dotted")+" svelte-1h27ktp"),b(t,"style",i[3]),T(t,"width",n)},m(o,s){z(o,t,s)},p(o,s){s&1&&e!==(e=je(o[6].state?"em-solid":"em-dotted")+" svelte-1h27ktp")&&b(t,"class",e),s&8&&b(t,"style",o[3]),s&1&&n!==(n=`${o[6].width}px`)&&T(t,"width",n)},d(o){o&&M(t)}}}function vf(i){let t,e,n,o,s=i[0].labelElement+"",r,a,l=`${i[0].labelOffset}%`,c=`${i[0].width}px`,d=`${i[0].left}px`,f=`${i[0].top}px`,u=`rotate(${i[0].rotateDeg}deg)`;function h(g,v){return g[0].children.length===0?Af:gf}let p=h(i),A=p(i);return{c(){t=V("div"),A.c(),e=ee(),n=V("div"),o=V("div"),r=Ee(s),b(o,"class","PanoRulerPlugin-rule-label-name svelte-1h27ktp"),De(()=>i[4].call(o)),b(n,"class","PanoRulerPlugin-rule-label svelte-1h27ktp"),T(n,"left",l),b(t,"class","PanoRulerPlugin-rule-line svelte-1h27ktp"),T(t,"width",c),T(t,"left",d),T(t,"top",f),T(t,"transform",u),T(t,"display",i[0].visible&&i[2]?"block":"none")},m(g,v){z(g,t,v),A.m(t,null),Q(t,e),Q(t,n),Q(n,o),Q(o,r),a=Et(o,i[4].bind(o))},p(g,[v]){p===(p=h(g))&&A?A.p(g,v):(A.d(1),A=p(g),A&&(A.c(),A.m(t,e))),v&1&&s!==(s=g[0].labelElement+"")&&xe(r,s),v&1&&l!==(l=`${g[0].labelOffset}%`)&&T(n,"left",l),v&1&&c!==(c=`${g[0].width}px`)&&T(t,"width",c),v&1&&d!==(d=`${g[0].left}px`)&&T(t,"left",d),v&1&&f!==(f=`${g[0].top}px`)&&T(t,"top",f),v&1&&u!==(u=`rotate(${g[0].rotateDeg}deg)`)&&T(t,"transform",u),v&5&&T(t,"display",g[0].visible&&g[2]?"block":"none")},i:Z,o:Z,d(g){g&&M(t),A.d(),a()}}}function bf(i,t,e){let n,{rulerItemProp:o}=t,s=!0,r,a="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGZpbHRlciBpZD0icHJlZml4X19hIiBoZWlnaHQ9IjQwMCUiIHdpZHRoPSIxMzcuNCUiIHg9Ii0xOC43JSIgeT0iLTE1MCUiPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0iZGlsYXRlIiByYWRpdXM9Ii41IiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSIvPjxmZU9mZnNldCBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiByYWRpdXM9IjEiIHJlc3VsdD0ic2hhZG93SW5uZXIiLz48ZmVPZmZzZXQgaW49InNoYWRvd0lubmVyIiByZXN1bHQ9InNoYWRvd0lubmVyIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIGluMj0ic2hhZG93SW5uZXIiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIuNSIvPjxmZUNvbG9yTWF0cml4IGluPSJzaGFkb3dCbHVyT3V0ZXIxIiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMiAwIi8+PC9maWx0ZXI+PHBhdGggaWQ9InByZWZpeF9fYiIgZD0iTS44ODkgMkgxMS41OCIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1kYXNoYXJyYXk9IjUgNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIGZpbGw9IiMwMDAiIGZpbHRlcj0idXJsKCNwcmVmaXhfX2EpIiB4bGluazpocmVmPSIjcHJlZml4X19iIi8+PHVzZSBzdHJva2U9IiNmZmYiIHN0cm9rZS1vcGFjaXR5PSIuNCIgeGxpbms6aHJlZj0iI3ByZWZpeF9fYiIvPjwvZz48L3N2Zz4=";function l(){r=this.offsetWidth,e(1,r)}return i.$$set=c=>{"rulerItemProp"in c&&e(0,o=c.rulerItemProp)},i.$$.update=()=>{i.$$.dirty&3&&(r>=o.width||r/2>=o.labelOffset/100*o.width||r/2>=(1-o.labelOffset/100)*o.width?e(2,s=!1):e(2,s=!0))},e(3,n=`--background-image: url(${a})`),[o,r,s,n,l]}class yf extends oe{constructor(t){super(),ie(this,t,bf,vf,ne,{rulerItemProp:0},pf)}}function ms(i,t,e){const n=i.slice();return n[12]=t[e],n}function ps(i){let t,e;return t=new yf({props:{rulerItemProp:i[12]}}),{c(){$(t.$$.fragment)},m(n,o){q(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.rulerItemProp=n[12]),t.$set(s)},i(n){e||(k(t.$$.fragment,n),e=!0)},o(n){S(t.$$.fragment,n),e=!1},d(n){K(t,n)}}}function wf(i){let t,e,n=i[0],o=[];for(let r=0;r<n.length;r+=1)o[r]=ps(ms(i,n,r));const s=r=>S(o[r],1,1,()=>{o[r]=null});return{c(){t=V("div");for(let r=0;r<o.length;r+=1)o[r].c()},m(r,a){z(r,t,a);for(let l=0;l<o.length;l+=1)o[l].m(t,null);e=!0},p(r,[a]){if(a&1){n=r[0];let l;for(l=0;l<n.length;l+=1){const c=ms(r,n,l);o[l]?(o[l].p(c,a),k(o[l],1)):(o[l]=ps(c),o[l].c(),k(o[l],1),o[l].m(t,null))}for(se(),l=n.length;l<o.length;l+=1)s(l);re()}},i(r){if(!e){for(let a=0;a<n.length;a+=1)k(o[a]);e=!0}},o(r){o=o.filter(Boolean);for(let a=0;a<o.length;a+=1)S(o[a]);e=!1},d(r){r&&M(t),lt(o,r)}}}function Cf(i,t,e){var A,g,v,w;let{five:n}=t,{rulerDatas:o}=t,{options:s}=t,r=[];const a=((g=(A=n.getElement())==null?void 0:A.parentElement)==null?void 0:g.clientWidth)||0,l=((w=(v=n.getElement())==null?void 0:v.parentElement)==null?void 0:w.clientHeight)||0,c=(y,P)=>{const I=[[{x:0,y:0},{x:a,y:0}],[{x:0,y:0},{x:0,y:l}],[{x:a,y:0},{x:a,y:l}],[{x:0,y:l},{x:a,y:l}]],C=[];for(let L=0;L<I.length;L++){const D=Ma([y,P],[I[L][0],I[L][1]],!0);D&&C.push(D)}return C.length===0?!1:C},d=(y,P)=>{const I=y.clone().project(n.camera),C=(I.x+1)/2*a,L=(-I.y+1)/2*l,D=P.clone().project(n.camera),B=(D.x+1)/2*a,N=(-D.y+1)/2*l,F=Math.sqrt(Math.pow(B-C,2)+Math.pow(N-L,2));return{startLeft:C,startTop:L,endLeft:B,endTop:N,distance:F}},f=(y,P,I)=>{const C=n.camera.position,L=n.camera.getWorldDirection(new H.Vector3),D=y.clone().sub(C).normalize().angleTo(L),B=P.clone().sub(C).normalize().angleTo(L),N=y.distanceTo(P),X=P.clone().sub(P.clone().sub(y).divide(new H.Vector3(2,2,2))).distanceTo(C),{startLeft:j,startTop:E,endLeft:R,endTop:O,distance:W}=d(y,P),_=-((Math.PI/2-Math.atan2(R-j,E-O))/Math.PI)*180;let J=!0;I||(J=!1),!Je(y,I)&&!Je(P,I)&&(J=!1),N<.3&&(J=!1),D>Math.PI/2&&(J=!1),B>Math.PI/2&&(J=!1),X/N>8&&(J=!1);let de=50,ue=W;const me=c({x:~~j,y:~~E},{x:~~R,y:~~O});if(me&&me.length===1&&(Je(y,I)?(ue=Math.sqrt(Math.pow(me[0].x-j,2)+Math.pow(me[0].y-E,2)),de=ue/W*50):Je(P,I)&&(ue=Math.sqrt(Math.pow(me[0].x-R,2)+Math.pow(me[0].y-O,2)),de=100-ue/W*50)),me&&me.length===2){const Pe={x:(me[0].x+me[1].x)/2,y:(me[0].y+me[1].y)/2};de=Math.sqrt(Math.pow(Pe.x-j,2)+Math.pow(Pe.y-E,2))/W*100}return{startLeft:j,startTop:E,distance:W,deg:_,visible:J,labelOffset:de,ruleLength:N}},u=()=>{const y=n.panoIndex,P=o.find(F=>F.panoIndex===y);if(!P)return e(0,r=[]);if(n.currentMode!==be.Five.Mode.Panorama)return e(0,r=[]);const I=n.camera.position,C=n.camera.getWorldDirection(new H.Vector3),L=P.lines.map(F=>new H.Vector3(F.start[0],-F.start[1],-F.start[2])),D=P.lines.map(F=>new H.Vector3(F.end[0],-F.end[1],-F.end[2])),[B]=L.concat(D).sort((F,X)=>{const j=F.clone().setY(0).sub(I).normalize().angleTo(C.clone().setY(0)),E=X.clone().setY(0).sub(I).normalize().angleTo(C.clone().setY(0));return j-E}),N=P.lines.map(F=>{var ue,me;const X=F.start,j=F.end,{startLeft:E,startTop:R,distance:O,deg:W,visible:U,labelOffset:_,ruleLength:J}=f(new H.Vector3(X[0],-X[1],-X[2]),new H.Vector3(j[0],-j[1],-j[2]),B),de=[];return F.children&&((ue=F.children)==null?void 0:ue.length)>0&&((me=F.children)==null||me.forEach(Pe=>{const Me=Pe.start,Re=Pe.end,{distance:ae}=d(new H.Vector3(Me[0],-Me[1],-Me[2]),new H.Vector3(Re[0],-Re[1],-Re[2]));de.push({width:ae,state:Pe.state})})),{width:O,left:E,top:R,rotateDeg:W,state:F.state,children:de,labelOffset:_,visible:U,labelElement:s.distanceText(J)}});e(0,r=N)},h=()=>ci(u),p=lo(u,80);return Ze(()=>{u(),n.on("panoArrived",u),n.on("modeChange",u),n.on("cameraDirectionUpdate",h),n.on("movingToPano",h),n.on("mouseWheel",()=>p()),n.on("pinchGesture",()=>p())}),It(()=>{n.off("panoArrived",u),n.off("modeChange",u),n.off("cameraDirectionUpdate",h),n.off("movingToPano",h),n.off("mouseWheel",()=>p()),n.off("pinchGesture",()=>p())}),i.$$set=y=>{"five"in y&&e(1,n=y.five),"rulerDatas"in y&&e(2,o=y.rulerDatas),"options"in y&&e(3,s=y.options)},[r,n,o,s]}class Ef extends oe{constructor(t){super(),ie(this,t,Cf,wf,ne,{five:1,rulerDatas:2,options:3})}}class Pf{constructor(t,e){m(this,"five");m(this,"container",document.createElement("div"));m(this,"panoRulerProData");m(this,"rulerItems");m(this,"state",{enabled:!1,loaded:!1,options:{className:"",distanceText:t=>`${t.toFixed(1)}m`}});var n,o;this.five=t,this.container.classList.add("panoRulerProPlugin-container"),this.container.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;"),e&&(e.data&&this.load(e.data),this.state.options=G(G({},this.state.options),e.options||{}),(n=e.options)!=null&&n.className&&this.container.classList.add((o=e.options)==null?void 0:o.className)),this.five.once("modelLoaded",()=>Y(this,null,function*(){var s,r;(r=(s=this.five.getElement())==null?void 0:s.parentNode)==null||r.append(this.container)})),this.five.once("dispose",()=>this.dispose())}load(t){return Y(this,null,function*(){if(!this.five.work)return;const e=t.data;if(!e)throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");this.panoRulerProData=e,this.state.loaded=!0})}enable(){return this.state.loaded?(this.state.enabled||(this.state.enabled=!0,this.render()),!0):!1}disable(){return this.state.enabled&&(this.state.enabled=!1,this.render()),!0}render(){return Y(this,null,function*(){var t;if(this.state.enabled){if(!this.panoRulerProData||!this.container)return;this.rulerItems=new Ef({target:this.container,props:{five:this.five,rulerDatas:this.panoRulerProData,options:this.state.options}})}else(t=this.rulerItems)==null||t.$destroy(),this.rulerItems=void 0})}dispose(){this.container&&(this.rulerItems.$destroy(),this.rulerItems=void 0),this.container.remove()}}const If=(i,t)=>new Pf(i,t),kf="data:image/png;base64,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";function xf(){const i=document.createElement("div"),t=document.createElement("i"),e=document.createElement("span");return i.appendChild(t),i.appendChild(e),i.style.position="relative",i.style.width="100%",i.style.display="flex",i.style.flexDirection="column",i.style.alignItems="center",i.style.marginTop=`${150/16}rem`,i.style.opacity="0",i.style.transition="opacity 1000ms linear",t.style.display="block",t.style.width=`${134/16}rem`,t.style.height=`${22/16}rem`,t.style.backgroundSize="100%",t.style.backgroundRepeat="no-repeat",t.style.backgroundImage=`url(${kf})`,e.style.marginTop=`${10/16}rem`,e.style.fontSize=`${16/16}rem`,e.style.color="#fff",e.style.opacity="0.7",e.style.textShadow="0 2px 16px rgb(22 34 83 / 24%)",e.style.fontWeight="bold",{appendTo(n){n.appendChild(i)},dispose(){i.remove()},setRoom(n){e.innerHTML=n.name+" "+Math.floor(n.size/1e6)+"\u33A1"},show(){i.style.opacity="1"},hide(){i.style.opacity="0"}}}const Df=new x.TextureLoader;function gs(i){return Y(this,null,function*(){return new Promise((t,e)=>{Df.load(i,t,void 0,e)}).then(t=>(t.encoding=x.sRGBEncoding,t))})}const xn={userAction:!0};class Lf extends Ht{constructor(e,n){super(e);m(this,"state",{visible:!0,enabled:!0,config:{compassImageUrl:"//vrlab-image4.ljcdn.com/release/web/v3/north-point-circle.96498e69.png",entryDoorImageUrl:"//vrlab-image4.ljcdn.com/release/web/enterDoor.831b8208.png"}});m(this,"data");m(this,"group",new x.Group);m(this,"roomInfoInstance");m(this,"roomInfoWrapperInstance");m(this,"compassMeshTween");m(this,"compassMesh");m(this,"entryDoorMesh");m(this,"dispose",()=>{var e,n,o,s;this.five.scene.remove(this.group),this.group.remove(...this.group.children),(n=(e=this.compassMesh)==null?void 0:e.material.map)==null||n.dispose(),(s=(o=this.entryDoorMesh)==null?void 0:o.material.map)==null||s.dispose(),this.five.off("dispose",this.dispose),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_addEventListener",()=>{this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("modeChange",this.onFiveModeChange),this.five.on("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_removeEventListener",()=>{this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("modeChange",this.onFiveModeChange),this.five.off("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_enable",()=>{this.five.scene.add(this.group),this.init(),this.onFivePanoArrived(this.five.panoIndex||0),this._addEventListener()});m(this,"_disable",()=>{this._clearCompassIfNeed(),this._clearEntryDoorIfNeed(),this.five.scene.remove(this.group),this._removeEventListener()});m(this,"_toggleVisible",()=>{this.group.visible=this.state.visible,this.five.needsRender=!0});m(this,"_clearCompassIfNeed",()=>{var e;this.compassMesh&&(this.group.remove(this.compassMesh),(e=this.compassMesh.material.map)==null||e.dispose(),this.compassMesh=null)});m(this,"_clearEntryDoorIfNeed",()=>{var e;this.entryDoorMesh&&(this.group.remove(this.entryDoorMesh),(e=this.entryDoorMesh.material.map)==null||e.dispose(),this.entryDoorMesh=null),this.roomInfoInstance&&(this.roomInfoInstance.dispose(),this.roomInfoInstance=null),this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.dispose(),this.roomInfoWrapperInstance=null)});m(this,"onFivePanoWillArrive",e=>{var n,o;e!==this.five.panoIndex&&((n=this.compassMeshTween)==null||n.dispose(),(o=this.compassMesh)==null||o.material.setValues({opacity:0}))});m(this,"onFivePanoArrived",e=>{var o,s,r,a,l,c,d;const n=(r=(s=(o=this.five.work)==null?void 0:o.observers)==null?void 0:s[e])==null?void 0:r.standingPosition;if(this.compassMesh&&(this.compassMesh.position.copy(n.clone().setY(n.y+.01)),this.compassMesh.material.opacity===0&&((a=this.compassMeshTween)==null||a.dispose(),this.compassMeshTween=La(1e3).onUpdate(({progress:f})=>{var u;(u=this.compassMesh)==null||u.material.setValues({opacity:f}),this.five.needsRender=!0}).play())),this.entryDoorMesh){const u=new x.Vector3(this.data.entrance.position.x,this.data.entrance.position.y,this.data.entrance.position.z).clone().setY(n.y).sub(n).normalize(),h=n.clone().add(u.clone().multiplyScalar(.7)).setY(n.y+.01);this.entryDoorMesh.rotation.z=new x.Vector3(0,0,-1).angleTo(u),this.entryDoorMesh.position.copy(h),((l=this.data)==null?void 0:l.room_observers[e].room.type)===1?(c=this.entryDoorMesh)==null||c.material.setValues({opacity:1}):(d=this.entryDoorMesh)==null||d.material.setValues({opacity:0})}this.roomInfoInstance&&this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.css3DObject.position.copy(n.clone().setY(n.y+.01)),this.roomInfoInstance.setRoom(this.data.room_observers[e].room)),this.five.needsRender=!0});m(this,"onFiveCameraDirectionUpdate",({longitude:e,latitude:n})=>{var o,s;!this.roomInfoWrapperInstance||(this.roomInfoWrapperInstance.css3DObject.rotation.z=e,n>.66&&this.five.getCurrentState().mode==="Panorama"?(o=this.roomInfoInstance)==null||o.show():(s=this.roomInfoInstance)==null||s.hide())});m(this,"onFiveModeChange",(e,n,o,s,r)=>{e!==n&&this.setState({visible:e===be.Five.Mode.Panorama},{userAction:r})});this.five.scene.add(this.group),this.five.once("dispose",this.dispose),this.setState({visible:!0,enabled:!0,config:G(G({},this.state.config),n||{})})}enable(e=xn){this.setState({enabled:!0},e)}disable(e=xn){this.setState({enabled:!1},e)}show(e=xn){if(!!this.state.enabled)return this.setState({visible:!0},e),Promise.resolve()}hide(e=xn){if(!!this.state.enabled)return this.setState({visible:!1},e),Promise.resolve()}setState(e,n={userAction:!0}){var s,r;const o=JSON.parse(JSON.stringify(this.state));this.state={visible:(s=e.visible)!=null?s:o.visible,enabled:(r=e.enabled)!=null?r:o.enabled,config:G(G({},o.config),e.config||{})},this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n.userAction}),e.enabled===!0&&(this._enable(),this.hooks.emit("enable",n)),e.enabled===!1&&(this._disable(),this.hooks.emit("disable",n)),e.visible===!1&&(this._toggleVisible(),this.hooks.emit("hide",n)),e.visible===!0&&(this._toggleVisible(),this.hooks.emit("show",n)),e.config&&this.init()}load(e,n,o=!0){return Y(this,null,function*(){const s=yield this.formatData(e);JSON.stringify(this.data)!==JSON.stringify(s)&&(this.hooks.emit("dataChange",s,this.data),this.data=G({},s),this.init(),n&&this.setState(n,{userAction:o}),this.hooks.emit("dataLoaded",this.data))})}formatData(e){return e.version&&e.data?Promise.resolve(e.data):Promise.resolve(e)}init(){return Y(this,null,function*(){var o,s,r,a;const e=(s=(o=this.data)==null?void 0:o.north_rad)!=null?s:null;this._clearCompassIfNeed(),e!==null&&(this.compassMesh=yield this.loadCompassMesh(),this.compassMesh.rotateX(-Math.PI/2),this.compassMesh.rotateZ(e-Math.PI/2),this.group.add(this.compassMesh));const n=(a=(r=this.data)==null?void 0:r.entrance)!=null?a:null;this._clearEntryDoorIfNeed(),n!==null&&(this.entryDoorMesh=yield this.loadEntryDoorMesh(),this.roomInfoWrapperInstance=this.loadRoomInfo(),this.roomInfoInstance=xf(),this.entryDoorMesh.rotateX(-Math.PI/2),this.roomInfoWrapperInstance&&this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container),this.group.add(this.entryDoorMesh)),this.onFivePanoArrived(this.five.panoIndex||0),this.five.needsRender=!0})}loadCompassMesh(){return Y(this,null,function*(){const e=this.state.config.compassImageUrl,n=yield gs(e),o=new x.CircleGeometry(.7,32),s=new x.MeshBasicMaterial({map:n,transparent:!0,opacity:0,depthTest:!1}),r=new x.Mesh(o,s);return r.name="pano-compass-mesh",r})}loadEntryDoorMesh(){return Y(this,null,function*(){const e=this.state.config.entryDoorImageUrl,n=yield gs(e),o=new x.PlaneGeometry(.2,.16),s=new x.MeshBasicMaterial({map:n,transparent:!0,opacity:.8,depthTest:!1}),r=new x.Mesh(o,s);return r.name="pano-compass-entry-door",r})}loadRoomInfo(){const e=[new x.Vector3(-.7,0,-.7),new x.Vector3(.7,0,-.7),new x.Vector3(.7,0,.7),new x.Vector3(-.7,0,.7)];return en(this.five).create3DDomContainer(e)}}const Sf=(i,t)=>new Lf(i,t);function Dn(i,t,e){const n=i[t],o=i[e];n===void 0||o===void 0||(i[t]=o,i[e]=n)}function Tf(i,t,e){const n=e/2;for(let o=1;o<=n;o++){const s=e-(o-1);for(let r=1;r<=t;r++){const a=(o-1)*t+r-1,l=(s-1)*t+r-1;Dn(i,a*4+0,l*4+0),Dn(i,a*4+1,l*4+1),Dn(i,a*4+2,l*4+2),Dn(i,a*4+3,l*4+3)}}}class Ba{constructor(t,e){m(this,"width");m(this,"height");m(this,"containerDom");m(this,"hooks",new be.Subscribe);m(this,"canvas",document.createElement("canvas"));m(this,"five");m(this,"scale");m(this,"config");m(this,"offset",{x:0,y:0});m(this,"context");m(this,"renderCenter",new x.Vector3);m(this,"hammer");m(this,"state",{enabled:!1});m(this,"offsetRange");m(this,"isPanning",!1);m(this,"onPanstart",()=>{this.isPanning=!0,this.canvas.style.boxShadow="0 2px 30px 0 rgba(0,0,0,0.20)"});m(this,"onPan",t=>{if(!this.isPanning||!this.offsetRange||this.hooks.emit("wantsPanGesture",t))return;const{translateX:n,translateY:o}=this.getPanOffset(t,this.offsetRange);this.canvas.style.transform=`translate3d(${n}px, ${o}px, 100px)`});m(this,"onPanend",t=>{if(this.isPanning=!1,this.canvas.style.boxShadow="none",!this.offsetRange)return;const{translateX:e,translateY:n}=this.getPanOffset(t,this.offsetRange);this.canvas.style.transform=`translate3d(${e}px, ${n}px, 100px)`,this.offset={x:e,y:n}});var o,s,r;if(!t.renderer)throw new Error("Five Render \u672A\u521D\u59CB\u5316");this.five=t,this.scale=(o=e==null?void 0:e.scale)!=null?o:2,this.width=(s=e==null?void 0:e.width)!=null?s:190,this.height=(r=e==null?void 0:e.height)!=null?r:190,this.config={dragEnabled:(e==null?void 0:e.dragEnabled)||!1,autoFixPCPosition:(e==null?void 0:e.autoFixPCPosition)||!1,initialPosition:(e==null?void 0:e.initialPosition)||{left:"0",top:"0"}};const n=this.canvas.getContext("2d");if(!n)throw new Error("CANNOT CREATE CONTEXT2D");this.context=n,this.config.dragEnabled&&(this.hammer=new gn.default(this.canvas),this.hammer.on("pan",this.onPan),this.hammer.on("panstart",this.onPanstart),this.hammer.on("panend",this.onPanend)),this.initStyle()}dispose(){var t;this.clear(),this.disable(),(t=this.hammer)==null||t.destroy()}enable(){if(!this.state.enabled)return this.state.enabled=!0,this.containerDom&&this._appendTo(this.containerDom),this}disable(){if(!!this.state.enabled)return this.state.enabled=!1,this.canvas.remove(),this}appendTo(t){return this.containerDom=t,this.state.enabled&&this._appendTo(t),this}clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this}renderWithPoint(t){!this.containerDom||!this.state.enabled||(this.renderCenter=t,this.render(),this.config.autoFixPCPosition&&this.autoFixPCPosition())}renderWithScreenPoint(t){!this.containerDom||!this.state.enabled||(this.renderCenter=t,this.render(),this.config.autoFixPCPosition&&this.autoFixPCPosition())}resetOffset(){this.offset={x:0,y:0},this.canvas.style.transform=`translate3d(${0}px, ${0}px, 100px)`}getCurrentState(){return{enabled:this.state.enabled}}getRenderCenter(){return this.renderCenter}_appendTo(t){if(this.resetOffset(),t.appendChild(this.canvas),!this.offsetRange){const e=this.canvas.getBoundingClientRect(),n=t.getBoundingClientRect(),o=n.right-e.right,s=n.bottom-e.bottom,r=n.left-e.left,a=n.top-e.top;this.offsetRange={min:{x:r,y:a},max:{x:o,y:s}}}}autoFixPCPosition(){if(!this.containerDom)return;const{width:t,height:e}=this,[n,o,s]=(()=>{if(this.renderCenter instanceof x.Vector3){const r=this.renderCenter.clone().project(this.five.camera);return[(r.x+1)/2*this.containerDom.clientWidth,-(r.x-1)/2*this.containerDom.clientWidth,-(r.y-1)/2*this.containerDom.clientHeight]}else return[this.renderCenter.x,this.containerDom.clientWidth-this.renderCenter.x,this.renderCenter.y]})();n<183?(this.canvas.style.top=-e/2+"px",this.canvas.style.left=90+"px"):s<183?(this.canvas.style.top=90+"px",this.canvas.style.left=-t/2+"px"):o<183?(this.canvas.style.top=-e/2+"px",this.canvas.style.left=-t-90+"px"):(this.canvas.style.left=-t/2+"px",this.canvas.style.top=-e-90+"px"),this.canvas.style.transform=`translate3d(${n}px, ${s}px, 10px)`,this.offset={x:n,y:s}}render(){if(!this.five.renderer||!this.containerDom)return;const{scale:t,context:e,width:n,height:o}=this,s=this.five.renderer.getSize(new x.Vector2),[r,a]=(()=>{if(this.renderCenter instanceof x.Vector3){const g=this.renderCenter.clone().project(this.five.camera);return[(g.x+1)/2*s.x,(g.y+1)/2*s.y]}else return[this.renderCenter.x,s.y-this.renderCenter.y]})(),l=1,c=n/t,d=o/t,f=l*t,u=this.five.getPixels(r-c/2,a-c/2,c,d,f),h=Math.floor(n*l),p=Math.floor(o*l);Tf(u,h,p);const A=new ImageData(h,p);A.data.set(u),e.putImageData(A,0,0)}initStyle(){const t=this.canvas;t.classList.add("five-plugin__magnifier"),t.style.position="absolute",t.style.pointerEvents="all",t.style.borderRadius="50%",t.style.zIndex="99";const e=1;t.setAttribute("width",(this.width*e).toString()),t.setAttribute("height",(this.height*e).toString()),t.style.border="2px solid rgba(255,255,255,0.20)",t.style.width=this.width+"px",t.style.height=this.height+"px",t.style.top=this.config.initialPosition.top,t.style.left=this.config.initialPosition.left,t.style.transform="translate(0,0,100px)",this.config.dragEnabled&&(this.canvas.style.cursor="pointer")}getPanOffset(t,e){const{min:{x:n,y:o},max:{x:s,y:r}}=e,a=this.offset.x+t.deltaX,l=this.offset.y+t.deltaY,c=Math.min(Math.max(a,n),s),d=Math.min(Math.max(l,o),r);return{translateX:c,translateY:d}}}class Mf{constructor(t){m(this,"edges",[]);m(this,"five");m(this,"onModelLoaded",()=>{!this.five.model||(this.edges=this.five.model.getEdges())});this.five=t,this.five.model.loaded?this.onModelLoaded():this.five.on("modelLoaded",this.onModelLoaded)}dispose(){}getAdsorbentPoint(t){if(this.edges.length===0)return null;let e=1/0,n;return this.edges.forEach(o=>{const s=o.closestPointToPoint(t.point,!0,new H.Vector3),r=s.distanceTo(t.point);r<e&&(n=s,e=r)}),e>.1?null:n||null}}function zf(i,t){for(let e=0,n=t.length;e<n;e++)if(i===t[e])return t.splice(e,1)[0]}class _e{constructor(t){m(this,"id");m(this,"lines");m(this,"position");m(this,"type","point");this.id=He(),this.lines=[],this.position=new H.Vector3,t instanceof H.Vector3?this.position.copy(t):this.position.fromArray(t)}toJson(){return{id:this.id,position:this.position.toArray()}}addLine(t){this.lines.push(t)}removeLine(t){zf(t,this.lines)}clone(){return new _e(this.position)}}class ui{constructor(t){m(this,"id",He());m(this,"lines",[]);m(this,"points",[]);m(this,"visiblePanoIndexes");m(this,"model");m(this,"type","polyline");m(this,"hook",new be.Subscribe);this.model=t.model}addLine(t){if(this.includes(t)){console.error(new Error("\u4E0D\u80FD\u91CD\u590D\u6DFB\u52A0\u7EBF\u6BB5"));return}const e=this.getLastPoint(),n=e&&t.findAnotherPoint(e);e?e&&n?(this.lines.push(t),this.points.push(...t.points),this.hook.emit("lineAdded",t)):console.error(new Error("\u4F20\u5165\u7EBF\u6BB5\u65E0\u6CD5\u4E0E\u5F53\u524D\u6298\u7EBF\u8FDB\u884C\u8FDE\u63A5")):(this.lines.push(t),this.points.push(...t.points),this.hook.emit("lineAdded",t))}removeLine(t){if(this.lines.length!==0){if(!this.isLastLine(t)){console.error(new Error("\u4F20\u5165\u7EBF\u6BB5\u4E0D\u662F\u5F53\u524D\u6298\u7EBF\u7684\u6700\u540E\u4E00\u6BB5"));return}this.lines.pop(),this.lines.length===0?this.points.slice(0,this.points.length):this.points.pop(),this.hook.emit("lineRemoved",t)}}isLastLine(t){const e=this.getLastLine();return e?t.id===e.id:!1}getLastLine(){return this.lines.slice(-1)[0]}clear(){this.lines.slice(0,this.lines.length),this.points.slice(0,this.points.length)}overlapWith(t){return t.type==="point"?this.includes(t):t.type==="line"?t.points.some(e=>this.includes(e)):t.type==="polyline"?t.points.some(e=>this.includes(e)):!0}includes(t){return t.type==="point"?this.points.find(({id:e})=>e===t.id)!==void 0:t.type==="line"?this.lines.find(({id:e})=>e===t.id)!==void 0:!1}isEmpty(){return this.points.length===0}getLastPoint(){return this.points.slice(-1)[0]}toJson(){return{id:this.id,lines:this.lines.map(t=>t.toJson()),visiblePanoIndexes:this.visiblePanoIndexes}}getPointByID(t){return this.points.find(({id:e})=>e===t)}fromJson(t){this.clear(),this.id=t.id;const{getPoint:e,getAllPoints:n}=r(),o=t.lines.map(a=>{const[l,c]=a.points,d=e(l),f=e(c);if(!d||!f)throw new Error("\u7EBF\u4E0A\u7684\u70B9\u4E0D\u5B58\u5728");const u=new Ft(d,f,this.model);return u.id=a.id,u.text=a.text,u}),s=n();this.points.push(...s),this.lines.push(...o),this.visiblePanoIndexes=t.visiblePanoIndexes;function r(){const a=new Map;function l(d){const f=a.get(d.id);if(f)return f;const u=new _e(d.position);return u.id=d.id,a.set(d.id,u),u}function c(){return Array.from(a.values())}return{getPoint:l,getAllPoints:c}}return this}replace(t){this.id=t.id,this.clear(),this.lines.push(...t.lines),this.points.push(...t.points)}}const Bf=1,Vf=3,jf=new H.Color(16777215),Qf=new H.Color(6522623),Rf=new H.Color(16777215),Of=new H.Color(6522623),Hf=6,Ff=8,Gf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==",Va=new H.TextureLoader().load(Gf),ja={pointTexture:Va,pointSize:Hf,lineWidth:Bf,lineColor:jf,pointColor:Rf,lineRenderOrder:20,pointsRenderOrder:20};he(G({},ja),{dashed:!0});const Nf={pointTexture:Va,pointSize:Ff,lineWidth:Vf,lineColor:Qf,pointColor:Of,lineRenderOrder:10,pointsRenderOrder:10};function Wf(i,t,e){var d,f,u,h,p;const n=(d=e==null?void 0:e.lineWidth)!=null?d:2,o=(f=e==null?void 0:e.lineColor)!=null?f:new H.Color(16777215),s=(u=e==null?void 0:e.pointSize)!=null?u:5,r=(h=e==null?void 0:e.lineRenderOrder)!=null?h:10,a=(p=e==null?void 0:e.lineRenderOrder)!=null?p:20,l=new Ur.Line(i,t);l.setMaterial({linewidth:n,color:o}),l.line.material.depthTest=!1,l.line.material.transparent=!0,l.line.renderOrder=r,l.points.renderOrder=a;const c=l.points.material;return c.depthTest=!1,c.size=s,e!=null&&e.pointColor&&c.color.set(e.pointColor).convertSRGBToLinear(),e!=null&&e.pointTexture&&(c.map=e.pointTexture),l}function As(i,t){const[e,n]=i.points,o=t==="light"?Nf:ja,s=Wf(e.position,n.position,o);return s.name="normalLine_"+i.id,s}function At(i){const{x:t,y:e,z:n}=i;return!(Math.abs(t)>1||Math.abs(e)>1||Math.abs(n)>1)}function _f(){const i=document.createElement("div");return i.setAttribute("style","backdrop-filter: blur(4px);-webkit-backdrop-filter: blur(4px);-webkit-tap-highlight-color: rgba(0,0,0,0);"),i.style.width="max-content",i.style.padding="3px 6px",i.style.lineHeight="1",i.style.textAlign="center",i.style.transform="translate(-50%, -50%)",i.style.borderRadius="100px",i.style.fontSize="14px",i.style.color="#fff",i.style.background="rgba(195,195,195,0.70)",i.style.border="0.5px solid rgba(255,255,255,0.6)",i.style.cursor="pointer",i}function Xf(i){const t=document.createElement("div");return t.id="distance_"+i.id,t.classList.add("five-plugin-measure__distance"),t.style.opacity="0",t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.width="0",t.style.height="0",t.style.transform="translate3d(0, 0, 0)",t.style.transformOrigin="left top",t}function Yf(i){let t=!0;const{line:e}=i,n=e.id,o=_f(),s=Xf(e),r=i.userDistanceItem,a=new H.Vector3(0,0,0),l={lineID:n,ndcPosition:a,update:u,appendTo:h,remove:p,highlight:d,unHighlight:f,getCurrentContent:A,setItemSelectable:g};s.style.pointerEvents=t?"all":"none",r!=null&&r.element?s.appendChild(r.element):s.appendChild(o);function c(){var v;(v=i.clickCallback)==null||v.call(i,l)}function d(){if(r)return r.highlight();o.style.border="0.5px solid #95AEFF",o.style.background="linear-gradient(90deg, #95AEFF 0%, #6386FF 100%)"}function f(){if(r)return r.unHighlight();o.style.border="0.5px solid rgba(255,255,255,0.6)",o.style.background="rgba(195,195,195,0.70)"}function u(v){if(e.mesh.visible===!1){s.style.opacity="0",s.style.pointerEvents="none";return}const w=v.getElement();if(!w)return;const y=w.clientWidth,P=w.clientHeight,I=y/2,C=P/2;if(e.points.length<2)return;const[L,D]=e.points,B=L.position.clone().project(v.camera),N=D.position.clone().project(v.camera),F=B.clone().lerp(N,.5),X=new H.Vector2(B.x*I,B.y*C),j=new H.Vector2(N.x*I,N.y*C),E=X.distanceTo(j);if((()=>!(Math.abs(B.z)>1||Math.abs(N.z)>1||!At(B)&&!At(N)||!At(F)||E===0))()===!1){s.style.opacity="0",s.style.pointerEvents="none";return}const O=(F.x+1)/2*y,W=-(F.y-1)/2*P,_=-(Math.atan((X.y-j.y)/(X.x-j.x))*180)/Math.PI,J=s.parentElement&&o.clientWidth>E?-20:0;s.style.transform=`translate(${O}px, ${W}px) rotate(${_}deg) translateY(${J}px)`,s.style.opacity="1",s.style.pointerEvents=t?"all":"none",r&&r.update({line:e,polyline:e.getPolyline()});const de=A();o.innerText=de}function h(v){v.appendChild(s),s.addEventListener("click",c)}function p(){o.removeEventListener("click",c),s.remove()}function A(){var L,D,B;if(e.points.length<2)return"";const[v,w]=e.points,y=v.position.clone().distanceTo(w.position),P=(L=i.line.text)!=null?L:i.line.model.config.defaultText,I=(B=(D=i.line.model.config)==null?void 0:D.getDistanceText)==null?void 0:B.call(D,y),C=P!=null?P:I;return C!=null?C:y.toFixed(2)+"m"}function g(v){t=v}return l}class Ft{constructor(t,e,n){m(this,"id");m(this,"selected",!1);m(this,"text");m(this,"type","line");m(this,"model");m(this,"mesh");m(this,"points");m(this,"lightMesh");m(this,"hook");m(this,"distanceItem");m(this,"polyline");var o;if(this.id=He(),this.model=n,t.id===e.id)throw new Error("\u65E0\u6548\u7684\u7EBF\u6BB5, \u4E00\u4E2A\u70B9\u65E0\u6CD5\u6784\u6210\u7EBF\u6BB5");typeof n.config.defaultText=="string"&&(this.text=n.config.defaultText),this.hook=new be.Subscribe,this.points=[t,e],this.mesh=As(this,"normal"),this.lightMesh=As(this,"light"),this.distanceItem=Yf({line:this,clickCallback:()=>this.hook.emit("selected",this),userDistanceItem:(o=this.model.config)!=null&&o.userDistanceItemCreator?this.model.config.userDistanceItemCreator():void 0}),t.lines.push(this),e.lines.push(this)}clear(){this.selected=!1,this.polyline=void 0}isEmpty(){return this.points.length===0}getPolyline(){if(this.polyline)return this.polyline;const t=this.model.polylines.find(e=>e.lines.includes(this));if(t)return this.polyline=t,t}findAnotherPoint(t){return this.points.find(({id:e})=>e!==t.id)}setText(t){this.text=t,this.hook.emit("textChanged",t)}toJson(){return{id:this.id,points:this.points.map(t=>t.toJson()),text:this.text}}clone(){const t=new Ft(this.points[0].clone(),this.points[1].clone(),this.model);return t.text=this.text,t}}class fi{constructor(t){m(this,"config");m(this,"polylines",[]);m(this,"hook",new be.Subscribe);this.config=t}addPolyline(t){if(this.includes(t)){console.error(new Error("\u4E0D\u80FD\u91CD\u590D\u6DFB\u52A0 polyline"));return}this.polylines.push(t),this.hook.emit("polylineAdded",t)}replacePolylineByID(t,e){const n=this.getPolylineByID(t);n==null||n.replace(e)}removePolyline(t){const e=this.polylines.findIndex(({id:n})=>n===t.id);if(e===-1){console.error(new Error("polyline \u4E0D\u5B58\u5728"));return}this.polylines.splice(e,1),this.hook.emit("polylineRemoved",t)}getPolylineByID(t){return this.polylines.find(e=>e.id===t)}getPolylineByLine(t){return this.polylines.find(e=>e.includes(t))}getLineByID(t){return this.getAllLines().find(e=>e.id===t)}getAllLines(){return this.polylines.map(t=>t.lines).flat(1)}getAllPoints(){return this.polylines.map(t=>t.points).flat(1)}includes(t){return this.polylines.find(({id:e})=>e===t.id)!==void 0}clear(){this.polylines.forEach(t=>this.hook.emit("polylineRemoved",t)),this.polylines.splice(0,this.polylines.length)}getClosestPoint(){}parse(t){this.clear(),this.polylines.push(...t.polylines.map(e=>new ui({model:this}).fromJson(e))),this.polylines.forEach(e=>this.hook.emit("polylineAdded",e))}toJson(){return{polylines:this.polylines.map(t=>t.toJson()).filter(t=>t.lines.length>0)}}}const Ln=i=>i.preventDefault();class hi{constructor(t){m(this,"model");m(this,"five");m(this,"group");m(this,"config");m(this,"dashed");m(this,"disposed",!1);m(this,"isMobile");m(this,"mouseGroup");m(this,"container");m(this,"fiveHelper");m(this,"hook");m(this,"magnifier");m(this,"userDistanceItemCreator");m(this,"updateDistanceUI",()=>{this.dashed.distanceItem.update(this.five),this.model.getAllLines().forEach(t=>t.distanceItem.update(this.five))});var n,o;this.five=t.five,this.hook=t.hook,this.model=t.model,this.config=t.config,this.magnifier=t.magnifier,this.container=t.container,this.fiveHelper=t.fiveHelper,this.isMobile=(o=(n=t.openParams)==null?void 0:n.isMobile)!=null?o:!1,this.userDistanceItemCreator=t.userDistanceItemCreator,this.group=t.group,this.mouseGroup=t.mouseGroup,this.dashed=new Ft(new _e([0,0,0]),new _e([0,0,0]),this.model),this.dashed.distanceItem.setItemSelectable(!1),this.dashed.mesh.setMaterial({dashed:!0,dashScale:100}),this.dashed.mesh.name="dashLine";const e=this.five.getElement();e&&(e.addEventListener("touchstart",Ln),e.addEventListener("contextmenu",Ln))}removeLine(t){this.group.remove(t.mesh,t.lightMesh),t.distanceItem.remove(),this.five.needsRender=!0}updateMouseGroup(t,e){if(!t)return this.mouseGroup;const n=this.fiveHelper.getAdsorbentPoint(t),o=n||t.point;if(this.mouseGroup.position.copy(o),e)this.mouseGroup.quaternion.copy(e.quaternion);else if(t.face){const r=t.face.normal.clone().multiplyScalar(.05),l=t.point.clone().add(r).clone().add(r);this.mouseGroup.lookAt(l)}return this.mouseGroup}dispose(){this.disposed=!0,this.magnifier.disable(),this.model.getAllLines().forEach(e=>this.removeLine(e));const t=this.five.getElement();t&&(t.removeEventListener("touchstart",Ln),t.removeEventListener("contextmenu",Ln))}}function Hi(i){const{x:t,y:e}=i.center,{clientWidth:n,clientHeight:o}=i.target,s=i.target.getBoundingClientRect(),r=new H.Vector2(t,e).sub(new H.Vector2(s.left,s.top)),a=new H.Vector2(r.x/n*2-1,-(r.y/o)*2+1);return{point:r,ndcPoint:a}}function Pi(i,t){const e=Hi(t).ndcPoint,n=new H.Raycaster;return n.setFromCamera(e,i.camera),i.model.intersectRaycaster(n)}class Sn extends hi{constructor(e){var o;super(e);m(this,"type","edit");m(this,"polyline");m(this,"pressPoint");m(this,"hasAppendDashed",!1);m(this,"hasAppendMouseGroup",!1);m(this,"fiveElement");m(this,"lastPoint",null);m(this,"hammer");m(this,"onIntersectionUpdate",lo((e,n)=>{var s;this.hasAppendMouseGroup===!1&&(this.group.add(this.mouseGroup),this.magnifier.appendTo(this.container),this.magnifier.enable(),this.hasAppendMouseGroup=!0);const o=this.updateMouseGroup(e,n).position;(s=this.pressPoint)==null||s.position.copy(o),this.updateDashed(),requestAnimationFrame(()=>this.magnifier.renderWithPoint(this.mouseGroup.position)),this.five.needsRender=!0},20));m(this,"revoke",()=>{if(this.polyline.lines.length===0&&this.lastPoint){this.lastPoint=null,this.hasAppendDashed=!1,this.dashed.distanceItem.remove(),this.group.remove(this.dashed.mesh),this.hook.emit("anchorChange",null),this.hook.emit("editedDashedLineChange",null),this.five.needsRender=!0;return}if(this.polyline.lines.length===0&&!this.lastPoint||!this.lastPoint)return;const e=this.polyline.lines[this.polyline.lines.length-1],n=e.findAnotherPoint(this.lastPoint);!n||(this.lastPoint=n,this.hook.emit("anchorChange",n.position),this.group.remove(e.mesh),this.polyline.removeLine(e),this.hasAppendMouseGroup=!1,this.mouseGroup.position.copy(this.lastPoint.position),this.group.remove(this.mouseGroup),e.distanceItem.remove(),this.updateDashed(),this.magnifier.disable(),this.five.needsRender=!0)});m(this,"onMouseLeave",()=>{this.magnifier.disable(),this.group.remove(this.mouseGroup),this.hasAppendMouseGroup=!1,this.lastPoint&&(this.mouseGroup.position.copy(this.lastPoint.position),this.updateDashed())});m(this,"onLineChanged",()=>{this.hook.emit("editedPolylineChange",this.polyline)});m(this,"onPress",e=>{const[n]=Pi(this.five,e);if(!(n!=null&&n.face))return;const o=new _e(n.point);this.pressPoint=o,this.onIntersectionUpdate(n)});m(this,"onPan",e=>{if(!this.pressPoint)return;const[n]=Pi(this.five,e);!(n!=null&&n.face)||this.onIntersectionUpdate(n)});m(this,"onPanEnd",e=>{!this.pressPoint||this.onTap(e)});m(this,"onTap",e=>{this.hasAppendDashed||(this.dashed.distanceItem.appendTo(this.container),this.group.add(this.dashed.mesh)),this.hasAppendDashed=!0;const[n]=Pi(this.five,e);this.updateMouseGroup(n);const o=new _e(this.mouseGroup.position),s=this.lastPoint;if(o&&(this.lastPoint=o),o&&s){const r=new Ft(s,o,this.model);r.distanceItem.setItemSelectable(!1),r.distanceItem.appendTo(this.container),this.polyline.addLine(r),this.group.add(r.mesh),r.distanceItem.update(this.five)}this.pressPoint=void 0,this.hasAppendMouseGroup=!1,this.magnifier.disable(),this.group.remove(this.mouseGroup),this.updateDashed(),this.five.needsRender=!0,this.hook.emit("anchorChange",o.position)});m(this,"onWantsTapGesture",()=>!1);m(this,"onWantsToMoveToPano",()=>!1);m(this,"onWantsPanGesture",()=>this.pressPoint?!1:void 0);m(this,"onCameraUpdate",()=>{this.updateDistanceUI(),this.dashed.distanceItem.update(this.five)});m(this,"updateDashed",()=>{!this.lastPoint||(this.dashed.points[0].position.copy(this.lastPoint.position),this.dashed.points[1].position.copy(this.mouseGroup.position),this.dashed.mesh.setPoints(this.lastPoint.position,this.mouseGroup.position),this.dashed.distanceItem.update(this.five),this.hook.emit("editedDashedLineChange",this.dashed))});this.model=new fi(this.config),this.polyline=new ui({model:this.model}),this.model.addPolyline(this.polyline),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("wantsPanGesture",this.onWantsPanGesture),this.five.on("wantsTapGesture",this.onWantsTapGesture),this.five.on("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.on("intersectionOnModelUpdate",this.onIntersectionUpdate),this.polyline.hook.on("lineAdded",this.onLineChanged),this.polyline.hook.on("lineRemoved",this.onLineChanged);const n=this.five.getElement();if(n){this.fiveElement=n;const s=new gn.default(n);this.hammer=s,s.on("tap",this.onTap),s.on("pan",this.onPan),s.on("press",this.onPress),s.on("panend",this.onPanEnd)}this.five.helperVisible=!1,(o=this.fiveElement)==null||o.addEventListener("mouseleave",this.onMouseLeave),this.hook.emit("anchorChange",null),this.hook.emit("editedDashedLineChange",null),this.five.refresh()}dispose(){var e,n;super.dispose(),this.five.helperVisible=!0,this.group.remove(this.mouseGroup,this.dashed.mesh),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("wantsPanGesture",this.onWantsPanGesture),this.five.off("wantsTapGesture",this.onWantsTapGesture),this.five.off("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.off("intersectionOnModelUpdate",this.onIntersectionUpdate),this.polyline.hook.off("lineAdded",this.onLineChanged),this.polyline.hook.off("lineRemoved",this.onLineChanged),(e=this.hammer)==null||e.destroy(),(n=this.fiveElement)==null||n.removeEventListener("mouseleave",this.onMouseLeave),this.magnifier.dispose(),this.dashed.distanceItem.remove(),this.five.needsRender=!0}getEditingLines(){return this.polyline.lines}}class vs extends hi{constructor(e){super(e);m(this,"type","view");m(this,"hammer");m(this,"polylineRemoved",e=>{e.lines.forEach(n=>this.removeLine(n)),this.hook.emit("selectedChange",this.model.getAllLines().filter(n=>n.selected).map(n=>n))});m(this,"polylineAdded",e=>{const n=this.five.getCurrentState().panoIndex;e.lines.forEach(o=>{e.visiblePanoIndexes&&!e.visiblePanoIndexes.includes(n)&&(o.mesh.visible=!1),o.distanceItem.appendTo(this.container),o.distanceItem.update(this.five),this.group.add(o.mesh)})});m(this,"onCameraUpdate",()=>{this.updateDistanceUI()});m(this,"onFivePanoWillArrive",e=>{this.model.polylines.forEach(n=>{!n.visiblePanoIndexes||n.visiblePanoIndexes.includes(e)||n.lines.forEach(o=>{o.mesh.visible=!1,o.distanceItem.update(this.five)})})});m(this,"onFivePanoArrived",e=>{this.model.polylines.forEach(n=>{!n.visiblePanoIndexes||n.visiblePanoIndexes.includes(e)&&n.lines.forEach(o=>{o.mesh.visible=!0,o.distanceItem.update(this.five)})})});this.model.getAllLines().forEach(o=>{o.distanceItem.appendTo(this.container),o.distanceItem.update(this.five),this.group.add(o.mesh)});const n=this.five.getElement();if(n){const o=new gn.default(n);this.hammer=o}this.updateDistanceUI(),this.five.needsRender=!0,this.model.hook.on("polylineAdded",this.polylineAdded),this.model.hook.on("polylineRemoved",this.polylineRemoved),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive)}dispose(){var e;super.dispose(),this.model.hook.off("polylineAdded",this.polylineAdded),this.model.hook.off("polylineRemoved",this.polylineRemoved),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.needsRender=!0,this.hook.emit("selectedChange",[]),(e=this.hammer)==null||e.destroy()}}const Uf=`
|
|
209
209
|
<svg class="fpm__delete-icon" width="16px" height="17px" viewBox="0 0 16 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
210
210
|
<defs>
|
|
211
211
|
<linearGradient x1="22.185491%" y1="100%" x2="66.8316686%" y2="6.67239121%" id="linearGradient-1">
|
package/dist/index.js
CHANGED
|
@@ -7665,8 +7665,9 @@ class Cs extends mi {
|
|
|
7665
7665
|
);
|
|
7666
7666
|
});
|
|
7667
7667
|
m(this, "polylineAdded", (e) => {
|
|
7668
|
-
|
|
7669
|
-
|
|
7668
|
+
const n = this.five.getCurrentState().panoIndex;
|
|
7669
|
+
e.lines.forEach((o) => {
|
|
7670
|
+
e.visiblePanoIndexes && !e.visiblePanoIndexes.includes(n) && (o.mesh.visible = !1), o.distanceItem.appendTo(this.container), o.distanceItem.update(this.five), this.group.add(o.mesh);
|
|
7670
7671
|
});
|
|
7671
7672
|
});
|
|
7672
7673
|
m(this, "onCameraUpdate", () => {
|