@realsee/dnalogel 2.20.7 → 2.20.8

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.
Files changed (307) hide show
  1. package/dist/index.cjs.js +3 -3
  2. package/dist/index.js +4 -4
  3. package/dist/index.umd.js +3 -3
  4. package/docs/classes/CSS3DRender.html +30 -30
  5. package/docs/classes/CruisePluginController.html +25 -25
  6. package/docs/classes/GuideLineItem.GuideLineItem.html +19 -19
  7. package/docs/classes/GuideLineModeItem.GuideLineModeItem.html +34 -34
  8. package/docs/classes/Magnifier.html +19 -19
  9. package/docs/classes/ModelRoomLabelController.html +10 -10
  10. package/docs/classes/Object3DHelperController.html +24 -24
  11. package/docs/classes/PaintBrush.html +14 -14
  12. package/docs/classes/PanoMeasurePluginLine.html +22 -22
  13. package/docs/classes/PanoMeasurePluginModel.html +21 -21
  14. package/docs/classes/PanoMeasurePluginPoint.html +13 -13
  15. package/docs/classes/PanoMeasurePluginPolyline.html +25 -25
  16. package/docs/classes/PanoTagPluginController.html +46 -46
  17. package/docs/classes/Util.BetterTween.html +8 -8
  18. package/docs/classes/Util.FivePointSelector.html +11 -11
  19. package/docs/classes/Util.Interval.html +11 -11
  20. package/docs/classes/Util.Magnifier.html +16 -16
  21. package/docs/classes/Util.PointDomHelper.html +10 -10
  22. package/docs/classes/Util.PointHelper.html +10 -10
  23. package/docs/classes/Util.Rectangle.html +12 -12
  24. package/docs/enums/CameraMovementEffect.html +6 -6
  25. package/docs/enums/ContentType.html +19 -19
  26. package/docs/enums/DIRECTION.html +8 -8
  27. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +8 -8
  28. package/docs/enums/DimensionType.html +6 -6
  29. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +7 -7
  30. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +8 -8
  31. package/docs/enums/PaintBrushTypeEnum.html +7 -7
  32. package/docs/enums/PointType.html +6 -6
  33. package/docs/enums/Rotation.html +7 -7
  34. package/docs/functions/CSS3DRenderPlugin.html +4 -4
  35. package/docs/functions/CameraMovementPlugin.html +4 -4
  36. package/docs/functions/CruisePlugin.html +4 -4
  37. package/docs/functions/GuideLinePlugin.html +4 -4
  38. package/docs/functions/ItemLabelPlugin.html +4 -4
  39. package/docs/functions/MapviewFloorplanPlugin.html +4 -4
  40. package/docs/functions/ModelChassisCompassPlugin.html +4 -4
  41. package/docs/functions/ModelEntryDoorGuidePlugin.html +4 -4
  42. package/docs/functions/ModelFloorplanPlugin.html +4 -4
  43. package/docs/functions/ModelItemLabelPlugin.html +4 -4
  44. package/docs/functions/ModelRoomLabelPlugin.html +4 -4
  45. package/docs/functions/ModelTVVideoPlugin.html +4 -4
  46. package/docs/functions/ModelViewPlugin.html +4 -4
  47. package/docs/functions/Object3DHelperPlugin.html +4 -4
  48. package/docs/functions/PanoCompassPlugin.html +4 -4
  49. package/docs/functions/PanoCursorRaycasterPlugin.html +4 -4
  50. package/docs/functions/PanoDoorLabelPlugin.html +4 -4
  51. package/docs/functions/PanoFloorplanRadarPlugin.html +4 -4
  52. package/docs/functions/PanoMeasurePlugin.html +4 -4
  53. package/docs/functions/PanoRulerPlugin.html +4 -4
  54. package/docs/functions/PanoRulerProPlugin.html +4 -4
  55. package/docs/functions/PanoSpatialTagPlugin.html +4 -4
  56. package/docs/functions/PanoTagPlugin.html +4 -4
  57. package/docs/functions/PanoVideoPlugin.html +4 -4
  58. package/docs/functions/TopviewFloorplanPlugin.html +4 -4
  59. package/docs/functions/Util.getCoordsFromClient.html +4 -4
  60. package/docs/functions/Util.getCoordsFromElement.html +4 -4
  61. package/docs/functions/Util.getFrameTime.html +4 -4
  62. package/docs/functions/Util.getIntersectFromRelativePosition.html +4 -4
  63. package/docs/functions/Util.getRaycasterFromFivePointer.html +4 -4
  64. package/docs/functions/Util.isAbsoluteURL.html +4 -4
  65. package/docs/functions/Util.isModelLike.html +4 -4
  66. package/docs/functions/Util.isNil.html +4 -4
  67. package/docs/functions/Util.isPanoramaLike.html +4 -4
  68. package/docs/functions/Util.nextFrame.html +4 -4
  69. package/docs/functions/Util.notNil.html +4 -4
  70. package/docs/functions/Util.requestAnimationFrameInterval.html +4 -4
  71. package/docs/functions/Util.tweenProgress.html +4 -4
  72. package/docs/functions/Util.uuid.html +4 -4
  73. package/docs/functions/pluginFlag.html +4 -4
  74. package/docs/index.html +4 -4
  75. package/docs/interfaces/AddTagConfig.html +5 -5
  76. package/docs/interfaces/CSS3DRenderPluginEventMap.html +10 -10
  77. package/docs/interfaces/CSS3DRenderPluginState.html +7 -7
  78. package/docs/interfaces/CameraMovementPluginExportType.html +6 -6
  79. package/docs/interfaces/CruisePluginTypes.Config.html +7 -7
  80. package/docs/interfaces/CruisePluginTypes.CruiseKeyframe.html +11 -11
  81. package/docs/interfaces/CruisePluginTypes.EventMap.html +19 -19
  82. package/docs/interfaces/CruisePluginTypes.MoveAction.html +11 -11
  83. package/docs/interfaces/CruisePluginTypes.MoveWithKeyframesAction.html +13 -13
  84. package/docs/interfaces/CruisePluginTypes.MoveWithPanoIndexAction.html +13 -13
  85. package/docs/interfaces/CruisePluginTypes.PluginData.html +8 -8
  86. package/docs/interfaces/CruisePluginTypes.PluginServerData.html +6 -6
  87. package/docs/interfaces/CruisePluginTypes.PluginState.html +10 -10
  88. package/docs/interfaces/EventMap.html +14 -14
  89. package/docs/interfaces/FloorplanBounding.html +7 -7
  90. package/docs/interfaces/FloorplanData.html +9 -9
  91. package/docs/interfaces/FloorplanEntrance.html +10 -10
  92. package/docs/interfaces/FloorplanExtraObject.html +9 -9
  93. package/docs/interfaces/FloorplanExtraObject3D.html +7 -7
  94. package/docs/interfaces/FloorplanFloorData.html +8 -8
  95. package/docs/interfaces/FloorplanImagePosition.html +6 -6
  96. package/docs/interfaces/FloorplanObserver.html +8 -8
  97. package/docs/interfaces/FloorplanOutlineItem.html +8 -8
  98. package/docs/interfaces/FloorplanPosition.html +6 -6
  99. package/docs/interfaces/FloorplanRoomItem.html +12 -12
  100. package/docs/interfaces/FloorplanRoomLabelItem.html +6 -6
  101. package/docs/interfaces/FloorplanServerBounding.html +7 -7
  102. package/docs/interfaces/FloorplanServerComputedData.html +9 -9
  103. package/docs/interfaces/FloorplanServerData.html +6 -6
  104. package/docs/interfaces/FloorplanServerDoorItem.html +9 -9
  105. package/docs/interfaces/FloorplanServerDoorPosition.html +7 -7
  106. package/docs/interfaces/FloorplanServerEntrance.html +10 -10
  107. package/docs/interfaces/FloorplanServerFloorData.html +8 -8
  108. package/docs/interfaces/FloorplanServerImagePosition.html +6 -6
  109. package/docs/interfaces/FloorplanServerObserver.html +8 -8
  110. package/docs/interfaces/FloorplanServerOutlineItem.html +8 -8
  111. package/docs/interfaces/FloorplanServerPosition.html +6 -6
  112. package/docs/interfaces/FloorplanServerRoomItem.html +13 -13
  113. package/docs/interfaces/FloorplanServerRoomLabelItem.html +6 -6
  114. package/docs/interfaces/GuideLineModeItem.GuideLineTagContainer.html +7 -7
  115. package/docs/interfaces/GuideLinePluginType.CatmullRomCurve3.html +9 -9
  116. package/docs/interfaces/GuideLinePluginType.EventMap.html +12 -12
  117. package/docs/interfaces/GuideLinePluginType.GuideLineGeometryStyle.html +7 -7
  118. package/docs/interfaces/GuideLinePluginType.GuideLineItemContainer.html +5 -5
  119. package/docs/interfaces/GuideLinePluginType.GuideLineMaterialStyle.html +12 -12
  120. package/docs/interfaces/GuideLinePluginType.LineGeometriesConfig.html +7 -7
  121. package/docs/interfaces/GuideLinePluginType.ModelGuideLineStyle.html +17 -17
  122. package/docs/interfaces/GuideLinePluginType.ModelGuideLineTagData.html +6 -6
  123. package/docs/interfaces/GuideLinePluginType.PanoramaGuideLineStyle.html +17 -17
  124. package/docs/interfaces/GuideLinePluginType.PluginDataV2.html +4 -4
  125. package/docs/interfaces/GuideLinePluginType.PluginServerData.html +6 -6
  126. package/docs/interfaces/GuideLinePluginType.PluginState.html +7 -7
  127. package/docs/interfaces/GuideLinePluginType.Route.html +10 -10
  128. package/docs/interfaces/GuideLinePluginType.RouteConfig.html +8 -8
  129. package/docs/interfaces/HelperOffset.html +7 -7
  130. package/docs/interfaces/ImagePlaneGroup.html +5 -5
  131. package/docs/interfaces/ItemLabelPluginData.html +5 -5
  132. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +10 -10
  133. package/docs/interfaces/ItemLabelPluginParametersType.html +8 -8
  134. package/docs/interfaces/MinMax.html +6 -6
  135. package/docs/interfaces/ModelChassisCompassPluginData.html +6 -6
  136. package/docs/interfaces/ModelChassisCompassPluginExportType.html +7 -7
  137. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +6 -6
  138. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +7 -7
  139. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +7 -7
  140. package/docs/interfaces/ModelItemLabelPluginData.html +5 -5
  141. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +10 -10
  142. package/docs/interfaces/ModelItemLabelPluginParametersType.html +6 -6
  143. package/docs/interfaces/ModelRoomLabelPluginData.html +5 -5
  144. package/docs/interfaces/ModelTVVideoPluginData.html +8 -8
  145. package/docs/interfaces/ModelTVVideoPluginExportType.html +7 -7
  146. package/docs/interfaces/ModelTVVideoPluginParameterType.html +5 -5
  147. package/docs/interfaces/ModelViewPluginExportType.html +10 -10
  148. package/docs/interfaces/Object3DHelperState.html +7 -7
  149. package/docs/interfaces/ObjectHelperControllers.html +8 -8
  150. package/docs/interfaces/PaintBrushAction.html +11 -11
  151. package/docs/interfaces/PaintBrushConfigs.html +11 -11
  152. package/docs/interfaces/PaintBrushState.html +9 -9
  153. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +9 -9
  154. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +4 -4
  155. package/docs/interfaces/PanoMeasureParameterType.html +13 -13
  156. package/docs/interfaces/PanoMeasurePluginLineJson.html +7 -7
  157. package/docs/interfaces/PanoMeasurePluginOpenParameter.html +6 -6
  158. package/docs/interfaces/PanoMeasurePluginPointJson.html +6 -6
  159. package/docs/interfaces/PanoMeasurePluginPolylineJson.html +7 -7
  160. package/docs/interfaces/PanoRulerPluginExportType.html +9 -9
  161. package/docs/interfaces/PanoRulerPluginOptions.html +6 -6
  162. package/docs/interfaces/PanoRulerPluginParameterType.html +7 -7
  163. package/docs/interfaces/PanoRulerProPluginExportType.html +8 -8
  164. package/docs/interfaces/PanoRulerProPluginOptions.html +6 -6
  165. package/docs/interfaces/PanoRulerProPluginParameterType.html +6 -6
  166. package/docs/interfaces/PanoRulerProPluginState.html +7 -7
  167. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +4 -4
  168. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +4 -4
  169. package/docs/interfaces/PanoSpatialTagPluginData.html +10 -10
  170. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +9 -9
  171. package/docs/interfaces/PanoSpatialTagPluginExportType.html +12 -12
  172. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +9 -9
  173. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +12 -12
  174. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +10 -10
  175. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +9 -9
  176. package/docs/interfaces/PanoVideoPluginType.LoadParams.html +5 -5
  177. package/docs/interfaces/PanoVideoPluginType.PanoVideoItem.html +7 -7
  178. package/docs/interfaces/PanoVideoPluginType.PluginData.html +5 -5
  179. package/docs/interfaces/PanoVideoPluginType.PluginEventMap.html +8 -8
  180. package/docs/interfaces/PanoVideoPluginType.PluginState.html +5 -5
  181. package/docs/interfaces/PanoVideoPluginType.VideoItem.html +7 -7
  182. package/docs/interfaces/PanoVideoPluginType.VideoMeshParams.html +9 -9
  183. package/docs/interfaces/Point.html +7 -7
  184. package/docs/interfaces/Room.html +8 -8
  185. package/docs/interfaces/RoomInfo.html +6 -6
  186. package/docs/interfaces/RoomLabel.html +13 -13
  187. package/docs/interfaces/RoomRules.html +4 -4
  188. package/docs/interfaces/Rooms.html +4 -4
  189. package/docs/interfaces/Scissor.html +8 -8
  190. package/docs/interfaces/State.html +7 -7
  191. package/docs/interfaces/TagCacheInterface.html +11 -11
  192. package/docs/interfaces/TagConfig.html +12 -12
  193. package/docs/interfaces/TagGLTFObjectGroup.html +5 -5
  194. package/docs/interfaces/TagIconUrl.html +11 -11
  195. package/docs/interfaces/TagObjectGroup.html +5 -5
  196. package/docs/interfaces/TagStyle.html +5 -5
  197. package/docs/interfaces/Tags.html +8 -8
  198. package/docs/interfaces/TemporaryState.html +5 -5
  199. package/docs/interfaces/Util.MagnifierParameter.html +10 -10
  200. package/docs/interfaces/Util.MouseGroupParameter.html +7 -7
  201. package/docs/modules/CruisePluginTypes.html +4 -4
  202. package/docs/modules/GuideLineItem.html +4 -4
  203. package/docs/modules/GuideLineModeItem.html +4 -4
  204. package/docs/modules/GuideLinePluginType.html +4 -4
  205. package/docs/modules/PanoVideoPluginType.html +4 -4
  206. package/docs/modules/Util.html +4 -4
  207. package/docs/modules.html +4 -4
  208. package/docs/types/ArrayPosition.html +4 -4
  209. package/docs/types/AudioAppearance.html +4 -4
  210. package/docs/types/AudioTagTypeConfigKey.html +4 -4
  211. package/docs/types/CSS3DRenderExportType.html +4 -4
  212. package/docs/types/CSS3DRenderPluginExportType.html +4 -4
  213. package/docs/types/CSS3DRenderPluginParameterType.html +4 -4
  214. package/docs/types/ClassFunctionParameters.html +4 -4
  215. package/docs/types/Color.html +4 -4
  216. package/docs/types/ContentTypeConfigKey.html +4 -4
  217. package/docs/types/ContentTypeConfigKeySplit.html +4 -4
  218. package/docs/types/ContentTypeMap.html +4 -4
  219. package/docs/types/Create3DDomContainerReturnType.html +4 -4
  220. package/docs/types/Create3DElementReturnType.html +4 -4
  221. package/docs/types/CruisePluginExportType.html +4 -4
  222. package/docs/types/CruisePluginTypes.CruiseData.html +4 -4
  223. package/docs/types/CruisePluginTypes.MoveEffect.html +4 -4
  224. package/docs/types/DeprecatedMediaPlaneProperty.html +4 -4
  225. package/docs/types/DeprecatedTagProperty.html +4 -4
  226. package/docs/types/Direction-1.html +4 -4
  227. package/docs/types/Direction4.html +4 -4
  228. package/docs/types/ElementRenderer.html +4 -4
  229. package/docs/types/FloorplanRuleLabels.html +4 -4
  230. package/docs/types/FloorplanServerRuleLabels.html +4 -4
  231. package/docs/types/GuideLinePluginExportType.html +4 -4
  232. package/docs/types/GuideLinePluginType.GuideLineItem.html +4 -4
  233. package/docs/types/GuideLinePluginType.GuideLineItemEventMap.html +4 -4
  234. package/docs/types/GuideLinePluginType.GuideLineModeItemMode.html +4 -4
  235. package/docs/types/GuideLinePluginType.GuideLineStyle.html +4 -4
  236. package/docs/types/GuideLinePluginType.ModelGuideLineTag.html +4 -4
  237. package/docs/types/GuideLinePluginType.PathItem.html +4 -4
  238. package/docs/types/GuideLinePluginType.PluginData.html +4 -4
  239. package/docs/types/HelperEventMap.html +4 -4
  240. package/docs/types/LoadTagConfig.html +4 -4
  241. package/docs/types/MapviewFloorplanPluginParameterType.html +4 -4
  242. package/docs/types/MapviewFloorplanPluginReturnType.html +4 -4
  243. package/docs/types/MediaData.html +4 -4
  244. package/docs/types/MediaStore.html +4 -4
  245. package/docs/types/ModelEntryDoorGuidePluginParameterType.html +4 -4
  246. package/docs/types/ModelFloorplanPluginParameterType.html +4 -4
  247. package/docs/types/ModelFloorplanPluginReturnType.html +4 -4
  248. package/docs/types/ModelRoomLabelPluginParameters.html +4 -4
  249. package/docs/types/ModelRoomLabelPluginReturnType.html +4 -4
  250. package/docs/types/MoveArgs.html +4 -4
  251. package/docs/types/MoveOpts.html +4 -4
  252. package/docs/types/Object3DHelperEventMap.html +4 -4
  253. package/docs/types/ObjectFit.html +4 -4
  254. package/docs/types/PaintBrushEventMap.html +4 -4
  255. package/docs/types/PanoCompassPluginData.html +4 -4
  256. package/docs/types/PanoCompassPluginExportType.html +4 -4
  257. package/docs/types/PanoCompassPluginParameterType.html +4 -4
  258. package/docs/types/PanoFloorplanRadarPluginParameterType.html +4 -4
  259. package/docs/types/PanoFloorplanRadarPluginReturnType.html +4 -4
  260. package/docs/types/PanoIndex.html +4 -4
  261. package/docs/types/PanoMeasurePluginEvent.html +4 -4
  262. package/docs/types/PanoMeasureReturnType.html +4 -4
  263. package/docs/types/PanoSpatialTagPluginId.html +4 -4
  264. package/docs/types/PanoTagPluginExportInterface.html +4 -4
  265. package/docs/types/PanoTagPluginParamsInterface.html +4 -4
  266. package/docs/types/PanoVideoPluginParameterType.html +4 -4
  267. package/docs/types/PanoVideoPluginReturnType.html +4 -4
  268. package/docs/types/PartialObjectDeep.html +4 -4
  269. package/docs/types/PickTagContentTypeInContentTypeConfigKey.html +4 -4
  270. package/docs/types/PlaneTag.html +4 -4
  271. package/docs/types/Point2DTag.html +4 -4
  272. package/docs/types/Point3DTag.html +4 -4
  273. package/docs/types/PointTag.html +4 -4
  274. package/docs/types/PointTagInstance.html +4 -4
  275. package/docs/types/Position.html +4 -4
  276. package/docs/types/RotateArgs.html +4 -4
  277. package/docs/types/RotateOpts.html +4 -4
  278. package/docs/types/RuleLabelsKey.html +4 -4
  279. package/docs/types/RuleLabelsValue.html +4 -4
  280. package/docs/types/StickType.html +4 -4
  281. package/docs/types/Tag.html +4 -4
  282. package/docs/types/Tag2D.html +4 -4
  283. package/docs/types/Tag3D.html +4 -4
  284. package/docs/types/TagContentType.html +4 -4
  285. package/docs/types/TagDimensionType.html +4 -4
  286. package/docs/types/TagElement.html +4 -4
  287. package/docs/types/TagEvents.html +4 -4
  288. package/docs/types/TagGLTFObject.html +4 -4
  289. package/docs/types/TagHooks.html +4 -4
  290. package/docs/types/TagId.html +4 -4
  291. package/docs/types/TagInstance.html +4 -4
  292. package/docs/types/TagPointType.html +4 -4
  293. package/docs/types/TagRendererMap.html +4 -4
  294. package/docs/types/TopviewFloorplanPluginParameterType.html +4 -4
  295. package/docs/types/TopviewFloorplanPluginReturnType.html +4 -4
  296. package/docs/types/WorkCode.html +4 -4
  297. package/docs/variables/FLOOR_TYPE_MAP.html +4 -4
  298. package/docs/variables/PLUGIN.html +4 -4
  299. package/docs/variables/ROOM_FETILE_TYPE_MAP.html +4 -4
  300. package/docs/variables/ROOM_TYPE_MAP.html +4 -4
  301. package/docs/variables/itemLabelPluginServerParams.html +4 -4
  302. package/docs/variables/modelItemLabelPluginServerParams.html +4 -4
  303. package/docs/variables/modelRoomLabelPluginServerParams.html +4 -4
  304. package/libs/GuideLinePlugin/GuideLineModeItem/index.js +2 -2
  305. package/libs/base/BasePlugin.js +1 -1
  306. package/libs/shared-utils/logger.js +1 -1
  307. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Au=Object.defineProperty,bu=Object.defineProperties;var yu=Object.getOwnPropertyDescriptors;var Da=Object.getOwnPropertySymbols;var wu=Object.prototype.hasOwnProperty,Pu=Object.prototype.propertyIsEnumerable;var ar=(i,t,e)=>t in i?Au(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,F=(i,t)=>{for(var e in t||(t={}))wu.call(t,e)&&ar(i,e,t[e]);if(Da)for(var e of Da(t))Pu.call(t,e)&&ar(i,e,t[e]);return i},ye=(i,t)=>bu(i,yu(t));var f=(i,t,e)=>(ar(i,typeof t!="symbol"?t+"":t,e),e);var Y=(i,t,e)=>new Promise((n,o)=>{var s=l=>{try{a(e.next(l))}catch(c){o(c)}},r=l=>{try{a(e.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,r);a((e=e.apply(i,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("@realsee/five"),R=require("three"),Qo=require("three/examples/jsm/renderers/CSS3DRenderer"),Ki=require("hammerjs"),yd=require("@realsee/five/line"),wd=require("three/examples/jsm/loaders/FBXLoader"),Ma=require("animejs"),Cu=require("@realsee/five/gltf-loader");function Eu(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>i[e]})}}return t.default=i,Object.freeze(t)}const I=Eu(R);function Iu(){console.info("%c %c@realsee/dnalogel %cv2.20.7",["background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')","background-repeat: no-repeat","background-position: 0 center","padding-left: 8px"].join(";"),"","background-color: #12ce9b;color:black;padding:0 6px;border-radius: 3px")}function ku(){const i=typeof OffscreenCanvas!="undefined",t=i&&new OffscreenCanvas(1,1).getContext("webgl")!==null;i&&!t&&Object.assign(window,{OffscreenCanvas:function(e,n){const o=document.createElement("canvas");return o.width=e,o.height=n,o}})}function Pd(){}const Sa=()=>Promise.resolve(),La={__queue:Promise.resolve()};function xu(i=Sa){La.__queue=La.__queue.then(i).catch(Sa)}function Ao(i,t,e){const n=i.x,o=i.y,s=Math.floor(n/t*1e4)/1e4,r=Math.floor(o/e*1e4)/1e4;return{x:s,y:r}}function lr(i,t,e){const{x:n,y:o}=i,s=n*t,r=o*e;return{x:s,y:r}}function bo(i){if(i.length<2)return{};const t=i.slice(-2),e=t[0],n={x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2};return{control:e,end:n}}function Du(i,t,e=Pd){new Promise(n=>{setTimeout(()=>{e(),n(!0)},t*i)})}const Mu=window,Ta=window.requestAnimationFrame||Mu.webkitRequestAnimationFrame||(i=>setTimeout(i,16));function jo(i,t=0){t<=0?Ta(i):Ta(()=>jo(i,t-1))}var kt=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return this.None(i)},Out:function(i){return this.None(i)},InOut:function(i){return this.None(i)}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var t=1.70158;return i===1?1:i*i*((t+1)*i-t)},Out:function(i){var t=1.70158;return i===0?0:--i*i*((t+1)*i+t)+1},InOut:function(i){var t=2.5949095;return(i*=2)<1?.5*(i*i*((t+1)*i-t)):.5*((i-=2)*i*((t+1)*i+t)+2)}}),Bounce:Object.freeze({In:function(i){return 1-kt.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?kt.Bounce.In(i*2)*.5:kt.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(t){return Math.pow(t,i)},Out:function(t){return 1-Math.pow(1-t,i)},InOut:function(t){return t<.5?Math.pow(t*2,i)/2:(1-Math.pow(2-t*2,i))/2+.5}}}}),Un=function(){return performance.now()},Cd=function(){function i(){this._tweens={},this._tweensAddedDuringUpdate={}}return i.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},i.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},i.prototype.update=function(t,e){t===void 0&&(t=Un()),e===void 0&&(e=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<n.length;o++){var s=this._tweens[n[o]],r=!e;s&&s.update(t,r)===!1&&!e&&delete this._tweens[n[o]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},i}(),wn={Linear:function(i,t){var e=i.length-1,n=e*t,o=Math.floor(n),s=wn.Utils.Linear;return t<0?s(i[0],i[1],n):t>1?s(i[e],i[e-1],e-n):s(i[o],i[o+1>e?e:o+1],n-o)},Bezier:function(i,t){for(var e=0,n=i.length-1,o=Math.pow,s=wn.Utils.Bernstein,r=0;r<=n;r++)e+=o(1-t,n-r)*o(t,r)*i[r]*s(n,r);return e},CatmullRom:function(i,t){var e=i.length-1,n=e*t,o=Math.floor(n),s=wn.Utils.CatmullRom;return i[0]===i[e]?(t<0&&(o=Math.floor(n=e*(1+t))),s(i[(o-1+e)%e],i[o],i[(o+1)%e],i[(o+2)%e],n-o)):t<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):t>1?i[e]-(s(i[e],i[e],i[e-1],i[e-1],n-e)-i[e]):s(i[o?o-1:0],i[o],i[e<o+1?e:o+1],i[e<o+2?e:o+2],n-o)},Utils:{Linear:function(i,t,e){return(t-i)*e+i},Bernstein:function(i,t){var e=wn.Utils.Factorial;return e(i)/e(t)/e(i-t)},Factorial:function(){var i=[1];return function(t){var e=1;if(i[t])return i[t];for(var n=t;n>1;n--)e*=n;return i[t]=e,e}}(),CatmullRom:function(i,t,e,n,o){var s=(e-i)*.5,r=(n-t)*.5,a=o*o,l=o*a;return(2*t-2*e+s+r)*l+(-3*t+3*e-2*s-r)*a+s*o+t}}},ea=function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i}(),Tr=new Cd,is=function(){function i(t,e){e===void 0&&(e=Tr),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=kt.Linear.None,this._interpolationFunction=wn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ea.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e,this},i.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t,this},i.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},i.prototype.start=function(t,e){if(t===void 0&&(t=Un()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var s in this._valuesEnd)o[s]=this._valuesEnd[s];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},i.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},i.prototype._setupProperties=function(t,e,n,o,s){for(var r in n){var a=t[r],l=Array.isArray(a),c=l?"array":typeof a,d=!l&&Array.isArray(n[r]);if(!(c==="undefined"||c==="function")){if(d){var h=n[r];if(h.length===0)continue;for(var u=[a],m=0,v=h.length;m<v;m+=1){var g=this._handleRelativeValue(a,h[m]);if(isNaN(g)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}u.push(g)}d&&(n[r]=u)}if((c==="object"||l)&&a&&!d){e[r]=l?[]:{};var A=a;for(var b in A)e[r][b]=A[b];o[r]=l?[]:{};var h=n[r];if(!this._isDynamic){var y={};for(var b in h)y[b]=h[b];n[r]=h=y}this._setupProperties(A,e[r],h,o[r],s)}else(typeof e[r]=="undefined"||s)&&(e[r]=a),l||(e[r]*=1),d?o[r]=n[r].slice().reverse():o[r]=e[r]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},i.prototype.pause=function(t){return t===void 0&&(t=Un()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},i.prototype.resume=function(t){return t===void 0&&(t=Un()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},i.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},i.prototype.group=function(t){return t===void 0&&(t=Tr),this._group=t,this},i.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},i.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},i.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},i.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},i.prototype.easing=function(t){return t===void 0&&(t=kt.Linear.None),this._easingFunction=t,this},i.prototype.interpolation=function(t){return t===void 0&&(t=wn.Linear),this._interpolationFunction=t,this},i.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},i.prototype.onStart=function(t){return this._onStartCallback=t,this},i.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},i.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},i.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},i.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},i.prototype.onStop=function(t){return this._onStopCallback=t,this},i.prototype.update=function(t,e){if(t===void 0&&(t=Un()),e===void 0&&(e=!0),this._isPaused)return!0;var n,o,s=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>s)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),o=(t-this._startTime)/this._duration,o=this._duration===0||o>1?1:o;var r=this._easingFunction(o);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,r),this._onUpdateCallback&&this._onUpdateCallback(this._object,o),o===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,l=this._chainedTweens.length;a<l;a++)this._chainedTweens[a].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(t,e,n,o){for(var s in n)if(e[s]!==void 0){var r=e[s]||0,a=n[s],l=Array.isArray(t[s]),c=Array.isArray(a),d=!l&&c;d?t[s]=this._interpolationFunction(a,o):typeof a=="object"&&a?this._updateProperties(t[s],r,a,o):(a=this._handleRelativeValue(r,a),typeof a=="number"&&(t[s]=r+(a-r)*o))}},i.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},i.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},i}(),Su="20.0.3",Lu=ea.nextId,Bt=Tr,Tu=Bt.getAll.bind(Bt),zu=Bt.removeAll.bind(Bt),_u=Bt.add.bind(Bt),Ed=Bt.remove.bind(Bt),Vu=Bt.update.bind(Bt),za={Easing:kt,Group:Cd,Interpolation:wn,now:Un,Sequence:ea,nextId:Lu,Tween:is,VERSION:Su,getAll:Tu,removeAll:zu,add:_u,remove:Ed,update:Vu};function ju(i,t,e,n=kt.Linear.None){const o=new is(i).to(t,e).easing(n).start();function s(r){o.update(r)&&requestAnimationFrame(s)}return requestAnimationFrame(s),o}var Xt=(i=>(i.Drawline="Drawline",i.Undo="Undo",i.Exit="Exit",i))(Xt||{});const Hi=Symbol("$$PAINT_BRUSH_EVENT$$");function yo(i){return i[Hi]||(i[Hi]={}),i[Hi]}function Ou(i){i[Hi]||delete i[Hi]}let Bu=class{hasListener(t){const e=yo(this);return e&&e[t]&&e[t].length>0}on(t,e,n){const o=yo(this);return o[t]||(o[t]=[]),o[t].push([e,n||!1]),()=>this.off(t,e)}once(t,e){return this.on(t,e,!0)}off(t,e){if(t===void 0){Ou(this);return}const n=yo(this);if(n[t]||(n[t]=[]),e===void 0){n[t].length=0;return}let o=0;for(;o<n[t].length&&n[t][o][0]!==e;o++);o<n[t].length&&n[t].splice(o,1)}emit(t,...e){let n=!1;const s=yo(this)[t]||[];for(let r of s.slice()){const[a,l=!1]=r,c=a(...e);l&&this.off(t,a),c===!1&&(n=!0)}return n}};function $t(){return((1+Math.random())*65536|0).toString(16).substring(1)}function dt(){return($t()+$t()+"-"+$t()+"-4"+$t().substr(0,3)+"-"+$t()+"-"+$t()+$t()+$t()).toLowerCase()}const Ru=`
1
+ "use strict";var Au=Object.defineProperty,bu=Object.defineProperties;var yu=Object.getOwnPropertyDescriptors;var Da=Object.getOwnPropertySymbols;var wu=Object.prototype.hasOwnProperty,Pu=Object.prototype.propertyIsEnumerable;var ar=(i,t,e)=>t in i?Au(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,F=(i,t)=>{for(var e in t||(t={}))wu.call(t,e)&&ar(i,e,t[e]);if(Da)for(var e of Da(t))Pu.call(t,e)&&ar(i,e,t[e]);return i},ye=(i,t)=>bu(i,yu(t));var f=(i,t,e)=>(ar(i,typeof t!="symbol"?t+"":t,e),e);var Y=(i,t,e)=>new Promise((n,o)=>{var s=l=>{try{a(e.next(l))}catch(c){o(c)}},r=l=>{try{a(e.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,r);a((e=e.apply(i,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("@realsee/five"),R=require("three"),Qo=require("three/examples/jsm/renderers/CSS3DRenderer"),Ki=require("hammerjs"),yd=require("@realsee/five/line"),wd=require("three/examples/jsm/loaders/FBXLoader"),Ma=require("animejs"),Cu=require("@realsee/five/gltf-loader");function Eu(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>i[e]})}}return t.default=i,Object.freeze(t)}const I=Eu(R);function Iu(){console.info("%c %c@realsee/dnalogel %cv2.20.8",["background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')","background-repeat: no-repeat","background-position: 0 center","padding-left: 8px"].join(";"),"","background-color: #12ce9b;color:black;padding:0 6px;border-radius: 3px")}function ku(){const i=typeof OffscreenCanvas!="undefined",t=i&&new OffscreenCanvas(1,1).getContext("webgl")!==null;i&&!t&&Object.assign(window,{OffscreenCanvas:function(e,n){const o=document.createElement("canvas");return o.width=e,o.height=n,o}})}function Pd(){}const Sa=()=>Promise.resolve(),La={__queue:Promise.resolve()};function xu(i=Sa){La.__queue=La.__queue.then(i).catch(Sa)}function Ao(i,t,e){const n=i.x,o=i.y,s=Math.floor(n/t*1e4)/1e4,r=Math.floor(o/e*1e4)/1e4;return{x:s,y:r}}function lr(i,t,e){const{x:n,y:o}=i,s=n*t,r=o*e;return{x:s,y:r}}function bo(i){if(i.length<2)return{};const t=i.slice(-2),e=t[0],n={x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2};return{control:e,end:n}}function Du(i,t,e=Pd){new Promise(n=>{setTimeout(()=>{e(),n(!0)},t*i)})}const Mu=window,Ta=window.requestAnimationFrame||Mu.webkitRequestAnimationFrame||(i=>setTimeout(i,16));function jo(i,t=0){t<=0?Ta(i):Ta(()=>jo(i,t-1))}var kt=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return this.None(i)},Out:function(i){return this.None(i)},InOut:function(i){return this.None(i)}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var t=1.70158;return i===1?1:i*i*((t+1)*i-t)},Out:function(i){var t=1.70158;return i===0?0:--i*i*((t+1)*i+t)+1},InOut:function(i){var t=2.5949095;return(i*=2)<1?.5*(i*i*((t+1)*i-t)):.5*((i-=2)*i*((t+1)*i+t)+2)}}),Bounce:Object.freeze({In:function(i){return 1-kt.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?kt.Bounce.In(i*2)*.5:kt.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(t){return Math.pow(t,i)},Out:function(t){return 1-Math.pow(1-t,i)},InOut:function(t){return t<.5?Math.pow(t*2,i)/2:(1-Math.pow(2-t*2,i))/2+.5}}}}),Un=function(){return performance.now()},Cd=function(){function i(){this._tweens={},this._tweensAddedDuringUpdate={}}return i.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},i.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},i.prototype.update=function(t,e){t===void 0&&(t=Un()),e===void 0&&(e=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<n.length;o++){var s=this._tweens[n[o]],r=!e;s&&s.update(t,r)===!1&&!e&&delete this._tweens[n[o]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},i}(),wn={Linear:function(i,t){var e=i.length-1,n=e*t,o=Math.floor(n),s=wn.Utils.Linear;return t<0?s(i[0],i[1],n):t>1?s(i[e],i[e-1],e-n):s(i[o],i[o+1>e?e:o+1],n-o)},Bezier:function(i,t){for(var e=0,n=i.length-1,o=Math.pow,s=wn.Utils.Bernstein,r=0;r<=n;r++)e+=o(1-t,n-r)*o(t,r)*i[r]*s(n,r);return e},CatmullRom:function(i,t){var e=i.length-1,n=e*t,o=Math.floor(n),s=wn.Utils.CatmullRom;return i[0]===i[e]?(t<0&&(o=Math.floor(n=e*(1+t))),s(i[(o-1+e)%e],i[o],i[(o+1)%e],i[(o+2)%e],n-o)):t<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):t>1?i[e]-(s(i[e],i[e],i[e-1],i[e-1],n-e)-i[e]):s(i[o?o-1:0],i[o],i[e<o+1?e:o+1],i[e<o+2?e:o+2],n-o)},Utils:{Linear:function(i,t,e){return(t-i)*e+i},Bernstein:function(i,t){var e=wn.Utils.Factorial;return e(i)/e(t)/e(i-t)},Factorial:function(){var i=[1];return function(t){var e=1;if(i[t])return i[t];for(var n=t;n>1;n--)e*=n;return i[t]=e,e}}(),CatmullRom:function(i,t,e,n,o){var s=(e-i)*.5,r=(n-t)*.5,a=o*o,l=o*a;return(2*t-2*e+s+r)*l+(-3*t+3*e-2*s-r)*a+s*o+t}}},ea=function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i}(),Tr=new Cd,is=function(){function i(t,e){e===void 0&&(e=Tr),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=kt.Linear.None,this._interpolationFunction=wn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ea.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e,this},i.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t,this},i.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},i.prototype.start=function(t,e){if(t===void 0&&(t=Un()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var s in this._valuesEnd)o[s]=this._valuesEnd[s];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},i.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},i.prototype._setupProperties=function(t,e,n,o,s){for(var r in n){var a=t[r],l=Array.isArray(a),c=l?"array":typeof a,d=!l&&Array.isArray(n[r]);if(!(c==="undefined"||c==="function")){if(d){var h=n[r];if(h.length===0)continue;for(var u=[a],m=0,v=h.length;m<v;m+=1){var g=this._handleRelativeValue(a,h[m]);if(isNaN(g)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}u.push(g)}d&&(n[r]=u)}if((c==="object"||l)&&a&&!d){e[r]=l?[]:{};var A=a;for(var b in A)e[r][b]=A[b];o[r]=l?[]:{};var h=n[r];if(!this._isDynamic){var y={};for(var b in h)y[b]=h[b];n[r]=h=y}this._setupProperties(A,e[r],h,o[r],s)}else(typeof e[r]=="undefined"||s)&&(e[r]=a),l||(e[r]*=1),d?o[r]=n[r].slice().reverse():o[r]=e[r]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},i.prototype.pause=function(t){return t===void 0&&(t=Un()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},i.prototype.resume=function(t){return t===void 0&&(t=Un()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},i.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},i.prototype.group=function(t){return t===void 0&&(t=Tr),this._group=t,this},i.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},i.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},i.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},i.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},i.prototype.easing=function(t){return t===void 0&&(t=kt.Linear.None),this._easingFunction=t,this},i.prototype.interpolation=function(t){return t===void 0&&(t=wn.Linear),this._interpolationFunction=t,this},i.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},i.prototype.onStart=function(t){return this._onStartCallback=t,this},i.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},i.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},i.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},i.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},i.prototype.onStop=function(t){return this._onStopCallback=t,this},i.prototype.update=function(t,e){if(t===void 0&&(t=Un()),e===void 0&&(e=!0),this._isPaused)return!0;var n,o,s=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>s)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),o=(t-this._startTime)/this._duration,o=this._duration===0||o>1?1:o;var r=this._easingFunction(o);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,r),this._onUpdateCallback&&this._onUpdateCallback(this._object,o),o===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,l=this._chainedTweens.length;a<l;a++)this._chainedTweens[a].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(t,e,n,o){for(var s in n)if(e[s]!==void 0){var r=e[s]||0,a=n[s],l=Array.isArray(t[s]),c=Array.isArray(a),d=!l&&c;d?t[s]=this._interpolationFunction(a,o):typeof a=="object"&&a?this._updateProperties(t[s],r,a,o):(a=this._handleRelativeValue(r,a),typeof a=="number"&&(t[s]=r+(a-r)*o))}},i.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},i.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},i}(),Su="20.0.3",Lu=ea.nextId,Bt=Tr,Tu=Bt.getAll.bind(Bt),zu=Bt.removeAll.bind(Bt),_u=Bt.add.bind(Bt),Ed=Bt.remove.bind(Bt),Vu=Bt.update.bind(Bt),za={Easing:kt,Group:Cd,Interpolation:wn,now:Un,Sequence:ea,nextId:Lu,Tween:is,VERSION:Su,getAll:Tu,removeAll:zu,add:_u,remove:Ed,update:Vu};function ju(i,t,e,n=kt.Linear.None){const o=new is(i).to(t,e).easing(n).start();function s(r){o.update(r)&&requestAnimationFrame(s)}return requestAnimationFrame(s),o}var Xt=(i=>(i.Drawline="Drawline",i.Undo="Undo",i.Exit="Exit",i))(Xt||{});const Hi=Symbol("$$PAINT_BRUSH_EVENT$$");function yo(i){return i[Hi]||(i[Hi]={}),i[Hi]}function Ou(i){i[Hi]||delete i[Hi]}let Bu=class{hasListener(t){const e=yo(this);return e&&e[t]&&e[t].length>0}on(t,e,n){const o=yo(this);return o[t]||(o[t]=[]),o[t].push([e,n||!1]),()=>this.off(t,e)}once(t,e){return this.on(t,e,!0)}off(t,e){if(t===void 0){Ou(this);return}const n=yo(this);if(n[t]||(n[t]=[]),e===void 0){n[t].length=0;return}let o=0;for(;o<n[t].length&&n[t][o][0]!==e;o++);o<n[t].length&&n[t].splice(o,1)}emit(t,...e){let n=!1;const s=yo(this)[t]||[];for(let r of s.slice()){const[a,l=!1]=r,c=a(...e);l&&this.off(t,a),c===!1&&(n=!0)}return n}};function $t(){return((1+Math.random())*65536|0).toString(16).substring(1)}function dt(){return($t()+$t()+"-"+$t()+"-4"+$t().substr(0,3)+"-"+$t()+"-"+$t()+$t()+$t()).toLowerCase()}const Ru=`
2
2
  <style type="text/css">
3
3
 
4
4
  #_gl_paintBrush {
@@ -191,7 +191,7 @@ void main() {
191
191
  svg [type='lineItemGroup'] g g g g {
192
192
  stroke: #ffffff;
193
193
  }</style>
194
- `;return i.$$set=s=>{"content"in s&&e(0,n=s.content)},[n,o]}class Rm extends ce{constructor(t){super(),le(this,t,Bm,Om,ae,{content:0},jm)}}function Qm(i){fe(i,"svelte-ozpg4a",".floorplan-plugin__base-image.svelte-ozpg4a{position:absolute;z-index:10;width:100%;height:100%;pointer-events:none}")}function Hm(i){let t,e;return t=new Vm({props:{url:i[1].url}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&2&&(s.url=n[1].url),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Gm(i){let t,e;return t=new Rm({props:{content:i[0]}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.content=n[0]),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Fm(i){let t,e,n,o;const s=[Gm,Hm],r=[];function a(l,c){return l[0]?0:l[1]?1:-1}return~(e=a(i))&&(n=r[e]=s[e](i)),{c(){t=z("div"),n&&n.c(),w(t,"class","floorplan-plugin__base-image svelte-ozpg4a")},m(l,c){j(l,t,c),~e&&r[e].m(t,null),o=!0},p(l,[c]){let d=e;e=a(l),e===d?~e&&r[e].p(l,c):(n&&(de(),L(r[d],1,1,()=>{r[d]=null}),he()),~e?(n=r[e],n?n.p(l,c):(n=r[e]=s[e](l),n.c()),x(n,1),n.m(t,null)):n=null)},i(l){o||(x(n),o=!0)},o(l){L(n),o=!1},d(l){l&&V(t),~e&&r[e].d()}}}function Wm(i,t,e){let n,o,{floorIndex:s}=t,{floorplanData:r}=t;return i.$$set=a=>{"floorIndex"in a&&e(2,s=a.floorIndex),"floorplanData"in a&&e(3,r=a.floorplanData)},i.$$.update=()=>{var a,l;i.$$.dirty&12&&e(1,n=r.outlines[s]),i.$$.dirty&12&&e(0,o=(l=(a=r.outlines)==null?void 0:a[s])==null?void 0:l.svgContent)},[o,n,s,r]}class ch extends ce{constructor(t){super(),le(this,t,Wm,Fm,ae,{floorIndex:2,floorplanData:3},Qm)}}function Nm(i){fe(i,"svelte-12pzct5",".floorplan-plugin__room-label-item.svelte-12pzct5{position:absolute;display:flex;flex-flow:column;align-items:center;line-height:1;color:#fff;transform:translate(-50%, -50%);white-space:nowrap;will-change:opacity;transition:opacity 300ms}.floorplan-plugin__room-size.svelte-12pzct5{opacity:0.45}")}function Xm(i){let t,e=i[8].outerHTML+"",n;return{c(){t=new Go(!1),n=Ee(),t.a=n},m(o,s){t.m(e,o,s),j(o,n,s)},p(o,s){s&256&&e!==(e=o[8].outerHTML+"")&&t.p(e)},d(o){o&&V(n),o&&t.d()}}}function Ym(i){let t,e,n=i[1]&&Fa(i),o=i[0]&&Wa(i);return{c(){n&&n.c(),t=ne(),o&&o.c(),e=Ee()},m(s,r){n&&n.m(s,r),j(s,t,r),o&&o.m(s,r),j(s,e,r)},p(s,r){s[1]?n?n.p(s,r):(n=Fa(s),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null),s[0]?o?o.p(s,r):(o=Wa(s),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null)},d(s){n&&n.d(s),s&&V(t),o&&o.d(s),s&&V(e)}}}function Fa(i){let t,e=i[2].name+"",n;return{c(){t=z("span"),n=_e(e),w(t,"class","floorplan-plugin__room-name")},m(o,s){j(o,t,s),O(t,n)},p(o,s){s&4&&e!==(e=o[2].name+"")&&Oe(n,e)},d(o){o&&V(t)}}}function Wa(i){let t,e;return{c(){t=z("span"),e=_e(i[7]),w(t,"class","floorplan-plugin__room-size svelte-12pzct5")},m(n,o){j(n,t,o),O(t,e)},p(n,o){o&128&&Oe(e,n[7])},d(n){n&&V(t)}}}function Um(i){let t,e,n;function o(a,l){if(a[3]===void 0)return Ym;if(a[8])return Xm}let s=o(i),r=s&&s(i);return{c(){t=z("div"),r&&r.c(),w(t,"class","floorplan-plugin__room-label-item svelte-12pzct5"),T(t,"left",i[9]),T(t,"top",i[10]),T(t,"font-size",i[11]),T(t,"opacity",i[6]?"1":"0")},m(a,l){j(a,t,l),r&&r.m(t,null),e||(n=[Ut(vi.call(null,t)),Ce(t,"clientWidth",i[19]),Ce(t,"clientHeight",i[20])],e=!0)},p(a,[l]){s===(s=o(a))&&r?r.p(a,l):(r&&r.d(1),r=s&&s(a),r&&(r.c(),r.m(t,null))),l&64&&T(t,"opacity",a[6]?"1":"0")},i:K,o:K,d(a){a&&V(t),r&&r.d(),e=!1,rt(n)}}}function qm(i,t){const e=i[0],n=i[1];let o=!1;for(let s=0,r=t.length-1;s<t.length;r=s++){const a=t[s][0],l=t[s][1],c=t[r][0],d=t[r][1];l>n!=d>n&&e<(c-a)*(n-l)/(d-l)+a&&(o=!o)}return o}function Jm(i,t,e){let n,o,s,r,a,{pxmm:l}=t,{roomAreaEnable:c}=t,{roomNameEnable:d}=t,{room:h}=t,{hoveredRoom:u}=t,{getRoomAreaText:m}=t,{getLabelElement:v}=t,{adaptiveRoomLabelVisibleEnable:g}=t;function A(Q,G){if(G.width===0||G.height===0)return()=>!1;const B=Q.path.map(({x:we,y:ge})=>[we,ge]),W=Q.roomLabel.position,{x:q,y:U}=W,{width:Z,height:re}=G,oe=Z/2,Ae=re/2;return function(ge){const Ve=q*ge,ve=U*ge,Ge=B.map(([be,Se])=>[be*ge,Se*ge]);return[[Ve+oe,ve-Ae],[Ve-oe,ve-Ae],[Ve-oe,ve+Ae],[Ve+oe,ve+Ae]].every(be=>qm(be,Ge))}}const b=document.body.clientWidth,y=document.body.clientHeight,E=h.roomLabel,k=E.positionInImage.x*100+"%",S=E.positionInImage.y*100+"%",C=(b<500||y<500?10:14)+"px";let _=0,M=0,X=!1;u.subscribe(function(G){e(16,X=!!G&&G.id===h.id)});const J=Q=>{e(4,_=Q.detail)},H=Q=>{e(5,M=Q.detail)};return i.$$set=Q=>{"pxmm"in Q&&e(12,l=Q.pxmm),"roomAreaEnable"in Q&&e(0,c=Q.roomAreaEnable),"roomNameEnable"in Q&&e(1,d=Q.roomNameEnable),"room"in Q&&e(2,h=Q.room),"hoveredRoom"in Q&&e(13,u=Q.hoveredRoom),"getRoomAreaText"in Q&&e(14,m=Q.getRoomAreaText),"getLabelElement"in Q&&e(3,v=Q.getLabelElement),"adaptiveRoomLabelVisibleEnable"in Q&&e(15,g=Q.adaptiveRoomLabelVisibleEnable)},i.$$.update=()=>{i.$$.dirty&12&&e(8,n=v==null?void 0:v(h)),i.$$.dirty&16388&&e(7,o=h.size?m(h.size):""),i.$$.dirty&48&&e(18,s={width:_,height:M}),i.$$.dirty&262148&&e(17,r=s?A(h,s):void 0),i.$$.dirty&233472&&e(6,a=g?X?!0:!!(r!=null&&r(l)):!0)},[c,d,h,v,_,M,a,o,n,k,S,C,l,u,m,g,X,r,s,J,H]}class Zm extends ce{constructor(t){super(),le(this,t,Jm,Um,ae,{pxmm:12,roomAreaEnable:0,roomNameEnable:1,room:2,hoveredRoom:13,getRoomAreaText:14,getLabelElement:3,adaptiveRoomLabelVisibleEnable:15},Nm)}}function Km(i){fe(i,"svelte-13xux0b",".floorplan-plugin__room-labels.svelte-13xux0b{width:100%;height:100%;position:absolute;left:0;top:0;z-index:20;pointer-events:none}")}function Na(i,t,e){const n=i.slice();return n[12]=t[e],n}function Xa(i){let t,e=[],n=new Map,o,s,r,a=i[8];const l=c=>c[12].id;for(let c=0;c<a.length;c+=1){let d=Na(i,a,c),h=l(d);n.set(h,e[c]=Ya(h,d))}return{c(){t=z("div");for(let c=0;c<e.length;c+=1)e[c].c();w(t,"class","floorplan-plugin__room-labels svelte-13xux0b")},m(c,d){j(c,t,d);for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(t,null);o=!0,s||(r=[Ut(vi.call(null,t)),Ce(t,"clientWidth",i[11])],s=!0)},p(c,d){d&447&&(a=c[8],de(),e=St(e,d,l,1,c,a,n,t,un,Ya,null,Na),he())},i(c){if(!o){for(let d=0;d<a.length;d+=1)x(e[d]);o=!0}},o(c){for(let d=0;d<e.length;d+=1)L(e[d]);o=!1},d(c){c&&V(t);for(let d=0;d<e.length;d+=1)e[d].d();s=!1,rt(r)}}}function Ya(i,t){let e,n,o;const s=[{pxmm:t[7],room:t[12],hoveredRoom:t[2],roomAreaEnable:t[0],roomNameEnable:t[1],getLabelElement:t[4],getRoomAreaText:t[3],adaptiveRoomLabelVisibleEnable:t[5]}];let r={};for(let a=0;a<s.length;a+=1)r=Ze(r,s[a]);return n=new Zm({props:r}),{key:i,first:null,c(){e=Ee(),ie(n.$$.fragment),this.first=e},m(a,l){j(a,e,l),ee(n,a,l),o=!0},p(a,l){t=a;const c=l&447?st(s,[{pxmm:t[7],room:t[12],hoveredRoom:t[2],roomAreaEnable:t[0],roomNameEnable:t[1],getLabelElement:t[4],getRoomAreaText:t[3],adaptiveRoomLabelVisibleEnable:t[5]}]):{};n.$set(c)},i(a){o||(x(n.$$.fragment,a),o=!0)},o(a){L(n.$$.fragment,a),o=!1},d(a){a&&V(e),te(n,a)}}}function $m(i){let t,e,n=i[8]&&Xa(i);return{c(){n&&n.c(),t=Ee()},m(o,s){n&&n.m(o,s),j(o,t,s),e=!0},p(o,[s]){o[8]?n?(n.p(o,s),s&256&&x(n,1)):(n=Xa(o),n.c(),x(n,1),n.m(t.parentNode,t)):n&&(de(),L(n,1,1,()=>{n=null}),he())},i(o){e||(x(n),e=!0)},o(o){L(n),e=!1},d(o){n&&n.d(o),o&&V(t)}}}function ep(i,t,e){let n,{floorIndex:o}=t,{roomAreaEnable:s}=t,{roomNameEnable:r}=t,{floorplanData:a}=t,{hoveredRoom:l}=t,{getRoomAreaText:c}=t,{getLabelElement:d}=t,{adaptiveRoomLabelVisibleEnable:h}=t,u=0,m=0;const v=g=>{e(6,u=g.detail)};return i.$$set=g=>{"floorIndex"in g&&e(9,o=g.floorIndex),"roomAreaEnable"in g&&e(0,s=g.roomAreaEnable),"roomNameEnable"in g&&e(1,r=g.roomNameEnable),"floorplanData"in g&&e(10,a=g.floorplanData),"hoveredRoom"in g&&e(2,l=g.hoveredRoom),"getRoomAreaText"in g&&e(3,c=g.getRoomAreaText),"getLabelElement"in g&&e(4,d=g.getLabelElement),"adaptiveRoomLabelVisibleEnable"in g&&e(5,h=g.adaptiveRoomLabelVisibleEnable)},i.$$.update=()=>{if(i.$$.dirty&1536&&e(8,n=a.floorDatas[o].rooms),i.$$.dirty&1088){const{max:g,min:A}=a.bounding,b=g.x-A.x;e(7,m=u/b)}},[s,r,l,c,d,h,u,m,n,o,a,v]}class tp extends ce{constructor(t){super(),le(this,t,ep,$m,ae,{floorIndex:9,roomAreaEnable:0,roomNameEnable:1,floorplanData:10,hoveredRoom:2,getRoomAreaText:3,getLabelElement:4,adaptiveRoomLabelVisibleEnable:5},Km)}}function np(i){fe(i,"svelte-djlmk4",".floorplan-plugin__rule-labels.svelte-djlmk4.svelte-djlmk4{position:absolute;display:flex}.floorplan-plugin__rule-labels--top.svelte-djlmk4.svelte-djlmk4{left:0;top:-1.25rem}.floorplan-plugin__rule-labels--bottom.svelte-djlmk4.svelte-djlmk4{left:0;bottom:-1.25rem}.floorplan-plugin__rule-labels--left.svelte-djlmk4.svelte-djlmk4{top:0;left:-1.25rem}.floorplan-plugin__rule-labels--right.svelte-djlmk4.svelte-djlmk4{top:0;right:-1.25rem}.floorplan-plugin__rule-line.svelte-djlmk4.svelte-djlmk4{background:#fff;opacity:0.05;width:100%;height:100%}.floorplan-plugin__rule-scale-wrapper.svelte-djlmk4.svelte-djlmk4{position:absolute;width:0.3125rem;height:100%;left:50%;top:0;transform:translateX(-50%)}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-scale-wrapper.svelte-djlmk4{width:100%;height:0.3125rem;top:50%;left:0;transform:translateY(-50%)}.floorplan-plugin__rule-scale.svelte-djlmk4.svelte-djlmk4{position:absolute;background:#fff;opacity:0.05;width:100%;height:0.0625rem}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-scale.svelte-djlmk4{width:0.0625rem;height:100%}.floorplan-plugin__rule-text-wrapper.svelte-djlmk4.svelte-djlmk4{position:absolute}.floorplan-plugin__rule-labels--top.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:100%;height:0;top:0.625rem}.floorplan-plugin__rule-labels--bottom.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:100%;height:0;bottom:0.625rem}.floorplan-plugin__rule-labels--left.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:0;height:100%;left:0.625rem}.floorplan-plugin__rule-labels--right.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:0;height:100%;right:0.625rem}.floorplan-plugin__rule-text-item.svelte-djlmk4.svelte-djlmk4{width:0;height:0;position:absolute;transform:rotate(90deg)}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-text-item.svelte-djlmk4{transform:rotate(0)}.floorplan-plugin__rule-text.svelte-djlmk4.svelte-djlmk4{width:-moz-max-content;width:max-content;transform:translate(-50%, -50%);font-size:0.625rem;color:#fff;opacity:0.2}")}function Ua(i,t,e){const n=i.slice();return n[11]=t[e],n[13]=e,n}function qa(i,t,e){const n=i.slice();return n[14]=t[e],n}function Ja(i){let t;return{c(){t=z("div"),w(t,"class","floorplan-plugin__rule-scale svelte-djlmk4"),T(t,"left",i[14].left*100+"%"),T(t,"bottom",i[14].bottom*100+"%")},m(e,n){j(e,t,n)},p:K,d(e){e&&V(t)}}}function Za(i,t){let e,n,o=t[1](t[11].distance)+"",s,r;return{key:i,first:null,c(){e=z("div"),n=z("div"),s=_e(o),r=ne(),w(n,"class","floorplan-plugin__rule-text svelte-djlmk4"),$(n,"is-row",t[2]),w(e,"class","floorplan-plugin__rule-text-item svelte-djlmk4"),T(e,"left",t[11].left*100+"%"),T(e,"bottom",t[11].bottom*100+"%"),this.first=e},m(a,l){j(a,e,l),O(e,n),O(n,s),O(e,r)},p(a,l){t=a,l&2&&o!==(o=t[1](t[11].distance)+"")&&Oe(s,o)},d(a){a&&V(e)}}}function ip(i){let t,e,n,o,s,r,a=[],l=new Map,c,d=i[3],h=[];for(let v=0;v<d.length;v+=1)h[v]=Ja(qa(i,d,v));let u=i[4];const m=v=>v[13];for(let v=0;v<u.length;v+=1){let g=Ua(i,u,v),A=m(g);l.set(A,a[v]=Za(A,g))}return{c(){t=z("div"),e=z("div"),n=ne(),o=z("div");for(let v=0;v<h.length;v+=1)h[v].c();s=ne(),r=z("div");for(let v=0;v<a.length;v+=1)a[v].c();w(e,"class","floorplan-plugin__rule-line svelte-djlmk4"),w(o,"class","floorplan-plugin__rule-scale-wrapper svelte-djlmk4"),$(o,"is-row",i[2]),w(r,"class","floorplan-plugin__rule-text-wrapper svelte-djlmk4"),w(t,"class",c="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--"+i[0]+" svelte-djlmk4"),$(t,"is-row",i[2]),T(t,"width",i[2]?"100%":1/16+"rem"),T(t,"height",i[2]?1/16+"rem":"100%")},m(v,g){j(v,t,g),O(t,e),O(t,n),O(t,o);for(let A=0;A<h.length;A+=1)h[A]&&h[A].m(o,null);O(t,s),O(t,r);for(let A=0;A<a.length;A+=1)a[A]&&a[A].m(r,null)},p(v,[g]){if(g&8){d=v[3];let A;for(A=0;A<d.length;A+=1){const b=qa(v,d,A);h[A]?h[A].p(b,g):(h[A]=Ja(b),h[A].c(),h[A].m(o,null))}for(;A<h.length;A+=1)h[A].d(1);h.length=d.length}g&22&&(u=v[4],a=St(a,g,m,1,v,u,l,r,aa,Za,null,Ua)),g&1&&c!==(c="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--"+v[0]+" svelte-djlmk4")&&w(t,"class",c),g&5&&$(t,"is-row",v[2])},i:K,o:K,d(v){v&&V(t),qt(h,v);for(let g=0;g<a.length;g+=1)a[g].d()}}}const Nn=1e3,Xn=180;function op(i,t,e){let{type:n}=t,{data:o}=t,{bounding:s}=t,{getRuleDistanceText:r}=t;const a=n==="top"||n==="bottom",l=s.max.x-s.min.x-(Nn-Xn)*2,c=s.max.y-s.min.y-(Nn-Xn)*2,d=o.map(([v,g])=>a?[v.x,g.x]:[v.y,g.y]).flat().sort().filter((v,g,A)=>g===0?!0:v!==A[g-1]),h=d.map(v=>{const g=a?(v-s.min.x-Nn+Xn)/l:0,A=a?0:(v-s.min.y-Nn+Xn)/c;return{left:g,bottom:A}});h.unshift({left:0,bottom:0}),h.push(a?{left:1,bottom:0}:{left:0,bottom:1});const u=d[d.length-1]-d[0],m=d.map((v,g,A)=>{const b=g===0?0:v-A[g-1],y=g===0?0:(v+A[g-1])/2,E=a?(y-s.min.x-Nn+Xn)/l:0,k=a?0:(y-s.min.y-Nn+Xn)/c;return{left:E,bottom:k,distance:b}}).filter(({distance:v})=>v/u>.1);return i.$$set=v=>{"type"in v&&e(0,n=v.type),"data"in v&&e(5,o=v.data),"bounding"in v&&e(6,s=v.bounding),"getRuleDistanceText"in v&&e(1,r=v.getRuleDistanceText)},[n,r,a,h,m,o,s]}class sp extends ce{constructor(t){super(),le(this,t,op,ip,ae,{type:0,data:5,bounding:6,getRuleDistanceText:1},np)}}function rp(i){fe(i,"svelte-1mzj9p3",".floorplan-plugin__rule-labels-wrapper.svelte-1mzj9p3{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}")}function Ka(i,t,e){const n=i.slice();return n[13]=t[e][0],n[14]=t[e][1],n}function $a(i,t){let e,n,o;const s=[{type:t[13],data:t[14],bounding:t[1],getRuleDistanceText:t[0]}];let r={};for(let a=0;a<s.length;a+=1)r=Ze(r,s[a]);return n=new sp({props:r}),{key:i,first:null,c(){e=Ee(),ie(n.$$.fragment),this.first=e},m(a,l){j(a,e,l),ee(n,a,l),o=!0},p(a,l){t=a;const c=l&19?st(s,[{type:t[13],data:t[14],bounding:t[1],getRuleDistanceText:t[0]}]):{};n.$set(c)},i(a){o||(x(n.$$.fragment,a),o=!0)},o(a){L(n.$$.fragment,a),o=!1},d(a){a&&V(e),te(n,a)}}}function ap(i){let t,e=[],n=new Map,o,s=i[4];const r=a=>a[13];for(let a=0;a<s.length;a+=1){let l=Ka(i,s,a),c=r(l);n.set(c,e[a]=$a(c,l))}return{c(){t=z("div");for(let a=0;a<e.length;a+=1)e[a].c();w(t,"class","floorplan-plugin__rule-labels-wrapper svelte-1mzj9p3"),T(t,"width",i[3]),T(t,"height",i[2])},m(a,l){j(a,t,l);for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(t,null);o=!0},p(a,[l]){l&19&&(s=a[4],de(),e=St(e,l,r,1,a,s,n,t,un,$a,null,Ka),he()),l&8&&T(t,"width",a[3]),l&4&&T(t,"height",a[2])},i(a){if(!o){for(let l=0;l<s.length;l+=1)x(e[l]);o=!0}},o(a){for(let l=0;l<e.length;l+=1)L(e[l]);o=!1},d(a){a&&V(t);for(let l=0;l<e.length;l+=1)e[l].d()}}}const el=1e3,tl=180;function lp(i,t,e){let n,o,s,r,a,l,c,d,h,u,{floorIndex:m}=t,{floorplanData:v}=t,{getRuleDistanceText:g}=t;return i.$$set=A=>{"floorIndex"in A&&e(5,m=A.floorIndex),"floorplanData"in A&&e(6,v=A.floorplanData),"getRuleDistanceText"in A&&e(0,g=A.getRuleDistanceText)},i.$$.update=()=>{i.$$.dirty&64&&e(1,n=v.bounding),i.$$.dirty&96&&e(11,o=v.floorDatas[m].rules),i.$$.dirty&2048&&e(12,s=Object.keys(o)),i.$$.dirty&6144&&e(4,r=s.map(A=>[A,o[A]])),i.$$.dirty&2&&e(9,a=n.max.x-n.min.x),i.$$.dirty&2&&e(7,l=n.max.y-n.min.y),i.$$.dirty&2&&e(10,c=n.max.x-n.min.x-(el-tl)*2),i.$$.dirty&2&&e(8,d=n.max.y-n.min.y-(el-tl)*2),i.$$.dirty&1536&&e(3,h=c/a*100+"%"),i.$$.dirty&384&&e(2,u=d/l*100+"%")},[g,n,u,h,r,m,v,l,d,a,c,o,s]}class cp extends ce{constructor(t){super(),le(this,t,lp,ap,ae,{floorIndex:5,floorplanData:6,getRuleDistanceText:0},rp)}}function us(i,t={}){let e="";const{needZ:n,needA:o}=t;return(n?i.slice().concat(i[0]):i.slice()).forEach((r,a)=>{const{x:l,y:c}=t.format?t.format(r):r,d=l+","+c;return a===0?(e+="M"+d,e):o!=null&&o[a]?(e+="A"+o[a]+","+d,e):(e+="L"+d,e)}),e+(n?"Z":"")}function dh({x:i,y:t},e){const{max:n,min:o}=e;return{x:i-o.x,y:n.y-t}}function dp(i,t){const e=i.x*1e3+t.bounding.origin.x,n=-i.z*1e3+t.bounding.origin.y;return{x:e,y:n}}function hp(i,t){const e=t.bounding,n=e.max.x-e.min.x,o=e.max.y-e.min.y;return{x:(i.x-e.min.x)/n,y:(e.max.y-i.y)/o}}function up(i,t){return Math.max(...t.work.observers.map(n=>i.z>=n.standingPosition.z?n.floorIndex:0))}function fp(i){let t;return{c(){t=Te("path"),w(t,"d",i[0]),w(t,"fill","#2F313A")},m(e,n){j(e,t,n)},p(e,[n]){n&1&&w(t,"d",e[0])},i:K,o:K,d(e){e&&V(t)}}}function mp(i,t,e){let n,{path:o}=t;return i.$$set=s=>{"path"in s&&e(1,o=s.path)},i.$$.update=()=>{i.$$.dirty&2&&e(0,n=us(o,{needZ:!0}))},[n,o]}class pp extends ce{constructor(t){super(),le(this,t,mp,fp,ae,{path:1})}}function gp(i){let t,e,n,o,s,r;return{c(){t=Te("defs"),e=Te("pattern"),n=Te("rect"),o=Te("path"),s=ne(),r=Te("path"),w(n,"x","0"),w(n,"y","0"),w(n,"width",i[1]),w(n,"height",i[1]),w(n,"fill","#323747"),w(o,"d",i[2]),w(o,"stroke","#ffffff"),w(o,"stroke-opacity","0.06"),w(o,"stroke-width","0.5"),w(o,"fill","none"),w(e,"id","fpm-room-pattern-0"),w(e,"x","0"),w(e,"y","0"),w(e,"width",i[1]),w(e,"height",i[1]),w(e,"patternUnits","userSpaceOnUse"),w(e,"patternTransform","scale(50 50)"),w(r,"d",i[0]),w(r,"fill","url(#fpm-room-pattern-0)")},m(a,l){j(a,t,l),O(t,e),O(e,n),O(e,o),j(a,s,l),j(a,r,l)},p(a,[l]){l&1&&w(r,"d",a[0])},i:K,o:K,d(a){a&&V(t),a&&V(s),a&&V(r)}}}const fr=6;function vp(i,t,e){let n,{path:o}=t;const s=fr*2,r=`M0 ${fr} h ${s} M${fr} 0 v ${s}`;return i.$$set=a=>{"path"in a&&e(3,o=a.path)},i.$$.update=()=>{i.$$.dirty&8&&e(0,n=us(o,{needZ:!0}))},[n,s,r,o]}class Ap extends ce{constructor(t){super(),le(this,t,vp,gp,ae,{path:3})}}function bp(i){let t,e,n,o,s,r,a,l,c,d,h;return{c(){t=Te("defs"),e=Te("pattern"),n=Te("rect"),o=Te("pattern"),s=Te("rect"),r=ne(),a=Te("path"),l=ne(),c=Te("path"),d=ne(),h=Te("path"),w(n,"x","0"),w(n,"y","0"),w(n,"width","6"),w(n,"height","50"),w(n,"fill","none"),w(n,"stroke","#4B4B57"),w(n,"stroke-width","0.5"),w(e,"id","room-material-pattern-1"),w(e,"x","0"),w(e,"y","0"),w(e,"width","12"),w(e,"height","50"),w(e,"patternUnits","userSpaceOnUse"),w(e,"patternTransform","scale(50 50)"),w(s,"x","0"),w(s,"y","0"),w(s,"width","6"),w(s,"height","50"),w(s,"fill","none"),w(s,"stroke","#4B4B57"),w(s,"stroke-width","0.5"),w(o,"id","room-material-pattern-2"),w(o,"x","6"),w(o,"y","25"),w(o,"width","12"),w(o,"height","50"),w(o,"patternUnits","userSpaceOnUse"),w(o,"patternTransform","scale(50 50)"),w(a,"d",i[0]),w(a,"fill","#43434D"),w(c,"d",i[0]),w(c,"fill","url(#room-material-pattern-1)"),w(h,"d",i[0]),w(h,"fill","url(#room-material-pattern-2)")},m(u,m){j(u,t,m),O(t,e),O(e,n),O(t,o),O(o,s),j(u,r,m),j(u,a,m),j(u,l,m),j(u,c,m),j(u,d,m),j(u,h,m)},p(u,[m]){m&1&&w(a,"d",u[0]),m&1&&w(c,"d",u[0]),m&1&&w(h,"d",u[0])},i:K,o:K,d(u){u&&V(t),u&&V(r),u&&V(a),u&&V(l),u&&V(c),u&&V(d),u&&V(h)}}}function yp(i,t,e){let n,{path:o}=t;return i.$$set=s=>{"path"in s&&e(1,o=s.path)},i.$$.update=()=>{i.$$.dirty&2&&e(0,n=us(o,{needZ:!0}))},[n,o]}class wp extends ce{constructor(t){super(),le(this,t,yp,bp,ae,{path:1})}}function Pp(i){fe(i,"svelte-1dykexu",".floorplan-plugin__room-material.svelte-1dykexu{position:absolute;left:0;top:0;width:100%;height:100%}svg.svelte-1dykexu{position:absolute;left:0;top:0;width:100%;height:100%;overflow:visible}")}function nl(i,t,e){const n=i.slice();return n[5]=t[e],n}function Cp(i){let t,e;return t=new Ap({props:{path:i[5].path}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.path=n[5].path),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Ep(i){let t,e;return t=new wp({props:{path:i[5].path}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.path=n[5].path),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Ip(i){let t,e;return t=new pp({props:{path:i[5].path}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.path=n[5].path),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function il(i){let t,e,n,o;const s=[Ip,Ep,Cp],r=[];function a(l,c){return l[5].floorType===1?0:l[5].floorType===0?1:2}return e=a(i),n=r[e]=s[e](i),{c(){t=Te("svg"),n.c(),w(t,"width","100%"),w(t,"height","100%"),w(t,"viewBox",`0 0 ${i[1]} ${i[2]}`),w(t,"class","svelte-1dykexu")},m(l,c){j(l,t,c),r[e].m(t,null),o=!0},p(l,c){let d=e;e=a(l),e===d?r[e].p(l,c):(de(),L(r[d],1,1,()=>{r[d]=null}),he(),n=r[e],n?n.p(l,c):(n=r[e]=s[e](l),n.c()),x(n,1),n.m(t,null))},i(l){o||(x(n),o=!0)},o(l){L(n),o=!1},d(l){l&&V(t),r[e].d()}}}function kp(i){let t,e,n=i[0],o=[];for(let r=0;r<n.length;r+=1)o[r]=il(nl(i,n,r));const s=r=>L(o[r],1,1,()=>{o[r]=null});return{c(){t=z("div");for(let r=0;r<o.length;r+=1)o[r].c();w(t,"class","floorplan-plugin__room-material svelte-1dykexu")},m(r,a){j(r,t,a);for(let l=0;l<o.length;l+=1)o[l]&&o[l].m(t,null);e=!0},p(r,[a]){if(a&7){n=r[0];let l;for(l=0;l<n.length;l+=1){const c=nl(r,n,l);o[l]?(o[l].p(c,a),x(o[l],1)):(o[l]=il(c),o[l].c(),x(o[l],1),o[l].m(t,null))}for(de(),l=n.length;l<o.length;l+=1)s(l);he()}},i(r){if(!e){for(let a=0;a<n.length;a+=1)x(o[a]);e=!0}},o(r){o=o.filter(Boolean);for(let a=0;a<o.length;a+=1)L(o[a]);e=!1},d(r){r&&V(t),qt(o,r)}}}function xp(i,t,e){let n,{floorIndex:o}=t,{floorplanData:s}=t;const r=s.bounding.max.x-s.bounding.min.x,a=s.bounding.max.y-s.bounding.min.y;return i.$$set=l=>{"floorIndex"in l&&e(3,o=l.floorIndex),"floorplanData"in l&&e(4,s=l.floorplanData)},i.$$.update=()=>{i.$$.dirty&24&&e(0,n=s.floorDatas[o].rooms.map(l=>ye(F({},l),{path:l.path.map(c=>dh(c,s.bounding))})))},[n,r,a,o,s]}class Dp extends ce{constructor(t){super(),le(this,t,xp,kp,ae,{floorIndex:3,floorplanData:4},Pp)}}function Mp(i){fe(i,"svelte-qq2273","path.svelte-qq2273{--opacity:0;opacity:var(--opacity)}path.svelte-qq2273:hover{opacity:calc(var(--opacity) + 0.1)}")}function Sp(i){let t,e,n,o;return{c(){t=Te("path"),w(t,"d",i[5]),w(t,"fill","#fff"),w(t,"style",i[2]),w(t,"id",e=`${i[1]}_${i[0].id}`),w(t,"class","svelte-qq2273")},m(s,r){j(s,t,r),n||(o=[Ce(t,"mouseenter",i[3]),Ce(t,"mouseleave",i[4])],n=!0)},p(s,[r]){r&4&&w(t,"style",s[2]),r&3&&e!==(e=`${s[1]}_${s[0].id}`)&&w(t,"id",e)},i:K,o:K,d(s){s&&V(t),n=!1,rt(o)}}}function Lp(i,t,e){let n,o,{room:s}=t,{floorIndex:r}=t,{floorplanData:a}=t,{highlightData:l}=t,{hoveredRoom:c}=t;function d(){c==null||c.set(s)}function h(){c==null||c.set(void 0)}const{bounding:u}=a,m=us(s.path,{needZ:!0,format:v=>dh(v,u)});return i.$$set=v=>{"room"in v&&e(0,s=v.room),"floorIndex"in v&&e(1,r=v.floorIndex),"floorplanData"in v&&e(6,a=v.floorplanData),"highlightData"in v&&e(7,l=v.highlightData),"hoveredRoom"in v&&e(8,c=v.hoveredRoom)},i.$$.update=()=>{i.$$.dirty&131&&e(9,n=l[`${r}_${s.id}`]),i.$$.dirty&512&&e(2,o=n?`fill: ${n.color}; --opacity: ${n.opacity}; pointer-events: ${n.disabled?"none":"auto"}`:null)},[s,r,o,d,h,m,a,l,c,n]}class Tp extends ce{constructor(t){super(),le(this,t,Lp,Sp,ae,{room:0,floorIndex:1,floorplanData:6,highlightData:7,hoveredRoom:8},Mp)}}function zp(i){fe(i,"svelte-1kqo6e4",".floorplan-plugin__room-highlight.svelte-1kqo6e4{position:absolute;width:100%;height:100%}svg.svelte-1kqo6e4{width:100%;height:100%;overflow:visible}")}function ol(i,t,e){const n=i.slice();return n[6]=t[e],n}function sl(i,t){let e,n,o;const s=[{room:t[6],floorplanData:t[1],hoveredRoom:t[3],floorIndex:t[0],highlightData:t[2]}];let r={};for(let a=0;a<s.length;a+=1)r=Ze(r,s[a]);return n=new Tp({props:r}),{key:i,first:null,c(){e=Ee(),ie(n.$$.fragment),this.first=e},m(a,l){j(a,e,l),ee(n,a,l),o=!0},p(a,l){t=a;const c=l&15?st(s,[{room:t[6],floorplanData:t[1],hoveredRoom:t[3],floorIndex:t[0],highlightData:t[2]}]):{};n.$set(c)},i(a){o||(x(n.$$.fragment,a),o=!0)},o(a){L(n.$$.fragment,a),o=!1},d(a){a&&V(e),te(n,a)}}}function _p(i){let t,e,n=[],o=new Map,s,r=i[1].floorDatas[i[0]].rooms;const a=l=>l[6].id;for(let l=0;l<r.length;l+=1){let c=ol(i,r,l),d=a(c);o.set(d,n[l]=sl(d,c))}return{c(){t=z("div"),e=Te("svg");for(let l=0;l<n.length;l+=1)n[l].c();w(e,"width","100%"),w(e,"height","100%"),w(e,"viewBox",`0 0 ${i[4]} ${i[5]}`),w(e,"class","svelte-1kqo6e4"),w(t,"class","floorplan-plugin__room-highlight svelte-1kqo6e4")},m(l,c){j(l,t,c),O(t,e);for(let d=0;d<n.length;d+=1)n[d]&&n[d].m(e,null);s=!0},p(l,[c]){c&15&&(r=l[1].floorDatas[l[0]].rooms,de(),n=St(n,c,a,1,l,r,o,e,un,sl,null,ol),he())},i(l){if(!s){for(let c=0;c<r.length;c+=1)x(n[c]);s=!0}},o(l){for(let c=0;c<n.length;c+=1)L(n[c]);s=!1},d(l){l&&V(t);for(let c=0;c<n.length;c+=1)n[c].d()}}}function Vp(i,t,e){let{floorIndex:n}=t,{floorplanData:o}=t,{highlightData:s}=t,{hoveredRoom:r}=t;const a=o.bounding.max.x-o.bounding.min.x,l=o.bounding.max.y-o.bounding.min.y;return i.$$set=c=>{"floorIndex"in c&&e(0,n=c.floorIndex),"floorplanData"in c&&e(1,o=c.floorplanData),"highlightData"in c&&e(2,s=c.highlightData),"hoveredRoom"in c&&e(3,r=c.hoveredRoom)},[n,o,s,r,a,l]}class hh extends ce{constructor(t){super(),le(this,t,Vp,_p,ae,{floorIndex:0,floorplanData:1,highlightData:2,hoveredRoom:3},zp)}}function jp(i){fe(i,"svelte-bl8zrz",".floorplan-plugin__floor.svelte-bl8zrz{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;pointer-events:none}.floorplan-plugin__floor--is-current.svelte-bl8zrz{opacity:1;pointer-events:auto}")}function rl(i){let t,e;const n=[{floorIndex:i[1],floorplanData:i[8],hoveredRoom:i[14],highlightData:i[13]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new hh({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&24834?st(n,[{floorIndex:s[1],floorplanData:s[8],hoveredRoom:s[14],highlightData:s[13]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function al(i){let t,e;const n=[{floorplanData:i[8],roomAreaEnable:i[5],roomNameEnable:i[6],floorIndex:i[1],getRoomAreaText:i[9],getLabelElement:i[10],hoveredRoom:i[14],adaptiveRoomLabelVisibleEnable:i[12]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new tp({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&22370?st(n,[{floorplanData:s[8],roomAreaEnable:s[5],roomNameEnable:s[6],floorIndex:s[1],getRoomAreaText:s[9],getLabelElement:s[10],hoveredRoom:s[14],adaptiveRoomLabelVisibleEnable:s[12]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function ll(i){let t,e;const n=[{floorplanData:i[8],floorIndex:i[1],getRuleDistanceText:i[11]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new cp({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&2306?st(n,[{floorplanData:s[8],floorIndex:s[1],getRuleDistanceText:s[11]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function Op(i){let t,e,n,o,s,r,a,l,c;const d=[{floorIndex:i[1],floorplanData:i[8]}];let h={};for(let b=0;b<d.length;b+=1)h=Ze(h,d[b]);e=new Dp({props:h});let u=(i[2]||i[3])&&rl(i);const m=[{floorplanData:i[8],floorIndex:i[1]}];let v={};for(let b=0;b<m.length;b+=1)v=Ze(v,m[b]);s=new ch({props:v});let g=i[4]&&al(i),A=i[7]&&ll(i);return{c(){t=z("div"),ie(e.$$.fragment),n=ne(),u&&u.c(),o=ne(),ie(s.$$.fragment),r=ne(),g&&g.c(),a=ne(),A&&A.c(),w(t,"class",l=Be(`floorplan-plugin__floor${i[0]?" floorplan-plugin__floor--is-current":""}`)+" svelte-bl8zrz")},m(b,y){j(b,t,y),ee(e,t,null),O(t,n),u&&u.m(t,null),O(t,o),ee(s,t,null),O(t,r),g&&g.m(t,null),O(t,a),A&&A.m(t,null),c=!0},p(b,[y]){const E=y&258?st(d,[{floorIndex:b[1],floorplanData:b[8]}]):{};e.$set(E),b[2]||b[3]?u?(u.p(b,y),y&12&&x(u,1)):(u=rl(b),u.c(),x(u,1),u.m(t,o)):u&&(de(),L(u,1,1,()=>{u=null}),he());const k=y&258?st(m,[{floorplanData:b[8],floorIndex:b[1]}]):{};s.$set(k),b[4]?g?(g.p(b,y),y&16&&x(g,1)):(g=al(b),g.c(),x(g,1),g.m(t,a)):g&&(de(),L(g,1,1,()=>{g=null}),he()),b[7]?A?(A.p(b,y),y&128&&x(A,1)):(A=ll(b),A.c(),x(A,1),A.m(t,null)):A&&(de(),L(A,1,1,()=>{A=null}),he()),(!c||y&1&&l!==(l=Be(`floorplan-plugin__floor${b[0]?" floorplan-plugin__floor--is-current":""}`)+" svelte-bl8zrz"))&&w(t,"class",l)},i(b){c||(x(e.$$.fragment,b),x(u),x(s.$$.fragment,b),x(g),x(A),c=!0)},o(b){L(e.$$.fragment,b),L(u),L(s.$$.fragment,b),L(g),L(A),c=!1},d(b){b&&V(t),te(e),u&&u.d(),te(s),g&&g.d(),A&&A.d()}}}function Bp(i,t,e){let{isCurrent:n}=t,{floorIndex:o}=t,{highlightEnable:s}=t,{hoverEnable:r}=t,{roomLabelsEnable:a}=t,{roomAreaEnable:l}=t,{roomNameEnable:c}=t,{ruleLabelsEnable:d}=t,{floorplanData:h}=t,{getRoomAreaText:u}=t,{getLabelElement:m}=t,{getRuleDistanceText:v}=t,{adaptiveRoomLabelVisibleEnable:g}=t,{highlightData:A}=t;const b=ca(void 0);return i.$$set=y=>{"isCurrent"in y&&e(0,n=y.isCurrent),"floorIndex"in y&&e(1,o=y.floorIndex),"highlightEnable"in y&&e(2,s=y.highlightEnable),"hoverEnable"in y&&e(3,r=y.hoverEnable),"roomLabelsEnable"in y&&e(4,a=y.roomLabelsEnable),"roomAreaEnable"in y&&e(5,l=y.roomAreaEnable),"roomNameEnable"in y&&e(6,c=y.roomNameEnable),"ruleLabelsEnable"in y&&e(7,d=y.ruleLabelsEnable),"floorplanData"in y&&e(8,h=y.floorplanData),"getRoomAreaText"in y&&e(9,u=y.getRoomAreaText),"getLabelElement"in y&&e(10,m=y.getLabelElement),"getRuleDistanceText"in y&&e(11,v=y.getRuleDistanceText),"adaptiveRoomLabelVisibleEnable"in y&&e(12,g=y.adaptiveRoomLabelVisibleEnable),"highlightData"in y&&e(13,A=y.highlightData)},[n,o,s,r,a,l,c,d,h,u,m,v,g,A,b]}let Rp=class extends ce{constructor(t){super(),le(this,t,Bp,Op,ae,{isCurrent:0,floorIndex:1,highlightEnable:2,hoverEnable:3,roomLabelsEnable:4,roomAreaEnable:5,roomNameEnable:6,ruleLabelsEnable:7,floorplanData:8,getRoomAreaText:9,getLabelElement:10,getRuleDistanceText:11,adaptiveRoomLabelVisibleEnable:12,highlightData:13},jp)}};function Qp(i){fe(i,"svelte-86bqav",".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}")}function cl(i,t,e){const n=i.slice();return n[21]=t[e],n}function dl(i){let t,e,n,o,s,r=i[13].floorDatas,a=[];for(let h=0;h<r.length;h+=1)a[h]=hl(cl(i,r,h));const l=h=>L(a[h],1,1,()=>{a[h]=null});let c=i[5]&&ul(i),d=i[8]&&fl(i);return{c(){t=z("div");for(let h=0;h<a.length;h+=1)a[h].c();e=ne(),c&&c.c(),n=ne(),d&&d.c(),w(t,"class","floorplan-main svelte-86bqav")},m(h,u){j(h,t,u);for(let m=0;m<a.length;m+=1)a[m]&&a[m].m(t,null);O(t,e),c&&c.m(t,null),O(t,n),d&&d.m(t,null),s=!0},p(h,u){if(i=h,u&2047696){r=i[13].floorDatas;let m;for(m=0;m<r.length;m+=1){const v=cl(i,r,m);a[m]?(a[m].p(v,u),x(a[m],1)):(a[m]=hl(v),a[m].c(),x(a[m],1),a[m].m(t,e))}for(de(),m=r.length;m<a.length;m+=1)l(m);he()}i[5]?c?(c.p(i,u),u&32&&x(c,1)):(c=ul(i),c.c(),x(c,1),c.m(t,n)):c&&(de(),L(c,1,1,()=>{c=null}),he()),i[8]?d?(d.p(i,u),u&256&&x(d,1)):(d=fl(i),d.c(),x(d,1),d.m(t,null)):d&&(de(),L(d,1,1,()=>{d=null}),he())},i(h){if(!s){for(let u=0;u<r.length;u+=1)x(a[u]);x(c),x(d),o||ot(()=>{o=Dn(t,In,{duration:i[0],easing:sn}),o.start()}),s=!0}},o(h){a=a.filter(Boolean);for(let u=0;u<a.length;u+=1)L(a[u]);L(c),L(d),s=!1},d(h){h&&V(t),qt(a,h),c&&c.d(),d&&d.d()}}}function hl(i){let t,e;const n=[{hoverEnable:i[6],highlightEnable:i[7],floorplanData:i[13],getRoomAreaText:i[16],getLabelElement:i[17],getRuleDistanceText:i[18],roomLabelsEnable:i[9],roomAreaEnable:i[10],roomNameEnable:i[11],ruleLabelsEnable:i[12],adaptiveRoomLabelVisibleEnable:i[19],highlightData:i[20]},{floorIndex:i[21].floorIndex},{isCurrent:i[21].floorIndex===i[4]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new Rp({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&2047696?st(n,[r&2047680&&{hoverEnable:s[6],highlightEnable:s[7],floorplanData:s[13],getRoomAreaText:s[16],getLabelElement:s[17],getRuleDistanceText:s[18],roomLabelsEnable:s[9],roomAreaEnable:s[10],roomNameEnable:s[11],ruleLabelsEnable:s[12],adaptiveRoomLabelVisibleEnable:s[19],highlightData:s[20]},r&8192&&{floorIndex:s[21].floorIndex},r&8208&&{isCurrent:s[21].floorIndex===s[4]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function ul(i){let t,e;const n=[{panoIndex:i[3],floorplanData:i[13],lastPanoramaLongitude:i[14],cameraImageUrl:i[15]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new Em({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&57352?st(n,[{panoIndex:s[3],floorplanData:s[13],lastPanoramaLongitude:s[14],cameraImageUrl:s[15]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function fl(i){let t,e;return t=new Lm({props:{floorplanData:i[13],northDesc:i[2]}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&8192&&(s.floorplanData=n[13]),o&4&&(s.northDesc=n[2]),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Hp(i){let t,e,n=i[1]&&dl(i);return{c(){n&&n.c(),t=Ee()},m(o,s){n&&n.m(o,s),j(o,t,s),e=!0},p(o,[s]){o[1]?n?(n.p(o,s),s&2&&x(n,1)):(n=dl(o),n.c(),x(n,1),n.m(t.parentNode,t)):n&&(de(),L(n,1,1,()=>{n=null}),he())},i(o){e||(x(n),e=!0)},o(o){L(n),e=!1},d(o){n&&n.d(o),o&&V(t)}}}function Gp(i,t,e){let{duration:n=0}=t,{visible:o}=t,{northDesc:s}=t,{panoIndex:r}=t,{floorIndex:a}=t,{cameraEnable:l}=t,{hoverEnable:c}=t,{highlightEnable:d}=t,{compassEnable:h}=t,{roomLabelsEnable:u}=t,{roomAreaEnable:m}=t,{roomNameEnable:v}=t,{ruleLabelsEnable:g}=t,{floorplanData:A}=t,{lastPanoramaLongitude:b}=t,{cameraImageUrl:y}=t,{getRoomAreaText:E}=t,{getLabelElement:k}=t,{getRuleDistanceText:S}=t,{adaptiveRoomLabelVisibleEnable:C}=t,{highlightData:_}=t;return i.$$set=M=>{"duration"in M&&e(0,n=M.duration),"visible"in M&&e(1,o=M.visible),"northDesc"in M&&e(2,s=M.northDesc),"panoIndex"in M&&e(3,r=M.panoIndex),"floorIndex"in M&&e(4,a=M.floorIndex),"cameraEnable"in M&&e(5,l=M.cameraEnable),"hoverEnable"in M&&e(6,c=M.hoverEnable),"highlightEnable"in M&&e(7,d=M.highlightEnable),"compassEnable"in M&&e(8,h=M.compassEnable),"roomLabelsEnable"in M&&e(9,u=M.roomLabelsEnable),"roomAreaEnable"in M&&e(10,m=M.roomAreaEnable),"roomNameEnable"in M&&e(11,v=M.roomNameEnable),"ruleLabelsEnable"in M&&e(12,g=M.ruleLabelsEnable),"floorplanData"in M&&e(13,A=M.floorplanData),"lastPanoramaLongitude"in M&&e(14,b=M.lastPanoramaLongitude),"cameraImageUrl"in M&&e(15,y=M.cameraImageUrl),"getRoomAreaText"in M&&e(16,E=M.getRoomAreaText),"getLabelElement"in M&&e(17,k=M.getLabelElement),"getRuleDistanceText"in M&&e(18,S=M.getRuleDistanceText),"adaptiveRoomLabelVisibleEnable"in M&&e(19,C=M.adaptiveRoomLabelVisibleEnable),"highlightData"in M&&e(20,_=M.highlightData)},[n,o,s,r,a,l,c,d,h,u,m,v,g,A,b,y,E,k,S,C,_]}let da=class extends ce{constructor(t){super(),le(this,t,Gp,Hp,ae,{duration:0,visible:1,northDesc:2,panoIndex:3,floorIndex:4,cameraEnable:5,hoverEnable:6,highlightEnable:7,compassEnable:8,roomLabelsEnable:9,roomAreaEnable:10,roomNameEnable:11,ruleLabelsEnable:12,floorplanData:13,lastPanoramaLongitude:14,cameraImageUrl:15,getRoomAreaText:16,getLabelElement:17,getRuleDistanceText:18,adaptiveRoomLabelVisibleEnable:19,highlightData:20},Qp)}};const Fp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC";function Wp(i){return Y(this,null,function*(){const t=new Headers({"Content-Type":"text/plain"}),e=function(o){return Y(this,null,function*(){const s={index:o.index,url:o.url,svgUrl:o.svg_url};if(o.svg_url){const r=yield fetch(o.svg_url,{headers:t}).then(a=>a.text());s.svgContent=r}return s})};return yield Promise.all(i.map(e))})}function Np(i){return{id:i.id,size:i.size,name:i.name,path:i.path,roomType:i.room_type,floorType:i.floor_type,roomLabel:{position:i.room_label.position,positionInImage:i.room_label.position_in_image},observerIndexs:i.observer_indexs}}function Xp(i){return{floorName:i.floor_name,floorIndex:i.floor_index,rooms:i.rooms.map(Np),rules:i.rules}}function Yp(i){return{index:i.index,floorIndex:i.floor_index,position:i.position,positionInImage:i.position_in_image}}function Up(i){return{rad:i.rad,position:i.position,positionInImage:i.position_in_image,northRad:i.north_rad,roomId:i.room_id,floorIndex:i.floor_index}}function ln(i){return Y(this,null,function*(){const t=yield Wp(i.outlines),e=i.computed_data.bounding,n=i.computed_data.floor_datas.map(Xp),o=i.computed_data.entrance?Up(i.computed_data.entrance):null;return{outlines:t,entrance:o,bounding:e,floorDatas:n,observers:i.computed_data.observers.map(Yp)}})}function qp(i,t,e){return i.map(o=>{const s=o.position,r=o.icon?o.icon:{url:Fp,width:45,height:48},a=up(s,t),l=dp(s,e),c=hp(l,e);return{floorIndex:a,icon:r,id:o.id,position:l,positionInImage:c}})}function Jp(i,t){return t(i),i}function fs(i,t){return Jp({},e=>{for(const n in i)t.indexOf(n)===-1&&(e[n]=i[n])})}function ml(i,t){const e=Math.max(...i.work.observers.map(n=>n.floorIndex));return t>e?i.model.bounding.max.y:Math.max(...i.work.observers.filter(n=>n.floorIndex===t).map(n=>n.standingPosition.y))}function ha(i,t,e=nn.BOUNDING_CENTER){const n=ml(i,t),o=ml(i,t+1);return e===nn.BOUNDING_CENTER?(i.model.bounding.max.y+i.model.bounding.min.y)/2:e===nn.CEILING?o:n}function ua(i,t,e,n){const o=ha(i,e,n==null?void 0:n.attachedTo),s=new I.Vector3(0,o,0),r=new I.Vector3(1,o,0),a=s.clone().project(i.camera),l=r.clone().project(i.camera);return Math.abs((l.x-a.x)/1e3)*(t.getBoundingClientRect().width/2)}let eo=class{constructor(t,e){f(this,"VERSION","2.20.7");f(this,"five");f(this,"hooks",new li);f(this,"staticPrefix","//vrlab-static.ljcdn.com");this.five=t,e!=null&&e.staticPrefix&&(this.staticPrefix=e.staticPrefix)}getCurrentState(){return this.state}isAbsoluteURL(t){return na(t)?t:`${this.staticPrefix}${t}`}},Mn=class extends eo{};var At=(i=>(i.UnknownError="UnknownError",i.DataNotLoaded="DataNotLoaded",i.BreakOffByHide="BreakOffByHide",i.BreakOffByDisable="BreakOffByDisable",i.ModelNotLoaded="ModelNotLoaded",i.ChangeModeError="ChangeModeError",i.UpdateCameraError="UpdateCameraError",i))(At||{});const uh=500,Zp=80;function Qr(i,t,e=4){return Math.floor(i*Math.pow(10,e))===Math.floor(t*Math.pow(10,e))}function fa(i,t){return Y(this,null,function*(){const[e]=yield ii(i.changeMode(...t));if(e)throw new Error("change mode canceled");yield new Promise(r=>{i.once("initAnimationWillStart",()=>{i.once("initAnimationEnded",()=>r())})});const n=t[1];if(!n)return!0;const o=i.getCurrentState();if(!Kp(n,o))throw new Error("pose 与预期不符")})}function Kp(i,t){return Object.keys(i).every(e=>{const n=t[e];if(n===void 0)return!0;const o=i[e];return typeof n=="number"&&typeof o=="number"?Qr(n,o,2):n===o})}function ma(i,t){if(i.currentMode!==t.mode)return!1;const{latitude:e,longitude:n,fov:o}=t,{latitude:s,longitude:r}=i.getCurrentState(),a=i.camera.fov;return!(!Qr(e,s,2)||!Qr(n,r,2)||o!==a)}function fh(i,t,e=!0){return Y(this,null,function*(){if(ma(i,t)===!0)return;const o=i.getCurrentState();if(o.mode!==t.mode){const[d]=yield ii(fa(i,[t.mode,t,void 0,e]));if(d)throw new Error(At.ChangeModeError);return}const{latitude:s,longitude:r,fov:a}=o,l=Math.min(1e3,Math.max(200,Math.abs(s-Math.PI/2)*1e3,(r>Math.PI?2*Math.PI-r:r)*500,Math.abs(a-t.fov)*10)),[c]=yield ii(i.updateCamera(t,l,e));if(c)throw new Error(At.UpdateCameraError)})}function si(i,t,e=300){const n=i.getElement();n&&(n.style.opacity=t+"",n.style.transition=e===0?"none":`opacity ${e}ms linear`,e!==0&&Promise.race([new Promise(o=>n.addEventListener("transitionend",o,{once:!0})),new Promise(o=>setTimeout(o,e))]).then(()=>{n.style.transition="none"}))}function $p(i){const{latitude:t,longitude:e}=i,n=Math.abs(t-Math.PI/2)>5*Math.PI/180,o=e>5*(Math.PI/180)&&e<355*(Math.PI/180);return n||o}function eg(i){const{latitude:t,longitude:e}=i,n=Math.abs(t-Math.PI/2)<10*Math.PI/180,o=e<30*(Math.PI/180)||e>330*(Math.PI/180);return n&&o}let tg=class extends Mn{constructor(e,n){var a;super(e);f(this,"name","modelFloorplanPlugin");f(this,"state");f(this,"data");f(this,"showState");f(this,"showPromise");f(this,"app");f(this,"panoIndex",0);f(this,"floorIndex",0);f(this,"selector");f(this,"showRejection");f(this,"wrapper");f(this,"container",document.createElement("div"));f(this,"lastPanoramaLongitude",0);f(this,"size",{width:0,height:0});f(this,"hasAddedEventListener",!1);f(this,"isHiddenByHideFunc",!1);f(this,"highlightData",{});f(this,"dispose",()=>{var e,n;this.removeEventListener(),(e=this.app)==null||e.$destroy(),this.app=void 0,(n=this.container)==null||n.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});f(this,"show",(...n)=>Y(this,[...n],function*(e={}){if(!this.state.enabled||!this.showPromise&&this.state.visible)return;const o=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!0},o),this._show(e)}));f(this,"hide",(...n)=>Y(this,[...n],function*(e={}){this.state.enabled&&(this.isHiddenByHideFunc=!0,this.state.visible!==!1&&(this.updateState({visible:!1},e.userAction||!0),this._hide(e)))}));f(this,"updateSize",()=>{if(!this.data||!ma(this.five,this.showState)||!this.container||!this.wrapper)return;const{min:e,max:n}=this.data.bounding,o=n.x-e.x,s=n.y-e.y,r=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=ua(this.five,this.wrapper,this.floorIndex,r),l=Math.ceil(o*a),c=Math.ceil(s*a);this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c})});f(this,"highlight",e=>{this.state.config.highlightEnable&&(this.highlightData=e,this.render())});f(this,"unhighlight",()=>{this.highlightData={},this.render()});f(this,"_disable",e=>{var o,s,r;const{userAction:n}=e;this.hooks.emit("disable",{userAction:n}),(o=this.showRejection)==null||o.call(this,At.BreakOffByDisable),this.showPromise=void 0,(s=this.app)==null||s.$destroy(),this.app=void 0,(r=this.container)==null||r.remove(),this.removeEventListener()});f(this,"_enable",e=>{const{userAction:n}=e;this.addEventListener(),this.wrapper&&(this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:n}),this.state.visible&&this._show({userAction:n}))});f(this,"_show",e=>Y(this,null,function*(){var r;if(!this.state.enabled)return;if(!((r=this.five.model)!=null&&r.loaded))throw new Error(At.ModelNotLoaded);if(!this.data)throw new Error(At.DataNotLoaded);this.isHiddenByHideFunc=!1;const n={floorIndex:this.floorIndex,modelOpacity:this.state.config.modelOpacity,immediately:!1,isAutoShow:!1,userAction:!0},o=F(F({},n),e),s=()=>Y(this,null,function*(){this.hooks.emit("show",{userAction:o.userAction,auto:o.isAutoShow});let a=!1,l;this.showRejection=u=>{a=!0,l=u};const[c]=yield ii(fh(this.five,this.showState,o.userAction));if(c)throw c;if(a)throw l?new Error(l):new Error(At.UnknownError);this.updateSize(),this.floorIndex=o.floorIndex,this.five.model.show(this.floorIndex);const d=o.modelOpacity,h=o.immediately?0:uh;si(this.five,d,h),this.render(h)});return this.showPromise=s().then(()=>{this.hooks.emit("showAnimationEnded",{auto:o.isAutoShow,userAction:o.userAction})}).catch(a=>{if(this.updateState({visible:!1},o.userAction),!o.isAutoShow&&a instanceof Error)throw a}).finally(()=>{this.showPromise=void 0,this.showRejection=void 0}),this.showPromise}));f(this,"_hide",e=>{var s;(s=this.showRejection)==null||s.call(this,At.BreakOffByHide),this.showPromise=void 0;const o=F(F({},{userAction:!0,isAutoHide:!1}),e);si(this.five,1,0),this.hooks.emit("hide",{auto:o.isAutoHide,userAction:o.userAction}),this.render()});f(this,"handleClick",()=>{if(!this.state.visible)return;if(this.hooks.emit("click"))return!1});f(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)});f(this,"onFiveModeChange",e=>{e!==this.showState.mode&&(this.updateState({visible:!1},!1),this._hide({userAction:!1}))});f(this,"onFiveInteriaPan",(e,n)=>{if(!n||this.state.config.autoShowEnable===!1||this.isHiddenByHideFunc)return;const o=this.five.getCurrentState();o.mode==="Floorplan"&&(this.state.visible||eg(o)&&(this.updateState({visible:!0},!0),this._show({isAutoShow:!0})))});f(this,"onFivePanoArrived",e=>{var n;(n=this.five)!=null&&n.work&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)});f(this,"onFiveCameraUpdate",(e,n)=>{if(!this.state.visible||this.showPromise)return;const o=this.five.getCurrentState();$p(o)&&(this.updateState({visible:!1},n),this._hide({userAction:n,isAutoHide:!0}))});f(this,"onFiveWantsGesture",(e,n)=>{if(this.state.visible&&(n.length>1||e==="mouseWheel"))return!1});f(this,"onFiveWantsPanGesture",(e,n)=>{if(this.five.getCurrentState().mode==="Floorplan"&&this.state.config.autoShowEnable!==!1&&n&&this.state.visible)return this.five.updateCamera(this.showState,0),!1});f(this,"onFiveWantsTapGesture",()=>this.handleClick());f(this,"onFiveWantsChangeMode",(e,n)=>{n==="Panorama"&&e==="Floorplan"&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude)});f(this,"onModelShownFloorChange",e=>{if(this.floorIndex!==e){if(e===null){const n=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[n].floorIndex;return}this.floorIndex=e,this.updateSize(),this.render()}});n!=null&&n.selector&&(this.selector=n.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.showState={mode:"Floorplan",longitude:0,latitude:Math.PI/2,fov:Zp/((a=n==null?void 0:n.scale)!=null?a:1)};const o={northDesc:"北",modelOpacity:1,cameraEnable:!0,highlightEnable:!1,hoverEnable:!0,compassEnable:!0,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,adaptiveRoomLabelVisibleEnable:!0,cameraImageUrl:an,attachedTo:nn.BOUNDING_CENTER,getLabelElement:void 0,getRoomAreaText:l=>(l/1e6).toFixed(1)+"㎡",getRuleDistanceText:l=>l.toString()},s=n?fs(n,["selector","scale"]):{},r=F(F({},o),s);this.state={enabled:!0,visible:!1,config:r},this.initContainer(),e.model.loaded?this.onFiveModelLoaded():e.once("modelLoaded",this.onFiveModelLoaded),e.once("dispose",this.dispose),this.addEventListener()}load(e,n,o=!0){return Y(this,null,function*(){function s(d){return Object.prototype.hasOwnProperty.apply(d,["version"])}const r=e;r&&!r.version&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(e)),l=s(a)?a.data:a,c=this.data;this.data=yield ln(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),n&&this.updateState(n,o),this.render()})}appendTo(e){if(this.wrapper=e,!!this.state.enabled)return e.appendChild(this.container),this.render(),this}enable(e={}){if(this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!0},e.userAction||n),this._enable({userAction:n})}disable(e={}){if(!this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!1},e.userAction||n),this._disable({userAction:n})}setState(e,n={}){const o=this.state,s=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,s),e.enabled!==void 0&&o.enabled!==e.enabled&&(e.enabled?this._enable({userAction:s}):this._disable({userAction:s})),e.visible!==void 0&&o.visible!==e.visible){const r={userAction:s};e.visible?this._show(r):this._hide(r)}this.render()}changeConfigs(e,n=!0){this.updateState({config:e},n),this.render()}formatData(e){return Y(this,null,function*(){return yield ln(e.data)})}updateState(e,n){const o=this.state,s=e.config?F(F({},o.config),e.config):o.config;this.state=ye(F(F({},this.state),e),{config:s}),!jt(this.state,o,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n})}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:10,pointerEvents:"none"}),this.five.addExtraElement(this.container)}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const e=this.five;e.on("modeChange",this.onFiveModeChange),e.on("interiaPan",this.onFiveInteriaPan),e.on("panoArrived",this.onFivePanoArrived),e.on("cameraUpdate",this.onFiveCameraUpdate),e.on("wantsGesture",this.onFiveWantsGesture),e.on("wantsPanGesture",this.onFiveWantsPanGesture),e.on("wantsTapGesture",this.onFiveWantsTapGesture),e.on("wantsChangeMode",this.onFiveWantsChangeMode),e.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const e=this.five;this.hasAddedEventListener=!1,e.off("modelLoaded",this.onFiveModelLoaded),e.off("modeChange",this.onFiveModeChange),e.off("interiaPan",this.onFiveInteriaPan),e.off("panoArrived",this.onFivePanoArrived),e.off("cameraUpdate",this.onFiveCameraUpdate),e.off("wantsGesture",this.onFiveWantsGesture),e.off("wantsPanGesture",this.onFiveWantsPanGesture),e.off("wantsTapGesture",this.onFiveWantsTapGesture),e.off("wantsChangeMode",this.onFiveWantsChangeMode),e.off("modelShownFloorChange",this.onModelShownFloorChange)}render(e){if(!this.state.enabled||!this.container||!this.data||this.size.width===0)return;const n=ye(F({},this.state.config),{visible:this.state.visible,duration:e!=null?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(n);this.app=new da({target:this.container,intro:!0,props:n})}};const ng=(i,t)=>new tg(i,t);function ig(i){const{latitude:t,longitude:e}=i,n=Math.abs(t-Math.PI/2)>5*Math.PI/180,o=e>5*(Math.PI/180)&&e<355*(Math.PI/180);return n||o}function og(i){const{latitude:t,longitude:e}=i,n=Math.abs(t-Math.PI/2)<10*Math.PI/180,o=e<30*(Math.PI/180)||e>330*(Math.PI/180);return n&&o}let sg=class extends Mn{constructor(e,n){super(e);f(this,"name","modelFloorplanPlugin");f(this,"state");f(this,"data");f(this,"showState");f(this,"showPromise");f(this,"app");f(this,"panoIndex",0);f(this,"floorIndex",0);f(this,"selector");f(this,"showRejection");f(this,"wrapper");f(this,"container",document.createElement("div"));f(this,"lastPanoramaLongitude",0);f(this,"size",{width:0,height:0});f(this,"hasAddedEventListener",!1);f(this,"isHiddenByHideFunc",!1);f(this,"highlightData",{});f(this,"dispose",()=>{var e,n;this.removeEventListener(),(e=this.app)==null||e.$destroy(),this.app=void 0,(n=this.container)==null||n.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});f(this,"show",(...n)=>Y(this,[...n],function*(e={}){if(!this.state.enabled||!this.showPromise&&this.state.visible)return;const o=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!0},o),this._show(e)}));f(this,"hide",(...n)=>Y(this,[...n],function*(e={}){this.state.enabled&&(this.isHiddenByHideFunc=!0,this.state.visible!==!1&&(this.updateState({visible:!1},e.userAction||!0),this._hide(e)))}));f(this,"updateSize",()=>{if(!this.data||!ma(this.five,this.showState)||!this.container||!this.wrapper)return;const{min:e,max:n}=this.data.bounding,o=n.x-e.x,s=n.y-e.y,r=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=ua(this.five,this.wrapper,this.floorIndex,r),l=Math.ceil(o*a),c=Math.ceil(s*a);this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c})});f(this,"highlight",e=>{this.state.config.highlightEnable&&(this.highlightData=e,this.render())});f(this,"unhighlight",()=>{this.highlightData={},this.render()});f(this,"_disable",e=>{var o,s,r;const{userAction:n}=e;this.hooks.emit("disable",{userAction:n}),(o=this.showRejection)==null||o.call(this,At.BreakOffByDisable),this.showPromise=void 0,(s=this.app)==null||s.$destroy(),this.app=void 0,(r=this.container)==null||r.remove(),this.removeEventListener()});f(this,"_enable",e=>{const{userAction:n}=e;this.addEventListener(),this.wrapper&&(this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:n}),this.state.visible&&this._show({userAction:n}))});f(this,"_show",e=>Y(this,null,function*(){var r;if(!this.state.enabled)return;if(!((r=this.five.model)!=null&&r.loaded))throw new Error(At.ModelNotLoaded);if(!this.data)throw new Error(At.DataNotLoaded);this.isHiddenByHideFunc=!1;const n={floorIndex:this.floorIndex,modelOpacity:this.state.config.modelOpacity,immediately:!1,isAutoShow:!1,userAction:!0},o=F(F({},n),e),s=()=>Y(this,null,function*(){this.hooks.emit("show",{userAction:o.userAction,auto:o.isAutoShow});let a=!1,l;this.showRejection=u=>{a=!0,l=u};const[c]=yield ii(fh(this.five,this.showState,o.userAction));if(c)throw c;if(a)throw l?new Error(l):new Error(At.UnknownError);this.updateSize(),this.updatePosition(),this.floorIndex=o.floorIndex,this.five.model.show(this.floorIndex);const d=o.modelOpacity,h=o.immediately?0:uh;si(this.five,d,h),this.render(h)});return this.showPromise=s().then(()=>{this.hooks.emit("showAnimationEnded",{auto:o.isAutoShow,userAction:o.userAction})}).catch(a=>{if(this.updateState({visible:!1},o.userAction),!o.isAutoShow&&a instanceof Error)throw a}).finally(()=>{this.showPromise=void 0,this.showRejection=void 0}),this.showPromise}));f(this,"_hide",e=>{var s;(s=this.showRejection)==null||s.call(this,At.BreakOffByHide),this.showPromise=void 0;const o=F(F({},{userAction:!0,isAutoHide:!1}),e);si(this.five,1,0),this.hooks.emit("hide",{auto:o.isAutoHide,userAction:o.userAction}),this.render()});f(this,"handleClick",()=>{if(!this.state.visible)return;if(this.hooks.emit("click"))return!1});f(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)});f(this,"onFiveModeChange",e=>{e!==this.showState.mode&&(this.updateState({visible:!1},!1),this._hide({userAction:!1}))});f(this,"onFivePanoArrived",e=>{var n;(n=this.five)!=null&&n.work&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)});f(this,"onFiveCameraUpdate",(e,n)=>{if(!this.state.visible||this.showPromise)return;const o=this.five.getCurrentState();this.updatePosition(),this.updateSize(),ig(o)&&(this.updateState({visible:!1},n),this._hide({userAction:n}))});f(this,"onFiveWantsPanGesture",(e,n)=>{if(this.five.getCurrentState().mode===this.showState.mode&&this.state.config.autoShowEnable!==!1){if(n&&this.state.visible)return this.five.updateCamera(this.showState,0),!1;if(n&&!this.state.visible){if(this.isHiddenByHideFunc)return;const o=this.five.getCurrentState();return o.mode!==this.showState.mode||this.state.visible?void 0:(og(o)&&(this.updateState({visible:!0},!0),this._show({isAutoShow:!0})),!1)}}});f(this,"onFiveWantsTapGesture",()=>this.handleClick());f(this,"onFiveWantsChangeMode",(e,n)=>{n==="Panorama"&&e===this.showState.mode&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude)});f(this,"onModelShownFloorChange",e=>{if(this.floorIndex!==e){if(e===null){const n=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[n].floorIndex;return}this.floorIndex=e,this.updateSize(),this.render()}});n!=null&&n.selector&&(this.selector=n.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.showState={mode:"Mapview",longitude:0,latitude:Math.PI/2,fov:90};const o={northDesc:"北",modelOpacity:1,cameraEnable:!0,highlightEnable:!1,hoverEnable:!0,compassEnable:!0,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,cameraImageUrl:an,attachedTo:nn.BOUNDING_CENTER,getLabelElement:void 0,adaptiveRoomLabelVisibleEnable:!0,getRoomAreaText:a=>(a/1e6).toFixed(1)+"㎡",getRuleDistanceText:a=>a.toString()},s=n?fs(n,["selector","scale"]):{},r=F(F({},o),s);this.state={enabled:!0,visible:!1,config:r},this.initContainer(),e.model.loaded?this.onFiveModelLoaded():e.once("modelLoaded",this.onFiveModelLoaded),e.once("dispose",this.dispose),this.addEventListener()}load(e,n,o=!0){return Y(this,null,function*(){function s(d){return Object.prototype.hasOwnProperty.apply(d,["version"])}const r=e;r&&!r.version&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(e)),l=s(a)?a.data:a,c=this.data;this.data=yield ln(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),n&&this.updateState(n,o),this.render()})}appendTo(e){if(this.wrapper=e,!!this.state.enabled)return e.appendChild(this.container),this.render(),this}enable(e={}){if(this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!0},e.userAction||n),this._enable({userAction:n})}disable(e={}){if(!this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!1},e.userAction||n),this._disable({userAction:n})}setState(e,n={}){const o=this.state,s=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,s),e.enabled!==void 0&&o.enabled!==e.enabled&&(e.enabled?this._enable({userAction:s}):this._disable({userAction:s})),e.visible!==void 0&&o.visible!==e.visible){const r={userAction:s};e.visible?this._show(r):this._hide(r)}}changeConfigs(e,n=!0){this.updateState({config:e},n),this.render()}updatePosition(){var a;const e=ha(this.five,this.floorIndex,this.state.config.attachedTo),n=(a=this.five.model)==null?void 0:a.bounding.getCenter(new I.Vector3).setY(e);if(!n)return;const o=n.clone().project(this.five.camera),s=(o.x+1)/2,r=-(o.y-1)/2;this.container.style.left=s*100+"%",this.container.style.top=r*100+"%"}formatData(e){return Y(this,null,function*(){return yield ln(e.data)})}updateState(e,n){const o=this.state,s=e.config?F(F({},o.config),e.config):o.config;this.state=ye(F(F({},this.state),e),{config:s}),!jt(this.state,o,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n})}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:10,pointerEvents:"none"}),this.five.addExtraElement(this.container)}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const e=this.five;e.on("modeChange",this.onFiveModeChange),e.on("panoArrived",this.onFivePanoArrived),e.on("cameraUpdate",this.onFiveCameraUpdate),e.on("wantsPanGesture",this.onFiveWantsPanGesture),e.on("wantsTapGesture",this.onFiveWantsTapGesture),e.on("wantsChangeMode",this.onFiveWantsChangeMode),e.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const e=this.five;this.hasAddedEventListener=!1,e.off("modelLoaded",this.onFiveModelLoaded),e.off("modeChange",this.onFiveModeChange),e.off("panoArrived",this.onFivePanoArrived),e.off("cameraUpdate",this.onFiveCameraUpdate),e.off("wantsPanGesture",this.onFiveWantsPanGesture),e.off("wantsTapGesture",this.onFiveWantsTapGesture),e.off("wantsChangeMode",this.onFiveWantsChangeMode),e.off("modelShownFloorChange",this.onModelShownFloorChange)}render(e){if(!this.state.enabled||!this.container||!this.data||this.size.width===0)return;const n=ye(F({},this.state.config),{visible:this.state.visible,duration:e!=null?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(n);this.app=new da({target:this.container,intro:!0,props:n})}};const rg=(i,t)=>new sg(i,t);let ag=class extends Mn{constructor(e,n){super(e);f(this,"name","topviewFloorplanPlugin");f(this,"state");f(this,"data");f(this,"app");f(this,"selector");f(this,"panoIndex",0);f(this,"floorIndex",0);f(this,"wrapper");f(this,"container",document.createElement("div"));f(this,"lastPanoramaLongitude",0);f(this,"size",{width:0,height:0});f(this,"hasAddedEventListener",!1);f(this,"isHiddenByHideFunc",!1);f(this,"highlightData",{});f(this,"updateSize",()=>{if(!this.data||!this.container||!this.wrapper||this.five.getCurrentState().mode!=="Topview")return;const{min:e,max:n}=this.data.bounding,o=n.x-e.x,s=n.y-e.y,r=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=ua(this.five,this.wrapper,this.floorIndex,r),l=Math.ceil(o*a),c=Math.ceil(s*a);this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c})});f(this,"dispose",()=>{var e,n;this.removeEventListener(),(e=this.app)==null||e.$destroy(),this.app=void 0,(n=this.container)==null||n.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});f(this,"highlight",e=>{this.state.config.highlightEnable&&(this.highlightData=e,this.render())});f(this,"unhighlight",()=>{this.highlightData={},this.render()});f(this,"_disable",e=>{var o,s;const{userAction:n}=e;(o=this.app)==null||o.$destroy(),this.app=void 0,(s=this.container)==null||s.remove(),this.removeEventListener(),this.hooks.emit("disable",{userAction:n})});f(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)});f(this,"onFiveModeChange",(...[e,,,,n])=>{e!=="Topview"&&this.state.visible&&(this.updateState({visible:!1},n),this._hide({userAction:n}))});f(this,"onFivePanoArrived",e=>{var n;(n=this.five)!=null&&n.work&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)});f(this,"onFiveCameraUpdate",(e,n)=>{this.state.visible&&(this.updatePosition(),this.updateSize())});f(this,"onFiveWantsGesture",e=>{if(!(e!=="pan"&&e!=="pinch"&&e!=="mouseWheel")&&this.state.visible&&!this.state.config.gestureEnable)return!1});f(this,"onFiveWantsMoveToPano",()=>{if(this.state.visible&&this.state.config.preventRoomClick)return!1});f(this,"onFiveInitAnimationEnded",(...[,,e])=>{const{mode:n}=this.five.getCurrentState();n==="Topview"&&!this.isHiddenByHideFunc&&!this.state.visible&&this.state.config.autoShowEnable&&(this.updateState({visible:!0},e),this._show({userAction:e}))});f(this,"onModelShownFloorChange",e=>{if(this.floorIndex!==e){if(e===null){const n=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[n].floorIndex;return}this.floorIndex=e,this.updateSize(),this.render()}});n!=null&&n.selector&&(this.selector=n.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法"));const o={northDesc:"北",modelOpacity:1,cameraEnable:!0,hoverEnable:!0,highlightEnable:!1,compassEnable:!0,gestureEnable:!1,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,cameraImageUrl:an,attachedTo:nn.BOUNDING_CENTER,getLabelElement:void 0,adaptiveRoomLabelVisibleEnable:!0,getRoomAreaText:a=>(a/1e6).toFixed(1)+"㎡",getRuleDistanceText:a=>a.toString()},s=n?fs(n,["selector","scale"]):{},r=F(F({},o),s);this.state={enabled:!0,visible:!1,config:r},this.initContainer(),e.model.loaded?this.onFiveModelLoaded():e.once("modelLoaded",this.onFiveModelLoaded),e.once("dispose",this.dispose),this.addEventListener()}load(e,n,o=!0){return Y(this,null,function*(){function s(d){return Object.prototype.hasOwnProperty.apply(d,["version"])}const r=e;r&&!r.version&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(e)),l=s(a)?a.data:a,c=this.data;this.data=yield ln(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),n&&this.updateState(n,o),this.render()})}updatePosition(){var a;const e=ha(this.five,this.floorIndex,this.state.config.attachedTo),n=(a=this.five.model)==null?void 0:a.bounding.getCenter(new I.Vector3).setY(e);if(!n)return;const o=n.clone().project(this.five.camera),s=(o.x+1)/2,r=-(o.y-1)/2;this.container.style.left=s*100+"%",this.container.style.top=r*100+"%"}appendTo(e){if(this.wrapper=e,!!this.state.enabled)return e.appendChild(this.container),this.render(),this}show(){return Y(this,arguments,function*(e={}){if(this.state.visible)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!0},n),this._show({userAction:n})})}hide(){return Y(this,arguments,function*(e={}){if(this.isHiddenByHideFunc=!0,!this.state.visible)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!1},n),this._hide({userAction:n})})}enable(e={}){if(this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!0},e.userAction||n),this._enable({userAction:n})}disable(e={}){if(!this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!1},e.userAction||n),this._disable({userAction:n})}setState(e,n={}){const o=this.state,s=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,s),e.enabled!==void 0&&o.enabled!==e.enabled){const r={userAction:s};e.enabled?this._enable(r):this._disable(r)}if(e.visible!==void 0&&o.visible!==e.visible){const r={userAction:s};e.visible?this._show(r):this._hide(r)}}changeConfigs(e,n=!0){this.updateState({config:e},n),this.render()}formatData(e){return Y(this,null,function*(){return yield ln(e.data)})}_show(e){return Y(this,null,function*(){if(!this.state.enabled)return;this.isHiddenByHideFunc=!1;const{userAction:n}=e;this.hooks.emit("show",{userAction:n,auto:!1}),this.five.getCurrentState().mode!=="Topview"&&(yield fa(this.five,["Topview",void 0,void 0,n])),this.five.model.show(this.floorIndex),this.updatePosition(),this.updateSize();const o=500,s=this.state.config.modelOpacity;si(this.five,s,o),this.hooks.emit("showAnimationEnded",{userAction:n,auto:!1}),this.render()})}_hide(e){return Y(this,null,function*(){if(!this.state.enabled)return;const{userAction:n}=e;this.hooks.emit("hide",{userAction:n,auto:!1});const o=1,s=0;si(this.five,o,s),this.render()})}_enable(e){const{userAction:n}=e;this.addEventListener(),this.wrapper&&this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:n}),this.state.visible&&this._show({userAction:n})}updateState(e,n){const o=this.state,s=e.config?F(F({},o.config),e.config):o.config;this.state=ye(F(F({},this.state),e),{config:s}),!jt(this.state,o,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n})}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const e=this.five;e.on("modeChange",this.onFiveModeChange),e.on("panoArrived",this.onFivePanoArrived),e.on("cameraUpdate",this.onFiveCameraUpdate),e.on("wantsGesture",this.onFiveWantsGesture),e.on("wantsMoveToPano",this.onFiveWantsMoveToPano),e.on("initAnimationEnded",this.onFiveInitAnimationEnded),e.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const e=this.five;this.hasAddedEventListener=!1,e.off("modeChange",this.onFiveModeChange),e.off("panoArrived",this.onFivePanoArrived),e.off("cameraUpdate",this.onFiveCameraUpdate),e.off("wantsGesture",this.onFiveWantsGesture),e.off("wantsMoveToPano",this.onFiveWantsMoveToPano),e.off("initAnimationEnded",this.onFiveInitAnimationEnded),e.off("modelShownFloorChange",this.onModelShownFloorChange)}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate3d(-50%, -50%, 10px)",zIndex:10,pointerEvents:"none","will-change":"width, height"}),this.five.addExtraElement(this.container)}render(e){if(!this.state.enabled||!this.container||!this.data||this.size.width===0)return;const n=ye(F({},this.state.config),{visible:this.state.visible,duration:e!=null?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(n);this.app=new da({target:this.container,intro:!0,props:n})}};const lg=(i,t)=>new ag(i,t);function pa(i,t=200){let e;return function(...n){e||(i(...n),e=setTimeout(function(){e=null},t))}}function cg(i){fe(i,"svelte-1nqrlxd",".plugin-radar__camera-wrapper.svelte-1nqrlxd{width:100%;height:100%;position:absolute;pointer-events:none}.plugin-radar__camera-position.svelte-1nqrlxd{position:absolute;left:0;top:0;width:0;height:0;transform:none;pointer-events:none;transition:transform 1s linear}.plugin-radar__camera-rotate.svelte-1nqrlxd{position:absolute;left:-0.9375rem;top:-0.9375rem;width:1.0625rem;height:1.0625rem;transform-origin:0.9375rem 0.9375rem;transform:rotate(45deg);background-repeat:no-repeat;background-size:100%}")}function dg(i){let t,e,n;return{c(){t=z("div"),e=z("div"),n=z("div"),w(n,"class","plugin-radar__camera-rotate svelte-1nqrlxd"),T(n,"background-image","url("+(i[0]||an)+")"),T(n,"transform",i[1]),w(e,"class","plugin-radar__camera-position svelte-1nqrlxd"),T(e,"transform",i[2]),w(t,"class","plugin-radar__camera-wrapper svelte-1nqrlxd")},m(o,s){j(o,t,s),O(t,e),O(e,n)},p(o,[s]){s&1&&T(n,"background-image","url("+(o[0]||an)+")"),(s&1||s&3)&&T(n,"transform",o[1]),s&4&&T(e,"transform",o[2])},i:K,o:K,d(o){o&&V(t)}}}function hg(i){return`rotate(${Math.floor(i/Math.PI*180)*-1+45}deg)`}function ug(i,t,e){let n,o,{five:s}=t,{pxmm:r}=t,{floorplanData:a}=t,{cameraImageUrl:l}=t,c=s.getCurrentState().panoIndex,d=s.getCurrentState().longitude;function h(v,g){const A=v.bounding,b=v.observers[g];if(!b)return"";const y=(A.max.x-A.min.x)*r,E=(A.max.y-A.min.y)*r,k=Math.floor(b.positionInImage.x*y),S=Math.floor(b.positionInImage.y*E);return`translate(${k}px, ${S}px)`}function u(v){e(6,c=v)}const m=pa(v=>{e(7,d=v.longitude)},1e3/60);return Mt(()=>(s.on("panoWillArrive",u),s.on("cameraDirectionUpdate",m),function(){s.off("panoWillArrive",u),s.off("cameraDirectionUpdate",m)})),i.$$set=v=>{"five"in v&&e(3,s=v.five),"pxmm"in v&&e(4,r=v.pxmm),"floorplanData"in v&&e(5,a=v.floorplanData),"cameraImageUrl"in v&&e(0,l=v.cameraImageUrl)},i.$$.update=()=>{i.$$.dirty&96&&e(2,n=h(a,c)),i.$$.dirty&128&&e(1,o=hg(d))},[l,o,n,s,r,a,c,d]}class fg extends ce{constructor(t){super(),le(this,t,ug,dg,ae,{five:3,pxmm:4,floorplanData:5,cameraImageUrl:0},cg)}}function mg(i){fe(i,"svelte-1i87fz7",".plugin-pano-floorplan__extra-objects.svelte-1i87fz7{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.plugin-pano-floorplan__extra-object-item--position.svelte-1i87fz7{position:absolute;width:0;height:0}.plugin-pano-floorplan__extra-object-item.svelte-1i87fz7{transform:translate(-50%, -50%)}")}function pl(i,t,e){const n=i.slice();return n[1]=t[e],n}function gl(i,t){let e,n,o=`${t[1].icon.width/16}rem`,s=`${t[1].icon.height/16}rem`,r,a=`${t[1].positionInImage.y*100}%`,l=`${t[1].positionInImage.x*100}%`;return{key:i,first:null,c(){e=z("div"),n=z("div"),r=ne(),w(n,"class","plugin-pano-floorplan__extra-object-item svelte-1i87fz7"),T(n,"background-image",`url(${t[1].icon.url})`),T(n,"width",o),T(n,"height",s),w(e,"class","plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7"),T(e,"top",a),T(e,"left",l),this.first=e},m(c,d){j(c,e,d),O(e,n),O(e,r)},p(c,d){t=c,d&1&&T(n,"background-image",`url(${t[1].icon.url})`);const h=d&1;h&&T(n,"width",o),h&&T(n,"height",s),d&1&&a!==(a=`${t[1].positionInImage.y*100}%`)&&T(e,"top",a),d&1&&l!==(l=`${t[1].positionInImage.x*100}%`)&&T(e,"left",l)},d(c){c&&V(e)}}}function pg(i){let t,e=[],n=new Map,o=i[0];const s=r=>r[1].id;for(let r=0;r<o.length;r+=1){let a=pl(i,o,r),l=s(a);n.set(l,e[r]=gl(l,a))}return{c(){t=z("div");for(let r=0;r<e.length;r+=1)e[r].c();w(t,"class","plugin-pano-floorplan__extra-objects svelte-1i87fz7")},m(r,a){j(r,t,a);for(let l=0;l<e.length;l+=1)e[l]&&e[l].m(t,null)},p(r,[a]){a&1&&(o=r[0],e=St(e,a,s,1,r,o,n,t,aa,gl,null,pl))},i:K,o:K,d(r){r&&V(t);for(let a=0;a<e.length;a+=1)e[a].d()}}}function gg(i,t,e){let{extraObjects:n=[]}=t;return i.$$set=o=>{"extraObjects"in o&&e(0,n=o.extraObjects)},[n]}class vg extends ce{constructor(t){super(),le(this,t,gg,pg,ae,{extraObjects:0},mg)}}function vl(i){let t,e;const n=[{five:i[0],pxmm:i[1],floorIndex:i[2],floorplanData:i[4],onRoomHeightClick:i[7],highlightData:i[5],hoveredRoom:void 0}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new hh({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&183?st(n,[{five:s[0],pxmm:s[1],floorIndex:s[2],floorplanData:s[4],onRoomHeightClick:s[7],highlightData:s[5],hoveredRoom:void 0}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function Ag(i){let t,e,n,o,s,r;const a=[{floorIndex:i[2],floorplanData:i[4]}];let l={};for(let d=0;d<a.length;d+=1)l=Ze(l,a[d]);t=new ch({props:l}),n=new vg({props:{extraObjects:i[6]}});let c=i[3]&&vl(i);return{c(){ie(t.$$.fragment),e=ne(),ie(n.$$.fragment),o=ne(),c&&c.c(),s=Ee()},m(d,h){ee(t,d,h),j(d,e,h),ee(n,d,h),j(d,o,h),c&&c.m(d,h),j(d,s,h),r=!0},p(d,[h]){const u=h&20?st(a,[{floorIndex:d[2],floorplanData:d[4]}]):{};t.$set(u);const m={};h&64&&(m.extraObjects=d[6]),n.$set(m),d[3]?c?(c.p(d,h),h&8&&x(c,1)):(c=vl(d),c.c(),x(c,1),c.m(s.parentNode,s)):c&&(de(),L(c,1,1,()=>{c=null}),he())},i(d){r||(x(t.$$.fragment,d),x(n.$$.fragment,d),x(c),r=!0)},o(d){L(t.$$.fragment,d),L(n.$$.fragment,d),L(c),r=!1},d(d){te(t,d),d&&V(e),te(n,d),d&&V(o),c&&c.d(d),d&&V(s)}}}function bg(i,t,e){let n,{five:o}=t,{pxmm:s}=t,{floorIndex:r}=t,{hoverEnable:a}=t,{floorplanData:l}=t,{extraObjects:c=[]}=t,{highlightData:d}=t;const h=void 0;return i.$$set=u=>{"five"in u&&e(0,o=u.five),"pxmm"in u&&e(1,s=u.pxmm),"floorIndex"in u&&e(2,r=u.floorIndex),"hoverEnable"in u&&e(3,a=u.hoverEnable),"floorplanData"in u&&e(4,l=u.floorplanData),"extraObjects"in u&&e(8,c=u.extraObjects),"highlightData"in u&&e(5,d=u.highlightData)},i.$$.update=()=>{i.$$.dirty&260&&e(6,n=c==null?void 0:c.filter(u=>u.floorIndex===r))},[o,s,r,a,l,d,n,h,c]}class yg extends ce{constructor(t){super(),le(this,t,bg,Ag,ae,{five:0,pxmm:1,floorIndex:2,hoverEnable:3,floorplanData:4,extraObjects:8,highlightData:5})}}function wg(i){fe(i,"svelte-1mvqyqq",".plugin-floorplan-radar.svelte-1mvqyqq{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.plugin-floorplan-radar-container.svelte-1mvqyqq{position:relative}")}function Al(i){let t,e,n,o,s=i[7]!==0&&bl(i);return{c(){t=z("div"),s&&s.c(),w(t,"class","plugin-floorplan-radar svelte-1mvqyqq")},m(r,a){j(r,t,a),s&&s.m(t,null),e=!0,n||(o=[Ut(vi.call(null,t)),Ce(t,"clientWidth",i[13]),Ce(t,"clientHeight",i[14])],n=!0)},p(r,a){r[7]!==0?s?(s.p(r,a),a&128&&x(s,1)):(s=bl(r),s.c(),x(s,1),s.m(t,null)):s&&(de(),L(s,1,1,()=>{s=null}),he())},i(r){e||(x(s),e=!0)},o(r){L(s),e=!1},d(r){r&&V(t),s&&s.d(),n=!1,rt(o)}}}function bl(i){let t,e,n,o,s=`${i[9]}px`,r=`${i[12]}px`,a;const l=[{five:i[0],pxmm:i[10],floorIndex:i[11],floorplanData:i[3],hoverEnable:i[2],extraObjects:i[5],highlightData:i[6]}];let c={};for(let u=0;u<l.length;u+=1)c=Ze(c,l[u]);e=new yg({props:c});const d=[{pxmm:i[10],five:i[0],floorplanData:i[3],cameraImageUrl:i[4]}];let h={};for(let u=0;u<d.length;u+=1)h=Ze(h,d[u]);return o=new fg({props:h}),{c(){t=z("div"),ie(e.$$.fragment),n=ne(),ie(o.$$.fragment),w(t,"class","plugin-floorplan-radar-container svelte-1mvqyqq"),T(t,"width",s),T(t,"height",r)},m(u,m){j(u,t,m),ee(e,t,null),O(t,n),ee(o,t,null),a=!0},p(u,m){const v=m&3181?st(l,[{five:u[0],pxmm:u[10],floorIndex:u[11],floorplanData:u[3],hoverEnable:u[2],extraObjects:u[5],highlightData:u[6]}]):{};e.$set(v);const g=m&1049?st(d,[{pxmm:u[10],five:u[0],floorplanData:u[3],cameraImageUrl:u[4]}]):{};o.$set(g),m&512&&s!==(s=`${u[9]}px`)&&T(t,"width",s),m&4096&&r!==(r=`${u[12]}px`)&&T(t,"height",r)},i(u){a||(x(e.$$.fragment,u),x(o.$$.fragment,u),a=!0)},o(u){L(e.$$.fragment,u),L(o.$$.fragment,u),a=!1},d(u){u&&V(t),te(e),te(o)}}}function Pg(i){let t,e,n=i[1]&&Al(i);return{c(){n&&n.c(),t=Ee()},m(o,s){n&&n.m(o,s),j(o,t,s),e=!0},p(o,[s]){o[1]?n?(n.p(o,s),s&2&&x(n,1)):(n=Al(o),n.c(),x(n,1),n.m(t.parentNode,t)):n&&(de(),L(n,1,1,()=>{n=null}),he())},i(o){e||(x(n),e=!0)},o(o){L(n),e=!1},d(o){n&&n.d(o),o&&V(t)}}}function Cg(i,t,e){var E,k;let{five:n}=t,{visible:o}=t,{hoverEnable:s}=t,{floorplanData:r}=t,{cameraImageUrl:a}=t,{extraObjects:l=[]}=t,{highlightData:c}=t,d=0,h=(k=(E=n.work.observers[n.getCurrentState().panoIndex])==null?void 0:E.floorIndex)!=null?k:0,u=0,m=0,v=0,g=0;function A(S){e(11,h=n.work.observers[S].floorIndex)}Mt(()=>(n.on("panoArrived",A),()=>{n.off("panoArrived",A)}));const b=S=>{e(7,u=S.detail)},y=S=>{e(8,m=S.detail)};return i.$$set=S=>{"five"in S&&e(0,n=S.five),"visible"in S&&e(1,o=S.visible),"hoverEnable"in S&&e(2,s=S.hoverEnable),"floorplanData"in S&&e(3,r=S.floorplanData),"cameraImageUrl"in S&&e(4,a=S.cameraImageUrl),"extraObjects"in S&&e(5,l=S.extraObjects),"highlightData"in S&&e(6,c=S.highlightData)},i.$$.update=()=>{if(i.$$.dirty&904){const S=Math.min(u,m),{max:C,min:_}=r.bounding,M=C.x-_.x,X=C.y-_.y,J=function(){return M>X?[S,S/M*X]:[S/X*M,S]}();e(9,v=J[0]),e(12,g=J[1]),e(10,d=v/M)}},[n,o,s,r,a,l,c,u,m,v,d,h,g,b,y]}class Eg extends ce{constructor(t){super(),le(this,t,Cg,Pg,ae,{five:0,visible:1,hoverEnable:2,floorplanData:3,cameraImageUrl:4,extraObjects:5,highlightData:6},wg)}}let Ig=class extends Mn{constructor(e,n){super(e);f(this,"name","panoFloorplanRadarPlugin");f(this,"state");f(this,"data");f(this,"app");f(this,"wrapperSelector","");f(this,"wrapper",null);f(this,"disposed",!1);f(this,"extraObjects",[]);f(this,"highlightData",{});f(this,"dispose",()=>{var e;this.disposed=!0,(e=this.app)==null||e.$destroy(),this.wrapper=null,this.wrapperSelector="",this.hooks.emit("dispose")});f(this,"highlight",e=>{this.state.config.highlightEnable&&(this.highlightData=e,this.render())});f(this,"unhighlight",()=>{this.highlightData={},this.render()});f(this,"_disable",e=>{var o;const{userAction:n}=e;(o=this.app)==null||o.$destroy(),this.app=void 0,this.hooks.emit("disable",{userAction:n})});this.five=e;const o={hoverEnable:!0,highlightEnable:!0,cameraImageUrl:an},s=n!=null&&n.configs?n.configs:{},r=F(F({},o),s);this.state={enabled:!0,visible:!0,config:r},n!=null&&n.wrapper&&console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法"),typeof(n==null?void 0:n.wrapper)=="string"?this.wrapperSelector=n.wrapper:(n==null?void 0:n.wrapper)instanceof Element&&(this.wrapper=n.wrapper),e.once("dispose",this.dispose)}load(e,n,o=!0){return Y(this,null,function*(){function s(c){return Object.prototype.hasOwnProperty.apply(c,["version"])}const r=JSON.parse(JSON.stringify(e)),a=s(r)?r.data:r,l=this.data;this.data=yield ln(a),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,l),n&&this.updateState(n,o),this.render()})}show(){return Y(this,arguments,function*(e={}){if(this.state.visible)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!0},n),this._show({userAction:n})})}hide(){return Y(this,arguments,function*(e={}){if(!this.state.visible)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!1},n),this._hide({userAction:n})})}enable(e={}){if(this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!0},e.userAction||n),this._enable({userAction:n})}disable(e={}){if(!this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!1},e.userAction||n),this._disable({userAction:n})}setState(e,n={}){const o=this.state,s=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,s),e.enabled!==void 0&&o.enabled!==e.enabled){const r={userAction:s};e.enabled?this._enable(r):this._disable(r)}if(e.visible!==void 0&&o.visible!==e.visible){const r={userAction:s};e.visible?this._show(r):this._hide(r)}}appendTo(e){this.wrapper=e,this.render()}changeConfigs(e,n=!0){this.setState({config:e},{userAction:n}),this.render()}setExtraObjectsWith3DPositions(e){this.data&&(this.extraObjects=qp(e,this.five,this.data),this.render())}formatData(e){return Y(this,null,function*(){return yield ln(e.data)})}_enable(e){const{userAction:n}=e;this.hooks.emit("enable",{userAction:n}),this.state.visible&&this._show({userAction:n})}_show(e){if(this.disposed||!this.state.enabled)return;const{userAction:n}=e;this.hooks.emit("show",{userAction:n}),this.render()}_hide(e){if(this.disposed||!this.state.enabled)return;const{userAction:n}=e;this.hooks.emit("hide",{userAction:n}),this.render()}updateState(e,n){const o=this.state;this.state=F(F({},this.state),e),!jt(this.state,o,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n})}render(){if(this.disposed||!this.state.enabled)return;if(!this.wrapper&&this.wrapperSelector){const n=document.querySelector(this.wrapperSelector);this.wrapper=n}if(!this.data||!this.wrapper)return;const e=ye(F({},this.state.config),{five:this.five,floorplanData:this.data,visible:this.state.visible,extraObjects:this.extraObjects,highlightData:this.highlightData});this.app?this.app.$set(e):this.app=new Eg({target:this.wrapper,props:e})}};const kg=(i,t)=>new Ig(i,t),xg=[{type:0,floorType:1,roomType:"100900000012",name:"其他"},{type:1,floorType:1,roomType:"100900000002",name:"客厅"},{type:2,floorType:1,roomType:"100900000002",name:"餐厅"},{type:3,floorType:0,roomType:"100900000001",name:"卧室"},{type:4,floorType:0,roomType:"100900000001",name:"书房"},{type:5,floorType:3,roomType:"100900000004",name:"卫生间"},{type:6,floorType:3,roomType:"100900000004",name:"淋浴间"},{type:7,floorType:3,roomType:"100900000004",name:"洗手间"},{type:8,floorType:3,roomType:"100900000003",name:"厨房"},{type:9,floorType:1,roomType:"100900000003",name:"开放厨房",onlySubArea:!0},{type:10,floorType:0,roomType:"100900000001",name:"多功能间"},{type:11,floorType:0,roomType:"100900000009",name:"保姆间"},{type:12,floorType:4,roomType:"100900000005",name:"阳台"},{type:13,floorType:4,roomType:"100900000006",name:"露台"},{type:14,floorType:0,roomType:"100900000008",name:"储物间"},{type:15,floorType:0,roomType:"100900000013",name:"衣帽间"},{type:16,floorType:0,roomType:"100900000011",name:"阁楼"},{type:17,floorType:2,roomType:"100900000007",name:"花园"},{type:18,floorType:5,roomType:"100900000010",name:"车库"},{type:19,floorType:1,roomType:"100900000012",name:"电梯"},{type:20,floorType:1,roomType:"100900000012",name:"地下室"},{type:21,floorType:1,roomType:"100900000012",name:"天井"},{type:22,floorType:1,roomType:"100900000012",name:"阳光房"},{type:23,floorType:1,roomType:"100900000012",name:"过道"},{type:24,floorType:1,roomType:"100900000012",name:"楼梯间"},{type:25,floorType:1,roomType:"100900000012",name:"门厅"},{type:26,floorType:2,roomType:"100900000012",name:"入户花园"},{type:27,floorType:1,roomType:"100900000012",name:"玄关"},{type:28,floorType:1,roomType:"100900000012",name:"挑空"},{type:29,floorType:4,roomType:"100900000012",name:"晾晒区"},{type:30,floorType:4,roomType:"100900000012",name:"洗衣房"},{type:31,floorType:0,roomType:"100900000012",name:"娱乐区"},{type:32,floorType:0,roomType:"100900000012",name:"健身区"},{type:33,floorType:0,roomType:"100900000012",name:"接待区"},{type:34,floorType:0,roomType:"100900000012",name:"影音区"},{type:35,floorType:1,roomType:"100900000012",name:"餐饮区"},{type:36,floorType:1,roomType:"100900000012",name:"其他",onlySubArea:!0},{type:37,floorType:1,roomType:"100900000002",name:"起居室"},{type:38,floorType:0,roomType:"100900000001",name:"主卧"},{type:39,floorType:0,roomType:"100900000001",name:"次卧"},{type:40,floorType:0,roomType:"100900000001",name:"优化间"},{type:41,floorType:0,roomType:"100900000001",name:"办公室"},{type:42,floorType:0,roomType:"100900000001",name:"会议室"},{type:43,floorType:0,roomType:"100900000001",name:"洽谈间"},{type:44,floorType:1,roomType:"100900000002",name:"共享大厅"},{type:45,floorType:1,roomType:"100900000012",name:"水吧"},{type:46,floorType:0,roomType:"100900000015",name:"出入口"},{type:47,floorType:0,roomType:"100900000015",name:"大厅"},{type:48,floorType:0,roomType:"100900000015",name:"包厢"},{type:49,floorType:0,roomType:"100900000015",name:"其他"},{type:50,floorType:0,roomType:"100900000016",name:"出入口"},{type:51,floorType:0,roomType:"100900000016",name:"办公区"},{type:52,floorType:0,roomType:"100900000016",name:"老板间"},{type:53,floorType:0,roomType:"100900000016",name:"会议室"},{type:54,floorType:0,roomType:"100900000016",name:"休息区/水吧"},{type:55,floorType:0,roomType:"100900000016",name:"其他"},{type:56,floorType:2,roomType:"100900000012",name:"空中花园"},{type:57,floorType:0,roomType:"100900000001",name:"洋室"},{type:58,floorType:0,roomType:"100900000001",name:"和室"}],Dg=[{type:0,description:"木质地板"},{type:1,description:"瓷砖地面"},{type:2,description:"户外地面"},{type:3,description:"卫生间地面"},{type:4,description:"阳台地面"},{type:5,description:"车库地面"}],Mg=[{roomType:"100900000001",description:"室"},{roomType:"100900000002",description:"厅"},{roomType:"100900000003",description:"厨"},{roomType:"100900000004",description:"卫"},{roomType:"100900000005",description:"阳台"},{roomType:"100900000006",description:"露台"},{roomType:"100900000007",description:"花园"},{roomType:"100900000008",description:"储"},{roomType:"100900000009",description:"保姆间"},{roomType:"100900000010",description:"车库"},{roomType:"100900000011",description:"阁楼"},{roomType:"100900000012",description:"其他"},{roomType:"100900000013",description:"衣"},{roomType:"100900000015",description:"商铺"},{roomType:"100900000016",description:"写字楼"}],mr=(i,t,e)=>{const n=new I.Matrix4,o=new I.Euler(i,t,e,"YXZ");return n.makeRotationFromEuler(o),n},Sg=(i,{scale:t,rotation:e,position:n})=>{if(t&&i.scale.set(t,t,t),e){const[o,s,r]=e;o&&i.applyMatrix4(mr(o,0,0)),s&&i.applyMatrix4(mr(0,s,0)),r&&i.applyMatrix4(mr(0,0,r))}return n&&i.position.set(n.x,n.y,n.z),i};function mh(i,t){i.traverse(e=>{var n;if(e.type==="Mesh"){const o=e,s=F({map:o.material.map||{}},t);o.material=new R.MeshBasicMaterial(s),o.renderOrder=1,((n=e.parent)==null?void 0:n.type)==="Mesh"&&(e.renderOrder=e.parent.renderOrder+1)}})}const Lg=(i,t)=>{var d;const e=t.fbx_url||"//vrlab-image4.ljcdn.com/release/web/dipan2.f38a21cc.FBX",n=(d=t.north_rad)!=null?d:void 0,o={},s=h=>Y(exports,null,function*(){var Q;const u=(h==null?void 0:h.fbx_url)||e,m=(Q=h==null?void 0:h.north_rad)!=null?Q:n;if(typeof m!="number")throw new Error('"northRad"配置参数缺失:未配置指南针指向!');const v=i.model.bounding,g=v.max.x-v.min.x,A=v.max.z-v.min.z,b=Math.max(g,A),E=yield new wd.FBXLoader().loadAsync(u);mh(E,{transparent:!0,side:I.DoubleSide,blending:I.AdditiveBlending});const k=[0,m-Math.PI/2,0],{model:{bounding:{max:{x:S,z:C},min:{x:_,y:M,z:X}}}}=i;o.yBase=M;const J={x:(S+_)/2,y:M-1.6,z:(C+X)/2},H=.0045*b;return Sg(E,{position:J,rotation:k,scale:H}),o.object=E,!0}),r=({latitude:h})=>{if(!o.object)return;const u=a(h);u&&(o.object.position.y=u)},a=h=>{if(o.yBase===void 0)return;const u=.6;if(h>=Math.PI/4)return o.yBase-(u+1.6);const m=h*(4/Math.PI);return o.yBase-(u*m+1.6)};return{load:s,disable:()=>{o.object&&(i.scene.remove(o.object),i.needsRender=!0,i.off("cameraDirectionUpdate",r))},enable:()=>{if(!o.object)return;const h=a(i.getPose().latitude);h&&(o.object.position.y=h),i.scene.add(o.object),i.needsRender=!0,i.on("cameraDirectionUpdate",r)}}};function Tg(i,t){var c,d,h,u,m;const e=(c=t==null?void 0:t.size)!=null?c:512,n=(d=t==null?void 0:t.fontSize)!=null?d:e*(35/256)*1.2,o=(h=t==null?void 0:t.backgroundColor)!=null?h:"rgba(0,0,0,0)",s=(u=t==null?void 0:t.fontColor)!=null?u:"#fff",r=(m=t==null?void 0:t.textAlign)!=null?m:"center",a=document.createElement("canvas");a.setAttribute("width",e+""),a.setAttribute("height",e+"");const l=a.getContext("2d");return l.fillStyle=o,l.fillRect(0,0,e,e),l.font=`${n}px "微软雅黑"`,l.textAlign=r,l.fillStyle=s,l.fillText(i,e/2,e*.7),new R.CanvasTexture(a)}const zg=({x:i,y:t,z:e})=>new R.Vector3(i,t,e),_g=(i,t)=>{var g,A,b;const e={},n=(g=t.animationEnabled)!=null?g:!0,o=(A=t.position)!=null?A:void 0,s=(b=t.rad)!=null?b:void 0,r=t.fbx_url||"//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx",a=[],l=y=>Y(exports,null,function*(){var J,H,Q,G,B,W,q,U;const E=(J=y==null?void 0:y.position)!=null?J:o;if(!E)return Promise.reject(new Error("ModelEntryDoorGuidePlugin.load(): position is undefined"));const k=zg(E),S=(H=y==null?void 0:y.rad)!=null?H:s,C=(Q=y==null?void 0:y.fbx_url)!=null?Q:r;if(e.rad=S,S===void 0)return Promise.reject(new Error(`ModelEntryDoorGuidePlugin.load(): rad is ${S}`));const _=yield new wd.FBXLoader().loadAsync(C);_.position.copy(k),_.rotation.z=S,_.scale.set(.8,.8,.8),mh(_,{transparent:!0,side:I.DoubleSide});const M=(q=(W=(B=(G=_.children)==null?void 0:G[0])==null?void 0:B.children)==null?void 0:W[3])==null?void 0:q.clone();if(!M)return Promise.reject(new Error(`ModelEntryDoorGuidePlugin.load(): textMesh is ${M}`));const X=(U=t.name)!=null?U:"入户门";return M.material=new R.MeshBasicMaterial({transparent:!0,map:Tg(X)}),M.renderOrder=3,_.children[0].add(M),e.object=_,!0}),c=()=>{if(e.animation)return;if(!e.object)return console.error("ModelEntryDoorGuidePlugin.initAnimation(): state.object is ",e.object);const y=1,E=new R.AnimationMixer(e.object);a.push(E);const k=E.clipAction(e.object.animations[0]);k.timeScale=y;let S;const C=()=>{let J=0,H=0;const Q=1e3/30,G=B=>{J=requestAnimationFrame(G);const W=B-H;W<Q||(H=B,a.forEach(q=>q.update(W/1e3)),i.needsRender=!0)};return J=requestAnimationFrame(G),()=>{cancelAnimationFrame(J)}},X={play:()=>{S||(k.play(),S=C(),requestAnimationFrame(()=>{e.object&&e.object.rotation.z!==e.rad&&(e.object.rotation.z=e.rad)}))},stop:()=>{k.stop(),S==null||S(),S=void 0}};e.animation=X},d=y=>{var k;if(!e.object)return console.error("ModelEntryDoorGuidePlugin.enable(): object is ",e.object);((k=y==null?void 0:y.animationEnable)!=null?k:n)&&(e.animation||c(),e.animation.play()),i.scene.add(e.object),i.needsRender=!0},h=()=>{e.object&&(e.animation&&e.animation.stop(),i.scene.remove(e.object),i.needsRender=!0)},u=y=>y==="Floorplan"?d():h();return{load:l,enable:y=>(e.enabled||(e.enabled=!0,u(i.currentMode),i.on("modeChange",u),d(y)),!0),disable:()=>(e.enabled&&(e.enabled=!1,h(),i.off("modeChange",u)),!0)}},Vg=kt;function jg(i,t,e,n=Vg.Linear.None){const o=new is(i).to(t,e).easing(n);rs(()=>o.start(0));const s=$i(a=>{o.update(a)===!1&&s()}),r=[];return o.onDestroy=a=>(r.push(a),o),o.destroy=function(){this.stop(),Object.assign(o,{_onStartCallback:null,_onUpdateCallback:null,_onCompleteCallback:null,_onStopCallbackL:null});let a;for(;a=r.shift();)a();s()},o}function Og(i,t){return jg({progress:0},{progress:1},i,t)}var ph=(i=>(i.Move="Move",i.Rotate="Rotate",i))(ph||{}),Vt=(i=>(i.Clockwise="Clockwise",i.Anticlockwise="Anticlockwise",i.Loop="Loop",i))(Vt||{});const Bo=Math.PI*2;function yl(i){return(i%Bo+Bo)%Bo}function wl(i){return i%Bo}function pr(i,t,e){return i+(t-i)*e}const Hr=(i,t,e)=>{const n=Math.PI,o=n*2;let s=yl(i),r=yl(t);return e===Vt.Anticlockwise&&s<r&&(s+=o),e===Vt.Clockwise&&r<s&&(r+=o),e===Vt.Loop&&r-s>n?Hr(s,r,Vt.Anticlockwise):e===Vt.Loop&&s-r>n?Hr(s,r,Vt.Clockwise):{from:s,to:r}},Bg=i=>{const t={},e=(l,c,...d)=>Y(exports,[l,c,...d],function*(s,r,a={preload:!0}){return t.interruptCallback&&t.interruptCallback(!1),a.asyncStartCallback&&(yield a.asyncStartCallback()),s.mode&&s.mode!==i.currentMode&&(yield i.changeMode(s.mode)),a.preload&&s.panoIndex!==void 0&&s.panoIndex!==i.panoIndex&&(yield i.preloadPano(s.panoIndex)),a.asyncEndCallback&&(yield a.asyncEndCallback()),s.panoIndex===void 0&&s.fov===void 0&&s.latitude===void 0&&s.longitude===void 0?!0:yield new Promise((h,u)=>{const m=s.panoIndex!==void 0?s.panoIndex:i.panoIndex;m!==void 0?i.moveToPano(m,F({duration:r,moveEndCallback:()=>h(!0),moveCancelCallback:()=>u(new Error("move canceled"))},s)):u(new Error("unexpected error"))})}),n=s=>{const r=i.state,a=wl(r.latitude),l=wl(s.latitude),{from:c,to:d}=Hr(r.longitude,s.longitude,s.rotation||Vt.Loop),h=r.fov,u=s.fov;return{from:{latitude:a,longitude:c,fov:h},to:{latitude:l,longitude:d,fov:u}}};return{move:e,rotate:(l,c,...d)=>Y(exports,[l,c,...d],function*(s,r,a={}){t.interruptCallback&&t.interruptCallback(!1),a.asyncStartCallback&&(yield a.asyncStartCallback()),i.currentMode!==ze.Five.Mode.Panorama&&(yield i.changeMode(ze.Five.Mode.Panorama)),s.panoIndex!==void 0&&s.panoIndex!==i.panoIndex&&(a.preload&&(yield i.preloadPano(s.panoIndex)),yield new Promise((m,v)=>{if(!s.panoIndex){m(!0);return}i.moveToPano(s.panoIndex,{moveEndCallback:()=>m(!0),moveCancelCallback:()=>v(new Error("move canceled"))})})),a.asyncEndCallback&&(yield a.asyncEndCallback());const{from:h,to:u}=n(s);return yield new Promise(m=>{const v=({progress:E})=>{const k={};k.longitude=pr(h.longitude,u.longitude,E),k.latitude=pr(h.latitude,u.latitude,E),k.fov=pr(h.fov,u.fov,E),i.setState(k,!0)},g=()=>{m(!0)},A=()=>{m(!1)},b=s.rotateSpeed?Math.ceil(Math.abs(u.longitude-h.longitude)/s.rotateSpeed*1e3):r,y=Og(b,kt.Linear.None).onUpdate(v).onComplete(g).onDestroy(A);s.rotation===Vt.Loop&&y.repeat(1/0).yoyo(!0),t.interruptCallback=(E=!0)=>{y.destroy(),t.interruptCallback=void 0,t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0),m(E)},t.timeoutId=setTimeout(()=>{t.interruptCallback&&t.interruptCallback(!0)},r)})})}};function Pl(i,t){return i.x===t.x&&i.y===t.y}function gh(i,t){return Math.abs(i)===1/0&&Math.abs(t)===1/0?!0:Math.abs(i-t)<.001}function Zo(i,t){return(t.y-i.y)/(t.x-i.x)}function vh(i,t,e){const n=Zo(i[1],i[0]),o=Zo(t[1],t[0]);if(isNaN(n)||isNaN(o)||gh(n,o))return!1;if(Io(i[0],t))return i[0];if(Io(i[1],t))return i[1];if(Io(t[0],i))return t[0];if(Io(t[1],i))return t[1];if(e&&!Rg(i,t))return!1;const s=i[0],r=t[0];if(Math.abs(n)===1/0)return{x:s.x,y:t[1].y-(t[1].x-s.x)*o};if(Math.abs(o)===1/0)return{x:r.x,y:i[1].y-(i[1].x-r.x)*n};const a=(r.y-s.y+n*s.x-o*r.x)/(n-o),l=n*a-n*s.x+s.y;return{x:a,y:l}}function Io(i,t){return Pl(i,t[0])||Pl(i,t[1])?!0:(t[0].x-i.x)*(i.x-t[1].x)>=0&&(t[0].y-i.y)*(i.y-t[1].y)>=0&&gh(Zo(t[0],i),Zo(i,t[1]))}function ko(i,t,e){return(i.x-e.x)*(t.y-e.y)-(t.x-e.x)*(i.y-e.y)}function Rg(i,t){return Math.max(i[0].x,i[1].x)>=Math.min(t[0].x,t[1].x)&&Math.max(t[0].x,t[1].x)>=Math.min(i[0].x,i[1].x)&&Math.max(i[0].y,i[1].y)>=Math.min(t[0].y,t[1].y)&&ko(t[0],i[1],i[0])*ko(i[1],t[1],i[0])>0&&ko(i[0],t[1],t[0])*ko(t[1],i[1],t[0])>0?1:0}function Ah(i,t=0){t<=0?requestAnimationFrame(i):requestAnimationFrame(()=>Ah(i,t-1))}const Qg=`<style type="text/css">
194
+ `;return i.$$set=s=>{"content"in s&&e(0,n=s.content)},[n,o]}class Rm extends ce{constructor(t){super(),le(this,t,Bm,Om,ae,{content:0},jm)}}function Qm(i){fe(i,"svelte-ozpg4a",".floorplan-plugin__base-image.svelte-ozpg4a{position:absolute;z-index:10;width:100%;height:100%;pointer-events:none}")}function Hm(i){let t,e;return t=new Vm({props:{url:i[1].url}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&2&&(s.url=n[1].url),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Gm(i){let t,e;return t=new Rm({props:{content:i[0]}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.content=n[0]),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Fm(i){let t,e,n,o;const s=[Gm,Hm],r=[];function a(l,c){return l[0]?0:l[1]?1:-1}return~(e=a(i))&&(n=r[e]=s[e](i)),{c(){t=z("div"),n&&n.c(),w(t,"class","floorplan-plugin__base-image svelte-ozpg4a")},m(l,c){j(l,t,c),~e&&r[e].m(t,null),o=!0},p(l,[c]){let d=e;e=a(l),e===d?~e&&r[e].p(l,c):(n&&(de(),L(r[d],1,1,()=>{r[d]=null}),he()),~e?(n=r[e],n?n.p(l,c):(n=r[e]=s[e](l),n.c()),x(n,1),n.m(t,null)):n=null)},i(l){o||(x(n),o=!0)},o(l){L(n),o=!1},d(l){l&&V(t),~e&&r[e].d()}}}function Wm(i,t,e){let n,o,{floorIndex:s}=t,{floorplanData:r}=t;return i.$$set=a=>{"floorIndex"in a&&e(2,s=a.floorIndex),"floorplanData"in a&&e(3,r=a.floorplanData)},i.$$.update=()=>{var a,l;i.$$.dirty&12&&e(1,n=r.outlines[s]),i.$$.dirty&12&&e(0,o=(l=(a=r.outlines)==null?void 0:a[s])==null?void 0:l.svgContent)},[o,n,s,r]}class ch extends ce{constructor(t){super(),le(this,t,Wm,Fm,ae,{floorIndex:2,floorplanData:3},Qm)}}function Nm(i){fe(i,"svelte-12pzct5",".floorplan-plugin__room-label-item.svelte-12pzct5{position:absolute;display:flex;flex-flow:column;align-items:center;line-height:1;color:#fff;transform:translate(-50%, -50%);white-space:nowrap;will-change:opacity;transition:opacity 300ms}.floorplan-plugin__room-size.svelte-12pzct5{opacity:0.45}")}function Xm(i){let t,e=i[8].outerHTML+"",n;return{c(){t=new Go(!1),n=Ee(),t.a=n},m(o,s){t.m(e,o,s),j(o,n,s)},p(o,s){s&256&&e!==(e=o[8].outerHTML+"")&&t.p(e)},d(o){o&&V(n),o&&t.d()}}}function Ym(i){let t,e,n=i[1]&&Fa(i),o=i[0]&&Wa(i);return{c(){n&&n.c(),t=ne(),o&&o.c(),e=Ee()},m(s,r){n&&n.m(s,r),j(s,t,r),o&&o.m(s,r),j(s,e,r)},p(s,r){s[1]?n?n.p(s,r):(n=Fa(s),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null),s[0]?o?o.p(s,r):(o=Wa(s),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null)},d(s){n&&n.d(s),s&&V(t),o&&o.d(s),s&&V(e)}}}function Fa(i){let t,e=i[2].name+"",n;return{c(){t=z("span"),n=_e(e),w(t,"class","floorplan-plugin__room-name")},m(o,s){j(o,t,s),O(t,n)},p(o,s){s&4&&e!==(e=o[2].name+"")&&Oe(n,e)},d(o){o&&V(t)}}}function Wa(i){let t,e;return{c(){t=z("span"),e=_e(i[7]),w(t,"class","floorplan-plugin__room-size svelte-12pzct5")},m(n,o){j(n,t,o),O(t,e)},p(n,o){o&128&&Oe(e,n[7])},d(n){n&&V(t)}}}function Um(i){let t,e,n;function o(a,l){if(a[3]===void 0)return Ym;if(a[8])return Xm}let s=o(i),r=s&&s(i);return{c(){t=z("div"),r&&r.c(),w(t,"class","floorplan-plugin__room-label-item svelte-12pzct5"),T(t,"left",i[9]),T(t,"top",i[10]),T(t,"font-size",i[11]),T(t,"opacity",i[6]?"1":"0")},m(a,l){j(a,t,l),r&&r.m(t,null),e||(n=[Ut(vi.call(null,t)),Ce(t,"clientWidth",i[19]),Ce(t,"clientHeight",i[20])],e=!0)},p(a,[l]){s===(s=o(a))&&r?r.p(a,l):(r&&r.d(1),r=s&&s(a),r&&(r.c(),r.m(t,null))),l&64&&T(t,"opacity",a[6]?"1":"0")},i:K,o:K,d(a){a&&V(t),r&&r.d(),e=!1,rt(n)}}}function qm(i,t){const e=i[0],n=i[1];let o=!1;for(let s=0,r=t.length-1;s<t.length;r=s++){const a=t[s][0],l=t[s][1],c=t[r][0],d=t[r][1];l>n!=d>n&&e<(c-a)*(n-l)/(d-l)+a&&(o=!o)}return o}function Jm(i,t,e){let n,o,s,r,a,{pxmm:l}=t,{roomAreaEnable:c}=t,{roomNameEnable:d}=t,{room:h}=t,{hoveredRoom:u}=t,{getRoomAreaText:m}=t,{getLabelElement:v}=t,{adaptiveRoomLabelVisibleEnable:g}=t;function A(Q,G){if(G.width===0||G.height===0)return()=>!1;const B=Q.path.map(({x:we,y:ge})=>[we,ge]),W=Q.roomLabel.position,{x:q,y:U}=W,{width:Z,height:re}=G,oe=Z/2,Ae=re/2;return function(ge){const Ve=q*ge,ve=U*ge,Ge=B.map(([be,Se])=>[be*ge,Se*ge]);return[[Ve+oe,ve-Ae],[Ve-oe,ve-Ae],[Ve-oe,ve+Ae],[Ve+oe,ve+Ae]].every(be=>qm(be,Ge))}}const b=document.body.clientWidth,y=document.body.clientHeight,E=h.roomLabel,k=E.positionInImage.x*100+"%",S=E.positionInImage.y*100+"%",C=(b<500||y<500?10:14)+"px";let _=0,M=0,X=!1;u.subscribe(function(G){e(16,X=!!G&&G.id===h.id)});const J=Q=>{e(4,_=Q.detail)},H=Q=>{e(5,M=Q.detail)};return i.$$set=Q=>{"pxmm"in Q&&e(12,l=Q.pxmm),"roomAreaEnable"in Q&&e(0,c=Q.roomAreaEnable),"roomNameEnable"in Q&&e(1,d=Q.roomNameEnable),"room"in Q&&e(2,h=Q.room),"hoveredRoom"in Q&&e(13,u=Q.hoveredRoom),"getRoomAreaText"in Q&&e(14,m=Q.getRoomAreaText),"getLabelElement"in Q&&e(3,v=Q.getLabelElement),"adaptiveRoomLabelVisibleEnable"in Q&&e(15,g=Q.adaptiveRoomLabelVisibleEnable)},i.$$.update=()=>{i.$$.dirty&12&&e(8,n=v==null?void 0:v(h)),i.$$.dirty&16388&&e(7,o=h.size?m(h.size):""),i.$$.dirty&48&&e(18,s={width:_,height:M}),i.$$.dirty&262148&&e(17,r=s?A(h,s):void 0),i.$$.dirty&233472&&e(6,a=g?X?!0:!!(r!=null&&r(l)):!0)},[c,d,h,v,_,M,a,o,n,k,S,C,l,u,m,g,X,r,s,J,H]}class Zm extends ce{constructor(t){super(),le(this,t,Jm,Um,ae,{pxmm:12,roomAreaEnable:0,roomNameEnable:1,room:2,hoveredRoom:13,getRoomAreaText:14,getLabelElement:3,adaptiveRoomLabelVisibleEnable:15},Nm)}}function Km(i){fe(i,"svelte-13xux0b",".floorplan-plugin__room-labels.svelte-13xux0b{width:100%;height:100%;position:absolute;left:0;top:0;z-index:20;pointer-events:none}")}function Na(i,t,e){const n=i.slice();return n[12]=t[e],n}function Xa(i){let t,e=[],n=new Map,o,s,r,a=i[8];const l=c=>c[12].id;for(let c=0;c<a.length;c+=1){let d=Na(i,a,c),h=l(d);n.set(h,e[c]=Ya(h,d))}return{c(){t=z("div");for(let c=0;c<e.length;c+=1)e[c].c();w(t,"class","floorplan-plugin__room-labels svelte-13xux0b")},m(c,d){j(c,t,d);for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(t,null);o=!0,s||(r=[Ut(vi.call(null,t)),Ce(t,"clientWidth",i[11])],s=!0)},p(c,d){d&447&&(a=c[8],de(),e=St(e,d,l,1,c,a,n,t,un,Ya,null,Na),he())},i(c){if(!o){for(let d=0;d<a.length;d+=1)x(e[d]);o=!0}},o(c){for(let d=0;d<e.length;d+=1)L(e[d]);o=!1},d(c){c&&V(t);for(let d=0;d<e.length;d+=1)e[d].d();s=!1,rt(r)}}}function Ya(i,t){let e,n,o;const s=[{pxmm:t[7],room:t[12],hoveredRoom:t[2],roomAreaEnable:t[0],roomNameEnable:t[1],getLabelElement:t[4],getRoomAreaText:t[3],adaptiveRoomLabelVisibleEnable:t[5]}];let r={};for(let a=0;a<s.length;a+=1)r=Ze(r,s[a]);return n=new Zm({props:r}),{key:i,first:null,c(){e=Ee(),ie(n.$$.fragment),this.first=e},m(a,l){j(a,e,l),ee(n,a,l),o=!0},p(a,l){t=a;const c=l&447?st(s,[{pxmm:t[7],room:t[12],hoveredRoom:t[2],roomAreaEnable:t[0],roomNameEnable:t[1],getLabelElement:t[4],getRoomAreaText:t[3],adaptiveRoomLabelVisibleEnable:t[5]}]):{};n.$set(c)},i(a){o||(x(n.$$.fragment,a),o=!0)},o(a){L(n.$$.fragment,a),o=!1},d(a){a&&V(e),te(n,a)}}}function $m(i){let t,e,n=i[8]&&Xa(i);return{c(){n&&n.c(),t=Ee()},m(o,s){n&&n.m(o,s),j(o,t,s),e=!0},p(o,[s]){o[8]?n?(n.p(o,s),s&256&&x(n,1)):(n=Xa(o),n.c(),x(n,1),n.m(t.parentNode,t)):n&&(de(),L(n,1,1,()=>{n=null}),he())},i(o){e||(x(n),e=!0)},o(o){L(n),e=!1},d(o){n&&n.d(o),o&&V(t)}}}function ep(i,t,e){let n,{floorIndex:o}=t,{roomAreaEnable:s}=t,{roomNameEnable:r}=t,{floorplanData:a}=t,{hoveredRoom:l}=t,{getRoomAreaText:c}=t,{getLabelElement:d}=t,{adaptiveRoomLabelVisibleEnable:h}=t,u=0,m=0;const v=g=>{e(6,u=g.detail)};return i.$$set=g=>{"floorIndex"in g&&e(9,o=g.floorIndex),"roomAreaEnable"in g&&e(0,s=g.roomAreaEnable),"roomNameEnable"in g&&e(1,r=g.roomNameEnable),"floorplanData"in g&&e(10,a=g.floorplanData),"hoveredRoom"in g&&e(2,l=g.hoveredRoom),"getRoomAreaText"in g&&e(3,c=g.getRoomAreaText),"getLabelElement"in g&&e(4,d=g.getLabelElement),"adaptiveRoomLabelVisibleEnable"in g&&e(5,h=g.adaptiveRoomLabelVisibleEnable)},i.$$.update=()=>{if(i.$$.dirty&1536&&e(8,n=a.floorDatas[o].rooms),i.$$.dirty&1088){const{max:g,min:A}=a.bounding,b=g.x-A.x;e(7,m=u/b)}},[s,r,l,c,d,h,u,m,n,o,a,v]}class tp extends ce{constructor(t){super(),le(this,t,ep,$m,ae,{floorIndex:9,roomAreaEnable:0,roomNameEnable:1,floorplanData:10,hoveredRoom:2,getRoomAreaText:3,getLabelElement:4,adaptiveRoomLabelVisibleEnable:5},Km)}}function np(i){fe(i,"svelte-djlmk4",".floorplan-plugin__rule-labels.svelte-djlmk4.svelte-djlmk4{position:absolute;display:flex}.floorplan-plugin__rule-labels--top.svelte-djlmk4.svelte-djlmk4{left:0;top:-1.25rem}.floorplan-plugin__rule-labels--bottom.svelte-djlmk4.svelte-djlmk4{left:0;bottom:-1.25rem}.floorplan-plugin__rule-labels--left.svelte-djlmk4.svelte-djlmk4{top:0;left:-1.25rem}.floorplan-plugin__rule-labels--right.svelte-djlmk4.svelte-djlmk4{top:0;right:-1.25rem}.floorplan-plugin__rule-line.svelte-djlmk4.svelte-djlmk4{background:#fff;opacity:0.05;width:100%;height:100%}.floorplan-plugin__rule-scale-wrapper.svelte-djlmk4.svelte-djlmk4{position:absolute;width:0.3125rem;height:100%;left:50%;top:0;transform:translateX(-50%)}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-scale-wrapper.svelte-djlmk4{width:100%;height:0.3125rem;top:50%;left:0;transform:translateY(-50%)}.floorplan-plugin__rule-scale.svelte-djlmk4.svelte-djlmk4{position:absolute;background:#fff;opacity:0.05;width:100%;height:0.0625rem}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-scale.svelte-djlmk4{width:0.0625rem;height:100%}.floorplan-plugin__rule-text-wrapper.svelte-djlmk4.svelte-djlmk4{position:absolute}.floorplan-plugin__rule-labels--top.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:100%;height:0;top:0.625rem}.floorplan-plugin__rule-labels--bottom.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:100%;height:0;bottom:0.625rem}.floorplan-plugin__rule-labels--left.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:0;height:100%;left:0.625rem}.floorplan-plugin__rule-labels--right.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:0;height:100%;right:0.625rem}.floorplan-plugin__rule-text-item.svelte-djlmk4.svelte-djlmk4{width:0;height:0;position:absolute;transform:rotate(90deg)}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-text-item.svelte-djlmk4{transform:rotate(0)}.floorplan-plugin__rule-text.svelte-djlmk4.svelte-djlmk4{width:-moz-max-content;width:max-content;transform:translate(-50%, -50%);font-size:0.625rem;color:#fff;opacity:0.2}")}function Ua(i,t,e){const n=i.slice();return n[11]=t[e],n[13]=e,n}function qa(i,t,e){const n=i.slice();return n[14]=t[e],n}function Ja(i){let t;return{c(){t=z("div"),w(t,"class","floorplan-plugin__rule-scale svelte-djlmk4"),T(t,"left",i[14].left*100+"%"),T(t,"bottom",i[14].bottom*100+"%")},m(e,n){j(e,t,n)},p:K,d(e){e&&V(t)}}}function Za(i,t){let e,n,o=t[1](t[11].distance)+"",s,r;return{key:i,first:null,c(){e=z("div"),n=z("div"),s=_e(o),r=ne(),w(n,"class","floorplan-plugin__rule-text svelte-djlmk4"),$(n,"is-row",t[2]),w(e,"class","floorplan-plugin__rule-text-item svelte-djlmk4"),T(e,"left",t[11].left*100+"%"),T(e,"bottom",t[11].bottom*100+"%"),this.first=e},m(a,l){j(a,e,l),O(e,n),O(n,s),O(e,r)},p(a,l){t=a,l&2&&o!==(o=t[1](t[11].distance)+"")&&Oe(s,o)},d(a){a&&V(e)}}}function ip(i){let t,e,n,o,s,r,a=[],l=new Map,c,d=i[3],h=[];for(let v=0;v<d.length;v+=1)h[v]=Ja(qa(i,d,v));let u=i[4];const m=v=>v[13];for(let v=0;v<u.length;v+=1){let g=Ua(i,u,v),A=m(g);l.set(A,a[v]=Za(A,g))}return{c(){t=z("div"),e=z("div"),n=ne(),o=z("div");for(let v=0;v<h.length;v+=1)h[v].c();s=ne(),r=z("div");for(let v=0;v<a.length;v+=1)a[v].c();w(e,"class","floorplan-plugin__rule-line svelte-djlmk4"),w(o,"class","floorplan-plugin__rule-scale-wrapper svelte-djlmk4"),$(o,"is-row",i[2]),w(r,"class","floorplan-plugin__rule-text-wrapper svelte-djlmk4"),w(t,"class",c="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--"+i[0]+" svelte-djlmk4"),$(t,"is-row",i[2]),T(t,"width",i[2]?"100%":1/16+"rem"),T(t,"height",i[2]?1/16+"rem":"100%")},m(v,g){j(v,t,g),O(t,e),O(t,n),O(t,o);for(let A=0;A<h.length;A+=1)h[A]&&h[A].m(o,null);O(t,s),O(t,r);for(let A=0;A<a.length;A+=1)a[A]&&a[A].m(r,null)},p(v,[g]){if(g&8){d=v[3];let A;for(A=0;A<d.length;A+=1){const b=qa(v,d,A);h[A]?h[A].p(b,g):(h[A]=Ja(b),h[A].c(),h[A].m(o,null))}for(;A<h.length;A+=1)h[A].d(1);h.length=d.length}g&22&&(u=v[4],a=St(a,g,m,1,v,u,l,r,aa,Za,null,Ua)),g&1&&c!==(c="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--"+v[0]+" svelte-djlmk4")&&w(t,"class",c),g&5&&$(t,"is-row",v[2])},i:K,o:K,d(v){v&&V(t),qt(h,v);for(let g=0;g<a.length;g+=1)a[g].d()}}}const Nn=1e3,Xn=180;function op(i,t,e){let{type:n}=t,{data:o}=t,{bounding:s}=t,{getRuleDistanceText:r}=t;const a=n==="top"||n==="bottom",l=s.max.x-s.min.x-(Nn-Xn)*2,c=s.max.y-s.min.y-(Nn-Xn)*2,d=o.map(([v,g])=>a?[v.x,g.x]:[v.y,g.y]).flat().sort().filter((v,g,A)=>g===0?!0:v!==A[g-1]),h=d.map(v=>{const g=a?(v-s.min.x-Nn+Xn)/l:0,A=a?0:(v-s.min.y-Nn+Xn)/c;return{left:g,bottom:A}});h.unshift({left:0,bottom:0}),h.push(a?{left:1,bottom:0}:{left:0,bottom:1});const u=d[d.length-1]-d[0],m=d.map((v,g,A)=>{const b=g===0?0:v-A[g-1],y=g===0?0:(v+A[g-1])/2,E=a?(y-s.min.x-Nn+Xn)/l:0,k=a?0:(y-s.min.y-Nn+Xn)/c;return{left:E,bottom:k,distance:b}}).filter(({distance:v})=>v/u>.1);return i.$$set=v=>{"type"in v&&e(0,n=v.type),"data"in v&&e(5,o=v.data),"bounding"in v&&e(6,s=v.bounding),"getRuleDistanceText"in v&&e(1,r=v.getRuleDistanceText)},[n,r,a,h,m,o,s]}class sp extends ce{constructor(t){super(),le(this,t,op,ip,ae,{type:0,data:5,bounding:6,getRuleDistanceText:1},np)}}function rp(i){fe(i,"svelte-1mzj9p3",".floorplan-plugin__rule-labels-wrapper.svelte-1mzj9p3{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}")}function Ka(i,t,e){const n=i.slice();return n[13]=t[e][0],n[14]=t[e][1],n}function $a(i,t){let e,n,o;const s=[{type:t[13],data:t[14],bounding:t[1],getRuleDistanceText:t[0]}];let r={};for(let a=0;a<s.length;a+=1)r=Ze(r,s[a]);return n=new sp({props:r}),{key:i,first:null,c(){e=Ee(),ie(n.$$.fragment),this.first=e},m(a,l){j(a,e,l),ee(n,a,l),o=!0},p(a,l){t=a;const c=l&19?st(s,[{type:t[13],data:t[14],bounding:t[1],getRuleDistanceText:t[0]}]):{};n.$set(c)},i(a){o||(x(n.$$.fragment,a),o=!0)},o(a){L(n.$$.fragment,a),o=!1},d(a){a&&V(e),te(n,a)}}}function ap(i){let t,e=[],n=new Map,o,s=i[4];const r=a=>a[13];for(let a=0;a<s.length;a+=1){let l=Ka(i,s,a),c=r(l);n.set(c,e[a]=$a(c,l))}return{c(){t=z("div");for(let a=0;a<e.length;a+=1)e[a].c();w(t,"class","floorplan-plugin__rule-labels-wrapper svelte-1mzj9p3"),T(t,"width",i[3]),T(t,"height",i[2])},m(a,l){j(a,t,l);for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(t,null);o=!0},p(a,[l]){l&19&&(s=a[4],de(),e=St(e,l,r,1,a,s,n,t,un,$a,null,Ka),he()),l&8&&T(t,"width",a[3]),l&4&&T(t,"height",a[2])},i(a){if(!o){for(let l=0;l<s.length;l+=1)x(e[l]);o=!0}},o(a){for(let l=0;l<e.length;l+=1)L(e[l]);o=!1},d(a){a&&V(t);for(let l=0;l<e.length;l+=1)e[l].d()}}}const el=1e3,tl=180;function lp(i,t,e){let n,o,s,r,a,l,c,d,h,u,{floorIndex:m}=t,{floorplanData:v}=t,{getRuleDistanceText:g}=t;return i.$$set=A=>{"floorIndex"in A&&e(5,m=A.floorIndex),"floorplanData"in A&&e(6,v=A.floorplanData),"getRuleDistanceText"in A&&e(0,g=A.getRuleDistanceText)},i.$$.update=()=>{i.$$.dirty&64&&e(1,n=v.bounding),i.$$.dirty&96&&e(11,o=v.floorDatas[m].rules),i.$$.dirty&2048&&e(12,s=Object.keys(o)),i.$$.dirty&6144&&e(4,r=s.map(A=>[A,o[A]])),i.$$.dirty&2&&e(9,a=n.max.x-n.min.x),i.$$.dirty&2&&e(7,l=n.max.y-n.min.y),i.$$.dirty&2&&e(10,c=n.max.x-n.min.x-(el-tl)*2),i.$$.dirty&2&&e(8,d=n.max.y-n.min.y-(el-tl)*2),i.$$.dirty&1536&&e(3,h=c/a*100+"%"),i.$$.dirty&384&&e(2,u=d/l*100+"%")},[g,n,u,h,r,m,v,l,d,a,c,o,s]}class cp extends ce{constructor(t){super(),le(this,t,lp,ap,ae,{floorIndex:5,floorplanData:6,getRuleDistanceText:0},rp)}}function us(i,t={}){let e="";const{needZ:n,needA:o}=t;return(n?i.slice().concat(i[0]):i.slice()).forEach((r,a)=>{const{x:l,y:c}=t.format?t.format(r):r,d=l+","+c;return a===0?(e+="M"+d,e):o!=null&&o[a]?(e+="A"+o[a]+","+d,e):(e+="L"+d,e)}),e+(n?"Z":"")}function dh({x:i,y:t},e){const{max:n,min:o}=e;return{x:i-o.x,y:n.y-t}}function dp(i,t){const e=i.x*1e3+t.bounding.origin.x,n=-i.z*1e3+t.bounding.origin.y;return{x:e,y:n}}function hp(i,t){const e=t.bounding,n=e.max.x-e.min.x,o=e.max.y-e.min.y;return{x:(i.x-e.min.x)/n,y:(e.max.y-i.y)/o}}function up(i,t){return Math.max(...t.work.observers.map(n=>i.z>=n.standingPosition.z?n.floorIndex:0))}function fp(i){let t;return{c(){t=Te("path"),w(t,"d",i[0]),w(t,"fill","#2F313A")},m(e,n){j(e,t,n)},p(e,[n]){n&1&&w(t,"d",e[0])},i:K,o:K,d(e){e&&V(t)}}}function mp(i,t,e){let n,{path:o}=t;return i.$$set=s=>{"path"in s&&e(1,o=s.path)},i.$$.update=()=>{i.$$.dirty&2&&e(0,n=us(o,{needZ:!0}))},[n,o]}class pp extends ce{constructor(t){super(),le(this,t,mp,fp,ae,{path:1})}}function gp(i){let t,e,n,o,s,r;return{c(){t=Te("defs"),e=Te("pattern"),n=Te("rect"),o=Te("path"),s=ne(),r=Te("path"),w(n,"x","0"),w(n,"y","0"),w(n,"width",i[1]),w(n,"height",i[1]),w(n,"fill","#323747"),w(o,"d",i[2]),w(o,"stroke","#ffffff"),w(o,"stroke-opacity","0.06"),w(o,"stroke-width","0.5"),w(o,"fill","none"),w(e,"id","fpm-room-pattern-0"),w(e,"x","0"),w(e,"y","0"),w(e,"width",i[1]),w(e,"height",i[1]),w(e,"patternUnits","userSpaceOnUse"),w(e,"patternTransform","scale(50 50)"),w(r,"d",i[0]),w(r,"fill","url(#fpm-room-pattern-0)")},m(a,l){j(a,t,l),O(t,e),O(e,n),O(e,o),j(a,s,l),j(a,r,l)},p(a,[l]){l&1&&w(r,"d",a[0])},i:K,o:K,d(a){a&&V(t),a&&V(s),a&&V(r)}}}const fr=6;function vp(i,t,e){let n,{path:o}=t;const s=fr*2,r=`M0 ${fr} h ${s} M${fr} 0 v ${s}`;return i.$$set=a=>{"path"in a&&e(3,o=a.path)},i.$$.update=()=>{i.$$.dirty&8&&e(0,n=us(o,{needZ:!0}))},[n,s,r,o]}class Ap extends ce{constructor(t){super(),le(this,t,vp,gp,ae,{path:3})}}function bp(i){let t,e,n,o,s,r,a,l,c,d,h;return{c(){t=Te("defs"),e=Te("pattern"),n=Te("rect"),o=Te("pattern"),s=Te("rect"),r=ne(),a=Te("path"),l=ne(),c=Te("path"),d=ne(),h=Te("path"),w(n,"x","0"),w(n,"y","0"),w(n,"width","6"),w(n,"height","50"),w(n,"fill","none"),w(n,"stroke","#4B4B57"),w(n,"stroke-width","0.5"),w(e,"id","room-material-pattern-1"),w(e,"x","0"),w(e,"y","0"),w(e,"width","12"),w(e,"height","50"),w(e,"patternUnits","userSpaceOnUse"),w(e,"patternTransform","scale(50 50)"),w(s,"x","0"),w(s,"y","0"),w(s,"width","6"),w(s,"height","50"),w(s,"fill","none"),w(s,"stroke","#4B4B57"),w(s,"stroke-width","0.5"),w(o,"id","room-material-pattern-2"),w(o,"x","6"),w(o,"y","25"),w(o,"width","12"),w(o,"height","50"),w(o,"patternUnits","userSpaceOnUse"),w(o,"patternTransform","scale(50 50)"),w(a,"d",i[0]),w(a,"fill","#43434D"),w(c,"d",i[0]),w(c,"fill","url(#room-material-pattern-1)"),w(h,"d",i[0]),w(h,"fill","url(#room-material-pattern-2)")},m(u,m){j(u,t,m),O(t,e),O(e,n),O(t,o),O(o,s),j(u,r,m),j(u,a,m),j(u,l,m),j(u,c,m),j(u,d,m),j(u,h,m)},p(u,[m]){m&1&&w(a,"d",u[0]),m&1&&w(c,"d",u[0]),m&1&&w(h,"d",u[0])},i:K,o:K,d(u){u&&V(t),u&&V(r),u&&V(a),u&&V(l),u&&V(c),u&&V(d),u&&V(h)}}}function yp(i,t,e){let n,{path:o}=t;return i.$$set=s=>{"path"in s&&e(1,o=s.path)},i.$$.update=()=>{i.$$.dirty&2&&e(0,n=us(o,{needZ:!0}))},[n,o]}class wp extends ce{constructor(t){super(),le(this,t,yp,bp,ae,{path:1})}}function Pp(i){fe(i,"svelte-1dykexu",".floorplan-plugin__room-material.svelte-1dykexu{position:absolute;left:0;top:0;width:100%;height:100%}svg.svelte-1dykexu{position:absolute;left:0;top:0;width:100%;height:100%;overflow:visible}")}function nl(i,t,e){const n=i.slice();return n[5]=t[e],n}function Cp(i){let t,e;return t=new Ap({props:{path:i[5].path}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.path=n[5].path),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Ep(i){let t,e;return t=new wp({props:{path:i[5].path}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.path=n[5].path),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Ip(i){let t,e;return t=new pp({props:{path:i[5].path}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.path=n[5].path),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function il(i){let t,e,n,o;const s=[Ip,Ep,Cp],r=[];function a(l,c){return l[5].floorType===1?0:l[5].floorType===0?1:2}return e=a(i),n=r[e]=s[e](i),{c(){t=Te("svg"),n.c(),w(t,"width","100%"),w(t,"height","100%"),w(t,"viewBox",`0 0 ${i[1]} ${i[2]}`),w(t,"class","svelte-1dykexu")},m(l,c){j(l,t,c),r[e].m(t,null),o=!0},p(l,c){let d=e;e=a(l),e===d?r[e].p(l,c):(de(),L(r[d],1,1,()=>{r[d]=null}),he(),n=r[e],n?n.p(l,c):(n=r[e]=s[e](l),n.c()),x(n,1),n.m(t,null))},i(l){o||(x(n),o=!0)},o(l){L(n),o=!1},d(l){l&&V(t),r[e].d()}}}function kp(i){let t,e,n=i[0],o=[];for(let r=0;r<n.length;r+=1)o[r]=il(nl(i,n,r));const s=r=>L(o[r],1,1,()=>{o[r]=null});return{c(){t=z("div");for(let r=0;r<o.length;r+=1)o[r].c();w(t,"class","floorplan-plugin__room-material svelte-1dykexu")},m(r,a){j(r,t,a);for(let l=0;l<o.length;l+=1)o[l]&&o[l].m(t,null);e=!0},p(r,[a]){if(a&7){n=r[0];let l;for(l=0;l<n.length;l+=1){const c=nl(r,n,l);o[l]?(o[l].p(c,a),x(o[l],1)):(o[l]=il(c),o[l].c(),x(o[l],1),o[l].m(t,null))}for(de(),l=n.length;l<o.length;l+=1)s(l);he()}},i(r){if(!e){for(let a=0;a<n.length;a+=1)x(o[a]);e=!0}},o(r){o=o.filter(Boolean);for(let a=0;a<o.length;a+=1)L(o[a]);e=!1},d(r){r&&V(t),qt(o,r)}}}function xp(i,t,e){let n,{floorIndex:o}=t,{floorplanData:s}=t;const r=s.bounding.max.x-s.bounding.min.x,a=s.bounding.max.y-s.bounding.min.y;return i.$$set=l=>{"floorIndex"in l&&e(3,o=l.floorIndex),"floorplanData"in l&&e(4,s=l.floorplanData)},i.$$.update=()=>{i.$$.dirty&24&&e(0,n=s.floorDatas[o].rooms.map(l=>ye(F({},l),{path:l.path.map(c=>dh(c,s.bounding))})))},[n,r,a,o,s]}class Dp extends ce{constructor(t){super(),le(this,t,xp,kp,ae,{floorIndex:3,floorplanData:4},Pp)}}function Mp(i){fe(i,"svelte-qq2273","path.svelte-qq2273{--opacity:0;opacity:var(--opacity)}path.svelte-qq2273:hover{opacity:calc(var(--opacity) + 0.1)}")}function Sp(i){let t,e,n,o;return{c(){t=Te("path"),w(t,"d",i[5]),w(t,"fill","#fff"),w(t,"style",i[2]),w(t,"id",e=`${i[1]}_${i[0].id}`),w(t,"class","svelte-qq2273")},m(s,r){j(s,t,r),n||(o=[Ce(t,"mouseenter",i[3]),Ce(t,"mouseleave",i[4])],n=!0)},p(s,[r]){r&4&&w(t,"style",s[2]),r&3&&e!==(e=`${s[1]}_${s[0].id}`)&&w(t,"id",e)},i:K,o:K,d(s){s&&V(t),n=!1,rt(o)}}}function Lp(i,t,e){let n,o,{room:s}=t,{floorIndex:r}=t,{floorplanData:a}=t,{highlightData:l}=t,{hoveredRoom:c}=t;function d(){c==null||c.set(s)}function h(){c==null||c.set(void 0)}const{bounding:u}=a,m=us(s.path,{needZ:!0,format:v=>dh(v,u)});return i.$$set=v=>{"room"in v&&e(0,s=v.room),"floorIndex"in v&&e(1,r=v.floorIndex),"floorplanData"in v&&e(6,a=v.floorplanData),"highlightData"in v&&e(7,l=v.highlightData),"hoveredRoom"in v&&e(8,c=v.hoveredRoom)},i.$$.update=()=>{i.$$.dirty&131&&e(9,n=l[`${r}_${s.id}`]),i.$$.dirty&512&&e(2,o=n?`fill: ${n.color}; --opacity: ${n.opacity}; pointer-events: ${n.disabled?"none":"auto"}`:null)},[s,r,o,d,h,m,a,l,c,n]}class Tp extends ce{constructor(t){super(),le(this,t,Lp,Sp,ae,{room:0,floorIndex:1,floorplanData:6,highlightData:7,hoveredRoom:8},Mp)}}function zp(i){fe(i,"svelte-1kqo6e4",".floorplan-plugin__room-highlight.svelte-1kqo6e4{position:absolute;width:100%;height:100%}svg.svelte-1kqo6e4{width:100%;height:100%;overflow:visible}")}function ol(i,t,e){const n=i.slice();return n[6]=t[e],n}function sl(i,t){let e,n,o;const s=[{room:t[6],floorplanData:t[1],hoveredRoom:t[3],floorIndex:t[0],highlightData:t[2]}];let r={};for(let a=0;a<s.length;a+=1)r=Ze(r,s[a]);return n=new Tp({props:r}),{key:i,first:null,c(){e=Ee(),ie(n.$$.fragment),this.first=e},m(a,l){j(a,e,l),ee(n,a,l),o=!0},p(a,l){t=a;const c=l&15?st(s,[{room:t[6],floorplanData:t[1],hoveredRoom:t[3],floorIndex:t[0],highlightData:t[2]}]):{};n.$set(c)},i(a){o||(x(n.$$.fragment,a),o=!0)},o(a){L(n.$$.fragment,a),o=!1},d(a){a&&V(e),te(n,a)}}}function _p(i){let t,e,n=[],o=new Map,s,r=i[1].floorDatas[i[0]].rooms;const a=l=>l[6].id;for(let l=0;l<r.length;l+=1){let c=ol(i,r,l),d=a(c);o.set(d,n[l]=sl(d,c))}return{c(){t=z("div"),e=Te("svg");for(let l=0;l<n.length;l+=1)n[l].c();w(e,"width","100%"),w(e,"height","100%"),w(e,"viewBox",`0 0 ${i[4]} ${i[5]}`),w(e,"class","svelte-1kqo6e4"),w(t,"class","floorplan-plugin__room-highlight svelte-1kqo6e4")},m(l,c){j(l,t,c),O(t,e);for(let d=0;d<n.length;d+=1)n[d]&&n[d].m(e,null);s=!0},p(l,[c]){c&15&&(r=l[1].floorDatas[l[0]].rooms,de(),n=St(n,c,a,1,l,r,o,e,un,sl,null,ol),he())},i(l){if(!s){for(let c=0;c<r.length;c+=1)x(n[c]);s=!0}},o(l){for(let c=0;c<n.length;c+=1)L(n[c]);s=!1},d(l){l&&V(t);for(let c=0;c<n.length;c+=1)n[c].d()}}}function Vp(i,t,e){let{floorIndex:n}=t,{floorplanData:o}=t,{highlightData:s}=t,{hoveredRoom:r}=t;const a=o.bounding.max.x-o.bounding.min.x,l=o.bounding.max.y-o.bounding.min.y;return i.$$set=c=>{"floorIndex"in c&&e(0,n=c.floorIndex),"floorplanData"in c&&e(1,o=c.floorplanData),"highlightData"in c&&e(2,s=c.highlightData),"hoveredRoom"in c&&e(3,r=c.hoveredRoom)},[n,o,s,r,a,l]}class hh extends ce{constructor(t){super(),le(this,t,Vp,_p,ae,{floorIndex:0,floorplanData:1,highlightData:2,hoveredRoom:3},zp)}}function jp(i){fe(i,"svelte-bl8zrz",".floorplan-plugin__floor.svelte-bl8zrz{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;pointer-events:none}.floorplan-plugin__floor--is-current.svelte-bl8zrz{opacity:1;pointer-events:auto}")}function rl(i){let t,e;const n=[{floorIndex:i[1],floorplanData:i[8],hoveredRoom:i[14],highlightData:i[13]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new hh({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&24834?st(n,[{floorIndex:s[1],floorplanData:s[8],hoveredRoom:s[14],highlightData:s[13]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function al(i){let t,e;const n=[{floorplanData:i[8],roomAreaEnable:i[5],roomNameEnable:i[6],floorIndex:i[1],getRoomAreaText:i[9],getLabelElement:i[10],hoveredRoom:i[14],adaptiveRoomLabelVisibleEnable:i[12]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new tp({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&22370?st(n,[{floorplanData:s[8],roomAreaEnable:s[5],roomNameEnable:s[6],floorIndex:s[1],getRoomAreaText:s[9],getLabelElement:s[10],hoveredRoom:s[14],adaptiveRoomLabelVisibleEnable:s[12]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function ll(i){let t,e;const n=[{floorplanData:i[8],floorIndex:i[1],getRuleDistanceText:i[11]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new cp({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&2306?st(n,[{floorplanData:s[8],floorIndex:s[1],getRuleDistanceText:s[11]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function Op(i){let t,e,n,o,s,r,a,l,c;const d=[{floorIndex:i[1],floorplanData:i[8]}];let h={};for(let b=0;b<d.length;b+=1)h=Ze(h,d[b]);e=new Dp({props:h});let u=(i[2]||i[3])&&rl(i);const m=[{floorplanData:i[8],floorIndex:i[1]}];let v={};for(let b=0;b<m.length;b+=1)v=Ze(v,m[b]);s=new ch({props:v});let g=i[4]&&al(i),A=i[7]&&ll(i);return{c(){t=z("div"),ie(e.$$.fragment),n=ne(),u&&u.c(),o=ne(),ie(s.$$.fragment),r=ne(),g&&g.c(),a=ne(),A&&A.c(),w(t,"class",l=Be(`floorplan-plugin__floor${i[0]?" floorplan-plugin__floor--is-current":""}`)+" svelte-bl8zrz")},m(b,y){j(b,t,y),ee(e,t,null),O(t,n),u&&u.m(t,null),O(t,o),ee(s,t,null),O(t,r),g&&g.m(t,null),O(t,a),A&&A.m(t,null),c=!0},p(b,[y]){const E=y&258?st(d,[{floorIndex:b[1],floorplanData:b[8]}]):{};e.$set(E),b[2]||b[3]?u?(u.p(b,y),y&12&&x(u,1)):(u=rl(b),u.c(),x(u,1),u.m(t,o)):u&&(de(),L(u,1,1,()=>{u=null}),he());const k=y&258?st(m,[{floorplanData:b[8],floorIndex:b[1]}]):{};s.$set(k),b[4]?g?(g.p(b,y),y&16&&x(g,1)):(g=al(b),g.c(),x(g,1),g.m(t,a)):g&&(de(),L(g,1,1,()=>{g=null}),he()),b[7]?A?(A.p(b,y),y&128&&x(A,1)):(A=ll(b),A.c(),x(A,1),A.m(t,null)):A&&(de(),L(A,1,1,()=>{A=null}),he()),(!c||y&1&&l!==(l=Be(`floorplan-plugin__floor${b[0]?" floorplan-plugin__floor--is-current":""}`)+" svelte-bl8zrz"))&&w(t,"class",l)},i(b){c||(x(e.$$.fragment,b),x(u),x(s.$$.fragment,b),x(g),x(A),c=!0)},o(b){L(e.$$.fragment,b),L(u),L(s.$$.fragment,b),L(g),L(A),c=!1},d(b){b&&V(t),te(e),u&&u.d(),te(s),g&&g.d(),A&&A.d()}}}function Bp(i,t,e){let{isCurrent:n}=t,{floorIndex:o}=t,{highlightEnable:s}=t,{hoverEnable:r}=t,{roomLabelsEnable:a}=t,{roomAreaEnable:l}=t,{roomNameEnable:c}=t,{ruleLabelsEnable:d}=t,{floorplanData:h}=t,{getRoomAreaText:u}=t,{getLabelElement:m}=t,{getRuleDistanceText:v}=t,{adaptiveRoomLabelVisibleEnable:g}=t,{highlightData:A}=t;const b=ca(void 0);return i.$$set=y=>{"isCurrent"in y&&e(0,n=y.isCurrent),"floorIndex"in y&&e(1,o=y.floorIndex),"highlightEnable"in y&&e(2,s=y.highlightEnable),"hoverEnable"in y&&e(3,r=y.hoverEnable),"roomLabelsEnable"in y&&e(4,a=y.roomLabelsEnable),"roomAreaEnable"in y&&e(5,l=y.roomAreaEnable),"roomNameEnable"in y&&e(6,c=y.roomNameEnable),"ruleLabelsEnable"in y&&e(7,d=y.ruleLabelsEnable),"floorplanData"in y&&e(8,h=y.floorplanData),"getRoomAreaText"in y&&e(9,u=y.getRoomAreaText),"getLabelElement"in y&&e(10,m=y.getLabelElement),"getRuleDistanceText"in y&&e(11,v=y.getRuleDistanceText),"adaptiveRoomLabelVisibleEnable"in y&&e(12,g=y.adaptiveRoomLabelVisibleEnable),"highlightData"in y&&e(13,A=y.highlightData)},[n,o,s,r,a,l,c,d,h,u,m,v,g,A,b]}let Rp=class extends ce{constructor(t){super(),le(this,t,Bp,Op,ae,{isCurrent:0,floorIndex:1,highlightEnable:2,hoverEnable:3,roomLabelsEnable:4,roomAreaEnable:5,roomNameEnable:6,ruleLabelsEnable:7,floorplanData:8,getRoomAreaText:9,getLabelElement:10,getRuleDistanceText:11,adaptiveRoomLabelVisibleEnable:12,highlightData:13},jp)}};function Qp(i){fe(i,"svelte-86bqav",".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}")}function cl(i,t,e){const n=i.slice();return n[21]=t[e],n}function dl(i){let t,e,n,o,s,r=i[13].floorDatas,a=[];for(let h=0;h<r.length;h+=1)a[h]=hl(cl(i,r,h));const l=h=>L(a[h],1,1,()=>{a[h]=null});let c=i[5]&&ul(i),d=i[8]&&fl(i);return{c(){t=z("div");for(let h=0;h<a.length;h+=1)a[h].c();e=ne(),c&&c.c(),n=ne(),d&&d.c(),w(t,"class","floorplan-main svelte-86bqav")},m(h,u){j(h,t,u);for(let m=0;m<a.length;m+=1)a[m]&&a[m].m(t,null);O(t,e),c&&c.m(t,null),O(t,n),d&&d.m(t,null),s=!0},p(h,u){if(i=h,u&2047696){r=i[13].floorDatas;let m;for(m=0;m<r.length;m+=1){const v=cl(i,r,m);a[m]?(a[m].p(v,u),x(a[m],1)):(a[m]=hl(v),a[m].c(),x(a[m],1),a[m].m(t,e))}for(de(),m=r.length;m<a.length;m+=1)l(m);he()}i[5]?c?(c.p(i,u),u&32&&x(c,1)):(c=ul(i),c.c(),x(c,1),c.m(t,n)):c&&(de(),L(c,1,1,()=>{c=null}),he()),i[8]?d?(d.p(i,u),u&256&&x(d,1)):(d=fl(i),d.c(),x(d,1),d.m(t,null)):d&&(de(),L(d,1,1,()=>{d=null}),he())},i(h){if(!s){for(let u=0;u<r.length;u+=1)x(a[u]);x(c),x(d),o||ot(()=>{o=Dn(t,In,{duration:i[0],easing:sn}),o.start()}),s=!0}},o(h){a=a.filter(Boolean);for(let u=0;u<a.length;u+=1)L(a[u]);L(c),L(d),s=!1},d(h){h&&V(t),qt(a,h),c&&c.d(),d&&d.d()}}}function hl(i){let t,e;const n=[{hoverEnable:i[6],highlightEnable:i[7],floorplanData:i[13],getRoomAreaText:i[16],getLabelElement:i[17],getRuleDistanceText:i[18],roomLabelsEnable:i[9],roomAreaEnable:i[10],roomNameEnable:i[11],ruleLabelsEnable:i[12],adaptiveRoomLabelVisibleEnable:i[19],highlightData:i[20]},{floorIndex:i[21].floorIndex},{isCurrent:i[21].floorIndex===i[4]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new Rp({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&2047696?st(n,[r&2047680&&{hoverEnable:s[6],highlightEnable:s[7],floorplanData:s[13],getRoomAreaText:s[16],getLabelElement:s[17],getRuleDistanceText:s[18],roomLabelsEnable:s[9],roomAreaEnable:s[10],roomNameEnable:s[11],ruleLabelsEnable:s[12],adaptiveRoomLabelVisibleEnable:s[19],highlightData:s[20]},r&8192&&{floorIndex:s[21].floorIndex},r&8208&&{isCurrent:s[21].floorIndex===s[4]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function ul(i){let t,e;const n=[{panoIndex:i[3],floorplanData:i[13],lastPanoramaLongitude:i[14],cameraImageUrl:i[15]}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new Em({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&57352?st(n,[{panoIndex:s[3],floorplanData:s[13],lastPanoramaLongitude:s[14],cameraImageUrl:s[15]}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function fl(i){let t,e;return t=new Lm({props:{floorplanData:i[13],northDesc:i[2]}}),{c(){ie(t.$$.fragment)},m(n,o){ee(t,n,o),e=!0},p(n,o){const s={};o&8192&&(s.floorplanData=n[13]),o&4&&(s.northDesc=n[2]),t.$set(s)},i(n){e||(x(t.$$.fragment,n),e=!0)},o(n){L(t.$$.fragment,n),e=!1},d(n){te(t,n)}}}function Hp(i){let t,e,n=i[1]&&dl(i);return{c(){n&&n.c(),t=Ee()},m(o,s){n&&n.m(o,s),j(o,t,s),e=!0},p(o,[s]){o[1]?n?(n.p(o,s),s&2&&x(n,1)):(n=dl(o),n.c(),x(n,1),n.m(t.parentNode,t)):n&&(de(),L(n,1,1,()=>{n=null}),he())},i(o){e||(x(n),e=!0)},o(o){L(n),e=!1},d(o){n&&n.d(o),o&&V(t)}}}function Gp(i,t,e){let{duration:n=0}=t,{visible:o}=t,{northDesc:s}=t,{panoIndex:r}=t,{floorIndex:a}=t,{cameraEnable:l}=t,{hoverEnable:c}=t,{highlightEnable:d}=t,{compassEnable:h}=t,{roomLabelsEnable:u}=t,{roomAreaEnable:m}=t,{roomNameEnable:v}=t,{ruleLabelsEnable:g}=t,{floorplanData:A}=t,{lastPanoramaLongitude:b}=t,{cameraImageUrl:y}=t,{getRoomAreaText:E}=t,{getLabelElement:k}=t,{getRuleDistanceText:S}=t,{adaptiveRoomLabelVisibleEnable:C}=t,{highlightData:_}=t;return i.$$set=M=>{"duration"in M&&e(0,n=M.duration),"visible"in M&&e(1,o=M.visible),"northDesc"in M&&e(2,s=M.northDesc),"panoIndex"in M&&e(3,r=M.panoIndex),"floorIndex"in M&&e(4,a=M.floorIndex),"cameraEnable"in M&&e(5,l=M.cameraEnable),"hoverEnable"in M&&e(6,c=M.hoverEnable),"highlightEnable"in M&&e(7,d=M.highlightEnable),"compassEnable"in M&&e(8,h=M.compassEnable),"roomLabelsEnable"in M&&e(9,u=M.roomLabelsEnable),"roomAreaEnable"in M&&e(10,m=M.roomAreaEnable),"roomNameEnable"in M&&e(11,v=M.roomNameEnable),"ruleLabelsEnable"in M&&e(12,g=M.ruleLabelsEnable),"floorplanData"in M&&e(13,A=M.floorplanData),"lastPanoramaLongitude"in M&&e(14,b=M.lastPanoramaLongitude),"cameraImageUrl"in M&&e(15,y=M.cameraImageUrl),"getRoomAreaText"in M&&e(16,E=M.getRoomAreaText),"getLabelElement"in M&&e(17,k=M.getLabelElement),"getRuleDistanceText"in M&&e(18,S=M.getRuleDistanceText),"adaptiveRoomLabelVisibleEnable"in M&&e(19,C=M.adaptiveRoomLabelVisibleEnable),"highlightData"in M&&e(20,_=M.highlightData)},[n,o,s,r,a,l,c,d,h,u,m,v,g,A,b,y,E,k,S,C,_]}let da=class extends ce{constructor(t){super(),le(this,t,Gp,Hp,ae,{duration:0,visible:1,northDesc:2,panoIndex:3,floorIndex:4,cameraEnable:5,hoverEnable:6,highlightEnable:7,compassEnable:8,roomLabelsEnable:9,roomAreaEnable:10,roomNameEnable:11,ruleLabelsEnable:12,floorplanData:13,lastPanoramaLongitude:14,cameraImageUrl:15,getRoomAreaText:16,getLabelElement:17,getRuleDistanceText:18,adaptiveRoomLabelVisibleEnable:19,highlightData:20},Qp)}};const Fp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC";function Wp(i){return Y(this,null,function*(){const t=new Headers({"Content-Type":"text/plain"}),e=function(o){return Y(this,null,function*(){const s={index:o.index,url:o.url,svgUrl:o.svg_url};if(o.svg_url){const r=yield fetch(o.svg_url,{headers:t}).then(a=>a.text());s.svgContent=r}return s})};return yield Promise.all(i.map(e))})}function Np(i){return{id:i.id,size:i.size,name:i.name,path:i.path,roomType:i.room_type,floorType:i.floor_type,roomLabel:{position:i.room_label.position,positionInImage:i.room_label.position_in_image},observerIndexs:i.observer_indexs}}function Xp(i){return{floorName:i.floor_name,floorIndex:i.floor_index,rooms:i.rooms.map(Np),rules:i.rules}}function Yp(i){return{index:i.index,floorIndex:i.floor_index,position:i.position,positionInImage:i.position_in_image}}function Up(i){return{rad:i.rad,position:i.position,positionInImage:i.position_in_image,northRad:i.north_rad,roomId:i.room_id,floorIndex:i.floor_index}}function ln(i){return Y(this,null,function*(){const t=yield Wp(i.outlines),e=i.computed_data.bounding,n=i.computed_data.floor_datas.map(Xp),o=i.computed_data.entrance?Up(i.computed_data.entrance):null;return{outlines:t,entrance:o,bounding:e,floorDatas:n,observers:i.computed_data.observers.map(Yp)}})}function qp(i,t,e){return i.map(o=>{const s=o.position,r=o.icon?o.icon:{url:Fp,width:45,height:48},a=up(s,t),l=dp(s,e),c=hp(l,e);return{floorIndex:a,icon:r,id:o.id,position:l,positionInImage:c}})}function Jp(i,t){return t(i),i}function fs(i,t){return Jp({},e=>{for(const n in i)t.indexOf(n)===-1&&(e[n]=i[n])})}function ml(i,t){const e=Math.max(...i.work.observers.map(n=>n.floorIndex));return t>e?i.model.bounding.max.y:Math.max(...i.work.observers.filter(n=>n.floorIndex===t).map(n=>n.standingPosition.y))}function ha(i,t,e=nn.BOUNDING_CENTER){const n=ml(i,t),o=ml(i,t+1);return e===nn.BOUNDING_CENTER?(i.model.bounding.max.y+i.model.bounding.min.y)/2:e===nn.CEILING?o:n}function ua(i,t,e,n){const o=ha(i,e,n==null?void 0:n.attachedTo),s=new I.Vector3(0,o,0),r=new I.Vector3(1,o,0),a=s.clone().project(i.camera),l=r.clone().project(i.camera);return Math.abs((l.x-a.x)/1e3)*(t.getBoundingClientRect().width/2)}let eo=class{constructor(t,e){f(this,"VERSION","2.20.8");f(this,"five");f(this,"hooks",new li);f(this,"staticPrefix","//vrlab-static.ljcdn.com");this.five=t,e!=null&&e.staticPrefix&&(this.staticPrefix=e.staticPrefix)}getCurrentState(){return this.state}isAbsoluteURL(t){return na(t)?t:`${this.staticPrefix}${t}`}},Mn=class extends eo{};var At=(i=>(i.UnknownError="UnknownError",i.DataNotLoaded="DataNotLoaded",i.BreakOffByHide="BreakOffByHide",i.BreakOffByDisable="BreakOffByDisable",i.ModelNotLoaded="ModelNotLoaded",i.ChangeModeError="ChangeModeError",i.UpdateCameraError="UpdateCameraError",i))(At||{});const uh=500,Zp=80;function Qr(i,t,e=4){return Math.floor(i*Math.pow(10,e))===Math.floor(t*Math.pow(10,e))}function fa(i,t){return Y(this,null,function*(){const[e]=yield ii(i.changeMode(...t));if(e)throw new Error("change mode canceled");yield new Promise(r=>{i.once("initAnimationWillStart",()=>{i.once("initAnimationEnded",()=>r())})});const n=t[1];if(!n)return!0;const o=i.getCurrentState();if(!Kp(n,o))throw new Error("pose 与预期不符")})}function Kp(i,t){return Object.keys(i).every(e=>{const n=t[e];if(n===void 0)return!0;const o=i[e];return typeof n=="number"&&typeof o=="number"?Qr(n,o,2):n===o})}function ma(i,t){if(i.currentMode!==t.mode)return!1;const{latitude:e,longitude:n,fov:o}=t,{latitude:s,longitude:r}=i.getCurrentState(),a=i.camera.fov;return!(!Qr(e,s,2)||!Qr(n,r,2)||o!==a)}function fh(i,t,e=!0){return Y(this,null,function*(){if(ma(i,t)===!0)return;const o=i.getCurrentState();if(o.mode!==t.mode){const[d]=yield ii(fa(i,[t.mode,t,void 0,e]));if(d)throw new Error(At.ChangeModeError);return}const{latitude:s,longitude:r,fov:a}=o,l=Math.min(1e3,Math.max(200,Math.abs(s-Math.PI/2)*1e3,(r>Math.PI?2*Math.PI-r:r)*500,Math.abs(a-t.fov)*10)),[c]=yield ii(i.updateCamera(t,l,e));if(c)throw new Error(At.UpdateCameraError)})}function si(i,t,e=300){const n=i.getElement();n&&(n.style.opacity=t+"",n.style.transition=e===0?"none":`opacity ${e}ms linear`,e!==0&&Promise.race([new Promise(o=>n.addEventListener("transitionend",o,{once:!0})),new Promise(o=>setTimeout(o,e))]).then(()=>{n.style.transition="none"}))}function $p(i){const{latitude:t,longitude:e}=i,n=Math.abs(t-Math.PI/2)>5*Math.PI/180,o=e>5*(Math.PI/180)&&e<355*(Math.PI/180);return n||o}function eg(i){const{latitude:t,longitude:e}=i,n=Math.abs(t-Math.PI/2)<10*Math.PI/180,o=e<30*(Math.PI/180)||e>330*(Math.PI/180);return n&&o}let tg=class extends Mn{constructor(e,n){var a;super(e);f(this,"name","modelFloorplanPlugin");f(this,"state");f(this,"data");f(this,"showState");f(this,"showPromise");f(this,"app");f(this,"panoIndex",0);f(this,"floorIndex",0);f(this,"selector");f(this,"showRejection");f(this,"wrapper");f(this,"container",document.createElement("div"));f(this,"lastPanoramaLongitude",0);f(this,"size",{width:0,height:0});f(this,"hasAddedEventListener",!1);f(this,"isHiddenByHideFunc",!1);f(this,"highlightData",{});f(this,"dispose",()=>{var e,n;this.removeEventListener(),(e=this.app)==null||e.$destroy(),this.app=void 0,(n=this.container)==null||n.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});f(this,"show",(...n)=>Y(this,[...n],function*(e={}){if(!this.state.enabled||!this.showPromise&&this.state.visible)return;const o=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!0},o),this._show(e)}));f(this,"hide",(...n)=>Y(this,[...n],function*(e={}){this.state.enabled&&(this.isHiddenByHideFunc=!0,this.state.visible!==!1&&(this.updateState({visible:!1},e.userAction||!0),this._hide(e)))}));f(this,"updateSize",()=>{if(!this.data||!ma(this.five,this.showState)||!this.container||!this.wrapper)return;const{min:e,max:n}=this.data.bounding,o=n.x-e.x,s=n.y-e.y,r=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=ua(this.five,this.wrapper,this.floorIndex,r),l=Math.ceil(o*a),c=Math.ceil(s*a);this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c})});f(this,"highlight",e=>{this.state.config.highlightEnable&&(this.highlightData=e,this.render())});f(this,"unhighlight",()=>{this.highlightData={},this.render()});f(this,"_disable",e=>{var o,s,r;const{userAction:n}=e;this.hooks.emit("disable",{userAction:n}),(o=this.showRejection)==null||o.call(this,At.BreakOffByDisable),this.showPromise=void 0,(s=this.app)==null||s.$destroy(),this.app=void 0,(r=this.container)==null||r.remove(),this.removeEventListener()});f(this,"_enable",e=>{const{userAction:n}=e;this.addEventListener(),this.wrapper&&(this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:n}),this.state.visible&&this._show({userAction:n}))});f(this,"_show",e=>Y(this,null,function*(){var r;if(!this.state.enabled)return;if(!((r=this.five.model)!=null&&r.loaded))throw new Error(At.ModelNotLoaded);if(!this.data)throw new Error(At.DataNotLoaded);this.isHiddenByHideFunc=!1;const n={floorIndex:this.floorIndex,modelOpacity:this.state.config.modelOpacity,immediately:!1,isAutoShow:!1,userAction:!0},o=F(F({},n),e),s=()=>Y(this,null,function*(){this.hooks.emit("show",{userAction:o.userAction,auto:o.isAutoShow});let a=!1,l;this.showRejection=u=>{a=!0,l=u};const[c]=yield ii(fh(this.five,this.showState,o.userAction));if(c)throw c;if(a)throw l?new Error(l):new Error(At.UnknownError);this.updateSize(),this.floorIndex=o.floorIndex,this.five.model.show(this.floorIndex);const d=o.modelOpacity,h=o.immediately?0:uh;si(this.five,d,h),this.render(h)});return this.showPromise=s().then(()=>{this.hooks.emit("showAnimationEnded",{auto:o.isAutoShow,userAction:o.userAction})}).catch(a=>{if(this.updateState({visible:!1},o.userAction),!o.isAutoShow&&a instanceof Error)throw a}).finally(()=>{this.showPromise=void 0,this.showRejection=void 0}),this.showPromise}));f(this,"_hide",e=>{var s;(s=this.showRejection)==null||s.call(this,At.BreakOffByHide),this.showPromise=void 0;const o=F(F({},{userAction:!0,isAutoHide:!1}),e);si(this.five,1,0),this.hooks.emit("hide",{auto:o.isAutoHide,userAction:o.userAction}),this.render()});f(this,"handleClick",()=>{if(!this.state.visible)return;if(this.hooks.emit("click"))return!1});f(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)});f(this,"onFiveModeChange",e=>{e!==this.showState.mode&&(this.updateState({visible:!1},!1),this._hide({userAction:!1}))});f(this,"onFiveInteriaPan",(e,n)=>{if(!n||this.state.config.autoShowEnable===!1||this.isHiddenByHideFunc)return;const o=this.five.getCurrentState();o.mode==="Floorplan"&&(this.state.visible||eg(o)&&(this.updateState({visible:!0},!0),this._show({isAutoShow:!0})))});f(this,"onFivePanoArrived",e=>{var n;(n=this.five)!=null&&n.work&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)});f(this,"onFiveCameraUpdate",(e,n)=>{if(!this.state.visible||this.showPromise)return;const o=this.five.getCurrentState();$p(o)&&(this.updateState({visible:!1},n),this._hide({userAction:n,isAutoHide:!0}))});f(this,"onFiveWantsGesture",(e,n)=>{if(this.state.visible&&(n.length>1||e==="mouseWheel"))return!1});f(this,"onFiveWantsPanGesture",(e,n)=>{if(this.five.getCurrentState().mode==="Floorplan"&&this.state.config.autoShowEnable!==!1&&n&&this.state.visible)return this.five.updateCamera(this.showState,0),!1});f(this,"onFiveWantsTapGesture",()=>this.handleClick());f(this,"onFiveWantsChangeMode",(e,n)=>{n==="Panorama"&&e==="Floorplan"&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude)});f(this,"onModelShownFloorChange",e=>{if(this.floorIndex!==e){if(e===null){const n=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[n].floorIndex;return}this.floorIndex=e,this.updateSize(),this.render()}});n!=null&&n.selector&&(this.selector=n.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.showState={mode:"Floorplan",longitude:0,latitude:Math.PI/2,fov:Zp/((a=n==null?void 0:n.scale)!=null?a:1)};const o={northDesc:"北",modelOpacity:1,cameraEnable:!0,highlightEnable:!1,hoverEnable:!0,compassEnable:!0,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,adaptiveRoomLabelVisibleEnable:!0,cameraImageUrl:an,attachedTo:nn.BOUNDING_CENTER,getLabelElement:void 0,getRoomAreaText:l=>(l/1e6).toFixed(1)+"㎡",getRuleDistanceText:l=>l.toString()},s=n?fs(n,["selector","scale"]):{},r=F(F({},o),s);this.state={enabled:!0,visible:!1,config:r},this.initContainer(),e.model.loaded?this.onFiveModelLoaded():e.once("modelLoaded",this.onFiveModelLoaded),e.once("dispose",this.dispose),this.addEventListener()}load(e,n,o=!0){return Y(this,null,function*(){function s(d){return Object.prototype.hasOwnProperty.apply(d,["version"])}const r=e;r&&!r.version&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(e)),l=s(a)?a.data:a,c=this.data;this.data=yield ln(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),n&&this.updateState(n,o),this.render()})}appendTo(e){if(this.wrapper=e,!!this.state.enabled)return e.appendChild(this.container),this.render(),this}enable(e={}){if(this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!0},e.userAction||n),this._enable({userAction:n})}disable(e={}){if(!this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!1},e.userAction||n),this._disable({userAction:n})}setState(e,n={}){const o=this.state,s=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,s),e.enabled!==void 0&&o.enabled!==e.enabled&&(e.enabled?this._enable({userAction:s}):this._disable({userAction:s})),e.visible!==void 0&&o.visible!==e.visible){const r={userAction:s};e.visible?this._show(r):this._hide(r)}this.render()}changeConfigs(e,n=!0){this.updateState({config:e},n),this.render()}formatData(e){return Y(this,null,function*(){return yield ln(e.data)})}updateState(e,n){const o=this.state,s=e.config?F(F({},o.config),e.config):o.config;this.state=ye(F(F({},this.state),e),{config:s}),!jt(this.state,o,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n})}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:10,pointerEvents:"none"}),this.five.addExtraElement(this.container)}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const e=this.five;e.on("modeChange",this.onFiveModeChange),e.on("interiaPan",this.onFiveInteriaPan),e.on("panoArrived",this.onFivePanoArrived),e.on("cameraUpdate",this.onFiveCameraUpdate),e.on("wantsGesture",this.onFiveWantsGesture),e.on("wantsPanGesture",this.onFiveWantsPanGesture),e.on("wantsTapGesture",this.onFiveWantsTapGesture),e.on("wantsChangeMode",this.onFiveWantsChangeMode),e.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const e=this.five;this.hasAddedEventListener=!1,e.off("modelLoaded",this.onFiveModelLoaded),e.off("modeChange",this.onFiveModeChange),e.off("interiaPan",this.onFiveInteriaPan),e.off("panoArrived",this.onFivePanoArrived),e.off("cameraUpdate",this.onFiveCameraUpdate),e.off("wantsGesture",this.onFiveWantsGesture),e.off("wantsPanGesture",this.onFiveWantsPanGesture),e.off("wantsTapGesture",this.onFiveWantsTapGesture),e.off("wantsChangeMode",this.onFiveWantsChangeMode),e.off("modelShownFloorChange",this.onModelShownFloorChange)}render(e){if(!this.state.enabled||!this.container||!this.data||this.size.width===0)return;const n=ye(F({},this.state.config),{visible:this.state.visible,duration:e!=null?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(n);this.app=new da({target:this.container,intro:!0,props:n})}};const ng=(i,t)=>new tg(i,t);function ig(i){const{latitude:t,longitude:e}=i,n=Math.abs(t-Math.PI/2)>5*Math.PI/180,o=e>5*(Math.PI/180)&&e<355*(Math.PI/180);return n||o}function og(i){const{latitude:t,longitude:e}=i,n=Math.abs(t-Math.PI/2)<10*Math.PI/180,o=e<30*(Math.PI/180)||e>330*(Math.PI/180);return n&&o}let sg=class extends Mn{constructor(e,n){super(e);f(this,"name","modelFloorplanPlugin");f(this,"state");f(this,"data");f(this,"showState");f(this,"showPromise");f(this,"app");f(this,"panoIndex",0);f(this,"floorIndex",0);f(this,"selector");f(this,"showRejection");f(this,"wrapper");f(this,"container",document.createElement("div"));f(this,"lastPanoramaLongitude",0);f(this,"size",{width:0,height:0});f(this,"hasAddedEventListener",!1);f(this,"isHiddenByHideFunc",!1);f(this,"highlightData",{});f(this,"dispose",()=>{var e,n;this.removeEventListener(),(e=this.app)==null||e.$destroy(),this.app=void 0,(n=this.container)==null||n.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});f(this,"show",(...n)=>Y(this,[...n],function*(e={}){if(!this.state.enabled||!this.showPromise&&this.state.visible)return;const o=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!0},o),this._show(e)}));f(this,"hide",(...n)=>Y(this,[...n],function*(e={}){this.state.enabled&&(this.isHiddenByHideFunc=!0,this.state.visible!==!1&&(this.updateState({visible:!1},e.userAction||!0),this._hide(e)))}));f(this,"updateSize",()=>{if(!this.data||!ma(this.five,this.showState)||!this.container||!this.wrapper)return;const{min:e,max:n}=this.data.bounding,o=n.x-e.x,s=n.y-e.y,r=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=ua(this.five,this.wrapper,this.floorIndex,r),l=Math.ceil(o*a),c=Math.ceil(s*a);this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c})});f(this,"highlight",e=>{this.state.config.highlightEnable&&(this.highlightData=e,this.render())});f(this,"unhighlight",()=>{this.highlightData={},this.render()});f(this,"_disable",e=>{var o,s,r;const{userAction:n}=e;this.hooks.emit("disable",{userAction:n}),(o=this.showRejection)==null||o.call(this,At.BreakOffByDisable),this.showPromise=void 0,(s=this.app)==null||s.$destroy(),this.app=void 0,(r=this.container)==null||r.remove(),this.removeEventListener()});f(this,"_enable",e=>{const{userAction:n}=e;this.addEventListener(),this.wrapper&&(this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:n}),this.state.visible&&this._show({userAction:n}))});f(this,"_show",e=>Y(this,null,function*(){var r;if(!this.state.enabled)return;if(!((r=this.five.model)!=null&&r.loaded))throw new Error(At.ModelNotLoaded);if(!this.data)throw new Error(At.DataNotLoaded);this.isHiddenByHideFunc=!1;const n={floorIndex:this.floorIndex,modelOpacity:this.state.config.modelOpacity,immediately:!1,isAutoShow:!1,userAction:!0},o=F(F({},n),e),s=()=>Y(this,null,function*(){this.hooks.emit("show",{userAction:o.userAction,auto:o.isAutoShow});let a=!1,l;this.showRejection=u=>{a=!0,l=u};const[c]=yield ii(fh(this.five,this.showState,o.userAction));if(c)throw c;if(a)throw l?new Error(l):new Error(At.UnknownError);this.updateSize(),this.updatePosition(),this.floorIndex=o.floorIndex,this.five.model.show(this.floorIndex);const d=o.modelOpacity,h=o.immediately?0:uh;si(this.five,d,h),this.render(h)});return this.showPromise=s().then(()=>{this.hooks.emit("showAnimationEnded",{auto:o.isAutoShow,userAction:o.userAction})}).catch(a=>{if(this.updateState({visible:!1},o.userAction),!o.isAutoShow&&a instanceof Error)throw a}).finally(()=>{this.showPromise=void 0,this.showRejection=void 0}),this.showPromise}));f(this,"_hide",e=>{var s;(s=this.showRejection)==null||s.call(this,At.BreakOffByHide),this.showPromise=void 0;const o=F(F({},{userAction:!0,isAutoHide:!1}),e);si(this.five,1,0),this.hooks.emit("hide",{auto:o.isAutoHide,userAction:o.userAction}),this.render()});f(this,"handleClick",()=>{if(!this.state.visible)return;if(this.hooks.emit("click"))return!1});f(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)});f(this,"onFiveModeChange",e=>{e!==this.showState.mode&&(this.updateState({visible:!1},!1),this._hide({userAction:!1}))});f(this,"onFivePanoArrived",e=>{var n;(n=this.five)!=null&&n.work&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)});f(this,"onFiveCameraUpdate",(e,n)=>{if(!this.state.visible||this.showPromise)return;const o=this.five.getCurrentState();this.updatePosition(),this.updateSize(),ig(o)&&(this.updateState({visible:!1},n),this._hide({userAction:n}))});f(this,"onFiveWantsPanGesture",(e,n)=>{if(this.five.getCurrentState().mode===this.showState.mode&&this.state.config.autoShowEnable!==!1){if(n&&this.state.visible)return this.five.updateCamera(this.showState,0),!1;if(n&&!this.state.visible){if(this.isHiddenByHideFunc)return;const o=this.five.getCurrentState();return o.mode!==this.showState.mode||this.state.visible?void 0:(og(o)&&(this.updateState({visible:!0},!0),this._show({isAutoShow:!0})),!1)}}});f(this,"onFiveWantsTapGesture",()=>this.handleClick());f(this,"onFiveWantsChangeMode",(e,n)=>{n==="Panorama"&&e===this.showState.mode&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude)});f(this,"onModelShownFloorChange",e=>{if(this.floorIndex!==e){if(e===null){const n=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[n].floorIndex;return}this.floorIndex=e,this.updateSize(),this.render()}});n!=null&&n.selector&&(this.selector=n.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.showState={mode:"Mapview",longitude:0,latitude:Math.PI/2,fov:90};const o={northDesc:"北",modelOpacity:1,cameraEnable:!0,highlightEnable:!1,hoverEnable:!0,compassEnable:!0,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,cameraImageUrl:an,attachedTo:nn.BOUNDING_CENTER,getLabelElement:void 0,adaptiveRoomLabelVisibleEnable:!0,getRoomAreaText:a=>(a/1e6).toFixed(1)+"㎡",getRuleDistanceText:a=>a.toString()},s=n?fs(n,["selector","scale"]):{},r=F(F({},o),s);this.state={enabled:!0,visible:!1,config:r},this.initContainer(),e.model.loaded?this.onFiveModelLoaded():e.once("modelLoaded",this.onFiveModelLoaded),e.once("dispose",this.dispose),this.addEventListener()}load(e,n,o=!0){return Y(this,null,function*(){function s(d){return Object.prototype.hasOwnProperty.apply(d,["version"])}const r=e;r&&!r.version&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(e)),l=s(a)?a.data:a,c=this.data;this.data=yield ln(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),n&&this.updateState(n,o),this.render()})}appendTo(e){if(this.wrapper=e,!!this.state.enabled)return e.appendChild(this.container),this.render(),this}enable(e={}){if(this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!0},e.userAction||n),this._enable({userAction:n})}disable(e={}){if(!this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!1},e.userAction||n),this._disable({userAction:n})}setState(e,n={}){const o=this.state,s=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,s),e.enabled!==void 0&&o.enabled!==e.enabled&&(e.enabled?this._enable({userAction:s}):this._disable({userAction:s})),e.visible!==void 0&&o.visible!==e.visible){const r={userAction:s};e.visible?this._show(r):this._hide(r)}}changeConfigs(e,n=!0){this.updateState({config:e},n),this.render()}updatePosition(){var a;const e=ha(this.five,this.floorIndex,this.state.config.attachedTo),n=(a=this.five.model)==null?void 0:a.bounding.getCenter(new I.Vector3).setY(e);if(!n)return;const o=n.clone().project(this.five.camera),s=(o.x+1)/2,r=-(o.y-1)/2;this.container.style.left=s*100+"%",this.container.style.top=r*100+"%"}formatData(e){return Y(this,null,function*(){return yield ln(e.data)})}updateState(e,n){const o=this.state,s=e.config?F(F({},o.config),e.config):o.config;this.state=ye(F(F({},this.state),e),{config:s}),!jt(this.state,o,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n})}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:10,pointerEvents:"none"}),this.five.addExtraElement(this.container)}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const e=this.five;e.on("modeChange",this.onFiveModeChange),e.on("panoArrived",this.onFivePanoArrived),e.on("cameraUpdate",this.onFiveCameraUpdate),e.on("wantsPanGesture",this.onFiveWantsPanGesture),e.on("wantsTapGesture",this.onFiveWantsTapGesture),e.on("wantsChangeMode",this.onFiveWantsChangeMode),e.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const e=this.five;this.hasAddedEventListener=!1,e.off("modelLoaded",this.onFiveModelLoaded),e.off("modeChange",this.onFiveModeChange),e.off("panoArrived",this.onFivePanoArrived),e.off("cameraUpdate",this.onFiveCameraUpdate),e.off("wantsPanGesture",this.onFiveWantsPanGesture),e.off("wantsTapGesture",this.onFiveWantsTapGesture),e.off("wantsChangeMode",this.onFiveWantsChangeMode),e.off("modelShownFloorChange",this.onModelShownFloorChange)}render(e){if(!this.state.enabled||!this.container||!this.data||this.size.width===0)return;const n=ye(F({},this.state.config),{visible:this.state.visible,duration:e!=null?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(n);this.app=new da({target:this.container,intro:!0,props:n})}};const rg=(i,t)=>new sg(i,t);let ag=class extends Mn{constructor(e,n){super(e);f(this,"name","topviewFloorplanPlugin");f(this,"state");f(this,"data");f(this,"app");f(this,"selector");f(this,"panoIndex",0);f(this,"floorIndex",0);f(this,"wrapper");f(this,"container",document.createElement("div"));f(this,"lastPanoramaLongitude",0);f(this,"size",{width:0,height:0});f(this,"hasAddedEventListener",!1);f(this,"isHiddenByHideFunc",!1);f(this,"highlightData",{});f(this,"updateSize",()=>{if(!this.data||!this.container||!this.wrapper||this.five.getCurrentState().mode!=="Topview")return;const{min:e,max:n}=this.data.bounding,o=n.x-e.x,s=n.y-e.y,r=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=ua(this.five,this.wrapper,this.floorIndex,r),l=Math.ceil(o*a),c=Math.ceil(s*a);this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c})});f(this,"dispose",()=>{var e,n;this.removeEventListener(),(e=this.app)==null||e.$destroy(),this.app=void 0,(n=this.container)==null||n.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});f(this,"highlight",e=>{this.state.config.highlightEnable&&(this.highlightData=e,this.render())});f(this,"unhighlight",()=>{this.highlightData={},this.render()});f(this,"_disable",e=>{var o,s;const{userAction:n}=e;(o=this.app)==null||o.$destroy(),this.app=void 0,(s=this.container)==null||s.remove(),this.removeEventListener(),this.hooks.emit("disable",{userAction:n})});f(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)});f(this,"onFiveModeChange",(...[e,,,,n])=>{e!=="Topview"&&this.state.visible&&(this.updateState({visible:!1},n),this._hide({userAction:n}))});f(this,"onFivePanoArrived",e=>{var n;(n=this.five)!=null&&n.work&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)});f(this,"onFiveCameraUpdate",(e,n)=>{this.state.visible&&(this.updatePosition(),this.updateSize())});f(this,"onFiveWantsGesture",e=>{if(!(e!=="pan"&&e!=="pinch"&&e!=="mouseWheel")&&this.state.visible&&!this.state.config.gestureEnable)return!1});f(this,"onFiveWantsMoveToPano",()=>{if(this.state.visible&&this.state.config.preventRoomClick)return!1});f(this,"onFiveInitAnimationEnded",(...[,,e])=>{const{mode:n}=this.five.getCurrentState();n==="Topview"&&!this.isHiddenByHideFunc&&!this.state.visible&&this.state.config.autoShowEnable&&(this.updateState({visible:!0},e),this._show({userAction:e}))});f(this,"onModelShownFloorChange",e=>{if(this.floorIndex!==e){if(e===null){const n=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[n].floorIndex;return}this.floorIndex=e,this.updateSize(),this.render()}});n!=null&&n.selector&&(this.selector=n.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法"));const o={northDesc:"北",modelOpacity:1,cameraEnable:!0,hoverEnable:!0,highlightEnable:!1,compassEnable:!0,gestureEnable:!1,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,cameraImageUrl:an,attachedTo:nn.BOUNDING_CENTER,getLabelElement:void 0,adaptiveRoomLabelVisibleEnable:!0,getRoomAreaText:a=>(a/1e6).toFixed(1)+"㎡",getRuleDistanceText:a=>a.toString()},s=n?fs(n,["selector","scale"]):{},r=F(F({},o),s);this.state={enabled:!0,visible:!1,config:r},this.initContainer(),e.model.loaded?this.onFiveModelLoaded():e.once("modelLoaded",this.onFiveModelLoaded),e.once("dispose",this.dispose),this.addEventListener()}load(e,n,o=!0){return Y(this,null,function*(){function s(d){return Object.prototype.hasOwnProperty.apply(d,["version"])}const r=e;r&&!r.version&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(e)),l=s(a)?a.data:a,c=this.data;this.data=yield ln(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),n&&this.updateState(n,o),this.render()})}updatePosition(){var a;const e=ha(this.five,this.floorIndex,this.state.config.attachedTo),n=(a=this.five.model)==null?void 0:a.bounding.getCenter(new I.Vector3).setY(e);if(!n)return;const o=n.clone().project(this.five.camera),s=(o.x+1)/2,r=-(o.y-1)/2;this.container.style.left=s*100+"%",this.container.style.top=r*100+"%"}appendTo(e){if(this.wrapper=e,!!this.state.enabled)return e.appendChild(this.container),this.render(),this}show(){return Y(this,arguments,function*(e={}){if(this.state.visible)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!0},n),this._show({userAction:n})})}hide(){return Y(this,arguments,function*(e={}){if(this.isHiddenByHideFunc=!0,!this.state.visible)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!1},n),this._hide({userAction:n})})}enable(e={}){if(this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!0},e.userAction||n),this._enable({userAction:n})}disable(e={}){if(!this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!1},e.userAction||n),this._disable({userAction:n})}setState(e,n={}){const o=this.state,s=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,s),e.enabled!==void 0&&o.enabled!==e.enabled){const r={userAction:s};e.enabled?this._enable(r):this._disable(r)}if(e.visible!==void 0&&o.visible!==e.visible){const r={userAction:s};e.visible?this._show(r):this._hide(r)}}changeConfigs(e,n=!0){this.updateState({config:e},n),this.render()}formatData(e){return Y(this,null,function*(){return yield ln(e.data)})}_show(e){return Y(this,null,function*(){if(!this.state.enabled)return;this.isHiddenByHideFunc=!1;const{userAction:n}=e;this.hooks.emit("show",{userAction:n,auto:!1}),this.five.getCurrentState().mode!=="Topview"&&(yield fa(this.five,["Topview",void 0,void 0,n])),this.five.model.show(this.floorIndex),this.updatePosition(),this.updateSize();const o=500,s=this.state.config.modelOpacity;si(this.five,s,o),this.hooks.emit("showAnimationEnded",{userAction:n,auto:!1}),this.render()})}_hide(e){return Y(this,null,function*(){if(!this.state.enabled)return;const{userAction:n}=e;this.hooks.emit("hide",{userAction:n,auto:!1});const o=1,s=0;si(this.five,o,s),this.render()})}_enable(e){const{userAction:n}=e;this.addEventListener(),this.wrapper&&this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:n}),this.state.visible&&this._show({userAction:n})}updateState(e,n){const o=this.state,s=e.config?F(F({},o.config),e.config):o.config;this.state=ye(F(F({},this.state),e),{config:s}),!jt(this.state,o,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n})}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const e=this.five;e.on("modeChange",this.onFiveModeChange),e.on("panoArrived",this.onFivePanoArrived),e.on("cameraUpdate",this.onFiveCameraUpdate),e.on("wantsGesture",this.onFiveWantsGesture),e.on("wantsMoveToPano",this.onFiveWantsMoveToPano),e.on("initAnimationEnded",this.onFiveInitAnimationEnded),e.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const e=this.five;this.hasAddedEventListener=!1,e.off("modeChange",this.onFiveModeChange),e.off("panoArrived",this.onFivePanoArrived),e.off("cameraUpdate",this.onFiveCameraUpdate),e.off("wantsGesture",this.onFiveWantsGesture),e.off("wantsMoveToPano",this.onFiveWantsMoveToPano),e.off("initAnimationEnded",this.onFiveInitAnimationEnded),e.off("modelShownFloorChange",this.onModelShownFloorChange)}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate3d(-50%, -50%, 10px)",zIndex:10,pointerEvents:"none","will-change":"width, height"}),this.five.addExtraElement(this.container)}render(e){if(!this.state.enabled||!this.container||!this.data||this.size.width===0)return;const n=ye(F({},this.state.config),{visible:this.state.visible,duration:e!=null?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(n);this.app=new da({target:this.container,intro:!0,props:n})}};const lg=(i,t)=>new ag(i,t);function pa(i,t=200){let e;return function(...n){e||(i(...n),e=setTimeout(function(){e=null},t))}}function cg(i){fe(i,"svelte-1nqrlxd",".plugin-radar__camera-wrapper.svelte-1nqrlxd{width:100%;height:100%;position:absolute;pointer-events:none}.plugin-radar__camera-position.svelte-1nqrlxd{position:absolute;left:0;top:0;width:0;height:0;transform:none;pointer-events:none;transition:transform 1s linear}.plugin-radar__camera-rotate.svelte-1nqrlxd{position:absolute;left:-0.9375rem;top:-0.9375rem;width:1.0625rem;height:1.0625rem;transform-origin:0.9375rem 0.9375rem;transform:rotate(45deg);background-repeat:no-repeat;background-size:100%}")}function dg(i){let t,e,n;return{c(){t=z("div"),e=z("div"),n=z("div"),w(n,"class","plugin-radar__camera-rotate svelte-1nqrlxd"),T(n,"background-image","url("+(i[0]||an)+")"),T(n,"transform",i[1]),w(e,"class","plugin-radar__camera-position svelte-1nqrlxd"),T(e,"transform",i[2]),w(t,"class","plugin-radar__camera-wrapper svelte-1nqrlxd")},m(o,s){j(o,t,s),O(t,e),O(e,n)},p(o,[s]){s&1&&T(n,"background-image","url("+(o[0]||an)+")"),(s&1||s&3)&&T(n,"transform",o[1]),s&4&&T(e,"transform",o[2])},i:K,o:K,d(o){o&&V(t)}}}function hg(i){return`rotate(${Math.floor(i/Math.PI*180)*-1+45}deg)`}function ug(i,t,e){let n,o,{five:s}=t,{pxmm:r}=t,{floorplanData:a}=t,{cameraImageUrl:l}=t,c=s.getCurrentState().panoIndex,d=s.getCurrentState().longitude;function h(v,g){const A=v.bounding,b=v.observers[g];if(!b)return"";const y=(A.max.x-A.min.x)*r,E=(A.max.y-A.min.y)*r,k=Math.floor(b.positionInImage.x*y),S=Math.floor(b.positionInImage.y*E);return`translate(${k}px, ${S}px)`}function u(v){e(6,c=v)}const m=pa(v=>{e(7,d=v.longitude)},1e3/60);return Mt(()=>(s.on("panoWillArrive",u),s.on("cameraDirectionUpdate",m),function(){s.off("panoWillArrive",u),s.off("cameraDirectionUpdate",m)})),i.$$set=v=>{"five"in v&&e(3,s=v.five),"pxmm"in v&&e(4,r=v.pxmm),"floorplanData"in v&&e(5,a=v.floorplanData),"cameraImageUrl"in v&&e(0,l=v.cameraImageUrl)},i.$$.update=()=>{i.$$.dirty&96&&e(2,n=h(a,c)),i.$$.dirty&128&&e(1,o=hg(d))},[l,o,n,s,r,a,c,d]}class fg extends ce{constructor(t){super(),le(this,t,ug,dg,ae,{five:3,pxmm:4,floorplanData:5,cameraImageUrl:0},cg)}}function mg(i){fe(i,"svelte-1i87fz7",".plugin-pano-floorplan__extra-objects.svelte-1i87fz7{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.plugin-pano-floorplan__extra-object-item--position.svelte-1i87fz7{position:absolute;width:0;height:0}.plugin-pano-floorplan__extra-object-item.svelte-1i87fz7{transform:translate(-50%, -50%)}")}function pl(i,t,e){const n=i.slice();return n[1]=t[e],n}function gl(i,t){let e,n,o=`${t[1].icon.width/16}rem`,s=`${t[1].icon.height/16}rem`,r,a=`${t[1].positionInImage.y*100}%`,l=`${t[1].positionInImage.x*100}%`;return{key:i,first:null,c(){e=z("div"),n=z("div"),r=ne(),w(n,"class","plugin-pano-floorplan__extra-object-item svelte-1i87fz7"),T(n,"background-image",`url(${t[1].icon.url})`),T(n,"width",o),T(n,"height",s),w(e,"class","plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7"),T(e,"top",a),T(e,"left",l),this.first=e},m(c,d){j(c,e,d),O(e,n),O(e,r)},p(c,d){t=c,d&1&&T(n,"background-image",`url(${t[1].icon.url})`);const h=d&1;h&&T(n,"width",o),h&&T(n,"height",s),d&1&&a!==(a=`${t[1].positionInImage.y*100}%`)&&T(e,"top",a),d&1&&l!==(l=`${t[1].positionInImage.x*100}%`)&&T(e,"left",l)},d(c){c&&V(e)}}}function pg(i){let t,e=[],n=new Map,o=i[0];const s=r=>r[1].id;for(let r=0;r<o.length;r+=1){let a=pl(i,o,r),l=s(a);n.set(l,e[r]=gl(l,a))}return{c(){t=z("div");for(let r=0;r<e.length;r+=1)e[r].c();w(t,"class","plugin-pano-floorplan__extra-objects svelte-1i87fz7")},m(r,a){j(r,t,a);for(let l=0;l<e.length;l+=1)e[l]&&e[l].m(t,null)},p(r,[a]){a&1&&(o=r[0],e=St(e,a,s,1,r,o,n,t,aa,gl,null,pl))},i:K,o:K,d(r){r&&V(t);for(let a=0;a<e.length;a+=1)e[a].d()}}}function gg(i,t,e){let{extraObjects:n=[]}=t;return i.$$set=o=>{"extraObjects"in o&&e(0,n=o.extraObjects)},[n]}class vg extends ce{constructor(t){super(),le(this,t,gg,pg,ae,{extraObjects:0},mg)}}function vl(i){let t,e;const n=[{five:i[0],pxmm:i[1],floorIndex:i[2],floorplanData:i[4],onRoomHeightClick:i[7],highlightData:i[5],hoveredRoom:void 0}];let o={};for(let s=0;s<n.length;s+=1)o=Ze(o,n[s]);return t=new hh({props:o}),{c(){ie(t.$$.fragment)},m(s,r){ee(t,s,r),e=!0},p(s,r){const a=r&183?st(n,[{five:s[0],pxmm:s[1],floorIndex:s[2],floorplanData:s[4],onRoomHeightClick:s[7],highlightData:s[5],hoveredRoom:void 0}]):{};t.$set(a)},i(s){e||(x(t.$$.fragment,s),e=!0)},o(s){L(t.$$.fragment,s),e=!1},d(s){te(t,s)}}}function Ag(i){let t,e,n,o,s,r;const a=[{floorIndex:i[2],floorplanData:i[4]}];let l={};for(let d=0;d<a.length;d+=1)l=Ze(l,a[d]);t=new ch({props:l}),n=new vg({props:{extraObjects:i[6]}});let c=i[3]&&vl(i);return{c(){ie(t.$$.fragment),e=ne(),ie(n.$$.fragment),o=ne(),c&&c.c(),s=Ee()},m(d,h){ee(t,d,h),j(d,e,h),ee(n,d,h),j(d,o,h),c&&c.m(d,h),j(d,s,h),r=!0},p(d,[h]){const u=h&20?st(a,[{floorIndex:d[2],floorplanData:d[4]}]):{};t.$set(u);const m={};h&64&&(m.extraObjects=d[6]),n.$set(m),d[3]?c?(c.p(d,h),h&8&&x(c,1)):(c=vl(d),c.c(),x(c,1),c.m(s.parentNode,s)):c&&(de(),L(c,1,1,()=>{c=null}),he())},i(d){r||(x(t.$$.fragment,d),x(n.$$.fragment,d),x(c),r=!0)},o(d){L(t.$$.fragment,d),L(n.$$.fragment,d),L(c),r=!1},d(d){te(t,d),d&&V(e),te(n,d),d&&V(o),c&&c.d(d),d&&V(s)}}}function bg(i,t,e){let n,{five:o}=t,{pxmm:s}=t,{floorIndex:r}=t,{hoverEnable:a}=t,{floorplanData:l}=t,{extraObjects:c=[]}=t,{highlightData:d}=t;const h=void 0;return i.$$set=u=>{"five"in u&&e(0,o=u.five),"pxmm"in u&&e(1,s=u.pxmm),"floorIndex"in u&&e(2,r=u.floorIndex),"hoverEnable"in u&&e(3,a=u.hoverEnable),"floorplanData"in u&&e(4,l=u.floorplanData),"extraObjects"in u&&e(8,c=u.extraObjects),"highlightData"in u&&e(5,d=u.highlightData)},i.$$.update=()=>{i.$$.dirty&260&&e(6,n=c==null?void 0:c.filter(u=>u.floorIndex===r))},[o,s,r,a,l,d,n,h,c]}class yg extends ce{constructor(t){super(),le(this,t,bg,Ag,ae,{five:0,pxmm:1,floorIndex:2,hoverEnable:3,floorplanData:4,extraObjects:8,highlightData:5})}}function wg(i){fe(i,"svelte-1mvqyqq",".plugin-floorplan-radar.svelte-1mvqyqq{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.plugin-floorplan-radar-container.svelte-1mvqyqq{position:relative}")}function Al(i){let t,e,n,o,s=i[7]!==0&&bl(i);return{c(){t=z("div"),s&&s.c(),w(t,"class","plugin-floorplan-radar svelte-1mvqyqq")},m(r,a){j(r,t,a),s&&s.m(t,null),e=!0,n||(o=[Ut(vi.call(null,t)),Ce(t,"clientWidth",i[13]),Ce(t,"clientHeight",i[14])],n=!0)},p(r,a){r[7]!==0?s?(s.p(r,a),a&128&&x(s,1)):(s=bl(r),s.c(),x(s,1),s.m(t,null)):s&&(de(),L(s,1,1,()=>{s=null}),he())},i(r){e||(x(s),e=!0)},o(r){L(s),e=!1},d(r){r&&V(t),s&&s.d(),n=!1,rt(o)}}}function bl(i){let t,e,n,o,s=`${i[9]}px`,r=`${i[12]}px`,a;const l=[{five:i[0],pxmm:i[10],floorIndex:i[11],floorplanData:i[3],hoverEnable:i[2],extraObjects:i[5],highlightData:i[6]}];let c={};for(let u=0;u<l.length;u+=1)c=Ze(c,l[u]);e=new yg({props:c});const d=[{pxmm:i[10],five:i[0],floorplanData:i[3],cameraImageUrl:i[4]}];let h={};for(let u=0;u<d.length;u+=1)h=Ze(h,d[u]);return o=new fg({props:h}),{c(){t=z("div"),ie(e.$$.fragment),n=ne(),ie(o.$$.fragment),w(t,"class","plugin-floorplan-radar-container svelte-1mvqyqq"),T(t,"width",s),T(t,"height",r)},m(u,m){j(u,t,m),ee(e,t,null),O(t,n),ee(o,t,null),a=!0},p(u,m){const v=m&3181?st(l,[{five:u[0],pxmm:u[10],floorIndex:u[11],floorplanData:u[3],hoverEnable:u[2],extraObjects:u[5],highlightData:u[6]}]):{};e.$set(v);const g=m&1049?st(d,[{pxmm:u[10],five:u[0],floorplanData:u[3],cameraImageUrl:u[4]}]):{};o.$set(g),m&512&&s!==(s=`${u[9]}px`)&&T(t,"width",s),m&4096&&r!==(r=`${u[12]}px`)&&T(t,"height",r)},i(u){a||(x(e.$$.fragment,u),x(o.$$.fragment,u),a=!0)},o(u){L(e.$$.fragment,u),L(o.$$.fragment,u),a=!1},d(u){u&&V(t),te(e),te(o)}}}function Pg(i){let t,e,n=i[1]&&Al(i);return{c(){n&&n.c(),t=Ee()},m(o,s){n&&n.m(o,s),j(o,t,s),e=!0},p(o,[s]){o[1]?n?(n.p(o,s),s&2&&x(n,1)):(n=Al(o),n.c(),x(n,1),n.m(t.parentNode,t)):n&&(de(),L(n,1,1,()=>{n=null}),he())},i(o){e||(x(n),e=!0)},o(o){L(n),e=!1},d(o){n&&n.d(o),o&&V(t)}}}function Cg(i,t,e){var E,k;let{five:n}=t,{visible:o}=t,{hoverEnable:s}=t,{floorplanData:r}=t,{cameraImageUrl:a}=t,{extraObjects:l=[]}=t,{highlightData:c}=t,d=0,h=(k=(E=n.work.observers[n.getCurrentState().panoIndex])==null?void 0:E.floorIndex)!=null?k:0,u=0,m=0,v=0,g=0;function A(S){e(11,h=n.work.observers[S].floorIndex)}Mt(()=>(n.on("panoArrived",A),()=>{n.off("panoArrived",A)}));const b=S=>{e(7,u=S.detail)},y=S=>{e(8,m=S.detail)};return i.$$set=S=>{"five"in S&&e(0,n=S.five),"visible"in S&&e(1,o=S.visible),"hoverEnable"in S&&e(2,s=S.hoverEnable),"floorplanData"in S&&e(3,r=S.floorplanData),"cameraImageUrl"in S&&e(4,a=S.cameraImageUrl),"extraObjects"in S&&e(5,l=S.extraObjects),"highlightData"in S&&e(6,c=S.highlightData)},i.$$.update=()=>{if(i.$$.dirty&904){const S=Math.min(u,m),{max:C,min:_}=r.bounding,M=C.x-_.x,X=C.y-_.y,J=function(){return M>X?[S,S/M*X]:[S/X*M,S]}();e(9,v=J[0]),e(12,g=J[1]),e(10,d=v/M)}},[n,o,s,r,a,l,c,u,m,v,d,h,g,b,y]}class Eg extends ce{constructor(t){super(),le(this,t,Cg,Pg,ae,{five:0,visible:1,hoverEnable:2,floorplanData:3,cameraImageUrl:4,extraObjects:5,highlightData:6},wg)}}let Ig=class extends Mn{constructor(e,n){super(e);f(this,"name","panoFloorplanRadarPlugin");f(this,"state");f(this,"data");f(this,"app");f(this,"wrapperSelector","");f(this,"wrapper",null);f(this,"disposed",!1);f(this,"extraObjects",[]);f(this,"highlightData",{});f(this,"dispose",()=>{var e;this.disposed=!0,(e=this.app)==null||e.$destroy(),this.wrapper=null,this.wrapperSelector="",this.hooks.emit("dispose")});f(this,"highlight",e=>{this.state.config.highlightEnable&&(this.highlightData=e,this.render())});f(this,"unhighlight",()=>{this.highlightData={},this.render()});f(this,"_disable",e=>{var o;const{userAction:n}=e;(o=this.app)==null||o.$destroy(),this.app=void 0,this.hooks.emit("disable",{userAction:n})});this.five=e;const o={hoverEnable:!0,highlightEnable:!0,cameraImageUrl:an},s=n!=null&&n.configs?n.configs:{},r=F(F({},o),s);this.state={enabled:!0,visible:!0,config:r},n!=null&&n.wrapper&&console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法"),typeof(n==null?void 0:n.wrapper)=="string"?this.wrapperSelector=n.wrapper:(n==null?void 0:n.wrapper)instanceof Element&&(this.wrapper=n.wrapper),e.once("dispose",this.dispose)}load(e,n,o=!0){return Y(this,null,function*(){function s(c){return Object.prototype.hasOwnProperty.apply(c,["version"])}const r=JSON.parse(JSON.stringify(e)),a=s(r)?r.data:r,l=this.data;this.data=yield ln(a),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,l),n&&this.updateState(n,o),this.render()})}show(){return Y(this,arguments,function*(e={}){if(this.state.visible)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!0},n),this._show({userAction:n})})}hide(){return Y(this,arguments,function*(e={}){if(!this.state.visible)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({visible:!1},n),this._hide({userAction:n})})}enable(e={}){if(this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!0},e.userAction||n),this._enable({userAction:n})}disable(e={}){if(!this.state.enabled)return;const n=e.userAction!==void 0?e.userAction:!0;this.updateState({enabled:!1},e.userAction||n),this._disable({userAction:n})}setState(e,n={}){const o=this.state,s=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,s),e.enabled!==void 0&&o.enabled!==e.enabled){const r={userAction:s};e.enabled?this._enable(r):this._disable(r)}if(e.visible!==void 0&&o.visible!==e.visible){const r={userAction:s};e.visible?this._show(r):this._hide(r)}}appendTo(e){this.wrapper=e,this.render()}changeConfigs(e,n=!0){this.setState({config:e},{userAction:n}),this.render()}setExtraObjectsWith3DPositions(e){this.data&&(this.extraObjects=qp(e,this.five,this.data),this.render())}formatData(e){return Y(this,null,function*(){return yield ln(e.data)})}_enable(e){const{userAction:n}=e;this.hooks.emit("enable",{userAction:n}),this.state.visible&&this._show({userAction:n})}_show(e){if(this.disposed||!this.state.enabled)return;const{userAction:n}=e;this.hooks.emit("show",{userAction:n}),this.render()}_hide(e){if(this.disposed||!this.state.enabled)return;const{userAction:n}=e;this.hooks.emit("hide",{userAction:n}),this.render()}updateState(e,n){const o=this.state;this.state=F(F({},this.state),e),!jt(this.state,o,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n})}render(){if(this.disposed||!this.state.enabled)return;if(!this.wrapper&&this.wrapperSelector){const n=document.querySelector(this.wrapperSelector);this.wrapper=n}if(!this.data||!this.wrapper)return;const e=ye(F({},this.state.config),{five:this.five,floorplanData:this.data,visible:this.state.visible,extraObjects:this.extraObjects,highlightData:this.highlightData});this.app?this.app.$set(e):this.app=new Eg({target:this.wrapper,props:e})}};const kg=(i,t)=>new Ig(i,t),xg=[{type:0,floorType:1,roomType:"100900000012",name:"其他"},{type:1,floorType:1,roomType:"100900000002",name:"客厅"},{type:2,floorType:1,roomType:"100900000002",name:"餐厅"},{type:3,floorType:0,roomType:"100900000001",name:"卧室"},{type:4,floorType:0,roomType:"100900000001",name:"书房"},{type:5,floorType:3,roomType:"100900000004",name:"卫生间"},{type:6,floorType:3,roomType:"100900000004",name:"淋浴间"},{type:7,floorType:3,roomType:"100900000004",name:"洗手间"},{type:8,floorType:3,roomType:"100900000003",name:"厨房"},{type:9,floorType:1,roomType:"100900000003",name:"开放厨房",onlySubArea:!0},{type:10,floorType:0,roomType:"100900000001",name:"多功能间"},{type:11,floorType:0,roomType:"100900000009",name:"保姆间"},{type:12,floorType:4,roomType:"100900000005",name:"阳台"},{type:13,floorType:4,roomType:"100900000006",name:"露台"},{type:14,floorType:0,roomType:"100900000008",name:"储物间"},{type:15,floorType:0,roomType:"100900000013",name:"衣帽间"},{type:16,floorType:0,roomType:"100900000011",name:"阁楼"},{type:17,floorType:2,roomType:"100900000007",name:"花园"},{type:18,floorType:5,roomType:"100900000010",name:"车库"},{type:19,floorType:1,roomType:"100900000012",name:"电梯"},{type:20,floorType:1,roomType:"100900000012",name:"地下室"},{type:21,floorType:1,roomType:"100900000012",name:"天井"},{type:22,floorType:1,roomType:"100900000012",name:"阳光房"},{type:23,floorType:1,roomType:"100900000012",name:"过道"},{type:24,floorType:1,roomType:"100900000012",name:"楼梯间"},{type:25,floorType:1,roomType:"100900000012",name:"门厅"},{type:26,floorType:2,roomType:"100900000012",name:"入户花园"},{type:27,floorType:1,roomType:"100900000012",name:"玄关"},{type:28,floorType:1,roomType:"100900000012",name:"挑空"},{type:29,floorType:4,roomType:"100900000012",name:"晾晒区"},{type:30,floorType:4,roomType:"100900000012",name:"洗衣房"},{type:31,floorType:0,roomType:"100900000012",name:"娱乐区"},{type:32,floorType:0,roomType:"100900000012",name:"健身区"},{type:33,floorType:0,roomType:"100900000012",name:"接待区"},{type:34,floorType:0,roomType:"100900000012",name:"影音区"},{type:35,floorType:1,roomType:"100900000012",name:"餐饮区"},{type:36,floorType:1,roomType:"100900000012",name:"其他",onlySubArea:!0},{type:37,floorType:1,roomType:"100900000002",name:"起居室"},{type:38,floorType:0,roomType:"100900000001",name:"主卧"},{type:39,floorType:0,roomType:"100900000001",name:"次卧"},{type:40,floorType:0,roomType:"100900000001",name:"优化间"},{type:41,floorType:0,roomType:"100900000001",name:"办公室"},{type:42,floorType:0,roomType:"100900000001",name:"会议室"},{type:43,floorType:0,roomType:"100900000001",name:"洽谈间"},{type:44,floorType:1,roomType:"100900000002",name:"共享大厅"},{type:45,floorType:1,roomType:"100900000012",name:"水吧"},{type:46,floorType:0,roomType:"100900000015",name:"出入口"},{type:47,floorType:0,roomType:"100900000015",name:"大厅"},{type:48,floorType:0,roomType:"100900000015",name:"包厢"},{type:49,floorType:0,roomType:"100900000015",name:"其他"},{type:50,floorType:0,roomType:"100900000016",name:"出入口"},{type:51,floorType:0,roomType:"100900000016",name:"办公区"},{type:52,floorType:0,roomType:"100900000016",name:"老板间"},{type:53,floorType:0,roomType:"100900000016",name:"会议室"},{type:54,floorType:0,roomType:"100900000016",name:"休息区/水吧"},{type:55,floorType:0,roomType:"100900000016",name:"其他"},{type:56,floorType:2,roomType:"100900000012",name:"空中花园"},{type:57,floorType:0,roomType:"100900000001",name:"洋室"},{type:58,floorType:0,roomType:"100900000001",name:"和室"}],Dg=[{type:0,description:"木质地板"},{type:1,description:"瓷砖地面"},{type:2,description:"户外地面"},{type:3,description:"卫生间地面"},{type:4,description:"阳台地面"},{type:5,description:"车库地面"}],Mg=[{roomType:"100900000001",description:"室"},{roomType:"100900000002",description:"厅"},{roomType:"100900000003",description:"厨"},{roomType:"100900000004",description:"卫"},{roomType:"100900000005",description:"阳台"},{roomType:"100900000006",description:"露台"},{roomType:"100900000007",description:"花园"},{roomType:"100900000008",description:"储"},{roomType:"100900000009",description:"保姆间"},{roomType:"100900000010",description:"车库"},{roomType:"100900000011",description:"阁楼"},{roomType:"100900000012",description:"其他"},{roomType:"100900000013",description:"衣"},{roomType:"100900000015",description:"商铺"},{roomType:"100900000016",description:"写字楼"}],mr=(i,t,e)=>{const n=new I.Matrix4,o=new I.Euler(i,t,e,"YXZ");return n.makeRotationFromEuler(o),n},Sg=(i,{scale:t,rotation:e,position:n})=>{if(t&&i.scale.set(t,t,t),e){const[o,s,r]=e;o&&i.applyMatrix4(mr(o,0,0)),s&&i.applyMatrix4(mr(0,s,0)),r&&i.applyMatrix4(mr(0,0,r))}return n&&i.position.set(n.x,n.y,n.z),i};function mh(i,t){i.traverse(e=>{var n;if(e.type==="Mesh"){const o=e,s=F({map:o.material.map||{}},t);o.material=new R.MeshBasicMaterial(s),o.renderOrder=1,((n=e.parent)==null?void 0:n.type)==="Mesh"&&(e.renderOrder=e.parent.renderOrder+1)}})}const Lg=(i,t)=>{var d;const e=t.fbx_url||"//vrlab-image4.ljcdn.com/release/web/dipan2.f38a21cc.FBX",n=(d=t.north_rad)!=null?d:void 0,o={},s=h=>Y(exports,null,function*(){var Q;const u=(h==null?void 0:h.fbx_url)||e,m=(Q=h==null?void 0:h.north_rad)!=null?Q:n;if(typeof m!="number")throw new Error('"northRad"配置参数缺失:未配置指南针指向!');const v=i.model.bounding,g=v.max.x-v.min.x,A=v.max.z-v.min.z,b=Math.max(g,A),E=yield new wd.FBXLoader().loadAsync(u);mh(E,{transparent:!0,side:I.DoubleSide,blending:I.AdditiveBlending});const k=[0,m-Math.PI/2,0],{model:{bounding:{max:{x:S,z:C},min:{x:_,y:M,z:X}}}}=i;o.yBase=M;const J={x:(S+_)/2,y:M-1.6,z:(C+X)/2},H=.0045*b;return Sg(E,{position:J,rotation:k,scale:H}),o.object=E,!0}),r=({latitude:h})=>{if(!o.object)return;const u=a(h);u&&(o.object.position.y=u)},a=h=>{if(o.yBase===void 0)return;const u=.6;if(h>=Math.PI/4)return o.yBase-(u+1.6);const m=h*(4/Math.PI);return o.yBase-(u*m+1.6)};return{load:s,disable:()=>{o.object&&(i.scene.remove(o.object),i.needsRender=!0,i.off("cameraDirectionUpdate",r))},enable:()=>{if(!o.object)return;const h=a(i.getPose().latitude);h&&(o.object.position.y=h),i.scene.add(o.object),i.needsRender=!0,i.on("cameraDirectionUpdate",r)}}};function Tg(i,t){var c,d,h,u,m;const e=(c=t==null?void 0:t.size)!=null?c:512,n=(d=t==null?void 0:t.fontSize)!=null?d:e*(35/256)*1.2,o=(h=t==null?void 0:t.backgroundColor)!=null?h:"rgba(0,0,0,0)",s=(u=t==null?void 0:t.fontColor)!=null?u:"#fff",r=(m=t==null?void 0:t.textAlign)!=null?m:"center",a=document.createElement("canvas");a.setAttribute("width",e+""),a.setAttribute("height",e+"");const l=a.getContext("2d");return l.fillStyle=o,l.fillRect(0,0,e,e),l.font=`${n}px "微软雅黑"`,l.textAlign=r,l.fillStyle=s,l.fillText(i,e/2,e*.7),new R.CanvasTexture(a)}const zg=({x:i,y:t,z:e})=>new R.Vector3(i,t,e),_g=(i,t)=>{var g,A,b;const e={},n=(g=t.animationEnabled)!=null?g:!0,o=(A=t.position)!=null?A:void 0,s=(b=t.rad)!=null?b:void 0,r=t.fbx_url||"//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx",a=[],l=y=>Y(exports,null,function*(){var J,H,Q,G,B,W,q,U;const E=(J=y==null?void 0:y.position)!=null?J:o;if(!E)return Promise.reject(new Error("ModelEntryDoorGuidePlugin.load(): position is undefined"));const k=zg(E),S=(H=y==null?void 0:y.rad)!=null?H:s,C=(Q=y==null?void 0:y.fbx_url)!=null?Q:r;if(e.rad=S,S===void 0)return Promise.reject(new Error(`ModelEntryDoorGuidePlugin.load(): rad is ${S}`));const _=yield new wd.FBXLoader().loadAsync(C);_.position.copy(k),_.rotation.z=S,_.scale.set(.8,.8,.8),mh(_,{transparent:!0,side:I.DoubleSide});const M=(q=(W=(B=(G=_.children)==null?void 0:G[0])==null?void 0:B.children)==null?void 0:W[3])==null?void 0:q.clone();if(!M)return Promise.reject(new Error(`ModelEntryDoorGuidePlugin.load(): textMesh is ${M}`));const X=(U=t.name)!=null?U:"入户门";return M.material=new R.MeshBasicMaterial({transparent:!0,map:Tg(X)}),M.renderOrder=3,_.children[0].add(M),e.object=_,!0}),c=()=>{if(e.animation)return;if(!e.object)return console.error("ModelEntryDoorGuidePlugin.initAnimation(): state.object is ",e.object);const y=1,E=new R.AnimationMixer(e.object);a.push(E);const k=E.clipAction(e.object.animations[0]);k.timeScale=y;let S;const C=()=>{let J=0,H=0;const Q=1e3/30,G=B=>{J=requestAnimationFrame(G);const W=B-H;W<Q||(H=B,a.forEach(q=>q.update(W/1e3)),i.needsRender=!0)};return J=requestAnimationFrame(G),()=>{cancelAnimationFrame(J)}},X={play:()=>{S||(k.play(),S=C(),requestAnimationFrame(()=>{e.object&&e.object.rotation.z!==e.rad&&(e.object.rotation.z=e.rad)}))},stop:()=>{k.stop(),S==null||S(),S=void 0}};e.animation=X},d=y=>{var k;if(!e.object)return console.error("ModelEntryDoorGuidePlugin.enable(): object is ",e.object);((k=y==null?void 0:y.animationEnable)!=null?k:n)&&(e.animation||c(),e.animation.play()),i.scene.add(e.object),i.needsRender=!0},h=()=>{e.object&&(e.animation&&e.animation.stop(),i.scene.remove(e.object),i.needsRender=!0)},u=y=>y==="Floorplan"?d():h();return{load:l,enable:y=>(e.enabled||(e.enabled=!0,u(i.currentMode),i.on("modeChange",u),d(y)),!0),disable:()=>(e.enabled&&(e.enabled=!1,h(),i.off("modeChange",u)),!0)}},Vg=kt;function jg(i,t,e,n=Vg.Linear.None){const o=new is(i).to(t,e).easing(n);rs(()=>o.start(0));const s=$i(a=>{o.update(a)===!1&&s()}),r=[];return o.onDestroy=a=>(r.push(a),o),o.destroy=function(){this.stop(),Object.assign(o,{_onStartCallback:null,_onUpdateCallback:null,_onCompleteCallback:null,_onStopCallbackL:null});let a;for(;a=r.shift();)a();s()},o}function Og(i,t){return jg({progress:0},{progress:1},i,t)}var ph=(i=>(i.Move="Move",i.Rotate="Rotate",i))(ph||{}),Vt=(i=>(i.Clockwise="Clockwise",i.Anticlockwise="Anticlockwise",i.Loop="Loop",i))(Vt||{});const Bo=Math.PI*2;function yl(i){return(i%Bo+Bo)%Bo}function wl(i){return i%Bo}function pr(i,t,e){return i+(t-i)*e}const Hr=(i,t,e)=>{const n=Math.PI,o=n*2;let s=yl(i),r=yl(t);return e===Vt.Anticlockwise&&s<r&&(s+=o),e===Vt.Clockwise&&r<s&&(r+=o),e===Vt.Loop&&r-s>n?Hr(s,r,Vt.Anticlockwise):e===Vt.Loop&&s-r>n?Hr(s,r,Vt.Clockwise):{from:s,to:r}},Bg=i=>{const t={},e=(l,c,...d)=>Y(exports,[l,c,...d],function*(s,r,a={preload:!0}){return t.interruptCallback&&t.interruptCallback(!1),a.asyncStartCallback&&(yield a.asyncStartCallback()),s.mode&&s.mode!==i.currentMode&&(yield i.changeMode(s.mode)),a.preload&&s.panoIndex!==void 0&&s.panoIndex!==i.panoIndex&&(yield i.preloadPano(s.panoIndex)),a.asyncEndCallback&&(yield a.asyncEndCallback()),s.panoIndex===void 0&&s.fov===void 0&&s.latitude===void 0&&s.longitude===void 0?!0:yield new Promise((h,u)=>{const m=s.panoIndex!==void 0?s.panoIndex:i.panoIndex;m!==void 0?i.moveToPano(m,F({duration:r,moveEndCallback:()=>h(!0),moveCancelCallback:()=>u(new Error("move canceled"))},s)):u(new Error("unexpected error"))})}),n=s=>{const r=i.state,a=wl(r.latitude),l=wl(s.latitude),{from:c,to:d}=Hr(r.longitude,s.longitude,s.rotation||Vt.Loop),h=r.fov,u=s.fov;return{from:{latitude:a,longitude:c,fov:h},to:{latitude:l,longitude:d,fov:u}}};return{move:e,rotate:(l,c,...d)=>Y(exports,[l,c,...d],function*(s,r,a={}){t.interruptCallback&&t.interruptCallback(!1),a.asyncStartCallback&&(yield a.asyncStartCallback()),i.currentMode!==ze.Five.Mode.Panorama&&(yield i.changeMode(ze.Five.Mode.Panorama)),s.panoIndex!==void 0&&s.panoIndex!==i.panoIndex&&(a.preload&&(yield i.preloadPano(s.panoIndex)),yield new Promise((m,v)=>{if(!s.panoIndex){m(!0);return}i.moveToPano(s.panoIndex,{moveEndCallback:()=>m(!0),moveCancelCallback:()=>v(new Error("move canceled"))})})),a.asyncEndCallback&&(yield a.asyncEndCallback());const{from:h,to:u}=n(s);return yield new Promise(m=>{const v=({progress:E})=>{const k={};k.longitude=pr(h.longitude,u.longitude,E),k.latitude=pr(h.latitude,u.latitude,E),k.fov=pr(h.fov,u.fov,E),i.setState(k,!0)},g=()=>{m(!0)},A=()=>{m(!1)},b=s.rotateSpeed?Math.ceil(Math.abs(u.longitude-h.longitude)/s.rotateSpeed*1e3):r,y=Og(b,kt.Linear.None).onUpdate(v).onComplete(g).onDestroy(A);s.rotation===Vt.Loop&&y.repeat(1/0).yoyo(!0),t.interruptCallback=(E=!0)=>{y.destroy(),t.interruptCallback=void 0,t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0),m(E)},t.timeoutId=setTimeout(()=>{t.interruptCallback&&t.interruptCallback(!0)},r)})})}};function Pl(i,t){return i.x===t.x&&i.y===t.y}function gh(i,t){return Math.abs(i)===1/0&&Math.abs(t)===1/0?!0:Math.abs(i-t)<.001}function Zo(i,t){return(t.y-i.y)/(t.x-i.x)}function vh(i,t,e){const n=Zo(i[1],i[0]),o=Zo(t[1],t[0]);if(isNaN(n)||isNaN(o)||gh(n,o))return!1;if(Io(i[0],t))return i[0];if(Io(i[1],t))return i[1];if(Io(t[0],i))return t[0];if(Io(t[1],i))return t[1];if(e&&!Rg(i,t))return!1;const s=i[0],r=t[0];if(Math.abs(n)===1/0)return{x:s.x,y:t[1].y-(t[1].x-s.x)*o};if(Math.abs(o)===1/0)return{x:r.x,y:i[1].y-(i[1].x-r.x)*n};const a=(r.y-s.y+n*s.x-o*r.x)/(n-o),l=n*a-n*s.x+s.y;return{x:a,y:l}}function Io(i,t){return Pl(i,t[0])||Pl(i,t[1])?!0:(t[0].x-i.x)*(i.x-t[1].x)>=0&&(t[0].y-i.y)*(i.y-t[1].y)>=0&&gh(Zo(t[0],i),Zo(i,t[1]))}function ko(i,t,e){return(i.x-e.x)*(t.y-e.y)-(t.x-e.x)*(i.y-e.y)}function Rg(i,t){return Math.max(i[0].x,i[1].x)>=Math.min(t[0].x,t[1].x)&&Math.max(t[0].x,t[1].x)>=Math.min(i[0].x,i[1].x)&&Math.max(i[0].y,i[1].y)>=Math.min(t[0].y,t[1].y)&&ko(t[0],i[1],i[0])*ko(i[1],t[1],i[0])>0&&ko(i[0],t[1],t[0])*ko(t[1],i[1],t[0])>0?1:0}function Ah(i,t=0){t<=0?requestAnimationFrame(i):requestAnimationFrame(()=>Ah(i,t-1))}const Qg=`<style type="text/css">
195
195
  .PanoRulerPlugin-rule-line {
196
196
  position: absolute;
197
197
  transform-origin: left center;
@@ -665,7 +665,7 @@ void main() {
665
665
  gl_FragColor.a = gl_FragColor.a * linearGradientOpacity();
666
666
  gl_FragColor.a = gl_FragColor.a * flicker;
667
667
  }
668
- `;class Zr{constructor(t,e){f(this,"name","");f(this,"startTagContainer");f(this,"endTagContainer");f(this,"mesh");f(this,"five");f(this,"mode");f(this,"path",[]);f(this,"_curvePath",null);f(this,"_curvePoints",null);f(this,"_panoGroup",[]);f(this,"skippedPositions",null);f(this,"textureUrl","");f(this,"scale",1);f(this,"width",.5);f(this,"unitLength",.5);f(this,"_visibleFloorIndexes",null);f(this,"visible",null);f(this,"modeVisible",!1);f(this,"floorVisible",!0);f(this,"defaultVisible",!1);f(this,"inWalkAnimation",!1);f(this,"customVisible",null);f(this,"parent");f(this,"plugin");f(this,"textureHasLoaded",!1);f(this,"disposed",!1);f(this,"flowAnime",new os({progress:0}).to({progress:1}).duration(1500).repeat(1/0));f(this,"flickerAnime",ss(300).yoyo(!0).repeat(5));f(this,"cacheLengths",[]);f(this,"dispose",()=>{var t,e;this.disposed||(this.disposed=!0,this.parent.hooks.off("show",this.updateVisible),this.parent.hooks.off("hide",this.updateVisible),this.plugin.hooks.off("show",this.updateVisible),this.plugin.hooks.off("hide",this.updateVisible),this.plugin.hooks.off("enable",this.updateVisible),this.plugin.hooks.off("disable",this.updateVisible),this.five.off("modeChange",this.onFiveModeChange),this.five.off("modelShownFloorChange",this.onFiveModelShownFloorChange),this.doHide(),(t=this.startTagContainer)==null||t.plugin.dispose(),(e=this.endTagContainer)==null||e.plugin.dispose())});f(this,"onWalkAnimationStart",()=>{this.inWalkAnimation=!0,this.updateVisible()});f(this,"onWalkAnimationEnd",()=>{this.inWalkAnimation=!1,this.updateVisible()});f(this,"onFiveModeChange",t=>{this.modeVisible=this.mode==="panorama"?ta(t):Md(t),this.updateVisible()});f(this,"onFiveModelShownFloorChange",t=>{this.floorVisible=t===null||this.visibleFloorIndexes===null||this.visibleFloorIndexes.includes(t),this.updateVisible()});f(this,"updateVisible",()=>{const t=(()=>!this.parent.visible||!this.plugin.state.enabled||!this.plugin.state.visible?!1:this.customVisible!==null?this.customVisible:this.inWalkAnimation?!0:this.modeVisible&&this.textureHasLoaded&&this.defaultVisible&&this.floorVisible)();this.visible!==t&&(this.visible=t,t?this.doShow():this.doHide())});f(this,"onFlowAnimeUpdate",t=>{const{progress:e}=t;this.mesh.material.uniforms.vOffset.value=e,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0});f(this,"onFlickerAnimeUpdate",t=>{var o,s;const{progress:e}=t,n=1-e;this.mesh.material.uniforms.flicker.value=n,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0,this.startTagContainer.tag&&kr(this.startTagContainer.tag)&&((o=this.startTagContainer.app)==null||o.$set(ye(F({},this.startTagContainer.tag.data),{opacity:n,name:this.name,distance:Math.floor(this.curvePath.getLength())}))),this.endTagContainer.tag&&kr(this.endTagContainer.tag)&&((s=this.endTagContainer.app)==null||s.$set(ye(F({},this.endTagContainer.tag.data),{opacity:n})))});f(this,"logWarning",t=>aA("GuideLineModeItem: ",t));f(this,"logError",t=>Sh("GuideLineModeItem: ",t));var s,r;this.five=t,this.mode=e.mode,this.plugin=e.plugin,this.parent=e.parent,this.startTagContainer={tag:null,plugin:new ns(this.five)},this.endTagContainer={tag:null,plugin:new ns(this.five)};const n=new I.BufferGeometry,o=new I.ShaderMaterial({vertexShader:lC,fragmentShader:cC,transparent:!0,uniforms:{map:{value:null},useMapColor:{value:0},mapColor:{value:new I.Color},mapOpacity:{value:1},backgroundColor:{value:new I.Color},backgroundOpacity:{value:0},borderColor:{value:new I.Color},borderOpacity:{value:0},opacity:{value:1},flicker:{value:1},maxU:{value:0},vOffset:{value:0}}});this.mesh=new I.Mesh(n,o),this.mesh.name="GuideLineModeItem",this.mode==="panorama"&&(this.parent.hooks.on("walkStart",this.onWalkAnimationStart),this.parent.hooks.on("walkEnded",this.onWalkAnimationEnd)),this.updateVisible(),this.onFiveModeChange(this.five.getCurrentState().mode),this.onFiveModelShownFloorChange((r=(s=this.five.model)==null?void 0:s.shownFloor)!=null?r:null),this.flowAnime.onUpdate(this.onFlowAnimeUpdate),this.flickerAnime.onUpdate(this.onFlickerAnimeUpdate),this.parent.hooks.on("show",this.updateVisible),this.parent.hooks.on("hide",this.updateVisible),this.plugin.hooks.on("show",this.updateVisible),this.plugin.hooks.on("hide",this.updateVisible),this.plugin.hooks.on("enable",this.updateVisible),this.plugin.hooks.on("disable",this.updateVisible),this.plugin.hooks.on("dispose",this.dispose),this.five.on("modeChange",this.onFiveModeChange),this.five.on("modelShownFloorChange",this.onFiveModelShownFloorChange)}get panoGroup(){return this._panoGroup}get visibleFloorIndexes(){return this._visibleFloorIndexes}get curvePath(){return this._curvePath}get curvePoints(){return this._curvePoints}setCustomVisible(t){if(this.disposed)return this.logError("disposed");this.customVisible!==t&&(this.customVisible=t,this.updateVisible())}setDefaultVisible(t){if(this.disposed)return this.logError("disposed");this.defaultVisible!==t&&(this.defaultVisible=t,this.updateVisible())}setUnitSize(t,e){if(this.disposed)return this.logError("disposed");this.width=t,this.unitLength=e,this.setGeometryByPath(this.path,{width:t,unit_length:e})}setScale(t){if(this.disposed)return this.logError("disposed");this.scale=t,this.setGeometryByPath(this.path,{scale:t})}setGeometryByPanoGroup(t,e){if(this.disposed)return this.logError("disposed");if(!this.five.work)return this.logError("setPathByPanoGroup: work is not ready");const n=aC(t);if(this._panoGroup=n,(e==null?void 0:e.skipPanoGroup)!==void 0){const s=e.skipPanoGroup?n.map(r=>this.five.work.observers[r]).map(r=>r.standingPosition.clone()):null;this.skippedPositions=s}const o=this.getPathFromPanoGroup(n,this.five.work,e);this.path=o,this.setGeometryByPath(o,e)}setGeometryByPath(t,e){var d,h,u;if(this.disposed)return this.logError("disposed");const n=(d=e==null?void 0:e.scale)!=null?d:this.scale,o=(h=e==null?void 0:e.width)!=null?h:this.width,s=(u=e==null?void 0:e.unit_length)!=null?u:this.unitLength;this.path=t,this.scale=n,this.width=o,this.unitLength=s;const{geometry:r,maxU:a,curvePath:l,curvePoints:c}=kA({path:t,width:o*n,unitLength:s*n,skipPositions:this.skippedPositions});this._curvePath=l,this._curvePoints=c,this.mesh.geometry=r,this.mesh.material.needsUpdate=!0,this.mesh.material.uniforms.maxU.value=a,this.five.needsRender=!0}setMartial(t){var e;if(this.disposed)return this.logError("disposed");(t==null?void 0:t.visible)!==void 0&&this.setDefaultVisible(t.visible),(t==null?void 0:t.color)!==void 0&&this.setColor(t.color),(t==null?void 0:t.opacity)!==void 0&&this.setOpacity(t.opacity),((e=t==null?void 0:t.texture)==null?void 0:e.url)!==void 0&&this.setTextureUrl(t.texture.url),(t==null?void 0:t.background_color)!==void 0&&this.setBackgroundColor(t.background_color),(t==null?void 0:t.background_opacity)!==void 0&&this.setBackgroundOpacity(t.background_opacity),(t==null?void 0:t.border_color)!==void 0&&this.setBorderColor(t.border_color),(t==null?void 0:t.border_opacity)!==void 0&&this.setBorderOpacity(t.border_opacity)}setColor(t){if(this.disposed)return this.logError("disposed");t&&(this.mesh.material.uniforms.mapColor.value=new I.Color().set(t)),this.mesh.material.uniforms.useMapColor.value=t?1:0,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderColor(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.borderColor.value=new I.Color().set(t),this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderOpacity(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.borderOpacity.value=t,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundColor(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.backgroundColor.value=new I.Color().set(t),this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundOpacity(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.backgroundOpacity.value=t,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setOpacity(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.opacity.value=t,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setMapOpacity(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.mapOpacity.value=t,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setTextureUrl(t){if(this.disposed)return this.logError("disposed");this.textureUrl=t,Ui(t).then(e=>{this.disposed||this.textureUrl===t&&(e.wrapT=I.RepeatWrapping,this.textureHasLoaded=!0,this.mesh.material.uniforms.map.value=e,this.mesh.material.uniformsNeedUpdate=!0,this.mesh.material.needsUpdate=!0,this.five.needsRender=!0,this.updateVisible())})}setVisibleFloorIndexes(t){var e,n;if(this.disposed)return this.logError("disposed");this._visibleFloorIndexes=t,this.onFiveModelShownFloorChange((n=(e=this.five.model)==null?void 0:e.shownFloor)!=null?n:null)}setStartTag(t){this.setTag("start",t)}setEndTag(t){this.setTag("end",t)}flicker(){if(this.disposed)return this.logError("disposed");this.flickerAnime.play()}getLengthByPanoGroupIndex(t){return this.disposed?this.logError("disposed"):this.cacheLengths.length!==0?this.cacheLengths[t]:(this.cacheLengths=this.getPanoGroupLengths(),this.cacheLengths[t])}getPanoGroupLengths(){const t=this.panoGroup.map(c=>this.five.work.observers[c]),e=this.curvePoints.length,n=this.curvePath.getLength(),o=e-1,s=n/o,r=this.curvePath.getLengths(o),a=[];let l=0;for(let c=0;c<e;c++){const d=this.curvePoints[c],h=t[l];if(!h)break;h.standingPosition.clone().setY(0).distanceTo(d.clone().setY(0))<s&&(a.push(r[c]),l+=1)}return a}setTag(t,e){const n=t==="start"?this.startTagContainer:this.endTagContainer;e||n.plugin.clearTags();const s=Ye({},{contentType:"Custom",stickType:"2DPoint",config:{visibleConfig:{visibleFiveMode:["Floorplan","Mapview"],followModelVisibility:!1}},style:{point:{enabled:!1}},data:{}},e);n.tag=s,kr(s)&&(n.tag.element=r=>{var c;(c=n.app)==null||c.$destroy();const a=t==="start"?ye(F({},s.data),{name:this.name,distance:Math.floor(this.curvePath.getLength()),i18n:this.plugin.config.i18n}):s.data,l=new rC({target:r,intro:!0,props:a});return n.app=l,()=>l.$destroy()}),n.plugin.load({tagList:[n.tag]})}doShow(){this.mode==="model"&&this.flowAnime.play(),this.five.scene.add(this.mesh),this.startTagContainer.plugin.show(),this.endTagContainer.plugin.show(),this.five.needsRender=!0}doHide(){this.mode==="model"&&this.flowAnime.stop(),this.five.scene.remove(this.mesh),this.startTagContainer.plugin.hide(),this.endTagContainer.plugin.hide(),this.five.needsRender=!0}getPathFromPanoGroup(t,e,n){if(t.length<2)return[];const s=t.map(r=>e.observers[r]).map(r=>r.standingPosition.toArray());return[F({type:"CatmullRomCurve3",points:s},n)]}}function kr(i){return i.contentType==="Custom"}const dC=Object.freeze(Object.defineProperty({__proto__:null,GuideLineModeItem:Zr},Symbol.toStringTag,{value:"Module"}));function pd(i){const t=Math.abs(Math.cos(i.latitude));return new I.Vector3(-Math.sin(i.longitude)*t,-Math.sin(i.latitude),-Math.cos(i.longitude)*t)}function hC(i,t){const e=pd(i),n=pd(t);return e.angleTo(n)}const uC=i=>Y(exports,null,function*(){try{i().then(()=>{},()=>{}).catch(()=>{})}catch(t){}}),Vo=Math.PI*2;function fC(i){return i>=0&&i<Vo?i:(i%Vo+Vo)%Vo}function mC(i){return{longitude:fC(-Math.atan2(i.x,-i.z)),latitude:-Math.asin(i.y/1)}}function pC(i,t,e,n){const o=-i/e,s=i;return o*n+s}function gC(i){return new Promise(t=>{setTimeout(()=>{t()},i)})}const cu="v1.0.6",du="CruisePlugin",ys=`${du}@${cu}`,gd=()=>{console.error(`${ys} is disposed`)},vC=()=>{console.warn(`${ys} is disabled`)},AC=()=>{console.error(`${ys} is disabled`)},xr=new Map;class to extends Mn{constructor(e,n){super(e,n);f(this,"state",{visible:!0,enabled:!0,disposed:!1,playing:!1,speed:1,config:{speedConfig:{rotateSpeed:.001,rotateSpeedUnit:"rad/ms",moveSpeed:.002,moveSpeedUnit:"m/ms"}}});f(this,"data");f(this,"config");f(this,"privateState",{playing:!1,currentPlayQueue:[],currentPlayKeyframe:null,broke:!1,disposers:[],modeChanging:!1});f(this,"GuideLine");this.config=n,Object.assign(window,{[`__${du}_DEBUG__`]:this});const o=this.setFiveLinearUpdateCamera.bind(this),s=this.setFiveOriginUpdateCamera.bind(this);this.hooks.on("play",o),this.hooks.on("broke",s),this.hooks.on("end",s),this.hooks.on("pause",s),this.privateState.disposers.push(()=>{this.hooks.off("play",o),this.hooks.off("broke",s),this.hooks.off("end",s),this.hooks.off("pause",s)})}load(e,n,o){return Y(this,null,function*(){var d,h,u,m,v,g;if(this.state.disposed)return gd();this.privateState.fiveOriginGetProgress||(h=(d=this.five.controller)==null?void 0:d.cameraMotion)!=null&&h.getProgress||(yield this.waitFiveLoaded(),this.privateState.fiveOriginGetProgress=(m=(u=this.five.controller)==null?void 0:u.cameraMotion)==null?void 0:m.getProgress),this.clear();const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,r=yield this.formatData(e);this.data=r,this.hooks.emit("dataChange",r,s);let a=[],l;const c=this.data.keyframes.filter(A=>A.data.panoIndex!==void 0);c.filter((A,b)=>{var y;return A.data.panoIndex!==((y=c[b-1])==null?void 0:y.data.panoIndex)}).map(A=>A.data.panoIndex).forEach(A=>{var y,E;const b=(y=this.five.work.observers[A])==null?void 0:y.floorIndex;if(b!==void 0)if(l===b){const k=a.length-1;a[k]=[...(E=a[k])!=null?E:[],A]}else{l=b;const k=a.length;a[k]=[A]}}),!this.GuideLine&&((v=this.config)==null?void 0:v.useGuideLine)!==!1&&r.useGuildLine!==!1&&(this.GuideLine=fu(this.five,this.config)),(g=this.GuideLine)==null||g.load({routes:a.map(A=>({panoIndexList:A})),config:r.guildPluginOptions}),this.setState({playing:!1}),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),this.changePlayState(this.state.playing),this.changeSpeed(this.state.speed),n&&this.setState(n,{userAction:o}),console.debug(`${ys} loaded`,r),this.hooks.emit("dataLoaded",r)})}play(e){this.setState({playing:!0},e)}playFrom(e){const{index:n,id:o,userAction:s}=e;this.state.playing&&this.setState({playing:!1},{userAction:s}),this.setState({playing:!0},{userAction:s,playFromIndex:n,playFromId:o})}playFromStart(e){return this.playFrom(ye(F({},e),{index:0}))}pause(e){this.setState({playing:!1},e)}show(e){return Y(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return Y(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,n){var s;if(this.state.disposed)return gd();if(!this.state.enabled&&e.enabled!==!0&&e.disposed!==!0)return AC();const o=F({},this.state);this.state=F(F({},this.state),e),e.disposed!==void 0&&e.disposed!==o.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible,n==null?void 0:n.userAction),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled,n==null?void 0:n.userAction),e.playing!==void 0&&e.playing!==o.playing&&this.changePlayState(e.playing,n),e.speed!==void 0&&e.speed!==o.speed&&this.changeSpeed(e.speed,n==null?void 0:n.userAction),jt(o,this.state,{deep:!0})||this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:(s=n==null?void 0:n.userAction)!=null?s:!0})}formatData(e){return Y(this,null,function*(){this.five.work||(yield this.waitFiveLoaded());const n=this.five.work.observers,o=(()=>{const s=e;return typeof s=="object"&&s!==null&&s.version&&s.data?s.data:s})();if(o.keyframes)return{keyframesId:dt(),keyframes:o.keyframes.map((s,r)=>{var c;const a=o.keyframes[r+1],l=(()=>!a||a.start===void 0||s.end===void 0?0:a.start-s.end)();return ye(F({id:(c=s.uuid)!=null?c:dt(),moveIndex:r,stay:l,index:r},s),{guildPluginOptions:o.guildPluginOptions})})};if(o.panoIndexList){let s=[];const{moveEffect:r,moveToFirstPanoEffect:a,moveToFirstPanoDuration:l}=o;return this.privateState.moveToFirstPanoEffect=a,this.privateState.moveToFirstPanoDuration=l,o.panoIndexList.forEach((c,d)=>{const h=(()=>{var A,b,y,E;const u=o.panoIndexList.slice(d).find(k=>k!==c);if(u===void 0)return;const m=(A=n[c])==null?void 0:A.position,v=(b=n[u])==null?void 0:b.position;if(!v||!m||((y=n[c])==null?void 0:y.floorIndex)!==((E=n[u])==null?void 0:E.floorIndex))return;const g=new I.Vector3().subVectors(v,m);return mC(g.normalize())})();o.moveType===void 0||o.moveType==="justMove"?s.push({moveIndex:d,stay:o.stay,data:F({effect:"Move",panoIndex:c,moveEffect:r},h!=null?h:{})}):o.moveType==="moveAndRotate"&&(s.push({moveIndex:d,stay:o.stay,data:{effect:"Move",panoIndex:c,moveEffect:r}}),h&&s.push({moveIndex:d,stay:o.stay,data:F({effect:"Rotate",panoIndex:c},h)}))}),{keyframesId:dt(),keyframes:s.map((c,d)=>F({id:dt(),index:d},c)),guildPluginOptions:o.guildPluginOptions,useGuildLine:o.useGuildLine}}else throw new Error("format error: data no keyframes or no panoIndexList")})}handleEnable(e,n=!0){var o,s;e?((o=this.GuideLine)==null||o.enable(),this.hooks.emit("enable",{userAction:n})):((s=this.GuideLine)==null||s.disable(),this.changePlayState(!1,{userAction:n}),this.hooks.emit("disable",{userAction:n})),this.state.enabled=e}handleVisible(e,n=!0){var o,s;e?((o=this.GuideLine)==null||o.show(),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:n}))):((s=this.GuideLine)==null||s.hide(),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:n}))),this.state.visible=e}changePlayState(e,n){this.actionIfStateIsEnabled(()=>{var o;return this.hooks.emit("playStateChange",e?"playing":"pause",{userAction:(o=n==null?void 0:n.userAction)!=null?o:!0})}),e?this.handlePlay(n):this.handlePause(n),this.state.playing=e}handlePlay(e){return Y(this,null,function*(){var m;const{data:n,state:o,privateState:s,hooks:r}=this;if(s.playing||!(n!=null&&n.keyframes)||(n==null?void 0:n.keyframes.length)===0)return;const a=dt();s.playId=a,s.playing=!0,s.broke=!1;const l=n.keyframes,c=this.getPauseData();(e==null?void 0:e.notEmitEvent)!==!0&&r.emit("play",{userAction:(m=e==null?void 0:e.userAction)!=null?m:!0});let d=!1;const u=yield(()=>Y(this,null,function*(){var v,g;if((e==null?void 0:e.playFromIndex)!==void 0)return e.playFromIndex;if((e==null?void 0:e.playFromId)!==void 0)return(v=this.data)==null?void 0:v.keyframes.findIndex(A=>A.id===e.playFromId);if(c!=null&&c.keyframeId){const A=(g=this.data)==null?void 0:g.keyframes.find(b=>b.id===c.keyframeId);if(c!=null&&c.fiveState&&(yield this.move(c.fiveState,{moveEffect:s.moveToFirstPanoEffect,duration:s.moveToFirstPanoDuration})),A){if(A.data.effect==="Move")return A.index;if(A.data.effect==="Rotate"){const b=c.duration!==void 0?c.duration*(1-c.playedProgress):void 0;return yield this.playKeyframe(A,{duration:b}),d=!0,A.index+1}}}}))();this.clearPauseData();for(const v of l){if(s.broke||!o.playing||!s.playing||a!==s.playId)return;if(!(u!==void 0&&v.index<u))try{r.emit("playIndexChange",v.index,v),yield this.playKeyframe(v,{moveEffect:d===!1?s.moveToFirstPanoEffect:void 0,duration:d===!1&&typeof s.moveToFirstPanoDuration=="number"?s.moveToFirstPanoDuration:void 0}),v.stay&&(yield gC(v.stay)),d===!1&&(d=!0)}catch(g){return Promise.resolve("broke")}}o.playing&&a===s.playId&&(this.setState({playing:!1},{userAction:!1}),r.emit("end"),this.clearPauseData())})}handlePause(e){var r;const{state:n,privateState:o,hooks:s}=this;n.playing=!1,o.playing!==!1&&(o.playing=!1,this.setPauseData(),o.broke||this.forceInteruptUpdateCamera(),(e==null?void 0:e.notEmitEvent)!==!0&&s.emit("pause",{userAction:(r=e==null?void 0:e.userAction)!=null?r:!0}))}playKeyframe(e,n){return Y(this,null,function*(){var s;const{privateState:o}=this;return((s=this.privateState.currentPlayKeyframe)==null?void 0:s.keyframe.id)!==e.id&&(this.privateState.currentPlayKeyframe={keyframe:e}),o.currentPlayQueue.push(this.getPlayPromise(e,n)),this.actionPromiseQueue()})}addInterruptListener(e){const n=()=>{this.privateState.modeChanging||e()},o=e;return this.five.once("gesture",o),this.five.once("wantsChangeMode",n),()=>{this.five.off("gesture",o),this.five.once("wantsChangeMode",n)}}getPlayPromise(o){return Y(this,arguments,function*(e,n={}){var r;const s=e.data;if(n.duration=(r=n.duration)!=null?r:e.start!==void 0&&e.end!==void 0?e.end-e.start:void 0,!!s)return new Promise((a,l)=>{let c=!1;this.addInterruptListener(()=>{if(!c)return this.hooks.emit("broke"),this.privateState.broke=!0,this.setState({playing:!1}),c=!0,l(new Error("play is interupted"))});try{if(c)return;const d=()=>{a(),c=!0};switch(s.effect){case"Move":this.move(s,n).then(d);break;case"Rotate":this.rotate(s,n).then(d);break;default:this.rotate(s,n).then(d)}}catch(d){}})})}actionPromiseQueue(){return Y(this,null,function*(){const{privateState:e}=this;return new Promise((n,o)=>{if(e.currentPlayQueue.length===0){n();return}const s=e.currentPlayQueue.shift();if(!s){n();return}s.then(n,o)}).then(()=>e.currentPlayQueue.length===0?Promise.resolve():this.actionPromiseQueue())})}move(e,n){return Y(this,null,function*(){if(e.mode&&e.mode!==this.five.currentMode)yield this.changeMode(e);else if(e.panoIndex!==this.five.panoIndex)yield this.changePano(e,n);else return Promise.resolve()})}rotate(e,n){return Y(this,null,function*(){if(e.mode&&e.mode!==this.five.currentMode)yield this.changeMode({mode:e.mode,panoIndex:e.panoIndex});else if(e.panoIndex&&e.panoIndex!==this.five.panoIndex)return yield this.changePano(e,n);yield this.updateCamera(e,n)})}updateCamera(o){return Y(this,arguments,function*(e,n={}){const{five:s,privateState:r,state:a}=this,l=(()=>{var m,v;const h=(m=a.config)==null?void 0:m.speedConfig,u=(v=e.rotateSpeed)!=null?v:h==null?void 0:h.rotateSpeed;if((h==null?void 0:h.rotateSpeedUnit)===void 0)return u;if(u!==void 0)return h.rotateSpeedUnit==="rad/ms"?u:u/1e3})(),c=(()=>{if(n.duration)return n.duration;if(l){const h=this.five.getCurrentState();return hC(h,e)/l}return 800})();r.currentPlayKeyframe&&(r.currentPlayKeyframe.originDuration=c);const d=this.getSpeededDuration(c);return new Promise(h=>{uC(()=>s.updateCamera(e,d)),setTimeout(()=>h(),d)})})}changePano(e,n){return Y(this,null,function*(){const{five:o,privateState:s,state:r}=this;if(typeof e.panoIndex!="number"||e.panoIndex===o.panoIndex)return;const a=o.getCurrentState().mode!=="Panorama";a&&(this.privateState.modeChanging=!0);const l=(()=>{var u,m;const d=(u=r.config)==null?void 0:u.speedConfig,h=(m=e.moveSpeed)!=null?m:d==null?void 0:d.moveSpeed;if((d==null?void 0:d.moveSpeedUnit)===void 0)return h;if(h!==void 0)return d.moveSpeedUnit==="m/ms"?h:h/1e3})(),c=(()=>{if(n!=null&&n.duration)return n.duration;if(l&&typeof o.panoIndex=="number"&&typeof e.panoIndex=="number"){const d=o.work.observers[o.panoIndex].position,h=o.work.observers[e.panoIndex].position;return d.distanceTo(h)/l}return 800})();s.currentPlayKeyframe&&(s.currentPlayKeyframe.originDuration=c),yield new Promise(d=>{var h,u,m;o.moveToPano(e.panoIndex,{latitude:e.latitude,longitude:e.longitude,fov:e.fov,duration:this.getSpeededDuration(c),effect:(m=(u=n==null?void 0:n.moveEffect)!=null?u:(h=this.state.config)==null?void 0:h.moveEffect)!=null?m:e.moveEffect,moveCancelCallback:()=>d(),moveEndCallback:()=>d()}),a&&o.once("panoArrived",()=>d())}),a&&(this.privateState.modeChanging=!1)})}changeSpeed(e,n=!0){const{state:o,privateState:s,hooks:r}=this,{currentPlayKeyframe:a}=s;if(r.emit("speedChange",e,{userAction:n}),o.playing&&a)try{const l=a.originDuration!==void 0?a.originDuration*(1-this.getProgress()):void 0,c=this.playKeyframe(a.keyframe,{duration:l});s.currentPlayQueue.push(c)}catch(l){}}getSpeededDuration(e){return e/this.state.speed}getProgress(){return this.five.controller.cameraMotion.progress}changeMode(e,n){return Y(this,null,function*(){e.mode&&e.mode!==this.five.currentMode&&(this.privateState.modeChanging=!0,yield this.five.changeMode(e.mode,e,n),this.privateState.modeChanging=!1)})}forceInteruptUpdateCamera(){this.five.updateCamera({},0)}getPauseData(){var e,n;if((e=this.data)!=null&&e.keyframesId)return xr.get((n=this.data)==null?void 0:n.keyframesId)}setPauseData(){var e,n,o,s;if((e=this.data)!=null&&e.keyframesId)return xr.set((n=this.data)==null?void 0:n.keyframesId,{keyframeId:(o=this.privateState.currentPlayKeyframe)==null?void 0:o.keyframe.id,fiveState:this.five.getCurrentState(),duration:(s=this.privateState.currentPlayKeyframe)==null?void 0:s.originDuration,playedProgress:this.getProgress()})}clearPauseData(){var e,n;if((e=this.data)!=null&&e.keyframesId)return xr.delete((n=this.data)==null?void 0:n.keyframesId)}clear(){this.clearPauseData(),this.privateState.currentPlayKeyframe=null}handleDispose(){var e,n;this.setState({playing:!1}),this.clearPauseData(),this.clear(),(e=this.GuideLine)==null||e.dispose(),this.GuideLine=void 0,(n=this.privateState.disposers)==null||n.forEach(o=>o==null?void 0:o())}actionIfStateIsEnabled(e,n){if(this.state.enabled)return e();n!=null&&n.warnLog&&vC()}waitFiveLoaded(){return Y(this,null,function*(){return new Promise(e=>{if(this.five.work){e();return}this.five.once("loaded",()=>{e()})})})}setFiveLinearUpdateCamera(){this.privateState.fiveOriginGetProgress&&(this.five.controller.cameraMotion.getProgress=e=>{const n=this.five.controller.cameraMotion,o=e-n.startTime;return o<0?0:o>=n.duration?1:1-pC(1,n.startVelocity,n.duration,o)})}setFiveOriginUpdateCamera(){this.privateState.fiveOriginGetProgress&&(this.five.controller.cameraMotion.getProgress=this.privateState.fiveOriginGetProgress)}}f(to,"PluginVersion",cu);const bC=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),yC=i=>new to(i);class hu{constructor(t){f(this,"id");f(this,"renderID");f(this,"isGuideLine",!0);f(this,"panoramaItem");f(this,"modelItem");f(this,"hooks",new ze.Subscribe);f(this,"_visible",!0);f(this,"plugin");f(this,"five");f(this,"logError",t=>Sh("GuideLineItem: ",t));this.id=t.id,this.five=t.five,this.plugin=t.plugin,this.panoramaItem=new Zr(this.five,{mode:"panorama",plugin:this.plugin,parent:this}),this.modelItem=new Zr(this.five,{mode:"model",plugin:this.plugin,parent:this})}get visible(){return this._visible}setData(t){this.setDataByMode("panorama",t),this.setDataByMode("model",t)}setHeightOffset(t){this.modelItem.mesh.position.y=t,this.panoramaItem.mesh.position.y=t}setDataByMode(t,e){var l;const n=t==="panorama"?this.panoramaItem:this.modelItem,o=t==="panorama"?e.panorama_style:e.model_style,s=e.path,r=o,a=o;if(e.pano_group){const c=t==="panorama";n.setGeometryByPanoGroup(e.pano_group,F({skipPanoGroup:c},r))}else e.path&&n.setGeometryByPath(s,r);n.name=e.name,n.setMartial(a),n.setVisibleFloorIndexes((l=e.visible_floor_indexes)!=null?l:null),n.setStartTag(o==null?void 0:o.start_tag),n.setEndTag(o==null?void 0:o.end_tag)}show(){this._visible=!0,this.hooks.emit("show",{userAction:!0})}hide(){this._visible=!1,this.hooks.emit("hide",{userAction:!0})}dispose(){this.panoramaItem.dispose(),this.modelItem.dispose()}walk(t){return Y(this,null,function*(){if(!this.panoramaItem.panoGroup)return;const e=F({panoIndexList:this.panoramaItem.panoGroup},t);this.hooks.emit("walkStart",{userAction:!0});const[n]=yield ii(wC(this.five,e));if(this.hooks.emit("walkEnded",{userAction:!0}),n)return this.logError(n.message)})}}function wC(i,t){return Y(this,null,function*(){if(t.panoIndexList.length===0)return;const e=i.getCurrentState();e.mode!=="Panorama"&&(yield fa(i,["Panorama",{longitude:e.longitude,latitude:0,panoIndex:t.panoIndexList[0]}]));const n=new to(i,{useGuideLine:!1});yield n.load(t),yield new Promise((o,s)=>{const r=i.getCurrentState();let a=t.panoIndexList.slice();r.panoIndex===a[0]&&c(r.panoIndex),n.playFromStart();function l(m){if(m!=="Panorama")return h(new Error("mode not match"))}function c(m){const v=a[0];if(a=a.slice(1),m!==v)return h(new Error("panoIndex not match, wanted: "+v+", got: "+m));if(a.length===0)return u()}function d(){i.off("modeChange",l),i.off("panoArrived",c)}function h(m){d(),s(m)}function u(){d(),o()}i.on("modeChange",l),i.on("panoArrived",c)})})}const PC=Object.freeze(Object.defineProperty({__proto__:null,GuideLineItem:hu},Symbol.toStringTag,{value:"Module"})),uu="v1.1.0",Kr="GuideLinePlugin",vd=`${Kr}@${uu}`;class CC extends Mn{constructor(e,n){super(e,n);f(this,"version",uu);f(this,"name",Kr);f(this,"cruisePlugin");f(this,"itemMap",new Map);f(this,"state",{visible:!1,enabled:!0});f(this,"data");f(this,"heightOffset",0);f(this,"_config");f(this,"_disposed",!1);f(this,"disposedErrorLog",()=>{console.error(`${vd} is disposed`)});this._config=n!=null?n:{},this.cruisePlugin=new to(e,{useGuideLine:!1}),Object.assign(window,{[`__${Kr}_DEBUG__`]:this})}get config(){return this._config}get disposed(){return this._disposed}load(e,n,o=!0){return Y(this,null,function*(){var m,v,g,A,b,y,E;if(this.disposed)return;const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,r=yield this.formatData(e);this.hooks.emit("dataChange",r,s),this.data=r;const a=r.config,c={panorama_style:{visible:!!(!r.lines&&r.routes),unit_length:(m=a==null?void 0:a.unitHeight)!=null?m:.4,width:(v=a==null?void 0:a.unitWidth)!=null?v:.6,texture:{url:(g=a==null?void 0:a.arrowTextureUrl)!=null?g:this.staticPrefix+"/release/web/arrow6.b6ce0c62.png"}}},d=(b=(A=r.routes)==null?void 0:A.map(k=>{var S;return Ye({},c,{id:(S=k.id)!=null?S:Date.now(),pano_group:k.panoIndexList})}))!=null?b:[],h=(E=(y=r.lines)==null?void 0:y.map(k=>Ye({},c,k)))!=null?E:[],u=[...d,...h];yield this.waitFiveLoaded(),this.clear(),u.forEach(k=>{this.addGuideLineItem(k)}),this.updateTagsEnable(),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),n&&this.setState(n,{userAction:o}),this.hooks.emit("dataLoaded",r),console.debug(`${vd} loaded`,r)})}formatData(e){return Y(this,null,function*(){return this.getDataWithoutVersion(e)})}show(e){return Y(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return Y(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.disposed||(this.clear(),this.hooks.emit("dispose"))}setState(e,n){var s;if(this.disposed)return this.disposedErrorLog();const o=F({},this.state);this.state=F(F({},this.state),e),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible,n==null?void 0:n.userAction),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled,n==null?void 0:n.userAction),jt(o,this.state,{deep:!0})||(this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:(s=n==null?void 0:n.userAction)!=null?s:!0}),this.five.needsRender=!0)}addGuideLineItem(e){const n=e.render_id||e.id,o=this.itemMap.get(n);o&&this.removeGuideLineItem(o);const s=new hu({five:this.five,id:n,plugin:this});return this.itemMap.set(n,s),e&&s.setData(e),this.heightOffset+=1e-4,s.setHeightOffset(this.heightOffset),s}getGuideLineItemByID(e){return this.itemMap.get(e)}removeGuideLineItem(e){this.itemMap.delete(e.id),e.panoramaItem.dispose(),e.modelItem.dispose()}updateTagsEnable(){const e=[];function n(r){return Array.isArray(r)&&r.every(a=>typeof a=="number")}function o(r,a){return new I.Vector3().fromArray(r).distanceTo(new I.Vector3().fromArray(a))<.01}function s(r){var l;const a=(l=r.tag)==null?void 0:l.position;return n(a)?e.every(c=>{var d;return n((d=c.tag)==null?void 0:d.position)?!o(a,c.tag.position):!0}):!1}this.itemMap.forEach(r=>{const a=r.modelItem.startTagContainer,l=r.modelItem.endTagContainer,c=s(a);c&&e.push(a),a.plugin.setState({enabled:c},{});const d=s(l);d&&e.push(l),l.plugin.setState({enabled:d},{})})}clear(){this.itemMap.forEach(e=>{this.removeGuideLineItem(e)})}handleEnable(e,n=!0){this.hooks.emit(e?"enable":"disable",{userAction:n})}handleVisible(e,n=!0){this.state.enabled&&this.hooks.emit(e?"show":"hide",{userAction:n})}waitFiveLoaded(){return Y(this,null,function*(){return new Promise(e=>{if(this.five.work){e();return}this.five.once("loaded",()=>{e()})})})}getDataWithoutVersion(e){return typeof e=="object"&&e!==null&&e.version&&e.data?e.data:e}}const fu=(i,t)=>new CC(i,t);function mu(i,t,e){if(e){const o=new I.Vector3().subVectors(i.position,e).applyQuaternion(i.quaternion.clone().inverse()).applyQuaternion(t).add(e);i.position.copy(o)}i.quaternion.copy(t)}class EC extends R.Object3D{constructor(){super()}add(...t){if(t.length===0)return this;const e=t.filter(Boolean);return super.add(...e)}remove(...t){if(t.length===0)return this;const e=t.filter(Boolean);return super.remove(...e)}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}}class ws extends EC{constructor(e,n){var o;super();f(this,"originObject3D");f(this,"onRender");this.originObject3D=e,this.onRender=(o=n==null?void 0:n.onRender)!=null?o:()=>{}}get helperObject(){return this}render(){this.onRender()}enable(){this.parent.children.includes(this)||this.parent.add(this)}disable(){this.removeFromParent()}show(){this.visible=!0,this.render()}hide(){this.visible=!1,this.render()}raycasterIntersectObject(e,n=[]){return e.intersectObject(this,!0,n)}initialPosition(){this.position.add(this.originObject3D.position)}initQuaternion(){this.quaternion.copy(this.originObject3D.quaternion)}applyHelperScaleMatrix4(e,n){this.scale.applyMatrix4(e)}setHelperQuaternion(e,n){mu(this,e,n)}applyHelperQuaternion(e,n){if(n){const o=new R.Vector3().subVectors(this.position,n).applyQuaternion(e).add(n);this.position.copy(o)}this.applyQuaternion(e)}dispose(){this.removeFromParent()}}class IC extends ws{}class kC extends ws{}class xC extends ws{}class pu extends ws{}class DC extends pu{}class MC extends I.Group{constructor(e){super();f(this,"direction");this.direction=e||"x"}}class Ad extends I.Mesh{constructor(e,n,o){super(e,n);f(this,"direction");this.direction=o||"x"}}function SC(i,t){const{offsetWidth:e,offsetHeight:n}=t,{top:o,left:s}=t.getBoundingClientRect();return Object.assign(new I.Vector2,{x:(i.x-s)/e*2-1,y:-(i.y-o)/n*2+1})}function Ia(i,t,e){if(!t||!e||!i)return;const n=SC(t,e);if(Math.abs(n.x)===1||Math.abs(n.y)===1)return;const o=new I.Raycaster;return o.setFromCamera(n,i),o}function LC(i,t){return!(Math.abs(i.x-t.x)>1e-5||Math.abs(i.y-t.y)>1e-5||Math.abs(i.z-t.z)>1e-5)}class Dr extends MC{constructor(e){var d;super(e.direction);f(this,"line");f(this,"arrow");f(this,"lineHeight",.4);f(this,"arrowHeight",.1);this.name="ArrowGroup";const n=new I.Color((d=e.color)!=null?d:16214315),o=new I.MeshBasicMaterial({color:n,depthTest:!1,opacity:1,transparent:!0,side:I.DoubleSide}),s=new I.ConeGeometry(.04,.1,32),r=new Ad(s,o.clone(),e.direction);r.name=`arrow-${e.direction}`,this.arrow=r;const a=.004,l=new I.CylinderGeometry(a,a,.4,32),c=new Ad(l,o.clone(),e.direction);c.name=`line-${e.direction}`,this.line=c,this.formatArrow(),this.formatLine(),this.add(this.arrow,this.line)}formatArrow(){this.arrow.geometry.translate(0,this.lineHeight+this.arrowHeight/2,0),this.direction==="x"?(this.arrow.geometry.rotateX(Math.PI/2),this.arrow.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.arrow.geometry.rotateX(Math.PI/2)}formatLine(){this.line.geometry.translate(0,this.lineHeight/2,0),this.direction==="x"?(this.line.geometry.rotateX(Math.PI/2),this.line.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.line.geometry.rotateX(Math.PI/2)}}const Mr={X:15618642,Y:4765519,Z:4227839};class ei{static get X(){return new I.Color(Mr.X).convertSRGBToLinear().clone()}static get Y(){return new I.Color(Mr.Y).convertSRGBToLinear().clone()}static get Z(){return new I.Color(Mr.Z).convertSRGBToLinear().clone()}}class TC extends IC{constructor(e){super(e);f(this,"xArrow",new Dr({direction:"x",color:ei.X}));f(this,"yArrow",new Dr({direction:"y",color:ei.Y}));f(this,"zArrow",new Dr({direction:"z",color:ei.Z}));this.add(this.xArrow),this.add(this.yArrow),this.add(this.zArrow)}show(){super.show(),this.xArrow.visible=!0,this.yArrow.visible=!0,this.zArrow.visible=!0}showDraggingHelper(e){this.xArrow.visible=e.includes("x"),this.yArrow.visible=e.includes("y"),this.zArrow.visible=e.includes("z")}dispose(){this.remove(this.xArrow,this.yArrow,this.zArrow)}}function En(i,t){return zC(document.createElement(t!=null?t:"div"),i)}function zC(i,t){if(!t)return i;for(const e in t)e&&t[e]&&(i.style[e]=t[e]);return i}function _C(i){const t=En(F({position:"absolute",display:"block",borderRadius:"4px",paddingTop:"1px",paddingBottom:"1px",paddingLeft:"4px",paddingRight:"4px",pointerEvents:"none",userSelect:"none",zIndex:"99999",backgroundColor:"rgba(0,0,0,0.7)",fontSize:"12px",color:"#fff",letterSpacing:"0",lineHeight:"18px"},i)),e=()=>{t.style.display!=="block"&&t.style.top&&t.style.left&&(t.style.display="block")};return{element:t,show:e,hide:()=>{t.style.display="none",t.style.top="",t.style.left=""},setLeftTop:(s,r)=>{t.style.left=s,t.style.top=r,e()}}}class VC extends xC{constructor(e,n){super(e);f(this,"xCircle");f(this,"yCircle");f(this,"zCircle");f(this,"children",[]);f(this,"angleTips");f(this,"container");(n==null?void 0:n.yzCircleEnable)!==!1&&(this.xCircle=new Sr({direction:"x",color:ei.X})),(n==null?void 0:n.xzCircleEnable)!==!1&&(this.yCircle=new Sr({direction:"y",color:ei.Y})),(n==null?void 0:n.xyCircleEnable)!==!1&&(this.zCircle=new Sr({direction:"z",color:ei.Z})),n!=null&&n.container&&(n==null?void 0:n.angleTipsEnable)!==!1&&(this.container=n==null?void 0:n.container,this.angleTips=_C({display:"none"}),this.container.appendChild(this.angleTips.element)),this.add(...[this.xCircle,this.yCircle,this.zCircle].filter(Boolean)),this.show()}hide(){this.children.forEach(e=>e.hide())}show(){var e;this.children.forEach(n=>n.showCircle()),(e=this.angleTips)==null||e.hide()}showDraggingHelper(e){var n;this.hide(),this.children.filter(o=>e.includes(o.direction)).forEach(o=>o.showRing()),(n=this.angleTips)==null||n.show()}dispose(){var e,n;this.removeFromParent(),(n=(e=this.angleTips)==null?void 0:e.element)==null||n.remove()}}class Sr extends I.Group{constructor(e){super();f(this,"direction");f(this,"circle");f(this,"ring");f(this,"angleSector");this.direction=e.direction,this.circle=new jC(e),this.ring=new OC(e),this.angleSector=new BC(e),this.add(this.circle,this.ring,this.angleSector),this.direction==="y"?this.rotateX(Math.PI/2):this.direction==="x"&&this.rotateY(-Math.PI/2)}showCircle(){this.add(this.circle),this.remove(this.ring,this.angleSector)}showRing(){this.add(this.ring,this.angleSector),this.remove(this.circle)}hide(){this.remove(this.ring,this.angleSector,this.circle)}}class jC extends I.Mesh{constructor(e){var n;super();f(this,"direction");f(this,"gapAngle",.02);f(this,"geometry",new I.RingGeometry(.25,.3,20,8,this.gapAngle,Math.PI/2-this.gapAngle*2));this.material=new I.MeshBasicMaterial({opacity:.6,color:(n=e.color)!=null?n:16777215,transparent:!0,side:I.DoubleSide,depthTest:!1}),this.direction=e.direction,this.geometry.name=`RotateHelperCircleGeometry-${this.direction}`}}class OC extends I.Group{constructor(e){super();f(this,"direction");this.direction=e.direction;const n=.015,o=new Array(8).fill(null).map((s,r)=>{const a=new I.RingGeometry(.25,.3,20,8,Math.PI/4*r+n,Math.PI/4-n*2),l=new I.MeshBasicMaterial({opacity:1,color:16777215,depthTest:!1,transparent:!0,side:I.DoubleSide}),c=new I.Mesh(a,l);return c.name=`AxesDashedRing-${this.direction}-${r}`,c});this.add(...o)}}class BC extends I.Mesh{constructor(e){var o;super();f(this,"direction");f(this,"baseAxes");f(this,"angleDirection");switch(e.direction){case"x":this.baseAxes=new I.Vector3(0,0,1);break;case"y":this.baseAxes=new I.Vector3(1,0,0);break;case"z":this.baseAxes=new I.Vector3(1,0,0);break}const n=.3+5e-4;this.geometry=new I.CircleGeometry(n,48,0,1e-4),this.material=new I.MeshBasicMaterial({opacity:.4,color:(o=e.color)!=null?o:16777215,depthTest:!1,transparent:!0,side:I.DoubleSide}),this.direction=e.direction,this.angleDirection=this.direction==="z"?1:-1}}function RC(){const i=En({width:"100%",height:"100%",left:"0",top:"0",position:"absolute",pointerEvents:"none"}),t=En({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}),e=En({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"absolute",border:"1px solid rgba(255,255,255,0.4)"});i.appendChild(t),t.appendChild(e);const n="-4px",o={direction:"nesw",element:en({cursor:"nesw-resize",left:n,bottom:n})},s={direction:"ns",element:en({cursor:"ns-resize",bottom:n})},r={direction:"nwse",element:en({cursor:"nwse-resize",right:n,bottom:n})},a={direction:"ew",element:en({cursor:"ew-resize",right:n})},l={direction:"nesw",element:en({cursor:"nesw-resize",right:n,top:n})},c={direction:"ns",element:en({cursor:"ns-resize",top:n})},d={direction:"nwse",element:en({cursor:"nwse-resize",left:n,top:n})},h={direction:"ew",element:en({cursor:"ew-resize",left:n})};return new Array(s,a,c,h,o,r,l,d).forEach(m=>t.appendChild(m.element)),{container:i,squares:[o,s,r,a,l,c,d,h]}}function en(i){const t=En(F({background:"#FFFFFF",width:"9px",height:"9px",position:"absolute",pointerEvents:"none"},i)),e=En({width:"15px",height:"15px",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"}),n=En({width:"15px",height:"15px",cursor:i==null?void 0:i.cursor,pointerEvents:"auto",background:"transparent"});return n.draggable=!0,e.appendChild(n),t.appendChild(e),t}class QC extends DC{constructor(e,n,o,s){super(e);f(this,"points",[]);f(this,"cornerPositions",[]);f(this,"css3DInstance");f(this,"plane");f(this,"css3DRenderer",new ti);f(this,"camera");f(this,"scene");f(this,"container");f(this,"enabled",!1);this.camera=o,this.scene=s,this.container=n,this.initRectangleScaleHelper()}get helperObject(){var e;if(!((e=this.css3DInstance)!=null&&e.css3DObject))throw new Error("css3DInstance is not initialized");return this.css3DInstance.css3DObject}applyMatrix4(e){var n;super.applyMatrix4(e),this.helperObject.applyMatrix4(e),(n=this.plane)==null||n.applyMatrix4(e),this.cornerPositions.forEach(o=>o.applyMatrix4(e))}showDraggingHelper(){}applyHelperScaleMatrix4(e,n){var o;(o=this.plane)==null||o.scale.applyMatrix4(e),this.helperObject.applyScaleMatrix4(e)}updatePoints(){const e=this.calculatePointPosition(this.cornerPositions);this.points.forEach((n,o)=>{n.position.copy(e[o])})}applyHelperQuaternion(e,n){var s;const o=(s=this.css3DInstance)==null?void 0:s.css3DObject;if(o){const r=new I.Vector3().subVectors(o.position,n).applyQuaternion(e).add(n);o.position.copy(r),o.applyQuaternion(e)}if(this.plane){const r=new I.Vector3().subVectors(this.plane.position,n).applyQuaternion(e).add(n);this.plane.position.copy(r),this.plane.applyQuaternion(e)}this.cornerPositions.forEach(r=>{const a=new I.Vector3().subVectors(r,n).applyQuaternion(e).add(n);r.copy(a)})}enable(){var e;this.enabled||(this.enabled=!0,(e=this.css3DInstance)==null||e.enable(),this.plane&&this.scene.add(this.plane))}disable(){var e;this.enabled&&(this.enabled=!1,(e=this.css3DInstance)==null||e.disable(),this.plane&&this.scene.remove(this.plane))}show(){var e;(e=this.css3DInstance)==null||e.show(),this.plane&&(this.plane.visible=!0)}hide(){var e;(e=this.css3DInstance)==null||e.hide(),this.plane&&(this.plane.visible=!1)}dispose(){this.disable(),this.css3DRenderer.dispose()}initRectangleScaleHelper(){var a,l;const e=this.getCornerPositions();if(!e)return;this.cornerPositions=e;const n=this.css3DRenderer.create3DElement(this.camera,e,{ratio:.003});if(!n)return;this.css3DInstance=n,n.appendToElement(this.container);const o=n.css3DObject.container,{container:s,squares:r}=RC();this.points=r.map((c,d)=>({direction:c.direction,point:c.element,position:this.calculatePointPosition(e)[d]})),o.insertBefore(s,(a=o.children[0])!=null?a:null),this.helperObject.position.copy(this.originObject3D.position),(l=this.plane)==null||l.position.copy(this.originObject3D.position)}getCornerPositions(){const{originObject3D:e}=this;if(e.isCSS3DObjectPlus)return e.cornerPoints;console.error("当前物体暂时不支持 ScaleHelper")}calculatePointPosition(e){return[e[0].clone(),e[0].clone().add(e[1]).divideScalar(2),e[1].clone(),e[1].clone().add(e[2]).divideScalar(2),e[2].clone(),e[2].clone().add(e[3]).divideScalar(2),e[3].clone(),e[3].clone().add(e[0]).divideScalar(2)]}}function gu(i){const t=new I.Box3,e=new I.Vector3;if(i.traverse(n=>{var s;if(n.name==="shadow")return;const o=n.geometry;if(o!==void 0)if((s=o==null?void 0:o.attributes)!=null&&s.position){const r=o.attributes.position;for(let a=0,l=r.count;a<l;a++)e.fromBufferAttribute(r,a).applyMatrix4(n.matrix),t.expandByPoint(e)}else o.vertices.forEach(r=>{const a=r.clone().applyMatrix4(n.matrix);t.expandByPoint(a)})}),!t.isEmpty())return t}class HC extends kC{constructor(e){super(e);f(this,"box");f(this,"outline");f(this,"originObject");f(this,"positionAttribute");this.originObject=e,this.positionAttribute=new I.BufferAttribute(new Float32Array(8*3),3),this.box=this.createBox(),this.outline=this.createOutline(),this.add(this.box,this.outline),this.update()}raycasterIntersectObject(e,n){return e.intersectObject(this,!1,n)}raycast(e,n){this.box.raycast(e,n)}update(){const e=gu(this.originObject);if(!e)return;const{min:n,max:o}=e;this.positionAttribute.setXYZ(0,o.x,o.y,o.z),this.positionAttribute.setXYZ(1,n.x,o.y,o.z),this.positionAttribute.setXYZ(2,n.x,n.y,o.z),this.positionAttribute.setXYZ(3,o.x,n.y,o.z),this.positionAttribute.setXYZ(4,o.x,o.y,n.z),this.positionAttribute.setXYZ(5,n.x,o.y,n.z),this.positionAttribute.setXYZ(6,n.x,n.y,n.z),this.positionAttribute.setXYZ(7,o.x,n.y,n.z),this.positionAttribute.needsUpdate=!0}createOutline(){const e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new I.BufferGeometry;n.setIndex(new I.BufferAttribute(e,1)),n.setAttribute("position",this.positionAttribute);const o=new I.LineBasicMaterial({color:64767,linewidth:1,opacity:1,depthTest:!1,transparent:!0,toneMapped:!1}),s=new I.LineSegments(n,o);return s.matrixAutoUpdate=!1,s}createBox(){const e=new Uint16Array([0,1,2,0,2,3,0,3,7,0,7,4,0,4,5,0,5,1,6,1,5,6,2,1,6,5,4,6,4,7,6,3,2,6,7,3]),n=new I.BufferGeometry;n.setIndex(new I.BufferAttribute(e,1)),n.setAttribute("position",this.positionAttribute);const o=new I.MeshBasicMaterial({color:64767,opacity:.1,depthTest:!1,transparent:!0});return new I.Mesh(n,o)}}class no{constructor(t,e){f(this,"originObject3D");f(this,"hooks");f(this,"disposers",[]);f(this,"helperObject3D");f(this,"camera");f(this,"model");f(this,"scene");f(this,"container");f(this,"domEvents");f(this,"isDragging",!1);f(this,"enabled",!1);f(this,"name","BaseController");f(this,"boundingBox");f(this,"offset");f(this,"onRender");f(this,"onWantsTapGesture",t=>{if(this.getIntersectObject(t))return!1});var c,d;this.hooks=(c=t.sharedHooks)!=null?c:new li,this.camera=t.camera,this.model=t.model,this.originObject3D=t.originObject3D,this.helperObject3D=t.helperObject3D,this.container=t.container,this.scene=t.scene,this.domEvents=new Me(t.camera,t.container),this.onRender=(d=t.onRender)!=null?d:()=>{},this.offset=e==null?void 0:e.offset,this.initialHelperPosition(),this.initialHelperQuaternion(),this.enable();const n=(...h)=>this.onSetOriginObjectScale(...h),o=(...h)=>this.onSetOriginObjectRotate(...h),s=(...h)=>this.onSetOriginObjectPosition(...h),r=(...h)=>this.onApplyOriginObjectScale(...h),a=(...h)=>this.onApplyOriginObjectRotate(...h),l=(...h)=>this.onApplyOriginObjectPosition(...h);this.hooks.on("setObjectScale",n),this.hooks.on("setObjectRotate",o),this.hooks.on("setObjectPosition",s),this.hooks.on("applyObjectPosition",l),this.hooks.on("applyObjectRotate",a),this.hooks.on("applyObjectScale",r),this.disposers.push(()=>{this.hooks.off("setObjectScale",n),this.hooks.off("setObjectRotate",o),this.hooks.off("setObjectPosition",s),this.hooks.off("applyObjectPosition",l),this.hooks.off("applyObjectRotate",a),this.hooks.off("applyObjectScale",r)})}initialHelperPosition(){this.helperObject3D.position.add(this.calculateOffset(this.offset)),this.helperObject3D.initialPosition()}initialHelperQuaternion(){this.helperObject3D.initQuaternion()}enable(){this.enabled||(this.enabled=!0,this.scene.add(this.helperObject3D),this.helperObject3D.enable(),this.render())}disable(){this.enabled&&(this.enabled=!1,this.helperObject3D.disable(),this.render())}show(){this.helperObject3D.show(),this.render()}hide(){this.helperObject3D.hide(),this.render()}dispose(){var t;(t=this.disposers)==null||t.forEach(e=>e==null?void 0:e()),this.helperObject3D.dispose(),this.render()}applyHelperMatrix4(t){this.helperObject3D.applyMatrix4(t)}applyHelperQuaternion(t,e){this.helperObject3D.applyHelperQuaternion(t,e)}applyHelperScaleMatrix4(t,e){this.helperObject3D.applyHelperScaleMatrix4(t,e)}onWantsGesture(t,e,n){if(this.isDragging)return!1}onIntersectionOnModelUpdate(t){}onApplyOriginObjectScale(t){this.applyHelperScaleMatrix4(t.matrix,t.origin)}onApplyOriginObjectRotate(t){this.applyHelperQuaternion(t.quaternion,t.origin)}onApplyOriginObjectPosition(t){this.applyHelperMatrix4(t.matrix)}onSetOriginObjectScale(t){this.helperObject3D.scale.copy(t),this.updateOffsetByScale(t)}onSetOriginObjectRotate(t,e){this.helperObject3D.setHelperQuaternion(t,e)}onSetOriginObjectPosition(t){this.helperObject3D.position.copy(t.clone().add(this.calculateOffset(this.offset)))}render(){this.onRender()}updateOffsetByScale(t){if(this.boundingBox&&this.offset){const e=this.originObject3D.position,n=new I.Vector3().subVectors(this.boundingBox.max,e).multiply(t).add(e),o=new I.Vector3().subVectors(this.boundingBox.min,e).multiply(t).add(e),s=this.calculateOffset(this.offset,{min:o,max:n});this.helperObject3D.position.copy(s),this.helperObject3D.initialPosition()}}hoverListener(t,e=16777215,n=1){const o=(Array.isArray(t)?t:[t]).filter(ci),s=[];for(const r of o)if(r instanceof I.Mesh||r instanceof I.Group){const a=r instanceof I.Group?r.children.filter(u=>u instanceof I.Mesh):[r];a.forEach(u=>{u.__originalColor__=u.material.color.clone(),u.__originalOpacity__=u.material.opacity});const l=()=>{a.forEach(u=>{u.material.color.set(e),u.material.opacity=n}),this.render()},c=()=>{a.forEach(u=>{u.material.color.copy(u.__originalColor__),u.material.opacity=u.__originalOpacity__}),this.render()},d=()=>{this.isDragging||l()},h=()=>{this.isDragging||c()};for(const u of a)this.domEvents.addEventListener(u,"mouseover",d),this.domEvents.addEventListener(u,"mouseout",h),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",c),this.hooks.on("rotateEnd",c),s.push(()=>{this.domEvents.removeEventListener(u,"mouseover",d),this.domEvents.removeEventListener(u,"mouseout",h),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",c),this.hooks.off("rotateEnd",c)})}return()=>s.forEach(r=>r==null?void 0:r())}getIntersectObject(t){const e=this.camera.position,n=this.helperObject3D;if(!n)return;const o=this.helperObject3D.raycasterIntersectObject(t)[0];if(!o)return;const s=o;if(s.object=n,this.model.intersectRaycaster){const r=this.model.intersectRaycaster(t)[0];if(r&&r.point.distanceTo(e)<s.point.distanceTo(e))return}return s.object}calculateOffset(t,e){const n=this.originObject3D,o=new I.Vector3(0,0,0);if(!t)return o;const s=()=>e||(this.boundingBox?this.boundingBox:(this.boundingBox=gu(n),this.boundingBox));if(typeof t.x=="number")o.setX(t.x);else if(typeof t.x=="object"){const r=s();o.setX((r.max.x-r.min.x)*t.x.percents)}if(typeof t.y=="number")o.setY(t.y);else if(typeof t.y=="object"){const r=s();o.setY((r.max.y-r.min.y)*t.y.percents)}if(typeof t.z=="number")o.setZ(t.z);else if(typeof t.z=="object"){const r=s();o.setZ((r.max.z-r.min.z)*t.z.percents)}return o}}class GC extends no{constructor(...e){super(...e);f(this,"name","MoveController");f(this,"startInfo");f(this,"_moveByMouseEnable",!1);f(this,"mouseInfo");f(this,"mousedownEventListenerDisposer");const n=this.helperObject3D;this.hoverListener([n.xArrow,n.yArrow,n.zArrow]);const o=this.dragStart.bind(this),s=this.dragging.bind(this),r=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",o),document.addEventListener("mousemove",s),document.addEventListener("mouseup",r),this.hooks.on("rotateStart",l),this.hooks.on("rotateEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",o),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",r),this.hooks.off("rotateStart",l),this.hooks.off("rotateEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)}),this.moveByMouseEnable&&this.moveByMouse()}get moveByMouseEnable(){return this._moveByMouseEnable}dispose(){var e;super.dispose(),(e=this.disposers)==null||e.forEach(n=>n==null?void 0:n())}moveByMouse(){this._moveByMouseEnable=!0;const e=this.handleMouseDown.bind(this),n=this.handleMouseUp.bind(this);this.hooks.emit("moveByMouseEnable"),setTimeout(()=>{this.container.addEventListener("mousedown",e),this.container.addEventListener("mouseup",n)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener("mousedown",e),this.container.removeEventListener("mouseup",n)}}disableMoveByMouse(){var e;this._moveByMouseEnable=!1,this.hooks.emit("moveByMouseDisable"),(e=this.mousedownEventListenerDisposer)==null||e.call(this)}onIntersectionOnModelUpdate(e){!this.moveByMouseEnable||this.hooks.emit("wantToMove",e.point)||(this.originObject3D.position.copy(e.point),this.hooks.emit("setObjectPosition",e.point),this.hooks.emit("move",e.point))}onApplyOriginObjectScale(e){}handleMouseDown(e){const{x:n,y:o}=e;this.mouseInfo={x:n,y:o,mouseDownTimestamp:Date.now()}}handleMouseUp(e){if(!this.mouseInfo)return;const{x:n,y:o}=e;this.mouseInfo.x===n&&this.mouseInfo.y===o&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}dragStart(e){if(this._moveByMouseEnable||this.isDragging)return;const n=e==null?void 0:e.intersect;if(!n)return this.dragEnd();const o=(n==null?void 0:n.object).direction;if(!o)return this.dragEnd();const s=new I.Vector3(1,0,0).applyQuaternion(this.helperObject3D.quaternion),r=new I.Vector3(0,1,0).applyQuaternion(this.helperObject3D.quaternion),a=new I.Vector3(0,0,1).applyQuaternion(this.helperObject3D.quaternion),l=(()=>{switch(o){case"x":return s;case"y":return r;case"z":return a}})(),c=(()=>{switch(o){case"x":case"y":return a;case"z":return s}})(),d=n.point.clone(),h=new I.Plane;h.setFromNormalAndCoplanarPoint(c,d),this.startInfo={startVectorProject:d.clone().projectOnVector(l),directionVector:l,plane:h},this.helperObject3D.showDraggingHelper([o]),this.hooks.emit("moveStart"),this.isDragging=!0}dragging(e){if(!this.isDragging||!this.startInfo)return;const n=Ia(this.camera,e,this.container);return n?(this.move(n),!1):this.dragEnd()}move(e){if(!this.startInfo)return this.dragEnd();const{plane:n,directionVector:o,startVectorProject:s}=this.startInfo,r=this.originObject3D,a=e.ray.intersectPlane(n,new I.Vector3);if(!a)return;const l=a.clone().projectOnVector(o),c=l.clone().sub(s),d=new I.Matrix4;d.setPosition(c);const h=r.position.clone().applyMatrix4(d);this.hooks.emit("wantToMove",h)||(r.applyMatrix4(d),s.copy(l),this.hooks.emit("applyObjectPosition",{matrix:d}),this.hooks.emit("move",h))}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("moveEnd"))}}class Oi{constructor(t,e,n,o,s,r){f(this,"helperController");f(this,"five");f(this,"onFiveWantsTapGesture",t=>{if(!this.helperController)return;const e=this.helperController.onWantsTapGesture(t);return this.five.needsRender=!0,e});f(this,"onFiveWantsGesture",(...t)=>{if(!this.helperController)return;const e=this.helperController.onWantsGesture(...t);return this.five.needsRender=!0,e});f(this,"onFiveIntersectionOnModelUpdate",(...t)=>{this.helperController&&this.helperController.onIntersectionOnModelUpdate(...t)});const{camera:a,model:l,scene:c}=t,d=t.getElement();if(this.five=t,!a||!l||!d||!c)return;const h=()=>{t.needsRender=!0};this.helperController=new e({camera:a,model:l,originObject3D:n,helperObject3D:o,container:d,scene:c,onRender:h,sharedHooks:r},s),t.on("wantsTapGesture",this.onFiveWantsTapGesture),t.on("wantsGesture",this.onFiveWantsGesture),t.on("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate)}dispose(){var t;this.five.off("wantsTapGesture",this.onFiveWantsTapGesture),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),(t=this.helperController)==null||t.dispose()}}const FC="v1.0.1",WC="Object3DHelper",ka=`${WC}@${FC}`,NC=()=>{console.error(`${ka} is disposed`)},XC=()=>{console.warn(`${ka} is disabled`)},YC=()=>{console.error(`${ka} is disabled`)};class UC{constructor(t){f(this,"controllers",{});f(this,"state",{visible:!0,enabled:!0,disposed:!1});f(this,"hooks",new li);f(this,"eventListener",{});t&&this.addControllers(t),this.setState(this.state)}show(t){return Y(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return Y(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.setState({disposed:!0})}setState(t,e){if(this.state.disposed)return NC();if(!this.state.enabled&&t.enabled!==!0&&t.disposed!==!0)return YC();const n=F({},this.state);this.state=F(F({},this.state),t),t.disposed!==void 0&&t.disposed!==n.disposed&&t.disposed&&this.handleDispose(),t.visible!==void 0&&this.handleVisible(t.visible),t.enabled!==void 0&&this.handleEnable(t.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:n})}addControllers(t){this.controllers=F(F({},this.controllers),t),this.setState(this.state)}getCurrentState(){return this.state}handleEnable(t,e=!0){t?(this.everyControllerDo(n=>{n.enable()}),this.hooks.emit("enable",{userAction:e})):(this.everyControllerDo(n=>{n.disable()}),this.hooks.emit("disable",{userAction:e})),this.state.enabled=t}handleVisible(t,e=!0){t?(this.everyControllerDo(n=>{n.show()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:e}))):(this.everyControllerDo(n=>{n.hide()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:e}))),this.state.visible=t}everyControllerDo(t){Object.values(this.controllers).forEach(e=>{e&&t(e)})}handleDispose(){var t,e;Object.values(this.controllers).forEach(n=>{n==null||n.dispose()});for(const n in this.controllers){if(!n)continue;const o=n;(e=(t=this.eventListener)[o])==null||e.call(t)}}actionIfStateIsEnabled(t,e){if(this.state.enabled)return t();e!=null&&e.warnLog&&XC()}}function Lr(i){return i*Math.PI/180}class qC extends no{constructor(...e){var c,d,h;super(...e);f(this,"name","RotateController");f(this,"startInfo");f(this,"removeListener");const n=this.helperObject3D;this.hoverListener([(c=n.xCircle)==null?void 0:c.circle,(d=n.yCircle)==null?void 0:d.circle,(h=n.zCircle)==null?void 0:h.circle].filter(Boolean));const o=this.dragStart.bind(this),s=this.dragging.bind(this),r=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",o),document.addEventListener("mousemove",s),document.addEventListener("mouseup",r),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.removeListener=()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",o),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",r),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)}}get rotateCenter(){return this.helperObject3D.position.clone()}initialHelperQuaternion(){this.helperObject3D.applyHelperQuaternion(this.originObject3D.quaternion)}setRotateAngle(e){const{x:n=0,y:o=0,z:s=0}=e,r=new I.Euler(Lr(n),Lr(o),Lr(s)),a=new I.Quaternion().setFromEuler(r);if(this.hooks.emit("wantToRotate",a))return;const{originObject3D:c,rotateCenter:d}=this;mu(c,a,d),this.hooks.emit("setObjectRotate",a,d),this.hooks.emit("rotate",a),this.render()}dispose(){this.removeListener(),super.dispose()}onApplyOriginObjectRotate(e){this.isDragging||super.onApplyOriginObjectRotate(e)}onApplyOriginObjectScale(e){}dragStart(e){if(this.isDragging)return;const n=e==null?void 0:e.intersect;if(!n)return this.dragEnd();const o=(n==null?void 0:n.object).direction;if(!o)return this.dragEnd();const s=n.point,r=this.getAngleHelper(o);this.setTipsAngle(0);const a=s.clone();a.y+=.2,this.setTipsPosition(a);const l=(()=>{if(o==="x")return new I.Vector3(1,0,0).applyQuaternion(this.originObject3D.quaternion);if(o==="y")return new I.Vector3(0,1,0).applyQuaternion(this.originObject3D.quaternion);if(o==="z")return new I.Vector3(0,0,1).applyQuaternion(this.originObject3D.quaternion)})(),c=new I.Plane().setFromNormalAndCoplanarPoint(l,s),h=c.projectPoint(s.clone(),new I.Vector3).clone().sub(this.rotateCenter),u=h.angleTo(r.baseAxes.clone().applyQuaternion(this.originObject3D.quaternion));this.setAngleHelperStart(o,u),this.setAngleHelperLength(o,0),this.startInfo={direction:o,startVector:h,plane:c,angleHelper:r,angle:0,objectQuaternion:this.originObject3D.quaternion.clone()},this.helperObject3D.showDraggingHelper([o]),this.hooks.emit("rotateStart"),this.isDragging=!0}dragging(e){if(!this.isDragging)return;const n=Ia(this.camera,e,this.container);return n?(this.rotate(n),!1):this.dragEnd()}rotate(e){if(!this.startInfo)return this.dragEnd();const{startVector:n,plane:o,angleHelper:s,direction:r,objectQuaternion:a}=this.startInfo,{originObject3D:l}=this,c=e.ray.intersectPlane(o,new I.Vector3);if(!c)return;const d=this.rotateCenter.clone(),u=o.projectPoint(c.clone(),new I.Vector3).clone().sub(d);if(n.angleTo(u)===0)return;const m=new I.Quaternion().setFromUnitVectors(n.clone().normalize(),u.clone().normalize()),v=l.quaternion.clone().premultiply(m);if(this.hooks.emit("wantToRotate",v))return;const b=new I.Euler().setFromQuaternion(new I.Quaternion().setFromUnitVectors(n.clone().normalize().applyQuaternion(a.clone().inverse()),u.clone().normalize().applyQuaternion(a.clone().inverse())),`${r.toUpperCase()}${"XZY".replace(r.toUpperCase(),"")}`)[r]*s.angleDirection;if(this.startInfo.angle+=b,this.setAngleHelperLength(r,this.startInfo.angle),this.setTipsAngle(lh(this.startInfo.angle)),d){const y=new I.Vector3().subVectors(l.position,d).applyQuaternion(m).add(d);l.position.copy(y)}l.applyQuaternion(m),this.hooks.emit("applyObjectRotate",{quaternion:m,origin:d}),this.hooks.emit("rotate",l.quaternion),this.startInfo.startVector=u}dragEnd(){this.isDragging&&(this.hooks.emit("setObjectRotate",this.originObject3D.quaternion,this.rotateCenter),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("rotateEnd"))}getAngleHelper(e){var n,o,s;switch(e){case"x":return(n=this.helperObject3D.xCircle)==null?void 0:n.angleSector;case"y":return(o=this.helperObject3D.yCircle)==null?void 0:o.angleSector;case"z":return(s=this.helperObject3D.zCircle)==null?void 0:s.angleSector}}setAngleHelperStart(e,n){const o=this.getAngleHelper(e);if(!o){console.warn("angleHelper is undefined");return}if(o instanceof I.Mesh&&o.geometry instanceof I.CircleGeometry){const{radius:s,segments:r,thetaLength:a}=o.geometry.parameters;o.geometry=new I.CircleGeometry(s,r,n,a)}else console.warn("only support THREE.CircleGeometry")}setAngleHelperLength(e,n){const s=n>=0?Math.max(n,.001):Math.min(n,-.001),r=this.getAngleHelper(e);if(r instanceof I.Mesh&&r.geometry instanceof I.CircleGeometry){const{radius:a,thetaStart:l}=r.geometry.parameters,c=Math.ceil(Math.abs(s)*(40/(2*Math.PI)));r.geometry=new I.CircleGeometry(a,c,l,s)}else console.warn("only support THREE.CircleGeometry")}setTipsAngle(e){var o;const n=(o=this.helperObject3D.angleTips)==null?void 0:o.element;n&&(n.innerText=`${e.toFixed(0)}°`)}setTipsPosition(e){const n=this.helperObject3D.angleTips;if(!n)return;const o=e.project(this.camera),{x:s,y:r,z:a}=o;if(a>1)return;const l=(s+1)/2*100+"%",c=(-r+1)/2*100+"%";n.setLeftTop(l,c)}}class JC extends no{constructor(...e){super(...e);f(this,"startInfo");f(this,"name","RectangleScaleController")}enable(){this.helperObject3D.enable(),super.enable()}disable(){this.helperObject3D.disable(),super.disable()}show(){this.helperObject3D.show(),super.show()}hide(){this.helperObject3D.hide(),super.hide()}onApplyOriginObjectPosition(e){this.isDragging||super.onApplyOriginObjectPosition(e)}onApplyOriginObjectScale(e){this.helperObject3D.applyHelperScaleMatrix4(e.matrix,e.origin)}getDragPlane(){const e=new I.Plane,n=this.helperObject3D.cornerPositions;if(n.length!==0)return n.length<3?e.setFromNormalAndCoplanarPoint(this.originObject3D.getWorldDirection(new R.Vector3),n[0]):e.setFromCoplanarPoints(n[0],n[1],n[2]),e}dragStart(e,n){var s,r;(r=(s=this.helperObject3D).updatePoints)==null||r.call(s);const o=this.getDragPlane();if(!o)return this.dragEnd();this.startInfo={startPoint:{position:n.position.clone(),direction:n.direction},plane:o},this.hooks.emit("scaleStart"),this.render(),this.isDragging=!0}dragging(e){if(!this.isDragging)return;const n=Ia(this.camera,e,this.container);if(!n)return this.dragEnd();this.scale(n)}scale(e){var X,J;if(!this.startInfo)return;const n=this.originObject3D,{startPoint:o,plane:s}=this.startInfo,r=this.helperObject3D.cornerPositions;if(r.length<4)return this.dragEnd();const a=e.ray.intersectPlane(s,new R.Vector3);if(!a||LC(a,this.camera.position))return;const l=new R.Vector3().addVectors(r[0],r[2]).divideScalar(2),{position:c,direction:d}=o,h=new R.Vector3().subVectors(r[1],r[0]),u=new R.Vector3().subVectors(r[3],r[0]),m=H=>{const Q=new R.Vector3(0,0,0);if(!this.startInfo)return Q;const G=(H==="ew"?h:u).clone(),B=c.clone().projectOnVector(G),W=a.clone().projectOnVector(G),q=l.clone().projectOnVector(G);if(W.equals(B))return Q;if(H==="ns"&&typeof this.startInfo.dragPointInCenterBottom!="boolean"){const re=new R.Vector3().subVectors(W,q),oe=re.x<0&&G.x>=0,Ae=re.y<0&&G.y>=0,we=re.z<0&&G.z>=0;this.startInfo.dragPointInCenterBottom=oe||Ae||we}if(H==="ew"&&typeof this.startInfo.dragPointInCenterLeft!="boolean"){const re=new R.Vector3().subVectors(W,q),oe=re.x<0&&G.x>=0,Ae=re.y<0&&G.y>=0,we=re.z<0&&G.z>=0;this.startInfo.dragPointInCenterLeft=oe||Ae||we}const U=new R.Vector3().subVectors(W,B),Z=U.length();return Z>.3?(console.warn("offset.length() > 0.3, skipped",Z),Q):U},v=m("ew"),g=m("ns"),A=()=>{const H=v;this.helperObject3D.cornerPositions.forEach((Q,G)=>{var B;(B=this.startInfo)!=null&&B.dragPointInCenterLeft?(G===0||G===3)&&Q.add(H):(G===1||G===2)&&Q.add(H)})},b=()=>{const H=g;this.helperObject3D.cornerPositions.forEach((Q,G)=>{var B;(B=this.startInfo)!=null&&B.dragPointInCenterBottom?(G===0||G===1)&&Q.add(H):(G===2||G===3)&&Q.add(H)})};switch(d){case"ew":A();break;case"ns":b();break;case"nesw":case"nwse":A(),b()}const y=new R.Vector3().subVectors(r[1],r[0]).length()/h.length(),E=new R.Vector3().subVectors(r[3],r[0]).length()/u.length(),k=new R.Vector3(y,E,1),S=new I.Matrix4().scale(k);n.isCSS3DObjectPlus?n.applyScaleMatrix4(S):n.scale.applyMatrix4(S),o.position.copy(a);const C=new R.Vector3().addVectors(r[0],r[2]).divideScalar(2),_=new R.Vector3().subVectors(C,l),M=new I.Matrix4().setPosition(_);n.applyMatrix4(M),(X=this.helperObject3D.css3DInstance)==null||X.css3DObject.applyMatrix4(M),(J=this.helperObject3D.plane)==null||J.applyMatrix4(M),this.hooks.emit("applyObjectScale",{matrix:S}),this.hooks.emit("applyObjectPosition",{matrix:M}),this.render()}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.hooks.emit("scaleEnd"),this.render())}}class ZC extends JC{constructor(...e){super(...e);f(this,"name","CSS3DScaleController");this.addHTMLEventListener()}addHTMLEventListener(){this.helperObject3D.points.forEach(e=>{if(!e)return;const n=e.point,o=a=>this.dragStart(a,e),s=this.dragging.bind(this),r=this.dragEnd.bind(this);n.addEventListener("dragstart",o),n.addEventListener("drag",s),n.addEventListener("dragend",r)})}}class KC extends no{constructor(...e){super(...e);f(this,"name","BoundingBoxController")}}class $C extends pu{constructor(t){super(t)}}class eE extends no{constructor(...e){super(...e);f(this,"name","ScaleController")}setScale(e){var l,c,d;let n=1,o=1,s=1;typeof e=="number"?(n=e,o=e,s=e):typeof e=="object"&&(n=(l=e.x)!=null?l:1,o=(c=e.y)!=null?c:1,s=(d=e.z)!=null?d:1);const r=new I.Vector3(n,o,s);this.hooks.emit("wantToScale",r)||(this.originObject3D.scale.copy(r),this.hooks.emit("setObjectScale",r),this.hooks.emit("scale",r),this.render())}}const $r="Object3DHelperPlugin",Ps=$r,tE=()=>{console.error(`${Ps} is disposed`)},nE=()=>{console.warn(`${Ps} is disabled`)},iE=()=>{console.error(`${Ps} is disabled`)};class vu extends eo{constructor(e){super(e);f(this,"name",$r);f(this,"state",{visible:!0,enabled:!0,disposed:!1});f(this,"objectHelperMap",new Map);f(this,"css3DObjectParentMap",new Map);f(this,"css3DRender");this.five=e,this.css3DRender=new ti(this.five.scene),console.warn("Object3DHelper: 使用此插件,需要在初始化five时,设置five参数: { backgroundAlpha: 0, backgroundColor: 0x000000 }"),Object.assign(window,{[`__${$r.toUpperCase()}_DEBUG__`]:this})}show(e){return Y(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return Y(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,n){if(this.state.disposed)return tE();if(!this.state.enabled&&e.enabled!==!0&&e.disposed!==!0)return iE();const o=F({},this.state);this.state=F(F({},this.state),e),e.disposed!==void 0&&e.disposed!==o.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:o})}getObject3DHelper(e){return this.objectHelperMap.get(e)}addObject3DHelper(e,n={}){var m;if(!e)return console.error("Object3D is undefined");if(this.objectHelperMap.has(e)){console.warn(`Object3DHelperPlugin: object3D ${e.name} is already has helper`);return}const o=new UC,s=[],r=(m=this.five.getElement())==null?void 0:m.parentElement,a=this.five.camera,{moveHelper:l=!0,rotateHelper:c=!0,scaleHelper:d=!0,boundingBoxHelper:h=!1}=n,u=new ze.Subscribe;if(l){const v=new TC(e),g=this.getConfig(n.moveHelper),A=new Oi(this.five,GC,e,v,g,u);o.addControllers({moveController:A.helperController}),s.push(()=>A.dispose())}if(c){const v=this.getConfig(n.rotateHelper),g=new VC(e,F({container:r},v)),A=new Oi(this.five,qC,e,g,v,u);o.addControllers({rotateController:A.helperController}),s.push(()=>A.dispose())}if(h){const v=new HC(e),g=new Oi(this.five,KC,e,v,void 0,u);o.addControllers({boundingBoxController:g.helperController})}if(d)if(e.isCSS3DObjectPlus&&r){const v=new QC(e,r,a,this.five.scene),g=new Oi(this.five,ZC,e,v,void 0,u);o.addControllers({scaleController:g.helperController}),s.push(()=>g.dispose()),xd(this.five).then(()=>{var A,b;if(e.isCSS3DObjectPlus){const y=e;if(!y||y.mode!=="front")return;const E=(A=this.css3DRender.behindModeCSS3DRenderer.wrapper)!=null?A:Dd(this.five);E&&(this.css3DObjectParentMap.set(y,y.parent),y.removeFromParent(),this.css3DRender.behindModeCSS3DRenderer.setWrapper(E),(b=this.css3DRender.getBehindCSS3DObjectGroup())==null||b.add(y),this.css3DRender.render(this.five.camera))}})}else{const v=new $C(e),g=new Oi(this.five,eE,e,v,void 0,u);o.addControllers({scaleController:g.helperController}),s.push(()=>g.dispose())}return this.objectHelperMap.set(e,{helper:o,disposers:s}),o.controllers}removeObject3DHelper(e){if(!this.objectHelperMap.has(e))return;const{helper:n,disposers:o}=this.objectHelperMap.get(e);if(n){if(e.isCSS3DObjectPlus){const s=e,r=this.css3DObjectParentMap.get(s);r&&r.add(s),this.css3DRender.render(this.five.camera)}this.objectHelperMap.delete(e),n.dispose(),o==null||o.forEach(s=>s==null?void 0:s())}}handleEnable(e,n=!0){e?(this.everyHelperDo(o=>o.enable()),this.hooks.emit("enable",{userAction:n})):(this.everyHelperDo(o=>o.disable()),this.hooks.emit("disable",{userAction:n})),this.state.enabled=e}handleVisible(e,n=!0){e?(this.everyHelperDo(o=>o.show()),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:n}))):(this.everyHelperDo(o=>o.hide()),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:n}))),this.state.visible=e}handleDispose(){this.objectHelperMap.forEach(({helper:e,disposers:n})=>{e.dispose(),n==null||n.forEach(o=>o==null?void 0:o())})}everyHelperDo(e){this.objectHelperMap.forEach(({helper:n,disposers:o})=>{n&&e(n)})}actionIfStateIsEnabled(e,n){if(this.state.enabled)return e();n!=null&&n.warnLog&&nE()}getConfig(e){if(e&&typeof e!="boolean"&&e.enable)return e}}const oE=i=>new vu(i),sE=`
668
+ `;class Zr{constructor(t,e){f(this,"name","");f(this,"startTagContainer");f(this,"endTagContainer");f(this,"mesh");f(this,"five");f(this,"mode");f(this,"path",[]);f(this,"_curvePath",null);f(this,"_curvePoints",null);f(this,"_panoGroup",[]);f(this,"skippedPositions",null);f(this,"textureUrl","");f(this,"scale",1);f(this,"width",.5);f(this,"unitLength",.5);f(this,"_visibleFloorIndexes",null);f(this,"visible",null);f(this,"modeVisible",!1);f(this,"floorVisible",!0);f(this,"defaultVisible",!1);f(this,"inWalkAnimation",!1);f(this,"customVisible",null);f(this,"parent");f(this,"plugin");f(this,"textureHasLoaded",!1);f(this,"disposed",!1);f(this,"flowAnime",new os({progress:0}).to({progress:1}).duration(1500).repeat(1/0));f(this,"flickerAnime",ss(300).yoyo(!0).repeat(5));f(this,"cacheLengths",[]);f(this,"dispose",()=>{var t,e;this.disposed||(this.disposed=!0,this.parent.hooks.off("show",this.updateVisible),this.parent.hooks.off("hide",this.updateVisible),this.plugin.hooks.off("show",this.updateVisible),this.plugin.hooks.off("hide",this.updateVisible),this.plugin.hooks.off("enable",this.updateVisible),this.plugin.hooks.off("disable",this.updateVisible),this.five.off("modeChange",this.onFiveModeChange),this.five.off("modelShownFloorChange",this.onFiveModelShownFloorChange),this.doHide(),(t=this.startTagContainer)==null||t.plugin.dispose(),(e=this.endTagContainer)==null||e.plugin.dispose())});f(this,"onWalkAnimationStart",()=>{this.inWalkAnimation=!0,this.updateVisible()});f(this,"onWalkAnimationEnd",()=>{this.inWalkAnimation=!1,this.updateVisible()});f(this,"onFiveModeChange",t=>{this.modeVisible=this.mode==="panorama"?ta(t):Md(t),this.updateVisible()});f(this,"onFiveModelShownFloorChange",t=>{this.floorVisible=t===null||this.visibleFloorIndexes===null||this.visibleFloorIndexes.includes(t),this.updateVisible()});f(this,"updateVisible",()=>{const t=(()=>!this.parent.visible||!this.plugin.state.enabled||!this.plugin.state.visible?!1:this.customVisible!==null?this.customVisible:this.inWalkAnimation?!0:this.modeVisible&&this.textureHasLoaded&&this.defaultVisible&&this.floorVisible)();this.visible!==t&&(this.visible=t,t?this.doShow():this.doHide())});f(this,"onFlowAnimeUpdate",t=>{const{progress:e}=t;this.mesh.material.uniforms.vOffset.value=e,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0});f(this,"onFlickerAnimeUpdate",t=>{var o,s;const{progress:e}=t,n=1-e;this.mesh.material.uniforms.flicker.value=n,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0,this.startTagContainer.tag&&kr(this.startTagContainer.tag)&&((o=this.startTagContainer.app)==null||o.$set(ye(F({},this.startTagContainer.tag.data),{opacity:n,name:this.name,distance:Math.round(this.curvePath.getLength())}))),this.endTagContainer.tag&&kr(this.endTagContainer.tag)&&((s=this.endTagContainer.app)==null||s.$set(ye(F({},this.endTagContainer.tag.data),{opacity:n})))});f(this,"logWarning",t=>aA("GuideLineModeItem: ",t));f(this,"logError",t=>Sh("GuideLineModeItem: ",t));var s,r;this.five=t,this.mode=e.mode,this.plugin=e.plugin,this.parent=e.parent,this.startTagContainer={tag:null,plugin:new ns(this.five)},this.endTagContainer={tag:null,plugin:new ns(this.five)};const n=new I.BufferGeometry,o=new I.ShaderMaterial({vertexShader:lC,fragmentShader:cC,transparent:!0,uniforms:{map:{value:null},useMapColor:{value:0},mapColor:{value:new I.Color},mapOpacity:{value:1},backgroundColor:{value:new I.Color},backgroundOpacity:{value:0},borderColor:{value:new I.Color},borderOpacity:{value:0},opacity:{value:1},flicker:{value:1},maxU:{value:0},vOffset:{value:0}}});this.mesh=new I.Mesh(n,o),this.mesh.name="GuideLineModeItem",this.mode==="panorama"&&(this.parent.hooks.on("walkStart",this.onWalkAnimationStart),this.parent.hooks.on("walkEnded",this.onWalkAnimationEnd)),this.updateVisible(),this.onFiveModeChange(this.five.getCurrentState().mode),this.onFiveModelShownFloorChange((r=(s=this.five.model)==null?void 0:s.shownFloor)!=null?r:null),this.flowAnime.onUpdate(this.onFlowAnimeUpdate),this.flickerAnime.onUpdate(this.onFlickerAnimeUpdate),this.parent.hooks.on("show",this.updateVisible),this.parent.hooks.on("hide",this.updateVisible),this.plugin.hooks.on("show",this.updateVisible),this.plugin.hooks.on("hide",this.updateVisible),this.plugin.hooks.on("enable",this.updateVisible),this.plugin.hooks.on("disable",this.updateVisible),this.plugin.hooks.on("dispose",this.dispose),this.five.on("modeChange",this.onFiveModeChange),this.five.on("modelShownFloorChange",this.onFiveModelShownFloorChange)}get panoGroup(){return this._panoGroup}get visibleFloorIndexes(){return this._visibleFloorIndexes}get curvePath(){return this._curvePath}get curvePoints(){return this._curvePoints}setCustomVisible(t){if(this.disposed)return this.logError("disposed");this.customVisible!==t&&(this.customVisible=t,this.updateVisible())}setDefaultVisible(t){if(this.disposed)return this.logError("disposed");this.defaultVisible!==t&&(this.defaultVisible=t,this.updateVisible())}setUnitSize(t,e){if(this.disposed)return this.logError("disposed");this.width=t,this.unitLength=e,this.setGeometryByPath(this.path,{width:t,unit_length:e})}setScale(t){if(this.disposed)return this.logError("disposed");this.scale=t,this.setGeometryByPath(this.path,{scale:t})}setGeometryByPanoGroup(t,e){if(this.disposed)return this.logError("disposed");if(!this.five.work)return this.logError("setPathByPanoGroup: work is not ready");const n=aC(t);if(this._panoGroup=n,(e==null?void 0:e.skipPanoGroup)!==void 0){const s=e.skipPanoGroup?n.map(r=>this.five.work.observers[r]).map(r=>r.standingPosition.clone()):null;this.skippedPositions=s}const o=this.getPathFromPanoGroup(n,this.five.work,e);this.path=o,this.setGeometryByPath(o,e)}setGeometryByPath(t,e){var d,h,u;if(this.disposed)return this.logError("disposed");const n=(d=e==null?void 0:e.scale)!=null?d:this.scale,o=(h=e==null?void 0:e.width)!=null?h:this.width,s=(u=e==null?void 0:e.unit_length)!=null?u:this.unitLength;this.path=t,this.scale=n,this.width=o,this.unitLength=s;const{geometry:r,maxU:a,curvePath:l,curvePoints:c}=kA({path:t,width:o*n,unitLength:s*n,skipPositions:this.skippedPositions});this._curvePath=l,this._curvePoints=c,this.mesh.geometry=r,this.mesh.material.needsUpdate=!0,this.mesh.material.uniforms.maxU.value=a,this.five.needsRender=!0}setMartial(t){var e;if(this.disposed)return this.logError("disposed");(t==null?void 0:t.visible)!==void 0&&this.setDefaultVisible(t.visible),(t==null?void 0:t.color)!==void 0&&this.setColor(t.color),(t==null?void 0:t.opacity)!==void 0&&this.setOpacity(t.opacity),((e=t==null?void 0:t.texture)==null?void 0:e.url)!==void 0&&this.setTextureUrl(t.texture.url),(t==null?void 0:t.background_color)!==void 0&&this.setBackgroundColor(t.background_color),(t==null?void 0:t.background_opacity)!==void 0&&this.setBackgroundOpacity(t.background_opacity),(t==null?void 0:t.border_color)!==void 0&&this.setBorderColor(t.border_color),(t==null?void 0:t.border_opacity)!==void 0&&this.setBorderOpacity(t.border_opacity)}setColor(t){if(this.disposed)return this.logError("disposed");t&&(this.mesh.material.uniforms.mapColor.value=new I.Color().set(t)),this.mesh.material.uniforms.useMapColor.value=t?1:0,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderColor(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.borderColor.value=new I.Color().set(t),this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderOpacity(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.borderOpacity.value=t,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundColor(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.backgroundColor.value=new I.Color().set(t),this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundOpacity(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.backgroundOpacity.value=t,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setOpacity(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.opacity.value=t,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setMapOpacity(t){if(this.disposed)return this.logError("disposed");this.mesh.material.uniforms.mapOpacity.value=t,this.mesh.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setTextureUrl(t){if(this.disposed)return this.logError("disposed");this.textureUrl=t,Ui(t).then(e=>{this.disposed||this.textureUrl===t&&(e.wrapT=I.RepeatWrapping,this.textureHasLoaded=!0,this.mesh.material.uniforms.map.value=e,this.mesh.material.uniformsNeedUpdate=!0,this.mesh.material.needsUpdate=!0,this.five.needsRender=!0,this.updateVisible())})}setVisibleFloorIndexes(t){var e,n;if(this.disposed)return this.logError("disposed");this._visibleFloorIndexes=t,this.onFiveModelShownFloorChange((n=(e=this.five.model)==null?void 0:e.shownFloor)!=null?n:null)}setStartTag(t){this.setTag("start",t)}setEndTag(t){this.setTag("end",t)}flicker(){if(this.disposed)return this.logError("disposed");this.flickerAnime.play()}getLengthByPanoGroupIndex(t){return this.disposed?this.logError("disposed"):this.cacheLengths.length!==0?this.cacheLengths[t]:(this.cacheLengths=this.getPanoGroupLengths(),this.cacheLengths[t])}getPanoGroupLengths(){const t=this.panoGroup.map(c=>this.five.work.observers[c]),e=this.curvePoints.length,n=this.curvePath.getLength(),o=e-1,s=n/o,r=this.curvePath.getLengths(o),a=[];let l=0;for(let c=0;c<e;c++){const d=this.curvePoints[c],h=t[l];if(!h)break;h.standingPosition.clone().setY(0).distanceTo(d.clone().setY(0))<s&&(a.push(r[c]),l+=1)}return a}setTag(t,e){const n=t==="start"?this.startTagContainer:this.endTagContainer;e||n.plugin.clearTags();const s=Ye({},{contentType:"Custom",stickType:"2DPoint",config:{visibleConfig:{visibleFiveMode:["Floorplan","Mapview"],followModelVisibility:!1}},style:{point:{enabled:!1}},data:{}},e);n.tag=s,kr(s)&&(n.tag.element=r=>{var c;(c=n.app)==null||c.$destroy();const a=t==="start"?ye(F({},s.data),{name:this.name,distance:Math.round(this.curvePath.getLength()),i18n:this.plugin.config.i18n}):s.data,l=new rC({target:r,intro:!0,props:a});return n.app=l,()=>l.$destroy()}),n.plugin.load({tagList:[n.tag]})}doShow(){this.mode==="model"&&this.flowAnime.play(),this.five.scene.add(this.mesh),this.startTagContainer.plugin.show(),this.endTagContainer.plugin.show(),this.five.needsRender=!0}doHide(){this.mode==="model"&&this.flowAnime.stop(),this.five.scene.remove(this.mesh),this.startTagContainer.plugin.hide(),this.endTagContainer.plugin.hide(),this.five.needsRender=!0}getPathFromPanoGroup(t,e,n){if(t.length<2)return[];const s=t.map(r=>e.observers[r]).map(r=>r.standingPosition.toArray());return[F({type:"CatmullRomCurve3",points:s},n)]}}function kr(i){return i.contentType==="Custom"}const dC=Object.freeze(Object.defineProperty({__proto__:null,GuideLineModeItem:Zr},Symbol.toStringTag,{value:"Module"}));function pd(i){const t=Math.abs(Math.cos(i.latitude));return new I.Vector3(-Math.sin(i.longitude)*t,-Math.sin(i.latitude),-Math.cos(i.longitude)*t)}function hC(i,t){const e=pd(i),n=pd(t);return e.angleTo(n)}const uC=i=>Y(exports,null,function*(){try{i().then(()=>{},()=>{}).catch(()=>{})}catch(t){}}),Vo=Math.PI*2;function fC(i){return i>=0&&i<Vo?i:(i%Vo+Vo)%Vo}function mC(i){return{longitude:fC(-Math.atan2(i.x,-i.z)),latitude:-Math.asin(i.y/1)}}function pC(i,t,e,n){const o=-i/e,s=i;return o*n+s}function gC(i){return new Promise(t=>{setTimeout(()=>{t()},i)})}const cu="v1.0.6",du="CruisePlugin",ys=`${du}@${cu}`,gd=()=>{console.error(`${ys} is disposed`)},vC=()=>{console.warn(`${ys} is disabled`)},AC=()=>{console.error(`${ys} is disabled`)},xr=new Map;class to extends Mn{constructor(e,n){super(e,n);f(this,"state",{visible:!0,enabled:!0,disposed:!1,playing:!1,speed:1,config:{speedConfig:{rotateSpeed:.001,rotateSpeedUnit:"rad/ms",moveSpeed:.002,moveSpeedUnit:"m/ms"}}});f(this,"data");f(this,"config");f(this,"privateState",{playing:!1,currentPlayQueue:[],currentPlayKeyframe:null,broke:!1,disposers:[],modeChanging:!1});f(this,"GuideLine");this.config=n,Object.assign(window,{[`__${du}_DEBUG__`]:this});const o=this.setFiveLinearUpdateCamera.bind(this),s=this.setFiveOriginUpdateCamera.bind(this);this.hooks.on("play",o),this.hooks.on("broke",s),this.hooks.on("end",s),this.hooks.on("pause",s),this.privateState.disposers.push(()=>{this.hooks.off("play",o),this.hooks.off("broke",s),this.hooks.off("end",s),this.hooks.off("pause",s)})}load(e,n,o){return Y(this,null,function*(){var d,h,u,m,v,g;if(this.state.disposed)return gd();this.privateState.fiveOriginGetProgress||(h=(d=this.five.controller)==null?void 0:d.cameraMotion)!=null&&h.getProgress||(yield this.waitFiveLoaded(),this.privateState.fiveOriginGetProgress=(m=(u=this.five.controller)==null?void 0:u.cameraMotion)==null?void 0:m.getProgress),this.clear();const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,r=yield this.formatData(e);this.data=r,this.hooks.emit("dataChange",r,s);let a=[],l;const c=this.data.keyframes.filter(A=>A.data.panoIndex!==void 0);c.filter((A,b)=>{var y;return A.data.panoIndex!==((y=c[b-1])==null?void 0:y.data.panoIndex)}).map(A=>A.data.panoIndex).forEach(A=>{var y,E;const b=(y=this.five.work.observers[A])==null?void 0:y.floorIndex;if(b!==void 0)if(l===b){const k=a.length-1;a[k]=[...(E=a[k])!=null?E:[],A]}else{l=b;const k=a.length;a[k]=[A]}}),!this.GuideLine&&((v=this.config)==null?void 0:v.useGuideLine)!==!1&&r.useGuildLine!==!1&&(this.GuideLine=fu(this.five,this.config)),(g=this.GuideLine)==null||g.load({routes:a.map(A=>({panoIndexList:A})),config:r.guildPluginOptions}),this.setState({playing:!1}),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),this.changePlayState(this.state.playing),this.changeSpeed(this.state.speed),n&&this.setState(n,{userAction:o}),console.debug(`${ys} loaded`,r),this.hooks.emit("dataLoaded",r)})}play(e){this.setState({playing:!0},e)}playFrom(e){const{index:n,id:o,userAction:s}=e;this.state.playing&&this.setState({playing:!1},{userAction:s}),this.setState({playing:!0},{userAction:s,playFromIndex:n,playFromId:o})}playFromStart(e){return this.playFrom(ye(F({},e),{index:0}))}pause(e){this.setState({playing:!1},e)}show(e){return Y(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return Y(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,n){var s;if(this.state.disposed)return gd();if(!this.state.enabled&&e.enabled!==!0&&e.disposed!==!0)return AC();const o=F({},this.state);this.state=F(F({},this.state),e),e.disposed!==void 0&&e.disposed!==o.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible,n==null?void 0:n.userAction),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled,n==null?void 0:n.userAction),e.playing!==void 0&&e.playing!==o.playing&&this.changePlayState(e.playing,n),e.speed!==void 0&&e.speed!==o.speed&&this.changeSpeed(e.speed,n==null?void 0:n.userAction),jt(o,this.state,{deep:!0})||this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:(s=n==null?void 0:n.userAction)!=null?s:!0})}formatData(e){return Y(this,null,function*(){this.five.work||(yield this.waitFiveLoaded());const n=this.five.work.observers,o=(()=>{const s=e;return typeof s=="object"&&s!==null&&s.version&&s.data?s.data:s})();if(o.keyframes)return{keyframesId:dt(),keyframes:o.keyframes.map((s,r)=>{var c;const a=o.keyframes[r+1],l=(()=>!a||a.start===void 0||s.end===void 0?0:a.start-s.end)();return ye(F({id:(c=s.uuid)!=null?c:dt(),moveIndex:r,stay:l,index:r},s),{guildPluginOptions:o.guildPluginOptions})})};if(o.panoIndexList){let s=[];const{moveEffect:r,moveToFirstPanoEffect:a,moveToFirstPanoDuration:l}=o;return this.privateState.moveToFirstPanoEffect=a,this.privateState.moveToFirstPanoDuration=l,o.panoIndexList.forEach((c,d)=>{const h=(()=>{var A,b,y,E;const u=o.panoIndexList.slice(d).find(k=>k!==c);if(u===void 0)return;const m=(A=n[c])==null?void 0:A.position,v=(b=n[u])==null?void 0:b.position;if(!v||!m||((y=n[c])==null?void 0:y.floorIndex)!==((E=n[u])==null?void 0:E.floorIndex))return;const g=new I.Vector3().subVectors(v,m);return mC(g.normalize())})();o.moveType===void 0||o.moveType==="justMove"?s.push({moveIndex:d,stay:o.stay,data:F({effect:"Move",panoIndex:c,moveEffect:r},h!=null?h:{})}):o.moveType==="moveAndRotate"&&(s.push({moveIndex:d,stay:o.stay,data:{effect:"Move",panoIndex:c,moveEffect:r}}),h&&s.push({moveIndex:d,stay:o.stay,data:F({effect:"Rotate",panoIndex:c},h)}))}),{keyframesId:dt(),keyframes:s.map((c,d)=>F({id:dt(),index:d},c)),guildPluginOptions:o.guildPluginOptions,useGuildLine:o.useGuildLine}}else throw new Error("format error: data no keyframes or no panoIndexList")})}handleEnable(e,n=!0){var o,s;e?((o=this.GuideLine)==null||o.enable(),this.hooks.emit("enable",{userAction:n})):((s=this.GuideLine)==null||s.disable(),this.changePlayState(!1,{userAction:n}),this.hooks.emit("disable",{userAction:n})),this.state.enabled=e}handleVisible(e,n=!0){var o,s;e?((o=this.GuideLine)==null||o.show(),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:n}))):((s=this.GuideLine)==null||s.hide(),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:n}))),this.state.visible=e}changePlayState(e,n){this.actionIfStateIsEnabled(()=>{var o;return this.hooks.emit("playStateChange",e?"playing":"pause",{userAction:(o=n==null?void 0:n.userAction)!=null?o:!0})}),e?this.handlePlay(n):this.handlePause(n),this.state.playing=e}handlePlay(e){return Y(this,null,function*(){var m;const{data:n,state:o,privateState:s,hooks:r}=this;if(s.playing||!(n!=null&&n.keyframes)||(n==null?void 0:n.keyframes.length)===0)return;const a=dt();s.playId=a,s.playing=!0,s.broke=!1;const l=n.keyframes,c=this.getPauseData();(e==null?void 0:e.notEmitEvent)!==!0&&r.emit("play",{userAction:(m=e==null?void 0:e.userAction)!=null?m:!0});let d=!1;const u=yield(()=>Y(this,null,function*(){var v,g;if((e==null?void 0:e.playFromIndex)!==void 0)return e.playFromIndex;if((e==null?void 0:e.playFromId)!==void 0)return(v=this.data)==null?void 0:v.keyframes.findIndex(A=>A.id===e.playFromId);if(c!=null&&c.keyframeId){const A=(g=this.data)==null?void 0:g.keyframes.find(b=>b.id===c.keyframeId);if(c!=null&&c.fiveState&&(yield this.move(c.fiveState,{moveEffect:s.moveToFirstPanoEffect,duration:s.moveToFirstPanoDuration})),A){if(A.data.effect==="Move")return A.index;if(A.data.effect==="Rotate"){const b=c.duration!==void 0?c.duration*(1-c.playedProgress):void 0;return yield this.playKeyframe(A,{duration:b}),d=!0,A.index+1}}}}))();this.clearPauseData();for(const v of l){if(s.broke||!o.playing||!s.playing||a!==s.playId)return;if(!(u!==void 0&&v.index<u))try{r.emit("playIndexChange",v.index,v),yield this.playKeyframe(v,{moveEffect:d===!1?s.moveToFirstPanoEffect:void 0,duration:d===!1&&typeof s.moveToFirstPanoDuration=="number"?s.moveToFirstPanoDuration:void 0}),v.stay&&(yield gC(v.stay)),d===!1&&(d=!0)}catch(g){return Promise.resolve("broke")}}o.playing&&a===s.playId&&(this.setState({playing:!1},{userAction:!1}),r.emit("end"),this.clearPauseData())})}handlePause(e){var r;const{state:n,privateState:o,hooks:s}=this;n.playing=!1,o.playing!==!1&&(o.playing=!1,this.setPauseData(),o.broke||this.forceInteruptUpdateCamera(),(e==null?void 0:e.notEmitEvent)!==!0&&s.emit("pause",{userAction:(r=e==null?void 0:e.userAction)!=null?r:!0}))}playKeyframe(e,n){return Y(this,null,function*(){var s;const{privateState:o}=this;return((s=this.privateState.currentPlayKeyframe)==null?void 0:s.keyframe.id)!==e.id&&(this.privateState.currentPlayKeyframe={keyframe:e}),o.currentPlayQueue.push(this.getPlayPromise(e,n)),this.actionPromiseQueue()})}addInterruptListener(e){const n=()=>{this.privateState.modeChanging||e()},o=e;return this.five.once("gesture",o),this.five.once("wantsChangeMode",n),()=>{this.five.off("gesture",o),this.five.once("wantsChangeMode",n)}}getPlayPromise(o){return Y(this,arguments,function*(e,n={}){var r;const s=e.data;if(n.duration=(r=n.duration)!=null?r:e.start!==void 0&&e.end!==void 0?e.end-e.start:void 0,!!s)return new Promise((a,l)=>{let c=!1;this.addInterruptListener(()=>{if(!c)return this.hooks.emit("broke"),this.privateState.broke=!0,this.setState({playing:!1}),c=!0,l(new Error("play is interupted"))});try{if(c)return;const d=()=>{a(),c=!0};switch(s.effect){case"Move":this.move(s,n).then(d);break;case"Rotate":this.rotate(s,n).then(d);break;default:this.rotate(s,n).then(d)}}catch(d){}})})}actionPromiseQueue(){return Y(this,null,function*(){const{privateState:e}=this;return new Promise((n,o)=>{if(e.currentPlayQueue.length===0){n();return}const s=e.currentPlayQueue.shift();if(!s){n();return}s.then(n,o)}).then(()=>e.currentPlayQueue.length===0?Promise.resolve():this.actionPromiseQueue())})}move(e,n){return Y(this,null,function*(){if(e.mode&&e.mode!==this.five.currentMode)yield this.changeMode(e);else if(e.panoIndex!==this.five.panoIndex)yield this.changePano(e,n);else return Promise.resolve()})}rotate(e,n){return Y(this,null,function*(){if(e.mode&&e.mode!==this.five.currentMode)yield this.changeMode({mode:e.mode,panoIndex:e.panoIndex});else if(e.panoIndex&&e.panoIndex!==this.five.panoIndex)return yield this.changePano(e,n);yield this.updateCamera(e,n)})}updateCamera(o){return Y(this,arguments,function*(e,n={}){const{five:s,privateState:r,state:a}=this,l=(()=>{var m,v;const h=(m=a.config)==null?void 0:m.speedConfig,u=(v=e.rotateSpeed)!=null?v:h==null?void 0:h.rotateSpeed;if((h==null?void 0:h.rotateSpeedUnit)===void 0)return u;if(u!==void 0)return h.rotateSpeedUnit==="rad/ms"?u:u/1e3})(),c=(()=>{if(n.duration)return n.duration;if(l){const h=this.five.getCurrentState();return hC(h,e)/l}return 800})();r.currentPlayKeyframe&&(r.currentPlayKeyframe.originDuration=c);const d=this.getSpeededDuration(c);return new Promise(h=>{uC(()=>s.updateCamera(e,d)),setTimeout(()=>h(),d)})})}changePano(e,n){return Y(this,null,function*(){const{five:o,privateState:s,state:r}=this;if(typeof e.panoIndex!="number"||e.panoIndex===o.panoIndex)return;const a=o.getCurrentState().mode!=="Panorama";a&&(this.privateState.modeChanging=!0);const l=(()=>{var u,m;const d=(u=r.config)==null?void 0:u.speedConfig,h=(m=e.moveSpeed)!=null?m:d==null?void 0:d.moveSpeed;if((d==null?void 0:d.moveSpeedUnit)===void 0)return h;if(h!==void 0)return d.moveSpeedUnit==="m/ms"?h:h/1e3})(),c=(()=>{if(n!=null&&n.duration)return n.duration;if(l&&typeof o.panoIndex=="number"&&typeof e.panoIndex=="number"){const d=o.work.observers[o.panoIndex].position,h=o.work.observers[e.panoIndex].position;return d.distanceTo(h)/l}return 800})();s.currentPlayKeyframe&&(s.currentPlayKeyframe.originDuration=c),yield new Promise(d=>{var h,u,m;o.moveToPano(e.panoIndex,{latitude:e.latitude,longitude:e.longitude,fov:e.fov,duration:this.getSpeededDuration(c),effect:(m=(u=n==null?void 0:n.moveEffect)!=null?u:(h=this.state.config)==null?void 0:h.moveEffect)!=null?m:e.moveEffect,moveCancelCallback:()=>d(),moveEndCallback:()=>d()}),a&&o.once("panoArrived",()=>d())}),a&&(this.privateState.modeChanging=!1)})}changeSpeed(e,n=!0){const{state:o,privateState:s,hooks:r}=this,{currentPlayKeyframe:a}=s;if(r.emit("speedChange",e,{userAction:n}),o.playing&&a)try{const l=a.originDuration!==void 0?a.originDuration*(1-this.getProgress()):void 0,c=this.playKeyframe(a.keyframe,{duration:l});s.currentPlayQueue.push(c)}catch(l){}}getSpeededDuration(e){return e/this.state.speed}getProgress(){return this.five.controller.cameraMotion.progress}changeMode(e,n){return Y(this,null,function*(){e.mode&&e.mode!==this.five.currentMode&&(this.privateState.modeChanging=!0,yield this.five.changeMode(e.mode,e,n),this.privateState.modeChanging=!1)})}forceInteruptUpdateCamera(){this.five.updateCamera({},0)}getPauseData(){var e,n;if((e=this.data)!=null&&e.keyframesId)return xr.get((n=this.data)==null?void 0:n.keyframesId)}setPauseData(){var e,n,o,s;if((e=this.data)!=null&&e.keyframesId)return xr.set((n=this.data)==null?void 0:n.keyframesId,{keyframeId:(o=this.privateState.currentPlayKeyframe)==null?void 0:o.keyframe.id,fiveState:this.five.getCurrentState(),duration:(s=this.privateState.currentPlayKeyframe)==null?void 0:s.originDuration,playedProgress:this.getProgress()})}clearPauseData(){var e,n;if((e=this.data)!=null&&e.keyframesId)return xr.delete((n=this.data)==null?void 0:n.keyframesId)}clear(){this.clearPauseData(),this.privateState.currentPlayKeyframe=null}handleDispose(){var e,n;this.setState({playing:!1}),this.clearPauseData(),this.clear(),(e=this.GuideLine)==null||e.dispose(),this.GuideLine=void 0,(n=this.privateState.disposers)==null||n.forEach(o=>o==null?void 0:o())}actionIfStateIsEnabled(e,n){if(this.state.enabled)return e();n!=null&&n.warnLog&&vC()}waitFiveLoaded(){return Y(this,null,function*(){return new Promise(e=>{if(this.five.work){e();return}this.five.once("loaded",()=>{e()})})})}setFiveLinearUpdateCamera(){this.privateState.fiveOriginGetProgress&&(this.five.controller.cameraMotion.getProgress=e=>{const n=this.five.controller.cameraMotion,o=e-n.startTime;return o<0?0:o>=n.duration?1:1-pC(1,n.startVelocity,n.duration,o)})}setFiveOriginUpdateCamera(){this.privateState.fiveOriginGetProgress&&(this.five.controller.cameraMotion.getProgress=this.privateState.fiveOriginGetProgress)}}f(to,"PluginVersion",cu);const bC=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),yC=i=>new to(i);class hu{constructor(t){f(this,"id");f(this,"renderID");f(this,"isGuideLine",!0);f(this,"panoramaItem");f(this,"modelItem");f(this,"hooks",new ze.Subscribe);f(this,"_visible",!0);f(this,"plugin");f(this,"five");f(this,"logError",t=>Sh("GuideLineItem: ",t));this.id=t.id,this.five=t.five,this.plugin=t.plugin,this.panoramaItem=new Zr(this.five,{mode:"panorama",plugin:this.plugin,parent:this}),this.modelItem=new Zr(this.five,{mode:"model",plugin:this.plugin,parent:this})}get visible(){return this._visible}setData(t){this.setDataByMode("panorama",t),this.setDataByMode("model",t)}setHeightOffset(t){this.modelItem.mesh.position.y=t,this.panoramaItem.mesh.position.y=t}setDataByMode(t,e){var l;const n=t==="panorama"?this.panoramaItem:this.modelItem,o=t==="panorama"?e.panorama_style:e.model_style,s=e.path,r=o,a=o;if(e.pano_group){const c=t==="panorama";n.setGeometryByPanoGroup(e.pano_group,F({skipPanoGroup:c},r))}else e.path&&n.setGeometryByPath(s,r);n.name=e.name,n.setMartial(a),n.setVisibleFloorIndexes((l=e.visible_floor_indexes)!=null?l:null),n.setStartTag(o==null?void 0:o.start_tag),n.setEndTag(o==null?void 0:o.end_tag)}show(){this._visible=!0,this.hooks.emit("show",{userAction:!0})}hide(){this._visible=!1,this.hooks.emit("hide",{userAction:!0})}dispose(){this.panoramaItem.dispose(),this.modelItem.dispose()}walk(t){return Y(this,null,function*(){if(!this.panoramaItem.panoGroup)return;const e=F({panoIndexList:this.panoramaItem.panoGroup},t);this.hooks.emit("walkStart",{userAction:!0});const[n]=yield ii(wC(this.five,e));if(this.hooks.emit("walkEnded",{userAction:!0}),n)return this.logError(n.message)})}}function wC(i,t){return Y(this,null,function*(){if(t.panoIndexList.length===0)return;const e=i.getCurrentState();e.mode!=="Panorama"&&(yield fa(i,["Panorama",{longitude:e.longitude,latitude:0,panoIndex:t.panoIndexList[0]}]));const n=new to(i,{useGuideLine:!1});yield n.load(t),yield new Promise((o,s)=>{const r=i.getCurrentState();let a=t.panoIndexList.slice();r.panoIndex===a[0]&&c(r.panoIndex),n.playFromStart();function l(m){if(m!=="Panorama")return h(new Error("mode not match"))}function c(m){const v=a[0];if(a=a.slice(1),m!==v)return h(new Error("panoIndex not match, wanted: "+v+", got: "+m));if(a.length===0)return u()}function d(){i.off("modeChange",l),i.off("panoArrived",c)}function h(m){d(),s(m)}function u(){d(),o()}i.on("modeChange",l),i.on("panoArrived",c)})})}const PC=Object.freeze(Object.defineProperty({__proto__:null,GuideLineItem:hu},Symbol.toStringTag,{value:"Module"})),uu="v1.1.0",Kr="GuideLinePlugin",vd=`${Kr}@${uu}`;class CC extends Mn{constructor(e,n){super(e,n);f(this,"version",uu);f(this,"name",Kr);f(this,"cruisePlugin");f(this,"itemMap",new Map);f(this,"state",{visible:!1,enabled:!0});f(this,"data");f(this,"heightOffset",0);f(this,"_config");f(this,"_disposed",!1);f(this,"disposedErrorLog",()=>{console.error(`${vd} is disposed`)});this._config=n!=null?n:{},this.cruisePlugin=new to(e,{useGuideLine:!1}),Object.assign(window,{[`__${Kr}_DEBUG__`]:this})}get config(){return this._config}get disposed(){return this._disposed}load(e,n,o=!0){return Y(this,null,function*(){var m,v,g,A,b,y,E;if(this.disposed)return;const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,r=yield this.formatData(e);this.hooks.emit("dataChange",r,s),this.data=r;const a=r.config,c={panorama_style:{visible:!!(!r.lines&&r.routes),unit_length:(m=a==null?void 0:a.unitHeight)!=null?m:.4,width:(v=a==null?void 0:a.unitWidth)!=null?v:.6,texture:{url:(g=a==null?void 0:a.arrowTextureUrl)!=null?g:this.staticPrefix+"/release/web/arrow6.b6ce0c62.png"}}},d=(b=(A=r.routes)==null?void 0:A.map(k=>{var S;return Ye({},c,{id:(S=k.id)!=null?S:Date.now(),pano_group:k.panoIndexList})}))!=null?b:[],h=(E=(y=r.lines)==null?void 0:y.map(k=>Ye({},c,k)))!=null?E:[],u=[...d,...h];yield this.waitFiveLoaded(),this.clear(),u.forEach(k=>{this.addGuideLineItem(k)}),this.updateTagsEnable(),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),n&&this.setState(n,{userAction:o}),this.hooks.emit("dataLoaded",r),console.debug(`${vd} loaded`,r)})}formatData(e){return Y(this,null,function*(){return this.getDataWithoutVersion(e)})}show(e){return Y(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return Y(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.disposed||(this.clear(),this.hooks.emit("dispose"))}setState(e,n){var s;if(this.disposed)return this.disposedErrorLog();const o=F({},this.state);this.state=F(F({},this.state),e),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible,n==null?void 0:n.userAction),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled,n==null?void 0:n.userAction),jt(o,this.state,{deep:!0})||(this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:(s=n==null?void 0:n.userAction)!=null?s:!0}),this.five.needsRender=!0)}addGuideLineItem(e){const n=e.render_id||e.id,o=this.itemMap.get(n);o&&this.removeGuideLineItem(o);const s=new hu({five:this.five,id:n,plugin:this});return this.itemMap.set(n,s),e&&s.setData(e),this.heightOffset+=1e-4,s.setHeightOffset(this.heightOffset),s}getGuideLineItemByID(e){return this.itemMap.get(e)}removeGuideLineItem(e){this.itemMap.delete(e.id),e.panoramaItem.dispose(),e.modelItem.dispose()}updateTagsEnable(){const e=[];function n(r){return Array.isArray(r)&&r.every(a=>typeof a=="number")}function o(r,a){return new I.Vector3().fromArray(r).distanceTo(new I.Vector3().fromArray(a))<.01}function s(r){var l;const a=(l=r.tag)==null?void 0:l.position;return n(a)?e.every(c=>{var d;return n((d=c.tag)==null?void 0:d.position)?!o(a,c.tag.position):!0}):!1}this.itemMap.forEach(r=>{const a=r.modelItem.startTagContainer,l=r.modelItem.endTagContainer,c=s(a);c&&e.push(a),a.plugin.setState({enabled:c},{});const d=s(l);d&&e.push(l),l.plugin.setState({enabled:d},{})})}clear(){this.itemMap.forEach(e=>{this.removeGuideLineItem(e)})}handleEnable(e,n=!0){this.hooks.emit(e?"enable":"disable",{userAction:n})}handleVisible(e,n=!0){this.state.enabled&&this.hooks.emit(e?"show":"hide",{userAction:n})}waitFiveLoaded(){return Y(this,null,function*(){return new Promise(e=>{if(this.five.work){e();return}this.five.once("loaded",()=>{e()})})})}getDataWithoutVersion(e){return typeof e=="object"&&e!==null&&e.version&&e.data?e.data:e}}const fu=(i,t)=>new CC(i,t);function mu(i,t,e){if(e){const o=new I.Vector3().subVectors(i.position,e).applyQuaternion(i.quaternion.clone().inverse()).applyQuaternion(t).add(e);i.position.copy(o)}i.quaternion.copy(t)}class EC extends R.Object3D{constructor(){super()}add(...t){if(t.length===0)return this;const e=t.filter(Boolean);return super.add(...e)}remove(...t){if(t.length===0)return this;const e=t.filter(Boolean);return super.remove(...e)}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}}class ws extends EC{constructor(e,n){var o;super();f(this,"originObject3D");f(this,"onRender");this.originObject3D=e,this.onRender=(o=n==null?void 0:n.onRender)!=null?o:()=>{}}get helperObject(){return this}render(){this.onRender()}enable(){this.parent.children.includes(this)||this.parent.add(this)}disable(){this.removeFromParent()}show(){this.visible=!0,this.render()}hide(){this.visible=!1,this.render()}raycasterIntersectObject(e,n=[]){return e.intersectObject(this,!0,n)}initialPosition(){this.position.add(this.originObject3D.position)}initQuaternion(){this.quaternion.copy(this.originObject3D.quaternion)}applyHelperScaleMatrix4(e,n){this.scale.applyMatrix4(e)}setHelperQuaternion(e,n){mu(this,e,n)}applyHelperQuaternion(e,n){if(n){const o=new R.Vector3().subVectors(this.position,n).applyQuaternion(e).add(n);this.position.copy(o)}this.applyQuaternion(e)}dispose(){this.removeFromParent()}}class IC extends ws{}class kC extends ws{}class xC extends ws{}class pu extends ws{}class DC extends pu{}class MC extends I.Group{constructor(e){super();f(this,"direction");this.direction=e||"x"}}class Ad extends I.Mesh{constructor(e,n,o){super(e,n);f(this,"direction");this.direction=o||"x"}}function SC(i,t){const{offsetWidth:e,offsetHeight:n}=t,{top:o,left:s}=t.getBoundingClientRect();return Object.assign(new I.Vector2,{x:(i.x-s)/e*2-1,y:-(i.y-o)/n*2+1})}function Ia(i,t,e){if(!t||!e||!i)return;const n=SC(t,e);if(Math.abs(n.x)===1||Math.abs(n.y)===1)return;const o=new I.Raycaster;return o.setFromCamera(n,i),o}function LC(i,t){return!(Math.abs(i.x-t.x)>1e-5||Math.abs(i.y-t.y)>1e-5||Math.abs(i.z-t.z)>1e-5)}class Dr extends MC{constructor(e){var d;super(e.direction);f(this,"line");f(this,"arrow");f(this,"lineHeight",.4);f(this,"arrowHeight",.1);this.name="ArrowGroup";const n=new I.Color((d=e.color)!=null?d:16214315),o=new I.MeshBasicMaterial({color:n,depthTest:!1,opacity:1,transparent:!0,side:I.DoubleSide}),s=new I.ConeGeometry(.04,.1,32),r=new Ad(s,o.clone(),e.direction);r.name=`arrow-${e.direction}`,this.arrow=r;const a=.004,l=new I.CylinderGeometry(a,a,.4,32),c=new Ad(l,o.clone(),e.direction);c.name=`line-${e.direction}`,this.line=c,this.formatArrow(),this.formatLine(),this.add(this.arrow,this.line)}formatArrow(){this.arrow.geometry.translate(0,this.lineHeight+this.arrowHeight/2,0),this.direction==="x"?(this.arrow.geometry.rotateX(Math.PI/2),this.arrow.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.arrow.geometry.rotateX(Math.PI/2)}formatLine(){this.line.geometry.translate(0,this.lineHeight/2,0),this.direction==="x"?(this.line.geometry.rotateX(Math.PI/2),this.line.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.line.geometry.rotateX(Math.PI/2)}}const Mr={X:15618642,Y:4765519,Z:4227839};class ei{static get X(){return new I.Color(Mr.X).convertSRGBToLinear().clone()}static get Y(){return new I.Color(Mr.Y).convertSRGBToLinear().clone()}static get Z(){return new I.Color(Mr.Z).convertSRGBToLinear().clone()}}class TC extends IC{constructor(e){super(e);f(this,"xArrow",new Dr({direction:"x",color:ei.X}));f(this,"yArrow",new Dr({direction:"y",color:ei.Y}));f(this,"zArrow",new Dr({direction:"z",color:ei.Z}));this.add(this.xArrow),this.add(this.yArrow),this.add(this.zArrow)}show(){super.show(),this.xArrow.visible=!0,this.yArrow.visible=!0,this.zArrow.visible=!0}showDraggingHelper(e){this.xArrow.visible=e.includes("x"),this.yArrow.visible=e.includes("y"),this.zArrow.visible=e.includes("z")}dispose(){this.remove(this.xArrow,this.yArrow,this.zArrow)}}function En(i,t){return zC(document.createElement(t!=null?t:"div"),i)}function zC(i,t){if(!t)return i;for(const e in t)e&&t[e]&&(i.style[e]=t[e]);return i}function _C(i){const t=En(F({position:"absolute",display:"block",borderRadius:"4px",paddingTop:"1px",paddingBottom:"1px",paddingLeft:"4px",paddingRight:"4px",pointerEvents:"none",userSelect:"none",zIndex:"99999",backgroundColor:"rgba(0,0,0,0.7)",fontSize:"12px",color:"#fff",letterSpacing:"0",lineHeight:"18px"},i)),e=()=>{t.style.display!=="block"&&t.style.top&&t.style.left&&(t.style.display="block")};return{element:t,show:e,hide:()=>{t.style.display="none",t.style.top="",t.style.left=""},setLeftTop:(s,r)=>{t.style.left=s,t.style.top=r,e()}}}class VC extends xC{constructor(e,n){super(e);f(this,"xCircle");f(this,"yCircle");f(this,"zCircle");f(this,"children",[]);f(this,"angleTips");f(this,"container");(n==null?void 0:n.yzCircleEnable)!==!1&&(this.xCircle=new Sr({direction:"x",color:ei.X})),(n==null?void 0:n.xzCircleEnable)!==!1&&(this.yCircle=new Sr({direction:"y",color:ei.Y})),(n==null?void 0:n.xyCircleEnable)!==!1&&(this.zCircle=new Sr({direction:"z",color:ei.Z})),n!=null&&n.container&&(n==null?void 0:n.angleTipsEnable)!==!1&&(this.container=n==null?void 0:n.container,this.angleTips=_C({display:"none"}),this.container.appendChild(this.angleTips.element)),this.add(...[this.xCircle,this.yCircle,this.zCircle].filter(Boolean)),this.show()}hide(){this.children.forEach(e=>e.hide())}show(){var e;this.children.forEach(n=>n.showCircle()),(e=this.angleTips)==null||e.hide()}showDraggingHelper(e){var n;this.hide(),this.children.filter(o=>e.includes(o.direction)).forEach(o=>o.showRing()),(n=this.angleTips)==null||n.show()}dispose(){var e,n;this.removeFromParent(),(n=(e=this.angleTips)==null?void 0:e.element)==null||n.remove()}}class Sr extends I.Group{constructor(e){super();f(this,"direction");f(this,"circle");f(this,"ring");f(this,"angleSector");this.direction=e.direction,this.circle=new jC(e),this.ring=new OC(e),this.angleSector=new BC(e),this.add(this.circle,this.ring,this.angleSector),this.direction==="y"?this.rotateX(Math.PI/2):this.direction==="x"&&this.rotateY(-Math.PI/2)}showCircle(){this.add(this.circle),this.remove(this.ring,this.angleSector)}showRing(){this.add(this.ring,this.angleSector),this.remove(this.circle)}hide(){this.remove(this.ring,this.angleSector,this.circle)}}class jC extends I.Mesh{constructor(e){var n;super();f(this,"direction");f(this,"gapAngle",.02);f(this,"geometry",new I.RingGeometry(.25,.3,20,8,this.gapAngle,Math.PI/2-this.gapAngle*2));this.material=new I.MeshBasicMaterial({opacity:.6,color:(n=e.color)!=null?n:16777215,transparent:!0,side:I.DoubleSide,depthTest:!1}),this.direction=e.direction,this.geometry.name=`RotateHelperCircleGeometry-${this.direction}`}}class OC extends I.Group{constructor(e){super();f(this,"direction");this.direction=e.direction;const n=.015,o=new Array(8).fill(null).map((s,r)=>{const a=new I.RingGeometry(.25,.3,20,8,Math.PI/4*r+n,Math.PI/4-n*2),l=new I.MeshBasicMaterial({opacity:1,color:16777215,depthTest:!1,transparent:!0,side:I.DoubleSide}),c=new I.Mesh(a,l);return c.name=`AxesDashedRing-${this.direction}-${r}`,c});this.add(...o)}}class BC extends I.Mesh{constructor(e){var o;super();f(this,"direction");f(this,"baseAxes");f(this,"angleDirection");switch(e.direction){case"x":this.baseAxes=new I.Vector3(0,0,1);break;case"y":this.baseAxes=new I.Vector3(1,0,0);break;case"z":this.baseAxes=new I.Vector3(1,0,0);break}const n=.3+5e-4;this.geometry=new I.CircleGeometry(n,48,0,1e-4),this.material=new I.MeshBasicMaterial({opacity:.4,color:(o=e.color)!=null?o:16777215,depthTest:!1,transparent:!0,side:I.DoubleSide}),this.direction=e.direction,this.angleDirection=this.direction==="z"?1:-1}}function RC(){const i=En({width:"100%",height:"100%",left:"0",top:"0",position:"absolute",pointerEvents:"none"}),t=En({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}),e=En({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"absolute",border:"1px solid rgba(255,255,255,0.4)"});i.appendChild(t),t.appendChild(e);const n="-4px",o={direction:"nesw",element:en({cursor:"nesw-resize",left:n,bottom:n})},s={direction:"ns",element:en({cursor:"ns-resize",bottom:n})},r={direction:"nwse",element:en({cursor:"nwse-resize",right:n,bottom:n})},a={direction:"ew",element:en({cursor:"ew-resize",right:n})},l={direction:"nesw",element:en({cursor:"nesw-resize",right:n,top:n})},c={direction:"ns",element:en({cursor:"ns-resize",top:n})},d={direction:"nwse",element:en({cursor:"nwse-resize",left:n,top:n})},h={direction:"ew",element:en({cursor:"ew-resize",left:n})};return new Array(s,a,c,h,o,r,l,d).forEach(m=>t.appendChild(m.element)),{container:i,squares:[o,s,r,a,l,c,d,h]}}function en(i){const t=En(F({background:"#FFFFFF",width:"9px",height:"9px",position:"absolute",pointerEvents:"none"},i)),e=En({width:"15px",height:"15px",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"}),n=En({width:"15px",height:"15px",cursor:i==null?void 0:i.cursor,pointerEvents:"auto",background:"transparent"});return n.draggable=!0,e.appendChild(n),t.appendChild(e),t}class QC extends DC{constructor(e,n,o,s){super(e);f(this,"points",[]);f(this,"cornerPositions",[]);f(this,"css3DInstance");f(this,"plane");f(this,"css3DRenderer",new ti);f(this,"camera");f(this,"scene");f(this,"container");f(this,"enabled",!1);this.camera=o,this.scene=s,this.container=n,this.initRectangleScaleHelper()}get helperObject(){var e;if(!((e=this.css3DInstance)!=null&&e.css3DObject))throw new Error("css3DInstance is not initialized");return this.css3DInstance.css3DObject}applyMatrix4(e){var n;super.applyMatrix4(e),this.helperObject.applyMatrix4(e),(n=this.plane)==null||n.applyMatrix4(e),this.cornerPositions.forEach(o=>o.applyMatrix4(e))}showDraggingHelper(){}applyHelperScaleMatrix4(e,n){var o;(o=this.plane)==null||o.scale.applyMatrix4(e),this.helperObject.applyScaleMatrix4(e)}updatePoints(){const e=this.calculatePointPosition(this.cornerPositions);this.points.forEach((n,o)=>{n.position.copy(e[o])})}applyHelperQuaternion(e,n){var s;const o=(s=this.css3DInstance)==null?void 0:s.css3DObject;if(o){const r=new I.Vector3().subVectors(o.position,n).applyQuaternion(e).add(n);o.position.copy(r),o.applyQuaternion(e)}if(this.plane){const r=new I.Vector3().subVectors(this.plane.position,n).applyQuaternion(e).add(n);this.plane.position.copy(r),this.plane.applyQuaternion(e)}this.cornerPositions.forEach(r=>{const a=new I.Vector3().subVectors(r,n).applyQuaternion(e).add(n);r.copy(a)})}enable(){var e;this.enabled||(this.enabled=!0,(e=this.css3DInstance)==null||e.enable(),this.plane&&this.scene.add(this.plane))}disable(){var e;this.enabled&&(this.enabled=!1,(e=this.css3DInstance)==null||e.disable(),this.plane&&this.scene.remove(this.plane))}show(){var e;(e=this.css3DInstance)==null||e.show(),this.plane&&(this.plane.visible=!0)}hide(){var e;(e=this.css3DInstance)==null||e.hide(),this.plane&&(this.plane.visible=!1)}dispose(){this.disable(),this.css3DRenderer.dispose()}initRectangleScaleHelper(){var a,l;const e=this.getCornerPositions();if(!e)return;this.cornerPositions=e;const n=this.css3DRenderer.create3DElement(this.camera,e,{ratio:.003});if(!n)return;this.css3DInstance=n,n.appendToElement(this.container);const o=n.css3DObject.container,{container:s,squares:r}=RC();this.points=r.map((c,d)=>({direction:c.direction,point:c.element,position:this.calculatePointPosition(e)[d]})),o.insertBefore(s,(a=o.children[0])!=null?a:null),this.helperObject.position.copy(this.originObject3D.position),(l=this.plane)==null||l.position.copy(this.originObject3D.position)}getCornerPositions(){const{originObject3D:e}=this;if(e.isCSS3DObjectPlus)return e.cornerPoints;console.error("当前物体暂时不支持 ScaleHelper")}calculatePointPosition(e){return[e[0].clone(),e[0].clone().add(e[1]).divideScalar(2),e[1].clone(),e[1].clone().add(e[2]).divideScalar(2),e[2].clone(),e[2].clone().add(e[3]).divideScalar(2),e[3].clone(),e[3].clone().add(e[0]).divideScalar(2)]}}function gu(i){const t=new I.Box3,e=new I.Vector3;if(i.traverse(n=>{var s;if(n.name==="shadow")return;const o=n.geometry;if(o!==void 0)if((s=o==null?void 0:o.attributes)!=null&&s.position){const r=o.attributes.position;for(let a=0,l=r.count;a<l;a++)e.fromBufferAttribute(r,a).applyMatrix4(n.matrix),t.expandByPoint(e)}else o.vertices.forEach(r=>{const a=r.clone().applyMatrix4(n.matrix);t.expandByPoint(a)})}),!t.isEmpty())return t}class HC extends kC{constructor(e){super(e);f(this,"box");f(this,"outline");f(this,"originObject");f(this,"positionAttribute");this.originObject=e,this.positionAttribute=new I.BufferAttribute(new Float32Array(8*3),3),this.box=this.createBox(),this.outline=this.createOutline(),this.add(this.box,this.outline),this.update()}raycasterIntersectObject(e,n){return e.intersectObject(this,!1,n)}raycast(e,n){this.box.raycast(e,n)}update(){const e=gu(this.originObject);if(!e)return;const{min:n,max:o}=e;this.positionAttribute.setXYZ(0,o.x,o.y,o.z),this.positionAttribute.setXYZ(1,n.x,o.y,o.z),this.positionAttribute.setXYZ(2,n.x,n.y,o.z),this.positionAttribute.setXYZ(3,o.x,n.y,o.z),this.positionAttribute.setXYZ(4,o.x,o.y,n.z),this.positionAttribute.setXYZ(5,n.x,o.y,n.z),this.positionAttribute.setXYZ(6,n.x,n.y,n.z),this.positionAttribute.setXYZ(7,o.x,n.y,n.z),this.positionAttribute.needsUpdate=!0}createOutline(){const e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new I.BufferGeometry;n.setIndex(new I.BufferAttribute(e,1)),n.setAttribute("position",this.positionAttribute);const o=new I.LineBasicMaterial({color:64767,linewidth:1,opacity:1,depthTest:!1,transparent:!0,toneMapped:!1}),s=new I.LineSegments(n,o);return s.matrixAutoUpdate=!1,s}createBox(){const e=new Uint16Array([0,1,2,0,2,3,0,3,7,0,7,4,0,4,5,0,5,1,6,1,5,6,2,1,6,5,4,6,4,7,6,3,2,6,7,3]),n=new I.BufferGeometry;n.setIndex(new I.BufferAttribute(e,1)),n.setAttribute("position",this.positionAttribute);const o=new I.MeshBasicMaterial({color:64767,opacity:.1,depthTest:!1,transparent:!0});return new I.Mesh(n,o)}}class no{constructor(t,e){f(this,"originObject3D");f(this,"hooks");f(this,"disposers",[]);f(this,"helperObject3D");f(this,"camera");f(this,"model");f(this,"scene");f(this,"container");f(this,"domEvents");f(this,"isDragging",!1);f(this,"enabled",!1);f(this,"name","BaseController");f(this,"boundingBox");f(this,"offset");f(this,"onRender");f(this,"onWantsTapGesture",t=>{if(this.getIntersectObject(t))return!1});var c,d;this.hooks=(c=t.sharedHooks)!=null?c:new li,this.camera=t.camera,this.model=t.model,this.originObject3D=t.originObject3D,this.helperObject3D=t.helperObject3D,this.container=t.container,this.scene=t.scene,this.domEvents=new Me(t.camera,t.container),this.onRender=(d=t.onRender)!=null?d:()=>{},this.offset=e==null?void 0:e.offset,this.initialHelperPosition(),this.initialHelperQuaternion(),this.enable();const n=(...h)=>this.onSetOriginObjectScale(...h),o=(...h)=>this.onSetOriginObjectRotate(...h),s=(...h)=>this.onSetOriginObjectPosition(...h),r=(...h)=>this.onApplyOriginObjectScale(...h),a=(...h)=>this.onApplyOriginObjectRotate(...h),l=(...h)=>this.onApplyOriginObjectPosition(...h);this.hooks.on("setObjectScale",n),this.hooks.on("setObjectRotate",o),this.hooks.on("setObjectPosition",s),this.hooks.on("applyObjectPosition",l),this.hooks.on("applyObjectRotate",a),this.hooks.on("applyObjectScale",r),this.disposers.push(()=>{this.hooks.off("setObjectScale",n),this.hooks.off("setObjectRotate",o),this.hooks.off("setObjectPosition",s),this.hooks.off("applyObjectPosition",l),this.hooks.off("applyObjectRotate",a),this.hooks.off("applyObjectScale",r)})}initialHelperPosition(){this.helperObject3D.position.add(this.calculateOffset(this.offset)),this.helperObject3D.initialPosition()}initialHelperQuaternion(){this.helperObject3D.initQuaternion()}enable(){this.enabled||(this.enabled=!0,this.scene.add(this.helperObject3D),this.helperObject3D.enable(),this.render())}disable(){this.enabled&&(this.enabled=!1,this.helperObject3D.disable(),this.render())}show(){this.helperObject3D.show(),this.render()}hide(){this.helperObject3D.hide(),this.render()}dispose(){var t;(t=this.disposers)==null||t.forEach(e=>e==null?void 0:e()),this.helperObject3D.dispose(),this.render()}applyHelperMatrix4(t){this.helperObject3D.applyMatrix4(t)}applyHelperQuaternion(t,e){this.helperObject3D.applyHelperQuaternion(t,e)}applyHelperScaleMatrix4(t,e){this.helperObject3D.applyHelperScaleMatrix4(t,e)}onWantsGesture(t,e,n){if(this.isDragging)return!1}onIntersectionOnModelUpdate(t){}onApplyOriginObjectScale(t){this.applyHelperScaleMatrix4(t.matrix,t.origin)}onApplyOriginObjectRotate(t){this.applyHelperQuaternion(t.quaternion,t.origin)}onApplyOriginObjectPosition(t){this.applyHelperMatrix4(t.matrix)}onSetOriginObjectScale(t){this.helperObject3D.scale.copy(t),this.updateOffsetByScale(t)}onSetOriginObjectRotate(t,e){this.helperObject3D.setHelperQuaternion(t,e)}onSetOriginObjectPosition(t){this.helperObject3D.position.copy(t.clone().add(this.calculateOffset(this.offset)))}render(){this.onRender()}updateOffsetByScale(t){if(this.boundingBox&&this.offset){const e=this.originObject3D.position,n=new I.Vector3().subVectors(this.boundingBox.max,e).multiply(t).add(e),o=new I.Vector3().subVectors(this.boundingBox.min,e).multiply(t).add(e),s=this.calculateOffset(this.offset,{min:o,max:n});this.helperObject3D.position.copy(s),this.helperObject3D.initialPosition()}}hoverListener(t,e=16777215,n=1){const o=(Array.isArray(t)?t:[t]).filter(ci),s=[];for(const r of o)if(r instanceof I.Mesh||r instanceof I.Group){const a=r instanceof I.Group?r.children.filter(u=>u instanceof I.Mesh):[r];a.forEach(u=>{u.__originalColor__=u.material.color.clone(),u.__originalOpacity__=u.material.opacity});const l=()=>{a.forEach(u=>{u.material.color.set(e),u.material.opacity=n}),this.render()},c=()=>{a.forEach(u=>{u.material.color.copy(u.__originalColor__),u.material.opacity=u.__originalOpacity__}),this.render()},d=()=>{this.isDragging||l()},h=()=>{this.isDragging||c()};for(const u of a)this.domEvents.addEventListener(u,"mouseover",d),this.domEvents.addEventListener(u,"mouseout",h),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",c),this.hooks.on("rotateEnd",c),s.push(()=>{this.domEvents.removeEventListener(u,"mouseover",d),this.domEvents.removeEventListener(u,"mouseout",h),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",c),this.hooks.off("rotateEnd",c)})}return()=>s.forEach(r=>r==null?void 0:r())}getIntersectObject(t){const e=this.camera.position,n=this.helperObject3D;if(!n)return;const o=this.helperObject3D.raycasterIntersectObject(t)[0];if(!o)return;const s=o;if(s.object=n,this.model.intersectRaycaster){const r=this.model.intersectRaycaster(t)[0];if(r&&r.point.distanceTo(e)<s.point.distanceTo(e))return}return s.object}calculateOffset(t,e){const n=this.originObject3D,o=new I.Vector3(0,0,0);if(!t)return o;const s=()=>e||(this.boundingBox?this.boundingBox:(this.boundingBox=gu(n),this.boundingBox));if(typeof t.x=="number")o.setX(t.x);else if(typeof t.x=="object"){const r=s();o.setX((r.max.x-r.min.x)*t.x.percents)}if(typeof t.y=="number")o.setY(t.y);else if(typeof t.y=="object"){const r=s();o.setY((r.max.y-r.min.y)*t.y.percents)}if(typeof t.z=="number")o.setZ(t.z);else if(typeof t.z=="object"){const r=s();o.setZ((r.max.z-r.min.z)*t.z.percents)}return o}}class GC extends no{constructor(...e){super(...e);f(this,"name","MoveController");f(this,"startInfo");f(this,"_moveByMouseEnable",!1);f(this,"mouseInfo");f(this,"mousedownEventListenerDisposer");const n=this.helperObject3D;this.hoverListener([n.xArrow,n.yArrow,n.zArrow]);const o=this.dragStart.bind(this),s=this.dragging.bind(this),r=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",o),document.addEventListener("mousemove",s),document.addEventListener("mouseup",r),this.hooks.on("rotateStart",l),this.hooks.on("rotateEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",o),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",r),this.hooks.off("rotateStart",l),this.hooks.off("rotateEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)}),this.moveByMouseEnable&&this.moveByMouse()}get moveByMouseEnable(){return this._moveByMouseEnable}dispose(){var e;super.dispose(),(e=this.disposers)==null||e.forEach(n=>n==null?void 0:n())}moveByMouse(){this._moveByMouseEnable=!0;const e=this.handleMouseDown.bind(this),n=this.handleMouseUp.bind(this);this.hooks.emit("moveByMouseEnable"),setTimeout(()=>{this.container.addEventListener("mousedown",e),this.container.addEventListener("mouseup",n)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener("mousedown",e),this.container.removeEventListener("mouseup",n)}}disableMoveByMouse(){var e;this._moveByMouseEnable=!1,this.hooks.emit("moveByMouseDisable"),(e=this.mousedownEventListenerDisposer)==null||e.call(this)}onIntersectionOnModelUpdate(e){!this.moveByMouseEnable||this.hooks.emit("wantToMove",e.point)||(this.originObject3D.position.copy(e.point),this.hooks.emit("setObjectPosition",e.point),this.hooks.emit("move",e.point))}onApplyOriginObjectScale(e){}handleMouseDown(e){const{x:n,y:o}=e;this.mouseInfo={x:n,y:o,mouseDownTimestamp:Date.now()}}handleMouseUp(e){if(!this.mouseInfo)return;const{x:n,y:o}=e;this.mouseInfo.x===n&&this.mouseInfo.y===o&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}dragStart(e){if(this._moveByMouseEnable||this.isDragging)return;const n=e==null?void 0:e.intersect;if(!n)return this.dragEnd();const o=(n==null?void 0:n.object).direction;if(!o)return this.dragEnd();const s=new I.Vector3(1,0,0).applyQuaternion(this.helperObject3D.quaternion),r=new I.Vector3(0,1,0).applyQuaternion(this.helperObject3D.quaternion),a=new I.Vector3(0,0,1).applyQuaternion(this.helperObject3D.quaternion),l=(()=>{switch(o){case"x":return s;case"y":return r;case"z":return a}})(),c=(()=>{switch(o){case"x":case"y":return a;case"z":return s}})(),d=n.point.clone(),h=new I.Plane;h.setFromNormalAndCoplanarPoint(c,d),this.startInfo={startVectorProject:d.clone().projectOnVector(l),directionVector:l,plane:h},this.helperObject3D.showDraggingHelper([o]),this.hooks.emit("moveStart"),this.isDragging=!0}dragging(e){if(!this.isDragging||!this.startInfo)return;const n=Ia(this.camera,e,this.container);return n?(this.move(n),!1):this.dragEnd()}move(e){if(!this.startInfo)return this.dragEnd();const{plane:n,directionVector:o,startVectorProject:s}=this.startInfo,r=this.originObject3D,a=e.ray.intersectPlane(n,new I.Vector3);if(!a)return;const l=a.clone().projectOnVector(o),c=l.clone().sub(s),d=new I.Matrix4;d.setPosition(c);const h=r.position.clone().applyMatrix4(d);this.hooks.emit("wantToMove",h)||(r.applyMatrix4(d),s.copy(l),this.hooks.emit("applyObjectPosition",{matrix:d}),this.hooks.emit("move",h))}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("moveEnd"))}}class Oi{constructor(t,e,n,o,s,r){f(this,"helperController");f(this,"five");f(this,"onFiveWantsTapGesture",t=>{if(!this.helperController)return;const e=this.helperController.onWantsTapGesture(t);return this.five.needsRender=!0,e});f(this,"onFiveWantsGesture",(...t)=>{if(!this.helperController)return;const e=this.helperController.onWantsGesture(...t);return this.five.needsRender=!0,e});f(this,"onFiveIntersectionOnModelUpdate",(...t)=>{this.helperController&&this.helperController.onIntersectionOnModelUpdate(...t)});const{camera:a,model:l,scene:c}=t,d=t.getElement();if(this.five=t,!a||!l||!d||!c)return;const h=()=>{t.needsRender=!0};this.helperController=new e({camera:a,model:l,originObject3D:n,helperObject3D:o,container:d,scene:c,onRender:h,sharedHooks:r},s),t.on("wantsTapGesture",this.onFiveWantsTapGesture),t.on("wantsGesture",this.onFiveWantsGesture),t.on("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate)}dispose(){var t;this.five.off("wantsTapGesture",this.onFiveWantsTapGesture),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),(t=this.helperController)==null||t.dispose()}}const FC="v1.0.1",WC="Object3DHelper",ka=`${WC}@${FC}`,NC=()=>{console.error(`${ka} is disposed`)},XC=()=>{console.warn(`${ka} is disabled`)},YC=()=>{console.error(`${ka} is disabled`)};class UC{constructor(t){f(this,"controllers",{});f(this,"state",{visible:!0,enabled:!0,disposed:!1});f(this,"hooks",new li);f(this,"eventListener",{});t&&this.addControllers(t),this.setState(this.state)}show(t){return Y(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return Y(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.setState({disposed:!0})}setState(t,e){if(this.state.disposed)return NC();if(!this.state.enabled&&t.enabled!==!0&&t.disposed!==!0)return YC();const n=F({},this.state);this.state=F(F({},this.state),t),t.disposed!==void 0&&t.disposed!==n.disposed&&t.disposed&&this.handleDispose(),t.visible!==void 0&&this.handleVisible(t.visible),t.enabled!==void 0&&this.handleEnable(t.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:n})}addControllers(t){this.controllers=F(F({},this.controllers),t),this.setState(this.state)}getCurrentState(){return this.state}handleEnable(t,e=!0){t?(this.everyControllerDo(n=>{n.enable()}),this.hooks.emit("enable",{userAction:e})):(this.everyControllerDo(n=>{n.disable()}),this.hooks.emit("disable",{userAction:e})),this.state.enabled=t}handleVisible(t,e=!0){t?(this.everyControllerDo(n=>{n.show()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:e}))):(this.everyControllerDo(n=>{n.hide()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:e}))),this.state.visible=t}everyControllerDo(t){Object.values(this.controllers).forEach(e=>{e&&t(e)})}handleDispose(){var t,e;Object.values(this.controllers).forEach(n=>{n==null||n.dispose()});for(const n in this.controllers){if(!n)continue;const o=n;(e=(t=this.eventListener)[o])==null||e.call(t)}}actionIfStateIsEnabled(t,e){if(this.state.enabled)return t();e!=null&&e.warnLog&&XC()}}function Lr(i){return i*Math.PI/180}class qC extends no{constructor(...e){var c,d,h;super(...e);f(this,"name","RotateController");f(this,"startInfo");f(this,"removeListener");const n=this.helperObject3D;this.hoverListener([(c=n.xCircle)==null?void 0:c.circle,(d=n.yCircle)==null?void 0:d.circle,(h=n.zCircle)==null?void 0:h.circle].filter(Boolean));const o=this.dragStart.bind(this),s=this.dragging.bind(this),r=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",o),document.addEventListener("mousemove",s),document.addEventListener("mouseup",r),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.removeListener=()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",o),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",r),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)}}get rotateCenter(){return this.helperObject3D.position.clone()}initialHelperQuaternion(){this.helperObject3D.applyHelperQuaternion(this.originObject3D.quaternion)}setRotateAngle(e){const{x:n=0,y:o=0,z:s=0}=e,r=new I.Euler(Lr(n),Lr(o),Lr(s)),a=new I.Quaternion().setFromEuler(r);if(this.hooks.emit("wantToRotate",a))return;const{originObject3D:c,rotateCenter:d}=this;mu(c,a,d),this.hooks.emit("setObjectRotate",a,d),this.hooks.emit("rotate",a),this.render()}dispose(){this.removeListener(),super.dispose()}onApplyOriginObjectRotate(e){this.isDragging||super.onApplyOriginObjectRotate(e)}onApplyOriginObjectScale(e){}dragStart(e){if(this.isDragging)return;const n=e==null?void 0:e.intersect;if(!n)return this.dragEnd();const o=(n==null?void 0:n.object).direction;if(!o)return this.dragEnd();const s=n.point,r=this.getAngleHelper(o);this.setTipsAngle(0);const a=s.clone();a.y+=.2,this.setTipsPosition(a);const l=(()=>{if(o==="x")return new I.Vector3(1,0,0).applyQuaternion(this.originObject3D.quaternion);if(o==="y")return new I.Vector3(0,1,0).applyQuaternion(this.originObject3D.quaternion);if(o==="z")return new I.Vector3(0,0,1).applyQuaternion(this.originObject3D.quaternion)})(),c=new I.Plane().setFromNormalAndCoplanarPoint(l,s),h=c.projectPoint(s.clone(),new I.Vector3).clone().sub(this.rotateCenter),u=h.angleTo(r.baseAxes.clone().applyQuaternion(this.originObject3D.quaternion));this.setAngleHelperStart(o,u),this.setAngleHelperLength(o,0),this.startInfo={direction:o,startVector:h,plane:c,angleHelper:r,angle:0,objectQuaternion:this.originObject3D.quaternion.clone()},this.helperObject3D.showDraggingHelper([o]),this.hooks.emit("rotateStart"),this.isDragging=!0}dragging(e){if(!this.isDragging)return;const n=Ia(this.camera,e,this.container);return n?(this.rotate(n),!1):this.dragEnd()}rotate(e){if(!this.startInfo)return this.dragEnd();const{startVector:n,plane:o,angleHelper:s,direction:r,objectQuaternion:a}=this.startInfo,{originObject3D:l}=this,c=e.ray.intersectPlane(o,new I.Vector3);if(!c)return;const d=this.rotateCenter.clone(),u=o.projectPoint(c.clone(),new I.Vector3).clone().sub(d);if(n.angleTo(u)===0)return;const m=new I.Quaternion().setFromUnitVectors(n.clone().normalize(),u.clone().normalize()),v=l.quaternion.clone().premultiply(m);if(this.hooks.emit("wantToRotate",v))return;const b=new I.Euler().setFromQuaternion(new I.Quaternion().setFromUnitVectors(n.clone().normalize().applyQuaternion(a.clone().inverse()),u.clone().normalize().applyQuaternion(a.clone().inverse())),`${r.toUpperCase()}${"XZY".replace(r.toUpperCase(),"")}`)[r]*s.angleDirection;if(this.startInfo.angle+=b,this.setAngleHelperLength(r,this.startInfo.angle),this.setTipsAngle(lh(this.startInfo.angle)),d){const y=new I.Vector3().subVectors(l.position,d).applyQuaternion(m).add(d);l.position.copy(y)}l.applyQuaternion(m),this.hooks.emit("applyObjectRotate",{quaternion:m,origin:d}),this.hooks.emit("rotate",l.quaternion),this.startInfo.startVector=u}dragEnd(){this.isDragging&&(this.hooks.emit("setObjectRotate",this.originObject3D.quaternion,this.rotateCenter),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("rotateEnd"))}getAngleHelper(e){var n,o,s;switch(e){case"x":return(n=this.helperObject3D.xCircle)==null?void 0:n.angleSector;case"y":return(o=this.helperObject3D.yCircle)==null?void 0:o.angleSector;case"z":return(s=this.helperObject3D.zCircle)==null?void 0:s.angleSector}}setAngleHelperStart(e,n){const o=this.getAngleHelper(e);if(!o){console.warn("angleHelper is undefined");return}if(o instanceof I.Mesh&&o.geometry instanceof I.CircleGeometry){const{radius:s,segments:r,thetaLength:a}=o.geometry.parameters;o.geometry=new I.CircleGeometry(s,r,n,a)}else console.warn("only support THREE.CircleGeometry")}setAngleHelperLength(e,n){const s=n>=0?Math.max(n,.001):Math.min(n,-.001),r=this.getAngleHelper(e);if(r instanceof I.Mesh&&r.geometry instanceof I.CircleGeometry){const{radius:a,thetaStart:l}=r.geometry.parameters,c=Math.ceil(Math.abs(s)*(40/(2*Math.PI)));r.geometry=new I.CircleGeometry(a,c,l,s)}else console.warn("only support THREE.CircleGeometry")}setTipsAngle(e){var o;const n=(o=this.helperObject3D.angleTips)==null?void 0:o.element;n&&(n.innerText=`${e.toFixed(0)}°`)}setTipsPosition(e){const n=this.helperObject3D.angleTips;if(!n)return;const o=e.project(this.camera),{x:s,y:r,z:a}=o;if(a>1)return;const l=(s+1)/2*100+"%",c=(-r+1)/2*100+"%";n.setLeftTop(l,c)}}class JC extends no{constructor(...e){super(...e);f(this,"startInfo");f(this,"name","RectangleScaleController")}enable(){this.helperObject3D.enable(),super.enable()}disable(){this.helperObject3D.disable(),super.disable()}show(){this.helperObject3D.show(),super.show()}hide(){this.helperObject3D.hide(),super.hide()}onApplyOriginObjectPosition(e){this.isDragging||super.onApplyOriginObjectPosition(e)}onApplyOriginObjectScale(e){this.helperObject3D.applyHelperScaleMatrix4(e.matrix,e.origin)}getDragPlane(){const e=new I.Plane,n=this.helperObject3D.cornerPositions;if(n.length!==0)return n.length<3?e.setFromNormalAndCoplanarPoint(this.originObject3D.getWorldDirection(new R.Vector3),n[0]):e.setFromCoplanarPoints(n[0],n[1],n[2]),e}dragStart(e,n){var s,r;(r=(s=this.helperObject3D).updatePoints)==null||r.call(s);const o=this.getDragPlane();if(!o)return this.dragEnd();this.startInfo={startPoint:{position:n.position.clone(),direction:n.direction},plane:o},this.hooks.emit("scaleStart"),this.render(),this.isDragging=!0}dragging(e){if(!this.isDragging)return;const n=Ia(this.camera,e,this.container);if(!n)return this.dragEnd();this.scale(n)}scale(e){var X,J;if(!this.startInfo)return;const n=this.originObject3D,{startPoint:o,plane:s}=this.startInfo,r=this.helperObject3D.cornerPositions;if(r.length<4)return this.dragEnd();const a=e.ray.intersectPlane(s,new R.Vector3);if(!a||LC(a,this.camera.position))return;const l=new R.Vector3().addVectors(r[0],r[2]).divideScalar(2),{position:c,direction:d}=o,h=new R.Vector3().subVectors(r[1],r[0]),u=new R.Vector3().subVectors(r[3],r[0]),m=H=>{const Q=new R.Vector3(0,0,0);if(!this.startInfo)return Q;const G=(H==="ew"?h:u).clone(),B=c.clone().projectOnVector(G),W=a.clone().projectOnVector(G),q=l.clone().projectOnVector(G);if(W.equals(B))return Q;if(H==="ns"&&typeof this.startInfo.dragPointInCenterBottom!="boolean"){const re=new R.Vector3().subVectors(W,q),oe=re.x<0&&G.x>=0,Ae=re.y<0&&G.y>=0,we=re.z<0&&G.z>=0;this.startInfo.dragPointInCenterBottom=oe||Ae||we}if(H==="ew"&&typeof this.startInfo.dragPointInCenterLeft!="boolean"){const re=new R.Vector3().subVectors(W,q),oe=re.x<0&&G.x>=0,Ae=re.y<0&&G.y>=0,we=re.z<0&&G.z>=0;this.startInfo.dragPointInCenterLeft=oe||Ae||we}const U=new R.Vector3().subVectors(W,B),Z=U.length();return Z>.3?(console.warn("offset.length() > 0.3, skipped",Z),Q):U},v=m("ew"),g=m("ns"),A=()=>{const H=v;this.helperObject3D.cornerPositions.forEach((Q,G)=>{var B;(B=this.startInfo)!=null&&B.dragPointInCenterLeft?(G===0||G===3)&&Q.add(H):(G===1||G===2)&&Q.add(H)})},b=()=>{const H=g;this.helperObject3D.cornerPositions.forEach((Q,G)=>{var B;(B=this.startInfo)!=null&&B.dragPointInCenterBottom?(G===0||G===1)&&Q.add(H):(G===2||G===3)&&Q.add(H)})};switch(d){case"ew":A();break;case"ns":b();break;case"nesw":case"nwse":A(),b()}const y=new R.Vector3().subVectors(r[1],r[0]).length()/h.length(),E=new R.Vector3().subVectors(r[3],r[0]).length()/u.length(),k=new R.Vector3(y,E,1),S=new I.Matrix4().scale(k);n.isCSS3DObjectPlus?n.applyScaleMatrix4(S):n.scale.applyMatrix4(S),o.position.copy(a);const C=new R.Vector3().addVectors(r[0],r[2]).divideScalar(2),_=new R.Vector3().subVectors(C,l),M=new I.Matrix4().setPosition(_);n.applyMatrix4(M),(X=this.helperObject3D.css3DInstance)==null||X.css3DObject.applyMatrix4(M),(J=this.helperObject3D.plane)==null||J.applyMatrix4(M),this.hooks.emit("applyObjectScale",{matrix:S}),this.hooks.emit("applyObjectPosition",{matrix:M}),this.render()}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.hooks.emit("scaleEnd"),this.render())}}class ZC extends JC{constructor(...e){super(...e);f(this,"name","CSS3DScaleController");this.addHTMLEventListener()}addHTMLEventListener(){this.helperObject3D.points.forEach(e=>{if(!e)return;const n=e.point,o=a=>this.dragStart(a,e),s=this.dragging.bind(this),r=this.dragEnd.bind(this);n.addEventListener("dragstart",o),n.addEventListener("drag",s),n.addEventListener("dragend",r)})}}class KC extends no{constructor(...e){super(...e);f(this,"name","BoundingBoxController")}}class $C extends pu{constructor(t){super(t)}}class eE extends no{constructor(...e){super(...e);f(this,"name","ScaleController")}setScale(e){var l,c,d;let n=1,o=1,s=1;typeof e=="number"?(n=e,o=e,s=e):typeof e=="object"&&(n=(l=e.x)!=null?l:1,o=(c=e.y)!=null?c:1,s=(d=e.z)!=null?d:1);const r=new I.Vector3(n,o,s);this.hooks.emit("wantToScale",r)||(this.originObject3D.scale.copy(r),this.hooks.emit("setObjectScale",r),this.hooks.emit("scale",r),this.render())}}const $r="Object3DHelperPlugin",Ps=$r,tE=()=>{console.error(`${Ps} is disposed`)},nE=()=>{console.warn(`${Ps} is disabled`)},iE=()=>{console.error(`${Ps} is disabled`)};class vu extends eo{constructor(e){super(e);f(this,"name",$r);f(this,"state",{visible:!0,enabled:!0,disposed:!1});f(this,"objectHelperMap",new Map);f(this,"css3DObjectParentMap",new Map);f(this,"css3DRender");this.five=e,this.css3DRender=new ti(this.five.scene),console.warn("Object3DHelper: 使用此插件,需要在初始化five时,设置five参数: { backgroundAlpha: 0, backgroundColor: 0x000000 }"),Object.assign(window,{[`__${$r.toUpperCase()}_DEBUG__`]:this})}show(e){return Y(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return Y(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,n){if(this.state.disposed)return tE();if(!this.state.enabled&&e.enabled!==!0&&e.disposed!==!0)return iE();const o=F({},this.state);this.state=F(F({},this.state),e),e.disposed!==void 0&&e.disposed!==o.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:o})}getObject3DHelper(e){return this.objectHelperMap.get(e)}addObject3DHelper(e,n={}){var m;if(!e)return console.error("Object3D is undefined");if(this.objectHelperMap.has(e)){console.warn(`Object3DHelperPlugin: object3D ${e.name} is already has helper`);return}const o=new UC,s=[],r=(m=this.five.getElement())==null?void 0:m.parentElement,a=this.five.camera,{moveHelper:l=!0,rotateHelper:c=!0,scaleHelper:d=!0,boundingBoxHelper:h=!1}=n,u=new ze.Subscribe;if(l){const v=new TC(e),g=this.getConfig(n.moveHelper),A=new Oi(this.five,GC,e,v,g,u);o.addControllers({moveController:A.helperController}),s.push(()=>A.dispose())}if(c){const v=this.getConfig(n.rotateHelper),g=new VC(e,F({container:r},v)),A=new Oi(this.five,qC,e,g,v,u);o.addControllers({rotateController:A.helperController}),s.push(()=>A.dispose())}if(h){const v=new HC(e),g=new Oi(this.five,KC,e,v,void 0,u);o.addControllers({boundingBoxController:g.helperController})}if(d)if(e.isCSS3DObjectPlus&&r){const v=new QC(e,r,a,this.five.scene),g=new Oi(this.five,ZC,e,v,void 0,u);o.addControllers({scaleController:g.helperController}),s.push(()=>g.dispose()),xd(this.five).then(()=>{var A,b;if(e.isCSS3DObjectPlus){const y=e;if(!y||y.mode!=="front")return;const E=(A=this.css3DRender.behindModeCSS3DRenderer.wrapper)!=null?A:Dd(this.five);E&&(this.css3DObjectParentMap.set(y,y.parent),y.removeFromParent(),this.css3DRender.behindModeCSS3DRenderer.setWrapper(E),(b=this.css3DRender.getBehindCSS3DObjectGroup())==null||b.add(y),this.css3DRender.render(this.five.camera))}})}else{const v=new $C(e),g=new Oi(this.five,eE,e,v,void 0,u);o.addControllers({scaleController:g.helperController}),s.push(()=>g.dispose())}return this.objectHelperMap.set(e,{helper:o,disposers:s}),o.controllers}removeObject3DHelper(e){if(!this.objectHelperMap.has(e))return;const{helper:n,disposers:o}=this.objectHelperMap.get(e);if(n){if(e.isCSS3DObjectPlus){const s=e,r=this.css3DObjectParentMap.get(s);r&&r.add(s),this.css3DRender.render(this.five.camera)}this.objectHelperMap.delete(e),n.dispose(),o==null||o.forEach(s=>s==null?void 0:s())}}handleEnable(e,n=!0){e?(this.everyHelperDo(o=>o.enable()),this.hooks.emit("enable",{userAction:n})):(this.everyHelperDo(o=>o.disable()),this.hooks.emit("disable",{userAction:n})),this.state.enabled=e}handleVisible(e,n=!0){e?(this.everyHelperDo(o=>o.show()),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:n}))):(this.everyHelperDo(o=>o.hide()),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:n}))),this.state.visible=e}handleDispose(){this.objectHelperMap.forEach(({helper:e,disposers:n})=>{e.dispose(),n==null||n.forEach(o=>o==null?void 0:o())})}everyHelperDo(e){this.objectHelperMap.forEach(({helper:n,disposers:o})=>{n&&e(n)})}actionIfStateIsEnabled(e,n){if(this.state.enabled)return e();n!=null&&n.warnLog&&nE()}getConfig(e){if(e&&typeof e!="boolean"&&e.enable)return e}}const oE=i=>new vu(i),sE=`
669
669
  varying vec2 vUv;
670
670
  void main() {
671
671
  vUv = uv;