@mapxus/mapxus-visual-jp 1.8.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bitbucket-pipelines.yml +50 -0
- package/config/rollup.js +33 -0
- package/config/rollup.serve.config.js +3 -0
- package/debug/circlemarker.html +444 -0
- package/debug/create_tags.html +474 -0
- package/debug/distance.html +220 -0
- package/debug/index.html +92 -0
- package/debug/integration.html +1084 -0
- package/debug/leaflet.html +54 -0
- package/debug/markers.html +115 -0
- package/debug/multi_monitor_sync.html +377 -0
- package/debug/outdoor.html +1026 -0
- package/debug/rect_tags.html +147 -0
- package/debug/rotate.html +236 -0
- package/debug/sample.html +324 -0
- package/debug/sequence.html +75 -0
- package/debug/tags.html +218 -0
- package/package.json +34 -10
- package/rollup.config.js +39 -0
- package/server.js +35 -0
- package/spec/api/APIv3.spec.ts +86 -0
- package/spec/component/Component.spec.ts +68 -0
- package/spec/component/StatsComponent.spec.ts +33 -0
- package/spec/component/direction/DirectionComponent.spec.ts +163 -0
- package/spec/component/direction/DirectionDOMRenderer.spec.ts +233 -0
- package/spec/component/keyboard/KeyZoomHandler.spec.ts +236 -0
- package/spec/component/marker/Marker.spec.ts +104 -0
- package/spec/component/marker/MarkerComponent.spec.ts +88 -0
- package/spec/component/marker/MarkerScene.spec.ts +223 -0
- package/spec/component/marker/MarkerSet.spec.ts +453 -0
- package/spec/component/mouse/DoubleClickZoomHandler.spec.ts +211 -0
- package/spec/component/popup/Popup.spec.ts +479 -0
- package/spec/component/popup/PopupComponent.spec.ts +414 -0
- package/spec/component/tag/CreateHandlerBase.spec.ts +83 -0
- package/spec/component/tag/CreatePointHandler.spec.ts +190 -0
- package/spec/component/tag/OutlineRenderTag.spec.ts +91 -0
- package/spec/component/tag/PointGeometry.spec.ts +131 -0
- package/spec/component/tag/PolygonGeometry.spec.ts +497 -0
- package/spec/component/tag/RectGeometry.spec.ts +1157 -0
- package/spec/component/tag/TagComponent.spec.ts +513 -0
- package/spec/component/tag/TagScene.spec.ts +346 -0
- package/spec/component/tag/TagSet.spec.ts +241 -0
- package/spec/component/utils/HandlerBase.spec.ts +203 -0
- package/spec/geo/Camera.spec.ts +250 -0
- package/spec/geo/GeoCoords.spec.ts +364 -0
- package/spec/geo/Spatial.spec.ts +711 -0
- package/spec/geo/Transform.spec.ts +850 -0
- package/spec/geo/ViewportCoords.spec.ts +534 -0
- package/spec/graph/FilterCreator.spec.ts +892 -0
- package/spec/graph/Graph.spec.ts +2078 -0
- package/spec/graph/GraphCalculator.spec.ts +263 -0
- package/spec/graph/GraphService.spec.ts +663 -0
- package/spec/graph/Node.spec.ts +373 -0
- package/spec/graph/NodeCache.spec.ts +206 -0
- package/spec/graph/Sequence.spec.ts +37 -0
- package/spec/graph/edge/EdgeCalculator.Pano.spec.ts +963 -0
- package/spec/graph/edge/EdgeCalculator.Sequence.spec.ts +108 -0
- package/spec/graph/edge/EdgeCalculator.Similar.spec.ts +272 -0
- package/spec/graph/edge/EdgeCalculator.Step.spec.ts +383 -0
- package/spec/graph/edge/EdgeCalculator.Turn.spec.ts +278 -0
- package/spec/graph/edge/EdgeCalculator.spec.ts +747 -0
- package/spec/helper/ContainerMockCreator.spec.ts +33 -0
- package/spec/helper/DOMRendererMockCreator.spec.ts +22 -0
- package/spec/helper/EdgeCalculatorHelper.spec.ts +96 -0
- package/spec/helper/EventHelper.spec.ts +92 -0
- package/spec/helper/GLRendererMockCreator.spec.ts +23 -0
- package/spec/helper/GeoHelper.spec.ts +16 -0
- package/spec/helper/ImageLoadingServiceMockCreator.spec.ts +24 -0
- package/spec/helper/KeyboardServiceMockCreator.spec.ts +21 -0
- package/spec/helper/LoadingServiceMockCreator.spec.ts +21 -0
- package/spec/helper/MockCreator.spec.ts +18 -0
- package/spec/helper/MockCreatorBase.spec.ts +17 -0
- package/spec/helper/MouseServiceMockCreator.spec.ts +38 -0
- package/spec/helper/NavigatorMockCreator.spec.ts +28 -0
- package/spec/helper/NodeHelper.spec.ts +77 -0
- package/spec/helper/NodeMockCreator.spec.ts +19 -0
- package/spec/helper/RenderServiceMockCreator.spec.ts +25 -0
- package/spec/helper/SpriteServiceMockCreator.spec.ts +22 -0
- package/spec/helper/StateServiceMockCreator.spec.ts +33 -0
- package/spec/helper/TouchServiceMockCreator.spec.ts +29 -0
- package/spec/helper/TransformHelper.spec.ts +17 -0
- package/spec/render/DOMRenderer.spec.ts +112 -0
- package/spec/render/GLRenderer.spec.ts +453 -0
- package/spec/render/RenderCamera.spec.ts +535 -0
- package/spec/render/RenderService.spec.ts +531 -0
- package/spec/state/StateBase.spec.ts +369 -0
- package/spec/state/StateService.spec.ts +9 -0
- package/spec/state/TraversingState.spec.ts +262 -0
- package/spec/state/WaitingState.spec.ts +319 -0
- package/spec/tiles/TextureProvider.spec.ts +653 -0
- package/spec/utils/EventEmitter.spec.ts +71 -0
- package/spec/utils/Support.spec.ts +54 -0
- package/spec/viewer/CacheService.spec.ts +160 -0
- package/spec/viewer/ComponentController.spec.ts +310 -0
- package/spec/viewer/LoadingService.spec.ts +19 -0
- package/spec/viewer/MouseService.spec.ts +1344 -0
- package/spec/viewer/Navigator.spec.ts +970 -0
- package/spec/viewer/Observer.spec.ts +96 -0
- package/spec/viewer/SpriteService.spec.ts +224 -0
- package/src/API.ts +3 -0
- package/src/Component.ts +77 -0
- package/src/Edge.ts +6 -0
- package/src/Error.ts +3 -0
- package/src/FilterRender.ts +27 -0
- package/src/Geo.ts +7 -0
- package/src/Graph.ts +19 -0
- package/src/MapxusVisual.ts +66 -0
- package/src/Render.ts +7 -0
- package/src/State.ts +8 -0
- package/src/Support.ts +35 -0
- package/src/Tiles.ts +5 -0
- package/src/Utils.ts +6 -0
- package/src/Viewer.ts +16 -0
- package/src/api/API.ts +396 -0
- package/src/api/Auth.ts +76 -0
- package/src/api/AuthStore.ts +11 -0
- package/src/api/GraphQLCreator.ts +100 -0
- package/src/api/interfaces/IAuth.ts +7 -0
- package/src/api/interfaces/IBuildingBase.ts +7 -0
- package/src/api/interfaces/IBuildingInfo.ts +19 -0
- package/src/api/interfaces/ICoreNode.ts +28 -0
- package/src/api/interfaces/IFillNode.ts +96 -0
- package/src/api/interfaces/IFloorInfo.ts +10 -0
- package/src/api/interfaces/IFullNode.ts +10 -0
- package/src/api/interfaces/IGPano.ts +38 -0
- package/src/api/interfaces/IImageTagInfo.ts +14 -0
- package/src/api/interfaces/IKey.ts +13 -0
- package/src/api/interfaces/ILatLon.ts +19 -0
- package/src/api/interfaces/IOutdoor.ts +14 -0
- package/src/api/interfaces/IPathNode.ts +37 -0
- package/src/api/interfaces/IProject.ts +8 -0
- package/src/api/interfaces/IQueryBuilding.ts +37 -0
- package/src/api/interfaces/IResponse.ts +7 -0
- package/src/api/interfaces/ISequence.ts +16 -0
- package/src/api/interfaces/IUser.ts +13 -0
- package/src/api/interfaces/interfaces.ts +17 -0
- package/src/component/AttributionComponent.ts +48 -0
- package/src/component/BackgroundComponent.ts +39 -0
- package/src/component/BearingComponent.ts +282 -0
- package/src/component/CacheComponent.ts +295 -0
- package/src/component/Component.ts +130 -0
- package/src/component/ComponentService.ts +150 -0
- package/src/component/CoverComponent.ts +132 -0
- package/src/component/DebugComponent.ts +157 -0
- package/src/component/ImageComponent.ts +96 -0
- package/src/component/LoadingComponent.ts +85 -0
- package/src/component/NavigationComponent.ts +233 -0
- package/src/component/RouteComponent.ts +354 -0
- package/src/component/StatsComponent.ts +100 -0
- package/src/component/direction/DirectionComponent.ts +254 -0
- package/src/component/direction/DirectionDOMCalculator.ts +243 -0
- package/src/component/direction/DirectionDOMRenderer.ts +631 -0
- package/src/component/imageplane/ImagePlaneComponent.ts +497 -0
- package/src/component/imageplane/ImagePlaneFactory.ts +314 -0
- package/src/component/imageplane/ImagePlaneGLRenderer.ts +247 -0
- package/src/component/imageplane/ImagePlaneScene.ts +87 -0
- package/src/component/imageplane/ImagePlaneShaders.ts +16 -0
- package/src/component/imageplane/SliderComponent.ts +697 -0
- package/src/component/imageplane/interfaces/IBBoxShaderMaterial.ts +10 -0
- package/src/component/imageplane/interfaces/IShaderMaterial.ts +9 -0
- package/src/component/imageplane/interfaces/interfaces.ts +2 -0
- package/src/component/imageplane/shaders/equirectangular.fragment.glsl.ts +26 -0
- package/src/component/imageplane/shaders/equirectangular.vertex.glsl.ts +15 -0
- package/src/component/imageplane/shaders/perspective.fragment.glsl.ts +27 -0
- package/src/component/imageplane/shaders/perspective.vertex.glsl.ts +15 -0
- package/src/component/interfaces/ICacheConfiguration.ts +72 -0
- package/src/component/interfaces/IComponentConfiguration.ts +5 -0
- package/src/component/interfaces/ICoverConfiguration.ts +15 -0
- package/src/component/interfaces/IDirectionConfiguration.ts +63 -0
- package/src/component/interfaces/IImagePlaneConfiguration.ts +17 -0
- package/src/component/interfaces/IKeyboardConfiguration.ts +44 -0
- package/src/component/interfaces/IMarkerConfiguration.ts +31 -0
- package/src/component/interfaces/IMouseConfiguration.ts +52 -0
- package/src/component/interfaces/INavigationConfiguration.ts +35 -0
- package/src/component/interfaces/IRouteConfiguration.ts +20 -0
- package/src/component/interfaces/ISequenceConfiguration.ts +72 -0
- package/src/component/interfaces/IShader.ts +6 -0
- package/src/component/interfaces/ISliderConfiguration.ts +61 -0
- package/src/component/interfaces/ITagConfiguration.ts +40 -0
- package/src/component/interfaces/interfaces.ts +17 -0
- package/src/component/keyboard/KeySequenceNavigationHandler.ts +86 -0
- package/src/component/keyboard/KeySpatialNavigationHandler.ts +216 -0
- package/src/component/keyboard/KeyZoomHandler.ts +106 -0
- package/src/component/keyboard/KeyboardComponent.ts +125 -0
- package/src/component/marker/Marker.ts +5 -0
- package/src/component/marker/MarkerComponent.ts +856 -0
- package/src/component/marker/MarkerScene.ts +145 -0
- package/src/component/marker/MarkerSet.ts +142 -0
- package/src/component/marker/interfaces/IArrowMarkerOptions.ts +41 -0
- package/src/component/marker/interfaces/ICircleMarkerOptions.ts +30 -0
- package/src/component/marker/interfaces/IDotMarkerOptions.ts +18 -0
- package/src/component/marker/interfaces/IMarkerEvent.ts +28 -0
- package/src/component/marker/interfaces/ISimpleMarkerOptions.ts +54 -0
- package/src/component/marker/interfaces/interfaces.ts +5 -0
- package/src/component/marker/marker/ArrowMarker.ts +84 -0
- package/src/component/marker/marker/CircleMarker.ts +82 -0
- package/src/component/marker/marker/DotMarker.ts +68 -0
- package/src/component/marker/marker/ImageMarker.ts +45 -0
- package/src/component/marker/marker/Marker.ts +99 -0
- package/src/component/marker/marker/SimpleMarker.ts +187 -0
- package/src/component/mouse/BounceHandler.ts +148 -0
- package/src/component/mouse/DoubleClickZoomHandler.ts +106 -0
- package/src/component/mouse/DragPanHandler.ts +489 -0
- package/src/component/mouse/HandlerTypes.ts +13 -0
- package/src/component/mouse/MouseComponent.ts +170 -0
- package/src/component/mouse/ScrollZoomHandler.ts +137 -0
- package/src/component/mouse/TouchZoomHandler.ts +136 -0
- package/src/component/path/PathComponent.ts +75 -0
- package/src/component/path/PathEvent.ts +245 -0
- package/src/component/path/PathMarker.ts +42 -0
- package/src/component/path/PathRender.ts +163 -0
- package/src/component/popup/Popup.ts +2 -0
- package/src/component/popup/PopupComponent.ts +244 -0
- package/src/component/popup/interfaces/IPopupOffset.ts +37 -0
- package/src/component/popup/interfaces/IPopupOptions.ts +81 -0
- package/src/component/popup/popup/Popup.ts +594 -0
- package/src/component/popup/popup/PopupAlignment.ts +3 -0
- package/src/component/sequence/SequenceComponent.ts +500 -0
- package/src/component/sequence/SequenceDOMInteraction.ts +23 -0
- package/src/component/sequence/SequenceDOMRenderer.ts +179 -0
- package/src/component/tag/Tag.ts +9 -0
- package/src/component/tag/TagComponent.ts +787 -0
- package/src/component/tag/TagCreator.ts +138 -0
- package/src/component/tag/TagDOMRenderer.ts +35 -0
- package/src/component/tag/TagMode.ts +37 -0
- package/src/component/tag/TagOperation.ts +7 -0
- package/src/component/tag/TagScene.ts +216 -0
- package/src/component/tag/TagSet.ts +186 -0
- package/src/component/tag/error/GeometryTagError.ts +11 -0
- package/src/component/tag/geometry/Geometry.ts +62 -0
- package/src/component/tag/geometry/PointGeometry.ts +89 -0
- package/src/component/tag/geometry/PolygonGeometry.ts +349 -0
- package/src/component/tag/geometry/RectGeometry.ts +759 -0
- package/src/component/tag/geometry/VertexGeometry.ts +185 -0
- package/src/component/tag/handlers/CreateHandlerBase.ts +81 -0
- package/src/component/tag/handlers/CreatePointHandler.ts +35 -0
- package/src/component/tag/handlers/CreatePolygonHandler.ts +33 -0
- package/src/component/tag/handlers/CreateRectDragHandler.ts +199 -0
- package/src/component/tag/handlers/CreateRectHandler.ts +57 -0
- package/src/component/tag/handlers/CreateVertexHandler.ts +165 -0
- package/src/component/tag/handlers/EditVertexHandler.ts +275 -0
- package/src/component/tag/handlers/TagHandlerBase.ts +57 -0
- package/src/component/tag/interfaces/IInteraction.ts +14 -0
- package/src/component/tag/interfaces/IOutlineCreateTagOptions.ts +15 -0
- package/src/component/tag/interfaces/IOutlineTagOptions.ts +89 -0
- package/src/component/tag/interfaces/ISpotTagOptions.ts +37 -0
- package/src/component/tag/interfaces/interfaces.ts +4 -0
- package/src/component/tag/tag/OutlineCreateTag.ts +330 -0
- package/src/component/tag/tag/OutlineRenderTag.ts +569 -0
- package/src/component/tag/tag/OutlineTag.ts +380 -0
- package/src/component/tag/tag/RenderTag.ts +50 -0
- package/src/component/tag/tag/SpotRenderTag.ts +160 -0
- package/src/component/tag/tag/SpotTag.ts +170 -0
- package/src/component/tag/tag/Tag.ts +103 -0
- package/src/component/utils/HandlerBase.ts +71 -0
- package/src/error/ArgumentBeeviewError.ts +11 -0
- package/src/error/BeeviewError.ts +9 -0
- package/src/error/GraphBeeviewError.ts +11 -0
- package/src/geo/Camera.ts +149 -0
- package/src/geo/GeoCoords.ts +280 -0
- package/src/geo/GeoRBush.ts +25 -0
- package/src/geo/Spatial.ts +259 -0
- package/src/geo/Transform.ts +543 -0
- package/src/geo/ViewportCoords.ts +518 -0
- package/src/geo/interfaces/ILatLonAlt.ts +7 -0
- package/src/geo/interfaces/interfaces.ts +1 -0
- package/src/graph/FilterCreator.ts +106 -0
- package/src/graph/FilterExpression.ts +16 -0
- package/src/graph/Graph.ts +1516 -0
- package/src/graph/GraphCalculator.ts +197 -0
- package/src/graph/GraphService.ts +516 -0
- package/src/graph/ImageLoadingService.ts +44 -0
- package/src/graph/MeshReader.ts +19 -0
- package/src/graph/Node.ts +622 -0
- package/src/graph/NodeCache.ts +548 -0
- package/src/graph/Sequence.ts +117 -0
- package/src/graph/edge/EdgeCalculator.ts +919 -0
- package/src/graph/edge/EdgeCalculatorCoefficients.ts +43 -0
- package/src/graph/edge/EdgeCalculatorDirections.ts +80 -0
- package/src/graph/edge/EdgeCalculatorSettings.ts +61 -0
- package/src/graph/edge/EdgeDirection.ts +63 -0
- package/src/graph/edge/interfaces/IEdge.ts +26 -0
- package/src/graph/edge/interfaces/IEdgeData.ts +22 -0
- package/src/graph/edge/interfaces/IPano.ts +8 -0
- package/src/graph/edge/interfaces/IPotentialEdge.ts +106 -0
- package/src/graph/edge/interfaces/IStep.ts +7 -0
- package/src/graph/edge/interfaces/ITurn.ts +7 -0
- package/src/graph/edge/interfaces/interfaces.ts +6 -0
- package/src/graph/interfaces/IEdgeStatus.ts +25 -0
- package/src/graph/interfaces/IGraphConfiguration.ts +26 -0
- package/src/graph/interfaces/ILoadStatus.ts +18 -0
- package/src/graph/interfaces/ILoadStatusObject.ts +8 -0
- package/src/graph/interfaces/IMesh.ts +20 -0
- package/src/graph/interfaces/interfaces.ts +5 -0
- package/src/render/DOMRenderer.ts +288 -0
- package/src/render/GLRenderStage.ts +6 -0
- package/src/render/GLRenderer.ts +436 -0
- package/src/render/RenderCamera.ts +212 -0
- package/src/render/RenderMode.ts +34 -0
- package/src/render/RenderService.ts +264 -0
- package/src/render/interfaces/IGLRender.ts +10 -0
- package/src/render/interfaces/IGLRenderFunction.ts +10 -0
- package/src/render/interfaces/IGLRenderHash.ts +8 -0
- package/src/render/interfaces/ISize.ts +6 -0
- package/src/render/interfaces/IVNodeHash.ts +8 -0
- package/src/render/interfaces/interfaces.ts +5 -0
- package/src/state/FrameGenerator.ts +36 -0
- package/src/state/State.ts +6 -0
- package/src/state/StateContext.ts +180 -0
- package/src/state/StateService.ts +600 -0
- package/src/state/StateTransitionMatrix.ts +58 -0
- package/src/state/interfaces/ICurrentState.ts +21 -0
- package/src/state/interfaces/IFrame.ts +9 -0
- package/src/state/interfaces/IRotation.ts +6 -0
- package/src/state/interfaces/IState.ts +11 -0
- package/src/state/interfaces/IStateContext.ts +31 -0
- package/src/state/interfaces/interfaces.ts +5 -0
- package/src/state/states/StateBase.ts +425 -0
- package/src/state/states/TraversingState.ts +861 -0
- package/src/state/states/WaitingState.ts +109 -0
- package/src/tiles/ImageTileLoader.ts +121 -0
- package/src/tiles/ImageTileStore.ts +70 -0
- package/src/tiles/RegionOfInterestCalculator.ts +158 -0
- package/src/tiles/TextureProvider.ts +609 -0
- package/src/tiles/interfaces/IBoundingBox.ts +28 -0
- package/src/tiles/interfaces/IRegionOfInterest.ts +25 -0
- package/src/tiles/interfaces/interfaces.ts +2 -0
- package/src/utils/DOM.ts +28 -0
- package/src/utils/EventEmitter.ts +61 -0
- package/src/utils/Func.ts +3 -0
- package/src/utils/Settings.ts +39 -0
- package/src/utils/Support.ts +70 -0
- package/src/utils/Urls.ts +43 -0
- package/src/viewer/Alignment.ts +53 -0
- package/src/viewer/CacheService.ts +75 -0
- package/src/viewer/ComponentController.ts +237 -0
- package/src/viewer/Container.ts +100 -0
- package/src/viewer/EventNames.ts +192 -0
- package/src/viewer/ImageSize.ts +28 -0
- package/src/viewer/KeyboardService.ts +15 -0
- package/src/viewer/LoadingService.ts +66 -0
- package/src/viewer/MouseService.ts +541 -0
- package/src/viewer/Navigator.ts +362 -0
- package/src/viewer/Observer.ts +441 -0
- package/src/viewer/Projection.ts +162 -0
- package/src/viewer/SpriteService.ts +281 -0
- package/src/viewer/TouchService.ts +336 -0
- package/src/viewer/Viewer.ts +1132 -0
- package/src/viewer/interfaces/IComponentOptions.ts +176 -0
- package/src/viewer/interfaces/IMouseClaim.ts +6 -0
- package/src/viewer/interfaces/IMouseDeferPixels.ts +6 -0
- package/src/viewer/interfaces/IPinch.ts +81 -0
- package/src/viewer/interfaces/ISpriteAtlas.ts +12 -0
- package/src/viewer/interfaces/IUnprojection.ts +9 -0
- package/src/viewer/interfaces/IViewerMouseEvent.ts +56 -0
- package/src/viewer/interfaces/IViewerOptions.ts +88 -0
- package/src/viewer/interfaces/PointOfView.ts +19 -0
- package/src/viewer/interfaces/interfaces.ts +9 -0
- package/styles/AttributionComponent.css +26 -0
- package/styles/BackgroundComponent.css +21 -0
- package/styles/BearingComponent.css +48 -0
- package/styles/CoverComponent.css +169 -0
- package/styles/DebugComponent.css +28 -0
- package/styles/DirectionComponent.css +154 -0
- package/styles/LoadingComponent.css +14 -0
- package/styles/NavigationComponent.css +64 -0
- package/styles/NorthBg.png +0 -0
- package/styles/PopupComponent.css +188 -0
- package/styles/RouteComponent.css +21 -0
- package/styles/SequenceComponent.css +120 -0
- package/styles/SliderComponent.css +82 -0
- package/styles/TagComponent.css +105 -0
- package/styles/cover-logo.png +0 -0
- package/styles/mapillary-js.css +29 -0
- package/styles/pano-indicator.svg +3 -0
- package/styles/pano.svg +20 -0
- package/styles/pointer-wheat.svg +3 -0
- package/styles/pointer-white.svg +3 -0
- package/styles/spinner.svg +1 -0
- package/styles/stepper-left.svg +1 -0
- package/styles/stepper-play.svg +1 -0
- package/styles/stepper-right.svg +1 -0
- package/styles/stepper-stop.svg +1 -0
- package/styles/turn-around.svg +3 -0
- package/styles/turn.svg +3 -0
- package/tsconfig.json +28 -0
- package/tslint.json +81 -0
- package/types/graphql/index.d.ts +28 -0
- package/types/graphql/language/ast/index.d.ts +7 -0
- package/types/images/index.d.ts +7 -0
- package/types/pbf/index.d.ts +16 -0
- package/types/rbush/index.d.ts +28 -0
- package/version/beeview-0.1.0.css +2 -0
- package/version/beeview-0.1.0.js +1 -0
- package/version/beeview-0.1.1.css +2 -0
- package/version/beeview-0.1.1.js +1 -0
- package/version/beeview-0.1.2.css +2 -0
- package/version/beeview-0.1.2.js +1 -0
- package/version/beeview-0.2.0.css +2 -0
- package/version/beeview-0.2.0.js +1 -0
- package/version/beeview-0.2.1.css +2 -0
- package/version/beeview-0.2.1.js +1 -0
- package/version/beeview-0.3.0.css +2 -0
- package/version/beeview-0.3.0.js +1 -0
- package/version/beeview-0.4.0.css +2 -0
- package/version/beeview-0.4.0.js +1 -0
- package/version/beeview-0.4.1.css +2 -0
- package/version/beeview-0.4.1.js +1 -0
- package/version/mapxus-visual-1.0.0.css +2 -0
- package/version/mapxus-visual-1.0.0.js +1 -0
- package/version/mapxus-visual-1.1.0.css +2 -0
- package/version/mapxus-visual-1.1.0.js +1 -0
- package/version/mapxus-visual-1.1.1.css +2 -0
- package/version/mapxus-visual-1.1.1.js +1 -0
- package/version/mapxus-visual-1.1.2.css +2 -0
- package/version/mapxus-visual-1.1.2.js +1 -0
- package/version/mapxus-visual-1.2.0.css +2 -0
- package/version/mapxus-visual-1.2.0.js +1 -0
- package/version/mapxus-visual-1.3.0.css +2 -0
- package/version/mapxus-visual-1.3.0.js +1 -0
- package/LICENSE +0 -11
- package/README.md +0 -28
- package/index.css +0 -2
- package/index.d.ts +0 -163
- package/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MapxusVisual=f()}}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(require,module,exports){"use strict";var Queue=require("tinyqueue");function polylabel(polygon,precision,debug){var minX,minY,maxX,maxY;precision=precision||1;for(var i=0;i<polygon[0].length;i++){var p=polygon[0][i];(!i||p[0]<minX)&&(minX=p[0]),(!i||p[1]<minY)&&(minY=p[1]),(!i||p[0]>maxX)&&(maxX=p[0]),(!i||p[1]>maxY)&&(maxY=p[1])}var width=maxX-minX,height=maxY-minY,cellSize=Math.min(width,height),h=cellSize/2,cellQueue=new Queue(null,compareMax);if(0===cellSize)return[minX,minY];for(var x=minX;x<maxX;x+=cellSize)for(var y=minY;y<maxY;y+=cellSize)cellQueue.push(new Cell(x+h,y+h,h,polygon));var bestCell=function(polygon){for(var area=0,x=0,y=0,points=polygon[0],i=0,len=points.length,j=len-1;i<len;j=i++){var a=points[i],b=points[j],f=a[0]*b[1]-b[0]*a[1];x+=(a[0]+b[0])*f,y+=(a[1]+b[1])*f,area+=3*f}return 0===area?new Cell(points[0][0],points[0][1],0,polygon):new Cell(x/area,y/area,0,polygon)}(polygon),bboxCell=new Cell(minX+width/2,minY+height/2,0,polygon);bboxCell.d>bestCell.d&&(bestCell=bboxCell);for(var numProbes=cellQueue.length;cellQueue.length;){var cell=cellQueue.pop();cell.d>bestCell.d&&(bestCell=cell,debug&&console.log("found best %d after %d probes",Math.round(1e4*cell.d)/1e4,numProbes)),cell.max-bestCell.d<=precision||(h=cell.h/2,cellQueue.push(new Cell(cell.x-h,cell.y-h,h,polygon)),cellQueue.push(new Cell(cell.x+h,cell.y-h,h,polygon)),cellQueue.push(new Cell(cell.x-h,cell.y+h,h,polygon)),cellQueue.push(new Cell(cell.x+h,cell.y+h,h,polygon)),numProbes+=4)}return debug&&(console.log("num probes: "+numProbes),console.log("best distance: "+bestCell.d)),[bestCell.x,bestCell.y]}function compareMax(a,b){return b.max-a.max}function Cell(x,y,h,polygon){this.x=x,this.y=y,this.h=h,this.d=function(x,y,polygon){for(var inside=!1,minDistSq=1/0,k=0;k<polygon.length;k++)for(var ring=polygon[k],i=0,len=ring.length,j=len-1;i<len;j=i++){var a=ring[i],b=ring[j];a[1]>y!=b[1]>y&&x<(b[0]-a[0])*(y-a[1])/(b[1]-a[1])+a[0]&&(inside=!inside),minDistSq=Math.min(minDistSq,getSegDistSq(x,y,a,b))}return(inside?1:-1)*Math.sqrt(minDistSq)}(x,y,polygon),this.max=this.d+this.h*Math.SQRT2}function getSegDistSq(px,py,a,b){var x=a[0],y=a[1],dx=b[0]-x,dy=b[1]-y;if(0!==dx||0!==dy){var t=((px-x)*dx+(py-y)*dy)/(dx*dx+dy*dy);1<t?(x=b[0],y=b[1]):0<t&&(x+=dx*t,y+=dy*t)}return(dx=px-x)*dx+(dy=py-y)*dy}module.exports=polylabel,module.exports.default=polylabel},{tinyqueue:289}],2:[function(require,module,exports){function UnitBezier(p1x,p1y,p2x,p2y){this.cx=3*p1x,this.bx=3*(p2x-p1x)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*p1y,this.by=3*(p2y-p1y)-this.cy,this.ay=1-this.cy-this.by,this.p1x=p1x,this.p1y=p2y,this.p2x=p2x,this.p2y=p2y}(module.exports=UnitBezier).prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},UnitBezier.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},UnitBezier.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},UnitBezier.prototype.solveCurveX=function(x,epsilon){var t0,t1,t2,x2,i;for(void 0===epsilon&&(epsilon=1e-6),t2=x,i=0;i<8;i++){if(x2=this.sampleCurveX(t2)-x,Math.abs(x2)<epsilon)return t2;var d2=this.sampleCurveDerivativeX(t2);if(Math.abs(d2)<1e-6)break;t2-=x2/d2}if((t2=x)<(t0=0))return t0;if((t1=1)<t2)return t1;for(;t0<t1;){if(x2=this.sampleCurveX(t2),Math.abs(x2-x)<epsilon)return t2;x2<x?t0=t2:t1=t2,t2=.5*(t1-t0)+t0}return t2},UnitBezier.prototype.solve=function(x,epsilon){return this.sampleCurveY(this.solveCurveX(x,epsilon))}},{}],3:[function(require,module,exports){(function(process){"use strict";function _interopDefault(ex){return ex&&"object"==typeof ex&&"default"in ex?ex.default:ex}Object.defineProperty(exports,"__esModule",{value:!0});var tslib=require("tslib"),ApolloClient__default=require("apollo-client"),ApolloClient__default__default=_interopDefault(ApolloClient__default),apolloLink=require("apollo-link"),apolloCacheInmemory=require("apollo-cache-inmemory"),apolloLinkHttp=require("apollo-link-http"),apolloLinkError=require("apollo-link-error"),graphqlTag=_interopDefault(require("graphql-tag")),tsInvariant=require("ts-invariant"),PRESET_CONFIG_KEYS=["request","uri","credentials","headers","fetch","fetchOptions","clientState","onError","cacheRedirects","cache","name","version","resolvers","typeDefs","fragmentMatcher"],DefaultClient=function(_super){function DefaultClient(config){void 0===config&&(config={});if(config){var diff=Object.keys(config).filter(function(key){return-1===PRESET_CONFIG_KEYS.indexOf(key)});0<diff.length&&("production"===process.env.NODE_ENV||tsInvariant.invariant.warn("ApolloBoost was initialized with unsupported options: "+diff.join(" ")))}var request=config.request,uri=config.uri,credentials=config.credentials,headers=config.headers,fetch=config.fetch,fetchOptions=config.fetchOptions,clientState=config.clientState,cacheRedirects=config.cacheRedirects,errorCallback=config.onError,name=config.name,version=config.version,resolvers=config.resolvers,typeDefs=config.typeDefs,fragmentMatcher=config.fragmentMatcher,cache=config.cache;"production"===process.env.NODE_ENV?tsInvariant.invariant(!cache||!cacheRedirects):tsInvariant.invariant(!cache||!cacheRedirects,"Incompatible cache configuration. If providing `cache` then configure the provided instance with `cacheRedirects` instead."),cache||(cache=cacheRedirects?new apolloCacheInmemory.InMemoryCache({cacheRedirects:cacheRedirects}):new apolloCacheInmemory.InMemoryCache);var errorLink=errorCallback?apolloLinkError.onError(errorCallback):apolloLinkError.onError(function(_a){var graphQLErrors=_a.graphQLErrors,networkError=_a.networkError;graphQLErrors&&graphQLErrors.map(function(_a){var message=_a.message,locations=_a.locations,path=_a.path;return"production"===process.env.NODE_ENV||tsInvariant.invariant.warn("[GraphQL error]: Message: "+message+", Location: "+locations+", Path: "+path)}),networkError&&("production"===process.env.NODE_ENV||tsInvariant.invariant.warn("[Network error]: "+networkError))}),requestHandler=!!request&&new apolloLink.ApolloLink(function(operation,forward){return new apolloLink.Observable(function(observer){var handle;return Promise.resolve(operation).then(function(oper){return request(oper)}).then(function(){handle=forward(operation).subscribe({next:observer.next.bind(observer),error:observer.error.bind(observer),complete:observer.complete.bind(observer)})}).catch(observer.error.bind(observer)),function(){handle&&handle.unsubscribe()}})}),httpLink=new apolloLinkHttp.HttpLink({uri:uri||"/graphql",fetch:fetch,fetchOptions:fetchOptions||{},credentials:credentials||"same-origin",headers:headers||{}}),link=apolloLink.ApolloLink.from([errorLink,requestHandler,httpLink].filter(function(x){return!!x})),activeResolvers=resolvers,activeTypeDefs=typeDefs,activeFragmentMatcher=fragmentMatcher;return clientState&&(clientState.defaults&&cache.writeData({data:clientState.defaults}),activeResolvers=clientState.resolvers,activeTypeDefs=clientState.typeDefs,activeFragmentMatcher=clientState.fragmentMatcher),_super.call(this,{cache:cache,link:link,name:name,version:version,resolvers:activeResolvers,typeDefs:activeTypeDefs,fragmentMatcher:activeFragmentMatcher})||this}return tslib.__extends(DefaultClient,_super),DefaultClient}(ApolloClient__default__default);Object.keys(ApolloClient__default).forEach(function(key){exports[key]=ApolloClient__default[key]}),Object.keys(apolloLink).forEach(function(key){exports[key]=apolloLink[key]}),Object.keys(apolloCacheInmemory).forEach(function(key){exports[key]=apolloCacheInmemory[key]}),exports.HttpLink=apolloLinkHttp.HttpLink,exports.gql=graphqlTag,exports.default=DefaultClient}).call(this,require("_process"))},{_process:47,"apollo-cache-inmemory":4,"apollo-client":6,"apollo-link":14,"apollo-link-error":9,"apollo-link-http":13,"graphql-tag":53,"ts-invariant":290,tslib:291}],4:[function(require,module,exports){(function(process){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib=require("tslib"),apolloCache=require("apollo-cache"),apolloUtilities=require("apollo-utilities"),optimism=require("optimism"),tsInvariant=require("ts-invariant"),testMap=new Map;if(testMap.set(1,2)!==testMap){var set_1=testMap.set;Map.prototype.set=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return set_1.apply(this,args),this}}var testSet=new Set;if(testSet.add(3)!==testSet){var add_1=testSet.add;Set.prototype.add=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return add_1.apply(this,args),this}}var frozen={};"function"==typeof Object.freeze&&Object.freeze(frozen);try{testMap.set(frozen,frozen).delete(frozen)}catch(_a){var wrap=function(method){return method&&function(obj){try{testMap.set(obj,obj).delete(obj)}finally{return method.call(Object,obj)}}};Object.freeze=wrap(Object.freeze),Object.seal=wrap(Object.seal),Object.preventExtensions=wrap(Object.preventExtensions)}var haveWarned=!1;function shouldWarn(){var answer=!haveWarned;return apolloUtilities.isTest()||(haveWarned=!0),answer}var HeuristicFragmentMatcher=function(){function HeuristicFragmentMatcher(){}return HeuristicFragmentMatcher.prototype.ensureReady=function(){return Promise.resolve()},HeuristicFragmentMatcher.prototype.canBypassInit=function(){return!0},HeuristicFragmentMatcher.prototype.match=function(idValue,typeCondition,context){var obj=context.store.get(idValue.id);return!obj&&"ROOT_QUERY"===idValue.id||!!obj&&(obj.__typename?obj.__typename===typeCondition||(shouldWarn()&&("production"===process.env.NODE_ENV||tsInvariant.invariant.error("You are using the simple (heuristic) fragment matcher, but your queries contain union or interface types. Apollo Client will not be able to accurately map fragments. To make this error go away, use the `IntrospectionFragmentMatcher` as described in the docs: https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher")),"heuristic"):(shouldWarn()&&("production"===process.env.NODE_ENV||tsInvariant.invariant.warn("You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments."),"production"===process.env.NODE_ENV||tsInvariant.invariant.warn("Could not find __typename on Fragment ",typeCondition,obj),"production"===process.env.NODE_ENV||tsInvariant.invariant.warn("DEPRECATION WARNING: using fragments without __typename is unsupported behavior and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now.")),"heuristic"))},HeuristicFragmentMatcher}(),IntrospectionFragmentMatcher=function(){function IntrospectionFragmentMatcher(options){options&&options.introspectionQueryResultData?(this.possibleTypesMap=this.parseIntrospectionResult(options.introspectionQueryResultData),this.isReady=!0):this.isReady=!1,this.match=this.match.bind(this)}return IntrospectionFragmentMatcher.prototype.match=function(idValue,typeCondition,context){"production"===process.env.NODE_ENV?tsInvariant.invariant(this.isReady):tsInvariant.invariant(this.isReady,"FragmentMatcher.match() was called before FragmentMatcher.init()");var obj=context.store.get(idValue.id);if(!obj)return!1;if("production"===process.env.NODE_ENV?tsInvariant.invariant(obj.__typename):tsInvariant.invariant(obj.__typename,"Cannot match fragment because __typename property is missing: "+JSON.stringify(obj)),obj.__typename===typeCondition)return!0;var implementingTypes=this.possibleTypesMap[typeCondition];return!!(implementingTypes&&-1<implementingTypes.indexOf(obj.__typename))},IntrospectionFragmentMatcher.prototype.parseIntrospectionResult=function(introspectionResultData){var typeMap={};return introspectionResultData.__schema.types.forEach(function(type){"UNION"!==type.kind&&"INTERFACE"!==type.kind||(typeMap[type.name]=type.possibleTypes.map(function(implementingType){return implementingType.name}))}),typeMap},IntrospectionFragmentMatcher}(),CacheKeyNode=function(){function CacheKeyNode(){this.children=null,this.key=null}return CacheKeyNode.prototype.lookup=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return this.lookupArray(args)},CacheKeyNode.prototype.lookupArray=function(array){var node=this;return array.forEach(function(value){node=node.getOrCreate(value)}),node.key||(node.key=Object.create(null))},CacheKeyNode.prototype.getOrCreate=function(value){var map=this.children||(this.children=new Map),node=map.get(value);return node||map.set(value,node=new CacheKeyNode),node},CacheKeyNode}(),hasOwn=Object.prototype.hasOwnProperty,DepTrackingCache=function(){function DepTrackingCache(data){void 0===data&&(data=Object.create(null));var _this=this;this.data=data,this.depend=optimism.wrap(function(dataId){return _this.data[dataId]},{disposable:!0,makeCacheKey:function(dataId){return dataId}})}return DepTrackingCache.prototype.toObject=function(){return this.data},DepTrackingCache.prototype.get=function(dataId){return this.depend(dataId),this.data[dataId]},DepTrackingCache.prototype.set=function(dataId,value){value!==this.data[dataId]&&(this.data[dataId]=value,this.depend.dirty(dataId))},DepTrackingCache.prototype.delete=function(dataId){hasOwn.call(this.data,dataId)&&(delete this.data[dataId],this.depend.dirty(dataId))},DepTrackingCache.prototype.clear=function(){this.replace(null)},DepTrackingCache.prototype.replace=function(newData){var _this=this;newData?(Object.keys(newData).forEach(function(dataId){_this.set(dataId,newData[dataId])}),Object.keys(this.data).forEach(function(dataId){hasOwn.call(newData,dataId)||_this.delete(dataId)})):Object.keys(this.data).forEach(function(dataId){_this.delete(dataId)})},DepTrackingCache}();function defaultNormalizedCacheFactory(seed){return new DepTrackingCache(seed)}var StoreReader=function(){function StoreReader(cacheKeyRoot){void 0===cacheKeyRoot&&(cacheKeyRoot=new CacheKeyNode);var _this=this;this.cacheKeyRoot=cacheKeyRoot;var reader=this,executeStoreQuery=reader.executeStoreQuery,executeSelectionSet=reader.executeSelectionSet;this.executeStoreQuery=optimism.wrap(function(options){return executeStoreQuery.call(_this,options)},{makeCacheKey:function(_a){var query=_a.query,rootValue=_a.rootValue,contextValue=_a.contextValue,variableValues=_a.variableValues,fragmentMatcher=_a.fragmentMatcher;if(contextValue.store instanceof DepTrackingCache)return reader.cacheKeyRoot.lookup(query,contextValue.store,fragmentMatcher,JSON.stringify(variableValues),rootValue.id)}}),this.executeSelectionSet=optimism.wrap(function(options){return executeSelectionSet.call(_this,options)},{makeCacheKey:function(_a){var selectionSet=_a.selectionSet,rootValue=_a.rootValue,execContext=_a.execContext;if(execContext.contextValue.store instanceof DepTrackingCache)return reader.cacheKeyRoot.lookup(selectionSet,execContext.contextValue.store,execContext.fragmentMatcher,JSON.stringify(execContext.variableValues),rootValue.id)}})}return StoreReader.prototype.readQueryFromStore=function(options){return this.diffQueryAgainstStore(tslib.__assign({},options,{returnPartialData:!1})).result},StoreReader.prototype.diffQueryAgainstStore=function(_a){var store=_a.store,query=_a.query,variables=_a.variables,previousResult=_a.previousResult,_b=_a.returnPartialData,returnPartialData=void 0===_b||_b,_c=_a.rootId,rootId=void 0===_c?"ROOT_QUERY":_c,fragmentMatcherFunction=_a.fragmentMatcherFunction,config=_a.config,queryDefinition=apolloUtilities.getQueryDefinition(query);variables=apolloUtilities.assign({},apolloUtilities.getDefaultValues(queryDefinition),variables);var context={store:store,dataIdFromObject:config&&config.dataIdFromObject||null,cacheRedirects:config&&config.cacheRedirects||{}},execResult=this.executeStoreQuery({query:query,rootValue:{type:"id",id:rootId,generated:!0,typename:"Query"},contextValue:context,variableValues:variables,fragmentMatcher:fragmentMatcherFunction}),hasMissingFields=execResult.missing&&0<execResult.missing.length;return hasMissingFields&&!returnPartialData&&execResult.missing.forEach(function(info){if(!info.tolerable)throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("Can't find field "+info.fieldName+" on object "+JSON.stringify(info.object,null,2)+".")}),previousResult&&apolloUtilities.isEqual(previousResult,execResult.result)&&(execResult.result=previousResult),{result:execResult.result,complete:!hasMissingFields}},StoreReader.prototype.executeStoreQuery=function(_a){var query=_a.query,rootValue=_a.rootValue,contextValue=_a.contextValue,variableValues=_a.variableValues,_b=_a.fragmentMatcher,fragmentMatcher=void 0===_b?defaultFragmentMatcher:_b,mainDefinition=apolloUtilities.getMainDefinition(query),fragments=apolloUtilities.getFragmentDefinitions(query),execContext={query:query,fragmentMap:apolloUtilities.createFragmentMap(fragments),contextValue:contextValue,variableValues:variableValues,fragmentMatcher:fragmentMatcher};return this.executeSelectionSet({selectionSet:mainDefinition.selectionSet,rootValue:rootValue,execContext:execContext})},StoreReader.prototype.executeSelectionSet=function(_a){var _this=this,selectionSet=_a.selectionSet,rootValue=_a.rootValue,execContext=_a.execContext,fragmentMap=execContext.fragmentMap,contextValue=execContext.contextValue,variables=execContext.variableValues,finalResult={result:null},objectsToMerge=[],object=contextValue.store.get(rootValue.id),typename=object&&object.__typename||"ROOT_QUERY"===rootValue.id&&"Query"||void 0;function handleMissing(result){var _a;return result.missing&&(finalResult.missing=finalResult.missing||[],(_a=finalResult.missing).push.apply(_a,result.missing)),result.result}return selectionSet.selections.forEach(function(selection){var _a;if(apolloUtilities.shouldInclude(selection,variables))if(apolloUtilities.isField(selection)){var fieldResult=handleMissing(_this.executeField(object,typename,selection,execContext));void 0!==fieldResult&&objectsToMerge.push(((_a={})[apolloUtilities.resultKeyNameFromField(selection)]=fieldResult,_a))}else{var fragment=void 0;if(apolloUtilities.isInlineFragment(selection))fragment=selection;else if(!(fragment=fragmentMap[selection.name.value]))throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("No fragment named "+selection.name.value);var typeCondition=fragment.typeCondition.name.value,match=execContext.fragmentMatcher(rootValue,typeCondition,contextValue);if(match){var fragmentExecResult=_this.executeSelectionSet({selectionSet:fragment.selectionSet,rootValue:rootValue,execContext:execContext});"heuristic"===match&&fragmentExecResult.missing&&(fragmentExecResult=tslib.__assign({},fragmentExecResult,{missing:fragmentExecResult.missing.map(function(info){return tslib.__assign({},info,{tolerable:!0})})})),objectsToMerge.push(handleMissing(fragmentExecResult))}}}),finalResult.result=apolloUtilities.mergeDeepArray(objectsToMerge),finalResult},StoreReader.prototype.executeField=function(object,typename,field,execContext){var variables=execContext.variableValues,contextValue=execContext.contextValue,readStoreResult=function(object,typename,fieldName,args,context,_a){_a.resultKey;var directives=_a.directives,storeKeyName=fieldName;(args||directives)&&(storeKeyName=apolloUtilities.getStoreKeyName(storeKeyName,args,directives));var fieldValue=void 0;if(object&&void 0===(fieldValue=object[storeKeyName])&&context.cacheRedirects&&"string"==typeof typename){var type=context.cacheRedirects[typename];if(type){var resolver=type[fieldName];resolver&&(fieldValue=resolver(object,args,{getCacheKey:function(storeObj){return apolloUtilities.toIdValue({id:context.dataIdFromObject(storeObj),typename:storeObj.__typename})}}))}}if(void 0===fieldValue)return{result:fieldValue,missing:[{object:object,fieldName:storeKeyName,tolerable:!1}]};apolloUtilities.isJsonValue(fieldValue)&&(fieldValue=fieldValue.json);return{result:fieldValue}}(object,typename,field.name.value,apolloUtilities.argumentsObjectFromField(field,variables),contextValue,{resultKey:apolloUtilities.resultKeyNameFromField(field),directives:apolloUtilities.getDirectiveInfoFromField(field,variables)});return Array.isArray(readStoreResult.result)?this.combineExecResults(readStoreResult,this.executeSubSelectedArray(field,readStoreResult.result,execContext)):field.selectionSet?null==readStoreResult.result?readStoreResult:this.combineExecResults(readStoreResult,this.executeSelectionSet({selectionSet:field.selectionSet,rootValue:readStoreResult.result,execContext:execContext})):(assertSelectionSetForIdValue(field,readStoreResult.result),readStoreResult)},StoreReader.prototype.combineExecResults=function(){for(var execResults=[],_i=0;_i<arguments.length;_i++)execResults[_i]=arguments[_i];var missing=null;return execResults.forEach(function(execResult){execResult.missing&&(missing=missing||[]).push.apply(missing,execResult.missing)}),{result:execResults.pop().result,missing:missing}},StoreReader.prototype.executeSubSelectedArray=function(field,result,execContext){var _this=this,missing=null;function handleMissing(childResult){return childResult.missing&&(missing=missing||[]).push.apply(missing,childResult.missing),childResult.result}return{result:result=result.map(function(item){return null===item?null:Array.isArray(item)?handleMissing(_this.executeSubSelectedArray(field,item,execContext)):field.selectionSet?handleMissing(_this.executeSelectionSet({selectionSet:field.selectionSet,rootValue:item,execContext:execContext})):(assertSelectionSetForIdValue(field,item),item)}),missing:missing}},StoreReader}();function assertSelectionSetForIdValue(field,value){if(!field.selectionSet&&apolloUtilities.isIdValue(value))throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("Missing selection set for object of type "+value.typename+" returned for query field "+field.name.value)}function defaultFragmentMatcher(){return!0}var ObjectCache=function(){function ObjectCache(data){void 0===data&&(data=Object.create(null)),this.data=data}return ObjectCache.prototype.toObject=function(){return this.data},ObjectCache.prototype.get=function(dataId){return this.data[dataId]},ObjectCache.prototype.set=function(dataId,value){this.data[dataId]=value},ObjectCache.prototype.delete=function(dataId){this.data[dataId]=void 0},ObjectCache.prototype.clear=function(){this.data=Object.create(null)},ObjectCache.prototype.replace=function(newData){this.data=newData||Object.create(null)},ObjectCache}();var WriteError=function(_super){function WriteError(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.type="WriteError",_this}return tslib.__extends(WriteError,_super),WriteError}(Error);function enhanceErrorWithDocument(error,document){var enhancedError=new WriteError("Error writing result to store for query:\n "+JSON.stringify(document));return enhancedError.message+="\n"+error.message,enhancedError.stack=error.stack,enhancedError}var StoreWriter=function(){function StoreWriter(){}return StoreWriter.prototype.writeQueryToStore=function(_a){var query=_a.query,result=_a.result,_b=_a.store,store=void 0===_b?defaultNormalizedCacheFactory():_b,variables=_a.variables,dataIdFromObject=_a.dataIdFromObject,fragmentMatcherFunction=_a.fragmentMatcherFunction;return this.writeResultToStore({dataId:"ROOT_QUERY",result:result,document:query,store:store,variables:variables,dataIdFromObject:dataIdFromObject,fragmentMatcherFunction:fragmentMatcherFunction})},StoreWriter.prototype.writeResultToStore=function(_a){var dataId=_a.dataId,result=_a.result,document=_a.document,_b=_a.store,store=void 0===_b?defaultNormalizedCacheFactory():_b,variables=_a.variables,dataIdFromObject=_a.dataIdFromObject,fragmentMatcherFunction=_a.fragmentMatcherFunction,operationDefinition=apolloUtilities.getOperationDefinition(document);try{return this.writeSelectionSetToStore({result:result,dataId:dataId,selectionSet:operationDefinition.selectionSet,context:{store:store,processedData:{},variables:apolloUtilities.assign({},apolloUtilities.getDefaultValues(operationDefinition),variables),dataIdFromObject:dataIdFromObject,fragmentMap:apolloUtilities.createFragmentMap(apolloUtilities.getFragmentDefinitions(document)),fragmentMatcherFunction:fragmentMatcherFunction}})}catch(e){throw enhanceErrorWithDocument(e,document)}},StoreWriter.prototype.writeSelectionSetToStore=function(_a){var _this=this,result=_a.result,dataId=_a.dataId,selectionSet=_a.selectionSet,context=_a.context,variables=context.variables,store=context.store,fragmentMap=context.fragmentMap;return selectionSet.selections.forEach(function(selection){if(apolloUtilities.shouldInclude(selection,variables))if(apolloUtilities.isField(selection)){var resultFieldKey=apolloUtilities.resultKeyNameFromField(selection),value=result[resultFieldKey];if(void 0!==value)_this.writeFieldToStore({dataId:dataId,value:value,field:selection,context:context});else{var isDefered=!1,isClient=!1;selection.directives&&selection.directives.length&&(isDefered=selection.directives.some(function(directive){return directive.name&&"defer"===directive.name.value}),isClient=selection.directives.some(function(directive){return directive.name&&"client"===directive.name.value})),isDefered||isClient||!context.fragmentMatcherFunction||"production"===process.env.NODE_ENV||tsInvariant.invariant.warn("Missing field "+resultFieldKey+" in "+JSON.stringify(result,null,2).substring(0,100))}}else{var fragment=void 0;apolloUtilities.isInlineFragment(selection)?fragment=selection:(fragment=(fragmentMap||{})[selection.name.value],"production"===process.env.NODE_ENV?tsInvariant.invariant(fragment):tsInvariant.invariant(fragment,"No fragment named "+selection.name.value+"."));var matches=!0;if(context.fragmentMatcherFunction&&fragment.typeCondition){var idValue=apolloUtilities.toIdValue({id:"self",typename:void 0}),fakeContext={store:new ObjectCache({self:result}),cacheRedirects:{}},match=context.fragmentMatcherFunction(idValue,fragment.typeCondition.name.value,fakeContext);apolloUtilities.isProduction()||"heuristic"!==match||"production"===process.env.NODE_ENV||tsInvariant.invariant.error("WARNING: heuristic fragment matching going on!"),matches=!!match}matches&&_this.writeSelectionSetToStore({result:result,selectionSet:fragment.selectionSet,dataId:dataId,context:context})}}),store},StoreWriter.prototype.writeFieldToStore=function(_a){var _b,storeValue,storeObject,field=_a.field,value=_a.value,dataId=_a.dataId,context=_a.context,variables=context.variables,dataIdFromObject=context.dataIdFromObject,store=context.store,storeFieldName=apolloUtilities.storeKeyNameFromField(field,variables);if(field.selectionSet&&null!==value)if(Array.isArray(value)){var generatedId=dataId+"."+storeFieldName;storeValue=this.processArrayValue(value,generatedId,field.selectionSet,context)}else{var valueDataId=dataId+"."+storeFieldName,generated=!0;if(isGeneratedId(valueDataId)||(valueDataId="$"+valueDataId),dataIdFromObject){var semanticId=dataIdFromObject(value);"production"===process.env.NODE_ENV?tsInvariant.invariant(!semanticId||!isGeneratedId(semanticId)):tsInvariant.invariant(!semanticId||!isGeneratedId(semanticId),'IDs returned by dataIdFromObject cannot begin with the "$" character.'),(semanticId||"number"==typeof semanticId&&0===semanticId)&&(valueDataId=semanticId,generated=!1)}isDataProcessed(valueDataId,field,context.processedData)||this.writeSelectionSetToStore({dataId:valueDataId,result:value,selectionSet:field.selectionSet,context:context});var typename=value.__typename;storeValue=apolloUtilities.toIdValue({id:valueDataId,typename:typename},generated);var escapedId=(storeObject=store.get(dataId))&&storeObject[storeFieldName];if(escapedId!==storeValue&&apolloUtilities.isIdValue(escapedId)){var hadTypename=void 0!==escapedId.typename,hasTypename=void 0!==typename,typenameChanged=hadTypename&&hasTypename&&escapedId.typename!==typename;"production"===process.env.NODE_ENV?tsInvariant.invariant(!generated||escapedId.generated||typenameChanged):tsInvariant.invariant(!generated||escapedId.generated||typenameChanged,"Store error: the application attempted to write an object with no provided id but the store already contains an id of "+escapedId.id+" for this object. The selectionSet that was trying to be written is:\n"+JSON.stringify(field)),"production"===process.env.NODE_ENV?tsInvariant.invariant(!hadTypename||hasTypename):tsInvariant.invariant(!hadTypename||hasTypename,"Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of "+escapedId.typename+" for the object of id "+escapedId.id+". The selectionSet that was trying to be written is:\n"+JSON.stringify(field)),escapedId.generated&&(typenameChanged?generated||store.delete(escapedId.id):function mergeWithGenerated(generatedKey,realKey,cache){if(generatedKey===realKey)return!1;var generated=cache.get(generatedKey);var real=cache.get(realKey);var madeChanges=!1;Object.keys(generated).forEach(function(key){var value=generated[key],realValue=real[key];apolloUtilities.isIdValue(value)&&isGeneratedId(value.id)&&apolloUtilities.isIdValue(realValue)&&!apolloUtilities.isEqual(value,realValue)&&mergeWithGenerated(value.id,realValue.id,cache)&&(madeChanges=!0)});cache.delete(generatedKey);var newRealValue=tslib.__assign({},generated,real);if(apolloUtilities.isEqual(newRealValue,real))return madeChanges;cache.set(realKey,newRealValue);return!0}(escapedId.id,storeValue.id,store))}}else storeValue=null!=value&&"object"==typeof value?{type:"json",json:value}:value;(storeObject=store.get(dataId))&&apolloUtilities.isEqual(storeValue,storeObject[storeFieldName])||store.set(dataId,tslib.__assign({},storeObject,((_b={})[storeFieldName]=storeValue,_b)))},StoreWriter.prototype.processArrayValue=function(value,generatedId,selectionSet,context){var _this=this;return value.map(function(item,index){if(null===item)return null;var itemDataId=generatedId+"."+index;if(Array.isArray(item))return _this.processArrayValue(item,itemDataId,selectionSet,context);var generated=!0;if(context.dataIdFromObject){var semanticId=context.dataIdFromObject(item);semanticId&&(itemDataId=semanticId,generated=!1)}return isDataProcessed(itemDataId,selectionSet,context.processedData)||_this.writeSelectionSetToStore({dataId:itemDataId,result:item,selectionSet:selectionSet,context:context}),apolloUtilities.toIdValue({id:itemDataId,typename:item.__typename},generated)})},StoreWriter}();function isGeneratedId(id){return"$"===id[0]}function isDataProcessed(dataId,field,processedData){if(!processedData)return!1;if(processedData[dataId]){if(0<=processedData[dataId].indexOf(field))return!0;processedData[dataId].push(field)}else processedData[dataId]=[field];return!1}var defaultConfig={fragmentMatcher:new HeuristicFragmentMatcher,dataIdFromObject:defaultDataIdFromObject,addTypename:!0,resultCaching:!0};function defaultDataIdFromObject(result){if(result.__typename){if(void 0!==result.id)return result.__typename+":"+result.id;if(void 0!==result._id)return result.__typename+":"+result._id}return null}var hasOwn$1=Object.prototype.hasOwnProperty,OptimisticCacheLayer=function(_super){function OptimisticCacheLayer(optimisticId,parent,transaction){var _this=_super.call(this,Object.create(null))||this;return _this.optimisticId=optimisticId,_this.parent=parent,_this.transaction=transaction,_this}return tslib.__extends(OptimisticCacheLayer,_super),OptimisticCacheLayer.prototype.toObject=function(){return tslib.__assign({},this.parent.toObject(),this.data)},OptimisticCacheLayer.prototype.get=function(dataId){return hasOwn$1.call(this.data,dataId)?this.data[dataId]:this.parent.get(dataId)},OptimisticCacheLayer}(ObjectCache),InMemoryCache=function(_super){function InMemoryCache(config){void 0===config&&(config={});var _this=_super.call(this)||this;_this.watches=new Set,_this.typenameDocumentCache=new Map,_this.cacheKeyRoot=new CacheKeyNode,_this.silenceBroadcast=!1,_this.config=tslib.__assign({},defaultConfig,config),_this.config.customResolvers&&("production"===process.env.NODE_ENV||tsInvariant.invariant.warn("customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version."),_this.config.cacheRedirects=_this.config.customResolvers),_this.config.cacheResolvers&&("production"===process.env.NODE_ENV||tsInvariant.invariant.warn("cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version."),_this.config.cacheRedirects=_this.config.cacheResolvers),_this.addTypename=_this.config.addTypename,_this.data=_this.config.resultCaching?new DepTrackingCache:new ObjectCache,_this.optimisticData=_this.data,_this.storeReader=new StoreReader(_this.cacheKeyRoot),_this.storeWriter=new StoreWriter;var cache=_this,maybeBroadcastWatch=cache.maybeBroadcastWatch;return _this.maybeBroadcastWatch=optimism.wrap(function(c){return maybeBroadcastWatch.call(_this,c)},{makeCacheKey:function(c){if(!c.optimistic&&!c.previousResult)return cache.data instanceof DepTrackingCache?cache.cacheKeyRoot.lookup(c.query,JSON.stringify(c.variables)):void 0}}),_this}return tslib.__extends(InMemoryCache,_super),InMemoryCache.prototype.restore=function(data){return data&&this.data.replace(data),this},InMemoryCache.prototype.extract=function(optimistic){return void 0===optimistic&&(optimistic=!1),(optimistic?this.optimisticData:this.data).toObject()},InMemoryCache.prototype.read=function(options){return"string"==typeof options.rootId&&void 0===this.data.get(options.rootId)?null:this.storeReader.readQueryFromStore({store:options.optimistic?this.optimisticData:this.data,query:this.transformDocument(options.query),variables:options.variables,rootId:options.rootId,fragmentMatcherFunction:this.config.fragmentMatcher.match,previousResult:options.previousResult,config:this.config})},InMemoryCache.prototype.write=function(write){this.storeWriter.writeResultToStore({dataId:write.dataId,result:write.result,variables:write.variables,document:this.transformDocument(write.query),store:this.data,dataIdFromObject:this.config.dataIdFromObject,fragmentMatcherFunction:this.config.fragmentMatcher.match}),this.broadcastWatches()},InMemoryCache.prototype.diff=function(query){return this.storeReader.diffQueryAgainstStore({store:query.optimistic?this.optimisticData:this.data,query:this.transformDocument(query.query),variables:query.variables,returnPartialData:query.returnPartialData,previousResult:query.previousResult,fragmentMatcherFunction:this.config.fragmentMatcher.match,config:this.config})},InMemoryCache.prototype.watch=function(watch){var _this=this;return this.watches.add(watch),function(){_this.watches.delete(watch)}},InMemoryCache.prototype.evict=function(query){throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("eviction is not implemented on InMemory Cache")},InMemoryCache.prototype.reset=function(){return this.data.clear(),this.broadcastWatches(),Promise.resolve()},InMemoryCache.prototype.removeOptimistic=function(idToRemove){for(var toReapply=[],removedCount=0,layer=this.optimisticData;layer instanceof OptimisticCacheLayer;)layer.optimisticId===idToRemove?++removedCount:toReapply.push(layer),layer=layer.parent;if(0<removedCount){for(this.optimisticData=layer;0<toReapply.length;){var layer_1=toReapply.pop();this.performTransaction(layer_1.transaction,layer_1.optimisticId)}this.broadcastWatches()}},InMemoryCache.prototype.performTransaction=function(transaction,optimisticId){var data=this.data,silenceBroadcast=this.silenceBroadcast;this.silenceBroadcast=!0,"string"==typeof optimisticId&&(this.data=this.optimisticData=new OptimisticCacheLayer(optimisticId,this.optimisticData,transaction));try{transaction(this)}finally{this.silenceBroadcast=silenceBroadcast,this.data=data}this.broadcastWatches()},InMemoryCache.prototype.recordOptimisticTransaction=function(transaction,id){return this.performTransaction(transaction,id)},InMemoryCache.prototype.transformDocument=function(document){if(this.addTypename){var result=this.typenameDocumentCache.get(document);return result||(result=apolloUtilities.addTypenameToDocument(document),this.typenameDocumentCache.set(document,result),this.typenameDocumentCache.set(result,result)),result}return document},InMemoryCache.prototype.broadcastWatches=function(){var _this=this;this.silenceBroadcast||this.watches.forEach(function(c){return _this.maybeBroadcastWatch(c)})},InMemoryCache.prototype.maybeBroadcastWatch=function(c){c.callback(this.diff({query:c.query,variables:c.variables,previousResult:c.previousResult&&c.previousResult(),optimistic:c.optimistic}))},InMemoryCache}(apolloCache.ApolloCache);exports.InMemoryCache=InMemoryCache,exports.defaultDataIdFromObject=defaultDataIdFromObject,exports.StoreReader=StoreReader,exports.assertIdValue=function(idValue){"production"===process.env.NODE_ENV?tsInvariant.invariant(apolloUtilities.isIdValue(idValue)):tsInvariant.invariant(apolloUtilities.isIdValue(idValue),"Encountered a sub-selection on the query, but the store doesn't have an object reference. This should never happen during normal use unless you have custom code that is directly manipulating the store; please file an issue.")},exports.WriteError=WriteError,exports.enhanceErrorWithDocument=enhanceErrorWithDocument,exports.StoreWriter=StoreWriter,exports.HeuristicFragmentMatcher=HeuristicFragmentMatcher,exports.IntrospectionFragmentMatcher=IntrospectionFragmentMatcher,exports.ObjectCache=ObjectCache,exports.defaultNormalizedCacheFactory=function(seed){return new ObjectCache(seed)}}).call(this,require("_process"))},{_process:47,"apollo-cache":5,"apollo-utilities":18,optimism:83,"ts-invariant":290,tslib:291}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var apolloUtilities=require("apollo-utilities");function selectionSetFromObj(obj){if("number"==typeof obj||"boolean"==typeof obj||"string"==typeof obj||null==obj)return null;if(Array.isArray(obj))return selectionSetFromObj(obj[0]);var selections=[];return Object.keys(obj).forEach(function(key){var field={kind:"Field",name:{kind:"Name",value:key},selectionSet:selectionSetFromObj(obj[key])||void 0};selections.push(field)}),{kind:"SelectionSet",selections:selections}}var justTypenameQuery={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:null,variableDefinitions:null,directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:null,name:{kind:"Name",value:"__typename"},arguments:[],directives:[],selectionSet:null}]}}]},ApolloCache=function(){function ApolloCache(){}return ApolloCache.prototype.transformDocument=function(document){return document},ApolloCache.prototype.transformForLink=function(document){return document},ApolloCache.prototype.readQuery=function(options,optimistic){return void 0===optimistic&&(optimistic=!1),this.read({query:options.query,variables:options.variables,optimistic:optimistic})},ApolloCache.prototype.readFragment=function(options,optimistic){return void 0===optimistic&&(optimistic=!1),this.read({query:apolloUtilities.getFragmentQueryDocument(options.fragment,options.fragmentName),variables:options.variables,rootId:options.id,optimistic:optimistic})},ApolloCache.prototype.writeQuery=function(options){this.write({dataId:"ROOT_QUERY",result:options.data,query:options.query,variables:options.variables})},ApolloCache.prototype.writeFragment=function(options){this.write({dataId:options.id,result:options.data,variables:options.variables,query:apolloUtilities.getFragmentQueryDocument(options.fragment,options.fragmentName)})},ApolloCache.prototype.writeData=function(_a){var id=_a.id,data=_a.data;if(void 0!==id){var typenameResult=null;try{typenameResult=this.read({rootId:id,optimistic:!1,query:justTypenameQuery})}catch(e){}var __typename=typenameResult&&typenameResult.__typename||"__ClientData",dataToWrite=Object.assign({__typename:__typename},data);this.writeFragment({id:id,fragment:function(obj,typename){return{kind:"Document",definitions:[{kind:"FragmentDefinition",typeCondition:{kind:"NamedType",name:{kind:"Name",value:typename||"__FakeType"}},name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:selectionSetFromObj(obj)}]}}(dataToWrite,__typename),data:dataToWrite})}else this.writeQuery({query:function(obj){return{kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:selectionSetFromObj(obj)}]}}(data),data:data})},ApolloCache}();exports.Cache||(exports.Cache={}),exports.ApolloCache=ApolloCache},{"apollo-utilities":18}],6:[function(require,module,exports){(function(process){var global,factory;global=this,factory=function(exports,tslib,apolloUtilities,apolloLink,$$observable,tsInvariant,apolloLinkDedup,visitor){"use strict";var NetworkStatus;function isNetworkRequestInFlight(networkStatus){return networkStatus<7}$$observable=$$observable&&$$observable.hasOwnProperty("default")?$$observable.default:$$observable,(NetworkStatus=exports.NetworkStatus||(exports.NetworkStatus={}))[NetworkStatus.loading=1]="loading",NetworkStatus[NetworkStatus.setVariables=2]="setVariables",NetworkStatus[NetworkStatus.fetchMore=3]="fetchMore",NetworkStatus[NetworkStatus.refetch=4]="refetch",NetworkStatus[NetworkStatus.poll=6]="poll",NetworkStatus[NetworkStatus.ready=7]="ready",NetworkStatus[NetworkStatus.error=8]="error";var Observable=function(_super){function Observable(){return null!==_super&&_super.apply(this,arguments)||this}return tslib.__extends(Observable,_super),Observable.prototype[$$observable]=function(){return this},Observable.prototype["@@observable"]=function(){return this},Observable}(apolloLink.Observable);function isApolloError(err){return err.hasOwnProperty("graphQLErrors")}var FetchType,ApolloError=function(_super){function ApolloError(_a){var graphQLErrors=_a.graphQLErrors,networkError=_a.networkError,errorMessage=_a.errorMessage,extraInfo=_a.extraInfo,_this=_super.call(this,errorMessage)||this;return _this.graphQLErrors=graphQLErrors||[],_this.networkError=networkError||null,_this.message=errorMessage||function(err){var message="";return Array.isArray(err.graphQLErrors)&&0!==err.graphQLErrors.length&&err.graphQLErrors.forEach(function(graphQLError){var errorMessage=graphQLError?graphQLError.message:"Error message not found.";message+="GraphQL error: "+errorMessage+"\n"}),err.networkError&&(message+="Network error: "+err.networkError.message+"\n"),message=message.replace(/\n$/,"")}(_this),_this.extraInfo=extraInfo,_this.__proto__=ApolloError.prototype,_this}return tslib.__extends(ApolloError,_super),ApolloError}(Error);(FetchType=exports.FetchType||(exports.FetchType={}))[FetchType.normal=1]="normal",FetchType[FetchType.refetch=2]="refetch",FetchType[FetchType.poll=3]="poll";var ObservableQuery=function(_super){function ObservableQuery(_a){var queryManager=_a.queryManager,options=_a.options,_b=_a.shouldSubscribe,shouldSubscribe=void 0===_b||_b,_this=_super.call(this,function(observer){return _this.onSubscribe(observer)})||this;return _this.isTornDown=!1,_this.options=options,_this.variables=options.variables||{},_this.queryId=queryManager.generateQueryId(),_this.shouldSubscribe=shouldSubscribe,_this.queryManager=queryManager,_this.observers=[],_this.subscriptionHandles=[],_this}return tslib.__extends(ObservableQuery,_super),ObservableQuery.prototype.result=function(){var that=this;return new Promise(function(resolve,reject){var subscription,observer={next:function(result){resolve(result),that.observers.some(function(obs){return obs!==observer})||that.queryManager.removeQuery(that.queryId),setTimeout(function(){subscription.unsubscribe()},0)},error:function(error){reject(error)}};subscription=that.subscribe(observer)})},ObservableQuery.prototype.currentResult=function(){var result=this.getCurrentResult();return void 0===result.data&&(result.data={}),result},ObservableQuery.prototype.getCurrentResult=function(){if(this.isTornDown)return{data:this.lastError?void 0:this.lastResult?this.lastResult.data:void 0,error:this.lastError,loading:!1,networkStatus:exports.NetworkStatus.error};var queryStoreValue=this.queryManager.queryStore.get(this.queryId);if(function(storeValue,policy){return void 0===policy&&(policy="none"),storeValue&&(storeValue.graphQLErrors&&0<storeValue.graphQLErrors.length&&"none"===policy||storeValue.networkError)}(queryStoreValue,this.options.errorPolicy))return{data:void 0,loading:!1,networkStatus:queryStoreValue.networkStatus,error:new ApolloError({graphQLErrors:queryStoreValue.graphQLErrors,networkError:queryStoreValue.networkError})};queryStoreValue&&queryStoreValue.variables&&(this.options.variables=Object.assign({},this.options.variables,queryStoreValue.variables));var networkStatus,_a=this.queryManager.getCurrentQueryResult(this),data=_a.data,partial=_a.partial,queryLoading=!queryStoreValue||queryStoreValue.networkStatus===exports.NetworkStatus.loading,loading="network-only"===this.options.fetchPolicy&&queryLoading||partial&&"cache-only"!==this.options.fetchPolicy,result={data:data,loading:isNetworkRequestInFlight(networkStatus=queryStoreValue?queryStoreValue.networkStatus:loading?exports.NetworkStatus.loading:exports.NetworkStatus.ready),networkStatus:networkStatus};return queryStoreValue&&queryStoreValue.graphQLErrors&&"all"===this.options.errorPolicy&&(result.errors=queryStoreValue.graphQLErrors),partial||(this.lastResult=tslib.__assign({},result,{stale:!1}),this.lastResultSnapshot=apolloUtilities.cloneDeep(this.lastResult)),tslib.__assign({},result,{partial:partial})},ObservableQuery.prototype.isDifferentFromLastResult=function(newResult){var snapshot=this.lastResultSnapshot;return!(snapshot&&newResult&&snapshot.networkStatus===newResult.networkStatus&&snapshot.stale===newResult.stale&&apolloUtilities.isEqual(snapshot.data,newResult.data))},ObservableQuery.prototype.getLastResult=function(){return this.lastResult},ObservableQuery.prototype.getLastError=function(){return this.lastError},ObservableQuery.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},ObservableQuery.prototype.refetch=function(variables){var fetchPolicy=this.options.fetchPolicy;if("cache-only"===fetchPolicy)return Promise.reject(new Error("cache-only fetchPolicy option should not be used together with query refetch."));apolloUtilities.isEqual(this.variables,variables)||(this.variables=Object.assign({},this.variables,variables)),apolloUtilities.isEqual(this.options.variables,this.variables)||(this.options.variables=Object.assign({},this.options.variables,this.variables));var isNetworkFetchPolicy="network-only"===fetchPolicy||"no-cache"===fetchPolicy,combinedOptions=tslib.__assign({},this.options,{fetchPolicy:isNetworkFetchPolicy?fetchPolicy:"network-only"});return this.queryManager.fetchQuery(this.queryId,combinedOptions,exports.FetchType.refetch).then(function(result){return result})},ObservableQuery.prototype.fetchMore=function(fetchMoreOptions){var combinedOptions,_this=this;return"production"===process.env.NODE_ENV?tsInvariant.invariant(fetchMoreOptions.updateQuery):tsInvariant.invariant(fetchMoreOptions.updateQuery,"updateQuery option is required. This function defines how to update the query data with the new results."),Promise.resolve().then(function(){var qid=_this.queryManager.generateQueryId();return(combinedOptions=fetchMoreOptions.query?fetchMoreOptions:tslib.__assign({},_this.options,fetchMoreOptions,{variables:Object.assign({},_this.variables,fetchMoreOptions.variables)})).fetchPolicy="network-only",_this.queryManager.fetchQuery(qid,combinedOptions,exports.FetchType.normal,_this.queryId)}).then(function(fetchMoreResult){return _this.updateQuery(function(previousResult){return fetchMoreOptions.updateQuery(previousResult,{fetchMoreResult:fetchMoreResult.data,variables:combinedOptions.variables})}),fetchMoreResult})},ObservableQuery.prototype.subscribeToMore=function(options){var _this=this,subscription=this.queryManager.startGraphQLSubscription({query:options.document,variables:options.variables}).subscribe({next:function(subscriptionData){options.updateQuery&&_this.updateQuery(function(previous,_a){var variables=_a.variables;return options.updateQuery(previous,{subscriptionData:subscriptionData,variables:variables})})},error:function(err){options.onError?options.onError(err):console.error("Unhandled GraphQL subscription error",err)}});return this.subscriptionHandles.push(subscription),function(){var i=_this.subscriptionHandles.indexOf(subscription);0<=i&&(_this.subscriptionHandles.splice(i,1),subscription.unsubscribe())}},ObservableQuery.prototype.setOptions=function(opts){var oldOptions=this.options;this.options=Object.assign({},this.options,opts),opts.pollInterval?this.startPolling(opts.pollInterval):0===opts.pollInterval&&this.stopPolling();var tryFetch="network-only"!==oldOptions.fetchPolicy&&"network-only"===opts.fetchPolicy||"cache-only"===oldOptions.fetchPolicy&&"cache-only"!==opts.fetchPolicy||"standby"===oldOptions.fetchPolicy&&"standby"!==opts.fetchPolicy||!1;return this.setVariables(this.options.variables,tryFetch,opts.fetchResults)},ObservableQuery.prototype.setVariables=function(variables,tryFetch,fetchResults){void 0===tryFetch&&(tryFetch=!1),void 0===fetchResults&&(fetchResults=!0),this.isTornDown=!1;var newVariables=variables||this.variables;return apolloUtilities.isEqual(newVariables,this.variables)&&!tryFetch?0!==this.observers.length&&fetchResults?this.result():new Promise(function(resolve){return resolve()}):(this.variables=newVariables,this.options.variables=newVariables,0===this.observers.length?new Promise(function(resolve){return resolve()}):this.queryManager.fetchQuery(this.queryId,tslib.__assign({},this.options,{variables:this.variables})).then(function(result){return result}))},ObservableQuery.prototype.updateQuery=function(mapFn){var _a=this.queryManager.getQueryWithPreviousResult(this.queryId),previousResult=_a.previousResult,variables=_a.variables,document=_a.document,newResult=apolloUtilities.tryFunctionOrLogError(function(){return mapFn(previousResult,{variables:variables})});newResult&&(this.queryManager.dataStore.markUpdateQueryResult(document,variables,newResult),this.queryManager.broadcastQueries())},ObservableQuery.prototype.stopPolling=function(){this.queryManager.stopPollingQuery(this.queryId),this.options.pollInterval=void 0},ObservableQuery.prototype.startPolling=function(pollInterval){assertNotCacheFirstOrOnly(this),this.options.pollInterval=pollInterval,this.queryManager.startPollingQuery(this.options,this.queryId)},ObservableQuery.prototype.onSubscribe=function(observer){var _this=this;return observer._subscription&&observer._subscription._observer&&!observer._subscription._observer.error&&(observer._subscription._observer.error=function(error){console.error("Unhandled error",error.message,error.stack)}),this.observers.push(observer),observer.next&&this.lastResult&&observer.next(this.lastResult),observer.error&&this.lastError&&observer.error(this.lastError),1===this.observers.length&&this.setUpQuery(),function(){_this.observers=_this.observers.filter(function(obs){return obs!==observer}),0===_this.observers.length&&_this.tearDownQuery()}},ObservableQuery.prototype.setUpQuery=function(){var _this=this;this.shouldSubscribe&&this.queryManager.addObservableQuery(this.queryId,this),this.options.pollInterval&&(assertNotCacheFirstOrOnly(this),this.queryManager.startPollingQuery(this.options,this.queryId));var observer={next:function(result){_this.lastResult=result,_this.lastResultSnapshot=apolloUtilities.cloneDeep(result),_this.observers.forEach(function(obs){return obs.next&&obs.next(result)})},error:function(error){_this.lastError=error,_this.observers.forEach(function(obs){return obs.error&&obs.error(error)})}};this.queryManager.startQuery(this.queryId,this.options,this.queryManager.queryListenerForObserver(this.queryId,this.options,observer))},ObservableQuery.prototype.tearDownQuery=function(){this.isTornDown=!0,this.queryManager.stopPollingQuery(this.queryId),this.subscriptionHandles.forEach(function(sub){return sub.unsubscribe()}),this.subscriptionHandles=[],this.queryManager.removeObservableQuery(this.queryId),this.queryManager.stopQuery(this.queryId),this.observers=[]},ObservableQuery}(Observable);function assertNotCacheFirstOrOnly(obsQuery){var fetchPolicy=obsQuery.options.fetchPolicy;"production"===process.env.NODE_ENV?tsInvariant.invariant("cache-first"!==fetchPolicy&&"cache-only"!==fetchPolicy):tsInvariant.invariant("cache-first"!==fetchPolicy&&"cache-only"!==fetchPolicy,"Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.")}var MutationStore=function(){function MutationStore(){this.store={}}return MutationStore.prototype.getStore=function(){return this.store},MutationStore.prototype.get=function(mutationId){return this.store[mutationId]},MutationStore.prototype.initMutation=function(mutationId,mutation,variables){this.store[mutationId]={mutation:mutation,variables:variables||{},loading:!0,error:null}},MutationStore.prototype.markMutationError=function(mutationId,error){var mutation=this.store[mutationId];mutation&&(mutation.loading=!1,mutation.error=error)},MutationStore.prototype.markMutationResult=function(mutationId){var mutation=this.store[mutationId];mutation&&(mutation.loading=!1,mutation.error=null)},MutationStore.prototype.reset=function(){this.store={}},MutationStore}(),QueryStore=function(){function QueryStore(){this.store={}}return QueryStore.prototype.getStore=function(){return this.store},QueryStore.prototype.get=function(queryId){return this.store[queryId]},QueryStore.prototype.initQuery=function(query){var previousQuery=this.store[query.queryId];if(previousQuery&&previousQuery.document!==query.document&&!apolloUtilities.isEqual(previousQuery.document,query.document))throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("Internal Error: may not update existing query string in store");var networkStatus,isSetVariables=!1,previousVariables=null;query.storePreviousVariables&&previousQuery&&previousQuery.networkStatus!==exports.NetworkStatus.loading&&(apolloUtilities.isEqual(previousQuery.variables,query.variables)||(isSetVariables=!0,previousVariables=previousQuery.variables)),networkStatus=isSetVariables?exports.NetworkStatus.setVariables:query.isPoll?exports.NetworkStatus.poll:query.isRefetch?exports.NetworkStatus.refetch:exports.NetworkStatus.loading;var graphQLErrors=[];previousQuery&&previousQuery.graphQLErrors&&(graphQLErrors=previousQuery.graphQLErrors),this.store[query.queryId]={document:query.document,variables:query.variables,previousVariables:previousVariables,networkError:null,graphQLErrors:graphQLErrors,networkStatus:networkStatus,metadata:query.metadata},"string"==typeof query.fetchMoreForQueryId&&this.store[query.fetchMoreForQueryId]&&(this.store[query.fetchMoreForQueryId].networkStatus=exports.NetworkStatus.fetchMore)},QueryStore.prototype.markQueryResult=function(queryId,result,fetchMoreForQueryId){this.store&&this.store[queryId]&&(this.store[queryId].networkError=null,this.store[queryId].graphQLErrors=result.errors&&result.errors.length?result.errors:[],this.store[queryId].previousVariables=null,this.store[queryId].networkStatus=exports.NetworkStatus.ready,"string"==typeof fetchMoreForQueryId&&this.store[fetchMoreForQueryId]&&(this.store[fetchMoreForQueryId].networkStatus=exports.NetworkStatus.ready))},QueryStore.prototype.markQueryError=function(queryId,error,fetchMoreForQueryId){this.store&&this.store[queryId]&&(this.store[queryId].networkError=error,this.store[queryId].networkStatus=exports.NetworkStatus.error,"string"==typeof fetchMoreForQueryId&&this.markQueryResultClient(fetchMoreForQueryId,!0))},QueryStore.prototype.markQueryResultClient=function(queryId,complete){this.store&&this.store[queryId]&&(this.store[queryId].networkError=null,this.store[queryId].previousVariables=null,this.store[queryId].networkStatus=complete?exports.NetworkStatus.ready:exports.NetworkStatus.loading)},QueryStore.prototype.stopQuery=function(queryId){delete this.store[queryId]},QueryStore.prototype.reset=function(observableQueryIds){var _this=this;this.store=Object.keys(this.store).filter(function(queryId){return-1<observableQueryIds.indexOf(queryId)}).reduce(function(res,key){return res[key]=tslib.__assign({},_this.store[key],{networkStatus:exports.NetworkStatus.loading}),res},{})},QueryStore}();var LocalState=function(){function LocalState(_a){var cache=_a.cache,client=_a.client,resolvers=_a.resolvers,fragmentMatcher=_a.fragmentMatcher;this.cache=cache,client&&(this.client=client),resolvers&&this.addResolvers(resolvers),fragmentMatcher&&this.setFragmentMatcher(fragmentMatcher)}return LocalState.prototype.addResolvers=function(resolvers){var _this=this;this.resolvers=this.resolvers||{},Array.isArray(resolvers)?resolvers.forEach(function(resolverGroup){_this.resolvers=apolloUtilities.mergeDeep(_this.resolvers,resolverGroup)}):this.resolvers=apolloUtilities.mergeDeep(this.resolvers,resolvers)},LocalState.prototype.setResolvers=function(resolvers){this.resolvers={},this.addResolvers(resolvers)},LocalState.prototype.getResolvers=function(){return this.resolvers||{}},LocalState.prototype.runResolvers=function(_a){var document=_a.document,remoteResult=_a.remoteResult,context=_a.context,variables=_a.variables,_b=_a.onlyRunForcedResolvers,onlyRunForcedResolvers=void 0!==_b&&_b;return tslib.__awaiter(this,void 0,void 0,function(){return tslib.__generator(this,function(_c){return document?[2,this.resolveDocument(document,remoteResult.data,context,variables,this.fragmentMatcher,onlyRunForcedResolvers).then(function(localResult){return tslib.__assign({},remoteResult,{data:localResult.result})})]:[2,remoteResult]})})},LocalState.prototype.setFragmentMatcher=function(fragmentMatcher){this.fragmentMatcher=fragmentMatcher},LocalState.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},LocalState.prototype.clientQuery=function(document){if(apolloUtilities.hasDirectives(["client"],document)){if(this.resolvers)return document;"production"===process.env.NODE_ENV||tsInvariant.invariant.warn("Found @client directives in query but no client resolvers were specified. You can now pass apollo-link-state resolvers to the ApolloClient constructor.")}return null},LocalState.prototype.serverQuery=function(document){return this.resolvers?apolloUtilities.removeClientSetsFromDocument(document):document},LocalState.prototype.prepareContext=function(context){void 0===context&&(context={});var cache=this.cache;return tslib.__assign({},context,{cache:cache,getCacheKey:function(obj){if(cache.config)return cache.config.dataIdFromObject(obj);"production"===process.env.NODE_ENV?tsInvariant.invariant(!1):tsInvariant.invariant(!1,"To use context.getCacheKey, you need to use a cache that has a configurable dataIdFromObject, like apollo-cache-inmemory.")}})},LocalState.prototype.addExportedVariables=function(document,variables,context){return void 0===variables&&(variables={}),void 0===context&&(context={}),tslib.__awaiter(this,void 0,void 0,function(){return tslib.__generator(this,function(_a){return document?[2,this.resolveDocument(document,this.buildRootValueFromCache(document,variables)||{},this.prepareContext(context),variables).then(function(data){return tslib.__assign({},variables,data.exportedVariables)})]:[2,tslib.__assign({},variables)]})})},LocalState.prototype.shouldForceResolvers=function(document){var forceResolvers=!1;return visitor.visit(document,{Directive:{enter:function(node){if("client"===node.name.value&&node.arguments&&(forceResolvers=node.arguments.some(function(arg){return"always"===arg.name.value&&"BooleanValue"===arg.value.kind&&!0===arg.value.value})))return visitor.BREAK}}}),forceResolvers},LocalState.prototype.shouldForceResolver=function(field){return this.shouldForceResolvers(field)},LocalState.prototype.buildRootValueFromCache=function(document,variables){return this.cache.diff({query:apolloUtilities.buildQueryFromSelectionSet(document),variables:variables,optimistic:!1}).result},LocalState.prototype.resolveDocument=function(document,rootValue,context,variables,fragmentMatcher,onlyRunForcedResolvers){return void 0===context&&(context={}),void 0===variables&&(variables={}),void 0===fragmentMatcher&&(fragmentMatcher=function(){return!0}),void 0===onlyRunForcedResolvers&&(onlyRunForcedResolvers=!1),tslib.__awaiter(this,void 0,void 0,function(){var mainDefinition,fragments,fragmentMap,definitionOperation,defaultOperationType,_a,cache,client,execContext;return tslib.__generator(this,function(_b){return mainDefinition=apolloUtilities.getMainDefinition(document),fragments=apolloUtilities.getFragmentDefinitions(document),fragmentMap=apolloUtilities.createFragmentMap(fragments),definitionOperation=mainDefinition.operation,defaultOperationType=definitionOperation?function(str){return str.charAt(0).toUpperCase()+str.slice(1)}(definitionOperation):"Query",cache=(_a=this).cache,client=_a.client,execContext={fragmentMap:fragmentMap,context:tslib.__assign({},context,{cache:cache,client:client}),variables:variables,fragmentMatcher:fragmentMatcher,defaultOperationType:defaultOperationType,exportedVariables:{},onlyRunForcedResolvers:onlyRunForcedResolvers},[2,this.resolveSelectionSet(mainDefinition.selectionSet,rootValue,execContext).then(function(result){return{result:result,exportedVariables:execContext.exportedVariables}})]})})},LocalState.prototype.resolveSelectionSet=function(selectionSet,rootValue,execContext){return tslib.__awaiter(this,void 0,void 0,function(){var fragmentMap,context,variables,resultsToMerge,execute,_this=this;return tslib.__generator(this,function(_a){return fragmentMap=execContext.fragmentMap,context=execContext.context,variables=execContext.variables,resultsToMerge=[rootValue],execute=function(selection){return tslib.__awaiter(_this,void 0,void 0,function(){var fragment,typeCondition;return tslib.__generator(this,function(_a){return apolloUtilities.shouldInclude(selection,variables)?apolloUtilities.isField(selection)?[2,this.resolveField(selection,rootValue,execContext).then(function(fieldResult){var _a;void 0!==fieldResult&&resultsToMerge.push(((_a={})[apolloUtilities.resultKeyNameFromField(selection)]=fieldResult,_a))})]:(apolloUtilities.isInlineFragment(selection)?fragment=selection:(fragment=fragmentMap[selection.name.value],"production"===process.env.NODE_ENV?tsInvariant.invariant(fragment):tsInvariant.invariant(fragment,"No fragment named "+selection.name.value)),fragment&&fragment.typeCondition&&(typeCondition=fragment.typeCondition.name.value,execContext.fragmentMatcher(rootValue,typeCondition,context))?[2,this.resolveSelectionSet(fragment.selectionSet,rootValue,execContext).then(function(fragmentResult){resultsToMerge.push(fragmentResult)})]:[2]):[2]})})},[2,Promise.all(selectionSet.selections.map(execute)).then(function(){return apolloUtilities.mergeDeepArray(resultsToMerge)})]})})},LocalState.prototype.resolveField=function(field,rootValue,execContext){return tslib.__awaiter(this,void 0,void 0,function(){var variables,fieldName,aliasedFieldName,aliasUsed,defaultResult,resultPromise,resolverType,resolverMap,resolve,_this=this;return tslib.__generator(this,function(_a){return variables=execContext.variables,fieldName=field.name.value,aliasedFieldName=apolloUtilities.resultKeyNameFromField(field),aliasUsed=fieldName!==aliasedFieldName,defaultResult=rootValue[aliasedFieldName]||rootValue[fieldName],resultPromise=Promise.resolve(defaultResult),execContext.onlyRunForcedResolvers&&!this.shouldForceResolver(field)||(resolverType=rootValue.__typename||execContext.defaultOperationType,(resolverMap=this.resolvers&&this.resolvers[resolverType])&&(resolve=resolverMap[aliasUsed?fieldName:aliasedFieldName])&&(resultPromise=Promise.resolve(resolve(rootValue,apolloUtilities.argumentsObjectFromField(field,variables),execContext.context,{field:field})))),[2,resultPromise.then(function(result){return void 0===result&&(result=defaultResult),field.directives&&field.directives.forEach(function(directive){"export"===directive.name.value&&directive.arguments&&directive.arguments.forEach(function(arg){"as"===arg.name.value&&"StringValue"===arg.value.kind&&(execContext.exportedVariables[arg.value.value]=result)})}),field.selectionSet?null==result?result:Array.isArray(result)?_this.resolveSubSelectedArray(field,result,execContext):field.selectionSet?_this.resolveSelectionSet(field.selectionSet,result,execContext):void 0:result})]})})},LocalState.prototype.resolveSubSelectedArray=function(field,result,execContext){var _this=this;return Promise.all(result.map(function(item){return null===item?null:Array.isArray(item)?_this.resolveSubSelectedArray(field,item,execContext):field.selectionSet?_this.resolveSelectionSet(field.selectionSet,item,execContext):void 0}))},LocalState}(),QueryManager=function(){function QueryManager(_a){var link=_a.link,_b=_a.queryDeduplication,queryDeduplication=void 0!==_b&&_b,store=_a.store,_c=_a.onBroadcast,onBroadcast=void 0===_c?function(){}:_c,_d=_a.ssrMode,ssrMode=void 0!==_d&&_d,_e=_a.clientAwareness,clientAwareness=void 0===_e?{}:_e,localState=_a.localState;this.mutationStore=new MutationStore,this.queryStore=new QueryStore,this.clientAwareness={},this.idCounter=1,this.queries=new Map,this.fetchQueryRejectFns=new Map,this.queryIdsByName={},this.pollingInfoByQueryId=new Map,this.nextPoll=null,this.link=link,this.deduplicator=apolloLink.ApolloLink.from([new apolloLinkDedup.DedupLink,link]),this.queryDeduplication=queryDeduplication,this.dataStore=store,this.onBroadcast=onBroadcast,this.clientAwareness=clientAwareness,this.localState=localState||new LocalState({cache:store.getCache()}),this.ssrMode=ssrMode}return QueryManager.prototype.stop=function(){var _this=this;this.queries.forEach(function(_info,queryId){_this.stopQueryNoBroadcast(queryId)}),this.fetchQueryRejectFns.forEach(function(reject){reject(new Error("QueryManager stopped while query was in flight"))})},QueryManager.prototype.mutate=function(_a){var mutation=_a.mutation,variables=_a.variables,optimisticResponse=_a.optimisticResponse,updateQueriesByName=_a.updateQueries,_b=_a.refetchQueries,refetchQueries=void 0===_b?[]:_b,_c=_a.awaitRefetchQueries,awaitRefetchQueries=void 0!==_c&&_c,updateWithProxyFn=_a.update,_d=_a.errorPolicy,errorPolicy=void 0===_d?"none":_d,fetchPolicy=_a.fetchPolicy,_e=_a.context,context=void 0===_e?{}:_e;return tslib.__awaiter(this,void 0,void 0,function(){var mutationId,cache,generateUpdateQueriesInfo,updatedVariables,_f,_this=this;return tslib.__generator(this,function(_g){switch(_g.label){case 0:return"production"===process.env.NODE_ENV?tsInvariant.invariant(mutation):tsInvariant.invariant(mutation,"mutation option is required. You must specify your GraphQL document in the mutation option."),"production"===process.env.NODE_ENV?tsInvariant.invariant(!fetchPolicy||"no-cache"===fetchPolicy):tsInvariant.invariant(!fetchPolicy||"no-cache"===fetchPolicy,"fetchPolicy for mutations currently only supports the 'no-cache' policy"),mutationId=this.generateQueryId(),cache=this.dataStore.getCache(),mutation=cache.transformDocument(mutation),variables=apolloUtilities.assign({},apolloUtilities.getDefaultValues(apolloUtilities.getMutationDefinition(mutation)),variables),this.setQuery(mutationId,function(){return{document:mutation}}),generateUpdateQueriesInfo=function(){var ret={};return updateQueriesByName&&Object.keys(updateQueriesByName).forEach(function(queryName){return(_this.queryIdsByName[queryName]||[]).forEach(function(queryId){ret[queryId]={updater:updateQueriesByName[queryName],query:_this.queryStore.get(queryId)}})}),ret},apolloUtilities.hasClientExports(mutation)?[4,this.localState.addExportedVariables(mutation,variables,context)]:[3,2];case 1:return _f=_g.sent(),[3,3];case 2:_f=variables,_g.label=3;case 3:return updatedVariables=_f,this.mutationStore.initMutation(mutationId,mutation,updatedVariables),this.dataStore.markMutationInit({mutationId:mutationId,document:mutation,variables:updatedVariables||{},updateQueries:generateUpdateQueriesInfo(),update:updateWithProxyFn,optimisticResponse:optimisticResponse}),this.broadcastQueries(),[2,new Promise(function(resolve,reject){var storeResult,error,operation=_this.buildOperationForLink(mutation,updatedVariables,tslib.__assign({},context,{optimisticResponse:optimisticResponse})),completeMutation=function(){if(error&&_this.mutationStore.markMutationError(mutationId,error),_this.dataStore.markMutationComplete({mutationId:mutationId,optimisticResponse:optimisticResponse}),_this.broadcastQueries(),error)return Promise.reject(error);"function"==typeof refetchQueries&&(refetchQueries=refetchQueries(storeResult));for(var refetchQueryPromises=[],_i=0,refetchQueries_1=refetchQueries;_i<refetchQueries_1.length;_i++){var refetchQuery=refetchQueries_1[_i];if("string"!=typeof refetchQuery){var queryOptions={query:refetchQuery.query,variables:refetchQuery.variables,fetchPolicy:"network-only"};refetchQuery.context&&(queryOptions.context=refetchQuery.context),refetchQueryPromises.push(_this.query(queryOptions))}else{var promise=_this.refetchQueryByName(refetchQuery);promise&&refetchQueryPromises.push(promise)}}return Promise.all(awaitRefetchQueries?refetchQueryPromises:[]).then(function(){return _this.setQuery(mutationId,function(){return{document:null}}),"ignore"===errorPolicy&&storeResult&&apolloUtilities.graphQLResultHasError(storeResult)&&delete storeResult.errors,storeResult})},clientQuery=_this.localState.clientQuery(operation.query),serverQuery=_this.localState.serverQuery(operation.query);serverQuery&&(operation.query=serverQuery);var obs=serverQuery?apolloLink.execute(_this.link,operation):Observable.of({data:{}}),self=_this,complete=!1,handlingNext=!1;obs.subscribe({next:function(result){return tslib.__awaiter(_this,void 0,void 0,function(){var updatedResult,context,variables;return tslib.__generator(this,function(_a){switch(_a.label){case 0:return handlingNext=!0,apolloUtilities.graphQLResultHasError(result)&&"none"===errorPolicy?(handlingNext=!1,error=new ApolloError({graphQLErrors:result.errors}),[2]):(self.mutationStore.markMutationResult(mutationId),updatedResult=result,context=operation.context,variables=operation.variables,clientQuery&&apolloUtilities.hasDirectives(["client"],clientQuery)?[4,self.localState.runResolvers({document:clientQuery,remoteResult:result,context:context,variables:variables}).catch(function(error){return handlingNext=!1,reject(error),result})]:[3,2]);case 1:updatedResult=_a.sent(),_a.label=2;case 2:return"no-cache"!==fetchPolicy&&self.dataStore.markMutationResult({mutationId:mutationId,result:updatedResult,document:mutation,variables:updatedVariables||{},updateQueries:generateUpdateQueriesInfo(),update:updateWithProxyFn}),storeResult=updatedResult,handlingNext=!1,complete&&completeMutation().then(resolve,reject),[2]}})})},error:function(err){self.mutationStore.markMutationError(mutationId,err),self.dataStore.markMutationComplete({mutationId:mutationId,optimisticResponse:optimisticResponse}),self.broadcastQueries(),self.setQuery(mutationId,function(){return{document:null}}),reject(new ApolloError({networkError:err}))},complete:function(){handlingNext||completeMutation().then(resolve,reject),complete=!0}})})]}})})},QueryManager.prototype.fetchQuery=function(queryId,options,fetchType,fetchMoreForQueryId){return tslib.__awaiter(this,void 0,void 0,function(){var _a,variables,_b,metadata,_c,fetchPolicy,_d,context,cache,query,updatedVariables,_e,updatedOptions,storeResult,needToFetch,_f,complete,result,shouldFetch,requestId,cancel,networkResult,_this=this;return tslib.__generator(this,function(_g){switch(_g.label){case 0:return _a=options.variables,variables=void 0===_a?{}:_a,_b=options.metadata,metadata=void 0===_b?null:_b,_c=options.fetchPolicy,fetchPolicy=void 0===_c?"cache-first":_c,_d=options.context,context=void 0===_d?{}:_d,cache=this.dataStore.getCache(),query=cache.transformDocument(options.query),apolloUtilities.hasClientExports(query)?[4,this.localState.addExportedVariables(query,variables,context)]:[3,2];case 1:return _e=_g.sent(),[3,3];case 2:_e=variables,_g.label=3;case 3:if(updatedVariables=_e,updatedOptions=tslib.__assign({},options,{variables:updatedVariables}),needToFetch="network-only"===fetchPolicy||"no-cache"===fetchPolicy,fetchType!==exports.FetchType.refetch&&"network-only"!==fetchPolicy&&"no-cache"!==fetchPolicy&&(_f=this.dataStore.getCache().diff({query:query,variables:updatedVariables,returnPartialData:!0,optimistic:!1}),complete=_f.complete,result=_f.result,needToFetch=!complete||"cache-and-network"===fetchPolicy,storeResult=result),shouldFetch=needToFetch&&"cache-only"!==fetchPolicy&&"standby"!==fetchPolicy,apolloUtilities.hasDirectives(["live"],query)&&(shouldFetch=!0),requestId=this.generateRequestId(),cancel=this.updateQueryWatch(queryId,query,updatedOptions),this.setQuery(queryId,function(){return{document:query,lastRequestId:requestId,invalidated:!0,cancel:cancel}}),this.invalidate(!0,fetchMoreForQueryId),this.queryStore.initQuery({queryId:queryId,document:query,storePreviousVariables:shouldFetch,variables:updatedVariables,isPoll:fetchType===exports.FetchType.poll,isRefetch:fetchType===exports.FetchType.refetch,metadata:metadata,fetchMoreForQueryId:fetchMoreForQueryId}),this.broadcastQueries(),(!shouldFetch||"cache-and-network"===fetchPolicy)&&(this.queryStore.markQueryResultClient(queryId,!shouldFetch),this.invalidate(!0,queryId,fetchMoreForQueryId),this.broadcastQueries(this.localState.shouldForceResolvers(query))),shouldFetch){if(networkResult=this.fetchRequest({requestId:requestId,queryId:queryId,document:query,options:updatedOptions,fetchMoreForQueryId:fetchMoreForQueryId}).catch(function(error){if(isApolloError(error))throw error;throw(_this.getQuery(queryId).lastRequestId||1)<=requestId&&(_this.queryStore.markQueryError(queryId,error,fetchMoreForQueryId),_this.invalidate(!0,queryId,fetchMoreForQueryId),_this.broadcastQueries()),new ApolloError({networkError:error})}),"cache-and-network"!==fetchPolicy)return[2,networkResult];networkResult.catch(function(){})}return[2,Promise.resolve({data:storeResult})]}})})},QueryManager.prototype.queryListenerForObserver=function(queryId,options,observer){var _this=this,previouslyHadError=!1;return function(queryStoreValue,newData,forceResolvers){return tslib.__awaiter(_this,void 0,void 0,function(){var observableQuery,fetchPolicy,errorPolicy,lastResult,lastError,shouldNotifyIfLoading,networkStatusChanged,errorStatusChanged,apolloError_1,data,isMissing,document_1,readResult,resultFromStore,query,variables,context,updatedResult,e_1,error_1;return tslib.__generator(this,function(_a){switch(_a.label){case 0:if(this.invalidate(!1,queryId),!queryStoreValue)return[2];if(observableQuery=this.getQuery(queryId).observableQuery,"standby"===(fetchPolicy=observableQuery?observableQuery.options.fetchPolicy:options.fetchPolicy))return[2];if(errorPolicy=observableQuery?observableQuery.options.errorPolicy:options.errorPolicy,lastResult=observableQuery?observableQuery.getLastResult():null,lastError=observableQuery?observableQuery.getLastError():null,shouldNotifyIfLoading=!newData&&null!=queryStoreValue.previousVariables||"cache-only"===fetchPolicy||"cache-and-network"===fetchPolicy,networkStatusChanged=Boolean(lastResult&&queryStoreValue.networkStatus!==lastResult.networkStatus),errorStatusChanged=errorPolicy&&(lastError&&lastError.graphQLErrors)!==queryStoreValue.graphQLErrors&&"none"!==errorPolicy,!(!isNetworkRequestInFlight(queryStoreValue.networkStatus)||networkStatusChanged&&options.notifyOnNetworkStatusChange||shouldNotifyIfLoading))return[3,8];if((!errorPolicy||"none"===errorPolicy)&&queryStoreValue.graphQLErrors&&0<queryStoreValue.graphQLErrors.length||queryStoreValue.networkError){if(apolloError_1=new ApolloError({graphQLErrors:queryStoreValue.graphQLErrors,networkError:queryStoreValue.networkError}),previouslyHadError=!0,observer.error)try{observer.error(apolloError_1)}catch(e){setTimeout(function(){throw e},0)}else setTimeout(function(){throw apolloError_1},0),"production"!==process.env.NODE_ENV&&console.info("An unhandled error was thrown because no error handler is registered for the query "+JSON.stringify(queryStoreValue.document));return[2]}_a.label=1;case 1:if(_a.trys.push([1,7,,8]),isMissing=data=void 0,isMissing=newData?("no-cache"!==fetchPolicy&&"network-only"!==fetchPolicy&&this.setQuery(queryId,function(){return{newData:null}}),data=newData.result,!newData.complete||!1):lastResult&&lastResult.data&&!errorStatusChanged?(data=lastResult.data,!1):(document_1=this.getQuery(queryId).document,readResult=this.dataStore.getCache().diff({query:document_1,variables:queryStoreValue.previousVariables||queryStoreValue.variables,optimistic:!0}),data=readResult.result,!readResult.complete),resultFromStore=void 0,resultFromStore=isMissing&&"cache-only"!==fetchPolicy?{data:lastResult&&lastResult.data,loading:isNetworkRequestInFlight(queryStoreValue.networkStatus),networkStatus:queryStoreValue.networkStatus,stale:!0}:{data:data,loading:isNetworkRequestInFlight(queryStoreValue.networkStatus),networkStatus:queryStoreValue.networkStatus,stale:!1},"all"===errorPolicy&&queryStoreValue.graphQLErrors&&0<queryStoreValue.graphQLErrors.length&&(resultFromStore.errors=queryStoreValue.graphQLErrors),!observer.next)return[3,6];if(!previouslyHadError&&observableQuery&&!observableQuery.isDifferentFromLastResult(resultFromStore))return[3,6];_a.label=2;case 2:return _a.trys.push([2,5,,6]),forceResolvers?(query=options.query,variables=options.variables,context=options.context,[4,this.localState.runResolvers({document:query,remoteResult:resultFromStore,context:context,variables:variables,onlyRunForcedResolvers:forceResolvers})]):[3,4];case 3:updatedResult=_a.sent(),resultFromStore=tslib.__assign({},resultFromStore,updatedResult),_a.label=4;case 4:return observer.next(resultFromStore),[3,6];case 5:return e_1=_a.sent(),setTimeout(function(){throw e_1},0),[3,6];case 6:return previouslyHadError=!1,[3,8];case 7:return error_1=_a.sent(),previouslyHadError=!0,observer.error&&observer.error(new ApolloError({networkError:error_1})),[2];case 8:return[2]}})})}},QueryManager.prototype.watchQuery=function(options,shouldSubscribe){void 0===shouldSubscribe&&(shouldSubscribe=!0),"production"===process.env.NODE_ENV?tsInvariant.invariant("standby"!==options.fetchPolicy):tsInvariant.invariant("standby"!==options.fetchPolicy,'client.watchQuery cannot be called with fetchPolicy set to "standby"');var queryDefinition=apolloUtilities.getQueryDefinition(options.query);if(queryDefinition.variableDefinitions&&queryDefinition.variableDefinitions.length){var defaultValues=apolloUtilities.getDefaultValues(queryDefinition);options.variables=apolloUtilities.assign({},defaultValues,options.variables)}void 0===options.notifyOnNetworkStatusChange&&(options.notifyOnNetworkStatusChange=!1);var transformedOptions=tslib.__assign({},options);return new ObservableQuery({queryManager:this,options:transformedOptions,shouldSubscribe:shouldSubscribe})},QueryManager.prototype.query=function(options){var _this=this;return"production"===process.env.NODE_ENV?tsInvariant.invariant(options.query):tsInvariant.invariant(options.query,"query option is required. You must specify your GraphQL document in the query option."),"production"===process.env.NODE_ENV?tsInvariant.invariant("Document"===options.query.kind):tsInvariant.invariant("Document"===options.query.kind,'You must wrap the query string in a "gql" tag.'),"production"===process.env.NODE_ENV?tsInvariant.invariant(!options.returnPartialData):tsInvariant.invariant(!options.returnPartialData,"returnPartialData option only supported on watchQuery."),"production"===process.env.NODE_ENV?tsInvariant.invariant(!options.pollInterval):tsInvariant.invariant(!options.pollInterval,"pollInterval option only supported on watchQuery."),new Promise(function(resolve,reject){var watchedQuery=_this.watchQuery(options,!1);_this.fetchQueryRejectFns.set("query:"+watchedQuery.queryId,reject),watchedQuery.result().then(resolve,reject).then(function(){return _this.fetchQueryRejectFns.delete("query:"+watchedQuery.queryId)})})},QueryManager.prototype.generateQueryId=function(){var queryId=this.idCounter.toString();return this.idCounter++,queryId},QueryManager.prototype.stopQueryInStore=function(queryId){this.stopQueryInStoreNoBroadcast(queryId),this.broadcastQueries()},QueryManager.prototype.stopQueryInStoreNoBroadcast=function(queryId){this.stopPollingQuery(queryId),this.queryStore.stopQuery(queryId),this.invalidate(!0,queryId)},QueryManager.prototype.addQueryListener=function(queryId,listener){this.setQuery(queryId,function(_a){var _b=_a.listeners;return{listeners:(void 0===_b?[]:_b).concat([listener]),invalidated:!1}})},QueryManager.prototype.updateQueryWatch=function(queryId,document,options){var _this=this,cancel=this.getQuery(queryId).cancel;cancel&&cancel();return this.dataStore.getCache().watch({query:document,variables:options.variables,optimistic:!0,previousResult:function(){var previousResult=null,observableQuery=_this.getQuery(queryId).observableQuery;if(observableQuery){var lastResult=observableQuery.getLastResult();lastResult&&(previousResult=lastResult.data)}return previousResult},callback:function(newData){_this.setQuery(queryId,function(){return{invalidated:!0,newData:newData}})}})},QueryManager.prototype.addObservableQuery=function(queryId,observableQuery){this.setQuery(queryId,function(){return{observableQuery:observableQuery}});var queryDef=apolloUtilities.getQueryDefinition(observableQuery.options.query);if(queryDef.name&&queryDef.name.value){var queryName=queryDef.name.value;this.queryIdsByName[queryName]=this.queryIdsByName[queryName]||[],this.queryIdsByName[queryName].push(observableQuery.queryId)}},QueryManager.prototype.removeObservableQuery=function(queryId){var _a=this.getQuery(queryId),observableQuery=_a.observableQuery,cancel=_a.cancel;if(cancel&&cancel(),observableQuery){var definition=apolloUtilities.getQueryDefinition(observableQuery.options.query),queryName=definition.name?definition.name.value:null;this.setQuery(queryId,function(){return{observableQuery:null}}),queryName&&(this.queryIdsByName[queryName]=this.queryIdsByName[queryName].filter(function(val){return!(observableQuery.queryId===val)}))}},QueryManager.prototype.clearStore=function(){this.fetchQueryRejectFns.forEach(function(reject){reject(new Error("Store reset while query was in flight(not completed in link chain)"))});var resetIds=[];return this.queries.forEach(function(_a,queryId){_a.observableQuery&&resetIds.push(queryId)}),this.queryStore.reset(resetIds),this.mutationStore.reset(),this.dataStore.reset()},QueryManager.prototype.resetStore=function(){var _this=this;return this.clearStore().then(function(){return _this.reFetchObservableQueries()})},QueryManager.prototype.reFetchObservableQueries=function(includeStandby){var observableQueryPromises=this.getObservableQueryPromises(includeStandby);return this.broadcastQueries(),Promise.all(observableQueryPromises)},QueryManager.prototype.startQuery=function(queryId,options,listener){return this.addQueryListener(queryId,listener),this.fetchQuery(queryId,options).catch(function(){}),queryId},QueryManager.prototype.startGraphQLSubscription=function(options){var sub,_this=this,query=options.query,isCacheEnabled=!(options.fetchPolicy&&"no-cache"===options.fetchPolicy),transformedDoc=this.dataStore.getCache().transformDocument(query),variables=apolloUtilities.assign({},apolloUtilities.getDefaultValues(apolloUtilities.getOperationDefinition(query)),options.variables),updatedVariables=variables,observers=[],clientQuery=this.localState.clientQuery(transformedDoc);return new Observable(function(observer){if(observers.push(observer),1===observers.length){var activeNextCalls_1=0,complete_1=!1,handler_1={next:function(result){return tslib.__awaiter(_this,void 0,void 0,function(){var updatedResult;return tslib.__generator(this,function(_a){switch(_a.label){case 0:return activeNextCalls_1+=1,updatedResult=result,clientQuery&&apolloUtilities.hasDirectives(["client"],clientQuery)?[4,this.localState.runResolvers({document:clientQuery,remoteResult:result,context:{},variables:updatedVariables})]:[3,2];case 1:updatedResult=_a.sent(),_a.label=2;case 2:return isCacheEnabled&&(this.dataStore.markSubscriptionResult(updatedResult,transformedDoc,updatedVariables),this.broadcastQueries()),observers.forEach(function(obs){apolloUtilities.graphQLResultHasError(updatedResult)&&obs.error?obs.error(new ApolloError({graphQLErrors:updatedResult.errors})):obs.next&&obs.next(updatedResult),activeNextCalls_1-=1}),0===activeNextCalls_1&&complete_1&&handler_1.complete(),[2]}})})},error:function(error){observers.forEach(function(obs){obs.error&&obs.error(error)})},complete:function(){0===activeNextCalls_1&&observers.forEach(function(obs){obs.complete&&obs.complete()}),complete_1=!0}};tslib.__awaiter(_this,void 0,void 0,function(){var updatedVariables,_a,serverQuery,operation;return tslib.__generator(this,function(_b){switch(_b.label){case 0:return apolloUtilities.hasClientExports(transformedDoc)?[4,this.localState.addExportedVariables(transformedDoc,variables)]:[3,2];case 1:return _a=_b.sent(),[3,3];case 2:_a=variables,_b.label=3;case 3:return updatedVariables=_a,serverQuery=this.localState.serverQuery(transformedDoc),sub=serverQuery?(operation=this.buildOperationForLink(serverQuery,updatedVariables),apolloLink.execute(this.link,operation).subscribe(handler_1)):Observable.of({data:{}}).subscribe(handler_1),[2]}})})}return function(){0===(observers=observers.filter(function(obs){return obs!==observer})).length&&sub&&sub.unsubscribe()}})},QueryManager.prototype.stopQuery=function(queryId){this.stopQueryNoBroadcast(queryId),this.broadcastQueries()},QueryManager.prototype.stopQueryNoBroadcast=function(queryId){this.stopQueryInStoreNoBroadcast(queryId),this.removeQuery(queryId)},QueryManager.prototype.removeQuery=function(queryId){var subscriptions=this.getQuery(queryId).subscriptions;this.fetchQueryRejectFns.delete("query:"+queryId),this.fetchQueryRejectFns.delete("fetchRequest:"+queryId),subscriptions.forEach(function(x){return x.unsubscribe()}),this.queries.delete(queryId)},QueryManager.prototype.getCurrentQueryResult=function(observableQuery,optimistic){void 0===optimistic&&(optimistic=!0);var _a=observableQuery.options,variables=_a.variables,query=_a.query,fetchPolicy=_a.fetchPolicy,lastResult=observableQuery.getLastResult(),newData=this.getQuery(observableQuery.queryId).newData;if(newData&&newData.complete)return{data:newData.result,partial:!1};if("no-cache"===fetchPolicy||"network-only"===fetchPolicy)return{data:void 0,partial:!1};try{return{data:this.dataStore.getCache().read({query:query,variables:variables,previousResult:lastResult?lastResult.data:void 0,optimistic:optimistic})||void 0,partial:!1}}catch(e){return{data:void 0,partial:!0}}},QueryManager.prototype.getQueryWithPreviousResult=function(queryIdOrObservable){var observableQuery;if("string"==typeof queryIdOrObservable){var foundObserveableQuery=this.getQuery(queryIdOrObservable).observableQuery;"production"===process.env.NODE_ENV?tsInvariant.invariant(foundObserveableQuery):tsInvariant.invariant(foundObserveableQuery,"ObservableQuery with this id doesn't exist: "+queryIdOrObservable),observableQuery=foundObserveableQuery}else observableQuery=queryIdOrObservable;var _a=observableQuery.options,variables=_a.variables,query=_a.query;return{previousResult:this.getCurrentQueryResult(observableQuery,!1).data,variables:variables,document:query}},QueryManager.prototype.broadcastQueries=function(forceResolvers){var _this=this;void 0===forceResolvers&&(forceResolvers=!1),this.onBroadcast(),this.queries.forEach(function(info,id){info.invalidated&&info.listeners&&info.listeners.filter(function(x){return!!x}).forEach(function(listener){listener(_this.queryStore.get(id),info.newData,forceResolvers)})})},QueryManager.prototype.getLocalState=function(){return this.localState},QueryManager.prototype.getObservableQueryPromises=function(includeStandby){var _this=this,observableQueryPromises=[];return this.queries.forEach(function(_a,queryId){var observableQuery=_a.observableQuery;if(observableQuery){var fetchPolicy=observableQuery.options.fetchPolicy;observableQuery.resetLastResults(),"cache-only"===fetchPolicy||!includeStandby&&"standby"===fetchPolicy||observableQueryPromises.push(observableQuery.refetch()),_this.setQuery(queryId,function(){return{newData:null}}),_this.invalidate(!0,queryId)}}),observableQueryPromises},QueryManager.prototype.fetchRequest=function(_a){var resultFromStore,errorsFromStore,_this=this,requestId=_a.requestId,queryId=_a.queryId,document=_a.document,options=_a.options,fetchMoreForQueryId=_a.fetchMoreForQueryId,variables=options.variables,context=options.context,_b=options.errorPolicy,errorPolicy=void 0===_b?"none":_b,fetchPolicy=options.fetchPolicy;return new Promise(function(resolve,reject){var obs,updatedContext={},clientQuery=_this.localState.clientQuery(document),serverQuery=_this.localState.serverQuery(document);if(serverQuery){var operation=_this.buildOperationForLink(serverQuery,variables,tslib.__assign({},context,{forceFetch:!_this.queryDeduplication}));updatedContext=operation.context,obs=apolloLink.execute(_this.deduplicator,operation)}else updatedContext=_this.prepareContext(context),obs=Observable.of({data:{}});_this.fetchQueryRejectFns.set("fetchRequest:"+queryId,reject);var complete=!1,handlingNext=!0,subscriber={next:function(result){return tslib.__awaiter(_this,void 0,void 0,function(){var updatedResult;return tslib.__generator(this,function(_a){switch(_a.label){case 0:return handlingNext=!0,updatedResult=result,(this.getQuery(queryId).lastRequestId||1)<=requestId?clientQuery&&apolloUtilities.hasDirectives(["client"],clientQuery)?[4,this.localState.runResolvers({document:clientQuery,remoteResult:result,context:updatedContext,variables:variables}).catch(function(error){return handlingNext=!1,reject(error),result})]:[3,2]:[3,3];case 1:updatedResult=_a.sent(),_a.label=2;case 2:if("no-cache"!==fetchPolicy)try{this.dataStore.markQueryResult(updatedResult,document,variables,fetchMoreForQueryId,"ignore"===errorPolicy||"all"===errorPolicy)}catch(e){return handlingNext=!1,reject(e),[2]}else this.setQuery(queryId,function(){return{newData:{result:updatedResult.data,complete:!0}}});this.queryStore.markQueryResult(queryId,updatedResult,fetchMoreForQueryId),this.invalidate(!0,queryId,fetchMoreForQueryId),this.broadcastQueries(),_a.label=3;case 3:if(updatedResult.errors&&"none"===errorPolicy)return handlingNext=!1,reject(new ApolloError({graphQLErrors:updatedResult.errors})),[2];if("all"===errorPolicy&&(errorsFromStore=updatedResult.errors),fetchMoreForQueryId||"no-cache"===fetchPolicy)resultFromStore=updatedResult.data;else try{resultFromStore=this.dataStore.getCache().read({variables:variables,query:document,optimistic:!1})}catch(e){}return handlingNext=!1,complete&&subscriber.complete(),[2]}})})},error:function(error){_this.fetchQueryRejectFns.delete("fetchRequest:"+queryId),_this.setQuery(queryId,function(_a){return{subscriptions:_a.subscriptions.filter(function(x){return x!==subscription})}}),reject(error)},complete:function(){handlingNext||(_this.fetchQueryRejectFns.delete("fetchRequest:"+queryId),_this.setQuery(queryId,function(_a){return{subscriptions:_a.subscriptions.filter(function(x){return x!==subscription})}}),resolve({data:resultFromStore,errors:errorsFromStore,loading:!1,networkStatus:exports.NetworkStatus.ready,stale:!1})),complete=!0}},subscription=obs.subscribe(subscriber);_this.setQuery(queryId,function(_a){return{subscriptions:_a.subscriptions.concat([subscription])}})}).catch(function(error){throw _this.fetchQueryRejectFns.delete("fetchRequest:"+queryId),error})},QueryManager.prototype.refetchQueryByName=function(queryName){var _this=this,refetchedQueries=this.queryIdsByName[queryName];if(void 0!==refetchedQueries)return Promise.all(refetchedQueries.map(function(id){return _this.getQuery(id).observableQuery}).filter(function(x){return!!x}).map(function(x){return x.refetch()}))},QueryManager.prototype.generateRequestId=function(){var requestId=this.idCounter;return this.idCounter++,requestId},QueryManager.prototype.getQuery=function(queryId){return this.queries.get(queryId)||{listeners:[],invalidated:!1,document:null,newData:null,lastRequestId:null,observableQuery:null,subscriptions:[]}},QueryManager.prototype.setQuery=function(queryId,updater){var prev=this.getQuery(queryId),newInfo=tslib.__assign({},prev,updater(prev));this.queries.set(queryId,newInfo)},QueryManager.prototype.invalidate=function(invalidated,queryId,fetchMoreForQueryId){queryId&&this.setQuery(queryId,function(){return{invalidated:invalidated}}),fetchMoreForQueryId&&this.setQuery(fetchMoreForQueryId,function(){return{invalidated:invalidated}})},QueryManager.prototype.buildOperationForLink=function(document,variables,extraContext){var cache=this.dataStore.getCache();return{query:cache.transformForLink?cache.transformForLink(document):document,variables:variables,operationName:apolloUtilities.getOperationName(document)||void 0,context:this.prepareContext(extraContext)}},QueryManager.prototype.prepareContext=function(context){void 0===context&&(context={});var newContext=this.localState.prepareContext(context);return tslib.__assign({},newContext,{clientAwareness:this.clientAwareness})},QueryManager.prototype.checkInFlight=function(queryId){var query=this.queryStore.get(queryId);return query&&query.networkStatus!==exports.NetworkStatus.ready&&query.networkStatus!==exports.NetworkStatus.error},QueryManager.prototype.startPollingQuery=function(options,queryId,listener){var pollInterval=options.pollInterval;return"production"===process.env.NODE_ENV?tsInvariant.invariant(pollInterval):tsInvariant.invariant(pollInterval,"Attempted to start a polling query without a polling interval."),this.ssrMode||(this.pollingInfoByQueryId.set(queryId,{interval:pollInterval,lastPollTimeMs:Date.now()-10,options:tslib.__assign({},options,{fetchPolicy:"network-only"})}),listener&&this.addQueryListener(queryId,listener),this.schedulePoll(pollInterval)),queryId},QueryManager.prototype.stopPollingQuery=function(queryId){this.pollingInfoByQueryId.delete(queryId)},QueryManager.prototype.schedulePoll=function(timeLimitMs){var _this=this,now=Date.now();if(this.nextPoll){if(!(timeLimitMs<this.nextPoll.time-now))return;clearTimeout(this.nextPoll.timeout)}this.nextPoll={time:now+timeLimitMs,timeout:setTimeout(function(){_this.nextPoll=null;var nextTimeLimitMs=1/0;_this.pollingInfoByQueryId.forEach(function(info,queryId){if(info.interval<nextTimeLimitMs&&(nextTimeLimitMs=info.interval),!_this.checkInFlight(queryId)&&Date.now()-info.lastPollTimeMs>=info.interval){var updateLastPollTime=function(){info.lastPollTimeMs=Date.now()};_this.fetchQuery(queryId,info.options,exports.FetchType.poll).then(updateLastPollTime,updateLastPollTime)}}),isFinite(nextTimeLimitMs)&&_this.schedulePoll(nextTimeLimitMs)},timeLimitMs)}},QueryManager}(),DataStore=function(){function DataStore(initialCache){this.cache=initialCache}return DataStore.prototype.getCache=function(){return this.cache},DataStore.prototype.markQueryResult=function(result,document,variables,fetchMoreForQueryId,ignoreErrors){void 0===ignoreErrors&&(ignoreErrors=!1);var writeWithErrors=!apolloUtilities.graphQLResultHasError(result);ignoreErrors&&apolloUtilities.graphQLResultHasError(result)&&result.data&&(writeWithErrors=!0),!fetchMoreForQueryId&&writeWithErrors&&this.cache.write({result:result.data,dataId:"ROOT_QUERY",query:document,variables:variables})},DataStore.prototype.markSubscriptionResult=function(result,document,variables){apolloUtilities.graphQLResultHasError(result)||this.cache.write({result:result.data,dataId:"ROOT_SUBSCRIPTION",query:document,variables:variables})},DataStore.prototype.markMutationInit=function(mutation){var _this=this;if(mutation.optimisticResponse){var optimistic_1;optimistic_1="function"==typeof mutation.optimisticResponse?mutation.optimisticResponse(mutation.variables):mutation.optimisticResponse;this.cache.recordOptimisticTransaction(function(c){var orig=_this.cache;_this.cache=c;try{_this.markMutationResult({mutationId:mutation.mutationId,result:{data:optimistic_1},document:mutation.document,variables:mutation.variables,updateQueries:mutation.updateQueries,update:mutation.update})}finally{_this.cache=orig}},mutation.mutationId)}},DataStore.prototype.markMutationResult=function(mutation){var _this=this;if(!apolloUtilities.graphQLResultHasError(mutation.result)){var cacheWrites_1=[];cacheWrites_1.push({result:mutation.result.data,dataId:"ROOT_MUTATION",query:mutation.document,variables:mutation.variables}),mutation.updateQueries&&Object.keys(mutation.updateQueries).filter(function(id){return mutation.updateQueries[id]}).forEach(function(queryId){var _a=mutation.updateQueries[queryId],query=_a.query,updater=_a.updater,_b=_this.cache.diff({query:query.document,variables:query.variables,returnPartialData:!0,optimistic:!1}),currentQueryResult=_b.result;if(_b.complete){var nextQueryResult=apolloUtilities.tryFunctionOrLogError(function(){return updater(currentQueryResult,{mutationResult:mutation.result,queryName:apolloUtilities.getOperationName(query.document)||void 0,queryVariables:query.variables})});nextQueryResult&&cacheWrites_1.push({result:nextQueryResult,dataId:"ROOT_QUERY",query:query.document,variables:query.variables})}}),this.cache.performTransaction(function(c){cacheWrites_1.forEach(function(write){return c.write(write)})});var update_1=mutation.update;update_1&&this.cache.performTransaction(function(c){apolloUtilities.tryFunctionOrLogError(function(){return update_1(c,mutation.result)})})}},DataStore.prototype.markMutationComplete=function(_a){var mutationId=_a.mutationId;_a.optimisticResponse&&this.cache.removeOptimistic(mutationId)},DataStore.prototype.markUpdateQueryResult=function(document,variables,newResult){this.cache.write({result:newResult,dataId:"ROOT_QUERY",variables:variables,query:document})},DataStore.prototype.reset=function(){return this.cache.reset()},DataStore}(),hasSuggestedDevtools=!1,ApolloClient=function(){function ApolloClient(options){var _this=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],this.clientAwareness={};var cache=options.cache,_a=options.ssrMode,ssrMode=void 0!==_a&&_a,_b=options.ssrForceFetchDelay,ssrForceFetchDelay=void 0===_b?0:_b,connectToDevTools=options.connectToDevTools,_c=options.queryDeduplication,queryDeduplication=void 0===_c||_c,defaultOptions=options.defaultOptions,resolvers=options.resolvers,typeDefs=options.typeDefs,fragmentMatcher=options.fragmentMatcher,clientAwarenessName=options.name,clientAwarenessVersion=options.version,link=options.link;if(!link&&resolvers&&(link=apolloLink.ApolloLink.empty()),!link||!cache)throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("\n In order to initialize Apollo Client, you must specify link & cache properties on the config object.\n This is part of the required upgrade when migrating from Apollo Client 1.0 to Apollo Client 2.0.\n For more information, please visit:\n https://www.apollographql.com/docs/react/basics/setup.html\n to help you get started.\n ");var supportedCache=new Map,supportedDirectives=new apolloLink.ApolloLink(function(operation,forward){var result=supportedCache.get(operation.query);return result||(result=apolloUtilities.removeConnectionDirectiveFromDocument(operation.query),supportedCache.set(operation.query,result),supportedCache.set(result,result)),operation.query=result,forward(operation)});this.link=supportedDirectives.concat(link),this.cache=cache,this.store=new DataStore(cache),this.disableNetworkFetches=ssrMode||0<ssrForceFetchDelay,this.queryDeduplication=queryDeduplication,this.ssrMode=ssrMode,this.defaultOptions=defaultOptions||{},this.typeDefs=typeDefs,ssrForceFetchDelay&&setTimeout(function(){return _this.disableNetworkFetches=!1},ssrForceFetchDelay),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this);var defaultConnectToDevTools="production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&!window.__APOLLO_CLIENT__;(void 0===connectToDevTools?defaultConnectToDevTools:connectToDevTools&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),hasSuggestedDevtools||"production"===process.env.NODE_ENV||(hasSuggestedDevtools=!0,"undefined"!=typeof window&&window.document&&window.top===window.self&&void 0===window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__&&window.navigator&&window.navigator.userAgent&&-1<window.navigator.userAgent.indexOf("Chrome")&&console.debug("Download the Apollo DevTools for a better development experience: https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm")),this.version="2.5.1",clientAwarenessName&&(this.clientAwareness.name=clientAwarenessName),clientAwarenessVersion&&(this.clientAwareness.version=clientAwarenessVersion),this.localState=new LocalState({cache:cache,client:this,resolvers:resolvers,fragmentMatcher:fragmentMatcher})}return ApolloClient.prototype.stop=function(){this.queryManager&&this.queryManager.stop()},ApolloClient.prototype.watchQuery=function(options){return this.defaultOptions.watchQuery&&(options=tslib.__assign({},this.defaultOptions.watchQuery,options)),!this.disableNetworkFetches||"network-only"!==options.fetchPolicy&&"cache-and-network"!==options.fetchPolicy||(options=tslib.__assign({},options,{fetchPolicy:"cache-first"})),this.initQueryManager().watchQuery(options)},ApolloClient.prototype.query=function(options){return this.defaultOptions.query&&(options=tslib.__assign({},this.defaultOptions.query,options)),"production"===process.env.NODE_ENV?tsInvariant.invariant("cache-and-network"!==options.fetchPolicy):tsInvariant.invariant("cache-and-network"!==options.fetchPolicy,"cache-and-network fetchPolicy can only be used with watchQuery"),this.disableNetworkFetches&&"network-only"===options.fetchPolicy&&(options=tslib.__assign({},options,{fetchPolicy:"cache-first"})),this.initQueryManager().query(options)},ApolloClient.prototype.mutate=function(options){return this.defaultOptions.mutate&&(options=tslib.__assign({},this.defaultOptions.mutate,options)),this.initQueryManager().mutate(options)},ApolloClient.prototype.subscribe=function(options){return this.initQueryManager().startGraphQLSubscription(options)},ApolloClient.prototype.readQuery=function(options,optimistic){return void 0===optimistic&&(optimistic=!1),this.initProxy().readQuery(options,optimistic)},ApolloClient.prototype.readFragment=function(options,optimistic){return void 0===optimistic&&(optimistic=!1),this.initProxy().readFragment(options,optimistic)},ApolloClient.prototype.writeQuery=function(options){var result=this.initProxy().writeQuery(options);return this.initQueryManager().broadcastQueries(),result},ApolloClient.prototype.writeFragment=function(options){var result=this.initProxy().writeFragment(options);return this.initQueryManager().broadcastQueries(),result},ApolloClient.prototype.writeData=function(options){var result=this.initProxy().writeData(options);return this.initQueryManager().broadcastQueries(),result},ApolloClient.prototype.__actionHookForDevTools=function(cb){this.devToolsHookCb=cb},ApolloClient.prototype.__requestRaw=function(payload){return apolloLink.execute(this.link,payload)},ApolloClient.prototype.initQueryManager=function(){var _this=this;return this.queryManager||(this.queryManager=new QueryManager({link:this.link,store:this.store,queryDeduplication:this.queryDeduplication,ssrMode:this.ssrMode,clientAwareness:this.clientAwareness,localState:this.localState,onBroadcast:function(){_this.devToolsHookCb&&_this.devToolsHookCb({action:{},state:{queries:_this.queryManager?_this.queryManager.queryStore.getStore():{},mutations:_this.queryManager?_this.queryManager.mutationStore.getStore():{}},dataWithOptimisticResults:_this.cache.extract(!0)})}})),this.queryManager},ApolloClient.prototype.resetStore=function(){var _this=this;return Promise.resolve().then(function(){return _this.queryManager?_this.queryManager.clearStore():Promise.resolve(null)}).then(function(){return Promise.all(_this.resetStoreCallbacks.map(function(fn){return fn()}))}).then(function(){return _this.queryManager&&_this.queryManager.reFetchObservableQueries?_this.queryManager.reFetchObservableQueries():Promise.resolve(null)})},ApolloClient.prototype.clearStore=function(){var _this=this,queryManager=this.queryManager;return Promise.resolve().then(function(){return Promise.all(_this.clearStoreCallbacks.map(function(fn){return fn()}))}).then(function(){return queryManager?queryManager.clearStore():Promise.resolve(null)})},ApolloClient.prototype.onResetStore=function(cb){var _this=this;return this.resetStoreCallbacks.push(cb),function(){_this.resetStoreCallbacks=_this.resetStoreCallbacks.filter(function(c){return c!==cb})}},ApolloClient.prototype.onClearStore=function(cb){var _this=this;return this.clearStoreCallbacks.push(cb),function(){_this.clearStoreCallbacks=_this.clearStoreCallbacks.filter(function(c){return c!==cb})}},ApolloClient.prototype.reFetchObservableQueries=function(includeStandby){return this.queryManager?this.queryManager.reFetchObservableQueries(includeStandby):Promise.resolve(null)},ApolloClient.prototype.extract=function(optimistic){return this.initProxy().extract(optimistic)},ApolloClient.prototype.restore=function(serializedState){return this.initProxy().restore(serializedState)},ApolloClient.prototype.addResolvers=function(resolvers){this.localState.addResolvers(resolvers)},ApolloClient.prototype.setResolvers=function(resolvers){this.localState.setResolvers(resolvers)},ApolloClient.prototype.getResolvers=function(){return this.localState.getResolvers()},ApolloClient.prototype.setLocalStateFragmentMatcher=function(fragmentMatcher){this.localState.setFragmentMatcher(fragmentMatcher)},ApolloClient.prototype.initProxy=function(){return this.proxy||(this.initQueryManager(),this.proxy=this.cache),this.proxy},ApolloClient}();exports.default=ApolloClient,exports.ApolloClient=ApolloClient,exports.ObservableQuery=ObservableQuery,exports.isApolloError=isApolloError,exports.ApolloError=ApolloError,Object.defineProperty(exports,"__esModule",{value:!0})},"object"==typeof exports&&void 0!==module?factory(exports,require("tslib"),require("apollo-utilities"),require("apollo-link"),require("symbol-observable"),require("ts-invariant"),require("apollo-link-dedup"),require("graphql/language/visitor")):factory((global=global||self)["apollo.core"]={},global.tslib,global.apollo.utilities,global.apolloLink.core,global.$$observable,global.invariant,global.apolloLink.dedup,global.visitor)}).call(this,require("_process"))},{_process:47,"apollo-link":14,"apollo-link-dedup":8,"apollo-utilities":18,"graphql/language/visitor":73,"symbol-observable":286,"ts-invariant":290,tslib:291}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),apollo_link_1=require("apollo-link"),DedupLink=function(_super){function DedupLink(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.inFlightRequestObservables=new Map,_this.subscribers=new Map,_this}return tslib_1.__extends(DedupLink,_super),DedupLink.prototype.request=function(operation,forward){var _this=this;if(operation.getContext().forceFetch)return forward(operation);var key=operation.toKey();if(!this.inFlightRequestObservables.get(key)){var subscription_1,singleObserver_1=forward(operation),sharedObserver=new apollo_link_1.Observable(function(observer){return _this.subscribers.has(key)||_this.subscribers.set(key,new Set),_this.subscribers.get(key).add(observer),subscription_1||(subscription_1=singleObserver_1.subscribe({next:function(result){var subscribers=_this.subscribers.get(key);_this.subscribers.delete(key),_this.inFlightRequestObservables.delete(key),subscribers&&(subscribers.forEach(function(obs){return obs.next(result)}),subscribers.forEach(function(obs){return obs.complete()}))},error:function(error){var subscribers=_this.subscribers.get(key);_this.subscribers.delete(key),_this.inFlightRequestObservables.delete(key),subscribers&&subscribers.forEach(function(obs){return obs.error(error)})}})),function(){_this.subscribers.has(key)&&(_this.subscribers.get(key).delete(observer),0===_this.subscribers.get(key).size&&(_this.inFlightRequestObservables.delete(key),subscription_1&&subscription_1.unsubscribe()))}});this.inFlightRequestObservables.set(key,sharedObserver)}return this.inFlightRequestObservables.get(key)},DedupLink}(apollo_link_1.ApolloLink);exports.DedupLink=DedupLink},{"apollo-link":14,tslib:291}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("tslib").__exportStar(require("./dedupLink"),exports)},{"./dedupLink":7,tslib:291}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),apollo_link_1=require("apollo-link");function onError(errorHandler){return new apollo_link_1.ApolloLink(function(operation,forward){return new apollo_link_1.Observable(function(observer){var sub,retriedSub,retriedResult;try{sub=forward(operation).subscribe({next:function(result){result.errors&&(retriedResult=errorHandler({graphQLErrors:result.errors,response:result,operation:operation,forward:forward}))?retriedSub=retriedResult.subscribe({next:observer.next.bind(observer),error:observer.error.bind(observer),complete:observer.complete.bind(observer)}):observer.next(result)},error:function(networkError){(retriedResult=errorHandler({operation:operation,networkError:networkError,graphQLErrors:networkError&&networkError.result&&networkError.result.errors,forward:forward}))?retriedSub=retriedResult.subscribe({next:observer.next.bind(observer),error:observer.error.bind(observer),complete:observer.complete.bind(observer)}):observer.error(networkError)},complete:function(){retriedResult||observer.complete.bind(observer)()}})}catch(e){errorHandler({networkError:e,operation:operation,forward:forward}),observer.error(e)}return function(){sub&&sub.unsubscribe(),retriedSub&&sub.unsubscribe()}})})}exports.onError=onError;var ErrorLink=function(_super){function ErrorLink(errorHandler){var _this=_super.call(this)||this;return _this.link=onError(errorHandler),_this}return tslib_1.__extends(ErrorLink,_super),ErrorLink.prototype.request=function(operation,forward){return this.link.request(operation,forward)},ErrorLink}(apollo_link_1.ApolloLink);exports.ErrorLink=ErrorLink},{"apollo-link":14,tslib:291}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),printer_1=require("graphql/language/printer"),ts_invariant_1=require("ts-invariant");exports.fallbackHttpConfig={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},exports.throwServerError=function(response,result,message){var error=new Error(message);throw error.name="ServerError",error.response=response,error.statusCode=response.status,error.result=result,error},exports.parseAndCheckHttpResponse=function(operations){return function(response){return response.text().then(function(bodyText){try{return JSON.parse(bodyText)}catch(err){var parseError=err;return parseError.name="ServerParseError",parseError.response=response,parseError.statusCode=response.status,parseError.bodyText=bodyText,Promise.reject(parseError)}}).then(function(result){return 300<=response.status&&exports.throwServerError(response,result,"Response not successful: Received status code "+response.status),Array.isArray(result)||result.hasOwnProperty("data")||result.hasOwnProperty("errors")||exports.throwServerError(response,result,"Server response was missing for query '"+(Array.isArray(operations)?operations.map(function(op){return op.operationName}):operations.operationName)+"'."),result})}},exports.checkFetcher=function(fetcher){if(!fetcher&&"undefined"==typeof fetch){var library="unfetch";throw"undefined"==typeof window&&(library="node-fetch"),new ts_invariant_1.InvariantError("\nfetch is not found globally and no fetcher passed, to fix pass a fetch for\nyour environment like https://www.npmjs.com/package/"+library+".\n\nFor example:\nimport fetch from '"+library+"';\nimport { createHttpLink } from 'apollo-link-http';\n\nconst link = createHttpLink({ uri: '/graphql', fetch: fetch });")}},exports.createSignalIfSupported=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var controller=new AbortController;return{controller:controller,signal:controller.signal}},exports.selectHttpOptionsAndBody=function(operation,fallbackConfig){for(var configs=[],_i=2;_i<arguments.length;_i++)configs[_i-2]=arguments[_i];var options=tslib_1.__assign({},fallbackConfig.options,{headers:fallbackConfig.headers,credentials:fallbackConfig.credentials}),http=fallbackConfig.http;configs.forEach(function(config){options=tslib_1.__assign({},options,config.options,{headers:tslib_1.__assign({},options.headers,config.headers)}),config.credentials&&(options.credentials=config.credentials),http=tslib_1.__assign({},http,config.http)});var operationName=operation.operationName,extensions=operation.extensions,variables=operation.variables,query=operation.query,body={operationName:operationName,variables:variables};return http.includeExtensions&&(body.extensions=extensions),http.includeQuery&&(body.query=printer_1.print(query)),{options:options,body:body}},exports.serializeFetchParameter=function(p,label){var serialized;try{serialized=JSON.stringify(p)}catch(e){var parseError=new ts_invariant_1.InvariantError("Network request failed. "+label+" is not serializable: "+e.message);throw parseError.parseError=e,parseError}return serialized},exports.selectURI=function(operation,fallbackURI){var contextURI=operation.getContext().uri;return contextURI||("function"==typeof fallbackURI?fallbackURI(operation):fallbackURI||"/graphql")}},{"graphql/language/printer":71,"ts-invariant":11,tslib:291}],11:[function(require,module,exports){(function(process){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib=require("tslib"),_a=Object.setPrototypeOf,setPrototypeOf=void 0===_a?function(obj,proto){return obj.__proto__=proto,obj}:_a,InvariantError=function(_super){function InvariantError(message){void 0===message&&(message="Invariant Violation");var _this=_super.call(this,"number"==typeof message?"Invariant Violation: "+message+" (see https://github.com/apollographql/invariant-packages)":message)||this;return _this.framesToPop=1,_this.name="Invariant Violation",setPrototypeOf(_this,InvariantError.prototype),_this}return tslib.__extends(InvariantError,_super),InvariantError}(Error);function invariant(condition,message){if(!condition)throw new InvariantError(message)}!function(invariant){invariant.warn=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return console.warn.apply(console,args)},invariant.error=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return console.error.apply(console,args)}}(invariant||(invariant={}));var processStub="object"==typeof process?process:{env:{}},invariant$1=invariant;exports.default=invariant$1,exports.InvariantError=InvariantError,exports.invariant=invariant,exports.process=processStub}).call(this,require("_process"))},{_process:47,tslib:291}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),apollo_link_1=require("apollo-link"),apollo_link_http_common_1=require("apollo-link-http-common");exports.createHttpLink=function(linkOptions){void 0===linkOptions&&(linkOptions={});var _a=linkOptions.uri,uri=void 0===_a?"/graphql":_a,fetcher=linkOptions.fetch,includeExtensions=linkOptions.includeExtensions,useGETForQueries=linkOptions.useGETForQueries,requestOptions=tslib_1.__rest(linkOptions,["uri","fetch","includeExtensions","useGETForQueries"]);apollo_link_http_common_1.checkFetcher(fetcher),fetcher||(fetcher=fetch);var linkConfig={http:{includeExtensions:includeExtensions},options:requestOptions.fetchOptions,credentials:requestOptions.credentials,headers:requestOptions.headers};return new apollo_link_1.ApolloLink(function(operation){var chosenURI=apollo_link_http_common_1.selectURI(operation,uri),context=operation.getContext(),clientAwarenessHeaders={};if(context.clientAwareness){var _a=context.clientAwareness,name_1=_a.name,version=_a.version;name_1&&(clientAwarenessHeaders["apollographql-client-name"]=name_1),version&&(clientAwarenessHeaders["apollographql-client-version"]=version)}var controller,contextHeaders=tslib_1.__assign({},clientAwarenessHeaders,context.headers),contextConfig={http:context.http,options:context.fetchOptions,credentials:context.credentials,headers:contextHeaders},_b=apollo_link_http_common_1.selectHttpOptionsAndBody(operation,apollo_link_http_common_1.fallbackHttpConfig,linkConfig,contextConfig),options=_b.options,body=_b.body;if(!options.signal){var _c=apollo_link_http_common_1.createSignalIfSupported(),_controller=_c.controller,signal=_c.signal;(controller=_controller)&&(options.signal=signal)}if(useGETForQueries&&!operation.query.definitions.some(function(d){return"OperationDefinition"===d.kind&&"mutation"===d.operation})&&(options.method="GET"),"GET"===options.method){var _d=function(chosenURI,body){var queryParams=[],addQueryParam=function(key,value){queryParams.push(key+"="+encodeURIComponent(value))};"query"in body&&addQueryParam("query",body.query);body.operationName&&addQueryParam("operationName",body.operationName);if(body.variables){var serializedVariables=void 0;try{serializedVariables=apollo_link_http_common_1.serializeFetchParameter(body.variables,"Variables map")}catch(parseError){return{parseError:parseError}}addQueryParam("variables",serializedVariables)}if(body.extensions){var serializedExtensions=void 0;try{serializedExtensions=apollo_link_http_common_1.serializeFetchParameter(body.extensions,"Extensions map")}catch(parseError){return{parseError:parseError}}addQueryParam("extensions",serializedExtensions)}var fragment="",preFragment=chosenURI,fragmentStart=chosenURI.indexOf("#");-1!==fragmentStart&&(fragment=chosenURI.substr(fragmentStart),preFragment=chosenURI.substr(0,fragmentStart));var queryParamsPrefix=-1===preFragment.indexOf("?")?"?":"&";return{newURI:preFragment+queryParamsPrefix+queryParams.join("&")+fragment}}(chosenURI,body),newURI=_d.newURI,parseError=_d.parseError;if(parseError)return apollo_link_1.fromError(parseError);chosenURI=newURI}else try{options.body=apollo_link_http_common_1.serializeFetchParameter(body,"Payload")}catch(parseError){return apollo_link_1.fromError(parseError)}return new apollo_link_1.Observable(function(observer){return fetcher(chosenURI,options).then(function(response){return operation.setContext({response:response}),response}).then(apollo_link_http_common_1.parseAndCheckHttpResponse(operation)).then(function(result){return observer.next(result),observer.complete(),result}).catch(function(err){"AbortError"!==err.name&&(err.result&&err.result.errors&&err.result.data&&observer.next(err.result),observer.error(err))}),function(){controller&&controller.abort()}})})};var HttpLink=function(_super){function HttpLink(opts){return _super.call(this,exports.createHttpLink(opts).request)||this}return tslib_1.__extends(HttpLink,_super),HttpLink}(apollo_link_1.ApolloLink);exports.HttpLink=HttpLink},{"apollo-link":14,"apollo-link-http-common":10,tslib:291}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("tslib").__exportStar(require("./httpLink"),exports)},{"./httpLink":12,tslib:291}],14:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib");tslib_1.__exportStar(require("./link"),exports);var linkUtils_1=require("./linkUtils");exports.createOperation=linkUtils_1.createOperation,exports.makePromise=linkUtils_1.makePromise,exports.toPromise=linkUtils_1.toPromise,exports.fromPromise=linkUtils_1.fromPromise,exports.fromError=linkUtils_1.fromError,exports.getOperationName=linkUtils_1.getOperationName;var zen_observable_ts_1=tslib_1.__importDefault(require("zen-observable-ts"));exports.Observable=zen_observable_ts_1.default},{"./link":15,"./linkUtils":16,tslib:291,"zen-observable-ts":339}],15:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var zen_observable_ts_1=require("tslib").__importDefault(require("zen-observable-ts")),ts_invariant_1=require("ts-invariant"),linkUtils_1=require("./linkUtils");function passthrough(op,forward){return forward?forward(op):zen_observable_ts_1.default.of()}function toLink(handler){return"function"==typeof handler?new ApolloLink(handler):handler}function empty(){return new ApolloLink(function(){return zen_observable_ts_1.default.of()})}function from(links){return 0===links.length?empty():links.map(toLink).reduce(function(x,y){return x.concat(y)})}function split(test,left,right){var leftLink=toLink(left),rightLink=toLink(right||new ApolloLink(passthrough));return linkUtils_1.isTerminating(leftLink)&&linkUtils_1.isTerminating(rightLink)?new ApolloLink(function(operation){return test(operation)?leftLink.request(operation)||zen_observable_ts_1.default.of():rightLink.request(operation)||zen_observable_ts_1.default.of()}):new ApolloLink(function(operation,forward){return test(operation)?leftLink.request(operation,forward)||zen_observable_ts_1.default.of():rightLink.request(operation,forward)||zen_observable_ts_1.default.of()})}exports.empty=empty,exports.from=from,exports.split=split,exports.concat=function(first,second){var firstLink=toLink(first);if(linkUtils_1.isTerminating(firstLink))return ts_invariant_1.invariant.warn(new linkUtils_1.LinkError("You are calling concat on a terminating link, which will have no effect",firstLink)),firstLink;var nextLink=toLink(second);return linkUtils_1.isTerminating(nextLink)?new ApolloLink(function(operation){return firstLink.request(operation,function(op){return nextLink.request(op)||zen_observable_ts_1.default.of()})||zen_observable_ts_1.default.of()}):new ApolloLink(function(operation,forward){return firstLink.request(operation,function(op){return nextLink.request(op,forward)||zen_observable_ts_1.default.of()})||zen_observable_ts_1.default.of()})};var ApolloLink=function(){function ApolloLink(request){request&&(this.request=request)}return ApolloLink.prototype.split=function(test,left,right){return this.concat(split(test,left,right||new ApolloLink(passthrough)))},ApolloLink.prototype.concat=function(next){return exports.concat(this,next)},ApolloLink.prototype.request=function(operation,forward){throw new ts_invariant_1.InvariantError("request is not implemented")},ApolloLink.empty=empty,ApolloLink.from=from,ApolloLink.split=split,ApolloLink.execute=execute,ApolloLink}();function execute(link,operation){return link.request(linkUtils_1.createOperation(operation.context,linkUtils_1.transformOperation(linkUtils_1.validateOperation(operation))))||zen_observable_ts_1.default.of()}exports.ApolloLink=ApolloLink,exports.execute=execute},{"./linkUtils":16,"ts-invariant":17,tslib:291,"zen-observable-ts":339}],16:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),zen_observable_ts_1=tslib_1.__importDefault(require("zen-observable-ts")),printer_1=require("graphql/language/printer"),apollo_utilities_1=require("apollo-utilities");exports.getOperationName=apollo_utilities_1.getOperationName;var ts_invariant_1=require("ts-invariant");exports.validateOperation=function(operation){for(var OPERATION_FIELDS=["query","operationName","variables","extensions","context"],_i=0,_a=Object.keys(operation);_i<_a.length;_i++){var key=_a[_i];if(OPERATION_FIELDS.indexOf(key)<0)throw new ts_invariant_1.InvariantError("illegal argument: "+key)}return operation};var LinkError=function(_super){function LinkError(message,link){var _this=_super.call(this,message)||this;return _this.link=link,_this}return tslib_1.__extends(LinkError,_super),LinkError}(Error);function toPromise(observable){var completed=!1;return new Promise(function(resolve,reject){observable.subscribe({next:function(data){completed?ts_invariant_1.invariant.warn("Promise Wrapper does not support multiple results from Observable"):(completed=!0,resolve(data))},error:reject})})}function getKey(operation){return printer_1.print(operation.query)+"|"+JSON.stringify(operation.variables)+"|"+operation.operationName}exports.LinkError=LinkError,exports.isTerminating=function(link){return link.request.length<=1},exports.toPromise=toPromise,exports.makePromise=toPromise,exports.fromPromise=function(promise){return new zen_observable_ts_1.default(function(observer){promise.then(function(value){observer.next(value),observer.complete()}).catch(observer.error.bind(observer))})},exports.fromError=function(errorValue){return new zen_observable_ts_1.default(function(observer){observer.error(errorValue)})},exports.transformOperation=function(operation){var transformedOperation={variables:operation.variables||{},extensions:operation.extensions||{},operationName:operation.operationName,query:operation.query};return transformedOperation.operationName||(transformedOperation.operationName="string"!=typeof transformedOperation.query?apollo_utilities_1.getOperationName(transformedOperation.query):""),transformedOperation},exports.createOperation=function(starting,operation){var context=tslib_1.__assign({},starting);return Object.defineProperty(operation,"setContext",{enumerable:!1,value:function(next){context="function"==typeof next?tslib_1.__assign({},context,next(context)):tslib_1.__assign({},context,next)}}),Object.defineProperty(operation,"getContext",{enumerable:!1,value:function(){return tslib_1.__assign({},context)}}),Object.defineProperty(operation,"toKey",{enumerable:!1,value:function(){return getKey(operation)}}),operation},exports.getKey=getKey},{"apollo-utilities":18,"graphql/language/printer":71,"ts-invariant":17,tslib:291,"zen-observable-ts":339}],17:[function(require,module,exports){arguments[4][11][0].apply(exports,arguments)},{_process:47,dup:11,tslib:291}],18:[function(require,module,exports){(function(process){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ex,visitor=require("graphql/language/visitor"),tsInvariant=require("ts-invariant"),tslib=require("tslib"),stringify=(ex=require("fast-json-stable-stringify"))&&"object"==typeof ex&&"default"in ex?ex.default:ex;function valueToObjectRepresentation(argObj,name,value,variables){if(function(value){return"IntValue"===value.kind}(value)||function(value){return"FloatValue"===value.kind}(value))argObj[name.value]=Number(value.value);else if(function(value){return"BooleanValue"===value.kind}(value)||function(value){return"StringValue"===value.kind}(value))argObj[name.value]=value.value;else if(function(value){return"ObjectValue"===value.kind}(value)){var nestedArgObj_1={};value.fields.map(function(obj){return valueToObjectRepresentation(nestedArgObj_1,obj.name,obj.value,variables)}),argObj[name.value]=nestedArgObj_1}else if(function(value){return"Variable"===value.kind}(value)){var variableValue=(variables||{})[value.name.value];argObj[name.value]=variableValue}else if(function(value){return"ListValue"===value.kind}(value))argObj[name.value]=value.values.map(function(listValue){var nestedArgArrayObj={};return valueToObjectRepresentation(nestedArgArrayObj,name,listValue,variables),nestedArgArrayObj[name.value]});else if(function(value){return"EnumValue"===value.kind}(value))argObj[name.value]=value.value;else{if(!function(value){return"NullValue"===value.kind}(value))throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError('The inline argument "'+name.value+'" of kind "'+value.kind+'"is not supported. Use variables instead of inline arguments to overcome this limitation.');argObj[name.value]=null}}var KNOWN_DIRECTIVES=["connection","include","skip","client","rest","export"];function getStoreKeyName(fieldName,args,directives){if(directives&&directives.connection&&directives.connection.key){if(directives.connection.filter&&0<directives.connection.filter.length){var filterKeys=directives.connection.filter?directives.connection.filter:[];filterKeys.sort();var queryArgs_1=args,filteredArgs_1={};return filterKeys.forEach(function(key){filteredArgs_1[key]=queryArgs_1[key]}),directives.connection.key+"("+JSON.stringify(filteredArgs_1)+")"}return directives.connection.key}var completeFieldName=fieldName;if(args){var stringifiedArgs=stringify(args);completeFieldName+="("+stringifiedArgs+")"}return directives&&Object.keys(directives).forEach(function(key){-1===KNOWN_DIRECTIVES.indexOf(key)&&(directives[key]&&Object.keys(directives[key]).length?completeFieldName+="@"+key+"("+JSON.stringify(directives[key])+")":completeFieldName+="@"+key)}),completeFieldName}function argumentsObjectFromField(field,variables){if(field.arguments&&field.arguments.length){var argObj_1={};return field.arguments.forEach(function(_a){var name=_a.name,value=_a.value;return valueToObjectRepresentation(argObj_1,name,value,variables)}),argObj_1}return null}function defaultValueFromVariable(node){throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode")}function getDirectiveNames(doc){var names=[];return visitor.visit(doc,{Directive:function(node){names.push(node.name.value)}}),names}function hasDirectives(names,doc){return getDirectiveNames(doc).some(function(name){return-1<names.indexOf(name)})}function assign(target){for(var sources=[],_i=1;_i<arguments.length;_i++)sources[_i-1]=arguments[_i];return sources.forEach(function(source){null!=source&&Object.keys(source).forEach(function(key){target[key]=source[key]})}),target}function checkDocument(doc){"production"===process.env.NODE_ENV?tsInvariant.invariant(doc&&"Document"===doc.kind):tsInvariant.invariant(doc&&"Document"===doc.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql');var operations=doc.definitions.filter(function(d){return"FragmentDefinition"!==d.kind}).map(function(definition){if("OperationDefinition"!==definition.kind)throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError('Schema type definitions not allowed in queries. Found: "'+definition.kind+'"');return definition});return"production"===process.env.NODE_ENV?tsInvariant.invariant(operations.length<=1):tsInvariant.invariant(operations.length<=1,"Ambiguous GraphQL document: contains "+operations.length+" operations"),doc}function getOperationDefinition(doc){return checkDocument(doc),doc.definitions.filter(function(definition){return"OperationDefinition"===definition.kind})[0]}function getFragmentDefinitions(doc){return doc.definitions.filter(function(definition){return"FragmentDefinition"===definition.kind})}function getFragmentDefinition(doc){"production"===process.env.NODE_ENV?tsInvariant.invariant("Document"===doc.kind):tsInvariant.invariant("Document"===doc.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'),"production"===process.env.NODE_ENV?tsInvariant.invariant(doc.definitions.length<=1):tsInvariant.invariant(doc.definitions.length<=1,"Fragment must have exactly one definition.");var fragmentDef=doc.definitions[0];return"production"===process.env.NODE_ENV?tsInvariant.invariant("FragmentDefinition"===fragmentDef.kind):tsInvariant.invariant("FragmentDefinition"===fragmentDef.kind,"Must be a fragment definition."),fragmentDef}function getMainDefinition(queryDoc){var fragmentDefinition;checkDocument(queryDoc);for(var _i=0,_a=queryDoc.definitions;_i<_a.length;_i++){var definition=_a[_i];if("OperationDefinition"===definition.kind){var operation=definition.operation;if("query"===operation||"mutation"===operation||"subscription"===operation)return definition}"FragmentDefinition"!==definition.kind||fragmentDefinition||(fragmentDefinition=definition)}if(fragmentDefinition)return fragmentDefinition;throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.")}function createFragmentMap(fragments){void 0===fragments&&(fragments=[]);var symTable={};return fragments.forEach(function(fragment){symTable[fragment.name.value]=fragment}),symTable}function filterInPlace(array,test,context){var target=0;return array.forEach(function(elem,i){test.call(this,elem,i,array)&&(array[target++]=elem)},context),array.length=target,array}var TYPENAME_FIELD={kind:"Field",name:{kind:"Name",value:"__typename"}};function nullIfDocIsEmpty(doc){return function isEmpty(op,fragments){return op.selectionSet.selections.every(function(selection){return"FragmentSpread"===selection.kind&&isEmpty(fragments[selection.name.value],fragments)})}(getOperationDefinition(doc)||getFragmentDefinition(doc),createFragmentMap(getFragmentDefinitions(doc)))?null:doc}function getDirectiveMatcher(directives){return function(directive){return directives.some(function(dir){return dir.name&&dir.name===directive.name.value||dir.test&&dir.test(directive)})}}function removeDirectivesFromDocument(directives,doc){var variablesInUse=Object.create(null),variablesToRemove=[],fragmentSpreadsInUse=Object.create(null),fragmentSpreadsToRemove=[],modifiedDoc=nullIfDocIsEmpty(visitor.visit(doc,{Variable:{enter:function(node,_key,parent){"VariableDefinition"!==parent.kind&&(variablesInUse[node.name.value]=!0)}},Field:{enter:function(node){if(directives&&node.directives&&(directives.some(function(directive){return directive.remove})&&node.directives&&node.directives.some(getDirectiveMatcher(directives))))return node.arguments&&node.arguments.forEach(function(arg){"Variable"===arg.value.kind&&variablesToRemove.push({name:arg.value.name.value})}),node.selectionSet&&function getAllFragmentSpreadsFromSelectionSet(selectionSet){var allFragments=[];selectionSet.selections.forEach(function(selection){"Field"!==selection.kind&&"InlineFragment"!==selection.kind||!selection.selectionSet?"FragmentSpread"===selection.kind&&allFragments.push(selection):getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function(frag){return allFragments.push(frag)})});return allFragments}(node.selectionSet).forEach(function(frag){fragmentSpreadsToRemove.push({name:frag.name.value})}),null}},FragmentSpread:{enter:function(node){fragmentSpreadsInUse[node.name.value]=!0}},Directive:{enter:function(node){if(getDirectiveMatcher(directives)(node))return null}}}));return modifiedDoc&&filterInPlace(variablesToRemove,function(v){return!variablesInUse[v.name]}).length&&(modifiedDoc=removeArgumentsFromDocument(variablesToRemove,modifiedDoc)),modifiedDoc&&filterInPlace(fragmentSpreadsToRemove,function(fs){return!fragmentSpreadsInUse[fs.name]}).length&&(modifiedDoc=removeFragmentSpreadFromDocument(fragmentSpreadsToRemove,modifiedDoc)),modifiedDoc}var connectionRemoveConfig={test:function(directive){var willRemove="connection"===directive.name.value;return willRemove&&(directive.arguments&&directive.arguments.some(function(arg){return"key"===arg.name.value})||console.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key.")),willRemove}};function hasDirectivesInSelectionSet(directives,selectionSet,nestedCheck){return void 0===nestedCheck&&(nestedCheck=!0),selectionSet&&selectionSet.selections&&selectionSet.selections.some(function(selection){return hasDirectivesInSelection(directives,selection,nestedCheck)})}function hasDirectivesInSelection(directives,selection,nestedCheck){return void 0===nestedCheck&&(nestedCheck=!0),"Field"!==selection.kind||!selection||!!selection.directives&&(selection.directives.some(getDirectiveMatcher(directives))||nestedCheck&&hasDirectivesInSelectionSet(directives,selection.selectionSet,nestedCheck))}function removeArgumentsFromDocument(config,doc){var argMatcher=function(config){return function(argument){return config.some(function(aConfig){return argument.value&&"Variable"===argument.value.kind&&argument.value.name&&(aConfig.name===argument.value.name.value||aConfig.test&&aConfig.test(argument))})}}(config);return nullIfDocIsEmpty(visitor.visit(doc,{OperationDefinition:{enter:function(node){return tslib.__assign({},node,{variableDefinitions:node.variableDefinitions.filter(function(varDef){return!config.some(function(arg){return arg.name===varDef.variable.name.value})})})}},Field:{enter:function(node){if(config.some(function(argConfig){return argConfig.remove})){var argMatchCount_1=0;if(node.arguments.forEach(function(arg){argMatcher(arg)&&(argMatchCount_1+=1)}),1===argMatchCount_1)return null}}},Argument:{enter:function(node){if(argMatcher(node))return null}}}))}function removeFragmentSpreadFromDocument(config,doc){function enter(node){if(config.some(function(def){return def.name===node.name.value}))return null}return nullIfDocIsEmpty(visitor.visit(doc,{FragmentSpread:{enter:enter},FragmentDefinition:{enter:enter}}))}var toString=Object.prototype.toString;function getEnv(){return void 0!==process&&process.env.NODE_ENV?process.env.NODE_ENV:"development"}function isEnv(env){return getEnv()===env}function isProduction(){return!0===isEnv("production")}function isDevelopment(){return!0===isEnv("development")}function isTest(){return!0===isEnv("test")}var hasOwnProperty=Object.prototype.hasOwnProperty;function mergeDeepArray(sources){var target=sources[0]||{},count=sources.length;if(1<count){var pastCopies=[];target=shallowCopyForMerge(target,pastCopies);for(var i=1;i<count;++i)target=mergeHelper(target,sources[i],pastCopies)}return target}function isObject(obj){return null!==obj&&"object"==typeof obj}function mergeHelper(target,source,pastCopies){return isObject(source)&&isObject(target)?(Object.isExtensible&&!Object.isExtensible(target)&&(target=shallowCopyForMerge(target,pastCopies)),Object.keys(source).forEach(function(sourceKey){var sourceValue=source[sourceKey];if(hasOwnProperty.call(target,sourceKey)){var targetValue=target[sourceKey];sourceValue!==targetValue&&(target[sourceKey]=mergeHelper(shallowCopyForMerge(targetValue,pastCopies),sourceValue,pastCopies))}else target[sourceKey]=sourceValue}),target):source}function shallowCopyForMerge(value,pastCopies){return null!==value&&"object"==typeof value&&pastCopies.indexOf(value)<0&&(value=Array.isArray(value)?value.slice(0):tslib.__assign({__proto__:Object.getPrototypeOf(value)},value),pastCopies.push(value)),value}var haveWarned=Object.create({});exports.getDirectiveInfoFromField=function(field,variables){if(field.directives&&field.directives.length){var directiveObj_1={};return field.directives.forEach(function(directive){directiveObj_1[directive.name.value]=argumentsObjectFromField(directive,variables)}),directiveObj_1}return null},exports.shouldInclude=function(selection,variables){if(void 0===variables&&(variables={}),!selection.directives)return!0;var res=!0;return selection.directives.forEach(function(directive){if("skip"===directive.name.value||"include"===directive.name.value){var directiveArguments=directive.arguments||[],directiveName=directive.name.value;"production"===process.env.NODE_ENV?tsInvariant.invariant(1===directiveArguments.length):tsInvariant.invariant(1===directiveArguments.length,"Incorrect number of arguments for the @"+directiveName+" directive.");var ifArgument=directiveArguments[0];"production"===process.env.NODE_ENV?tsInvariant.invariant(ifArgument.name&&"if"===ifArgument.name.value):tsInvariant.invariant(ifArgument.name&&"if"===ifArgument.name.value,"Invalid argument for the @"+directiveName+" directive.");var ifValue=directiveArguments[0].value,evaledValue=!1;ifValue&&"BooleanValue"===ifValue.kind?evaledValue=ifValue.value:("production"===process.env.NODE_ENV?tsInvariant.invariant("Variable"===ifValue.kind):tsInvariant.invariant("Variable"===ifValue.kind,"Argument for the @"+directiveName+" directive must be a variable or a boolean value."),evaledValue=variables[ifValue.name.value],"production"===process.env.NODE_ENV?tsInvariant.invariant(void 0!==evaledValue):tsInvariant.invariant(void 0!==evaledValue,"Invalid variable referenced in @"+directiveName+" directive.")),"skip"===directiveName&&(evaledValue=!evaledValue),evaledValue||(res=!1)}}),res},exports.getDirectiveNames=getDirectiveNames,exports.hasDirectives=hasDirectives,exports.hasClientExports=function(document){return document&&hasDirectives(["client"],document)&&hasDirectives(["export"],document)},exports.getFragmentQueryDocument=function(document,fragmentName){var actualFragmentName=fragmentName,fragments=[];return document.definitions.forEach(function(definition){if("OperationDefinition"===definition.kind)throw"production"===process.env.NODE_ENV?new tsInvariant.InvariantError:new tsInvariant.InvariantError("Found a "+definition.operation+" operation"+(definition.name?" named '"+definition.name.value+"'":"")+". No operations are allowed when using a fragment as a query. Only fragments are allowed.");"FragmentDefinition"===definition.kind&&fragments.push(definition)}),void 0===actualFragmentName&&("production"===process.env.NODE_ENV?tsInvariant.invariant(1===fragments.length):tsInvariant.invariant(1===fragments.length,"Found "+fragments.length+" fragments. `fragmentName` must be provided when there is not exactly 1 fragment."),actualFragmentName=fragments[0].name.value),tslib.__assign({},document,{definitions:[{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:actualFragmentName}}]}}].concat(document.definitions)})},exports.getMutationDefinition=function(doc){checkDocument(doc);var mutationDef=doc.definitions.filter(function(definition){return"OperationDefinition"===definition.kind&&"mutation"===definition.operation})[0];return"production"===process.env.NODE_ENV?tsInvariant.invariant(mutationDef):tsInvariant.invariant(mutationDef,"Must contain a mutation definition."),mutationDef},exports.checkDocument=checkDocument,exports.getOperationDefinition=getOperationDefinition,exports.getOperationDefinitionOrDie=function(document){var def=getOperationDefinition(document);return"production"===process.env.NODE_ENV?tsInvariant.invariant(def):tsInvariant.invariant(def,"GraphQL document is missing an operation"),def},exports.getOperationName=function(doc){return doc.definitions.filter(function(definition){return"OperationDefinition"===definition.kind&&definition.name}).map(function(x){return x.name.value})[0]||null},exports.getFragmentDefinitions=getFragmentDefinitions,exports.getQueryDefinition=function(doc){var queryDef=getOperationDefinition(doc);return"production"===process.env.NODE_ENV?tsInvariant.invariant(queryDef&&"query"===queryDef.operation):tsInvariant.invariant(queryDef&&"query"===queryDef.operation,"Must contain a query definition."),queryDef},exports.getFragmentDefinition=getFragmentDefinition,exports.getMainDefinition=getMainDefinition,exports.createFragmentMap=createFragmentMap,exports.getDefaultValues=function(definition){if(definition&&definition.variableDefinitions&&definition.variableDefinitions.length){var defaultValues=definition.variableDefinitions.filter(function(_a){return _a.defaultValue}).map(function(_a){var variable=_a.variable,defaultValue=_a.defaultValue,defaultValueObj={};return valueToObjectRepresentation(defaultValueObj,variable.name,defaultValue),defaultValueObj});return assign.apply(void 0,[{}].concat(defaultValues))}return{}},exports.variablesInOperation=function(operation){var names=new Set;if(operation.variableDefinitions)for(var _i=0,_a=operation.variableDefinitions;_i<_a.length;_i++){var definition=_a[_i];names.add(definition.variable.name.value)}return names},exports.removeDirectivesFromDocument=removeDirectivesFromDocument,exports.addTypenameToDocument=function(doc){return visitor.visit(checkDocument(doc),{SelectionSet:{enter:function(node,_key,parent){if(!parent||"OperationDefinition"!==parent.kind){var selections=node.selections;if(selections&&!selections.some(function(selection){return"Field"===selection.kind&&("__typename"===selection.name.value||0===selection.name.value.lastIndexOf("__",0))}))return tslib.__assign({},node,{selections:selections.concat([TYPENAME_FIELD])})}}}})},exports.removeConnectionDirectiveFromDocument=function(doc){return removeDirectivesFromDocument([connectionRemoveConfig],checkDocument(doc))},exports.getDirectivesFromDocument=function(directives,doc){var parentPath;return checkDocument(doc),nullIfDocIsEmpty(visitor.visit(doc,{SelectionSet:{enter:function(node,_key,_parent,path){var currentPath=path.join("-");if(!parentPath||currentPath===parentPath||!currentPath.startsWith(parentPath)){if(node.selections){var selectionsWithDirectives=node.selections.filter(function(selection){return hasDirectivesInSelection(directives,selection)});return hasDirectivesInSelectionSet(directives,node,!1)&&(parentPath=currentPath),tslib.__assign({},node,{selections:selectionsWithDirectives})}return null}}}}))},exports.removeArgumentsFromDocument=removeArgumentsFromDocument,exports.removeFragmentSpreadFromDocument=removeFragmentSpreadFromDocument,exports.buildQueryFromSelectionSet=function(document){return"query"===getMainDefinition(document).operation?document:visitor.visit(document,{OperationDefinition:{enter:function(node){return tslib.__assign({},node,{operation:"query"})}}})},exports.removeClientSetsFromDocument=function(document){checkDocument(document);var modifiedDoc=removeDirectivesFromDocument([{test:function(directive){return"client"===directive.name.value},remove:!0}],document);return modifiedDoc&&(modifiedDoc=visitor.visit(modifiedDoc,{FragmentDefinition:{enter:function(node){if(node.selectionSet&&node.selectionSet.selections.every(function(selection){return"Field"===selection.kind&&"__typename"===selection.name.value}))return null}}})),modifiedDoc},exports.isScalarValue=function(value){return-1<["StringValue","BooleanValue","EnumValue"].indexOf(value.kind)},exports.isNumberValue=function(value){return-1<["IntValue","FloatValue"].indexOf(value.kind)},exports.valueToObjectRepresentation=valueToObjectRepresentation,exports.storeKeyNameFromField=function(field,variables){var directivesObj=null;field.directives&&(directivesObj={},field.directives.forEach(function(directive){directivesObj[directive.name.value]={},directive.arguments&&directive.arguments.forEach(function(_a){var name=_a.name,value=_a.value;return valueToObjectRepresentation(directivesObj[directive.name.value],name,value,variables)})}));var argObj=null;return field.arguments&&field.arguments.length&&(argObj={},field.arguments.forEach(function(_a){var name=_a.name,value=_a.value;return valueToObjectRepresentation(argObj,name,value,variables)})),getStoreKeyName(field.name.value,argObj,directivesObj)},exports.getStoreKeyName=getStoreKeyName,exports.argumentsObjectFromField=argumentsObjectFromField,exports.resultKeyNameFromField=function(field){return field.alias?field.alias.value:field.name.value},exports.isField=function(selection){return"Field"===selection.kind},exports.isInlineFragment=function(selection){return"InlineFragment"===selection.kind},exports.isIdValue=function(idObject){return idObject&&"id"===idObject.type&&"boolean"==typeof idObject.generated},exports.toIdValue=function(idConfig,generated){return void 0===generated&&(generated=!1),tslib.__assign({type:"id",generated:generated},"string"==typeof idConfig?{id:idConfig,typename:void 0}:idConfig)},exports.isJsonValue=function(jsonObject){return null!=jsonObject&&"object"==typeof jsonObject&&"json"===jsonObject.type},exports.valueFromNode=function valueFromNode(node,onVariable){switch(void 0===onVariable&&(onVariable=defaultValueFromVariable),node.kind){case"Variable":return onVariable(node);case"NullValue":return null;case"IntValue":return parseInt(node.value,10);case"FloatValue":return parseFloat(node.value);case"ListValue":return node.values.map(function(v){return valueFromNode(v,onVariable)});case"ObjectValue":for(var value={},_i=0,_a=node.fields;_i<_a.length;_i++){var field=_a[_i];value[field.name.value]=valueFromNode(field.value,onVariable)}return value;default:return node.value}},exports.assign=assign,exports.cloneDeep=function(value){return function cloneDeepHelper(val,seen){switch(toString.call(val)){case"[object Array]":if(seen.has(val))return seen.get(val);var copy_1=val.slice(0);return seen.set(val,copy_1),copy_1.forEach(function(child,i){copy_1[i]=cloneDeepHelper(child,seen)}),copy_1;case"[object Object]":if(seen.has(val))return seen.get(val);var copy_2=Object.create(Object.getPrototypeOf(val));return seen.set(val,copy_2),Object.keys(val).forEach(function(key){copy_2[key]=cloneDeepHelper(val[key],seen)}),copy_2;default:return val}}(value,new Map)},exports.getEnv=getEnv,exports.isEnv=isEnv,exports.isProduction=isProduction,exports.isDevelopment=isDevelopment,exports.isTest=isTest,exports.tryFunctionOrLogError=function(f){try{return f()}catch(e){console.error&&console.error(e)}},exports.graphQLResultHasError=function(result){return result.errors&&result.errors.length},exports.isEqual=function isEqual(a,b){if(a===b)return!0;if(a instanceof Date&&b instanceof Date)return a.getTime()===b.getTime();if(null==a||"object"!=typeof a||null==b||"object"!=typeof b)return!1;for(var key in a)if(Object.prototype.hasOwnProperty.call(a,key)){if(!Object.prototype.hasOwnProperty.call(b,key))return!1;if(!isEqual(a[key],b[key]))return!1}for(var key in b)if(Object.prototype.hasOwnProperty.call(b,key)&&!Object.prototype.hasOwnProperty.call(a,key))return!1;return!0},exports.maybeDeepFreeze=function(obj){return!isDevelopment()&&!isTest()||"function"==typeof Symbol&&"string"==typeof Symbol("")?obj:function deepFreeze(o){return Object.freeze(o),Object.getOwnPropertyNames(o).forEach(function(prop){null===o[prop]||"object"!=typeof o[prop]&&"function"!=typeof o[prop]||Object.isFrozen(o[prop])||deepFreeze(o[prop])}),o}(obj)},exports.mergeDeep=function(){for(var sources=[],_i=0;_i<arguments.length;_i++)sources[_i]=arguments[_i];return mergeDeepArray(sources)},exports.mergeDeepArray=mergeDeepArray,exports.warnOnceInDevelopment=function(msg,type){if(void 0===type&&(type="warn"),!isProduction()&&!haveWarned[msg])switch(isTest()||(haveWarned[msg]=!0),type){case"error":console.error(msg);break;default:console.warn(msg)}},exports.stripSymbols=function(data){return JSON.parse(JSON.stringify(data))}}).call(this,require("_process"))},{_process:47,"fast-json-stable-stringify":51,"graphql/language/visitor":73,"ts-invariant":290,tslib:291}],19:[function(require,module,exports){module.exports=require("./lib/axios")},{"./lib/axios":21}],20:[function(require,module,exports){(function(process){"use strict";var utils=require("./../utils"),settle=require("./../core/settle"),buildURL=require("./../helpers/buildURL"),parseHeaders=require("./../helpers/parseHeaders"),isURLSameOrigin=require("./../helpers/isURLSameOrigin"),createError=require("../core/createError"),btoa="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||require("./../helpers/btoa");module.exports=function(config){return new Promise(function(resolve,reject){var requestData=config.data,requestHeaders=config.headers;utils.isFormData(requestData)&&delete requestHeaders["Content-Type"];var request=new XMLHttpRequest,loadEvent="onreadystatechange",xDomain=!1;if("test"===process.env.NODE_ENV||"undefined"==typeof window||!window.XDomainRequest||"withCredentials"in request||isURLSameOrigin(config.url)||(request=new window.XDomainRequest,loadEvent="onload",xDomain=!0,request.onprogress=function(){},request.ontimeout=function(){}),config.auth){var username=config.auth.username||"",password=config.auth.password||"";requestHeaders.Authorization="Basic "+btoa(username+":"+password)}if(request.open(config.method.toUpperCase(),buildURL(config.url,config.params,config.paramsSerializer),!0),request.timeout=config.timeout,request[loadEvent]=function(){if(request&&(4===request.readyState||xDomain)&&(0!==request.status||request.responseURL&&0===request.responseURL.indexOf("file:"))){var responseHeaders="getAllResponseHeaders"in request?parseHeaders(request.getAllResponseHeaders()):null,response={data:config.responseType&&"text"!==config.responseType?request.response:request.responseText,status:1223===request.status?204:request.status,statusText:1223===request.status?"No Content":request.statusText,headers:responseHeaders,config:config,request:request};settle(resolve,reject,response),request=null}},request.onerror=function(){reject(createError("Network Error",config,null,request)),request=null},request.ontimeout=function(){reject(createError("timeout of "+config.timeout+"ms exceeded",config,"ECONNABORTED",request)),request=null},utils.isStandardBrowserEnv()){var cookies=require("./../helpers/cookies"),xsrfValue=(config.withCredentials||isURLSameOrigin(config.url))&&config.xsrfCookieName?cookies.read(config.xsrfCookieName):void 0;xsrfValue&&(requestHeaders[config.xsrfHeaderName]=xsrfValue)}if("setRequestHeader"in request&&utils.forEach(requestHeaders,function(val,key){void 0===requestData&&"content-type"===key.toLowerCase()?delete requestHeaders[key]:request.setRequestHeader(key,val)}),config.withCredentials&&(request.withCredentials=!0),config.responseType)try{request.responseType=config.responseType}catch(e){if("json"!==config.responseType)throw e}"function"==typeof config.onDownloadProgress&&request.addEventListener("progress",config.onDownloadProgress),"function"==typeof config.onUploadProgress&&request.upload&&request.upload.addEventListener("progress",config.onUploadProgress),config.cancelToken&&config.cancelToken.promise.then(function(cancel){request&&(request.abort(),reject(cancel),request=null)}),void 0===requestData&&(requestData=null),request.send(requestData)})}}).call(this,require("_process"))},{"../core/createError":27,"./../core/settle":30,"./../helpers/btoa":34,"./../helpers/buildURL":35,"./../helpers/cookies":37,"./../helpers/isURLSameOrigin":39,"./../helpers/parseHeaders":41,"./../utils":43,_process:47}],21:[function(require,module,exports){"use strict";var utils=require("./utils"),bind=require("./helpers/bind"),Axios=require("./core/Axios"),defaults=require("./defaults");function createInstance(defaultConfig){var context=new Axios(defaultConfig),instance=bind(Axios.prototype.request,context);return utils.extend(instance,Axios.prototype,context),utils.extend(instance,context),instance}var axios=createInstance(defaults);axios.Axios=Axios,axios.create=function(instanceConfig){return createInstance(utils.merge(defaults,instanceConfig))},axios.Cancel=require("./cancel/Cancel"),axios.CancelToken=require("./cancel/CancelToken"),axios.isCancel=require("./cancel/isCancel"),axios.all=function(promises){return Promise.all(promises)},axios.spread=require("./helpers/spread"),module.exports=axios,module.exports.default=axios},{"./cancel/Cancel":22,"./cancel/CancelToken":23,"./cancel/isCancel":24,"./core/Axios":25,"./defaults":32,"./helpers/bind":33,"./helpers/spread":42,"./utils":43}],22:[function(require,module,exports){"use strict";function Cancel(message){this.message=message}Cancel.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0,module.exports=Cancel},{}],23:[function(require,module,exports){"use strict";var Cancel=require("./Cancel");function CancelToken(executor){if("function"!=typeof executor)throw new TypeError("executor must be a function.");var resolvePromise;this.promise=new Promise(function(resolve){resolvePromise=resolve});var token=this;executor(function(message){token.reason||(token.reason=new Cancel(message),resolvePromise(token.reason))})}CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},CancelToken.source=function(){var cancel;return{token:new CancelToken(function(c){cancel=c}),cancel:cancel}},module.exports=CancelToken},{"./Cancel":22}],24:[function(require,module,exports){"use strict";module.exports=function(value){return!(!value||!value.__CANCEL__)}},{}],25:[function(require,module,exports){"use strict";var defaults=require("./../defaults"),utils=require("./../utils"),InterceptorManager=require("./InterceptorManager"),dispatchRequest=require("./dispatchRequest");function Axios(instanceConfig){this.defaults=instanceConfig,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}Axios.prototype.request=function(config){"string"==typeof config&&(config=utils.merge({url:arguments[0]},arguments[1])),(config=utils.merge(defaults,{method:"get"},this.defaults,config)).method=config.method.toLowerCase();var chain=[dispatchRequest,void 0],promise=Promise.resolve(config);for(this.interceptors.request.forEach(function(interceptor){chain.unshift(interceptor.fulfilled,interceptor.rejected)}),this.interceptors.response.forEach(function(interceptor){chain.push(interceptor.fulfilled,interceptor.rejected)});chain.length;)promise=promise.then(chain.shift(),chain.shift());return promise},utils.forEach(["delete","get","head","options"],function(method){Axios.prototype[method]=function(url,config){return this.request(utils.merge(config||{},{method:method,url:url}))}}),utils.forEach(["post","put","patch"],function(method){Axios.prototype[method]=function(url,data,config){return this.request(utils.merge(config||{},{method:method,url:url,data:data}))}}),module.exports=Axios},{"./../defaults":32,"./../utils":43,"./InterceptorManager":26,"./dispatchRequest":28}],26:[function(require,module,exports){"use strict";var utils=require("./../utils");function InterceptorManager(){this.handlers=[]}InterceptorManager.prototype.use=function(fulfilled,rejected){return this.handlers.push({fulfilled:fulfilled,rejected:rejected}),this.handlers.length-1},InterceptorManager.prototype.eject=function(id){this.handlers[id]&&(this.handlers[id]=null)},InterceptorManager.prototype.forEach=function(fn){utils.forEach(this.handlers,function(h){null!==h&&fn(h)})},module.exports=InterceptorManager},{"./../utils":43}],27:[function(require,module,exports){"use strict";var enhanceError=require("./enhanceError");module.exports=function(message,config,code,request,response){var error=new Error(message);return enhanceError(error,config,code,request,response)}},{"./enhanceError":29}],28:[function(require,module,exports){"use strict";var utils=require("./../utils"),transformData=require("./transformData"),isCancel=require("../cancel/isCancel"),defaults=require("../defaults"),isAbsoluteURL=require("./../helpers/isAbsoluteURL"),combineURLs=require("./../helpers/combineURLs");function throwIfCancellationRequested(config){config.cancelToken&&config.cancelToken.throwIfRequested()}module.exports=function(config){return throwIfCancellationRequested(config),config.baseURL&&!isAbsoluteURL(config.url)&&(config.url=combineURLs(config.baseURL,config.url)),config.headers=config.headers||{},config.data=transformData(config.data,config.headers,config.transformRequest),config.headers=utils.merge(config.headers.common||{},config.headers[config.method]||{},config.headers||{}),utils.forEach(["delete","get","head","post","put","patch","common"],function(method){delete config.headers[method]}),(config.adapter||defaults.adapter)(config).then(function(response){return throwIfCancellationRequested(config),response.data=transformData(response.data,response.headers,config.transformResponse),response},function(reason){return isCancel(reason)||(throwIfCancellationRequested(config),reason&&reason.response&&(reason.response.data=transformData(reason.response.data,reason.response.headers,config.transformResponse))),Promise.reject(reason)})}},{"../cancel/isCancel":24,"../defaults":32,"./../helpers/combineURLs":36,"./../helpers/isAbsoluteURL":38,"./../utils":43,"./transformData":31}],29:[function(require,module,exports){"use strict";module.exports=function(error,config,code,request,response){return error.config=config,code&&(error.code=code),error.request=request,error.response=response,error}},{}],30:[function(require,module,exports){"use strict";var createError=require("./createError");module.exports=function(resolve,reject,response){var validateStatus=response.config.validateStatus;response.status&&validateStatus&&!validateStatus(response.status)?reject(createError("Request failed with status code "+response.status,response.config,null,response.request,response)):resolve(response)}},{"./createError":27}],31:[function(require,module,exports){"use strict";var utils=require("./../utils");module.exports=function(data,headers,fns){return utils.forEach(fns,function(fn){data=fn(data,headers)}),data}},{"./../utils":43}],32:[function(require,module,exports){(function(process){"use strict";var utils=require("./utils"),normalizeHeaderName=require("./helpers/normalizeHeaderName"),DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(headers,value){!utils.isUndefined(headers)&&utils.isUndefined(headers["Content-Type"])&&(headers["Content-Type"]=value)}var adapter,defaults={adapter:("undefined"!=typeof XMLHttpRequest?adapter=require("./adapters/xhr"):void 0!==process&&(adapter=require("./adapters/http")),adapter),transformRequest:[function(data,headers){return normalizeHeaderName(headers,"Content-Type"),utils.isFormData(data)||utils.isArrayBuffer(data)||utils.isBuffer(data)||utils.isStream(data)||utils.isFile(data)||utils.isBlob(data)?data:utils.isArrayBufferView(data)?data.buffer:utils.isURLSearchParams(data)?(setContentTypeIfUnset(headers,"application/x-www-form-urlencoded;charset=utf-8"),data.toString()):utils.isObject(data)?(setContentTypeIfUnset(headers,"application/json;charset=utf-8"),JSON.stringify(data)):data}],transformResponse:[function(data){if("string"==typeof data)try{data=JSON.parse(data)}catch(e){}return data}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(status){return 200<=status&&status<300}};defaults.headers={common:{Accept:"application/json, text/plain, */*"}},utils.forEach(["delete","get","head"],function(method){defaults.headers[method]={}}),utils.forEach(["post","put","patch"],function(method){defaults.headers[method]=utils.merge(DEFAULT_CONTENT_TYPE)}),module.exports=defaults}).call(this,require("_process"))},{"./adapters/http":20,"./adapters/xhr":20,"./helpers/normalizeHeaderName":40,"./utils":43,_process:47}],33:[function(require,module,exports){"use strict";module.exports=function(fn,thisArg){return function(){for(var args=new Array(arguments.length),i=0;i<args.length;i++)args[i]=arguments[i];return fn.apply(thisArg,args)}}},{}],34:[function(require,module,exports){"use strict";function E(){this.message="String contains an invalid character"}(E.prototype=new Error).code=5,E.prototype.name="InvalidCharacterError",module.exports=function(input){for(var block,charCode,str=String(input),output="",idx=0,map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";str.charAt(0|idx)||(map="=",idx%1);output+=map.charAt(63&block>>8-idx%1*8)){if(255<(charCode=str.charCodeAt(idx+=.75)))throw new E;block=block<<8|charCode}return output}},{}],35:[function(require,module,exports){"use strict";var utils=require("./../utils");function encode(val){return encodeURIComponent(val).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}module.exports=function(url,params,paramsSerializer){if(!params)return url;var serializedParams;if(paramsSerializer)serializedParams=paramsSerializer(params);else if(utils.isURLSearchParams(params))serializedParams=params.toString();else{var parts=[];utils.forEach(params,function(val,key){null!=val&&(utils.isArray(val)?key+="[]":val=[val],utils.forEach(val,function(v){utils.isDate(v)?v=v.toISOString():utils.isObject(v)&&(v=JSON.stringify(v)),parts.push(encode(key)+"="+encode(v))}))}),serializedParams=parts.join("&")}return serializedParams&&(url+=(-1===url.indexOf("?")?"?":"&")+serializedParams),url}},{"./../utils":43}],36:[function(require,module,exports){"use strict";module.exports=function(baseURL,relativeURL){return relativeURL?baseURL.replace(/\/+$/,"")+"/"+relativeURL.replace(/^\/+/,""):baseURL}},{}],37:[function(require,module,exports){"use strict";var utils=require("./../utils");module.exports=utils.isStandardBrowserEnv()?{write:function(name,value,expires,path,domain,secure){var cookie=[];cookie.push(name+"="+encodeURIComponent(value)),utils.isNumber(expires)&&cookie.push("expires="+new Date(expires).toGMTString()),utils.isString(path)&&cookie.push("path="+path),utils.isString(domain)&&cookie.push("domain="+domain),!0===secure&&cookie.push("secure"),document.cookie=cookie.join("; ")},read:function(name){var match=document.cookie.match(new RegExp("(^|;\\s*)("+name+")=([^;]*)"));return match?decodeURIComponent(match[3]):null},remove:function(name){this.write(name,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},{"./../utils":43}],38:[function(require,module,exports){"use strict";module.exports=function(url){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url)}},{}],39:[function(require,module,exports){"use strict";var utils=require("./../utils");module.exports=utils.isStandardBrowserEnv()?function(){var originURL,msie=/(msie|trident)/i.test(navigator.userAgent),urlParsingNode=document.createElement("a");function resolveURL(url){var href=url;return msie&&(urlParsingNode.setAttribute("href",href),href=urlParsingNode.href),urlParsingNode.setAttribute("href",href),{href:urlParsingNode.href,protocol:urlParsingNode.protocol?urlParsingNode.protocol.replace(/:$/,""):"",host:urlParsingNode.host,search:urlParsingNode.search?urlParsingNode.search.replace(/^\?/,""):"",hash:urlParsingNode.hash?urlParsingNode.hash.replace(/^#/,""):"",hostname:urlParsingNode.hostname,port:urlParsingNode.port,pathname:"/"===urlParsingNode.pathname.charAt(0)?urlParsingNode.pathname:"/"+urlParsingNode.pathname}}return originURL=resolveURL(window.location.href),function(requestURL){var parsed=utils.isString(requestURL)?resolveURL(requestURL):requestURL;return parsed.protocol===originURL.protocol&&parsed.host===originURL.host}}():function(){return!0}},{"./../utils":43}],40:[function(require,module,exports){"use strict";var utils=require("../utils");module.exports=function(headers,normalizedName){utils.forEach(headers,function(value,name){name!==normalizedName&&name.toUpperCase()===normalizedName.toUpperCase()&&(headers[normalizedName]=value,delete headers[name])})}},{"../utils":43}],41:[function(require,module,exports){"use strict";var utils=require("./../utils"),ignoreDuplicateOf=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];module.exports=function(headers){var key,val,i,parsed={};return headers&&utils.forEach(headers.split("\n"),function(line){if(i=line.indexOf(":"),key=utils.trim(line.substr(0,i)).toLowerCase(),val=utils.trim(line.substr(i+1)),key){if(parsed[key]&&0<=ignoreDuplicateOf.indexOf(key))return;parsed[key]="set-cookie"===key?(parsed[key]?parsed[key]:[]).concat([val]):parsed[key]?parsed[key]+", "+val:val}}),parsed}},{"./../utils":43}],42:[function(require,module,exports){"use strict";module.exports=function(callback){return function(arr){return callback.apply(null,arr)}}},{}],43:[function(require,module,exports){"use strict";var bind=require("./helpers/bind"),isBuffer=require("is-buffer"),toString=Object.prototype.toString;function isArray(val){return"[object Array]"===toString.call(val)}function isObject(val){return null!==val&&"object"==typeof val}function isFunction(val){return"[object Function]"===toString.call(val)}function forEach(obj,fn){if(null!=obj)if("object"!=typeof obj&&(obj=[obj]),isArray(obj))for(var i=0,l=obj.length;i<l;i++)fn.call(null,obj[i],i,obj);else for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&fn.call(null,obj[key],key,obj)}module.exports={isArray:isArray,isArrayBuffer:function(val){return"[object ArrayBuffer]"===toString.call(val)},isBuffer:isBuffer,isFormData:function(val){return"undefined"!=typeof FormData&&val instanceof FormData},isArrayBufferView:function(val){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(val):val&&val.buffer&&val.buffer instanceof ArrayBuffer},isString:function(val){return"string"==typeof val},isNumber:function(val){return"number"==typeof val},isObject:isObject,isUndefined:function(val){return void 0===val},isDate:function(val){return"[object Date]"===toString.call(val)},isFile:function(val){return"[object File]"===toString.call(val)},isBlob:function(val){return"[object Blob]"===toString.call(val)},isFunction:isFunction,isStream:function(val){return isObject(val)&&isFunction(val.pipe)},isURLSearchParams:function(val){return"undefined"!=typeof URLSearchParams&&val instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:forEach,merge:function merge(){var result={};function assignValue(val,key){"object"==typeof result[key]&&"object"==typeof val?result[key]=merge(result[key],val):result[key]=val}for(var i=0,l=arguments.length;i<l;i++)forEach(arguments[i],assignValue);return result},extend:function(a,b,thisArg){return forEach(b,function(val,key){a[key]=thisArg&&"function"==typeof val?bind(val,thisArg):val}),a},trim:function(str){return str.replace(/^\s*/,"").replace(/\s*$/,"")}}},{"./helpers/bind":33,"is-buffer":78}],44:[function(require,module,exports){"use strict";exports.byteLength=function(b64){var lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1];return 3*(validLen+placeHoldersLen)/4-placeHoldersLen},exports.toByteArray=function(b64){for(var tmp,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Arr(function(b64,validLen,placeHoldersLen){return 3*(validLen+placeHoldersLen)/4-placeHoldersLen}(0,validLen,placeHoldersLen)),curByte=0,len=0<placeHoldersLen?validLen-4:validLen,i=0;i<len;i+=4)tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)],arr[curByte++]=tmp>>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp;2===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[curByte++]=255&tmp);1===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp);return arr},exports.fromByteArray=function(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,parts=[],i=0,len2=len-extraBytes;i<len2;i+=16383)parts.push(encodeChunk(uint8,i,len2<i+16383?len2:i+16383));1==extraBytes?(tmp=uint8[len-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")):2==extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"="));return parts.join("")};for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;function getLens(b64){var len=b64.length;if(0<len%4)throw new Error("Invalid string. Length must be a multiple of 4");var validLen=b64.indexOf("=");return-1===validLen&&(validLen=len),[validLen,validLen===len?0:4-validLen%4]}function encodeChunk(uint8,start,end){for(var tmp,num,output=[],i=start;i<end;i+=3)tmp=(uint8[i]<<16&16711680)+(uint8[i+1]<<8&65280)+(255&uint8[i+2]),output.push(lookup[(num=tmp)>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]);return output.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63},{}],45:[function(require,module,exports){},{}],46:[function(require,module,exports){var undef,nativeSplit,compliantExecNpcg;module.exports=(nativeSplit=String.prototype.split,compliantExecNpcg=/()??/.exec("")[1]===undef,function(str,separator,limit){if("[object RegExp]"!==Object.prototype.toString.call(separator))return nativeSplit.call(str,separator,limit);var separator2,match,lastIndex,lastLength,output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.extended?"x":"")+(separator.sticky?"y":""),lastLastIndex=0;for(separator=new RegExp(separator.source,flags+"g"),str+="",compliantExecNpcg||(separator2=new RegExp("^"+separator.source+"$(?!\\s)",flags)),limit=limit===undef?-1>>>0:limit>>>0;(match=separator.exec(str))&&!(lastLastIndex<(lastIndex=match.index+match[0].length)&&(output.push(str.slice(lastLastIndex,match.index)),!compliantExecNpcg&&1<match.length&&match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++)arguments[i]===undef&&(match[i]=undef)}),1<match.length&&match.index<str.length&&Array.prototype.push.apply(output,match.slice(1)),lastLength=match[0].length,lastLastIndex=lastIndex,output.length>=limit));)separator.lastIndex===match.index&&separator.lastIndex++;return lastLastIndex===str.length?!lastLength&&separator.test("")||output.push(""):output.push(str.slice(lastLastIndex)),output.length>limit?output.slice(0,limit):output})},{}],47:[function(require,module,exports){var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,function(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],48:[function(require,module,exports){(function(Buffer){"use strict";var base64=require("base64-js"),ieee754=require("ieee754");exports.Buffer=Buffer,exports.SlowBuffer=function(length){+length!=length&&(length=0);return Buffer.alloc(+length)},exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;function createBuffer(length){if(K_MAX_LENGTH<length)throw new RangeError('The value "'+length+'" is invalid for option "size"');var buf=new Uint8Array(length);return buf.__proto__=Buffer.prototype,buf}function Buffer(arg,encodingOrOffset,length){if("number"!=typeof arg)return from(arg,encodingOrOffset,length);if("string"==typeof encodingOrOffset)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(arg)}function from(value,encodingOrOffset,length){if("string"==typeof value)return function(string,encoding){"string"==typeof encoding&&""!==encoding||(encoding="utf8");if(!Buffer.isEncoding(encoding))throw new TypeError("Unknown encoding: "+encoding);var length=0|byteLength(string,encoding),buf=createBuffer(length),actual=buf.write(string,encoding);actual!==length&&(buf=buf.slice(0,actual));return buf}(value,encodingOrOffset);if(ArrayBuffer.isView(value))return fromArrayLike(value);if(null==value)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof value);if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer))return function(array,byteOffset,length){if(byteOffset<0||array.byteLength<byteOffset)throw new RangeError('"offset" is outside of buffer bounds');if(array.byteLength<byteOffset+(length||0))throw new RangeError('"length" is outside of buffer bounds');var buf;buf=void 0===byteOffset&&void 0===length?new Uint8Array(array):void 0===length?new Uint8Array(array,byteOffset):new Uint8Array(array,byteOffset,length);return buf.__proto__=Buffer.prototype,buf}(value,encodingOrOffset,length);if("number"==typeof value)throw new TypeError('The "value" argument must not be of type number. Received type number');var valueOf=value.valueOf&&value.valueOf();if(null!=valueOf&&valueOf!==value)return Buffer.from(valueOf,encodingOrOffset,length);var b=function(obj){if(Buffer.isBuffer(obj)){var len=0|checked(obj.length),buf=createBuffer(len);return 0===buf.length||obj.copy(buf,0,0,len),buf}if(void 0!==obj.length)return"number"!=typeof obj.length||numberIsNaN(obj.length)?createBuffer(0):fromArrayLike(obj);if("Buffer"===obj.type&&Array.isArray(obj.data))return fromArrayLike(obj.data)}(value);if(b)return b;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof value[Symbol.toPrimitive])return Buffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof value)}function assertSize(size){if("number"!=typeof size)throw new TypeError('"size" argument must be of type number');if(size<0)throw new RangeError('The value "'+size+'" is invalid for option "size"')}function allocUnsafe(size){return assertSize(size),createBuffer(size<0?0:0|checked(size))}function fromArrayLike(array){for(var length=array.length<0?0:0|checked(array.length),buf=createBuffer(length),i=0;i<length;i+=1)buf[i]=255&array[i];return buf}function checked(length){if(K_MAX_LENGTH<=length)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|length}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if(ArrayBuffer.isView(string)||isInstance(string,ArrayBuffer))return string.byteLength;if("string"!=typeof string)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof string);var len=string.length,mustMatch=2<arguments.length&&!0===arguments[2];if(!mustMatch&&0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return mustMatch?-1:utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):2147483647<byteOffset?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),numberIsNaN(byteOffset=+byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val&=255,"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var i,indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;arrLength/=indexSize=2,valLength/=2,byteOffset/=2}function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++)if(read(arr,i)===read(val,-1===foundIndex?0:i-foundIndex)){if(-1===foundIndex&&(foundIndex=i),i-foundIndex+1===valLength)return foundIndex*indexSize}else-1!==foundIndex&&(i-=i-foundIndex),foundIndex=-1}else for(arrLength<byteOffset+valLength&&(byteOffset=arrLength-valLength),i=byteOffset;0<=i;i--){for(var found=!0,j=0;j<valLength;j++)if(read(arr,i+j)!==read(val,j)){found=!1;break}if(found)return i}return-1}function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;length?remaining<(length=Number(length))&&(length=remaining):length=remaining;var strLen=string.length;strLen/2<length&&(length=strLen/2);for(var i=0;i<length;++i){var parsed=parseInt(string.substr(2*i,2),16);if(numberIsNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(function(str){for(var byteArray=[],i=0;i<str.length;++i)byteArray.push(255&str.charCodeAt(i));return byteArray}(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(function(str,units){for(var c,hi,lo,byteArray=[],i=0;i<str.length&&!((units-=2)<0);++i)c=str.charCodeAt(i),hi=c>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i<end;){var secondByte,thirdByte,fourthByte,tempCodePoint,firstByte=buf[i],codePoint=null,bytesPerSequence=239<firstByte?4:223<firstByte?3:191<firstByte?2:1;if(i+bytesPerSequence<=end)switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:128==(192&(secondByte=buf[i+1]))&&127<(tempCodePoint=(31&firstByte)<<6|63&secondByte)&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&2047<(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)&&(tempCodePoint<55296||57343<tempCodePoint)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&65535<(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}null===codePoint?(codePoint=65533,bytesPerSequence=1):65535<codePoint&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return function(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);var res="",i=0;for(;i<len;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH));return res}(res)}exports.kMaxLength=K_MAX_LENGTH,(Buffer.TYPED_ARRAY_SUPPORT=function(){try{var arr=new Uint8Array(1);return arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===arr.foo()}catch(e){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),Buffer.poolSize=8192,Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)},Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(size,fill,encoding){return function(size,fill,encoding){return assertSize(size),size<=0?createBuffer(size):void 0!==fill?"string"==typeof encoding?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill):createBuffer(size)}(size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)},Buffer.isBuffer=function(b){return null!=b&&!0===b._isBuffer&&b!==Buffer.prototype},Buffer.compare=function(a,b){if(isInstance(a,Uint8Array)&&(a=Buffer.from(a,a.offset,a.byteLength)),isInstance(b,Uint8Array)&&(b=Buffer.from(b,b.offset,b.byteLength)),!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i<len;++i)if(a[i]!==b[i]){x=a[i],y=b[i];break}return x<y?-1:y<x?1:0},Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(list,length){if(!Array.isArray(list))throw new TypeError('"list" argument must be an Array of Buffers');if(0===list.length)return Buffer.alloc(0);var i;if(void 0===length)for(i=length=0;i<list.length;++i)length+=list[i].length;var buffer=Buffer.allocUnsafe(length),pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(isInstance(buf,Uint8Array)&&(buf=Buffer.from(buf)),!Buffer.isBuffer(buf))throw new TypeError('"list" argument must be an Array of Buffers');buf.copy(buffer,pos),pos+=buf.length}return buffer},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var len=this.length;if(len%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<len;i+=2)swap(this,i,i+1);return this},Buffer.prototype.swap32=function(){var len=this.length;if(len%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<len;i+=4)swap(this,i,i+3),swap(this,i+1,i+2);return this},Buffer.prototype.swap64=function(){var len=this.length;if(len%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<len;i+=8)swap(this,i,i+7),swap(this,i+1,i+6),swap(this,i+2,i+5),swap(this,i+3,i+4);return this},Buffer.prototype.toLocaleString=Buffer.prototype.toString=function(){var length=this.length;return 0===length?"":0===arguments.length?utf8Slice(this,0,length):function(encoding,start,end){var loweredCase=!1;if((void 0===start||start<0)&&(start=0),start>this.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if((end>>>=0)<=(start>>>=0))return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}.apply(this,arguments)},Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||0===Buffer.compare(this,b)},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES;return str=this.toString("hex",0,max).replace(/(.{2})/g,"$1 ").trim(),this.length>max&&(str+=" ... "),"<Buffer "+str+">"},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array)&&(target=Buffer.from(target,target.offset,target.byteLength)),!Buffer.isBuffer(target))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof target);if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisEnd<=thisStart&&end<=start)return 0;if(thisEnd<=thisStart)return-1;if(end<=start)return 1;if(this===target)return 0;for(var x=(thisEnd>>>=0)-(thisStart>>>=0),y=(end>>>=0)-(start>>>=0),len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;i<len;++i)if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i],y=targetCopy[i];break}return x<y?-1:y<x?1:0},Buffer.prototype.includes=function(val,byteOffset,encoding){return-1!==this.indexOf(val,byteOffset,encoding)},Buffer.prototype.indexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!0)},Buffer.prototype.lastIndexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!1)},Buffer.prototype.write=function(string,offset,length,encoding){if(void 0===offset)encoding="utf8",length=this.length,offset=0;else if(void 0===length&&"string"==typeof offset)encoding=offset,length=this.length,offset=0;else{if(!isFinite(offset))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");offset>>>=0,isFinite(length)?(length>>>=0,void 0===encoding&&(encoding="utf8")):(encoding=length,length=void 0)}var remaining=this.length-offset;if((void 0===length||remaining<length)&&(length=remaining),0<string.length&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i)ret+=String.fromCharCode(127&buf[i]);return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i)ret+=String.fromCharCode(buf[i]);return ret}function hexSlice(buf,start,end){var len=buf.length;(!start||start<0)&&(start=0),(!end||end<0||len<end)&&(end=len);for(var out="",i=start;i<end;++i)out+=toHex(buf[i]);return out}function utf16leSlice(buf,start,end){for(var bytes=buf.slice(start,end),res="",i=0;i<bytes.length;i+=2)res+=String.fromCharCode(bytes[i]+256*bytes[i+1]);return res}function checkOffset(offset,ext,length){if(offset%1!=0||offset<0)throw new RangeError("offset is not uint");if(length<offset+ext)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(max<value||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return value=+value,offset>>>=0,noAssert||checkIEEE754(buf,0,offset,4),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return value=+value,offset>>>=0,noAssert||checkIEEE754(buf,0,offset,8),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}Buffer.prototype.slice=function(start,end){var len=this.length;(start=~~start)<0?(start+=len)<0&&(start=0):len<start&&(start=len),(end=void 0===end?len:~~end)<0?(end+=len)<0&&(end=0):len<end&&(end=len),end<start&&(end=start);var newBuf=this.subarray(start,end);return newBuf.__proto__=Buffer.prototype,newBuf},Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return val},Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset+--byteLength],mul=1;0<byteLength&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return(mul*=128)<=val&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];0<i&&(mul*=256);)val+=this[offset+--i]*mul;return(mul*=128)<=val&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){(value=+value,offset>>>=0,byteLength>>>=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0);var mul=1,i=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){(value=+value,offset>>>=0,byteLength>>>=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0);var i=byteLength-1,mul=1;for(this[offset+i]=255&value;0<=--i&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,255,0),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=value>>>8,this[offset+1]=255&value,offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,4294967295,0),this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value,offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,4294967295,0),this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset>>>=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i-1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset>>>=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;0<=--i&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,127,-128),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,32767,-32768),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,32767,-32768),this[offset]=value>>>8,this[offset+1]=255&value,offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24,offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(!Buffer.isBuffer(target))throw new TypeError("argument should be a Buffer");if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),0<end&&end<start&&(end=start),end===start)return 0;if(0===target.length||0===this.length)return 0;if(targetStart<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=this.length)throw new RangeError("Index out of range");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart<end-start&&(end=target.length-targetStart+start);var len=end-start;if(this===target&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(targetStart,start,end);else if(this===target&&start<targetStart&&targetStart<end)for(var i=len-1;0<=i;--i)target[i+targetStart]=this[i+start];else Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart);return len},Buffer.prototype.fill=function(val,start,end,encoding){if("string"==typeof val){if("string"==typeof start?(encoding=start,start=0,end=this.length):"string"==typeof end&&(encoding=end,end=this.length),void 0!==encoding&&"string"!=typeof encoding)throw new TypeError("encoding must be a string");if("string"==typeof encoding&&!Buffer.isEncoding(encoding))throw new TypeError("Unknown encoding: "+encoding);if(1===val.length){var code=val.charCodeAt(0);("utf8"===encoding&&code<128||"latin1"===encoding)&&(val=code)}}else"number"==typeof val&&(val&=255);if(start<0||this.length<start||this.length<end)throw new RangeError("Out of range index");if(end<=start)return this;var i;if(start>>>=0,end=void 0===end?this.length:end>>>0,val||(val=0),"number"==typeof val)for(i=start;i<end;++i)this[i]=val;else{var bytes=Buffer.isBuffer(val)?val:Buffer.from(val,encoding),len=bytes.length;if(0===len)throw new TypeError('The value "'+val+'" is invalid for argument "value"');for(i=0;i<end-start;++i)this[i+start]=bytes[i%len]}return this};var INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){var codePoint;units=units||1/0;for(var length=string.length,leadSurrogate=null,bytes=[],i=0;i<length;++i){if(55295<(codePoint=string.charCodeAt(i))&&codePoint<57344){if(!leadSurrogate){if(56319<codePoint){-1<(units-=3)&&bytes.push(239,191,189);continue}if(i+1===length){-1<(units-=3)&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){-1<(units-=3)&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&-1<(units-=3)&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function base64ToBytes(str){return base64.toByteArray(function(str){if((str=(str=str.split("=")[0]).trim().replace(INVALID_BASE64_RE,"")).length<2)return"";for(;str.length%4!=0;)str+="=";return str}(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length&&!(i+offset>=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}function isInstance(obj,type){return obj instanceof type||null!=obj&&null!=obj.constructor&&null!=obj.constructor.name&&obj.constructor.name===type.name}function numberIsNaN(obj){return obj!=obj}}).call(this,require("buffer").Buffer)},{"base64-js":44,buffer:48,ieee754:74}],49:[function(require,module,exports){"use strict";function earcut(data,holeIndices,dim){dim=dim||2;var minX,minY,maxX,maxY,x,y,invSize,hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,outerNode=linkedList(data,0,outerLen,dim,!0),triangles=[];if(!outerNode||outerNode.next===outerNode.prev)return triangles;if(hasHoles&&(outerNode=function(data,holeIndices,outerNode,dim){var i,len,start,end,list,queue=[];for(i=0,len=holeIndices.length;i<len;i++)start=holeIndices[i]*dim,end=i<len-1?holeIndices[i+1]*dim:data.length,(list=linkedList(data,start,end,dim,!1))===list.next&&(list.steiner=!0),queue.push(getLeftmost(list));for(queue.sort(compareX),i=0;i<queue.length;i++)eliminateHole(queue[i],outerNode),outerNode=filterPoints(outerNode,outerNode.next);return outerNode}(data,holeIndices,outerNode,dim)),data.length>80*dim){minX=maxX=data[0],minY=maxY=data[1];for(var i=dim;i<outerLen;i+=dim)(x=data[i])<minX&&(minX=x),(y=data[i+1])<minY&&(minY=y),maxX<x&&(maxX=x),maxY<y&&(maxY=y);invSize=0!==(invSize=Math.max(maxX-minX,maxY-minY))?1/invSize:0}return earcutLinked(outerNode,triangles,dim,minX,minY,invSize),triangles}function linkedList(data,start,end,dim,clockwise){var i,last;if(clockwise===0<signedArea(data,start,end,dim))for(i=start;i<end;i+=dim)last=insertNode(i,data[i],data[i+1],last);else for(i=end-dim;start<=i;i-=dim)last=insertNode(i,data[i],data[i+1],last);return last&&equals(last,last.next)&&(removeNode(last),last=last.next),last}function filterPoints(start,end){if(!start)return start;end||(end=start);var again,p=start;do{if(again=!1,p.steiner||!equals(p,p.next)&&0!==area(p.prev,p,p.next))p=p.next;else{if(removeNode(p),(p=end=p.prev)===p.next)break;again=!0}}while(again||p!==end);return end}function earcutLinked(ear,triangles,dim,minX,minY,invSize,pass){if(ear){!pass&&invSize&&function(start,minX,minY,invSize){var p=start;for(;null===p.z&&(p.z=zOrder(p.x,p.y,minX,minY,invSize)),p.prevZ=p.prev,p.nextZ=p.next,p=p.next,p!==start;);p.prevZ.nextZ=null,p.prevZ=null,function(list){var i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{for(p=list,tail=list=null,numMerges=0;p;){for(numMerges++,q=p,i=pSize=0;i<inSize&&(pSize++,q=q.nextZ);i++);for(qSize=inSize;0<pSize||0<qSize&&q;)0!==pSize&&(0===qSize||!q||p.z<=q.z)?(p=(e=p).nextZ,pSize--):(q=(e=q).nextZ,qSize--),tail?tail.nextZ=e:list=e,e.prevZ=tail,tail=e;p=q}tail.nextZ=null,inSize*=2}while(1<numMerges)}(p)}(ear,minX,minY,invSize);for(var prev,next,stop=ear;ear.prev!==ear.next;)if(prev=ear.prev,next=ear.next,invSize?isEarHashed(ear,minX,minY,invSize):isEar(ear))triangles.push(prev.i/dim),triangles.push(ear.i/dim),triangles.push(next.i/dim),removeNode(ear),ear=next.next,stop=next.next;else if((ear=next)===stop){pass?1===pass?earcutLinked(ear=cureLocalIntersections(ear,triangles,dim),triangles,dim,minX,minY,invSize,2):2===pass&&splitEarcut(ear,triangles,dim,minX,minY,invSize):earcutLinked(filterPoints(ear),triangles,dim,minX,minY,invSize,1);break}}}function isEar(ear){var a=ear.prev,b=ear,c=ear.next;if(0<=area(a,b,c))return!1;for(var p=ear.next.next;p!==ear.prev;){if(pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&0<=area(p.prev,p,p.next))return!1;p=p.next}return!0}function isEarHashed(ear,minX,minY,invSize){var a=ear.prev,b=ear,c=ear.next;if(0<=area(a,b,c))return!1;for(var minTX=a.x<b.x?a.x<c.x?a.x:c.x:b.x<c.x?b.x:c.x,minTY=a.y<b.y?a.y<c.y?a.y:c.y:b.y<c.y?b.y:c.y,maxTX=a.x>b.x?a.x>c.x?a.x:c.x:b.x>c.x?b.x:c.x,maxTY=a.y>b.y?a.y>c.y?a.y:c.y:b.y>c.y?b.y:c.y,minZ=zOrder(minTX,minTY,minX,minY,invSize),maxZ=zOrder(maxTX,maxTY,minX,minY,invSize),p=ear.prevZ,n=ear.nextZ;p&&p.z>=minZ&&n&&n.z<=maxZ;){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&0<=area(p.prev,p,p.next))return!1;if(p=p.prevZ,n!==ear.prev&&n!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,n.x,n.y)&&0<=area(n.prev,n,n.next))return!1;n=n.nextZ}for(;p&&p.z>=minZ;){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&0<=area(p.prev,p,p.next))return!1;p=p.prevZ}for(;n&&n.z<=maxZ;){if(n!==ear.prev&&n!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,n.x,n.y)&&0<=area(n.prev,n,n.next))return!1;n=n.nextZ}return!0}function cureLocalIntersections(start,triangles,dim){var p=start;do{var a=p.prev,b=p.next.next;!equals(a,b)&&intersects(a,p,p.next,b)&&locallyInside(a,b)&&locallyInside(b,a)&&(triangles.push(a.i/dim),triangles.push(p.i/dim),triangles.push(b.i/dim),removeNode(p),removeNode(p.next),p=start=b),p=p.next}while(p!==start);return p}function splitEarcut(start,triangles,dim,minX,minY,invSize){var a=start;do{for(var b=a.next.next;b!==a.prev;){if(a.i!==b.i&&isValidDiagonal(a,b)){var c=splitPolygon(a,b);return a=filterPoints(a,a.next),c=filterPoints(c,c.next),earcutLinked(a,triangles,dim,minX,minY,invSize),void earcutLinked(c,triangles,dim,minX,minY,invSize)}b=b.next}a=a.next}while(a!==start)}function compareX(a,b){return a.x-b.x}function eliminateHole(hole,outerNode){if(outerNode=function(hole,outerNode){var m,p=outerNode,hx=hole.x,hy=hole.y,qx=-1/0;do{if(hy<=p.y&&hy>=p.next.y&&p.next.y!==p.y){var x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&qx<x){if((qx=x)===hx){if(hy===p.y)return p;if(hy===p.next.y)return p.next}m=p.x<p.next.x?p:p.next}}p=p.next}while(p!==outerNode);if(!m)return null;if(hx===qx)return m.prev;var tan,stop=m,mx=m.x,my=m.y,tanMin=1/0;p=m.next;for(;p!==stop;)hx>=p.x&&p.x>=mx&&hx!==p.x&&pointInTriangle(hy<my?hx:qx,hy,mx,my,hy<my?qx:hx,hy,p.x,p.y)&&((tan=Math.abs(hy-p.y)/(hx-p.x))<tanMin||tan===tanMin&&p.x>m.x)&&locallyInside(p,hole)&&(m=p,tanMin=tan),p=p.next;return m}(hole,outerNode)){var b=splitPolygon(outerNode,hole);filterPoints(b,b.next)}}function zOrder(x,y,minX,minY,invSize){return(x=1431655765&((x=858993459&((x=252645135&((x=16711935&((x=32767*(x-minX)*invSize)|x<<8))|x<<4))|x<<2))|x<<1))|(y=1431655765&((y=858993459&((y=252645135&((y=16711935&((y=32767*(y-minY)*invSize)|y<<8))|y<<4))|y<<2))|y<<1))<<1}function getLeftmost(start){for(var p=start,leftmost=start;(p.x<leftmost.x||p.x===leftmost.x&&p.y<leftmost.y)&&(leftmost=p),(p=p.next)!==start;);return leftmost}function pointInTriangle(ax,ay,bx,by,cx,cy,px,py){return 0<=(cx-px)*(ay-py)-(ax-px)*(cy-py)&&0<=(ax-px)*(by-py)-(bx-px)*(ay-py)&&0<=(bx-px)*(cy-py)-(cx-px)*(by-py)}function isValidDiagonal(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(a,b){var p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&intersects(p,p.next,a,b))return!0;p=p.next}while(p!==a);return!1}(a,b)&&locallyInside(a,b)&&locallyInside(b,a)&&function(a,b){var p=a,inside=!1,px=(a.x+b.x)/2,py=(a.y+b.y)/2;for(;p.y>py!=p.next.y>py&&p.next.y!==p.y&&px<(p.next.x-p.x)*(py-p.y)/(p.next.y-p.y)+p.x&&(inside=!inside),p=p.next,p!==a;);return inside}(a,b)}function area(p,q,r){return(q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y)}function equals(p1,p2){return p1.x===p2.x&&p1.y===p2.y}function intersects(p1,q1,p2,q2){return!!(equals(p1,q1)&&equals(p2,q2)||equals(p1,q2)&&equals(p2,q1))||0<area(p1,q1,p2)!=0<area(p1,q1,q2)&&0<area(p2,q2,p1)!=0<area(p2,q2,q1)}function locallyInside(a,b){return area(a.prev,a,a.next)<0?0<=area(a,b,a.next)&&0<=area(a,a.prev,b):area(a,b,a.prev)<0||area(a,a.next,b)<0}function splitPolygon(a,b){var a2=new Node(a.i,a.x,a.y),b2=new Node(b.i,b.x,b.y),an=a.next,bp=b.prev;return(a.next=b).prev=a,(a2.next=an).prev=a2,(b2.next=a2).prev=b2,(bp.next=b2).prev=bp,b2}function insertNode(i,x,y,last){var p=new Node(i,x,y);return last?(p.next=last.next,(p.prev=last).next.prev=p,last.next=p):(p.prev=p).next=p,p}function removeNode(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function Node(i,x,y){this.i=i,this.x=x,this.y=y,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(data,start,end,dim){for(var sum=0,i=start,j=end-dim;i<end;i+=dim)sum+=(data[j]-data[i])*(data[i+1]+data[j+1]),j=i;return sum}module.exports=earcut,(module.exports.default=earcut).deviation=function(data,holeIndices,dim,triangles){var hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,polygonArea=Math.abs(signedArea(data,0,outerLen,dim));if(hasHoles)for(var i=0,len=holeIndices.length;i<len;i++){var start=holeIndices[i]*dim,end=i<len-1?holeIndices[i+1]*dim:data.length;polygonArea-=Math.abs(signedArea(data,start,end,dim))}var trianglesArea=0;for(i=0;i<triangles.length;i+=3){var a=triangles[i]*dim,b=triangles[i+1]*dim,c=triangles[i+2]*dim;trianglesArea+=Math.abs((data[a]-data[c])*(data[1+b]-data[1+a])-(data[a]-data[b])*(data[1+c]-data[1+a]))}return 0===polygonArea&&0===trianglesArea?0:Math.abs((trianglesArea-polygonArea)/polygonArea)},earcut.flatten=function(data){for(var dim=data[0][0].length,result={vertices:[],holes:[],dimensions:dim},holeIndex=0,i=0;i<data.length;i++){for(var j=0;j<data[i].length;j++)for(var d=0;d<dim;d++)result.vertices.push(data[i][j][d]);0<i&&(holeIndex+=data[i-1].length,result.holes.push(holeIndex))}return result}},{}],50:[function(require,module,exports){"use strict";require("individual/one-version")("ev-store","7");module.exports=function(elem){var hash=elem["__EV_STORE_KEY@7"];hash||(hash=elem["__EV_STORE_KEY@7"]={});return hash}},{"individual/one-version":77}],51:[function(require,module,exports){"use strict";module.exports=function(data,opts){opts||(opts={}),"function"==typeof opts&&(opts={cmp:opts});var f,cycles="boolean"==typeof opts.cycles&&opts.cycles,cmp=opts.cmp&&(f=opts.cmp,function(node){return function(a,b){var aobj={key:a,value:node[a]},bobj={key:b,value:node[b]};return f(aobj,bobj)}}),seen=[];return function stringify(node){if(node&&node.toJSON&&"function"==typeof node.toJSON&&(node=node.toJSON()),void 0!==node){if("number"==typeof node)return isFinite(node)?""+node:"null";if("object"!=typeof node)return JSON.stringify(node);var i,out;if(Array.isArray(node)){for(out="[",i=0;i<node.length;i++)i&&(out+=","),out+=stringify(node[i])||"null";return out+"]"}if(null===node)return"null";if(-1!==seen.indexOf(node)){if(cycles)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var seenIndex=seen.push(node)-1,keys=Object.keys(node).sort(cmp&&cmp(node));for(out="",i=0;i<keys.length;i++){var key=keys[i],value=stringify(node[key]);value&&(out&&(out+=","),out+=JSON.stringify(key)+":"+value)}return seen.splice(seenIndex,1),"{"+out+"}"}}(data)}},{}],52:[function(require,module,exports){(function(global){var doccy,topLevel=void 0!==global?global:"undefined"!=typeof window?window:{},minDoc=require("min-document");"undefined"!=typeof document?doccy=document:(doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"])||(doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc),module.exports=doccy}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":45}],53:[function(require,module,exports){(function(){"use strict";var parse=require("graphql/language/parser").parse;function normalize(string){return string.replace(/[\s,]+/g," ").trim()}var docCache={},fragmentSourceMap={};var printFragmentWarnings=!0;var experimentalFragmentVariables=!1;function parseDocument(doc){var cacheKey=normalize(doc);if(docCache[cacheKey])return docCache[cacheKey];var parsed=parse(doc,{experimentalFragmentVariables:experimentalFragmentVariables});if(!parsed||"Document"!==parsed.kind)throw new Error("Not a valid GraphQL document.");return parsed=function stripLoc(doc,removeLocAtThisLevel){var docType=Object.prototype.toString.call(doc);if("[object Array]"===docType)return doc.map(function(d){return stripLoc(d,removeLocAtThisLevel)});if("[object Object]"!==docType)throw new Error("Unexpected input.");removeLocAtThisLevel&&doc.loc&&delete doc.loc,doc.loc&&(delete doc.loc.startToken,delete doc.loc.endToken);var key,value,valueType,keys=Object.keys(doc);for(key in keys)keys.hasOwnProperty(key)&&(value=doc[keys[key]],"[object Object]"!==(valueType=Object.prototype.toString.call(value))&&"[object Array]"!==valueType||(doc[keys[key]]=stripLoc(value,!0)));return doc}(parsed=function(ast){for(var loc,astFragmentMap={},definitions=[],i=0;i<ast.definitions.length;i++){var fragmentDefinition=ast.definitions[i];if("FragmentDefinition"===fragmentDefinition.kind){var fragmentName=fragmentDefinition.name.value,sourceKey=normalize((loc=fragmentDefinition.loc).source.body.substring(loc.start,loc.end));fragmentSourceMap.hasOwnProperty(fragmentName)&&!fragmentSourceMap[fragmentName][sourceKey]?(printFragmentWarnings&&console.warn("Warning: fragment with name "+fragmentName+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"),fragmentSourceMap[fragmentName][sourceKey]=!0):fragmentSourceMap.hasOwnProperty(fragmentName)||(fragmentSourceMap[fragmentName]={},fragmentSourceMap[fragmentName][sourceKey]=!0),astFragmentMap[sourceKey]||(astFragmentMap[sourceKey]=!0,definitions.push(fragmentDefinition))}else definitions.push(fragmentDefinition)}return ast.definitions=definitions,ast}(parsed),!1),docCache[cacheKey]=parsed}function gql(){for(var args=Array.prototype.slice.call(arguments),literals=args[0],result="string"==typeof literals?literals:literals[0],i=1;i<args.length;i++)args[i]&&args[i].kind&&"Document"===args[i].kind?result+=args[i].loc.source.body:result+=args[i],result+=literals[i];return parseDocument(result)}(gql.default=gql).resetCaches=function(){docCache={},fragmentSourceMap={}},gql.disableFragmentWarnings=function(){printFragmentWarnings=!1},gql.enableExperimentalFragmentVariables=function(){experimentalFragmentVariables=!0},gql.disableExperimentalFragmentVariables=function(){experimentalFragmentVariables=!1},module.exports=gql})()},{"graphql/language/parser":70}],54:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLError=GraphQLError;var _printError=require("./printError"),_location=require("../language/location");function GraphQLError(message,nodes,source,positions,path,originalError,extensions){var _nodes=Array.isArray(nodes)?0!==nodes.length?nodes:void 0:nodes?[nodes]:void 0,_source=source;if(!_source&&_nodes){var node=_nodes[0];_source=node&&node.loc&&node.loc.source}var _locations,_positions=positions;!_positions&&_nodes&&(_positions=_nodes.reduce(function(list,node){return node.loc&&list.push(node.loc.start),list},[])),_positions&&0===_positions.length&&(_positions=void 0),positions&&source?_locations=positions.map(function(pos){return(0,_location.getLocation)(source,pos)}):_nodes&&(_locations=_nodes.reduce(function(list,node){return node.loc&&list.push((0,_location.getLocation)(node.loc.source,node.loc.start)),list},[]));var _extensions=extensions||originalError&&originalError.extensions;Object.defineProperties(this,{message:{value:message,enumerable:!0,writable:!0},locations:{value:_locations||void 0,enumerable:Boolean(_locations)},path:{value:path||void 0,enumerable:Boolean(path)},nodes:{value:_nodes||void 0},source:{value:_source||void 0},positions:{value:_positions||void 0},originalError:{value:originalError},extensions:{value:_extensions||void 0,enumerable:Boolean(_extensions)}}),originalError&&originalError.stack?Object.defineProperty(this,"stack",{value:originalError.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}GraphQLError.prototype=Object.create(Error.prototype,{constructor:{value:GraphQLError},name:{value:"GraphQLError"},toString:{value:function(){return(0,_printError.printError)(this)}}})},{"../language/location":69,"./printError":58}],55:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatError=function(error){error||(0,_invariant.default)(0,"Received null or undefined error.");var message=error.message||"An unknown error occurred.",locations=error.locations,path=error.path,extensions=error.extensions;return extensions?{message:message,locations:locations,path:path,extensions:extensions}:{message:message,locations:locations,path:path}};var obj,_invariant=(obj=require("../jsutils/invariant"))&&obj.__esModule?obj:{default:obj}},{"../jsutils/invariant":63}],56:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"GraphQLError",{enumerable:!0,get:function(){return _GraphQLError.GraphQLError}}),Object.defineProperty(exports,"syntaxError",{enumerable:!0,get:function(){return _syntaxError.syntaxError}}),Object.defineProperty(exports,"locatedError",{enumerable:!0,get:function(){return _locatedError.locatedError}}),Object.defineProperty(exports,"printError",{enumerable:!0,get:function(){return _printError.printError}}),Object.defineProperty(exports,"formatError",{enumerable:!0,get:function(){return _formatError.formatError}});var _GraphQLError=require("./GraphQLError"),_syntaxError=require("./syntaxError"),_locatedError=require("./locatedError"),_printError=require("./printError"),_formatError=require("./formatError")},{"./GraphQLError":54,"./formatError":55,"./locatedError":57,"./printError":58,"./syntaxError":59}],57:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.locatedError=function(originalError,nodes,path){if(originalError&&Array.isArray(originalError.path))return originalError;return new _GraphQLError.GraphQLError(originalError&&originalError.message,originalError&&originalError.nodes||nodes,originalError&&originalError.source,originalError&&originalError.positions,path,originalError)};var _GraphQLError=require("./GraphQLError")},{"./GraphQLError":54}],58:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.printError=function(error){var printedLocations=[];if(error.nodes){var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=error.nodes[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var node=_step.value;node.loc&&printedLocations.push(highlightSourceAtLocation(node.loc.source,(0,_location.getLocation)(node.loc.source,node.loc.start)))}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}}else if(error.source&&error.locations){var source=error.source,_iteratorNormalCompletion2=!0,_didIteratorError2=!1,_iteratorError2=void 0;try{for(var _step2,_iterator2=error.locations[Symbol.iterator]();!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=!0){var location=_step2.value;printedLocations.push(highlightSourceAtLocation(source,location))}}catch(err){_didIteratorError2=!0,_iteratorError2=err}finally{try{_iteratorNormalCompletion2||null==_iterator2.return||_iterator2.return()}finally{if(_didIteratorError2)throw _iteratorError2}}}return 0===printedLocations.length?error.message:[error.message].concat(printedLocations).join("\n\n")+"\n"};var _location=require("../language/location");function highlightSourceAtLocation(source,location){var firstLineColumnOffset=source.locationOffset.column-1,body=whitespace(firstLineColumnOffset)+source.body,lineIndex=location.line-1,lineOffset=source.locationOffset.line-1,lineNum=location.line+lineOffset,columnOffset=1===location.line?firstLineColumnOffset:0,columnNum=location.column+columnOffset,lines=body.split(/\r\n|[\n\r]/g);return"".concat(source.name," (").concat(lineNum,":").concat(columnNum,")\n")+function(lines){var existingLines=lines.filter(function(_ref){_ref[0];var line=_ref[1];return void 0!==line}),padLen=0,_iteratorNormalCompletion3=!0,_didIteratorError3=!1,_iteratorError3=void 0;try{for(var _step3,_iterator3=existingLines[Symbol.iterator]();!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=!0){var _ref4=_step3.value,prefix=_ref4[0];padLen=Math.max(padLen,prefix.length)}}catch(err){_didIteratorError3=!0,_iteratorError3=err}finally{try{_iteratorNormalCompletion3||null==_iterator3.return||_iterator3.return()}finally{if(_didIteratorError3)throw _iteratorError3}}return existingLines.map(function(_ref3){var prefix=_ref3[0],line=_ref3[1];return function(len,str){return whitespace(len-str.length)+str}(padLen,prefix)+line}).join("\n")}([["".concat(lineNum-1,": "),lines[lineIndex-1]],["".concat(lineNum,": "),lines[lineIndex]],["",whitespace(columnNum-1)+"^"],["".concat(lineNum+1,": "),lines[1+lineIndex]]])}function whitespace(len){return Array(len+1).join(" ")}},{"../language/location":69}],59:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.syntaxError=function(source,position,description){return new _GraphQLError.GraphQLError("Syntax Error: ".concat(description),void 0,source,[position])};var _GraphQLError=require("./GraphQLError")},{"./GraphQLError":54}],60:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(classObject){var fn=1<arguments.length&&void 0!==arguments[1]?arguments[1]:classObject.prototype.toString;classObject.prototype.toJSON=fn,classObject.prototype.inspect=fn,_nodejsCustomInspectSymbol.default&&(classObject.prototype[_nodejsCustomInspectSymbol.default]=fn)};var obj,_nodejsCustomInspectSymbol=(obj=require("./nodejsCustomInspectSymbol"))&&obj.__esModule?obj:{default:obj}},{"./nodejsCustomInspectSymbol":64}],61:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(classObject){"function"==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(classObject.prototype,Symbol.toStringTag,{get:function(){return this.constructor.name}})}},{}],62:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(value){return formatValue(value,[])};var obj,_nodejsCustomInspectSymbol=(obj=require("./nodejsCustomInspectSymbol"))&&obj.__esModule?obj:{default:obj};function _typeof(obj){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}var MAX_ARRAY_LENGTH=10,MAX_RECURSIVE_DEPTH=2;function formatValue(value,seenValues){switch(_typeof(value)){case"string":return JSON.stringify(value);case"function":return value.name?"[function ".concat(value.name,"]"):"[function]";case"object":return function(value,previouslySeenValues){if(-1!==previouslySeenValues.indexOf(value))return"[Circular]";var seenValues=[].concat(previouslySeenValues,[value]);if(value){var customInspectFn=function(object){var customInspectFn=object[String(_nodejsCustomInspectSymbol.default)];if("function"==typeof customInspectFn)return customInspectFn;if("function"==typeof object.inspect)return object.inspect}(value);if(customInspectFn){var customValue=customInspectFn.call(value);if(customValue!==value)return"string"==typeof customValue?customValue:formatValue(customValue,seenValues)}else if(Array.isArray(value))return function(array,seenValues){if(0===array.length)return"[]";if(seenValues.length>MAX_RECURSIVE_DEPTH)return"[Array]";for(var len=Math.min(MAX_ARRAY_LENGTH,array.length),remaining=array.length-len,items=[],i=0;i<len;++i)items.push(formatValue(array[i],seenValues));1==remaining?items.push("... 1 more item"):1<remaining&&items.push("... ".concat(remaining," more items"));return"["+items.join(", ")+"]"}(value,seenValues);return function(object,seenValues){var keys=Object.keys(object);if(0===keys.length)return"{}";if(seenValues.length>MAX_RECURSIVE_DEPTH)return"["+function(object){var tag=Object.prototype.toString.call(object).replace(/^\[object /,"").replace(/]$/,"");if("Object"===tag&&"function"==typeof object.constructor){var name=object.constructor.name;if("string"==typeof name)return name}return tag}(object)+"]";return"{ "+keys.map(function(key){var value=formatValue(object[key],seenValues);return key+": "+value}).join(", ")+" }"}(value,seenValues)}return String(value)}(value,seenValues);default:return String(value)}}},{"./nodejsCustomInspectSymbol":64}],63:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(condition,message){if(!condition)throw new Error(message)}},{}],64:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default="function"==typeof Symbol?Symbol.for("nodejs.util.inspect.custom"):void 0;exports.default=_default},{}],65:[function(require,module,exports){"use strict";function leadingWhitespace(str){for(var i=0;i<str.length&&(" "===str[i]||"\t"===str[i]);)i++;return i}function isBlank(str){return leadingWhitespace(str)===str.length}Object.defineProperty(exports,"__esModule",{value:!0}),exports.dedentBlockStringValue=function(rawString){for(var lines=rawString.split(/\r\n|[\n\r]/g),commonIndent=null,i=1;i<lines.length;i++){var line=lines[i],indent=leadingWhitespace(line);if(indent<line.length&&(null===commonIndent||indent<commonIndent)&&0===(commonIndent=indent))break}if(commonIndent)for(var _i=1;_i<lines.length;_i++)lines[_i]=lines[_i].slice(commonIndent);for(;0<lines.length&&isBlank(lines[0]);)lines.shift();for(;0<lines.length&&isBlank(lines[lines.length-1]);)lines.pop();return lines.join("\n")},exports.printBlockString=function(value){var indentation=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",preferMultipleLines=2<arguments.length&&void 0!==arguments[2]&&arguments[2],isSingleLine=-1===value.indexOf("\n"),hasLeadingSpace=" "===value[0]||"\t"===value[0],hasTrailingQuote='"'===value[value.length-1],printAsMultipleLines=!isSingleLine||hasTrailingQuote||preferMultipleLines,result="";!printAsMultipleLines||isSingleLine&&hasLeadingSpace||(result+="\n"+indentation);result+=indentation?value.replace(/\n/g,"\n"+indentation):value,printAsMultipleLines&&(result+="\n");return'"""'+result.replace(/"""/g,'\\"""')+'"""'}},{}],66:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DirectiveLocation=void 0;var DirectiveLocation=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});exports.DirectiveLocation=DirectiveLocation},{}],67:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Kind=void 0;var Kind=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});exports.Kind=Kind},{}],68:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createLexer=function(source,options){var startOfFileToken=new Tok(TokenKind.SOF,0,0,0,0,null);return{source:source,options:options,lastToken:startOfFileToken,token:startOfFileToken,line:1,lineStart:0,advance:advanceLexer,lookahead:lookahead}},exports.getTokenDesc=function(token){var value=token.value;return value?"".concat(token.kind,' "').concat(value,'"'):token.kind},exports.TokenKind=void 0;var obj,_defineToJSON=(obj=require("../jsutils/defineToJSON"))&&obj.__esModule?obj:{default:obj},_error=require("../error"),_blockString=require("./blockString");function advanceLexer(){return this.lastToken=this.token,this.token=this.lookahead()}function lookahead(){var token=this.token;if(token.kind!==TokenKind.EOF)for(;(token=token.next||(token.next=readToken(this,token))).kind===TokenKind.COMMENT;);return token}var TokenKind=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function Tok(kind,start,end,line,column,prev,value){this.kind=kind,this.start=start,this.end=end,this.line=line,this.column=column,this.value=value,this.prev=prev,this.next=null}function printCharCode(code){return isNaN(code)?TokenKind.EOF:code<127?JSON.stringify(String.fromCharCode(code)):'"\\u'.concat(("00"+code.toString(16).toUpperCase()).slice(-4),'"')}function readToken(lexer,prev){var source=lexer.source,body=source.body,bodyLength=body.length,pos=function(body,startPosition,lexer){var bodyLength=body.length,position=startPosition;for(;position<bodyLength;){var code=body.charCodeAt(position);if(9===code||32===code||44===code||65279===code)++position;else if(10===code)++position,++lexer.line,lexer.lineStart=position;else{if(13!==code)break;10===body.charCodeAt(position+1)?position+=2:++position,++lexer.line,lexer.lineStart=position}}return position}(body,prev.end,lexer),line=lexer.line,col=1+pos-lexer.lineStart;if(bodyLength<=pos)return new Tok(TokenKind.EOF,bodyLength,bodyLength,line,col,prev);var code=body.charCodeAt(pos);switch(code){case 33:return new Tok(TokenKind.BANG,pos,pos+1,line,col,prev);case 35:return function(source,start,line,col,prev){var code,body=source.body,position=start;for(;code=body.charCodeAt(++position),!isNaN(code)&&(31<code||9===code););return new Tok(TokenKind.COMMENT,start,position,line,col,prev,body.slice(start+1,position))}(source,pos,line,col,prev);case 36:return new Tok(TokenKind.DOLLAR,pos,pos+1,line,col,prev);case 38:return new Tok(TokenKind.AMP,pos,pos+1,line,col,prev);case 40:return new Tok(TokenKind.PAREN_L,pos,pos+1,line,col,prev);case 41:return new Tok(TokenKind.PAREN_R,pos,pos+1,line,col,prev);case 46:if(46===body.charCodeAt(pos+1)&&46===body.charCodeAt(pos+2))return new Tok(TokenKind.SPREAD,pos,pos+3,line,col,prev);break;case 58:return new Tok(TokenKind.COLON,pos,pos+1,line,col,prev);case 61:return new Tok(TokenKind.EQUALS,pos,pos+1,line,col,prev);case 64:return new Tok(TokenKind.AT,pos,pos+1,line,col,prev);case 91:return new Tok(TokenKind.BRACKET_L,pos,pos+1,line,col,prev);case 93:return new Tok(TokenKind.BRACKET_R,pos,pos+1,line,col,prev);case 123:return new Tok(TokenKind.BRACE_L,pos,pos+1,line,col,prev);case 124:return new Tok(TokenKind.PIPE,pos,pos+1,line,col,prev);case 125:return new Tok(TokenKind.BRACE_R,pos,pos+1,line,col,prev);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return function(source,start,line,col,prev){var body=source.body,bodyLength=body.length,position=start+1,code=0;for(;position!==bodyLength&&!isNaN(code=body.charCodeAt(position))&&(95===code||48<=code&&code<=57||65<=code&&code<=90||97<=code&&code<=122);)++position;return new Tok(TokenKind.NAME,start,position,line,col,prev,body.slice(start,position))}(source,pos,line,col,prev);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return function(source,start,firstCode,line,col,prev){var body=source.body,code=firstCode,position=start,isFloat=!1;45===code&&(code=body.charCodeAt(++position));if(48===code){if(48<=(code=body.charCodeAt(++position))&&code<=57)throw(0,_error.syntaxError)(source,position,"Invalid number, unexpected digit after 0: ".concat(printCharCode(code),"."))}else position=readDigits(source,position,code),code=body.charCodeAt(position);46===code&&(isFloat=!0,code=body.charCodeAt(++position),position=readDigits(source,position,code),code=body.charCodeAt(position));69!==code&&101!==code||(isFloat=!0,43!==(code=body.charCodeAt(++position))&&45!==code||(code=body.charCodeAt(++position)),position=readDigits(source,position,code));return new Tok(isFloat?TokenKind.FLOAT:TokenKind.INT,start,position,line,col,prev,body.slice(start,position))}(source,pos,code,line,col,prev);case 34:return 34===body.charCodeAt(pos+1)&&34===body.charCodeAt(pos+2)?function(source,start,line,col,prev,lexer){var body=source.body,position=start+3,chunkStart=position,code=0,rawValue="";for(;position<body.length&&!isNaN(code=body.charCodeAt(position));){if(34===code&&34===body.charCodeAt(position+1)&&34===body.charCodeAt(position+2))return rawValue+=body.slice(chunkStart,position),new Tok(TokenKind.BLOCK_STRING,start,position+3,line,col,prev,(0,_blockString.dedentBlockStringValue)(rawValue));if(code<32&&9!==code&&10!==code&&13!==code)throw(0,_error.syntaxError)(source,position,"Invalid character within String: ".concat(printCharCode(code),"."));10===code?(++position,++lexer.line,lexer.lineStart=position):13===code?(10===body.charCodeAt(position+1)?position+=2:++position,++lexer.line,lexer.lineStart=position):92===code&&34===body.charCodeAt(position+1)&&34===body.charCodeAt(position+2)&&34===body.charCodeAt(position+3)?(rawValue+=body.slice(chunkStart,position)+'"""',chunkStart=position+=4):++position}throw(0,_error.syntaxError)(source,position,"Unterminated string.")}(source,pos,line,col,prev,lexer):function(source,start,line,col,prev){var body=source.body,position=start+1,chunkStart=position,code=0,value="";for(;position<body.length&&!isNaN(code=body.charCodeAt(position))&&10!==code&&13!==code;){if(34===code)return value+=body.slice(chunkStart,position),new Tok(TokenKind.STRING,start,position+1,line,col,prev,value);if(code<32&&9!==code)throw(0,_error.syntaxError)(source,position,"Invalid character within String: ".concat(printCharCode(code),"."));if(++position,92===code){switch(value+=body.slice(chunkStart,position-1),code=body.charCodeAt(position)){case 34:value+='"';break;case 47:value+="/";break;case 92:value+="\\";break;case 98:value+="\b";break;case 102:value+="\f";break;case 110:value+="\n";break;case 114:value+="\r";break;case 116:value+="\t";break;case 117:var charCode=(a=body.charCodeAt(position+1),b=body.charCodeAt(position+2),c=body.charCodeAt(position+3),d=body.charCodeAt(position+4),char2hex(a)<<12|char2hex(b)<<8|char2hex(c)<<4|char2hex(d));if(charCode<0)throw(0,_error.syntaxError)(source,position,"Invalid character escape sequence: "+"\\u".concat(body.slice(position+1,position+5),"."));value+=String.fromCharCode(charCode),position+=4;break;default:throw(0,_error.syntaxError)(source,position,"Invalid character escape sequence: \\".concat(String.fromCharCode(code),"."))}chunkStart=++position}}var a,b,c,d;throw(0,_error.syntaxError)(source,position,"Unterminated string.")}(source,pos,line,col,prev)}throw(0,_error.syntaxError)(source,pos,function(code){if(code<32&&9!==code&&10!==code&&13!==code)return"Cannot contain the invalid character ".concat(printCharCode(code),".");return 39!==code?"Cannot parse the unexpected character ".concat(printCharCode(code),"."):"Unexpected single quote character ('), did you mean to use a double quote (\")?"}(code))}function readDigits(source,start,firstCode){var body=source.body,position=start,code=firstCode;if(48<=code&&code<=57){for(;48<=(code=body.charCodeAt(++position))&&code<=57;);return position}throw(0,_error.syntaxError)(source,position,"Invalid number, expected digit but got: ".concat(printCharCode(code),"."))}function char2hex(a){return 48<=a&&a<=57?a-48:65<=a&&a<=70?a-55:97<=a&&a<=102?a-87:-1}exports.TokenKind=TokenKind,(0,_defineToJSON.default)(Tok,function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}})},{"../error":56,"../jsutils/defineToJSON":60,"./blockString":65}],69:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLocation=function(source,position){var match,lineRegexp=/\r\n|[\n\r]/g,line=1,column=position+1;for(;(match=lineRegexp.exec(source.body))&&match.index<position;)line+=1,column=position+1-(match.index+match[0].length);return{line:line,column:column}}},{}],70:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.parse=function(source,options){var sourceObj="string"==typeof source?new _source.Source(source):source;if(sourceObj instanceof _source.Source)return function(lexer){var start=lexer.token;return{kind:_kinds.Kind.DOCUMENT,definitions:many(lexer,_lexer.TokenKind.SOF,parseDefinition,_lexer.TokenKind.EOF),loc:loc(lexer,start)}}((0,_lexer.createLexer)(sourceObj,options||{}));throw new TypeError("Must provide Source. Received: ".concat((0,_inspect.default)(sourceObj)))},exports.parseValue=function(source,options){var sourceObj="string"==typeof source?new _source.Source(source):source,lexer=(0,_lexer.createLexer)(sourceObj,options||{});expectToken(lexer,_lexer.TokenKind.SOF);var value=parseValueLiteral(lexer,!1);return expectToken(lexer,_lexer.TokenKind.EOF),value},exports.parseType=function(source,options){var sourceObj="string"==typeof source?new _source.Source(source):source,lexer=(0,_lexer.createLexer)(sourceObj,options||{});expectToken(lexer,_lexer.TokenKind.SOF);var type=parseTypeReference(lexer);return expectToken(lexer,_lexer.TokenKind.EOF),type},exports.parseConstValue=parseConstValue,exports.parseTypeReference=parseTypeReference,exports.parseNamedType=parseNamedType;var _inspect=_interopRequireDefault(require("../jsutils/inspect")),_defineToJSON=_interopRequireDefault(require("../jsutils/defineToJSON")),_source=require("./source"),_error=require("../error"),_lexer=require("./lexer"),_kinds=require("./kinds"),_directiveLocation=require("./directiveLocation");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function parseName(lexer){var token=expectToken(lexer,_lexer.TokenKind.NAME);return{kind:_kinds.Kind.NAME,value:token.value,loc:loc(lexer,token)}}function parseDefinition(lexer){if(peek(lexer,_lexer.TokenKind.NAME))switch(lexer.token.value){case"query":case"mutation":case"subscription":case"fragment":return parseExecutableDefinition(lexer);case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return parseTypeSystemDefinition(lexer);case"extend":return function(lexer){var keywordToken=lexer.lookahead();if(keywordToken.kind===_lexer.TokenKind.NAME)switch(keywordToken.value){case"schema":return function(lexer){var start=lexer.token;expectKeyword(lexer,"extend"),expectKeyword(lexer,"schema");var directives=parseDirectives(lexer,!0),operationTypes=peek(lexer,_lexer.TokenKind.BRACE_L)?many(lexer,_lexer.TokenKind.BRACE_L,parseOperationTypeDefinition,_lexer.TokenKind.BRACE_R):[];if(0!==directives.length||0!==operationTypes.length)return{kind:_kinds.Kind.SCHEMA_EXTENSION,directives:directives,operationTypes:operationTypes,loc:loc(lexer,start)};throw unexpected(lexer)}(lexer);case"scalar":return function(lexer){var start=lexer.token;expectKeyword(lexer,"extend"),expectKeyword(lexer,"scalar");var name=parseName(lexer),directives=parseDirectives(lexer,!0);if(0!==directives.length)return{kind:_kinds.Kind.SCALAR_TYPE_EXTENSION,name:name,directives:directives,loc:loc(lexer,start)};throw unexpected(lexer)}(lexer);case"type":return function(lexer){var start=lexer.token;expectKeyword(lexer,"extend"),expectKeyword(lexer,"type");var name=parseName(lexer),interfaces=parseImplementsInterfaces(lexer),directives=parseDirectives(lexer,!0),fields=parseFieldsDefinition(lexer);if(0!==interfaces.length||0!==directives.length||0!==fields.length)return{kind:_kinds.Kind.OBJECT_TYPE_EXTENSION,name:name,interfaces:interfaces,directives:directives,fields:fields,loc:loc(lexer,start)};throw unexpected(lexer)}(lexer);case"interface":return function(lexer){var start=lexer.token;expectKeyword(lexer,"extend"),expectKeyword(lexer,"interface");var name=parseName(lexer),directives=parseDirectives(lexer,!0),fields=parseFieldsDefinition(lexer);if(0!==directives.length||0!==fields.length)return{kind:_kinds.Kind.INTERFACE_TYPE_EXTENSION,name:name,directives:directives,fields:fields,loc:loc(lexer,start)};throw unexpected(lexer)}(lexer);case"union":return function(lexer){var start=lexer.token;expectKeyword(lexer,"extend"),expectKeyword(lexer,"union");var name=parseName(lexer),directives=parseDirectives(lexer,!0),types=parseUnionMemberTypes(lexer);if(0!==directives.length||0!==types.length)return{kind:_kinds.Kind.UNION_TYPE_EXTENSION,name:name,directives:directives,types:types,loc:loc(lexer,start)};throw unexpected(lexer)}(lexer);case"enum":return function(lexer){var start=lexer.token;expectKeyword(lexer,"extend"),expectKeyword(lexer,"enum");var name=parseName(lexer),directives=parseDirectives(lexer,!0),values=parseEnumValuesDefinition(lexer);if(0!==directives.length||0!==values.length)return{kind:_kinds.Kind.ENUM_TYPE_EXTENSION,name:name,directives:directives,values:values,loc:loc(lexer,start)};throw unexpected(lexer)}(lexer);case"input":return function(lexer){var start=lexer.token;expectKeyword(lexer,"extend"),expectKeyword(lexer,"input");var name=parseName(lexer),directives=parseDirectives(lexer,!0),fields=parseInputFieldsDefinition(lexer);if(0!==directives.length||0!==fields.length)return{kind:_kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:name,directives:directives,fields:fields,loc:loc(lexer,start)};throw unexpected(lexer)}(lexer)}throw unexpected(lexer,keywordToken)}(lexer)}else{if(peek(lexer,_lexer.TokenKind.BRACE_L))return parseExecutableDefinition(lexer);if(peekDescription(lexer))return parseTypeSystemDefinition(lexer)}throw unexpected(lexer)}function parseExecutableDefinition(lexer){if(peek(lexer,_lexer.TokenKind.NAME))switch(lexer.token.value){case"query":case"mutation":case"subscription":return parseOperationDefinition(lexer);case"fragment":return function(lexer){var start=lexer.token;if(expectKeyword(lexer,"fragment"),lexer.options.experimentalFragmentVariables)return{kind:_kinds.Kind.FRAGMENT_DEFINITION,name:parseFragmentName(lexer),variableDefinitions:parseVariableDefinitions(lexer),typeCondition:(expectKeyword(lexer,"on"),parseNamedType(lexer)),directives:parseDirectives(lexer,!1),selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)};return{kind:_kinds.Kind.FRAGMENT_DEFINITION,name:parseFragmentName(lexer),typeCondition:(expectKeyword(lexer,"on"),parseNamedType(lexer)),directives:parseDirectives(lexer,!1),selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)}}(lexer)}else if(peek(lexer,_lexer.TokenKind.BRACE_L))return parseOperationDefinition(lexer);throw unexpected(lexer)}function parseOperationDefinition(lexer){var start=lexer.token;if(peek(lexer,_lexer.TokenKind.BRACE_L))return{kind:_kinds.Kind.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)};var name,operation=parseOperationType(lexer);return peek(lexer,_lexer.TokenKind.NAME)&&(name=parseName(lexer)),{kind:_kinds.Kind.OPERATION_DEFINITION,operation:operation,name:name,variableDefinitions:parseVariableDefinitions(lexer),directives:parseDirectives(lexer,!1),selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)}}function parseOperationType(lexer){var operationToken=expectToken(lexer,_lexer.TokenKind.NAME);switch(operationToken.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw unexpected(lexer,operationToken)}function parseVariableDefinitions(lexer){return peek(lexer,_lexer.TokenKind.PAREN_L)?many(lexer,_lexer.TokenKind.PAREN_L,parseVariableDefinition,_lexer.TokenKind.PAREN_R):[]}function parseVariableDefinition(lexer){var start=lexer.token;return{kind:_kinds.Kind.VARIABLE_DEFINITION,variable:parseVariable(lexer),type:(expectToken(lexer,_lexer.TokenKind.COLON),parseTypeReference(lexer)),defaultValue:expectOptionalToken(lexer,_lexer.TokenKind.EQUALS)?parseValueLiteral(lexer,!0):void 0,directives:parseDirectives(lexer,!0),loc:loc(lexer,start)}}function parseVariable(lexer){var start=lexer.token;return expectToken(lexer,_lexer.TokenKind.DOLLAR),{kind:_kinds.Kind.VARIABLE,name:parseName(lexer),loc:loc(lexer,start)}}function parseSelectionSet(lexer){var start=lexer.token;return{kind:_kinds.Kind.SELECTION_SET,selections:many(lexer,_lexer.TokenKind.BRACE_L,parseSelection,_lexer.TokenKind.BRACE_R),loc:loc(lexer,start)}}function parseSelection(lexer){return peek(lexer,_lexer.TokenKind.SPREAD)?function(lexer){var start=lexer.token;expectToken(lexer,_lexer.TokenKind.SPREAD);var hasTypeCondition=expectOptionalKeyword(lexer,"on");return hasTypeCondition||!peek(lexer,_lexer.TokenKind.NAME)?{kind:_kinds.Kind.INLINE_FRAGMENT,typeCondition:hasTypeCondition?parseNamedType(lexer):void 0,directives:parseDirectives(lexer,!1),selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)}:{kind:_kinds.Kind.FRAGMENT_SPREAD,name:parseFragmentName(lexer),directives:parseDirectives(lexer,!1),loc:loc(lexer,start)}}(lexer):function(lexer){var alias,name,start=lexer.token,nameOrAlias=parseName(lexer);name=expectOptionalToken(lexer,_lexer.TokenKind.COLON)?(alias=nameOrAlias,parseName(lexer)):nameOrAlias;return{kind:_kinds.Kind.FIELD,alias:alias,name:name,arguments:parseArguments(lexer,!1),directives:parseDirectives(lexer,!1),selectionSet:peek(lexer,_lexer.TokenKind.BRACE_L)?parseSelectionSet(lexer):void 0,loc:loc(lexer,start)}}(lexer)}function parseArguments(lexer,isConst){var item=isConst?parseConstArgument:parseArgument;return peek(lexer,_lexer.TokenKind.PAREN_L)?many(lexer,_lexer.TokenKind.PAREN_L,item,_lexer.TokenKind.PAREN_R):[]}function parseArgument(lexer){var start=lexer.token,name=parseName(lexer);return expectToken(lexer,_lexer.TokenKind.COLON),{kind:_kinds.Kind.ARGUMENT,name:name,value:parseValueLiteral(lexer,!1),loc:loc(lexer,start)}}function parseConstArgument(lexer){var start=lexer.token;return{kind:_kinds.Kind.ARGUMENT,name:parseName(lexer),value:(expectToken(lexer,_lexer.TokenKind.COLON),parseConstValue(lexer)),loc:loc(lexer,start)}}function parseFragmentName(lexer){if("on"===lexer.token.value)throw unexpected(lexer);return parseName(lexer)}function parseValueLiteral(lexer,isConst){var token=lexer.token;switch(token.kind){case _lexer.TokenKind.BRACKET_L:return function(lexer,isConst){var start=lexer.token,item=isConst?parseConstValue:parseValueValue;return{kind:_kinds.Kind.LIST,values:any(lexer,_lexer.TokenKind.BRACKET_L,item,_lexer.TokenKind.BRACKET_R),loc:loc(lexer,start)}}(lexer,isConst);case _lexer.TokenKind.BRACE_L:return function(lexer,isConst){var start=lexer.token;return{kind:_kinds.Kind.OBJECT,fields:any(lexer,_lexer.TokenKind.BRACE_L,function(){return parseObjectField(lexer,isConst)},_lexer.TokenKind.BRACE_R),loc:loc(lexer,start)}}(lexer,isConst);case _lexer.TokenKind.INT:return lexer.advance(),{kind:_kinds.Kind.INT,value:token.value,loc:loc(lexer,token)};case _lexer.TokenKind.FLOAT:return lexer.advance(),{kind:_kinds.Kind.FLOAT,value:token.value,loc:loc(lexer,token)};case _lexer.TokenKind.STRING:case _lexer.TokenKind.BLOCK_STRING:return parseStringLiteral(lexer);case _lexer.TokenKind.NAME:return"true"===token.value||"false"===token.value?(lexer.advance(),{kind:_kinds.Kind.BOOLEAN,value:"true"===token.value,loc:loc(lexer,token)}):"null"===token.value?(lexer.advance(),{kind:_kinds.Kind.NULL,loc:loc(lexer,token)}):(lexer.advance(),{kind:_kinds.Kind.ENUM,value:token.value,loc:loc(lexer,token)});case _lexer.TokenKind.DOLLAR:if(!isConst)return parseVariable(lexer)}throw unexpected(lexer)}function parseStringLiteral(lexer){var token=lexer.token;return lexer.advance(),{kind:_kinds.Kind.STRING,value:token.value,block:token.kind===_lexer.TokenKind.BLOCK_STRING,loc:loc(lexer,token)}}function parseConstValue(lexer){return parseValueLiteral(lexer,!0)}function parseValueValue(lexer){return parseValueLiteral(lexer,!1)}function parseObjectField(lexer,isConst){var start=lexer.token,name=parseName(lexer);return expectToken(lexer,_lexer.TokenKind.COLON),{kind:_kinds.Kind.OBJECT_FIELD,name:name,value:parseValueLiteral(lexer,isConst),loc:loc(lexer,start)}}function parseDirectives(lexer,isConst){for(var directives=[];peek(lexer,_lexer.TokenKind.AT);)directives.push(parseDirective(lexer,isConst));return directives}function parseDirective(lexer,isConst){var start=lexer.token;return expectToken(lexer,_lexer.TokenKind.AT),{kind:_kinds.Kind.DIRECTIVE,name:parseName(lexer),arguments:parseArguments(lexer,isConst),loc:loc(lexer,start)}}function parseTypeReference(lexer){var type,start=lexer.token;return type=expectOptionalToken(lexer,_lexer.TokenKind.BRACKET_L)?(type=parseTypeReference(lexer),expectToken(lexer,_lexer.TokenKind.BRACKET_R),{kind:_kinds.Kind.LIST_TYPE,type:type,loc:loc(lexer,start)}):parseNamedType(lexer),expectOptionalToken(lexer,_lexer.TokenKind.BANG)?{kind:_kinds.Kind.NON_NULL_TYPE,type:type,loc:loc(lexer,start)}:type}function parseNamedType(lexer){var start=lexer.token;return{kind:_kinds.Kind.NAMED_TYPE,name:parseName(lexer),loc:loc(lexer,start)}}function parseTypeSystemDefinition(lexer){var keywordToken=peekDescription(lexer)?lexer.lookahead():lexer.token;if(keywordToken.kind===_lexer.TokenKind.NAME)switch(keywordToken.value){case"schema":return function(lexer){var start=lexer.token;expectKeyword(lexer,"schema");var directives=parseDirectives(lexer,!0),operationTypes=many(lexer,_lexer.TokenKind.BRACE_L,parseOperationTypeDefinition,_lexer.TokenKind.BRACE_R);return{kind:_kinds.Kind.SCHEMA_DEFINITION,directives:directives,operationTypes:operationTypes,loc:loc(lexer,start)}}(lexer);case"scalar":return function(lexer){var start=lexer.token,description=parseDescription(lexer);expectKeyword(lexer,"scalar");var name=parseName(lexer),directives=parseDirectives(lexer,!0);return{kind:_kinds.Kind.SCALAR_TYPE_DEFINITION,description:description,name:name,directives:directives,loc:loc(lexer,start)}}(lexer);case"type":return function(lexer){var start=lexer.token,description=parseDescription(lexer);expectKeyword(lexer,"type");var name=parseName(lexer),interfaces=parseImplementsInterfaces(lexer),directives=parseDirectives(lexer,!0),fields=parseFieldsDefinition(lexer);return{kind:_kinds.Kind.OBJECT_TYPE_DEFINITION,description:description,name:name,interfaces:interfaces,directives:directives,fields:fields,loc:loc(lexer,start)}}(lexer);case"interface":return function(lexer){var start=lexer.token,description=parseDescription(lexer);expectKeyword(lexer,"interface");var name=parseName(lexer),directives=parseDirectives(lexer,!0),fields=parseFieldsDefinition(lexer);return{kind:_kinds.Kind.INTERFACE_TYPE_DEFINITION,description:description,name:name,directives:directives,fields:fields,loc:loc(lexer,start)}}(lexer);case"union":return function(lexer){var start=lexer.token,description=parseDescription(lexer);expectKeyword(lexer,"union");var name=parseName(lexer),directives=parseDirectives(lexer,!0),types=parseUnionMemberTypes(lexer);return{kind:_kinds.Kind.UNION_TYPE_DEFINITION,description:description,name:name,directives:directives,types:types,loc:loc(lexer,start)}}(lexer);case"enum":return function(lexer){var start=lexer.token,description=parseDescription(lexer);expectKeyword(lexer,"enum");var name=parseName(lexer),directives=parseDirectives(lexer,!0),values=parseEnumValuesDefinition(lexer);return{kind:_kinds.Kind.ENUM_TYPE_DEFINITION,description:description,name:name,directives:directives,values:values,loc:loc(lexer,start)}}(lexer);case"input":return function(lexer){var start=lexer.token,description=parseDescription(lexer);expectKeyword(lexer,"input");var name=parseName(lexer),directives=parseDirectives(lexer,!0),fields=parseInputFieldsDefinition(lexer);return{kind:_kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:description,name:name,directives:directives,fields:fields,loc:loc(lexer,start)}}(lexer);case"directive":return function(lexer){var start=lexer.token,description=parseDescription(lexer);expectKeyword(lexer,"directive"),expectToken(lexer,_lexer.TokenKind.AT);var name=parseName(lexer),args=parseArgumentDefs(lexer);expectKeyword(lexer,"on");var locations=function(lexer){expectOptionalToken(lexer,_lexer.TokenKind.PIPE);var locations=[];for(;locations.push(parseDirectiveLocation(lexer)),expectOptionalToken(lexer,_lexer.TokenKind.PIPE););return locations}(lexer);return{kind:_kinds.Kind.DIRECTIVE_DEFINITION,description:description,name:name,arguments:args,locations:locations,loc:loc(lexer,start)}}(lexer)}throw unexpected(lexer,keywordToken)}function peekDescription(lexer){return peek(lexer,_lexer.TokenKind.STRING)||peek(lexer,_lexer.TokenKind.BLOCK_STRING)}function parseDescription(lexer){if(peekDescription(lexer))return parseStringLiteral(lexer)}function parseOperationTypeDefinition(lexer){var start=lexer.token,operation=parseOperationType(lexer);expectToken(lexer,_lexer.TokenKind.COLON);var type=parseNamedType(lexer);return{kind:_kinds.Kind.OPERATION_TYPE_DEFINITION,operation:operation,type:type,loc:loc(lexer,start)}}function parseImplementsInterfaces(lexer){var types=[];if(expectOptionalKeyword(lexer,"implements"))for(expectOptionalToken(lexer,_lexer.TokenKind.AMP);types.push(parseNamedType(lexer)),expectOptionalToken(lexer,_lexer.TokenKind.AMP)||lexer.options.allowLegacySDLImplementsInterfaces&&peek(lexer,_lexer.TokenKind.NAME););return types}function parseFieldsDefinition(lexer){return lexer.options.allowLegacySDLEmptyFields&&peek(lexer,_lexer.TokenKind.BRACE_L)&&lexer.lookahead().kind===_lexer.TokenKind.BRACE_R?(lexer.advance(),lexer.advance(),[]):peek(lexer,_lexer.TokenKind.BRACE_L)?many(lexer,_lexer.TokenKind.BRACE_L,parseFieldDefinition,_lexer.TokenKind.BRACE_R):[]}function parseFieldDefinition(lexer){var start=lexer.token,description=parseDescription(lexer),name=parseName(lexer),args=parseArgumentDefs(lexer);expectToken(lexer,_lexer.TokenKind.COLON);var type=parseTypeReference(lexer),directives=parseDirectives(lexer,!0);return{kind:_kinds.Kind.FIELD_DEFINITION,description:description,name:name,arguments:args,type:type,directives:directives,loc:loc(lexer,start)}}function parseArgumentDefs(lexer){return peek(lexer,_lexer.TokenKind.PAREN_L)?many(lexer,_lexer.TokenKind.PAREN_L,parseInputValueDef,_lexer.TokenKind.PAREN_R):[]}function parseInputValueDef(lexer){var start=lexer.token,description=parseDescription(lexer),name=parseName(lexer);expectToken(lexer,_lexer.TokenKind.COLON);var defaultValue,type=parseTypeReference(lexer);expectOptionalToken(lexer,_lexer.TokenKind.EQUALS)&&(defaultValue=parseConstValue(lexer));var directives=parseDirectives(lexer,!0);return{kind:_kinds.Kind.INPUT_VALUE_DEFINITION,description:description,name:name,type:type,defaultValue:defaultValue,directives:directives,loc:loc(lexer,start)}}function parseUnionMemberTypes(lexer){var types=[];if(expectOptionalToken(lexer,_lexer.TokenKind.EQUALS))for(expectOptionalToken(lexer,_lexer.TokenKind.PIPE);types.push(parseNamedType(lexer)),expectOptionalToken(lexer,_lexer.TokenKind.PIPE););return types}function parseEnumValuesDefinition(lexer){return peek(lexer,_lexer.TokenKind.BRACE_L)?many(lexer,_lexer.TokenKind.BRACE_L,parseEnumValueDefinition,_lexer.TokenKind.BRACE_R):[]}function parseEnumValueDefinition(lexer){var start=lexer.token,description=parseDescription(lexer),name=parseName(lexer),directives=parseDirectives(lexer,!0);return{kind:_kinds.Kind.ENUM_VALUE_DEFINITION,description:description,name:name,directives:directives,loc:loc(lexer,start)}}function parseInputFieldsDefinition(lexer){return peek(lexer,_lexer.TokenKind.BRACE_L)?many(lexer,_lexer.TokenKind.BRACE_L,parseInputValueDef,_lexer.TokenKind.BRACE_R):[]}function parseDirectiveLocation(lexer){var start=lexer.token,name=parseName(lexer);if(_directiveLocation.DirectiveLocation.hasOwnProperty(name.value))return name;throw unexpected(lexer,start)}function loc(lexer,startToken){if(!lexer.options.noLocation)return new Loc(startToken,lexer.lastToken,lexer.source)}function Loc(startToken,endToken,source){this.start=startToken.start,this.end=endToken.end,this.startToken=startToken,this.endToken=endToken,this.source=source}function peek(lexer,kind){return lexer.token.kind===kind}function expectToken(lexer,kind){var token=lexer.token;if(token.kind===kind)return lexer.advance(),token;throw(0,_error.syntaxError)(lexer.source,token.start,"Expected ".concat(kind,", found ").concat((0,_lexer.getTokenDesc)(token)))}function expectOptionalToken(lexer,kind){var token=lexer.token;if(token.kind===kind)return lexer.advance(),token}function expectKeyword(lexer,value){var token=lexer.token;if(token.kind===_lexer.TokenKind.NAME&&token.value===value)return lexer.advance(),token;throw(0,_error.syntaxError)(lexer.source,token.start,'Expected "'.concat(value,'", found ').concat((0,_lexer.getTokenDesc)(token)))}function expectOptionalKeyword(lexer,value){var token=lexer.token;if(token.kind===_lexer.TokenKind.NAME&&token.value===value)return lexer.advance(),token}function unexpected(lexer,atToken){var token=atToken||lexer.token;return(0,_error.syntaxError)(lexer.source,token.start,"Unexpected ".concat((0,_lexer.getTokenDesc)(token)))}function any(lexer,openKind,parseFn,closeKind){expectToken(lexer,openKind);for(var nodes=[];!expectOptionalToken(lexer,closeKind);)nodes.push(parseFn(lexer));return nodes}function many(lexer,openKind,parseFn,closeKind){expectToken(lexer,openKind);for(var nodes=[parseFn(lexer)];!expectOptionalToken(lexer,closeKind);)nodes.push(parseFn(lexer));return nodes}(0,_defineToJSON.default)(Loc,function(){return{start:this.start,end:this.end}})},{"../error":56,"../jsutils/defineToJSON":60,"../jsutils/inspect":62,"./directiveLocation":66,"./kinds":67,"./lexer":68,"./source":72}],71:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.print=function(ast){return(0,_visitor.visit)(ast,{leave:printDocASTReducer})};var _visitor=require("./visitor"),_blockString=require("./blockString");var printDocASTReducer={Name:function(node){return node.value},Variable:function(node){return"$"+node.name},Document:function(node){return join(node.definitions,"\n\n")+"\n"},OperationDefinition:function(node){var op=node.operation,name=node.name,varDefs=wrap("(",join(node.variableDefinitions,", "),")"),directives=join(node.directives," "),selectionSet=node.selectionSet;return name||directives||varDefs||"query"!==op?join([op,join([name,varDefs]),directives,selectionSet]," "):selectionSet},VariableDefinition:function(_ref){var variable=_ref.variable,type=_ref.type,defaultValue=_ref.defaultValue,directives=_ref.directives;return variable+": "+type+wrap(" = ",defaultValue)+wrap(" ",join(directives," "))},SelectionSet:function(_ref2){return block(_ref2.selections)},Field:function(_ref3){var alias=_ref3.alias,name=_ref3.name,args=_ref3.arguments,directives=_ref3.directives,selectionSet=_ref3.selectionSet;return join([wrap("",alias,": ")+name+wrap("(",join(args,", "),")"),join(directives," "),selectionSet]," ")},Argument:function(_ref4){return _ref4.name+": "+_ref4.value},FragmentSpread:function(_ref5){return"..."+_ref5.name+wrap(" ",join(_ref5.directives," "))},InlineFragment:function(_ref6){var typeCondition=_ref6.typeCondition,directives=_ref6.directives,selectionSet=_ref6.selectionSet;return join(["...",wrap("on ",typeCondition),join(directives," "),selectionSet]," ")},FragmentDefinition:function(_ref7){var name=_ref7.name,typeCondition=_ref7.typeCondition,variableDefinitions=_ref7.variableDefinitions,directives=_ref7.directives,selectionSet=_ref7.selectionSet;return"fragment ".concat(name).concat(wrap("(",join(variableDefinitions,", "),")")," ")+"on ".concat(typeCondition," ").concat(wrap("",join(directives," ")," "))+selectionSet},IntValue:function(_ref8){return _ref8.value},FloatValue:function(_ref9){return _ref9.value},StringValue:function(_ref10,key){var value=_ref10.value;return _ref10.block?(0,_blockString.printBlockString)(value,"description"===key?"":" "):JSON.stringify(value)},BooleanValue:function(_ref11){return _ref11.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(_ref12){return _ref12.value},ListValue:function(_ref13){return"["+join(_ref13.values,", ")+"]"},ObjectValue:function(_ref14){return"{"+join(_ref14.fields,", ")+"}"},ObjectField:function(_ref15){return _ref15.name+": "+_ref15.value},Directive:function(_ref16){return"@"+_ref16.name+wrap("(",join(_ref16.arguments,", "),")")},NamedType:function(_ref17){return _ref17.name},ListType:function(_ref18){return"["+_ref18.type+"]"},NonNullType:function(_ref19){return _ref19.type+"!"},SchemaDefinition:function(_ref20){var directives=_ref20.directives,operationTypes=_ref20.operationTypes;return join(["schema",join(directives," "),block(operationTypes)]," ")},OperationTypeDefinition:function(_ref21){return _ref21.operation+": "+_ref21.type},ScalarTypeDefinition:addDescription(function(_ref22){return join(["scalar",_ref22.name,join(_ref22.directives," ")]," ")}),ObjectTypeDefinition:addDescription(function(_ref23){var name=_ref23.name,interfaces=_ref23.interfaces,directives=_ref23.directives,fields=_ref23.fields;return join(["type",name,wrap("implements ",join(interfaces," & ")),join(directives," "),block(fields)]," ")}),FieldDefinition:addDescription(function(_ref24){var name=_ref24.name,args=_ref24.arguments,type=_ref24.type,directives=_ref24.directives;return name+(hasMultilineItems(args)?wrap("(\n",indent(join(args,"\n")),"\n)"):wrap("(",join(args,", "),")"))+": "+type+wrap(" ",join(directives," "))}),InputValueDefinition:addDescription(function(_ref25){var name=_ref25.name,type=_ref25.type,defaultValue=_ref25.defaultValue,directives=_ref25.directives;return join([name+": "+type,wrap("= ",defaultValue),join(directives," ")]," ")}),InterfaceTypeDefinition:addDescription(function(_ref26){var name=_ref26.name,directives=_ref26.directives,fields=_ref26.fields;return join(["interface",name,join(directives," "),block(fields)]," ")}),UnionTypeDefinition:addDescription(function(_ref27){var name=_ref27.name,directives=_ref27.directives,types=_ref27.types;return join(["union",name,join(directives," "),types&&0!==types.length?"= "+join(types," | "):""]," ")}),EnumTypeDefinition:addDescription(function(_ref28){var name=_ref28.name,directives=_ref28.directives,values=_ref28.values;return join(["enum",name,join(directives," "),block(values)]," ")}),EnumValueDefinition:addDescription(function(_ref29){return join([_ref29.name,join(_ref29.directives," ")]," ")}),InputObjectTypeDefinition:addDescription(function(_ref30){var name=_ref30.name,directives=_ref30.directives,fields=_ref30.fields;return join(["input",name,join(directives," "),block(fields)]," ")}),DirectiveDefinition:addDescription(function(_ref31){var name=_ref31.name,args=_ref31.arguments,locations=_ref31.locations;return"directive @"+name+(hasMultilineItems(args)?wrap("(\n",indent(join(args,"\n")),"\n)"):wrap("(",join(args,", "),")"))+" on "+join(locations," | ")}),SchemaExtension:function(_ref32){var directives=_ref32.directives,operationTypes=_ref32.operationTypes;return join(["extend schema",join(directives," "),block(operationTypes)]," ")},ScalarTypeExtension:function(_ref33){return join(["extend scalar",_ref33.name,join(_ref33.directives," ")]," ")},ObjectTypeExtension:function(_ref34){var name=_ref34.name,interfaces=_ref34.interfaces,directives=_ref34.directives,fields=_ref34.fields;return join(["extend type",name,wrap("implements ",join(interfaces," & ")),join(directives," "),block(fields)]," ")},InterfaceTypeExtension:function(_ref35){var name=_ref35.name,directives=_ref35.directives,fields=_ref35.fields;return join(["extend interface",name,join(directives," "),block(fields)]," ")},UnionTypeExtension:function(_ref36){var name=_ref36.name,directives=_ref36.directives,types=_ref36.types;return join(["extend union",name,join(directives," "),types&&0!==types.length?"= "+join(types," | "):""]," ")},EnumTypeExtension:function(_ref37){var name=_ref37.name,directives=_ref37.directives,values=_ref37.values;return join(["extend enum",name,join(directives," "),block(values)]," ")},InputObjectTypeExtension:function(_ref38){var name=_ref38.name,directives=_ref38.directives,fields=_ref38.fields;return join(["extend input",name,join(directives," "),block(fields)]," ")}};function addDescription(cb){return function(node){return join([node.description,cb(node)],"\n")}}function join(maybeArray,separator){return maybeArray?maybeArray.filter(function(x){return x}).join(separator||""):""}function block(array){return array&&0!==array.length?"{\n"+indent(join(array,"\n"))+"\n}":""}function wrap(start,maybeString,end){return maybeString?start+maybeString+(end||""):""}function indent(maybeString){return maybeString&&" "+maybeString.replace(/\n/g,"\n ")}function isMultiline(string){return-1!==string.indexOf("\n")}function hasMultilineItems(maybeArray){return maybeArray&&maybeArray.some(isMultiline)}},{"./blockString":65,"./visitor":73}],72:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Source=void 0;var _invariant=_interopRequireDefault(require("../jsutils/invariant")),_defineToStringTag=_interopRequireDefault(require("../jsutils/defineToStringTag"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var Source=function(body,name,locationOffset){this.body=body,this.name=name||"GraphQL request",this.locationOffset=locationOffset||{line:1,column:1},0<this.locationOffset.line||(0,_invariant.default)(0,"line in locationOffset is 1-indexed and must be positive"),0<this.locationOffset.column||(0,_invariant.default)(0,"column in locationOffset is 1-indexed and must be positive")};exports.Source=Source,(0,_defineToStringTag.default)(Source)},{"../jsutils/defineToStringTag":61,"../jsutils/invariant":63}],73:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.visit=function(root,visitor){var visitorKeys=2<arguments.length&&void 0!==arguments[2]?arguments[2]:QueryDocumentKeys,stack=void 0,inArray=Array.isArray(root),keys=[root],index=-1,edits=[],node=void 0,key=void 0,parent=void 0,path=[],ancestors=[],newRoot=root;do{var isLeaving=++index===keys.length,isEdited=isLeaving&&0!==edits.length;if(isLeaving){if(key=0===ancestors.length?void 0:path[path.length-1],node=parent,parent=ancestors.pop(),isEdited){if(inArray)node=node.slice();else{for(var clone={},_arr=Object.keys(node),_i=0;_i<_arr.length;_i++){var k=_arr[_i];clone[k]=node[k]}node=clone}for(var editOffset=0,ii=0;ii<edits.length;ii++){var editKey=edits[ii][0],editValue=edits[ii][1];inArray&&(editKey-=editOffset),inArray&&null===editValue?(node.splice(editKey,1),editOffset++):node[editKey]=editValue}}index=stack.index,keys=stack.keys,edits=stack.edits,inArray=stack.inArray,stack=stack.prev}else{if(key=parent?inArray?index:keys[index]:void 0,null==(node=parent?parent[key]:newRoot))continue;parent&&path.push(key)}var result=void 0;if(!Array.isArray(node)){if(!isNode(node))throw new Error("Invalid AST Node: "+(0,_inspect.default)(node));var visitFn=getVisitFn(visitor,node.kind,isLeaving);if(visitFn){if((result=visitFn.call(visitor,node,key,parent,path,ancestors))===BREAK)break;if(!1===result){if(!isLeaving){path.pop();continue}}else if(void 0!==result&&(edits.push([key,result]),!isLeaving)){if(!isNode(result)){path.pop();continue}node=result}}}void 0===result&&isEdited&&edits.push([key,node]),isLeaving?path.pop():(stack={inArray:inArray,index:index,keys:keys,edits:edits,prev:stack},inArray=Array.isArray(node),keys=inArray?node:visitorKeys[node.kind]||[],index=-1,edits=[],parent&&ancestors.push(parent),parent=node)}while(void 0!==stack);0!==edits.length&&(newRoot=edits[edits.length-1][1]);return newRoot},exports.visitInParallel=function(visitors){var skipping=new Array(visitors.length);return{enter:function(node){for(var i=0;i<visitors.length;i++)if(!skipping[i]){var fn=getVisitFn(visitors[i],node.kind,!1);if(fn){var result=fn.apply(visitors[i],arguments);if(!1===result)skipping[i]=node;else if(result===BREAK)skipping[i]=BREAK;else if(void 0!==result)return result}}},leave:function(node){for(var i=0;i<visitors.length;i++)if(skipping[i])skipping[i]===node&&(skipping[i]=null);else{var fn=getVisitFn(visitors[i],node.kind,!0);if(fn){var result=fn.apply(visitors[i],arguments);if(result===BREAK)skipping[i]=BREAK;else if(void 0!==result&&!1!==result)return result}}}}},exports.visitWithTypeInfo=function(typeInfo,visitor){return{enter:function(node){typeInfo.enter(node);var fn=getVisitFn(visitor,node.kind,!1);if(fn){var result=fn.apply(visitor,arguments);return void 0!==result&&(typeInfo.leave(node),isNode(result)&&typeInfo.enter(result)),result}},leave:function(node){var result,fn=getVisitFn(visitor,node.kind,!0);return fn&&(result=fn.apply(visitor,arguments)),typeInfo.leave(node),result}}},exports.getVisitFn=getVisitFn,exports.BREAK=exports.QueryDocumentKeys=void 0;var obj,_inspect=(obj=require("../jsutils/inspect"))&&obj.__esModule?obj:{default:obj};var QueryDocumentKeys={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};exports.QueryDocumentKeys=QueryDocumentKeys;var BREAK={};function isNode(maybeNode){return Boolean(maybeNode&&"string"==typeof maybeNode.kind)}function getVisitFn(visitor,kind,isLeaving){var kindVisitor=visitor[kind];if(kindVisitor){if(!isLeaving&&"function"==typeof kindVisitor)return kindVisitor;var kindSpecificVisitor=isLeaving?kindVisitor.leave:kindVisitor.enter;if("function"==typeof kindSpecificVisitor)return kindSpecificVisitor}else{var specificVisitor=isLeaving?visitor.leave:visitor.enter;if(specificVisitor){if("function"==typeof specificVisitor)return specificVisitor;var specificKindVisitor=specificVisitor[kind];if("function"==typeof specificKindVisitor)return specificKindVisitor}}}exports.BREAK=BREAK},{"../jsutils/inspect":62}],74:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;0<nBits;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;0<nBits;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),2<=(value+=1<=e+eBias?rt/c:rt*Math.pow(2,1-eBias))*c&&(e++,c/=2),eMax<=e+eBias?(m=0,e=eMax):1<=e+eBias?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));8<=mLen;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<<mLen|m,eLen+=mLen;0<eLen;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],75:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var useSymbol="function"==typeof Symbol&&"function"==typeof Symbol.for,brand=useSymbol?Symbol.for("immutable-tuple"):"@@__IMMUTABLE_TUPLE__@@",globalKey=useSymbol?Symbol.for("immutable-tuple-root"):"@@__IMMUTABLE_TUPLE_ROOT__@@";function def(obj,name,value,enumerable){return Object.defineProperty(obj,name,{value:value,enumerable:!!enumerable,writable:!1,configurable:!1}),value}var freeze=Object.freeze||function(obj){return obj};function isObjRef(value){switch(typeof value){case"object":if(null===value)return!1;case"function":return!0;default:return!1}}var UniversalWeakMap=function(){this._weakMap=null,this._strongMap=null,this.data=null};UniversalWeakMap.prototype.get=function(key){var map=this._getMap(key,!1);if(map)return map.get(key)},UniversalWeakMap.prototype.set=function(key,value){return this._getMap(key,!0).set(key,value),value},UniversalWeakMap.prototype._getMap=function(key,canCreate){return canCreate?isObjRef(key)?this._weakMap||(this._weakMap=new WeakMap):this._strongMap||(this._strongMap=new Map):isObjRef(key)?this._weakMap:this._strongMap};var root=Array[globalKey]||def(Array,globalKey,new UniversalWeakMap,!1);function lookup(){return lookupArray(arguments)}function lookupArray(array){for(var node=root,len=array.length,i=0;i<len;++i){var item=array[i];node=node.get(item)||node.set(item,new UniversalWeakMap)}return node.data||(node.data=Object.create(null))}function tuple(){var arguments$1=arguments,node=lookup.apply(null,arguments);if(node.tuple)return node.tuple;for(var t=Object.create(tuple.prototype),argc=arguments.length,i=0;i<argc;++i)t[i]=arguments$1[i];return def(t,"length",argc,!1),freeze(node.tuple=t)}function isTuple(that){return!(!that||!0!==that[brand])}function toArray(tuple){for(var array=[],i=tuple.length;i--;)array[i]=tuple[i];return array}def(tuple.prototype,brand,!0,!1),tuple.isTuple=isTuple,function(fn){function call(name,mustConvertThisToArray){var desc=Object.getOwnPropertyDescriptor(Array.prototype,name);fn(name,desc,!!mustConvertThisToArray)}call("every"),call("filter"),call("find"),call("findIndex"),call("forEach"),call("includes"),call("indexOf"),call("join"),call("lastIndexOf"),call("map"),call("reduce"),call("reduceRight"),call("slice"),call("some"),call("toLocaleString"),call("toString"),call("reverse",!0),call("sort",!0),call(useSymbol&&Symbol.iterator||"@@iterator")}(function(name,desc,mustConvertThisToArray){var method=desc&&desc.value;"function"==typeof method&&(desc.value=function(){for(var args=[],len=arguments.length;len--;)args[len]=arguments[len];var result=method.apply(mustConvertThisToArray?toArray(this):this,args);return Array.isArray(result)?tuple.apply(void 0,result):result},Object.defineProperty(tuple.prototype,name,desc))});var concat=Array.prototype.concat;tuple.prototype.concat=function(){for(var args=[],len=arguments.length;len--;)args[len]=arguments[len];return tuple.apply(void 0,concat.apply(toArray(this),args.map(function(item){return isTuple(item)?toArray(item):item})))},exports.default=tuple,exports.tuple=tuple,exports.lookup=lookup,exports.lookupArray=lookupArray},{}],76:[function(require,module,exports){(function(global){"use strict";var root="undefined"!=typeof window?window:void 0!==global?global:{};module.exports=function(key,value){if(key in root)return root[key];return root[key]=value}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],77:[function(require,module,exports){"use strict";var Individual=require("./index.js");module.exports=function(moduleName,version,defaultValue){var key="__INDIVIDUAL_ONE_VERSION_"+moduleName,versionValue=Individual(key+"_ENFORCE_SINGLETON",version);if(versionValue===version)return Individual(key,defaultValue);throw new Error("Can only have one copy of "+moduleName+".\nYou already have version "+versionValue+" installed.\nThis means you cannot install version "+version)}},{"./index.js":76}],78:[function(require,module,exports){function isBuffer(obj){return!!obj.constructor&&"function"==typeof obj.constructor.isBuffer&&obj.constructor.isBuffer(obj)}module.exports=function(obj){return null!=obj&&(isBuffer(obj)||function(obj){return"function"==typeof obj.readFloatLE&&"function"==typeof obj.slice&&isBuffer(obj.slice(0,0))}(obj)||!!obj._isBuffer)}},{}],79:[function(require,module,exports){"use strict";module.exports=function(x){return"object"==typeof x&&null!==x}},{}],80:[function(require,module,exports){"use strict";var Geohash={base32:"0123456789bcdefghjkmnpqrstuvwxyz",encode:function(lat,lon,precision){if(void 0===precision){for(var p=1;p<=12;p++){var hash=Geohash.encode(lat,lon,p),posn=Geohash.decode(hash);if(posn.lat==lat&&posn.lon==lon)return hash}precision=12}if(lat=Number(lat),lon=Number(lon),precision=Number(precision),isNaN(lat)||isNaN(lon)||isNaN(precision))throw new Error("Invalid geohash");for(var idx=0,bit=0,evenBit=!0,geohash="",latMin=-90,latMax=90,lonMin=-180,lonMax=180;geohash.length<precision;){if(evenBit){var lonMid=(lonMin+lonMax)/2;lonMid<=lon?(idx=2*idx+1,lonMin=lonMid):(idx*=2,lonMax=lonMid)}else{var latMid=(latMin+latMax)/2;latMid<=lat?(idx=2*idx+1,latMin=latMid):(idx*=2,latMax=latMid)}evenBit=!evenBit,5==++bit&&(geohash+=Geohash.base32.charAt(idx),idx=bit=0)}return geohash},decode:function(geohash){var bounds=Geohash.bounds(geohash),latMin=bounds.sw.lat,lonMin=bounds.sw.lon,latMax=bounds.ne.lat,lonMax=bounds.ne.lon,lat=(latMin+latMax)/2,lon=(lonMin+lonMax)/2;return lat=lat.toFixed(Math.floor(2-Math.log(latMax-latMin)/Math.LN10)),lon=lon.toFixed(Math.floor(2-Math.log(lonMax-lonMin)/Math.LN10)),{lat:Number(lat),lon:Number(lon)}},bounds:function(geohash){if(0===geohash.length)throw new Error("Invalid geohash");geohash=geohash.toLowerCase();for(var evenBit=!0,latMin=-90,latMax=90,lonMin=-180,lonMax=180,i=0;i<geohash.length;i++){var chr=geohash.charAt(i),idx=Geohash.base32.indexOf(chr);if(-1==idx)throw new Error("Invalid geohash");for(var n=4;0<=n;n--){var bitN=idx>>n&1;if(evenBit){var lonMid=(lonMin+lonMax)/2;1==bitN?lonMin=lonMid:lonMax=lonMid}else{var latMid=(latMin+latMax)/2;1==bitN?latMin=latMid:latMax=latMid}evenBit=!evenBit}}return{sw:{lat:latMin,lon:lonMin},ne:{lat:latMax,lon:lonMax}}},adjacent:function(geohash,direction){if(geohash=geohash.toLowerCase(),direction=direction.toLowerCase(),0===geohash.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(direction))throw new Error("Invalid direction");var lastCh=geohash.slice(-1),parent=geohash.slice(0,-1),type=geohash.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[direction][type].indexOf(lastCh)&&""!==parent&&(parent=Geohash.adjacent(parent,direction)),parent+Geohash.base32.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[direction][type].indexOf(lastCh))},neighbours:function(geohash){return{n:Geohash.adjacent(geohash,"n"),ne:Geohash.adjacent(Geohash.adjacent(geohash,"n"),"e"),e:Geohash.adjacent(geohash,"e"),se:Geohash.adjacent(Geohash.adjacent(geohash,"s"),"e"),s:Geohash.adjacent(geohash,"s"),sw:Geohash.adjacent(Geohash.adjacent(geohash,"s"),"w"),w:Geohash.adjacent(geohash,"w"),nw:Geohash.adjacent(Geohash.adjacent(geohash,"n"),"w")}}};void 0!==module&&module.exports&&(module.exports=Geohash)},{}],81:[function(require,module,exports){"use strict";function Cache(options){this.map=new Map,this.newest=null,this.oldest=null,this.max=options&&options.max,this.dispose=options&&options.dispose}var Cp=(exports.Cache=Cache).prototype;function getEntry(cache,key){var entry=cache.map.get(key);if(entry&&entry!==cache.newest){var older=entry.older,newer=entry.newer;newer&&(newer.older=older),older&&(older.newer=newer),entry.older=cache.newest,(entry.older.newer=entry).newer=null,(cache.newest=entry)===cache.oldest&&(cache.oldest=newer)}return entry}Cp.has=function(key){return this.map.has(key)},Cp.get=function(key){var entry=getEntry(this,key);return entry&&entry.value},Cp.set=function(key,value){var entry=getEntry(this,key);return entry?entry.value=value:(entry={key:key,value:value,newer:null,older:this.newest},this.newest&&(this.newest.newer=entry),this.newest=entry,this.oldest=this.oldest||entry,this.map.set(key,entry),entry.value)},Cp.clean=function(){if("number"==typeof this.max)for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},Cp.delete=function(key){var entry=this.map.get(key);return!!entry&&(entry===this.newest&&(this.newest=entry.older),entry===this.oldest&&(this.oldest=entry.newer),entry.newer&&(entry.newer.older=entry.older),entry.older&&(entry.older.newer=entry.newer),this.map.delete(key),"function"==typeof this.dispose&&this.dispose(key,entry.value),!0)}},{}],82:[function(require,module,exports){"use strict";var getLocal=require("./local.js").get,UNKNOWN_VALUE=Object.create(null),emptySetPool=[],entryPool=[];function assert(condition,optionalMessage){if(!condition)throw new Error(optionalMessage||"assertion failure")}function Entry(fn,key,args){this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,reset(this,fn,key,args),++Entry.count}function reset(entry,fn,key,args){entry.fn=fn,entry.key=key,entry.args=args,entry.value=UNKNOWN_VALUE,entry.dirty=!0,entry.subscribe=null,entry.unsubscribe=null,entry.recomputing=!1,entry.reportOrphan=null}exports.POOL_TARGET_SIZE=100,Entry.count=0,Entry.acquire=function(fn,key,args){var entry=entryPool.pop();return entry?(reset(entry,fn,key,args),entry):new Entry(fn,key,args)};var Ep=(exports.Entry=Entry).prototype;function maybeReportOrphan(entry){var report=entry.reportOrphan;return"function"==typeof report&&0===entry.parents.size&&!0===report(entry)}function reportDirty(entry){entry.parents.forEach(function(parent){reportDirtyChild(parent,entry)})}function reportClean(entry){entry.parents.forEach(function(parent){reportCleanChild(parent,entry)})}function mightBeDirty(entry){return entry.dirty||entry.dirtyChildren&&entry.dirtyChildren.size}function reportDirtyChild(entry,child){if(assert(entry.childValues.has(child)),assert(mightBeDirty(child)),entry.dirtyChildren){if(entry.dirtyChildren.has(child))return}else entry.dirtyChildren=emptySetPool.pop()||new Set;entry.dirtyChildren.add(child),reportDirty(entry)}function reportCleanChild(entry,child){var cv=entry.childValues;assert(cv.has(child)),assert(!mightBeDirty(child));var childValue=cv.get(child);childValue===UNKNOWN_VALUE?cv.set(child,child.value):childValue!==child.value&&entry.setDirty(),removeDirtyChild(entry,child),mightBeDirty(entry)||reportClean(entry)}function removeDirtyChild(entry,child){var dc=entry.dirtyChildren;dc&&(dc.delete(child),0===dc.size&&(emptySetPool.length<exports.POOL_TARGET_SIZE&&emptySetPool.push(dc),entry.dirtyChildren=null))}function reallyRecompute(entry){assert(!entry.recomputing,"already recomputing"),entry.recomputing=!0;var originalChildren=forgetChildren(entry),local=getLocal(),parent=local.currentParentEntry;local.currentParentEntry=entry;var threw=!0;try{entry.value=entry.fn.apply(null,entry.args),threw=!1}finally{entry.recomputing=!1,assert(local.currentParentEntry===entry),local.currentParentEntry=parent,threw||!function(entry){if("function"==typeof entry.subscribe)try{unsubscribe(entry),entry.unsubscribe=entry.subscribe.apply(null,entry.args)}catch(e){return entry.setDirty(),!1}return!0}(entry)?entry.setDirty():function(entry){entry.dirty=!1,mightBeDirty(entry)||reportClean(entry)}(entry)}return originalChildren.forEach(maybeReportOrphan),entry.value}Ep.recompute=function(){if(function(entry){var parent=getLocal().currentParentEntry;if(parent)return entry.parents.add(parent),parent.childValues.has(entry)||parent.childValues.set(entry,UNKNOWN_VALUE),mightBeDirty(entry)?reportDirtyChild(parent,entry):reportCleanChild(parent,entry),parent}(this)||!maybeReportOrphan(this))return function recomputeIfDirty(entry){if(entry.dirty)return reallyRecompute(entry);if(mightBeDirty(entry)&&(entry.dirtyChildren.forEach(function(child){assert(entry.childValues.has(child));try{recomputeIfDirty(child)}catch(e){entry.setDirty()}}),entry.dirty))return reallyRecompute(entry);assert(entry.value!==UNKNOWN_VALUE);return entry.value}(this)},Ep.setDirty=function(){this.dirty||(this.dirty=!0,this.value=UNKNOWN_VALUE,reportDirty(this),unsubscribe(this))},Ep.dispose=function(){var entry=this;forgetChildren(entry).forEach(maybeReportOrphan),unsubscribe(entry),entry.parents.forEach(function(parent){parent.setDirty(),forgetChild(parent,entry)}),function(entry){assert(0===entry.parents.size),assert(0===entry.childValues.size),assert(null===entry.dirtyChildren),entryPool.length<exports.POOL_TARGET_SIZE&&entryPool.push(entry)}(entry)};var reusableEmptyArray=[];function forgetChildren(entry){var children=reusableEmptyArray;return 0<entry.childValues.size&&(children=[],entry.childValues.forEach(function(value,child){forgetChild(entry,child),children.push(child)})),assert(null===entry.dirtyChildren),children}function forgetChild(entry,child){child.parents.delete(entry),entry.childValues.delete(child),removeDirtyChild(entry,child)}function unsubscribe(entry){var unsub=entry.unsubscribe;"function"==typeof unsub&&(entry.unsubscribe=null,unsub())}},{"./local.js":84}],83:[function(require,module,exports){"use strict";var Cache=require("./cache.js").Cache,tuple=require("immutable-tuple").tuple,Entry=require("./entry.js").Entry,getLocal=require("./local.js").get;exports.defaultMakeCacheKey=tuple,exports.wrap=function(fn,options){var disposable=!!(options=function(options){return"function"!=typeof(options=options||Object.create(null)).makeCacheKey&&(options.makeCacheKey=tuple),"number"!=typeof options.max&&(options.max=Math.pow(2,16)),options}(options)).disposable,cache=new Cache({max:options.max,dispose:function(key,entry){entry.dispose()}});function reportOrphan(entry){if(disposable)return cache.delete(entry.key),!0}function optimistic(){if(!disposable||getLocal().currentParentEntry){var key=options.makeCacheKey.apply(null,arguments);if(!key)return fn.apply(null,arguments);for(var args=[],len=arguments.length;len--;)args[len]=arguments[len];var entry=cache.get(key);entry?entry.args=args:(cache.set(key,entry=Entry.acquire(fn,key,args)),entry.subscribe=options.subscribe,disposable&&(entry.reportOrphan=reportOrphan));var value=entry.recompute();return cache.set(key,entry),0===entry.parents.size&&cache.clean(),disposable?void 0:value}}return optimistic.dirty=function(){var key=options.makeCacheKey.apply(null,arguments);key&&cache.has(key)&&cache.get(key).setDirty()},optimistic}},{"./cache.js":81,"./entry.js":82,"./local.js":84,"immutable-tuple":75}],84:[function(require,module,exports){"use strict";var fakeNullFiber=new function(){};function getCurrentFiber(){return fakeNullFiber}if("object"==typeof module)try{var Fiber=module["eriuqer".split("").reverse().join("")]("fibers");getCurrentFiber=function(){return Fiber.current||fakeNullFiber}}catch(e){}exports.get=function(){var fiber=getCurrentFiber();return fiber._optimism_local||(fiber._optimism_local=Object.create(null))}},{}],85:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){for(var up=0,i=parts.length-1;0<=i;i--){var last=parts[i];"."===last?parts.splice(i,1):".."===last?(parts.splice(i,1),up++):up&&(parts.splice(i,1),up--)}if(allowAboveRoot)for(;up--;up)parts.unshift("..");return parts}function filter(xs,f){if(xs.filter)return xs.filter(f);for(var res=[],i=0;i<xs.length;i++)f(xs[i],i,xs)&&res.push(xs[i]);return res}exports.resolve=function(){for(var resolvedPath="",resolvedAbsolute=!1,i=arguments.length-1;-1<=i&&!resolvedAbsolute;i--){var path=0<=i?arguments[i]:process.cwd();if("string"!=typeof path)throw new TypeError("Arguments to path.resolve must be strings");path&&(resolvedPath=path+"/"+resolvedPath,resolvedAbsolute="/"===path.charAt(0))}return(resolvedAbsolute?"/":"")+(resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/"))||"."},exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash="/"===substr(path,-1);return(path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/"))||isAbsolute||(path="."),path&&trailingSlash&&(path+="/"),(isAbsolute?"/":"")+path},exports.isAbsolute=function(path){return"/"===path.charAt(0)},exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if("string"!=typeof p)throw new TypeError("Arguments to path.join must be strings");return p}).join("/"))},exports.relative=function(from,to){function trim(arr){for(var start=0;start<arr.length&&""===arr[start];start++);for(var end=arr.length-1;0<=end&&""===arr[end];end--);return end<start?[]:arr.slice(start,end-start+1)}from=exports.resolve(from).substr(1),to=exports.resolve(to).substr(1);for(var fromParts=trim(from.split("/")),toParts=trim(to.split("/")),length=Math.min(fromParts.length,toParts.length),samePartsLength=length,i=0;i<length;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}var outputParts=[];for(i=samePartsLength;i<fromParts.length;i++)outputParts.push("..");return(outputParts=outputParts.concat(toParts.slice(samePartsLength))).join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(path){if("string"!=typeof path&&(path+=""),0===path.length)return".";for(var code=path.charCodeAt(0),hasRoot=47===code,end=-1,matchedSlash=!0,i=path.length-1;1<=i;--i)if(47===(code=path.charCodeAt(i))){if(!matchedSlash){end=i;break}}else matchedSlash=!1;return-1===end?hasRoot?"/":".":hasRoot&&1===end?"/":path.slice(0,end)},exports.basename=function(path,ext){var f=function(path){"string"!=typeof path&&(path+="");var i,start=0,end=-1,matchedSlash=!0;for(i=path.length-1;0<=i;--i)if(47===path.charCodeAt(i)){if(!matchedSlash){start=i+1;break}}else-1===end&&(matchedSlash=!1,end=i+1);return-1===end?"":path.slice(start,end)}(path);return ext&&f.substr(-1*ext.length)===ext&&(f=f.substr(0,f.length-ext.length)),f},exports.extname=function(path){"string"!=typeof path&&(path+="");for(var startDot=-1,startPart=0,end=-1,matchedSlash=!0,preDotState=0,i=path.length-1;0<=i;--i){var code=path.charCodeAt(i);if(47===code){if(matchedSlash)continue;startPart=i+1;break}-1===end&&(matchedSlash=!1,end=i+1),46===code?-1===startDot?startDot=i:1!==preDotState&&(preDotState=1):-1!==startDot&&(preDotState=-1)}return-1===startDot||-1===end||0===preDotState||1===preDotState&&startDot===end-1&&startDot===startPart+1?"":path.slice(startDot,end)};var substr="b"==="ab".substr(-1)?function(str,start,len){return str.substr(start,len)}:function(str,start,len){return start<0&&(start=str.length+start),str.substr(start,len)}}).call(this,require("_process"))},{_process:47}],86:[function(require,module,exports){"use strict";module.exports=Pbf;var ieee754=require("ieee754");function Pbf(buf){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(buf)?buf:new Uint8Array(buf||0),this.pos=0,this.type=0,this.length=this.buf.length}Pbf.Varint=0,Pbf.Fixed64=1,Pbf.Bytes=2,Pbf.Fixed32=5;function readPackedEnd(pbf){return pbf.type===Pbf.Bytes?pbf.readVarint()+pbf.pos:pbf.pos+1}function toNum(low,high,isSigned){return isSigned?4294967296*high+(low>>>0):4294967296*(high>>>0)+(low>>>0)}function makeRoomForExtraLength(startPos,len,pbf){var extraLen=len<=16383?1:len<=2097151?2:len<=268435455?3:Math.floor(Math.log(len)/(7*Math.LN2));pbf.realloc(extraLen);for(var i=pbf.pos-1;startPos<=i;i--)pbf.buf[i+extraLen]=pbf.buf[i]}function writePackedVarint(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeVarint(arr[i])}function writePackedSVarint(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeSVarint(arr[i])}function writePackedFloat(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeFloat(arr[i])}function writePackedDouble(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeDouble(arr[i])}function writePackedBoolean(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeBoolean(arr[i])}function writePackedFixed32(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeFixed32(arr[i])}function writePackedSFixed32(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeSFixed32(arr[i])}function writePackedFixed64(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeFixed64(arr[i])}function writePackedSFixed64(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeSFixed64(arr[i])}function readUInt32(buf,pos){return(buf[pos]|buf[pos+1]<<8|buf[pos+2]<<16)+16777216*buf[pos+3]}function writeInt32(buf,val,pos){buf[pos]=val,buf[pos+1]=val>>>8,buf[pos+2]=val>>>16,buf[pos+3]=val>>>24}function readInt32(buf,pos){return(buf[pos]|buf[pos+1]<<8|buf[pos+2]<<16)+(buf[pos+3]<<24)}Pbf.prototype={destroy:function(){this.buf=null},readFields:function(readField,result,end){for(end=end||this.length;this.pos<end;){var val=this.readVarint(),tag=val>>3,startPos=this.pos;this.type=7&val,readField(tag,result,this),this.pos===startPos&&this.skip(val)}return result},readMessage:function(readField,result){return this.readFields(readField,result,this.readVarint()+this.pos)},readFixed32:function(){var val=readUInt32(this.buf,this.pos);return this.pos+=4,val},readSFixed32:function(){var val=readInt32(this.buf,this.pos);return this.pos+=4,val},readFixed64:function(){var val=readUInt32(this.buf,this.pos)+4294967296*readUInt32(this.buf,this.pos+4);return this.pos+=8,val},readSFixed64:function(){var val=readUInt32(this.buf,this.pos)+4294967296*readInt32(this.buf,this.pos+4);return this.pos+=8,val},readFloat:function(){var val=ieee754.read(this.buf,this.pos,!0,23,4);return this.pos+=4,val},readDouble:function(){var val=ieee754.read(this.buf,this.pos,!0,52,8);return this.pos+=8,val},readVarint:function(isSigned){var val,b,buf=this.buf;return val=127&(b=buf[this.pos++]),b<128?val:(val|=(127&(b=buf[this.pos++]))<<7,b<128?val:(val|=(127&(b=buf[this.pos++]))<<14,b<128?val:(val|=(127&(b=buf[this.pos++]))<<21,b<128?val:function(l,s,p){var h,b,buf=p.buf;if(b=buf[p.pos++],h=(112&b)>>4,b<128)return toNum(l,h,s);if(b=buf[p.pos++],h|=(127&b)<<3,b<128)return toNum(l,h,s);if(b=buf[p.pos++],h|=(127&b)<<10,b<128)return toNum(l,h,s);if(b=buf[p.pos++],h|=(127&b)<<17,b<128)return toNum(l,h,s);if(b=buf[p.pos++],h|=(127&b)<<24,b<128)return toNum(l,h,s);if(b=buf[p.pos++],h|=(1&b)<<31,b<128)return toNum(l,h,s);throw new Error("Expected varint not more than 10 bytes")}(val|=(15&(b=buf[this.pos]))<<28,isSigned,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var num=this.readVarint();return num%2==1?(num+1)/-2:num/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var end=this.readVarint()+this.pos,str=function(buf,pos,end){var str="",i=pos;for(;i<end;){var b1,b2,b3,b0=buf[i],c=null,bytesPerSequence=239<b0?4:223<b0?3:191<b0?2:1;if(end<i+bytesPerSequence)break;1===bytesPerSequence?b0<128&&(c=b0):2===bytesPerSequence?128==(192&(b1=buf[i+1]))&&(c=(31&b0)<<6|63&b1)<=127&&(c=null):3===bytesPerSequence?(b1=buf[i+1],b2=buf[i+2],128==(192&b1)&&128==(192&b2)&&((c=(15&b0)<<12|(63&b1)<<6|63&b2)<=2047||55296<=c&&c<=57343)&&(c=null)):4===bytesPerSequence&&(b1=buf[i+1],b2=buf[i+2],b3=buf[i+3],128==(192&b1)&&128==(192&b2)&&128==(192&b3)&&((c=(15&b0)<<18|(63&b1)<<12|(63&b2)<<6|63&b3)<=65535||1114112<=c)&&(c=null)),null===c?(c=65533,bytesPerSequence=1):65535<c&&(c-=65536,str+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),str+=String.fromCharCode(c),i+=bytesPerSequence}return str}(this.buf,this.pos,end);return this.pos=end,str},readBytes:function(){var end=this.readVarint()+this.pos,buffer=this.buf.subarray(this.pos,end);return this.pos=end,buffer},readPackedVarint:function(arr,isSigned){if(this.type!==Pbf.Bytes)return arr.push(this.readVarint(isSigned));var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readVarint(isSigned));return arr},readPackedSVarint:function(arr){if(this.type!==Pbf.Bytes)return arr.push(this.readSVarint());var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readSVarint());return arr},readPackedBoolean:function(arr){if(this.type!==Pbf.Bytes)return arr.push(this.readBoolean());var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readBoolean());return arr},readPackedFloat:function(arr){if(this.type!==Pbf.Bytes)return arr.push(this.readFloat());var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readFloat());return arr},readPackedDouble:function(arr){if(this.type!==Pbf.Bytes)return arr.push(this.readDouble());var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readDouble());return arr},readPackedFixed32:function(arr){if(this.type!==Pbf.Bytes)return arr.push(this.readFixed32());var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readFixed32());return arr},readPackedSFixed32:function(arr){if(this.type!==Pbf.Bytes)return arr.push(this.readSFixed32());var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readSFixed32());return arr},readPackedFixed64:function(arr){if(this.type!==Pbf.Bytes)return arr.push(this.readFixed64());var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readFixed64());return arr},readPackedSFixed64:function(arr){if(this.type!==Pbf.Bytes)return arr.push(this.readSFixed64());var end=readPackedEnd(this);for(arr=arr||[];this.pos<end;)arr.push(this.readSFixed64());return arr},skip:function(val){var type=7&val;if(type===Pbf.Varint)for(;127<this.buf[this.pos++];);else if(type===Pbf.Bytes)this.pos=this.readVarint()+this.pos;else if(type===Pbf.Fixed32)this.pos+=4;else{if(type!==Pbf.Fixed64)throw new Error("Unimplemented type: "+type);this.pos+=8}},writeTag:function(tag,type){this.writeVarint(tag<<3|type)},realloc:function(min){for(var length=this.length||16;length<this.pos+min;)length*=2;if(length!==this.length){var buf=new Uint8Array(length);buf.set(this.buf),this.buf=buf,this.length=length}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(val){this.realloc(4),writeInt32(this.buf,val,this.pos),this.pos+=4},writeSFixed32:function(val){this.realloc(4),writeInt32(this.buf,val,this.pos),this.pos+=4},writeFixed64:function(val){this.realloc(8),writeInt32(this.buf,-1&val,this.pos),writeInt32(this.buf,Math.floor(val*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(val){this.realloc(8),writeInt32(this.buf,-1&val,this.pos),writeInt32(this.buf,Math.floor(val*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(val){268435455<(val=+val||0)||val<0?function(val,pbf){var low,high;0<=val?(low=val%4294967296|0,high=val/4294967296|0):(high=~(-val/4294967296),4294967295^(low=~(-val%4294967296))?low=low+1|0:high=high+1|(low=0));if(0x10000000000000000<=val||val<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");pbf.realloc(10),function(low,high,pbf){pbf.buf[pbf.pos++]=127&low|128,low>>>=7,pbf.buf[pbf.pos++]=127&low|128,low>>>=7,pbf.buf[pbf.pos++]=127&low|128,low>>>=7,pbf.buf[pbf.pos++]=127&low|128,low>>>=7,pbf.buf[pbf.pos]=127&low}(low,0,pbf),function(high,pbf){var lsb=(7&high)<<4;if(pbf.buf[pbf.pos++]|=lsb|((high>>>=3)?128:0),!high)return;if(pbf.buf[pbf.pos++]=127&high|((high>>>=7)?128:0),!high)return;if(pbf.buf[pbf.pos++]=127&high|((high>>>=7)?128:0),!high)return;if(pbf.buf[pbf.pos++]=127&high|((high>>>=7)?128:0),!high)return;if(pbf.buf[pbf.pos++]=127&high|((high>>>=7)?128:0),!high)return;pbf.buf[pbf.pos++]=127&high}(high,pbf)}(val,this):(this.realloc(4),this.buf[this.pos++]=127&val|(127<val?128:0),val<=127||(this.buf[this.pos++]=127&(val>>>=7)|(127<val?128:0),val<=127||(this.buf[this.pos++]=127&(val>>>=7)|(127<val?128:0),val<=127||(this.buf[this.pos++]=val>>>7&127))))},writeSVarint:function(val){this.writeVarint(val<0?2*-val-1:2*val)},writeBoolean:function(val){this.writeVarint(Boolean(val))},writeString:function(str){str=String(str),this.realloc(4*str.length),this.pos++;var startPos=this.pos;this.pos=function(buf,str,pos){for(var c,lead,i=0;i<str.length;i++){if(55295<(c=str.charCodeAt(i))&&c<57344){if(!lead){56319<c||i+1===str.length?(buf[pos++]=239,buf[pos++]=191,buf[pos++]=189):lead=c;continue}if(c<56320){buf[pos++]=239,buf[pos++]=191,buf[pos++]=189,lead=c;continue}c=lead-55296<<10|c-56320|65536,lead=null}else lead&&(buf[pos++]=239,buf[pos++]=191,buf[pos++]=189,lead=null);c<128?buf[pos++]=c:(c<2048?buf[pos++]=c>>6|192:(c<65536?buf[pos++]=c>>12|224:(buf[pos++]=c>>18|240,buf[pos++]=c>>12&63|128),buf[pos++]=c>>6&63|128),buf[pos++]=63&c|128)}return pos}(this.buf,str,this.pos);var len=this.pos-startPos;128<=len&&makeRoomForExtraLength(startPos,len,this),this.pos=startPos-1,this.writeVarint(len),this.pos+=len},writeFloat:function(val){this.realloc(4),ieee754.write(this.buf,val,this.pos,!0,23,4),this.pos+=4},writeDouble:function(val){this.realloc(8),ieee754.write(this.buf,val,this.pos,!0,52,8),this.pos+=8},writeBytes:function(buffer){var len=buffer.length;this.writeVarint(len),this.realloc(len);for(var i=0;i<len;i++)this.buf[this.pos++]=buffer[i]},writeRawMessage:function(fn,obj){this.pos++;var startPos=this.pos;fn(obj,this);var len=this.pos-startPos;128<=len&&makeRoomForExtraLength(startPos,len,this),this.pos=startPos-1,this.writeVarint(len),this.pos+=len},writeMessage:function(tag,fn,obj){this.writeTag(tag,Pbf.Bytes),this.writeRawMessage(fn,obj)},writePackedVarint:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedVarint,arr)},writePackedSVarint:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedSVarint,arr)},writePackedBoolean:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedBoolean,arr)},writePackedFloat:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedFloat,arr)},writePackedDouble:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedDouble,arr)},writePackedFixed32:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedFixed32,arr)},writePackedSFixed32:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedSFixed32,arr)},writePackedFixed64:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedFixed64,arr)},writePackedSFixed64:function(tag,arr){arr.length&&this.writeMessage(tag,writePackedSFixed64,arr)},writeBytesField:function(tag,buffer){this.writeTag(tag,Pbf.Bytes),this.writeBytes(buffer)},writeFixed32Field:function(tag,val){this.writeTag(tag,Pbf.Fixed32),this.writeFixed32(val)},writeSFixed32Field:function(tag,val){this.writeTag(tag,Pbf.Fixed32),this.writeSFixed32(val)},writeFixed64Field:function(tag,val){this.writeTag(tag,Pbf.Fixed64),this.writeFixed64(val)},writeSFixed64Field:function(tag,val){this.writeTag(tag,Pbf.Fixed64),this.writeSFixed64(val)},writeVarintField:function(tag,val){this.writeTag(tag,Pbf.Varint),this.writeVarint(val)},writeSVarintField:function(tag,val){this.writeTag(tag,Pbf.Varint),this.writeSVarint(val)},writeStringField:function(tag,str){this.writeTag(tag,Pbf.Bytes),this.writeString(str)},writeFloatField:function(tag,val){this.writeTag(tag,Pbf.Fixed32),this.writeFloat(val)},writeDoubleField:function(tag,val){this.writeTag(tag,Pbf.Fixed64),this.writeDouble(val)},writeBooleanField:function(tag,val){this.writeVarintField(tag,Boolean(val))}}},{ieee754:74}],87:[function(require,module,exports){var global,factory;global=this,factory=function(){"use strict";function swap(arr,i,j){var tmp=arr[i];arr[i]=arr[j],arr[j]=tmp}function defaultCompare(a,b){return a<b?-1:b<a?1:0}return function(arr,k,left,right,compare){!function quickselectStep(arr,k,left,right,compare){for(;left<right;){if(600<right-left){var n=right-left+1,m=k-left+1,z=Math.log(n),s=.5*Math.exp(2*z/3),sd=.5*Math.sqrt(z*s*(n-s)/n)*(m-n/2<0?-1:1),newLeft=Math.max(left,Math.floor(k-m*s/n+sd)),newRight=Math.min(right,Math.floor(k+(n-m)*s/n+sd));quickselectStep(arr,k,newLeft,newRight,compare)}var t=arr[k],i=left,j=right;for(swap(arr,left,k),0<compare(arr[right],t)&&swap(arr,left,right);i<j;){for(swap(arr,i,j),i++,j--;compare(arr[i],t)<0;)i++;for(;0<compare(arr[j],t);)j--}0===compare(arr[left],t)?swap(arr,left,j):swap(arr,++j,right),j<=k&&(left=j+1),k<=j&&(right=j-1)}}(arr,k,left||0,right||arr.length-1,compare||defaultCompare)}},"object"==typeof exports&&void 0!==module?module.exports=factory():global.quickselect=factory()},{}],88:[function(require,module,exports){"use strict";module.exports=rbush,module.exports.default=rbush;var quickselect=require("quickselect");function rbush(maxEntries,format){if(!(this instanceof rbush))return new rbush(maxEntries,format);this._maxEntries=Math.max(4,maxEntries||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),format&&this._initFormat(format),this.clear()}function findItem(item,items,equalsFn){if(!equalsFn)return items.indexOf(item);for(var i=0;i<items.length;i++)if(equalsFn(item,items[i]))return i;return-1}function calcBBox(node,toBBox){distBBox(node,0,node.children.length,toBBox,node)}function distBBox(node,k,p,toBBox,destNode){destNode||(destNode=createNode(null)),destNode.minX=1/0,destNode.minY=1/0,destNode.maxX=-1/0,destNode.maxY=-1/0;for(var child,i=k;i<p;i++)child=node.children[i],extend(destNode,node.leaf?toBBox(child):child);return destNode}function extend(a,b){return a.minX=Math.min(a.minX,b.minX),a.minY=Math.min(a.minY,b.minY),a.maxX=Math.max(a.maxX,b.maxX),a.maxY=Math.max(a.maxY,b.maxY),a}function compareNodeMinX(a,b){return a.minX-b.minX}function compareNodeMinY(a,b){return a.minY-b.minY}function bboxArea(a){return(a.maxX-a.minX)*(a.maxY-a.minY)}function bboxMargin(a){return a.maxX-a.minX+(a.maxY-a.minY)}function contains(a,b){return a.minX<=b.minX&&a.minY<=b.minY&&b.maxX<=a.maxX&&b.maxY<=a.maxY}function intersects(a,b){return b.minX<=a.maxX&&b.minY<=a.maxY&&b.maxX>=a.minX&&b.maxY>=a.minY}function createNode(children){return{children:children,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(arr,left,right,n,compare){for(var mid,stack=[left,right];stack.length;)(right=stack.pop())-(left=stack.pop())<=n||(mid=left+Math.ceil((right-left)/n/2)*n,quickselect(arr,mid,left,right,compare),stack.push(left,mid,mid,right))}rbush.prototype={all:function(){return this._all(this.data,[])},search:function(bbox){var node=this.data,result=[],toBBox=this.toBBox;if(!intersects(bbox,node))return result;for(var i,len,child,childBBox,nodesToSearch=[];node;){for(i=0,len=node.children.length;i<len;i++)child=node.children[i],intersects(bbox,childBBox=node.leaf?toBBox(child):child)&&(node.leaf?result.push(child):contains(bbox,childBBox)?this._all(child,result):nodesToSearch.push(child));node=nodesToSearch.pop()}return result},collides:function(bbox){var node=this.data,toBBox=this.toBBox;if(!intersects(bbox,node))return!1;for(var i,len,child,childBBox,nodesToSearch=[];node;){for(i=0,len=node.children.length;i<len;i++)if(child=node.children[i],intersects(bbox,childBBox=node.leaf?toBBox(child):child)){if(node.leaf||contains(bbox,childBBox))return!0;nodesToSearch.push(child)}node=nodesToSearch.pop()}return!1},load:function(data){if(!data||!data.length)return this;if(data.length<this._minEntries){for(var i=0,len=data.length;i<len;i++)this.insert(data[i]);return this}var node=this._build(data.slice(),0,data.length-1,0);if(this.data.children.length)if(this.data.height===node.height)this._splitRoot(this.data,node);else{if(this.data.height<node.height){var tmpNode=this.data;this.data=node,node=tmpNode}this._insert(node,this.data.height-node.height-1,!0)}else this.data=node;return this},insert:function(item){return item&&this._insert(item,this.data.height-1),this},clear:function(){return this.data=createNode([]),this},remove:function(item,equalsFn){if(!item)return this;for(var i,parent,index,goingUp,node=this.data,bbox=this.toBBox(item),path=[],indexes=[];node||path.length;){if(node||(node=path.pop(),parent=path[path.length-1],i=indexes.pop(),goingUp=!0),node.leaf&&-1!==(index=findItem(item,node.children,equalsFn)))return node.children.splice(index,1),path.push(node),this._condense(path),this;goingUp||node.leaf||!contains(node,bbox)?parent?(i++,node=parent.children[i],goingUp=!1):node=null:(path.push(node),indexes.push(i),i=0,node=(parent=node).children[0])}return this},toBBox:function(item){return item},compareMinX:compareNodeMinX,compareMinY:compareNodeMinY,toJSON:function(){return this.data},fromJSON:function(data){return this.data=data,this},_all:function(node,result){for(var nodesToSearch=[];node;)node.leaf?result.push.apply(result,node.children):nodesToSearch.push.apply(nodesToSearch,node.children),node=nodesToSearch.pop();return result},_build:function(items,left,right,height){var node,N=right-left+1,M=this._maxEntries;if(N<=M)return calcBBox(node=createNode(items.slice(left,right+1)),this.toBBox),node;height||(height=Math.ceil(Math.log(N)/Math.log(M)),M=Math.ceil(N/Math.pow(M,height-1))),(node=createNode([])).leaf=!1,node.height=height;var i,j,right2,right3,N2=Math.ceil(N/M),N1=N2*Math.ceil(Math.sqrt(M));for(multiSelect(items,left,right,N1,this.compareMinX),i=left;i<=right;i+=N1)for(multiSelect(items,i,right2=Math.min(i+N1-1,right),N2,this.compareMinY),j=i;j<=right2;j+=N2)right3=Math.min(j+N2-1,right2),node.children.push(this._build(items,j,right3,height-1));return calcBBox(node,this.toBBox),node},_chooseSubtree:function(bbox,node,level,path){for(var i,len,child,targetNode,area,enlargement,minArea,minEnlargement,a,b;path.push(node),!node.leaf&&path.length-1!==level;){for(minArea=minEnlargement=1/0,i=0,len=node.children.length;i<len;i++)area=bboxArea(child=node.children[i]),a=bbox,b=child,(enlargement=(Math.max(b.maxX,a.maxX)-Math.min(b.minX,a.minX))*(Math.max(b.maxY,a.maxY)-Math.min(b.minY,a.minY))-area)<minEnlargement?(minEnlargement=enlargement,minArea=area<minArea?area:minArea,targetNode=child):enlargement===minEnlargement&&area<minArea&&(minArea=area,targetNode=child);node=targetNode||node.children[0]}return node},_insert:function(item,level,isNode){var toBBox=this.toBBox,bbox=isNode?item:toBBox(item),insertPath=[],node=this._chooseSubtree(bbox,this.data,level,insertPath);for(node.children.push(item),extend(node,bbox);0<=level&&insertPath[level].children.length>this._maxEntries;)this._split(insertPath,level),level--;this._adjustParentBBoxes(bbox,insertPath,level)},_split:function(insertPath,level){var node=insertPath[level],M=node.children.length,m=this._minEntries;this._chooseSplitAxis(node,m,M);var splitIndex=this._chooseSplitIndex(node,m,M),newNode=createNode(node.children.splice(splitIndex,node.children.length-splitIndex));newNode.height=node.height,newNode.leaf=node.leaf,calcBBox(node,this.toBBox),calcBBox(newNode,this.toBBox),level?insertPath[level-1].children.push(newNode):this._splitRoot(node,newNode)},_splitRoot:function(node,newNode){this.data=createNode([node,newNode]),this.data.height=node.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)},_chooseSplitIndex:function(node,m,M){var i,bbox1,bbox2,overlap,area,minOverlap,minArea,index,a,b,minX,minY,maxX,maxY;for(minOverlap=minArea=1/0,i=m;i<=M-m;i++)bbox1=distBBox(node,0,i,this.toBBox),bbox2=distBBox(node,i,M,this.toBBox),a=bbox1,b=bbox2,void 0,minX=Math.max(a.minX,b.minX),minY=Math.max(a.minY,b.minY),maxX=Math.min(a.maxX,b.maxX),maxY=Math.min(a.maxY,b.maxY),overlap=Math.max(0,maxX-minX)*Math.max(0,maxY-minY),area=bboxArea(bbox1)+bboxArea(bbox2),overlap<minOverlap?(minOverlap=overlap,index=i,minArea=area<minArea?area:minArea):overlap===minOverlap&&area<minArea&&(minArea=area,index=i);return index},_chooseSplitAxis:function(node,m,M){var compareMinX=node.leaf?this.compareMinX:compareNodeMinX,compareMinY=node.leaf?this.compareMinY:compareNodeMinY;this._allDistMargin(node,m,M,compareMinX)<this._allDistMargin(node,m,M,compareMinY)&&node.children.sort(compareMinX)},_allDistMargin:function(node,m,M,compare){node.children.sort(compare);var i,child,toBBox=this.toBBox,leftBBox=distBBox(node,0,m,toBBox),rightBBox=distBBox(node,M-m,M,toBBox),margin=bboxMargin(leftBBox)+bboxMargin(rightBBox);for(i=m;i<M-m;i++)child=node.children[i],extend(leftBBox,node.leaf?toBBox(child):child),margin+=bboxMargin(leftBBox);for(i=M-m-1;m<=i;i--)child=node.children[i],extend(rightBBox,node.leaf?toBBox(child):child),margin+=bboxMargin(rightBBox);return margin},_adjustParentBBoxes:function(bbox,path,level){for(var i=level;0<=i;i--)extend(path[i],bbox)},_condense:function(path){for(var siblings,i=path.length-1;0<=i;i--)0===path[i].children.length?0<i?(siblings=path[i-1].children).splice(siblings.indexOf(path[i]),1):this.clear():calcBBox(path[i],this.toBBox)},_initFormat:function(format){var compareArr=["return a"," - b",";"];this.compareMinX=new Function("a","b",compareArr.join(format[0])),this.compareMinY=new Function("a","b",compareArr.join(format[1])),this.toBBox=new Function("a","return {minX: a"+format[0]+", minY: a"+format[1]+", maxX: a"+format[2]+", maxY: a"+format[3]+"};")}}},{quickselect:87}],89:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("./internal/Observable");exports.Observable=Observable_1.Observable;var ConnectableObservable_1=require("./internal/observable/ConnectableObservable");exports.ConnectableObservable=ConnectableObservable_1.ConnectableObservable;var groupBy_1=require("./internal/operators/groupBy");exports.GroupedObservable=groupBy_1.GroupedObservable;var observable_1=require("./internal/symbol/observable");exports.observable=observable_1.observable;var Subject_1=require("./internal/Subject");exports.Subject=Subject_1.Subject;var BehaviorSubject_1=require("./internal/BehaviorSubject");exports.BehaviorSubject=BehaviorSubject_1.BehaviorSubject;var ReplaySubject_1=require("./internal/ReplaySubject");exports.ReplaySubject=ReplaySubject_1.ReplaySubject;var AsyncSubject_1=require("./internal/AsyncSubject");exports.AsyncSubject=AsyncSubject_1.AsyncSubject;var asap_1=require("./internal/scheduler/asap");exports.asapScheduler=asap_1.asap;var async_1=require("./internal/scheduler/async");exports.asyncScheduler=async_1.async;var queue_1=require("./internal/scheduler/queue");exports.queueScheduler=queue_1.queue;var animationFrame_1=require("./internal/scheduler/animationFrame");exports.animationFrameScheduler=animationFrame_1.animationFrame;var VirtualTimeScheduler_1=require("./internal/scheduler/VirtualTimeScheduler");exports.VirtualTimeScheduler=VirtualTimeScheduler_1.VirtualTimeScheduler,exports.VirtualAction=VirtualTimeScheduler_1.VirtualAction;var Scheduler_1=require("./internal/Scheduler");exports.Scheduler=Scheduler_1.Scheduler;var Subscription_1=require("./internal/Subscription");exports.Subscription=Subscription_1.Subscription;var Subscriber_1=require("./internal/Subscriber");exports.Subscriber=Subscriber_1.Subscriber;var Notification_1=require("./internal/Notification");exports.Notification=Notification_1.Notification;var pipe_1=require("./internal/util/pipe");exports.pipe=pipe_1.pipe;var noop_1=require("./internal/util/noop");exports.noop=noop_1.noop;var identity_1=require("./internal/util/identity");exports.identity=identity_1.identity;var isObservable_1=require("./internal/util/isObservable");exports.isObservable=isObservable_1.isObservable;var ArgumentOutOfRangeError_1=require("./internal/util/ArgumentOutOfRangeError");exports.ArgumentOutOfRangeError=ArgumentOutOfRangeError_1.ArgumentOutOfRangeError;var EmptyError_1=require("./internal/util/EmptyError");exports.EmptyError=EmptyError_1.EmptyError;var ObjectUnsubscribedError_1=require("./internal/util/ObjectUnsubscribedError");exports.ObjectUnsubscribedError=ObjectUnsubscribedError_1.ObjectUnsubscribedError;var UnsubscriptionError_1=require("./internal/util/UnsubscriptionError");exports.UnsubscriptionError=UnsubscriptionError_1.UnsubscriptionError;var TimeoutError_1=require("./internal/util/TimeoutError");exports.TimeoutError=TimeoutError_1.TimeoutError;var bindCallback_1=require("./internal/observable/bindCallback");exports.bindCallback=bindCallback_1.bindCallback;var bindNodeCallback_1=require("./internal/observable/bindNodeCallback");exports.bindNodeCallback=bindNodeCallback_1.bindNodeCallback;var combineLatest_1=require("./internal/observable/combineLatest");exports.combineLatest=combineLatest_1.combineLatest;var concat_1=require("./internal/observable/concat");exports.concat=concat_1.concat;var defer_1=require("./internal/observable/defer");exports.defer=defer_1.defer;var empty_1=require("./internal/observable/empty");exports.empty=empty_1.empty;var forkJoin_1=require("./internal/observable/forkJoin");exports.forkJoin=forkJoin_1.forkJoin;var from_1=require("./internal/observable/from");exports.from=from_1.from;var fromEvent_1=require("./internal/observable/fromEvent");exports.fromEvent=fromEvent_1.fromEvent;var fromEventPattern_1=require("./internal/observable/fromEventPattern");exports.fromEventPattern=fromEventPattern_1.fromEventPattern;var generate_1=require("./internal/observable/generate");exports.generate=generate_1.generate;var iif_1=require("./internal/observable/iif");exports.iif=iif_1.iif;var interval_1=require("./internal/observable/interval");exports.interval=interval_1.interval;var merge_1=require("./internal/observable/merge");exports.merge=merge_1.merge;var never_1=require("./internal/observable/never");exports.never=never_1.never;var of_1=require("./internal/observable/of");exports.of=of_1.of;var onErrorResumeNext_1=require("./internal/observable/onErrorResumeNext");exports.onErrorResumeNext=onErrorResumeNext_1.onErrorResumeNext;var pairs_1=require("./internal/observable/pairs");exports.pairs=pairs_1.pairs;var race_1=require("./internal/observable/race");exports.race=race_1.race;var range_1=require("./internal/observable/range");exports.range=range_1.range;var throwError_1=require("./internal/observable/throwError");exports.throwError=throwError_1.throwError;var timer_1=require("./internal/observable/timer");exports.timer=timer_1.timer;var using_1=require("./internal/observable/using");exports.using=using_1.using;var zip_1=require("./internal/observable/zip");exports.zip=zip_1.zip;var empty_2=require("./internal/observable/empty");exports.EMPTY=empty_2.EMPTY;var never_2=require("./internal/observable/never");exports.NEVER=never_2.NEVER;var config_1=require("./internal/config");exports.config=config_1.config},{"./internal/AsyncSubject":90,"./internal/BehaviorSubject":91,"./internal/Notification":93,"./internal/Observable":94,"./internal/ReplaySubject":97,"./internal/Scheduler":98,"./internal/Subject":99,"./internal/Subscriber":101,"./internal/Subscription":102,"./internal/config":103,"./internal/observable/ConnectableObservable":104,"./internal/observable/bindCallback":106,"./internal/observable/bindNodeCallback":107,"./internal/observable/combineLatest":108,"./internal/observable/concat":109,"./internal/observable/defer":110,"./internal/observable/empty":111,"./internal/observable/forkJoin":112,"./internal/observable/from":113,"./internal/observable/fromEvent":115,"./internal/observable/fromEventPattern":116,"./internal/observable/generate":120,"./internal/observable/iif":121,"./internal/observable/interval":122,"./internal/observable/merge":123,"./internal/observable/never":124,"./internal/observable/of":125,"./internal/observable/onErrorResumeNext":126,"./internal/observable/pairs":127,"./internal/observable/race":128,"./internal/observable/range":129,"./internal/observable/throwError":131,"./internal/observable/timer":132,"./internal/observable/using":133,"./internal/observable/zip":134,"./internal/operators/groupBy":170,"./internal/scheduler/VirtualTimeScheduler":247,"./internal/scheduler/animationFrame":248,"./internal/scheduler/asap":249,"./internal/scheduler/async":250,"./internal/scheduler/queue":251,"./internal/symbol/observable":253,"./internal/util/ArgumentOutOfRangeError":255,"./internal/util/EmptyError":256,"./internal/util/ObjectUnsubscribedError":258,"./internal/util/TimeoutError":259,"./internal/util/UnsubscriptionError":260,"./internal/util/identity":263,"./internal/util/isObservable":272,"./internal/util/noop":275,"./internal/util/pipe":277}],90:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("./Subject"),Subscription_1=require("./Subscription"),AsyncSubject=function(_super){function AsyncSubject(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.value=null,_this.hasNext=!1,_this.hasCompleted=!1,_this}return __extends(AsyncSubject,_super),AsyncSubject.prototype._subscribe=function(subscriber){return this.hasError?(subscriber.error(this.thrownError),Subscription_1.Subscription.EMPTY):this.hasCompleted&&this.hasNext?(subscriber.next(this.value),subscriber.complete(),Subscription_1.Subscription.EMPTY):_super.prototype._subscribe.call(this,subscriber)},AsyncSubject.prototype.next=function(value){this.hasCompleted||(this.value=value,this.hasNext=!0)},AsyncSubject.prototype.error=function(error){this.hasCompleted||_super.prototype.error.call(this,error)},AsyncSubject.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&_super.prototype.next.call(this,this.value),_super.prototype.complete.call(this)},AsyncSubject}(Subject_1.Subject);exports.AsyncSubject=AsyncSubject},{"./Subject":99,"./Subscription":102}],91:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("./Subject"),ObjectUnsubscribedError_1=require("./util/ObjectUnsubscribedError"),BehaviorSubject=function(_super){function BehaviorSubject(_value){var _this=_super.call(this)||this;return _this._value=_value,_this}return __extends(BehaviorSubject,_super),Object.defineProperty(BehaviorSubject.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),BehaviorSubject.prototype._subscribe=function(subscriber){var subscription=_super.prototype._subscribe.call(this,subscriber);return subscription&&!subscription.closed&&subscriber.next(this._value),subscription},BehaviorSubject.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError;return this._value},BehaviorSubject.prototype.next=function(value){_super.prototype.next.call(this,this._value=value)},BehaviorSubject}(Subject_1.Subject);exports.BehaviorSubject=BehaviorSubject},{"./Subject":99,"./util/ObjectUnsubscribedError":258}],92:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var InnerSubscriber=function(_super){function InnerSubscriber(parent,outerValue,outerIndex){var _this=_super.call(this)||this;return _this.parent=parent,_this.outerValue=outerValue,_this.outerIndex=outerIndex,_this.index=0,_this}return __extends(InnerSubscriber,_super),InnerSubscriber.prototype._next=function(value){this.parent.notifyNext(this.outerValue,value,this.outerIndex,this.index++,this)},InnerSubscriber.prototype._error=function(error){this.parent.notifyError(error,this),this.unsubscribe()},InnerSubscriber.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},InnerSubscriber}(require("./Subscriber").Subscriber);exports.InnerSubscriber=InnerSubscriber},{"./Subscriber":101}],93:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var empty_1=require("./observable/empty"),of_1=require("./observable/of"),throwError_1=require("./observable/throwError");!function(NotificationKind){NotificationKind.NEXT="N",NotificationKind.ERROR="E",NotificationKind.COMPLETE="C"}(exports.NotificationKind||(exports.NotificationKind={}));var Notification=function(){function Notification(kind,value,error){this.kind=kind,this.value=value,this.error=error,this.hasValue="N"===kind}return Notification.prototype.observe=function(observer){switch(this.kind){case"N":return observer.next&&observer.next(this.value);case"E":return observer.error&&observer.error(this.error);case"C":return observer.complete&&observer.complete()}},Notification.prototype.do=function(next,error,complete){switch(this.kind){case"N":return next&&next(this.value);case"E":return error&&error(this.error);case"C":return complete&&complete()}},Notification.prototype.accept=function(nextOrObserver,error,complete){return nextOrObserver&&"function"==typeof nextOrObserver.next?this.observe(nextOrObserver):this.do(nextOrObserver,error,complete)},Notification.prototype.toObservable=function(){switch(this.kind){case"N":return of_1.of(this.value);case"E":return throwError_1.throwError(this.error);case"C":return empty_1.empty()}throw new Error("unexpected notification kind value")},Notification.createNext=function(value){return void 0!==value?new Notification("N",value):Notification.undefinedValueNotification},Notification.createError=function(err){return new Notification("E",void 0,err)},Notification.createComplete=function(){return Notification.completeNotification},Notification.completeNotification=new Notification("C"),Notification.undefinedValueNotification=new Notification("N",void 0),Notification}();exports.Notification=Notification},{"./observable/empty":111,"./observable/of":125,"./observable/throwError":131}],94:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var canReportError_1=require("./util/canReportError"),toSubscriber_1=require("./util/toSubscriber"),observable_1=require("../internal/symbol/observable"),pipe_1=require("./util/pipe"),config_1=require("./config"),Observable=function(){function Observable(subscribe){this._isScalar=!1,subscribe&&(this._subscribe=subscribe)}return Observable.prototype.lift=function(operator){var observable=new Observable;return observable.source=this,observable.operator=operator,observable},Observable.prototype.subscribe=function(observerOrNext,error,complete){var operator=this.operator,sink=toSubscriber_1.toSubscriber(observerOrNext,error,complete);if(operator?sink.add(operator.call(sink,this.source)):sink.add(this.source||config_1.config.useDeprecatedSynchronousErrorHandling&&!sink.syncErrorThrowable?this._subscribe(sink):this._trySubscribe(sink)),config_1.config.useDeprecatedSynchronousErrorHandling&&sink.syncErrorThrowable&&(sink.syncErrorThrowable=!1,sink.syncErrorThrown))throw sink.syncErrorValue;return sink},Observable.prototype._trySubscribe=function(sink){try{return this._subscribe(sink)}catch(err){config_1.config.useDeprecatedSynchronousErrorHandling&&(sink.syncErrorThrown=!0,sink.syncErrorValue=err),canReportError_1.canReportError(sink)?sink.error(err):console.warn(err)}},Observable.prototype.forEach=function(next,promiseCtor){var _this=this;return new(promiseCtor=getPromiseCtor(promiseCtor))(function(resolve,reject){var subscription;subscription=_this.subscribe(function(value){try{next(value)}catch(err){reject(err),subscription&&subscription.unsubscribe()}},reject,resolve)})},Observable.prototype._subscribe=function(subscriber){var source=this.source;return source&&source.subscribe(subscriber)},Observable.prototype[observable_1.observable]=function(){return this},Observable.prototype.pipe=function(){for(var operations=[],_i=0;_i<arguments.length;_i++)operations[_i]=arguments[_i];return 0===operations.length?this:pipe_1.pipeFromArray(operations)(this)},Observable.prototype.toPromise=function(promiseCtor){var _this=this;return new(promiseCtor=getPromiseCtor(promiseCtor))(function(resolve,reject){var value;_this.subscribe(function(x){return value=x},function(err){return reject(err)},function(){return resolve(value)})})},Observable.create=function(subscribe){return new Observable(subscribe)},Observable}();function getPromiseCtor(promiseCtor){if(promiseCtor||(promiseCtor=config_1.config.Promise||Promise),!promiseCtor)throw new Error("no Promise impl found");return promiseCtor}exports.Observable=Observable},{"../internal/symbol/observable":253,"./config":103,"./util/canReportError":261,"./util/pipe":277,"./util/toSubscriber":284}],95:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var config_1=require("./config"),hostReportError_1=require("./util/hostReportError");exports.empty={closed:!0,next:function(value){},error:function(err){if(config_1.config.useDeprecatedSynchronousErrorHandling)throw err;hostReportError_1.hostReportError(err)},complete:function(){}}},{"./config":103,"./util/hostReportError":262}],96:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber=function(_super){function OuterSubscriber(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(OuterSubscriber,_super),OuterSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.destination.next(innerValue)},OuterSubscriber.prototype.notifyError=function(error,innerSub){this.destination.error(error)},OuterSubscriber.prototype.notifyComplete=function(innerSub){this.destination.complete()},OuterSubscriber}(require("./Subscriber").Subscriber);exports.OuterSubscriber=OuterSubscriber},{"./Subscriber":101}],97:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("./Subject"),queue_1=require("./scheduler/queue"),Subscription_1=require("./Subscription"),observeOn_1=require("./operators/observeOn"),ObjectUnsubscribedError_1=require("./util/ObjectUnsubscribedError"),SubjectSubscription_1=require("./SubjectSubscription"),ReplaySubject=function(_super){function ReplaySubject(bufferSize,windowTime,scheduler){void 0===bufferSize&&(bufferSize=Number.POSITIVE_INFINITY),void 0===windowTime&&(windowTime=Number.POSITIVE_INFINITY);var _this=_super.call(this)||this;return _this.scheduler=scheduler,_this._events=[],_this._infiniteTimeWindow=!1,_this._bufferSize=bufferSize<1?1:bufferSize,_this._windowTime=windowTime<1?1:windowTime,windowTime===Number.POSITIVE_INFINITY?(_this._infiniteTimeWindow=!0,_this.next=_this.nextInfiniteTimeWindow):_this.next=_this.nextTimeWindow,_this}return __extends(ReplaySubject,_super),ReplaySubject.prototype.nextInfiniteTimeWindow=function(value){var _events=this._events;_events.push(value),_events.length>this._bufferSize&&_events.shift(),_super.prototype.next.call(this,value)},ReplaySubject.prototype.nextTimeWindow=function(value){this._events.push(new ReplayEvent(this._getNow(),value)),this._trimBufferThenGetEvents(),_super.prototype.next.call(this,value)},ReplaySubject.prototype._subscribe=function(subscriber){var subscription,_infiniteTimeWindow=this._infiniteTimeWindow,_events=_infiniteTimeWindow?this._events:this._trimBufferThenGetEvents(),scheduler=this.scheduler,len=_events.length;if(this.closed)throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError;if(subscription=this.isStopped||this.hasError?Subscription_1.Subscription.EMPTY:(this.observers.push(subscriber),new SubjectSubscription_1.SubjectSubscription(this,subscriber)),scheduler&&subscriber.add(subscriber=new observeOn_1.ObserveOnSubscriber(subscriber,scheduler)),_infiniteTimeWindow)for(var i=0;i<len&&!subscriber.closed;i++)subscriber.next(_events[i]);else for(i=0;i<len&&!subscriber.closed;i++)subscriber.next(_events[i].value);return this.hasError?subscriber.error(this.thrownError):this.isStopped&&subscriber.complete(),subscription},ReplaySubject.prototype._getNow=function(){return(this.scheduler||queue_1.queue).now()},ReplaySubject.prototype._trimBufferThenGetEvents=function(){for(var now=this._getNow(),_bufferSize=this._bufferSize,_windowTime=this._windowTime,_events=this._events,eventsCount=_events.length,spliceCount=0;spliceCount<eventsCount&&!(now-_events[spliceCount].time<_windowTime);)spliceCount++;return _bufferSize<eventsCount&&(spliceCount=Math.max(spliceCount,eventsCount-_bufferSize)),0<spliceCount&&_events.splice(0,spliceCount),_events},ReplaySubject}(Subject_1.Subject);exports.ReplaySubject=ReplaySubject;var ReplayEvent=function(time,value){this.time=time,this.value=value}},{"./Subject":99,"./SubjectSubscription":100,"./Subscription":102,"./operators/observeOn":185,"./scheduler/queue":251,"./util/ObjectUnsubscribedError":258}],98:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Scheduler=function(){function Scheduler(SchedulerAction,now){void 0===now&&(now=Scheduler.now),this.SchedulerAction=SchedulerAction,this.now=now}return Scheduler.prototype.schedule=function(work,delay,state){return void 0===delay&&(delay=0),new this.SchedulerAction(this,work).schedule(state,delay)},Scheduler.now=function(){return Date.now()},Scheduler}();exports.Scheduler=Scheduler},{}],99:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("./Observable"),Subscriber_1=require("./Subscriber"),Subscription_1=require("./Subscription"),ObjectUnsubscribedError_1=require("./util/ObjectUnsubscribedError"),SubjectSubscription_1=require("./SubjectSubscription"),rxSubscriber_1=require("../internal/symbol/rxSubscriber"),SubjectSubscriber=function(_super){function SubjectSubscriber(destination){var _this=_super.call(this,destination)||this;return _this.destination=destination,_this}return __extends(SubjectSubscriber,_super),SubjectSubscriber}(Subscriber_1.Subscriber);exports.SubjectSubscriber=SubjectSubscriber;var Subject=function(_super){function Subject(){var _this=_super.call(this)||this;return _this.observers=[],_this.closed=!1,_this.isStopped=!1,_this.hasError=!1,_this.thrownError=null,_this}return __extends(Subject,_super),Subject.prototype[rxSubscriber_1.rxSubscriber]=function(){return new SubjectSubscriber(this)},Subject.prototype.lift=function(operator){var subject=new AnonymousSubject(this,this);return subject.operator=operator,subject},Subject.prototype.next=function(value){if(this.closed)throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError;if(!this.isStopped)for(var observers=this.observers,len=observers.length,copy=observers.slice(),i=0;i<len;i++)copy[i].next(value)},Subject.prototype.error=function(err){if(this.closed)throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError;this.hasError=!0,this.thrownError=err,this.isStopped=!0;for(var observers=this.observers,len=observers.length,copy=observers.slice(),i=0;i<len;i++)copy[i].error(err);this.observers.length=0},Subject.prototype.complete=function(){if(this.closed)throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError;this.isStopped=!0;for(var observers=this.observers,len=observers.length,copy=observers.slice(),i=0;i<len;i++)copy[i].complete();this.observers.length=0},Subject.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},Subject.prototype._trySubscribe=function(subscriber){if(this.closed)throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError;return _super.prototype._trySubscribe.call(this,subscriber)},Subject.prototype._subscribe=function(subscriber){if(this.closed)throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError;return this.hasError?(subscriber.error(this.thrownError),Subscription_1.Subscription.EMPTY):this.isStopped?(subscriber.complete(),Subscription_1.Subscription.EMPTY):(this.observers.push(subscriber),new SubjectSubscription_1.SubjectSubscription(this,subscriber))},Subject.prototype.asObservable=function(){var observable=new Observable_1.Observable;return observable.source=this,observable},Subject.create=function(destination,source){return new AnonymousSubject(destination,source)},Subject}(Observable_1.Observable),AnonymousSubject=function(_super){function AnonymousSubject(destination,source){var _this=_super.call(this)||this;return _this.destination=destination,_this.source=source,_this}return __extends(AnonymousSubject,_super),AnonymousSubject.prototype.next=function(value){var destination=this.destination;destination&&destination.next&&destination.next(value)},AnonymousSubject.prototype.error=function(err){var destination=this.destination;destination&&destination.error&&this.destination.error(err)},AnonymousSubject.prototype.complete=function(){var destination=this.destination;destination&&destination.complete&&this.destination.complete()},AnonymousSubject.prototype._subscribe=function(subscriber){return this.source?this.source.subscribe(subscriber):Subscription_1.Subscription.EMPTY},AnonymousSubject}(exports.Subject=Subject);exports.AnonymousSubject=AnonymousSubject},{"../internal/symbol/rxSubscriber":254,"./Observable":94,"./SubjectSubscription":100,"./Subscriber":101,"./Subscription":102,"./util/ObjectUnsubscribedError":258}],100:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var SubjectSubscription=function(_super){function SubjectSubscription(subject,subscriber){var _this=_super.call(this)||this;return _this.subject=subject,_this.subscriber=subscriber,_this.closed=!1,_this}return __extends(SubjectSubscription,_super),SubjectSubscription.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var subject=this.subject,observers=subject.observers;if(this.subject=null,observers&&0!==observers.length&&!subject.isStopped&&!subject.closed){var subscriberIndex=observers.indexOf(this.subscriber);-1!==subscriberIndex&&observers.splice(subscriberIndex,1)}}},SubjectSubscription}(require("./Subscription").Subscription);exports.SubjectSubscription=SubjectSubscription},{"./Subscription":102}],101:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var isFunction_1=require("./util/isFunction"),Observer_1=require("./Observer"),Subscription_1=require("./Subscription"),rxSubscriber_1=require("../internal/symbol/rxSubscriber"),config_1=require("./config"),hostReportError_1=require("./util/hostReportError"),Subscriber=function(_super){function Subscriber(destinationOrNext,error,complete){var _this=_super.call(this)||this;switch(_this.syncErrorValue=null,_this.syncErrorThrown=!1,_this.syncErrorThrowable=!1,_this.isStopped=!1,arguments.length){case 0:_this.destination=Observer_1.empty;break;case 1:if(!destinationOrNext){_this.destination=Observer_1.empty;break}if("object"==typeof destinationOrNext){destinationOrNext instanceof Subscriber?(_this.syncErrorThrowable=destinationOrNext.syncErrorThrowable,(_this.destination=destinationOrNext).add(_this)):(_this.syncErrorThrowable=!0,_this.destination=new SafeSubscriber(_this,destinationOrNext));break}default:_this.syncErrorThrowable=!0,_this.destination=new SafeSubscriber(_this,destinationOrNext,error,complete)}return _this}return __extends(Subscriber,_super),Subscriber.prototype[rxSubscriber_1.rxSubscriber]=function(){return this},Subscriber.create=function(next,error,complete){var subscriber=new Subscriber(next,error,complete);return subscriber.syncErrorThrowable=!1,subscriber},Subscriber.prototype.next=function(value){this.isStopped||this._next(value)},Subscriber.prototype.error=function(err){this.isStopped||(this.isStopped=!0,this._error(err))},Subscriber.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Subscriber.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,_super.prototype.unsubscribe.call(this))},Subscriber.prototype._next=function(value){this.destination.next(value)},Subscriber.prototype._error=function(err){this.destination.error(err),this.unsubscribe()},Subscriber.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},Subscriber.prototype._unsubscribeAndRecycle=function(){var _parent=this._parent,_parents=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=_parent,this._parents=_parents,this},Subscriber}(Subscription_1.Subscription),SafeSubscriber=function(_super){function SafeSubscriber(_parentSubscriber,observerOrNext,error,complete){var next,_this=_super.call(this)||this;_this._parentSubscriber=_parentSubscriber;var context=_this;return isFunction_1.isFunction(observerOrNext)?next=observerOrNext:observerOrNext&&(next=observerOrNext.next,error=observerOrNext.error,complete=observerOrNext.complete,observerOrNext!==Observer_1.empty&&(context=Object.create(observerOrNext),isFunction_1.isFunction(context.unsubscribe)&&_this.add(context.unsubscribe.bind(context)),context.unsubscribe=_this.unsubscribe.bind(_this))),_this._context=context,_this._next=next,_this._error=error,_this._complete=complete,_this}return __extends(SafeSubscriber,_super),SafeSubscriber.prototype.next=function(value){if(!this.isStopped&&this._next){var _parentSubscriber=this._parentSubscriber;config_1.config.useDeprecatedSynchronousErrorHandling&&_parentSubscriber.syncErrorThrowable?this.__tryOrSetError(_parentSubscriber,this._next,value)&&this.unsubscribe():this.__tryOrUnsub(this._next,value)}},SafeSubscriber.prototype.error=function(err){if(!this.isStopped){var _parentSubscriber=this._parentSubscriber,useDeprecatedSynchronousErrorHandling=config_1.config.useDeprecatedSynchronousErrorHandling;if(this._error)useDeprecatedSynchronousErrorHandling&&_parentSubscriber.syncErrorThrowable?this.__tryOrSetError(_parentSubscriber,this._error,err):this.__tryOrUnsub(this._error,err),this.unsubscribe();else if(_parentSubscriber.syncErrorThrowable)useDeprecatedSynchronousErrorHandling?(_parentSubscriber.syncErrorValue=err,_parentSubscriber.syncErrorThrown=!0):hostReportError_1.hostReportError(err),this.unsubscribe();else{if(this.unsubscribe(),useDeprecatedSynchronousErrorHandling)throw err;hostReportError_1.hostReportError(err)}}},SafeSubscriber.prototype.complete=function(){var _this=this;if(!this.isStopped){var _parentSubscriber=this._parentSubscriber;if(this._complete){var wrappedComplete=function(){return _this._complete.call(_this._context)};config_1.config.useDeprecatedSynchronousErrorHandling&&_parentSubscriber.syncErrorThrowable?this.__tryOrSetError(_parentSubscriber,wrappedComplete):this.__tryOrUnsub(wrappedComplete),this.unsubscribe()}else this.unsubscribe()}},SafeSubscriber.prototype.__tryOrUnsub=function(fn,value){try{fn.call(this._context,value)}catch(err){if(this.unsubscribe(),config_1.config.useDeprecatedSynchronousErrorHandling)throw err;hostReportError_1.hostReportError(err)}},SafeSubscriber.prototype.__tryOrSetError=function(parent,fn,value){if(!config_1.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{fn.call(this._context,value)}catch(err){return config_1.config.useDeprecatedSynchronousErrorHandling?(parent.syncErrorValue=err,parent.syncErrorThrown=!0):(hostReportError_1.hostReportError(err),!0)}return!1},SafeSubscriber.prototype._unsubscribe=function(){var _parentSubscriber=this._parentSubscriber;this._context=null,this._parentSubscriber=null,_parentSubscriber.unsubscribe()},SafeSubscriber}(exports.Subscriber=Subscriber);exports.SafeSubscriber=SafeSubscriber},{"../internal/symbol/rxSubscriber":254,"./Observer":95,"./Subscription":102,"./config":103,"./util/hostReportError":262,"./util/isFunction":267}],102:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var isArray_1=require("./util/isArray"),isObject_1=require("./util/isObject"),isFunction_1=require("./util/isFunction"),UnsubscriptionError_1=require("./util/UnsubscriptionError"),Subscription=function(){function Subscription(unsubscribe){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,unsubscribe&&(this._unsubscribe=unsubscribe)}var empty;return Subscription.prototype.unsubscribe=function(){var errors,hasErrors=!1;if(!this.closed){var _parent=this._parent,_parents=this._parents,_unsubscribe=this._unsubscribe,_subscriptions=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var index=-1,len=_parents?_parents.length:0;_parent;)_parent.remove(this),_parent=++index<len&&_parents[index]||null;if(isFunction_1.isFunction(_unsubscribe))try{_unsubscribe.call(this)}catch(e){hasErrors=!0,errors=e instanceof UnsubscriptionError_1.UnsubscriptionError?flattenUnsubscriptionErrors(e.errors):[e]}if(isArray_1.isArray(_subscriptions))for(index=-1,len=_subscriptions.length;++index<len;){var sub=_subscriptions[index];if(isObject_1.isObject(sub))try{sub.unsubscribe()}catch(e){hasErrors=!0,errors=errors||[],e instanceof UnsubscriptionError_1.UnsubscriptionError?errors=errors.concat(flattenUnsubscriptionErrors(e.errors)):errors.push(e)}}if(hasErrors)throw new UnsubscriptionError_1.UnsubscriptionError(errors)}},Subscription.prototype.add=function(teardown){var subscription=teardown;switch(typeof teardown){case"function":subscription=new Subscription(teardown);case"object":if(subscription===this||subscription.closed||"function"!=typeof subscription.unsubscribe)return subscription;if(this.closed)return subscription.unsubscribe(),subscription;if(!(subscription instanceof Subscription)){var tmp=subscription;(subscription=new Subscription)._subscriptions=[tmp]}break;default:if(!teardown)return Subscription.EMPTY;throw new Error("unrecognized teardown "+teardown+" added to Subscription.")}if(subscription._addParent(this)){var subscriptions=this._subscriptions;subscriptions?subscriptions.push(subscription):this._subscriptions=[subscription]}return subscription},Subscription.prototype.remove=function(subscription){var subscriptions=this._subscriptions;if(subscriptions){var subscriptionIndex=subscriptions.indexOf(subscription);-1!==subscriptionIndex&&subscriptions.splice(subscriptionIndex,1)}},Subscription.prototype._addParent=function(parent){var _parent=this._parent,_parents=this._parents;return _parent!==parent&&(_parent?_parents?-1===_parents.indexOf(parent)&&(_parents.push(parent),!0):(this._parents=[parent],!0):(this._parent=parent,!0))},Subscription.EMPTY=((empty=new Subscription).closed=!0,empty),Subscription}();function flattenUnsubscriptionErrors(errors){return errors.reduce(function(errs,err){return errs.concat(err instanceof UnsubscriptionError_1.UnsubscriptionError?err.errors:err)},[])}exports.Subscription=Subscription},{"./util/UnsubscriptionError":260,"./util/isArray":264,"./util/isFunction":267,"./util/isObject":271}],103:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _enable_super_gross_mode_that_will_cause_bad_things=!1;exports.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(value){if(value){var error=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+error.stack)}else _enable_super_gross_mode_that_will_cause_bad_things&&console.log("RxJS: Back to a better error behavior. Thank you. <3");_enable_super_gross_mode_that_will_cause_bad_things=value},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}}},{}],104:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("../Subject"),Observable_1=require("../Observable"),Subscriber_1=require("../Subscriber"),Subscription_1=require("../Subscription"),refCount_1=require("../operators/refCount"),ConnectableObservable=function(_super){function ConnectableObservable(source,subjectFactory){var _this=_super.call(this)||this;return _this.source=source,_this.subjectFactory=subjectFactory,_this._refCount=0,_this._isComplete=!1,_this}return __extends(ConnectableObservable,_super),ConnectableObservable.prototype._subscribe=function(subscriber){return this.getSubject().subscribe(subscriber)},ConnectableObservable.prototype.getSubject=function(){var subject=this._subject;return subject&&!subject.isStopped||(this._subject=this.subjectFactory()),this._subject},ConnectableObservable.prototype.connect=function(){var connection=this._connection;return connection||(this._isComplete=!1,(connection=this._connection=new Subscription_1.Subscription).add(this.source.subscribe(new ConnectableSubscriber(this.getSubject(),this))),connection.closed?(this._connection=null,connection=Subscription_1.Subscription.EMPTY):this._connection=connection),connection},ConnectableObservable.prototype.refCount=function(){return refCount_1.refCount()(this)},ConnectableObservable}(Observable_1.Observable),connectableProto=(exports.ConnectableObservable=ConnectableObservable).prototype;exports.connectableObservableDescriptor={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:connectableProto._subscribe},_isComplete:{value:connectableProto._isComplete,writable:!0},getSubject:{value:connectableProto.getSubject},connect:{value:connectableProto.connect},refCount:{value:connectableProto.refCount}};var ConnectableSubscriber=function(_super){function ConnectableSubscriber(destination,connectable){var _this=_super.call(this,destination)||this;return _this.connectable=connectable,_this}return __extends(ConnectableSubscriber,_super),ConnectableSubscriber.prototype._error=function(err){this._unsubscribe(),_super.prototype._error.call(this,err)},ConnectableSubscriber.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),_super.prototype._complete.call(this)},ConnectableSubscriber.prototype._unsubscribe=function(){var connectable=this.connectable;if(connectable){this.connectable=null;var connection=connectable._connection;connectable._refCount=0,connectable._subject=null,connectable._connection=null,connection&&connection.unsubscribe()}},ConnectableSubscriber}(Subject_1.SubjectSubscriber),RefCountSubscriber=(function(){function RefCountOperator(connectable){this.connectable=connectable}RefCountOperator.prototype.call=function(subscriber,source){var connectable=this.connectable;connectable._refCount++;var refCounter=new RefCountSubscriber(subscriber,connectable),subscription=source.subscribe(refCounter);return refCounter.closed||(refCounter.connection=connectable.connect()),subscription}}(),function(_super){function RefCountSubscriber(destination,connectable){var _this=_super.call(this,destination)||this;return _this.connectable=connectable,_this}return __extends(RefCountSubscriber,_super),RefCountSubscriber.prototype._unsubscribe=function(){var connectable=this.connectable;if(connectable){this.connectable=null;var refCount=connectable._refCount;if(refCount<=0)this.connection=null;else if(connectable._refCount=refCount-1,1<refCount)this.connection=null;else{var connection=this.connection,sharedConnection=connectable._connection;this.connection=null,!sharedConnection||connection&&sharedConnection!==connection||sharedConnection.unsubscribe()}}else this.connection=null},RefCountSubscriber}(Subscriber_1.Subscriber))},{"../Observable":94,"../Subject":99,"../Subscriber":101,"../Subscription":102,"../operators/refCount":196}],105:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),asap_1=require("../scheduler/asap"),isNumeric_1=require("../util/isNumeric"),SubscribeOnObservable=function(_super){function SubscribeOnObservable(source,delayTime,scheduler){void 0===delayTime&&(delayTime=0),void 0===scheduler&&(scheduler=asap_1.asap);var _this=_super.call(this)||this;return _this.source=source,_this.delayTime=delayTime,_this.scheduler=scheduler,(!isNumeric_1.isNumeric(delayTime)||delayTime<0)&&(_this.delayTime=0),scheduler&&"function"==typeof scheduler.schedule||(_this.scheduler=asap_1.asap),_this}return __extends(SubscribeOnObservable,_super),SubscribeOnObservable.create=function(source,delay,scheduler){return void 0===delay&&(delay=0),void 0===scheduler&&(scheduler=asap_1.asap),new SubscribeOnObservable(source,delay,scheduler)},SubscribeOnObservable.dispatch=function(arg){var source=arg.source,subscriber=arg.subscriber;return this.add(source.subscribe(subscriber))},SubscribeOnObservable.prototype._subscribe=function(subscriber){var delay=this.delayTime,source=this.source;return this.scheduler.schedule(SubscribeOnObservable.dispatch,delay,{source:source,subscriber:subscriber})},SubscribeOnObservable}(Observable_1.Observable);exports.SubscribeOnObservable=SubscribeOnObservable},{"../Observable":94,"../scheduler/asap":249,"../util/isNumeric":270}],106:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),AsyncSubject_1=require("../AsyncSubject"),map_1=require("../operators/map"),canReportError_1=require("../util/canReportError"),isArray_1=require("../util/isArray"),isScheduler_1=require("../util/isScheduler");function dispatch(state){var _this=this,args=state.args,subscriber=state.subscriber,params=state.params,callbackFunc=params.callbackFunc,context=params.context,scheduler=params.scheduler,subject=params.subject;if(!subject){subject=params.subject=new AsyncSubject_1.AsyncSubject;try{callbackFunc.apply(context,args.concat([function(){for(var innerArgs=[],_i=0;_i<arguments.length;_i++)innerArgs[_i]=arguments[_i];var value=innerArgs.length<=1?innerArgs[0]:innerArgs;_this.add(scheduler.schedule(dispatchNext,0,{value:value,subject:subject}))}]))}catch(err){subject.error(err)}}this.add(subject.subscribe(subscriber))}function dispatchNext(state){var value=state.value,subject=state.subject;subject.next(value),subject.complete()}exports.bindCallback=function bindCallback(callbackFunc,resultSelector,scheduler){if(resultSelector){if(!isScheduler_1.isScheduler(resultSelector))return function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return bindCallback(callbackFunc,scheduler).apply(void 0,args).pipe(map_1.map(function(args){return isArray_1.isArray(args)?resultSelector.apply(void 0,args):resultSelector(args)}))};scheduler=resultSelector}return function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];var subject,context=this,params={context:context,subject:subject,callbackFunc:callbackFunc,scheduler:scheduler};return new Observable_1.Observable(function(subscriber){if(scheduler){var state={args:args,subscriber:subscriber,params:params};return scheduler.schedule(dispatch,0,state)}if(!subject){subject=new AsyncSubject_1.AsyncSubject;try{callbackFunc.apply(context,args.concat([function(){for(var innerArgs=[],_i=0;_i<arguments.length;_i++)innerArgs[_i]=arguments[_i];subject.next(innerArgs.length<=1?innerArgs[0]:innerArgs),subject.complete()}]))}catch(err){canReportError_1.canReportError(subject)?subject.error(err):console.warn(err)}}return subject.subscribe(subscriber)})}}},{"../AsyncSubject":90,"../Observable":94,"../operators/map":174,"../util/canReportError":261,"../util/isArray":264,"../util/isScheduler":274}],107:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),AsyncSubject_1=require("../AsyncSubject"),map_1=require("../operators/map"),canReportError_1=require("../util/canReportError"),isScheduler_1=require("../util/isScheduler"),isArray_1=require("../util/isArray");function dispatch(state){var _this=this,params=state.params,subscriber=state.subscriber,context=state.context,callbackFunc=params.callbackFunc,args=params.args,scheduler=params.scheduler,subject=params.subject;if(!subject){subject=params.subject=new AsyncSubject_1.AsyncSubject;try{callbackFunc.apply(context,args.concat([function(){for(var innerArgs=[],_i=0;_i<arguments.length;_i++)innerArgs[_i]=arguments[_i];var err=innerArgs.shift();if(err)_this.add(scheduler.schedule(dispatchError,0,{err:err,subject:subject}));else{var value=innerArgs.length<=1?innerArgs[0]:innerArgs;_this.add(scheduler.schedule(dispatchNext,0,{value:value,subject:subject}))}}]))}catch(err){this.add(scheduler.schedule(dispatchError,0,{err:err,subject:subject}))}}this.add(subject.subscribe(subscriber))}function dispatchNext(arg){var value=arg.value,subject=arg.subject;subject.next(value),subject.complete()}function dispatchError(arg){var err=arg.err;arg.subject.error(err)}exports.bindNodeCallback=function bindNodeCallback(callbackFunc,resultSelector,scheduler){if(resultSelector){if(!isScheduler_1.isScheduler(resultSelector))return function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return bindNodeCallback(callbackFunc,scheduler).apply(void 0,args).pipe(map_1.map(function(args){return isArray_1.isArray(args)?resultSelector.apply(void 0,args):resultSelector(args)}))};scheduler=resultSelector}return function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];var params={subject:void 0,args:args,callbackFunc:callbackFunc,scheduler:scheduler,context:this};return new Observable_1.Observable(function(subscriber){var context=params.context,subject=params.subject;if(scheduler)return scheduler.schedule(dispatch,0,{params:params,subscriber:subscriber,context:context});if(!subject){subject=params.subject=new AsyncSubject_1.AsyncSubject;try{callbackFunc.apply(context,args.concat([function(){for(var innerArgs=[],_i=0;_i<arguments.length;_i++)innerArgs[_i]=arguments[_i];var err=innerArgs.shift();err?subject.error(err):(subject.next(innerArgs.length<=1?innerArgs[0]:innerArgs),subject.complete())}]))}catch(err){canReportError_1.canReportError(subject)?subject.error(err):console.warn(err)}}return subject.subscribe(subscriber)})}}},{"../AsyncSubject":90,"../Observable":94,"../operators/map":174,"../util/canReportError":261,"../util/isArray":264,"../util/isScheduler":274}],108:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var isScheduler_1=require("../util/isScheduler"),isArray_1=require("../util/isArray"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult"),fromArray_1=require("./fromArray"),NONE={};exports.combineLatest=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];var resultSelector=null,scheduler=null;return isScheduler_1.isScheduler(observables[observables.length-1])&&(scheduler=observables.pop()),"function"==typeof observables[observables.length-1]&&(resultSelector=observables.pop()),1===observables.length&&isArray_1.isArray(observables[0])&&(observables=observables[0]),fromArray_1.fromArray(observables,scheduler).lift(new CombineLatestOperator(resultSelector))};var CombineLatestOperator=function(){function CombineLatestOperator(resultSelector){this.resultSelector=resultSelector}return CombineLatestOperator.prototype.call=function(subscriber,source){return source.subscribe(new CombineLatestSubscriber(subscriber,this.resultSelector))},CombineLatestOperator}();exports.CombineLatestOperator=CombineLatestOperator;var CombineLatestSubscriber=function(_super){function CombineLatestSubscriber(destination,resultSelector){var _this=_super.call(this,destination)||this;return _this.resultSelector=resultSelector,_this.active=0,_this.values=[],_this.observables=[],_this}return __extends(CombineLatestSubscriber,_super),CombineLatestSubscriber.prototype._next=function(observable){this.values.push(NONE),this.observables.push(observable)},CombineLatestSubscriber.prototype._complete=function(){var observables=this.observables,len=observables.length;if(0===len)this.destination.complete();else{this.active=len,this.toRespond=len;for(var i=0;i<len;i++){var observable=observables[i];this.add(subscribeToResult_1.subscribeToResult(this,observable,observable,i))}}},CombineLatestSubscriber.prototype.notifyComplete=function(unused){0==(this.active-=1)&&this.destination.complete()},CombineLatestSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){var values=this.values,oldVal=values[outerIndex],toRespond=this.toRespond?oldVal===NONE?--this.toRespond:this.toRespond:0;values[outerIndex]=innerValue,0===toRespond&&(this.resultSelector?this._tryResultSelector(values):this.destination.next(values.slice()))},CombineLatestSubscriber.prototype._tryResultSelector=function(values){var result;try{result=this.resultSelector.apply(this,values)}catch(err){return void this.destination.error(err)}this.destination.next(result)},CombineLatestSubscriber}(OuterSubscriber_1.OuterSubscriber);exports.CombineLatestSubscriber=CombineLatestSubscriber},{"../OuterSubscriber":96,"../util/isArray":264,"../util/isScheduler":274,"../util/subscribeToResult":283,"./fromArray":114}],109:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var of_1=require("./of"),concatAll_1=require("../operators/concatAll");exports.concat=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];return concatAll_1.concatAll()(of_1.of.apply(void 0,observables))}},{"../operators/concatAll":146,"./of":125}],110:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),from_1=require("./from"),empty_1=require("./empty");exports.defer=function(observableFactory){return new Observable_1.Observable(function(subscriber){var input;try{input=observableFactory()}catch(err){return void subscriber.error(err)}return(input?from_1.from(input):empty_1.empty()).subscribe(subscriber)})}},{"../Observable":94,"./empty":111,"./from":113}],111:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable");function emptyScheduled(scheduler){return new Observable_1.Observable(function(subscriber){return scheduler.schedule(function(){return subscriber.complete()})})}exports.EMPTY=new Observable_1.Observable(function(subscriber){return subscriber.complete()}),exports.empty=function(scheduler){return scheduler?emptyScheduled(scheduler):exports.EMPTY},exports.emptyScheduled=emptyScheduled},{"../Observable":94}],112:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),isArray_1=require("../util/isArray"),empty_1=require("./empty"),subscribeToResult_1=require("../util/subscribeToResult"),OuterSubscriber_1=require("../OuterSubscriber"),map_1=require("../operators/map");exports.forkJoin=function forkJoin(){for(var resultSelector,sources=[],_i=0;_i<arguments.length;_i++)sources[_i]=arguments[_i];return"function"==typeof sources[sources.length-1]&&(resultSelector=sources.pop()),1===sources.length&&isArray_1.isArray(sources[0])&&(sources=sources[0]),0===sources.length?empty_1.EMPTY:resultSelector?forkJoin(sources).pipe(map_1.map(function(args){return resultSelector.apply(void 0,args)})):new Observable_1.Observable(function(subscriber){return new ForkJoinSubscriber(subscriber,sources)})};var ForkJoinSubscriber=function(_super){function ForkJoinSubscriber(destination,sources){var _this=_super.call(this,destination)||this;_this.sources=sources,_this.completed=0,_this.haveValues=0;var len=sources.length;_this.values=new Array(len);for(var i=0;i<len;i++){var source=sources[i],innerSubscription=subscribeToResult_1.subscribeToResult(_this,source,null,i);innerSubscription&&_this.add(innerSubscription)}return _this}return __extends(ForkJoinSubscriber,_super),ForkJoinSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.values[outerIndex]=innerValue,innerSub._hasValue||(innerSub._hasValue=!0,this.haveValues++)},ForkJoinSubscriber.prototype.notifyComplete=function(innerSub){var destination=this.destination,haveValues=this.haveValues,values=this.values,len=values.length;innerSub._hasValue?(this.completed++,this.completed===len&&(haveValues===len&&destination.next(values),destination.complete())):destination.complete()},ForkJoinSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../Observable":94,"../OuterSubscriber":96,"../operators/map":174,"../util/isArray":264,"../util/subscribeToResult":283,"./empty":111}],113:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),isPromise_1=require("../util/isPromise"),isArrayLike_1=require("../util/isArrayLike"),isInteropObservable_1=require("../util/isInteropObservable"),isIterable_1=require("../util/isIterable"),fromArray_1=require("./fromArray"),fromPromise_1=require("./fromPromise"),fromIterable_1=require("./fromIterable"),fromObservable_1=require("./fromObservable"),subscribeTo_1=require("../util/subscribeTo");exports.from=function(input,scheduler){if(!scheduler)return input instanceof Observable_1.Observable?input:new Observable_1.Observable(subscribeTo_1.subscribeTo(input));if(null!=input){if(isInteropObservable_1.isInteropObservable(input))return fromObservable_1.fromObservable(input,scheduler);if(isPromise_1.isPromise(input))return fromPromise_1.fromPromise(input,scheduler);if(isArrayLike_1.isArrayLike(input))return fromArray_1.fromArray(input,scheduler);if(isIterable_1.isIterable(input)||"string"==typeof input)return fromIterable_1.fromIterable(input,scheduler)}throw new TypeError((null!==input&&typeof input||input)+" is not observable")}},{"../Observable":94,"../util/isArrayLike":265,"../util/isInteropObservable":268,"../util/isIterable":269,"../util/isPromise":273,"../util/subscribeTo":278,"./fromArray":114,"./fromIterable":117,"./fromObservable":118,"./fromPromise":119}],114:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),Subscription_1=require("../Subscription"),subscribeToArray_1=require("../util/subscribeToArray");exports.fromArray=function(input,scheduler){return scheduler?new Observable_1.Observable(function(subscriber){var sub=new Subscription_1.Subscription,i=0;return sub.add(scheduler.schedule(function(){i!==input.length?(subscriber.next(input[i++]),subscriber.closed||sub.add(this.schedule())):subscriber.complete()})),sub}):new Observable_1.Observable(subscribeToArray_1.subscribeToArray(input))}},{"../Observable":94,"../Subscription":102,"../util/subscribeToArray":279}],115:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),isArray_1=require("../util/isArray"),isFunction_1=require("../util/isFunction"),map_1=require("../operators/map");Object.prototype.toString;function isNodeStyleEventEmitter(sourceObj){return sourceObj&&"function"==typeof sourceObj.addListener&&"function"==typeof sourceObj.removeListener}function isJQueryStyleEventEmitter(sourceObj){return sourceObj&&"function"==typeof sourceObj.on&&"function"==typeof sourceObj.off}function isEventTarget(sourceObj){return sourceObj&&"function"==typeof sourceObj.addEventListener&&"function"==typeof sourceObj.removeEventListener}exports.fromEvent=function fromEvent(target,eventName,options,resultSelector){return isFunction_1.isFunction(options)&&(resultSelector=options,options=void 0),resultSelector?fromEvent(target,eventName,options).pipe(map_1.map(function(args){return isArray_1.isArray(args)?resultSelector.apply(void 0,args):resultSelector(args)})):new Observable_1.Observable(function(subscriber){!function setupSubscription(sourceObj,eventName,handler,subscriber,options){var unsubscribe;if(isEventTarget(sourceObj)){var source_1=sourceObj;sourceObj.addEventListener(eventName,handler,options),unsubscribe=function(){return source_1.removeEventListener(eventName,handler,options)}}else if(isJQueryStyleEventEmitter(sourceObj)){var source_2=sourceObj;sourceObj.on(eventName,handler),unsubscribe=function(){return source_2.off(eventName,handler)}}else if(isNodeStyleEventEmitter(sourceObj)){var source_3=sourceObj;sourceObj.addListener(eventName,handler),unsubscribe=function(){return source_3.removeListener(eventName,handler)}}else{if(!sourceObj||!sourceObj.length)throw new TypeError("Invalid event target");for(var i=0,len=sourceObj.length;i<len;i++)setupSubscription(sourceObj[i],eventName,handler,subscriber,options)}subscriber.add(unsubscribe)}(target,eventName,function(e){1<arguments.length?subscriber.next(Array.prototype.slice.call(arguments)):subscriber.next(e)},subscriber,options)})}},{"../Observable":94,"../operators/map":174,"../util/isArray":264,"../util/isFunction":267}],116:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),isArray_1=require("../util/isArray"),isFunction_1=require("../util/isFunction"),map_1=require("../operators/map");exports.fromEventPattern=function fromEventPattern(addHandler,removeHandler,resultSelector){return resultSelector?fromEventPattern(addHandler,removeHandler).pipe(map_1.map(function(args){return isArray_1.isArray(args)?resultSelector.apply(void 0,args):resultSelector(args)})):new Observable_1.Observable(function(subscriber){var retValue,handler=function(){for(var e=[],_i=0;_i<arguments.length;_i++)e[_i]=arguments[_i];return subscriber.next(1===e.length?e[0]:e)};try{retValue=addHandler(handler)}catch(err){return void subscriber.error(err)}if(isFunction_1.isFunction(removeHandler))return function(){return removeHandler(handler,retValue)}})}},{"../Observable":94,"../operators/map":174,"../util/isArray":264,"../util/isFunction":267}],117:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),Subscription_1=require("../Subscription"),iterator_1=require("../symbol/iterator"),subscribeToIterable_1=require("../util/subscribeToIterable");exports.fromIterable=function(input,scheduler){if(!input)throw new Error("Iterable cannot be null");return scheduler?new Observable_1.Observable(function(subscriber){var iterator,sub=new Subscription_1.Subscription;return sub.add(function(){iterator&&"function"==typeof iterator.return&&iterator.return()}),sub.add(scheduler.schedule(function(){iterator=input[iterator_1.iterator](),sub.add(scheduler.schedule(function(){if(!subscriber.closed){var value,done;try{var result=iterator.next();value=result.value,done=result.done}catch(err){return void subscriber.error(err)}done?subscriber.complete():(subscriber.next(value),this.schedule())}}))})),sub}):new Observable_1.Observable(subscribeToIterable_1.subscribeToIterable(input))}},{"../Observable":94,"../Subscription":102,"../symbol/iterator":252,"../util/subscribeToIterable":280}],118:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),Subscription_1=require("../Subscription"),observable_1=require("../symbol/observable"),subscribeToObservable_1=require("../util/subscribeToObservable");exports.fromObservable=function(input,scheduler){return scheduler?new Observable_1.Observable(function(subscriber){var sub=new Subscription_1.Subscription;return sub.add(scheduler.schedule(function(){var observable=input[observable_1.observable]();sub.add(observable.subscribe({next:function(value){sub.add(scheduler.schedule(function(){return subscriber.next(value)}))},error:function(err){sub.add(scheduler.schedule(function(){return subscriber.error(err)}))},complete:function(){sub.add(scheduler.schedule(function(){return subscriber.complete()}))}}))})),sub}):new Observable_1.Observable(subscribeToObservable_1.subscribeToObservable(input))}},{"../Observable":94,"../Subscription":102,"../symbol/observable":253,"../util/subscribeToObservable":281}],119:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),Subscription_1=require("../Subscription"),subscribeToPromise_1=require("../util/subscribeToPromise");exports.fromPromise=function(input,scheduler){return scheduler?new Observable_1.Observable(function(subscriber){var sub=new Subscription_1.Subscription;return sub.add(scheduler.schedule(function(){return input.then(function(value){sub.add(scheduler.schedule(function(){subscriber.next(value),sub.add(scheduler.schedule(function(){return subscriber.complete()}))}))},function(err){sub.add(scheduler.schedule(function(){return subscriber.error(err)}))})})),sub}):new Observable_1.Observable(subscribeToPromise_1.subscribeToPromise(input))}},{"../Observable":94,"../Subscription":102,"../util/subscribeToPromise":282}],120:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),identity_1=require("../util/identity"),isScheduler_1=require("../util/isScheduler");function dispatch(state){var subscriber=state.subscriber,condition=state.condition;if(!subscriber.closed){if(state.needIterate)try{state.state=state.iterate(state.state)}catch(err){return void subscriber.error(err)}else state.needIterate=!0;if(condition){var conditionResult=void 0;try{conditionResult=condition(state.state)}catch(err){return void subscriber.error(err)}if(!conditionResult)return void subscriber.complete();if(subscriber.closed)return}var value;try{value=state.resultSelector(state.state)}catch(err){return void subscriber.error(err)}if(!subscriber.closed&&(subscriber.next(value),!subscriber.closed))return this.schedule(state)}}exports.generate=function(initialStateOrOptions,condition,iterate,resultSelectorOrObservable,scheduler){var resultSelector,initialState;if(1==arguments.length){var options=initialStateOrOptions;initialState=options.initialState,condition=options.condition,iterate=options.iterate,resultSelector=options.resultSelector||identity_1.identity,scheduler=options.scheduler}else void 0===resultSelectorOrObservable||isScheduler_1.isScheduler(resultSelectorOrObservable)?(initialState=initialStateOrOptions,resultSelector=identity_1.identity,scheduler=resultSelectorOrObservable):(initialState=initialStateOrOptions,resultSelector=resultSelectorOrObservable);return new Observable_1.Observable(function(subscriber){var state=initialState;if(scheduler)return scheduler.schedule(dispatch,0,{subscriber:subscriber,iterate:iterate,condition:condition,resultSelector:resultSelector,state:state});for(;;){if(condition){var conditionResult=void 0;try{conditionResult=condition(state)}catch(err){return void subscriber.error(err)}if(!conditionResult){subscriber.complete();break}}var value=void 0;try{value=resultSelector(state)}catch(err){return void subscriber.error(err)}if(subscriber.next(value),subscriber.closed)break;try{state=iterate(state)}catch(err){return void subscriber.error(err)}}})}},{"../Observable":94,"../util/identity":263,"../util/isScheduler":274}],121:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var defer_1=require("./defer"),empty_1=require("./empty");exports.iif=function(condition,trueResult,falseResult){return void 0===trueResult&&(trueResult=empty_1.EMPTY),void 0===falseResult&&(falseResult=empty_1.EMPTY),defer_1.defer(function(){return condition()?trueResult:falseResult})}},{"./defer":110,"./empty":111}],122:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),async_1=require("../scheduler/async"),isNumeric_1=require("../util/isNumeric");function dispatch(state){var subscriber=state.subscriber,counter=state.counter,period=state.period;subscriber.next(counter),this.schedule({subscriber:subscriber,counter:counter+1,period:period},period)}exports.interval=function(period,scheduler){return void 0===period&&(period=0),void 0===scheduler&&(scheduler=async_1.async),(!isNumeric_1.isNumeric(period)||period<0)&&(period=0),scheduler&&"function"==typeof scheduler.schedule||(scheduler=async_1.async),new Observable_1.Observable(function(subscriber){return subscriber.add(scheduler.schedule(dispatch,period,{subscriber:subscriber,counter:0,period:period})),subscriber})}},{"../Observable":94,"../scheduler/async":250,"../util/isNumeric":270}],123:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),isScheduler_1=require("../util/isScheduler"),mergeAll_1=require("../operators/mergeAll"),fromArray_1=require("./fromArray");exports.merge=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];var concurrent=Number.POSITIVE_INFINITY,scheduler=null,last=observables[observables.length-1];return isScheduler_1.isScheduler(last)?(scheduler=observables.pop(),1<observables.length&&"number"==typeof observables[observables.length-1]&&(concurrent=observables.pop())):"number"==typeof last&&(concurrent=observables.pop()),null===scheduler&&1===observables.length&&observables[0]instanceof Observable_1.Observable?observables[0]:mergeAll_1.mergeAll(concurrent)(fromArray_1.fromArray(observables,scheduler))}},{"../Observable":94,"../operators/mergeAll":179,"../util/isScheduler":274,"./fromArray":114}],124:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),noop_1=require("../util/noop");exports.NEVER=new Observable_1.Observable(noop_1.noop),exports.never=function(){return exports.NEVER}},{"../Observable":94,"../util/noop":275}],125:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var isScheduler_1=require("../util/isScheduler"),fromArray_1=require("./fromArray"),empty_1=require("./empty"),scalar_1=require("./scalar");exports.of=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];var scheduler=args[args.length-1];switch(isScheduler_1.isScheduler(scheduler)?args.pop():scheduler=void 0,args.length){case 0:return empty_1.empty(scheduler);case 1:return scheduler?fromArray_1.fromArray(args,scheduler):scalar_1.scalar(args[0]);default:return fromArray_1.fromArray(args,scheduler)}}},{"../util/isScheduler":274,"./empty":111,"./fromArray":114,"./scalar":130}],126:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),from_1=require("./from"),isArray_1=require("../util/isArray"),empty_1=require("./empty");exports.onErrorResumeNext=function onErrorResumeNext(){for(var sources=[],_i=0;_i<arguments.length;_i++)sources[_i]=arguments[_i];if(0===sources.length)return empty_1.EMPTY;var first=sources[0],remainder=sources.slice(1);return 1===sources.length&&isArray_1.isArray(first)?onErrorResumeNext.apply(void 0,first):new Observable_1.Observable(function(subscriber){var subNext=function(){return subscriber.add(onErrorResumeNext.apply(void 0,remainder).subscribe(subscriber))};return from_1.from(first).subscribe({next:function(value){subscriber.next(value)},error:subNext,complete:subNext})})}},{"../Observable":94,"../util/isArray":264,"./empty":111,"./from":113}],127:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),Subscription_1=require("../Subscription");function dispatch(state){var keys=state.keys,index=state.index,subscriber=state.subscriber,subscription=state.subscription,obj=state.obj;if(!subscriber.closed)if(index<keys.length){var key=keys[index];subscriber.next([key,obj[key]]),subscription.add(this.schedule({keys:keys,index:index+1,subscriber:subscriber,subscription:subscription,obj:obj}))}else subscriber.complete()}exports.pairs=function(obj,scheduler){return scheduler?new Observable_1.Observable(function(subscriber){var keys=Object.keys(obj),subscription=new Subscription_1.Subscription;return subscription.add(scheduler.schedule(dispatch,0,{keys:keys,index:0,subscriber:subscriber,subscription:subscription,obj:obj})),subscription}):new Observable_1.Observable(function(subscriber){for(var keys=Object.keys(obj),i=0;i<keys.length&&!subscriber.closed;i++){var key=keys[i];obj.hasOwnProperty(key)&&subscriber.next([key,obj[key]])}subscriber.complete()})},exports.dispatch=dispatch},{"../Observable":94,"../Subscription":102}],128:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var isArray_1=require("../util/isArray"),fromArray_1=require("./fromArray"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.race=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];if(1===observables.length){if(!isArray_1.isArray(observables[0]))return observables[0];observables=observables[0]}return fromArray_1.fromArray(observables,void 0).lift(new RaceOperator)};var RaceOperator=function(){function RaceOperator(){}return RaceOperator.prototype.call=function(subscriber,source){return source.subscribe(new RaceSubscriber(subscriber))},RaceOperator}();exports.RaceOperator=RaceOperator;var RaceSubscriber=function(_super){function RaceSubscriber(destination){var _this=_super.call(this,destination)||this;return _this.hasFirst=!1,_this.observables=[],_this.subscriptions=[],_this}return __extends(RaceSubscriber,_super),RaceSubscriber.prototype._next=function(observable){this.observables.push(observable)},RaceSubscriber.prototype._complete=function(){var observables=this.observables,len=observables.length;if(0===len)this.destination.complete();else{for(var i=0;i<len&&!this.hasFirst;i++){var observable=observables[i],subscription=subscribeToResult_1.subscribeToResult(this,observable,observable,i);this.subscriptions&&this.subscriptions.push(subscription),this.add(subscription)}this.observables=null}},RaceSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){if(!this.hasFirst){this.hasFirst=!0;for(var i=0;i<this.subscriptions.length;i++)if(i!==outerIndex){var subscription=this.subscriptions[i];subscription.unsubscribe(),this.remove(subscription)}this.subscriptions=null}this.destination.next(innerValue)},RaceSubscriber}(OuterSubscriber_1.OuterSubscriber);exports.RaceSubscriber=RaceSubscriber},{"../OuterSubscriber":96,"../util/isArray":264,"../util/subscribeToResult":283,"./fromArray":114}],129:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable");function dispatch(state){var start=state.start,index=state.index,count=state.count,subscriber=state.subscriber;count<=index?subscriber.complete():(subscriber.next(start),subscriber.closed||(state.index=index+1,state.start=start+1,this.schedule(state)))}exports.range=function(start,count,scheduler){return void 0===start&&(start=0),new Observable_1.Observable(function(subscriber){void 0===count&&(count=start,start=0);var index=0,current=start;if(scheduler)return scheduler.schedule(dispatch,0,{index:index,count:count,start:start,subscriber:subscriber});for(;;){if(index++>=count){subscriber.complete();break}if(subscriber.next(current++),subscriber.closed)break}})},exports.dispatch=dispatch},{"../Observable":94}],130:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable");exports.scalar=function(value){var result=new Observable_1.Observable(function(subscriber){subscriber.next(value),subscriber.complete()});return result._isScalar=!0,result.value=value,result}},{"../Observable":94}],131:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable");function dispatch(_a){var error=_a.error;_a.subscriber.error(error)}exports.throwError=function(error,scheduler){return scheduler?new Observable_1.Observable(function(subscriber){return scheduler.schedule(dispatch,0,{error:error,subscriber:subscriber})}):new Observable_1.Observable(function(subscriber){return subscriber.error(error)})}},{"../Observable":94}],132:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),async_1=require("../scheduler/async"),isNumeric_1=require("../util/isNumeric"),isScheduler_1=require("../util/isScheduler");function dispatch(state){var index=state.index,period=state.period,subscriber=state.subscriber;if(subscriber.next(index),!subscriber.closed){if(-1===period)return subscriber.complete();state.index=index+1,this.schedule(state,period)}}exports.timer=function(dueTime,periodOrScheduler,scheduler){void 0===dueTime&&(dueTime=0);var period=-1;return isNumeric_1.isNumeric(periodOrScheduler)?period=Number(periodOrScheduler)<1?1:Number(periodOrScheduler):isScheduler_1.isScheduler(periodOrScheduler)&&(scheduler=periodOrScheduler),isScheduler_1.isScheduler(scheduler)||(scheduler=async_1.async),new Observable_1.Observable(function(subscriber){var due=isNumeric_1.isNumeric(dueTime)?dueTime:+dueTime-scheduler.now();return scheduler.schedule(dispatch,due,{index:0,period:period,subscriber:subscriber})})}},{"../Observable":94,"../scheduler/async":250,"../util/isNumeric":270,"../util/isScheduler":274}],133:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),from_1=require("./from"),empty_1=require("./empty");exports.using=function(resourceFactory,observableFactory){return new Observable_1.Observable(function(subscriber){var resource,result;try{resource=resourceFactory()}catch(err){return void subscriber.error(err)}try{result=observableFactory(resource)}catch(err){return void subscriber.error(err)}var subscription=(result?from_1.from(result):empty_1.EMPTY).subscribe(subscriber);return function(){subscription.unsubscribe(),resource&&resource.unsubscribe()}})}},{"../Observable":94,"./empty":111,"./from":113}],134:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var fromArray_1=require("./fromArray"),isArray_1=require("../util/isArray"),Subscriber_1=require("../Subscriber"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult"),iterator_1=require("../../internal/symbol/iterator");exports.zip=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];var resultSelector=observables[observables.length-1];return"function"==typeof resultSelector&&observables.pop(),fromArray_1.fromArray(observables,void 0).lift(new ZipOperator(resultSelector))};var ZipOperator=function(){function ZipOperator(resultSelector){this.resultSelector=resultSelector}return ZipOperator.prototype.call=function(subscriber,source){return source.subscribe(new ZipSubscriber(subscriber,this.resultSelector))},ZipOperator}();exports.ZipOperator=ZipOperator;var ZipSubscriber=function(_super){function ZipSubscriber(destination,resultSelector,values){void 0===values&&(values=Object.create(null));var _this=_super.call(this,destination)||this;return _this.iterators=[],_this.active=0,_this.resultSelector="function"==typeof resultSelector?resultSelector:null,_this.values=values,_this}return __extends(ZipSubscriber,_super),ZipSubscriber.prototype._next=function(value){var iterators=this.iterators;isArray_1.isArray(value)?iterators.push(new StaticArrayIterator(value)):"function"==typeof value[iterator_1.iterator]?iterators.push(new StaticIterator(value[iterator_1.iterator]())):iterators.push(new ZipBufferIterator(this.destination,this,value))},ZipSubscriber.prototype._complete=function(){var iterators=this.iterators,len=iterators.length;if(this.unsubscribe(),0!==len){this.active=len;for(var i=0;i<len;i++){var iterator=iterators[i];if(iterator.stillUnsubscribed)this.destination.add(iterator.subscribe(iterator,i));else this.active--}}else this.destination.complete()},ZipSubscriber.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},ZipSubscriber.prototype.checkIterators=function(){for(var iterators=this.iterators,len=iterators.length,destination=this.destination,i=0;i<len;i++){if("function"==typeof(iterator=iterators[i]).hasValue&&!iterator.hasValue())return}var shouldComplete=!1,args=[];for(i=0;i<len;i++){var iterator,result=(iterator=iterators[i]).next();if(iterator.hasCompleted()&&(shouldComplete=!0),result.done)return void destination.complete();args.push(result.value)}this.resultSelector?this._tryresultSelector(args):destination.next(args),shouldComplete&&destination.complete()},ZipSubscriber.prototype._tryresultSelector=function(args){var result;try{result=this.resultSelector.apply(this,args)}catch(err){return void this.destination.error(err)}this.destination.next(result)},ZipSubscriber}(Subscriber_1.Subscriber);exports.ZipSubscriber=ZipSubscriber;var StaticIterator=function(){function StaticIterator(iterator){this.iterator=iterator,this.nextResult=iterator.next()}return StaticIterator.prototype.hasValue=function(){return!0},StaticIterator.prototype.next=function(){var result=this.nextResult;return this.nextResult=this.iterator.next(),result},StaticIterator.prototype.hasCompleted=function(){var nextResult=this.nextResult;return nextResult&&nextResult.done},StaticIterator}(),StaticArrayIterator=function(){function StaticArrayIterator(array){this.array=array,this.index=0,this.length=0,this.length=array.length}return StaticArrayIterator.prototype[iterator_1.iterator]=function(){return this},StaticArrayIterator.prototype.next=function(value){var i=this.index++,array=this.array;return i<this.length?{value:array[i],done:!1}:{value:null,done:!0}},StaticArrayIterator.prototype.hasValue=function(){return this.array.length>this.index},StaticArrayIterator.prototype.hasCompleted=function(){return this.array.length===this.index},StaticArrayIterator}(),ZipBufferIterator=function(_super){function ZipBufferIterator(destination,parent,observable){var _this=_super.call(this,destination)||this;return _this.parent=parent,_this.observable=observable,_this.stillUnsubscribed=!0,_this.buffer=[],_this.isComplete=!1,_this}return __extends(ZipBufferIterator,_super),ZipBufferIterator.prototype[iterator_1.iterator]=function(){return this},ZipBufferIterator.prototype.next=function(){var buffer=this.buffer;return 0===buffer.length&&this.isComplete?{value:null,done:!0}:{value:buffer.shift(),done:!1}},ZipBufferIterator.prototype.hasValue=function(){return 0<this.buffer.length},ZipBufferIterator.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},ZipBufferIterator.prototype.notifyComplete=function(){0<this.buffer.length?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},ZipBufferIterator.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.buffer.push(innerValue),this.parent.checkIterators()},ZipBufferIterator.prototype.subscribe=function(value,index){return subscribeToResult_1.subscribeToResult(this,this.observable,this,index)},ZipBufferIterator}(OuterSubscriber_1.OuterSubscriber)},{"../../internal/symbol/iterator":252,"../OuterSubscriber":96,"../Subscriber":101,"../util/isArray":264,"../util/subscribeToResult":283,"./fromArray":114}],135:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.audit=function(durationSelector){return function(source){return source.lift(new AuditOperator(durationSelector))}};var AuditOperator=function(){function AuditOperator(durationSelector){this.durationSelector=durationSelector}return AuditOperator.prototype.call=function(subscriber,source){return source.subscribe(new AuditSubscriber(subscriber,this.durationSelector))},AuditOperator}(),AuditSubscriber=function(_super){function AuditSubscriber(destination,durationSelector){var _this=_super.call(this,destination)||this;return _this.durationSelector=durationSelector,_this.hasValue=!1,_this}return __extends(AuditSubscriber,_super),AuditSubscriber.prototype._next=function(value){if(this.value=value,this.hasValue=!0,!this.throttled){var duration=void 0;try{duration=(0,this.durationSelector)(value)}catch(err){return this.destination.error(err)}var innerSubscription=subscribeToResult_1.subscribeToResult(this,duration);!innerSubscription||innerSubscription.closed?this.clearThrottle():this.add(this.throttled=innerSubscription)}},AuditSubscriber.prototype.clearThrottle=function(){var value=this.value,hasValue=this.hasValue,throttled=this.throttled;throttled&&(this.remove(throttled),this.throttled=null,throttled.unsubscribe()),hasValue&&(this.value=null,this.hasValue=!1,this.destination.next(value))},AuditSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex){this.clearThrottle()},AuditSubscriber.prototype.notifyComplete=function(){this.clearThrottle()},AuditSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],136:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var async_1=require("../scheduler/async"),audit_1=require("./audit"),timer_1=require("../observable/timer");exports.auditTime=function(duration,scheduler){return void 0===scheduler&&(scheduler=async_1.async),audit_1.audit(function(){return timer_1.timer(duration,scheduler)})}},{"../observable/timer":132,"../scheduler/async":250,"./audit":135}],137:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.buffer=function(closingNotifier){return function(source){return source.lift(new BufferOperator(closingNotifier))}};var BufferOperator=function(){function BufferOperator(closingNotifier){this.closingNotifier=closingNotifier}return BufferOperator.prototype.call=function(subscriber,source){return source.subscribe(new BufferSubscriber(subscriber,this.closingNotifier))},BufferOperator}(),BufferSubscriber=function(_super){function BufferSubscriber(destination,closingNotifier){var _this=_super.call(this,destination)||this;return _this.buffer=[],_this.add(subscribeToResult_1.subscribeToResult(_this,closingNotifier)),_this}return __extends(BufferSubscriber,_super),BufferSubscriber.prototype._next=function(value){this.buffer.push(value)},BufferSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){var buffer=this.buffer;this.buffer=[],this.destination.next(buffer)},BufferSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],138:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.bufferCount=function(bufferSize,startBufferEvery){return void 0===startBufferEvery&&(startBufferEvery=null),function(source){return source.lift(new BufferCountOperator(bufferSize,startBufferEvery))}};var BufferCountOperator=function(){function BufferCountOperator(bufferSize,startBufferEvery){this.bufferSize=bufferSize,this.startBufferEvery=startBufferEvery,this.subscriberClass=startBufferEvery&&bufferSize!==startBufferEvery?BufferSkipCountSubscriber:BufferCountSubscriber}return BufferCountOperator.prototype.call=function(subscriber,source){return source.subscribe(new this.subscriberClass(subscriber,this.bufferSize,this.startBufferEvery))},BufferCountOperator}(),BufferCountSubscriber=function(_super){function BufferCountSubscriber(destination,bufferSize){var _this=_super.call(this,destination)||this;return _this.bufferSize=bufferSize,_this.buffer=[],_this}return __extends(BufferCountSubscriber,_super),BufferCountSubscriber.prototype._next=function(value){var buffer=this.buffer;buffer.push(value),buffer.length==this.bufferSize&&(this.destination.next(buffer),this.buffer=[])},BufferCountSubscriber.prototype._complete=function(){var buffer=this.buffer;0<buffer.length&&this.destination.next(buffer),_super.prototype._complete.call(this)},BufferCountSubscriber}(Subscriber_1.Subscriber),BufferSkipCountSubscriber=function(_super){function BufferSkipCountSubscriber(destination,bufferSize,startBufferEvery){var _this=_super.call(this,destination)||this;return _this.bufferSize=bufferSize,_this.startBufferEvery=startBufferEvery,_this.buffers=[],_this.count=0,_this}return __extends(BufferSkipCountSubscriber,_super),BufferSkipCountSubscriber.prototype._next=function(value){var bufferSize=this.bufferSize,startBufferEvery=this.startBufferEvery,buffers=this.buffers,count=this.count;this.count++,count%startBufferEvery==0&&buffers.push([]);for(var i=buffers.length;i--;){var buffer=buffers[i];buffer.push(value),buffer.length===bufferSize&&(buffers.splice(i,1),this.destination.next(buffer))}},BufferSkipCountSubscriber.prototype._complete=function(){for(var buffers=this.buffers,destination=this.destination;0<buffers.length;){var buffer=buffers.shift();0<buffer.length&&destination.next(buffer)}_super.prototype._complete.call(this)},BufferSkipCountSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],139:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var async_1=require("../scheduler/async"),Subscriber_1=require("../Subscriber"),isScheduler_1=require("../util/isScheduler");exports.bufferTime=function(bufferTimeSpan){var length=arguments.length,scheduler=async_1.async;isScheduler_1.isScheduler(arguments[arguments.length-1])&&(scheduler=arguments[arguments.length-1],length--);var bufferCreationInterval=null;2<=length&&(bufferCreationInterval=arguments[1]);var maxBufferSize=Number.POSITIVE_INFINITY;return 3<=length&&(maxBufferSize=arguments[2]),function(source){return source.lift(new BufferTimeOperator(bufferTimeSpan,bufferCreationInterval,maxBufferSize,scheduler))}};var BufferTimeOperator=function(){function BufferTimeOperator(bufferTimeSpan,bufferCreationInterval,maxBufferSize,scheduler){this.bufferTimeSpan=bufferTimeSpan,this.bufferCreationInterval=bufferCreationInterval,this.maxBufferSize=maxBufferSize,this.scheduler=scheduler}return BufferTimeOperator.prototype.call=function(subscriber,source){return source.subscribe(new BufferTimeSubscriber(subscriber,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},BufferTimeOperator}(),Context=function(){this.buffer=[]},BufferTimeSubscriber=function(_super){function BufferTimeSubscriber(destination,bufferTimeSpan,bufferCreationInterval,maxBufferSize,scheduler){var _this=_super.call(this,destination)||this;_this.bufferTimeSpan=bufferTimeSpan,_this.bufferCreationInterval=bufferCreationInterval,_this.maxBufferSize=maxBufferSize,_this.scheduler=scheduler,_this.contexts=[];var context=_this.openContext();if(_this.timespanOnly=null==bufferCreationInterval||bufferCreationInterval<0,_this.timespanOnly){var timeSpanOnlyState={subscriber:_this,context:context,bufferTimeSpan:bufferTimeSpan};_this.add(context.closeAction=scheduler.schedule(dispatchBufferTimeSpanOnly,bufferTimeSpan,timeSpanOnlyState))}else{var closeState={subscriber:_this,context:context},creationState={bufferTimeSpan:bufferTimeSpan,bufferCreationInterval:bufferCreationInterval,subscriber:_this,scheduler:scheduler};_this.add(context.closeAction=scheduler.schedule(dispatchBufferClose,bufferTimeSpan,closeState)),_this.add(scheduler.schedule(dispatchBufferCreation,bufferCreationInterval,creationState))}return _this}return __extends(BufferTimeSubscriber,_super),BufferTimeSubscriber.prototype._next=function(value){for(var filledBufferContext,contexts=this.contexts,len=contexts.length,i=0;i<len;i++){var context_1=contexts[i],buffer=context_1.buffer;buffer.push(value),buffer.length==this.maxBufferSize&&(filledBufferContext=context_1)}filledBufferContext&&this.onBufferFull(filledBufferContext)},BufferTimeSubscriber.prototype._error=function(err){this.contexts.length=0,_super.prototype._error.call(this,err)},BufferTimeSubscriber.prototype._complete=function(){for(var contexts=this.contexts,destination=this.destination;0<contexts.length;){var context_2=contexts.shift();destination.next(context_2.buffer)}_super.prototype._complete.call(this)},BufferTimeSubscriber.prototype._unsubscribe=function(){this.contexts=null},BufferTimeSubscriber.prototype.onBufferFull=function(context){this.closeContext(context);var closeAction=context.closeAction;if(closeAction.unsubscribe(),this.remove(closeAction),!this.closed&&this.timespanOnly){context=this.openContext();var bufferTimeSpan=this.bufferTimeSpan,timeSpanOnlyState={subscriber:this,context:context,bufferTimeSpan:bufferTimeSpan};this.add(context.closeAction=this.scheduler.schedule(dispatchBufferTimeSpanOnly,bufferTimeSpan,timeSpanOnlyState))}},BufferTimeSubscriber.prototype.openContext=function(){var context=new Context;return this.contexts.push(context),context},BufferTimeSubscriber.prototype.closeContext=function(context){this.destination.next(context.buffer);var contexts=this.contexts;0<=(contexts?contexts.indexOf(context):-1)&&contexts.splice(contexts.indexOf(context),1)},BufferTimeSubscriber}(Subscriber_1.Subscriber);function dispatchBufferTimeSpanOnly(state){var subscriber=state.subscriber,prevContext=state.context;prevContext&&subscriber.closeContext(prevContext),subscriber.closed||(state.context=subscriber.openContext(),state.context.closeAction=this.schedule(state,state.bufferTimeSpan))}function dispatchBufferCreation(state){var bufferCreationInterval=state.bufferCreationInterval,bufferTimeSpan=state.bufferTimeSpan,subscriber=state.subscriber,scheduler=state.scheduler,context=subscriber.openContext();subscriber.closed||(subscriber.add(context.closeAction=scheduler.schedule(dispatchBufferClose,bufferTimeSpan,{subscriber:subscriber,context:context})),this.schedule(state,bufferCreationInterval))}function dispatchBufferClose(arg){var subscriber=arg.subscriber,context=arg.context;subscriber.closeContext(context)}},{"../Subscriber":101,"../scheduler/async":250,"../util/isScheduler":274}],140:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscription_1=require("../Subscription"),subscribeToResult_1=require("../util/subscribeToResult"),OuterSubscriber_1=require("../OuterSubscriber");exports.bufferToggle=function(openings,closingSelector){return function(source){return source.lift(new BufferToggleOperator(openings,closingSelector))}};var BufferToggleOperator=function(){function BufferToggleOperator(openings,closingSelector){this.openings=openings,this.closingSelector=closingSelector}return BufferToggleOperator.prototype.call=function(subscriber,source){return source.subscribe(new BufferToggleSubscriber(subscriber,this.openings,this.closingSelector))},BufferToggleOperator}(),BufferToggleSubscriber=function(_super){function BufferToggleSubscriber(destination,openings,closingSelector){var _this=_super.call(this,destination)||this;return _this.openings=openings,_this.closingSelector=closingSelector,_this.contexts=[],_this.add(subscribeToResult_1.subscribeToResult(_this,openings)),_this}return __extends(BufferToggleSubscriber,_super),BufferToggleSubscriber.prototype._next=function(value){for(var contexts=this.contexts,len=contexts.length,i=0;i<len;i++)contexts[i].buffer.push(value)},BufferToggleSubscriber.prototype._error=function(err){for(var contexts=this.contexts;0<contexts.length;){var context_1=contexts.shift();context_1.subscription.unsubscribe(),context_1.buffer=null,context_1.subscription=null}this.contexts=null,_super.prototype._error.call(this,err)},BufferToggleSubscriber.prototype._complete=function(){for(var contexts=this.contexts;0<contexts.length;){var context_2=contexts.shift();this.destination.next(context_2.buffer),context_2.subscription.unsubscribe(),context_2.buffer=null,context_2.subscription=null}this.contexts=null,_super.prototype._complete.call(this)},BufferToggleSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){outerValue?this.closeBuffer(outerValue):this.openBuffer(innerValue)},BufferToggleSubscriber.prototype.notifyComplete=function(innerSub){this.closeBuffer(innerSub.context)},BufferToggleSubscriber.prototype.openBuffer=function(value){try{var closingNotifier=this.closingSelector.call(this,value);closingNotifier&&this.trySubscribe(closingNotifier)}catch(err){this._error(err)}},BufferToggleSubscriber.prototype.closeBuffer=function(context){var contexts=this.contexts;if(contexts&&context){var buffer=context.buffer,subscription=context.subscription;this.destination.next(buffer),contexts.splice(contexts.indexOf(context),1),this.remove(subscription),subscription.unsubscribe()}},BufferToggleSubscriber.prototype.trySubscribe=function(closingNotifier){var contexts=this.contexts,subscription=new Subscription_1.Subscription,context={buffer:[],subscription:subscription};contexts.push(context);var innerSubscription=subscribeToResult_1.subscribeToResult(this,closingNotifier,context);!innerSubscription||innerSubscription.closed?this.closeBuffer(context):(innerSubscription.context=context,this.add(innerSubscription),subscription.add(innerSubscription))},BufferToggleSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../Subscription":102,"../util/subscribeToResult":283}],141:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscription_1=require("../Subscription"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.bufferWhen=function(closingSelector){return function(source){return source.lift(new BufferWhenOperator(closingSelector))}};var BufferWhenOperator=function(){function BufferWhenOperator(closingSelector){this.closingSelector=closingSelector}return BufferWhenOperator.prototype.call=function(subscriber,source){return source.subscribe(new BufferWhenSubscriber(subscriber,this.closingSelector))},BufferWhenOperator}(),BufferWhenSubscriber=function(_super){function BufferWhenSubscriber(destination,closingSelector){var _this=_super.call(this,destination)||this;return _this.closingSelector=closingSelector,_this.subscribing=!1,_this.openBuffer(),_this}return __extends(BufferWhenSubscriber,_super),BufferWhenSubscriber.prototype._next=function(value){this.buffer.push(value)},BufferWhenSubscriber.prototype._complete=function(){var buffer=this.buffer;buffer&&this.destination.next(buffer),_super.prototype._complete.call(this)},BufferWhenSubscriber.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},BufferWhenSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.openBuffer()},BufferWhenSubscriber.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},BufferWhenSubscriber.prototype.openBuffer=function(){var closingSubscription=this.closingSubscription;closingSubscription&&(this.remove(closingSubscription),closingSubscription.unsubscribe());var closingNotifier,buffer=this.buffer;this.buffer&&this.destination.next(buffer),this.buffer=[];try{closingNotifier=(0,this.closingSelector)()}catch(err){return this.error(err)}closingSubscription=new Subscription_1.Subscription,this.closingSubscription=closingSubscription,this.add(closingSubscription),this.subscribing=!0,closingSubscription.add(subscribeToResult_1.subscribeToResult(this,closingNotifier)),this.subscribing=!1},BufferWhenSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../Subscription":102,"../util/subscribeToResult":283}],142:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),InnerSubscriber_1=require("../InnerSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.catchError=function(selector){return function(source){var operator=new CatchOperator(selector),caught=source.lift(operator);return operator.caught=caught}};var CatchOperator=function(){function CatchOperator(selector){this.selector=selector}return CatchOperator.prototype.call=function(subscriber,source){return source.subscribe(new CatchSubscriber(subscriber,this.selector,this.caught))},CatchOperator}(),CatchSubscriber=function(_super){function CatchSubscriber(destination,selector,caught){var _this=_super.call(this,destination)||this;return _this.selector=selector,_this.caught=caught,_this}return __extends(CatchSubscriber,_super),CatchSubscriber.prototype.error=function(err){if(!this.isStopped){var result=void 0;try{result=this.selector(err,this.caught)}catch(err2){return void _super.prototype.error.call(this,err2)}this._unsubscribeAndRecycle();var innerSubscriber=new InnerSubscriber_1.InnerSubscriber(this,void 0,void 0);this.add(innerSubscriber),subscribeToResult_1.subscribeToResult(this,result,void 0,void 0,innerSubscriber)}},CatchSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../InnerSubscriber":92,"../OuterSubscriber":96,"../util/subscribeToResult":283}],143:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var combineLatest_1=require("../observable/combineLatest");exports.combineAll=function(project){return function(source){return source.lift(new combineLatest_1.CombineLatestOperator(project))}}},{"../observable/combineLatest":108}],144:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var isArray_1=require("../util/isArray"),combineLatest_1=require("../observable/combineLatest"),from_1=require("../observable/from");exports.combineLatest=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];var project=null;return"function"==typeof observables[observables.length-1]&&(project=observables.pop()),1===observables.length&&isArray_1.isArray(observables[0])&&(observables=observables[0].slice()),function(source){return source.lift.call(from_1.from([source].concat(observables)),new combineLatest_1.CombineLatestOperator(project))}}},{"../observable/combineLatest":108,"../observable/from":113,"../util/isArray":264}],145:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var concat_1=require("../observable/concat");exports.concat=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];return function(source){return source.lift.call(concat_1.concat.apply(void 0,[source].concat(observables)))}}},{"../observable/concat":109}],146:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var mergeAll_1=require("./mergeAll");exports.concatAll=function(){return mergeAll_1.mergeAll(1)}},{"./mergeAll":179}],147:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var mergeMap_1=require("./mergeMap");exports.concatMap=function(project,resultSelector){return mergeMap_1.mergeMap(project,resultSelector,1)}},{"./mergeMap":180}],148:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var concatMap_1=require("./concatMap");exports.concatMapTo=function(innerObservable,resultSelector){return concatMap_1.concatMap(function(){return innerObservable},resultSelector)}},{"./concatMap":147}],149:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.count=function(predicate){return function(source){return source.lift(new CountOperator(predicate,source))}};var CountOperator=function(){function CountOperator(predicate,source){this.predicate=predicate,this.source=source}return CountOperator.prototype.call=function(subscriber,source){return source.subscribe(new CountSubscriber(subscriber,this.predicate,this.source))},CountOperator}(),CountSubscriber=function(_super){function CountSubscriber(destination,predicate,source){var _this=_super.call(this,destination)||this;return _this.predicate=predicate,_this.source=source,_this.count=0,_this.index=0,_this}return __extends(CountSubscriber,_super),CountSubscriber.prototype._next=function(value){this.predicate?this._tryPredicate(value):this.count++},CountSubscriber.prototype._tryPredicate=function(value){var result;try{result=this.predicate(value,this.index++,this.source)}catch(err){return void this.destination.error(err)}result&&this.count++},CountSubscriber.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},CountSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],150:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.debounce=function(durationSelector){return function(source){return source.lift(new DebounceOperator(durationSelector))}};var DebounceOperator=function(){function DebounceOperator(durationSelector){this.durationSelector=durationSelector}return DebounceOperator.prototype.call=function(subscriber,source){return source.subscribe(new DebounceSubscriber(subscriber,this.durationSelector))},DebounceOperator}(),DebounceSubscriber=function(_super){function DebounceSubscriber(destination,durationSelector){var _this=_super.call(this,destination)||this;return _this.durationSelector=durationSelector,_this.hasValue=!1,_this.durationSubscription=null,_this}return __extends(DebounceSubscriber,_super),DebounceSubscriber.prototype._next=function(value){try{var result=this.durationSelector.call(this,value);result&&this._tryNext(value,result)}catch(err){this.destination.error(err)}},DebounceSubscriber.prototype._complete=function(){this.emitValue(),this.destination.complete()},DebounceSubscriber.prototype._tryNext=function(value,duration){var subscription=this.durationSubscription;this.value=value,this.hasValue=!0,subscription&&(subscription.unsubscribe(),this.remove(subscription)),(subscription=subscribeToResult_1.subscribeToResult(this,duration))&&!subscription.closed&&this.add(this.durationSubscription=subscription)},DebounceSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.emitValue()},DebounceSubscriber.prototype.notifyComplete=function(){this.emitValue()},DebounceSubscriber.prototype.emitValue=function(){if(this.hasValue){var value=this.value,subscription=this.durationSubscription;subscription&&(this.durationSubscription=null,subscription.unsubscribe(),this.remove(subscription)),this.value=null,this.hasValue=!1,_super.prototype._next.call(this,value)}},DebounceSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],151:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),async_1=require("../scheduler/async");exports.debounceTime=function(dueTime,scheduler){return void 0===scheduler&&(scheduler=async_1.async),function(source){return source.lift(new DebounceTimeOperator(dueTime,scheduler))}};var DebounceTimeOperator=function(){function DebounceTimeOperator(dueTime,scheduler){this.dueTime=dueTime,this.scheduler=scheduler}return DebounceTimeOperator.prototype.call=function(subscriber,source){return source.subscribe(new DebounceTimeSubscriber(subscriber,this.dueTime,this.scheduler))},DebounceTimeOperator}(),DebounceTimeSubscriber=function(_super){function DebounceTimeSubscriber(destination,dueTime,scheduler){var _this=_super.call(this,destination)||this;return _this.dueTime=dueTime,_this.scheduler=scheduler,_this.debouncedSubscription=null,_this.lastValue=null,_this.hasValue=!1,_this}return __extends(DebounceTimeSubscriber,_super),DebounceTimeSubscriber.prototype._next=function(value){this.clearDebounce(),this.lastValue=value,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(dispatchNext,this.dueTime,this))},DebounceTimeSubscriber.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},DebounceTimeSubscriber.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var lastValue=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(lastValue)}},DebounceTimeSubscriber.prototype.clearDebounce=function(){var debouncedSubscription=this.debouncedSubscription;null!==debouncedSubscription&&(this.remove(debouncedSubscription),debouncedSubscription.unsubscribe(),this.debouncedSubscription=null)},DebounceTimeSubscriber}(Subscriber_1.Subscriber);function dispatchNext(subscriber){subscriber.debouncedNext()}},{"../Subscriber":101,"../scheduler/async":250}],152:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.defaultIfEmpty=function(defaultValue){return void 0===defaultValue&&(defaultValue=null),function(source){return source.lift(new DefaultIfEmptyOperator(defaultValue))}};var DefaultIfEmptyOperator=function(){function DefaultIfEmptyOperator(defaultValue){this.defaultValue=defaultValue}return DefaultIfEmptyOperator.prototype.call=function(subscriber,source){return source.subscribe(new DefaultIfEmptySubscriber(subscriber,this.defaultValue))},DefaultIfEmptyOperator}(),DefaultIfEmptySubscriber=function(_super){function DefaultIfEmptySubscriber(destination,defaultValue){var _this=_super.call(this,destination)||this;return _this.defaultValue=defaultValue,_this.isEmpty=!0,_this}return __extends(DefaultIfEmptySubscriber,_super),DefaultIfEmptySubscriber.prototype._next=function(value){this.isEmpty=!1,this.destination.next(value)},DefaultIfEmptySubscriber.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},DefaultIfEmptySubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],153:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var async_1=require("../scheduler/async"),isDate_1=require("../util/isDate"),Subscriber_1=require("../Subscriber"),Notification_1=require("../Notification");exports.delay=function(delay,scheduler){void 0===scheduler&&(scheduler=async_1.async);var delayFor=isDate_1.isDate(delay)?+delay-scheduler.now():Math.abs(delay);return function(source){return source.lift(new DelayOperator(delayFor,scheduler))}};var DelayOperator=function(){function DelayOperator(delay,scheduler){this.delay=delay,this.scheduler=scheduler}return DelayOperator.prototype.call=function(subscriber,source){return source.subscribe(new DelaySubscriber(subscriber,this.delay,this.scheduler))},DelayOperator}(),DelaySubscriber=function(_super){function DelaySubscriber(destination,delay,scheduler){var _this=_super.call(this,destination)||this;return _this.delay=delay,_this.scheduler=scheduler,_this.queue=[],_this.active=!1,_this.errored=!1,_this}return __extends(DelaySubscriber,_super),DelaySubscriber.dispatch=function(state){for(var source=state.source,queue=source.queue,scheduler=state.scheduler,destination=state.destination;0<queue.length&&queue[0].time-scheduler.now()<=0;)queue.shift().notification.observe(destination);if(0<queue.length){var delay_1=Math.max(0,queue[0].time-scheduler.now());this.schedule(state,delay_1)}else this.unsubscribe(),source.active=!1},DelaySubscriber.prototype._schedule=function(scheduler){this.active=!0,this.destination.add(scheduler.schedule(DelaySubscriber.dispatch,this.delay,{source:this,destination:this.destination,scheduler:scheduler}))},DelaySubscriber.prototype.scheduleNotification=function(notification){if(!0!==this.errored){var scheduler=this.scheduler,message=new DelayMessage(scheduler.now()+this.delay,notification);this.queue.push(message),!1===this.active&&this._schedule(scheduler)}},DelaySubscriber.prototype._next=function(value){this.scheduleNotification(Notification_1.Notification.createNext(value))},DelaySubscriber.prototype._error=function(err){this.errored=!0,this.queue=[],this.destination.error(err),this.unsubscribe()},DelaySubscriber.prototype._complete=function(){this.scheduleNotification(Notification_1.Notification.createComplete()),this.unsubscribe()},DelaySubscriber}(Subscriber_1.Subscriber),DelayMessage=function(time,notification){this.time=time,this.notification=notification}},{"../Notification":93,"../Subscriber":101,"../scheduler/async":250,"../util/isDate":266}],154:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),Observable_1=require("../Observable"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.delayWhen=function(delayDurationSelector,subscriptionDelay){return subscriptionDelay?function(source){return new SubscriptionDelayObservable(source,subscriptionDelay).lift(new DelayWhenOperator(delayDurationSelector))}:function(source){return source.lift(new DelayWhenOperator(delayDurationSelector))}};var DelayWhenOperator=function(){function DelayWhenOperator(delayDurationSelector){this.delayDurationSelector=delayDurationSelector}return DelayWhenOperator.prototype.call=function(subscriber,source){return source.subscribe(new DelayWhenSubscriber(subscriber,this.delayDurationSelector))},DelayWhenOperator}(),DelayWhenSubscriber=function(_super){function DelayWhenSubscriber(destination,delayDurationSelector){var _this=_super.call(this,destination)||this;return _this.delayDurationSelector=delayDurationSelector,_this.completed=!1,_this.delayNotifierSubscriptions=[],_this.index=0,_this}return __extends(DelayWhenSubscriber,_super),DelayWhenSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.destination.next(outerValue),this.removeSubscription(innerSub),this.tryComplete()},DelayWhenSubscriber.prototype.notifyError=function(error,innerSub){this._error(error)},DelayWhenSubscriber.prototype.notifyComplete=function(innerSub){var value=this.removeSubscription(innerSub);value&&this.destination.next(value),this.tryComplete()},DelayWhenSubscriber.prototype._next=function(value){var index=this.index++;try{var delayNotifier=this.delayDurationSelector(value,index);delayNotifier&&this.tryDelay(delayNotifier,value)}catch(err){this.destination.error(err)}},DelayWhenSubscriber.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},DelayWhenSubscriber.prototype.removeSubscription=function(subscription){subscription.unsubscribe();var subscriptionIdx=this.delayNotifierSubscriptions.indexOf(subscription);return-1!==subscriptionIdx&&this.delayNotifierSubscriptions.splice(subscriptionIdx,1),subscription.outerValue},DelayWhenSubscriber.prototype.tryDelay=function(delayNotifier,value){var notifierSubscription=subscribeToResult_1.subscribeToResult(this,delayNotifier,value);notifierSubscription&&!notifierSubscription.closed&&(this.destination.add(notifierSubscription),this.delayNotifierSubscriptions.push(notifierSubscription))},DelayWhenSubscriber.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},DelayWhenSubscriber}(OuterSubscriber_1.OuterSubscriber),SubscriptionDelayObservable=function(_super){function SubscriptionDelayObservable(source,subscriptionDelay){var _this=_super.call(this)||this;return _this.source=source,_this.subscriptionDelay=subscriptionDelay,_this}return __extends(SubscriptionDelayObservable,_super),SubscriptionDelayObservable.prototype._subscribe=function(subscriber){this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber,this.source))},SubscriptionDelayObservable}(Observable_1.Observable),SubscriptionDelaySubscriber=function(_super){function SubscriptionDelaySubscriber(parent,source){var _this=_super.call(this)||this;return _this.parent=parent,_this.source=source,_this.sourceSubscribed=!1,_this}return __extends(SubscriptionDelaySubscriber,_super),SubscriptionDelaySubscriber.prototype._next=function(unused){this.subscribeToSource()},SubscriptionDelaySubscriber.prototype._error=function(err){this.unsubscribe(),this.parent.error(err)},SubscriptionDelaySubscriber.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},SubscriptionDelaySubscriber.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},SubscriptionDelaySubscriber}(Subscriber_1.Subscriber)},{"../Observable":94,"../OuterSubscriber":96,"../Subscriber":101,"../util/subscribeToResult":283}],155:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.dematerialize=function(){return function(source){return source.lift(new DeMaterializeOperator)}};var DeMaterializeOperator=function(){function DeMaterializeOperator(){}return DeMaterializeOperator.prototype.call=function(subscriber,source){return source.subscribe(new DeMaterializeSubscriber(subscriber))},DeMaterializeOperator}(),DeMaterializeSubscriber=function(_super){function DeMaterializeSubscriber(destination){return _super.call(this,destination)||this}return __extends(DeMaterializeSubscriber,_super),DeMaterializeSubscriber.prototype._next=function(value){value.observe(this.destination)},DeMaterializeSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],156:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.distinct=function(keySelector,flushes){return function(source){return source.lift(new DistinctOperator(keySelector,flushes))}};var DistinctOperator=function(){function DistinctOperator(keySelector,flushes){this.keySelector=keySelector,this.flushes=flushes}return DistinctOperator.prototype.call=function(subscriber,source){return source.subscribe(new DistinctSubscriber(subscriber,this.keySelector,this.flushes))},DistinctOperator}(),DistinctSubscriber=function(_super){function DistinctSubscriber(destination,keySelector,flushes){var _this=_super.call(this,destination)||this;return _this.keySelector=keySelector,_this.values=new Set,flushes&&_this.add(subscribeToResult_1.subscribeToResult(_this,flushes)),_this}return __extends(DistinctSubscriber,_super),DistinctSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.values.clear()},DistinctSubscriber.prototype.notifyError=function(error,innerSub){this._error(error)},DistinctSubscriber.prototype._next=function(value){this.keySelector?this._useKeySelector(value):this._finalizeNext(value,value)},DistinctSubscriber.prototype._useKeySelector=function(value){var key,destination=this.destination;try{key=this.keySelector(value)}catch(err){return void destination.error(err)}this._finalizeNext(key,value)},DistinctSubscriber.prototype._finalizeNext=function(key,value){var values=this.values;values.has(key)||(values.add(key),this.destination.next(value))},DistinctSubscriber}(OuterSubscriber_1.OuterSubscriber);exports.DistinctSubscriber=DistinctSubscriber},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],157:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.distinctUntilChanged=function(compare,keySelector){return function(source){return source.lift(new DistinctUntilChangedOperator(compare,keySelector))}};var DistinctUntilChangedOperator=function(){function DistinctUntilChangedOperator(compare,keySelector){this.compare=compare,this.keySelector=keySelector}return DistinctUntilChangedOperator.prototype.call=function(subscriber,source){return source.subscribe(new DistinctUntilChangedSubscriber(subscriber,this.compare,this.keySelector))},DistinctUntilChangedOperator}(),DistinctUntilChangedSubscriber=function(_super){function DistinctUntilChangedSubscriber(destination,compare,keySelector){var _this=_super.call(this,destination)||this;return _this.keySelector=keySelector,_this.hasKey=!1,"function"==typeof compare&&(_this.compare=compare),_this}return __extends(DistinctUntilChangedSubscriber,_super),DistinctUntilChangedSubscriber.prototype.compare=function(x,y){return x===y},DistinctUntilChangedSubscriber.prototype._next=function(value){var key;try{var keySelector=this.keySelector;key=keySelector?keySelector(value):value}catch(err){return this.destination.error(err)}var result=!1;if(this.hasKey)try{result=(0,this.compare)(this.key,key)}catch(err){return this.destination.error(err)}else this.hasKey=!0;result||(this.key=key,this.destination.next(value))},DistinctUntilChangedSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],158:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var distinctUntilChanged_1=require("./distinctUntilChanged");exports.distinctUntilKeyChanged=function(key,compare){return distinctUntilChanged_1.distinctUntilChanged(function(x,y){return compare?compare(x[key],y[key]):x[key]===y[key]})}},{"./distinctUntilChanged":157}],159:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ArgumentOutOfRangeError_1=require("../util/ArgumentOutOfRangeError"),filter_1=require("./filter"),throwIfEmpty_1=require("./throwIfEmpty"),defaultIfEmpty_1=require("./defaultIfEmpty"),take_1=require("./take");exports.elementAt=function(index,defaultValue){if(index<0)throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError;var hasDefaultValue=2<=arguments.length;return function(source){return source.pipe(filter_1.filter(function(v,i){return i===index}),take_1.take(1),hasDefaultValue?defaultIfEmpty_1.defaultIfEmpty(defaultValue):throwIfEmpty_1.throwIfEmpty(function(){return new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError}))}}},{"../util/ArgumentOutOfRangeError":255,"./defaultIfEmpty":152,"./filter":165,"./take":217,"./throwIfEmpty":224}],160:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var fromArray_1=require("../observable/fromArray"),scalar_1=require("../observable/scalar"),empty_1=require("../observable/empty"),concat_1=require("../observable/concat"),isScheduler_1=require("../util/isScheduler");exports.endWith=function(){for(var array=[],_i=0;_i<arguments.length;_i++)array[_i]=arguments[_i];return function(source){var scheduler=array[array.length-1];isScheduler_1.isScheduler(scheduler)?array.pop():scheduler=null;var len=array.length;return 1!==len||scheduler?0<len?concat_1.concat(source,fromArray_1.fromArray(array,scheduler)):concat_1.concat(source,empty_1.empty(scheduler)):concat_1.concat(source,scalar_1.scalar(array[0]))}}},{"../observable/concat":109,"../observable/empty":111,"../observable/fromArray":114,"../observable/scalar":130,"../util/isScheduler":274}],161:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.every=function(predicate,thisArg){return function(source){return source.lift(new EveryOperator(predicate,thisArg,source))}};var EveryOperator=function(){function EveryOperator(predicate,thisArg,source){this.predicate=predicate,this.thisArg=thisArg,this.source=source}return EveryOperator.prototype.call=function(observer,source){return source.subscribe(new EverySubscriber(observer,this.predicate,this.thisArg,this.source))},EveryOperator}(),EverySubscriber=function(_super){function EverySubscriber(destination,predicate,thisArg,source){var _this=_super.call(this,destination)||this;return _this.predicate=predicate,_this.thisArg=thisArg,_this.source=source,_this.index=0,_this.thisArg=thisArg||_this,_this}return __extends(EverySubscriber,_super),EverySubscriber.prototype.notifyComplete=function(everyValueMatch){this.destination.next(everyValueMatch),this.destination.complete()},EverySubscriber.prototype._next=function(value){var result=!1;try{result=this.predicate.call(this.thisArg,value,this.index++,this.source)}catch(err){return void this.destination.error(err)}result||this.notifyComplete(!1)},EverySubscriber.prototype._complete=function(){this.notifyComplete(!0)},EverySubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],162:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.exhaust=function(){return function(source){return source.lift(new SwitchFirstOperator)}};var SwitchFirstOperator=function(){function SwitchFirstOperator(){}return SwitchFirstOperator.prototype.call=function(subscriber,source){return source.subscribe(new SwitchFirstSubscriber(subscriber))},SwitchFirstOperator}(),SwitchFirstSubscriber=function(_super){function SwitchFirstSubscriber(destination){var _this=_super.call(this,destination)||this;return _this.hasCompleted=!1,_this.hasSubscription=!1,_this}return __extends(SwitchFirstSubscriber,_super),SwitchFirstSubscriber.prototype._next=function(value){this.hasSubscription||(this.hasSubscription=!0,this.add(subscribeToResult_1.subscribeToResult(this,value)))},SwitchFirstSubscriber.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},SwitchFirstSubscriber.prototype.notifyComplete=function(innerSub){this.remove(innerSub),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},SwitchFirstSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],163:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),InnerSubscriber_1=require("../InnerSubscriber"),subscribeToResult_1=require("../util/subscribeToResult"),map_1=require("./map"),from_1=require("../observable/from");exports.exhaustMap=function exhaustMap(project,resultSelector){return resultSelector?function(source){return source.pipe(exhaustMap(function(a,i){return from_1.from(project(a,i)).pipe(map_1.map(function(b,ii){return resultSelector(a,b,i,ii)}))}))}:function(source){return source.lift(new ExhaustMapOperator(project))}};var ExhaustMapOperator=function(){function ExhaustMapOperator(project){this.project=project}return ExhaustMapOperator.prototype.call=function(subscriber,source){return source.subscribe(new ExhaustMapSubscriber(subscriber,this.project))},ExhaustMapOperator}(),ExhaustMapSubscriber=function(_super){function ExhaustMapSubscriber(destination,project){var _this=_super.call(this,destination)||this;return _this.project=project,_this.hasSubscription=!1,_this.hasCompleted=!1,_this.index=0,_this}return __extends(ExhaustMapSubscriber,_super),ExhaustMapSubscriber.prototype._next=function(value){this.hasSubscription||this.tryNext(value)},ExhaustMapSubscriber.prototype.tryNext=function(value){var result,index=this.index++;try{result=this.project(value,index)}catch(err){return void this.destination.error(err)}this.hasSubscription=!0,this._innerSub(result,value,index)},ExhaustMapSubscriber.prototype._innerSub=function(result,value,index){var innerSubscriber=new InnerSubscriber_1.InnerSubscriber(this,void 0,void 0);this.destination.add(innerSubscriber),subscribeToResult_1.subscribeToResult(this,result,value,index,innerSubscriber)},ExhaustMapSubscriber.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},ExhaustMapSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.destination.next(innerValue)},ExhaustMapSubscriber.prototype.notifyError=function(err){this.destination.error(err)},ExhaustMapSubscriber.prototype.notifyComplete=function(innerSub){this.destination.remove(innerSub),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},ExhaustMapSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../InnerSubscriber":92,"../OuterSubscriber":96,"../observable/from":113,"../util/subscribeToResult":283,"./map":174}],164:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.expand=function(project,concurrent,scheduler){return void 0===concurrent&&(concurrent=Number.POSITIVE_INFINITY),void 0===scheduler&&(scheduler=void 0),concurrent=(concurrent||0)<1?Number.POSITIVE_INFINITY:concurrent,function(source){return source.lift(new ExpandOperator(project,concurrent,scheduler))}};var ExpandOperator=function(){function ExpandOperator(project,concurrent,scheduler){this.project=project,this.concurrent=concurrent,this.scheduler=scheduler}return ExpandOperator.prototype.call=function(subscriber,source){return source.subscribe(new ExpandSubscriber(subscriber,this.project,this.concurrent,this.scheduler))},ExpandOperator}();exports.ExpandOperator=ExpandOperator;var ExpandSubscriber=function(_super){function ExpandSubscriber(destination,project,concurrent,scheduler){var _this=_super.call(this,destination)||this;return _this.project=project,_this.concurrent=concurrent,_this.scheduler=scheduler,_this.index=0,_this.active=0,_this.hasCompleted=!1,concurrent<Number.POSITIVE_INFINITY&&(_this.buffer=[]),_this}return __extends(ExpandSubscriber,_super),ExpandSubscriber.dispatch=function(arg){var subscriber=arg.subscriber,result=arg.result,value=arg.value,index=arg.index;subscriber.subscribeToProjection(result,value,index)},ExpandSubscriber.prototype._next=function(value){var destination=this.destination;if(destination.closed)this._complete();else{var index=this.index++;if(this.active<this.concurrent){destination.next(value);try{var result=(0,this.project)(value,index);if(this.scheduler){var state={subscriber:this,result:result,value:value,index:index};this.destination.add(this.scheduler.schedule(ExpandSubscriber.dispatch,0,state))}else this.subscribeToProjection(result,value,index)}catch(e){destination.error(e)}}else this.buffer.push(value)}},ExpandSubscriber.prototype.subscribeToProjection=function(result,value,index){this.active++,this.destination.add(subscribeToResult_1.subscribeToResult(this,result,value,index))},ExpandSubscriber.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},ExpandSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this._next(innerValue)},ExpandSubscriber.prototype.notifyComplete=function(innerSub){var buffer=this.buffer;this.destination.remove(innerSub),this.active--,buffer&&0<buffer.length&&this._next(buffer.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},ExpandSubscriber}(OuterSubscriber_1.OuterSubscriber);exports.ExpandSubscriber=ExpandSubscriber},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],165:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.filter=function(predicate,thisArg){return function(source){return source.lift(new FilterOperator(predicate,thisArg))}};var FilterOperator=function(){function FilterOperator(predicate,thisArg){this.predicate=predicate,this.thisArg=thisArg}return FilterOperator.prototype.call=function(subscriber,source){return source.subscribe(new FilterSubscriber(subscriber,this.predicate,this.thisArg))},FilterOperator}(),FilterSubscriber=function(_super){function FilterSubscriber(destination,predicate,thisArg){var _this=_super.call(this,destination)||this;return _this.predicate=predicate,_this.thisArg=thisArg,_this.count=0,_this}return __extends(FilterSubscriber,_super),FilterSubscriber.prototype._next=function(value){var result;try{result=this.predicate.call(this.thisArg,value,this.count++)}catch(err){return void this.destination.error(err)}result&&this.destination.next(value)},FilterSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],166:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),Subscription_1=require("../Subscription");exports.finalize=function(callback){return function(source){return source.lift(new FinallyOperator(callback))}};var FinallyOperator=function(){function FinallyOperator(callback){this.callback=callback}return FinallyOperator.prototype.call=function(subscriber,source){return source.subscribe(new FinallySubscriber(subscriber,this.callback))},FinallyOperator}(),FinallySubscriber=function(_super){function FinallySubscriber(destination,callback){var _this=_super.call(this,destination)||this;return _this.add(new Subscription_1.Subscription(callback)),_this}return __extends(FinallySubscriber,_super),FinallySubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101,"../Subscription":102}],167:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.find=function(predicate,thisArg){if("function"!=typeof predicate)throw new TypeError("predicate is not a function");return function(source){return source.lift(new FindValueOperator(predicate,source,!1,thisArg))}};var FindValueOperator=function(){function FindValueOperator(predicate,source,yieldIndex,thisArg){this.predicate=predicate,this.source=source,this.yieldIndex=yieldIndex,this.thisArg=thisArg}return FindValueOperator.prototype.call=function(observer,source){return source.subscribe(new FindValueSubscriber(observer,this.predicate,this.source,this.yieldIndex,this.thisArg))},FindValueOperator}();exports.FindValueOperator=FindValueOperator;var FindValueSubscriber=function(_super){function FindValueSubscriber(destination,predicate,source,yieldIndex,thisArg){var _this=_super.call(this,destination)||this;return _this.predicate=predicate,_this.source=source,_this.yieldIndex=yieldIndex,_this.thisArg=thisArg,_this.index=0,_this}return __extends(FindValueSubscriber,_super),FindValueSubscriber.prototype.notifyComplete=function(value){var destination=this.destination;destination.next(value),destination.complete(),this.unsubscribe()},FindValueSubscriber.prototype._next=function(value){var predicate=this.predicate,thisArg=this.thisArg,index=this.index++;try{predicate.call(thisArg||this,value,index,this.source)&&this.notifyComplete(this.yieldIndex?index:value)}catch(err){this.destination.error(err)}},FindValueSubscriber.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},FindValueSubscriber}(Subscriber_1.Subscriber);exports.FindValueSubscriber=FindValueSubscriber},{"../Subscriber":101}],168:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var find_1=require("../operators/find");exports.findIndex=function(predicate,thisArg){return function(source){return source.lift(new find_1.FindValueOperator(predicate,source,!0,thisArg))}}},{"../operators/find":167}],169:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EmptyError_1=require("../util/EmptyError"),filter_1=require("./filter"),take_1=require("./take"),defaultIfEmpty_1=require("./defaultIfEmpty"),throwIfEmpty_1=require("./throwIfEmpty"),identity_1=require("../util/identity");exports.first=function(predicate,defaultValue){var hasDefaultValue=2<=arguments.length;return function(source){return source.pipe(predicate?filter_1.filter(function(v,i){return predicate(v,i,source)}):identity_1.identity,take_1.take(1),hasDefaultValue?defaultIfEmpty_1.defaultIfEmpty(defaultValue):throwIfEmpty_1.throwIfEmpty(function(){return new EmptyError_1.EmptyError}))}}},{"../util/EmptyError":256,"../util/identity":263,"./defaultIfEmpty":152,"./filter":165,"./take":217,"./throwIfEmpty":224}],170:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),Subscription_1=require("../Subscription"),Observable_1=require("../Observable"),Subject_1=require("../Subject");exports.groupBy=function(keySelector,elementSelector,durationSelector,subjectSelector){return function(source){return source.lift(new GroupByOperator(keySelector,elementSelector,durationSelector,subjectSelector))}};var GroupByOperator=function(){function GroupByOperator(keySelector,elementSelector,durationSelector,subjectSelector){this.keySelector=keySelector,this.elementSelector=elementSelector,this.durationSelector=durationSelector,this.subjectSelector=subjectSelector}return GroupByOperator.prototype.call=function(subscriber,source){return source.subscribe(new GroupBySubscriber(subscriber,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},GroupByOperator}(),GroupBySubscriber=function(_super){function GroupBySubscriber(destination,keySelector,elementSelector,durationSelector,subjectSelector){var _this=_super.call(this,destination)||this;return _this.keySelector=keySelector,_this.elementSelector=elementSelector,_this.durationSelector=durationSelector,_this.subjectSelector=subjectSelector,_this.groups=null,_this.attemptedToUnsubscribe=!1,_this.count=0,_this}return __extends(GroupBySubscriber,_super),GroupBySubscriber.prototype._next=function(value){var key;try{key=this.keySelector(value)}catch(err){return void this.error(err)}this._group(value,key)},GroupBySubscriber.prototype._group=function(value,key){var groups=this.groups;groups||(groups=this.groups=new Map);var element,group=groups.get(key);if(this.elementSelector)try{element=this.elementSelector(value)}catch(err){this.error(err)}else element=value;if(!group){group=this.subjectSelector?this.subjectSelector():new Subject_1.Subject,groups.set(key,group);var groupedObservable=new GroupedObservable(key,group,this);if(this.destination.next(groupedObservable),this.durationSelector){var duration=void 0;try{duration=this.durationSelector(new GroupedObservable(key,group))}catch(err){return void this.error(err)}this.add(duration.subscribe(new GroupDurationSubscriber(key,group,this)))}}group.closed||group.next(element)},GroupBySubscriber.prototype._error=function(err){var groups=this.groups;groups&&(groups.forEach(function(group,key){group.error(err)}),groups.clear()),this.destination.error(err)},GroupBySubscriber.prototype._complete=function(){var groups=this.groups;groups&&(groups.forEach(function(group,key){group.complete()}),groups.clear()),this.destination.complete()},GroupBySubscriber.prototype.removeGroup=function(key){this.groups.delete(key)},GroupBySubscriber.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&_super.prototype.unsubscribe.call(this))},GroupBySubscriber}(Subscriber_1.Subscriber),GroupDurationSubscriber=function(_super){function GroupDurationSubscriber(key,group,parent){var _this=_super.call(this,group)||this;return _this.key=key,_this.group=group,_this.parent=parent,_this}return __extends(GroupDurationSubscriber,_super),GroupDurationSubscriber.prototype._next=function(value){this.complete()},GroupDurationSubscriber.prototype._unsubscribe=function(){var parent=this.parent,key=this.key;this.key=this.parent=null,parent&&parent.removeGroup(key)},GroupDurationSubscriber}(Subscriber_1.Subscriber),GroupedObservable=function(_super){function GroupedObservable(key,groupSubject,refCountSubscription){var _this=_super.call(this)||this;return _this.key=key,_this.groupSubject=groupSubject,_this.refCountSubscription=refCountSubscription,_this}return __extends(GroupedObservable,_super),GroupedObservable.prototype._subscribe=function(subscriber){var subscription=new Subscription_1.Subscription,refCountSubscription=this.refCountSubscription,groupSubject=this.groupSubject;return refCountSubscription&&!refCountSubscription.closed&&subscription.add(new InnerRefCountSubscription(refCountSubscription)),subscription.add(groupSubject.subscribe(subscriber)),subscription},GroupedObservable}(Observable_1.Observable);exports.GroupedObservable=GroupedObservable;var InnerRefCountSubscription=function(_super){function InnerRefCountSubscription(parent){var _this=_super.call(this)||this;return(_this.parent=parent).count++,_this}return __extends(InnerRefCountSubscription,_super),InnerRefCountSubscription.prototype.unsubscribe=function(){var parent=this.parent;parent.closed||this.closed||(_super.prototype.unsubscribe.call(this),parent.count-=1,0===parent.count&&parent.attemptedToUnsubscribe&&parent.unsubscribe())},InnerRefCountSubscription}(Subscription_1.Subscription)},{"../Observable":94,"../Subject":99,"../Subscriber":101,"../Subscription":102}],171:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.ignoreElements=function(){return function(source){return source.lift(new IgnoreElementsOperator)}};var IgnoreElementsOperator=function(){function IgnoreElementsOperator(){}return IgnoreElementsOperator.prototype.call=function(subscriber,source){return source.subscribe(new IgnoreElementsSubscriber(subscriber))},IgnoreElementsOperator}(),IgnoreElementsSubscriber=function(_super){function IgnoreElementsSubscriber(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(IgnoreElementsSubscriber,_super),IgnoreElementsSubscriber.prototype._next=function(unused){},IgnoreElementsSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],172:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.isEmpty=function(){return function(source){return source.lift(new IsEmptyOperator)}};var IsEmptyOperator=function(){function IsEmptyOperator(){}return IsEmptyOperator.prototype.call=function(observer,source){return source.subscribe(new IsEmptySubscriber(observer))},IsEmptyOperator}(),IsEmptySubscriber=function(_super){function IsEmptySubscriber(destination){return _super.call(this,destination)||this}return __extends(IsEmptySubscriber,_super),IsEmptySubscriber.prototype.notifyComplete=function(isEmpty){var destination=this.destination;destination.next(isEmpty),destination.complete()},IsEmptySubscriber.prototype._next=function(value){this.notifyComplete(!1)},IsEmptySubscriber.prototype._complete=function(){this.notifyComplete(!0)},IsEmptySubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],173:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EmptyError_1=require("../util/EmptyError"),filter_1=require("./filter"),takeLast_1=require("./takeLast"),throwIfEmpty_1=require("./throwIfEmpty"),defaultIfEmpty_1=require("./defaultIfEmpty"),identity_1=require("../util/identity");exports.last=function(predicate,defaultValue){var hasDefaultValue=2<=arguments.length;return function(source){return source.pipe(predicate?filter_1.filter(function(v,i){return predicate(v,i,source)}):identity_1.identity,takeLast_1.takeLast(1),hasDefaultValue?defaultIfEmpty_1.defaultIfEmpty(defaultValue):throwIfEmpty_1.throwIfEmpty(function(){return new EmptyError_1.EmptyError}))}}},{"../util/EmptyError":256,"../util/identity":263,"./defaultIfEmpty":152,"./filter":165,"./takeLast":218,"./throwIfEmpty":224}],174:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.map=function(project,thisArg){return function(source){if("function"!=typeof project)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return source.lift(new MapOperator(project,thisArg))}};var MapOperator=function(){function MapOperator(project,thisArg){this.project=project,this.thisArg=thisArg}return MapOperator.prototype.call=function(subscriber,source){return source.subscribe(new MapSubscriber(subscriber,this.project,this.thisArg))},MapOperator}();exports.MapOperator=MapOperator;var MapSubscriber=function(_super){function MapSubscriber(destination,project,thisArg){var _this=_super.call(this,destination)||this;return _this.project=project,_this.count=0,_this.thisArg=thisArg||_this,_this}return __extends(MapSubscriber,_super),MapSubscriber.prototype._next=function(value){var result;try{result=this.project.call(this.thisArg,value,this.count++)}catch(err){return void this.destination.error(err)}this.destination.next(result)},MapSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],175:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.mapTo=function(value){return function(source){return source.lift(new MapToOperator(value))}};var MapToOperator=function(){function MapToOperator(value){this.value=value}return MapToOperator.prototype.call=function(subscriber,source){return source.subscribe(new MapToSubscriber(subscriber,this.value))},MapToOperator}(),MapToSubscriber=function(_super){function MapToSubscriber(destination,value){var _this=_super.call(this,destination)||this;return _this.value=value,_this}return __extends(MapToSubscriber,_super),MapToSubscriber.prototype._next=function(x){this.destination.next(this.value)},MapToSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],176:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),Notification_1=require("../Notification");exports.materialize=function(){return function(source){return source.lift(new MaterializeOperator)}};var MaterializeOperator=function(){function MaterializeOperator(){}return MaterializeOperator.prototype.call=function(subscriber,source){return source.subscribe(new MaterializeSubscriber(subscriber))},MaterializeOperator}(),MaterializeSubscriber=function(_super){function MaterializeSubscriber(destination){return _super.call(this,destination)||this}return __extends(MaterializeSubscriber,_super),MaterializeSubscriber.prototype._next=function(value){this.destination.next(Notification_1.Notification.createNext(value))},MaterializeSubscriber.prototype._error=function(err){var destination=this.destination;destination.next(Notification_1.Notification.createError(err)),destination.complete()},MaterializeSubscriber.prototype._complete=function(){var destination=this.destination;destination.next(Notification_1.Notification.createComplete()),destination.complete()},MaterializeSubscriber}(Subscriber_1.Subscriber)},{"../Notification":93,"../Subscriber":101}],177:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var reduce_1=require("./reduce");exports.max=function(comparer){var max="function"==typeof comparer?function(x,y){return 0<comparer(x,y)?x:y}:function(x,y){return y<x?x:y};return reduce_1.reduce(max)}},{"./reduce":195}],178:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var merge_1=require("../observable/merge");exports.merge=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];return function(source){return source.lift.call(merge_1.merge.apply(void 0,[source].concat(observables)))}}},{"../observable/merge":123}],179:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var mergeMap_1=require("./mergeMap"),identity_1=require("../util/identity");exports.mergeAll=function(concurrent){return void 0===concurrent&&(concurrent=Number.POSITIVE_INFINITY),mergeMap_1.mergeMap(identity_1.identity,concurrent)}},{"../util/identity":263,"./mergeMap":180}],180:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var subscribeToResult_1=require("../util/subscribeToResult"),OuterSubscriber_1=require("../OuterSubscriber"),InnerSubscriber_1=require("../InnerSubscriber"),map_1=require("./map"),from_1=require("../observable/from");exports.mergeMap=function mergeMap(project,resultSelector,concurrent){return void 0===concurrent&&(concurrent=Number.POSITIVE_INFINITY),"function"==typeof resultSelector?function(source){return source.pipe(mergeMap(function(a,i){return from_1.from(project(a,i)).pipe(map_1.map(function(b,ii){return resultSelector(a,b,i,ii)}))},concurrent))}:("number"==typeof resultSelector&&(concurrent=resultSelector),function(source){return source.lift(new MergeMapOperator(project,concurrent))})};var MergeMapOperator=function(){function MergeMapOperator(project,concurrent){void 0===concurrent&&(concurrent=Number.POSITIVE_INFINITY),this.project=project,this.concurrent=concurrent}return MergeMapOperator.prototype.call=function(observer,source){return source.subscribe(new MergeMapSubscriber(observer,this.project,this.concurrent))},MergeMapOperator}();exports.MergeMapOperator=MergeMapOperator;var MergeMapSubscriber=function(_super){function MergeMapSubscriber(destination,project,concurrent){void 0===concurrent&&(concurrent=Number.POSITIVE_INFINITY);var _this=_super.call(this,destination)||this;return _this.project=project,_this.concurrent=concurrent,_this.hasCompleted=!1,_this.buffer=[],_this.active=0,_this.index=0,_this}return __extends(MergeMapSubscriber,_super),MergeMapSubscriber.prototype._next=function(value){this.active<this.concurrent?this._tryNext(value):this.buffer.push(value)},MergeMapSubscriber.prototype._tryNext=function(value){var result,index=this.index++;try{result=this.project(value,index)}catch(err){return void this.destination.error(err)}this.active++,this._innerSub(result,value,index)},MergeMapSubscriber.prototype._innerSub=function(ish,value,index){var innerSubscriber=new InnerSubscriber_1.InnerSubscriber(this,void 0,void 0);this.destination.add(innerSubscriber),subscribeToResult_1.subscribeToResult(this,ish,value,index,innerSubscriber)},MergeMapSubscriber.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},MergeMapSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.destination.next(innerValue)},MergeMapSubscriber.prototype.notifyComplete=function(innerSub){var buffer=this.buffer;this.remove(innerSub),this.active--,0<buffer.length?this._next(buffer.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},MergeMapSubscriber}(OuterSubscriber_1.OuterSubscriber);exports.MergeMapSubscriber=MergeMapSubscriber},{"../InnerSubscriber":92,"../OuterSubscriber":96,"../observable/from":113,"../util/subscribeToResult":283,"./map":174}],181:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var mergeMap_1=require("./mergeMap");exports.mergeMapTo=function(innerObservable,resultSelector,concurrent){return void 0===concurrent&&(concurrent=Number.POSITIVE_INFINITY),"function"==typeof resultSelector?mergeMap_1.mergeMap(function(){return innerObservable},resultSelector,concurrent):("number"==typeof resultSelector&&(concurrent=resultSelector),mergeMap_1.mergeMap(function(){return innerObservable},concurrent))}},{"./mergeMap":180}],182:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var subscribeToResult_1=require("../util/subscribeToResult"),OuterSubscriber_1=require("../OuterSubscriber"),InnerSubscriber_1=require("../InnerSubscriber");exports.mergeScan=function(accumulator,seed,concurrent){return void 0===concurrent&&(concurrent=Number.POSITIVE_INFINITY),function(source){return source.lift(new MergeScanOperator(accumulator,seed,concurrent))}};var MergeScanOperator=function(){function MergeScanOperator(accumulator,seed,concurrent){this.accumulator=accumulator,this.seed=seed,this.concurrent=concurrent}return MergeScanOperator.prototype.call=function(subscriber,source){return source.subscribe(new MergeScanSubscriber(subscriber,this.accumulator,this.seed,this.concurrent))},MergeScanOperator}();exports.MergeScanOperator=MergeScanOperator;var MergeScanSubscriber=function(_super){function MergeScanSubscriber(destination,accumulator,acc,concurrent){var _this=_super.call(this,destination)||this;return _this.accumulator=accumulator,_this.acc=acc,_this.concurrent=concurrent,_this.hasValue=!1,_this.hasCompleted=!1,_this.buffer=[],_this.active=0,_this.index=0,_this}return __extends(MergeScanSubscriber,_super),MergeScanSubscriber.prototype._next=function(value){if(this.active<this.concurrent){var index=this.index++,destination=this.destination,ish=void 0;try{ish=(0,this.accumulator)(this.acc,value,index)}catch(e){return destination.error(e)}this.active++,this._innerSub(ish,value,index)}else this.buffer.push(value)},MergeScanSubscriber.prototype._innerSub=function(ish,value,index){var innerSubscriber=new InnerSubscriber_1.InnerSubscriber(this,void 0,void 0);this.destination.add(innerSubscriber),subscribeToResult_1.subscribeToResult(this,ish,value,index,innerSubscriber)},MergeScanSubscriber.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},MergeScanSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){var destination=this.destination;this.acc=innerValue,this.hasValue=!0,destination.next(innerValue)},MergeScanSubscriber.prototype.notifyComplete=function(innerSub){var buffer=this.buffer;this.destination.remove(innerSub),this.active--,0<buffer.length?this._next(buffer.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},MergeScanSubscriber}(OuterSubscriber_1.OuterSubscriber);exports.MergeScanSubscriber=MergeScanSubscriber},{"../InnerSubscriber":92,"../OuterSubscriber":96,"../util/subscribeToResult":283}],183:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var reduce_1=require("./reduce");exports.min=function(comparer){var min="function"==typeof comparer?function(x,y){return comparer(x,y)<0?x:y}:function(x,y){return x<y?x:y};return reduce_1.reduce(min)}},{"./reduce":195}],184:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ConnectableObservable_1=require("../observable/ConnectableObservable");exports.multicast=function(subjectOrSubjectFactory,selector){return function(source){var subjectFactory;if(subjectFactory="function"==typeof subjectOrSubjectFactory?subjectOrSubjectFactory:function(){return subjectOrSubjectFactory},"function"==typeof selector)return source.lift(new MulticastOperator(subjectFactory,selector));var connectable=Object.create(source,ConnectableObservable_1.connectableObservableDescriptor);return connectable.source=source,connectable.subjectFactory=subjectFactory,connectable}};var MulticastOperator=function(){function MulticastOperator(subjectFactory,selector){this.subjectFactory=subjectFactory,this.selector=selector}return MulticastOperator.prototype.call=function(subscriber,source){var selector=this.selector,subject=this.subjectFactory(),subscription=selector(subject).subscribe(subscriber);return subscription.add(source.subscribe(subject)),subscription},MulticastOperator}();exports.MulticastOperator=MulticastOperator},{"../observable/ConnectableObservable":104}],185:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),Notification_1=require("../Notification");exports.observeOn=function(scheduler,delay){return void 0===delay&&(delay=0),function(source){return source.lift(new ObserveOnOperator(scheduler,delay))}};var ObserveOnOperator=function(){function ObserveOnOperator(scheduler,delay){void 0===delay&&(delay=0),this.scheduler=scheduler,this.delay=delay}return ObserveOnOperator.prototype.call=function(subscriber,source){return source.subscribe(new ObserveOnSubscriber(subscriber,this.scheduler,this.delay))},ObserveOnOperator}();exports.ObserveOnOperator=ObserveOnOperator;var ObserveOnSubscriber=function(_super){function ObserveOnSubscriber(destination,scheduler,delay){void 0===delay&&(delay=0);var _this=_super.call(this,destination)||this;return _this.scheduler=scheduler,_this.delay=delay,_this}return __extends(ObserveOnSubscriber,_super),ObserveOnSubscriber.dispatch=function(arg){var notification=arg.notification,destination=arg.destination;notification.observe(destination),this.unsubscribe()},ObserveOnSubscriber.prototype.scheduleMessage=function(notification){this.destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch,this.delay,new ObserveOnMessage(notification,this.destination)))},ObserveOnSubscriber.prototype._next=function(value){this.scheduleMessage(Notification_1.Notification.createNext(value))},ObserveOnSubscriber.prototype._error=function(err){this.scheduleMessage(Notification_1.Notification.createError(err)),this.unsubscribe()},ObserveOnSubscriber.prototype._complete=function(){this.scheduleMessage(Notification_1.Notification.createComplete()),this.unsubscribe()},ObserveOnSubscriber}(Subscriber_1.Subscriber);exports.ObserveOnSubscriber=ObserveOnSubscriber;var ObserveOnMessage=function(notification,destination){this.notification=notification,this.destination=destination};exports.ObserveOnMessage=ObserveOnMessage},{"../Notification":93,"../Subscriber":101}],186:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var from_1=require("../observable/from"),isArray_1=require("../util/isArray"),OuterSubscriber_1=require("../OuterSubscriber"),InnerSubscriber_1=require("../InnerSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.onErrorResumeNext=function(){for(var nextSources=[],_i=0;_i<arguments.length;_i++)nextSources[_i]=arguments[_i];return 1===nextSources.length&&isArray_1.isArray(nextSources[0])&&(nextSources=nextSources[0]),function(source){return source.lift(new OnErrorResumeNextOperator(nextSources))}},exports.onErrorResumeNextStatic=function(){for(var nextSources=[],_i=0;_i<arguments.length;_i++)nextSources[_i]=arguments[_i];var source;return 1===nextSources.length&&isArray_1.isArray(nextSources[0])&&(nextSources=nextSources[0]),source=nextSources.shift(),from_1.from(source,null).lift(new OnErrorResumeNextOperator(nextSources))};var OnErrorResumeNextOperator=function(){function OnErrorResumeNextOperator(nextSources){this.nextSources=nextSources}return OnErrorResumeNextOperator.prototype.call=function(subscriber,source){return source.subscribe(new OnErrorResumeNextSubscriber(subscriber,this.nextSources))},OnErrorResumeNextOperator}(),OnErrorResumeNextSubscriber=function(_super){function OnErrorResumeNextSubscriber(destination,nextSources){var _this=_super.call(this,destination)||this;return _this.destination=destination,_this.nextSources=nextSources,_this}return __extends(OnErrorResumeNextSubscriber,_super),OnErrorResumeNextSubscriber.prototype.notifyError=function(error,innerSub){this.subscribeToNextSource()},OnErrorResumeNextSubscriber.prototype.notifyComplete=function(innerSub){this.subscribeToNextSource()},OnErrorResumeNextSubscriber.prototype._error=function(err){this.subscribeToNextSource(),this.unsubscribe()},OnErrorResumeNextSubscriber.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},OnErrorResumeNextSubscriber.prototype.subscribeToNextSource=function(){var next=this.nextSources.shift();if(next){var innerSubscriber=new InnerSubscriber_1.InnerSubscriber(this,void 0,void 0);this.destination.add(innerSubscriber),subscribeToResult_1.subscribeToResult(this,next,void 0,void 0,innerSubscriber)}else this.destination.complete()},OnErrorResumeNextSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../InnerSubscriber":92,"../OuterSubscriber":96,"../observable/from":113,"../util/isArray":264,"../util/subscribeToResult":283}],187:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.pairwise=function(){return function(source){return source.lift(new PairwiseOperator)}};var PairwiseOperator=function(){function PairwiseOperator(){}return PairwiseOperator.prototype.call=function(subscriber,source){return source.subscribe(new PairwiseSubscriber(subscriber))},PairwiseOperator}(),PairwiseSubscriber=function(_super){function PairwiseSubscriber(destination){var _this=_super.call(this,destination)||this;return _this.hasPrev=!1,_this}return __extends(PairwiseSubscriber,_super),PairwiseSubscriber.prototype._next=function(value){this.hasPrev?this.destination.next([this.prev,value]):this.hasPrev=!0,this.prev=value},PairwiseSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],188:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var not_1=require("../util/not"),filter_1=require("./filter");exports.partition=function(predicate,thisArg){return function(source){return[filter_1.filter(predicate,thisArg)(source),filter_1.filter(not_1.not(predicate,thisArg))(source)]}}},{"../util/not":276,"./filter":165}],189:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var map_1=require("./map");exports.pluck=function(){for(var properties=[],_i=0;_i<arguments.length;_i++)properties[_i]=arguments[_i];var length=properties.length;if(0===length)throw new Error("list of properties cannot be empty.");return function(source){return map_1.map(function(props,length){return function(x){for(var currentProp=x,i=0;i<length;i++){var p=currentProp[props[i]];if(void 0===p)return;currentProp=p}return currentProp}}(properties,length))(source)}}},{"./map":174}],190:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("../Subject"),multicast_1=require("./multicast");exports.publish=function(selector){return selector?multicast_1.multicast(function(){return new Subject_1.Subject},selector):multicast_1.multicast(new Subject_1.Subject)}},{"../Subject":99,"./multicast":184}],191:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var BehaviorSubject_1=require("../BehaviorSubject"),multicast_1=require("./multicast");exports.publishBehavior=function(value){return function(source){return multicast_1.multicast(new BehaviorSubject_1.BehaviorSubject(value))(source)}}},{"../BehaviorSubject":91,"./multicast":184}],192:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var AsyncSubject_1=require("../AsyncSubject"),multicast_1=require("./multicast");exports.publishLast=function(){return function(source){return multicast_1.multicast(new AsyncSubject_1.AsyncSubject)(source)}}},{"../AsyncSubject":90,"./multicast":184}],193:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ReplaySubject_1=require("../ReplaySubject"),multicast_1=require("./multicast");exports.publishReplay=function(bufferSize,windowTime,selectorOrScheduler,scheduler){selectorOrScheduler&&"function"!=typeof selectorOrScheduler&&(scheduler=selectorOrScheduler);var selector="function"==typeof selectorOrScheduler?selectorOrScheduler:void 0,subject=new ReplaySubject_1.ReplaySubject(bufferSize,windowTime,scheduler);return function(source){return multicast_1.multicast(function(){return subject},selector)(source)}}},{"../ReplaySubject":97,"./multicast":184}],194:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var isArray_1=require("../util/isArray"),race_1=require("../observable/race");exports.race=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];return function(source){return 1===observables.length&&isArray_1.isArray(observables[0])&&(observables=observables[0]),source.lift.call(race_1.race.apply(void 0,[source].concat(observables)))}}},{"../observable/race":128,"../util/isArray":264}],195:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var scan_1=require("./scan"),takeLast_1=require("./takeLast"),defaultIfEmpty_1=require("./defaultIfEmpty"),pipe_1=require("../util/pipe");exports.reduce=function(accumulator,seed){return 2<=arguments.length?function(source){return pipe_1.pipe(scan_1.scan(accumulator,seed),takeLast_1.takeLast(1),defaultIfEmpty_1.defaultIfEmpty(seed))(source)}:function(source){return pipe_1.pipe(scan_1.scan(function(acc,value,index){return accumulator(acc,value,index+1)}),takeLast_1.takeLast(1))(source)}}},{"../util/pipe":277,"./defaultIfEmpty":152,"./scan":203,"./takeLast":218}],196:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.refCount=function(){return function(source){return source.lift(new RefCountOperator(source))}};var RefCountOperator=function(){function RefCountOperator(connectable){this.connectable=connectable}return RefCountOperator.prototype.call=function(subscriber,source){var connectable=this.connectable;connectable._refCount++;var refCounter=new RefCountSubscriber(subscriber,connectable),subscription=source.subscribe(refCounter);return refCounter.closed||(refCounter.connection=connectable.connect()),subscription},RefCountOperator}(),RefCountSubscriber=function(_super){function RefCountSubscriber(destination,connectable){var _this=_super.call(this,destination)||this;return _this.connectable=connectable,_this}return __extends(RefCountSubscriber,_super),RefCountSubscriber.prototype._unsubscribe=function(){var connectable=this.connectable;if(connectable){this.connectable=null;var refCount=connectable._refCount;if(refCount<=0)this.connection=null;else if(connectable._refCount=refCount-1,1<refCount)this.connection=null;else{var connection=this.connection,sharedConnection=connectable._connection;this.connection=null,!sharedConnection||connection&&sharedConnection!==connection||sharedConnection.unsubscribe()}}else this.connection=null},RefCountSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],197:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),empty_1=require("../observable/empty");exports.repeat=function(count){return void 0===count&&(count=-1),function(source){return 0===count?empty_1.empty():count<0?source.lift(new RepeatOperator(-1,source)):source.lift(new RepeatOperator(count-1,source))}};var RepeatOperator=function(){function RepeatOperator(count,source){this.count=count,this.source=source}return RepeatOperator.prototype.call=function(subscriber,source){return source.subscribe(new RepeatSubscriber(subscriber,this.count,this.source))},RepeatOperator}(),RepeatSubscriber=function(_super){function RepeatSubscriber(destination,count,source){var _this=_super.call(this,destination)||this;return _this.count=count,_this.source=source,_this}return __extends(RepeatSubscriber,_super),RepeatSubscriber.prototype.complete=function(){if(!this.isStopped){var source=this.source,count=this.count;if(0===count)return _super.prototype.complete.call(this);-1<count&&(this.count=count-1),source.subscribe(this._unsubscribeAndRecycle())}},RepeatSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101,"../observable/empty":111}],198:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("../Subject"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.repeatWhen=function(notifier){return function(source){return source.lift(new RepeatWhenOperator(notifier))}};var RepeatWhenOperator=function(){function RepeatWhenOperator(notifier){this.notifier=notifier}return RepeatWhenOperator.prototype.call=function(subscriber,source){return source.subscribe(new RepeatWhenSubscriber(subscriber,this.notifier,source))},RepeatWhenOperator}(),RepeatWhenSubscriber=function(_super){function RepeatWhenSubscriber(destination,notifier,source){var _this=_super.call(this,destination)||this;return _this.notifier=notifier,_this.source=source,_this.sourceIsBeingSubscribedTo=!0,_this}return __extends(RepeatWhenSubscriber,_super),RepeatWhenSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},RepeatWhenSubscriber.prototype.notifyComplete=function(innerSub){if(!1===this.sourceIsBeingSubscribedTo)return _super.prototype.complete.call(this)},RepeatWhenSubscriber.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return _super.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next()}},RepeatWhenSubscriber.prototype._unsubscribe=function(){var notifications=this.notifications,retriesSubscription=this.retriesSubscription;notifications&&(notifications.unsubscribe(),this.notifications=null),retriesSubscription&&(retriesSubscription.unsubscribe(),this.retriesSubscription=null),this.retries=null},RepeatWhenSubscriber.prototype._unsubscribeAndRecycle=function(){var _unsubscribe=this._unsubscribe;return this._unsubscribe=null,_super.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=_unsubscribe,this},RepeatWhenSubscriber.prototype.subscribeToRetries=function(){var retries;this.notifications=new Subject_1.Subject;try{retries=(0,this.notifier)(this.notifications)}catch(e){return _super.prototype.complete.call(this)}this.retries=retries,this.retriesSubscription=subscribeToResult_1.subscribeToResult(this,retries)},RepeatWhenSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../Subject":99,"../util/subscribeToResult":283}],199:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.retry=function(count){return void 0===count&&(count=-1),function(source){return source.lift(new RetryOperator(count,source))}};var RetryOperator=function(){function RetryOperator(count,source){this.count=count,this.source=source}return RetryOperator.prototype.call=function(subscriber,source){return source.subscribe(new RetrySubscriber(subscriber,this.count,this.source))},RetryOperator}(),RetrySubscriber=function(_super){function RetrySubscriber(destination,count,source){var _this=_super.call(this,destination)||this;return _this.count=count,_this.source=source,_this}return __extends(RetrySubscriber,_super),RetrySubscriber.prototype.error=function(err){if(!this.isStopped){var source=this.source,count=this.count;if(0===count)return _super.prototype.error.call(this,err);-1<count&&(this.count=count-1),source.subscribe(this._unsubscribeAndRecycle())}},RetrySubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],200:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("../Subject"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.retryWhen=function(notifier){return function(source){return source.lift(new RetryWhenOperator(notifier,source))}};var RetryWhenOperator=function(){function RetryWhenOperator(notifier,source){this.notifier=notifier,this.source=source}return RetryWhenOperator.prototype.call=function(subscriber,source){return source.subscribe(new RetryWhenSubscriber(subscriber,this.notifier,this.source))},RetryWhenOperator}(),RetryWhenSubscriber=function(_super){function RetryWhenSubscriber(destination,notifier,source){var _this=_super.call(this,destination)||this;return _this.notifier=notifier,_this.source=source,_this}return __extends(RetryWhenSubscriber,_super),RetryWhenSubscriber.prototype.error=function(err){if(!this.isStopped){var errors=this.errors,retries=this.retries,retriesSubscription=this.retriesSubscription;if(retries)this.errors=null,this.retriesSubscription=null;else{errors=new Subject_1.Subject;try{retries=(0,this.notifier)(errors)}catch(e){return _super.prototype.error.call(this,e)}retriesSubscription=subscribeToResult_1.subscribeToResult(this,retries)}this._unsubscribeAndRecycle(),this.errors=errors,this.retries=retries,this.retriesSubscription=retriesSubscription,errors.next(err)}},RetryWhenSubscriber.prototype._unsubscribe=function(){var errors=this.errors,retriesSubscription=this.retriesSubscription;errors&&(errors.unsubscribe(),this.errors=null),retriesSubscription&&(retriesSubscription.unsubscribe(),this.retriesSubscription=null),this.retries=null},RetryWhenSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){var _unsubscribe=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=_unsubscribe,this.source.subscribe(this)},RetryWhenSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../Subject":99,"../util/subscribeToResult":283}],201:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.sample=function(notifier){return function(source){return source.lift(new SampleOperator(notifier))}};var SampleOperator=function(){function SampleOperator(notifier){this.notifier=notifier}return SampleOperator.prototype.call=function(subscriber,source){var sampleSubscriber=new SampleSubscriber(subscriber),subscription=source.subscribe(sampleSubscriber);return subscription.add(subscribeToResult_1.subscribeToResult(sampleSubscriber,this.notifier)),subscription},SampleOperator}(),SampleSubscriber=function(_super){function SampleSubscriber(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.hasValue=!1,_this}return __extends(SampleSubscriber,_super),SampleSubscriber.prototype._next=function(value){this.value=value,this.hasValue=!0},SampleSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.emitValue()},SampleSubscriber.prototype.notifyComplete=function(){this.emitValue()},SampleSubscriber.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},SampleSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],202:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),async_1=require("../scheduler/async");exports.sampleTime=function(period,scheduler){return void 0===scheduler&&(scheduler=async_1.async),function(source){return source.lift(new SampleTimeOperator(period,scheduler))}};var SampleTimeOperator=function(){function SampleTimeOperator(period,scheduler){this.period=period,this.scheduler=scheduler}return SampleTimeOperator.prototype.call=function(subscriber,source){return source.subscribe(new SampleTimeSubscriber(subscriber,this.period,this.scheduler))},SampleTimeOperator}(),SampleTimeSubscriber=function(_super){function SampleTimeSubscriber(destination,period,scheduler){var _this=_super.call(this,destination)||this;return _this.period=period,_this.scheduler=scheduler,_this.hasValue=!1,_this.add(scheduler.schedule(dispatchNotification,period,{subscriber:_this,period:period})),_this}return __extends(SampleTimeSubscriber,_super),SampleTimeSubscriber.prototype._next=function(value){this.lastValue=value,this.hasValue=!0},SampleTimeSubscriber.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},SampleTimeSubscriber}(Subscriber_1.Subscriber);function dispatchNotification(state){var subscriber=state.subscriber,period=state.period;subscriber.notifyNext(),this.schedule(state,period)}},{"../Subscriber":101,"../scheduler/async":250}],203:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.scan=function(accumulator,seed){var hasSeed=!1;return 2<=arguments.length&&(hasSeed=!0),function(source){return source.lift(new ScanOperator(accumulator,seed,hasSeed))}};var ScanOperator=function(){function ScanOperator(accumulator,seed,hasSeed){void 0===hasSeed&&(hasSeed=!1),this.accumulator=accumulator,this.seed=seed,this.hasSeed=hasSeed}return ScanOperator.prototype.call=function(subscriber,source){return source.subscribe(new ScanSubscriber(subscriber,this.accumulator,this.seed,this.hasSeed))},ScanOperator}(),ScanSubscriber=function(_super){function ScanSubscriber(destination,accumulator,_seed,hasSeed){var _this=_super.call(this,destination)||this;return _this.accumulator=accumulator,_this._seed=_seed,_this.hasSeed=hasSeed,_this.index=0,_this}return __extends(ScanSubscriber,_super),Object.defineProperty(ScanSubscriber.prototype,"seed",{get:function(){return this._seed},set:function(value){this.hasSeed=!0,this._seed=value},enumerable:!0,configurable:!0}),ScanSubscriber.prototype._next=function(value){if(this.hasSeed)return this._tryNext(value);this.seed=value,this.destination.next(value)},ScanSubscriber.prototype._tryNext=function(value){var result,index=this.index++;try{result=this.accumulator(this.seed,value,index)}catch(err){this.destination.error(err)}this.seed=result,this.destination.next(result)},ScanSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],204:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.sequenceEqual=function(compareTo,comparator){return function(source){return source.lift(new SequenceEqualOperator(compareTo,comparator))}};var SequenceEqualOperator=function(){function SequenceEqualOperator(compareTo,comparator){this.compareTo=compareTo,this.comparator=comparator}return SequenceEqualOperator.prototype.call=function(subscriber,source){return source.subscribe(new SequenceEqualSubscriber(subscriber,this.compareTo,this.comparator))},SequenceEqualOperator}();exports.SequenceEqualOperator=SequenceEqualOperator;var SequenceEqualSubscriber=function(_super){function SequenceEqualSubscriber(destination,compareTo,comparator){var _this=_super.call(this,destination)||this;return _this.compareTo=compareTo,_this.comparator=comparator,_this._a=[],_this._b=[],_this._oneComplete=!1,_this.destination.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination,_this))),_this}return __extends(SequenceEqualSubscriber,_super),SequenceEqualSubscriber.prototype._next=function(value){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(value),this.checkValues())},SequenceEqualSubscriber.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},SequenceEqualSubscriber.prototype.checkValues=function(){for(var _a=this._a,_b=this._b,comparator=this.comparator;0<_a.length&&0<_b.length;){var a=_a.shift(),b=_b.shift(),areEqual=!1;try{areEqual=comparator?comparator(a,b):a===b}catch(e){this.destination.error(e)}areEqual||this.emit(!1)}},SequenceEqualSubscriber.prototype.emit=function(value){var destination=this.destination;destination.next(value),destination.complete()},SequenceEqualSubscriber.prototype.nextB=function(value){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(value),this.checkValues())},SequenceEqualSubscriber.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},SequenceEqualSubscriber}(Subscriber_1.Subscriber);exports.SequenceEqualSubscriber=SequenceEqualSubscriber;var SequenceEqualCompareToSubscriber=function(_super){function SequenceEqualCompareToSubscriber(destination,parent){var _this=_super.call(this,destination)||this;return _this.parent=parent,_this}return __extends(SequenceEqualCompareToSubscriber,_super),SequenceEqualCompareToSubscriber.prototype._next=function(value){this.parent.nextB(value)},SequenceEqualCompareToSubscriber.prototype._error=function(err){this.parent.error(err),this.unsubscribe()},SequenceEqualCompareToSubscriber.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},SequenceEqualCompareToSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],205:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var multicast_1=require("./multicast"),refCount_1=require("./refCount"),Subject_1=require("../Subject");function shareSubjectFactory(){return new Subject_1.Subject}exports.share=function(){return function(source){return refCount_1.refCount()(multicast_1.multicast(shareSubjectFactory)(source))}}},{"../Subject":99,"./multicast":184,"./refCount":196}],206:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ReplaySubject_1=require("../ReplaySubject");exports.shareReplay=function(configOrBufferSize,windowTime,scheduler){var config;return config=configOrBufferSize&&"object"==typeof configOrBufferSize?configOrBufferSize:{bufferSize:configOrBufferSize,windowTime:windowTime,refCount:!1,scheduler:scheduler},function(source){return source.lift(function(_a){var subject,subscription,_b=_a.bufferSize,bufferSize=void 0===_b?Number.POSITIVE_INFINITY:_b,_c=_a.windowTime,windowTime=void 0===_c?Number.POSITIVE_INFINITY:_c,useRefCount=_a.refCount,scheduler=_a.scheduler,refCount=0,hasError=!1,isComplete=!1;return function(source){refCount++,subject&&!hasError||(hasError=!1,subject=new ReplaySubject_1.ReplaySubject(bufferSize,windowTime,scheduler),subscription=source.subscribe({next:function(value){subject.next(value)},error:function(err){hasError=!0,subject.error(err)},complete:function(){isComplete=!0,subject.complete()}}));var innerSub=subject.subscribe(this);this.add(function(){refCount--,innerSub.unsubscribe(),subscription&&!isComplete&&useRefCount&&0===refCount&&(subscription.unsubscribe(),subject=subscription=void 0)})}}(config))}}},{"../ReplaySubject":97}],207:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),EmptyError_1=require("../util/EmptyError");exports.single=function(predicate){return function(source){return source.lift(new SingleOperator(predicate,source))}};var SingleOperator=function(){function SingleOperator(predicate,source){this.predicate=predicate,this.source=source}return SingleOperator.prototype.call=function(subscriber,source){return source.subscribe(new SingleSubscriber(subscriber,this.predicate,this.source))},SingleOperator}(),SingleSubscriber=function(_super){function SingleSubscriber(destination,predicate,source){var _this=_super.call(this,destination)||this;return _this.predicate=predicate,_this.source=source,_this.seenValue=!1,_this.index=0,_this}return __extends(SingleSubscriber,_super),SingleSubscriber.prototype.applySingleValue=function(value){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=value)},SingleSubscriber.prototype._next=function(value){var index=this.index++;this.predicate?this.tryNext(value,index):this.applySingleValue(value)},SingleSubscriber.prototype.tryNext=function(value,index){try{this.predicate(value,index,this.source)&&this.applySingleValue(value)}catch(err){this.destination.error(err)}},SingleSubscriber.prototype._complete=function(){var destination=this.destination;0<this.index?(destination.next(this.seenValue?this.singleValue:void 0),destination.complete()):destination.error(new EmptyError_1.EmptyError)},SingleSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101,"../util/EmptyError":256}],208:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.skip=function(count){return function(source){return source.lift(new SkipOperator(count))}};var SkipOperator=function(){function SkipOperator(total){this.total=total}return SkipOperator.prototype.call=function(subscriber,source){return source.subscribe(new SkipSubscriber(subscriber,this.total))},SkipOperator}(),SkipSubscriber=function(_super){function SkipSubscriber(destination,total){var _this=_super.call(this,destination)||this;return _this.total=total,_this.count=0,_this}return __extends(SkipSubscriber,_super),SkipSubscriber.prototype._next=function(x){++this.count>this.total&&this.destination.next(x)},SkipSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],209:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),ArgumentOutOfRangeError_1=require("../util/ArgumentOutOfRangeError");exports.skipLast=function(count){return function(source){return source.lift(new SkipLastOperator(count))}};var SkipLastOperator=function(){function SkipLastOperator(_skipCount){if(this._skipCount=_skipCount,this._skipCount<0)throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError}return SkipLastOperator.prototype.call=function(subscriber,source){return 0===this._skipCount?source.subscribe(new Subscriber_1.Subscriber(subscriber)):source.subscribe(new SkipLastSubscriber(subscriber,this._skipCount))},SkipLastOperator}(),SkipLastSubscriber=function(_super){function SkipLastSubscriber(destination,_skipCount){var _this=_super.call(this,destination)||this;return _this._skipCount=_skipCount,_this._count=0,_this._ring=new Array(_skipCount),_this}return __extends(SkipLastSubscriber,_super),SkipLastSubscriber.prototype._next=function(value){var skipCount=this._skipCount,count=this._count++;if(count<skipCount)this._ring[count]=value;else{var currentIndex=count%skipCount,ring=this._ring,oldValue=ring[currentIndex];ring[currentIndex]=value,this.destination.next(oldValue)}},SkipLastSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101,"../util/ArgumentOutOfRangeError":255}],210:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),InnerSubscriber_1=require("../InnerSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.skipUntil=function(notifier){return function(source){return source.lift(new SkipUntilOperator(notifier))}};var SkipUntilOperator=function(){function SkipUntilOperator(notifier){this.notifier=notifier}return SkipUntilOperator.prototype.call=function(destination,source){return source.subscribe(new SkipUntilSubscriber(destination,this.notifier))},SkipUntilOperator}(),SkipUntilSubscriber=function(_super){function SkipUntilSubscriber(destination,notifier){var _this=_super.call(this,destination)||this;_this.hasValue=!1;var innerSubscriber=new InnerSubscriber_1.InnerSubscriber(_this,void 0,void 0);return _this.add(innerSubscriber),_this.innerSubscription=innerSubscriber,subscribeToResult_1.subscribeToResult(_this,notifier,void 0,void 0,innerSubscriber),_this}return __extends(SkipUntilSubscriber,_super),SkipUntilSubscriber.prototype._next=function(value){this.hasValue&&_super.prototype._next.call(this,value)},SkipUntilSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},SkipUntilSubscriber.prototype.notifyComplete=function(){},SkipUntilSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../InnerSubscriber":92,"../OuterSubscriber":96,"../util/subscribeToResult":283}],211:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.skipWhile=function(predicate){return function(source){return source.lift(new SkipWhileOperator(predicate))}};var SkipWhileOperator=function(){function SkipWhileOperator(predicate){this.predicate=predicate}return SkipWhileOperator.prototype.call=function(subscriber,source){return source.subscribe(new SkipWhileSubscriber(subscriber,this.predicate))},SkipWhileOperator}(),SkipWhileSubscriber=function(_super){function SkipWhileSubscriber(destination,predicate){var _this=_super.call(this,destination)||this;return _this.predicate=predicate,_this.skipping=!0,_this.index=0,_this}return __extends(SkipWhileSubscriber,_super),SkipWhileSubscriber.prototype._next=function(value){var destination=this.destination;this.skipping&&this.tryCallPredicate(value),this.skipping||destination.next(value)},SkipWhileSubscriber.prototype.tryCallPredicate=function(value){try{var result=this.predicate(value,this.index++);this.skipping=Boolean(result)}catch(err){this.destination.error(err)}},SkipWhileSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],212:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var fromArray_1=require("../observable/fromArray"),scalar_1=require("../observable/scalar"),empty_1=require("../observable/empty"),concat_1=require("../observable/concat"),isScheduler_1=require("../util/isScheduler");exports.startWith=function(){for(var array=[],_i=0;_i<arguments.length;_i++)array[_i]=arguments[_i];return function(source){var scheduler=array[array.length-1];isScheduler_1.isScheduler(scheduler)?array.pop():scheduler=null;var len=array.length;return 1!==len||scheduler?0<len?concat_1.concat(fromArray_1.fromArray(array,scheduler),source):concat_1.concat(empty_1.empty(scheduler),source):concat_1.concat(scalar_1.scalar(array[0]),source)}}},{"../observable/concat":109,"../observable/empty":111,"../observable/fromArray":114,"../observable/scalar":130,"../util/isScheduler":274}],213:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var SubscribeOnObservable_1=require("../observable/SubscribeOnObservable");exports.subscribeOn=function(scheduler,delay){return void 0===delay&&(delay=0),function(source){return source.lift(new SubscribeOnOperator(scheduler,delay))}};var SubscribeOnOperator=function(){function SubscribeOnOperator(scheduler,delay){this.scheduler=scheduler,this.delay=delay}return SubscribeOnOperator.prototype.call=function(subscriber,source){return new SubscribeOnObservable_1.SubscribeOnObservable(source,this.delay,this.scheduler).subscribe(subscriber)},SubscribeOnOperator}()},{"../observable/SubscribeOnObservable":105}],214:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var switchMap_1=require("./switchMap"),identity_1=require("../util/identity");exports.switchAll=function(){return switchMap_1.switchMap(identity_1.identity)}},{"../util/identity":263,"./switchMap":215}],215:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),InnerSubscriber_1=require("../InnerSubscriber"),subscribeToResult_1=require("../util/subscribeToResult"),map_1=require("./map"),from_1=require("../observable/from");exports.switchMap=function switchMap(project,resultSelector){return"function"==typeof resultSelector?function(source){return source.pipe(switchMap(function(a,i){return from_1.from(project(a,i)).pipe(map_1.map(function(b,ii){return resultSelector(a,b,i,ii)}))}))}:function(source){return source.lift(new SwitchMapOperator(project))}};var SwitchMapOperator=function(){function SwitchMapOperator(project){this.project=project}return SwitchMapOperator.prototype.call=function(subscriber,source){return source.subscribe(new SwitchMapSubscriber(subscriber,this.project))},SwitchMapOperator}(),SwitchMapSubscriber=function(_super){function SwitchMapSubscriber(destination,project){var _this=_super.call(this,destination)||this;return _this.project=project,_this.index=0,_this}return __extends(SwitchMapSubscriber,_super),SwitchMapSubscriber.prototype._next=function(value){var result,index=this.index++;try{result=this.project(value,index)}catch(error){return void this.destination.error(error)}this._innerSub(result,value,index)},SwitchMapSubscriber.prototype._innerSub=function(result,value,index){var innerSubscription=this.innerSubscription;innerSubscription&&innerSubscription.unsubscribe();var innerSubscriber=new InnerSubscriber_1.InnerSubscriber(this,void 0,void 0);this.destination.add(innerSubscriber),this.innerSubscription=subscribeToResult_1.subscribeToResult(this,result,value,index,innerSubscriber)},SwitchMapSubscriber.prototype._complete=function(){var innerSubscription=this.innerSubscription;innerSubscription&&!innerSubscription.closed||_super.prototype._complete.call(this),this.unsubscribe()},SwitchMapSubscriber.prototype._unsubscribe=function(){this.innerSubscription=null},SwitchMapSubscriber.prototype.notifyComplete=function(innerSub){this.destination.remove(innerSub),this.innerSubscription=null,this.isStopped&&_super.prototype._complete.call(this)},SwitchMapSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.destination.next(innerValue)},SwitchMapSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../InnerSubscriber":92,"../OuterSubscriber":96,"../observable/from":113,"../util/subscribeToResult":283,"./map":174}],216:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var switchMap_1=require("./switchMap");exports.switchMapTo=function(innerObservable,resultSelector){return resultSelector?switchMap_1.switchMap(function(){return innerObservable},resultSelector):switchMap_1.switchMap(function(){return innerObservable})}},{"./switchMap":215}],217:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),ArgumentOutOfRangeError_1=require("../util/ArgumentOutOfRangeError"),empty_1=require("../observable/empty");exports.take=function(count){return function(source){return 0===count?empty_1.empty():source.lift(new TakeOperator(count))}};var TakeOperator=function(){function TakeOperator(total){if(this.total=total,this.total<0)throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError}return TakeOperator.prototype.call=function(subscriber,source){return source.subscribe(new TakeSubscriber(subscriber,this.total))},TakeOperator}(),TakeSubscriber=function(_super){function TakeSubscriber(destination,total){var _this=_super.call(this,destination)||this;return _this.total=total,_this.count=0,_this}return __extends(TakeSubscriber,_super),TakeSubscriber.prototype._next=function(value){var total=this.total,count=++this.count;count<=total&&(this.destination.next(value),count===total&&(this.destination.complete(),this.unsubscribe()))},TakeSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101,"../observable/empty":111,"../util/ArgumentOutOfRangeError":255}],218:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),ArgumentOutOfRangeError_1=require("../util/ArgumentOutOfRangeError"),empty_1=require("../observable/empty");exports.takeLast=function(count){return function(source){return 0===count?empty_1.empty():source.lift(new TakeLastOperator(count))}};var TakeLastOperator=function(){function TakeLastOperator(total){if(this.total=total,this.total<0)throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError}return TakeLastOperator.prototype.call=function(subscriber,source){return source.subscribe(new TakeLastSubscriber(subscriber,this.total))},TakeLastOperator}(),TakeLastSubscriber=function(_super){function TakeLastSubscriber(destination,total){var _this=_super.call(this,destination)||this;return _this.total=total,_this.ring=new Array,_this.count=0,_this}return __extends(TakeLastSubscriber,_super),TakeLastSubscriber.prototype._next=function(value){var ring=this.ring,total=this.total,count=this.count++;ring.length<total?ring.push(value):ring[count%total]=value},TakeLastSubscriber.prototype._complete=function(){var destination=this.destination,count=this.count;if(0<count)for(var total=this.count>=this.total?this.total:this.count,ring=this.ring,i=0;i<total;i++){var idx=count++%total;destination.next(ring[idx])}destination.complete()},TakeLastSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101,"../observable/empty":111,"../util/ArgumentOutOfRangeError":255}],219:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.takeUntil=function(notifier){return function(source){return source.lift(new TakeUntilOperator(notifier))}};var TakeUntilOperator=function(){function TakeUntilOperator(notifier){this.notifier=notifier}return TakeUntilOperator.prototype.call=function(subscriber,source){var takeUntilSubscriber=new TakeUntilSubscriber(subscriber),notifierSubscription=subscribeToResult_1.subscribeToResult(takeUntilSubscriber,this.notifier);return notifierSubscription&&!takeUntilSubscriber.seenValue?(takeUntilSubscriber.add(notifierSubscription),source.subscribe(takeUntilSubscriber)):takeUntilSubscriber},TakeUntilOperator}(),TakeUntilSubscriber=function(_super){function TakeUntilSubscriber(destination){var _this=_super.call(this,destination)||this;return _this.seenValue=!1,_this}return __extends(TakeUntilSubscriber,_super),TakeUntilSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.seenValue=!0,this.complete()},TakeUntilSubscriber.prototype.notifyComplete=function(){},TakeUntilSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],220:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.takeWhile=function(predicate,inclusive){return void 0===inclusive&&(inclusive=!1),function(source){return source.lift(new TakeWhileOperator(predicate,inclusive))}};var TakeWhileOperator=function(){function TakeWhileOperator(predicate,inclusive){this.predicate=predicate,this.inclusive=inclusive}return TakeWhileOperator.prototype.call=function(subscriber,source){return source.subscribe(new TakeWhileSubscriber(subscriber,this.predicate,this.inclusive))},TakeWhileOperator}(),TakeWhileSubscriber=function(_super){function TakeWhileSubscriber(destination,predicate,inclusive){var _this=_super.call(this,destination)||this;return _this.predicate=predicate,_this.inclusive=inclusive,_this.index=0,_this}return __extends(TakeWhileSubscriber,_super),TakeWhileSubscriber.prototype._next=function(value){var result,destination=this.destination;try{result=this.predicate(value,this.index++)}catch(err){return void destination.error(err)}this.nextOrComplete(value,result)},TakeWhileSubscriber.prototype.nextOrComplete=function(value,predicateResult){var destination=this.destination;Boolean(predicateResult)?destination.next(value):(this.inclusive&&destination.next(value),destination.complete())},TakeWhileSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101}],221:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),noop_1=require("../util/noop"),isFunction_1=require("../util/isFunction");exports.tap=function(nextOrObserver,error,complete){return function(source){return source.lift(new DoOperator(nextOrObserver,error,complete))}};var DoOperator=function(){function DoOperator(nextOrObserver,error,complete){this.nextOrObserver=nextOrObserver,this.error=error,this.complete=complete}return DoOperator.prototype.call=function(subscriber,source){return source.subscribe(new TapSubscriber(subscriber,this.nextOrObserver,this.error,this.complete))},DoOperator}(),TapSubscriber=function(_super){function TapSubscriber(destination,observerOrNext,error,complete){var _this=_super.call(this,destination)||this;return _this._tapNext=noop_1.noop,_this._tapError=noop_1.noop,_this._tapComplete=noop_1.noop,_this._tapError=error||noop_1.noop,_this._tapComplete=complete||noop_1.noop,isFunction_1.isFunction(observerOrNext)?(_this._context=_this)._tapNext=observerOrNext:observerOrNext&&(_this._context=observerOrNext,_this._tapNext=observerOrNext.next||noop_1.noop,_this._tapError=observerOrNext.error||noop_1.noop,_this._tapComplete=observerOrNext.complete||noop_1.noop),_this}return __extends(TapSubscriber,_super),TapSubscriber.prototype._next=function(value){try{this._tapNext.call(this._context,value)}catch(err){return void this.destination.error(err)}this.destination.next(value)},TapSubscriber.prototype._error=function(err){try{this._tapError.call(this._context,err)}catch(err){return void this.destination.error(err)}this.destination.error(err)},TapSubscriber.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(err){return void this.destination.error(err)}return this.destination.complete()},TapSubscriber}(Subscriber_1.Subscriber)},{"../Subscriber":101,"../util/isFunction":267,"../util/noop":275}],222:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.defaultThrottleConfig={leading:!0,trailing:!1},exports.throttle=function(durationSelector,config){return void 0===config&&(config=exports.defaultThrottleConfig),function(source){return source.lift(new ThrottleOperator(durationSelector,config.leading,config.trailing))}};var ThrottleOperator=function(){function ThrottleOperator(durationSelector,leading,trailing){this.durationSelector=durationSelector,this.leading=leading,this.trailing=trailing}return ThrottleOperator.prototype.call=function(subscriber,source){return source.subscribe(new ThrottleSubscriber(subscriber,this.durationSelector,this.leading,this.trailing))},ThrottleOperator}(),ThrottleSubscriber=function(_super){function ThrottleSubscriber(destination,durationSelector,_leading,_trailing){var _this=_super.call(this,destination)||this;return _this.destination=destination,_this.durationSelector=durationSelector,_this._leading=_leading,_this._trailing=_trailing,_this._hasValue=!1,_this}return __extends(ThrottleSubscriber,_super),ThrottleSubscriber.prototype._next=function(value){this._hasValue=!0,this._sendValue=value,this._throttled||(this._leading?this.send():this.throttle(value))},ThrottleSubscriber.prototype.send=function(){var _hasValue=this._hasValue,_sendValue=this._sendValue;_hasValue&&(this.destination.next(_sendValue),this.throttle(_sendValue)),this._hasValue=!1,this._sendValue=null},ThrottleSubscriber.prototype.throttle=function(value){var duration=this.tryDurationSelector(value);duration&&this.add(this._throttled=subscribeToResult_1.subscribeToResult(this,duration))},ThrottleSubscriber.prototype.tryDurationSelector=function(value){try{return this.durationSelector(value)}catch(err){return this.destination.error(err),null}},ThrottleSubscriber.prototype.throttlingDone=function(){var _throttled=this._throttled,_trailing=this._trailing;_throttled&&_throttled.unsubscribe(),this._throttled=null,_trailing&&this.send()},ThrottleSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.throttlingDone()},ThrottleSubscriber.prototype.notifyComplete=function(){this.throttlingDone()},ThrottleSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],223:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),async_1=require("../scheduler/async"),throttle_1=require("./throttle");exports.throttleTime=function(duration,scheduler,config){return void 0===scheduler&&(scheduler=async_1.async),void 0===config&&(config=throttle_1.defaultThrottleConfig),function(source){return source.lift(new ThrottleTimeOperator(duration,scheduler,config.leading,config.trailing))}};var ThrottleTimeOperator=function(){function ThrottleTimeOperator(duration,scheduler,leading,trailing){this.duration=duration,this.scheduler=scheduler,this.leading=leading,this.trailing=trailing}return ThrottleTimeOperator.prototype.call=function(subscriber,source){return source.subscribe(new ThrottleTimeSubscriber(subscriber,this.duration,this.scheduler,this.leading,this.trailing))},ThrottleTimeOperator}(),ThrottleTimeSubscriber=function(_super){function ThrottleTimeSubscriber(destination,duration,scheduler,leading,trailing){var _this=_super.call(this,destination)||this;return _this.duration=duration,_this.scheduler=scheduler,_this.leading=leading,_this.trailing=trailing,_this._hasTrailingValue=!1,_this._trailingValue=null,_this}return __extends(ThrottleTimeSubscriber,_super),ThrottleTimeSubscriber.prototype._next=function(value){this.throttled?this.trailing&&(this._trailingValue=value,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(dispatchNext,this.duration,{subscriber:this})),this.leading&&this.destination.next(value))},ThrottleTimeSubscriber.prototype._complete=function(){this._hasTrailingValue&&this.destination.next(this._trailingValue),this.destination.complete()},ThrottleTimeSubscriber.prototype.clearThrottle=function(){var throttled=this.throttled;throttled&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),throttled.unsubscribe(),this.remove(throttled),this.throttled=null)},ThrottleTimeSubscriber}(Subscriber_1.Subscriber);function dispatchNext(arg){arg.subscriber.clearThrottle()}},{"../Subscriber":101,"../scheduler/async":250,"./throttle":222}],224:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tap_1=require("./tap"),EmptyError_1=require("../util/EmptyError");function defaultErrorFactory(){return new EmptyError_1.EmptyError}exports.throwIfEmpty=function(errorFactory){return void 0===errorFactory&&(errorFactory=defaultErrorFactory),tap_1.tap({hasValue:!1,next:function(){this.hasValue=!0},complete:function(){if(!this.hasValue)throw errorFactory()}})}},{"../util/EmptyError":256,"./tap":221}],225:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var async_1=require("../scheduler/async"),scan_1=require("./scan"),defer_1=require("../observable/defer"),map_1=require("./map");exports.timeInterval=function(scheduler){return void 0===scheduler&&(scheduler=async_1.async),function(source){return defer_1.defer(function(){return source.pipe(scan_1.scan(function(_a,value){var current=_a.current;return{value:value,current:scheduler.now(),last:current}},{current:scheduler.now(),value:void 0,last:void 0}),map_1.map(function(_a){var current=_a.current,last=_a.last,value=_a.value;return new TimeInterval(value,current-last)}))})}};var TimeInterval=function(value,interval){this.value=value,this.interval=interval};exports.TimeInterval=TimeInterval},{"../observable/defer":110,"../scheduler/async":250,"./map":174,"./scan":203}],226:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var async_1=require("../scheduler/async"),TimeoutError_1=require("../util/TimeoutError"),timeoutWith_1=require("./timeoutWith"),throwError_1=require("../observable/throwError");exports.timeout=function(due,scheduler){return void 0===scheduler&&(scheduler=async_1.async),timeoutWith_1.timeoutWith(due,throwError_1.throwError(new TimeoutError_1.TimeoutError),scheduler)}},{"../observable/throwError":131,"../scheduler/async":250,"../util/TimeoutError":259,"./timeoutWith":227}],227:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var async_1=require("../scheduler/async"),isDate_1=require("../util/isDate"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.timeoutWith=function(due,withObservable,scheduler){return void 0===scheduler&&(scheduler=async_1.async),function(source){var absoluteTimeout=isDate_1.isDate(due),waitFor=absoluteTimeout?+due-scheduler.now():Math.abs(due);return source.lift(new TimeoutWithOperator(waitFor,absoluteTimeout,withObservable,scheduler))}};var TimeoutWithOperator=function(){function TimeoutWithOperator(waitFor,absoluteTimeout,withObservable,scheduler){this.waitFor=waitFor,this.absoluteTimeout=absoluteTimeout,this.withObservable=withObservable,this.scheduler=scheduler}return TimeoutWithOperator.prototype.call=function(subscriber,source){return source.subscribe(new TimeoutWithSubscriber(subscriber,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},TimeoutWithOperator}(),TimeoutWithSubscriber=function(_super){function TimeoutWithSubscriber(destination,absoluteTimeout,waitFor,withObservable,scheduler){var _this=_super.call(this,destination)||this;return _this.absoluteTimeout=absoluteTimeout,_this.waitFor=waitFor,_this.withObservable=withObservable,_this.scheduler=scheduler,_this.action=null,_this.scheduleTimeout(),_this}return __extends(TimeoutWithSubscriber,_super),TimeoutWithSubscriber.dispatchTimeout=function(subscriber){var withObservable=subscriber.withObservable;subscriber._unsubscribeAndRecycle(),subscriber.add(subscribeToResult_1.subscribeToResult(subscriber,withObservable))},TimeoutWithSubscriber.prototype.scheduleTimeout=function(){var action=this.action;action?this.action=action.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(TimeoutWithSubscriber.dispatchTimeout,this.waitFor,this))},TimeoutWithSubscriber.prototype._next=function(value){this.absoluteTimeout||this.scheduleTimeout(),_super.prototype._next.call(this,value)},TimeoutWithSubscriber.prototype._unsubscribe=function(){this.action=null,this.scheduler=null,this.withObservable=null},TimeoutWithSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../scheduler/async":250,"../util/isDate":266,"../util/subscribeToResult":283}],228:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var async_1=require("../scheduler/async"),map_1=require("./map");exports.timestamp=function(scheduler){return void 0===scheduler&&(scheduler=async_1.async),map_1.map(function(value){return new Timestamp(value,scheduler.now())})};var Timestamp=function(value,timestamp){this.value=value,this.timestamp=timestamp};exports.Timestamp=Timestamp},{"../scheduler/async":250,"./map":174}],229:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var reduce_1=require("./reduce");function toArrayReducer(arr,item,index){return 0===index?[item]:(arr.push(item),arr)}exports.toArray=function(){return reduce_1.reduce(toArrayReducer,[])}},{"./reduce":195}],230:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("../Subject"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.window=function(windowBoundaries){return function(source){return source.lift(new WindowOperator(windowBoundaries))}};var WindowOperator=function(){function WindowOperator(windowBoundaries){this.windowBoundaries=windowBoundaries}return WindowOperator.prototype.call=function(subscriber,source){var windowSubscriber=new WindowSubscriber(subscriber),sourceSubscription=source.subscribe(windowSubscriber);return sourceSubscription.closed||windowSubscriber.add(subscribeToResult_1.subscribeToResult(windowSubscriber,this.windowBoundaries)),sourceSubscription},WindowOperator}(),WindowSubscriber=function(_super){function WindowSubscriber(destination){var _this=_super.call(this,destination)||this;return _this.window=new Subject_1.Subject,destination.next(_this.window),_this}return __extends(WindowSubscriber,_super),WindowSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.openWindow()},WindowSubscriber.prototype.notifyError=function(error,innerSub){this._error(error)},WindowSubscriber.prototype.notifyComplete=function(innerSub){this._complete()},WindowSubscriber.prototype._next=function(value){this.window.next(value)},WindowSubscriber.prototype._error=function(err){this.window.error(err),this.destination.error(err)},WindowSubscriber.prototype._complete=function(){this.window.complete(),this.destination.complete()},WindowSubscriber.prototype._unsubscribe=function(){this.window=null},WindowSubscriber.prototype.openWindow=function(){var prevWindow=this.window;prevWindow&&prevWindow.complete();var destination=this.destination,newWindow=this.window=new Subject_1.Subject;destination.next(newWindow)},WindowSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../Subject":99,"../util/subscribeToResult":283}],231:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),Subject_1=require("../Subject");exports.windowCount=function(windowSize,startWindowEvery){return void 0===startWindowEvery&&(startWindowEvery=0),function(source){return source.lift(new WindowCountOperator(windowSize,startWindowEvery))}};var WindowCountOperator=function(){function WindowCountOperator(windowSize,startWindowEvery){this.windowSize=windowSize,this.startWindowEvery=startWindowEvery}return WindowCountOperator.prototype.call=function(subscriber,source){return source.subscribe(new WindowCountSubscriber(subscriber,this.windowSize,this.startWindowEvery))},WindowCountOperator}(),WindowCountSubscriber=function(_super){function WindowCountSubscriber(destination,windowSize,startWindowEvery){var _this=_super.call(this,destination)||this;return _this.destination=destination,_this.windowSize=windowSize,_this.startWindowEvery=startWindowEvery,_this.windows=[new Subject_1.Subject],_this.count=0,destination.next(_this.windows[0]),_this}return __extends(WindowCountSubscriber,_super),WindowCountSubscriber.prototype._next=function(value){for(var startWindowEvery=0<this.startWindowEvery?this.startWindowEvery:this.windowSize,destination=this.destination,windowSize=this.windowSize,windows=this.windows,len=windows.length,i=0;i<len&&!this.closed;i++)windows[i].next(value);var c=this.count-windowSize+1;if(0<=c&&c%startWindowEvery==0&&!this.closed&&windows.shift().complete(),++this.count%startWindowEvery==0&&!this.closed){var window_1=new Subject_1.Subject;windows.push(window_1),destination.next(window_1)}},WindowCountSubscriber.prototype._error=function(err){var windows=this.windows;if(windows)for(;0<windows.length&&!this.closed;)windows.shift().error(err);this.destination.error(err)},WindowCountSubscriber.prototype._complete=function(){var windows=this.windows;if(windows)for(;0<windows.length&&!this.closed;)windows.shift().complete();this.destination.complete()},WindowCountSubscriber.prototype._unsubscribe=function(){this.count=0,this.windows=null},WindowCountSubscriber}(Subscriber_1.Subscriber)},{"../Subject":99,"../Subscriber":101}],232:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("../Subject"),async_1=require("../scheduler/async"),Subscriber_1=require("../Subscriber"),isNumeric_1=require("../util/isNumeric"),isScheduler_1=require("../util/isScheduler");exports.windowTime=function(windowTimeSpan){var scheduler=async_1.async,windowCreationInterval=null,maxWindowSize=Number.POSITIVE_INFINITY;return isScheduler_1.isScheduler(arguments[3])&&(scheduler=arguments[3]),isScheduler_1.isScheduler(arguments[2])?scheduler=arguments[2]:isNumeric_1.isNumeric(arguments[2])&&(maxWindowSize=arguments[2]),isScheduler_1.isScheduler(arguments[1])?scheduler=arguments[1]:isNumeric_1.isNumeric(arguments[1])&&(windowCreationInterval=arguments[1]),function(source){return source.lift(new WindowTimeOperator(windowTimeSpan,windowCreationInterval,maxWindowSize,scheduler))}};var WindowTimeOperator=function(){function WindowTimeOperator(windowTimeSpan,windowCreationInterval,maxWindowSize,scheduler){this.windowTimeSpan=windowTimeSpan,this.windowCreationInterval=windowCreationInterval,this.maxWindowSize=maxWindowSize,this.scheduler=scheduler}return WindowTimeOperator.prototype.call=function(subscriber,source){return source.subscribe(new WindowTimeSubscriber(subscriber,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},WindowTimeOperator}(),CountedSubject=function(_super){function CountedSubject(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this._numberOfNextedValues=0,_this}return __extends(CountedSubject,_super),CountedSubject.prototype.next=function(value){this._numberOfNextedValues++,_super.prototype.next.call(this,value)},Object.defineProperty(CountedSubject.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),CountedSubject}(Subject_1.Subject),WindowTimeSubscriber=function(_super){function WindowTimeSubscriber(destination,windowTimeSpan,windowCreationInterval,maxWindowSize,scheduler){var _this=_super.call(this,destination)||this;_this.destination=destination,_this.windowTimeSpan=windowTimeSpan,_this.windowCreationInterval=windowCreationInterval,_this.maxWindowSize=maxWindowSize,_this.scheduler=scheduler,_this.windows=[];var window=_this.openWindow();if(null!==windowCreationInterval&&0<=windowCreationInterval){var closeState={subscriber:_this,window:window,context:null},creationState={windowTimeSpan:windowTimeSpan,windowCreationInterval:windowCreationInterval,subscriber:_this,scheduler:scheduler};_this.add(scheduler.schedule(dispatchWindowClose,windowTimeSpan,closeState)),_this.add(scheduler.schedule(dispatchWindowCreation,windowCreationInterval,creationState))}else{var timeSpanOnlyState={subscriber:_this,window:window,windowTimeSpan:windowTimeSpan};_this.add(scheduler.schedule(dispatchWindowTimeSpanOnly,windowTimeSpan,timeSpanOnlyState))}return _this}return __extends(WindowTimeSubscriber,_super),WindowTimeSubscriber.prototype._next=function(value){for(var windows=this.windows,len=windows.length,i=0;i<len;i++){var window_1=windows[i];window_1.closed||(window_1.next(value),window_1.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(window_1))}},WindowTimeSubscriber.prototype._error=function(err){for(var windows=this.windows;0<windows.length;)windows.shift().error(err);this.destination.error(err)},WindowTimeSubscriber.prototype._complete=function(){for(var windows=this.windows;0<windows.length;){var window_2=windows.shift();window_2.closed||window_2.complete()}this.destination.complete()},WindowTimeSubscriber.prototype.openWindow=function(){var window=new CountedSubject;return this.windows.push(window),this.destination.next(window),window},WindowTimeSubscriber.prototype.closeWindow=function(window){window.complete();var windows=this.windows;windows.splice(windows.indexOf(window),1)},WindowTimeSubscriber}(Subscriber_1.Subscriber);function dispatchWindowTimeSpanOnly(state){var subscriber=state.subscriber,windowTimeSpan=state.windowTimeSpan,window=state.window;window&&subscriber.closeWindow(window),state.window=subscriber.openWindow(),this.schedule(state,windowTimeSpan)}function dispatchWindowCreation(state){var windowTimeSpan=state.windowTimeSpan,subscriber=state.subscriber,scheduler=state.scheduler,windowCreationInterval=state.windowCreationInterval,window=subscriber.openWindow(),context={action:this,subscription:null},timeSpanState={subscriber:subscriber,window:window,context:context};context.subscription=scheduler.schedule(dispatchWindowClose,windowTimeSpan,timeSpanState),this.add(context.subscription),this.schedule(state,windowCreationInterval)}function dispatchWindowClose(state){var subscriber=state.subscriber,window=state.window,context=state.context;context&&context.action&&context.subscription&&context.action.remove(context.subscription),subscriber.closeWindow(window)}},{"../Subject":99,"../Subscriber":101,"../scheduler/async":250,"../util/isNumeric":270,"../util/isScheduler":274}],233:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("../Subject"),Subscription_1=require("../Subscription"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.windowToggle=function(openings,closingSelector){return function(source){return source.lift(new WindowToggleOperator(openings,closingSelector))}};var WindowToggleOperator=function(){function WindowToggleOperator(openings,closingSelector){this.openings=openings,this.closingSelector=closingSelector}return WindowToggleOperator.prototype.call=function(subscriber,source){return source.subscribe(new WindowToggleSubscriber(subscriber,this.openings,this.closingSelector))},WindowToggleOperator}(),WindowToggleSubscriber=function(_super){function WindowToggleSubscriber(destination,openings,closingSelector){var _this=_super.call(this,destination)||this;return _this.openings=openings,_this.closingSelector=closingSelector,_this.contexts=[],_this.add(_this.openSubscription=subscribeToResult_1.subscribeToResult(_this,openings,openings)),_this}return __extends(WindowToggleSubscriber,_super),WindowToggleSubscriber.prototype._next=function(value){var contexts=this.contexts;if(contexts)for(var len=contexts.length,i=0;i<len;i++)contexts[i].window.next(value)},WindowToggleSubscriber.prototype._error=function(err){var contexts=this.contexts;if(this.contexts=null,contexts)for(var len=contexts.length,index=-1;++index<len;){var context_1=contexts[index];context_1.window.error(err),context_1.subscription.unsubscribe()}_super.prototype._error.call(this,err)},WindowToggleSubscriber.prototype._complete=function(){var contexts=this.contexts;if(this.contexts=null,contexts)for(var len=contexts.length,index=-1;++index<len;){var context_2=contexts[index];context_2.window.complete(),context_2.subscription.unsubscribe()}_super.prototype._complete.call(this)},WindowToggleSubscriber.prototype._unsubscribe=function(){var contexts=this.contexts;if(this.contexts=null,contexts)for(var len=contexts.length,index=-1;++index<len;){var context_3=contexts[index];context_3.window.unsubscribe(),context_3.subscription.unsubscribe()}},WindowToggleSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){if(outerValue===this.openings){var closingNotifier=void 0;try{closingNotifier=(0,this.closingSelector)(innerValue)}catch(e){return this.error(e)}var window_1=new Subject_1.Subject,subscription=new Subscription_1.Subscription,context_4={window:window_1,subscription:subscription};this.contexts.push(context_4);var innerSubscription=subscribeToResult_1.subscribeToResult(this,closingNotifier,context_4);innerSubscription.closed?this.closeWindow(this.contexts.length-1):(innerSubscription.context=context_4,subscription.add(innerSubscription)),this.destination.next(window_1)}else this.closeWindow(this.contexts.indexOf(outerValue))},WindowToggleSubscriber.prototype.notifyError=function(err){this.error(err)},WindowToggleSubscriber.prototype.notifyComplete=function(inner){inner!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(inner.context))},WindowToggleSubscriber.prototype.closeWindow=function(index){if(-1!==index){var contexts=this.contexts,context=contexts[index],window=context.window,subscription=context.subscription;contexts.splice(index,1),window.complete(),subscription.unsubscribe()}},WindowToggleSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../Subject":99,"../Subscription":102,"../util/subscribeToResult":283}],234:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Subject_1=require("../Subject"),OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.windowWhen=function(closingSelector){return function(source){return source.lift(new WindowOperator(closingSelector))}};var WindowOperator=function(){function WindowOperator(closingSelector){this.closingSelector=closingSelector}return WindowOperator.prototype.call=function(subscriber,source){return source.subscribe(new WindowSubscriber(subscriber,this.closingSelector))},WindowOperator}(),WindowSubscriber=function(_super){function WindowSubscriber(destination,closingSelector){var _this=_super.call(this,destination)||this;return _this.destination=destination,_this.closingSelector=closingSelector,_this.openWindow(),_this}return __extends(WindowSubscriber,_super),WindowSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.openWindow(innerSub)},WindowSubscriber.prototype.notifyError=function(error,innerSub){this._error(error)},WindowSubscriber.prototype.notifyComplete=function(innerSub){this.openWindow(innerSub)},WindowSubscriber.prototype._next=function(value){this.window.next(value)},WindowSubscriber.prototype._error=function(err){this.window.error(err),this.destination.error(err),this.unsubscribeClosingNotification()},WindowSubscriber.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},WindowSubscriber.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},WindowSubscriber.prototype.openWindow=function(innerSub){void 0===innerSub&&(innerSub=null),innerSub&&(this.remove(innerSub),innerSub.unsubscribe());var prevWindow=this.window;prevWindow&&prevWindow.complete();var closingNotifier,window=this.window=new Subject_1.Subject;this.destination.next(window);try{closingNotifier=(0,this.closingSelector)()}catch(e){return this.destination.error(e),void this.window.error(e)}this.add(this.closingNotification=subscribeToResult_1.subscribeToResult(this,closingNotifier))},WindowSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../Subject":99,"../util/subscribeToResult":283}],235:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var OuterSubscriber_1=require("../OuterSubscriber"),subscribeToResult_1=require("../util/subscribeToResult");exports.withLatestFrom=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return function(source){var project;"function"==typeof args[args.length-1]&&(project=args.pop());var observables=args;return source.lift(new WithLatestFromOperator(observables,project))}};var WithLatestFromOperator=function(){function WithLatestFromOperator(observables,project){this.observables=observables,this.project=project}return WithLatestFromOperator.prototype.call=function(subscriber,source){return source.subscribe(new WithLatestFromSubscriber(subscriber,this.observables,this.project))},WithLatestFromOperator}(),WithLatestFromSubscriber=function(_super){function WithLatestFromSubscriber(destination,observables,project){var _this=_super.call(this,destination)||this;_this.observables=observables,_this.project=project,_this.toRespond=[];var len=observables.length;_this.values=new Array(len);for(var i=0;i<len;i++)_this.toRespond.push(i);for(i=0;i<len;i++){var observable=observables[i];_this.add(subscribeToResult_1.subscribeToResult(_this,observable,observable,i))}return _this}return __extends(WithLatestFromSubscriber,_super),WithLatestFromSubscriber.prototype.notifyNext=function(outerValue,innerValue,outerIndex,innerIndex,innerSub){this.values[outerIndex]=innerValue;var toRespond=this.toRespond;if(0<toRespond.length){var found=toRespond.indexOf(outerIndex);-1!==found&&toRespond.splice(found,1)}},WithLatestFromSubscriber.prototype.notifyComplete=function(){},WithLatestFromSubscriber.prototype._next=function(value){if(0===this.toRespond.length){var args=[value].concat(this.values);this.project?this._tryProject(args):this.destination.next(args)}},WithLatestFromSubscriber.prototype._tryProject=function(args){var result;try{result=this.project.apply(this,args)}catch(err){return void this.destination.error(err)}this.destination.next(result)},WithLatestFromSubscriber}(OuterSubscriber_1.OuterSubscriber)},{"../OuterSubscriber":96,"../util/subscribeToResult":283}],236:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var zip_1=require("../observable/zip");exports.zip=function(){for(var observables=[],_i=0;_i<arguments.length;_i++)observables[_i]=arguments[_i];return function(source){return source.lift.call(zip_1.zip.apply(void 0,[source].concat(observables)))}}},{"../observable/zip":134}],237:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var zip_1=require("../observable/zip");exports.zipAll=function(project){return function(source){return source.lift(new zip_1.ZipOperator(project))}}},{"../observable/zip":134}],238:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Action=function(_super){function Action(scheduler,work){return _super.call(this)||this}return __extends(Action,_super),Action.prototype.schedule=function(state,delay){return void 0===delay&&(delay=0),this},Action}(require("../Subscription").Subscription);exports.Action=Action},{"../Subscription":102}],239:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var AnimationFrameAction=function(_super){function AnimationFrameAction(scheduler,work){var _this=_super.call(this,scheduler,work)||this;return _this.scheduler=scheduler,_this.work=work,_this}return __extends(AnimationFrameAction,_super),AnimationFrameAction.prototype.requestAsyncId=function(scheduler,id,delay){return void 0===delay&&(delay=0),null!==delay&&0<delay?_super.prototype.requestAsyncId.call(this,scheduler,id,delay):(scheduler.actions.push(this),scheduler.scheduled||(scheduler.scheduled=requestAnimationFrame(function(){return scheduler.flush(null)})))},AnimationFrameAction.prototype.recycleAsyncId=function(scheduler,id,delay){if(void 0===delay&&(delay=0),null!==delay&&0<delay||null===delay&&0<this.delay)return _super.prototype.recycleAsyncId.call(this,scheduler,id,delay);0===scheduler.actions.length&&(cancelAnimationFrame(id),scheduler.scheduled=void 0)},AnimationFrameAction}(require("./AsyncAction").AsyncAction);exports.AnimationFrameAction=AnimationFrameAction},{"./AsyncAction":243}],240:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var AnimationFrameScheduler=function(_super){function AnimationFrameScheduler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(AnimationFrameScheduler,_super),AnimationFrameScheduler.prototype.flush=function(action){this.active=!0,this.scheduled=void 0;var error,actions=this.actions,index=-1,count=actions.length;action=action||actions.shift();do{if(error=action.execute(action.state,action.delay))break}while(++index<count&&(action=actions.shift()));if(this.active=!1,error){for(;++index<count&&(action=actions.shift());)action.unsubscribe();throw error}},AnimationFrameScheduler}(require("./AsyncScheduler").AsyncScheduler);exports.AnimationFrameScheduler=AnimationFrameScheduler},{"./AsyncScheduler":244}],241:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Immediate_1=require("../util/Immediate"),AsapAction=function(_super){function AsapAction(scheduler,work){var _this=_super.call(this,scheduler,work)||this;return _this.scheduler=scheduler,_this.work=work,_this}return __extends(AsapAction,_super),AsapAction.prototype.requestAsyncId=function(scheduler,id,delay){return void 0===delay&&(delay=0),null!==delay&&0<delay?_super.prototype.requestAsyncId.call(this,scheduler,id,delay):(scheduler.actions.push(this),scheduler.scheduled||(scheduler.scheduled=Immediate_1.Immediate.setImmediate(scheduler.flush.bind(scheduler,null))))},AsapAction.prototype.recycleAsyncId=function(scheduler,id,delay){if(void 0===delay&&(delay=0),null!==delay&&0<delay||null===delay&&0<this.delay)return _super.prototype.recycleAsyncId.call(this,scheduler,id,delay);0===scheduler.actions.length&&(Immediate_1.Immediate.clearImmediate(id),scheduler.scheduled=void 0)},AsapAction}(require("./AsyncAction").AsyncAction);exports.AsapAction=AsapAction},{"../util/Immediate":257,"./AsyncAction":243}],242:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var AsapScheduler=function(_super){function AsapScheduler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(AsapScheduler,_super),AsapScheduler.prototype.flush=function(action){this.active=!0,this.scheduled=void 0;var error,actions=this.actions,index=-1,count=actions.length;action=action||actions.shift();do{if(error=action.execute(action.state,action.delay))break}while(++index<count&&(action=actions.shift()));if(this.active=!1,error){for(;++index<count&&(action=actions.shift());)action.unsubscribe();throw error}},AsapScheduler}(require("./AsyncScheduler").AsyncScheduler);exports.AsapScheduler=AsapScheduler},{"./AsyncScheduler":244}],243:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var AsyncAction=function(_super){function AsyncAction(scheduler,work){var _this=_super.call(this,scheduler,work)||this;return _this.scheduler=scheduler,_this.work=work,_this.pending=!1,_this}return __extends(AsyncAction,_super),AsyncAction.prototype.schedule=function(state,delay){if(void 0===delay&&(delay=0),this.closed)return this;this.state=state;var id=this.id,scheduler=this.scheduler;return null!=id&&(this.id=this.recycleAsyncId(scheduler,id,delay)),this.pending=!0,this.delay=delay,this.id=this.id||this.requestAsyncId(scheduler,this.id,delay),this},AsyncAction.prototype.requestAsyncId=function(scheduler,id,delay){return void 0===delay&&(delay=0),setInterval(scheduler.flush.bind(scheduler,this),delay)},AsyncAction.prototype.recycleAsyncId=function(scheduler,id,delay){if(void 0===delay&&(delay=0),null!==delay&&this.delay===delay&&!1===this.pending)return id;clearInterval(id)},AsyncAction.prototype.execute=function(state,delay){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var error=this._execute(state,delay);if(error)return error;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},AsyncAction.prototype._execute=function(state,delay){var errored=!1,errorValue=void 0;try{this.work(state)}catch(e){errored=!0,errorValue=!!e&&e||new Error(e)}if(errored)return this.unsubscribe(),errorValue},AsyncAction.prototype._unsubscribe=function(){var id=this.id,scheduler=this.scheduler,actions=scheduler.actions,index=actions.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==index&&actions.splice(index,1),null!=id&&(this.id=this.recycleAsyncId(scheduler,id,null)),this.delay=null},AsyncAction}(require("./Action").Action);exports.AsyncAction=AsyncAction},{"./Action":238}],244:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Scheduler_1=require("../Scheduler"),AsyncScheduler=function(_super){function AsyncScheduler(SchedulerAction,now){void 0===now&&(now=Scheduler_1.Scheduler.now);var _this=_super.call(this,SchedulerAction,function(){return AsyncScheduler.delegate&&AsyncScheduler.delegate!==_this?AsyncScheduler.delegate.now():now()})||this;return _this.actions=[],_this.active=!1,_this.scheduled=void 0,_this}return __extends(AsyncScheduler,_super),AsyncScheduler.prototype.schedule=function(work,delay,state){return void 0===delay&&(delay=0),AsyncScheduler.delegate&&AsyncScheduler.delegate!==this?AsyncScheduler.delegate.schedule(work,delay,state):_super.prototype.schedule.call(this,work,delay,state)},AsyncScheduler.prototype.flush=function(action){var actions=this.actions;if(this.active)actions.push(action);else{var error;this.active=!0;do{if(error=action.execute(action.state,action.delay))break}while(action=actions.shift());if(this.active=!1,error){for(;action=actions.shift();)action.unsubscribe();throw error}}},AsyncScheduler}(Scheduler_1.Scheduler);exports.AsyncScheduler=AsyncScheduler},{"../Scheduler":98}],245:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var QueueAction=function(_super){function QueueAction(scheduler,work){var _this=_super.call(this,scheduler,work)||this;return _this.scheduler=scheduler,_this.work=work,_this}return __extends(QueueAction,_super),QueueAction.prototype.schedule=function(state,delay){return void 0===delay&&(delay=0),0<delay?_super.prototype.schedule.call(this,state,delay):(this.delay=delay,this.state=state,this.scheduler.flush(this),this)},QueueAction.prototype.execute=function(state,delay){return 0<delay||this.closed?_super.prototype.execute.call(this,state,delay):this._execute(state,delay)},QueueAction.prototype.requestAsyncId=function(scheduler,id,delay){return void 0===delay&&(delay=0),null!==delay&&0<delay||null===delay&&0<this.delay?_super.prototype.requestAsyncId.call(this,scheduler,id,delay):scheduler.flush(this)},QueueAction}(require("./AsyncAction").AsyncAction);exports.QueueAction=QueueAction},{"./AsyncAction":243}],246:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var QueueScheduler=function(_super){function QueueScheduler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(QueueScheduler,_super),QueueScheduler}(require("./AsyncScheduler").AsyncScheduler);exports.QueueScheduler=QueueScheduler},{"./AsyncScheduler":244}],247:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var AsyncAction_1=require("./AsyncAction"),VirtualTimeScheduler=function(_super){function VirtualTimeScheduler(SchedulerAction,maxFrames){void 0===SchedulerAction&&(SchedulerAction=VirtualAction),void 0===maxFrames&&(maxFrames=Number.POSITIVE_INFINITY);var _this=_super.call(this,SchedulerAction,function(){return _this.frame})||this;return _this.maxFrames=maxFrames,_this.frame=0,_this.index=-1,_this}return __extends(VirtualTimeScheduler,_super),VirtualTimeScheduler.prototype.flush=function(){for(var error,action,actions=this.actions,maxFrames=this.maxFrames;(action=actions[0])&&action.delay<=maxFrames&&(actions.shift(),this.frame=action.delay,!(error=action.execute(action.state,action.delay))););if(error){for(;action=actions.shift();)action.unsubscribe();throw error}},VirtualTimeScheduler.frameTimeFactor=10,VirtualTimeScheduler}(require("./AsyncScheduler").AsyncScheduler);exports.VirtualTimeScheduler=VirtualTimeScheduler;var VirtualAction=function(_super){function VirtualAction(scheduler,work,index){void 0===index&&(index=scheduler.index+=1);var _this=_super.call(this,scheduler,work)||this;return _this.scheduler=scheduler,_this.work=work,_this.index=index,_this.active=!0,_this.index=scheduler.index=index,_this}return __extends(VirtualAction,_super),VirtualAction.prototype.schedule=function(state,delay){if(void 0===delay&&(delay=0),!this.id)return _super.prototype.schedule.call(this,state,delay);this.active=!1;var action=new VirtualAction(this.scheduler,this.work);return this.add(action),action.schedule(state,delay)},VirtualAction.prototype.requestAsyncId=function(scheduler,id,delay){void 0===delay&&(delay=0),this.delay=scheduler.frame+delay;var actions=scheduler.actions;return actions.push(this),actions.sort(VirtualAction.sortActions),!0},VirtualAction.prototype.recycleAsyncId=function(scheduler,id,delay){void 0===delay&&(delay=0)},VirtualAction.prototype._execute=function(state,delay){if(!0===this.active)return _super.prototype._execute.call(this,state,delay)},VirtualAction.sortActions=function(a,b){return a.delay===b.delay?a.index===b.index?0:a.index>b.index?1:-1:a.delay>b.delay?1:-1},VirtualAction}(AsyncAction_1.AsyncAction);exports.VirtualAction=VirtualAction},{"./AsyncAction":243,"./AsyncScheduler":244}],248:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var AnimationFrameAction_1=require("./AnimationFrameAction"),AnimationFrameScheduler_1=require("./AnimationFrameScheduler");exports.animationFrame=new AnimationFrameScheduler_1.AnimationFrameScheduler(AnimationFrameAction_1.AnimationFrameAction)},{"./AnimationFrameAction":239,"./AnimationFrameScheduler":240}],249:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var AsapAction_1=require("./AsapAction"),AsapScheduler_1=require("./AsapScheduler");exports.asap=new AsapScheduler_1.AsapScheduler(AsapAction_1.AsapAction)},{"./AsapAction":241,"./AsapScheduler":242}],250:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var AsyncAction_1=require("./AsyncAction"),AsyncScheduler_1=require("./AsyncScheduler");exports.async=new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction)},{"./AsyncAction":243,"./AsyncScheduler":244}],251:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var QueueAction_1=require("./QueueAction"),QueueScheduler_1=require("./QueueScheduler");exports.queue=new QueueScheduler_1.QueueScheduler(QueueAction_1.QueueAction)},{"./QueueAction":245,"./QueueScheduler":246}],252:[function(require,module,exports){"use strict";function getSymbolIterator(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSymbolIterator=getSymbolIterator,exports.iterator=getSymbolIterator(),exports.$$iterator=exports.iterator},{}],253:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},{}],254:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.rxSubscriber="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),exports.$$rxSubscriber=exports.rxSubscriber},{}],255:[function(require,module,exports){"use strict";function ArgumentOutOfRangeErrorImpl(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}Object.defineProperty(exports,"__esModule",{value:!0}),ArgumentOutOfRangeErrorImpl.prototype=Object.create(Error.prototype),exports.ArgumentOutOfRangeError=ArgumentOutOfRangeErrorImpl},{}],256:[function(require,module,exports){"use strict";function EmptyErrorImpl(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}Object.defineProperty(exports,"__esModule",{value:!0}),EmptyErrorImpl.prototype=Object.create(Error.prototype),exports.EmptyError=EmptyErrorImpl},{}],257:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var nextHandle=1,tasksByHandle={};exports.Immediate={setImmediate:function(cb){var handle=nextHandle++;return tasksByHandle[handle]=cb,Promise.resolve().then(function(){return function(handle){var cb=tasksByHandle[handle];cb&&cb()}(handle)}),handle},clearImmediate:function(handle){delete tasksByHandle[handle]}}},{}],258:[function(require,module,exports){"use strict";function ObjectUnsubscribedErrorImpl(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}Object.defineProperty(exports,"__esModule",{value:!0}),ObjectUnsubscribedErrorImpl.prototype=Object.create(Error.prototype),exports.ObjectUnsubscribedError=ObjectUnsubscribedErrorImpl},{}],259:[function(require,module,exports){"use strict";function TimeoutErrorImpl(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}Object.defineProperty(exports,"__esModule",{value:!0}),TimeoutErrorImpl.prototype=Object.create(Error.prototype),exports.TimeoutError=TimeoutErrorImpl},{}],260:[function(require,module,exports){"use strict";function UnsubscriptionErrorImpl(errors){return Error.call(this),this.message=errors?errors.length+" errors occurred during unsubscription:\n"+errors.map(function(err,i){return i+1+") "+err.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=errors,this}Object.defineProperty(exports,"__esModule",{value:!0}),UnsubscriptionErrorImpl.prototype=Object.create(Error.prototype),exports.UnsubscriptionError=UnsubscriptionErrorImpl},{}],261:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");exports.canReportError=function(observer){for(;observer;){var _a=observer,closed_1=_a.closed,destination=_a.destination,isStopped=_a.isStopped;if(closed_1||isStopped)return!1;observer=destination&&destination instanceof Subscriber_1.Subscriber?destination:null}return!0}},{"../Subscriber":101}],262:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.hostReportError=function(err){setTimeout(function(){throw err})}},{}],263:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.identity=function(x){return x}},{}],264:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isArray=Array.isArray||function(x){return x&&"number"==typeof x.length}},{}],265:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isArrayLike=function(x){return x&&"number"==typeof x.length&&"function"!=typeof x}},{}],266:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isDate=function(value){return value instanceof Date&&!isNaN(+value)}},{}],267:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isFunction=function(x){return"function"==typeof x}},{}],268:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var observable_1=require("../symbol/observable");exports.isInteropObservable=function(input){return input&&"function"==typeof input[observable_1.observable]}},{"../symbol/observable":253}],269:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var iterator_1=require("../symbol/iterator");exports.isIterable=function(input){return input&&"function"==typeof input[iterator_1.iterator]}},{"../symbol/iterator":252}],270:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var isArray_1=require("./isArray");exports.isNumeric=function(val){return!isArray_1.isArray(val)&&0<=val-parseFloat(val)+1}},{"./isArray":264}],271:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isObject=function(x){return null!==x&&"object"==typeof x}},{}],272:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable");exports.isObservable=function(obj){return!!obj&&(obj instanceof Observable_1.Observable||"function"==typeof obj.lift&&"function"==typeof obj.subscribe)}},{"../Observable":94}],273:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isPromise=function(value){return!!value&&"function"!=typeof value.subscribe&&"function"==typeof value.then}},{}],274:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isScheduler=function(value){return value&&"function"==typeof value.schedule}},{}],275:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.noop=function(){}},{}],276:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.not=function(pred,thisArg){function notPred(){return!notPred.pred.apply(notPred.thisArg,arguments)}return notPred.pred=pred,notPred.thisArg=thisArg,notPred}},{}],277:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var noop_1=require("./noop");function pipeFromArray(fns){return fns?1===fns.length?fns[0]:function(input){return fns.reduce(function(prev,fn){return fn(prev)},input)}:noop_1.noop}exports.pipe=function(){for(var fns=[],_i=0;_i<arguments.length;_i++)fns[_i]=arguments[_i];return pipeFromArray(fns)},exports.pipeFromArray=pipeFromArray},{"./noop":275}],278:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable"),subscribeToArray_1=require("./subscribeToArray"),subscribeToPromise_1=require("./subscribeToPromise"),subscribeToIterable_1=require("./subscribeToIterable"),subscribeToObservable_1=require("./subscribeToObservable"),isArrayLike_1=require("./isArrayLike"),isPromise_1=require("./isPromise"),isObject_1=require("./isObject"),iterator_1=require("../symbol/iterator"),observable_1=require("../symbol/observable");exports.subscribeTo=function(result){if(result instanceof Observable_1.Observable)return function(subscriber){return result._isScalar?(subscriber.next(result.value),void subscriber.complete()):result.subscribe(subscriber)};if(result&&"function"==typeof result[observable_1.observable])return subscribeToObservable_1.subscribeToObservable(result);if(isArrayLike_1.isArrayLike(result))return subscribeToArray_1.subscribeToArray(result);if(isPromise_1.isPromise(result))return subscribeToPromise_1.subscribeToPromise(result);if(result&&"function"==typeof result[iterator_1.iterator])return subscribeToIterable_1.subscribeToIterable(result);var value=isObject_1.isObject(result)?"an invalid object":"'"+result+"'";throw new TypeError("You provided "+value+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},{"../Observable":94,"../symbol/iterator":252,"../symbol/observable":253,"./isArrayLike":265,"./isObject":271,"./isPromise":273,"./subscribeToArray":279,"./subscribeToIterable":280,"./subscribeToObservable":281,"./subscribeToPromise":282}],279:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.subscribeToArray=function(array){return function(subscriber){for(var i=0,len=array.length;i<len&&!subscriber.closed;i++)subscriber.next(array[i]);subscriber.closed||subscriber.complete()}}},{}],280:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var iterator_1=require("../symbol/iterator");exports.subscribeToIterable=function(iterable){return function(subscriber){for(var iterator=iterable[iterator_1.iterator]();;){var item=iterator.next();if(item.done){subscriber.complete();break}if(subscriber.next(item.value),subscriber.closed)break}return"function"==typeof iterator.return&&subscriber.add(function(){iterator.return&&iterator.return()}),subscriber}}},{"../symbol/iterator":252}],281:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var observable_1=require("../symbol/observable");exports.subscribeToObservable=function(obj){return function(subscriber){var obs=obj[observable_1.observable]();if("function"!=typeof obs.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return obs.subscribe(subscriber)}}},{"../symbol/observable":253}],282:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var hostReportError_1=require("./hostReportError");exports.subscribeToPromise=function(promise){return function(subscriber){return promise.then(function(value){subscriber.closed||(subscriber.next(value),subscriber.complete())},function(err){return subscriber.error(err)}).then(null,hostReportError_1.hostReportError),subscriber}}},{"./hostReportError":262}],283:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var InnerSubscriber_1=require("../InnerSubscriber"),subscribeTo_1=require("./subscribeTo");exports.subscribeToResult=function(outerSubscriber,result,outerValue,outerIndex,destination){if(void 0===destination&&(destination=new InnerSubscriber_1.InnerSubscriber(outerSubscriber,outerValue,outerIndex)),!destination.closed)return subscribeTo_1.subscribeTo(result)(destination)}},{"../InnerSubscriber":92,"./subscribeTo":278}],284:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),rxSubscriber_1=require("../symbol/rxSubscriber"),Observer_1=require("../Observer");exports.toSubscriber=function(nextOrObserver,error,complete){if(nextOrObserver){if(nextOrObserver instanceof Subscriber_1.Subscriber)return nextOrObserver;if(nextOrObserver[rxSubscriber_1.rxSubscriber])return nextOrObserver[rxSubscriber_1.rxSubscriber]()}return nextOrObserver||error||complete?new Subscriber_1.Subscriber(nextOrObserver,error,complete):new Subscriber_1.Subscriber(Observer_1.empty)}},{"../Observer":95,"../Subscriber":101,"../symbol/rxSubscriber":254}],285:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var audit_1=require("../internal/operators/audit");exports.audit=audit_1.audit;var auditTime_1=require("../internal/operators/auditTime");exports.auditTime=auditTime_1.auditTime;var buffer_1=require("../internal/operators/buffer");exports.buffer=buffer_1.buffer;var bufferCount_1=require("../internal/operators/bufferCount");exports.bufferCount=bufferCount_1.bufferCount;var bufferTime_1=require("../internal/operators/bufferTime");exports.bufferTime=bufferTime_1.bufferTime;var bufferToggle_1=require("../internal/operators/bufferToggle");exports.bufferToggle=bufferToggle_1.bufferToggle;var bufferWhen_1=require("../internal/operators/bufferWhen");exports.bufferWhen=bufferWhen_1.bufferWhen;var catchError_1=require("../internal/operators/catchError");exports.catchError=catchError_1.catchError;var combineAll_1=require("../internal/operators/combineAll");exports.combineAll=combineAll_1.combineAll;var combineLatest_1=require("../internal/operators/combineLatest");exports.combineLatest=combineLatest_1.combineLatest;var concat_1=require("../internal/operators/concat");exports.concat=concat_1.concat;var concatAll_1=require("../internal/operators/concatAll");exports.concatAll=concatAll_1.concatAll;var concatMap_1=require("../internal/operators/concatMap");exports.concatMap=concatMap_1.concatMap;var concatMapTo_1=require("../internal/operators/concatMapTo");exports.concatMapTo=concatMapTo_1.concatMapTo;var count_1=require("../internal/operators/count");exports.count=count_1.count;var debounce_1=require("../internal/operators/debounce");exports.debounce=debounce_1.debounce;var debounceTime_1=require("../internal/operators/debounceTime");exports.debounceTime=debounceTime_1.debounceTime;var defaultIfEmpty_1=require("../internal/operators/defaultIfEmpty");exports.defaultIfEmpty=defaultIfEmpty_1.defaultIfEmpty;var delay_1=require("../internal/operators/delay");exports.delay=delay_1.delay;var delayWhen_1=require("../internal/operators/delayWhen");exports.delayWhen=delayWhen_1.delayWhen;var dematerialize_1=require("../internal/operators/dematerialize");exports.dematerialize=dematerialize_1.dematerialize;var distinct_1=require("../internal/operators/distinct");exports.distinct=distinct_1.distinct;var distinctUntilChanged_1=require("../internal/operators/distinctUntilChanged");exports.distinctUntilChanged=distinctUntilChanged_1.distinctUntilChanged;var distinctUntilKeyChanged_1=require("../internal/operators/distinctUntilKeyChanged");exports.distinctUntilKeyChanged=distinctUntilKeyChanged_1.distinctUntilKeyChanged;var elementAt_1=require("../internal/operators/elementAt");exports.elementAt=elementAt_1.elementAt;var endWith_1=require("../internal/operators/endWith");exports.endWith=endWith_1.endWith;var every_1=require("../internal/operators/every");exports.every=every_1.every;var exhaust_1=require("../internal/operators/exhaust");exports.exhaust=exhaust_1.exhaust;var exhaustMap_1=require("../internal/operators/exhaustMap");exports.exhaustMap=exhaustMap_1.exhaustMap;var expand_1=require("../internal/operators/expand");exports.expand=expand_1.expand;var filter_1=require("../internal/operators/filter");exports.filter=filter_1.filter;var finalize_1=require("../internal/operators/finalize");exports.finalize=finalize_1.finalize;var find_1=require("../internal/operators/find");exports.find=find_1.find;var findIndex_1=require("../internal/operators/findIndex");exports.findIndex=findIndex_1.findIndex;var first_1=require("../internal/operators/first");exports.first=first_1.first;var groupBy_1=require("../internal/operators/groupBy");exports.groupBy=groupBy_1.groupBy;var ignoreElements_1=require("../internal/operators/ignoreElements");exports.ignoreElements=ignoreElements_1.ignoreElements;var isEmpty_1=require("../internal/operators/isEmpty");exports.isEmpty=isEmpty_1.isEmpty;var last_1=require("../internal/operators/last");exports.last=last_1.last;var map_1=require("../internal/operators/map");exports.map=map_1.map;var mapTo_1=require("../internal/operators/mapTo");exports.mapTo=mapTo_1.mapTo;var materialize_1=require("../internal/operators/materialize");exports.materialize=materialize_1.materialize;var max_1=require("../internal/operators/max");exports.max=max_1.max;var merge_1=require("../internal/operators/merge");exports.merge=merge_1.merge;var mergeAll_1=require("../internal/operators/mergeAll");exports.mergeAll=mergeAll_1.mergeAll;var mergeMap_1=require("../internal/operators/mergeMap");exports.mergeMap=mergeMap_1.mergeMap;var mergeMap_2=require("../internal/operators/mergeMap");exports.flatMap=mergeMap_2.mergeMap;var mergeMapTo_1=require("../internal/operators/mergeMapTo");exports.mergeMapTo=mergeMapTo_1.mergeMapTo;var mergeScan_1=require("../internal/operators/mergeScan");exports.mergeScan=mergeScan_1.mergeScan;var min_1=require("../internal/operators/min");exports.min=min_1.min;var multicast_1=require("../internal/operators/multicast");exports.multicast=multicast_1.multicast;var observeOn_1=require("../internal/operators/observeOn");exports.observeOn=observeOn_1.observeOn;var onErrorResumeNext_1=require("../internal/operators/onErrorResumeNext");exports.onErrorResumeNext=onErrorResumeNext_1.onErrorResumeNext;var pairwise_1=require("../internal/operators/pairwise");exports.pairwise=pairwise_1.pairwise;var partition_1=require("../internal/operators/partition");exports.partition=partition_1.partition;var pluck_1=require("../internal/operators/pluck");exports.pluck=pluck_1.pluck;var publish_1=require("../internal/operators/publish");exports.publish=publish_1.publish;var publishBehavior_1=require("../internal/operators/publishBehavior");exports.publishBehavior=publishBehavior_1.publishBehavior;var publishLast_1=require("../internal/operators/publishLast");exports.publishLast=publishLast_1.publishLast;var publishReplay_1=require("../internal/operators/publishReplay");exports.publishReplay=publishReplay_1.publishReplay;var race_1=require("../internal/operators/race");exports.race=race_1.race;var reduce_1=require("../internal/operators/reduce");exports.reduce=reduce_1.reduce;var repeat_1=require("../internal/operators/repeat");exports.repeat=repeat_1.repeat;var repeatWhen_1=require("../internal/operators/repeatWhen");exports.repeatWhen=repeatWhen_1.repeatWhen;var retry_1=require("../internal/operators/retry");exports.retry=retry_1.retry;var retryWhen_1=require("../internal/operators/retryWhen");exports.retryWhen=retryWhen_1.retryWhen;var refCount_1=require("../internal/operators/refCount");exports.refCount=refCount_1.refCount;var sample_1=require("../internal/operators/sample");exports.sample=sample_1.sample;var sampleTime_1=require("../internal/operators/sampleTime");exports.sampleTime=sampleTime_1.sampleTime;var scan_1=require("../internal/operators/scan");exports.scan=scan_1.scan;var sequenceEqual_1=require("../internal/operators/sequenceEqual");exports.sequenceEqual=sequenceEqual_1.sequenceEqual;var share_1=require("../internal/operators/share");exports.share=share_1.share;var shareReplay_1=require("../internal/operators/shareReplay");exports.shareReplay=shareReplay_1.shareReplay;var single_1=require("../internal/operators/single");exports.single=single_1.single;var skip_1=require("../internal/operators/skip");exports.skip=skip_1.skip;var skipLast_1=require("../internal/operators/skipLast");exports.skipLast=skipLast_1.skipLast;var skipUntil_1=require("../internal/operators/skipUntil");exports.skipUntil=skipUntil_1.skipUntil;var skipWhile_1=require("../internal/operators/skipWhile");exports.skipWhile=skipWhile_1.skipWhile;var startWith_1=require("../internal/operators/startWith");exports.startWith=startWith_1.startWith;var subscribeOn_1=require("../internal/operators/subscribeOn");exports.subscribeOn=subscribeOn_1.subscribeOn;var switchAll_1=require("../internal/operators/switchAll");exports.switchAll=switchAll_1.switchAll;var switchMap_1=require("../internal/operators/switchMap");exports.switchMap=switchMap_1.switchMap;var switchMapTo_1=require("../internal/operators/switchMapTo");exports.switchMapTo=switchMapTo_1.switchMapTo;var take_1=require("../internal/operators/take");exports.take=take_1.take;var takeLast_1=require("../internal/operators/takeLast");exports.takeLast=takeLast_1.takeLast;var takeUntil_1=require("../internal/operators/takeUntil");exports.takeUntil=takeUntil_1.takeUntil;var takeWhile_1=require("../internal/operators/takeWhile");exports.takeWhile=takeWhile_1.takeWhile;var tap_1=require("../internal/operators/tap");exports.tap=tap_1.tap;var throttle_1=require("../internal/operators/throttle");exports.throttle=throttle_1.throttle;var throttleTime_1=require("../internal/operators/throttleTime");exports.throttleTime=throttleTime_1.throttleTime;var throwIfEmpty_1=require("../internal/operators/throwIfEmpty");exports.throwIfEmpty=throwIfEmpty_1.throwIfEmpty;var timeInterval_1=require("../internal/operators/timeInterval");exports.timeInterval=timeInterval_1.timeInterval;var timeout_1=require("../internal/operators/timeout");exports.timeout=timeout_1.timeout;var timeoutWith_1=require("../internal/operators/timeoutWith");exports.timeoutWith=timeoutWith_1.timeoutWith;var timestamp_1=require("../internal/operators/timestamp");exports.timestamp=timestamp_1.timestamp;var toArray_1=require("../internal/operators/toArray");exports.toArray=toArray_1.toArray;var window_1=require("../internal/operators/window");exports.window=window_1.window;var windowCount_1=require("../internal/operators/windowCount");exports.windowCount=windowCount_1.windowCount;var windowTime_1=require("../internal/operators/windowTime");exports.windowTime=windowTime_1.windowTime;var windowToggle_1=require("../internal/operators/windowToggle");exports.windowToggle=windowToggle_1.windowToggle;var windowWhen_1=require("../internal/operators/windowWhen");exports.windowWhen=windowWhen_1.windowWhen;var withLatestFrom_1=require("../internal/operators/withLatestFrom");exports.withLatestFrom=withLatestFrom_1.withLatestFrom;var zip_1=require("../internal/operators/zip");exports.zip=zip_1.zip;var zipAll_1=require("../internal/operators/zipAll");exports.zipAll=zipAll_1.zipAll},{"../internal/operators/audit":135,"../internal/operators/auditTime":136,"../internal/operators/buffer":137,"../internal/operators/bufferCount":138,"../internal/operators/bufferTime":139,"../internal/operators/bufferToggle":140,"../internal/operators/bufferWhen":141,"../internal/operators/catchError":142,"../internal/operators/combineAll":143,"../internal/operators/combineLatest":144,"../internal/operators/concat":145,"../internal/operators/concatAll":146,"../internal/operators/concatMap":147,"../internal/operators/concatMapTo":148,"../internal/operators/count":149,"../internal/operators/debounce":150,"../internal/operators/debounceTime":151,"../internal/operators/defaultIfEmpty":152,"../internal/operators/delay":153,"../internal/operators/delayWhen":154,"../internal/operators/dematerialize":155,"../internal/operators/distinct":156,"../internal/operators/distinctUntilChanged":157,"../internal/operators/distinctUntilKeyChanged":158,"../internal/operators/elementAt":159,"../internal/operators/endWith":160,"../internal/operators/every":161,"../internal/operators/exhaust":162,"../internal/operators/exhaustMap":163,"../internal/operators/expand":164,"../internal/operators/filter":165,"../internal/operators/finalize":166,"../internal/operators/find":167,"../internal/operators/findIndex":168,"../internal/operators/first":169,"../internal/operators/groupBy":170,"../internal/operators/ignoreElements":171,"../internal/operators/isEmpty":172,"../internal/operators/last":173,"../internal/operators/map":174,"../internal/operators/mapTo":175,"../internal/operators/materialize":176,"../internal/operators/max":177,"../internal/operators/merge":178,"../internal/operators/mergeAll":179,"../internal/operators/mergeMap":180,"../internal/operators/mergeMapTo":181,"../internal/operators/mergeScan":182,"../internal/operators/min":183,"../internal/operators/multicast":184,"../internal/operators/observeOn":185,"../internal/operators/onErrorResumeNext":186,"../internal/operators/pairwise":187,"../internal/operators/partition":188,"../internal/operators/pluck":189,"../internal/operators/publish":190,"../internal/operators/publishBehavior":191,"../internal/operators/publishLast":192,"../internal/operators/publishReplay":193,"../internal/operators/race":194,"../internal/operators/reduce":195,"../internal/operators/refCount":196,"../internal/operators/repeat":197,"../internal/operators/repeatWhen":198,"../internal/operators/retry":199,"../internal/operators/retryWhen":200,"../internal/operators/sample":201,"../internal/operators/sampleTime":202,"../internal/operators/scan":203,"../internal/operators/sequenceEqual":204,"../internal/operators/share":205,"../internal/operators/shareReplay":206,"../internal/operators/single":207,"../internal/operators/skip":208,"../internal/operators/skipLast":209,"../internal/operators/skipUntil":210,"../internal/operators/skipWhile":211,"../internal/operators/startWith":212,"../internal/operators/subscribeOn":213,"../internal/operators/switchAll":214,"../internal/operators/switchMap":215,"../internal/operators/switchMapTo":216,"../internal/operators/take":217,"../internal/operators/takeLast":218,"../internal/operators/takeUntil":219,"../internal/operators/takeWhile":220,"../internal/operators/tap":221,"../internal/operators/throttle":222,"../internal/operators/throttleTime":223,"../internal/operators/throwIfEmpty":224,"../internal/operators/timeInterval":225,"../internal/operators/timeout":226,"../internal/operators/timeoutWith":227,"../internal/operators/timestamp":228,"../internal/operators/toArray":229,"../internal/operators/window":230,"../internal/operators/windowCount":231,"../internal/operators/windowTime":232,"../internal/operators/windowToggle":233,"../internal/operators/windowWhen":234,"../internal/operators/withLatestFrom":235,"../internal/operators/zip":236,"../internal/operators/zipAll":237}],286:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var obj,root,_ponyfill=require("./ponyfill.js"),_ponyfill2=(obj=_ponyfill)&&obj.__esModule?obj:{default:obj};root="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==global?global:void 0!==module?module:Function("return this")();var result=(0,_ponyfill2.default)(root);exports.default=result}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ponyfill.js":287}],287:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(root){var result,_Symbol=root.Symbol;"function"==typeof _Symbol?_Symbol.observable?result=_Symbol.observable:(result=_Symbol("observable"),_Symbol.observable=result):result="@@observable";return result}},{}],288:[function(require,module,exports){var l;l=this,function(l){function xa(){}function C(a,b){this.x=a||0,this.y=b||0}function ba(a,b,c,d,e,f,g,h,k,m){Object.defineProperty(this,"id",{value:hf++}),this.uuid=Y.generateUUID(),this.name="",this.image=void 0!==a?a:ba.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==b?b:ba.DEFAULT_MAPPING,this.wrapS=void 0!==c?c:1001,this.wrapT=void 0!==d?d:1001,this.magFilter=void 0!==e?e:1006,this.minFilter=void 0!==f?f:1008,this.anisotropy=void 0!==k?k:1,this.format=void 0!==g?g:1023,this.type=void 0!==h?h:1009,this.offset=new C(0,0),this.repeat=new C(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==m?m:3e3,this.version=0,this.onUpdate=null}function fa(a,b,c,d){this.x=a||0,this.y=b||0,this.z=c||0,this.w=void 0!==d?d:1}function Cb(a,b,c){this.uuid=Y.generateUUID(),this.width=a,this.height=b,this.scissor=new fa(0,0,a,b),this.scissorTest=!1,this.viewport=new fa(0,0,a,b),void 0===(c=c||{}).minFilter&&(c.minFilter=1006),this.texture=new ba(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy,c.encoding),this.depthBuffer=void 0===c.depthBuffer||c.depthBuffer,this.stencilBuffer=void 0===c.stencilBuffer||c.stencilBuffer,this.depthTexture=void 0!==c.depthTexture?c.depthTexture:null}function Db(a,b,c){Cb.call(this,a,b,c),this.activeMipMapLevel=this.activeCubeFace=0}function oa(a,b,c,d){this._x=a||0,this._y=b||0,this._z=c||0,this._w=void 0!==d?d:1}function n(a,b,c){this.x=a||0,this.y=b||0,this.z=c||0}function K(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function db(a,b,c,d,e,f,g,h,k,m,q,v){ba.call(this,null,f,g,h,k,m,d,e,q,v),this.image={data:a,width:b,height:c},this.magFilter=void 0!==k?k:1003,this.minFilter=void 0!==m?m:1003,this.flipY=this.generateMipmaps=!1,this.unpackAlignment=1}function Xa(a,b,c,d,e,f,g,h,k,m){ba.call(this,a=void 0!==a?a:[],void 0!==b?b:301,c,d,e,f,g,h,k,m),this.flipY=!1}function Eb(a,b,c){var d=a[0];if(d<=0||0<d)return a;var e=b*c,f=xe[e];if(void 0===f&&(f=new Float32Array(e),xe[e]=f),0!==b)for(d.toArray(f,0),d=1,e=0;d!==b;++d)e+=c,a[d].toArray(f,e);return f}function ye(a,b){var c=ze[b];void 0===c&&(c=new Int32Array(b),ze[b]=c);for(var d=0;d!==b;++d)c[d]=a.allocTextureUnit();return c}function jf(a,b){a.uniform1f(this.addr,b)}function kf(a,b){a.uniform1i(this.addr,b)}function lf(a,b){void 0===b.x?a.uniform2fv(this.addr,b):a.uniform2f(this.addr,b.x,b.y)}function mf(a,b){void 0!==b.x?a.uniform3f(this.addr,b.x,b.y,b.z):void 0!==b.r?a.uniform3f(this.addr,b.r,b.g,b.b):a.uniform3fv(this.addr,b)}function nf(a,b){void 0===b.x?a.uniform4fv(this.addr,b):a.uniform4f(this.addr,b.x,b.y,b.z,b.w)}function of(a,b){a.uniformMatrix2fv(this.addr,!1,b.elements||b)}function pf(a,b){void 0===b.elements?a.uniformMatrix3fv(this.addr,!1,b):(Ae.set(b.elements),a.uniformMatrix3fv(this.addr,!1,Ae))}function qf(a,b){void 0===b.elements?a.uniformMatrix4fv(this.addr,!1,b):(Be.set(b.elements),a.uniformMatrix4fv(this.addr,!1,Be))}function rf(a,b,c){var d=c.allocTextureUnit();a.uniform1i(this.addr,d),c.setTexture2D(b||Ce,d)}function sf(a,b,c){var d=c.allocTextureUnit();a.uniform1i(this.addr,d),c.setTextureCube(b||De,d)}function Ee(a,b){a.uniform2iv(this.addr,b)}function Fe(a,b){a.uniform3iv(this.addr,b)}function Ge(a,b){a.uniform4iv(this.addr,b)}function uf(a,b){a.uniform1fv(this.addr,b)}function vf(a,b){a.uniform1iv(this.addr,b)}function wf(a,b){a.uniform2fv(this.addr,Eb(b,this.size,2))}function xf(a,b){a.uniform3fv(this.addr,Eb(b,this.size,3))}function yf(a,b){a.uniform4fv(this.addr,Eb(b,this.size,4))}function zf(a,b){a.uniformMatrix2fv(this.addr,!1,Eb(b,this.size,4))}function Af(a,b){a.uniformMatrix3fv(this.addr,!1,Eb(b,this.size,9))}function Bf(a,b){a.uniformMatrix4fv(this.addr,!1,Eb(b,this.size,16))}function Cf(a,b,c){var d=b.length,e=ye(c,d);for(a.uniform1iv(this.addr,e),a=0;a!==d;++a)c.setTexture2D(b[a]||Ce,e[a])}function Df(a,b,c){var d=b.length,e=ye(c,d);for(a.uniform1iv(this.addr,e),a=0;a!==d;++a)c.setTextureCube(b[a]||De,e[a])}function Ff(a,b,c){this.id=a,this.addr=c,this.setValue=function(a){switch(a){case 5126:return jf;case 35664:return lf;case 35665:return mf;case 35666:return nf;case 35674:return of;case 35675:return pf;case 35676:return qf;case 35678:case 36198:return rf;case 35680:return sf;case 5124:case 35670:return kf;case 35667:case 35671:return Ee;case 35668:case 35672:return Fe;case 35669:case 35673:return Ge}}(b.type)}function Gf(a,b,c){this.id=a,this.addr=c,this.size=b.size,this.setValue=function(a){switch(a){case 5126:return uf;case 35664:return wf;case 35665:return xf;case 35666:return yf;case 35674:return zf;case 35675:return Af;case 35676:return Bf;case 35678:return Cf;case 35680:return Df;case 5124:case 35670:return vf;case 35667:case 35671:return Ee;case 35668:case 35672:return Fe;case 35669:case 35673:return Ge}}(b.type)}function He(a){this.id=a,this.seq=[],this.map={}}function eb(a,b,c){this.seq=[],this.map={},this.renderer=c,c=a.getProgramParameter(b,a.ACTIVE_UNIFORMS);for(var d=0;d<c;++d){var e=a.getActiveUniform(b,d),f=a.getUniformLocation(b,e.name),g=this,h=e.name,k=h.length;for(Pd.lastIndex=0;;){var m=Pd.exec(h),q=Pd.lastIndex,v=m[1],p=m[3];if("]"===m[2]&&(v|=0),void 0===p||"["===p&&q+2===k){h=g,e=void 0===p?new Ff(v,e,f):new Gf(v,e,f),h.seq.push(e),h.map[e.id]=e;break}void 0===(p=g.map[v])&&(p=new He(v),v=g,g=p,v.seq.push(g),v.map[g.id]=g),g=p}}}function G(a,b,c){return void 0===b&&void 0===c?this.set(a):this.setRGB(a,b,c)}function fd(a,b){this.min=void 0!==a?a:new C(1/0,1/0),this.max=void 0!==b?b:new C(-1/0,-1/0)}function Hf(a,b){var c,d,e,f,g,h,k,m,q,v,l,t,x,u,H,p=a.context,r=a.state;this.render=function(w,I,W){if(0!==b.length){w=new n;var D=W.w/W.z,O=.5*W.z,aa=.5*W.w,ja=new C((F=16/W.w)*D,F),T=new n(1,1,0),fb=new C(1,1),Ya=new fd;if(Ya.min.set(W.x,W.y),Ya.max.set(W.x+(W.z-16),W.y+(W.w-16)),void 0===x){var F=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),ka=new Uint16Array([0,1,2,0,2,3]);l=p.createBuffer(),t=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,l),p.bufferData(p.ARRAY_BUFFER,F,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t),p.bufferData(p.ELEMENT_ARRAY_BUFFER,ka,p.STATIC_DRAW),u=p.createTexture(),H=p.createTexture(),r.bindTexture(p.TEXTURE_2D,u),p.texImage2D(p.TEXTURE_2D,0,p.RGB,16,16,0,p.RGB,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),r.bindTexture(p.TEXTURE_2D,H),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,16,16,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST);F={vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},ka=p.createProgram();var P=p.createShader(p.FRAGMENT_SHADER),M=p.createShader(p.VERTEX_SHADER),V="precision "+a.getPrecision()+" float;\n";p.shaderSource(P,V+F.fragmentShader),p.shaderSource(M,V+F.vertexShader),p.compileShader(P),p.compileShader(M),p.attachShader(ka,P),p.attachShader(ka,M),p.linkProgram(ka),x=ka,q=p.getAttribLocation(x,"position"),v=p.getAttribLocation(x,"uv"),c=p.getUniformLocation(x,"renderType"),d=p.getUniformLocation(x,"map"),e=p.getUniformLocation(x,"occlusionMap"),f=p.getUniformLocation(x,"opacity"),g=p.getUniformLocation(x,"color"),h=p.getUniformLocation(x,"scale"),k=p.getUniformLocation(x,"rotation"),m=p.getUniformLocation(x,"screenPosition")}for(p.useProgram(x),r.initAttributes(),r.enableAttribute(q),r.enableAttribute(v),r.disableUnusedAttributes(),p.uniform1i(e,0),p.uniform1i(d,1),p.bindBuffer(p.ARRAY_BUFFER,l),p.vertexAttribPointer(q,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(v,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t),r.disable(p.CULL_FACE),r.buffers.depth.setMask(!1),ka=0,P=b.length;ka<P;ka++)if(F=16/W.w,ja.set(F*D,F),M=b[ka],w.set(M.matrixWorld.elements[12],M.matrixWorld.elements[13],M.matrixWorld.elements[14]),w.applyMatrix4(I.matrixWorldInverse),w.applyMatrix4(I.projectionMatrix),T.copy(w),fb.x=W.x+T.x*O+O-8,fb.y=W.y+T.y*aa+aa-8,!0===Ya.containsPoint(fb)){r.activeTexture(p.TEXTURE0),r.bindTexture(p.TEXTURE_2D,null),r.activeTexture(p.TEXTURE1),r.bindTexture(p.TEXTURE_2D,u),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGB,fb.x,fb.y,16,16,0),p.uniform1i(c,0),p.uniform2f(h,ja.x,ja.y),p.uniform3f(m,T.x,T.y,T.z),r.disable(p.BLEND),r.enable(p.DEPTH_TEST),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),r.activeTexture(p.TEXTURE0),r.bindTexture(p.TEXTURE_2D,H),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,fb.x,fb.y,16,16,0),p.uniform1i(c,1),r.disable(p.DEPTH_TEST),r.activeTexture(p.TEXTURE1),r.bindTexture(p.TEXTURE_2D,u),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),M.positionScreen.copy(T),M.customUpdateCallback?M.customUpdateCallback(M):M.updateLensFlares(),p.uniform1i(c,2),r.enable(p.BLEND);V=0;for(var pa=M.lensFlares.length;V<pa;V++){var S=M.lensFlares[V];.001<S.opacity&&.001<S.scale&&(T.x=S.x,T.y=S.y,T.z=S.z,F=S.size*S.scale/W.w,ja.x=F*D,ja.y=F,p.uniform3f(m,T.x,T.y,T.z),p.uniform2f(h,ja.x,ja.y),p.uniform1f(k,S.rotation),p.uniform1f(f,S.opacity),p.uniform3f(g,S.color.r,S.color.g,S.color.b),r.setBlending(S.blending,S.blendEquation,S.blendSrc,S.blendDst),a.setTexture2D(S.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}r.enable(p.CULL_FACE),r.enable(p.DEPTH_TEST),r.buffers.depth.setMask(!0),a.resetGLState()}}}function If(a,b){var c,d,e,f,g,h,k,m,q,v,p,r,l,t,y,x,u;function H(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:b.id-a.id}var W,D,O,aa,w=a.context,I=a.state,F=new n,ja=new oa,T=new n;this.render=function(n,Ya){if(0!==b.length){if(void 0===O){var ka=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),P=new Uint16Array([0,1,2,0,2,3]);W=w.createBuffer(),D=w.createBuffer(),w.bindBuffer(w.ARRAY_BUFFER,W),w.bufferData(w.ARRAY_BUFFER,ka,w.STATIC_DRAW),w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,D),w.bufferData(w.ELEMENT_ARRAY_BUFFER,P,w.STATIC_DRAW);ka=w.createProgram(),P=w.createShader(w.VERTEX_SHADER);var M=w.createShader(w.FRAGMENT_SHADER);w.shaderSource(P,["precision "+a.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),w.shaderSource(M,["precision "+a.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),w.compileShader(P),w.compileShader(M),w.attachShader(ka,P),w.attachShader(ka,M),w.linkProgram(ka),O=ka,x=w.getAttribLocation(O,"position"),u=w.getAttribLocation(O,"uv"),c=w.getUniformLocation(O,"uvOffset"),d=w.getUniformLocation(O,"uvScale"),e=w.getUniformLocation(O,"rotation"),f=w.getUniformLocation(O,"scale"),g=w.getUniformLocation(O,"color"),h=w.getUniformLocation(O,"map"),k=w.getUniformLocation(O,"opacity"),m=w.getUniformLocation(O,"modelViewMatrix"),q=w.getUniformLocation(O,"projectionMatrix"),v=w.getUniformLocation(O,"fogType"),p=w.getUniformLocation(O,"fogDensity"),r=w.getUniformLocation(O,"fogNear"),l=w.getUniformLocation(O,"fogFar"),t=w.getUniformLocation(O,"fogColor"),y=w.getUniformLocation(O,"alphaTest"),(ka=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,ka.height=8,(P=ka.getContext("2d")).fillStyle="white",P.fillRect(0,0,8,8),(aa=new ba(ka)).needsUpdate=!0}w.useProgram(O),I.initAttributes(),I.enableAttribute(x),I.enableAttribute(u),I.disableUnusedAttributes(),I.disable(w.CULL_FACE),I.enable(w.BLEND),w.bindBuffer(w.ARRAY_BUFFER,W),w.vertexAttribPointer(x,2,w.FLOAT,!1,16,0),w.vertexAttribPointer(u,2,w.FLOAT,!1,16,8),w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,D),w.uniformMatrix4fv(q,!1,Ya.projectionMatrix.elements),I.activeTexture(w.TEXTURE0),w.uniform1i(h,0),P=ka=0,(M=n.fog)?(w.uniform3f(t,M.color.r,M.color.g,M.color.b),M.isFog?(w.uniform1f(r,M.near),w.uniform1f(l,M.far),w.uniform1i(v,1),P=ka=1):M.isFogExp2&&(w.uniform1f(p,M.density),w.uniform1i(v,2),P=ka=2)):(w.uniform1i(v,0),P=ka=0);M=0;for(var V=b.length;M<V;M++){(pa=b[M]).modelViewMatrix.multiplyMatrices(Ya.matrixWorldInverse,pa.matrixWorld),pa.z=-pa.modelViewMatrix.elements[14]}b.sort(H);var S=[];for(M=0,V=b.length;M<V;M++){var pa,N=(pa=b[M]).material;if(!1!==N.visible){pa.onBeforeRender(a,n,Ya,void 0,N,void 0),w.uniform1f(y,N.alphaTest),w.uniformMatrix4fv(m,!1,pa.modelViewMatrix.elements),pa.matrixWorld.decompose(F,ja,T),S[0]=T.x,S[1]=T.y;var C=0;n.fog&&N.fog&&(C=P),ka!==C&&(w.uniform1i(v,C),ka=C),null!==N.map?(w.uniform2f(c,N.map.offset.x,N.map.offset.y),w.uniform2f(d,N.map.repeat.x,N.map.repeat.y)):(w.uniform2f(c,0,0),w.uniform2f(d,1,1)),w.uniform1f(k,N.opacity),w.uniform3f(g,N.color.r,N.color.g,N.color.b),w.uniform1f(e,N.rotation),w.uniform2fv(f,S),I.setBlending(N.blending,N.blendEquation,N.blendSrc,N.blendDst,N.blendEquationAlpha,N.blendSrcAlpha,N.blendDstAlpha,N.premultipliedAlpha),I.buffers.depth.setTest(N.depthTest),I.buffers.depth.setMask(N.depthWrite),N.map?a.setTexture2D(N.map,0):a.setTexture2D(aa,0),w.drawElements(w.TRIANGLES,6,w.UNSIGNED_SHORT,0),pa.onAfterRender(a,n,Ya,void 0,N,void 0)}}I.enable(w.CULL_FACE),a.resetGLState()}}}function U(){Object.defineProperty(this,"id",{value:Jf++}),this.uuid=Y.generateUUID(),this.name="",this.type="Material",this.lights=this.fog=!0,this.blending=1,this.side=0,this.shading=2,this.vertexColors=0,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=3,this.depthWrite=this.depthTest=!0,this.clippingPlanes=null,this.clipShadows=this.clipIntersection=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.needsUpdate=this.visible=!0}function ra(a){U.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},(this.index0AttributeName=void 0)!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(a))}function Za(a){U.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.morphTargets=this.skinning=!1,this.displacementMap=this.alphaMap=this.map=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.setValues(a)}function Ra(a,b){this.min=void 0!==a?a:new n(1/0,1/0,1/0),this.max=void 0!==b?b:new n(-1/0,-1/0,-1/0)}function Ea(a,b){this.center=void 0!==a?a:new n,this.radius=void 0!==b?b:0}function Ba(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function Aa(a,b){this.normal=void 0!==a?a:new n(1,0,0),this.constant=void 0!==b?b:0}function gd(a,b,c,d,e,f){this.planes=[void 0!==a?a:new Aa,void 0!==b?b:new Aa,void 0!==c?c:new Aa,void 0!==d?d:new Aa,void 0!==e?e:new Aa,void 0!==f?f:new Aa]}function Ie(a,b,c,d){function e(b,c,d,e){var g,f=b.geometry;g=t;var h=b.customDepthMaterial;return d&&(g=y,h=b.customDistanceMaterial),g=h||(h=!1,c.morphTargets&&(f&&f.isBufferGeometry?h=f.morphAttributes&&f.morphAttributes.position&&0<f.morphAttributes.position.length:f&&f.isGeometry&&(h=f.morphTargets&&0<f.morphTargets.length)),b.isSkinnedMesh&&!1===c.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",b),f=0,h&&(f|=1),(b=b.isSkinnedMesh&&c.skinning)&&(f|=2),g[f]),a.localClippingEnabled&&!0===c.clipShadows&&0!==c.clippingPlanes.length&&(f=g.uuid,h=c.uuid,void 0===(b=x[f])&&(b={},x[f]=b),void 0===(f=b[h])&&(f=g.clone(),b[h]=f),g=f),g.visible=c.visible,g.wireframe=c.wireframe,h=c.side,F.renderSingleSided&&2==h&&(h=0),F.renderReverseSided&&(0===h?h=1:1===h&&(h=0)),g.side=h,g.clipShadows=c.clipShadows,g.clippingPlanes=c.clippingPlanes,g.wireframeLinewidth=c.wireframeLinewidth,g.linewidth=c.linewidth,d&&void 0!==g.uniforms.lightPos&&g.uniforms.lightPos.value.copy(e),g}function f(b,d,g,h){if(!1!==b.visible){if(b.layers.test(d.layers)&&(b.isMesh||b.isLine||b.isPoints)&&b.castShadow&&(!b.frustumCulled||k.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,b.matrixWorld);var m=c.update(b),p=b.material;if(Array.isArray(p))for(var q=m.groups,v=0,r=q.length;v<r;v++){var u=q[v],w=p[u.materialIndex];w&&w.visible&&(w=e(b,w,h,l),a.renderBufferDirect(g,null,m,w,b,u))}else p.visible&&(w=e(b,p,h,l),a.renderBufferDirect(g,null,m,w,b,null))}for(m=0,p=(b=b.children).length;m<p;m++)f(b[m],d,g,h)}}var g=a.context,h=a.state,k=new gd,m=new K,q=b.shadows,v=new C,p=new C(d.maxTextureSize,d.maxTextureSize),r=new n,l=new n,t=Array(4),y=Array(4),x={},u=[new n(1,0,0),new n(-1,0,0),new n(0,0,1),new n(0,0,-1),new n(0,1,0),new n(0,-1,0)],H=[new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,0,1),new n(0,0,-1)],w=[new fa,new fa,new fa,new fa,new fa,new fa];(b=new Za).depthPacking=3201,b.clipping=!0,d=$a.distanceRGBA;for(var I=Ca.clone(d.uniforms),W=0;4!==W;++W){var D=0!=(1&W),O=0!=(2&W),aa=b.clone();aa.morphTargets=D,aa.skinning=O,t[W]=aa,D=new ra({defines:{USE_SHADOWMAP:""},uniforms:I,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,morphTargets:D,skinning:O,clipping:!0}),y[W]=D}var F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.renderSingleSided=this.renderReverseSided=!0,this.render=function(b,c){if(!1!==F.enabled&&(!1!==F.autoUpdate||!1!==F.needsUpdate)&&0!==q.length){h.disable(g.BLEND),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(var d,e=0,t=q.length;e<t;e++){var n=q[e];d=n.shadow;var y=n&&n.isPointLight;if(void 0===d)console.warn("THREE.WebGLShadowMap:",n,"has no shadow.");else{var x=d.camera;if(v.copy(d.mapSize),v.min(p),y){var D=v.x,I=v.y;w[0].set(2*D,I,D,I),w[1].set(0,I,D,I),w[2].set(3*D,I,D,I),w[3].set(D,I,D,I),w[4].set(3*D,0,D,I),w[5].set(D,0,D,I),v.x*=4,v.y*=2}for(null===d.map&&(d.map=new Cb(v.x,v.y,{minFilter:1003,magFilter:1003,format:1023}),d.map.texture.name=n.name+".shadowMap",x.updateProjectionMatrix()),d.isSpotLightShadow&&d.update(n),D=d.map,I=d.matrix,l.setFromMatrixPosition(n.matrixWorld),x.position.copy(l),y?(d=6,I.makeTranslation(-l.x,-l.y,-l.z)):(d=1,r.setFromMatrixPosition(n.target.matrixWorld),x.lookAt(r),x.updateMatrixWorld(),I.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),I.multiply(x.projectionMatrix),I.multiply(x.matrixWorldInverse)),a.setRenderTarget(D),a.clear(),n=0;n<d;n++)y&&(r.copy(x.position),r.add(u[n]),x.up.copy(H[n]),x.lookAt(r),x.updateMatrixWorld(),h.viewport(w[n])),m.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse),k.setFromMatrix(m),f(b,c,x,y)}}e=a.getClearColor(),t=a.getClearAlpha(),a.setClearColor(e,t),F.needsUpdate=!1}}}function Kf(a){var b={};return{get:function(a){return a.isInterleavedBufferAttribute&&(a=a.data),b[a.uuid]},remove:function(c){c.isInterleavedBufferAttribute&&(c=c.data);var d=b[c.uuid];d&&(a.deleteBuffer(d.buffer),delete b[c.uuid])},update:function(c,d){if(c.isInterleavedBufferAttribute&&(c=c.data),void 0===(e=b[c.uuid])){var e=c.uuid,f=c,g=f.array,h=f.dynamic?a.DYNAMIC_DRAW:a.STATIC_DRAW,k=a.createBuffer();a.bindBuffer(d,k),a.bufferData(d,g,h),f.onUploadCallback(),h=a.FLOAT,g instanceof Float32Array?h=a.FLOAT:g instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):g instanceof Uint16Array?h=a.UNSIGNED_SHORT:g instanceof Int16Array?h=a.SHORT:g instanceof Uint32Array?h=a.UNSIGNED_INT:g instanceof Int32Array?h=a.INT:g instanceof Int8Array?h=a.BYTE:g instanceof Uint8Array&&(h=a.UNSIGNED_BYTE),b[e]={buffer:k,type:h,bytesPerElement:g.BYTES_PER_ELEMENT,version:f.version}}else e.version<c.version&&(g=(f=c).array,k=f.updateRange,a.bindBuffer(d,e.buffer),!1===f.dynamic?a.bufferData(d,g,a.STATIC_DRAW):-1===k.count?a.bufferSubData(d,0,g):0===k.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(a.bufferSubData(d,k.offset*g.BYTES_PER_ELEMENT,g.subarray(k.offset,k.offset+k.count)),k.count=-1),e.version=c.version)}}}function ab(a,b,c,d){this._x=a||0,this._y=b||0,this._z=c||0,this._order=d||ab.DefaultOrder}function Qd(){this.mask=1}function z(){Object.defineProperty(this,"id",{value:Lf++}),this.uuid=Y.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=z.DefaultUp.clone();var a=new n,b=new ab,c=new oa,d=new n(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)}),c.onChange(function(){b.setFromQuaternion(c,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:a},rotation:{enumerable:!0,value:b},quaternion:{enumerable:!0,value:c},scale:{enumerable:!0,value:d},modelViewMatrix:{value:new K},normalMatrix:{value:new Ba}}),this.matrix=new K,this.matrixWorld=new K,this.matrixAutoUpdate=z.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Qd,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function Na(){z.call(this),this.type="Camera",this.matrixWorldInverse=new K,this.projectionMatrix=new K}function Fb(a,b,c,d,e,f){Na.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=a,this.right=b,this.top=c,this.bottom=d,this.near=void 0!==e?e:.1,this.far=void 0!==f?f:2e3,this.updateProjectionMatrix()}function qa(a,b,c,d){Na.call(this),this.type="PerspectiveCamera",this.fov=void 0!==a?a:50,this.zoom=1,this.near=void 0!==c?c:.1,this.far=void 0!==d?d:2e3,this.focus=10,this.aspect=void 0!==b?b:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Sa(a,b,c,d,e,f){this.a=a,this.b=b,this.c=c,this.normal=d&&d.isVector3?d:new n,this.vertexNormals=Array.isArray(d)?d:[],this.color=e&&e.isColor?e:new G,this.vertexColors=Array.isArray(e)?e:[],this.materialIndex=void 0!==f?f:0}function J(){Object.defineProperty(this,"id",{value:Rd++}),this.uuid=Y.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function Z(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Y.generateUUID(),this.name="",this.array=a,this.itemSize=b,this.count=void 0!==a?a.length/b:0,this.normalized=!0===c,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function pc(a,b){Z.call(this,new Int8Array(a),b)}function qc(a,b){Z.call(this,new Uint8Array(a),b)}function rc(a,b){Z.call(this,new Uint8ClampedArray(a),b)}function sc(a,b){Z.call(this,new Int16Array(a),b)}function gb(a,b){Z.call(this,new Uint16Array(a),b)}function tc(a,b){Z.call(this,new Int32Array(a),b)}function hb(a,b){Z.call(this,new Uint32Array(a),b)}function B(a,b){Z.call(this,new Float32Array(a),b)}function uc(a,b){Z.call(this,new Float64Array(a),b)}function Je(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function Sd(a){if(0===a.length)return-1/0;for(var b=a[0],c=1,d=a.length;c<d;++c)a[c]>b&&(b=a[c]);return b}function E(){Object.defineProperty(this,"id",{value:Rd++}),this.uuid=Y.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}}function Gb(a,b,c,d,e,f){J.call(this),this.type="BoxGeometry",this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f},this.fromBufferGeometry(new ib(a,b,c,d,e,f)),this.mergeVertices()}function ib(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,W,D,O){var aa=f/W,F=g/D,ja=f/2,T=g/2,C=l/2;g=W+1;var P,M,B=D+1,z=f=0,V=new n;for(M=0;M<B;M++){var pa=M*F-T;for(P=0;P<g;P++)V[a]=(P*aa-ja)*d,V[b]=pa*e,V[c]=C,m.push(V.x,V.y,V.z),V[a]=0,V[b]=0,V[c]=0<l?1:-1,q.push(V.x,V.y,V.z),v.push(P/W),v.push(1-M/D),f+=1}for(M=0;M<D;M++)for(P=0;P<W;P++)a=p+P+g*(M+1),b=p+(P+1)+g*(M+1),c=p+(P+1)+g*M,k.push(p+P+g*M,a,c),k.push(a,b,c),z+=6;h.addGroup(r,z,O),r+=z,p+=f}E.call(this),this.type="BoxBufferGeometry",this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};var h=this;d=Math.floor(d)||1,e=Math.floor(e)||1,f=Math.floor(f)||1;var k=[],m=[],q=[],v=[],p=0,r=0;g("z","y","x",-1,-1,c,b,a,f,e,0),g("z","y","x",1,-1,c,b,-a,f,e,1),g("x","z","y",1,1,a,c,b,d,f,2),g("x","z","y",1,-1,a,c,-b,d,f,3),g("x","y","z",1,-1,a,b,c,d,e,4),g("x","y","z",-1,-1,a,b,-c,d,e,5),this.setIndex(k),this.addAttribute("position",new B(m,3)),this.addAttribute("normal",new B(q,3)),this.addAttribute("uv",new B(v,2))}function vc(a,b,c,d){J.call(this),this.type="PlaneGeometry",this.parameters={width:a,height:b,widthSegments:c,heightSegments:d},this.fromBufferGeometry(new jb(a,b,c,d)),this.mergeVertices()}function jb(a,b,c,d){E.call(this),this.type="PlaneBufferGeometry",this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2,g=(c=Math.floor(c)||1)+1,h=(d=Math.floor(d)||1)+1,k=a/c,m=b/d,q=[],v=[],p=[],r=[];for(a=0;a<h;a++){var l=a*m-f;for(b=0;b<g;b++)v.push(b*k-e,-l,0),p.push(0,0,1),r.push(b/c),r.push(1-a/d)}for(a=0;a<d;a++)for(b=0;b<c;b++)e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,q.push(b+g*a,e,h),q.push(e,f,h);this.setIndex(q),this.addAttribute("position",new B(v,3)),this.addAttribute("normal",new B(p,3)),this.addAttribute("uv",new B(r,2))}function ya(a){U.call(this),this.type="MeshBasicMaterial",this.color=new G(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.lights=this.morphTargets=this.skinning=!1,this.setValues(a)}function kb(a,b){this.origin=void 0!==a?a:new n,this.direction=void 0!==b?b:new n}function Hb(a,b){this.start=void 0!==a?a:new n,this.end=void 0!==b?b:new n}function Ta(a,b,c){this.a=void 0!==a?a:new n,this.b=void 0!==b?b:new n,this.c=void 0!==c?c:new n}function la(a,b){z.call(this),this.type="Mesh",this.geometry=void 0!==a?a:new E,this.material=void 0!==b?b:new ya({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}function Mf(a,b,c,d){function e(a,c){b.buffers.color.setClear(a.r,a.g,a.b,c,d)}var h,k,m,q,f=new G(0),g=0;return{getClearColor:function(){return f},setClearColor:function(a,b){f.set(a),e(f,g=void 0!==b?b:1)},getClearAlpha:function(){return g},setClearAlpha:function(a){e(f,g=a)},render:function(b,d,r){null===(b=b.background)?e(f,g):b&&b.isColor&&(e(b,1),r=!0),(a.autoClear||r)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil),b&&b.isCubeTexture?(void 0===m&&(m=new qa,q=new la(new ib(5,5,5),new ra({uniforms:$a.cube.uniforms,vertexShader:$a.cube.vertexShader,fragmentShader:$a.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))),m.projectionMatrix.copy(d.projectionMatrix),m.matrixWorld.extractRotation(d.matrixWorld),m.matrixWorldInverse.getInverse(m.matrixWorld),q.material.uniforms.tCube.value=b,q.modelViewMatrix.multiplyMatrices(m.matrixWorldInverse,q.matrixWorld),c.update(q),a.renderBufferDirect(m,null,q.geometry,q.material,q,null)):b&&b.isTexture&&(void 0===h&&(h=new Fb(-1,1,1,-1,0,1),k=new la(new jb(2,2),new ya({depthTest:!1,depthWrite:!1,fog:!1}))),k.material.map=b,c.update(k),a.renderBufferDirect(h,null,k.geometry,k.material,k,null))}}}function Nf(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.program&&b.program&&a.program!==b.program?a.program.id-b.program.id:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function Of(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function Pf(){var a=[],b=-1,c=[],d=-1;return{opaque:a,transparent:c,init:function(){d=b=-1},push:function(e,f,g,h,k){var m,q;q=g.transparent?(m=c,++d):(m=a,++b),(q=m[q])?(q.id=e.id,q.object=e,q.geometry=f,q.material=g,q.program=g.program,q.renderOrder=e.renderOrder,q.z=h,q.group=k):(q={id:e.id,object:e,geometry:f,material:g,program:g.program,renderOrder:e.renderOrder,z:h,group:k},m.push(q))},finish:function(){a.length=b+1,c.length=d+1},sort:function(){a.sort(Nf),c.sort(Of)}}}function Qf(){var a={};return{get:function(b,c){var d=b.id+","+c.id,e=a[d];return void 0===e&&(e=new Pf,a[d]=e),e},dispose:function(){a={}}}}function Rf(a,b,c){var d,e,f;this.setMode=function(a){d=a},this.setIndex=function(a){e=a.type,f=a.bytesPerElement},this.render=function(b,h){a.drawElements(d,h,e,b*f),c.calls++,c.vertices+=h,d===a.TRIANGLES&&(c.faces+=h/3)},this.renderInstances=function(g,h,k){var m=b.get("ANGLE_instanced_arrays");null===m?console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(m.drawElementsInstancedANGLE(d,k,e,h*f,g.maxInstancedCount),c.calls++,c.vertices+=k*g.maxInstancedCount,d===a.TRIANGLES&&(c.faces+=g.maxInstancedCount*k/3))}}function Sf(a,b,c){var d;this.setMode=function(a){d=a},this.render=function(b,f){a.drawArrays(d,b,f),c.calls++,c.vertices+=f,d===a.TRIANGLES&&(c.faces+=f/3)},this.renderInstances=function(e,f,g){var h=b.get("ANGLE_instanced_arrays");if(null===h)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var k=e.attributes.position;k.isInterleavedBufferAttribute?(g=k.data.count,h.drawArraysInstancedANGLE(d,0,g,e.maxInstancedCount)):h.drawArraysInstancedANGLE(d,f,g,e.maxInstancedCount),c.calls++,c.vertices+=g*e.maxInstancedCount,d===a.TRIANGLES&&(c.faces+=e.maxInstancedCount*g/3)}}}function Tf(a,b,c){function d(a){a=a.target;var h=e[a.id];for(var k in null!==h.index&&b.remove(h.index),h.attributes)b.remove(h.attributes[k]);a.removeEventListener("dispose",d),delete e[a.id],(k=f[a.id])&&(b.remove(k),delete f[a.id]),(k=f[h.id])&&(b.remove(k),delete f[h.id]),c.geometries--}var e={},f={};return{get:function(a,b){var f=e[b.id];return f||(b.addEventListener("dispose",d),b.isBufferGeometry?f=b:b.isGeometry&&(void 0===b._bufferGeometry&&(b._bufferGeometry=(new E).setFromObject(a)),f=b._bufferGeometry),e[b.id]=f,c.geometries++,f)},update:function(c){var d=c.index,e=c.attributes;for(var f in null!==d&&b.update(d,a.ELEMENT_ARRAY_BUFFER),e)b.update(e[f],a.ARRAY_BUFFER);for(f in c=c.morphAttributes){e=0;for(var q=(d=c[f]).length;e<q;e++)b.update(d[e],a.ARRAY_BUFFER)}},getWireframeAttribute:function(c){if(d=f[c.id])return d;var d=[],e=c.index,m=c.attributes;if(null!==e){m=0;for(var q=(e=e.array).length;m<q;m+=3){var v=e[m+0],p=e[m+1],r=e[m+2];d.push(v,p,p,r,r,v)}}else for(e=m.position.array,m=0,q=e.length/3-1;m<q;m+=3)v=m+0,p=m+1,r=m+2,d.push(v,p,p,r,r,v);return d=new(65535<Sd(d)?hb:gb)(d,1),b.update(d,a.ELEMENT_ARRAY_BUFFER),f[c.id]=d}}}function Uf(){var a={};return{get:function(b){if(void 0!==a[b.id])return a[b.id];var c;switch(b.type){case"DirectionalLight":c={direction:new n,color:new G,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new C};break;case"SpotLight":c={position:new n,direction:new n,color:new G,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new C};break;case"PointLight":c={position:new n,color:new G,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new C};break;case"HemisphereLight":c={direction:new n,skyColor:new G,groundColor:new G};break;case"RectAreaLight":c={color:new G,position:new n,halfWidth:new n,halfHeight:new n}}return a[b.id]=c}}}function Vf(a,b,c){var d={};return{update:function(a){var f=c.frame,g=a.geometry,h=b.get(a,g);return d[h.id]!==f&&(g.isGeometry&&h.updateFromObject(a),b.update(h),d[h.id]=f),h},clear:function(){d={}}}}function Ke(a,b,c){var d=a.createShader(b);return a.shaderSource(d,c),a.compileShader(d),!1===a.getShaderParameter(d,a.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==a.getShaderInfoLog(d)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",b===a.VERTEX_SHADER?"vertex":"fragment",a.getShaderInfoLog(d),function(a){a=a.split("\n");for(var b=0;b<a.length;b++)a[b]=b+1+": "+a[b];return a.join("\n")}(c)),d}function Le(a){switch(a){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw Error("unsupported encoding: "+a)}}function Td(a,b){var c=Le(b);return"vec4 "+a+"( vec4 value ) { return "+c[0]+"ToLinear"+c[1]+"; }"}function wc(a){return""!==a}function Me(a,b){return a.replace(/NUM_DIR_LIGHTS/g,b.numDirLights).replace(/NUM_SPOT_LIGHTS/g,b.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,b.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,b.numPointLights).replace(/NUM_HEMI_LIGHTS/g,b.numHemiLights)}function Ud(a){return a.replace(/^[ \t]*#include +<([\w\d.]+)>/gm,function(a,c){var d=X[c];if(void 0===d)throw Error("Can not resolve #include <"+c+">");return Ud(d)})}function Ne(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){for(a="",c=parseInt(c);c<parseInt(d);c++)a+=e.replace(/\[ i \]/g,"[ "+c+" ]");return a})}function ag(a,b,c,d,e){var f=a.context,g=c.extensions,h=c.defines,k=d.vertexShader,m=d.fragmentShader,q="SHADOWMAP_TYPE_BASIC";1===e.shadowMapType?q="SHADOWMAP_TYPE_PCF":2===e.shadowMapType&&(q="SHADOWMAP_TYPE_PCF_SOFT");var v="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",r="ENVMAP_BLENDING_MULTIPLY";if(e.envMap){switch(c.envMap.mapping){case 301:case 302:v="ENVMAP_TYPE_CUBE";break;case 306:case 307:v="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:v="ENVMAP_TYPE_EQUIREC";break;case 305:v="ENVMAP_TYPE_SPHERE"}switch(c.envMap.mapping){case 302:case 304:p="ENVMAP_MODE_REFRACTION"}switch(c.combine){case 0:r="ENVMAP_BLENDING_MULTIPLY";break;case 1:r="ENVMAP_BLENDING_MIX";break;case 2:r="ENVMAP_BLENDING_ADD"}}var x,u,l=0<a.gammaFactor?a.gammaFactor:1,t=(g=function(a,b,c){return[(a=a||{}).derivatives||b.envMapCubeUV||b.bumpMap||b.normalMap||b.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(a.fragDepth||b.logarithmicDepthBuffer)&&c.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&c.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||b.envMap)&&c.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(wc).join("\n")}(g,e,a.extensions),function(a){var c,b=[];for(c in a){var d=a[c];!1!==d&&b.push("#define "+c+" "+d)}return b.join("\n")}(h)),n=f.createProgram();return d=c.isRawShaderMaterial?(h=[t,"\n"].filter(wc).join("\n"),[g,t,"\n"].filter(wc).join("\n")):(h=["precision "+e.precision+" float;","precision "+e.precision+" int;","#define SHADER_NAME "+d.name,t,e.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+l,"#define MAX_BONES "+e.maxBones,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+p:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.displacementMap&&e.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.useVertexTexture?"#define BONE_TEXTURE":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&!1===e.flatShading?"#define USE_MORPHNORMALS":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+e.numClippingPlanes,e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+q:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(wc).join("\n"),[g,"precision "+e.precision+" float;","precision "+e.precision+" int;","#define SHADER_NAME "+d.name,t,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"","#define GAMMA_FACTOR "+l,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+v:"",e.envMap?"#define "+p:"",e.envMap?"#define "+r:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+e.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(e.numClippingPlanes-e.numClipIntersection),e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+q:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",e.envMap&&a.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==e.toneMapping?"#define TONE_MAPPING":"",0!==e.toneMapping?X.tonemapping_pars_fragment:"",0!==e.toneMapping?function(a,b){var c;switch(b){case 1:c="Linear";break;case 2:c="Reinhard";break;case 3:c="Uncharted2";break;case 4:c="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+b)}return"vec3 "+a+"( vec3 color ) { return "+c+"ToneMapping( color ); }"}("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.outputEncoding||e.mapEncoding||e.envMapEncoding||e.emissiveMapEncoding?X.encodings_pars_fragment:"",e.mapEncoding?Td("mapTexelToLinear",e.mapEncoding):"",e.envMapEncoding?Td("envMapTexelToLinear",e.envMapEncoding):"",e.emissiveMapEncoding?Td("emissiveMapTexelToLinear",e.emissiveMapEncoding):"",e.outputEncoding?function(a,b){var c=Le(b);return"vec4 "+a+"( vec4 value ) { return LinearTo"+c[0]+c[1]+"; }"}("linearToOutputTexel",e.outputEncoding):"",e.depthPacking?"#define DEPTH_PACKING "+c.depthPacking:"","\n"].filter(wc).join("\n")),k=Me(k=Ud(k),e),m=Me(m=Ud(m),e),c.isShaderMaterial||(k=Ne(k),m=Ne(m)),m=d+m,k=Ke(f,f.VERTEX_SHADER,h+k),m=Ke(f,f.FRAGMENT_SHADER,m),f.attachShader(n,k),f.attachShader(n,m),void 0!==c.index0AttributeName?f.bindAttribLocation(n,0,c.index0AttributeName):!0===e.morphTargets&&f.bindAttribLocation(n,0,"position"),f.linkProgram(n),e=f.getProgramInfoLog(n),q=f.getShaderInfoLog(k),v=f.getShaderInfoLog(m),r=p=!0,!1===f.getProgramParameter(n,f.LINK_STATUS)?(p=!1,console.error("THREE.WebGLProgram: shader error: ",f.getError(),"gl.VALIDATE_STATUS",f.getProgramParameter(n,f.VALIDATE_STATUS),"gl.getProgramInfoLog",e,q,v)):""!==e?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",e):""!==q&&""!==v||(r=!1),r&&(this.diagnostics={runnable:p,material:c,programLog:e,vertexShader:{log:q,prefix:h},fragmentShader:{log:v,prefix:d}}),f.deleteShader(k),f.deleteShader(m),this.getUniforms=function(){return void 0===x&&(x=new eb(f,n,a)),x},this.getAttributes=function(){if(void 0===u){for(var a={},b=f.getProgramParameter(n,f.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=f.getActiveAttrib(n,c).name;a[d]=f.getAttribLocation(n,d)}u=a}return u},this.destroy=function(){f.deleteProgram(n),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=bg++,this.code=b,this.usedTimes=1,this.program=n,this.vertexShader=k,this.fragmentShader=m,this}function cg(a,b){function c(a,b){var c;return a?a.isTexture?c=a.encoding:a.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),c=a.texture.encoding):c=3e3,3e3===c&&b&&(c=3007),c}var d=[],e={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},f="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking dithering".split(" ");this.getParameters=function(d,f,k,m,q,v){var r,p=e[d.type];if(v.isSkinnedMesh)if(r=v.skeleton.bones,b.floatVertexTextures)r=1024;else{var l=Math.min(Math.floor((b.maxVertexUniforms-20)/4),r.length);r=l<r.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+r.length+" bones. This GPU supports "+l+"."),0):l}else r=0;l=a.getPrecision(),null!==d.precision&&((l=b.getMaxPrecision(d.precision))!==d.precision&&console.warn("THREE.WebGLProgram.getParameters:",d.precision,"not supported, using",l,"instead."));var t=a.getRenderTarget();return{shaderID:p,precision:l,supportsVertexTextures:b.vertexTextures,outputEncoding:c(t?t.texture:null,a.gammaOutput),map:!!d.map,mapEncoding:c(d.map,a.gammaInput),envMap:!!d.envMap,envMapMode:d.envMap&&d.envMap.mapping,envMapEncoding:c(d.envMap,a.gammaInput),envMapCubeUV:!!d.envMap&&(306===d.envMap.mapping||307===d.envMap.mapping),lightMap:!!d.lightMap,aoMap:!!d.aoMap,emissiveMap:!!d.emissiveMap,emissiveMapEncoding:c(d.emissiveMap,a.gammaInput),bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,displacementMap:!!d.displacementMap,roughnessMap:!!d.roughnessMap,metalnessMap:!!d.metalnessMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,gradientMap:!!d.gradientMap,combine:d.combine,vertexColors:d.vertexColors,fog:!!k,useFog:d.fog,fogExp:k&&k.isFogExp2,flatShading:1===d.shading,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:b.logarithmicDepthBuffer,skinning:d.skinning&&0<r,maxBones:r,useVertexTexture:b.floatVertexTextures,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:a.maxMorphTargets,maxMorphNormals:a.maxMorphNormals,numDirLights:f.directional.length,numPointLights:f.point.length,numSpotLights:f.spot.length,numRectAreaLights:f.rectArea.length,numHemiLights:f.hemi.length,numClippingPlanes:m,numClipIntersection:q,dithering:d.dithering,shadowMapEnabled:a.shadowMap.enabled&&v.receiveShadow&&0<f.shadows.length,shadowMapType:a.shadowMap.type,toneMapping:a.toneMapping,physicallyCorrectLights:a.physicallyCorrectLights,premultipliedAlpha:d.premultipliedAlpha,alphaTest:d.alphaTest,doubleSided:2===d.side,flipSided:1===d.side,depthPacking:void 0!==d.depthPacking&&d.depthPacking}},this.getProgramCode=function(b,c){var d=[];if(c.shaderID?d.push(c.shaderID):(d.push(b.fragmentShader),d.push(b.vertexShader)),void 0!==b.defines)for(var e in b.defines)d.push(e),d.push(b.defines[e]);for(e=0;e<f.length;e++)d.push(c[f[e]]);return d.push(b.onBeforeCompile.toString()),d.push(a.gammaOutput),d.join()},this.acquireProgram=function(b,c,e,f){for(var q,v=0,p=d.length;v<p;v++){var r=d[v];if(r.code===f){++(q=r).usedTimes;break}}return void 0===q&&(q=new ag(a,f,b,c,e),d.push(q)),q},this.releaseProgram=function(a){if(0==--a.usedTimes){var b=d.indexOf(a);d[b]=d[d.length-1],d.pop(),a.destroy()}},this.programs=d}function dg(a,b,c,d,e,f,g){function h(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return d.width=Math.floor(a.width*c),d.height=Math.floor(a.height*c),d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height),console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a),d}return a}function k(a){return Y.isPowerOfTwo(a.width)&&Y.isPowerOfTwo(a.height)}function m(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function q(b){return 1003===b||1004===b||1005===b?a.NEAREST:a.LINEAR}function v(b){(b=b.target).removeEventListener("dispose",v);a:{var c=d.get(b);if(b.image&&c.__image__webglTextureCube)a.deleteTexture(c.__image__webglTextureCube);else{if(void 0===c.__webglInit)break a;a.deleteTexture(c.__webglTexture)}d.remove(b)}g.textures--}function p(b){(b=b.target).removeEventListener("dispose",p);var c=d.get(b),e=d.get(b.texture);if(b){if(void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture),b.depthTexture&&b.depthTexture.dispose(),b.isWebGLRenderTargetCube)for(e=0;e<6;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.remove(b.texture),d.remove(b)}g.textures--}function r(b,p){var q=d.get(b);if(0<b.version&&q.__version!==b.version)if(void 0===(r=b.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",b);else{if(!1!==r.complete){void 0===q.__webglInit&&(q.__webglInit=!0,b.addEventListener("dispose",v),q.__webglTexture=a.createTexture(),g.textures++),c.activeTexture(a.TEXTURE0+p),c.bindTexture(a.TEXTURE_2D,q.__webglTexture),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b.flipY),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),a.pixelStorei(a.UNPACK_ALIGNMENT,b.unpackAlignment);var t=h(b.image,e.maxTextureSize);if((1001!==b.wrapS||1001!==b.wrapT||1003!==b.minFilter&&1006!==b.minFilter)&&!1===k(t))if((r=t)instanceof HTMLImageElement||r instanceof HTMLCanvasElement){(n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=Y.nearestPowerOfTwo(r.width),n.height=Y.nearestPowerOfTwo(r.height),n.getContext("2d").drawImage(r,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+r.width+"x"+r.height+"). Resized to "+n.width+"x"+n.height,r),t=n}else t=r;var r=k(t),n=f(b.format),y=f(b.type);l(a.TEXTURE_2D,b,r);var aa=b.mipmaps;if(b.isDepthTexture){if(aa=a.DEPTH_COMPONENT,1015===b.type){if(!x)throw Error("Float Depth Texture only supported in WebGL2.0");aa=a.DEPTH_COMPONENT32F}else x&&(aa=a.DEPTH_COMPONENT16);1026===b.format&&aa===a.DEPTH_COMPONENT&&1012!==b.type&&1014!==b.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),b.type=1012,y=f(b.type)),1027===b.format&&(aa=a.DEPTH_STENCIL,1020!==b.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),b.type=1020,y=f(b.type))),c.texImage2D(a.TEXTURE_2D,0,aa,t.width,t.height,0,n,y,null)}else if(b.isDataTexture)if(0<aa.length&&r){for(var F=0,ja=aa.length;F<ja;F++)t=aa[F],c.texImage2D(a.TEXTURE_2D,F,n,t.width,t.height,0,n,y,t.data);b.generateMipmaps=!1}else c.texImage2D(a.TEXTURE_2D,0,n,t.width,t.height,0,n,y,t.data);else if(b.isCompressedTexture)for(F=0,ja=aa.length;F<ja;F++)t=aa[F],1023!==b.format&&1022!==b.format?-1<c.getCompressedTextureFormats().indexOf(n)?c.compressedTexImage2D(a.TEXTURE_2D,F,n,t.width,t.height,0,t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):c.texImage2D(a.TEXTURE_2D,F,n,t.width,t.height,0,n,y,t.data);else if(0<aa.length&&r){for(F=0,ja=aa.length;F<ja;F++)t=aa[F],c.texImage2D(a.TEXTURE_2D,F,n,n,y,t);b.generateMipmaps=!1}else c.texImage2D(a.TEXTURE_2D,0,n,n,y,t);return m(b,r)&&a.generateMipmap(a.TEXTURE_2D),q.__version=b.version,void(b.onUpdate&&b.onUpdate(b))}console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",b)}c.activeTexture(a.TEXTURE0+p),c.bindTexture(a.TEXTURE_2D,q.__webglTexture)}function l(c,g,h){h?(a.texParameteri(c,a.TEXTURE_WRAP_S,f(g.wrapS)),a.texParameteri(c,a.TEXTURE_WRAP_T,f(g.wrapT)),a.texParameteri(c,a.TEXTURE_MAG_FILTER,f(g.magFilter)),a.texParameteri(c,a.TEXTURE_MIN_FILTER,f(g.minFilter))):(a.texParameteri(c,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(c,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),1001===g.wrapS&&1001===g.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",g),a.texParameteri(c,a.TEXTURE_MAG_FILTER,q(g.magFilter)),a.texParameteri(c,a.TEXTURE_MIN_FILTER,q(g.minFilter)),1003!==g.minFilter&&1006!==g.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",g)),!(h=b.get("EXT_texture_filter_anisotropic"))||1015===g.type&&null===b.get("OES_texture_float_linear")||1016===g.type&&null===b.get("OES_texture_half_float_linear")||!(1<g.anisotropy||d.get(g).__currentAnisotropy)||(a.texParameterf(c,h.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,e.getMaxAnisotropy())),d.get(g).__currentAnisotropy=g.anisotropy)}function t(b,e,g,h){var k=f(e.texture.format),m=f(e.texture.type);c.texImage2D(h,0,k,e.width,e.height,0,k,m,null),a.bindFramebuffer(a.FRAMEBUFFER,b),a.framebufferTexture2D(a.FRAMEBUFFER,g,h,d.get(e.texture).__webglTexture,0),a.bindFramebuffer(a.FRAMEBUFFER,null)}function n(b,c){a.bindRenderbuffer(a.RENDERBUFFER,b),c.depthBuffer&&!c.stencilBuffer?(a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_COMPONENT16,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,b)):c.depthBuffer&&c.stencilBuffer?(a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,b)):a.renderbufferStorage(a.RENDERBUFFER,a.RGBA4,c.width,c.height),a.bindRenderbuffer(a.RENDERBUFFER,null)}var x="undefined"!=typeof WebGL2RenderingContext&&a instanceof WebGL2RenderingContext;this.setTexture2D=r,this.setTextureCube=function(b,p){var q=d.get(b);if(6===b.image.length)if(0<b.version&&q.__version!==b.version){q.__image__webglTextureCube||(b.addEventListener("dispose",v),q.__image__webglTextureCube=a.createTexture(),g.textures++),c.activeTexture(a.TEXTURE0+p),c.bindTexture(a.TEXTURE_CUBE_MAP,q.__image__webglTextureCube),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b.flipY);for(var r=b&&b.isCompressedTexture,t=b.image[0]&&b.image[0].isDataTexture,n=[],y=0;y<6;y++)n[y]=r||t?t?b.image[y].image:b.image[y]:h(b.image[y],e.maxCubemapSize);var x=k(n[0]),F=f(b.format),ja=f(b.type);for(l(a.TEXTURE_CUBE_MAP,b,x),y=0;y<6;y++)if(r)for(var T,C=n[y].mipmaps,z=0,B=C.length;z<B;z++)T=C[z],1023!==b.format&&1022!==b.format?-1<c.getCompressedTextureFormats().indexOf(F)?c.compressedTexImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+y,z,F,T.width,T.height,0,T.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+y,z,F,T.width,T.height,0,F,ja,T.data);else t?c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,F,n[y].width,n[y].height,0,F,ja,n[y].data):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,F,F,ja,n[y]);m(b,x)&&a.generateMipmap(a.TEXTURE_CUBE_MAP),q.__version=b.version,b.onUpdate&&b.onUpdate(b)}else c.activeTexture(a.TEXTURE0+p),c.bindTexture(a.TEXTURE_CUBE_MAP,q.__image__webglTextureCube)},this.setTextureCubeDynamic=function(b,e){c.activeTexture(a.TEXTURE0+e),c.bindTexture(a.TEXTURE_CUBE_MAP,d.get(b).__webglTexture)},this.setupRenderTarget=function(b){var e=d.get(b),f=d.get(b.texture);b.addEventListener("dispose",p),f.__webglTexture=a.createTexture(),g.textures++;var h=!0===b.isWebGLRenderTargetCube,q=k(b);if(h){e.__webglFramebuffer=[];for(var v=0;v<6;v++)e.__webglFramebuffer[v]=a.createFramebuffer()}else e.__webglFramebuffer=a.createFramebuffer();if(h){for(c.bindTexture(a.TEXTURE_CUBE_MAP,f.__webglTexture),l(a.TEXTURE_CUBE_MAP,b.texture,q),v=0;v<6;v++)t(e.__webglFramebuffer[v],b,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+v);m(b.texture,q)&&a.generateMipmap(a.TEXTURE_CUBE_MAP),c.bindTexture(a.TEXTURE_CUBE_MAP,null)}else c.bindTexture(a.TEXTURE_2D,f.__webglTexture),l(a.TEXTURE_2D,b.texture,q),t(e.__webglFramebuffer,b,a.COLOR_ATTACHMENT0,a.TEXTURE_2D),m(b.texture,q)&&a.generateMipmap(a.TEXTURE_2D),c.bindTexture(a.TEXTURE_2D,null);if(b.depthBuffer){if(e=d.get(b),f=!0===b.isWebGLRenderTargetCube,b.depthTexture){if(f)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");if(a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),r(b.depthTexture,0),e=d.get(b.depthTexture).__webglTexture,1026===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,e,0);else{if(1027!==b.depthTexture.format)throw Error("Unknown depthTexture format");a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,e,0)}}else if(f)for(e.__webglDepthbuffer=[],f=0;f<6;f++)a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[f]),e.__webglDepthbuffer[f]=a.createRenderbuffer(),n(e.__webglDepthbuffer[f],b);else a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=a.createRenderbuffer(),n(e.__webglDepthbuffer,b);a.bindFramebuffer(a.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(b){var e=b.texture;m(e,k(b))&&(b=b.isWebGLRenderTargetCube?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D,e=d.get(e).__webglTexture,c.bindTexture(b,e),a.generateMipmap(b),c.bindTexture(b,null))}}function eg(){var a={};return{get:function(b){b=b.uuid;var c=a[b];return void 0===c&&(c={},a[b]=c),c},remove:function(b){delete a[b.uuid]},clear:function(){a={}}}}function fg(a,b,c){function d(b,c,d){var e=new Uint8Array(4),f=a.createTexture();for(a.bindTexture(b,f),a.texParameteri(b,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(b,a.TEXTURE_MAG_FILTER,a.NEAREST),b=0;b<d;b++)a.texImage2D(c+b,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,e);return f}function e(b){!0!==u[b]&&(a.enable(b),u[b]=!0)}function f(b){!1!==u[b]&&(a.disable(b),u[b]=!1)}function g(b,d,g,h,k,m,p,q){0!==b?e(a.BLEND):f(a.BLEND),5===b||b===w&&q===ja||(2===b?q?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE,a.ONE,a.ONE)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):3===b?q?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.ZERO,a.ONE_MINUS_SRC_COLOR,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):4===b?q?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.SRC_COLOR,a.ZERO,a.SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):q?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),w=b,ja=q),5===b?(k=k||d,m=m||g,p=p||h,d===I&&k===O||(a.blendEquationSeparate(c(d),c(k)),I=d,O=k),g===W&&h===D&&m===aa&&p===F||(a.blendFuncSeparate(c(g),c(h),c(m),c(p)),W=g,D=h,aa=m,F=p)):F=aa=O=D=W=I=null}function h(b){T!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),T=b)}function k(b){0!==b?(e(a.CULL_FACE),b!==C&&(1===b?a.cullFace(a.BACK):2===b?a.cullFace(a.FRONT):a.cullFace(a.FRONT_AND_BACK))):f(a.CULL_FACE),C=b}function m(b,c,d){b?(e(a.POLYGON_OFFSET_FILL),(B!==c||P!==d)&&(a.polygonOffset(c,d),B=c,P=d)):f(a.POLYGON_OFFSET_FILL)}function q(b){void 0===b&&(b=a.TEXTURE0+V-1),S!==b&&(a.activeTexture(b),S=b)}var v=new function(){var b=!1,c=new fa,d=null,e=new fa;return{setMask:function(c){d===c||b||(a.colorMask(c,c,c,c),d=c)},setLocked:function(a){b=a},setClear:function(b,d,f,g,h){!0===h&&(b*=g,d*=g,f*=g),c.set(b,d,f,g),!1===e.equals(c)&&(a.clearColor(b,d,f,g),e.copy(c))},reset:function(){b=!1,d=null,e.set(0,0,0,1)}}},p=new function(){var b=!1,c=null,d=null,g=null;return{setTest:function(b){b?e(a.DEPTH_TEST):f(a.DEPTH_TEST)},setMask:function(d){c===d||b||(a.depthMask(d),c=d)},setFunc:function(b){if(d!==b){if(b)switch(b){case 0:a.depthFunc(a.NEVER);break;case 1:a.depthFunc(a.ALWAYS);break;case 2:a.depthFunc(a.LESS);break;case 3:a.depthFunc(a.LEQUAL);break;case 4:a.depthFunc(a.EQUAL);break;case 5:a.depthFunc(a.GEQUAL);break;case 6:a.depthFunc(a.GREATER);break;case 7:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);d=b}},setLocked:function(a){b=a},setClear:function(b){g!==b&&(a.clearDepth(b),g=b)},reset:function(){b=!1,g=d=c=null}}},r=new function(){var b=!1,c=null,d=null,g=null,h=null,k=null,m=null,p=null,q=null;return{setTest:function(b){b?e(a.STENCIL_TEST):f(a.STENCIL_TEST)},setMask:function(d){c===d||b||(a.stencilMask(d),c=d)},setFunc:function(b,c,e){d===b&&g===c&&h===e||(a.stencilFunc(b,c,e),d=b,g=c,h=e)},setOp:function(b,c,d){k===b&&m===c&&p===d||(a.stencilOp(b,c,d),k=b,m=c,p=d)},setLocked:function(a){b=a},setClear:function(b){q!==b&&(a.clearStencil(b),q=b)},reset:function(){b=!1,q=p=m=k=h=g=d=c=null}}},l=a.getParameter(a.MAX_VERTEX_ATTRIBS),t=new Uint8Array(l),n=new Uint8Array(l),x=new Uint8Array(l),u={},H=null,w=null,I=null,W=null,D=null,O=null,aa=null,F=null,ja=!1,T=null,C=null,z=null,B=null,P=null,M=null,V=a.getParameter(a.MAX_COMBINED_TEXTURE_IMAGE_UNITS),pa=(l=parseFloat(/^WebGL\ ([0-9])/.exec(a.getParameter(a.VERSION))[1]),1<=parseFloat(l)),S=null,N={},E=new fa,G=new fa,K={};return K[a.TEXTURE_2D]=d(a.TEXTURE_2D,a.TEXTURE_2D,1),K[a.TEXTURE_CUBE_MAP]=d(a.TEXTURE_CUBE_MAP,a.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:v,depth:p,stencil:r},init:function(){v.setClear(0,0,0,1),p.setClear(1),r.setClear(0),e(a.DEPTH_TEST),p.setFunc(3),h(!1),k(1),e(a.CULL_FACE),e(a.BLEND),g(1)},initAttributes:function(){for(var a=0,b=t.length;a<b;a++)t[a]=0},enableAttribute:function(c){t[c]=1,0===n[c]&&(a.enableVertexAttribArray(c),n[c]=1),0!==x[c]&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c,0),x[c]=0)},enableAttributeAndDivisor:function(c,d){t[c]=1,0===n[c]&&(a.enableVertexAttribArray(c),n[c]=1),x[c]!==d&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c,d),x[c]=d)},disableUnusedAttributes:function(){for(var b=0,c=n.length;b!==c;++b)n[b]!==t[b]&&(a.disableVertexAttribArray(b),n[b]=0)},enable:e,disable:f,getCompressedTextureFormats:function(){if(null===H&&(H=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")||b.get("WEBGL_compressed_texture_etc1")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),d=0;d<c.length;d++)H.push(c[d]);return H},setBlending:g,setMaterial:function(b){2===b.side?f(a.CULL_FACE):e(a.CULL_FACE),h(1===b.side),!0===b.transparent?g(b.blending,b.blendEquation,b.blendSrc,b.blendDst,b.blendEquationAlpha,b.blendSrcAlpha,b.blendDstAlpha,b.premultipliedAlpha):g(0),p.setFunc(b.depthFunc),p.setTest(b.depthTest),p.setMask(b.depthWrite),v.setMask(b.colorWrite),m(b.polygonOffset,b.polygonOffsetFactor,b.polygonOffsetUnits)},setFlipSided:h,setCullFace:k,setLineWidth:function(b){b!==z&&(pa&&a.lineWidth(b),z=b)},setPolygonOffset:m,getScissorTest:function(){return M},setScissorTest:function(b){(M=b)?e(a.SCISSOR_TEST):f(a.SCISSOR_TEST)},activeTexture:q,bindTexture:function(b,c){null===S&&q();var d=N[S];void 0===d&&(d={type:void 0,texture:void 0},N[S]=d),d.type===b&&d.texture===c||(a.bindTexture(b,c||K[b]),d.type=b,d.texture=c)},compressedTexImage2D:function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(b){console.error("THREE.WebGLState:",b)}},texImage2D:function(){try{a.texImage2D.apply(a,arguments)}catch(b){console.error("THREE.WebGLState:",b)}},scissor:function(b){!1===E.equals(b)&&(a.scissor(b.x,b.y,b.z,b.w),E.copy(b))},viewport:function(b){!1===G.equals(b)&&(a.viewport(b.x,b.y,b.z,b.w),G.copy(b))},reset:function(){for(var b=0;b<n.length;b++)1===n[b]&&(a.disableVertexAttribArray(b),n[b]=0);u={},S=H=null,N={},C=T=w=null,v.reset(),p.reset(),r.reset()}}}function gg(a,b,c){function d(b){if("highp"===b){if(0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.HIGH_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT).precision)return"highp";b="mediump"}return"mediump"===b&&0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.MEDIUM_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.MEDIUM_FLOAT).precision?"mediump":"lowp"}var e,f=void 0!==c.precision?c.precision:"highp";(g=d(f))!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",g,"instead."),f=g),c=!0===c.logarithmicDepthBuffer&&!!b.get("EXT_frag_depth");var g=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),h=a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS),k=a.getParameter(a.MAX_TEXTURE_SIZE),m=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE),q=a.getParameter(a.MAX_VERTEX_ATTRIBS),v=a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS),p=a.getParameter(a.MAX_VARYING_VECTORS),r=a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS),l=0<h,t=!!b.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==e)return e;var c=b.get("EXT_texture_filter_anisotropic");return e=null!==c?a.getParameter(c.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:d,precision:f,logarithmicDepthBuffer:c,maxTextures:g,maxVertexTextures:h,maxTextureSize:k,maxCubemapSize:m,maxAttributes:q,maxVertexUniforms:v,maxVaryings:p,maxFragmentUniforms:r,vertexTextures:l,floatFragmentTextures:t,floatVertexTextures:l&&t}}function kd(a){qa.call(this),this.cameras=a||[]}function hg(a){var b=this,c=null,d=null;"VRFrameData"in window&&(d=new window.VRFrameData);var e=new K,f=new K,g=new K,h=new qa;h.bounds=new fa(0,0,.5,1),h.layers.enable(1);var k=new qa;k.bounds=new fa(.5,0,.5,1),k.layers.enable(2);var q,v,m=new kd([h,k]);m.layers.enable(1),m.layers.enable(2),window.addEventListener("vrdisplaypresentchange",function(){if(c.isPresenting){var e=(d=c.getEyeParameters("left")).renderWidth,d=d.renderHeight;v=a.getPixelRatio(),q=a.getSize(),a.setDrawingBufferSize(2*e,d,1)}else b.enabled&&a.setDrawingBufferSize(q.width,q.height,v)},!1),this.standing=this.enabled=!1,this.getDevice=function(){return c},this.setDevice=function(a){void 0!==a&&(c=a)},this.getCamera=function(a){if(null===c)return a;c.depthNear=a.near,c.depthFar=a.far,c.getFrameData(d);var b=d.pose;return null!==b.position?a.position.fromArray(b.position):a.position.set(0,0,0),null!==b.orientation&&a.quaternion.fromArray(b.orientation),a.updateMatrixWorld(),b=c.stageParameters,this.standing&&b&&(f.fromArray(b.sittingToStandingTransform),g.getInverse(f),a.matrixWorld.multiply(f),a.matrixWorldInverse.multiply(g)),!1===c.isPresenting?a:(m.matrixWorld.copy(a.matrixWorld),m.matrixWorldInverse.copy(a.matrixWorldInverse),h.matrixWorldInverse.fromArray(d.leftViewMatrix),k.matrixWorldInverse.fromArray(d.rightViewMatrix),this.standing&&b&&(h.matrixWorldInverse.multiply(g),k.matrixWorldInverse.multiply(g)),null!==(a=a.parent)&&(e.getInverse(a.matrixWorld),h.matrixWorldInverse.multiply(e),k.matrixWorldInverse.multiply(e)),h.matrixWorld.getInverse(h.matrixWorldInverse),k.matrixWorld.getInverse(k.matrixWorldInverse),h.projectionMatrix.fromArray(d.leftProjectionMatrix),k.projectionMatrix.fromArray(d.rightProjectionMatrix),m.projectionMatrix.copy(h.projectionMatrix),(a=c.getLayers()).length&&(null!==(a=a[0]).leftBounds&&4===a.leftBounds.length&&h.bounds.fromArray(a.leftBounds),null!==a.rightBounds&&4===a.rightBounds.length&&k.bounds.fromArray(a.rightBounds)),m)},this.getStandingMatrix=function(){return f},this.submitFrame=function(){c&&c.isPresenting&&c.submitFrame()}}function ig(a){var b={};return{get:function(c){if(void 0!==b[c])return b[c];var d;switch(c){case"WEBGL_depth_texture":d=a.getExtension("WEBGL_depth_texture")||a.getExtension("MOZ_WEBGL_depth_texture")||a.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":d=a.getExtension("WEBGL_compressed_texture_etc1");break;default:d=a.getExtension(c)}return null===d&&console.warn("THREE.WebGLRenderer: "+c+" extension not supported."),b[c]=d}}}function jg(){function a(){m.value!==d&&(m.value=d,m.needsUpdate=0<e),c.numPlanes=e,c.numIntersection=0}function b(a,b,d,e){var f=null!==a?a.length:0,g=null;if(0!==f){if(g=m.value,!0!==e||null===g)for(e=d+4*f,b=b.matrixWorldInverse,k.getNormalMatrix(b),(null===g||g.length<e)&&(g=new Float32Array(e)),e=0;e!==f;++e,d+=4)h.copy(a[e]).applyMatrix4(b,k),h.normal.toArray(g,d),g[d+3]=h.constant;m.value=g,m.needsUpdate=!0}return c.numPlanes=f,g}var c=this,d=null,e=0,f=!1,g=!1,h=new Aa,k=new Ba,m={value:null,needsUpdate:!1};this.uniform=m,this.numIntersection=this.numPlanes=0,this.init=function(a,c,g){var h=0!==a.length||c||0!==e||f;return f=c,d=b(a,g,0),e=a.length,h},this.beginShadows=function(){g=!0,b(null)},this.endShadows=function(){g=!1,a()},this.setState=function(c,h,k,r,l,t){if(!f||null===c||0===c.length||g&&!k)g?b(null):a();else{var n=4*(k=g?0:e),x=l.clippingState||null;for(m.value=x,x=b(c,r,n,t),c=0;c!==n;++c)x[c]=d[c];l.clippingState=x,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=k}}}function Xd(a){function b(){ga.init(),ga.scissor(J.copy(ea).multiplyScalar(Q)),ga.viewport(U.copy(hd).multiplyScalar(Q))}function c(){S=G=null,pa="",V=-1,ga.reset()}function d(a){a.preventDefault(),c(),b(),ha.clear(),xa.clear()}function e(a){(a=a.target).removeEventListener("dispose",e),f(a),ha.remove(a)}function f(a){var b=ha.get(a).program;(a.program=void 0)!==b&&va.releaseProgram(b)}function h(a,b){return Math.abs(b[0])-Math.abs(a[0])}function m(a,b,c,d){for(var e=0,f=a.length;e<f;e++){var h=(g=a[e]).object,k=g.geometry,m=void 0===d?g.material:d,g=g.group;if(c.isArrayCamera)for(var p=(N=c).cameras,v=0,r=p.length;v<r;v++){var l=p[v];if(h.layers.test(l.layers)){var n=(t=l.bounds).x*ba,ca=t.y*L,u=t.z*ba,t=t.w*L;B.setViewport(n,ca,u,t),B.setScissor(n,ca,u,t),B.setScissorTest(!0),q(h,b,l,k,m,g)}}else N=null,q(h,b,c,k,m,g)}}function q(a,b,c,d,e,f){if(a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld),a.normalMatrix.getNormalMatrix(a.modelViewMatrix),a.onBeforeRender(B,b,c,d,e,f),a.isImmediateRenderObject){ga.setMaterial(e);var h=p(c,b.fog,e,a);pa="",function(a,b,c){a.render(function(a){B.renderBufferImmediate(a,b,c)})}(a,h,e)}else B.renderBufferDirect(c,b.fog,d,e,a,f);a.onAfterRender(B,b,c,d,e,f)}function v(a,b,c){var d=ha.get(a);c=va.getParameters(a,da,b,Ha.numPlanes,Ha.numIntersection,c);var g=va.getProgramCode(a,c),h=d.program,k=!0;if(void 0===h)a.addEventListener("dispose",e);else if(h.code!==g)f(a);else{if(void 0!==c.shaderID)return;k=!1}if(k&&(c.shaderID?(h=$a[c.shaderID],d.shader={name:a.type,uniforms:Ca.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}):d.shader={name:a.type,uniforms:a.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader},a.onBeforeCompile(d.shader),h=va.acquireProgram(a,d.shader,c,g),d.program=h,a.program=h),c=h.getAttributes(),a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<B.maxMorphTargets;g++)0<=c["morphTarget"+g]&&a.numSupportedMorphTargets++;if(a.morphNormals)for(g=a.numSupportedMorphNormals=0;g<B.maxMorphNormals;g++)0<=c["morphNormal"+g]&&a.numSupportedMorphNormals++;c=d.shader.uniforms,(a.isShaderMaterial||a.isRawShaderMaterial)&&!0!==a.clipping||(d.numClippingPlanes=Ha.numPlanes,d.numIntersection=Ha.numIntersection,c.clippingPlanes=Ha.uniform),d.fog=b,d.lightsHash=da.hash,a.lights&&(c.ambientLightColor.value=da.ambient,c.directionalLights.value=da.directional,c.spotLights.value=da.spot,c.rectAreaLights.value=da.rectArea,c.pointLights.value=da.point,c.hemisphereLights.value=da.hemi,c.directionalShadowMap.value=da.directionalShadowMap,c.directionalShadowMatrix.value=da.directionalShadowMatrix,c.spotShadowMap.value=da.spotShadowMap,c.spotShadowMatrix.value=da.spotShadowMatrix,c.pointShadowMap.value=da.pointShadowMap,c.pointShadowMatrix.value=da.pointShadowMatrix),a=d.program.getUniforms(),a=eb.seqWithValue(a.seq,c),d.uniformsList=a}function p(a,b,c,d){X=0;var e=ha.get(c);id&&(Wd||a!==S)&&Ha.setState(c.clippingPlanes,c.clipIntersection,c.clipShadows,a,e,a===S&&c.id===V),!1===c.needsUpdate&&(void 0===e.program?c.needsUpdate=!0:c.fog&&e.fog!==b?c.needsUpdate=!0:c.lights&&e.lightsHash!==da.hash?c.needsUpdate=!0:void 0===e.numClippingPlanes||e.numClippingPlanes===Ha.numPlanes&&e.numIntersection===Ha.numIntersection||(c.needsUpdate=!0)),c.needsUpdate&&(v(c,b,d),c.needsUpdate=!1);var f=!1,g=!1,h=!1,k=e.program,m=k.getUniforms(),q=e.shader.uniforms;if(k.id!==G&&(A.useProgram(k.program),G=k.id,h=g=f=!0),c.id!==V&&(V=c.id,g=!0),(f||a!==S)&&(m.setValue(A,"projectionMatrix",a.projectionMatrix),ia.logarithmicDepthBuffer&&m.setValue(A,"logDepthBufFC",2/(Math.log(a.far+1)/Math.LN2)),S!==(N||a)&&(S=N||a,h=g=!0),(c.isShaderMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.envMap)&&(void 0!==(f=m.map.cameraPosition)&&f.setValue(A,Oa.setFromMatrixPosition(a.matrixWorld))),(c.isMeshPhongMaterial||c.isMeshLambertMaterial||c.isMeshBasicMaterial||c.isMeshStandardMaterial||c.isShaderMaterial||c.skinning)&&m.setValue(A,"viewMatrix",a.matrixWorldInverse)),c.skinning&&(m.setOptional(A,d,"bindMatrix"),m.setOptional(A,d,"bindMatrixInverse"),a=d.skeleton))if(f=a.bones,ia.floatVertexTextures){if(void 0===a.boneTexture){f=Math.sqrt(4*f.length),f=Y.nextPowerOfTwo(Math.ceil(f)),f=Math.max(f,4);var p=new Float32Array(f*f*4);p.set(a.boneMatrices);var t=new db(p,f,f,1023,1015);a.boneMatrices=p,a.boneTexture=t,a.boneTextureSize=f}m.setValue(A,"boneTexture",a.boneTexture),m.setValue(A,"boneTextureSize",a.boneTextureSize)}else m.setOptional(A,a,"boneMatrices");if(g){var n;if(m.setValue(A,"toneMappingExposure",B.toneMappingExposure),m.setValue(A,"toneMappingWhitePoint",B.toneMappingWhitePoint),c.lights&&(g=h,q.ambientLightColor.needsUpdate=g,q.directionalLights.needsUpdate=g,q.pointLights.needsUpdate=g,q.spotLights.needsUpdate=g,q.rectAreaLights.needsUpdate=g,q.hemisphereLights.needsUpdate=g),b&&c.fog&&(q.fogColor.value=b.color,b.isFog?(q.fogNear.value=b.near,q.fogFar.value=b.far):b.isFogExp2&&(q.fogDensity.value=b.density)),c.isMeshBasicMaterial||c.isMeshLambertMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.isMeshNormalMaterial||c.isMeshDepthMaterial)q.opacity.value=c.opacity,q.diffuse.value=c.color,c.emissive&&q.emissive.value.copy(c.emissive).multiplyScalar(c.emissiveIntensity),q.map.value=c.map,q.specularMap.value=c.specularMap,q.alphaMap.value=c.alphaMap,c.lightMap&&(q.lightMap.value=c.lightMap,q.lightMapIntensity.value=c.lightMapIntensity),c.aoMap&&(q.aoMap.value=c.aoMap,q.aoMapIntensity.value=c.aoMapIntensity),c.map?n=c.map:c.specularMap?n=c.specularMap:c.displacementMap?n=c.displacementMap:c.normalMap?n=c.normalMap:c.bumpMap?n=c.bumpMap:c.roughnessMap?n=c.roughnessMap:c.metalnessMap?n=c.metalnessMap:c.alphaMap?n=c.alphaMap:c.emissiveMap&&(n=c.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),b=n.offset,n=n.repeat,q.offsetRepeat.value.set(b.x,b.y,n.x,n.y)),q.envMap.value=c.envMap,q.flipEnvMap.value=c.envMap&&c.envMap.isCubeTexture?-1:1,q.reflectivity.value=c.reflectivity,q.refractionRatio.value=c.refractionRatio;c.isLineBasicMaterial?(q.diffuse.value=c.color,q.opacity.value=c.opacity):c.isLineDashedMaterial?(q.diffuse.value=c.color,q.opacity.value=c.opacity,q.dashSize.value=c.dashSize,q.totalSize.value=c.dashSize+c.gapSize,q.scale.value=c.scale):c.isPointsMaterial?(q.diffuse.value=c.color,q.opacity.value=c.opacity,q.size.value=c.size*Q,q.scale.value=.5*L,q.map.value=c.map,null!==c.map&&(n=c.map.offset,c=c.map.repeat,q.offsetRepeat.value.set(n.x,n.y,c.x,c.y))):c.isMeshLambertMaterial?c.emissiveMap&&(q.emissiveMap.value=c.emissiveMap):c.isMeshToonMaterial?(r(q,c),c.gradientMap&&(q.gradientMap.value=c.gradientMap)):c.isMeshPhongMaterial?r(q,c):c.isMeshPhysicalMaterial?(q.clearCoat.value=c.clearCoat,q.clearCoatRoughness.value=c.clearCoatRoughness,l(q,c)):c.isMeshStandardMaterial?l(q,c):c.isMeshDepthMaterial?c.displacementMap&&(q.displacementMap.value=c.displacementMap,q.displacementScale.value=c.displacementScale,q.displacementBias.value=c.displacementBias):c.isMeshNormalMaterial&&(c.bumpMap&&(q.bumpMap.value=c.bumpMap,q.bumpScale.value=c.bumpScale),c.normalMap&&(q.normalMap.value=c.normalMap,q.normalScale.value.copy(c.normalScale)),c.displacementMap&&(q.displacementMap.value=c.displacementMap,q.displacementScale.value=c.displacementScale,q.displacementBias.value=c.displacementBias)),void 0!==q.ltcMat&&(q.ltcMat.value=R.LTC_MAT_TEXTURE),void 0!==q.ltcMag&&(q.ltcMag.value=R.LTC_MAG_TEXTURE),eb.upload(A,e.uniformsList,q,B)}return m.setValue(A,"modelViewMatrix",d.modelViewMatrix),m.setValue(A,"normalMatrix",d.normalMatrix),m.setValue(A,"modelMatrix",d.matrixWorld),k}function r(a,b){a.specular.value=b.specular,a.shininess.value=Math.max(b.shininess,1e-4),b.emissiveMap&&(a.emissiveMap.value=b.emissiveMap),b.bumpMap&&(a.bumpMap.value=b.bumpMap,a.bumpScale.value=b.bumpScale),b.normalMap&&(a.normalMap.value=b.normalMap,a.normalScale.value.copy(b.normalScale)),b.displacementMap&&(a.displacementMap.value=b.displacementMap,a.displacementScale.value=b.displacementScale,a.displacementBias.value=b.displacementBias)}function l(a,b){a.roughness.value=b.roughness,a.metalness.value=b.metalness,b.roughnessMap&&(a.roughnessMap.value=b.roughnessMap),b.metalnessMap&&(a.metalnessMap.value=b.metalnessMap),b.emissiveMap&&(a.emissiveMap.value=b.emissiveMap),b.bumpMap&&(a.bumpMap.value=b.bumpMap,a.bumpScale.value=b.bumpScale),b.normalMap&&(a.normalMap.value=b.normalMap,a.normalScale.value.copy(b.normalScale)),b.displacementMap&&(a.displacementMap.value=b.displacementMap,a.displacementScale.value=b.displacementScale,a.displacementBias.value=b.displacementBias),b.envMap&&(a.envMapIntensity.value=b.envMapIntensity)}function t(a,b){var c,d,e,f,m,q,p,g=0,h=0,k=0,v=b.matrixWorldInverse,r=0,l=0,n=0,t=0,ca=0;for(c=0,d=a.length;c<d;c++)if(f=(e=a[c]).color,m=e.intensity,q=e.distance,p=e.shadow&&e.shadow.map?e.shadow.map.texture:null,e.isAmbientLight)g+=f.r*m,h+=f.g*m,k+=f.b*m;else if(e.isDirectionalLight){var u=wa.get(e);u.color.copy(e.color).multiplyScalar(e.intensity),u.direction.setFromMatrixPosition(e.matrixWorld),Oa.setFromMatrixPosition(e.target.matrixWorld),u.direction.sub(Oa),u.direction.transformDirection(v),(u.shadow=e.castShadow)&&(f=e.shadow,u.shadowBias=f.bias,u.shadowRadius=f.radius,u.shadowMapSize=f.mapSize),da.directionalShadowMap[r]=p,da.directionalShadowMatrix[r]=e.shadow.matrix,da.directional[r]=u,r++}else e.isSpotLight?((u=wa.get(e)).position.setFromMatrixPosition(e.matrixWorld),u.position.applyMatrix4(v),u.color.copy(f).multiplyScalar(m),u.distance=q,u.direction.setFromMatrixPosition(e.matrixWorld),Oa.setFromMatrixPosition(e.target.matrixWorld),u.direction.sub(Oa),u.direction.transformDirection(v),u.coneCos=Math.cos(e.angle),u.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),u.decay=0===e.distance?0:e.decay,(u.shadow=e.castShadow)&&(f=e.shadow,u.shadowBias=f.bias,u.shadowRadius=f.radius,u.shadowMapSize=f.mapSize),da.spotShadowMap[n]=p,da.spotShadowMatrix[n]=e.shadow.matrix,da.spot[n]=u,n++):e.isRectAreaLight?((u=wa.get(e)).color.copy(f).multiplyScalar(m/(e.width*e.height)),u.position.setFromMatrixPosition(e.matrixWorld),u.position.applyMatrix4(v),oa.identity(),qa.copy(e.matrixWorld),qa.premultiply(v),oa.extractRotation(qa),u.halfWidth.set(.5*e.width,0,0),u.halfHeight.set(0,.5*e.height,0),u.halfWidth.applyMatrix4(oa),u.halfHeight.applyMatrix4(oa),da.rectArea[t]=u,t++):e.isPointLight?((u=wa.get(e)).position.setFromMatrixPosition(e.matrixWorld),u.position.applyMatrix4(v),u.color.copy(e.color).multiplyScalar(e.intensity),u.distance=e.distance,u.decay=0===e.distance?0:e.decay,(u.shadow=e.castShadow)&&(f=e.shadow,u.shadowBias=f.bias,u.shadowRadius=f.radius,u.shadowMapSize=f.mapSize),da.pointShadowMap[l]=p,da.pointShadowMatrix[l]=e.shadow.matrix,da.point[l]=u,l++):e.isHemisphereLight&&((u=wa.get(e)).direction.setFromMatrixPosition(e.matrixWorld),u.direction.transformDirection(v),u.direction.normalize(),u.skyColor.copy(e.color).multiplyScalar(m),u.groundColor.copy(e.groundColor).multiplyScalar(m),da.hemi[ca]=u,ca++);da.ambient[0]=g,da.ambient[1]=h,da.ambient[2]=k,da.directional.length=r,da.spot.length=n,da.rectArea.length=t,da.point.length=l,da.hemi.length=ca,da.hash=r+","+l+","+n+","+t+","+ca+","+da.shadows.length}function y(a){var b;if(1e3===a)return A.REPEAT;if(1001===a)return A.CLAMP_TO_EDGE;if(1002===a)return A.MIRRORED_REPEAT;if(1003===a)return A.NEAREST;if(1004===a)return A.NEAREST_MIPMAP_NEAREST;if(1005===a)return A.NEAREST_MIPMAP_LINEAR;if(1006===a)return A.LINEAR;if(1007===a)return A.LINEAR_MIPMAP_NEAREST;if(1008===a)return A.LINEAR_MIPMAP_LINEAR;if(1009===a)return A.UNSIGNED_BYTE;if(1017===a)return A.UNSIGNED_SHORT_4_4_4_4;if(1018===a)return A.UNSIGNED_SHORT_5_5_5_1;if(1019===a)return A.UNSIGNED_SHORT_5_6_5;if(1010===a)return A.BYTE;if(1011===a)return A.SHORT;if(1012===a)return A.UNSIGNED_SHORT;if(1013===a)return A.INT;if(1014===a)return A.UNSIGNED_INT;if(1015===a)return A.FLOAT;if(1016===a&&null!==(b=ma.get("OES_texture_half_float")))return b.HALF_FLOAT_OES;if(1021===a)return A.ALPHA;if(1022===a)return A.RGB;if(1023===a)return A.RGBA;if(1024===a)return A.LUMINANCE;if(1025===a)return A.LUMINANCE_ALPHA;if(1026===a)return A.DEPTH_COMPONENT;if(1027===a)return A.DEPTH_STENCIL;if(100===a)return A.FUNC_ADD;if(101===a)return A.FUNC_SUBTRACT;if(102===a)return A.FUNC_REVERSE_SUBTRACT;if(200===a)return A.ZERO;if(201===a)return A.ONE;if(202===a)return A.SRC_COLOR;if(203===a)return A.ONE_MINUS_SRC_COLOR;if(204===a)return A.SRC_ALPHA;if(205===a)return A.ONE_MINUS_SRC_ALPHA;if(206===a)return A.DST_ALPHA;if(207===a)return A.ONE_MINUS_DST_ALPHA;if(208===a)return A.DST_COLOR;if(209===a)return A.ONE_MINUS_DST_COLOR;if(210===a)return A.SRC_ALPHA_SATURATE;if((2001===a||2002===a||2003===a||2004===a)&&null!==(b=ma.get("WEBGL_compressed_texture_s3tc"))){if(2001===a)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(2002===a)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(2003===a)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(2004===a)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((2100===a||2101===a||2102===a||2103===a)&&null!==(b=ma.get("WEBGL_compressed_texture_pvrtc"))){if(2100===a)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(2101===a)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(2102===a)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(2103===a)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(2151===a&&null!==(b=ma.get("WEBGL_compressed_texture_etc1")))return b.COMPRESSED_RGB_ETC1_WEBGL;if((103===a||104===a)&&null!==(b=ma.get("EXT_blend_minmax"))){if(103===a)return b.MIN_EXT;if(104===a)return b.MAX_EXT}return 1020===a&&null!==(b=ma.get("WEBGL_depth_texture"))?b.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer","86");var x=void 0!==(a=a||{}).canvas?a.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),u=void 0!==a.context?a.context:null,H=void 0!==a.alpha&&a.alpha,w=void 0===a.depth||a.depth,I=void 0===a.stencil||a.stencil,W=void 0!==a.antialias&&a.antialias,D=void 0===a.premultipliedAlpha||a.premultipliedAlpha,O=void 0!==a.preserveDrawingBuffer&&a.preserveDrawingBuffer,aa=[],F=null,ja=new Float32Array(8),C=[],z=[];this.domElement=x,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1,this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var A,B=this,G=null,P=null,M=null,V=-1,pa="",S=null,N=null,J=new fa,Z=null,U=new fa,X=0,ba=x.width,L=x.height,Q=1,ea=new fa(0,0,ba,L),na=!1,hd=new fa(0,0,ba,L),Vd=new gd,Ha=new jg,id=!1,Wd=!1,jd=new K,Oa=new n,qa=new K,oa=new K,da={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},ta={geometries:0,textures:0},la={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:la,memory:ta,programs:null};try{if(H={alpha:H,depth:w,stencil:I,antialias:W,premultipliedAlpha:D,preserveDrawingBuffer:O},null===(A=u||x.getContext("webgl",H)||x.getContext("experimental-webgl",H))){if(null!==x.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}void 0===A.getShaderPrecisionFormat&&(A.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),x.addEventListener("webglcontextlost",d,!1)}catch(kg){console.error("THREE.WebGLRenderer: "+kg)}var ma=new ig(A);ma.get("WEBGL_depth_texture"),ma.get("OES_texture_float"),ma.get("OES_texture_float_linear"),ma.get("OES_texture_half_float"),ma.get("OES_texture_half_float_linear"),ma.get("OES_standard_derivatives"),ma.get("ANGLE_instanced_arrays"),ma.get("OES_element_index_uint")&&(E.MaxIndex=4294967296);var ia=new gg(A,ma,a),ga=new fg(A,ma,y),ha=new eg,ra=new dg(A,ma,ga,ha,ia,y,ta),ua=new Kf(A),za=new Tf(A,ua,ta),xa=new Vf(A,za,la),va=new cg(this,ia),wa=new Uf,Aa=new Qf,ya=new Mf(this,ga,xa,D),sa=new hg(this);this.info.programs=va.programs;var Da=new Sf(A,ma,la),Ea=new Rf(A,ma,la);b(),this.context=A,this.capabilities=ia,this.extensions=ma,this.properties=ha,this.renderLists=Aa,this.state=ga,this.vr=sa;var Ba=new Ie(this,da,xa,ia);this.shadowMap=Ba;var Fa=new If(this,C),Ga=new Hf(this,z);this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){var a=ma.get("WEBGL_lose_context");a&&a.loseContext()},this.getMaxAnisotropy=function(){return ia.getMaxAnisotropy()},this.getPrecision=function(){return ia.precision},this.getPixelRatio=function(){return Q},this.setPixelRatio=function(a){void 0!==a&&(Q=a,this.setSize(ba,L,!1))},this.getSize=function(){return{width:ba,height:L}},this.setSize=function(a,b,c){var d=sa.getDevice();d&&d.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(ba=a,L=b,x.width=a*Q,x.height=b*Q,!1!==c&&(x.style.width=a+"px",x.style.height=b+"px"),this.setViewport(0,0,a,b))},this.getDrawingBufferSize=function(){return{width:ba*Q,height:L*Q}},this.setDrawingBufferSize=function(a,b,c){ba=a,L=b,Q=c,x.width=a*c,x.height=b*c,this.setViewport(0,0,a,b)},this.setViewport=function(a,b,c,d){hd.set(a,L-b-d,c,d),ga.viewport(U.copy(hd).multiplyScalar(Q))},this.setScissor=function(a,b,c,d){ea.set(a,L-b-d,c,d),ga.scissor(J.copy(ea).multiplyScalar(Q))},this.setScissorTest=function(a){ga.setScissorTest(na=a)},this.getClearColor=ya.getClearColor,this.setClearColor=ya.setClearColor,this.getClearAlpha=ya.getClearAlpha,this.setClearAlpha=ya.setClearAlpha,this.clear=function(a,b,c){var d=0;(void 0===a||a)&&(d|=A.COLOR_BUFFER_BIT),(void 0===b||b)&&(d|=A.DEPTH_BUFFER_BIT),(void 0===c||c)&&(d|=A.STENCIL_BUFFER_BIT),A.clear(d)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(a,b,c,d){this.setRenderTarget(a),this.clear(b,c,d)},this.resetGLState=c,this.dispose=function(){x.removeEventListener("webglcontextlost",d,!1),Aa.dispose()},this.renderBufferImmediate=function(a,b,c){ga.initAttributes();var d=ha.get(a);if(a.hasPositions&&!d.position&&(d.position=A.createBuffer()),a.hasNormals&&!d.normal&&(d.normal=A.createBuffer()),a.hasUvs&&!d.uv&&(d.uv=A.createBuffer()),a.hasColors&&!d.color&&(d.color=A.createBuffer()),b=b.getAttributes(),a.hasPositions&&(A.bindBuffer(A.ARRAY_BUFFER,d.position),A.bufferData(A.ARRAY_BUFFER,a.positionArray,A.DYNAMIC_DRAW),ga.enableAttribute(b.position),A.vertexAttribPointer(b.position,3,A.FLOAT,!1,0,0)),a.hasNormals){if(A.bindBuffer(A.ARRAY_BUFFER,d.normal),!c.isMeshPhongMaterial&&!c.isMeshStandardMaterial&&!c.isMeshNormalMaterial&&1===c.shading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,k=(g[e+1]+g[e+4]+g[e+7])/3,m=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=h,g[e+1]=k,g[e+2]=m,g[e+3]=h,g[e+4]=k,g[e+5]=m,g[e+6]=h,g[e+7]=k,g[e+8]=m}A.bufferData(A.ARRAY_BUFFER,a.normalArray,A.DYNAMIC_DRAW),ga.enableAttribute(b.normal),A.vertexAttribPointer(b.normal,3,A.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(A.bindBuffer(A.ARRAY_BUFFER,d.uv),A.bufferData(A.ARRAY_BUFFER,a.uvArray,A.DYNAMIC_DRAW),ga.enableAttribute(b.uv),A.vertexAttribPointer(ua.uv,2,A.FLOAT,!1,0,0)),a.hasColors&&0!==c.vertexColors&&(A.bindBuffer(A.ARRAY_BUFFER,d.color),A.bufferData(A.ARRAY_BUFFER,a.colorArray,A.DYNAMIC_DRAW),ga.enableAttribute(b.color),A.vertexAttribPointer(b.color,3,A.FLOAT,!1,0,0)),ga.disableUnusedAttributes(),A.drawArrays(A.TRIANGLES,0,a.count),a.count=0},this.renderBufferDirect=function(a,b,c,d,e,f){ga.setMaterial(d);var r,g=p(a,b,d,e),k=!1;if((a=c.id+"_"+g.id+"_"+(!0===d.wireframe))!==pa&&(pa=a,k=!0),void 0!==(b=e.morphTargetInfluences)){var m=[];a=0;for(var q=b.length;a<q;a++)k=b[a],m.push([k,a]);m.sort(h),8<m.length&&(m.length=8);var v=c.morphAttributes;for(a=0,q=m.length;a<q;a++)k=m[a],ja[a]=k[0],0!==k[0]?(b=k[1],!0===d.morphTargets&&v.position&&c.addAttribute("morphTarget"+a,v.position[b]),!0===d.morphNormals&&v.normal&&c.addAttribute("morphNormal"+a,v.normal[b])):(!0===d.morphTargets&&c.removeAttribute("morphTarget"+a),!0===d.morphNormals&&c.removeAttribute("morphNormal"+a));for(a=m.length,b=ja.length;a<b;a++)ja[a]=0;g.getUniforms().setValue(A,"morphTargetInfluences",ja),k=!0}if(b=c.index,q=c.attributes.position,m=1,!0===d.wireframe&&(b=za.getWireframeAttribute(c),m=2),a=Da,null!==b&&(r=ua.get(b),(a=Ea).setIndex(r)),k){if(k=void 0,c&&c.isInstancedBufferGeometry&&null===ma.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===k&&(k=0),ga.initAttributes();v=c.attributes,g=g.getAttributes();var n,l=d.defaultAttributeValues;for(n in g){var t=g[n];if(0<=t)if(void 0!==(u=v[n])){var ca=u.normalized,w=u.itemSize,y=(x=ua.get(u)).buffer,H=x.type,x=x.bytesPerElement;if(u.isInterleavedBufferAttribute){var I=u.data,D=I.stride,u=u.offset;I&&I.isInstancedInterleavedBuffer?(ga.enableAttributeAndDivisor(t,I.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=I.meshPerAttribute*I.count)):ga.enableAttribute(t),A.bindBuffer(A.ARRAY_BUFFER,y),A.vertexAttribPointer(t,w,H,ca,D*x,(k*D+u)*x)}else u.isInstancedBufferAttribute?(ga.enableAttributeAndDivisor(t,u.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=u.meshPerAttribute*u.count)):ga.enableAttribute(t),A.bindBuffer(A.ARRAY_BUFFER,y),A.vertexAttribPointer(t,w,H,ca,0,k*w*x)}else if(void 0!==l&&void 0!==(ca=l[n]))switch(ca.length){case 2:A.vertexAttrib2fv(t,ca);break;case 3:A.vertexAttrib3fv(t,ca);break;case 4:A.vertexAttrib4fv(t,ca);break;default:A.vertexAttrib1fv(t,ca)}}ga.disableUnusedAttributes()}null!==b&&A.bindBuffer(A.ELEMENT_ARRAY_BUFFER,r.buffer)}if(r=0,null!==b?r=b.count:void 0!==q&&(r=q.count),b=c.drawRange.start*m,q=null!==f?f.start*m:0,n=Math.max(b,q),0!==(f=Math.max(0,Math.min(r,b+c.drawRange.count*m,q+(null!==f?f.count*m:1/0))-1-n+1))){if(e.isMesh)if(!0===d.wireframe)ga.setLineWidth(d.wireframeLinewidth*(null===P?Q:1)),a.setMode(A.LINES);else switch(e.drawMode){case 0:a.setMode(A.TRIANGLES);break;case 1:a.setMode(A.TRIANGLE_STRIP);break;case 2:a.setMode(A.TRIANGLE_FAN)}else e.isLine?(void 0===(d=d.linewidth)&&(d=1),ga.setLineWidth(d*(null===P?Q:1)),e.isLineSegments?a.setMode(A.LINES):e.isLineLoop?a.setMode(A.LINE_LOOP):a.setMode(A.LINE_STRIP)):e.isPoints&&a.setMode(A.POINTS);c&&c.isInstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,n,f):a.render(n,f)}},this.compile=function(a,b){aa=[],a.traverse(function(a){a.isLight&&aa.push(a)}),t(aa,b),a.traverse(function(b){if(b.material)if(Array.isArray(b.material))for(var c=0;c<b.material.length;c++)v(b.material[c],a.fog,b);else v(b.material,a.fog,b)})},this.animate=function(a){(sa.getDevice()||window).requestAnimationFrame(function b(){a(),(sa.getDevice()||window).requestAnimationFrame(b)})},this.render=function(a,b,c,d){if(b&&b.isCamera){pa="",V=-1,!(S=null)===a.autoUpdate&&a.updateMatrixWorld(),null===b.parent&&b.updateMatrixWorld(),sa.enabled&&(b=sa.getCamera(b)),jd.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),Vd.setFromMatrix(jd),aa.length=0,C.length=0,z.length=0,Wd=this.localClippingEnabled,id=Ha.init(this.clippingPlanes,Wd,b),(F=Aa.get(a,b)).init(),function k(a,b,c){if(a.visible){if(a.layers.test(b.layers))if(a.isLight)aa.push(a);else if(a.isSprite)a.frustumCulled&&!Vd.intersectsSprite(a)||C.push(a);else if(a.isLensFlare)z.push(a);else if(a.isImmediateRenderObject)c&&Oa.setFromMatrixPosition(a.matrixWorld).applyMatrix4(jd),F.push(a,null,a.material,Oa.z,null);else if((a.isMesh||a.isLine||a.isPoints)&&(a.isSkinnedMesh&&a.skeleton.update(),!a.frustumCulled||Vd.intersectsObject(a))){c&&Oa.setFromMatrixPosition(a.matrixWorld).applyMatrix4(jd);var d=xa.update(a),e=a.material;if(Array.isArray(e))for(var f=d.groups,g=0,h=f.length;g<h;g++){var m=f[g],q=e[m.materialIndex];q&&q.visible&&F.push(a,d,q,Oa.z,m)}else e.visible&&F.push(a,d,e,Oa.z,null)}for(g=0,h=(a=a.children).length;g<h;g++)k(a[g],b,c)}}(a,b,B.sortObjects),F.finish(),!0===B.sortObjects&&F.sort(),id&&Ha.beginShadows();for(var e=aa,f=0,g=0,h=e.length;g<h;g++){var q=e[g];q.castShadow&&(da.shadows[f]=q,f++)}da.shadows.length=f,Ba.render(a,b),t(aa,b),id&&Ha.endShadows(),la.frame++,la.calls=0,la.vertices=0,la.faces=0,void(la.points=0)===c&&(c=null),this.setRenderTarget(c),ya.render(a,b,d),d=F.opaque,e=F.transparent,a.overrideMaterial?(f=a.overrideMaterial,d.length&&m(d,a,b,f),e.length&&m(e,a,b,f)):(d.length&&m(d,a,b),e.length&&m(e,a,b)),Fa.render(a,b),Ga.render(a,b,U),c&&ra.updateRenderTargetMipmap(c),ga.buffers.depth.setTest(!0),ga.buffers.depth.setMask(!0),ga.buffers.color.setMask(!0),b.isArrayCamera&&B.setScissorTest(!1),sa.enabled&&sa.submitFrame()}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(a,b){ga.setCullFace(a),ga.setFlipSided(0===b)},this.allocTextureUnit=function(){var a=X;return a>=ia.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+a+" texture units while this GPU supports only "+ia.maxTextures),X+=1,a},this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),a=!0),b=b.texture),ra.setTexture2D(b,c)}}(),this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0),ra.setTexture2D(b,c)}}(),this.setTextureCube=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture),b&&b.isCubeTexture||Array.isArray(b.image)&&6===b.image.length?ra.setTextureCube(b,c):ra.setTextureCubeDynamic(b,c)}}(),this.getRenderTarget=function(){return P},this.setRenderTarget=function(a){(P=a)&&void 0===ha.get(a).__webglFramebuffer&&ra.setupRenderTarget(a);var c,b=a&&a.isWebGLRenderTargetCube;a?(c=ha.get(a),c=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,J.copy(a.scissor),Z=a.scissorTest,U.copy(a.viewport)):(c=null,J.copy(ea).multiplyScalar(Q),Z=na,U.copy(hd).multiplyScalar(Q)),M!==c&&(A.bindFramebuffer(A.FRAMEBUFFER,c),M=c),ga.scissor(J),ga.setScissorTest(Z),ga.viewport(U),b&&(b=ha.get(a.texture),A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,b.__webglTexture,a.activeMipMapLevel))},this.readRenderTargetPixels=function(a,b,c,d,e,f){if(a&&a.isWebGLRenderTarget){var g=ha.get(a).__webglFramebuffer;if(g){var h=!1;g!==M&&(A.bindFramebuffer(A.FRAMEBUFFER,g),h=!0);try{var k=a.texture,m=k.format,q=k.type;1023!==m&&y(m)!==A.getParameter(A.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===q||y(q)===A.getParameter(A.IMPLEMENTATION_COLOR_READ_TYPE)||1015===q&&(ma.get("OES_texture_float")||ma.get("WEBGL_color_buffer_float"))||1016===q&&ma.get("EXT_color_buffer_half_float")?A.checkFramebufferStatus(A.FRAMEBUFFER)===A.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&A.readPixels(b,c,d,e,y(m),y(q),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&A.bindFramebuffer(A.FRAMEBUFFER,M)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function Ib(a,b){this.name="",this.color=new G(a),this.density=void 0!==b?b:25e-5}function Jb(a,b,c){this.name="",this.color=new G(a),this.near=void 0!==b?b:1,this.far=void 0!==c?c:1e3}function ld(){z.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function Yd(a,b,c,d,e){z.call(this),this.lensFlares=[],this.positionScreen=new n,(this.customUpdateCallback=void 0)!==a&&this.add(a,b,c,d,e)}function bb(a){U.call(this),this.type="SpriteMaterial",this.color=new G(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(a)}function xc(a){z.call(this),this.type="Sprite",this.material=void 0!==a?a:new bb}function yc(){z.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function zc(a,b){if(a=a||[],this.bones=a.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var c=0,d=this.bones.length;c<d;c++)this.boneInverses.push(new K)}}function md(){z.call(this),this.type="Bone"}function nd(a,b){la.call(this,a,b),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new K,this.bindMatrixInverse=new K;var c=new zc(c=this.initBones());this.bind(c,this.matrixWorld),this.normalizeSkinWeights()}function ea(a){U.call(this),this.type="LineBasicMaterial",this.color=new G(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.lights=!1,this.setValues(a)}function sa(a,b,c){if(1===c)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Q(a,b);z.call(this),this.type="Line",this.geometry=void 0!==a?a:new E,this.material=void 0!==b?b:new ea({color:16777215*Math.random()})}function Q(a,b){sa.call(this,a,b),this.type="LineSegments"}function od(a,b){sa.call(this,a,b),this.type="LineLoop"}function Fa(a){U.call(this),this.type="PointsMaterial",this.color=new G(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(a)}function Kb(a,b){z.call(this),this.type="Points",this.geometry=void 0!==a?a:new E,this.material=void 0!==b?b:new Fa({color:16777215*Math.random()})}function Ac(){z.call(this),this.type="Group"}function pd(a,b,c,d,e,f,g,h,k){ba.call(this,a,b,c,d,e,f,g,h,k),this.generateMipmaps=!1;var q=this;!function m(){requestAnimationFrame(m),a.readyState>=a.HAVE_CURRENT_DATA&&(q.needsUpdate=!0)}()}function Lb(a,b,c,d,e,f,g,h,k,m,q,v){ba.call(this,null,f,g,h,k,m,d,e,q,v),this.image={width:b,height:c},this.mipmaps=a,this.generateMipmaps=this.flipY=!1}function qd(a,b,c,d,e,f,g,h,k){ba.call(this,a,b,c,d,e,f,g,h,k),this.needsUpdate=!0}function Bc(a,b,c,d,e,f,g,h,k,m){if(1026!==(m=void 0!==m?m:1026)&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012),void 0===c&&1027===m&&(c=1020),ba.call(this,null,d,e,f,g,h,m,c,k),this.image={width:a,height:b},this.magFilter=void 0!==g?g:1003,this.minFilter=void 0!==h?h:1003,this.generateMipmaps=this.flipY=!1}function Mb(a){E.call(this),this.type="WireframeGeometry";var c,d,e,f,k,m,b=[],g=[0,0],h={},q=["a","b","c"];if(a&&a.isGeometry){var v=a.faces;for(c=0,e=v.length;c<e;c++){var p=v[c];for(d=0;d<3;d++)k=p[q[d]],m=p[q[(d+1)%3]],g[0]=Math.min(k,m),g[1]=Math.max(k,m),void 0===h[k=g[0]+","+g[1]]&&(h[k]={index1:g[0],index2:g[1]})}for(k in h)c=h[k],q=a.vertices[c.index1],b.push(q.x,q.y,q.z),q=a.vertices[c.index2],b.push(q.x,q.y,q.z)}else if(a&&a.isBufferGeometry){var r;q=new n;if(null!==a.index){for(v=a.attributes.position,p=a.index,0===(r=a.groups).length&&(r=[{start:0,count:p.count,materialIndex:0}]),a=0,f=r.length;a<f;++a)for(d=(c=r[a]).start,e=c.count,e=(c=d)+e;c<e;c+=3)for(d=0;d<3;d++)k=p.getX(c+d),m=p.getX(c+(d+1)%3),g[0]=Math.min(k,m),g[1]=Math.max(k,m),void 0===h[k=g[0]+","+g[1]]&&(h[k]={index1:g[0],index2:g[1]});for(k in h)c=h[k],q.fromBufferAttribute(v,c.index1),b.push(q.x,q.y,q.z),q.fromBufferAttribute(v,c.index2),b.push(q.x,q.y,q.z)}else for(c=0,e=(v=a.attributes.position).count/3;c<e;c++)for(d=0;d<3;d++)h=3*c+d,q.fromBufferAttribute(v,h),b.push(q.x,q.y,q.z),h=3*c+(d+1)%3,q.fromBufferAttribute(v,h),b.push(q.x,q.y,q.z)}this.addAttribute("position",new B(b,3))}function Cc(a,b,c){J.call(this),this.type="ParametricGeometry",this.parameters={func:a,slices:b,stacks:c},this.fromBufferGeometry(new Nb(a,b,c)),this.mergeVertices()}function Nb(a,b,c){E.call(this),this.type="ParametricBufferGeometry",this.parameters={func:a,slices:b,stacks:c};var p,r,d=[],e=[],f=[],g=[],h=new n,k=new n,m=new n,q=new n,v=new n,l=b+1;for(p=0;p<=c;p++){var t=p/c;for(r=0;r<=b;r++){var y=r/b;k=a(y,t,k);e.push(k.x,k.y,k.z),0<=y-1e-5?(m=a(y-1e-5,t,m),q.subVectors(k,m)):(m=a(1e-5+y,t,m),q.subVectors(m,k)),0<=t-1e-5?(m=a(y,t-1e-5,m),v.subVectors(k,m)):(m=a(y,1e-5+t,m),v.subVectors(m,k)),h.crossVectors(q,v).normalize(),f.push(h.x,h.y,h.z),g.push(y,t)}}for(p=0;p<c;p++)for(r=0;r<b;r++)a=p*l+r+1,h=(p+1)*l+r+1,k=(p+1)*l+r,d.push(p*l+r,a,k),d.push(a,h,k);this.setIndex(d),this.addAttribute("position",new B(e,3)),this.addAttribute("normal",new B(f,3)),this.addAttribute("uv",new B(g,2))}function Dc(a,b,c,d){J.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:a,indices:b,radius:c,detail:d},this.fromBufferGeometry(new za(a,b,c,d)),this.mergeVertices()}function za(a,b,c,d){function e(a){h.push(a.x,a.y,a.z)}function f(b,c){var d=3*b;c.x=a[0+d],c.y=a[1+d],c.z=a[2+d]}function g(a,b,c,d){d<0&&1===a.x&&(k[b]=a.x-1),0===c.x&&0===c.z&&(k[b]=d/2/Math.PI+.5)}E.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:a,indices:b,radius:c,detail:d},c=c||1;var h=[],k=[];!function(a){for(var c=new n,d=new n,g=new n,h=0;h<b.length;h+=3){f(b[h+0],c),f(b[h+1],d),f(b[h+2],g);var H,w,k=c,l=d,y=g,x=Math.pow(2,a),u=[];for(H=0;H<=x;H++){u[H]=[];var I=k.clone().lerp(y,H/x),W=l.clone().lerp(y,H/x),D=x-H;for(w=0;w<=D;w++)u[H][w]=0===w&&H===x?I:I.clone().lerp(W,w/D)}for(H=0;H<x;H++)for(w=0;w<2*(x-H)-1;w++)k=Math.floor(w/2),0==w%2?(e(u[H][k+1]),e(u[H+1][k]),e(u[H][k])):(e(u[H][k+1]),e(u[H+1][k+1]),e(u[H+1][k]))}}(d=d||0),function(a){for(var b=new n,c=0;c<h.length;c+=3)b.x=h[c+0],b.y=h[c+1],b.z=h[c+2],b.normalize().multiplyScalar(a),h[c+0]=b.x,h[c+1]=b.y,h[c+2]=b.z}(c),function(){for(var a=new n,b=0;b<h.length;b+=3)a.x=h[b+0],a.y=h[b+1],a.z=h[b+2],k.push(Math.atan2(a.z,-a.x)/2/Math.PI+.5,1-(Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5));a=new n,b=new n;for(var c=new n,d=new n,e=new C,f=new C,l=new C,y=0,x=0;y<h.length;y+=9,x+=6){a.set(h[y+0],h[y+1],h[y+2]),b.set(h[y+3],h[y+4],h[y+5]),c.set(h[y+6],h[y+7],h[y+8]),e.set(k[x+0],k[x+1]),f.set(k[x+2],k[x+3]),l.set(k[x+4],k[x+5]),d.copy(a).add(b).add(c).divideScalar(3);var u=Math.atan2(d.z,-d.x);g(e,x+0,a,u),g(f,x+2,b,u),g(l,x+4,c,u)}for(a=0;a<k.length;a+=6)b=k[a+0],c=k[a+2],d=k[a+4],e=Math.min(b,c,d),.9<Math.max(b,c,d)&&e<.1&&(b<.2&&(k[a+0]+=1),c<.2&&(k[a+2]+=1),d<.2&&(k[a+4]+=1))}(),this.addAttribute("position",new B(h,3)),this.addAttribute("normal",new B(h.slice(),3)),this.addAttribute("uv",new B(k,2)),0===d?this.computeVertexNormals():this.normalizeNormals()}function Ec(a,b){J.call(this),this.type="TetrahedronGeometry",this.parameters={radius:a,detail:b},this.fromBufferGeometry(new Ob(a,b)),this.mergeVertices()}function Ob(a,b){za.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b),this.type="TetrahedronBufferGeometry",this.parameters={radius:a,detail:b}}function Fc(a,b){J.call(this),this.type="OctahedronGeometry",this.parameters={radius:a,detail:b},this.fromBufferGeometry(new lb(a,b)),this.mergeVertices()}function lb(a,b){za.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b),this.type="OctahedronBufferGeometry",this.parameters={radius:a,detail:b}}function Gc(a,b){J.call(this),this.type="IcosahedronGeometry",this.parameters={radius:a,detail:b},this.fromBufferGeometry(new Pb(a,b)),this.mergeVertices()}function Pb(a,b){var c=(1+Math.sqrt(5))/2;za.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b),this.type="IcosahedronBufferGeometry",this.parameters={radius:a,detail:b}}function Hc(a,b){J.call(this),this.type="DodecahedronGeometry",this.parameters={radius:a,detail:b},this.fromBufferGeometry(new Qb(a,b)),this.mergeVertices()}function Qb(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;za.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b),this.type="DodecahedronBufferGeometry",this.parameters={radius:a,detail:b}}function Ic(a,b,c,d,e,f){J.call(this),this.type="TubeGeometry",this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e},void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed."),a=new Rb(a,b,c,d,e),this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Rb(a,b,c,d,e){function f(e){var f=a.getPointAt(e/b),m=g.normals[e];for(e=g.binormals[e],v=0;v<=d;v++){var q=v/d*Math.PI*2,l=Math.sin(q);q=-Math.cos(q);k.x=q*m.x+l*e.x,k.y=q*m.y+l*e.y,k.z=q*m.z+l*e.z,k.normalize(),r.push(k.x,k.y,k.z),h.x=f.x+c*k.x,h.y=f.y+c*k.y,h.z=f.z+c*k.z,p.push(h.x,h.y,h.z)}}E.call(this),this.type="TubeBufferGeometry",this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e},b=b||64,c=c||1,d=d||8,e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents,this.normals=g.normals,this.binormals=g.binormals;var q,v,h=new n,k=new n,m=new C,p=[],r=[],l=[],t=[];for(q=0;q<b;q++)f(q);for(f(!1===e?b:0),q=0;q<=b;q++)for(v=0;v<=d;v++)m.x=q/b,m.y=v/d,l.push(m.x,m.y);!function(){for(v=1;v<=b;v++)for(q=1;q<=d;q++){var a=(d+1)*v+(q-1),c=(d+1)*v+q,e=(d+1)*(v-1)+q;t.push((d+1)*(v-1)+(q-1),a,e),t.push(a,c,e)}}(),this.setIndex(t),this.addAttribute("position",new B(p,3)),this.addAttribute("normal",new B(r,3)),this.addAttribute("uv",new B(l,2))}function Jc(a,b,c,d,e,f,g){J.call(this),this.type="TorusKnotGeometry",this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:e,q:f},void 0!==g&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Sb(a,b,c,d,e,f)),this.mergeVertices()}function Sb(a,b,c,d,e,f){function g(a,b,c,d,e){var f=Math.sin(a);b=c/b*a,c=Math.cos(b),e.x=d*(2+c)*.5*Math.cos(a),e.y=d*(2+c)*f*.5,e.z=d*Math.sin(b)*.5}E.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:e,q:f},a=a||100,b=b||40,c=Math.floor(c)||64,d=Math.floor(d)||8,e=e||2,f=f||3;var v,p,h=[],k=[],m=[],q=[],r=new n,l=new n,t=new n,y=new n,x=new n,u=new n,H=new n;for(v=0;v<=c;++v)for(g(p=v/c*e*Math.PI*2,e,f,a,t),g(p+.01,e,f,a,y),u.subVectors(y,t),H.addVectors(y,t),x.crossVectors(u,H),H.crossVectors(x,u),x.normalize(),H.normalize(),p=0;p<=d;++p){var w=p/d*Math.PI*2,I=-b*Math.cos(w);w=b*Math.sin(w);r.x=t.x+(I*H.x+w*x.x),r.y=t.y+(I*H.y+w*x.y),r.z=t.z+(I*H.z+w*x.z),k.push(r.x,r.y,r.z),l.subVectors(r,t).normalize(),m.push(l.x,l.y,l.z),q.push(v/c),q.push(p/d)}for(p=1;p<=c;p++)for(v=1;v<=d;v++)a=(d+1)*p+(v-1),b=(d+1)*p+v,e=(d+1)*(p-1)+v,h.push((d+1)*(p-1)+(v-1),a,e),h.push(a,b,e);this.setIndex(h),this.addAttribute("position",new B(k,3)),this.addAttribute("normal",new B(m,3)),this.addAttribute("uv",new B(q,2))}function Kc(a,b,c,d,e){J.call(this),this.type="TorusGeometry",this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e},this.fromBufferGeometry(new Tb(a,b,c,d,e)),this.mergeVertices()}function Tb(a,b,c,d,e){E.call(this),this.type="TorusBufferGeometry",this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e},a=a||100,b=b||40,c=Math.floor(c)||8,d=Math.floor(d)||6,e=e||2*Math.PI;var p,r,f=[],g=[],h=[],k=[],m=new n,q=new n,v=new n;for(p=0;p<=c;p++)for(r=0;r<=d;r++){var l=r/d*e,t=p/c*Math.PI*2;q.x=(a+b*Math.cos(t))*Math.cos(l),q.y=(a+b*Math.cos(t))*Math.sin(l),q.z=b*Math.sin(t),g.push(q.x,q.y,q.z),m.x=a*Math.cos(l),m.y=a*Math.sin(l),v.subVectors(q,m).normalize(),h.push(v.x,v.y,v.z),k.push(r/d),k.push(p/c)}for(p=1;p<=c;p++)for(r=1;r<=d;r++)a=(d+1)*(p-1)+r-1,b=(d+1)*(p-1)+r,e=(d+1)*p+r,f.push((d+1)*p+r-1,a,e),f.push(a,b,e);this.setIndex(f),this.addAttribute("position",new B(g,3)),this.addAttribute("normal",new B(h,3)),this.addAttribute("uv",new B(k,2))}function cb(a,b){J.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:a,options:b},this.fromBufferGeometry(new Ga(a,b)),this.mergeVertices()}function Ga(a,b){void 0!==a&&(E.call(this),this.type="ExtrudeBufferGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeVertexNormals())}function Lc(a,b){J.call(this),this.type="TextGeometry",this.parameters={text:a,parameters:b},this.fromBufferGeometry(new Ub(a,b)),this.mergeVertices()}function Ub(a,b){var c=(b=b||{}).font;if(!c||!c.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new J;c=c.generateShapes(a,b.size,b.curveSegments),b.amount=void 0!==b.height?b.height:50,void 0===b.bevelThickness&&(b.bevelThickness=10),void 0===b.bevelSize&&(b.bevelSize=8),void 0===b.bevelEnabled&&(b.bevelEnabled=!1),Ga.call(this,c,b),this.type="TextBufferGeometry"}function Mc(a,b,c,d,e,f,g){J.call(this),this.type="SphereGeometry",this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g},this.fromBufferGeometry(new mb(a,b,c,d,e,f,g)),this.mergeVertices()}function mb(a,b,c,d,e,f,g){E.call(this),this.type="SphereBufferGeometry",this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g},a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI;var k,m,h=(f=void 0!==f?f:0)+(g=void 0!==g?g:Math.PI),q=0,v=[],p=new n,r=new n,l=[],t=[],y=[],x=[];for(m=0;m<=c;m++){var u=[],H=m/c;for(k=0;k<=b;k++){var w=k/b;p.x=-a*Math.cos(d+w*e)*Math.sin(f+H*g),p.y=a*Math.cos(f+H*g),p.z=a*Math.sin(d+w*e)*Math.sin(f+H*g),t.push(p.x,p.y,p.z),r.set(p.x,p.y,p.z).normalize(),y.push(r.x,r.y,r.z),x.push(w,1-H),u.push(q++)}v.push(u)}for(m=0;m<c;m++)for(k=0;k<b;k++)a=v[m][k+1],d=v[m][k],e=v[m+1][k],g=v[m+1][k+1],(0!==m||0<f)&&l.push(a,d,g),(m!==c-1||h<Math.PI)&&l.push(d,e,g);this.setIndex(l),this.addAttribute("position",new B(t,3)),this.addAttribute("normal",new B(y,3)),this.addAttribute("uv",new B(x,2))}function Nc(a,b,c,d,e,f){J.call(this),this.type="RingGeometry",this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f},this.fromBufferGeometry(new Vb(a,b,c,d,e,f)),this.mergeVertices()}function Vb(a,b,c,d,e,f){E.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f},a=a||20,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8;var l,t,g=[],h=[],k=[],m=[],q=a,v=(b-a)/(d=void 0!==d?Math.max(1,d):1),p=new n,r=new C;for(l=0;l<=d;l++){for(t=0;t<=c;t++)a=e+t/c*f,p.x=q*Math.cos(a),p.y=q*Math.sin(a),h.push(p.x,p.y,p.z),k.push(0,0,1),r.x=(p.x/b+1)/2,r.y=(p.y/b+1)/2,m.push(r.x,r.y);q+=v}for(l=0;l<d;l++)for(b=l*(c+1),t=0;t<c;t++)e=(a=t+b)+c+1,f=a+c+2,q=a+1,g.push(a,e,q),g.push(e,f,q);this.setIndex(g),this.addAttribute("position",new B(h,3)),this.addAttribute("normal",new B(k,3)),this.addAttribute("uv",new B(m,2))}function Oc(a,b,c,d){J.call(this),this.type="LatheGeometry",this.parameters={points:a,segments:b,phiStart:c,phiLength:d},this.fromBufferGeometry(new Wb(a,b,c,d)),this.mergeVertices()}function Wb(a,b,c,d){E.call(this),this.type="LatheBufferGeometry",this.parameters={points:a,segments:b,phiStart:c,phiLength:d},b=Math.floor(b)||12,c=c||0,d=d||2*Math.PI,d=Y.clamp(d,0,2*Math.PI);var q,v,e=[],f=[],g=[],h=1/b,k=new n,m=new C;for(q=0;q<=b;q++){v=c+q*h*d;var p=Math.sin(v),r=Math.cos(v);for(v=0;v<=a.length-1;v++)k.x=a[v].x*p,k.y=a[v].y,k.z=a[v].x*r,f.push(k.x,k.y,k.z),m.x=q/b,m.y=v/(a.length-1),g.push(m.x,m.y)}for(q=0;q<b;q++)for(v=0;v<a.length-1;v++)h=(c=v+q*a.length)+a.length,k=c+a.length+1,m=c+1,e.push(c,h,m),e.push(h,k,m);if(this.setIndex(e),this.addAttribute("position",new B(f,3)),this.addAttribute("uv",new B(g,2)),this.computeVertexNormals(),d===2*Math.PI)for(d=this.attributes.normal.array,e=new n,f=new n,g=new n,c=b*a.length*3,v=q=0;q<a.length;q++,v+=3)e.x=d[v+0],e.y=d[v+1],e.z=d[v+2],f.x=d[c+v+0],f.y=d[c+v+1],f.z=d[c+v+2],g.addVectors(e,f).normalize(),d[v+0]=d[c+v+0]=g.x,d[v+1]=d[c+v+1]=g.y,d[v+2]=d[c+v+2]=g.z}function Xb(a,b){J.call(this),this.type="ShapeGeometry","object"==typeof b&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),b=b.curveSegments),this.parameters={shapes:a,curveSegments:b},this.fromBufferGeometry(new Yb(a,b)),this.mergeVertices()}function Yb(a,b){function c(a){var c,h,m=e.length/3,l=(a=a.extractPoints(b)).shape,n=a.holes;if(!1===Ia.isClockWise(l))for(l=l.reverse(),a=0,c=n.length;a<c;a++)h=n[a],!0===Ia.isClockWise(h)&&(n[a]=h.reverse());var y=Ia.triangulateShape(l,n);for(a=0,c=n.length;a<c;a++)h=n[a],l=l.concat(h);for(a=0,c=l.length;a<c;a++)h=l[a],e.push(h.x,h.y,0),f.push(0,0,1),g.push(h.x,h.y);for(a=0,c=y.length;a<c;a++)l=y[a],d.push(l[0]+m,l[1]+m,l[2]+m),k+=3}E.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:a,curveSegments:b},b=b||12;var d=[],e=[],f=[],g=[],h=0,k=0;if(!1===Array.isArray(a))c(a);else for(var m=0;m<a.length;m++)c(a[m]),this.addGroup(h,k,m),h+=k,k=0;this.setIndex(d),this.addAttribute("position",new B(e,3)),this.addAttribute("normal",new B(f,3)),this.addAttribute("uv",new B(g,2))}function Zb(a,b){E.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:b};var g,h,m,c=[],d=Math.cos(Y.DEG2RAD*(void 0!==b?b:1)),e=[0,0],f={},k=["a","b","c"];a.isBufferGeometry?(m=new J).fromBufferGeometry(a):m=a.clone(),m.mergeVertices(),m.computeFaceNormals();for(var q=m.vertices,v=0,p=(m=m.faces).length;v<p;v++)for(var l=m[v],n=0;n<3;n++)g=l[k[n]],h=l[k[(n+1)%3]],e[0]=Math.min(g,h),e[1]=Math.max(g,h),void 0===f[g=e[0]+","+e[1]]?f[g]={index1:e[0],index2:e[1],face1:v,face2:void 0}:f[g].face2=v;for(g in f)(void 0===(e=f[g]).face2||m[e.face1].normal.dot(m[e.face2].normal)<=d)&&(k=q[e.index1],c.push(k.x,k.y,k.z),k=q[e.index2],c.push(k.x,k.y,k.z));this.addAttribute("position",new B(c,3))}function nb(a,b,c,d,e,f,g,h){J.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h},this.fromBufferGeometry(new Ua(a,b,c,d,e,f,g,h)),this.mergeVertices()}function Ua(a,b,c,d,e,f,g,h){function k(c){var e,f,k,t=new C,D=new n,O=0,aa=!0===c?a:b,F=!0===c?1:-1;for(f=ca,e=1;e<=d;e++)v.push(0,y*F,0),p.push(0,F,0),l.push(.5,.5),ca++;for(k=ca,e=0;e<=d;e++){var B=e/d*h+g,z=Math.cos(B);B=Math.sin(B);D.x=aa*B,D.y=y*F,D.z=aa*z,v.push(D.x,D.y,D.z),p.push(0,F,0),t.x=.5*z+.5,t.y=.5*B*F+.5,l.push(t.x,t.y),ca++}for(e=0;e<d;e++)t=f+e,D=k+e,!0===c?q.push(D,D+1,t):q.push(D+1,D,t),O+=3;m.addGroup(x,O,!0===c?1:2),x+=O}E.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};var m=this;a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,d=Math.floor(d)||8,e=Math.floor(e)||1,f=void 0!==f&&f,g=void 0!==g?g:0,h=void 0!==h?h:2*Math.PI;var q=[],v=[],p=[],l=[],ca=0,t=[],y=c/2,x=0;!function(){var f,k,w=new n,I=new n,W=0,D=(b-a)/c;for(k=0;k<=e;k++){var O=[],aa=k/e,F=aa*(b-a)+a;for(f=0;f<=d;f++){var B=f/d,C=B*h+g,z=Math.sin(C);C=Math.cos(C);I.x=F*z,I.y=-aa*c+y,I.z=F*C,v.push(I.x,I.y,I.z),w.set(z,D,C).normalize(),p.push(w.x,w.y,w.z),l.push(B,1-aa),O.push(ca++)}t.push(O)}for(f=0;f<d;f++)for(k=0;k<e;k++)w=t[k+1][f],I=t[k+1][f+1],D=t[k][f+1],q.push(t[k][f],w,D),q.push(w,I,D),W+=6;m.addGroup(x,W,0),x+=W}(),!1===f&&(0<a&&k(!0),0<b&&k(!1)),this.setIndex(q),this.addAttribute("position",new B(v,3)),this.addAttribute("normal",new B(p,3)),this.addAttribute("uv",new B(l,2))}function Pc(a,b,c,d,e,f,g){nb.call(this,0,a,b,c,d,e,f,g),this.type="ConeGeometry",this.parameters={radius:a,height:b,radialSegments:c,heightSegments:d,openEnded:e,thetaStart:f,thetaLength:g}}function Qc(a,b,c,d,e,f,g){Ua.call(this,0,a,b,c,d,e,f,g),this.type="ConeBufferGeometry",this.parameters={radius:a,height:b,radialSegments:c,heightSegments:d,openEnded:e,thetaStart:f,thetaLength:g}}function Rc(a,b,c,d){J.call(this),this.type="CircleGeometry",this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d},this.fromBufferGeometry(new $b(a,b,c,d)),this.mergeVertices()}function $b(a,b,c,d){E.call(this),this.type="CircleBufferGeometry",this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d},a=a||50,b=void 0!==b?Math.max(3,b):8,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI;var k,m,e=[],f=[],g=[],h=[],q=new n,v=new C;for(f.push(0,0,0),g.push(0,0,1),h.push(.5,.5),m=0,k=3;m<=b;m++,k+=3){var p=c+m/b*d;q.x=a*Math.cos(p),q.y=a*Math.sin(p),f.push(q.x,q.y,q.z),g.push(0,0,1),v.x=(f[k]/a+1)/2,v.y=(f[k+1]/a+1)/2,h.push(v.x,v.y)}for(k=1;k<=b;k++)e.push(k,k+1,0);this.setIndex(e),this.addAttribute("position",new B(f,3)),this.addAttribute("normal",new B(g,3)),this.addAttribute("uv",new B(h,2))}function ac(a){ra.call(this,{uniforms:Ca.merge([R.lights,{opacity:{value:1}}]),vertexShader:X.shadow_vert,fragmentShader:X.shadow_frag}),this.transparent=this.lights=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(a){this.uniforms.opacity.value=a}}}),this.setValues(a)}function bc(a){ra.call(this,a),this.type="RawShaderMaterial"}function Pa(a){U.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new G(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new G(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new C(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(a)}function ob(a){Pa.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoatRoughness=this.clearCoat=0,this.setValues(a)}function Ja(a){U.call(this),this.type="MeshPhongMaterial",this.color=new G(16777215),this.specular=new G(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new G(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new C(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(a)}function pb(a){Ja.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(a)}function qb(a){U.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new C(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.morphNormals=this.morphTargets=this.skinning=this.lights=this.fog=!1,this.setValues(a)}function rb(a){U.call(this),this.type="MeshLambertMaterial",this.color=new G(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new G(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(a)}function sb(a){U.call(this),this.type="LineDashedMaterial",this.color=new G(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(a)}function Zd(a,b,c){var d=this,e=!1,f=0,g=0;this.onStart=void 0,this.onLoad=a,this.onProgress=b,this.onError=c,this.itemStart=function(a){g++,!1===e&&void 0!==d.onStart&&d.onStart(a,f,g),e=!0},this.itemEnd=function(a){f++,void 0!==d.onProgress&&d.onProgress(a,f,g),f===g&&(e=!1,void 0!==d.onLoad)&&d.onLoad()},this.itemError=function(a){void 0!==d.onError&&d.onError(a)}}function Ka(a){this.manager=void 0!==a?a:va}function Oe(a){this.manager=void 0!==a?a:va,this._parser=null}function $d(a){this.manager=void 0!==a?a:va,this._parser=null}function Sc(a){this.manager=void 0!==a?a:va}function ae(a){this.manager=void 0!==a?a:va}function rd(a){this.manager=void 0!==a?a:va}function na(a,b){z.call(this),this.type="Light",this.color=new G(a),this.intensity=void 0!==b?b:1,this.receiveShadow=void 0}function sd(a,b,c){na.call(this,a,c),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(z.DefaultUp),this.updateMatrix(),this.groundColor=new G(b)}function tb(a){this.camera=a,this.bias=0,this.radius=1,this.mapSize=new C(512,512),this.map=null,this.matrix=new K}function td(){tb.call(this,new qa(50,1,.5,500))}function ud(a,b,c,d,e,f){na.call(this,a,b),this.type="SpotLight",this.position.copy(z.DefaultUp),this.updateMatrix(),this.target=new z,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}}),this.distance=void 0!==c?c:0,this.angle=void 0!==d?d:Math.PI/3,this.penumbra=void 0!==e?e:0,this.decay=void 0!==f?f:1,this.shadow=new td}function vd(a,b,c,d){na.call(this,a,b),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}}),this.distance=void 0!==c?c:0,this.decay=void 0!==d?d:1,this.shadow=new tb(new qa(90,1,.5,500))}function wd(){tb.call(this,new Fb(-5,5,5,-5,.5,500))}function xd(a,b){na.call(this,a,b),this.type="DirectionalLight",this.position.copy(z.DefaultUp),this.updateMatrix(),this.target=new z,this.shadow=new wd}function yd(a,b){na.call(this,a,b),this.type="AmbientLight",this.castShadow=void 0}function zd(a,b,c,d){na.call(this,a,b),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==c?c:10,this.height=void 0!==d?d:10}function wa(a,b,c,d){this.parameterPositions=a,this._cachedIndex=0,this.resultBuffer=void 0!==d?d:new b.constructor(c),this.sampleValues=b,this.valueSize=c}function Ad(a,b,c,d){wa.call(this,a,b,c,d),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function Tc(a,b,c,d){wa.call(this,a,b,c,d)}function Bd(a,b,c,d){wa.call(this,a,b,c,d)}function ub(a,b,c,d){if(void 0===a)throw Error("track name is undefined");if(void 0===b||0===b.length)throw Error("no keyframes in track named "+a);this.name=a,this.times=ia.convertArray(b,this.TimeBufferType),this.values=ia.convertArray(c,this.ValueBufferType),this.setInterpolation(d||this.DefaultInterpolation),this.validate(),this.optimize()}function cc(a,b,c,d){ub.call(this,a,b,c,d)}function Cd(a,b,c,d){wa.call(this,a,b,c,d)}function Uc(a,b,c,d){ub.call(this,a,b,c,d)}function dc(a,b,c,d){ub.call(this,a,b,c,d)}function Dd(a,b,c,d){ub.call(this,a,b,c,d)}function Ed(a,b,c){ub.call(this,a,b,c)}function Fd(a,b,c,d){ub.call(this,a,b,c,d)}function vb(a,b,c,d){ub.apply(this,arguments)}function Da(a,b,c){this.name=a,this.tracks=c,this.duration=void 0!==b?b:-1,this.uuid=Y.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Gd(a){this.manager=void 0!==a?a:va,this.textures={}}function be(a){this.manager=void 0!==a?a:va}function ec(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function ce(a){"boolean"==typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0),this.manager=void 0!==a?a:va,this.withCredentials=!1}function Pe(a){this.manager=void 0!==a?a:va,this.texturePath=""}function Qe(a,b,c,d,e){var f=a*a;return(2*c-2*d+(b=.5*(d-b))+(e=.5*(e-c)))*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function wb(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function xb(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function ua(){this.arcLengthDivisions=200}function Qa(a,b){this.arcLengthDivisions=200,this.v1=a,this.v2=b}function Vc(){this.arcLengthDivisions=200,this.curves=[],this.autoClose=!1}function Va(a,b,c,d,e,f,g,h){this.arcLengthDivisions=200,this.aX=a,this.aY=b,this.xRadius=c,this.yRadius=d,this.aStartAngle=e,this.aEndAngle=f,this.aClockwise=g,this.aRotation=h||0}function yb(a){this.arcLengthDivisions=200,this.points=void 0===a?[]:a}function fc(a,b,c,d){this.arcLengthDivisions=200,this.v0=a,this.v1=b,this.v2=c,this.v3=d}function gc(a,b,c){this.arcLengthDivisions=200,this.v0=a,this.v1=b,this.v2=c}function Wc(a){Vc.call(this),this.currentPoint=new C,a&&this.fromPoints(a)}function zb(){Wc.apply(this,arguments),this.holes=[]}function de(){this.subPaths=[],this.currentPath=null}function ee(a){this.data=a}function Re(a){this.manager=void 0!==a?a:va}function fe(a){this.manager=void 0!==a?a:va}function Se(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new qa,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new qa,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Hd(a,b,c){z.call(this),this.type="CubeCamera";var d=new qa(90,1,a,b);d.up.set(0,-1,0),d.lookAt(new n(1,0,0)),this.add(d);var e=new qa(90,1,a,b);e.up.set(0,-1,0),e.lookAt(new n(-1,0,0)),this.add(e);var f=new qa(90,1,a,b);f.up.set(0,0,1),f.lookAt(new n(0,1,0)),this.add(f);var g=new qa(90,1,a,b);g.up.set(0,0,-1),g.lookAt(new n(0,-1,0)),this.add(g);var h=new qa(90,1,a,b);h.up.set(0,-1,0),h.lookAt(new n(0,0,1)),this.add(h);var k=new qa(90,1,a,b);k.up.set(0,-1,0),k.lookAt(new n(0,0,-1)),this.add(k),this.renderTarget=new Db(c,c,{format:1022,magFilter:1006,minFilter:1006}),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(a,b){null===this.parent&&this.updateMatrixWorld();var c=this.renderTarget,p=c.texture.generateMipmaps;c.texture.generateMipmaps=!1,c.activeCubeFace=0,a.render(b,d,c),c.activeCubeFace=1,a.render(b,e,c),c.activeCubeFace=2,a.render(b,f,c),c.activeCubeFace=3,a.render(b,g,c),c.activeCubeFace=4,a.render(b,h,c),c.texture.generateMipmaps=p,c.activeCubeFace=5,a.render(b,k,c),a.setRenderTarget(null)}}function ge(){z.call(this),this.type="AudioListener",this.context=he.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function hc(a){z.call(this),this.type="Audio",this.context=a.context,this.gain=this.context.createGain(),this.gain.connect(a.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function ie(a){hc.call(this,a),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function je(a,b){this.analyser=a.context.createAnalyser(),this.analyser.fftSize=void 0!==b?b:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),a.getOutput().connect(this.analyser)}function ke(a,b,c){switch(this.binding=a,this.valueSize=c,a=Float64Array,b){case"quaternion":b=this._slerp;break;case"string":case"bool":a=Array,b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c),this._mixBufferRegion=b,this.referenceCount=this.useCount=this.cumulativeWeight=0}function Te(a,b,c){c=c||ha.parseTrackName(b),this._targetGroup=a,this._bindings=a.subscribe_(b,c)}function ha(a,b,c){this.path=b,this.parsedPath=c||ha.parseTrackName(b),this.node=ha.findNode(a,this.parsedPath.nodeName)||a,this.rootNode=a}function Ue(a){this.uuid=Y.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var b={};this._indicesByUUID=b;for(var c=0,d=arguments.length;c!==d;++c)b[arguments[c].uuid]=c;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}function Ve(a,b,c){this._mixer=a,this._clip=b,this._localRoot=c||null,b=(a=b.tracks).length,c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);(c[e]=f).settings=d}this._interpolantSettings=d,this._interpolants=c,this._propertyBindings=Array(b),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function We(a){this._root=a,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function Id(a,b){"string"==typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b),this.value=a}function le(){E.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function me(a,b,c,d){this.uuid=Y.generateUUID(),this.data=a,this.itemSize=b,this.offset=c,this.normalized=!0===d}function ic(a,b){this.uuid=Y.generateUUID(),this.array=a,this.stride=b,this.count=void 0!==a?a.length/b:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function ne(a,b,c){ic.call(this,a,b),this.meshPerAttribute=c||1}function oe(a,b,c){Z.call(this,a,b),this.meshPerAttribute=c||1}function Xe(a,b,c,d){this.ray=new kb(a,b),this.near=c||0,this.far=d||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Ye(a,b){return a.distance-b.distance}function pe(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){d=0;for(var e=(a=a.children).length;d<e;d++)pe(a[d],b,c,!0)}}function Ze(a){this.autoStart=void 0===a||a,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1}function $e(a,b,c){return this.radius=void 0!==a?a:1,this.phi=void 0!==b?b:0,this.theta=void 0!==c?c:0,this}function af(a,b,c){return this.radius=void 0!==a?a:1,this.theta=void 0!==b?b:0,this.y=void 0!==c?c:0,this}function ta(a,b){la.call(this,a,b),this.animationsMap={},this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1),this.setAnimationWeight("__default",1)}function Xc(a){z.call(this),this.material=a,this.render=function(a){}}function Yc(a,b,c,d){this.object=a,this.size=void 0!==b?b:1,a=void 0!==c?c:16711680,d=void 0!==d?d:1,b=0,(c=this.object.geometry)&&c.isGeometry?b=3*c.faces.length:c&&c.isBufferGeometry&&(b=c.attributes.normal.count),c=new E,b=new B(6*b,3),c.addAttribute("position",b),Q.call(this,c,new ea({color:a,linewidth:d})),this.matrixAutoUpdate=!1,this.update()}function jc(a){z.call(this),this.light=a,this.light.updateMatrixWorld(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,a=new E;for(var b=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],c=0,d=1;c<32;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new B(b,3)),b=new ea({fog:!1}),this.cone=new Q(a,b),this.add(this.cone),this.update()}function kc(a){for(var b=function bf(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;c<a.children.length;c++)b.push.apply(b,bf(a.children[c]));return b}(a),c=new E,d=[],e=[],f=new G(0,0,1),g=new G(0,1,0),h=0;h<b.length;h++){var k=b[h];k.parent&&k.parent.isBone&&(d.push(0,0,0),d.push(0,0,0),e.push(f.r,f.g,f.b),e.push(g.r,g.g,g.b))}c.addAttribute("position",new B(d,3)),c.addAttribute("color",new B(e,3)),d=new ea({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0}),Q.call(this,c,d),this.root=a,this.bones=b,this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,this.onBeforeRender()}function lc(a,b){this.light=a,this.light.updateMatrixWorld();var c=new mb(b,4,2),d=new ya({wireframe:!0,fog:!1});d.color.copy(this.light.color),la.call(this,c,d),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function mc(a){z.call(this),this.light=a,this.light.updateMatrixWorld(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,a=new ea({color:a.color});var b=new E;b.addAttribute("position",new Z(new Float32Array(15),3)),this.add(new sa(b,a)),this.update()}function nc(a,b){z.call(this),this.light=a,this.light.updateMatrixWorld(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1;var c=new lb(b);c.rotateY(.5*Math.PI);var d=new ya({vertexColors:2,wireframe:!0}),e=c.getAttribute("position");e=new Float32Array(3*e.count);c.addAttribute("color",new Z(e,3)),this.add(new la(c,d)),this.update()}function Zc(a,b,c,d){a=a||10,b=b||10,c=new G(void 0!==c?c:4473924),d=new G(void 0!==d?d:8947848);var e=b/2,f=a/b,g=a/2;a=[];for(var h=[],k=0,m=0,q=-g;k<=b;k++,q+=f){a.push(-g,0,q,g,0,q),a.push(q,0,-g,q,0,g);var l=k===e?c:d;l.toArray(h,m),m+=3,l.toArray(h,m),m+=3,l.toArray(h,m),m+=3,l.toArray(h,m),m+=3}(b=new E).addAttribute("position",new B(a,3)),b.addAttribute("color",new B(h,3)),c=new ea({vertexColors:2}),Q.call(this,b,c)}function Jd(a,b,c,d,e,f){a=a||10,b=b||16,c=c||8,d=d||64,e=new G(void 0!==e?e:4473924),f=new G(void 0!==f?f:8947848);var k,m,q,l,p,g=[],h=[];for(q=0;q<=b;q++)m=q/b*2*Math.PI,k=Math.sin(m)*a,m=Math.cos(m)*a,g.push(0,0,0),g.push(k,0,m),p=1&q?e:f,h.push(p.r,p.g,p.b),h.push(p.r,p.g,p.b);for(q=0;q<=c;q++)for(p=1&q?e:f,l=a-a/c*q,b=0;b<d;b++)m=b/d*2*Math.PI,k=Math.sin(m)*l,m=Math.cos(m)*l,g.push(k,0,m),h.push(p.r,p.g,p.b),m=(b+1)/d*2*Math.PI,k=Math.sin(m)*l,m=Math.cos(m)*l,g.push(k,0,m),h.push(p.r,p.g,p.b);(a=new E).addAttribute("position",new B(g,3)),a.addAttribute("color",new B(h,3)),g=new ea({vertexColors:2}),Q.call(this,a,g)}function $c(a,b,c,d){this.object=a,this.size=void 0!==b?b:1,a=void 0!==c?c:16776960,d=void 0!==d?d:1,b=0,(c=this.object.geometry)&&c.isGeometry?b=c.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),c=new E,b=new B(6*b,3),c.addAttribute("position",b),Q.call(this,c,new ea({color:a,linewidth:d})),this.matrixAutoUpdate=!1,this.update()}function oc(a,b){z.call(this),this.light=a,this.light.updateMatrixWorld(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,void 0===b&&(b=1);var c=new E;c.addAttribute("position",new B([-b,b,0,b,b,0,b,-b,0,-b,-b,0,-b,b,0],3));var d=new ea({fog:!1});this.add(new sa(c,d)),(c=new E).addAttribute("position",new B([0,0,0,0,0,1],3)),this.add(new sa(c,d)),this.update()}function ad(a){function b(a,b,d){c(a,d),c(b,d)}function c(a,b){f.push(0,0,0),g.push(b.r,b.g,b.b),void 0===h[a]&&(h[a]=[]),h[a].push(f.length/3-1)}var d=new E,e=new ea({color:16777215,vertexColors:1}),f=[],g=[],h={},k=new G(16755200),m=new G(16711680),q=new G(43775),l=new G(16777215),p=new G(3355443);b("n1","n2",k),b("n2","n4",k),b("n4","n3",k),b("n3","n1",k),b("f1","f2",k),b("f2","f4",k),b("f4","f3",k),b("f3","f1",k),b("n1","f1",k),b("n2","f2",k),b("n3","f3",k),b("n4","f4",k),b("p","n1",m),b("p","n2",m),b("p","n3",m),b("p","n4",m),b("u1","u2",q),b("u2","u3",q),b("u3","u1",q),b("c","t",l),b("p","c",p),b("cn1","cn2",p),b("cn3","cn4",p),b("cf1","cf2",p),b("cf3","cf4",p),d.addAttribute("position",new B(f,3)),d.addAttribute("color",new B(g,3)),Q.call(this,d,e),this.camera=a,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=h,this.update()}function Ab(a,b){this.object=a,void 0===b&&(b=16776960);var c=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]),d=new Float32Array(24),e=new E;e.setIndex(new Z(c,1)),e.addAttribute("position",new Z(d,3)),Q.call(this,e,new ea({color:b})),this.matrixAutoUpdate=!1,this.update()}function Bb(a,b,c,d,e,f){z.call(this),void 0===d&&(d=16776960),void 0===c&&(c=1),void 0===e&&(e=.2*c),void 0===f&&(f=.2*e),void 0===Kd&&((Kd=new E).addAttribute("position",new B([0,0,0,0,1,0],3)),(qe=new Ua(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(b),this.line=new sa(Kd,new ea({color:d})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new la(qe,new ya({color:d})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(a),this.setLength(c,e,f)}function Ld(a){var b=[0,0,0,a=a||1,0,0,0,0,0,0,a,0,0,0,0,0,0,a];(a=new E).addAttribute("position",new B(b,3)),a.addAttribute("color",new B([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),b=new ea({vertexColors:2}),Q.call(this,a,b)}function re(){var a=0,b=0,c=0,d=0;return{initCatmullRom:function(e,f,g,h,k){c=-3*(a=f)+3*g-2*(b=e=k*(g-e))-(h=k*(h-f)),d=2*f-2*g+e+h},initNonuniformCatmullRom:function(e,f,g,h,k,m,q){c=-3*(a=f)+3*g-2*(b=e=((f-e)/k-(g-e)/(k+m)+(g-f)/m)*m)-(h=((g-f)/m-(h-f)/(m+q)+(h-g)/q)*m),d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b*e+c*f+d*f*e}}}function La(a){this.arcLengthDivisions=200,a.length<2&&console.warn("THREE.CatmullRomCurve3: Points array needs at least two entries."),this.points=a||[],this.closed=!1}function bd(a,b,c,d){this.arcLengthDivisions=200,this.v0=a,this.v1=b,this.v2=c,this.v3=d}function cd(a,b,c){this.arcLengthDivisions=200,this.v0=a,this.v1=b,this.v2=c}function dd(a,b){this.arcLengthDivisions=200,this.v1=a,this.v2=b}function Md(a,b,c,d,e,f){Va.call(this,a,b,c,c,d,e,f)}function cf(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),La.call(this,a),this.type="catmullrom",this.closed=!0}function df(a){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),La.call(this,a),this.type="catmullrom"}function se(a){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),La.call(this,a),this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a}),void 0===Math.sign&&(Math.sign=function(a){return a<0?-1:0<a?1:+a}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(a){if(null==a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var d=arguments[c];if(null!=d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(b[e]=d[e])}return b}),Object.assign(xa.prototype,{addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]),-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners&&void 0!==(b=this._listeners[a.type])){a.target=this;for(var b,c=0,d=(b=b.slice(0)).length;c<d;c++)b[c].call(this,a)}}});var d,a,b,c,Y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,function(){for(var e=0;e<36;e++)8===e||13===e||18===e||23===e?b[e]="-":14===e?b[e]="4":(c<=2&&(c=33554432+16777216*Math.random()|0),d=15&c,c>>=4,b[e]=a[19===e?3&d|8:d]);return b.join("")}),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){return a<=b?0:c<=a?1:(a=(a-b)/(c-b))*a*(3-2*a)},smootherstep:function(a,b,c){return a<=b?0:c<=a?1:(a=(a-b)/(c-b))*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*Y.DEG2RAD},radToDeg:function(a){return a*Y.RAD2DEG},isPowerOfTwo:function(a){return 0==(a&a-1)&&0!==a},nearestPowerOfTwo:function(a){return Math.pow(2,Math.round(Math.log(a)/Math.LN2))},nextPowerOfTwo:function(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,++a}};Object.defineProperties(C.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}}),Object.assign(C.prototype,{isVector2:!0,set:function(a,b){return this.x=a,this.y=b,this},setScalar:function(a){return this.y=this.x=a,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a)}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){return this.x=a.x,this.y=a.y,this},add:function(a,b){return void 0!==b?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b)):(this.x+=a.x,this.y+=a.y,this)},addScalar:function(a){return this.x+=a,this.y+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this},addScaledVector:function(a,b){return this.x+=a.x*b,this.y+=a.y*b,this},sub:function(a,b){return void 0!==b?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b)):(this.x-=a.x,this.y-=a.y,this)},subScalar:function(a){return this.x-=a,this.y-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this},multiply:function(a){return this.x*=a.x,this.y*=a.y,this},multiplyScalar:function(a){return this.x*=a,this.y*=a,this},divide:function(a){return this.x/=a.x,this.y/=a.y,this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this},max:function(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this},clamp:function(a,b){return this.x=Math.max(a.x,Math.min(b.x,this.x)),this.y=Math.max(a.y,Math.min(b.y,this.y)),this},clampScalar:function(){var a=new C,b=new C;return function(c,d){return a.set(c,c),b.set(d,d),this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var a=Math.atan2(this.y,this.x);return a<0&&(a+=2*Math.PI),a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;return b*b+(a=this.y-a.y)*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){return void 0===b&&(b=0),this.x=a[b],this.y=a[b+1],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.x,a[b+1]=this.y,a},fromBufferAttribute:function(a,b,c){return void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=a.getX(b),this.y=a.getY(b),this},rotateAround:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=this.x-a.x,f=this.y-a.y;return this.x=e*c-f*d+a.x,this.y=e*d+f*c+a.y,this}});var hf=0;ba.DEFAULT_IMAGE=void 0,ba.DEFAULT_MAPPING=300,Object.defineProperty(ba.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}}),Object.assign(ba.prototype,xa.prototype,{constructor:ba,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.name=a.name,this.image=a.image,this.mipmaps=a.mipmaps.slice(0),this.mapping=a.mapping,this.wrapS=a.wrapS,this.wrapT=a.wrapT,this.magFilter=a.magFilter,this.minFilter=a.minFilter,this.anisotropy=a.anisotropy,this.format=a.format,this.type=a.type,this.offset.copy(a.offset),this.repeat.copy(a.repeat),this.generateMipmaps=a.generateMipmaps,this.premultiplyAlpha=a.premultiplyAlpha,this.flipY=a.flipY,this.unpackAlignment=a.unpackAlignment,this.encoding=a.encoding,this},toJSON:function(a){if(void 0!==a.textures[this.uuid])return a.textures[this.uuid];var b={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var c=this.image;if(void 0===c.uuid&&(c.uuid=Y.generateUUID()),void 0===a.images[c.uuid]){var g,d=a.images,e=c.uuid,f=c.uuid;void 0!==c.toDataURL?g=c:((g=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=c.width,g.height=c.height,g.getContext("2d").drawImage(c,0,0,c.width,c.height)),g=2048<g.width||2048<g.height?g.toDataURL("image/jpeg",.6):g.toDataURL("image/png"),d[e]={uuid:f,url:g}}b.image=c.uuid}return a.textures[this.uuid]=b},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(a){if(300===this.mapping){if(a.multiply(this.repeat),a.add(this.offset),a.x<0||1<a.x)switch(this.wrapS){case 1e3:a.x-=Math.floor(a.x);break;case 1001:a.x=a.x<0?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(a.y<0||1<a.y)switch(this.wrapT){case 1e3:a.y-=Math.floor(a.y);break;case 1001:a.y=a.y<0?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y)}}}),Object.assign(fa.prototype,{isVector4:!0,set:function(a,b,c,d){return this.x=a,this.y=b,this.z=c,this.w=d,this},setScalar:function(a){return this.w=this.z=this.y=this.x=a,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setZ:function(a){return this.z=a,this},setW:function(a){return this.w=a,this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a)}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){return this.x=a.x,this.y=a.y,this.z=a.z,this.w=void 0!==a.w?a.w:1,this},add:function(a,b){return void 0!==b?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b)):(this.x+=a.x,this.y+=a.y,this.z+=a.z,this.w+=a.w,this)},addScalar:function(a){return this.x+=a,this.y+=a,this.z+=a,this.w+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this.w=a.w+b.w,this},addScaledVector:function(a,b){return this.x+=a.x*b,this.y+=a.y*b,this.z+=a.z*b,this.w+=a.w*b,this},sub:function(a,b){return void 0!==b?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b)):(this.x-=a.x,this.y-=a.y,this.z-=a.z,this.w-=a.w,this)},subScalar:function(a){return this.x-=a,this.y-=a,this.z-=a,this.w-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this.w=a.w-b.w,this},multiplyScalar:function(a){return this.x*=a,this.y*=a,this.z*=a,this.w*=a,this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;return a=a.elements,this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e,this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e,this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e,this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e,this},divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);return b<1e-4?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b),this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,e=(a=a.elements)[0];d=a[4];var f=a[8],g=a[1],h=a[5],k=a[9];c=a[2],b=a[6];var m=a[10];return Math.abs(d-g)<.01&&Math.abs(f-c)<.01&&Math.abs(k-b)<.01?Math.abs(d+g)<.1&&Math.abs(f+c)<.1&&Math.abs(k+b)<.1&&Math.abs(e+h+m-3)<.1?this.set(1,0,0,0):(a=Math.PI,m=(m+1)/2,d=(d+g)/4,f=(f+c)/4,k=(k+b)/4,(h=(h+1)/2)<(e=(e+1)/2)&&m<e?d=e<.01?(b=0,c=.707106781):(c=d/(b=Math.sqrt(e)),f/b):m<h?d=h<.01?(c=0,b=.707106781):(b=d/(c=Math.sqrt(h)),k/c):m<.01?(c=b=.707106781,d=0):(b=f/(d=Math.sqrt(m)),c=k/d),this.set(b,c,d,a)):(a=Math.sqrt((b-k)*(b-k)+(f-c)*(f-c)+(g-d)*(g-d)),Math.abs(a)<.001&&(a=1),this.x=(b-k)/a,this.y=(f-c)/a,this.z=(g-d)/a,this.w=Math.acos((e+h+m-1)/2)),this},min:function(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this.z=Math.min(this.z,a.z),this.w=Math.min(this.w,a.w),this},max:function(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this.z=Math.max(this.z,a.z),this.w=Math.max(this.w,a.w),this},clamp:function(a,b){return this.x=Math.max(a.x,Math.min(b.x,this.x)),this.y=Math.max(a.y,Math.min(b.y,this.y)),this.z=Math.max(a.z,Math.min(b.z,this.z)),this.w=Math.max(a.w,Math.min(b.w,this.w)),this},clampScalar:function(){var a,b;return function(c,d){return void 0===a&&(a=new fa,b=new fa),a.set(c,c,c,c),b.set(d,d,d,d),this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b,this.w+=(a.w-this.w)*b,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){return void 0===b&&(b=0),this.x=a[b],this.y=a[b+1],this.z=a[b+2],this.w=a[b+3],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.x,a[b+1]=this.y,a[b+2]=this.z,a[b+3]=this.w,a},fromBufferAttribute:function(a,b,c){return void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=a.getX(b),this.y=a.getY(b),this.z=a.getZ(b),this.w=a.getW(b),this}}),Object.assign(Cb.prototype,xa.prototype,{isWebGLRenderTarget:!0,setSize:function(a,b){this.width===a&&this.height===b||(this.width=a,this.height=b,this.dispose()),this.viewport.set(0,0,a,b),this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.width=a.width,this.height=a.height,this.viewport.copy(a.viewport),this.texture=a.texture.clone(),this.depthBuffer=a.depthBuffer,this.stencilBuffer=a.stencilBuffer,this.depthTexture=a.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((Db.prototype=Object.create(Cb.prototype)).constructor=Db).prototype.isWebGLRenderTargetCube=!0,Object.assign(oa,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h=c[d+0],k=c[d+1],m=c[d+2];c=c[d+3],d=e[f+0];var q=e[f+1],l=e[f+2];if(c!==(e=e[f+3])||h!==d||k!==q||m!==l){f=1-g;var p=h*d+k*q+m*l+c*e,r=0<=p?1:-1,n=1-p*p;n>Number.EPSILON&&(n=Math.sqrt(n),p=Math.atan2(n,p*r),f=Math.sin(f*p)/n,g=Math.sin(g*p)/n),h=h*f+d*(r*=g),k=k*f+q*r,m=m*f+l*r,c=c*f+e*r,f===1-g&&(h*=g=1/Math.sqrt(h*h+k*k+m*m+c*c),k*=g,m*=g,c*=g)}a[b]=h,a[b+1]=k,a[b+2]=m,a[b+3]=c}}),Object.defineProperties(oa.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a,this.onChangeCallback()}}}),Object.assign(oa.prototype,{set:function(a,b,c,d){return this._x=a,this._y=b,this._z=c,this._w=d,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){return this._x=a.x,this._y=a.y,this._z=a.z,this._w=a.w,this.onChangeCallback(),this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,e=a._z,f=a.order,g=Math.cos,h=Math.sin,k=g(c/2),m=g(d/2);g=g(e/2),c=h(c/2),d=h(d/2),e=h(e/2);return"XYZ"===f?(this._x=c*m*g+k*d*e,this._y=k*d*g-c*m*e,this._z=k*m*e+c*d*g,this._w=k*m*g-c*d*e):"YXZ"===f?(this._x=c*m*g+k*d*e,this._y=k*d*g-c*m*e,this._z=k*m*e-c*d*g,this._w=k*m*g+c*d*e):"ZXY"===f?(this._x=c*m*g-k*d*e,this._y=k*d*g+c*m*e,this._z=k*m*e+c*d*g,this._w=k*m*g-c*d*e):"ZYX"===f?(this._x=c*m*g-k*d*e,this._y=k*d*g+c*m*e,this._z=k*m*e-c*d*g,this._w=k*m*g+c*d*e):"YZX"===f?(this._x=c*m*g+k*d*e,this._y=k*d*g+c*m*e,this._z=k*m*e-c*d*g,this._w=k*m*g-c*d*e):"XZY"===f&&(this._x=c*m*g-k*d*e,this._y=k*d*g-c*m*e,this._z=k*m*e+c*d*g,this._w=k*m*g+c*d*e),!1!==b&&this.onChangeCallback(),this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);return this._x=a.x*d,this._y=a.y*d,this._z=a.z*d,this._w=Math.cos(c),this.onChangeCallback(),this},setFromRotationMatrix:function(a){var c=(b=a.elements)[0];a=b[4];var b,d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],k=b[6],m=c+f+(b=b[10]);return 0<m?(c=.5/Math.sqrt(m+1),this._w=.25/c,this._x=(k-g)*c,this._y=(d-h)*c,this._z=(e-a)*c):f<c&&b<c?(c=2*Math.sqrt(1+c-f-b),this._w=(k-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):b<f?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+k)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=.25*c),this.onChangeCallback(),this},setFromUnitVectors:function(){var b,a=new n;return function(c,d){return void 0===a&&(a=new n),(b=c.dot(d)+1)<1e-6?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d),this._x=a.x,this._y=a.y,this._z=a.z,this._w=b,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();return 0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a),this.onChangeCallback(),this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,k=b._z,m=b._w;return this._x=c*m+f*g+d*k-e*h,this._y=d*m+f*h+e*g-c*k,this._z=e*m+f*k+c*h-d*g,this._w=f*m-c*g-d*h-e*k,this.onChangeCallback(),this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w;if((g=f*a._w+c*a._x+d*a._y+e*a._z)<0?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a),1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=Math.sqrt(1-g*g);if(Math.abs(h)<.001)return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;var k=Math.atan2(h,g),g=Math.sin((1-b)*k)/h;h=Math.sin(b*k)/h;return this._w=f*g+this._w*h,this._x=c*g+this._x*h,this._y=d*g+this._y*h,this._z=e*g+this._z*h,this.onChangeCallback(),this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){return void 0===b&&(b=0),this._x=a[b],this._y=a[b+1],this._z=a[b+2],this._w=a[b+3],this.onChangeCallback(),this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this._x,a[b+1]=this._y,a[b+2]=this._z,a[b+3]=this._w,a},onChange:function(a){return this.onChangeCallback=a,this},onChangeCallback:function(){}}),Object.assign(n.prototype,{isVector3:!0,set:function(a,b,c){return this.x=a,this.y=b,this.z=c,this},setScalar:function(a){return this.z=this.y=this.x=a,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setZ:function(a){return this.z=a,this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a)}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){return this.x=a.x,this.y=a.y,this.z=a.z,this},add:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b)):(this.x+=a.x,this.y+=a.y,this.z+=a.z,this)},addScalar:function(a){return this.x+=a,this.y+=a,this.z+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this},addScaledVector:function(a,b){return this.x+=a.x*b,this.y+=a.y*b,this.z+=a.z*b,this},sub:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b)):(this.x-=a.x,this.y-=a.y,this.z-=a.z,this)},subScalar:function(a){return this.x-=a,this.y-=a,this.z-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b)):(this.x*=a.x,this.y*=a.y,this.z*=a.z,this)},multiplyScalar:function(a){return this.x*=a,this.y*=a,this.z*=a,this},multiplyVectors:function(a,b){return this.x=a.x*b.x,this.y=a.y*b.y,this.z=a.z*b.z,this},applyEuler:function(){var a=new oa;return function(b){return b&&b.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a=new oa;return function(b,c){return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;return a=a.elements,this.x=a[0]*b+a[3]*c+a[6]*d,this.y=a[1]*b+a[4]*c+a[7]*d,this.z=a[2]*b+a[5]*c+a[8]*d,this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=1/((a=a.elements)[3]*b+a[7]*c+a[11]*d+a[15]);return this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e,this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e,this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e,this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,h=(a=a.w)*b+f*d-g*c,k=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;return this.x=h*a+b*-e+k*-g-m*-f,this.y=k*a+b*-f+m*-e-h*-g,this.z=m*a+b*-g+h*-f-k*-e,this},project:function(){var a=new K;return function(b){return a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld)),this.applyMatrix4(a)}}(),unproject:function(){var a=new K;return function(b){return a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix)),this.applyMatrix4(a)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;return a=a.elements,this.x=a[0]*b+a[4]*c+a[8]*d,this.y=a[1]*b+a[5]*c+a[9]*d,this.z=a[2]*b+a[6]*c+a[10]*d,this.normalize()},divide:function(a){return this.x/=a.x,this.y/=a.y,this.z/=a.z,this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this.z=Math.min(this.z,a.z),this},max:function(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this.z=Math.max(this.z,a.z),this},clamp:function(a,b){return this.x=Math.max(a.x,Math.min(b.x,this.x)),this.y=Math.max(a.y,Math.min(b.y,this.y)),this.z=Math.max(a.z,Math.min(b.z,this.z)),this},clampScalar:function(){var a=new n,b=new n;return function(c,d){return a.set(c,c,c),b.set(d,d,d),this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;return this.x=d*a.z-e*a.y,this.y=e*a.x-c*a.z,this.z=c*a.y-d*a.x,this},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;return this.x=d*h-e*g,this.y=e*f-c*h,this.z=c*g-d*f,this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a=new n;return function(b){return a.copy(this).projectOnVector(b),this.sub(a)}}(),reflect:function(){var a=new n;return function(b){return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){return a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq()),Math.acos(Y.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;return b*b+c*c+(a=this.z-a.z)*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){var b=Math.sin(a.phi)*a.radius;return this.x=b*Math.sin(a.theta),this.y=Math.cos(a.phi)*a.radius,this.z=b*Math.cos(a.theta),this},setFromCylindrical:function(a){return this.x=a.radius*Math.sin(a.theta),this.y=a.y,this.z=a.radius*Math.cos(a.theta),this},setFromMatrixPosition:function(a){return a=a.elements,this.x=a[12],this.y=a[13],this.z=a[14],this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();return a=this.setFromMatrixColumn(a,2).length(),this.x=b,this.y=c,this.z=a,this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){return void 0===b&&(b=0),this.x=a[b],this.y=a[b+1],this.z=a[b+2],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.x,a[b+1]=this.y,a[b+2]=this.z,a},fromBufferAttribute:function(a,b,c){return void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=a.getX(b),this.y=a.getY(b),this.z=a.getZ(b),this}}),Object.assign(K.prototype,{isMatrix4:!0,set:function(a,b,c,d,e,f,g,h,k,m,q,l,p,r,n,t){var y=this.elements;return y[0]=a,y[4]=b,y[8]=c,y[12]=d,y[1]=e,y[5]=f,y[9]=g,y[13]=h,y[2]=k,y[6]=m,y[10]=q,y[14]=l,y[3]=p,y[7]=r,y[11]=n,y[15]=t,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new K).fromArray(this.elements)},copy:function(a){var b=this.elements;return a=a.elements,b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15],this},copyPosition:function(a){var b=this.elements;return a=a.elements,b[12]=a[12],b[13]=a[13],b[14]=a[14],this},extractBasis:function(a,b,c){return a.setFromMatrixColumn(this,0),b.setFromMatrixColumn(this,1),c.setFromMatrixColumn(this,2),this},makeBasis:function(a,b,c){return this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1),this},extractRotation:function(){var a=new n;return function(b){var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();return b=1/a.setFromMatrixColumn(b,2).length(),c[0]=d[0]*e,c[1]=d[1]*e,c[2]=d[2]*e,c[4]=d[4]*f,c[5]=d[5]*f,c[6]=d[6]*f,c[8]=d[8]*b,c[9]=d[9]*b,c[10]=d[10]*b,this}}(),makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),g=(c=Math.sin(c),Math.cos(d)),h=(d=Math.sin(d),Math.cos(e));e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e,m=c*h,q=c*e;b[0]=g*h,b[4]=-g*e,b[8]=d,b[1]=k+m*d,b[5]=a-q*d,b[9]=-c*g,b[2]=q-a*d,b[6]=m+k*d,b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,m=d*h,q=d*e,b[0]=a+q*c,b[4]=m*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-m,b[6]=q+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,m=d*h,q=d*e,b[0]=a-q*c,b[4]=-f*e,b[8]=m+k*c,b[1]=k+m*c,b[5]=f*h,b[9]=q-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,m=c*h,q=c*e,b[0]=g*h,b[4]=m*d-k,b[8]=a*d+q,b[1]=g*e,b[5]=q*d+a,b[9]=k*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,m=c*g,q=c*d,b[0]=g*h,b[4]=q-a*e,b[8]=m*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+m,b[10]=a-q*e):"XZY"===a.order&&(a=f*g,k=f*d,m=c*g,q=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+q,b[5]=f*h,b[9]=k*e-m,b[2]=m*e-k,b[6]=c*h,b[10]=q*e+a);return b[3]=0,b[7]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this},makeRotationFromQuaternion:function(a){var b=this.elements,c=a._x,d=a._y,e=a._z,f=a._w,k=e+e;a=c*(g=c+c);var m=c*(h=d+d),q=(c=c*k,d*h),g=(d=d*k,e=e*k,f*g),h=f*h;f*=k;return b[0]=1-(q+e),b[4]=m-f,b[8]=c+h,b[1]=m+f,b[5]=1-(a+e),b[9]=d-g,b[2]=c-h,b[6]=d+g,b[10]=1-(a+q),b[3]=0,b[7]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this},lookAt:function(){var a=new n,b=new n,c=new n;return function(d,e,f){var g=this.elements;return c.subVectors(d,e),0===c.lengthSq()&&(c.z=1),c.normalize(),a.crossVectors(f,c),0===a.lengthSq()&&(1===Math.abs(f.z)?c.x+=1e-4:c.z+=1e-4,c.normalize(),a.crossVectors(f,c)),a.normalize(),b.crossVectors(c,a),g[0]=a.x,g[4]=b.x,g[8]=c.x,g[1]=a.y,g[5]=b.y,g[9]=c.y,g[2]=a.z,g[6]=b.z,g[10]=c.z,this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],k=c[12],m=c[1],q=c[5],l=c[9],p=c[13],r=c[2],n=c[6],t=c[10],y=c[14],x=c[3],u=c[7],H=c[11],w=(c=c[15],d[0]),I=d[4],W=d[8],D=d[12],O=d[1],B=d[5],F=d[9],C=d[13],z=d[2],E=d[6],G=d[10],K=d[14],P=d[3],M=d[7],V=d[11];d=d[15];return e[0]=f*w+g*O+h*z+k*P,e[4]=f*I+g*B+h*E+k*M,e[8]=f*W+g*F+h*G+k*V,e[12]=f*D+g*C+h*K+k*d,e[1]=m*w+q*O+l*z+p*P,e[5]=m*I+q*B+l*E+p*M,e[9]=m*W+q*F+l*G+p*V,e[13]=m*D+q*C+l*K+p*d,e[2]=r*w+n*O+t*z+y*P,e[6]=r*I+n*B+t*E+y*M,e[10]=r*W+n*F+t*G+y*V,e[14]=r*D+n*C+t*K+y*d,e[3]=x*w+u*O+H*z+c*P,e[7]=x*I+u*B+H*E+c*M,e[11]=x*W+u*F+H*G+c*V,e[15]=x*D+u*C+H*K+c*d,this},multiplyScalar:function(a){var b=this.elements;return b[0]*=a,b[4]*=a,b[8]*=a,b[12]*=a,b[1]*=a,b[5]*=a,b[9]*=a,b[13]*=a,b[2]*=a,b[6]*=a,b[10]*=a,b[14]*=a,b[3]*=a,b[7]*=a,b[11]*=a,b[15]*=a,this},applyToBufferAttribute:function(){var a=new n;return function(b){for(var c=0,d=b.count;c<d;c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix4(this),b.setXYZ(c,a.x,a.y,a.z);return b}}(),determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],k=a[13],m=a[2],q=a[6],l=a[10],p=a[14];return a[3]*(+e*h*q-d*k*q-e*g*l+c*k*l+d*g*p-c*h*p)+a[7]*(+b*h*p-b*k*l+e*f*l-d*f*p+d*k*m-e*h*m)+a[11]*(+b*k*q-b*g*p-e*f*q+c*f*p+e*g*m-c*k*m)+a[15]*(-d*g*m-b*h*q+b*g*l+d*f*q-c*f*l+c*h*m)},transpose:function(){var b,a=this.elements;return b=a[1],a[1]=a[4],a[4]=b,b=a[2],a[2]=a[8],a[8]=b,b=a[6],a[6]=a[9],a[9]=b,b=a[3],a[3]=a[12],a[12]=b,b=a[7],a[7]=a[13],a[13]=b,b=a[11],a[11]=a[14],a[14]=b,this},setPosition:function(a){var b=this.elements;return b[12]=a.x,b[13]=a.y,b[14]=a.z,this},getInverse:function(a,b){var d,c=this.elements,e=(d=a.elements)[0],f=d[1],g=d[2],h=d[3],k=d[4],m=d[5],q=d[6],l=d[7],p=d[8],r=d[9],n=d[10],t=d[11],y=d[12],x=d[13],u=d[14],H=r*u*l-x*n*l+x*q*t-m*u*t-r*q*(d=d[15])+m*n*d,w=y*n*l-p*u*l-y*q*t+k*u*t+p*q*d-k*n*d,I=p*x*l-y*r*l+y*m*t-k*x*t-p*m*d+k*r*d,W=y*r*q-p*x*q-y*m*n+k*x*n+p*m*u-k*r*u,D=e*H+f*w+g*I+h*W;if(0!==D)return D=1/D,c[0]=H*D,c[1]=(x*n*h-r*u*h-x*g*t+f*u*t+r*g*d-f*n*d)*D,c[2]=(m*u*h-x*q*h+x*g*l-f*u*l-m*g*d+f*q*d)*D,c[3]=(r*q*h-m*n*h-r*g*l+f*n*l+m*g*t-f*q*t)*D,c[4]=w*D,c[5]=(p*u*h-y*n*h+y*g*t-e*u*t-p*g*d+e*n*d)*D,c[6]=(y*q*h-k*u*h-y*g*l+e*u*l+k*g*d-e*q*d)*D,c[7]=(k*n*h-p*q*h+p*g*l-e*n*l-k*g*t+e*q*t)*D,c[8]=I*D,c[9]=(y*r*h-p*x*h-y*f*t+e*x*t+p*f*d-e*r*d)*D,c[10]=(k*x*h-y*m*h+y*f*l-e*x*l-k*f*d+e*m*d)*D,c[11]=(p*m*h-k*r*h-p*f*l+e*r*l+k*f*t-e*m*t)*D,c[12]=W*D,c[13]=(p*x*g-y*r*g+y*f*n-e*x*n-p*f*u+e*r*u)*D,c[14]=(y*m*g-k*x*g-y*f*q+e*x*q+k*f*u-e*m*u)*D,c[15]=(k*r*g-p*m*g+p*f*q-e*r*q-k*f*n+e*m*n)*D,this;if(!0===b)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity()},scale:function(a){var b=this.elements,c=a.x,d=a.y;return a=a.z,b[0]*=c,b[4]*=d,b[8]*=a,b[1]*=c,b[5]*=d,b[9]*=a,b[2]*=c,b[6]*=d,b[10]*=a,b[3]*=c,b[7]*=d,b[11]*=a,this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))},makeTranslation:function(a,b,c){return this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1),this},makeRotationX:function(a){var b=Math.cos(a);return a=Math.sin(a),this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1),this},makeRotationY:function(a){var b=Math.cos(a);return a=Math.sin(a),this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1),this},makeRotationZ:function(a){var b=Math.cos(a);return a=Math.sin(a),this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,m=e*g;return this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,m*g+c,m*h-d*f,0,k*h-d*g,m*h+d*f,e*h*h+c,0,0,0,0,1),this},makeScale:function(a,b,c){return this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1),this},makeShear:function(a,b,c){return this.set(1,b,c,0,a,1,c,0,a,b,1,0,0,0,0,1),this},compose:function(a,b,c){return this.makeRotationFromQuaternion(b),this.scale(c),this.setPosition(a),this},decompose:function(){var a=new n,b=new K;return function(c,d,e){var f=this.elements,g=a.set(f[0],f[1],f[2]).length(),h=a.set(f[4],f[5],f[6]).length(),k=a.set(f[8],f[9],f[10]).length();this.determinant()<0&&(g=-g),c.x=f[12],c.y=f[13],c.z=f[14],b.copy(this),c=1/g;f=1/h;var m=1/k;return b.elements[0]*=c,b.elements[1]*=c,b.elements[2]*=c,b.elements[4]*=f,b.elements[5]*=f,b.elements[6]*=f,b.elements[8]*=m,b.elements[9]*=m,b.elements[10]*=m,d.setFromRotationMatrix(b),e.x=g,e.y=h,e.z=k,this}}(),makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var g=this.elements;return g[0]=2*e/(b-a),g[4]=0,g[8]=(b+a)/(b-a),g[12]=0,g[1]=0,g[5]=2*e/(c-d),g[9]=(c+d)/(c-d),g[13]=0,g[2]=0,g[6]=0,g[10]=-(f+e)/(f-e),g[14]=-2*f*e/(f-e),g[3]=0,g[7]=0,g[11]=-1,g[15]=0,this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),k=1/(c-d),m=1/(f-e);return g[0]=2*h,g[4]=0,g[8]=0,g[12]=-(b+a)*h,g[1]=0,g[5]=2*k,g[9]=0,g[13]=-(c+d)*k,g[2]=0,g[6]=0,g[10]=-2*m,g[14]=-(f+e)*m,g[3]=0,g[7]=0,g[11]=0,g[15]=1,this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;c<16;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;c<16;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]),void 0===b&&(b=0);var c=this.elements;return a[b]=c[0],a[b+1]=c[1],a[b+2]=c[2],a[b+3]=c[3],a[b+4]=c[4],a[b+5]=c[5],a[b+6]=c[6],a[b+7]=c[7],a[b+8]=c[8],a[b+9]=c[9],a[b+10]=c[10],a[b+11]=c[11],a[b+12]=c[12],a[b+13]=c[13],a[b+14]=c[14],a[b+15]=c[15],a}}),((db.prototype=Object.create(ba.prototype)).constructor=db).prototype.isDataTexture=!0,((Xa.prototype=Object.create(ba.prototype)).constructor=Xa).prototype.isCubeTexture=!0,Object.defineProperty(Xa.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});var Ce=new ba,De=new Xa,xe=[],ze=[],Be=new Float32Array(16),Ae=new Float32Array(9);He.prototype.setValue=function(a,b){for(var c=this.seq,d=0,e=c.length;d!==e;++d){var f=c[d];f.setValue(a,b[f.id])}};var Pd=/([\w\d_]+)(\])?(\[|\.)?/g;eb.prototype.setValue=function(a,b,c){void 0!==(b=this.map[b])&&b.setValue(a,c,this.renderer)},eb.prototype.setOptional=function(a,b,c){void 0!==(b=b[c])&&this.setValue(a,c,b)},eb.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],h=c[g.id];!1!==h.needsUpdate&&g.setValue(a,h.value,d)}},eb.seqWithValue=function(a,b){for(var c=[],d=0,e=a.length;d!==e;++d){var f=a[d];f.id in b&&c.push(f)}return c};var lg={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(G.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){return a&&a.isColor?this.copy(a):"number"==typeof a?this.setHex(a):"string"==typeof a&&this.setStyle(a),this},setScalar:function(a){return this.b=this.g=this.r=a,this},setHex:function(a){return a=Math.floor(a),this.r=(a>>16&255)/255,this.g=(a>>8&255)/255,this.b=(255&a)/255,this},setRGB:function(a,b,c){return this.r=a,this.g=b,this.b=c,this},setHSL:function(){function a(a,c,d){return d<0&&(d+=1),1<d&&--d,d<1/6?a+6*(c-a)*d:d<.5?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b,c,d){return b=Y.euclideanModulo(b,1),c=Y.clamp(c,0,1),d=Y.clamp(d,0,1),0===c?this.r=this.g=this.b=d:(d=2*d-(c=d<=.5?d*(1+c):d+c-d*c),this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3)),this}}(),setStyle:function(a){function b(b){void 0!==b&&parseFloat(b)<1&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case"rgb":case"rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case"hsl":case"hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){d=parseFloat(c[1])/360;var e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;return b(c[5]),this.setHSL(d,e,f)}}}else if(c=/^\#([A-Fa-f0-9]+)$/.exec(a)){if(3===(d=(c=c[1]).length))return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return a&&0<a.length&&(void 0!==(c=lg[a])?this.setHex(c):console.warn("THREE.Color: Unknown color "+a)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(a){return this.r=a.r,this.g=a.g,this.b=a.b,this},copyGammaToLinear:function(a,b){return void 0===b&&(b=2),this.r=Math.pow(a.r,b),this.g=Math.pow(a.g,b),this.b=Math.pow(a.b,b),this},copyLinearToGamma:function(a,b){void 0===b&&(b=2);var c=0<b?1/b:1;return this.r=Math.pow(a.r,c),this.g=Math.pow(a.g,c),this.b=Math.pow(a.b,c),this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;return this.r=a*a,this.g=b*b,this.b=c*c,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(a){a=a||{h:0,s:0,l:0};var g,b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),h=((f=Math.min(b,c,d))+e)/2;if(f===e)f=g=0;else{var k=e-f,f=h<=.5?k/(e+f):k/(2-e-f);switch(e){case b:g=(c-d)/k+(c<d?6:0);break;case c:g=(d-b)/k+2;break;case d:g=(b-c)/k+4}g/=6}return a.h=g,a.s=f,a.l=h,a},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,b,c){var d=this.getHSL();return d.h+=a,d.s+=b,d.l+=c,this.setHSL(d.h,d.s,d.l),this},add:function(a){return this.r+=a.r,this.g+=a.g,this.b+=a.b,this},addColors:function(a,b){return this.r=a.r+b.r,this.g=a.g+b.g,this.b=a.b+b.b,this},addScalar:function(a){return this.r+=a,this.g+=a,this.b+=a,this},sub:function(a){return this.r=Math.max(0,this.r-a.r),this.g=Math.max(0,this.g-a.g),this.b=Math.max(0,this.b-a.b),this},multiply:function(a){return this.r*=a.r,this.g*=a.g,this.b*=a.b,this},multiplyScalar:function(a){return this.r*=a,this.g*=a,this.b*=a,this},lerp:function(a,b){return this.r+=(a.r-this.r)*b,this.g+=(a.g-this.g)*b,this.b+=(a.b-this.b)*b,this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a,b){return void 0===b&&(b=0),this.r=a[b],this.g=a[b+1],this.b=a[b+2],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.r,a[b+1]=this.g,a[b+2]=this.b,a},toJSON:function(){return this.getHex()}});var R={common:{diffuse:{value:new G(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new fa(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new C(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new G(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new G(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new fa(0,0,1,1)}}},Ca={merge:function(a){for(var b={},c=0;c<a.length;c++){var e,d=this.clone(a[c]);for(e in d)b[e]=d[e]}return b},clone:function(a){var c,b={};for(c in a)for(var d in b[c]={},a[c]){var e=a[c][d];e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture)?b[c][d]=e.clone():Array.isArray(e)?b[c][d]=e.slice():b[c][d]=e}return b}},X={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = asin( flipNormal * reflectVec.y ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},$a={basic:{uniforms:Ca.merge([R.common,R.aomap,R.lightmap,R.fog]),vertexShader:X.meshbasic_vert,fragmentShader:X.meshbasic_frag},lambert:{uniforms:Ca.merge([R.common,R.aomap,R.lightmap,R.emissivemap,R.fog,R.lights,{emissive:{value:new G(0)}}]),vertexShader:X.meshlambert_vert,fragmentShader:X.meshlambert_frag},phong:{uniforms:Ca.merge([R.common,R.aomap,R.lightmap,R.emissivemap,R.bumpmap,R.normalmap,R.displacementmap,R.gradientmap,R.fog,R.lights,{emissive:{value:new G(0)},specular:{value:new G(1118481)},shininess:{value:30}}]),vertexShader:X.meshphong_vert,fragmentShader:X.meshphong_frag},standard:{uniforms:Ca.merge([R.common,R.aomap,R.lightmap,R.emissivemap,R.bumpmap,R.normalmap,R.displacementmap,R.roughnessmap,R.metalnessmap,R.fog,R.lights,{emissive:{value:new G(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:X.meshphysical_vert,fragmentShader:X.meshphysical_frag},points:{uniforms:Ca.merge([R.points,R.fog]),vertexShader:X.points_vert,fragmentShader:X.points_frag},dashed:{uniforms:Ca.merge([R.common,R.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:X.linedashed_vert,fragmentShader:X.linedashed_frag},depth:{uniforms:Ca.merge([R.common,R.displacementmap]),vertexShader:X.depth_vert,fragmentShader:X.depth_frag},normal:{uniforms:Ca.merge([R.common,R.bumpmap,R.normalmap,R.displacementmap,{opacity:{value:1}}]),vertexShader:X.normal_vert,fragmentShader:X.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:X.cube_vert,fragmentShader:X.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:X.equirect_vert,fragmentShader:X.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new n}},vertexShader:X.distanceRGBA_vert,fragmentShader:X.distanceRGBA_frag}};$a.physical={uniforms:Ca.merge([$a.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:X.meshphysical_vert,fragmentShader:X.meshphysical_frag},Object.assign(fd.prototype,{set:function(a,b){return this.min.copy(a),this.max.copy(b),this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new C;return function(b,c){var d=a.copy(c).multiplyScalar(.5);return this.min.copy(b).sub(d),this.max.copy(b).add(d),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.min.copy(a.min),this.max.copy(a.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(a){return a=a||new C,this.isEmpty()?a.set(0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){return a=a||new C,this.isEmpty()?a.set(0,0):a.subVectors(this.max,this.min)},expandByPoint:function(a){return this.min.min(a),this.max.max(a),this},expandByVector:function(a){return this.min.sub(a),this.max.add(a),this},expandByScalar:function(a){return this.min.addScalar(-a),this.max.addScalar(a),this},containsPoint:function(a){return!(a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y)},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){return(b||new C).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return!(a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y)},clampPoint:function(a,b){return(b||new C).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new C;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){return this.min.max(a.min),this.max.min(a.max),this},union:function(a){return this.min.min(a.min),this.max.max(a.max),this},translate:function(a){return this.min.add(a),this.max.add(a),this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Jf=0;Object.assign(U.prototype,xa.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else{var d=this[b];void 0===d?console.warn("THREE."+this.type+": '"+b+"' is not a property of this material."):d&&d.isColor?d.set(c):d&&d.isVector3&&c&&c.isVector3?d.copy(c):this[b]="overdraw"===b?Number(c):c}}},toJSON:function(a){function b(a){var c,b=[];for(c in a){var d=a[c];delete d.metadata,b.push(d)}return b}var c=void 0===a;c&&(a={textures:{},images:{}});var d={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};return d.uuid=this.uuid,d.type=this.type,""!==this.name&&(d.name=this.name),this.color&&this.color.isColor&&(d.color=this.color.getHex()),void 0!==this.roughness&&(d.roughness=this.roughness),void 0!==this.metalness&&(d.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex()),void 0!==this.shininess&&(d.shininess=this.shininess),void 0!==this.clearCoat&&(d.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(d.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(d.map=this.map.toJSON(a).uuid),this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap=this.alphaMap.toJSON(a).uuid),this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(a).uuid),this.bumpMap&&this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(a).uuid,d.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(a).uuid,d.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(a).uuid,d.displacementScale=this.displacementScale,d.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(a).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(a).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(d.emissiveMap=this.emissiveMap.toJSON(a).uuid),this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(a).uuid),this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(a).uuid,d.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(d.gradientMap=this.gradientMap.toJSON(a).uuid),void 0!==this.size&&(d.size=this.size),void 0!==this.sizeAttenuation&&(d.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(d.blending=this.blending),2!==this.shading&&(d.shading=this.shading),0!==this.side&&(d.side=this.side),0!==this.vertexColors&&(d.vertexColors=this.vertexColors),this.opacity<1&&(d.opacity=this.opacity),!0===this.transparent&&(d.transparent=this.transparent),d.depthFunc=this.depthFunc,d.depthTest=this.depthTest,d.depthWrite=this.depthWrite,0<this.alphaTest&&(d.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(d.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(d.wireframe=this.wireframe),1<this.wireframeLinewidth&&(d.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(d.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(d.wireframeLinejoin=this.wireframeLinejoin),d.skinning=this.skinning,d.morphTargets=this.morphTargets,d.dithering=this.dithering,c&&(c=b(a.textures),a=b(a.images),0<c.length&&(d.textures=c),0<a.length&&(d.images=a)),d},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=a.name,this.fog=a.fog,this.lights=a.lights,this.blending=a.blending,this.side=a.side,this.shading=a.shading,this.vertexColors=a.vertexColors,this.opacity=a.opacity,this.transparent=a.transparent,this.blendSrc=a.blendSrc,this.blendDst=a.blendDst,this.blendEquation=a.blendEquation,this.blendSrcAlpha=a.blendSrcAlpha,this.blendDstAlpha=a.blendDstAlpha,this.blendEquationAlpha=a.blendEquationAlpha,this.depthFunc=a.depthFunc,this.depthTest=a.depthTest,this.depthWrite=a.depthWrite,this.colorWrite=a.colorWrite,this.precision=a.precision,this.polygonOffset=a.polygonOffset,this.polygonOffsetFactor=a.polygonOffsetFactor,this.polygonOffsetUnits=a.polygonOffsetUnits,this.dithering=a.dithering,this.alphaTest=a.alphaTest,this.premultipliedAlpha=a.premultipliedAlpha,this.overdraw=a.overdraw,this.visible=a.visible,this.clipShadows=a.clipShadows,this.clipIntersection=a.clipIntersection;var b=null;if(null!==(a=a.clippingPlanes))for(var c=a.length,d=(b=Array(c),0);d!==c;++d)b[d]=a[d].clone();return this.clippingPlanes=b,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((ra.prototype=Object.create(U.prototype)).constructor=ra).prototype.isShaderMaterial=!0,ra.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.fragmentShader=a.fragmentShader,this.vertexShader=a.vertexShader,this.uniforms=Ca.clone(a.uniforms),this.defines=a.defines,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.lights=a.lights,this.clipping=a.clipping,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this.extensions=a.extensions,this},ra.prototype.toJSON=function(a){return(a=U.prototype.toJSON.call(this,a)).uniforms=this.uniforms,a.vertexShader=this.vertexShader,a.fragmentShader=this.fragmentShader,a},((Za.prototype=Object.create(U.prototype)).constructor=Za).prototype.isMeshDepthMaterial=!0,Za.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.depthPacking=a.depthPacking,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.map=a.map,this.alphaMap=a.alphaMap,this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this},Object.assign(Ra.prototype,{isBox3:!0,set:function(a,b){return this.min.copy(a),this.max.copy(b),this},setFromArray:function(a){for(var b=1/0,c=1/0,d=1/0,e=-1/0,f=-1/0,g=-1/0,h=0,k=a.length;h<k;h+=3){var m=a[h],q=a[h+1],l=a[h+2];m<b&&(b=m),q<c&&(c=q),l<d&&(d=l),e<m&&(e=m),f<q&&(f=q),g<l&&(g=l)}return this.min.set(b,c,d),this.max.set(e,f,g),this},setFromBufferAttribute:function(a){for(var b=1/0,c=1/0,d=1/0,e=-1/0,f=-1/0,g=-1/0,h=0,k=a.count;h<k;h++){var m=a.getX(h),q=a.getY(h),l=a.getZ(h);m<b&&(b=m),q<c&&(c=q),l<d&&(d=l),e<m&&(e=m),f<q&&(f=q),g<l&&(g=l)}return this.min.set(b,c,d),this.max.set(e,f,g),this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new n;return function(b,c){var d=a.copy(c).multiplyScalar(.5);return this.min.copy(b).sub(d),this.max.copy(b).add(d),this}}(),setFromObject:function(a){return this.makeEmpty(),this.expandByObject(a)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.min.copy(a.min),this.max.copy(a.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(a){return a=a||new n,this.isEmpty()?a.set(0,0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){return a=a||new n,this.isEmpty()?a.set(0,0,0):a.subVectors(this.max,this.min)},expandByPoint:function(a){return this.min.min(a),this.max.max(a),this},expandByVector:function(a){return this.min.sub(a),this.max.add(a),this},expandByScalar:function(a){return this.min.addScalar(-a),this.max.addScalar(a),this},expandByObject:function(){var a=new n;return function(b){var c=this;return b.updateMatrixWorld(!0),b.traverse(function(b){var e,f;if(void 0!==(e=b.geometry))if(e.isGeometry){var g=e.vertices;for(e=0,f=g.length;e<f;e++)a.copy(g[e]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a)}else if(e.isBufferGeometry&&void 0!==(g=e.attributes.position))for(e=0,f=g.count;e<f;e++)a.fromBufferAttribute(g,e).applyMatrix4(b.matrixWorld),c.expandByPoint(a)}),this}}(),containsPoint:function(a){return!(a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z)},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){return(b||new n).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return!(a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z)},intersectsSphere:function(){var a=new n;return function(b){return this.clampPoint(b.center,a),a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){var b,c;return c=0<a.normal.x?(b=a.normal.x*this.min.x,a.normal.x*this.max.x):(b=a.normal.x*this.max.x,a.normal.x*this.min.x),0<a.normal.y?(b+=a.normal.y*this.min.y,c+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,c+=a.normal.y*this.min.y),0<a.normal.z?(b+=a.normal.z*this.min.z,c+=a.normal.z*this.max.z):(b+=a.normal.z*this.max.z,c+=a.normal.z*this.min.z),b<=a.constant&&c>=a.constant},clampPoint:function(a,b){return(b||new n).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new n;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new n;return function(b){return b=b||new Ea,this.getCenter(b.center),b.radius=.5*this.getSize(a).length(),b}}(),intersect:function(a){return this.min.max(a.min),this.max.min(a.max),this.isEmpty()&&this.makeEmpty(),this},union:function(a){return this.min.min(a.min),this.max.max(a.max),this},applyMatrix4:function(){var a=[new n,new n,new n,new n,new n,new n,new n,new n];return function(b){return this.isEmpty()||(a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b),a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b),a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b),a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b),a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b),a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b),a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b),a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b),this.setFromPoints(a)),this}}(),translate:function(a){return this.min.add(a),this.max.add(a),this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}}),Object.assign(Ea.prototype,{set:function(a,b){return this.center.copy(a),this.radius=b,this},setFromPoints:function(){var a=new Ra;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d);for(var e=0,f=0,g=b.length;f<g;f++)e=Math.max(e,d.distanceToSquared(b[f]));return this.radius=Math.sqrt(e),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.center.copy(a.center),this.radius=a.radius,this},empty:function(){return this.radius<=0},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(this.center.dot(a.normal)-a.constant)<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new n;return d.copy(a),c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center)),d},getBoundingBox:function(a){return(a=a||new Ra).set(this.center,this.center),a.expandByScalar(this.radius),a},applyMatrix4:function(a){return this.center.applyMatrix4(a),this.radius*=a.getMaxScaleOnAxis(),this},translate:function(a){return this.center.add(a),this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}}),Object.assign(Ba.prototype,{isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,k){var m=this.elements;return m[0]=a,m[1]=d,m[2]=g,m[3]=b,m[4]=e,m[5]=h,m[6]=c,m[7]=f,m[8]=k,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;return a=a.elements,b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],this},setFromMatrix4:function(a){return a=a.elements,this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]),this},applyToBufferAttribute:function(){var a=new n;return function(b){for(var c=0,d=b.count;c<d;c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix3(this),b.setXYZ(c,a.x,a.y,a.z);return b}}(),multiply:function(a){return this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[3],h=c[6],k=c[1],m=c[4],q=c[7],l=c[2],p=c[5],r=(c=c[8],d[0]),n=d[3],t=d[6],y=d[1],x=d[4],u=d[7],H=d[2],w=d[5];d=d[8];return e[0]=f*r+g*y+h*H,e[3]=f*n+g*x+h*w,e[6]=f*t+g*u+h*d,e[1]=k*r+m*y+q*H,e[4]=k*n+m*x+q*w,e[7]=k*t+m*u+q*d,e[2]=l*r+p*y+c*H,e[5]=l*n+p*x+c*w,e[8]=l*t+p*u+c*d,this},multiplyScalar:function(a){var b=this.elements;return b[0]*=a,b[3]*=a,b[6]*=a,b[1]*=a,b[4]*=a,b[7]*=a,b[2]*=a,b[5]*=a,b[8]*=a,this},determinant:function(){var a,b=(a=this.elements)[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],k=a[7];return b*f*(a=a[8])-b*g*k-c*e*a+c*g*h+d*e*k-d*f*h},getInverse:function(a,b){a&&a.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var c=a.elements,d=this.elements,e=c[0],f=c[1],g=c[2],h=c[3],k=c[4],m=c[5],q=c[6],l=c[7],p=(c=c[8])*k-m*l,r=m*q-c*h,n=l*h-k*q,t=e*p+f*r+g*n;if(0!==t)return t=1/t,d[0]=p*t,d[1]=(g*l-c*f)*t,d[2]=(m*f-g*k)*t,d[3]=r*t,d[4]=(c*e-g*q)*t,d[5]=(g*h-m*e)*t,d[6]=n*t,d[7]=(f*q-l*e)*t,d[8]=(k*e-f*h)*t,this;if(!0===b)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity()},transpose:function(){var a,b=this.elements;return a=b[1],b[1]=b[3],b[3]=a,a=b[2],b[2]=b[6],b[6]=a,a=b[5],b[5]=b[7],b[7]=a,this},getNormalMatrix:function(a){return this.setFromMatrix4(a).getInverse(this).transpose()},transposeIntoArray:function(a){var b=this.elements;return a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8],this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;c<9;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;c<9;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]),void 0===b&&(b=0);var c=this.elements;return a[b]=c[0],a[b+1]=c[1],a[b+2]=c[2],a[b+3]=c[3],a[b+4]=c[4],a[b+5]=c[5],a[b+6]=c[6],a[b+7]=c[7],a[b+8]=c[8],a}}),Object.assign(Aa.prototype,{set:function(a,b){return this.normal.copy(a),this.constant=b,this},setComponents:function(a,b,c,d){return this.normal.set(a,b,c),this.constant=d,this},setFromNormalAndCoplanarPoint:function(a,b){return this.normal.copy(a),this.constant=-b.dot(this.normal),this},setFromCoplanarPoints:function(){var a=new n,b=new n;return function(c,d,e){return d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize(),this.setFromNormalAndCoplanarPoint(d,c),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.normal.copy(a.normal),this.constant=a.constant,this},normalize:function(){var a=1/this.normal.length();return this.normal.multiplyScalar(a),this.constant*=a,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,b){var c=this.distanceToPoint(a);return(b||new n).copy(this.normal).multiplyScalar(c)},intersectLine:function(){var a=new n;return function(b,c){var d=c||new n,e=b.delta(a),f=this.normal.dot(e);return 0!==f?(f=-(b.start.dot(this.normal)+this.constant)/f)<0||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start):0===this.distanceToPoint(b.start)?d.copy(b.start):void 0}}(),intersectsLine:function(a){var b=this.distanceToPoint(a.start);return a=this.distanceToPoint(a.end),b<0&&0<a||a<0&&0<b},intersectsBox:function(a){return a.intersectsPlane(this)},intersectsSphere:function(a){return a.intersectsPlane(this)},coplanarPoint:function(a){return(a||new n).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new n,b=new Ba;return function(c,d){var e=this.coplanarPoint(a).applyMatrix4(c),f=d||b.getNormalMatrix(c);f=this.normal.applyMatrix3(f).normalize();return this.constant=-e.dot(f),this}}(),translate:function(a){return this.constant-=a.dot(this.normal),this},equals:function(a){return a.normal.equals(this.normal)&&a.constant===this.constant}}),Object.assign(gd.prototype,{set:function(a,b,c,d,e,f){var g=this.planes;return g[0].copy(a),g[1].copy(b),g[2].copy(c),g[3].copy(d),g[4].copy(e),g[5].copy(f),this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b=this.planes,c=0;c<6;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes;a=(c=a.elements)[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],m=c[7],q=c[8],l=c[9],p=c[10],r=c[11],n=c[12],t=c[13],y=c[14],c=c[15];return b[0].setComponents(f-a,m-g,r-q,c-n).normalize(),b[1].setComponents(f+a,m+g,r+q,c+n).normalize(),b[2].setComponents(f+d,m+h,r+l,c+t).normalize(),b[3].setComponents(f-d,m-h,r-l,c-t).normalize(),b[4].setComponents(f-e,m-k,r-p,c-y).normalize(),b[5].setComponents(f+e,m+k,r+p,c+y).normalize(),this},intersectsObject:function(){var a=new Ea;return function(b){var c=b.geometry;return null===c.boundingSphere&&c.computeBoundingSphere(),a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld),this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Ea;return function(b){return a.center.set(0,0,0),a.radius=.7071067811865476,a.applyMatrix4(b.matrixWorld),this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;d<6;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new n,b=new n;return function(c){for(var d=this.planes,e=0;e<6;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x,b.x=0<f.normal.x?c.max.x:c.min.x,a.y=0<f.normal.y?c.min.y:c.max.y,b.y=0<f.normal.y?c.max.y:c.min.y,a.z=0<f.normal.z?c.min.z:c.max.z,b.z=0<f.normal.z?c.max.z:c.min.z;var g=f.distanceToPoint(a);f=f.distanceToPoint(b);if(g<0&&f<0)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;c<6;c++)if(b[c].distanceToPoint(a)<0)return!1;return!0}}),ab.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),ab.DefaultOrder="XYZ",Object.defineProperties(ab.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(a){this._order=a,this.onChangeCallback()}}}),Object.assign(ab.prototype,{isEuler:!0,set:function(a,b,c,d){return this._x=a,this._y=b,this._z=c,this._order=d||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){return this._x=a._x,this._y=a._y,this._z=a._z,this._order=a._order,this.onChangeCallback(),this},setFromRotationMatrix:function(a,b,c){var d=Y.clamp;a=(e=a.elements)[0];var f=e[4],g=e[8],h=e[1],k=e[5],m=e[9],q=e[2],l=e[6],e=e[10];return"XYZ"===(b=b||this._order)?(this._y=Math.asin(d(g,-1,1)),Math.abs(g)<.99999?(this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(l,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),Math.abs(m)<.99999?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,k)):(this._y=Math.atan2(-q,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(-q,e),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(q,-1,1)),Math.abs(q)<.99999?(this._x=Math.atan2(l,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-m,k),this._y=Math.atan2(-q,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),Math.abs(f)<.99999?(this._x=Math.atan2(l,k),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b),this._order=b,!1!==c&&this.onChangeCallback(),this},setFromQuaternion:function(){var a=new K;return function(b,c,d){return a.makeRotationFromQuaternion(b),this.setFromRotationMatrix(a,c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new oa;return function(b){return a.setFromEuler(this),this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){return this._x=a[0],this._y=a[1],this._z=a[2],void 0!==a[3]&&(this._order=a[3]),this.onChangeCallback(),this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this._x,a[b+1]=this._y,a[b+2]=this._z,a[b+3]=this._order,a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},onChange:function(a){return this.onChangeCallback=a,this},onChangeCallback:function(){}}),Object.assign(Qd.prototype,{set:function(a){this.mask=1<<a|0},enable:function(a){this.mask=this.mask|1<<a|0},toggle:function(a){this.mask^=1<<a|0},disable:function(a){this.mask&=~(1<<a|0)},test:function(a){return 0!=(this.mask&a.mask)}});var Lf=0;z.DefaultUp=new n(0,1,0),z.DefaultMatrixAutoUpdate=!0,Object.assign(z.prototype,xa.prototype,{isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(a){return this.quaternion.premultiply(a),this},setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function(){var a=new oa;return function(b,c){return a.setFromAxisAngle(b,c),this.quaternion.multiply(a),this}}(),rotateX:function(){var a=new n(1,0,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateY:function(){var a=new n(0,1,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateZ:function(){var a=new n(0,0,1);return function(b){return this.rotateOnAxis(a,b)}}(),translateOnAxis:function(){var a=new n;return function(b,c){return a.copy(b).applyQuaternion(this.quaternion),this.position.add(a.multiplyScalar(c)),this}}(),translateX:function(){var a=new n(1,0,0);return function(b){return this.translateOnAxis(a,b)}}(),translateY:function(){var a=new n(0,1,0);return function(b){return this.translateOnAxis(a,b)}}(),translateZ:function(){var a=new n(0,0,1);return function(b){return this.translateOnAxis(a,b)}}(),localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var a=new K;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}}(),lookAt:function(){var a=new K;return function(b){this.isCamera?a.lookAt(this.position,b,this.up):a.lookAt(b,this.position,this.up),this.quaternion.setFromRotationMatrix(a)}}(),add:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.add(arguments[b]);return this}return a===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",a):a&&a.isObject3D?(null!==a.parent&&a.parent.remove(a),a.parent=this,a.dispatchEvent({type:"added"}),this.children.push(a)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",a),this},remove:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);return this}return-1!==(b=this.children.indexOf(a))&&(a.parent=null,a.dispatchEvent({type:"removed"}),this.children.splice(b,1)),this},getObjectById:function(a){return this.getObjectByProperty("id",a)},getObjectByName:function(a){return this.getObjectByProperty("name",a)},getObjectByProperty:function(a,b){if(this[a]===b)return this;for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c].getObjectByProperty(a,b);if(void 0!==e)return e}},getWorldPosition:function(a){return a=a||new n,this.updateMatrixWorld(!0),a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var a=new n,b=new n;return function(c){return c=c||new oa,this.updateMatrixWorld(!0),this.matrixWorld.decompose(a,c,b),c}}(),getWorldRotation:function(){var a=new oa;return function(b){return b=b||new ab,this.getWorldQuaternion(a),b.setFromQuaternion(a,this.rotation.order,!1)}}(),getWorldScale:function(){var a=new n,b=new oa;return function(c){return c=c||new n,this.updateMatrixWorld(!0),this.matrixWorld.decompose(a,b,c),c}}(),getWorldDirection:function(){var a=new oa;return function(b){return b=b||new n,this.getWorldQuaternion(a),b.set(0,0,1).applyQuaternion(a)}}(),raycast:function(){},traverse:function(a){a(this);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].traverseVisible(a)}},traverseAncestors:function(a){var b=this.parent;null!==b&&(a(b),b.traverseAncestors(a))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||a)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),a=!(this.matrixWorldNeedsUpdate=!1));for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].updateMatrixWorld(a)},toJSON:function(a){function b(b,c){return void 0===b[c.uuid]&&(b[c.uuid]=c.toJSON(a)),c.uuid}function c(a){var c,b=[];for(c in a){var d=a[c];delete d.metadata,b.push(d)}return b}var d=void 0===a||""===a,e={};d&&(a={geometries:{},materials:{},textures:{},images:{}},e.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var f={};if(f.uuid=this.uuid,f.type=this.type,""!==this.name&&(f.name=this.name),"{}"!==JSON.stringify(this.userData)&&(f.userData=this.userData),!0===this.castShadow&&(f.castShadow=!0),!0===this.receiveShadow&&(f.receiveShadow=!0),!1===this.visible&&(f.visible=!1),f.matrix=this.matrix.toArray(),void 0!==this.geometry&&(f.geometry=b(a.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var g=[],h=0,k=this.material.length;h<k;h++)g.push(b(a.materials,this.material[h]));f.material=g}else f.material=b(a.materials,this.material);if(0<this.children.length)for(f.children=[],h=0;h<this.children.length;h++)f.children.push(this.children[h].toJSON(a).object);return d&&(d=c(a.geometries),g=c(a.materials),h=c(a.textures),k=c(a.images),0<d.length&&(e.geometries=d),0<g.length&&(e.materials=g),0<h.length&&(e.textures=h),0<k.length&&(e.images=k)),e.object=f,e},clone:function(a){return(new this.constructor).copy(this,a)},copy:function(a,b){if(void 0===b&&(b=!0),this.name=a.name,this.up.copy(a.up),this.position.copy(a.position),this.quaternion.copy(a.quaternion),this.scale.copy(a.scale),this.matrix.copy(a.matrix),this.matrixWorld.copy(a.matrixWorld),this.matrixAutoUpdate=a.matrixAutoUpdate,this.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate,this.layers.mask=a.layers.mask,this.visible=a.visible,this.castShadow=a.castShadow,this.receiveShadow=a.receiveShadow,this.frustumCulled=a.frustumCulled,this.renderOrder=a.renderOrder,this.userData=JSON.parse(JSON.stringify(a.userData)),!0===b)for(var c=0;c<a.children.length;c++)this.add(a.children[c].clone());return this}}),Na.prototype=Object.assign(Object.create(z.prototype),{constructor:Na,isCamera:!0,copy:function(a,b){return z.prototype.copy.call(this,a,b),this.matrixWorldInverse.copy(a.matrixWorldInverse),this.projectionMatrix.copy(a.projectionMatrix),this},getWorldDirection:function(){var a=new oa;return function(b){return b=b||new n,this.getWorldQuaternion(a),b.set(0,0,-1).applyQuaternion(a)}}(),updateMatrixWorld:function(a){z.prototype.updateMatrixWorld.call(this,a),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Fb.prototype=Object.assign(Object.create(Na.prototype),{constructor:Fb,isOrthographicCamera:!0,copy:function(a,b){return Na.prototype.copy.call(this,a,b),this.left=a.left,this.right=a.right,this.top=a.top,this.bottom=a.bottom,this.near=a.near,this.far=a.far,this.zoom=a.zoom,this.view=null===a.view?null:Object.assign({},a.view),this},setViewOffset:function(a,b,c,d,e,f){this.view={fullWidth:a,fullHeight:b,offsetX:c,offsetY:d,width:e,height:f},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),e=(c=(this.right+this.left)/2)-a,c=c+a;a=(d=(this.top+this.bottom)/2)+b,b=d-b;if(null!==this.view){c=this.zoom/(this.view.width/this.view.fullWidth),b=this.zoom/(this.view.height/this.view.fullHeight);var f=(this.right-this.left)/this.view.width,d=(this.top-this.bottom)/this.view.height;c=(e=e+this.view.offsetX/c*f)+this.view.width/c*f,b=(a=a-this.view.offsetY/b*d)-this.view.height/b*d}this.projectionMatrix.makeOrthographic(e,c,a,b,this.near,this.far)},toJSON:function(a){return(a=z.prototype.toJSON.call(this,a)).object.zoom=this.zoom,a.object.left=this.left,a.object.right=this.right,a.object.top=this.top,a.object.bottom=this.bottom,a.object.near=this.near,a.object.far=this.far,null!==this.view&&(a.object.view=Object.assign({},this.view)),a}}),qa.prototype=Object.assign(Object.create(Na.prototype),{constructor:qa,isPerspectiveCamera:!0,copy:function(a,b){return Na.prototype.copy.call(this,a,b),this.fov=a.fov,this.zoom=a.zoom,this.near=a.near,this.far=a.far,this.focus=a.focus,this.aspect=a.aspect,this.view=null===a.view?null:Object.assign({},a.view),this.filmGauge=a.filmGauge,this.filmOffset=a.filmOffset,this},setFocalLength:function(a){a=.5*this.getFilmHeight()/a,this.fov=2*Y.RAD2DEG*Math.atan(a),this.updateProjectionMatrix()},getFocalLength:function(){var a=Math.tan(.5*Y.DEG2RAD*this.fov);return.5*this.getFilmHeight()/a},getEffectiveFOV:function(){return 2*Y.RAD2DEG*Math.atan(Math.tan(.5*Y.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(a,b,c,d,e,f){this.aspect=a/b,this.view={fullWidth:a,fullHeight:b,offsetX:c,offsetY:d,width:e,height:f},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=this.near,c=2*(b=a*Math.tan(.5*Y.DEG2RAD*this.fov)/this.zoom),e=-.5*(d=this.aspect*c),f=this.view;if(null!==f){var g=f.fullWidth,h=f.fullHeight,b=(e=e+f.offsetX*d/g,b-f.offsetY*c/h),d=f.width/g*d;c=f.height/h*c}0!==(f=this.filmOffset)&&(e+=a*f/this.getFilmWidth()),this.projectionMatrix.makePerspective(e,e+d,b,b-c,a,this.far)},toJSON:function(a){return(a=z.prototype.toJSON.call(this,a)).object.fov=this.fov,a.object.zoom=this.zoom,a.object.near=this.near,a.object.far=this.far,a.object.focus=this.focus,a.object.aspect=this.aspect,null!==this.view&&(a.object.view=Object.assign({},this.view)),a.object.filmGauge=this.filmGauge,a.object.filmOffset=this.filmOffset,a}}),Object.assign(Sa.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a=a.a,this.b=a.b,this.c=a.c,this.normal.copy(a.normal),this.color.copy(a.color),this.materialIndex=a.materialIndex;for(var b=0,c=a.vertexNormals.length;b<c;b++)this.vertexNormals[b]=a.vertexNormals[b].clone();for(b=0,c=a.vertexColors.length;b<c;b++)this.vertexColors[b]=a.vertexColors[b].clone();return this}});var Rd=0;Object.assign(J.prototype,xa.prototype,{isGeometry:!0,applyMatrix:function(a){for(var b=(new Ba).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);for(c=0,d=this.faces.length;c<d;c++){(a=this.faces[c]).normal.applyMatrix3(b).normalize();for(var e=0,f=a.vertexNormals.length;e<f;e++)a.vertexNormals[e].applyMatrix3(b).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0,this},rotateX:function(){var a=new K;return function(b){return a.makeRotationX(b),this.applyMatrix(a),this}}(),rotateY:function(){var a=new K;return function(b){return a.makeRotationY(b),this.applyMatrix(a),this}}(),rotateZ:function(){var a=new K;return function(b){return a.makeRotationZ(b),this.applyMatrix(a),this}}(),translate:function(){var a=new K;return function(b,c,d){return a.makeTranslation(b,c,d),this.applyMatrix(a),this}}(),scale:function(){var a=new K;return function(b,c,d){return a.makeScale(b,c,d),this.applyMatrix(a),this}}(),lookAt:function(){var a=new z;return function(b){a.lookAt(b),a.updateMatrix(),this.applyMatrix(a.matrix)}}(),fromBufferGeometry:function(a){function b(a,b,d,e){e=new Sa(a,b,d,void 0!==g?[q[a].clone(),q[b].clone(),q[d].clone()]:[],void 0!==h?[c.colors[a].clone(),c.colors[b].clone(),c.colors[d].clone()]:[],e),c.faces.push(e),void 0!==k&&c.faceVertexUvs[0].push([l[a].clone(),l[b].clone(),l[d].clone()]),void 0!==m&&c.faceVertexUvs[1].push([p[a].clone(),p[b].clone(),p[d].clone()])}var c=this,d=null!==a.index?a.index.array:void 0,e=a.attributes,f=e.position.array,g=void 0!==e.normal?e.normal.array:void 0,h=void 0!==e.color?e.color.array:void 0,k=void 0!==e.uv?e.uv.array:void 0,m=void 0!==e.uv2?e.uv2.array:void 0;void 0!==m&&(this.faceVertexUvs[1]=[]);for(var q=[],l=[],p=[],r=e=0;e<f.length;e+=3,r+=2)c.vertices.push(new n(f[e],f[e+1],f[e+2])),void 0!==g&&q.push(new n(g[e],g[e+1],g[e+2])),void 0!==h&&c.colors.push(new G(h[e],h[e+1],h[e+2])),void 0!==k&&l.push(new C(k[r],k[r+1])),void 0!==m&&p.push(new C(m[r],m[r+1]));var ca=a.groups;if(0<ca.length)for(e=0;e<ca.length;e++){r=t=(f=ca[e]).start;for(var t=t+f.count;r<t;r+=3)void 0!==d?b(d[r],d[r+1],d[r+2],f.materialIndex):b(r,r+1,r+2,f.materialIndex)}else if(void 0!==d)for(e=0;e<d.length;e+=3)b(d[e],d[e+1],d[e+2]);else for(e=0;e<f.length/3;e+=3)b(e,e+1,e+2);return this.computeFaceNormals(),null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone()),null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var a=this.boundingBox.getCenter().negate();return this.translate(a.x,a.y,a.z),a},normalize:function(){this.computeBoundingSphere();var a=this.boundingSphere.center,b=0===(b=this.boundingSphere.radius)?1:1/b,c=new K;return c.set(b,0,0,-b*a.x,0,b,0,-b*a.y,0,0,b,-b*a.z,0,0,0,1),this.applyMatrix(c),this},computeFaceNormals:function(){for(var a=new n,b=new n,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g),b.subVectors(f,g),a.cross(b),a.normalize(),e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d;for(void 0===a&&(a=!0),d=Array(this.vertices.length),b=0,c=this.vertices.length;b<c;b++)d[b]=new n;if(a){var e,f,g,h=new n,k=new n;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.subVectors(g,f),k.subVectors(e,f),h.cross(k),d[c.a].add(h),d[c.b].add(h),d[c.c].add(h)}else for(this.computeFaceNormals(),a=0,b=this.faces.length;a<b;a++)d[(c=this.faces[a]).a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);for(b=0,c=this.vertices.length;b<c;b++)d[b].normalize();for(a=0,b=this.faces.length;a<b;a++)3===(e=(c=this.faces[a]).vertexNormals).length?(e[0].copy(d[c.a]),e[1].copy(d[c.b]),e[2].copy(d[c.c])):(e[0]=d[c.a].clone(),e[1]=d[c.b].clone(),e[2]=d[c.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var a,b,c;for(this.computeFaceNormals(),a=0,b=this.faces.length;a<b;a++){var d=(c=this.faces[a]).vertexNormals;3===d.length?(d[0].copy(c.normal),d[1].copy(c.normal),d[2].copy(c.normal)):(d[0]=c.normal.clone(),d[1]=c.normal.clone(),d[2]=c.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var a,b,c,d,e;for(c=0,d=this.faces.length;c<d;c++)for((e=this.faces[c]).__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var f=new J;for(f.faces=this.faces,a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={},this.morphNormals[a].faceNormals=[],this.morphNormals[a].vertexNormals=[],e=this.morphNormals[a].faceNormals;var h,k,g=this.morphNormals[a].vertexNormals;for(c=0,d=this.faces.length;c<d;c++)h=new n,k={a:new n,b:new n,c:new n},e.push(h),g.push(k)}for(g=this.morphNormals[a],f.vertices=this.morphTargets[a].vertices,f.computeFaceNormals(),f.computeVertexNormals(),c=0,d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],k=g.vertexNormals[c],h.copy(e.normal),k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])}for(c=0,d=this.faces.length;c<d;c++)(e=this.faces[c]).normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ra),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Ea),this.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(a&&a.isGeometry){var d,e=this.vertices.length,f=this.vertices,g=a.vertices,h=this.faces,k=a.faces,m=this.faceVertexUvs[0],q=a.faceVertexUvs[0],l=this.colors,p=a.colors;void 0===c&&(c=0),void 0!==b&&(d=(new Ba).getNormalMatrix(b)),a=0;for(var r=g.length;a<r;a++){var n=g[a].clone();void 0!==b&&n.applyMatrix4(b),f.push(n)}for(a=0,r=p.length;a<r;a++)l.push(p[a].clone());for(a=0,r=k.length;a<r;a++){var t=(g=k[a]).vertexNormals;p=g.vertexColors;for((l=new Sa(g.a+e,g.b+e,g.c+e)).normal.copy(g.normal),void 0!==d&&l.normal.applyMatrix3(d).normalize(),b=0,f=t.length;b<f;b++)n=t[b].clone(),void 0!==d&&n.applyMatrix3(d).normalize(),l.vertexNormals.push(n);for(l.color.copy(g.color),b=0,f=p.length;b<f;b++)n=p[b],l.vertexColors.push(n.clone());l.materialIndex=g.materialIndex+c,h.push(l)}for(a=0,r=q.length;a<r;a++)if(d=[],void 0!==(c=q[a])){for(b=0,f=c.length;b<f;b++)d.push(c[b].clone());m.push(d)}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",a)},mergeMesh:function(a){a&&a.isMesh?(a.matrixAutoUpdate&&a.updateMatrix(),this.merge(a.geometry,a.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a)},mergeVertices:function(){var d,f,g,a={},b=[],c=[],e=Math.pow(10,4);for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f],void 0===a[d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e)]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(a=[],f=0,g=this.faces.length;f<g;f++)for((e=this.faces[f]).a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;d<3;d++)if(e[d]===e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);return f=this.vertices.length-b.length,this.vertices=b,f},sortFacesByMaterialIndex:function(){for(var a=this.faces,b=a.length,c=0;c<b;c++)a[c]._id=c;a.sort(function(a,b){return a.materialIndex-b.materialIndex});var f,g,d=this.faceVertexUvs[0],e=this.faceVertexUvs[1];for(d&&d.length===b&&(f=[]),e&&e.length===b&&(g=[]),c=0;c<b;c++){var h=a[c]._id;f&&f.push(d[h]),g&&g.push(e[h])}f&&(this.faceVertexUvs[0]=f),g&&(this.faceVertexUvs[1]=g)},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();return void 0!==m[b]||(m[b]=k.length/3,k.push(a.x,a.y,a.z)),m[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();return void 0!==l[b]||(l[b]=q.length,q.push(a.getHex())),l[b]}function d(a){var b=a.x.toString()+a.y.toString();return void 0!==r[b]||(r[b]=p.length/2,p.push(a.x,a.y)),r[b]}var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var g,f=this.parameters;for(g in f)void 0!==f[g]&&(e[g]=f[g]);return e}for(f=[],g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}h=[];var k=[],m={},q=[],l={},p=[],r={};for(g=0;g<this.faces.length;g++){var n=this.faces[g],t=void 0!==this.faceVertexUvs[0][g],y=0<n.normal.length(),x=0<n.vertexNormals.length,u=1!==n.color.r||1!==n.color.g||1!==n.color.b,H=0<n.vertexColors.length,w=a(w=a(w=a(w=a(w=a(w=a(w=a(w=a(w=0,0,0),1,!0),2,!1),3,t),4,y),5,x),6,u),7,H);h.push(w),h.push(n.a,n.b,n.c),h.push(n.materialIndex),t&&(t=this.faceVertexUvs[0][g],h.push(d(t[0]),d(t[1]),d(t[2]))),y&&h.push(b(n.normal)),x&&(y=n.vertexNormals,h.push(b(y[0]),b(y[1]),b(y[2]))),u&&h.push(c(n.color)),H&&(n=n.vertexColors,h.push(c(n[0]),c(n[1]),c(n[2])))}return e.data={},e.data.vertices=f,e.data.normals=k,0<q.length&&(e.data.colors=q),0<p.length&&(e.data.uvs=[p]),e.data.faces=h,e},clone:function(){return(new J).copy(this)},copy:function(a){var b,c,d,e,f,g;for(this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.name=a.name,b=0,c=(d=a.vertices).length;b<c;b++)this.vertices.push(d[b].clone());for(b=0,c=(d=a.colors).length;b<c;b++)this.colors.push(d[b].clone());for(b=0,c=(d=a.faces).length;b<c;b++)this.faces.push(d[b].clone());for(b=0,c=a.faceVertexUvs.length;b<c;b++){var h=a.faceVertexUvs[b];for(void 0===this.faceVertexUvs[b]&&(this.faceVertexUvs[b]=[]),d=0,e=h.length;d<e;d++){var k=h[d],m=[];for(f=0,g=k.length;f<g;f++)m.push(k[f].clone());this.faceVertexUvs[b].push(m)}}for(b=0,c=(f=a.morphTargets).length;b<c;b++){if((g={}).name=f[b].name,void 0!==f[b].vertices)for(g.vertices=[],d=0,e=f[b].vertices.length;d<e;d++)g.vertices.push(f[b].vertices[d].clone());if(void 0!==f[b].normals)for(g.normals=[],d=0,e=f[b].normals.length;d<e;d++)g.normals.push(f[b].normals[d].clone());this.morphTargets.push(g)}for(b=0,c=(f=a.morphNormals).length;b<c;b++){if(g={},void 0!==f[b].vertexNormals)for(g.vertexNormals=[],d=0,e=f[b].vertexNormals.length;d<e;d++)h=f[b].vertexNormals[d],(k={}).a=h.a.clone(),k.b=h.b.clone(),k.c=h.c.clone(),g.vertexNormals.push(k);if(void 0!==f[b].faceNormals)for(g.faceNormals=[],d=0,e=f[b].faceNormals.length;d<e;d++)g.faceNormals.push(f[b].faceNormals[d].clone());this.morphNormals.push(g)}for(b=0,c=(d=a.skinWeights).length;b<c;b++)this.skinWeights.push(d[b].clone());for(b=0,c=(d=a.skinIndices).length;b<c;b++)this.skinIndices.push(d[b].clone());for(b=0,c=(d=a.lineDistances).length;b<c;b++)this.lineDistances.push(d[b]);return null!==(b=a.boundingBox)&&(this.boundingBox=b.clone()),null!==(b=a.boundingSphere)&&(this.boundingSphere=b.clone()),this.elementsNeedUpdate=a.elementsNeedUpdate,this.verticesNeedUpdate=a.verticesNeedUpdate,this.uvsNeedUpdate=a.uvsNeedUpdate,this.normalsNeedUpdate=a.normalsNeedUpdate,this.colorsNeedUpdate=a.colorsNeedUpdate,this.lineDistancesNeedUpdate=a.lineDistancesNeedUpdate,this.groupsNeedUpdate=a.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Z.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}}),Object.assign(Z.prototype,{isBufferAttribute:!0,setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==a?a.length/this.itemSize:0,this.array=a},setDynamic:function(a){return this.dynamic=a,this},copy:function(a){return this.array=new a.array.constructor(a.array),this.itemSize=a.itemSize,this.count=a.count,this.normalized=a.normalized,this.dynamic=a.dynamic,this},copyAt:function(a,b,c){a*=this.itemSize,c*=b.itemSize;for(var d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d];return this},copyArray:function(a){return this.array.set(a),this},copyColorsArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",d),f=new G),b[c++]=f.r,b[c++]=f.g,b[c++]=f.b}return this},copyIndicesArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];b[c++]=f.a,b[c++]=f.b,b[c++]=f.c}return this},copyVector2sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",d),f=new C),b[c++]=f.x,b[c++]=f.y}return this},copyVector3sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",d),f=new n),b[c++]=f.x,b[c++]=f.y,b[c++]=f.z}return this},copyVector4sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",d),f=new fa),b[c++]=f.x,b[c++]=f.y,b[c++]=f.z,b[c++]=f.w}return this},set:function(a,b){return void 0===b&&(b=0),this.array.set(a,b),this},getX:function(a){return this.array[a*this.itemSize]},setX:function(a,b){return this.array[a*this.itemSize]=b,this},getY:function(a){return this.array[a*this.itemSize+1]},setY:function(a,b){return this.array[a*this.itemSize+1]=b,this},getZ:function(a){return this.array[a*this.itemSize+2]},setZ:function(a,b){return this.array[a*this.itemSize+2]=b,this},getW:function(a){return this.array[a*this.itemSize+3]},setW:function(a,b){return this.array[a*this.itemSize+3]=b,this},setXY:function(a,b,c){return a*=this.itemSize,this.array[a+0]=b,this.array[a+1]=c,this},setXYZ:function(a,b,c,d){return a*=this.itemSize,this.array[a+0]=b,this.array[a+1]=c,this.array[a+2]=d,this},setXYZW:function(a,b,c,d,e){return a*=this.itemSize,this.array[a+0]=b,this.array[a+1]=c,this.array[a+2]=d,this.array[a+3]=e,this},onUpload:function(a){return this.onUploadCallback=a,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(pc.prototype=Object.create(Z.prototype)).constructor=pc,(qc.prototype=Object.create(Z.prototype)).constructor=qc,(rc.prototype=Object.create(Z.prototype)).constructor=rc,(sc.prototype=Object.create(Z.prototype)).constructor=sc,(gb.prototype=Object.create(Z.prototype)).constructor=gb,(tc.prototype=Object.create(Z.prototype)).constructor=tc,(hb.prototype=Object.create(Z.prototype)).constructor=hb,(B.prototype=Object.create(Z.prototype)).constructor=B,(uc.prototype=Object.create(Z.prototype)).constructor=uc,Object.assign(Je.prototype,{computeGroups:function(a){var b,c=[],d=void 0;a=a.faces;for(var e=0;e<a.length;e++){var f=a[e];f.materialIndex!==d&&(d=f.materialIndex,void 0!==b&&(b.count=3*e-b.start,c.push(b)),b={start:3*e,materialIndex:d})}void 0!==b&&(b.count=3*e-b.start,c.push(b)),this.groups=c},fromGeometry:function(a){var k,b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,f=d[1]&&0<d[1].length,g=a.morphTargets,h=g.length;if(0<h){k=[];for(var m=0;m<h;m++)k[m]=[];this.morphTargets.position=k}var p,q=a.morphNormals,l=q.length;if(0<l){for(p=[],m=0;m<l;m++)p[m]=[];this.morphTargets.normal=p}var r=a.skinIndices,n=a.skinWeights,t=r.length===c.length,y=n.length===c.length;for(m=0;m<b.length;m++){var x=b[m];this.vertices.push(c[x.a],c[x.b],c[x.c]);var u=x.vertexNormals;for(3===u.length?this.normals.push(u[0],u[1],u[2]):(u=x.normal,this.normals.push(u,u,u)),3===(u=x.vertexColors).length?this.colors.push(u[0],u[1],u[2]):(u=x.color,this.colors.push(u,u,u)),!0===e&&(void 0!==(u=d[0][m])?this.uvs.push(u[0],u[1],u[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",m),this.uvs.push(new C,new C,new C))),!0===f&&(void 0!==(u=d[1][m])?this.uvs2.push(u[0],u[1],u[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",m),this.uvs2.push(new C,new C,new C))),u=0;u<h;u++){var H=g[u].vertices;k[u].push(H[x.a],H[x.b],H[x.c])}for(u=0;u<l;u++)H=q[u].vertexNormals[m],p[u].push(H.a,H.b,H.c);t&&this.skinIndices.push(r[x.a],r[x.b],r[x.c]),y&&this.skinWeights.push(n[x.a],n[x.b],n[x.c])}return this.computeGroups(a),this.verticesNeedUpdate=a.verticesNeedUpdate,this.normalsNeedUpdate=a.normalsNeedUpdate,this.colorsNeedUpdate=a.colorsNeedUpdate,this.uvsNeedUpdate=a.uvsNeedUpdate,this.groupsNeedUpdate=a.groupsNeedUpdate,this}}),E.MaxIndex=65535,Object.assign(E.prototype,xa.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(a){Array.isArray(a)?this.index=new(65535<Sd(a)?hb:gb)(a,1):this.index=a},addAttribute:function(a,b,c){if(b&&b.isBufferAttribute||b&&b.isInterleavedBufferAttribute){if("index"!==a)return this.attributes[a]=b,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(b)}else console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(a,new Z(b,c))},getAttribute:function(a){return this.attributes[a]},removeAttribute:function(a){return delete this.attributes[a],this},addGroup:function(a,b,c){this.groups.push({start:a,count:b,materialIndex:void 0!==c?c:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(a,b){this.drawRange.start=a,this.drawRange.count=b},applyMatrix:function(a){var b=this.attributes.position;return void 0!==b&&(a.applyToBufferAttribute(b),b.needsUpdate=!0),void 0!==(b=this.attributes.normal)&&((new Ba).getNormalMatrix(a).applyToBufferAttribute(b),b.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var a=new K;return function(b){return a.makeRotationX(b),this.applyMatrix(a),this}}(),rotateY:function(){var a=new K;return function(b){return a.makeRotationY(b),this.applyMatrix(a),this}}(),rotateZ:function(){var a=new K;return function(b){return a.makeRotationZ(b),this.applyMatrix(a),this}}(),translate:function(){var a=new K;return function(b,c,d){return a.makeTranslation(b,c,d),this.applyMatrix(a),this}}(),scale:function(){var a=new K;return function(b,c,d){return a.makeScale(b,c,d),this.applyMatrix(a),this}}(),lookAt:function(){var a=new z;return function(b){a.lookAt(b),a.updateMatrix(),this.applyMatrix(a.matrix)}}(),center:function(){this.computeBoundingBox();var a=this.boundingBox.getCenter().negate();return this.translate(a.x,a.y,a.z),a},setFromObject:function(a){var b=a.geometry;if(a.isPoints||a.isLine){a=new B(3*b.vertices.length,3);var c=new B(3*b.colors.length,3);this.addAttribute("position",a.copyVector3sArray(b.vertices)),this.addAttribute("color",c.copyColorsArray(b.colors)),b.lineDistances&&b.lineDistances.length===b.vertices.length&&(a=new B(b.lineDistances.length,1),this.addAttribute("lineDistance",a.copyArray(b.lineDistances))),null!==b.boundingSphere&&(this.boundingSphere=b.boundingSphere.clone()),null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone())}else a.isMesh&&b&&b.isGeometry&&this.fromGeometry(b);return this},updateFromObject:function(a){var b=a.geometry;if(a.isMesh){var c=b.__directGeometry;if(!0===b.elementsNeedUpdate&&(c=void 0,b.elementsNeedUpdate=!1),void 0===c)return this.fromGeometry(b);c.verticesNeedUpdate=b.verticesNeedUpdate,c.normalsNeedUpdate=b.normalsNeedUpdate,c.colorsNeedUpdate=b.colorsNeedUpdate,c.uvsNeedUpdate=b.uvsNeedUpdate,c.groupsNeedUpdate=b.groupsNeedUpdate,b.verticesNeedUpdate=!1,b.normalsNeedUpdate=!1,b.colorsNeedUpdate=!1,b.uvsNeedUpdate=!1,b.groupsNeedUpdate=!1,b=c}return!0===b.verticesNeedUpdate&&(void 0!==(c=this.attributes.position)&&(c.copyVector3sArray(b.vertices),c.needsUpdate=!0),b.verticesNeedUpdate=!1),!0===b.normalsNeedUpdate&&(void 0!==(c=this.attributes.normal)&&(c.copyVector3sArray(b.normals),c.needsUpdate=!0),b.normalsNeedUpdate=!1),!0===b.colorsNeedUpdate&&(void 0!==(c=this.attributes.color)&&(c.copyColorsArray(b.colors),c.needsUpdate=!0),b.colorsNeedUpdate=!1),b.uvsNeedUpdate&&(void 0!==(c=this.attributes.uv)&&(c.copyVector2sArray(b.uvs),c.needsUpdate=!0),b.uvsNeedUpdate=!1),b.lineDistancesNeedUpdate&&(void 0!==(c=this.attributes.lineDistance)&&(c.copyArray(b.lineDistances),c.needsUpdate=!0),b.lineDistancesNeedUpdate=!1),b.groupsNeedUpdate&&(b.computeGroups(a.geometry),this.groups=b.groups,b.groupsNeedUpdate=!1),this},fromGeometry:function(a){return a.__directGeometry=(new Je).fromGeometry(a),this.fromDirectGeometry(a.__directGeometry)},fromDirectGeometry:function(a){var b=new Float32Array(3*a.vertices.length);for(var c in this.addAttribute("position",new Z(b,3).copyVector3sArray(a.vertices)),0<a.normals.length&&(b=new Float32Array(3*a.normals.length),this.addAttribute("normal",new Z(b,3).copyVector3sArray(a.normals))),0<a.colors.length&&(b=new Float32Array(3*a.colors.length),this.addAttribute("color",new Z(b,3).copyColorsArray(a.colors))),0<a.uvs.length&&(b=new Float32Array(2*a.uvs.length),this.addAttribute("uv",new Z(b,2).copyVector2sArray(a.uvs))),0<a.uvs2.length&&(b=new Float32Array(2*a.uvs2.length),this.addAttribute("uv2",new Z(b,2).copyVector2sArray(a.uvs2))),0<a.indices.length&&(b=new(65535<Sd(a.indices)?Uint32Array:Uint16Array)(3*a.indices.length),this.setIndex(new Z(b,1).copyIndicesArray(a.indices))),this.groups=a.groups,a.morphTargets){b=[];for(var d=a.morphTargets[c],e=0,f=d.length;e<f;e++){var g=d[e],h=new B(3*g.length,3);b.push(h.copyVector3sArray(g))}this.morphAttributes[c]=b}return 0<a.skinIndices.length&&(c=new B(4*a.skinIndices.length,4),this.addAttribute("skinIndex",c.copyVector4sArray(a.skinIndices))),0<a.skinWeights.length&&(c=new B(4*a.skinWeights.length,4),this.addAttribute("skinWeight",c.copyVector4sArray(a.skinWeights))),null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone()),null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ra);var a=this.attributes.position;void 0!==a?this.boundingBox.setFromBufferAttribute(a):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var a=new Ra,b=new n;return function(){null===this.boundingSphere&&(this.boundingSphere=new Ea);var c=this.attributes.position;if(c){var d=this.boundingSphere.center;a.setFromBufferAttribute(c),a.getCenter(d);for(var e=0,f=0,g=c.count;f<g;f++)b.x=c.getX(f),b.y=c.getY(f),b.z=c.getZ(f),e=Math.max(e,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(e),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.index,b=this.attributes,c=this.groups;if(b.position){var d=b.position.array;if(void 0===b.normal)this.addAttribute("normal",new Z(new Float32Array(d.length),3));else for(var f=0,g=(e=b.normal.array).length;f<g;f++)e[f]=0;var h,k,m,e=b.normal.array,q=new n,l=new n,p=new n,r=new n,ca=new n;if(a){a=a.array,0===c.length&&this.addGroup(0,a.length);for(var t=0,y=c.length;t<y;++t)for(g=(f=c[t]).start,h=f.count,f=g,g+=h;f<g;f+=3)h=3*a[f+0],k=3*a[f+1],m=3*a[f+2],q.fromArray(d,h),l.fromArray(d,k),p.fromArray(d,m),r.subVectors(p,l),ca.subVectors(q,l),r.cross(ca),e[h]+=r.x,e[h+1]+=r.y,e[h+2]+=r.z,e[k]+=r.x,e[1+k]+=r.y,e[2+k]+=r.z,e[m]+=r.x,e[1+m]+=r.y,e[2+m]+=r.z}else for(f=0,g=d.length;f<g;f+=9)q.fromArray(d,f),l.fromArray(d,f+3),p.fromArray(d,f+6),r.subVectors(p,l),ca.subVectors(q,l),r.cross(ca),e[f]=r.x,e[f+1]=r.y,e[f+2]=r.z,e[f+3]=r.x,e[f+4]=r.y,e[f+5]=r.z,e[f+6]=r.x,e[f+7]=r.y,e[f+8]=r.z;this.normalizeNormals(),b.normal.needsUpdate=!0}},merge:function(a,b){if(a&&a.isBufferGeometry){void 0===b&&(b=0);var d,c=this.attributes;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,g=(f=a.attributes[d]).array,h=0,f=f.itemSize*b;h<g.length;h++,f++)e[f]=g[h];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a)},normalizeNormals:function(){for(var b,c,d,e,a=this.attributes.normal,f=0,g=a.count;f<g;f++)b=a.getX(f),c=a.getY(f),d=a.getZ(f),e=1/Math.sqrt(b*b+c*c+d*d),a.setXYZ(f,b*e,c*e,d*e)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var d,a=new E,b=this.index.array,c=this.attributes;for(d in c){for(var h,f=(e=c[d]).array,e=e.itemSize,g=new f.constructor(b.length*e),k=0,m=0,q=b.length;m<q;m++){h=b[m]*e;for(var l=0;l<e;l++)g[k++]=f[h++]}a.addAttribute(d,new Z(g,e))}return a},toJSON:function(){var a={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),void 0!==this.parameters){var c,b=this.parameters;for(c in b)void 0!==b[c]&&(a[c]=b[c]);return a}a.data={attributes:{}};var d=this.index;for(c in null!==d&&(b=Array.prototype.slice.call(d.array),a.data.index={type:d.array.constructor.name,array:b}),d=this.attributes){var e=d[c];b=Array.prototype.slice.call(e.array);a.data.attributes[c]={itemSize:e.itemSize,type:e.array.constructor.name,array:b,normalized:e.normalized}}return 0<(c=this.groups).length&&(a.data.groups=JSON.parse(JSON.stringify(c))),null!==(c=this.boundingSphere)&&(a.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),a},clone:function(){return(new E).copy(this)},copy:function(a){var b,c,d;for(b in this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.name=a.name,null!==(c=a.index)&&this.setIndex(c.clone()),c=a.attributes)this.addAttribute(b,c[b].clone());var e=a.morphAttributes;for(b in e){var f=[],g=e[b];for(c=0,d=g.length;c<d;c++)f.push(g[c].clone());this.morphAttributes[b]=f}for(c=0,d=(b=a.groups).length;c<d;c++)e=b[c],this.addGroup(e.start,e.count,e.materialIndex);return null!==(b=a.boundingBox)&&(this.boundingBox=b.clone()),null!==(b=a.boundingSphere)&&(this.boundingSphere=b.clone()),this.drawRange.start=a.drawRange.start,this.drawRange.count=a.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(Gb.prototype=Object.create(J.prototype)).constructor=Gb,(ib.prototype=Object.create(E.prototype)).constructor=ib,(vc.prototype=Object.create(J.prototype)).constructor=vc,(jb.prototype=Object.create(E.prototype)).constructor=jb,((ya.prototype=Object.create(U.prototype)).constructor=ya).prototype.isMeshBasicMaterial=!0,ya.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.combine=a.combine,this.reflectivity=a.reflectivity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this},Object.assign(kb.prototype,{set:function(a,b){return this.origin.copy(a),this.direction.copy(b),this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.origin.copy(a.origin),this.direction.copy(a.direction),this},at:function(a,b){return(b||new n).copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){return this.direction.copy(a).sub(this.origin).normalize(),this},recast:function(){var a=new n;return function(b){return this.origin.copy(this.at(b,a)),this}}(),closestPointToPoint:function(a,b){var c=b||new n;c.subVectors(a,this.origin);var d=c.dot(this.direction);return d<0?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new n;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);return c<0?this.origin.distanceToSquared(b):(a.copy(this.direction).multiplyScalar(c).add(this.origin),a.distanceToSquared(b))}}(),distanceSqToSegment:function(){var a=new n,b=new n,c=new n;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5),b.copy(e).sub(d).normalize(),c.copy(this.origin).sub(a);var r,h=.5*d.distanceTo(e),k=-this.direction.dot(b),m=c.dot(this.direction),q=-c.dot(b),l=c.lengthSq(),p=Math.abs(1-k*k);return k=0<p?(e=k*m-q,r=h*p,0<=(d=k*q-m)?-r<=e?e<=r?(d*=h=1/p)*(d+k*(e*=h)+2*m)+e*(k*d+e+2*q)+l:(e=h,-(d=Math.max(0,-(k*e+m)))*d+e*(e+2*q)+l):(e=-h,-(d=Math.max(0,-(k*e+m)))*d+e*(e+2*q)+l):e<=-r?-(d=Math.max(0,-(-k*h+m)))*d+(e=0<d?-h:Math.min(Math.max(-h,-q),h))*(e+2*q)+l:e<=r?(d=0,(e=Math.min(Math.max(-h,-q),h))*(e+2*q)+l):-(d=Math.max(0,-(k*h+m)))*d+(e=0<d?h:Math.min(Math.max(-h,-q),h))*(e+2*q)+l):(e=0<k?-h:h,-(d=Math.max(0,-(k*e+m)))*d+e*(e+2*q)+l),f&&f.copy(this.direction).multiplyScalar(d).add(this.origin),g&&g.copy(b).multiplyScalar(e).add(a),k}}(),intersectSphere:function(){var a=new n;return function(b,c){a.subVectors(b.center,this.origin);var d=a.dot(this.direction),e=a.dot(a)-d*d,f=b.radius*b.radius;return f<e?null:(e=d-(f=Math.sqrt(f-e)),d+=f,e<0&&d<0?null:e<0?this.at(d,c):this.at(e,c))}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);return 0===b?0===a.distanceToPoint(this.origin)?0:null:0<=(a=-(this.origin.dot(a.normal)+a.constant)/b)?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||a.normal.dot(this.direction)*b<0},intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x,f=1/this.direction.y,g=1/this.direction.z;var h=this.origin;return 0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x),0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y),f<c||d<e?null:((c<e||c!=c)&&(c=e),(f<d||d!=d)&&(d=f),0<=g?(e=(a.min.z-h.z)*g,g*=a.max.z-h.z):(e=(a.max.z-h.z)*g,g*=a.min.z-h.z),g<c||d<e?null:((c<e||c!=c)&&(c=e),(g<d||d!=d)&&(d=g),d<0?null:this.at(0<=c?c:d,b)))},intersectsBox:function(){var a=new n;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new n,b=new n,c=new n,d=new n;return function(e,f,g,h,k){if(b.subVectors(f,e),c.subVectors(g,e),d.crossVectors(b,c),0<(f=this.direction.dot(d))){if(h)return null;h=1}else{if(!(f<0))return null;h=-1,f=-f}return a.subVectors(this.origin,e),(e=h*this.direction.dot(c.crossVectors(a,c)))<0?null:(g=h*this.direction.dot(b.cross(a)))<0||f<e+g?null:(e=-h*a.dot(d))<0?null:this.at(e/f,k)}}(),applyMatrix4:function(a){return this.origin.applyMatrix4(a),this.direction.transformDirection(a),this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}}),Object.assign(Hb.prototype,{set:function(a,b){return this.start.copy(a),this.end.copy(b),this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.start.copy(a.start),this.end.copy(a.end),this},getCenter:function(a){return(a||new n).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new n).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){var c=b||new n;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new n,b=new n;return function(c,d){a.subVectors(c,this.start),b.subVectors(this.end,this.start);var e=b.dot(b);e=b.dot(a)/e;return d&&(e=Y.clamp(e,0,1)),e}}(),closestPointToPoint:function(a,b,c){return a=this.closestPointToPointParameter(a,b),c=c||new n,this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){return this.start.applyMatrix4(a),this.end.applyMatrix4(a),this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}}),Object.assign(Ta,{normal:function(){var a=new n;return function(b,c,d,e){return(e=e||new n).subVectors(d,c),a.subVectors(b,c),e.cross(a),0<(b=e.lengthSq())?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}(),barycoordFromPoint:function(){var a=new n,b=new n,c=new n;return function(d,e,f,g,h){a.subVectors(g,e),b.subVectors(f,e),c.subVectors(d,e),d=a.dot(a),e=a.dot(b),f=a.dot(c);var k=b.dot(b);g=b.dot(c);var m=d*k-e*e;return h=h||new n,0===m?h.set(-2,-1,-1):(k=(k*f-e*g)*(m=1/m),d=(d*g-e*f)*m,h.set(1-k-d,d,k))}}(),containsPoint:function(){var a=new n;return function(b,c,d,e){return 0<=(b=Ta.barycoordFromPoint(b,c,d,e,a)).x&&0<=b.y&&b.x+b.y<=1}}()}),Object.assign(Ta.prototype,{set:function(a,b,c){return this.a.copy(a),this.b.copy(b),this.c.copy(c),this},setFromPointsAndIndices:function(a,b,c,d){return this.a.copy(a[b]),this.b.copy(a[c]),this.c.copy(a[d]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.a.copy(a.a),this.b.copy(a.b),this.c.copy(a.c),this},area:function(){var a=new n,b=new n;return function(){return a.subVectors(this.c,this.b),b.subVectors(this.a,this.b),.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new n).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return Ta.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new Aa).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return Ta.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return Ta.containsPoint(a,this.a,this.b,this.c)},closestPointToPoint:function(){var a=new Aa,b=[new Hb,new Hb,new Hb],c=new n,d=new n;return function(e,f){var g=f||new n,h=1/0;if(a.setFromCoplanarPoints(this.a,this.b,this.c),a.projectPoint(e,c),!0===this.containsPoint(c))g.copy(c);else{b[0].set(this.a,this.b),b[1].set(this.b,this.c),b[2].set(this.c,this.a);for(var k=0;k<b.length;k++){b[k].closestPointToPoint(c,!0,d);var m=c.distanceToSquared(d);m<h&&(h=m,g.copy(d))}}return g}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}}),la.prototype=Object.assign(Object.create(z.prototype),{constructor:la,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){return z.prototype.copy.call(this,a),this.drawMode=a.drawMode,this},updateMorphTargets:function(){var b,c,a=this.geometry;if(a.isBufferGeometry){if(a=a.morphAttributes,0<(b=Object.keys(a)).length){var d=a[b[0]];if(void 0!==d)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},a=0,b=d.length;a<b;a++)c=d[a].name||String(a),this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=a}}else if(void 0!==(d=a.morphTargets)&&0<d.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},a=0,b=d.length;a<b;a++)c=d[a].name||String(a),this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=a},raycast:function(){function a(a,b,c,d,e,f,g){return Ta.barycoordFromPoint(a,b,c,d,t),e.multiplyScalar(t.x),f.multiplyScalar(t.y),g.multiplyScalar(t.z),e.add(f).add(g),e.clone()}function b(a,b,c,d,e,f,g){var h=a.material;return null===(1===h.side?c.intersectTriangle(f,e,d,!0,g):c.intersectTriangle(d,e,f,2!==h.side,g))?null:(x.copy(g),x.applyMatrix4(a.matrixWorld),(c=b.ray.origin.distanceTo(x))<b.near||c>b.far?null:{distance:c,point:x.clone(),object:a})}function c(c,d,e,f,m,q,l,n){return g.fromBufferAttribute(f,q),h.fromBufferAttribute(f,l),k.fromBufferAttribute(f,n),(c=b(c,d,e,g,h,k,y))&&(m&&(p.fromBufferAttribute(m,q),r.fromBufferAttribute(m,l),ca.fromBufferAttribute(m,n),c.uv=a(y,g,h,k,p,r,ca)),c.face=new Sa(q,l,n,Ta.normal(g,h,k)),c.faceIndex=q),c}var d=new K,e=new kb,f=new Ea,g=new n,h=new n,k=new n,m=new n,q=new n,l=new n,p=new C,r=new C,ca=new C,t=new n,y=new n,x=new n;return function(n,t){var D,w=this.geometry,x=this.material,B=this.matrixWorld;if(void 0!==x&&(null===w.boundingSphere&&w.computeBoundingSphere(),f.copy(w.boundingSphere),f.applyMatrix4(B),!1!==n.ray.intersectsSphere(f)&&(d.getInverse(B),e.copy(n.ray).applyMatrix4(d),null===w.boundingBox||!1!==e.intersectsBox(w.boundingBox))))if(w.isBufferGeometry){x=w.index;var O,C,z,T,F=w.attributes.position;B=w.attributes.uv;if(null!==x)for(z=0,T=x.count;z<T;z+=3)w=x.getX(z),O=x.getX(z+1),C=x.getX(z+2),(D=c(this,n,e,F,B,w,O,C))&&(D.faceIndex=Math.floor(z/3),t.push(D));else for(z=0,T=F.count;z<T;z+=3)(D=c(this,n,e,F,B,w=z,O=z+1,C=z+2))&&(D.index=w,t.push(D))}else if(w.isGeometry){var E;B=Array.isArray(x);z=w.vertices,T=w.faces,0<(O=w.faceVertexUvs[0]).length&&(F=O);for(var G=0,K=T.length;G<K;G++){var P=T[G];if(void 0!==(D=B?x[P.materialIndex]:x)){if(O=z[P.a],C=z[P.b],E=z[P.c],!0===D.morphTargets){D=w.morphTargets;var M=this.morphTargetInfluences;g.set(0,0,0),h.set(0,0,0),k.set(0,0,0);for(var V=0,pa=D.length;V<pa;V++){var S=M[V];if(0!==S){var N=D[V].vertices;g.addScaledVector(m.subVectors(N[P.a],O),S),h.addScaledVector(q.subVectors(N[P.b],C),S),k.addScaledVector(l.subVectors(N[P.c],E),S)}}g.add(O),h.add(C),k.add(E),O=g,C=h,E=k}(D=b(this,n,e,O,C,E,y))&&(F&&F[G]&&(M=F[G],p.copy(M[0]),r.copy(M[1]),ca.copy(M[2]),D.uv=a(y,O,C,E,p,r,ca)),D.face=P,D.faceIndex=G,t.push(D))}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var bg=0;kd.prototype=Object.assign(Object.create(qa.prototype),{constructor:kd,isArrayCamera:!0}),Ib.prototype.isFogExp2=!0,Ib.prototype.clone=function(){return new Ib(this.color.getHex(),this.density)},Ib.prototype.toJSON=function(a){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Jb.prototype.isFog=!0,Jb.prototype.clone=function(){return new Jb(this.color.getHex(),this.near,this.far)},Jb.prototype.toJSON=function(a){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ld.prototype=Object.assign(Object.create(z.prototype),{constructor:ld,copy:function(a,b){return z.prototype.copy.call(this,a,b),null!==a.background&&(this.background=a.background.clone()),null!==a.fog&&(this.fog=a.fog.clone()),null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone()),this.autoUpdate=a.autoUpdate,this.matrixAutoUpdate=a.matrixAutoUpdate,this},toJSON:function(a){var b=z.prototype.toJSON.call(this,a);return null!==this.background&&(b.object.background=this.background.toJSON(a)),null!==this.fog&&(b.object.fog=this.fog.toJSON()),b}}),Yd.prototype=Object.assign(Object.create(z.prototype),{constructor:Yd,isLensFlare:!0,copy:function(a){z.prototype.copy.call(this,a),this.positionScreen.copy(a.positionScreen),this.customUpdateCallback=a.customUpdateCallback;for(var b=0,c=a.lensFlares.length;b<c;b++)this.lensFlares.push(a.lensFlares[b]);return this},add:function(a,b,c,d,e,f){void 0===b&&(b=-1),void 0===c&&(c=0),void 0===f&&(f=1),void 0===e&&(e=new G(16777215)),void 0===d&&(d=1),c=Math.min(c,Math.max(0,c)),this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:0,opacity:f,color:e,blending:d})},updateLensFlares:function(){var a,c,b=this.lensFlares.length,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)(c=this.lensFlares[a]).x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=c.x*Math.PI*.25,c.rotation+=.25*(c.wantedRotation-c.rotation)}}),((bb.prototype=Object.create(U.prototype)).constructor=bb).prototype.isSpriteMaterial=!0,bb.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.map=a.map,this.rotation=a.rotation,this},xc.prototype=Object.assign(Object.create(z.prototype),{constructor:xc,isSprite:!0,raycast:function(){var a=new n,b=new n,c=new n;return function(d,e){b.setFromMatrixPosition(this.matrixWorld),d.ray.closestPointToPoint(b,a),c.setFromMatrixScale(this.matrixWorld);var f=c.x*c.y/4;b.distanceToSquared(a)>f||((f=d.ray.origin.distanceTo(a))<d.near||f>d.far||e.push({distance:f,point:a.clone(),face:null,object:this}))}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),yc.prototype=Object.assign(Object.create(z.prototype),{constructor:yc,copy:function(a){z.prototype.copy.call(this,a,!1);for(var b=0,c=(a=a.levels).length;b<c;b++){var d=a[b];this.addLevel(d.object.clone(),d.distance)}return this},addLevel:function(a,b){void 0===b&&(b=0),b=Math.abs(b);for(var c=this.levels,d=0;d<c.length&&!(b<c[d].distance);d++);c.splice(d,0,{distance:b,object:a}),this.add(a)},getObjectForDistance:function(a){for(var b=this.levels,c=1,d=b.length;c<d&&!(a<b[c].distance);c++);return b[c-1].object},raycast:function(){var a=new n;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.origin.distanceTo(a);this.getObjectForDistance(d).raycast(b,c)}}(),update:function(){var a=new n,b=new n;return function(c){var d=this.levels;if(1<d.length){a.setFromMatrixPosition(c.matrixWorld),b.setFromMatrixPosition(this.matrixWorld),c=a.distanceTo(b),d[0].object.visible=!0;for(var e=1,f=d.length;e<f&&c>=d[e].distance;e++)d[e-1].object.visible=!1,d[e].object.visible=!0;for(;e<f;e++)d[e].object.visible=!1}}}(),toJSON:function(a){(a=z.prototype.toJSON.call(this,a)).object.levels=[];for(var b=this.levels,c=0,d=b.length;c<d;c++){var e=b[c];a.object.levels.push({object:e.object.uuid,distance:e.distance})}return a}}),Object.assign(zc.prototype,{calculateInverses:function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new K;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld),this.boneInverses.push(c)}},pose:function(){var a,b,c;for(b=0,c=this.bones.length;b<c;b++)(a=this.bones[b])&&a.matrixWorld.getInverse(this.boneInverses[b]);for(b=0,c=this.bones.length;b<c;b++)(a=this.bones[b])&&(a.parent&&a.parent.isBone?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))},update:function(){var a=new K,b=new K;return function(){for(var c=this.bones,d=this.boneInverses,e=this.boneMatrices,f=this.boneTexture,g=0,h=c.length;g<h;g++)a.multiplyMatrices(c[g]?c[g].matrixWorld:b,d[g]),a.toArray(e,16*g);void 0!==f&&(f.needsUpdate=!0)}}(),clone:function(){return new zc(this.bones,this.boneInverses)}}),md.prototype=Object.assign(Object.create(z.prototype),{constructor:md,isBone:!0}),nd.prototype=Object.assign(Object.create(la.prototype),{constructor:nd,isSkinnedMesh:!0,initBones:function(){var b,c,d,e,a=[];if(this.geometry&&void 0!==this.geometry.bones){for(d=0,e=this.geometry.bones.length;d<e;d++)c=this.geometry.bones[d],b=new md,a.push(b),b.name=c.name,b.position.fromArray(c.pos),b.quaternion.fromArray(c.rotq),void 0!==c.scl&&b.scale.fromArray(c.scl);for(d=0,e=this.geometry.bones.length;d<e;d++)-1!==(c=this.geometry.bones[d]).parent&&null!==c.parent&&void 0!==a[c.parent]?a[c.parent].add(a[d]):this.add(a[d])}return this.updateMatrixWorld(!0),a},bind:function(a,b){this.skeleton=a,void 0===b&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),b=this.matrixWorld),this.bindMatrix.copy(b),this.bindMatrixInverse.getInverse(b)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var a,b;if(this.geometry&&this.geometry.isGeometry)for(b=0;b<this.geometry.skinWeights.length;b++){1/0!==(a=1/(c=this.geometry.skinWeights[b]).lengthManhattan())?c.multiplyScalar(a):c.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var c=new fa,d=this.geometry.attributes.skinWeight;for(b=0;b<d.count;b++)c.x=d.getX(b),c.y=d.getY(b),c.z=d.getZ(b),c.w=d.getW(b),1/0!==(a=1/c.lengthManhattan())?c.multiplyScalar(a):c.set(1,0,0,0),d.setXYZW(b,c.x,c.y,c.z,c.w)}},updateMatrixWorld:function(a){la.prototype.updateMatrixWorld.call(this,a),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((ea.prototype=Object.create(U.prototype)).constructor=ea).prototype.isLineBasicMaterial=!0,ea.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.linewidth=a.linewidth,this.linecap=a.linecap,this.linejoin=a.linejoin,this},sa.prototype=Object.assign(Object.create(z.prototype),{constructor:sa,isLine:!0,raycast:function(){var a=new K,b=new kb,c=new Ea;return function(d,e){var f=(f=d.linePrecision)*f,g=this.geometry,h=this.matrixWorld;if(null===g.boundingSphere&&g.computeBoundingSphere(),c.copy(g.boundingSphere),c.applyMatrix4(h),!1!==d.ray.intersectsSphere(c)){a.getInverse(h),b.copy(d.ray).applyMatrix4(a);var k=new n,m=new n,q=(h=new n,new n),l=this&&this.isLineSegments?2:1;if(g.isBufferGeometry){var p=g.index,r=g.attributes.position.array;if(null!==p){g=0;for(var ca=(p=p.array).length-1;g<ca;g+=l){var t=p[g+1];k.fromArray(r,3*p[g]),m.fromArray(r,3*t),f<(t=b.distanceSqToSegment(k,m,q,h))||(q.applyMatrix4(this.matrixWorld),(t=d.ray.origin.distanceTo(q))<d.near||t>d.far||e.push({distance:t,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else for(g=0,ca=r.length/3-1;g<ca;g+=l)k.fromArray(r,3*g),m.fromArray(r,3*g+3),f<(t=b.distanceSqToSegment(k,m,q,h))||(q.applyMatrix4(this.matrixWorld),(t=d.ray.origin.distanceTo(q))<d.near||t>d.far||e.push({distance:t,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(m=(k=g.vertices).length,g=0;g<m-1;g+=l)f<(t=b.distanceSqToSegment(k[g],k[g+1],q,h))||(q.applyMatrix4(this.matrixWorld),(t=d.ray.origin.distanceTo(q))<d.near||t>d.far||e.push({distance:t,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Q.prototype=Object.assign(Object.create(sa.prototype),{constructor:Q,isLineSegments:!0}),od.prototype=Object.assign(Object.create(sa.prototype),{constructor:od,isLineLoop:!0}),((Fa.prototype=Object.create(U.prototype)).constructor=Fa).prototype.isPointsMaterial=!0,Fa.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.map=a.map,this.size=a.size,this.sizeAttenuation=a.sizeAttenuation,this},Kb.prototype=Object.assign(Object.create(z.prototype),{constructor:Kb,isPoints:!0,raycast:function(){var a=new K,b=new kb,c=new Ea;return function(d,e){function f(a,c){var f=b.distanceSqToPoint(a);if(f<q){var h=b.closestPointToPoint(a);h.applyMatrix4(k);var m=d.ray.origin.distanceTo(h);m<d.near||m>d.far||e.push({distance:m,distanceToRay:Math.sqrt(f),point:h.clone(),index:c,face:null,object:g})}}var g=this,h=this.geometry,k=this.matrixWorld,m=d.params.Points.threshold;if(null===h.boundingSphere&&h.computeBoundingSphere(),c.copy(h.boundingSphere),c.applyMatrix4(k),c.radius+=m,!1!==d.ray.intersectsSphere(c)){a.getInverse(k),b.copy(d.ray).applyMatrix4(a);var q=(m=m/((this.scale.x+this.scale.y+this.scale.z)/3))*m;m=new n;if(h.isBufferGeometry){var l=h.index;h=h.attributes.position.array;if(null!==l)for(var p=l.array,r=(l=0,p.length);l<r;l++){var ca=p[l];m.fromArray(h,3*ca),f(m,ca)}else for(l=0,p=h.length/3;l<p;l++)m.fromArray(h,3*l),f(m,l)}else for(l=0,p=(m=h.vertices).length;l<p;l++)f(m[l],l)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ac.prototype=Object.assign(Object.create(z.prototype),{constructor:Ac}),(pd.prototype=Object.create(ba.prototype)).constructor=pd,((Lb.prototype=Object.create(ba.prototype)).constructor=Lb).prototype.isCompressedTexture=!0,(qd.prototype=Object.create(ba.prototype)).constructor=qd,((Bc.prototype=Object.create(ba.prototype)).constructor=Bc).prototype.isDepthTexture=!0,(Mb.prototype=Object.create(E.prototype)).constructor=Mb,(Cc.prototype=Object.create(J.prototype)).constructor=Cc,(Nb.prototype=Object.create(E.prototype)).constructor=Nb,(Dc.prototype=Object.create(J.prototype)).constructor=Dc,(za.prototype=Object.create(E.prototype)).constructor=za,(Ec.prototype=Object.create(J.prototype)).constructor=Ec,(Ob.prototype=Object.create(za.prototype)).constructor=Ob,(Fc.prototype=Object.create(J.prototype)).constructor=Fc,(lb.prototype=Object.create(za.prototype)).constructor=lb,(Gc.prototype=Object.create(J.prototype)).constructor=Gc,(Pb.prototype=Object.create(za.prototype)).constructor=Pb,(Hc.prototype=Object.create(J.prototype)).constructor=Hc,(Qb.prototype=Object.create(za.prototype)).constructor=Qb,(Ic.prototype=Object.create(J.prototype)).constructor=Ic,(Rb.prototype=Object.create(E.prototype)).constructor=Rb,(Jc.prototype=Object.create(J.prototype)).constructor=Jc,(Sb.prototype=Object.create(E.prototype)).constructor=Sb,(Kc.prototype=Object.create(J.prototype)).constructor=Kc,(Tb.prototype=Object.create(E.prototype)).constructor=Tb;var Ia={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e<b;d=e++)c+=a[d].x*a[e].y-a[e].x*a[d].y;return.5*c},triangulate:function(a,b){var c=a.length;if(c<3)return null;var g,h,k,d=[],e=[],f=[];if(0<Ia.area(a))for(h=0;h<c;h++)e[h]=h;else for(h=0;h<c;h++)e[h]=c-1-h;var m=2*c;for(h=c-1;2<c;){if(m--<=0){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}var q;c<=(g=h)&&(g=0),c<=(h=g+1)&&(h=0),c<=(k=h+1)&&(k=0);a:{var l,p,r,n,t,y,x,u;if(l=a[e[g]].x,p=a[e[g]].y,r=a[e[h]].x,n=a[e[h]].y,t=a[e[k]].x,(r-l)*((y=a[e[k]].y)-p)-(n-p)*(t-l)<=0)q=!1;else{var H,w,I,z,D,O,B,C,E,G;for(H=t-r,w=y-n,I=l-t,z=p-y,D=r-l,O=n-p,q=0;q<c;q++)if(x=a[e[q]].x,u=a[e[q]].y,!(x===l&&u===p||x===r&&u===n||x===t&&u===y)&&(E=x-r,G=u-n,B=D*(C=u-p)-O*(B=x-l),C=I*(u-=y)-z*(x-=t),(E=H*G-w*E)>=-Number.EPSILON&&C>=-Number.EPSILON&&B>=-Number.EPSILON)){q=!1;break a}q=!0}}if(q){for(d.push([a[e[g]],a[e[h]],a[e[k]]]),f.push([e[g],e[h],e[k]]),k=(g=h)+1;k<c;g++,k++)e[g]=e[k];m=2*--c}}return b?f:d},triangulateShape:function(a,b){function c(a){var b=a.length;2<b&&a[b-1].equals(a[0])&&a.pop()}function d(a,b,c){return a.x!==b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function e(a,b,c,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-c.x,m=e.y-c.y,q=a.x-c.x,l=a.y-c.y,p=h*k-g*m,n=h*q-g*l;if(Math.abs(p)>Number.EPSILON){if(0<p){if(n<0||p<n)return[];if((k=m*q-k*l)<0||p<k)return[]}else{if(0<n||n<p)return[];if(0<(k=m*q-k*l)||k<p)return[]}return 0===k?!f||0!=n&&n!==p?[a]:[]:k===p?!f||0!=n&&n!==p?[b]:[]:0==n?[c]:n===p?[e]:(f=k/p,[{x:a.x+f*g,y:a.y+f*h}])}return 0!=n||m*q!=k*l?[]:(k=0===k&&0===m,(h=0===g&&0===h)&&k?a.x!==c.x||a.y!==c.y?[]:[a]:h?d(c,e,a)?[a]:[]:k?d(a,b,c)?[c]:[]:(c=0!==g?(a=a.x<b.x?(k=(g=a).x,(h=b).x):(k=(g=b).x,(h=a).x),c.x<e.x?(p=(b=c).x,(m=e).x):(p=(b=e).x,(m=c).x)):(a=a.y<b.y?(k=(g=a).y,(h=b).y):(k=(g=b).y,(h=a).y),c.y<e.y?(p=(b=c).y,(m=e).y):(p=(b=e).y,(m=c).y)),k<=p?a<p?[]:a===p?f?[]:[b]:a<=c?[b,h]:[b,m]:c<k?[]:k===c?f?[]:[g]:a<=c?[g,h]:[g,m]))}function f(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x,c=c.y-a.y;var g=d.x-a.x;return d=d.y-a.y,a=e*c-f*b,e=e*d-f*g,Math.abs(a)>Number.EPSILON?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}c(a),b.forEach(c);var g,h,k,m,q,l={};for(k=a.concat(),g=0,h=b.length;g<h;g++)Array.prototype.push.apply(k,b[g]);for(g=0,h=k.length;g<h;g++)void 0!==l[q=k[g].x+":"+k[g].y]&&console.warn("THREE.ShapeUtils: Duplicate point",q,g),l[q]=g;g=function(a,b){function c(a,b){var d=h.length-1,e=a-1;e<0&&(e=d);var g=a+1;return d<g&&(g=0),!!(d=f(h[a],h[e],h[g],k[b]))&&(d=k.length-1,(e=b-1)<0&&(e=d),d<(g=b+1)&&(g=0),!!(d=f(k[b],k[e],k[g],h[a])))}function d(a,b){var c,f;for(c=0;c<h.length;c++)if(f=c+1,f%=h.length,0<(f=e(a,b,h[c],h[f],!0)).length)return!0;return!1}function g(a,c){var d,f,h,k;for(d=0;d<m.length;d++)for(f=b[m[d]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,0<(k=e(a,c,f[h],f[k],!0)).length)return!0;return!1}var k,q,l,p,n,v,C,z,E,h=a.concat(),m=[],B=[],G=0;for(q=b.length;G<q;G++)m.push(G);C=0;for(var K=2*m.length;0<m.length;){if(--K<0){console.log("Infinite Loop! Holes left:"+m.length+", Probably Hole outside Shape!");break}for(l=C;l<h.length;l++){for(p=h[l],q=-1,G=0;G<m.length;G++)if(n=m[G],void 0===B[v=p.x+":"+p.y+":"+n]){for(k=b[n],z=0;z<k.length;z++)if(n=k[z],c(l,z)&&!d(p,n)&&!g(p,n)){q=z,m.splice(G,1),C=h.slice(0,l+1),n=h.slice(l),z=k.slice(q),E=k.slice(0,q+1),h=C.concat(z).concat(E).concat(n),C=l;break}if(0<=q)break;B[v]=!0}if(0<=q)break}}return h}(a,b);var p=Ia.triangulate(g,!1);for(g=0,h=p.length;g<h;g++)for(m=p[g],k=0;k<3;k++)void 0!==(q=l[q=m[k].x+":"+m[k].y])&&(m[k]=q);return p.concat()},isClockWise:function(a){return Ia.area(a)<0}};(cb.prototype=Object.create(J.prototype)).constructor=cb,((Ga.prototype=Object.create(E.prototype)).constructor=Ga).prototype.getArrays=function(){var a,b,c;return{position:a=(a=this.getAttribute("position"))?Array.prototype.slice.call(a.array):[],uv:b=(b=this.getAttribute("uv"))?Array.prototype.slice.call(b.array):[],index:c=(c=this.index)?Array.prototype.slice.call(c.array):[]}},Ga.prototype.addShapeList=function(a,b){var c=a.length;b.arrays=this.getArrays();for(var d=0;d<c;d++)this.addShape(a[d],b);this.setIndex(b.arrays.index),this.addAttribute("position",new B(b.arrays.position,3)),this.addAttribute("uv",new B(b.arrays.uv,2))},Ga.prototype.addShape=function(a,b){function c(a,b,c){return b||console.error("THREE.ExtrudeGeometry: vec does not exist"),b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d,e,f;e=a.x-b.x,f=a.y-b.y,d=c.x-a.x;var g=c.y-a.y,h=e*e+f*f;if(Math.abs(e*g-f*d)>Number.EPSILON){var k=Math.sqrt(h),m=Math.sqrt(d*d+g*g);h=b.x-f/k;if(b=b.y+e/k,(f=(d=h+e*(g=((c.x-g/m-h)*g-(c.y+d/m-b)*d)/(e*g-f*d))-a.x)*d+(e=b+f*g-a.y)*e)<=2)return new C(d,e);f=Math.sqrt(f/2)}else a=!1,e>Number.EPSILON?d>Number.EPSILON&&(a=!0):e<-Number.EPSILON?d<-Number.EPSILON&&(a=!0):Math.sign(f)===Math.sign(g)&&(a=!0),f=a?(d=-f,Math.sqrt(h)):(d=e,e=f,Math.sqrt(h/2));return new C(d/f,e/f)}function e(a,b){var c,d;for(L=a.length;0<=--L;){(d=(c=L)-1)<0&&(d=a.length-1);var e,f=H+2*y;for(e=0;e<f;e++){var g=ba*e,l=b+d+g,p=b+d+(m=ba*(e+1)),m=b+c+m;h(b+c+g),h(l),h(m),h(l),h(p),h(m),g=q.length/3,k((g=D.generateSideWallUV(Z,q,g-6,g-3,g-2,g-1))[0]),k(g[1]),k(g[3]),k(g[1]),k(g[2]),k(g[3])}}}function f(a,b,c){r.push(a),r.push(b),r.push(c)}function g(a,b,c){h(a),h(b),h(c),a=q.length/3,k((a=D.generateTopUV(Z,q,a-3,a-2,a-1))[0]),k(a[1]),k(a[2])}function h(a){l.push(q.length/3),q.push(r[3*a+0]),q.push(r[3*a+1]),q.push(r[3*a+2])}function k(a){p.push(a.x),p.push(a.y)}var I,O,E,F,K,q=(m=b.arrays?b.arrays:this.getArrays()).position,l=m.index,p=m.uv,r=[],m=void 0!==b.amount?b.amount:100,z=void 0!==b.bevelThickness?b.bevelThickness:6,t=void 0!==b.bevelSize?b.bevelSize:z-2,y=void 0!==b.bevelSegments?b.bevelSegments:3,x=void 0===b.bevelEnabled||b.bevelEnabled,u=void 0!==b.curveSegments?b.curveSegments:12,H=void 0!==b.steps?b.steps:1,w=b.extrudePath,G=!1,D=void 0!==b.UVGenerator?b.UVGenerator:cb.WorldUVGenerator;w&&(I=w.getSpacedPoints(H),x=!(G=!0),O=void 0!==b.frames?b.frames:w.computeFrenetFrames(H,!1),E=new n,F=new n,K=new n),x||(t=z=y=0);var T,J,U,Z=this,P=(u=(w=a.extractPoints(u)).shape,w.holes);if(!Ia.isClockWise(u))for(u=u.reverse(),J=0,U=P.length;J<U;J++)T=P[J],Ia.isClockWise(T)&&(P[J]=T.reverse());var M=Ia.triangulateShape(u,P),V=u;for(J=0,U=P.length;J<U;J++)T=P[J],u=u.concat(T);var R,S,N,Y,Q,X,ba=u.length,fa=M.length,L=(w=[],0);for(R=(N=V.length)-1,S=L+1;L<N;L++,R++,S++)R===N&&(R=0),S===N&&(S=0),w[L]=d(V[L],V[R],V[S]);var ea,ha=[],ia=w.concat();for(J=0,U=P.length;J<U;J++){for(T=P[J],ea=[],L=0,R=(N=T.length)-1,S=L+1;L<N;L++,R++,S++)R===N&&(R=0),S===N&&(S=0),ea[L]=d(T[L],T[R],T[S]);ha.push(ea),ia=ia.concat(ea)}for(R=0;R<y;R++){for(N=R/y,Y=z*Math.cos(N*Math.PI/2),S=t*Math.sin(N*Math.PI/2),L=0,N=V.length;L<N;L++)f((Q=c(V[L],w[L],S)).x,Q.y,-Y);for(J=0,U=P.length;J<U;J++)for(T=P[J],ea=ha[J],L=0,N=T.length;L<N;L++)f((Q=c(T[L],ea[L],S)).x,Q.y,-Y)}for(S=t,L=0;L<ba;L++)Q=x?c(u[L],ia[L],S):u[L],G?(F.copy(O.normals[0]).multiplyScalar(Q.x),E.copy(O.binormals[0]).multiplyScalar(Q.y),K.copy(I[0]).add(F).add(E),f(K.x,K.y,K.z)):f(Q.x,Q.y,0);for(N=1;N<=H;N++)for(L=0;L<ba;L++)Q=x?c(u[L],ia[L],S):u[L],G?(F.copy(O.normals[N]).multiplyScalar(Q.x),E.copy(O.binormals[N]).multiplyScalar(Q.y),K.copy(I[N]).add(F).add(E),f(K.x,K.y,K.z)):f(Q.x,Q.y,m/H*N);for(R=y-1;0<=R;R--){for(N=R/y,Y=z*Math.cos(N*Math.PI/2),S=t*Math.sin(N*Math.PI/2),L=0,N=V.length;L<N;L++)f((Q=c(V[L],w[L],S)).x,Q.y,m+Y);for(J=0,U=P.length;J<U;J++)for(T=P[J],ea=ha[J],L=0,N=T.length;L<N;L++)Q=c(T[L],ea[L],S),G?f(Q.x,Q.y+I[H-1].y,I[H-1].x+Y):f(Q.x,Q.y,m+Y)}!function(){var a=q.length/3;if(x){var c=0*ba;for(L=0;L<fa;L++)g((X=M[L])[2]+c,X[1]+c,X[0]+c);for(c=ba*(H+2*y),L=0;L<fa;L++)g((X=M[L])[0]+c,X[1]+c,X[2]+c)}else{for(L=0;L<fa;L++)g((X=M[L])[2],X[1],X[0]);for(L=0;L<fa;L++)g((X=M[L])[0]+ba*H,X[1]+ba*H,X[2]+ba*H)}Z.addGroup(a,q.length/3-a,void 0!==b.material?b.material:0)}(),function(){var a=q.length/3,c=0;for(e(V,c),c+=V.length,J=0,U=P.length;J<U;J++)e(T=P[J],c),c+=T.length;Z.addGroup(a,q.length/3-a,void 0!==b.extrudeMaterial?b.extrudeMaterial:1)}(),b.arrays||(this.setIndex(l),this.addAttribute("position",new B(q,3)),this.addAttribute("uv",new B(b.arrays.uv,2)))},cb.WorldUVGenerator={generateTopUV:function(a,b,c,d,e){a=b[3*d],d=b[3*d+1];var f=b[3*e];return e=b[3*e+1],[new C(b[3*c],b[3*c+1]),new C(a,d),new C(f,e)]},generateSideWallUV:function(a,b,c,d,e,f){a=b[3*c];var g=b[3*c+1];c=b[3*c+2];var h=b[3*d],k=b[3*d+1];d=b[3*d+2];var m=b[3*e],l=b[3*e+1];e=b[3*e+2];var n=b[3*f],p=b[3*f+1];return b=b[3*f+2],Math.abs(g-k)<.01?[new C(a,1-c),new C(h,1-d),new C(m,1-e),new C(n,1-b)]:[new C(g,1-c),new C(k,1-d),new C(l,1-e),new C(p,1-b)]}},(Lc.prototype=Object.create(J.prototype)).constructor=Lc,(Ub.prototype=Object.create(Ga.prototype)).constructor=Ub,(Mc.prototype=Object.create(J.prototype)).constructor=Mc,(mb.prototype=Object.create(E.prototype)).constructor=mb,(Nc.prototype=Object.create(J.prototype)).constructor=Nc,(Vb.prototype=Object.create(E.prototype)).constructor=Vb,(Oc.prototype=Object.create(J.prototype)).constructor=Oc,(Wb.prototype=Object.create(E.prototype)).constructor=Wb,(Xb.prototype=Object.create(J.prototype)).constructor=Xb,(Yb.prototype=Object.create(E.prototype)).constructor=Yb,(Zb.prototype=Object.create(E.prototype)).constructor=Zb,(nb.prototype=Object.create(J.prototype)).constructor=nb,(Ua.prototype=Object.create(E.prototype)).constructor=Ua,(Pc.prototype=Object.create(nb.prototype)).constructor=Pc,(Qc.prototype=Object.create(Ua.prototype)).constructor=Qc,(Rc.prototype=Object.create(J.prototype)).constructor=Rc,($b.prototype=Object.create(E.prototype)).constructor=$b;var Ma=Object.freeze({WireframeGeometry:Mb,ParametricGeometry:Cc,ParametricBufferGeometry:Nb,TetrahedronGeometry:Ec,TetrahedronBufferGeometry:Ob,OctahedronGeometry:Fc,OctahedronBufferGeometry:lb,IcosahedronGeometry:Gc,IcosahedronBufferGeometry:Pb,DodecahedronGeometry:Hc,DodecahedronBufferGeometry:Qb,PolyhedronGeometry:Dc,PolyhedronBufferGeometry:za,TubeGeometry:Ic,TubeBufferGeometry:Rb,TorusKnotGeometry:Jc,TorusKnotBufferGeometry:Sb,TorusGeometry:Kc,TorusBufferGeometry:Tb,TextGeometry:Lc,TextBufferGeometry:Ub,SphereGeometry:Mc,SphereBufferGeometry:mb,RingGeometry:Nc,RingBufferGeometry:Vb,PlaneGeometry:vc,PlaneBufferGeometry:jb,LatheGeometry:Oc,LatheBufferGeometry:Wb,ShapeGeometry:Xb,ShapeBufferGeometry:Yb,ExtrudeGeometry:cb,ExtrudeBufferGeometry:Ga,EdgesGeometry:Zb,ConeGeometry:Pc,ConeBufferGeometry:Qc,CylinderGeometry:nb,CylinderBufferGeometry:Ua,CircleGeometry:Rc,CircleBufferGeometry:$b,BoxGeometry:Gb,BoxBufferGeometry:ib});((ac.prototype=Object.create(ra.prototype)).constructor=ac).prototype.isShadowMaterial=!0,((bc.prototype=Object.create(ra.prototype)).constructor=bc).prototype.isRawShaderMaterial=!0,((Pa.prototype=Object.create(U.prototype)).constructor=Pa).prototype.isMeshStandardMaterial=!0,Pa.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.defines={STANDARD:""},this.color.copy(a.color),this.roughness=a.roughness,this.metalness=a.metalness,this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.roughnessMap=a.roughnessMap,this.metalnessMap=a.metalnessMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.envMapIntensity=a.envMapIntensity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this},((ob.prototype=Object.create(Pa.prototype)).constructor=ob).prototype.isMeshPhysicalMaterial=!0,ob.prototype.copy=function(a){return Pa.prototype.copy.call(this,a),this.defines={PHYSICAL:""},this.reflectivity=a.reflectivity,this.clearCoat=a.clearCoat,this.clearCoatRoughness=a.clearCoatRoughness,this},((Ja.prototype=Object.create(U.prototype)).constructor=Ja).prototype.isMeshPhongMaterial=!0,Ja.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.specular.copy(a.specular),this.shininess=a.shininess,this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.combine=a.combine,this.reflectivity=a.reflectivity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this},((pb.prototype=Object.create(Ja.prototype)).constructor=pb).prototype.isMeshToonMaterial=!0,pb.prototype.copy=function(a){return Ja.prototype.copy.call(this,a),this.gradientMap=a.gradientMap,this},((qb.prototype=Object.create(U.prototype)).constructor=qb).prototype.isMeshNormalMaterial=!0,qb.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this},((rb.prototype=Object.create(U.prototype)).constructor=rb).prototype.isMeshLambertMaterial=!0,rb.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.combine=a.combine,this.reflectivity=a.reflectivity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this},((sb.prototype=Object.create(U.prototype)).constructor=sb).prototype.isLineDashedMaterial=!0,sb.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.linewidth=a.linewidth,this.scale=a.scale,this.dashSize=a.dashSize,this.gapSize=a.gapSize,this};var mg=Object.freeze({ShadowMaterial:ac,SpriteMaterial:bb,RawShaderMaterial:bc,ShaderMaterial:ra,PointsMaterial:Fa,MeshPhysicalMaterial:ob,MeshStandardMaterial:Pa,MeshPhongMaterial:Ja,MeshToonMaterial:pb,MeshNormalMaterial:qb,MeshLambertMaterial:rb,MeshDepthMaterial:Za,MeshBasicMaterial:ya,LineDashedMaterial:sb,LineBasicMaterial:ea,Material:U}),ed={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},va=new Zd;Object.assign(Ka.prototype,{load:function(a,b,c,d){void 0===a&&(a=""),void 0!==this.path&&(a=this.path+a);var e=this,f=ed.get(a);if(void 0!==f)return e.manager.itemStart(a),setTimeout(function(){b&&b(f),e.manager.itemEnd(a)},0),f;if(g=a.match(/^data:(.*?)(;base64)?,(.*)$/)){var h=g[1],k=!!g[2],g=g[3];g=window.decodeURIComponent(g);k&&(g=window.atob(g));try{var m,l=(this.responseType||"").toLowerCase();switch(l){case"arraybuffer":case"blob":m=new ArrayBuffer(g.length);var n=new Uint8Array(m);for(k=0;k<g.length;k++)n[k]=g.charCodeAt(k);"blob"===l&&(m=new Blob([m],{type:h}));break;case"document":m=(new DOMParser).parseFromString(g,h);break;case"json":m=JSON.parse(g);break;default:m=g}window.setTimeout(function(){b&&b(m),e.manager.itemEnd(a)},0)}catch(r){window.setTimeout(function(){d&&d(r),e.manager.itemEnd(a),e.manager.itemError(a)},0)}}else{var p=new XMLHttpRequest;for(h in p.open("GET",a,!0),p.addEventListener("load",function(c){var f=c.target.response;ed.add(a,f),200===this.status?(b&&b(f),e.manager.itemEnd(a)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),b&&b(f),e.manager.itemEnd(a)):(d&&d(c),e.manager.itemEnd(a),e.manager.itemError(a))},!1),void 0!==c&&p.addEventListener("progress",function(a){c(a)},!1),p.addEventListener("error",function(b){d&&d(b),e.manager.itemEnd(a),e.manager.itemError(a)},!1),void 0!==this.responseType&&(p.responseType=this.responseType),void 0!==this.withCredentials&&(p.withCredentials=this.withCredentials),p.overrideMimeType&&p.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)p.setRequestHeader(h,this.requestHeader[h]);p.send(null)}return e.manager.itemStart(a),p},setPath:function(a){return this.path=a,this},setResponseType:function(a){return this.responseType=a,this},setWithCredentials:function(a){return this.withCredentials=a,this},setMimeType:function(a){return this.mimeType=a,this},setRequestHeader:function(a){return this.requestHeader=a,this}}),Object.assign(Oe.prototype,{load:function(a,b,c,d){function e(e){k.load(a[e],function(a){a=f._parser(a,!0),g[e]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps},6===(m+=1)&&(1===a.mipmapCount&&(h.minFilter=1006),h.format=a.format,h.needsUpdate=!0,b&&b(h))},c,d)}var f=this,g=[],h=new Lb;h.image=g;var k=new Ka(this.manager);if(k.setPath(this.path),k.setResponseType("arraybuffer"),Array.isArray(a))for(var m=0,l=0,n=a.length;l<n;++l)e(l);else k.load(a,function(a){if((a=f._parser(a,!0)).isCubemap)for(var c=a.mipmaps.length/a.mipmapCount,d=0;d<c;d++){g[d]={mipmaps:[]};for(var e=0;e<a.mipmapCount;e++)g[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+e]),g[d].format=a.format,g[d].width=a.width,g[d].height=a.height}else h.image.width=a.width,h.image.height=a.height,h.mipmaps=a.mipmaps;1===a.mipmapCount&&(h.minFilter=1006),h.format=a.format,h.needsUpdate=!0,b&&b(h)},c,d);return h},setPath:function(a){return this.path=a,this}}),Object.assign($d.prototype,{load:function(a,b,c,d){var e=this,f=new db,g=new Ka(this.manager);return g.setResponseType("arraybuffer"),g.load(a,function(a){(a=e._parser(a))&&(void 0!==a.image?f.image=a.image:void 0!==a.data&&(f.image.width=a.width,f.image.height=a.height,f.image.data=a.data),f.wrapS=void 0!==a.wrapS?a.wrapS:1001,f.wrapT=void 0!==a.wrapT?a.wrapT:1001,f.magFilter=void 0!==a.magFilter?a.magFilter:1006,f.minFilter=void 0!==a.minFilter?a.minFilter:1008,f.anisotropy=void 0!==a.anisotropy?a.anisotropy:1,void 0!==a.format&&(f.format=a.format),void 0!==a.type&&(f.type=a.type),void 0!==a.mipmaps&&(f.mipmaps=a.mipmaps),1===a.mipmapCount&&(f.minFilter=1006),f.needsUpdate=!0,b&&b(f,a))},c,d),f}}),Object.assign(Sc.prototype,{load:function(a,b,c,d){void 0===a&&(a=""),void 0!==this.path&&(a=this.path+a);var e=this,f=ed.get(a);return void 0!==f?(e.manager.itemStart(a),setTimeout(function(){b&&b(f),e.manager.itemEnd(a)},0),f):((c=document.createElementNS("http://www.w3.org/1999/xhtml","img")).addEventListener("load",function(){ed.add(a,this),b&&b(this),e.manager.itemEnd(a)},!1),c.addEventListener("error",function(b){d&&d(b),e.manager.itemEnd(a),e.manager.itemError(a)},!1),"data:"!==a.substr(0,5)&&void 0!==this.crossOrigin&&(c.crossOrigin=this.crossOrigin),e.manager.itemStart(a),c.src=a,c)},setCrossOrigin:function(a){return this.crossOrigin=a,this},setPath:function(a){return this.path=a,this}}),Object.assign(ae.prototype,{load:function(a,b,c,d){function e(c){g.load(a[c],function(a){f.images[c]=a,6===++h&&(f.needsUpdate=!0,b&&b(f))},void 0,d)}var f=new Xa,g=new Sc(this.manager);g.setCrossOrigin(this.crossOrigin),g.setPath(this.path);var h=0;for(c=0;c<a.length;++c)e(c);return f},setCrossOrigin:function(a){return this.crossOrigin=a,this},setPath:function(a){return this.path=a,this}}),Object.assign(rd.prototype,{load:function(a,b,c,d){var e=new Sc(this.manager);e.setCrossOrigin(this.crossOrigin),e.setPath(this.path);var f=new ba;return f.image=e.load(a,function(){var c=0<a.search(/\.(jpg|jpeg)$/)||0===a.search(/^data\:image\/jpeg/);f.format=c?1022:1023,f.needsUpdate=!0,void 0!==b&&b(f)},c,d),f},setCrossOrigin:function(a){return this.crossOrigin=a,this},setPath:function(a){return this.path=a,this}}),na.prototype=Object.assign(Object.create(z.prototype),{constructor:na,isLight:!0,copy:function(a){return z.prototype.copy.call(this,a),this.color.copy(a.color),this.intensity=a.intensity,this},toJSON:function(a){return(a=z.prototype.toJSON.call(this,a)).object.color=this.color.getHex(),a.object.intensity=this.intensity,void 0!==this.groundColor&&(a.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(a.object.distance=this.distance),void 0!==this.angle&&(a.object.angle=this.angle),void 0!==this.decay&&(a.object.decay=this.decay),void 0!==this.penumbra&&(a.object.penumbra=this.penumbra),void 0!==this.shadow&&(a.object.shadow=this.shadow.toJSON()),a}}),sd.prototype=Object.assign(Object.create(na.prototype),{constructor:sd,isHemisphereLight:!0,copy:function(a){return na.prototype.copy.call(this,a),this.groundColor.copy(a.groundColor),this}}),Object.assign(tb.prototype,{copy:function(a){return this.camera=a.camera.clone(),this.bias=a.bias,this.radius=a.radius,this.mapSize.copy(a.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a={};return 0!==this.bias&&(a.bias=this.bias),1!==this.radius&&(a.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(a.mapSize=this.mapSize.toArray()),a.camera=this.camera.toJSON(!1).object,delete a.camera.matrix,a}}),td.prototype=Object.assign(Object.create(tb.prototype),{constructor:td,isSpotLightShadow:!0,update:function(a){var b=this.camera,c=2*Y.RAD2DEG*a.angle,d=this.mapSize.width/this.mapSize.height;a=a.distance||b.far,c===b.fov&&d===b.aspect&&a===b.far||(b.fov=c,b.aspect=d,b.far=a,b.updateProjectionMatrix())}}),ud.prototype=Object.assign(Object.create(na.prototype),{constructor:ud,isSpotLight:!0,copy:function(a){return na.prototype.copy.call(this,a),this.distance=a.distance,this.angle=a.angle,this.penumbra=a.penumbra,this.decay=a.decay,this.target=a.target.clone(),this.shadow=a.shadow.clone(),this}}),vd.prototype=Object.assign(Object.create(na.prototype),{constructor:vd,isPointLight:!0,copy:function(a){return na.prototype.copy.call(this,a),this.distance=a.distance,this.decay=a.decay,this.shadow=a.shadow.clone(),this}}),wd.prototype=Object.assign(Object.create(tb.prototype),{constructor:wd}),xd.prototype=Object.assign(Object.create(na.prototype),{constructor:xd,isDirectionalLight:!0,copy:function(a){return na.prototype.copy.call(this,a),this.target=a.target.clone(),this.shadow=a.shadow.clone(),this}}),yd.prototype=Object.assign(Object.create(na.prototype),{constructor:yd,isAmbientLight:!0}),zd.prototype=Object.assign(Object.create(na.prototype),{constructor:zd,isRectAreaLight:!0,copy:function(a){return na.prototype.copy.call(this,a),this.width=a.width,this.height=a.height,this},toJSON:function(a){return(a=na.prototype.toJSON.call(this,a)).object.width=this.width,a.object.height=this.height,a}});var Wa,ia={arraySlice:function(a,b,c){return ia.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"==typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;return c.sort(function(b,c){return a[b]-a[c]}),c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,k=0;k!==b;++k)e[g++]=a[h+k];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g))for(;void 0!==(g=f[d])&&(b.push(f.time),c.push.apply(c,g)),void 0!==(f=a[e++]););else if(void 0!==g.toArray)for(;void 0!==(g=f[d])&&(b.push(f.time),g.toArray(c,c.length)),void 0!==(f=a[e++]););else for(;void 0!==(g=f[d])&&(b.push(f.time),c.push(g)),void 0!==(f=a[e++]););}}};Object.assign(wa.prototype,{evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a<d)){for(var f=c+2;;){if(void 0===d){if(a<e)break d;return this._cachedIndex=c=b.length,this.afterEnd_(c-1,a,e)}if(c===f)break;if(e=d,a<(d=b[++c]))break b}d=b.length;break c}if(e<=a)break a;for(a<(f=b[1])&&(c=2,e=f),f=c-2;;){if(void 0===e)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(c===f)break;if(d=e,(e=b[--c-1])<=a)break b}d=c,c=0}for(;c<d;)a<b[e=c+d>>>1]?d=e:c=e+1;if(d=b[c],void 0===(e=b[c-1]))return this._cachedIndex=0,this.beforeStart_(0,a,d);if(void 0===d)return this._cachedIndex=c=b.length,this.afterEnd_(c-1,e,a)}this._cachedIndex=c,this.intervalChanged_(c,e,d)}return this.interpolate_(c,e,a,d)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(a){var b=this.resultBuffer,c=this.sampleValues,d=this.valueSize;a*=d;for(var e=0;e!==d;++e)b[e]=c[a+e];return b},interpolate_:function(a,b,c,d){throw Error("call to abstract method")},intervalChanged_:function(a,b,c){}}),Object.assign(wa.prototype,{beforeStart_:wa.prototype.copySampleValue_,afterEnd_:wa.prototype.copySampleValue_}),Ad.prototype=Object.assign(Object.create(wa.prototype),{constructor:Ad,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(a,b,c){var d=this.parameterPositions,e=a-2,f=a+1,g=d[e],h=d[f];if(void 0===g)switch(this.getSettings_().endingStart){case 2401:e=a,g=2*b-c;break;case 2402:g=b+d[e=d.length-2]-d[e+1];break;default:e=a,g=c}if(void 0===h)switch(this.getSettings_().endingEnd){case 2401:f=a,h=2*c-b;break;case 2402:h=c+d[f=1]-d[0];break;default:f=a-1,h=b}a=.5*(c-b),d=this.valueSize,this._weightPrev=a/(b-g),this._weightNext=a/(h-c),this._offsetPrev=e*d,this._offsetNext=f*d},interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize,h=(a*=g)-g,k=this._offsetPrev,m=this._offsetNext,l=this._weightPrev,n=this._weightNext,p=(c-b)/(d-b);for(b=-l*(d=(c=p*p)*p)+2*l*c-l*p,l=(1+l)*d+(-1.5-2*l)*c+(-.5+l)*p+1,p=(-1-n)*d+(1.5+n)*c+.5*p,n=n*d-n*c,c=0;c!==g;++c)e[c]=b*f[k+c]+l*f[h+c]+p*f[a+c]+n*f[m+c];return e}}),Tc.prototype=Object.assign(Object.create(wa.prototype),{constructor:Tc,interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize,h=(a*=g)-g;for(c=1-(b=(c-b)/(d-b)),d=0;d!==g;++d)e[d]=f[h+d]*c+f[a+d]*b;return e}}),Bd.prototype=Object.assign(Object.create(wa.prototype),{constructor:Bd,interpolate_:function(a,b,c,d){return this.copySampleValue_(a-1)}}),Wa={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(a){return new Bd(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodLinear:function(a){return new Tc(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:function(a){return new Ad(this.times,this.values,this.getValueSize(),a)},setInterpolation:function(a){var b;switch(a){case 2300:b=this.InterpolantFactoryMethodDiscrete;break;case 2301:b=this.InterpolantFactoryMethodLinear;break;case 2302:b=this.InterpolantFactoryMethodSmooth}if(void 0===b){if(b="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(a===this.DefaultInterpolation)throw Error(b);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrackPrototype:",b)}else this.createInterpolant=b},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(a){if(0!==a)for(var b=this.times,c=0,d=b.length;c!==d;++c)b[c]+=a;return this},scale:function(a){if(1!==a)for(var b=this.times,c=0,d=b.length;c!==d;++c)b[c]*=a;return this},trim:function(a,b){for(var c=this.times,d=c.length,e=0,f=d-1;e!==d&&c[e]<a;)++e;for(;-1!==f&&c[f]>b;)--f;return++f,0===e&&f===d||(f<=e&&(e=(f=Math.max(f,1))-1),d=this.getValueSize(),this.times=ia.arraySlice(c,e,f),this.values=ia.arraySlice(this.values,e*d,f*d)),this},validate:function(){var a=!0;0!=(b=this.getValueSize())-Math.floor(b)&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),a=!1);var c=this.times,b=this.values,d=c.length;0===d&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"==typeof g&&isNaN(g)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,f,g),a=!1;break}if(null!==e&&g<e){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,f,g,e),a=!1;break}e=g}if(void 0!==b&&ia.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,f,d),a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;g<f;++g){var h=!1;if((k=a[g])!==a[g+1]&&(1!==g||k!==k[0]))if(d)h=!0;else for(var m=g*c,l=m-c,n=m+c,k=0;k!==c;++k){var p=b[m+k];if(p!==b[l+k]||p!==b[n+k]){h=!0;break}}if(h){if(g!==e)for(a[e]=a[g],h=g*c,m=e*c,k=0;k!==c;++k)b[m+k]=b[h+k];++e}}if(0<f){for(a[e]=a[f],h=f*c,m=e*c,k=0;k!==c;++k)b[m+k]=b[h+k];++e}return e!==a.length&&(this.times=ia.arraySlice(a,0,e),this.values=ia.arraySlice(b,0,e*c)),this}},cc.prototype=Object.assign(Object.create(Wa),{constructor:cc,ValueTypeName:"vector"}),Cd.prototype=Object.assign(Object.create(wa.prototype),{constructor:Cd,interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;for(b=(c-b)/(d-b),c=(a*=g)+g;a!==c;a+=4)oa.slerpFlat(e,0,f,a-g,f,a,b);return e}}),Uc.prototype=Object.assign(Object.create(Wa),{constructor:Uc,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(a){return new Cd(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:void 0}),dc.prototype=Object.assign(Object.create(Wa),{constructor:dc,ValueTypeName:"number"}),Dd.prototype=Object.assign(Object.create(Wa),{constructor:Dd,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ed.prototype=Object.assign(Object.create(Wa),{constructor:Ed,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Fd.prototype=Object.assign(Object.create(Wa),{constructor:Fd,ValueTypeName:"color"}),(vb.prototype=Wa).constructor=vb,Object.assign(vb,{parse:function(a){if(void 0===a.type)throw Error("track type undefined, can not parse");var b=vb._getTrackTypeForValueTypeName(a.type);if(void 0===a.times){var c=[],d=[];ia.flattenJSON(a.keys,c,d,"value"),a.times=c,a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)},toJSON:function(a){if(void 0!==(b=a.constructor).toJSON)b=b.toJSON(a);else{var b={name:a.name,times:ia.convertArray(a.times,Array),values:ia.convertArray(a.values,Array)},c=a.getInterpolation();c!==a.DefaultInterpolation&&(b.interpolation=c)}return b.type=a.ValueTypeName,b},_getTrackTypeForValueTypeName:function(a){switch(a.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return dc;case"vector":case"vector2":case"vector3":case"vector4":return cc;case"color":return Fd;case"quaternion":return Uc;case"bool":case"boolean":return Ed;case"string":return Dd}throw Error("Unsupported typeName: "+a)}}),Object.assign(Da,{parse:function(a){for(var b=[],c=a.tracks,d=1/(a.fps||1),e=0,f=c.length;e!==f;++e)b.push(vb.parse(c[e]).scale(d));return new Da(a.name,a.duration,b)},toJSON:function(a){var b=[],c=a.tracks;a={name:a.name,duration:a.duration,tracks:b};for(var d=0,e=c.length;d!==e;++d)b.push(vb.toJSON(c[d]));return a},CreateFromMorphTargetSequence:function(a,b,c,d){for(var e=b.length,f=[],g=0;g<e;g++){var k=[];(h=[]).push((g+e-1)%e,g,(g+1)%e),k.push(0,1,0);var m=ia.getKeyframeOrder(h),h=ia.sortedArray(h,1,m);k=ia.sortedArray(k,1,m);d||0!==h[0]||(h.push(e),k.push(k[0])),f.push(new dc(".morphTargetInfluences["+b[g].name+"]",h,k).scale(1/c))}return new Da(a,-1,f)},findByName:function(a,b){var c=a;Array.isArray(a)||(c=a.geometry&&a.geometry.animations||a.animations);for(var d=0;d<c.length;d++)if(c[d].name===b)return c[d];return null},CreateClipsFromMorphTargetSequences:function(a,b,c){for(var d={},e=/^([\w-]*?)([\d]+)$/,f=0,g=a.length;f<g;f++){var h=a[f],k=h.name.match(e);if(k&&1<k.length){var m=k[1];(k=d[m])||(d[m]=k=[]),k.push(h)}}for(m in a=[],d)a.push(Da.CreateFromMorphTargetSequence(m,d[m],b,c));return a},parseAnimation:function(a,b){if(!a)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var c=function(a,b,c,d,e){if(0!==c.length){var f=[],g=[];ia.flattenJSON(c,f,g,d),0!==f.length&&e.push(new a(b,f,g))}},d=[],e=a.name||"default",f=a.length||-1,g=a.fps||30,h=a.hierarchy||[],k=0;k<h.length;k++){var m=h[k].keys;if(m&&0!==m.length)if(m[0].morphTargets){f={};for(var l=0;l<m.length;l++)if(m[l].morphTargets)for(var n=0;n<m[l].morphTargets.length;n++)f[m[l].morphTargets[n]]=-1;for(var p in f){var r=[],z=[];for(n=0;n!==m[l].morphTargets.length;++n){var t=m[l];r.push(t.time),z.push(t.morphTarget===p?1:0)}d.push(new dc(".morphTargetInfluence["+p+"]",r,z))}f=f.length*(g||1)}else c(cc,(l=".bones["+b[k].name+"]")+".position",m,"pos",d),c(Uc,l+".quaternion",m,"rot",d),c(cc,l+".scale",m,"scl",d)}return 0===d.length?null:new Da(e,f,d)}}),Object.assign(Da.prototype,{resetDuration:function(){for(var a=0,b=0,c=this.tracks.length;b!==c;++b){var d=this.tracks[b];a=Math.max(a,d.times[d.times.length-1])}this.duration=a},trim:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,this.duration);return this},optimize:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].optimize();return this}}),Object.assign(Gd.prototype,{load:function(a,b,c,d){var e=this;new Ka(e.manager).load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setTextures:function(a){this.textures=a},parse:function(a){function b(a){return void 0===c[a]&&console.warn("THREE.MaterialLoader: Undefined texture",a),c[a]}var c=this.textures,d=new mg[a.type];if(void 0!==a.uuid&&(d.uuid=a.uuid),void 0!==a.name&&(d.name=a.name),void 0!==a.color&&d.color.setHex(a.color),void 0!==a.roughness&&(d.roughness=a.roughness),void 0!==a.metalness&&(d.metalness=a.metalness),void 0!==a.emissive&&d.emissive.setHex(a.emissive),void 0!==a.specular&&d.specular.setHex(a.specular),void 0!==a.shininess&&(d.shininess=a.shininess),void 0!==a.clearCoat&&(d.clearCoat=a.clearCoat),void 0!==a.clearCoatRoughness&&(d.clearCoatRoughness=a.clearCoatRoughness),void 0!==a.uniforms&&(d.uniforms=a.uniforms),void 0!==a.vertexShader&&(d.vertexShader=a.vertexShader),void 0!==a.fragmentShader&&(d.fragmentShader=a.fragmentShader),void 0!==a.vertexColors&&(d.vertexColors=a.vertexColors),void 0!==a.fog&&(d.fog=a.fog),void 0!==a.shading&&(d.shading=a.shading),void 0!==a.blending&&(d.blending=a.blending),void 0!==a.side&&(d.side=a.side),void 0!==a.opacity&&(d.opacity=a.opacity),void 0!==a.transparent&&(d.transparent=a.transparent),void 0!==a.alphaTest&&(d.alphaTest=a.alphaTest),void 0!==a.depthTest&&(d.depthTest=a.depthTest),void 0!==a.depthWrite&&(d.depthWrite=a.depthWrite),void 0!==a.colorWrite&&(d.colorWrite=a.colorWrite),void 0!==a.wireframe&&(d.wireframe=a.wireframe),void 0!==a.wireframeLinewidth&&(d.wireframeLinewidth=a.wireframeLinewidth),void 0!==a.wireframeLinecap&&(d.wireframeLinecap=a.wireframeLinecap),void 0!==a.wireframeLinejoin&&(d.wireframeLinejoin=a.wireframeLinejoin),void 0!==a.skinning&&(d.skinning=a.skinning),void 0!==a.morphTargets&&(d.morphTargets=a.morphTargets),void 0!==a.size&&(d.size=a.size),void 0!==a.sizeAttenuation&&(d.sizeAttenuation=a.sizeAttenuation),void 0!==a.map&&(d.map=b(a.map)),void 0!==a.alphaMap&&(d.alphaMap=b(a.alphaMap),d.transparent=!0),void 0!==a.bumpMap&&(d.bumpMap=b(a.bumpMap)),void 0!==a.bumpScale&&(d.bumpScale=a.bumpScale),void 0!==a.normalMap&&(d.normalMap=b(a.normalMap)),void 0!==a.normalScale){var e=a.normalScale;!1===Array.isArray(e)&&(e=[e,e]),d.normalScale=(new C).fromArray(e)}return void 0!==a.displacementMap&&(d.displacementMap=b(a.displacementMap)),void 0!==a.displacementScale&&(d.displacementScale=a.displacementScale),void 0!==a.displacementBias&&(d.displacementBias=a.displacementBias),void 0!==a.roughnessMap&&(d.roughnessMap=b(a.roughnessMap)),void 0!==a.metalnessMap&&(d.metalnessMap=b(a.metalnessMap)),void 0!==a.emissiveMap&&(d.emissiveMap=b(a.emissiveMap)),void 0!==a.emissiveIntensity&&(d.emissiveIntensity=a.emissiveIntensity),void 0!==a.specularMap&&(d.specularMap=b(a.specularMap)),void 0!==a.envMap&&(d.envMap=b(a.envMap)),void 0!==a.reflectivity&&(d.reflectivity=a.reflectivity),void 0!==a.lightMap&&(d.lightMap=b(a.lightMap)),void 0!==a.lightMapIntensity&&(d.lightMapIntensity=a.lightMapIntensity),void 0!==a.aoMap&&(d.aoMap=b(a.aoMap)),void 0!==a.aoMapIntensity&&(d.aoMapIntensity=a.aoMapIntensity),void 0!==a.gradientMap&&(d.gradientMap=b(a.gradientMap)),d}}),Object.assign(be.prototype,{load:function(a,b,c,d){var e=this;new Ka(e.manager).load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},parse:function(a){var b=new E;void 0!==(c=a.data.index)&&(c=new ef[c.type](c.array),b.setIndex(new Z(c,1)));var e,d=a.data.attributes;for(e in d){var f=d[e],c=new ef[f.type](f.array);b.addAttribute(e,new Z(c,f.itemSize,f.normalized))}if(void 0!==(e=a.data.groups||a.data.drawcalls||a.data.offsets))for(c=0,d=e.length;c!==d;++c)f=e[c],b.addGroup(f.start,f.count,f.materialIndex);return void 0!==(a=a.data.boundingSphere)&&(e=new n,void 0!==a.center&&e.fromArray(a.center),b.boundingSphere=new Ea(e,a.radius)),b}});var ef={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};ec.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;c<d;c+=2){var e=b[c+1];if(b[c].test(a))return e}return null}},Object.assign(ec.prototype,{crossOrigin:void 0,extractUrlBase:function(a){return 1===(a=a.split("/")).length?"./":(a.pop(),a.join("/")+"/")},initMaterials:function(a,b,c){for(var d=[],e=0;e<a.length;++e)d[e]=this.createMaterial(a[e],b,c);return d},createMaterial:function(){var a={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},b=new G,c=new rd,d=new Gd;return function(e,f,g){function h(a,b,d,e,h){a=f+a;var m=ec.Handlers.get(a);return a=null!==m?m.load(a):(c.setCrossOrigin(g),c.load(a)),void 0!==b&&(a.repeat.fromArray(b),1!==b[0]&&(a.wrapS=1e3),1!==b[1]&&(a.wrapT=1e3)),void 0!==d&&a.offset.fromArray(d),void 0!==e&&("repeat"===e[0]&&(a.wrapS=1e3),"mirror"===e[0]&&(a.wrapS=1002),"repeat"===e[1]&&(a.wrapT=1e3),"mirror"===e[1]&&(a.wrapT=1002)),void 0!==h&&(a.anisotropy=h),b=Y.generateUUID(),k[b]=a,b}var l,k={},m={uuid:Y.generateUUID(),type:"MeshLambertMaterial"};for(l in e){var n=e[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":m.name=n;break;case"blending":m.blending=a[n];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":m.color=b.fromArray(n).getHex();break;case"colorSpecular":m.specular=b.fromArray(n).getHex();break;case"colorEmissive":m.emissive=b.fromArray(n).getHex();break;case"specularCoef":m.shininess=n;break;case"shading":"basic"===n.toLowerCase()&&(m.type="MeshBasicMaterial"),"phong"===n.toLowerCase()&&(m.type="MeshPhongMaterial"),"standard"===n.toLowerCase()&&(m.type="MeshStandardMaterial");break;case"mapDiffuse":m.map=h(n,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":m.emissiveMap=h(n,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":m.lightMap=h(n,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":m.aoMap=h(n,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":m.bumpMap=h(n,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":m.bumpScale=n;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":m.normalMap=h(n,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":m.normalScale=[n,n];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":m.specularMap=h(n,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":m.metalnessMap=h(n,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":m.roughnessMap=h(n,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":m.alphaMap=h(n,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":m.side=1;break;case"doubleSided":m.side=2;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),m.opacity=n;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":m[l]=n;break;case"vertexColors":!0===n&&(m.vertexColors=2),"face"===n&&(m.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,n)}}return"MeshBasicMaterial"===m.type&&delete m.emissive,"MeshPhongMaterial"!==m.type&&delete m.specular,m.opacity<1&&(m.transparent=!0),d.setTextures(k),d.parse(m)}}()}),Object.assign(ce.prototype,{load:function(a,b,c,d){var e=this,f=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:ec.prototype.extractUrlBase(a),g=new Ka(this.manager);g.setWithCredentials(this.withCredentials),g.load(a,function(c){var d=(c=JSON.parse(c)).metadata;if(void 0!==d&&void 0!==(d=d.type)){if("object"===d.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");if("scene"===d.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.")}c=e.parse(c,f),b(c.geometry,c.materials)},c,d)},setTexturePath:function(a){this.texturePath=a},parse:function(a,b){void 0!==a.data&&(a=a.data),a.scale=void 0!==a.scale?1/a.scale:1;var e,f,g,h,k,m,l,v,p,r,z,t,y,x,c=new J,d=a,u=d.faces;p=d.vertices;var B=d.normals,w=d.colors;m=d.scale;var I=0;if(void 0!==d.uvs){for(e=0;e<d.uvs.length;e++)d.uvs[e].length&&I++;for(e=0;e<I;e++)c.faceVertexUvs[e]=[]}for(h=0,k=p.length;h<k;)(e=new n).x=p[h++]*m,e.y=p[h++]*m,e.z=p[h++]*m,c.vertices.push(e);for(h=0,k=u.length;h<k;)if(r=1&(p=u[h++]),g=2&p,e=8&p,l=16&p,z=32&p,m=64&p,p&=128,r){if((r=new Sa).a=u[h],r.b=u[h+1],r.c=u[h+3],(t=new Sa).a=u[h+1],t.b=u[h+2],t.c=u[h+3],h+=4,g&&(g=u[h++],r.materialIndex=g,t.materialIndex=g),g=c.faces.length,e)for(e=0;e<I;e++)for(y=d.uvs[e],c.faceVertexUvs[e][g]=[],c.faceVertexUvs[e][g+1]=[],f=0;f<4;f++)x=new C(x=y[2*(v=u[h++])],v=y[2*v+1]),2!==f&&c.faceVertexUvs[e][g].push(x),0!==f&&c.faceVertexUvs[e][g+1].push(x);if(l&&(l=3*u[h++],r.normal.set(B[l++],B[l++],B[l]),t.normal.copy(r.normal)),z)for(e=0;e<4;e++)l=3*u[h++],z=new n(B[l++],B[l++],B[l]),2!==e&&r.vertexNormals.push(z),0!==e&&t.vertexNormals.push(z);if(m&&(m=w[m=u[h++]],r.color.setHex(m),t.color.setHex(m)),p)for(e=0;e<4;e++)m=w[m=u[h++]],2!==e&&r.vertexColors.push(new G(m)),0!==e&&t.vertexColors.push(new G(m));c.faces.push(r),c.faces.push(t)}else{if((r=new Sa).a=u[h++],r.b=u[h++],r.c=u[h++],g&&(g=u[h++],r.materialIndex=g),g=c.faces.length,e)for(e=0;e<I;e++)for(y=d.uvs[e],c.faceVertexUvs[e][g]=[],f=0;f<3;f++)x=new C(x=y[2*(v=u[h++])],v=y[2*v+1]),c.faceVertexUvs[e][g].push(x);if(l&&(l=3*u[h++],r.normal.set(B[l++],B[l++],B[l])),z)for(e=0;e<3;e++)l=3*u[h++],z=new n(B[l++],B[l++],B[l]),r.vertexNormals.push(z);if(m&&(m=u[h++],r.color.setHex(w[m])),p)for(e=0;e<3;e++)m=u[h++],r.vertexColors.push(new G(w[m]));c.faces.push(r)}if(h=void 0!==(d=a).influencesPerVertex?d.influencesPerVertex:2,d.skinWeights)for(k=0,u=d.skinWeights.length;k<u;k+=h)c.skinWeights.push(new fa(d.skinWeights[k],1<h?d.skinWeights[k+1]:0,2<h?d.skinWeights[k+2]:0,3<h?d.skinWeights[k+3]:0));if(d.skinIndices)for(k=0,u=d.skinIndices.length;k<u;k+=h)c.skinIndices.push(new fa(d.skinIndices[k],1<h?d.skinIndices[k+1]:0,2<h?d.skinIndices[k+2]:0,3<h?d.skinIndices[k+3]:0));if(c.bones=d.bones,c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match."),u=(k=a).scale,void 0!==k.morphTargets)for(d=0,h=k.morphTargets.length;d<h;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=k.morphTargets[d].name,c.morphTargets[d].vertices=[],B=c.morphTargets[d].vertices,I=0,p=(w=k.morphTargets[d].vertices).length;I<p;I+=3)(m=new n).x=w[I]*u,m.y=w[I+1]*u,m.z=w[I+2]*u,B.push(m);if(void 0!==k.morphColors&&0<k.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),u=c.faces,k=k.morphColors[0].colors,d=0,h=u.length;d<h;d++)u[d].color.fromArray(k,3*d);for(d=[],h=[],void 0!==(k=a).animation&&h.push(k.animation),void 0!==k.animations&&(k.animations.length?h=h.concat(k.animations):h.push(k.animations)),k=0;k<h.length;k++)(u=Da.parseAnimation(h[k],c.bones))&&d.push(u);return c.morphTargets&&(h=Da.CreateClipsFromMorphTargetSequences(c.morphTargets,10),d=d.concat(h)),0<d.length&&(c.animations=d),c.computeFaceNormals(),c.computeBoundingSphere(),void 0===a.materials||0===a.materials.length?{geometry:c}:{geometry:c,materials:d=ec.prototype.initMaterials(a.materials,b,this.crossOrigin)}}}),Object.assign(Pe.prototype,{load:function(a,b,c,d){""===this.texturePath&&(this.texturePath=a.substring(0,a.lastIndexOf("/")+1));var e=this;new Ka(e.manager).load(a,function(c){var g=null;try{g=JSON.parse(c)}catch(h){return void 0!==d&&d(h),void console.error("THREE:ObjectLoader: Can't parse "+a+".",h.message)}void 0===(c=g.metadata)||void 0===c.type||"geometry"===c.type.toLowerCase()?console.error("THREE.ObjectLoader: Can't load "+a+". Use THREE.JSONLoader instead."):e.parse(g,b)},c,d)},setTexturePath:function(a){this.texturePath=a},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a,b){var c=this.parseGeometries(a.geometries),d=this.parseImages(a.images,function(){void 0!==b&&b(e)}),e=(d=this.parseTextures(a.textures,d),d=this.parseMaterials(a.materials,d),this.parseObject(a.object,c,d));return a.animations&&(e.animations=this.parseAnimations(a.animations)),void 0!==a.images&&0!==a.images.length||void 0===b||b(e),e},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new ce,d=new be,e=0,f=a.length;e<f;e++){var g,h=a[e];switch(h.type){case"PlaneGeometry":case"PlaneBufferGeometry":g=new Ma[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":g=new Ma[h.type](h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":g=new Ma[h.type](h.radius,h.segments,h.thetaStart,h.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":g=new Ma[h.type](h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded,h.thetaStart,h.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":g=new Ma[h.type](h.radius,h.height,h.radialSegments,h.heightSegments,h.openEnded,h.thetaStart,h.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":g=new Ma[h.type](h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":g=new Ma[h.type](h.radius,h.detail);break;case"RingGeometry":case"RingBufferGeometry":g=new Ma[h.type](h.innerRadius,h.outerRadius,h.thetaSegments,h.phiSegments,h.thetaStart,h.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":g=new Ma[h.type](h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":g=new Ma[h.type](h.radius,h.tube,h.tubularSegments,h.radialSegments,h.p,h.q);break;case"LatheGeometry":case"LatheBufferGeometry":g=new Ma[h.type](h.points,h.segments,h.phiStart,h.phiLength);break;case"BufferGeometry":g=d.parse(h);break;case"Geometry":g=c.parse(h,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+h.type+'"');continue}g.uuid=h.uuid,void 0!==h.name&&(g.name=h.name),b[h.uuid]=g}return b},parseMaterials:function(a,b){var c={};if(void 0!==a){var d=new Gd;d.setTextures(b);for(var e=0,f=a.length;e<f;e++){var g=a[e];if("MultiMaterial"===g.type){for(var h=[],k=0;k<g.materials.length;k++)h.push(d.parse(g.materials[k]));c[g.uuid]=h}else c[g.uuid]=d.parse(g)}}return c},parseAnimations:function(a){for(var b=[],c=0;c<a.length;c++){var d=Da.parse(a[c]);b.push(d)}return b},parseImages:function(a,b){function c(a){return d.manager.itemStart(a),g.load(a,function(){d.manager.itemEnd(a)},void 0,function(){d.manager.itemEnd(a),d.manager.itemError(a)})}var d=this,e={};if(void 0!==a&&0<a.length){var g=new Sc(f=new Zd(b));g.setCrossOrigin(this.crossOrigin);for(var f=0,h=a.length;f<h;f++){var k=a[f],m=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(k.url)?k.url:d.texturePath+k.url;e[k.uuid]=c(m)}}return e},parseTextures:function(a,b){function c(a,b){return"number"==typeof a?a:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",a),b[a])}var d={};if(void 0!==a)for(var e=0,f=a.length;e<f;e++){var g=a[e];void 0===g.image&&console.warn('THREE.ObjectLoader: No "image" specified for',g.uuid),void 0===b[g.image]&&console.warn("THREE.ObjectLoader: Undefined image",g.image);var h=new ba(b[g.image]);h.needsUpdate=!0,h.uuid=g.uuid,void 0!==g.name&&(h.name=g.name),void 0!==g.mapping&&(h.mapping=c(g.mapping,ng)),void 0!==g.offset&&h.offset.fromArray(g.offset),void 0!==g.repeat&&h.repeat.fromArray(g.repeat),void 0!==g.wrap&&(h.wrapS=c(g.wrap[0],ff),h.wrapT=c(g.wrap[1],ff)),void 0!==g.minFilter&&(h.minFilter=c(g.minFilter,gf)),void 0!==g.magFilter&&(h.magFilter=c(g.magFilter,gf)),void 0!==g.anisotropy&&(h.anisotropy=g.anisotropy),void 0!==g.flipY&&(h.flipY=g.flipY),d[g.uuid]=h}return d},parseObject:function(){var a=new K;return function(b,c,d){function e(a){return void 0===c[a]&&console.warn("THREE.ObjectLoader: Undefined geometry",a),c[a]}function f(a){if(void 0!==a){if(Array.isArray(a)){for(var b=[],c=0,e=a.length;c<e;c++){var f=a[c];void 0===d[f]&&console.warn("THREE.ObjectLoader: Undefined material",f),b.push(d[f])}return b}return void 0===d[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),d[a]}}var g;switch(b.type){case"Scene":g=new ld,void 0!==b.background&&Number.isInteger(b.background)&&(g.background=new G(b.background)),void 0!==b.fog&&("Fog"===b.fog.type?g.fog=new Jb(b.fog.color,b.fog.near,b.fog.far):"FogExp2"===b.fog.type&&(g.fog=new Ib(b.fog.color,b.fog.density)));break;case"PerspectiveCamera":g=new qa(b.fov,b.aspect,b.near,b.far),void 0!==b.focus&&(g.focus=b.focus),void 0!==b.zoom&&(g.zoom=b.zoom),void 0!==b.filmGauge&&(g.filmGauge=b.filmGauge),void 0!==b.filmOffset&&(g.filmOffset=b.filmOffset),void 0!==b.view&&(g.view=Object.assign({},b.view));break;case"OrthographicCamera":g=new Fb(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case"AmbientLight":g=new yd(b.color,b.intensity);break;case"DirectionalLight":g=new xd(b.color,b.intensity);break;case"PointLight":g=new vd(b.color,b.intensity,b.distance,b.decay);break;case"RectAreaLight":g=new zd(b.color,b.intensity,b.width,b.height);break;case"SpotLight":g=new ud(b.color,b.intensity,b.distance,b.angle,b.penumbra,b.decay);break;case"HemisphereLight":g=new sd(b.color,b.groundColor,b.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":g=e(b.geometry);var h=f(b.material);g=g.bones&&0<g.bones.length?new nd(g,h):new la(g,h);break;case"LOD":g=new yc;break;case"Line":g=new sa(e(b.geometry),f(b.material),b.mode);break;case"LineLoop":g=new od(e(b.geometry),f(b.material));break;case"LineSegments":g=new Q(e(b.geometry),f(b.material));break;case"PointCloud":case"Points":g=new Kb(e(b.geometry),f(b.material));break;case"Sprite":g=new xc(f(b.material));break;case"Group":g=new Ac;break;default:g=new z}if(g.uuid=b.uuid,void 0!==b.name&&(g.name=b.name),void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(g.position,g.quaternion,g.scale)):(void 0!==b.position&&g.position.fromArray(b.position),void 0!==b.rotation&&g.rotation.fromArray(b.rotation),void 0!==b.quaternion&&g.quaternion.fromArray(b.quaternion),void 0!==b.scale&&g.scale.fromArray(b.scale)),void 0!==b.castShadow&&(g.castShadow=b.castShadow),void 0!==b.receiveShadow&&(g.receiveShadow=b.receiveShadow),b.shadow&&(void 0!==b.shadow.bias&&(g.shadow.bias=b.shadow.bias),void 0!==b.shadow.radius&&(g.shadow.radius=b.shadow.radius),void 0!==b.shadow.mapSize&&g.shadow.mapSize.fromArray(b.shadow.mapSize),void 0!==b.shadow.camera&&(g.shadow.camera=this.parseObject(b.shadow.camera))),void 0!==b.visible&&(g.visible=b.visible),void 0!==b.userData&&(g.userData=b.userData),void 0!==b.children)for(var k in b.children)g.add(this.parseObject(b.children[k],c,d));if("LOD"===b.type)for(b=b.levels,h=0;h<b.length;h++){var m=b[h];void 0!==(k=g.getObjectByProperty("uuid",m.object))&&g.addLevel(k,m.distance)}return g}}()});var ng={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},ff={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},gf={NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008};Object.assign(ua.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(a){return a=this.getUtoTmapping(a),this.getPoint(a)},getPoints:function(a){void 0===a&&(a=5);for(var b=[],c=0;c<=a;c++)b.push(this.getPoint(c/a));return b},getSpacedPoints:function(a){void 0===a&&(a=5);for(var b=[],c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b},getLength:function(){var a=this.getLengths();return a[a.length-1]},getLengths:function(a){if(void 0===a&&(a=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var c,e,b=[],d=this.getPoint(0),f=0;for(b.push(0),e=1;e<=a;e++)f+=(c=this.getPoint(e/a)).distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(a,b){var d,f,c=this.getLengths(),e=c.length;f=b||a*c[e-1];for(var k,g=0,h=e-1;g<=h;)if((k=c[d=Math.floor(g+(h-g)/2)]-f)<0)g=d+1;else{if(!(0<k)){h=d;break}h=d-1}return c[d=h]===f?d/(e-1):(d+(f-(g=c[d]))/(c[d+1]-g))/(e-1)},getTangent:function(a){var b=a-1e-4;return b<0&&(b=0),1<(a+=1e-4)&&(a=1),b=this.getPoint(b),this.getPoint(a).clone().sub(b).normalize()},getTangentAt:function(a){return a=this.getUtoTmapping(a),this.getTangent(a)},computeFrenetFrames:function(a,b){var k,m,c=new n,d=[],e=[],f=[],g=new n,h=new K;for(k=0;k<=a;k++)m=k/a,d[k]=this.getTangentAt(m),d[k].normalize();e[0]=new n,f[0]=new n,k=Number.MAX_VALUE,m=Math.abs(d[0].x);var l=Math.abs(d[0].y),v=Math.abs(d[0].z);for(m<=k&&(k=m,c.set(1,0,0)),l<=k&&(k=l,c.set(0,1,0)),v<=k&&c.set(0,0,1),g.crossVectors(d[0],c).normalize(),e[0].crossVectors(d[0],g),f[0].crossVectors(d[0],e[0]),k=1;k<=a;k++)e[k]=e[k-1].clone(),f[k]=f[k-1].clone(),g.crossVectors(d[k-1],d[k]),g.length()>Number.EPSILON&&(g.normalize(),c=Math.acos(Y.clamp(d[k-1].dot(d[k]),-1,1)),e[k].applyMatrix4(h.makeRotationAxis(g,c))),f[k].crossVectors(d[k],e[k]);if(!0===b)for(c=Math.acos(Y.clamp(e[0].dot(e[a]),-1,1)),c/=a,0<d[0].dot(g.crossVectors(e[0],e[a]))&&(c=-c),k=1;k<=a;k++)e[k].applyMatrix4(h.makeRotationAxis(d[k],c*k)),f[k].crossVectors(d[k],e[k]);return{tangents:d,normals:e,binormals:f}}}),((Qa.prototype=Object.create(ua.prototype)).constructor=Qa).prototype.isLineCurve=!0,Qa.prototype.getPoint=function(a){if(1===a)return this.v2.clone();var b=this.v2.clone().sub(this.v1);return b.multiplyScalar(a).add(this.v1),b},Qa.prototype.getPointAt=function(a){return this.getPoint(a)},Qa.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()},Vc.prototype=Object.assign(Object.create(ua.prototype),{constructor:Vc,add:function(a){this.curves.push(a)},closePath:function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new Qa(b,a))},getPoint:function(a){var b=a*this.getLength(),c=this.getCurveLengths();for(a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,c=(a=this.curves[a]).getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a},getSpacedPoints:function(a){void 0===a&&(a=40);for(var b=[],c=0;c<=a;c++)b.push(this.getPoint(c/a));return this.autoClose&&b.push(b[0]),b},getPoints:function(a){a=a||12;for(var c,b=[],d=0,e=this.curves;d<e.length;d++)for(var f=(f=e[d]).getPoints(f&&f.isEllipseCurve?2*a:f&&f.isLineCurve?1:f&&f.isSplineCurve?a*f.points.length:a),g=0;g<f.length;g++){var h=f[g];c&&c.equals(h)||(b.push(h),c=h)}return this.autoClose&&1<b.length&&!b[b.length-1].equals(b[0])&&b.push(b[0]),b},createPointsGeometry:function(a){return a=this.getPoints(a),this.createGeometry(a)},createSpacedPointsGeometry:function(a){return a=this.getSpacedPoints(a),this.createGeometry(a)},createGeometry:function(a){for(var b=new J,c=0,d=a.length;c<d;c++){var e=a[c];b.vertices.push(new n(e.x,e.y,e.z||0))}return b}}),((Va.prototype=Object.create(ua.prototype)).constructor=Va).prototype.isEllipseCurve=!0,Va.prototype.getPoint=function(a){for(var b=2*Math.PI,c=this.aEndAngle-this.aStartAngle,d=Math.abs(c)<Number.EPSILON;c<0;)c+=b;for(;b<c;)c-=b;c<Number.EPSILON&&(c=d?0:b),!0!==this.aClockwise||d||(c=c===b?-b:c-b),b=this.aStartAngle+a*c,a=this.aX+this.xRadius*Math.cos(b);var e=this.aY+this.yRadius*Math.sin(b);return 0!==this.aRotation&&(b=Math.cos(this.aRotation),c=Math.sin(this.aRotation),a=(d=a-this.aX)*b-(e-=this.aY)*c+this.aX,e=d*c+e*b+this.aY),new C(a,e)},((yb.prototype=Object.create(ua.prototype)).constructor=yb).prototype.isSplineCurve=!0,yb.prototype.getPoint=function(a){var c=(c=((b=this.points).length-1)*a)-(a=Math.floor(c)),d=b[0===a?a:a-1],e=b[a],f=b[a>b.length-2?b.length-1:a+1],b=b[a>b.length-3?b.length-1:a+2];return new C(Qe(c,d.x,e.x,f.x,b.x),Qe(c,d.y,e.y,f.y,b.y))},((fc.prototype=Object.create(ua.prototype)).constructor=fc).prototype.getPoint=function(a){var b=this.v0,c=this.v1,d=this.v2,e=this.v3;return new C(xb(a,b.x,c.x,d.x,e.x),xb(a,b.y,c.y,d.y,e.y))},((gc.prototype=Object.create(ua.prototype)).constructor=gc).prototype.getPoint=function(a){var b=this.v0,c=this.v1,d=this.v2;return new C(wb(a,b.x,c.x,d.x),wb(a,b.y,c.y,d.y))};var te=Object.assign(Object.create(Vc.prototype),{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)},moveTo:function(a,b){this.currentPoint.set(a,b)},lineTo:function(a,b){var c=new Qa(this.currentPoint.clone(),new C(a,b));this.curves.push(c),this.currentPoint.set(a,b)},quadraticCurveTo:function(a,b,c,d){a=new gc(this.currentPoint.clone(),new C(a,b),new C(c,d)),this.curves.push(a),this.currentPoint.set(c,d)},bezierCurveTo:function(a,b,c,d,e,f){a=new fc(this.currentPoint.clone(),new C(a,b),new C(c,d),new C(e,f)),this.curves.push(a),this.currentPoint.set(e,f)},splineThru:function(a){var b=new yb(b=[this.currentPoint.clone()].concat(a));this.curves.push(b),this.currentPoint.copy(a[a.length-1])},arc:function(a,b,c,d,e,f){this.absarc(a+this.currentPoint.x,b+this.currentPoint.y,c,d,e,f)},absarc:function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)},ellipse:function(a,b,c,d,e,f,g,h){this.absellipse(a+this.currentPoint.x,b+this.currentPoint.y,c,d,e,f,g,h)},absellipse:function(a,b,c,d,e,f,g,h){a=new Va(a,b,c,d,e,f,g,h),0<this.curves.length&&((b=a.getPoint(0)).equals(this.currentPoint)||this.lineTo(b.x,b.y)),this.curves.push(a),a=a.getPoint(1),this.currentPoint.copy(a)}});(Wc.prototype=te).constructor=Wc,zb.prototype=Object.assign(Object.create(te),{constructor:zb,getPointsHoles:function(a){for(var b=[],c=0,d=this.holes.length;c<d;c++)b[c]=this.holes[c].getPoints(a);return b},extractAllPoints:function(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}},extractPoints:function(a){return this.extractAllPoints(a)}}),Object.assign(de.prototype,{moveTo:function(a,b){this.currentPath=new Wc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(a,b)},lineTo:function(a,b){this.currentPath.lineTo(a,b)},quadraticCurveTo:function(a,b,c,d){this.currentPath.quadraticCurveTo(a,b,c,d)},bezierCurveTo:function(a,b,c,d,e,f){this.currentPath.bezierCurveTo(a,b,c,d,e,f)},splineThru:function(a){this.currentPath.splineThru(a)},toShapes:function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new zb;f.curves=e.curves,b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,m=h.y-g.y;if(Math.abs(m)>Number.EPSILON){if(m<0&&(g=b[f],k=-k,h=b[e],m=-m),!(a.y<g.y||a.y>h.y))if(a.y===g.y){if(a.x===g.x)return!0}else{if(0===(e=m*(a.x-g.x)-k*(a.y-g.y)))return!0;e<0||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=Ia.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);var g,h,k,m=[];if(1===f.length)return h=f[0],(k=new zb).curves=h.curves,m.push(k),m;var l=!e(f[0].getPoints());l=a?!l:l;k=[];var z,n=[],p=[],r=0;n[r]=void 0,p[r]=[];for(var t=0,y=f.length;t<y;t++)g=e(z=(h=f[t]).getPoints()),(g=a?!g:g)?(!l&&n[r]&&r++,n[r]={s:new zb,p:z},n[r].s.curves=h.curves,l&&r++,p[r]=[]):p[r].push({h:h,p:z[0]});if(!n[0])return c(f);if(1<n.length){for(t=!1,h=[],e=0,f=n.length;e<f;e++)k[e]=[];for(e=0,f=n.length;e<f;e++)for(g=p[e],l=0;l<g.length;l++){for(r=g[l],z=!0,y=0;y<n.length;y++)d(r.p,n[y].p)&&(e!==y&&h.push({froms:e,tos:y,hole:l}),z?(z=!1,k[y].push(r)):t=!0);z&&k[e].push(r)}0<h.length&&(t||(p=k))}for(t=0,e=n.length;t<e;t++)for(k=n[t].s,m.push(k),f=0,g=(h=p[t]).length;f<g;f++)k.holes.push(h[f].h);return m}}),Object.assign(ee.prototype,{isFont:!0,generateShapes:function(a,b,c){void 0===b&&(b=100),void 0===c&&(c=4);var d=this.data;a=String(a).split("");var e=b/d.resolution,f=(d.boundingBox.yMax-d.boundingBox.yMin+d.underlineThickness)*e,g=0,h=0;b=[];for(var k=0;k<a.length;k++){var m=a[k];if("\n"===m)g=0,h-=f;else{var l;l=e;var n=g,p=h;if(m=d.glyphs[m]||d.glyphs["?"]){var t,y,x,u,B,w,C,G,r=new de,z=[];if(m.o)for(var D=m._cachedOutline||(m._cachedOutline=m.o.split(" ")),E=0,J=D.length;E<J;)switch(D[E++]){case"m":t=D[E++]*l+n,y=D[E++]*l+p,r.moveTo(t,y);break;case"l":t=D[E++]*l+n,y=D[E++]*l+p,r.lineTo(t,y);break;case"q":if(t=D[E++]*l+n,y=D[E++]*l+p,B=D[E++]*l+n,w=D[E++]*l+p,r.quadraticCurveTo(B,w,t,y),u=z[z.length-1]){x=u.x,u=u.y;for(var F=1;F<=c;F++){var K=F/c;wb(K,x,B,t),wb(K,u,w,y)}}break;case"b":if(t=D[E++]*l+n,y=D[E++]*l+p,B=D[E++]*l+n,w=D[E++]*l+p,C=D[E++]*l+n,G=D[E++]*l+p,r.bezierCurveTo(B,w,C,G,t,y),u=z[z.length-1])for(x=u.x,u=u.y,F=1;F<=c;F++)xb(K=F/c,x,B,C,t),xb(K,u,w,G,y)}l={offsetX:m.ha*l,path:r}}else l=void 0;g+=l.offsetX,b.push(l.path)}}for(c=[],d=0,a=b.length;d<a;d++)Array.prototype.push.apply(c,b[d].toShapes());return c}}),Object.assign(Re.prototype,{load:function(a,b,c,d){var e=this;new Ka(this.manager).load(a,function(a){var c;try{c=JSON.parse(a)}catch(d){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),c=JSON.parse(a.substring(65,a.length-2))}a=e.parse(c),b&&b(a)},c,d)},parse:function(a){return new ee(a)}});var Nd,Kd,qe,he={getContext:function(){return void 0===Nd&&(Nd=new(window.AudioContext||window.webkitAudioContext)),Nd},setContext:function(a){Nd=a}};Object.assign(fe.prototype,{load:function(a,b,c,d){var e=new Ka(this.manager);e.setResponseType("arraybuffer"),e.load(a,function(a){he.getContext().decodeAudioData(a,function(a){b(a)})},c,d)}}),Object.assign(Se.prototype,{update:function(){var a,b,c,d,e,f,g,h,k=new K,m=new K;return function(l){if(a!==this||b!==l.focus||c!==l.fov||d!==l.aspect*this.aspect||e!==l.near||f!==l.far||g!==l.zoom||h!==this.eyeSep){a=this,b=l.focus,c=l.fov,d=l.aspect*this.aspect,e=l.near,f=l.far,g=l.zoom;var z,t,n=l.projectionMatrix.clone(),p=(h=this.eyeSep/2)*e/b,r=e*Math.tan(Y.DEG2RAD*c*.5)/g;m.elements[12]=-h,k.elements[12]=h,z=-r*d+p,t=r*d+p,n.elements[0]=2*e/(t-z),n.elements[8]=(t+z)/(t-z),this.cameraL.projectionMatrix.copy(n),z=-r*d-p,t=r*d-p,n.elements[0]=2*e/(t-z),n.elements[8]=(t+z)/(t-z),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(l.matrixWorld).multiply(m),this.cameraR.matrixWorld.copy(l.matrixWorld).multiply(k)}}()}),(Hd.prototype=Object.create(z.prototype)).constructor=Hd,ge.prototype=Object.assign(Object.create(z.prototype),{constructor:ge,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=a,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.value=a},updateMatrixWorld:function(){var a=new n,b=new oa,c=new n,d=new n;return function(e){z.prototype.updateMatrixWorld.call(this,e),e=this.context.listener;var f=this.up;this.matrixWorld.decompose(a,b,c),d.set(0,0,-1).applyQuaternion(b),e.positionX?(e.positionX.setValueAtTime(a.x,this.context.currentTime),e.positionY.setValueAtTime(a.y,this.context.currentTime),e.positionZ.setValueAtTime(a.z,this.context.currentTime),e.forwardX.setValueAtTime(d.x,this.context.currentTime),e.forwardY.setValueAtTime(d.y,this.context.currentTime),e.forwardZ.setValueAtTime(d.z,this.context.currentTime),e.upX.setValueAtTime(f.x,this.context.currentTime),e.upY.setValueAtTime(f.y,this.context.currentTime),e.upZ.setValueAtTime(f.z,this.context.currentTime)):(e.setPosition(a.x,a.y,a.z),e.setOrientation(d.x,d.y,d.z,f.x,f.y,f.z))}}()}),hc.prototype=Object.assign(Object.create(z.prototype),{constructor:hc,getOutput:function(){return this.gain},setNodeSource:function(a){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=a,this.connect(),this},setBuffer:function(a){return this.buffer=a,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else{if(!1!==this.hasPlaybackControl){var a=this.context.createBufferSource();return a.buffer=this.buffer,a.loop=this.loop,a.onended=this.onEnded.bind(this),a.playbackRate.setValueAtTime(this.playbackRate,this.startTime),a.start(0,this.startTime),this.isPlaying=!0,this.source=a,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}},pause:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var a=1,b=this.filters.length;a<b;a++)this.filters[a-1].connect(this.filters[a]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var a=1,b=this.filters.length;a<b;a++)this.filters[a-1].disconnect(this.filters[a]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(a){return a||(a=[]),!0===this.isPlaying?(this.disconnect(),this.filters=a,this.connect()):this.filters=a,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(a){return this.setFilters(a?[a]:[])},setPlaybackRate:function(a){if(!1!==this.hasPlaybackControl)return this.playbackRate=a,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(a){if(!1!==this.hasPlaybackControl)return this.loop=a,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(a){return this.gain.gain.value=a,this}}),ie.prototype=Object.assign(Object.create(hc.prototype),{constructor:ie,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(a){this.panner.refDistance=a},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(a){this.panner.rolloffFactor=a},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(a){this.panner.distanceModel=a},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(a){this.panner.maxDistance=a},updateMatrixWorld:function(){var a=new n;return function(b){z.prototype.updateMatrixWorld.call(this,b),a.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(a.x,a.y,a.z)}}()}),Object.assign(je.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var a=0,b=this.getFrequencyData(),c=0;c<b.length;c++)a+=b[c];return a/b.length}}),Object.assign(ke.prototype,{accumulate:function(a,b){var c=this.buffer,d=this.valueSize,e=a*d+d,f=this.cumulativeWeight;if(0===f){for(f=0;f!==d;++f)c[e+f]=c[f];f=b}else f+=b,this._mixBufferRegion(c,e,0,b/f,d);this.cumulativeWeight=f},apply:function(a){var b=this.valueSize,c=this.buffer;a=a*b+b;var d=this.cumulativeWeight,e=this.binding;this.cumulativeWeight=0,d<1&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){oa.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}}),Object.assign(Te.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}}),Object.assign(ha,{Composite:Te,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new ha.Composite(a,b,c):new ha(a,b,c)},sanitizeNodeName:function(a){return a.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:function(){var a=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),b=["material","materials","bones"];return function(c){if(!(d=a.exec(c)))throw Error("PropertyBinding: Cannot parse trackName: "+c);var d,e=(d={nodeName:d[2],objectName:d[3],objectIndex:d[4],propertyName:d[5],propertyIndex:d[6]}).nodeName&&d.nodeName.lastIndexOf(".");if(void 0!==e&&-1!==e){var f=d.nodeName.substring(e+1);-1!==b.indexOf(f)&&(d.nodeName=d.nodeName.substring(0,e),d.objectName=f)}if(null===d.propertyName||0===d.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+c);return d}}(),findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=function(a){for(var c=0;c<a.bones.length;c++){var d=a.bones[c];if(d.name===b)return d}return null}(a.skeleton);if(c)return c}if(a.children){var d=function(a){for(var c=0;c<a.length;c++){var g=a[c];if(g.name===b||g.uuid===b||(g=d(g.children)))return g}return null};if(c=d(a.children))return c}return null}}),Object.assign(ha.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(a,b){a[b]=this.node[this.propertyName]},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)a[b++]=c[d]},function(a,b){a[b]=this.resolvedProperty[this.propertyIndex]},function(a,b){this.resolvedProperty.toArray(a,b)}],SetterByBindingTypeAndVersioning:[[function(a,b){this.node[this.propertyName]=a[b]},function(a,b){this.node[this.propertyName]=a[b],this.targetObject.needsUpdate=!0},function(a,b){this.node[this.propertyName]=a[b],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++]},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.needsUpdate=!0},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty[this.propertyIndex]=a[b]},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b],this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty.fromArray(a,b)},function(a,b){this.resolvedProperty.fromArray(a,b),this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty.fromArray(a,b),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(a,b){this.bind(),this.getValue(a,b)},setValue:function(a,b){this.bind(),this.setValue(a,b)},bind:function(){var a=this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,e=b.propertyIndex;if(a||(this.node=a=ha.findNode(this.rootNode,b.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,a){if(c){var f=b.objectIndex;switch(c){case"materials":if(!a.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!a.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);a=a.material.materials;break;case"bones":if(!a.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);for(a=a.skeleton.bones,c=0;c<a.length;c++)if(a[c].name===f){f=c;break}break;default:if(void 0===a[c])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);a=a[c]}if(void 0!==f){if(void 0===a[f])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,a);a=a[f]}}if(void 0===(f=a[d]))console.error("THREE.PropertyBinding: Trying to update property for track: "+b.nodeName+"."+d+" but it wasn't found.",a);else{if(b=this.Versioning.None,void 0!==a.needsUpdate?(b=this.Versioning.NeedsUpdate,this.targetObject=a):void 0!==a.matrixWorldNeedsUpdate&&(b=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=a),c=this.BindingType.Direct,void 0!==e){if("morphTargetInfluences"===d){if(!a.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(a.geometry.isBufferGeometry){if(!a.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(c=0;c<this.node.geometry.morphAttributes.position.length;c++)if(a.geometry.morphAttributes.position[c].name===e){e=c;break}}else{if(!a.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(c=0;c<this.node.geometry.morphTargets.length;c++)if(a.geometry.morphTargets[c].name===e){e=c;break}}}c=this.BindingType.ArrayElement,this.resolvedProperty=f,this.propertyIndex=e}else void 0!==f.fromArray&&void 0!==f.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=f):Array.isArray(f)?(c=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=d;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][b]}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(ha.prototype,{_getValue_unbound:ha.prototype.getValue,_setValue_unbound:ha.prototype.setValue}),Object.assign(Ue.prototype,{isAnimationObjectGroup:!0,add:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._paths,g=this._parsedPaths,h=this._bindings,k=h.length,m=0,l=arguments.length;m!==l;++m){var n=arguments[m],r=e[p=n.uuid];if(void 0===r){r=c++,e[p]=r,b.push(n);for(var p=0,z=k;p!==z;++p)h[p].push(new ha(n,f[p],g[p]))}else if(r<d){var t=--d;for(b[e[(z=b[t]).uuid]=r]=z,b[e[p]=t]=n,p=0,z=k;p!==z;++p){var y=h[p],x=y[r];y[r]=y[t],void 0===x&&(x=new ha(n,f[p],g[p])),y[t]=x}}else void 0!==b[r]&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=d},remove:function(a){for(var b=this._objects,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k=arguments[g],m=k.uuid,l=d[m];if(void 0!==l&&c<=l){var n=c++;for(b[d[(p=b[n]).uuid]=l]=p,b[d[m]=n]=k,k=0,m=f;k!==m;++k){var p,r=(p=e[k])[l];p[l]=p[n],p[n]=r}}}this.nCachedObjects_=c},uncache:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._bindings,g=f.length,h=0,k=arguments.length;h!==k;++h){var n=e[l=arguments[h].uuid];if(void 0!==n)if(delete e[l],n<d){var l,v=b[l=--d],p=--c,r=b[p];for(b[e[v.uuid]=n]=v,b[e[r.uuid]=l]=r,b.pop(),v=0,r=g;v!==r;++v){var z=f[v],t=z[p];z[n]=z[l],z[l]=t,z.pop()}}else for(b[e[(r=b[p=--c]).uuid]=n]=r,b.pop(),v=0,r=g;v!==r;++v)(z=f[v])[n]=z[p],z.pop()}this.nCachedObjects_=d},subscribe_:function(a,b){var c=this._bindingsIndicesByPath,d=c[a],e=this._bindings;if(void 0!==d)return e[d];var f=this._paths,g=this._parsedPaths,h=this._objects,k=this.nCachedObjects_,l=Array(h.length);d=e.length;for(c[a]=d,f.push(a),g.push(b),e.push(l),c=k,d=h.length;c!==d;++c)l[c]=new ha(h[c],a,b);return l},unsubscribe_:function(a){var b=this._bindingsIndicesByPath,c=b[a];if(void 0!==c){var d=this._paths,e=this._parsedPaths,f=this._bindings,g=f.length-1,h=f[g];f[b[a[g]]=c]=h,f.pop(),e[c]=e[g],e.pop(),d[c]=d[g],d.pop()}}}),Object.assign(Ve.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(a){return this._startTime=a,this},setLoop:function(a,b){return this.loop=a,this.repetitions=b,this},setEffectiveWeight:function(a){return this.weight=a,this._effectiveWeight=this.enabled?a:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(a){return this._scheduleFading(a,0,1)},fadeOut:function(a){return this._scheduleFading(a,1,0)},crossFadeFrom:function(a,b,c){if(a.fadeOut(b),this.fadeIn(b),c){c=this._clip.duration;var d=a._clip.duration,e=c/d;a.warp(1,d/c,b),this.warp(e,1,b)}return this},crossFadeTo:function(a,b,c){return a.crossFadeFrom(this,b,c)},stopFading:function(){var a=this._weightInterpolant;return null!==a&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(a)),this},setEffectiveTimeScale:function(a){return this.timeScale=a,this._effectiveTimeScale=this.paused?0:a,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(a){return this.timeScale=this._clip.duration/a,this.stopWarping()},syncWith:function(a){return this.time=a.time,this.timeScale=a.timeScale,this.stopWarping()},halt:function(a){return this.warp(this._effectiveTimeScale,0,a)},warp:function(a,b,c){var d=this._mixer,e=d.time,f=this._timeScaleInterpolant,g=this.timeScale;return null===f&&(this._timeScaleInterpolant=f=d._lendControlInterpolant()),d=f.parameterPositions,f=f.sampleValues,d[0]=e,d[1]=e+c,f[0]=a/g,f[1]=b/g,this},stopWarping:function(){var a=this._timeScaleInterpolant;return null!==a&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(a)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(a,b,c,d){if(this.enabled){if(null!==(e=this._startTime)){if((b=(a-e)*c)<0||0===c)return;this._startTime=null,b*=c}if(b*=this._updateTimeScale(a),c=this._updateTime(b),0<(a=this._updateWeight(a))){b=this._interpolants;for(var e=this._propertyBindings,f=0,g=b.length;f!==g;++f)b[f].evaluate(c),e[f].accumulate(d,a)}}else this._updateWeight(a)},_updateWeight:function(a){var b=0;if(this.enabled){b=this.weight;var c=this._weightInterpolant;if(null!==c){var d=c.evaluate(a)[0];b=b*d;a>c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var c=this._timeScaleInterpolant;if(null!==c){b=b*c.evaluate(a)[0];a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a;if(0===a)return b;var c=this._clip.duration,d=this.loop,e=this._loopCount;if(2200===d)a:{if(-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1)),c<=b)b=c;else{if(!(b<0))break a;b=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:a<0?-1:1})}else{if(d=2202===d,-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d)),c<=b||b<0){var f=Math.floor(b/c),g=(b=b-c*f,e=e+Math.abs(f),this.repetitions-e);g<0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,b=0<a?c:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<a?1:-1})):(0==g?(a=a<0,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:f}))}if(d&&1==(1&e))return c-(this.time=b)}return this.time=b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;return null===f&&(this._weightInterpolant=f=d._lendControlInterpolant()),d=f.parameterPositions,f=f.sampleValues,d[0]=e,f[0]=b,d[1]=e+a,f[1]=c,this}}),Object.assign(We.prototype,xa.prototype,{_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings,g=a._interpolants,h=c.uuid,k=this._bindingsByRootAndName,l=k[h];for(void 0===l&&(l={},k[h]=l),k=0;k!==e;++k){var n=d[k],v=n.name,p=l[v];if(void 0===p){if(void 0!==(p=f[k])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,h,v));continue}++(p=new ke(ha.create(c,v,b&&b._propertyBindings[k].binding.parsedPath),n.ValueTypeName,n.getValueSize())).referenceCount,this._addInactiveBinding(p,h,v)}f[k]=p,g[k].resultBuffer=p.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]),this._addInactiveAction(a,c,b)}for(c=0,d=(b=a._propertyBindings).length;c!==d;++c){var e=b[c];0==e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0==--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){return null!==(a=a._cacheIndex)&&a<this._nActiveActions},_addInactiveAction:function(a,b,c){var d=this._actions,e=this._actionsByClip,f=e[b];void 0===f?(f={knownActions:[a],actionByRoot:{}},a._byClipCacheIndex=0,e[b]=f):(b=f.knownActions,a._byClipCacheIndex=b.length,b.push(a)),a._cacheIndex=d.length,d.push(a),f.actionByRoot[c]=a},_removeInactiveAction:function(a){var c=(b=this._actions)[b.length-1],d=a._cacheIndex;b[c._cacheIndex=d]=c,b.pop(),a._cacheIndex=null;var b=a._clip.uuid,e=(d=(c=this._actionsByClip)[b]).knownActions,f=e[e.length-1],g=a._byClipCacheIndex;e[f._byClipCacheIndex=g]=f,e.pop(),a._byClipCacheIndex=null,delete d.actionByRoot[(a._localRoot||this._root).uuid],0===e.length&&delete c[b],this._removeInactiveBindingsForAction(a)},_removeInactiveBindingsForAction:function(a){for(var b=0,c=(a=a._propertyBindings).length;b!==c;++b){var d=a[b];0==--d.referenceCount&&this._removeInactiveBinding(d)}},_lendAction:function(a){var b=this._actions,c=a._cacheIndex,d=this._nActiveActions++,e=b[d];b[a._cacheIndex=d]=a,b[e._cacheIndex=c]=e},_takeBackAction:function(a){var b=this._actions,c=a._cacheIndex,d=--this._nActiveActions,e=b[d];b[a._cacheIndex=d]=a,b[e._cacheIndex=c]=e},_addInactiveBinding:function(a,b,c){var d=this._bindingsByRootAndName,e=d[b],f=this._bindings;void 0===e&&(e={},d[b]=e),(e[c]=a)._cacheIndex=f.length,f.push(a)},_removeInactiveBinding:function(a){var b=this._bindings,d=(c=a.binding).rootNode.uuid,c=c.path,e=this._bindingsByRootAndName,f=e[d],g=b[b.length-1];a=a._cacheIndex,b[g._cacheIndex=a]=g,b.pop(),delete f[c];a:{for(var h in f)break a;delete e[d]}},_lendBinding:function(a){var b=this._bindings,c=a._cacheIndex,d=this._nActiveBindings++,e=b[d];b[a._cacheIndex=d]=a,b[e._cacheIndex=c]=e},_takeBackBinding:function(a){var b=this._bindings,c=a._cacheIndex,d=--this._nActiveBindings,e=b[d];b[a._cacheIndex=d]=a,b[e._cacheIndex=c]=e},_lendControlInterpolant:function(){var a=this._controlInterpolants,b=this._nActiveControlInterpolants++,c=a[b];return void 0===c&&(a[(c=new Tc(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=b]=c),c},_takeBackControlInterpolant:function(a){var b=this._controlInterpolants,c=a.__cacheIndex,d=--this._nActiveControlInterpolants,e=b[d];b[a.__cacheIndex=d]=a,b[e.__cacheIndex=c]=e},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(a,b){var d=(c=b||this._root).uuid,e="string"==typeof a?Da.findByName(c,a):a,c=null!==e?e.uuid:a,f=this._actionsByClip[c],g=null;if(void 0!==f){if(void 0!==(g=f.actionByRoot[d]))return g;g=f.knownActions[0],null===e&&(e=g._clip)}return null===e?null:(e=new Ve(this,e,b),this._bindAction(e,g),this._addInactiveAction(e,c,d),e)},existingAction:function(a,b){var d=(c=b||this._root).uuid,c="string"==typeof a?Da.findByName(c,a):a;return void 0!==(c=this._actionsByClip[c?c.uuid:a])&&c.actionByRoot[d]||null},stopAllAction:function(){for(var a=this._actions,b=this._nActiveActions,c=this._bindings,d=this._nActiveBindings,e=this._nActiveBindings=this._nActiveActions=0;e!==b;++e)a[e].reset();for(e=0;e!==d;++e)c[e].useCount=0;return this},update:function(a){a*=this.timeScale;for(var b=this._actions,c=this._nActiveActions,d=this.time+=a,e=Math.sign(a),f=this._accuIndex^=1,g=0;g!==c;++g)b[g]._update(d,a,e,f);for(a=this._bindings,b=this._nActiveBindings,g=0;g!==b;++g)a[g].apply(f);return this},getRoot:function(){return this._root},uncacheClip:function(a){var b=this._actions;a=a.uuid;var c=this._actionsByClip;if(void 0!==(d=c[a])){for(var d,e=0,f=(d=d.knownActions).length;e!==f;++e){var g=d[e];this._deactivateAction(g);var h=g._cacheIndex,k=b[b.length-1];g._cacheIndex=null,g._byClipCacheIndex=null,b[k._cacheIndex=h]=k,b.pop(),this._removeInactiveBindingsForAction(g)}delete c[a]}},uncacheRoot:function(a){a=a.uuid;var c,b=this._actionsByClip;for(c in b){var d=b[c].actionByRoot[a];void 0!==d&&(this._deactivateAction(d),this._removeInactiveAction(d))}if(void 0!==(c=this._bindingsByRootAndName[a]))for(var e in c)(a=c[e]).restoreOriginalState(),this._removeInactiveBinding(a)},uncacheAction:function(a,b){var c=this.existingAction(a,b);null!==c&&(this._deactivateAction(c),this._removeInactiveAction(c))}}),Id.prototype.clone=function(){return new Id(void 0===this.value.clone?this.value:this.value.clone())},le.prototype=Object.assign(Object.create(E.prototype),{constructor:le,isInstancedBufferGeometry:!0,addGroup:function(a,b,c){this.groups.push({start:a,count:b,materialIndex:c})},copy:function(a){null!==(b=a.index)&&this.setIndex(b.clone());var c,b=a.attributes;for(c in b)this.addAttribute(c,b[c].clone());for(c=0,b=(a=a.groups).length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}return this}}),Object.defineProperties(me.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(me.prototype,{isInterleavedBufferAttribute:!0,setX:function(a,b){return this.data.array[a*this.data.stride+this.offset]=b,this},setY:function(a,b){return this.data.array[a*this.data.stride+this.offset+1]=b,this},setZ:function(a,b){return this.data.array[a*this.data.stride+this.offset+2]=b,this},setW:function(a,b){return this.data.array[a*this.data.stride+this.offset+3]=b,this},getX:function(a){return this.data.array[a*this.data.stride+this.offset]},getY:function(a){return this.data.array[a*this.data.stride+this.offset+1]},getZ:function(a){return this.data.array[a*this.data.stride+this.offset+2]},getW:function(a){return this.data.array[a*this.data.stride+this.offset+3]},setXY:function(a,b,c){return a=a*this.data.stride+this.offset,this.data.array[a+0]=b,this.data.array[a+1]=c,this},setXYZ:function(a,b,c,d){return a=a*this.data.stride+this.offset,this.data.array[a+0]=b,this.data.array[a+1]=c,this.data.array[a+2]=d,this},setXYZW:function(a,b,c,d,e){return a=a*this.data.stride+this.offset,this.data.array[a+0]=b,this.data.array[a+1]=c,this.data.array[a+2]=d,this.data.array[a+3]=e,this}}),Object.defineProperty(ic.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}}),Object.assign(ic.prototype,{isInterleavedBuffer:!0,setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==a?a.length/this.stride:0,this.array=a},setDynamic:function(a){return this.dynamic=a,this},copy:function(a){return this.array=new a.array.constructor(a.array),this.count=a.count,this.stride=a.stride,this.dynamic=a.dynamic,this},copyAt:function(a,b,c){a*=this.stride,c*=b.stride;for(var d=0,e=this.stride;d<e;d++)this.array[a+d]=b.array[c+d];return this},set:function(a,b){return void 0===b&&(b=0),this.array.set(a,b),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(a){return this.onUploadCallback=a,this}}),ne.prototype=Object.assign(Object.create(ic.prototype),{constructor:ne,isInstancedInterleavedBuffer:!0,copy:function(a){return ic.prototype.copy.call(this,a),this.meshPerAttribute=a.meshPerAttribute,this}}),oe.prototype=Object.assign(Object.create(Z.prototype),{constructor:oe,isInstancedBufferAttribute:!0,copy:function(a){return Z.prototype.copy.call(this,a),this.meshPerAttribute=a.meshPerAttribute,this}}),Object.assign(Xe.prototype,{linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(a,b){b&&b.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(b.matrixWorld),this.ray.direction.set(a.x,a.y,.5).unproject(b).sub(this.ray.origin).normalize()):b&&b.isOrthographicCamera?(this.ray.origin.set(a.x,a.y,(b.near+b.far)/(b.near-b.far)).unproject(b),this.ray.direction.set(0,0,-1).transformDirection(b.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,b){var c=[];return pe(a,this,c,b),c.sort(Ye),c},intersectObjects:function(a,b){var c=[];if(!1===Array.isArray(a))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),c;for(var d=0,e=a.length;d<e;d++)pe(a[d],this,c,b);return c.sort(Ye),c}}),Object.assign(Ze.prototype,{start:function(){this.oldTime=this.startTime=("undefined"==typeof performance?Date:performance).now(),this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.autoStart=this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"==typeof performance?Date:performance).now();a=(b-this.oldTime)/1e3;this.oldTime=b,this.elapsedTime+=a}return a}}),Object.assign($e.prototype,{set:function(a,b,c){return this.radius=a,this.phi=b,this.theta=c,this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.radius=a.radius,this.phi=a.phi,this.theta=a.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(a){return this.radius=a.length(),0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(a.x,a.z),this.phi=Math.acos(Y.clamp(a.y/this.radius,-1,1))),this}}),Object.assign(af.prototype,{set:function(a,b,c){return this.radius=a,this.theta=b,this.y=c,this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.radius=a.radius,this.theta=a.theta,this.y=a.y,this},setFromVector3:function(a){return this.radius=Math.sqrt(a.x*a.x+a.z*a.z),this.theta=Math.atan2(a.x,a.z),this.y=a.y,this}}),((ta.prototype=Object.create(la.prototype)).constructor=ta).prototype.createAnimation=function(a,b,c,d){b={start:b,end:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[a]=b,this.animationsList.push(b)},ta.prototype.autoCreateAnimations=function(a){for(var c,b=/([a-z]+)_?(\d+)/i,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&1<h.length){var k=h[1];d[k]||(d[k]={start:1/0,end:-1/0}),f<(h=d[k]).start&&(h.start=f),f>h.end&&(h.end=f),c||(c=k)}}for(k in d)h=d[k],this.createAnimation(k,h.start,h.end,a);this.firstAnimation=c},ta.prototype.setAnimationDirectionForward=function(a){(a=this.animationsMap[a])&&(a.direction=1,a.directionBackwards=!1)},ta.prototype.setAnimationDirectionBackward=function(a){(a=this.animationsMap[a])&&(a.direction=-1,a.directionBackwards=!0)},ta.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)},ta.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)},ta.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)},ta.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)},ta.prototype.getAnimationTime=function(a){var b=0;return(a=this.animationsMap[a])&&(b=a.time),b},ta.prototype.getAnimationDuration=function(a){var b=-1;return(a=this.animationsMap[a])&&(b=a.duration),b},ta.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("THREE.MorphBlendMesh: animation["+a+"] undefined in .playAnimation()")},ta.prototype.stopAnimation=function(a){(a=this.animationsMap[a])&&(a.active=!1)},ta.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a,d.mirroredLoop?(d.time>d.duration||d.time<0)&&(d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),d.time<0&&(d.time=0,d.directionBackwards=!1)):(d.time%=d.duration,d.time<0&&(d.time+=d.duration));var f=d.start+Y.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f),e=d.time%e/e,d.directionBackwards&&(e=1-e),d.currentFrame!==d.lastFrame?(this.morphTargetInfluences[d.currentFrame]=e*g,this.morphTargetInfluences[d.lastFrame]=(1-e)*g):this.morphTargetInfluences[d.currentFrame]=g}}},((Xc.prototype=Object.create(z.prototype)).constructor=Xc).prototype.isImmediateRenderObject=!0,((Yc.prototype=Object.create(Q.prototype)).constructor=Yc).prototype.update=function(){var a=new n,b=new n,c=new Ba;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0),c.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,k=g.faces,l=g=0,n=k.length;l<n;l++)for(var v=k[l],p=0,r=v.vertexNormals.length;p<r;p++){var z=v.vertexNormals[p];a.copy(h[v[d[p]]]).applyMatrix4(e),b.copy(z).applyMatrix3(c).normalize().multiplyScalar(this.size).add(a),f.setXYZ(g,a.x,a.y,a.z),g+=1,f.setXYZ(g,b.x,b.y,b.z),g+=1}else if(g&&g.isBufferGeometry)for(d=g.attributes.position,h=g.attributes.normal,p=g=0,r=d.count;p<r;p++)a.set(d.getX(p),d.getY(p),d.getZ(p)).applyMatrix4(e),b.set(h.getX(p),h.getY(p),h.getZ(p)),b.applyMatrix3(c).normalize().multiplyScalar(this.size).add(a),f.setXYZ(g,a.x,a.y,a.z),g+=1,f.setXYZ(g,b.x,b.y,b.z),g+=1;f.needsUpdate=!0}}(),((jc.prototype=Object.create(z.prototype)).constructor=jc).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},jc.prototype.update=function(){var a=new n,b=new n;return function(){this.light.updateMatrixWorld();var c=this.light.distance?this.light.distance:1e3,d=c*Math.tan(this.light.angle);this.cone.scale.set(d,d,c),a.setFromMatrixPosition(this.light.matrixWorld),b.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(b.sub(a)),this.cone.material.color.copy(this.light.color)}}(),((kc.prototype=Object.create(Q.prototype)).constructor=kc).prototype.onBeforeRender=function(){var a=new n,b=new K,c=new K;return function(){var d=this.bones,e=this.geometry,f=e.getAttribute("position");c.getInverse(this.root.matrixWorld);for(var g=0,h=0;g<d.length;g++){var k=d[g];k.parent&&k.parent.isBone&&(b.multiplyMatrices(c,k.matrixWorld),a.setFromMatrixPosition(b),f.setXYZ(h,a.x,a.y,a.z),b.multiplyMatrices(c,k.parent.matrixWorld),a.setFromMatrixPosition(b),f.setXYZ(h+1,a.x,a.y,a.z),h+=2)}e.getAttribute("position").needsUpdate=!0}}(),((lc.prototype=Object.create(la.prototype)).constructor=lc).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},lc.prototype.update=function(){this.material.color.copy(this.light.color)},((mc.prototype=Object.create(z.prototype)).constructor=mc).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},mc.prototype.update=function(){(a=this.children[0]).material.color.copy(this.light.color);var a,b=.5*this.light.width,c=.5*this.light.height,d=(a=a.geometry.attributes.position).array;d[0]=b,d[1]=-c,d[2]=0,d[3]=b,d[4]=c,d[5]=0,d[6]=-b,d[7]=c,d[8]=0,d[9]=-b,d[10]=-c,d[11]=0,d[12]=b,d[13]=-c,d[14]=0,a.needsUpdate=!0},((nc.prototype=Object.create(z.prototype)).constructor=nc).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},nc.prototype.update=function(){var a=new n,b=new G,c=new G;return function(){var d=this.children[0],e=d.geometry.getAttribute("color");b.copy(this.light.color),c.copy(this.light.groundColor);for(var f=0,g=e.count;f<g;f++){var h=f<g/2?b:c;e.setXYZ(f,h.r,h.g,h.b)}d.lookAt(a.setFromMatrixPosition(this.light.matrixWorld).negate()),e.needsUpdate=!0}}(),(Zc.prototype=Object.create(Q.prototype)).constructor=Zc,(Jd.prototype=Object.create(Q.prototype)).constructor=Jd,(($c.prototype=Object.create(Q.prototype)).constructor=$c).prototype.update=function(){var a=new n,b=new n,c=new Ba;return function(){this.object.updateMatrixWorld(!0),c.getNormalMatrix(this.object.matrixWorld);for(var f,d=this.object.matrixWorld,e=this.geometry.attributes.position,g=(f=this.object.geometry).vertices,h=0,k=0,l=(f=f.faces).length;k<l;k++){var n=f[k],v=n.normal;a.copy(g[n.a]).add(g[n.b]).add(g[n.c]).divideScalar(3).applyMatrix4(d),b.copy(v).applyMatrix3(c).normalize().multiplyScalar(this.size).add(a),e.setXYZ(h,a.x,a.y,a.z),h+=1,e.setXYZ(h,b.x,b.y,b.z),h+=1}e.needsUpdate=!0}}(),((oc.prototype=Object.create(z.prototype)).constructor=oc).prototype.dispose=function(){var a=this.children[0],b=this.children[1];a.geometry.dispose(),a.material.dispose(),b.geometry.dispose(),b.material.dispose()},oc.prototype.update=function(){var a=new n,b=new n,c=new n;return function(){a.setFromMatrixPosition(this.light.matrixWorld),b.setFromMatrixPosition(this.light.target.matrixWorld),c.subVectors(b,a);var d=this.children[0],e=this.children[1];d.lookAt(c),d.material.color.copy(this.light.color),e.lookAt(c),e.scale.z=c.length()}}(),((ad.prototype=Object.create(Q.prototype)).constructor=ad).prototype.update=function(){function a(a,g,h,k){if(d.set(g,h,k).unproject(e),void 0!==(a=c[a]))for(g=b.getAttribute("position"),h=0,k=a.length;h<k;h++)g.setXYZ(a[h],d.x,d.y,d.z)}var b,c,d=new n,e=new Na;return function(){b=this.geometry,c=this.pointMap,e.projectionMatrix.copy(this.camera.projectionMatrix),a("c",0,0,-1),a("t",0,0,1),a("n1",-1,-1,-1),a("n2",1,-1,-1),a("n3",-1,1,-1),a("n4",1,1,-1),a("f1",-1,-1,1),a("f2",1,-1,1),a("f3",-1,1,1),a("f4",1,1,1),a("u1",.7,1.1,-1),a("u2",-.7,1.1,-1),a("u3",0,2,-1),a("cf1",-1,0,1),a("cf2",1,0,1),a("cf3",0,-1,1),a("cf4",0,1,1),a("cn1",-1,0,-1),a("cn2",1,0,-1),a("cn3",0,-1,-1),a("cn4",0,1,-1),b.getAttribute("position").needsUpdate=!0}}(),((Ab.prototype=Object.create(Q.prototype)).constructor=Ab).prototype.update=function(){var a=new Ra;return function(b){if(void 0!==b&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&a.setFromObject(this.object),!a.isEmpty()){b=a.min;var c=a.max,d=this.geometry.attributes.position,e=d.array;e[0]=c.x,e[1]=c.y,e[2]=c.z,e[3]=b.x,e[4]=c.y,e[5]=c.z,e[6]=b.x,e[7]=b.y,e[8]=c.z,e[9]=c.x,e[10]=b.y,e[11]=c.z,e[12]=c.x,e[13]=c.y,e[14]=b.z,e[15]=b.x,e[16]=c.y,e[17]=b.z,e[18]=b.x,e[19]=b.y,e[20]=b.z,e[21]=c.x,e[22]=b.y,e[23]=b.z,d.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),Ab.prototype.setFromObject=function(a){return this.object=a,this.update(),this},((Bb.prototype=Object.create(z.prototype)).constructor=Bb).prototype.setDirection=function(){var b,a=new n;return function(c){.99999<c.y?this.quaternion.set(0,0,0,1):c.y<-.99999?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}(),Bb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a),void 0===c&&(c=.2*b),this.line.scale.set(1,Math.max(0,a-b),1),this.line.updateMatrix(),this.cone.scale.set(c,b,c),this.cone.position.y=a,this.cone.updateMatrix()},Bb.prototype.setColor=function(a){this.line.material.color.copy(a),this.cone.material.color.copy(a)},(Ld.prototype=Object.create(Q.prototype)).constructor=Ld;var Od=new n,ue=new re,ve=new re,we=new re;((La.prototype=Object.create(ua.prototype)).constructor=La).prototype.getPoint=function(a){var e,f,g,b=this.points;if(a*=(c=b.length)-(this.closed?0:1),a-=d=Math.floor(a),this.closed?d+=0<d?0:(Math.floor(Math.abs(d)/b.length)+1)*b.length:0===a&&d===c-1&&(d=c-2,a=1),e=this.closed||0<d?b[(d-1)%c]:(Od.subVectors(b[0],b[1]).add(b[0]),Od),f=b[d%c],g=b[(d+1)%c],b=this.closed||d+2<c?b[(d+2)%c]:(Od.subVectors(b[c-1],b[c-2]).add(b[c-1]),Od),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var d,h="chordal"===this.type?.5:.25,c=Math.pow(e.distanceToSquared(f),h);(d=Math.pow(f.distanceToSquared(g),h))<1e-4&&(d=1),c<1e-4&&(c=d),(h=Math.pow(g.distanceToSquared(b),h))<1e-4&&(h=d),ue.initNonuniformCatmullRom(e.x,f.x,g.x,b.x,c,d,h),ve.initNonuniformCatmullRom(e.y,f.y,g.y,b.y,c,d,h),we.initNonuniformCatmullRom(e.z,f.z,g.z,b.z,c,d,h)}else"catmullrom"===this.type&&(c=void 0!==this.tension?this.tension:.5,ue.initCatmullRom(e.x,f.x,g.x,b.x,c),ve.initCatmullRom(e.y,f.y,g.y,b.y,c),we.initCatmullRom(e.z,f.z,g.z,b.z,c));return new n(ue.calc(a),ve.calc(a),we.calc(a))},((bd.prototype=Object.create(ua.prototype)).constructor=bd).prototype.getPoint=function(a){var b=this.v0,c=this.v1,d=this.v2,e=this.v3;return new n(xb(a,b.x,c.x,d.x,e.x),xb(a,b.y,c.y,d.y,e.y),xb(a,b.z,c.z,d.z,e.z))},((cd.prototype=Object.create(ua.prototype)).constructor=cd).prototype.getPoint=function(a){var b=this.v0,c=this.v1,d=this.v2;return new n(wb(a,b.x,c.x,d.x),wb(a,b.y,c.y,d.y),wb(a,b.z,c.z,d.z))},((dd.prototype=Object.create(ua.prototype)).constructor=dd).prototype.getPoint=function(a){if(1===a)return this.v2.clone();var b=new n;return b.subVectors(this.v2,this.v1),b.multiplyScalar(a),b.add(this.v1),b},(Md.prototype=Object.create(Va.prototype)).constructor=Md,ua.create=function(a,b){return console.log("THREE.Curve.create() has been deprecated"),a.prototype=Object.create(ua.prototype),(a.prototype.constructor=a).prototype.getPoint=b,a},cf.prototype=Object.create(La.prototype),df.prototype=Object.create(La.prototype),se.prototype=Object.create(La.prototype),Object.assign(se.prototype,{initFromArray:function(a){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(a){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(a){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Zc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},kc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(fd.prototype,{center:function(a){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(a)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(a){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)},size:function(a){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(a)}}),Object.assign(Ra.prototype,{center:function(a){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(a)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(a){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)},isIntersectionSphere:function(a){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(a)},size:function(a){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(a)}}),Hb.prototype.center=function(a){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(a)},Y.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(Ba.prototype,{flattenToArrayOffset:function(a,b){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(a,b)},multiplyVector3:function(a){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),a.applyMatrix3(this)},multiplyVector3Array:function(a){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(a,b,c){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(a)},applyToVector3Array:function(a,b,c){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(K.prototype,{extractPosition:function(a){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(a)},flattenToArrayOffset:function(a,b){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(a,b)},getPosition:function(){var a;return function(){return void 0===a&&(a=new n),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),a.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(a){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(a)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(a){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)},multiplyVector4:function(a){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)},multiplyVector3Array:function(a){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),a.transformDirection(this)},crossVector:function(a){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(a,b,c){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(a)},applyToVector3Array:function(a,b,c){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(a,b,c,d,e,f){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(a,b,d,c,e,f)}}),Aa.prototype.isIntersectionLine=function(a){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(a)},oa.prototype.multiplyVector3=function(a){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),a.applyQuaternion(this)},Object.assign(kb.prototype,{isIntersectionBox:function(a){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)},isIntersectionPlane:function(a){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(a)},isIntersectionSphere:function(a){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(a)}}),Object.assign(zb.prototype,{extrude:function(a){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new cb(this,a)},makeGeometry:function(a){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Xb(this,a)}}),Object.assign(C.prototype,{fromAttribute:function(a,b,c){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(a,b,c)}}),Object.assign(n.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(b,a)},applyProjection:function(a){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(a)},fromAttribute:function(a,b,c){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(a,b,c)}}),Object.assign(fa.prototype,{fromAttribute:function(a,b,c){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(a,b,c)}}),J.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(z.prototype,{getChildByName:function(a){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(a)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(a,b){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(b,a)}}),Object.defineProperties(z.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(a){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=a}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(yc.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(zc.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(ua.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(a){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=a}}),qa.prototype.setLens=function(a,b){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==b&&(this.filmGauge=b),this.setFocalLength(a)},Object.defineProperties(na.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(a){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=a}},shadowCameraLeft:{set:function(a){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=a}},shadowCameraRight:{set:function(a){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=a}},shadowCameraTop:{set:function(a){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=a}},shadowCameraBottom:{set:function(a){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=a}},shadowCameraNear:{set:function(a){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=a}},shadowCameraFar:{set:function(a){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=a}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(a){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=a}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(a){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=a}},shadowMapHeight:{set:function(a){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=a}}}),Object.defineProperties(Z.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(E.prototype,{addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(a)},addDrawCall:function(a,b,c){void 0!==c&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(a,b)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(E.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Id.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(U.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new G}}}),Object.defineProperties(Ja.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(ra.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(a){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=a}}}),Object.assign(Xd.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(a){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(a)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(Xd.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=a}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=a}}}),Object.defineProperties(Ie.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a,console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+a+"."),this.renderReverseSided=a}}}),Object.defineProperties(Cb.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=a}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=a}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=a}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=a}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(a){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=a}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(a){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=a}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(a){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=a}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(a){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=a}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(a){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=a}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(a){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=a}}}),hc.prototype.load=function(a){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var b=this;return(new fe).load(a,function(a){b.setBuffer(a)}),this},je.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},l.WebGLRenderTargetCube=Db,l.WebGLRenderTarget=Cb,l.WebGLRenderer=Xd,l.ShaderLib=$a,l.UniformsLib=R,l.UniformsUtils=Ca,l.ShaderChunk=X,l.FogExp2=Ib,l.Fog=Jb,l.Scene=ld,l.LensFlare=Yd,l.Sprite=xc,l.LOD=yc,l.SkinnedMesh=nd,l.Skeleton=zc,l.Bone=md,l.Mesh=la,l.LineSegments=Q,l.LineLoop=od,l.Line=sa,l.Points=Kb,l.Group=Ac,l.VideoTexture=pd,l.DataTexture=db,l.CompressedTexture=Lb,l.CubeTexture=Xa,l.CanvasTexture=qd,l.DepthTexture=Bc,l.Texture=ba,l.CompressedTextureLoader=Oe,l.DataTextureLoader=$d,l.CubeTextureLoader=ae,l.TextureLoader=rd,l.ObjectLoader=Pe,l.MaterialLoader=Gd,l.BufferGeometryLoader=be,l.DefaultLoadingManager=va,l.LoadingManager=Zd,l.JSONLoader=ce,l.ImageLoader=Sc,l.FontLoader=Re,l.FileLoader=Ka,l.Loader=ec,l.Cache=ed,l.AudioLoader=fe,l.SpotLightShadow=td,l.SpotLight=ud,l.PointLight=vd,l.RectAreaLight=zd,l.HemisphereLight=sd,l.DirectionalLightShadow=wd,l.DirectionalLight=xd,l.AmbientLight=yd,l.LightShadow=tb,l.Light=na,l.StereoCamera=Se,l.PerspectiveCamera=qa,l.OrthographicCamera=Fb,l.CubeCamera=Hd,l.ArrayCamera=kd,l.Camera=Na,l.AudioListener=ge,l.PositionalAudio=ie,l.AudioContext=he,l.AudioAnalyser=je,l.Audio=hc,l.VectorKeyframeTrack=cc,l.StringKeyframeTrack=Dd,l.QuaternionKeyframeTrack=Uc,l.NumberKeyframeTrack=dc,l.ColorKeyframeTrack=Fd,l.BooleanKeyframeTrack=Ed,l.PropertyMixer=ke,l.PropertyBinding=ha,l.KeyframeTrack=vb,l.AnimationUtils=ia,l.AnimationObjectGroup=Ue,l.AnimationMixer=We,l.AnimationClip=Da,l.Uniform=Id,l.InstancedBufferGeometry=le,l.BufferGeometry=E,l.GeometryIdCount=function(){return Rd++},l.Geometry=J,l.InterleavedBufferAttribute=me,l.InstancedInterleavedBuffer=ne,l.InterleavedBuffer=ic,l.InstancedBufferAttribute=oe,l.Face3=Sa,l.Object3D=z,l.Raycaster=Xe,l.Layers=Qd,l.EventDispatcher=xa,l.Clock=Ze,l.QuaternionLinearInterpolant=Cd,l.LinearInterpolant=Tc,l.DiscreteInterpolant=Bd,l.CubicInterpolant=Ad,l.Interpolant=wa,l.Triangle=Ta,l.Math=Y,l.Spherical=$e,l.Cylindrical=af,l.Plane=Aa,l.Frustum=gd,l.Sphere=Ea,l.Ray=kb,l.Matrix4=K,l.Matrix3=Ba,l.Box3=Ra,l.Box2=fd,l.Line3=Hb,l.Euler=ab,l.Vector4=fa,l.Vector3=n,l.Vector2=C,l.Quaternion=oa,l.Color=G,l.MorphBlendMesh=ta,l.ImmediateRenderObject=Xc,l.VertexNormalsHelper=Yc,l.SpotLightHelper=jc,l.SkeletonHelper=kc,l.PointLightHelper=lc,l.RectAreaLightHelper=mc,l.HemisphereLightHelper=nc,l.GridHelper=Zc,l.PolarGridHelper=Jd,l.FaceNormalsHelper=$c,l.DirectionalLightHelper=oc,l.CameraHelper=ad,l.BoxHelper=Ab,l.ArrowHelper=Bb,l.AxisHelper=Ld,l.CatmullRomCurve3=La,l.CubicBezierCurve3=bd,l.QuadraticBezierCurve3=cd,l.LineCurve3=dd,l.ArcCurve=Md,l.EllipseCurve=Va,l.SplineCurve=yb,l.CubicBezierCurve=fc,l.QuadraticBezierCurve=gc,l.LineCurve=Qa,l.Shape=zb,l.Path=Wc,l.ShapePath=de,l.Font=ee,l.CurvePath=Vc,l.Curve=ua,l.ShapeUtils=Ia,l.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new Ac,d=0,e=b.length;d<e;d++)c.add(new la(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld),b.remove(a),c.add(a)},attach:function(a,b,c){a.applyMatrix((new K).getInverse(c.matrixWorld)),b.remove(a),c.add(a)}},l.WireframeGeometry=Mb,l.ParametricGeometry=Cc,l.ParametricBufferGeometry=Nb,l.TetrahedronGeometry=Ec,l.TetrahedronBufferGeometry=Ob,l.OctahedronGeometry=Fc,l.OctahedronBufferGeometry=lb,l.IcosahedronGeometry=Gc,l.IcosahedronBufferGeometry=Pb,l.DodecahedronGeometry=Hc,l.DodecahedronBufferGeometry=Qb,l.PolyhedronGeometry=Dc,l.PolyhedronBufferGeometry=za,l.TubeGeometry=Ic,l.TubeBufferGeometry=Rb,l.TorusKnotGeometry=Jc,l.TorusKnotBufferGeometry=Sb,l.TorusGeometry=Kc,l.TorusBufferGeometry=Tb,l.TextGeometry=Lc,l.TextBufferGeometry=Ub,l.SphereGeometry=Mc,l.SphereBufferGeometry=mb,l.RingGeometry=Nc,l.RingBufferGeometry=Vb,l.PlaneGeometry=vc,l.PlaneBufferGeometry=jb,l.LatheGeometry=Oc,l.LatheBufferGeometry=Wb,l.ShapeGeometry=Xb,l.ShapeBufferGeometry=Yb,l.ExtrudeGeometry=cb,l.ExtrudeBufferGeometry=Ga,l.EdgesGeometry=Zb,l.ConeGeometry=Pc,l.ConeBufferGeometry=Qc,l.CylinderGeometry=nb,l.CylinderBufferGeometry=Ua,l.CircleGeometry=Rc,l.CircleBufferGeometry=$b,l.BoxGeometry=Gb,l.BoxBufferGeometry=ib,l.ShadowMaterial=ac,l.SpriteMaterial=bb,l.RawShaderMaterial=bc,l.ShaderMaterial=ra,l.PointsMaterial=Fa,l.MeshPhysicalMaterial=ob,l.MeshStandardMaterial=Pa,l.MeshPhongMaterial=Ja,l.MeshToonMaterial=pb,l.MeshNormalMaterial=qb,l.MeshLambertMaterial=rb,l.MeshDepthMaterial=Za,l.MeshBasicMaterial=ya,l.LineDashedMaterial=sb,l.LineBasicMaterial=ea,l.Material=U,l.Float64BufferAttribute=uc,l.Float32BufferAttribute=B,l.Uint32BufferAttribute=hb,l.Int32BufferAttribute=tc,l.Uint16BufferAttribute=gb,l.Int16BufferAttribute=sc,l.Uint8ClampedBufferAttribute=rc,l.Uint8BufferAttribute=qc,l.Int8BufferAttribute=pc,l.BufferAttribute=Z,l.REVISION="86",l.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},l.CullFaceNone=0,l.CullFaceBack=1,l.CullFaceFront=2,l.CullFaceFrontBack=3,l.FrontFaceDirectionCW=0,l.FrontFaceDirectionCCW=1,l.BasicShadowMap=0,l.PCFShadowMap=1,l.PCFSoftShadowMap=2,l.FrontSide=0,l.BackSide=1,l.DoubleSide=2,l.FlatShading=1,l.SmoothShading=2,l.NoColors=0,l.FaceColors=1,l.VertexColors=2,l.NoBlending=0,l.NormalBlending=1,l.AdditiveBlending=2,l.SubtractiveBlending=3,l.MultiplyBlending=4,l.CustomBlending=5,l.AddEquation=100,l.SubtractEquation=101,l.ReverseSubtractEquation=102,l.MinEquation=103,l.MaxEquation=104,l.ZeroFactor=200,l.OneFactor=201,l.SrcColorFactor=202,l.OneMinusSrcColorFactor=203,l.SrcAlphaFactor=204,l.OneMinusSrcAlphaFactor=205,l.DstAlphaFactor=206,l.OneMinusDstAlphaFactor=207,l.DstColorFactor=208,l.OneMinusDstColorFactor=209,l.SrcAlphaSaturateFactor=210,l.NeverDepth=0,l.AlwaysDepth=1,l.LessDepth=2,l.LessEqualDepth=3,l.EqualDepth=4,l.GreaterEqualDepth=5,l.GreaterDepth=6,l.NotEqualDepth=7,l.MultiplyOperation=0,l.MixOperation=1,l.AddOperation=2,l.NoToneMapping=0,l.LinearToneMapping=1,l.ReinhardToneMapping=2,l.Uncharted2ToneMapping=3,l.CineonToneMapping=4,l.UVMapping=300,l.CubeReflectionMapping=301,l.CubeRefractionMapping=302,l.EquirectangularReflectionMapping=303,l.EquirectangularRefractionMapping=304,l.SphericalReflectionMapping=305,l.CubeUVReflectionMapping=306,l.CubeUVRefractionMapping=307,l.RepeatWrapping=1e3,l.ClampToEdgeWrapping=1001,l.MirroredRepeatWrapping=1002,l.NearestFilter=1003,l.NearestMipMapNearestFilter=1004,l.NearestMipMapLinearFilter=1005,l.LinearFilter=1006,l.LinearMipMapNearestFilter=1007,l.LinearMipMapLinearFilter=1008,l.UnsignedByteType=1009,l.ByteType=1010,l.ShortType=1011,l.UnsignedShortType=1012,l.IntType=1013,l.UnsignedIntType=1014,l.FloatType=1015,l.HalfFloatType=1016,l.UnsignedShort4444Type=1017,l.UnsignedShort5551Type=1018,l.UnsignedShort565Type=1019,l.UnsignedInt248Type=1020,l.AlphaFormat=1021,l.RGBFormat=1022,l.RGBAFormat=1023,l.LuminanceFormat=1024,l.LuminanceAlphaFormat=1025,l.RGBEFormat=1023,l.DepthFormat=1026,l.DepthStencilFormat=1027,l.RGB_S3TC_DXT1_Format=2001,l.RGBA_S3TC_DXT1_Format=2002,l.RGBA_S3TC_DXT3_Format=2003,l.RGBA_S3TC_DXT5_Format=2004,l.RGB_PVRTC_4BPPV1_Format=2100,l.RGB_PVRTC_2BPPV1_Format=2101,l.RGBA_PVRTC_4BPPV1_Format=2102,l.RGBA_PVRTC_2BPPV1_Format=2103,l.RGB_ETC1_Format=2151,l.LoopOnce=2200,l.LoopRepeat=2201,l.LoopPingPong=2202,l.InterpolateDiscrete=2300,l.InterpolateLinear=2301,l.InterpolateSmooth=2302,l.ZeroCurvatureEnding=2400,l.ZeroSlopeEnding=2401,l.WrapAroundEnding=2402,l.TrianglesDrawMode=0,l.TriangleStripDrawMode=1,l.TriangleFanDrawMode=2,l.LinearEncoding=3e3,l.sRGBEncoding=3001,l.GammaEncoding=3007,l.RGBEEncoding=3002,l.LogLuvEncoding=3003,l.RGBM7Encoding=3004,l.RGBM16Encoding=3005,l.RGBDEncoding=3006,l.BasicDepthPacking=3200,l.RGBADepthPacking=3201,l.CubeGeometry=Gb,l.Face4=function(a,b,c,d,e,f,g){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Sa(a,b,c,e,f,g)},l.LineStrip=0,l.LinePieces=1,l.MeshFaceMaterial=function(a){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),a},l.MultiMaterial=function(a){return void 0===a&&(a=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),a.isMultiMaterial=!0,(a.materials=a).clone=function(){return a.slice()},a},l.PointCloud=function(a,b){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Kb(a,b)},l.Particle=function(a){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new xc(a)},l.ParticleSystem=function(a,b){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Kb(a,b)},l.PointCloudMaterial=function(a){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Fa(a)},l.ParticleBasicMaterial=function(a){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Fa(a)},l.ParticleSystemMaterial=function(a){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Fa(a)},l.Vertex=function(a,b,c){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new n(a,b,c)},l.DynamicBufferAttribute=function(a,b){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new Z(a,b).setDynamic(!0)},l.Int8Attribute=function(a,b){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new pc(a,b)},l.Uint8Attribute=function(a,b){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new qc(a,b)},l.Uint8ClampedAttribute=function(a,b){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new rc(a,b)},l.Int16Attribute=function(a,b){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new sc(a,b)},l.Uint16Attribute=function(a,b){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new gb(a,b)},l.Int32Attribute=function(a,b){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new tc(a,b)},l.Uint32Attribute=function(a,b){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new hb(a,b)},l.Float32Attribute=function(a,b){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new B(a,b)},l.Float64Attribute=function(a,b){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new uc(a,b)},l.ClosedSplineCurve3=cf,l.SplineCurve3=df,l.Spline=se,l.BoundingBoxHelper=function(a,b){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Ab(a,b)},l.EdgesHelper=function(a,b){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Q(new Zb(a.geometry),new ea({color:void 0!==b?b:16777215}))},l.WireframeHelper=function(a,b){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Q(new Mb(a.geometry),new ea({color:void 0!==b?b:16777215}))},l.XHRLoader=function(a){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Ka(a)},l.BinaryTextureLoader=function(a){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new $d(a)},l.GeometryUtils={merge:function(a,b,c){var d;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),b.isMesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry),a.merge(b,d,c)},center:function(a){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),a.center()}},l.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var e=new rd;return e.setCrossOrigin(this.crossOrigin),a=e.load(a,c,void 0,d),b&&(a.mapping=b),a},loadTextureCube:function(a,b,c,d){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var e=new ae;return e.setCrossOrigin(this.crossOrigin),a=e.load(a,c,void 0,d),b&&(a.mapping=b),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},l.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(a,b){console.warn("THREE.Projector: .projectVector() is now vector.project()."),a.project(b)},this.unprojectVector=function(a,b){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),a.unproject(b)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},l.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},Object.defineProperty(l,"__esModule",{value:!0})}("object"==typeof exports&&void 0!==module?exports:l.THREE=l.THREE||{})},{}],289:[function(require,module,exports){"use strict";function TinyQueue(data,compare){if(!(this instanceof TinyQueue))return new TinyQueue(data,compare);if(this.data=data||[],this.length=this.data.length,this.compare=compare||defaultCompare,0<this.length)for(var i=(this.length>>1)-1;0<=i;i--)this._down(i)}function defaultCompare(a,b){return a<b?-1:b<a?1:0}module.exports=TinyQueue,(module.exports.default=TinyQueue).prototype={push:function(item){this.data.push(item),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var top=this.data[0];return this.length--,0<this.length&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),top}},peek:function(){return this.data[0]},_up:function(pos){for(var data=this.data,compare=this.compare,item=data[pos];0<pos;){var parent=pos-1>>1,current=data[parent];if(0<=compare(item,current))break;data[pos]=current,pos=parent}data[pos]=item},_down:function(pos){for(var data=this.data,compare=this.compare,halfLength=this.length>>1,item=data[pos];pos<halfLength;){var left=1+(pos<<1),right=left+1,best=data[left];if(right<this.length&&compare(data[right],best)<0&&(best=data[left=right]),0<=compare(best,item))break;data[pos]=best,pos=left}data[pos]=item}}},{}],290:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib=require("tslib"),_a=Object.setPrototypeOf,setPrototypeOf=void 0===_a?function(obj,proto){return obj.__proto__=proto,obj}:_a,InvariantError=function(_super){function InvariantError(message){void 0===message&&(message="Invariant Violation");var _this=_super.call(this,message)||this;return _this.framesToPop=1,_this.name="Invariant Violation",setPrototypeOf(_this,InvariantError.prototype),_this}return tslib.__extends(InvariantError,_super),InvariantError}(Error);function invariant(condition,message){if(!condition)throw new InvariantError(message)}!function(invariant){invariant.warn=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return console.warn.apply(console,args)},invariant.error=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return console.error.apply(console,args)}}(invariant||(invariant={}));var invariant$1=invariant;exports.default=invariant$1,exports.InvariantError=InvariantError,exports.invariant=invariant},{tslib:291}],291:[function(require,module,exports){(function(global){var __extends,__assign,__rest,__decorate,__param,__metadata,__awaiter,__generator,__exportStar,__values,__read,__spread,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault;!function(factory){var root="object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:{};function createExporter(exports,previous){return exports!==root&&("function"==typeof Object.create?Object.defineProperty(exports,"__esModule",{value:!0}):exports.__esModule=!0),function(id,v){return exports[id]=previous?previous(id,v):v}}"object"==typeof module&&"object"==typeof module.exports?factory(createExporter(root,createExporter(module.exports))):factory(createExporter(root))}(function(exporter){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])};__extends=function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&(t[p[i]]=s[p[i]])}return t},__decorate=function(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;0<=i;i--)(d=decorators[i])&&(r=(c<3?d(r):3<c?d(target,key,r):d(target,key))||r);return 3<c&&r&&Object.defineProperty(target,key,r),r},__param=function(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}},__metadata=function(metadataKey,metadataValue){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(metadataKey,metadataValue)},__awaiter=function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=0<(t=_.trys).length&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}},__exportStar=function(m,exports){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])},__values=function(o){var m="function"==typeof Symbol&&o[Symbol.iterator],i=0;return m?m.call(o):{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}}},__read=function(o,n){var m="function"==typeof Symbol&&o[Symbol.iterator];if(!m)return o;var r,e,i=m.call(o),ar=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error:error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar},__spread=function(){for(var ar=[],i=0;i<arguments.length;i++)ar=ar.concat(__read(arguments[i]));return ar},__await=function(v){return this instanceof __await?(this.v=v,this):new __await(v)},__asyncGenerator=function(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,g=generator.apply(thisArg,_arguments||[]),q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){g[n]&&(i[n]=function(v){return new Promise(function(a,b){1<q.push([n,v,a,b])||resume(n,v)})})}function resume(n,v){try{!function(r){r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}(g[n](v))}catch(e){settle(q[0][3],e)}}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}},__asyncDelegator=function(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await(o[n](v)),done:"return"===n}:f?f(v):v}:f}},__asyncValues=function(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,m=o[Symbol.asyncIterator];return m?m.call(o):(o=__values(o),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){(function(resolve,reject,d,v){Promise.resolve(v).then(function(v){resolve({value:v,done:d})},reject)})(resolve,reject,(v=o[n](v)).done,v.value)})}}},__makeTemplateObject=function(cooked,raw){return Object.defineProperty?Object.defineProperty(cooked,"raw",{value:raw}):cooked.raw=raw,cooked},__importStar=function(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)Object.hasOwnProperty.call(mod,k)&&(result[k]=mod[k]);return result.default=mod,result},__importDefault=function(mod){return mod&&mod.__esModule?mod:{default:mod}},exporter("__extends",__extends),exporter("__assign",__assign),exporter("__rest",__rest),exporter("__decorate",__decorate),exporter("__param",__param),exporter("__metadata",__metadata),exporter("__awaiter",__awaiter),exporter("__generator",__generator),exporter("__exportStar",__exportStar),exporter("__values",__values),exporter("__read",__read),exporter("__spread",__spread),exporter("__await",__await),exporter("__asyncGenerator",__asyncGenerator),exporter("__asyncDelegator",__asyncDelegator),exporter("__asyncValues",__asyncValues),exporter("__makeTemplateObject",__makeTemplateObject),exporter("__importStar",__importStar),exporter("__importDefault",__importDefault)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],292:[function(require,module,exports){(function(global){!function(){var root="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this||{},previousUnderscore=root._,ArrayProto=Array.prototype,ObjProto=Object.prototype,SymbolProto="undefined"!=typeof Symbol?Symbol.prototype:null,push=ArrayProto.push,slice=ArrayProto.slice,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty,nativeIsArray=Array.isArray,nativeKeys=Object.keys,nativeCreate=Object.create,Ctor=function(){},_=function(obj){return obj instanceof _?obj:this instanceof _?void(this._wrapped=obj):new _(obj)};void 0===exports||exports.nodeType?root._=_:(void 0!==module&&!module.nodeType&&module.exports&&(exports=module.exports=_),exports._=_),_.VERSION="1.9.1";var builtinIteratee,optimizeCb=function(func,context,argCount){if(void 0===context)return func;switch(null==argCount?3:argCount){case 1:return function(value){return func.call(context,value)};case 3:return function(value,index,collection){return func.call(context,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(context,accumulator,value,index,collection)}}return function(){return func.apply(context,arguments)}},cb=function(value,context,argCount){return _.iteratee!==builtinIteratee?_.iteratee(value,context):null==value?_.identity:_.isFunction(value)?optimizeCb(value,context,argCount):_.isObject(value)&&!_.isArray(value)?_.matcher(value):_.property(value)};_.iteratee=builtinIteratee=function(value,context){return cb(value,context,1/0)};var restArguments=function(func,startIndex){return startIndex=null==startIndex?func.length-1:+startIndex,function(){for(var length=Math.max(arguments.length-startIndex,0),rest=Array(length),index=0;index<length;index++)rest[index]=arguments[index+startIndex];switch(startIndex){case 0:return func.call(this,rest);case 1:return func.call(this,arguments[0],rest);case 2:return func.call(this,arguments[0],arguments[1],rest)}var args=Array(startIndex+1);for(index=0;index<startIndex;index++)args[index]=arguments[index];return args[startIndex]=rest,func.apply(this,args)}},baseCreate=function(prototype){if(!_.isObject(prototype))return{};if(nativeCreate)return nativeCreate(prototype);Ctor.prototype=prototype;var result=new Ctor;return Ctor.prototype=null,result},shallowProperty=function(key){return function(obj){return null==obj?void 0:obj[key]}},has=function(obj,path){return null!=obj&&hasOwnProperty.call(obj,path)},deepGet=function(obj,path){for(var length=path.length,i=0;i<length;i++){if(null==obj)return;obj=obj[path[i]]}return length?obj:void 0},MAX_ARRAY_INDEX=Math.pow(2,53)-1,getLength=shallowProperty("length"),isArrayLike=function(collection){var length=getLength(collection);return"number"==typeof length&&0<=length&&length<=MAX_ARRAY_INDEX};_.each=_.forEach=function(obj,iteratee,context){var i,length;if(iteratee=optimizeCb(iteratee,context),isArrayLike(obj))for(i=0,length=obj.length;i<length;i++)iteratee(obj[i],i,obj);else{var keys=_.keys(obj);for(i=0,length=keys.length;i<length;i++)iteratee(obj[keys[i]],keys[i],obj)}return obj},_.map=_.collect=function(obj,iteratee,context){iteratee=cb(iteratee,context);for(var keys=!isArrayLike(obj)&&_.keys(obj),length=(keys||obj).length,results=Array(length),index=0;index<length;index++){var currentKey=keys?keys[index]:index;results[index]=iteratee(obj[currentKey],currentKey,obj)}return results};var createReduce=function(dir){return function(obj,iteratee,memo,context){var initial=3<=arguments.length;return function(obj,iteratee,memo,initial){var keys=!isArrayLike(obj)&&_.keys(obj),length=(keys||obj).length,index=0<dir?0:length-1;for(initial||(memo=obj[keys?keys[index]:index],index+=dir);0<=index&&index<length;index+=dir){var currentKey=keys?keys[index]:index;memo=iteratee(memo,obj[currentKey],currentKey,obj)}return memo}(obj,optimizeCb(iteratee,context,4),memo,initial)}};_.reduce=_.foldl=_.inject=createReduce(1),_.reduceRight=_.foldr=createReduce(-1),_.find=_.detect=function(obj,predicate,context){var key=(isArrayLike(obj)?_.findIndex:_.findKey)(obj,predicate,context);if(void 0!==key&&-1!==key)return obj[key]},_.filter=_.select=function(obj,predicate,context){var results=[];return predicate=cb(predicate,context),_.each(obj,function(value,index,list){predicate(value,index,list)&&results.push(value)}),results},_.reject=function(obj,predicate,context){return _.filter(obj,_.negate(cb(predicate)),context)},_.every=_.all=function(obj,predicate,context){predicate=cb(predicate,context);for(var keys=!isArrayLike(obj)&&_.keys(obj),length=(keys||obj).length,index=0;index<length;index++){var currentKey=keys?keys[index]:index;if(!predicate(obj[currentKey],currentKey,obj))return!1}return!0},_.some=_.any=function(obj,predicate,context){predicate=cb(predicate,context);for(var keys=!isArrayLike(obj)&&_.keys(obj),length=(keys||obj).length,index=0;index<length;index++){var currentKey=keys?keys[index]:index;if(predicate(obj[currentKey],currentKey,obj))return!0}return!1},_.contains=_.includes=_.include=function(obj,item,fromIndex,guard){return isArrayLike(obj)||(obj=_.values(obj)),("number"!=typeof fromIndex||guard)&&(fromIndex=0),0<=_.indexOf(obj,item,fromIndex)},_.invoke=restArguments(function(obj,path,args){var contextPath,func;return _.isFunction(path)?func=path:_.isArray(path)&&(contextPath=path.slice(0,-1),path=path[path.length-1]),_.map(obj,function(context){var method=func;if(!method){if(contextPath&&contextPath.length&&(context=deepGet(context,contextPath)),null==context)return;method=context[path]}return null==method?method:method.apply(context,args)})}),_.pluck=function(obj,key){return _.map(obj,_.property(key))},_.where=function(obj,attrs){return _.filter(obj,_.matcher(attrs))},_.findWhere=function(obj,attrs){return _.find(obj,_.matcher(attrs))},_.max=function(obj,iteratee,context){var value,computed,result=-1/0,lastComputed=-1/0;if(null==iteratee||"number"==typeof iteratee&&"object"!=typeof obj[0]&&null!=obj)for(var i=0,length=(obj=isArrayLike(obj)?obj:_.values(obj)).length;i<length;i++)null!=(value=obj[i])&&result<value&&(result=value);else iteratee=cb(iteratee,context),_.each(obj,function(v,index,list){computed=iteratee(v,index,list),(lastComputed<computed||computed===-1/0&&result===-1/0)&&(result=v,lastComputed=computed)});return result},_.min=function(obj,iteratee,context){var value,computed,result=1/0,lastComputed=1/0;if(null==iteratee||"number"==typeof iteratee&&"object"!=typeof obj[0]&&null!=obj)for(var i=0,length=(obj=isArrayLike(obj)?obj:_.values(obj)).length;i<length;i++)null!=(value=obj[i])&&value<result&&(result=value);else iteratee=cb(iteratee,context),_.each(obj,function(v,index,list){((computed=iteratee(v,index,list))<lastComputed||computed===1/0&&result===1/0)&&(result=v,lastComputed=computed)});return result},_.shuffle=function(obj){return _.sample(obj,1/0)},_.sample=function(obj,n,guard){if(null==n||guard)return isArrayLike(obj)||(obj=_.values(obj)),obj[_.random(obj.length-1)];var sample=isArrayLike(obj)?_.clone(obj):_.values(obj),length=getLength(sample);n=Math.max(Math.min(n,length),0);for(var last=length-1,index=0;index<n;index++){var rand=_.random(index,last),temp=sample[index];sample[index]=sample[rand],sample[rand]=temp}return sample.slice(0,n)},_.sortBy=function(obj,iteratee,context){var index=0;return iteratee=cb(iteratee,context),_.pluck(_.map(obj,function(value,key,list){return{value:value,index:index++,criteria:iteratee(value,key,list)}}).sort(function(left,right){var a=left.criteria,b=right.criteria;if(a!==b){if(b<a||void 0===a)return 1;if(a<b||void 0===b)return-1}return left.index-right.index}),"value")};var group=function(behavior,partition){return function(obj,iteratee,context){var result=partition?[[],[]]:{};return iteratee=cb(iteratee,context),_.each(obj,function(value,index){var key=iteratee(value,index,obj);behavior(result,value,key)}),result}};_.groupBy=group(function(result,value,key){has(result,key)?result[key].push(value):result[key]=[value]}),_.indexBy=group(function(result,value,key){result[key]=value}),_.countBy=group(function(result,value,key){has(result,key)?result[key]++:result[key]=1});var reStrSymbol=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;_.toArray=function(obj){return obj?_.isArray(obj)?slice.call(obj):_.isString(obj)?obj.match(reStrSymbol):isArrayLike(obj)?_.map(obj,_.identity):_.values(obj):[]},_.size=function(obj){return null==obj?0:isArrayLike(obj)?obj.length:_.keys(obj).length},_.partition=group(function(result,value,pass){result[pass?0:1].push(value)},!0),_.first=_.head=_.take=function(array,n,guard){return null==array||array.length<1?null==n?void 0:[]:null==n||guard?array[0]:_.initial(array,array.length-n)},_.initial=function(array,n,guard){return slice.call(array,0,Math.max(0,array.length-(null==n||guard?1:n)))},_.last=function(array,n,guard){return null==array||array.length<1?null==n?void 0:[]:null==n||guard?array[array.length-1]:_.rest(array,Math.max(0,array.length-n))},_.rest=_.tail=_.drop=function(array,n,guard){return slice.call(array,null==n||guard?1:n)},_.compact=function(array){return _.filter(array,Boolean)};var flatten=function(input,shallow,strict,output){for(var idx=(output=output||[]).length,i=0,length=getLength(input);i<length;i++){var value=input[i];if(isArrayLike(value)&&(_.isArray(value)||_.isArguments(value)))if(shallow)for(var j=0,len=value.length;j<len;)output[idx++]=value[j++];else flatten(value,shallow,strict,output),idx=output.length;else strict||(output[idx++]=value)}return output};_.flatten=function(array,shallow){return flatten(array,shallow,!1)},_.without=restArguments(function(array,otherArrays){return _.difference(array,otherArrays)}),_.uniq=_.unique=function(array,isSorted,iteratee,context){_.isBoolean(isSorted)||(context=iteratee,iteratee=isSorted,isSorted=!1),null!=iteratee&&(iteratee=cb(iteratee,context));for(var result=[],seen=[],i=0,length=getLength(array);i<length;i++){var value=array[i],computed=iteratee?iteratee(value,i,array):value;isSorted&&!iteratee?(i&&seen===computed||result.push(value),seen=computed):iteratee?_.contains(seen,computed)||(seen.push(computed),result.push(value)):_.contains(result,value)||result.push(value)}return result},_.union=restArguments(function(arrays){return _.uniq(flatten(arrays,!0,!0))}),_.intersection=function(array){for(var result=[],argsLength=arguments.length,i=0,length=getLength(array);i<length;i++){var item=array[i];if(!_.contains(result,item)){var j;for(j=1;j<argsLength&&_.contains(arguments[j],item);j++);j===argsLength&&result.push(item)}}return result},_.difference=restArguments(function(array,rest){return rest=flatten(rest,!0,!0),_.filter(array,function(value){return!_.contains(rest,value)})}),_.unzip=function(array){for(var length=array&&_.max(array,getLength).length||0,result=Array(length),index=0;index<length;index++)result[index]=_.pluck(array,index);return result},_.zip=restArguments(_.unzip),_.object=function(list,values){for(var result={},i=0,length=getLength(list);i<length;i++)values?result[list[i]]=values[i]:result[list[i][0]]=list[i][1];return result};var createPredicateIndexFinder=function(dir){return function(array,predicate,context){predicate=cb(predicate,context);for(var length=getLength(array),index=0<dir?0:length-1;0<=index&&index<length;index+=dir)if(predicate(array[index],index,array))return index;return-1}};_.findIndex=createPredicateIndexFinder(1),_.findLastIndex=createPredicateIndexFinder(-1),_.sortedIndex=function(array,obj,iteratee,context){for(var value=(iteratee=cb(iteratee,context,1))(obj),low=0,high=getLength(array);low<high;){var mid=Math.floor((low+high)/2);iteratee(array[mid])<value?low=mid+1:high=mid}return low};var createIndexFinder=function(dir,predicateFind,sortedIndex){return function(array,item,idx){var i=0,length=getLength(array);if("number"==typeof idx)0<dir?i=0<=idx?idx:Math.max(idx+length,i):length=0<=idx?Math.min(idx+1,length):idx+length+1;else if(sortedIndex&&idx&&length)return array[idx=sortedIndex(array,item)]===item?idx:-1;if(item!=item)return 0<=(idx=predicateFind(slice.call(array,i,length),_.isNaN))?idx+i:-1;for(idx=0<dir?i:length-1;0<=idx&&idx<length;idx+=dir)if(array[idx]===item)return idx;return-1}};_.indexOf=createIndexFinder(1,_.findIndex,_.sortedIndex),_.lastIndexOf=createIndexFinder(-1,_.findLastIndex),_.range=function(start,stop,step){null==stop&&(stop=start||0,start=0),step||(step=stop<start?-1:1);for(var length=Math.max(Math.ceil((stop-start)/step),0),range=Array(length),idx=0;idx<length;idx++,start+=step)range[idx]=start;return range},_.chunk=function(array,count){if(null==count||count<1)return[];for(var result=[],i=0,length=array.length;i<length;)result.push(slice.call(array,i,i+=count));return result};var executeBound=function(sourceFunc,boundFunc,context,callingContext,args){if(!(callingContext instanceof boundFunc))return sourceFunc.apply(context,args);var self=baseCreate(sourceFunc.prototype),result=sourceFunc.apply(self,args);return _.isObject(result)?result:self};_.bind=restArguments(function(func,context,args){if(!_.isFunction(func))throw new TypeError("Bind must be called on a function");var bound=restArguments(function(callArgs){return executeBound(func,bound,context,this,args.concat(callArgs))});return bound}),_.partial=restArguments(function(func,boundArgs){var placeholder=_.partial.placeholder,bound=function(){for(var position=0,length=boundArgs.length,args=Array(length),i=0;i<length;i++)args[i]=boundArgs[i]===placeholder?arguments[position++]:boundArgs[i];for(;position<arguments.length;)args.push(arguments[position++]);return executeBound(func,bound,this,this,args)};return bound}),(_.partial.placeholder=_).bindAll=restArguments(function(obj,keys){var index=(keys=flatten(keys,!1,!1)).length;if(index<1)throw new Error("bindAll must be passed function names");for(;index--;){var key=keys[index];obj[key]=_.bind(obj[key],obj)}}),_.memoize=function(func,hasher){var memoize=function(key){var cache=memoize.cache,address=""+(hasher?hasher.apply(this,arguments):key);return has(cache,address)||(cache[address]=func.apply(this,arguments)),cache[address]};return memoize.cache={},memoize},_.delay=restArguments(function(func,wait,args){return setTimeout(function(){return func.apply(null,args)},wait)}),_.defer=_.partial(_.delay,_,1),_.throttle=function(func,wait,options){var timeout,context,args,result,previous=0;options||(options={});var later=function(){previous=!1===options.leading?0:_.now(),timeout=null,result=func.apply(context,args),timeout||(context=args=null)},throttled=function(){var now=_.now();previous||!1!==options.leading||(previous=now);var remaining=wait-(now-previous);return context=this,args=arguments,remaining<=0||wait<remaining?(timeout&&(clearTimeout(timeout),timeout=null),previous=now,result=func.apply(context,args),timeout||(context=args=null)):timeout||!1===options.trailing||(timeout=setTimeout(later,remaining)),result};return throttled.cancel=function(){clearTimeout(timeout),previous=0,timeout=context=args=null},throttled},_.debounce=function(func,wait,immediate){var timeout,result,later=function(context,args){timeout=null,args&&(result=func.apply(context,args))},debounced=restArguments(function(args){if(timeout&&clearTimeout(timeout),immediate){var callNow=!timeout;timeout=setTimeout(later,wait),callNow&&(result=func.apply(this,args))}else timeout=_.delay(later,wait,this,args);return result});return debounced.cancel=function(){clearTimeout(timeout),timeout=null},debounced},_.wrap=function(func,wrapper){return _.partial(wrapper,func)},_.negate=function(predicate){return function(){return!predicate.apply(this,arguments)}},_.compose=function(){var args=arguments,start=args.length-1;return function(){for(var i=start,result=args[start].apply(this,arguments);i--;)result=args[i].call(this,result);return result}},_.after=function(times,func){return function(){if(--times<1)return func.apply(this,arguments)}},_.before=function(times,func){var memo;return function(){return 0<--times&&(memo=func.apply(this,arguments)),times<=1&&(func=null),memo}},_.once=_.partial(_.before,2),_.restArguments=restArguments;var hasEnumBug=!{toString:null}.propertyIsEnumerable("toString"),nonEnumerableProps=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],collectNonEnumProps=function(obj,keys){var nonEnumIdx=nonEnumerableProps.length,constructor=obj.constructor,proto=_.isFunction(constructor)&&constructor.prototype||ObjProto,prop="constructor";for(has(obj,prop)&&!_.contains(keys,prop)&&keys.push(prop);nonEnumIdx--;)(prop=nonEnumerableProps[nonEnumIdx])in obj&&obj[prop]!==proto[prop]&&!_.contains(keys,prop)&&keys.push(prop)};_.keys=function(obj){if(!_.isObject(obj))return[];if(nativeKeys)return nativeKeys(obj);var keys=[];for(var key in obj)has(obj,key)&&keys.push(key);return hasEnumBug&&collectNonEnumProps(obj,keys),keys},_.allKeys=function(obj){if(!_.isObject(obj))return[];var keys=[];for(var key in obj)keys.push(key);return hasEnumBug&&collectNonEnumProps(obj,keys),keys},_.values=function(obj){for(var keys=_.keys(obj),length=keys.length,values=Array(length),i=0;i<length;i++)values[i]=obj[keys[i]];return values},_.mapObject=function(obj,iteratee,context){iteratee=cb(iteratee,context);for(var keys=_.keys(obj),length=keys.length,results={},index=0;index<length;index++){var currentKey=keys[index];results[currentKey]=iteratee(obj[currentKey],currentKey,obj)}return results},_.pairs=function(obj){for(var keys=_.keys(obj),length=keys.length,pairs=Array(length),i=0;i<length;i++)pairs[i]=[keys[i],obj[keys[i]]];return pairs},_.invert=function(obj){for(var result={},keys=_.keys(obj),i=0,length=keys.length;i<length;i++)result[obj[keys[i]]]=keys[i];return result},_.functions=_.methods=function(obj){var names=[];for(var key in obj)_.isFunction(obj[key])&&names.push(key);return names.sort()};var createAssigner=function(keysFunc,defaults){return function(obj){var length=arguments.length;if(defaults&&(obj=Object(obj)),length<2||null==obj)return obj;for(var index=1;index<length;index++)for(var source=arguments[index],keys=keysFunc(source),l=keys.length,i=0;i<l;i++){var key=keys[i];defaults&&void 0!==obj[key]||(obj[key]=source[key])}return obj}};_.extend=createAssigner(_.allKeys),_.extendOwn=_.assign=createAssigner(_.keys),_.findKey=function(obj,predicate,context){predicate=cb(predicate,context);for(var key,keys=_.keys(obj),i=0,length=keys.length;i<length;i++)if(predicate(obj[key=keys[i]],key,obj))return key};var eq,deepEq,keyInObj=function(value,key,obj){return key in obj};_.pick=restArguments(function(obj,keys){var result={},iteratee=keys[0];if(null==obj)return result;_.isFunction(iteratee)?(1<keys.length&&(iteratee=optimizeCb(iteratee,keys[1])),keys=_.allKeys(obj)):(iteratee=keyInObj,keys=flatten(keys,!1,!1),obj=Object(obj));for(var i=0,length=keys.length;i<length;i++){var key=keys[i],value=obj[key];iteratee(value,key,obj)&&(result[key]=value)}return result}),_.omit=restArguments(function(obj,keys){var context,iteratee=keys[0];return _.isFunction(iteratee)?(iteratee=_.negate(iteratee),1<keys.length&&(context=keys[1])):(keys=_.map(flatten(keys,!1,!1),String),iteratee=function(value,key){return!_.contains(keys,key)}),_.pick(obj,iteratee,context)}),_.defaults=createAssigner(_.allKeys,!0),_.create=function(prototype,props){var result=baseCreate(prototype);return props&&_.extendOwn(result,props),result},_.clone=function(obj){return _.isObject(obj)?_.isArray(obj)?obj.slice():_.extend({},obj):obj},_.tap=function(obj,interceptor){return interceptor(obj),obj},_.isMatch=function(object,attrs){var keys=_.keys(attrs),length=keys.length;if(null==object)return!length;for(var obj=Object(object),i=0;i<length;i++){var key=keys[i];if(attrs[key]!==obj[key]||!(key in obj))return!1}return!0},eq=function(a,b,aStack,bStack){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return!1;if(a!=a)return b!=b;var type=typeof a;return("function"==type||"object"==type||"object"==typeof b)&&deepEq(a,b,aStack,bStack)},deepEq=function(a,b,aStack,bStack){a instanceof _&&(a=a._wrapped),b instanceof _&&(b=b._wrapped);var className=toString.call(a);if(className!==toString.call(b))return!1;switch(className){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!=+a?+b!=+b:0==+a?1/+a==1/b:+a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object Symbol]":return SymbolProto.valueOf.call(a)===SymbolProto.valueOf.call(b)}var areArrays="[object Array]"===className;if(!areArrays){if("object"!=typeof a||"object"!=typeof b)return!1;var aCtor=a.constructor,bCtor=b.constructor;if(aCtor!==bCtor&&!(_.isFunction(aCtor)&&aCtor instanceof aCtor&&_.isFunction(bCtor)&&bCtor instanceof bCtor)&&"constructor"in a&&"constructor"in b)return!1}bStack=bStack||[];for(var length=(aStack=aStack||[]).length;length--;)if(aStack[length]===a)return bStack[length]===b;if(aStack.push(a),bStack.push(b),areArrays){if((length=a.length)!==b.length)return!1;for(;length--;)if(!eq(a[length],b[length],aStack,bStack))return!1}else{var key,keys=_.keys(a);if(length=keys.length,_.keys(b).length!==length)return!1;for(;length--;)if(key=keys[length],!has(b,key)||!eq(a[key],b[key],aStack,bStack))return!1}return aStack.pop(),bStack.pop(),!0},_.isEqual=function(a,b){return eq(a,b)},_.isEmpty=function(obj){return null==obj||(isArrayLike(obj)&&(_.isArray(obj)||_.isString(obj)||_.isArguments(obj))?0===obj.length:0===_.keys(obj).length)},_.isElement=function(obj){return!(!obj||1!==obj.nodeType)},_.isArray=nativeIsArray||function(obj){return"[object Array]"===toString.call(obj)},_.isObject=function(obj){var type=typeof obj;return"function"==type||"object"==type&&!!obj},_.each(["Arguments","Function","String","Number","Date","RegExp","Error","Symbol","Map","WeakMap","Set","WeakSet"],function(name){_["is"+name]=function(obj){return toString.call(obj)==="[object "+name+"]"}}),_.isArguments(arguments)||(_.isArguments=function(obj){return has(obj,"callee")});var nodelist=root.document&&root.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof nodelist&&(_.isFunction=function(obj){return"function"==typeof obj||!1}),_.isFinite=function(obj){return!_.isSymbol(obj)&&isFinite(obj)&&!isNaN(parseFloat(obj))},_.isNaN=function(obj){return _.isNumber(obj)&&isNaN(obj)},_.isBoolean=function(obj){return!0===obj||!1===obj||"[object Boolean]"===toString.call(obj)},_.isNull=function(obj){return null===obj},_.isUndefined=function(obj){return void 0===obj},_.has=function(obj,path){if(!_.isArray(path))return has(obj,path);for(var length=path.length,i=0;i<length;i++){var key=path[i];if(null==obj||!hasOwnProperty.call(obj,key))return!1;obj=obj[key]}return!!length},_.noConflict=function(){return root._=previousUnderscore,this},_.identity=function(value){return value},_.constant=function(value){return function(){return value}},_.noop=function(){},_.property=function(path){return _.isArray(path)?function(obj){return deepGet(obj,path)}:shallowProperty(path)},_.propertyOf=function(obj){return null==obj?function(){}:function(path){return _.isArray(path)?deepGet(obj,path):obj[path]}},_.matcher=_.matches=function(attrs){return attrs=_.extendOwn({},attrs),function(obj){return _.isMatch(obj,attrs)}},_.times=function(n,iteratee,context){var accum=Array(Math.max(0,n));iteratee=optimizeCb(iteratee,context,1);for(var i=0;i<n;i++)accum[i]=iteratee(i);return accum},_.random=function(min,max){return null==max&&(max=min,min=0),min+Math.floor(Math.random()*(max-min+1))},_.now=Date.now||function(){return(new Date).getTime()};var escapeMap={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},unescapeMap=_.invert(escapeMap),createEscaper=function(map){var escaper=function(match){return map[match]},source="(?:"+_.keys(map).join("|")+")",testRegexp=RegExp(source),replaceRegexp=RegExp(source,"g");return function(string){return string=null==string?"":""+string,testRegexp.test(string)?string.replace(replaceRegexp,escaper):string}};_.escape=createEscaper(escapeMap),_.unescape=createEscaper(unescapeMap),_.result=function(obj,path,fallback){_.isArray(path)||(path=[path]);var length=path.length;if(!length)return _.isFunction(fallback)?fallback.call(obj):fallback;for(var i=0;i<length;i++){var prop=null==obj?void 0:obj[path[i]];void 0===prop&&(prop=fallback,i=length),obj=_.isFunction(prop)?prop.call(obj):prop}return obj};var idCounter=0;_.uniqueId=function(prefix){var id=++idCounter+"";return prefix?prefix+id:id},_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var noMatch=/(.)^/,escapes={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},escapeRegExp=/\\|'|\r|\n|\u2028|\u2029/g,escapeChar=function(match){return"\\"+escapes[match]};_.template=function(text,settings,oldSettings){!settings&&oldSettings&&(settings=oldSettings),settings=_.defaults({},settings,_.templateSettings);var render,matcher=RegExp([(settings.escape||noMatch).source,(settings.interpolate||noMatch).source,(settings.evaluate||noMatch).source].join("|")+"|$","g"),index=0,source="__p+='";text.replace(matcher,function(match,escape,interpolate,evaluate,offset){return source+=text.slice(index,offset).replace(escapeRegExp,escapeChar),index=offset+match.length,escape?source+="'+\n((__t=("+escape+"))==null?'':_.escape(__t))+\n'":interpolate?source+="'+\n((__t=("+interpolate+"))==null?'':__t)+\n'":evaluate&&(source+="';\n"+evaluate+"\n__p+='"),match}),source+="';\n",settings.variable||(source="with(obj||{}){\n"+source+"}\n"),source="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+source+"return __p;\n";try{render=new Function(settings.variable||"obj","_",source)}catch(e){throw e.source=source,e}var template=function(data){return render.call(this,data,_)},argument=settings.variable||"obj";return template.source="function("+argument+"){\n"+source+"}",template},_.chain=function(obj){var instance=_(obj);return instance._chain=!0,instance};var chainResult=function(instance,obj){return instance._chain?_(obj).chain():obj};_.mixin=function(obj){return _.each(_.functions(obj),function(name){var func=_[name]=obj[name];_.prototype[name]=function(){var args=[this._wrapped];return push.apply(args,arguments),chainResult(this,func.apply(_,args))}}),_},_.mixin(_),_.each(["pop","push","reverse","shift","sort","splice","unshift"],function(name){var method=ArrayProto[name];_.prototype[name]=function(){var obj=this._wrapped;return method.apply(obj,arguments),"shift"!==name&&"splice"!==name||0!==obj.length||delete obj[0],chainResult(this,obj)}}),_.each(["concat","join","slice"],function(name){var method=ArrayProto[name];_.prototype[name]=function(){return chainResult(this,method.apply(this._wrapped,arguments))}}),_.prototype.value=function(){return this._wrapped},_.prototype.valueOf=_.prototype.toJSON=_.prototype.value,_.prototype.toString=function(){return String(this._wrapped)}}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],293:[function(require,module,exports){var createElement=require("./vdom/create-element.js");module.exports=createElement},{"./vdom/create-element.js":299}],294:[function(require,module,exports){var diff=require("./vtree/diff.js");module.exports=diff},{"./vtree/diff.js":319}],295:[function(require,module,exports){var h=require("./virtual-hyperscript/index.js");module.exports=h},{"./virtual-hyperscript/index.js":306}],296:[function(require,module,exports){var diff=require("./diff.js"),patch=require("./patch.js"),h=require("./h.js"),create=require("./create-element.js"),VNode=require("./vnode/vnode.js"),VText=require("./vnode/vtext.js");module.exports={diff:diff,patch:patch,h:h,create:create,VNode:VNode,VText:VText}},{"./create-element.js":293,"./diff.js":294,"./h.js":295,"./patch.js":297,"./vnode/vnode.js":315,"./vnode/vtext.js":317}],297:[function(require,module,exports){var patch=require("./vdom/patch.js");module.exports=patch},{"./vdom/patch.js":302}],298:[function(require,module,exports){var isObject=require("is-object"),isHook=require("../vnode/is-vhook.js");function removeProperty(node,propName,propValue,previous){if(previous){var previousValue=previous[propName];if(isHook(previousValue))previousValue.unhook&&previousValue.unhook(node,propName,propValue);else if("attributes"===propName)for(var attrName in previousValue)node.removeAttribute(attrName);else if("style"===propName)for(var i in previousValue)node.style[i]="";else node[propName]="string"==typeof previousValue?"":null}}function patchObject(node,props,previous,propName,propValue){var previousValue=previous?previous[propName]:void 0;if("attributes"!==propName)if(previousValue&&isObject(previousValue)&&getPrototype(previousValue)!==getPrototype(propValue))node[propName]=propValue;else{isObject(node[propName])||(node[propName]={});var replacer="style"===propName?"":void 0;for(var k in propValue){var value=propValue[k];node[propName][k]=void 0===value?replacer:value}}else for(var attrName in propValue){var attrValue=propValue[attrName];void 0===attrValue?node.removeAttribute(attrName):node.setAttribute(attrName,attrValue)}}function getPrototype(value){return Object.getPrototypeOf?Object.getPrototypeOf(value):value.__proto__?value.__proto__:value.constructor?value.constructor.prototype:void 0}module.exports=function(node,props,previous){for(var propName in props){var propValue=props[propName];void 0===propValue?removeProperty(node,propName,propValue,previous):isHook(propValue)?(removeProperty(node,propName,propValue,previous),propValue.hook&&propValue.hook(node,propName,previous?previous[propName]:void 0)):isObject(propValue)?patchObject(node,props,previous,propName,propValue):node[propName]=propValue}}},{"../vnode/is-vhook.js":310,"is-object":79}],299:[function(require,module,exports){var document=require("global/document"),applyProperties=require("./apply-properties"),isVNode=require("../vnode/is-vnode.js"),isVText=require("../vnode/is-vtext.js"),isWidget=require("../vnode/is-widget.js"),handleThunk=require("../vnode/handle-thunk.js");module.exports=function createElement(vnode,opts){var doc=opts&&opts.document||document;var warn=opts?opts.warn:null;vnode=handleThunk(vnode).a;{if(isWidget(vnode))return vnode.init();if(isVText(vnode))return doc.createTextNode(vnode.text);if(!isVNode(vnode))return warn&&warn("Item is not a valid virtual dom node",vnode),null}var node=null===vnode.namespace?doc.createElement(vnode.tagName):doc.createElementNS(vnode.namespace,vnode.tagName);var props=vnode.properties;applyProperties(node,props);var children=vnode.children;for(var i=0;i<children.length;i++){var childNode=createElement(children[i],opts);childNode&&node.appendChild(childNode)}return node}},{"../vnode/handle-thunk.js":308,"../vnode/is-vnode.js":311,"../vnode/is-vtext.js":312,"../vnode/is-widget.js":313,"./apply-properties":298,"global/document":52}],300:[function(require,module,exports){var noChild={};function indexInRange(indices,left,right){if(0===indices.length)return!1;for(var currentIndex,currentItem,minIndex=0,maxIndex=indices.length-1;minIndex<=maxIndex;){if(currentItem=indices[currentIndex=(maxIndex+minIndex)/2>>0],minIndex===maxIndex)return left<=currentItem&¤tItem<=right;if(currentItem<left)minIndex=1+currentIndex;else{if(!(right<currentItem))return!0;maxIndex=currentIndex-1}}return!1}function ascending(a,b){return b<a?1:-1}module.exports=function(rootNode,tree,indices,nodes){return indices&&0!==indices.length?(indices.sort(ascending),function recurse(rootNode,tree,indices,nodes,rootIndex){nodes=nodes||{};if(rootNode){indexInRange(indices,rootIndex,rootIndex)&&(nodes[rootIndex]=rootNode);var vChildren=tree.children;if(vChildren)for(var childNodes=rootNode.childNodes,i=0;i<tree.children.length;i++){rootIndex+=1;var vChild=vChildren[i]||noChild,nextIndex=rootIndex+(vChild.count||0);indexInRange(indices,rootIndex,nextIndex)&&recurse(childNodes[i],vChild,indices,nodes,rootIndex),rootIndex=nextIndex}}return nodes}(rootNode,tree,indices,nodes,0)):{}}},{}],301:[function(require,module,exports){var applyProperties=require("./apply-properties"),isWidget=require("../vnode/is-widget.js"),VPatch=require("../vnode/vpatch.js"),updateWidget=require("./update-widget");function destroyWidget(domNode,w){"function"==typeof w.destroy&&isWidget(w)&&w.destroy(domNode)}module.exports=function(vpatch,domNode,renderOptions){var type=vpatch.type,vNode=vpatch.vNode,patch=vpatch.patch;switch(type){case VPatch.REMOVE:return function(domNode,vNode){var parentNode=domNode.parentNode;parentNode&&parentNode.removeChild(domNode);return destroyWidget(domNode,vNode),null}(domNode,vNode);case VPatch.INSERT:return function(parentNode,vNode,renderOptions){var newNode=renderOptions.render(vNode,renderOptions);parentNode&&parentNode.appendChild(newNode);return parentNode}(domNode,patch,renderOptions);case VPatch.VTEXT:return function(domNode,leftVNode,vText,renderOptions){var newNode;if(3===domNode.nodeType)domNode.replaceData(0,domNode.length,vText.text),newNode=domNode;else{var parentNode=domNode.parentNode;newNode=renderOptions.render(vText,renderOptions),parentNode&&newNode!==domNode&&parentNode.replaceChild(newNode,domNode)}return newNode}(domNode,0,patch,renderOptions);case VPatch.WIDGET:return function(domNode,leftVNode,widget,renderOptions){var newNode,updating=updateWidget(leftVNode,widget);newNode=updating?widget.update(leftVNode,domNode)||domNode:renderOptions.render(widget,renderOptions);var parentNode=domNode.parentNode;parentNode&&newNode!==domNode&&parentNode.replaceChild(newNode,domNode);updating||destroyWidget(domNode,leftVNode);return newNode}(domNode,vNode,patch,renderOptions);case VPatch.VNODE:return function(domNode,leftVNode,vNode,renderOptions){var parentNode=domNode.parentNode,newNode=renderOptions.render(vNode,renderOptions);parentNode&&newNode!==domNode&&parentNode.replaceChild(newNode,domNode);return newNode}(domNode,0,patch,renderOptions);case VPatch.ORDER:return function(domNode,moves){for(var node,remove,insert,childNodes=domNode.childNodes,keyMap={},i=0;i<moves.removes.length;i++)remove=moves.removes[i],node=childNodes[remove.from],remove.key&&(keyMap[remove.key]=node),domNode.removeChild(node);for(var length=childNodes.length,j=0;j<moves.inserts.length;j++)insert=moves.inserts[j],node=keyMap[insert.key],domNode.insertBefore(node,insert.to>=length++?null:childNodes[insert.to])}(domNode,patch),domNode;case VPatch.PROPS:return applyProperties(domNode,patch,vNode.properties),domNode;case VPatch.THUNK:return function(oldRoot,newRoot){oldRoot&&newRoot&&oldRoot!==newRoot&&oldRoot.parentNode&&oldRoot.parentNode.replaceChild(newRoot,oldRoot);return newRoot}(domNode,renderOptions.patch(domNode,patch,renderOptions));default:return domNode}}},{"../vnode/is-widget.js":313,"../vnode/vpatch.js":316,"./apply-properties":298,"./update-widget":303}],302:[function(require,module,exports){var document=require("global/document"),isArray=require("x-is-array"),render=require("./create-element"),domIndex=require("./dom-index"),patchOp=require("./patch-op");function patchRecursive(rootNode,patches,renderOptions){var indices=function(patches){var indices=[];for(var key in patches)"a"!==key&&indices.push(Number(key));return indices}(patches);if(0===indices.length)return rootNode;var index=domIndex(rootNode,patches.a,indices),ownerDocument=rootNode.ownerDocument;renderOptions.document||ownerDocument===document||(renderOptions.document=ownerDocument);for(var i=0;i<indices.length;i++){var nodeIndex=indices[i];rootNode=applyPatch(rootNode,index[nodeIndex],patches[nodeIndex],renderOptions)}return rootNode}function applyPatch(rootNode,domNode,patchList,renderOptions){if(!domNode)return rootNode;var newNode;if(isArray(patchList))for(var i=0;i<patchList.length;i++)newNode=patchOp(patchList[i],domNode,renderOptions),domNode===rootNode&&(rootNode=newNode);else newNode=patchOp(patchList,domNode,renderOptions),domNode===rootNode&&(rootNode=newNode);return rootNode}module.exports=function patch(rootNode,patches,renderOptions){renderOptions=renderOptions||{};renderOptions.patch=renderOptions.patch&&renderOptions.patch!==patch?renderOptions.patch:patchRecursive;renderOptions.render=renderOptions.render||render;return renderOptions.patch(rootNode,patches,renderOptions)}},{"./create-element":299,"./dom-index":300,"./patch-op":301,"global/document":52,"x-is-array":338}],303:[function(require,module,exports){var isWidget=require("../vnode/is-widget.js");module.exports=function(a,b){if(isWidget(a)&&isWidget(b))return"name"in a&&"name"in b?a.id===b.id:a.init===b.init;return!1}},{"../vnode/is-widget.js":313}],304:[function(require,module,exports){"use strict";var EvStore=require("ev-store");function EvHook(value){if(!(this instanceof EvHook))return new EvHook(value);this.value=value}(module.exports=EvHook).prototype.hook=function(node,propertyName){EvStore(node)[propertyName.substr(3)]=this.value},EvHook.prototype.unhook=function(node,propertyName){EvStore(node)[propertyName.substr(3)]=void 0}},{"ev-store":50}],305:[function(require,module,exports){"use strict";function SoftSetHook(value){if(!(this instanceof SoftSetHook))return new SoftSetHook(value);this.value=value}(module.exports=SoftSetHook).prototype.hook=function(node,propertyName){node[propertyName]!==this.value&&(node[propertyName]=this.value)}},{}],306:[function(require,module,exports){"use strict";var isArray=require("x-is-array"),VNode=require("../vnode/vnode.js"),VText=require("../vnode/vtext.js"),isVNode=require("../vnode/is-vnode"),isVText=require("../vnode/is-vtext"),isWidget=require("../vnode/is-widget"),isHook=require("../vnode/is-vhook"),isVThunk=require("../vnode/is-thunk"),parseTag=require("./parse-tag.js"),softSetHook=require("./hooks/soft-set-hook.js"),evHook=require("./hooks/ev-hook.js");function isChild(x){return isVNode(x)||isVText(x)||isWidget(x)||isVThunk(x)}function UnexpectedVirtualElement(data){var err=new Error;return err.type="virtual-hyperscript.unexpected.virtual-element",err.message="Unexpected virtual child passed to h().\nExpected a VNode / Vthunk / VWidget / string but:\ngot:\n"+errorString(data.foreignObject)+".\nThe parent vnode is:\n"+errorString(data.parentVnode),err.foreignObject=data.foreignObject,err.parentVnode=data.parentVnode,err}function errorString(obj){try{return JSON.stringify(obj,null," ")}catch(e){return String(obj)}}module.exports=function(tagName,properties,children){var tag,props,key,namespace,childNodes=[];!children&&function(x){return"string"==typeof x||isArray(x)||isChild(x)}(properties)&&(children=properties,props={});tag=parseTag(tagName,props=props||properties||{}),props.hasOwnProperty("key")&&(key=props.key,props.key=void 0);props.hasOwnProperty("namespace")&&(namespace=props.namespace,props.namespace=void 0);"INPUT"!==tag||namespace||!props.hasOwnProperty("value")||void 0===props.value||isHook(props.value)||(props.value=softSetHook(props.value));(function(props){for(var propName in props)if(props.hasOwnProperty(propName)){var value=props[propName];if(isHook(value))continue;"ev-"===propName.substr(0,3)&&(props[propName]=evHook(value))}})(props),null!=children&&!function addChild(c,childNodes,tag,props){if("string"==typeof c)childNodes.push(new VText(c));else if("number"==typeof c)childNodes.push(new VText(String(c)));else if(isChild(c))childNodes.push(c);else{if(!isArray(c)){if(null==c)return;throw UnexpectedVirtualElement({foreignObject:c,parentVnode:{tagName:tag,properties:props}})}for(var i=0;i<c.length;i++)addChild(c[i],childNodes,tag,props)}}(children,childNodes,tag,props);return new VNode(tag,props,childNodes,key,namespace)}},{"../vnode/is-thunk":309,"../vnode/is-vhook":310,"../vnode/is-vnode":311,"../vnode/is-vtext":312,"../vnode/is-widget":313,"../vnode/vnode.js":315,"../vnode/vtext.js":317,"./hooks/ev-hook.js":304,"./hooks/soft-set-hook.js":305,"./parse-tag.js":307,"x-is-array":338}],307:[function(require,module,exports){"use strict";var split=require("browser-split"),classIdSplit=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,notClassId=/^\.|#/;module.exports=function(tag,props){if(!tag)return"DIV";var classes,part,type,i,noId=!props.hasOwnProperty("id"),tagParts=split(tag,classIdSplit),tagName=null;notClassId.test(tagParts[1])&&(tagName="DIV");for(i=0;i<tagParts.length;i++)(part=tagParts[i])&&(type=part.charAt(0),tagName?"."===type?(classes=classes||[]).push(part.substring(1,part.length)):"#"===type&&noId&&(props.id=part.substring(1,part.length)):tagName=part);classes&&(props.className&&classes.push(props.className),props.className=classes.join(" "));return props.namespace?tagName:tagName.toUpperCase()}},{"browser-split":46}],308:[function(require,module,exports){var isVNode=require("./is-vnode"),isVText=require("./is-vtext"),isWidget=require("./is-widget"),isThunk=require("./is-thunk");function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;if(renderedThunk||(renderedThunk=thunk.vnode=thunk.render(previous)),!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk)))throw new Error("thunk did not return a valid node");return renderedThunk}module.exports=function(a,b){var renderedA=a,renderedB=b;isThunk(b)&&(renderedB=renderThunk(b,a));isThunk(a)&&(renderedA=renderThunk(a,null));return{a:renderedA,b:renderedB}}},{"./is-thunk":309,"./is-vnode":311,"./is-vtext":312,"./is-widget":313}],309:[function(require,module,exports){module.exports=function(t){return t&&"Thunk"===t.type}},{}],310:[function(require,module,exports){module.exports=function(hook){return hook&&("function"==typeof hook.hook&&!hook.hasOwnProperty("hook")||"function"==typeof hook.unhook&&!hook.hasOwnProperty("unhook"))}},{}],311:[function(require,module,exports){var version=require("./version");module.exports=function(x){return x&&"VirtualNode"===x.type&&x.version===version}},{"./version":314}],312:[function(require,module,exports){var version=require("./version");module.exports=function(x){return x&&"VirtualText"===x.type&&x.version===version}},{"./version":314}],313:[function(require,module,exports){module.exports=function(w){return w&&"Widget"===w.type}},{}],314:[function(require,module,exports){module.exports="2"},{}],315:[function(require,module,exports){var version=require("./version"),isVNode=require("./is-vnode"),isWidget=require("./is-widget"),isThunk=require("./is-thunk"),isVHook=require("./is-vhook");module.exports=VirtualNode;var noProperties={},noChildren=[];function VirtualNode(tagName,properties,children,key,namespace){this.tagName=tagName,this.properties=properties||noProperties,this.children=children||noChildren,this.key=null!=key?String(key):void 0,this.namespace="string"==typeof namespace?namespace:null;var hooks,count=children&&children.length||0,descendants=0,hasWidgets=!1,hasThunks=!1,descendantHooks=!1;for(var propName in properties)if(properties.hasOwnProperty(propName)){var property=properties[propName];isVHook(property)&&property.unhook&&(hooks||(hooks={}),hooks[propName]=property)}for(var i=0;i<count;i++){var child=children[i];isVNode(child)?(descendants+=child.count||0,!hasWidgets&&child.hasWidgets&&(hasWidgets=!0),!hasThunks&&child.hasThunks&&(hasThunks=!0),descendantHooks||!child.hooks&&!child.descendantHooks||(descendantHooks=!0)):!hasWidgets&&isWidget(child)?"function"==typeof child.destroy&&(hasWidgets=!0):!hasThunks&&isThunk(child)&&(hasThunks=!0)}this.count=count+descendants,this.hasWidgets=hasWidgets,this.hasThunks=hasThunks,this.hooks=hooks,this.descendantHooks=descendantHooks}VirtualNode.prototype.version=version,VirtualNode.prototype.type="VirtualNode"},{"./is-thunk":309,"./is-vhook":310,"./is-vnode":311,"./is-widget":313,"./version":314}],316:[function(require,module,exports){var version=require("./version");function VirtualPatch(type,vNode,patch){this.type=Number(type),this.vNode=vNode,this.patch=patch}VirtualPatch.NONE=0,VirtualPatch.VTEXT=1,VirtualPatch.VNODE=2,VirtualPatch.WIDGET=3,VirtualPatch.PROPS=4,VirtualPatch.ORDER=5,VirtualPatch.INSERT=6,VirtualPatch.REMOVE=7,VirtualPatch.THUNK=8,(module.exports=VirtualPatch).prototype.version=version,VirtualPatch.prototype.type="VirtualPatch"},{"./version":314}],317:[function(require,module,exports){var version=require("./version");function VirtualText(text){this.text=String(text)}(module.exports=VirtualText).prototype.version=version,VirtualText.prototype.type="VirtualText"},{"./version":314}],318:[function(require,module,exports){var isObject=require("is-object"),isHook=require("../vnode/is-vhook");function getPrototype(value){return Object.getPrototypeOf?Object.getPrototypeOf(value):value.__proto__?value.__proto__:value.constructor?value.constructor.prototype:void 0}module.exports=function diffProps(a,b){var diff;for(var aKey in a){aKey in b||((diff=diff||{})[aKey]=void 0);var aValue=a[aKey],bValue=b[aKey];if(aValue!==bValue)if(isObject(aValue)&&isObject(bValue))if(getPrototype(bValue)!==getPrototype(aValue))(diff=diff||{})[aKey]=bValue;else if(isHook(bValue))(diff=diff||{})[aKey]=bValue;else{var objectDiff=diffProps(aValue,bValue);objectDiff&&((diff=diff||{})[aKey]=objectDiff)}else(diff=diff||{})[aKey]=bValue}for(var bKey in b)bKey in a||((diff=diff||{})[bKey]=b[bKey]);return diff}},{"../vnode/is-vhook":310,"is-object":79}],319:[function(require,module,exports){var isArray=require("x-is-array"),VPatch=require("../vnode/vpatch"),isVNode=require("../vnode/is-vnode"),isVText=require("../vnode/is-vtext"),isWidget=require("../vnode/is-widget"),isThunk=require("../vnode/is-thunk"),handleThunk=require("../vnode/handle-thunk"),diffProps=require("./diff-props");function diff(a,b){var patch={a:a};return walk(a,b,patch,0),patch}function walk(a,b,patch,index){if(a!==b){var apply=patch[index],applyClear=!1;if(isThunk(a)||isThunk(b))thunks(a,b,patch,index);else if(null==b)isWidget(a)||(clearState(a,patch,index),apply=patch[index]),apply=appendPatch(apply,new VPatch(VPatch.REMOVE,a,b));else if(isVNode(b))if(isVNode(a))if(a.tagName===b.tagName&&a.namespace===b.namespace&&a.key===b.key){var propsPatch=diffProps(a.properties,b.properties);propsPatch&&(apply=appendPatch(apply,new VPatch(VPatch.PROPS,a,propsPatch))),apply=function(a,b,patch,apply,index){for(var aChildren=a.children,orderedSet=function(aChildren,bChildren){var bChildIndex=keyIndex(bChildren),bKeys=bChildIndex.keys,bFree=bChildIndex.free;if(bFree.length===bChildren.length)return{children:bChildren,moves:null};var aChildIndex=keyIndex(aChildren),aKeys=aChildIndex.keys;if(aChildIndex.free.length===aChildren.length)return{children:bChildren,moves:null};for(var newChildren=[],freeIndex=0,freeCount=bFree.length,deletedItems=0,i=0;i<aChildren.length;i++){var itemIndex,aItem=aChildren[i];aItem.key?bKeys.hasOwnProperty(aItem.key)?(itemIndex=bKeys[aItem.key],newChildren.push(bChildren[itemIndex])):(itemIndex=i-deletedItems++,newChildren.push(null)):freeIndex<freeCount?(itemIndex=bFree[freeIndex++],newChildren.push(bChildren[itemIndex])):(itemIndex=i-deletedItems++,newChildren.push(null))}for(var lastFreeIndex=freeIndex>=bFree.length?bChildren.length:bFree[freeIndex],j=0;j<bChildren.length;j++){var newItem=bChildren[j];newItem.key?aKeys.hasOwnProperty(newItem.key)||newChildren.push(newItem):lastFreeIndex<=j&&newChildren.push(newItem)}for(var simulateItem,simulate=newChildren.slice(),simulateIndex=0,removes=[],inserts=[],k=0;k<bChildren.length;){var wantedItem=bChildren[k];for(simulateItem=simulate[simulateIndex];null===simulateItem&&simulate.length;)removes.push(remove(simulate,simulateIndex,null)),simulateItem=simulate[simulateIndex];simulateItem&&simulateItem.key===wantedItem.key?(simulateIndex++,k++):wantedItem.key?(simulateItem&&simulateItem.key&&bKeys[simulateItem.key]!==k+1?(removes.push(remove(simulate,simulateIndex,simulateItem.key)),(simulateItem=simulate[simulateIndex])&&simulateItem.key===wantedItem.key?simulateIndex++:inserts.push({key:wantedItem.key,to:k})):inserts.push({key:wantedItem.key,to:k}),k++):simulateItem&&simulateItem.key&&removes.push(remove(simulate,simulateIndex,simulateItem.key))}for(;simulateIndex<simulate.length;)simulateItem=simulate[simulateIndex],removes.push(remove(simulate,simulateIndex,simulateItem&&simulateItem.key));return removes.length!==deletedItems||inserts.length?{children:newChildren,moves:{removes:removes,inserts:inserts}}:{children:newChildren,moves:null}}(aChildren,b.children),bChildren=orderedSet.children,aLen=aChildren.length,bLen=bChildren.length,len=bLen<aLen?aLen:bLen,i=0;i<len;i++){var leftNode=aChildren[i],rightNode=bChildren[i];index+=1,leftNode?walk(leftNode,rightNode,patch,index):rightNode&&(apply=appendPatch(apply,new VPatch(VPatch.INSERT,null,rightNode))),isVNode(leftNode)&&leftNode.count&&(index+=leftNode.count)}orderedSet.moves&&(apply=appendPatch(apply,new VPatch(VPatch.ORDER,a,orderedSet.moves)));return apply}(a,b,patch,apply,index)}else apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b)),applyClear=!0;else apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b)),applyClear=!0;else isVText(b)?isVText(a)?a.text!==b.text&&(apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b))):(apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b)),applyClear=!0):isWidget(b)&&(isWidget(a)||(applyClear=!0),apply=appendPatch(apply,new VPatch(VPatch.WIDGET,a,b)));apply&&(patch[index]=apply),applyClear&&clearState(a,patch,index)}}function clearState(vNode,patch,index){!function unhook(vNode,patch,index){if(isVNode(vNode)){if(vNode.hooks&&(patch[index]=appendPatch(patch[index],new VPatch(VPatch.PROPS,vNode,undefinedKeys(vNode.hooks)))),vNode.descendantHooks||vNode.hasThunks)for(var children=vNode.children,len=children.length,i=0;i<len;i++){var child=children[i];unhook(child,patch,index+=1),isVNode(child)&&child.count&&(index+=child.count)}}else isThunk(vNode)&&thunks(vNode,null,patch,index)}(vNode,patch,index),function destroyWidgets(vNode,patch,index){if(isWidget(vNode))"function"==typeof vNode.destroy&&(patch[index]=appendPatch(patch[index],new VPatch(VPatch.REMOVE,vNode,null)));else if(isVNode(vNode)&&(vNode.hasWidgets||vNode.hasThunks))for(var children=vNode.children,len=children.length,i=0;i<len;i++){var child=children[i];destroyWidgets(child,patch,index+=1),isVNode(child)&&child.count&&(index+=child.count)}else isThunk(vNode)&&thunks(vNode,null,patch,index)}(vNode,patch,index)}function thunks(a,b,patch,index){var nodes=handleThunk(a,b),thunkPatch=diff(nodes.a,nodes.b);(function(patch){for(var index in patch)if("a"!==index)return!0;return!1})(thunkPatch)&&(patch[index]=new VPatch(VPatch.THUNK,null,thunkPatch))}function undefinedKeys(obj){var result={};for(var key in obj)result[key]=void 0;return result}function remove(arr,index,key){return arr.splice(index,1),{from:index,key:key}}function keyIndex(children){for(var keys={},free=[],length=children.length,i=0;i<length;i++){var child=children[i];child.key?keys[child.key]=i:free.push(i)}return{keys:keys,free:free}}function appendPatch(apply,patch){return apply?(isArray(apply)?apply.push(patch):apply=[apply,patch],apply):patch}module.exports=diff},{"../vnode/handle-thunk":308,"../vnode/is-thunk":309,"../vnode/is-vnode":311,"../vnode/is-vtext":312,"../vnode/is-widget":313,"../vnode/vpatch":316,"./diff-props":318,"x-is-array":338}],320:[function(require,module,exports){!function(define){"use strict";define(function(require){return require("./makePromise")({scheduler:new(require("./Scheduler"))(require("./env").asap)})})}(function(factory){module.exports=factory(require)})},{"./Scheduler":321,"./env":333,"./makePromise":335}],321:[function(require,module,exports){!function(define){"use strict";define(function(){function Scheduler(async){this._async=async,this._running=!1,(this._queue=this)._queueLen=0,this._afterQueue={},this._afterQueueLen=0;var self=this;this.drain=function(){self._drain()}}return Scheduler.prototype.enqueue=function(task){this._queue[this._queueLen++]=task,this.run()},Scheduler.prototype.afterQueue=function(task){this._afterQueue[this._afterQueueLen++]=task,this.run()},Scheduler.prototype.run=function(){this._running||(this._running=!0,this._async(this.drain))},Scheduler.prototype._drain=function(){for(var i=0;i<this._queueLen;++i)this._queue[i].run(),this._queue[i]=void 0;for(this._queueLen=0,this._running=!1,i=0;i<this._afterQueueLen;++i)this._afterQueue[i].run(),this._afterQueue[i]=void 0;this._afterQueueLen=0},Scheduler})}(function(factory){module.exports=factory()})},{}],322:[function(require,module,exports){!function(define){"use strict";define(function(){function TimeoutError(message){Error.call(this),this.message=message,this.name=TimeoutError.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,TimeoutError)}return(TimeoutError.prototype=Object.create(Error.prototype)).constructor=TimeoutError})}(function(factory){module.exports=factory()})},{}],323:[function(require,module,exports){!function(define){"use strict";define(function(){return makeApply.tryCatchResolve=tryCatchResolve,makeApply;function makeApply(Promise,call){return arguments.length<2&&(call=tryCatchResolve),function(f,thisArg,args){var p=Promise._defer(),l=args.length,params=new Array(l);return callAndResolve({f:f,thisArg:thisArg,args:args,params:params,i:l-1,call:call},p._handler),p};function callAndResolve(c,h){if(c.i<0)return call(c.f,c.thisArg,c.params,h);Promise._handler(c.args[c.i]).fold(callAndResolveNext,c,void 0,h)}function callAndResolveNext(c,x,h){c.params[c.i]=x,c.i-=1,callAndResolve(c,h)}}function tryCatchResolve(f,thisArg,args,resolver){try{resolver.resolve(f.apply(thisArg,args))}catch(e){resolver.reject(e)}}})}(function(factory){module.exports=factory()})},{}],324:[function(require,module,exports){!function(define){"use strict";define(function(require){var state=require("../state"),applier=require("../apply");return function(Promise){var applyFold=applier(Promise),toPromise=Promise.resolve,all=Promise.all,ar=Array.prototype.reduce,arr=Array.prototype.reduceRight,slice=Array.prototype.slice;return Promise.any=function(promises){for(var h,x,p=Promise._defer(),resolver=p._handler,l=promises.length>>>0,pending=l,errors=[],i=0;i<l;++i)if(void 0!==(x=promises[i])||i in promises){if(0<(h=Promise._handler(x)).state()){resolver.become(h),Promise._visitRemaining(promises,i,h);break}h.visit(resolver,handleFulfill,handleReject)}else--pending;0===pending&&resolver.reject(new RangeError("any(): array must not be empty"));return p;function handleFulfill(x){errors=null,this.resolve(x)}function handleReject(e){this.resolved||(errors.push(e),0==--pending&&this.reject(errors))}},Promise.some=function(promises,n){var nReject,x,i,p=Promise._defer(),resolver=p._handler,results=[],errors=[],l=promises.length>>>0,nFulfill=0;for(i=0;i<l;++i)(void 0!==(x=promises[i])||i in promises)&&++nFulfill;n=Math.max(n,0),nReject=nFulfill-n+1,(nFulfill=Math.min(n,nFulfill))<n?resolver.reject(new RangeError("some(): array must contain at least "+n+" item(s), but had "+nFulfill)):0===nFulfill&&resolver.resolve(results);for(i=0;i<l;++i)(void 0!==(x=promises[i])||i in promises)&&Promise._handler(x).visit(resolver,fulfill,reject,resolver.notify);return p;function fulfill(x){this.resolved||(results.push(x),0==--nFulfill&&(errors=null,this.resolve(results)))}function reject(e){this.resolved||(errors.push(e),0==--nReject&&(results=null,this.reject(errors)))}},Promise.settle=function(promises){return all(promises.map(settleOne))},Promise.map=function(promises,f){return Promise._traverse(f,promises)},Promise.filter=function(promises,predicate){var a=slice.call(promises);return Promise._traverse(predicate,a).then(function(keep){return function(promises,keep){for(var l=keep.length,filtered=new Array(l),i=0,j=0;i<l;++i)keep[i]&&(filtered[j++]=Promise._handler(promises[i]).value);return filtered.length=j,filtered}(a,keep)})},Promise.reduce=function(promises,f){return 2<arguments.length?ar.call(promises,liftCombine(f),arguments[2]):ar.call(promises,liftCombine(f))},Promise.reduceRight=function(promises,f){return 2<arguments.length?arr.call(promises,liftCombine(f),arguments[2]):arr.call(promises,liftCombine(f))},Promise.prototype.spread=function(onFulfilled){return this.then(all).then(function(array){return onFulfilled.apply(this,array)})},Promise;function settleOne(p){var handler;return p instanceof Promise&&(handler=p._handler.join()),handler&&0===handler.state()||!handler?toPromise(p).then(state.fulfilled,state.rejected):(handler._unreport(),state.inspect(handler))}function liftCombine(f){return function(z,x,i){return applyFold(f,void 0,[z,x,i])}}}})}(function(factory){module.exports=factory(require)})},{"../apply":323,"../state":336}],325:[function(require,module,exports){!function(define){"use strict";define(function(){return function(Promise){var resolve=Promise.resolve,reject=Promise.reject,origCatch=Promise.prototype.catch;function runSideEffect(handler,thisArg,propagate,value){var result=handler.call(thisArg);return function(x){return("object"==typeof x||"function"==typeof x)&&null!==x}(result)?function(result,propagate,x){return resolve(result).then(function(){return propagate(x)})}(result,propagate,value):propagate(value)}return Promise.prototype.done=function(onResult,onError){this._handler.visit(this._handler.receiver,onResult,onError)},Promise.prototype.catch=Promise.prototype.otherwise=function(onRejected){return arguments.length<2?origCatch.call(this,onRejected):"function"!=typeof onRejected?this.ensure(rejectInvalidPredicate):origCatch.call(this,function(handler,predicate){return function(e){return function(e,predicate){return function(predicate){return predicate===Error||null!=predicate&&predicate.prototype instanceof Error}(predicate)?e instanceof predicate:predicate(e)}(e,predicate)?handler.call(this,e):reject(e)}}(arguments[1],onRejected))},Promise.prototype.finally=Promise.prototype.ensure=function(handler){return"function"!=typeof handler?this:this.then(function(x){return runSideEffect(handler,this,identity,x)},function(e){return runSideEffect(handler,this,reject,e)})},Promise.prototype.else=Promise.prototype.orElse=function(defaultValue){return this.then(void 0,function(){return defaultValue})},Promise.prototype.yield=function(value){return this.then(function(){return value})},Promise.prototype.tap=function(onFulfilledSideEffect){return this.then(onFulfilledSideEffect).yield(this)},Promise};function rejectInvalidPredicate(){throw new TypeError("catch predicate must be a function")}function identity(x){return x}})}(function(factory){module.exports=factory()})},{}],326:[function(require,module,exports){!function(define){"use strict";define(function(){return function(Promise){return Promise.prototype.fold=function(f,z){var promise=this._beget();return this._handler.fold(function(z,x,to){Promise._handler(z).fold(function(x,z,to){to.resolve(f.call(this,z,x))},x,this,to)},z,promise._handler.receiver,promise._handler),promise},Promise}})}(function(factory){module.exports=factory()})},{}],327:[function(require,module,exports){!function(define){"use strict";define(function(require){var inspect=require("../state").inspect;return function(Promise){return Promise.prototype.inspect=function(){return inspect(Promise._handler(this))},Promise}})}(function(factory){module.exports=factory(require)})},{"../state":336}],328:[function(require,module,exports){!function(define){"use strict";define(function(){return function(Promise){var resolve=Promise.resolve;return Promise.iterate=function(f,condition,handler,x){return unfold(function(x){return[x,f(x)]},condition,handler,x)},Promise.unfold=unfold,Promise;function unfold(unspool,condition,handler,x){return resolve(x).then(function(seed){return resolve(condition(seed)).then(function(done){return done?seed:resolve(unspool(seed)).spread(next)})});function next(item,newSeed){return resolve(handler(item)).then(function(){return unfold(unspool,condition,handler,newSeed)})}}}})}(function(factory){module.exports=factory()})},{}],329:[function(require,module,exports){!function(define){"use strict";define(function(){return function(Promise){return Promise.prototype.progress=function(onProgress){return this.then(void 0,void 0,onProgress)},Promise}})}(function(factory){module.exports=factory()})},{}],330:[function(require,module,exports){!function(define){"use strict";define(function(require){var env=require("../env"),TimeoutError=require("../TimeoutError");function setTimeout(f,ms,x,y){return env.setTimer(function(){f(x,y,ms)},ms)}return function(Promise){function handleDelay(ms,x,h){setTimeout(resolveDelay,ms,x,h)}function resolveDelay(x,h){h.resolve(x)}function onTimeout(reason,h,ms){var e=void 0===reason?new TimeoutError("timed out after "+ms+"ms"):reason;h.reject(e)}return Promise.prototype.delay=function(ms){var p=this._beget();return this._handler.fold(handleDelay,ms,void 0,p._handler),p},Promise.prototype.timeout=function(ms,reason){var p=this._beget(),h=p._handler,t=setTimeout(onTimeout,ms,reason,p._handler);return this._handler.visit(h,function(x){env.clearTimer(t),this.resolve(x)},function(x){env.clearTimer(t),this.reject(x)},h.notify),p},Promise}})}(function(factory){module.exports=factory(require)})},{"../TimeoutError":322,"../env":333}],331:[function(require,module,exports){!function(define){"use strict";define(function(require){var setTimer=require("../env").setTimer,format=require("../format");return function(Promise){var localConsole,logError=noop,logInfo=noop;"undefined"!=typeof console&&(localConsole=console,logError=void 0!==localConsole.error?function(e){localConsole.error(e)}:function(e){localConsole.log(e)},logInfo=void 0!==localConsole.info?function(e){localConsole.info(e)}:function(e){localConsole.log(e)}),Promise.onPotentiallyUnhandledRejection=function(rejection){enqueue(report,rejection)},Promise.onPotentiallyUnhandledRejectionHandled=function(rejection){enqueue(unreport,rejection)},Promise.onFatalRejection=function(rejection){enqueue(throwit,rejection.value)};var tasks=[],reported=[],running=null;function report(r){r.handled||(reported.push(r),logError("Potentially unhandled rejection ["+r.id+"] "+format.formatError(r.value)))}function unreport(r){var i=reported.indexOf(r);0<=i&&(reported.splice(i,1),logInfo("Handled previous rejection ["+r.id+"] "+format.formatObject(r.value)))}function enqueue(f,x){tasks.push(f,x),null===running&&(running=setTimer(flush,0))}function flush(){for(running=null;0<tasks.length;)tasks.shift()(tasks.shift())}return Promise};function throwit(e){throw e}function noop(){}})}(function(factory){module.exports=factory(require)})},{"../env":333,"../format":334}],332:[function(require,module,exports){!function(define){"use strict";define(function(){return function(Promise){return Promise.prototype.with=Promise.prototype.withThis=function(receiver){var p=this._beget(),child=p._handler;return child.receiver=receiver,this._handler.chain(child,receiver),p},Promise}})}(function(factory){module.exports=factory()})},{}],333:[function(require,module,exports){(function(process){!function(define){"use strict";define(function(require){var MutationObs,capturedSetTimeout="undefined"!=typeof setTimeout&&setTimeout,setTimer=function(f,ms){return setTimeout(f,ms)},clearTimer=function(t){return clearTimeout(t)},asap=function(f){return capturedSetTimeout(f,0)};if(void 0!==process&&"[object process]"===Object.prototype.toString.call(process))asap=function(f){return process.nextTick(f)};else if(MutationObs="undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver)asap=function(MutationObserver){var scheduled,node=document.createTextNode("");new MutationObserver(function(){var f=scheduled;scheduled=void 0,f()}).observe(node,{characterData:!0});var i=0;return function(f){scheduled=f,node.data=i^=1}}(MutationObs);else if(!capturedSetTimeout){var vertx=require("vertx");setTimer=function(f,ms){return vertx.setTimer(ms,f)},clearTimer=vertx.cancelTimer,asap=vertx.runOnLoop||vertx.runOnContext}return{setTimer:setTimer,clearTimer:clearTimer,asap:asap}})}(function(factory){module.exports=factory(require)})}).call(this,require("_process"))},{_process:47}],334:[function(require,module,exports){!function(define){"use strict";define(function(){return{formatError:function(e){var s="object"==typeof e&&null!==e&&(e.stack||e.message)?e.stack||e.message:formatObject(e);return e instanceof Error?s:s+" (WARNING: non-Error used)"},formatObject:formatObject,tryStringify:tryStringify};function formatObject(o){var s=String(o);return"[object Object]"===s&&"undefined"!=typeof JSON&&(s=tryStringify(o,s)),s}function tryStringify(x,defaultValue){try{return JSON.stringify(x)}catch(e){return defaultValue}}})}(function(factory){module.exports=factory()})},{}],335:[function(require,module,exports){(function(process){!function(define){"use strict";define(function(){return function(environment){var tasks=environment.scheduler,emitRejection=function(){{if(null!=process&&"function"==typeof process.emit)return function(type,rejection){return"unhandledRejection"===type?process.emit(type,rejection.value,rejection):process.emit(type,rejection)};if("undefined"!=typeof self&&function(){if("function"==typeof CustomEvent)try{var ev=new CustomEvent("unhandledRejection");return ev instanceof CustomEvent}catch(ignoredException){}return!1}())return function(self,CustomEvent){return function(type,rejection){var ev=new CustomEvent(type,{detail:{reason:rejection.value,key:rejection},bubbles:!1,cancelable:!0});return!self.dispatchEvent(ev)}}(self,CustomEvent);if("undefined"!=typeof self&&function(){if("undefined"!=typeof document&&"function"==typeof document.createEvent)try{var ev=document.createEvent("CustomEvent");return ev.initCustomEvent("eventType",!1,!0,{}),!0}catch(ignoredException){}return!1}())return function(self,document){return function(type,rejection){var ev=document.createEvent("CustomEvent");return ev.initCustomEvent(type,!1,!0,{reason:rejection.value,key:rejection}),!self.dispatchEvent(ev)}}(self,document)}return noop}(),objectCreate=Object.create||function(proto){function Child(){}return Child.prototype=proto,new Child};function Promise(resolver,handler){this._handler=resolver===Handler?handler:function(resolver){var handler=new Pending;try{resolver(function(x){handler.resolve(x)},promiseReject,function(x){handler.notify(x)})}catch(e){promiseReject(e)}return handler;function promiseReject(reason){handler.reject(reason)}}(resolver)}function resolve(x){return isPromise(x)?x:new Promise(Handler,new Async(getHandler(x)))}function reject(x){return new Promise(Handler,new Async(new Rejected(x)))}function never(){return foreverPendingPromise}function traverseWith(tryMap,f,promises){for(var x,handler="function"==typeof f?function(i,x,resolver){resolver.resolved||traverseAt(promises,settleAt,i,tryMap(f,x,i),resolver)}:settleAt,resolver=new Pending,pending=promises.length>>>0,results=new Array(pending),i=0;i<promises.length&&!resolver.resolved;++i)void 0!==(x=promises[i])||i in promises?traverseAt(promises,handler,i,x,resolver):--pending;return 0===pending&&resolver.become(new Fulfilled(results)),new Promise(Handler,resolver);function settleAt(i,x,resolver){results[i]=x,0==--pending&&resolver.become(new Fulfilled(results))}}function traverseAt(promises,handler,i,x,resolver){if(maybeThenable(x)){var h=function(x){return isPromise(x)?x._handler.join():getHandlerUntrusted(x)}(x),s=h.state();0===s?h.fold(handler,i,void 0,resolver):0<s?handler(i,h.value,resolver):(resolver.become(h),visitRemaining(promises,i+1,h))}else handler(i,x,resolver)}function visitRemaining(promises,start,handler){for(var i=start;i<promises.length;++i)markAsHandled(getHandler(promises[i]),handler)}function markAsHandled(h,handler){if(h!==handler){var s=h.state();0===s?h.visit(h,void 0,h._unreport):s<0&&h._unreport()}}function getHandler(x){return isPromise(x)?x._handler.join():maybeThenable(x)?getHandlerUntrusted(x):new Fulfilled(x)}function getHandlerUntrusted(x){try{var untrustedThen=x.then;return"function"==typeof untrustedThen?new Thenable(untrustedThen,x):new Fulfilled(x)}catch(e){return new Rejected(e)}}function Handler(){}function FailIfRejected(){}Promise.resolve=resolve,Promise.reject=reject,Promise.never=never,Promise._defer=function(){return new Promise(Handler,new Pending)},Promise._handler=getHandler,Promise.prototype.then=function(onFulfilled,onRejected,onProgress){var parent=this._handler,state=parent.join().state();if("function"!=typeof onFulfilled&&0<state||"function"!=typeof onRejected&&state<0)return new this.constructor(Handler,parent);var p=this._beget(),child=p._handler;return parent.chain(child,parent.receiver,onFulfilled,onRejected,onProgress),p},Promise.prototype.catch=function(onRejected){return this.then(void 0,onRejected)},Promise.prototype._beget=function(){return function(parent,Promise){var child=new Pending(parent.receiver,parent.join().context);return new Promise(Handler,child)}(this._handler,this.constructor)},Promise.all=function(promises){return traverseWith(snd,null,promises)},Promise.race=function(promises){return"object"==typeof promises&&null!==promises?0===promises.length?never():1===promises.length?resolve(promises[0]):function(promises){var i,x,h,resolver=new Pending;for(i=0;i<promises.length;++i)if(void 0!==(x=promises[i])||i in promises){if(0!==(h=getHandler(x)).state()){resolver.become(h),visitRemaining(promises,i+1,h);break}h.visit(resolver,resolver.resolve,resolver.reject)}return new Promise(Handler,resolver)}(promises):reject(new TypeError("non-iterable passed to race()"))},Promise._traverse=function(f,promises){return traverseWith(tryCatch2,f,promises)},Promise._visitRemaining=visitRemaining,Handler.prototype.when=Handler.prototype.become=Handler.prototype.notify=Handler.prototype.fail=Handler.prototype._unreport=Handler.prototype._report=noop,Handler.prototype._state=0,Handler.prototype.state=function(){return this._state},Handler.prototype.join=function(){for(var h=this;void 0!==h.handler;)h=h.handler;return h},Handler.prototype.chain=function(to,receiver,fulfilled,rejected,progress){this.when({resolver:to,receiver:receiver,fulfilled:fulfilled,rejected:rejected,progress:progress})},Handler.prototype.visit=function(receiver,fulfilled,rejected,progress){this.chain(failIfRejected,receiver,fulfilled,rejected,progress)},Handler.prototype.fold=function(f,z,c,to){this.when(new Fold(f,z,c,to))},inherit(Handler,FailIfRejected),FailIfRejected.prototype.become=function(h){h.fail()};var failIfRejected=new FailIfRejected;function Pending(receiver,inheritedContext){Promise.createContext(this,inheritedContext),this.consumers=void 0,this.receiver=receiver,this.handler=void 0,this.resolved=!1}function Async(handler){this.handler=handler}function Thenable(then,thenable){Pending.call(this),tasks.enqueue(new AssimilateTask(then,thenable,this))}function Fulfilled(x){Promise.createContext(this),this.value=x}inherit(Handler,Pending),Pending.prototype._state=0,Pending.prototype.resolve=function(x){this.become(getHandler(x))},Pending.prototype.reject=function(x){this.resolved||this.become(new Rejected(x))},Pending.prototype.join=function(){if(!this.resolved)return this;for(var h=this;void 0!==h.handler;)if((h=h.handler)===this)return this.handler=new Rejected(new TypeError("Promise cycle"));return h},Pending.prototype.run=function(){var q=this.consumers,handler=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var i=0;i<q.length;++i)handler.when(q[i])},Pending.prototype.become=function(handler){this.resolved||(this.resolved=!0,this.handler=handler,void 0!==this.consumers&&tasks.enqueue(this),void 0!==this.context&&handler._report(this.context))},Pending.prototype.when=function(continuation){this.resolved?tasks.enqueue(new ContinuationTask(continuation,this.handler)):void 0===this.consumers?this.consumers=[continuation]:this.consumers.push(continuation)},Pending.prototype.notify=function(x){this.resolved||tasks.enqueue(new ProgressTask(x,this))},Pending.prototype.fail=function(context){var c=void 0===context?this.context:context;this.resolved&&this.handler.join().fail(c)},Pending.prototype._report=function(context){this.resolved&&this.handler.join()._report(context)},Pending.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},inherit(Handler,Async),Async.prototype.when=function(continuation){tasks.enqueue(new ContinuationTask(continuation,this))},Async.prototype._report=function(context){this.join()._report(context)},Async.prototype._unreport=function(){this.join()._unreport()},inherit(Pending,Thenable),inherit(Handler,Fulfilled),Fulfilled.prototype._state=1,Fulfilled.prototype.fold=function(f,z,c,to){!function(f,x,h,receiver,next){if("function"!=typeof f)return next.become(h);Promise.enterContext(h),function(f,x,y,thisArg,next){try{f.call(thisArg,x,y,next)}catch(e){next.become(new Rejected(e))}}(f,x,h.value,receiver,next),Promise.exitContext()}(f,z,this,c,to)},Fulfilled.prototype.when=function(cont){runContinuation1(cont.fulfilled,this,cont.receiver,cont.resolver)};var errorId=0;function Rejected(x){Promise.createContext(this),this.id=++errorId,this.value=x,this.handled=!1,this.reported=!1,this._report()}function ReportTask(rejection,context){this.rejection=rejection,this.context=context}function UnreportTask(rejection){this.rejection=rejection}inherit(Handler,Rejected),Rejected.prototype._state=-1,Rejected.prototype.fold=function(f,z,c,to){to.become(this)},Rejected.prototype.when=function(cont){"function"==typeof cont.rejected&&this._unreport(),runContinuation1(cont.rejected,this,cont.receiver,cont.resolver)},Rejected.prototype._report=function(context){tasks.afterQueue(new ReportTask(this,context))},Rejected.prototype._unreport=function(){this.handled||(this.handled=!0,tasks.afterQueue(new UnreportTask(this)))},Rejected.prototype.fail=function(context){this.reported=!0,emitRejection("unhandledRejection",this),Promise.onFatalRejection(this,void 0===context?this.context:context)},ReportTask.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,emitRejection("unhandledRejection",this.rejection)||Promise.onPotentiallyUnhandledRejection(this.rejection,this.context))},UnreportTask.prototype.run=function(){this.rejection.reported&&(emitRejection("rejectionHandled",this.rejection)||Promise.onPotentiallyUnhandledRejectionHandled(this.rejection))},Promise.createContext=Promise.enterContext=Promise.exitContext=Promise.onPotentiallyUnhandledRejection=Promise.onPotentiallyUnhandledRejectionHandled=Promise.onFatalRejection=noop;var foreverPendingHandler=new Handler,foreverPendingPromise=new Promise(Handler,foreverPendingHandler);function ContinuationTask(continuation,handler){this.continuation=continuation,this.handler=handler}function ProgressTask(value,handler){this.handler=handler,this.value=value}function AssimilateTask(then,thenable,resolver){this._then=then,this.thenable=thenable,this.resolver=resolver}function Fold(f,z,c,to){this.f=f,this.z=z,this.c=c,this.to=to,this.resolver=failIfRejected,this.receiver=this}function isPromise(x){return x instanceof Promise}function maybeThenable(x){return("object"==typeof x||"function"==typeof x)&&null!==x}function runContinuation1(f,h,receiver,next){if("function"!=typeof f)return next.become(h);Promise.enterContext(h),function(f,x,thisArg,next){try{next.become(getHandler(f.call(thisArg,x)))}catch(e){next.become(new Rejected(e))}}(f,h.value,receiver,next),Promise.exitContext()}function runNotify(f,x,h,receiver,next){if("function"!=typeof f)return next.notify(x);Promise.enterContext(h),function(f,x,thisArg,next){try{next.notify(f.call(thisArg,x))}catch(e){next.notify(e)}}(f,x,receiver,next),Promise.exitContext()}function tryCatch2(f,a,b){try{return f(a,b)}catch(e){return reject(e)}}function inherit(Parent,Child){Child.prototype=objectCreate(Parent.prototype),Child.prototype.constructor=Child}function snd(x,y){return y}function noop(){}return ContinuationTask.prototype.run=function(){this.handler.join().when(this.continuation)},ProgressTask.prototype.run=function(){var q=this.handler.consumers;if(void 0!==q)for(var c,i=0;i<q.length;++i)runNotify((c=q[i]).progress,this.value,this.handler,c.receiver,c.resolver)},AssimilateTask.prototype.run=function(){var h=this.resolver;!function(then,thenable,resolve,reject,notify){try{then.call(thenable,resolve,reject,notify)}catch(e){reject(e)}}(this._then,this.thenable,function(x){h.resolve(x)},function(x){h.reject(x)},function(x){h.notify(x)})},Fold.prototype.fulfilled=function(x){this.f.call(this.c,this.z,x,this.to)},Fold.prototype.rejected=function(x){this.to.reject(x)},Fold.prototype.progress=function(x){this.to.notify(x)},Promise}})}(function(factory){module.exports=factory()})}).call(this,require("_process"))},{_process:47}],336:[function(require,module,exports){!function(define){"use strict";define(function(){return{pending:toPendingState,fulfilled:toFulfilledState,rejected:toRejectedState,inspect:function(handler){var state=handler.state();return 0===state?{state:"pending"}:0<state?toFulfilledState(handler.value):toRejectedState(handler.value)}};function toPendingState(){return{state:"pending"}}function toRejectedState(e){return{state:"rejected",reason:e}}function toFulfilledState(x){return{state:"fulfilled",value:x}}})}(function(factory){module.exports=factory()})},{}],337:[function(require,module,exports){!function(define){"use strict";define(function(require){var timed=require("./lib/decorators/timed"),array=require("./lib/decorators/array"),flow=require("./lib/decorators/flow"),fold=require("./lib/decorators/fold"),inspect=require("./lib/decorators/inspect"),generate=require("./lib/decorators/iterate"),progress=require("./lib/decorators/progress"),withThis=require("./lib/decorators/with"),unhandledRejection=require("./lib/decorators/unhandledRejection"),TimeoutError=require("./lib/TimeoutError"),Promise=[array,flow,fold,generate,progress,inspect,withThis,timed,unhandledRejection].reduce(function(Promise,feature){return feature(Promise)},require("./lib/Promise")),apply=require("./lib/apply")(Promise);function when(x,onFulfilled,onRejected,onProgress){var p=Promise.resolve(x);return arguments.length<2?p:p.then(onFulfilled,onRejected,onProgress)}function lift(f){return function(){for(var i=0,l=arguments.length,a=new Array(l);i<l;++i)a[i]=arguments[i];return apply(f,this,a)}}function attempt(f){for(var i=0,l=arguments.length-1,a=new Array(l);i<l;++i)a[i]=arguments[i+1];return apply(f,this,a)}function Deferred(){var p=Promise._defer();function resolve(x){p._handler.resolve(x)}function reject(x){p._handler.reject(x)}function notify(x){p._handler.notify(x)}this.promise=p,this.resolve=resolve,this.reject=reject,this.notify=notify,this.resolver={resolve:resolve,reject:reject,notify:notify}}return when.promise=function(resolver){return new Promise(resolver)},when.resolve=Promise.resolve,when.reject=Promise.reject,when.lift=lift,when.try=attempt,when.attempt=attempt,when.iterate=Promise.iterate,when.unfold=Promise.unfold,when.join=function(){return Promise.all(arguments)},when.all=function(promises){return when(promises,Promise.all)},when.settle=function(promises){return when(promises,Promise.settle)},when.any=lift(Promise.any),when.some=lift(Promise.some),when.race=lift(Promise.race),when.map=function(promises,mapFunc){return when(promises,function(promises){return Promise.map(promises,mapFunc)})},when.filter=function(promises,predicate){return when(promises,function(promises){return Promise.filter(promises,predicate)})},when.reduce=lift(Promise.reduce),when.reduceRight=lift(Promise.reduceRight),when.isPromiseLike=function(x){return x&&"function"==typeof x.then},when.Promise=Promise,when.defer=function(){return new Deferred},when.TimeoutError=TimeoutError,when})}(function(factory){module.exports=factory(require)})},{"./lib/Promise":320,"./lib/TimeoutError":322,"./lib/apply":323,"./lib/decorators/array":324,"./lib/decorators/flow":325,"./lib/decorators/fold":326,"./lib/decorators/inspect":327,"./lib/decorators/iterate":328,"./lib/decorators/progress":329,"./lib/decorators/timed":330,"./lib/decorators/unhandledRejection":331,"./lib/decorators/with":332}],338:[function(require,module,exports){var nativeIsArray=Array.isArray,toString=Object.prototype.toString;module.exports=nativeIsArray||function(obj){return"[object Array]"===toString.call(obj)}},{}],339:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),zenObservable_1=require("./zenObservable");tslib_1.__exportStar(require("./zenObservable"),exports),exports.default=zenObservable_1.Observable},{"./zenObservable":340,tslib:291}],340:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var zen_observable_1=require("tslib").__importDefault(require("zen-observable"));exports.Observable=zen_observable_1.default},{tslib:291,"zen-observable":341}],341:[function(require,module,exports){module.exports=require("./lib/Observable.js").Observable},{"./lib/Observable.js":342}],342:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var hasSymbols=function(){return"function"==typeof Symbol},hasSymbol=function(name){return hasSymbols()&&Boolean(Symbol[name])},getSymbol=function(name){return hasSymbol(name)?Symbol[name]:"@@"+name};hasSymbols()&&!hasSymbol("observable")&&(Symbol.observable=Symbol("observable"));var SymbolIterator=getSymbol("iterator"),SymbolObservable=getSymbol("observable"),SymbolSpecies=getSymbol("species");function getMethod(obj,key){var value=obj[key];if(null!=value){if("function"!=typeof value)throw new TypeError(value+" is not a function");return value}}function getSpecies(obj){var ctor=obj.constructor;return void 0!==ctor&&null===(ctor=ctor[SymbolSpecies])&&(ctor=void 0),void 0!==ctor?ctor:Observable}function isObservable(x){return x instanceof Observable}function hostReportError(e){hostReportError.log?hostReportError.log(e):setTimeout(function(){throw e})}function enqueue(fn){Promise.resolve().then(function(){try{fn()}catch(e){hostReportError(e)}})}function cleanupSubscription(subscription){var cleanup=subscription._cleanup;if(void 0!==cleanup&&(subscription._cleanup=void 0,cleanup))try{if("function"==typeof cleanup)cleanup();else{var unsubscribe=getMethod(cleanup,"unsubscribe");unsubscribe&&unsubscribe.call(cleanup)}}catch(e){hostReportError(e)}}function closeSubscription(subscription){subscription._observer=void 0,subscription._queue=void 0,subscription._state="closed"}function notifySubscription(subscription,type,value){subscription._state="running";var observer=subscription._observer;try{var m=getMethod(observer,type);switch(type){case"next":m&&m.call(observer,value);break;case"error":if(closeSubscription(subscription),!m)throw value;m.call(observer,value);break;case"complete":closeSubscription(subscription),m&&m.call(observer)}}catch(e){hostReportError(e)}"closed"===subscription._state?cleanupSubscription(subscription):"running"===subscription._state&&(subscription._state="ready")}function onNotify(subscription,type,value){if("closed"!==subscription._state){if("buffering"!==subscription._state)return"ready"!==subscription._state?(subscription._state="buffering",subscription._queue=[{type:type,value:value}],void enqueue(function(){return function(subscription){var queue=subscription._queue;if(queue){subscription._queue=void 0,subscription._state="ready";for(var i=0;i<queue.length&&(notifySubscription(subscription,queue[i].type,queue[i].value),"closed"!==subscription._state);++i);}}(subscription)})):void notifySubscription(subscription,type,value);subscription._queue.push({type:type,value:value})}}var Subscription=function(){function Subscription(observer,subscriber){_classCallCheck(this,Subscription),this._cleanup=void 0,this._observer=observer,this._queue=void 0,this._state="initializing";var subscriptionObserver=new SubscriptionObserver(this);try{this._cleanup=subscriber.call(void 0,subscriptionObserver)}catch(e){subscriptionObserver.error(e)}"initializing"===this._state&&(this._state="ready")}return _createClass(Subscription,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(closeSubscription(this),cleanupSubscription(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),Subscription}(),SubscriptionObserver=function(){function SubscriptionObserver(subscription){_classCallCheck(this,SubscriptionObserver),this._subscription=subscription}return _createClass(SubscriptionObserver,[{key:"next",value:function(value){onNotify(this._subscription,"next",value)}},{key:"error",value:function(value){onNotify(this._subscription,"error",value)}},{key:"complete",value:function(){onNotify(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),SubscriptionObserver}(),Observable=exports.Observable=function(){function Observable(subscriber){if(_classCallCheck(this,Observable),!(this instanceof Observable))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof subscriber)throw new TypeError("Observable initializer must be a function");this._subscriber=subscriber}return _createClass(Observable,[{key:"subscribe",value:function(observer){return"object"==typeof observer&&null!==observer||(observer={next:observer,error:arguments[1],complete:arguments[2]}),new Subscription(observer,this._subscriber)}},{key:"forEach",value:function(fn){var _this=this;return new Promise(function(resolve,reject){if("function"==typeof fn)var subscription=_this.subscribe({next:function(value){try{fn(value,done)}catch(e){reject(e),subscription.unsubscribe()}},error:reject,complete:resolve});else reject(new TypeError(fn+" is not a function"));function done(){subscription.unsubscribe(),resolve()}})}},{key:"map",value:function(fn){var _this2=this;if("function"!=typeof fn)throw new TypeError(fn+" is not a function");return new(getSpecies(this))(function(observer){return _this2.subscribe({next:function(value){try{value=fn(value)}catch(e){return observer.error(e)}observer.next(value)},error:function(e){observer.error(e)},complete:function(){observer.complete()}})})}},{key:"filter",value:function(fn){var _this3=this;if("function"!=typeof fn)throw new TypeError(fn+" is not a function");return new(getSpecies(this))(function(observer){return _this3.subscribe({next:function(value){try{if(!fn(value))return}catch(e){return observer.error(e)}observer.next(value)},error:function(e){observer.error(e)},complete:function(){observer.complete()}})})}},{key:"reduce",value:function(fn){var _this4=this;if("function"!=typeof fn)throw new TypeError(fn+" is not a function");var C=getSpecies(this),hasSeed=1<arguments.length,hasValue=!1,acc=arguments[1];return new C(function(observer){return _this4.subscribe({next:function(value){var first=!hasValue;if(hasValue=!0,!first||hasSeed)try{acc=fn(acc,value)}catch(e){return observer.error(e)}else acc=value},error:function(e){observer.error(e)},complete:function(){if(!hasValue&&!hasSeed)return observer.error(new TypeError("Cannot reduce an empty sequence"));observer.next(acc),observer.complete()}})})}},{key:"concat",value:function(){for(var _this5=this,_len=arguments.length,sources=Array(_len),_key=0;_key<_len;_key++)sources[_key]=arguments[_key];var C=getSpecies(this);return new C(function(observer){var subscription=void 0,index=0;return function startNext(next){subscription=next.subscribe({next:function(v){observer.next(v)},error:function(e){observer.error(e)},complete:function(){index===sources.length?(subscription=void 0,observer.complete()):startNext(C.from(sources[index++]))}})}(_this5),function(){subscription&&(subscription.unsubscribe(),subscription=void 0)}})}},{key:"flatMap",value:function(fn){var _this6=this;if("function"!=typeof fn)throw new TypeError(fn+" is not a function");var C=getSpecies(this);return new C(function(observer){var subscriptions=[],outer=_this6.subscribe({next:function(value){if(fn)try{value=fn(value)}catch(e){return observer.error(e)}var inner=C.from(value).subscribe({next:function(value){observer.next(value)},error:function(e){observer.error(e)},complete:function(){var i=subscriptions.indexOf(inner);0<=i&&subscriptions.splice(i,1),completeIfDone()}});subscriptions.push(inner)},error:function(e){observer.error(e)},complete:function(){completeIfDone()}});function completeIfDone(){outer.closed&&0===subscriptions.length&&observer.complete()}return function(){subscriptions.forEach(function(s){return s.unsubscribe()}),outer.unsubscribe()}})}},{key:SymbolObservable,value:function(){return this}}],[{key:"from",value:function(x){var C="function"==typeof this?this:Observable;if(null==x)throw new TypeError(x+" is not an object");var method=getMethod(x,SymbolObservable);if(method){var observable=method.call(x);if(Object(observable)!==observable)throw new TypeError(observable+" is not an object");return isObservable(observable)&&observable.constructor===C?observable:new C(function(observer){return observable.subscribe(observer)})}if(hasSymbol("iterator")&&(method=getMethod(x,SymbolIterator)))return new C(function(observer){enqueue(function(){if(!observer.closed){var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=method.call(x)[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var item=_step.value;if(observer.next(item),observer.closed)return}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{!_iteratorNormalCompletion&&_iterator.return&&_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}observer.complete()}})});if(Array.isArray(x))return new C(function(observer){enqueue(function(){if(!observer.closed){for(var i=0;i<x.length;++i)if(observer.next(x[i]),observer.closed)return;observer.complete()}})});throw new TypeError(x+" is not observable")}},{key:"of",value:function(){for(var _len2=arguments.length,items=Array(_len2),_key2=0;_key2<_len2;_key2++)items[_key2]=arguments[_key2];return new("function"==typeof this?this:Observable)(function(observer){enqueue(function(){if(!observer.closed){for(var i=0;i<items.length;++i)if(observer.next(items[i]),observer.closed)return;observer.complete()}})})}},{key:SymbolSpecies,get:function(){return this}}]),Observable}();hasSymbols()&&Object.defineProperty(Observable,Symbol("extensions"),{value:{symbol:SymbolObservable,hostReportError:hostReportError},configurable:!0})},{}],343:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("./component/Component");exports.Component=Component_1.Component;var ComponentService_1=require("./component/ComponentService");exports.ComponentService=ComponentService_1.ComponentService;var HandlerBase_1=require("./component/utils/HandlerBase");exports.HandlerBase=HandlerBase_1.HandlerBase;var BackgroundComponent_1=require("./component/BackgroundComponent");exports.BackgroundComponent=BackgroundComponent_1.BackgroundComponent;var BearingComponent_1=require("./component/BearingComponent");exports.BearingComponent=BearingComponent_1.BearingComponent;var CacheComponent_1=require("./component/CacheComponent");exports.CacheComponent=CacheComponent_1.CacheComponent;var CoverComponent_1=require("./component/CoverComponent");exports.CoverComponent=CoverComponent_1.CoverComponent;var DebugComponent_1=require("./component/DebugComponent");exports.DebugComponent=DebugComponent_1.DebugComponent;var DirectionComponent_1=require("./component/direction/DirectionComponent");exports.DirectionComponent=DirectionComponent_1.DirectionComponent;var DirectionDOMCalculator_1=require("./component/direction/DirectionDOMCalculator");exports.DirectionDOMCalculator=DirectionDOMCalculator_1.DirectionDOMCalculator;var DirectionDOMRenderer_1=require("./component/direction/DirectionDOMRenderer");exports.DirectionDOMRenderer=DirectionDOMRenderer_1.DirectionDOMRenderer;var ImageComponent_1=require("./component/ImageComponent");exports.ImageComponent=ImageComponent_1.ImageComponent;var KeyboardComponent_1=require("./component/keyboard/KeyboardComponent");exports.KeyboardComponent=KeyboardComponent_1.KeyboardComponent;var KeyZoomHandler_1=require("./component/keyboard/KeyZoomHandler");exports.KeyZoomHandler=KeyZoomHandler_1.KeyZoomHandler;var KeySequenceNavigationHandler_1=require("./component/keyboard/KeySequenceNavigationHandler");exports.KeySequenceNavigationHandler=KeySequenceNavigationHandler_1.KeySequenceNavigationHandler;var KeySpatialNavigationHandler_1=require("./component/keyboard/KeySpatialNavigationHandler");exports.KeySpatialNavigationHandler=KeySpatialNavigationHandler_1.KeySpatialNavigationHandler;var LoadingComponent_1=require("./component/LoadingComponent");exports.LoadingComponent=LoadingComponent_1.LoadingComponent;var Marker_1=require("./component/marker/marker/Marker");exports.Marker=Marker_1.Marker;var MarkerComponent_1=require("./component/marker/MarkerComponent");exports.MarkerComponent=MarkerComponent_1.MarkerComponent;var MarkerScene_1=require("./component/marker/MarkerScene");exports.MarkerScene=MarkerScene_1.MarkerScene;var MarkerSet_1=require("./component/marker/MarkerSet");exports.MarkerSet=MarkerSet_1.MarkerSet;var MouseComponent_1=require("./component/mouse/MouseComponent");exports.MouseComponent=MouseComponent_1.MouseComponent;var BounceHandler_1=require("./component/mouse/BounceHandler");exports.BounceHandler=BounceHandler_1.BounceHandler;var DragPanHandler_1=require("./component/mouse/DragPanHandler");exports.DragPanHandler=DragPanHandler_1.DragPanHandler;var DoubleClickZoomHandler_1=require("./component/mouse/DoubleClickZoomHandler");exports.DoubleClickZoomHandler=DoubleClickZoomHandler_1.DoubleClickZoomHandler;var ScrollZoomHandler_1=require("./component/mouse/ScrollZoomHandler");exports.ScrollZoomHandler=ScrollZoomHandler_1.ScrollZoomHandler;var TouchZoomHandler_1=require("./component/mouse/TouchZoomHandler");exports.TouchZoomHandler=TouchZoomHandler_1.TouchZoomHandler;var Popup_1=require("./component/popup/popup/Popup");exports.Popup=Popup_1.Popup;var PopupComponent_1=require("./component/popup/PopupComponent");exports.PopupComponent=PopupComponent_1.PopupComponent;var NavigationComponent_1=require("./component/NavigationComponent");exports.NavigationComponent=NavigationComponent_1.NavigationComponent;var RouteComponent_1=require("./component/RouteComponent");exports.RouteComponent=RouteComponent_1.RouteComponent;var SequenceComponent_1=require("./component/sequence/SequenceComponent");exports.SequenceComponent=SequenceComponent_1.SequenceComponent;var SequenceDOMRenderer_1=require("./component/sequence/SequenceDOMRenderer");exports.SequenceDOMRenderer=SequenceDOMRenderer_1.SequenceDOMRenderer;var SequenceDOMInteraction_1=require("./component/sequence/SequenceDOMInteraction");exports.SequenceDOMInteraction=SequenceDOMInteraction_1.SequenceDOMInteraction;var ImagePlaneComponent_1=require("./component/imageplane/ImagePlaneComponent");exports.ImagePlaneComponent=ImagePlaneComponent_1.ImagePlaneComponent;var ImagePlaneFactory_1=require("./component/imageplane/ImagePlaneFactory");exports.ImagePlaneFactory=ImagePlaneFactory_1.ImagePlaneFactory;var ImagePlaneGLRenderer_1=require("./component/imageplane/ImagePlaneGLRenderer");exports.ImagePlaneGLRenderer=ImagePlaneGLRenderer_1.ImagePlaneGLRenderer;var ImagePlaneScene_1=require("./component/imageplane/ImagePlaneScene");exports.ImagePlaneScene=ImagePlaneScene_1.ImagePlaneScene;var ImagePlaneShaders_1=require("./component/imageplane/ImagePlaneShaders");exports.ImagePlaneShaders=ImagePlaneShaders_1.ImagePlaneShaders;var SimpleMarker_1=require("./component/marker/marker/SimpleMarker");exports.SimpleMarker=SimpleMarker_1.SimpleMarker;var CircleMarker_1=require("./component/marker/marker/CircleMarker");exports.CircleMarker=CircleMarker_1.CircleMarker;var SliderComponent_1=require("./component/imageplane/SliderComponent");exports.SliderComponent=SliderComponent_1.SliderComponent;var PathComponent_1=require("./component/path/PathComponent");exports.PathComponent=PathComponent_1.PathComponent;var TagHandlerBase_1=require("./component/tag/handlers/TagHandlerBase");exports.TagHandlerBase=TagHandlerBase_1.TagHandlerBase;var CreateHandlerBase_1=require("./component/tag/handlers/CreateHandlerBase");exports.CreateHandlerBase=CreateHandlerBase_1.CreateHandlerBase;var CreatePointHandler_1=require("./component/tag/handlers/CreatePointHandler");exports.CreatePointHandler=CreatePointHandler_1.CreatePointHandler;var CreateVertexHandler_1=require("./component/tag/handlers/CreateVertexHandler");exports.CreateVertexHandler=CreateVertexHandler_1.CreateVertexHandler;var CreatePolygonHandler_1=require("./component/tag/handlers/CreatePolygonHandler");exports.CreatePolygonHandler=CreatePolygonHandler_1.CreatePolygonHandler;var CreateRectHandler_1=require("./component/tag/handlers/CreateRectHandler");exports.CreateRectHandler=CreateRectHandler_1.CreateRectHandler;var CreateRectDragHandler_1=require("./component/tag/handlers/CreateRectDragHandler");exports.CreateRectDragHandler=CreateRectDragHandler_1.CreateRectDragHandler;var EditVertexHandler_1=require("./component/tag/handlers/EditVertexHandler");exports.EditVertexHandler=EditVertexHandler_1.EditVertexHandler;var Tag_1=require("./component/tag/tag/Tag");exports.Tag=Tag_1.Tag;var OutlineTag_1=require("./component/tag/tag/OutlineTag");exports.OutlineTag=OutlineTag_1.OutlineTag;var RenderTag_1=require("./component/tag/tag/RenderTag");exports.RenderTag=RenderTag_1.RenderTag;var OutlineRenderTag_1=require("./component/tag/tag/OutlineRenderTag");exports.OutlineRenderTag=OutlineRenderTag_1.OutlineRenderTag;var OutlineCreateTag_1=require("./component/tag/tag/OutlineCreateTag");exports.OutlineCreateTag=OutlineCreateTag_1.OutlineCreateTag;var SpotTag_1=require("./component/tag/tag/SpotTag");exports.SpotTag=SpotTag_1.SpotTag;var SpotRenderTag_1=require("./component/tag/tag/SpotRenderTag");exports.SpotRenderTag=SpotRenderTag_1.SpotRenderTag;var TagComponent_1=require("./component/tag/TagComponent");exports.TagComponent=TagComponent_1.TagComponent;var TagCreator_1=require("./component/tag/TagCreator");exports.TagCreator=TagCreator_1.TagCreator;var TagDOMRenderer_1=require("./component/tag/TagDOMRenderer");exports.TagDOMRenderer=TagDOMRenderer_1.TagDOMRenderer;var TagMode_1=require("./component/tag/TagMode");exports.TagMode=TagMode_1.TagMode;var TagOperation_1=require("./component/tag/TagOperation");exports.TagOperation=TagOperation_1.TagOperation;var TagScene_1=require("./component/tag/TagScene");exports.TagScene=TagScene_1.TagScene;var TagSet_1=require("./component/tag/TagSet");exports.TagSet=TagSet_1.TagSet;var Geometry_1=require("./component/tag/geometry/Geometry");exports.Geometry=Geometry_1.Geometry;var VertexGeometry_1=require("./component/tag/geometry/VertexGeometry");exports.VertexGeometry=VertexGeometry_1.VertexGeometry;var RectGeometry_1=require("./component/tag/geometry/RectGeometry");exports.RectGeometry=RectGeometry_1.RectGeometry;var PointGeometry_1=require("./component/tag/geometry/PointGeometry");exports.PointGeometry=PointGeometry_1.PointGeometry;var PolygonGeometry_1=require("./component/tag/geometry/PolygonGeometry");exports.PolygonGeometry=PolygonGeometry_1.PolygonGeometry;var GeometryTagError_1=require("./component/tag/error/GeometryTagError");exports.GeometryTagError=GeometryTagError_1.GeometryTagError,function(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}(require("./component/interfaces/interfaces"))},{"./component/BackgroundComponent":359,"./component/BearingComponent":360,"./component/CacheComponent":361,"./component/Component":362,"./component/ComponentService":363,"./component/CoverComponent":364,"./component/DebugComponent":365,"./component/ImageComponent":366,"./component/LoadingComponent":367,"./component/NavigationComponent":368,"./component/RouteComponent":369,"./component/direction/DirectionComponent":370,"./component/direction/DirectionDOMCalculator":371,"./component/direction/DirectionDOMRenderer":372,"./component/imageplane/ImagePlaneComponent":373,"./component/imageplane/ImagePlaneFactory":374,"./component/imageplane/ImagePlaneGLRenderer":375,"./component/imageplane/ImagePlaneScene":376,"./component/imageplane/ImagePlaneShaders":377,"./component/imageplane/SliderComponent":378,"./component/interfaces/interfaces":380,"./component/keyboard/KeySequenceNavigationHandler":381,"./component/keyboard/KeySpatialNavigationHandler":382,"./component/keyboard/KeyZoomHandler":383,"./component/keyboard/KeyboardComponent":384,"./component/marker/MarkerComponent":386,"./component/marker/MarkerScene":387,"./component/marker/MarkerSet":388,"./component/marker/marker/CircleMarker":390,"./component/marker/marker/Marker":392,"./component/marker/marker/SimpleMarker":393,"./component/mouse/BounceHandler":394,"./component/mouse/DoubleClickZoomHandler":395,"./component/mouse/DragPanHandler":396,"./component/mouse/MouseComponent":397,"./component/mouse/ScrollZoomHandler":398,"./component/mouse/TouchZoomHandler":399,"./component/path/PathComponent":400,"./component/popup/PopupComponent":405,"./component/popup/popup/Popup":406,"./component/sequence/SequenceComponent":407,"./component/sequence/SequenceDOMInteraction":408,"./component/sequence/SequenceDOMRenderer":409,"./component/tag/TagComponent":411,"./component/tag/TagCreator":412,"./component/tag/TagDOMRenderer":413,"./component/tag/TagMode":414,"./component/tag/TagOperation":415,"./component/tag/TagScene":416,"./component/tag/TagSet":417,"./component/tag/error/GeometryTagError":418,"./component/tag/geometry/Geometry":419,"./component/tag/geometry/PointGeometry":420,"./component/tag/geometry/PolygonGeometry":421,"./component/tag/geometry/RectGeometry":422,"./component/tag/geometry/VertexGeometry":423,"./component/tag/handlers/CreateHandlerBase":424,"./component/tag/handlers/CreatePointHandler":425,"./component/tag/handlers/CreatePolygonHandler":426,"./component/tag/handlers/CreateRectDragHandler":427,"./component/tag/handlers/CreateRectHandler":428,"./component/tag/handlers/CreateVertexHandler":429,"./component/tag/handlers/EditVertexHandler":430,"./component/tag/handlers/TagHandlerBase":431,"./component/tag/tag/OutlineCreateTag":432,"./component/tag/tag/OutlineRenderTag":433,"./component/tag/tag/OutlineTag":434,"./component/tag/tag/RenderTag":435,"./component/tag/tag/SpotRenderTag":436,"./component/tag/tag/SpotTag":437,"./component/tag/tag/Tag":438,"./component/utils/HandlerBase":439}],344:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EdgeDirection_1=require("./graph/edge/EdgeDirection");exports.EdgeDirection=EdgeDirection_1.EdgeDirection;var EdgeCalculatorSettings_1=require("./graph/edge/EdgeCalculatorSettings");exports.EdgeCalculatorSettings=EdgeCalculatorSettings_1.EdgeCalculatorSettings;var EdgeCalculatorDirections_1=require("./graph/edge/EdgeCalculatorDirections");exports.EdgeCalculatorDirections=EdgeCalculatorDirections_1.EdgeCalculatorDirections;var EdgeCalculatorCoefficients_1=require("./graph/edge/EdgeCalculatorCoefficients");exports.EdgeCalculatorCoefficients=EdgeCalculatorCoefficients_1.EdgeCalculatorCoefficients;var EdgeCalculator_1=require("./graph/edge/EdgeCalculator");exports.EdgeCalculator=EdgeCalculator_1.EdgeCalculator},{"./graph/edge/EdgeCalculator":457,"./graph/edge/EdgeCalculatorCoefficients":458,"./graph/edge/EdgeCalculatorDirections":459,"./graph/edge/EdgeCalculatorSettings":460,"./graph/edge/EdgeDirection":461}],345:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ArgumentBeeviewError_1=require("./error/ArgumentBeeviewError");exports.ArgumentBeeviewError=ArgumentBeeviewError_1.ArgumentBeeviewError;var GraphBeeviewError_1=require("./error/GraphBeeviewError");exports.GraphBeeviewError=GraphBeeviewError_1.GraphBeeviewError;var BeeviewError_1=require("./error/BeeviewError");exports.BeeviewError=BeeviewError_1.BeeviewError},{"./error/ArgumentBeeviewError":440,"./error/BeeviewError":441,"./error/GraphBeeviewError":442}],346:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Camera_1=require("./geo/Camera");exports.Camera=Camera_1.Camera;var GeoCoords_1=require("./geo/GeoCoords");exports.GeoCoords=GeoCoords_1.GeoCoords;var ViewportCoords_1=require("./geo/ViewportCoords");exports.ViewportCoords=ViewportCoords_1.ViewportCoords;var Spatial_1=require("./geo/Spatial");exports.Spatial=Spatial_1.Spatial;var Transform_1=require("./geo/Transform");exports.Transform=Transform_1.Transform},{"./geo/Camera":443,"./geo/GeoCoords":444,"./geo/Spatial":445,"./geo/Transform":446,"./geo/ViewportCoords":447}],347:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var FilterCreator_1=require("./graph/FilterCreator");exports.FilterCreator=FilterCreator_1.FilterCreator;var Graph_1=require("./graph/Graph");exports.Graph=Graph_1.Graph;var GraphCalculator_1=require("./graph/GraphCalculator");exports.GraphCalculator=GraphCalculator_1.GraphCalculator;var GraphService_1=require("./graph/GraphService");exports.GraphService=GraphService_1.GraphService;var ImageLoadingService_1=require("./graph/ImageLoadingService");exports.ImageLoadingService=ImageLoadingService_1.ImageLoadingService;var MeshReader_1=require("./graph/MeshReader");exports.MeshReader=MeshReader_1.MeshReader;var Node_1=require("./graph/Node");exports.Node=Node_1.Node;var NodeCache_1=require("./graph/NodeCache");exports.NodeCache=NodeCache_1.NodeCache;var Sequence_1=require("./graph/Sequence");exports.Sequence=Sequence_1.Sequence},{"./graph/FilterCreator":448,"./graph/Graph":449,"./graph/GraphCalculator":450,"./graph/GraphService":451,"./graph/ImageLoadingService":452,"./graph/MeshReader":453,"./graph/Node":454,"./graph/NodeCache":455,"./graph/Sequence":456}],348:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}(require("./Support"));var Edge_1=require("./Edge");exports.EdgeDirection=Edge_1.EdgeDirection;var Render_1=require("./Render");exports.RenderMode=Render_1.RenderMode;var Viewer_1=require("./Viewer");exports.Alignment=Viewer_1.Alignment,exports.ImageSize=Viewer_1.ImageSize,exports.Viewer=Viewer_1.Viewer;var TagComponent=require("./component/tag/Tag");exports.TagComponent=TagComponent;var MarkerComponent=require("./component/marker/Marker");exports.MarkerComponent=MarkerComponent;var PopupComponent=require("./component/popup/Popup");exports.PopupComponent=PopupComponent},{"./Edge":344,"./Render":349,"./Support":351,"./Viewer":354,"./component/marker/Marker":385,"./component/popup/Popup":404,"./component/tag/Tag":410}],349:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var DOMRenderer_1=require("./render/DOMRenderer");exports.DOMRenderer=DOMRenderer_1.DOMRenderer;var GLRenderer_1=require("./render/GLRenderer");exports.GLRenderer=GLRenderer_1.GLRenderer;var GLRenderStage_1=require("./render/GLRenderStage");exports.GLRenderStage=GLRenderStage_1.GLRenderStage;var RenderCamera_1=require("./render/RenderCamera");exports.RenderCamera=RenderCamera_1.RenderCamera;var RenderMode_1=require("./render/RenderMode");exports.RenderMode=RenderMode_1.RenderMode;var RenderService_1=require("./render/RenderService");exports.RenderService=RenderService_1.RenderService},{"./render/DOMRenderer":462,"./render/GLRenderStage":463,"./render/GLRenderer":464,"./render/RenderCamera":465,"./render/RenderMode":466,"./render/RenderService":467}],350:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var State_1=require("./state/State");exports.State=State_1.State;var StateBase_1=require("./state/states/StateBase");exports.StateBase=StateBase_1.StateBase;var StateContext_1=require("./state/StateContext");exports.StateContext=StateContext_1.StateContext;var StateService_1=require("./state/StateService");exports.StateService=StateService_1.StateService;var TraversingState_1=require("./state/states/TraversingState");exports.TraversingState=TraversingState_1.TraversingState;var WaitingState_1=require("./state/states/WaitingState");exports.WaitingState=WaitingState_1.WaitingState;var FrameGenerator_1=require("./state/FrameGenerator");exports.FrameGenerator=FrameGenerator_1.FrameGenerator},{"./state/FrameGenerator":468,"./state/State":469,"./state/StateContext":470,"./state/StateService":471,"./state/states/StateBase":472,"./state/states/TraversingState":473,"./state/states/WaitingState":474}],351:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var support=require("./utils/Support");function isFallbackSupported(){return support.isBrowser()&&support.isArraySupported()&&support.isFunctionSupported()&&support.isJSONSupported()&&support.isObjectSupported()}exports.isSupported=function(){return isFallbackSupported()&&support.isWebGLSupportedCached()},exports.isFallbackSupported=isFallbackSupported},{"./utils/Support":482}],352:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ImageTileLoader_1=require("./tiles/ImageTileLoader");exports.ImageTileLoader=ImageTileLoader_1.ImageTileLoader;var ImageTileStore_1=require("./tiles/ImageTileStore");exports.ImageTileStore=ImageTileStore_1.ImageTileStore;var TextureProvider_1=require("./tiles/TextureProvider");exports.TextureProvider=TextureProvider_1.TextureProvider;var RegionOfInterestCalculator_1=require("./tiles/RegionOfInterestCalculator");exports.RegionOfInterestCalculator=RegionOfInterestCalculator_1.RegionOfInterestCalculator},{"./tiles/ImageTileLoader":475,"./tiles/ImageTileStore":476,"./tiles/RegionOfInterestCalculator":477,"./tiles/TextureProvider":478}],353:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var DOM_1=require("./utils/DOM");exports.DOM=DOM_1.DOM;var EventEmitter_1=require("./utils/EventEmitter");exports.EventEmitter=EventEmitter_1.EventEmitter;var Settings_1=require("./utils/Settings");exports.Settings=Settings_1.Settings,function(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}(require("./utils/Support"));var Urls_1=require("./utils/Urls");exports.Urls=Urls_1.Urls},{"./utils/DOM":479,"./utils/EventEmitter":480,"./utils/Settings":481,"./utils/Support":482,"./utils/Urls":483}],354:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Alignment_1=require("./viewer/Alignment");exports.Alignment=Alignment_1.Alignment;var CacheService_1=require("./viewer/CacheService");exports.CacheService=CacheService_1.CacheService;var ComponentController_1=require("./viewer/ComponentController");exports.ComponentController=ComponentController_1.ComponentController;var Container_1=require("./viewer/Container");exports.Container=Container_1.Container;var Observer_1=require("./viewer/Observer");exports.Observer=Observer_1.Observer;var ImageSize_1=require("./viewer/ImageSize");exports.ImageSize=ImageSize_1.ImageSize;var KeyboardService_1=require("./viewer/KeyboardService");exports.KeyboardService=KeyboardService_1.KeyboardService;var LoadingService_1=require("./viewer/LoadingService");exports.LoadingService=LoadingService_1.LoadingService;var MouseService_1=require("./viewer/MouseService");exports.MouseService=MouseService_1.MouseService;var Navigator_1=require("./viewer/Navigator");exports.Navigator=Navigator_1.Navigator;var Projection_1=require("./viewer/Projection");exports.Projection=Projection_1.Projection;var SpriteService_1=require("./viewer/SpriteService");exports.SpriteService=SpriteService_1.SpriteService;var TouchService_1=require("./viewer/TouchService");exports.TouchService=TouchService_1.TouchService;var Viewer_1=require("./viewer/Viewer");exports.Viewer=Viewer_1.Viewer},{"./viewer/Alignment":484,"./viewer/CacheService":485,"./viewer/ComponentController":486,"./viewer/Container":487,"./viewer/ImageSize":488,"./viewer/KeyboardService":489,"./viewer/LoadingService":490,"./viewer/MouseService":491,"./viewer/Navigator":492,"./viewer/Observer":493,"./viewer/Projection":494,"./viewer/SpriteService":495,"./viewer/TouchService":496,"./viewer/Viewer":497}],355:[function(require,module,exports){"use strict";var __makeTemplateObject=this&&this.__makeTemplateObject||function(cooked,raw){return Object.defineProperty?Object.defineProperty(cooked,"raw",{value:raw}):cooked.raw=raw,cooked};Object.defineProperty(exports,"__esModule",{value:!0});var templateObject_1,templateObject_2,templateObject_3,templateObject_4,templateObject_5,templateObject_6,templateObject_7,templateObject_8,templateObject_9,templateObject_10,templateObject_11,rxjs_1=require("rxjs"),_=require("underscore"),GraphQLCreator_1=require("./GraphQLCreator"),apollo_boost_1=require("apollo-boost"),operators_1=require("rxjs/operators"),API=function(){function API(creator){this._modelCreator=null!=creator?creator:new GraphQLCreator_1.GraphQLCreator,this._model=this._modelCreator.createGraphQL(),this._minCount=0,this._maxCount=50,this._sequence="{\n key\n }",this._gpano="{\n CroppedAreaImageHeightPixels\n CroppedAreaImageWidthPixels\n CroppedAreaLeftPixels\n CroppedAreaTopPixels\n FullPanoHeightPixels\n FullPanoWidthPixels\n ProjectionType\n Software\n valid\n }",this._buildingName="{\n default\n en\n cn\n zh\n }",this._building="{\n id\n name "+this._buildingName+"\n }",this._floor="{\n id\n code\n sequence\n }",this._coordinate="{\n lat\n lon\n }",this._user="{\n username\n }",this._image="{\n key\n ca\n floor "+this._floor+"\n cl "+this._coordinate+"\n l "+this._coordinate+"\n }",this._queryImages="{\n key\n sequence "+this._sequence+"\n c_rotation\n c_translation\n cl "+this._coordinate+"\n l "+this._coordinate+"\n building "+this._building+"\n floor "+this._floor+"\n loop_line\n ca\n captured_at\n height\n width\n orientation\n merge_version\n gpano "+this._gpano+"\n merge_cc\n user "+this._user+"\n }",this._querySequences="{\n key\n keys\n }",this._queryOutdoorImages="{\n key\n outdoorImages "+this._image+"\n }",this._queryBuilding="{\n key\n images "+this._image+"\n }"}return API.prototype.imageByKeyFullForOutdoor$=function(keys){var query="{\n outdoorImages(keys: ["+keys.map(function(key){return'"'+(key?key.trim():"")+'"'})+"])\n "+this._queryImages+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_1||(templateObject_1=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){var result={};return value.data.outdoorImages.forEach(function(res){result[res.key]=res}),result}))},API.prototype.imageByKeyFull$=function(keys){var query="{\n images(keys: ["+keys.map(function(key){return'"'+(key?key.trim():"")+'"'})+"])\n "+this._queryImages+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_2||(templateObject_2=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){var result={};return value.data.images.forEach(function(res){result[res.key]=res}),result}))},API.prototype.imageByKeyFill$=function(keys){var query="{\n images(keys: ["+keys.map(function(key){return'"'+(key?key.trim():"")+'"'})+"])\n "+this._queryImages+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_3||(templateObject_3=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){var result={};return value.data.images.forEach(function(res){result[res.key]=res}),result}))},API.prototype.outdoorByBbox$=function(northEastLatLon,southWestLatLon){var query="{\n outdoorByBbox(\n ne_lat: "+northEastLatLon.lat+",\n ne_lon: "+northEastLatLon.lon+",\n sw_lat: "+southWestLatLon.lat+",\n sw_lon: "+southWestLatLon.lon+"\n )\n "+this._queryOutdoorImages+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_4||(templateObject_4=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){return value.data.outdoorByBbox}))},API.prototype.outdoorByLatLon$=function(l,distance){void 0===distance&&(distance=5e3);var query="{\n outdoor(from: "+this._minCount+", to: "+this._maxCount+", lat: "+l.lat+", lon: "+l.lon+", distance: "+distance+")\n "+this._queryOutdoorImages+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_5||(templateObject_5=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){return value.data.outdoor}))},API.prototype.outdoorImagesByKeys$=function(keys){var query="{\n outdoorImages(keys: ["+keys.map(function(key){return'"'+(key?key.trim():"")+'"'})+"])\n "+this._image+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_6||(templateObject_6=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){return value.data.outdoorImages}))},API.prototype.imagesByH$=function(h,l){var query="{\n imagesByH(from: "+this._minCount+", to: "+this._maxCount+", lat: "+l.lat+", lon: "+l.lon+")\n "+this._queryImages+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_7||(templateObject_7=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){var result={};return result[h]=value.data.imagesByH,result}))},API.prototype.imageCloseTo$=function(l,floorCode,buildingId,distance){var content="\n from: 0, to: 1,\n lat: "+l.lat+",\n lon: "+l.lon+',\n floorCode: "'+floorCode+'"\n ';buildingId&&(content+=', buildingId: "'+buildingId+'"'),distance&&(content+=", distance: "+distance);var query="{\n imagesByH("+content+") "+this._queryImages+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_8||(templateObject_8=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){return _.first(value.data.imagesByH)}))},API.prototype.buildingByKey$=function(key){var query='{\n building(key: "'+key+'")\n '+this._queryBuilding+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_9||(templateObject_9=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){return value.data.building}))},API.prototype.sequenceByKeyForOutdoor$=function(sequenceKeys){var query="{\n outdoorSequences(keys: ["+sequenceKeys.map(function(key){return'"'+key.trim()+'"'})+"])\n "+this._querySequences+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_10||(templateObject_10=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){var result={};return value.data.outdoorSequences.forEach(function(res){result[res.key]=res}),result}))},API.prototype.sequenceByKey$=function(sequenceKeys){var query="{\n sequences(keys: ["+sequenceKeys.map(function(key){return'"'+key.trim()+'"'})+"])\n "+this._querySequences+"\n }";return this._wrapPromise$(this._model.query({query:apollo_boost_1.gql(templateObject_11||(templateObject_11=__makeTemplateObject(["",""],["",""])),query)})).pipe(operators_1.map(function(value){var result={};return value.data.sequences.forEach(function(res){result[res.key]=res}),result}))},API.prototype._wrapPromise$=function(promise){return rxjs_1.defer(function(){return rxjs_1.from(promise)})},API}();exports.API=API,exports.default=API},{"./GraphQLCreator":358,"apollo-boost":3,rxjs:89,"rxjs/operators":285,underscore:292}],356:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var KeyPlatformEnum,axios_1=require("axios"),Urls_1=require("../utils/Urls"),AuthStore_1=require("./AuthStore");!function(KeyPlatformEnum){KeyPlatformEnum.WEB="WEB",KeyPlatformEnum.IOS="IOS",KeyPlatformEnum.ANDROID="ANDROID"}(KeyPlatformEnum=exports.KeyPlatformEnum||(exports.KeyPlatformEnum={}));var Auth=function(){function Auth(){}return Auth.prototype.applyToken=function(appId,secret,keyPlatform,authOption){var options;switch(keyPlatform){case KeyPlatformEnum.IOS:options={appId:appId,secret:secret,keyPlatform:keyPlatform,bundleId:authOption.bundleId};break;case KeyPlatformEnum.ANDROID:options={appId:appId,secret:secret,keyPlatform:keyPlatform,packageName:authOption.packageName,sha1:authOption.sha1};break;default:options={appId:appId,secret:secret,keyPlatform:keyPlatform||"WEB",origin:window.location.hostname}}return AuthStore_1.AuthStore.appId=appId,AuthStore_1.AuthStore.secret=secret,AuthStore_1.AuthStore.bundleId=authOption.bundleId,AuthStore_1.AuthStore.packageName=authOption.packageName,AuthStore_1.AuthStore.sha1=authOption.sha1,axios_1.default.post(Urls_1.default.authUrl,options)},Auth}();exports.Auth=Auth},{"../utils/Urls":483,"./AuthStore":357,axios:19}],357:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var AuthStore=function(){};exports.AuthStore=AuthStore},{}],358:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var apollo_link_http_1=require("apollo-link-http"),apollo_link_error_1=require("apollo-link-error"),apollo_client_1=require("apollo-client"),apollo_cache_inmemory_1=require("apollo-cache-inmemory"),apollo_link_1=require("apollo-link"),Utils_1=require("../Utils"),Auth_1=require("./Auth"),AuthStore_1=require("./AuthStore"),GraphQLCreator=function(){function GraphQLCreator(token){this._token=token}return Object.defineProperty(GraphQLCreator.prototype,"token",{get:function(){return this._token},enumerable:!0,configurable:!0}),GraphQLCreator.prototype._setTokenToHeader=function(operation){operation.setContext({headers:{token:this._token}})},GraphQLCreator.prototype.createGraphQL=function(){var _this=this,httpLink=new apollo_link_http_1.HttpLink({uri:Utils_1.Urls.graphqlModel()}),errorLink=apollo_link_error_1.onError(function(_a){var networkError=_a.networkError,operation=_a.operation,forward=_a.forward;if(networkError&&401===networkError.statusCode)return new apollo_link_1.Observable(function(observer){(new Auth_1.Auth).applyToken(AuthStore_1.AuthStore.appId,AuthStore_1.AuthStore.secret,AuthStore_1.AuthStore.keyPlatform,{bundleId:AuthStore_1.AuthStore.bundleId,packageName:AuthStore_1.AuthStore.packageName,sha1:AuthStore_1.AuthStore.sha1}).then(function(res){_this._token=res.data.result.idToken,_this._setTokenToHeader(operation)}).then(function(){var subscriber={next:observer.next.bind(observer),error:observer.error.bind(observer),complete:observer.complete.bind(observer)};forward(operation).subscribe(subscriber)})})}),link=new apollo_link_1.ApolloLink(function(operation,forward){return _this._setTokenToHeader(operation),forward(operation)}).concat(errorLink).concat(httpLink);return new apollo_client_1.default({link:link,cache:new apollo_cache_inmemory_1.InMemoryCache})},GraphQLCreator}();exports.GraphQLCreator=GraphQLCreator,exports.default=GraphQLCreator},{"../Utils":353,"./Auth":356,"./AuthStore":357,"apollo-cache-inmemory":4,"apollo-client":6,"apollo-link":14,"apollo-link-error":9,"apollo-link-http":13}],359:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),Component_1=require("../Component"),BackgroundComponent=function(_super){function BackgroundComponent(name,container,navigator){return _super.call(this,name,container,navigator)||this}return __extends(BackgroundComponent,_super),BackgroundComponent.prototype._activate=function(){this._container.domRenderer.render$.next({name:this._name,vnode:this._getBackgroundNode("The viewer can't display the given photo.")})},BackgroundComponent.prototype._deactivate=function(){},BackgroundComponent.prototype._getDefaultConfiguration=function(){return{}},BackgroundComponent.prototype._getBackgroundNode=function(notice){return vd.h("div.BackgroundWrapper",{},[vd.h("p",{textContent:notice},[])])},BackgroundComponent.componentName="background",BackgroundComponent}(Component_1.Component);exports.BackgroundComponent=BackgroundComponent,Component_1.ComponentService.register(BackgroundComponent),exports.default=BackgroundComponent},{"../Component":343,"virtual-dom":296}],360:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),rxjs_1=require("rxjs"),Component_1=require("../Component"),Geo_1=require("../Geo"),operators_1=require("rxjs/operators"),BearingComponent=function(_super){function BearingComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;return _this._spatial=new Geo_1.Spatial,_this._svgNamespace="http://www.w3.org/2000/svg",_this._distinctThreshold=Math.PI/90,_this}return __extends(BearingComponent,_super),BearingComponent.prototype._activate=function(){var _this=this,nodeBearingFov$=this._navigator.stateService.currentState$.pipe(operators_1.distinctUntilChanged(void 0,function(frame){return frame.state.currentNode.key}),operators_1.map(function(frame){var node=frame.state.currentNode,transform=frame.state.currentTransform;if(node.pano){var hFov_1=2*Math.PI*node.gpano.CroppedAreaImageWidthPixels/node.gpano.FullPanoWidthPixels;return[_this._spatial.degToRad(node.ca),hFov_1]}var size=Math.max(transform.basicWidth,transform.basicHeight);size<=0&&console.warn("Original image size ("+transform.basicWidth+", "+transform.basicHeight+") is invalid ("+node.key+". Not showing available fov.");var hFov=0<size?2*Math.atan(.5*transform.basicWidth/(size*transform.focal)):0;return[_this._spatial.degToRad(node.ca),hFov]}),operators_1.distinctUntilChanged(function(a1,a2){return Math.abs(a2[0]-a1[0])<_this._distinctThreshold&&Math.abs(a2[1]-a1[1])<_this._distinctThreshold})),cameraBearingFov$=this._container.renderService.renderCamera$.pipe(operators_1.map(function(rc){var vFov=_this._spatial.degToRad(rc.perspective.fov),hFov=rc.perspective.aspect===Number.POSITIVE_INFINITY?Math.PI:2*Math.atan(rc.perspective.aspect*Math.tan(.5*vFov));return[_this._spatial.azimuthalToBearing(rc.rotation.phi),hFov]}),operators_1.distinctUntilChanged(function(a1,a2){return Math.abs(a2[0]-a1[0])<_this._distinctThreshold&&Math.abs(a2[1]-a1[1])<_this._distinctThreshold}));this._renderSubscription=rxjs_1.combineLatest(nodeBearingFov$,cameraBearingFov$).pipe(operators_1.map(function(args){var background=vd.h("div.BearingIndicatorBackground",{oncontextmenu:function(event){event.preventDefault()}},[vd.h("div.BearingIndicatorBackgroundRectangle",{},[]),vd.h("div.BearingIndicatorBackgroundCircle",{},[])]),north=vd.h("div.BearingIndicatorNorth",{},[]),nodeSector=_this._createCircleSector(args[0][0],args[0][1],"#fff"),cameraSector=_this._createCircleSector(args[1][0],args[1][1],"#49b1d3"),compass=_this._createCircleSectorCompass(nodeSector,cameraSector),degArgs=60*args[1][0],deg=vd.h("div.TransformDeg",{attributes:{style:"transform:rotate("+degArgs+"deg)"}},[]);return{name:_this._name,vnode:vd.h("div.BearingIndicator",{},[background,north,compass,deg])}})).subscribe(this._container.domRenderer.render$)},BearingComponent.prototype._deactivate=function(){this._renderSubscription.unsubscribe()},BearingComponent.prototype._getDefaultConfiguration=function(){return{}},BearingComponent.prototype._createCircleSectorCompass=function(nodeSector,cameraSector){var group=vd.h("g",{attributes:{transform:"translate(1,1)"},namespace:this._svgNamespace},[nodeSector,cameraSector]),centerCircle=vd.h("circle",{attributes:{cx:"1",cy:"1",fill:"#fff",r:"0.291667",stroke:"#fff","stroke-width":"0.0833333"},namespace:this._svgNamespace},[]);return vd.h("svg",{attributes:{viewBox:"0 0 2 2"},namespace:this._svgNamespace,style:{bottom:"4px",height:"48px",left:"4px",position:"absolute",width:"48px"}},[group,centerCircle])},BearingComponent.prototype._createCircleSector=function(bearing,fov,fill){if(fov>2*Math.PI-Math.PI/90)return vd.h("circle",{attributes:{cx:"0",cy:"0",fill:fill,r:"1"},namespace:this._svgNamespace},[]);var arcStart=bearing-fov/2-Math.PI/2,arcEnd=arcStart+fov,startX=Math.cos(arcStart),startY=Math.sin(arcStart),endX=Math.cos(arcEnd),endY=Math.sin(arcEnd),description="M 0 0 "+startX+" "+startY+" A 1 1 0 "+(fov>=Math.PI?1:0)+" 1 "+endX+" "+endY;return vd.h("path",{attributes:{d:description,fill:fill},namespace:this._svgNamespace},[])},BearingComponent.componentName="bearing",BearingComponent}(Component_1.Component);exports.BearingComponent=BearingComponent,Component_1.ComponentService.register(BearingComponent),exports.default=BearingComponent},{"../Component":343,"../Geo":346,rxjs:89,"rxjs/operators":285,"virtual-dom":296}],361:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Edge_1=require("../Edge"),Component_1=require("../Component"),operators_1=require("rxjs/operators"),CacheComponent=function(_super){function CacheComponent(name,container,navigator){return _super.call(this,name,container,navigator)||this}return __extends(CacheComponent,_super),CacheComponent.prototype.setDepth=function(depth){this.configure({depth:depth})},CacheComponent.prototype._activate=function(){var _this=this;this._sequenceSubscription=rxjs_1.combineLatest(this._navigator.stateService.currentNode$.pipe(operators_1.switchMap(function(node){return node.sequenceEdges$}),operators_1.filter(function(status){return status.cached})),this._configuration$).pipe(operators_1.switchMap(function(nc){var status=nc[0],configuration=nc[1],sequenceDepth=Math.max(0,Math.min(4,configuration.depth.sequence)),next$=_this._cache$(status.edges,Edge_1.EdgeDirection.Next,sequenceDepth),prev$=_this._cache$(status.edges,Edge_1.EdgeDirection.Prev,sequenceDepth);return rxjs_1.merge(next$,prev$).pipe(operators_1.catchError(function(error,caught){return console.error("Failed to cache sequence edges.",error),rxjs_1.empty()}))})).subscribe(function(){}),this._spatialSubscription=this._navigator.stateService.currentNode$.pipe(operators_1.switchMap(function(node){return rxjs_1.combineLatest(rxjs_1.of(node),node.spatialEdges$.pipe(operators_1.filter(function(status){return status.cached})))}),operators_1.combineLatest(this._configuration$,function(ns,configuration){return[ns[0],ns[1],configuration]}),operators_1.switchMap(function(args){var node=args[0],edges=args[1].edges,depth=args[2].depth,panoDepth=Math.max(0,Math.min(2,depth.pano)),stepDepth=node.pano?0:Math.max(0,Math.min(3,depth.step)),turnDepth=node.pano?0:Math.max(0,Math.min(1,depth.turn)),pano$=_this._cache$(edges,Edge_1.EdgeDirection.Pano,panoDepth),forward$=_this._cache$(edges,Edge_1.EdgeDirection.StepForward,stepDepth),backward$=_this._cache$(edges,Edge_1.EdgeDirection.StepBackward,stepDepth),left$=_this._cache$(edges,Edge_1.EdgeDirection.StepLeft,stepDepth),right$=_this._cache$(edges,Edge_1.EdgeDirection.StepRight,stepDepth),turnLeft$=_this._cache$(edges,Edge_1.EdgeDirection.TurnLeft,turnDepth),turnRight$=_this._cache$(edges,Edge_1.EdgeDirection.TurnRight,turnDepth),turnU$=_this._cache$(edges,Edge_1.EdgeDirection.TurnU,turnDepth);return rxjs_1.merge(forward$,backward$,left$,right$,pano$,turnLeft$,turnRight$,turnU$).pipe(operators_1.catchError(function(error,caught){return console.error("Failed to cache spatial edges.",error),rxjs_1.empty()}))})).subscribe(function(){})},CacheComponent.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._spatialSubscription.unsubscribe()},CacheComponent.prototype._getDefaultConfiguration=function(){return{depth:{pano:1,sequence:2,step:1,turn:0}}},CacheComponent.prototype._cache$=function(edges,direction,depth){var _this=this;return rxjs_1.zip(rxjs_1.of(edges),rxjs_1.of(depth)).pipe(operators_1.expand(function(ed){var es=ed[0],d=ed[1],edgesDepths$=[];if(0<d)for(var _i=0,es_1=es;_i<es_1.length;_i++){var edge=es_1[_i];edge.data.direction===direction&&edgesDepths$.push(rxjs_1.zip(_this._navigator.graphService.cacheNode$(edge.to).pipe(operators_1.mergeMap(function(n){return _this._nodeToEdges$(n,direction)})),rxjs_1.of(d-1)))}return rxjs_1.from(edgesDepths$).pipe(operators_1.mergeAll())}),operators_1.skip(1))},CacheComponent.prototype._nodeToEdges$=function(node,direction){return(-1<[Edge_1.EdgeDirection.Next,Edge_1.EdgeDirection.Prev].indexOf(direction)?node.sequenceEdges$:node.spatialEdges$).pipe(operators_1.first(function(status){return status.cached}),operators_1.map(function(status){return status.edges}))},CacheComponent.componentName="cache",CacheComponent}(Component_1.Component);exports.CacheComponent=CacheComponent,Component_1.ComponentService.register(CacheComponent),exports.default=CacheComponent},{"../Component":343,"../Edge":344,rxjs:89,"rxjs/operators":285}],362:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Utils_1=require("../Utils"),operators_1=require("rxjs/operators"),Component=function(_super){function Component(name,container,navigator){var _this=_super.call(this)||this;return _this._activated$=new rxjs_1.BehaviorSubject(!1),_this._configurationSubject$=new rxjs_1.Subject,_this._activated=!1,_this._container=container,_this._name=name,_this._navigator=navigator,_this._configuration$=_this._configurationSubject$.pipe(operators_1.startWith(_this.defaultConfiguration),operators_1.scan(function(conf,newConf){for(var key in newConf)newConf.hasOwnProperty(key)&&(conf[key]=newConf[key]);return conf}),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),_this._configuration$.subscribe(function(){}),_this}return __extends(Component,_super),Object.defineProperty(Component.prototype,"activated",{get:function(){return this._activated},enumerable:!0,configurable:!0}),Object.defineProperty(Component.prototype,"activated$",{get:function(){return this._activated$},enumerable:!0,configurable:!0}),Object.defineProperty(Component.prototype,"defaultConfiguration",{get:function(){return this._getDefaultConfiguration()},enumerable:!0,configurable:!0}),Object.defineProperty(Component.prototype,"configuration$",{get:function(){return this._configuration$},enumerable:!0,configurable:!0}),Object.defineProperty(Component.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Component.prototype.activate=function(conf){this._activated||(void 0!==conf&&this._configurationSubject$.next(conf),this._activated=!0,this._activate(),this._activated$.next(!0))},Component.prototype.configure=function(conf){this._configurationSubject$.next(conf)},Component.prototype.deactivate=function(){this._activated&&(this._activated=!1,this._deactivate(),this._container.domRenderer.clear(this._name),this._container.glRenderer.clear(this._name),this._activated$.next(!1))},Component.prototype.resize=function(){},Component.componentName="not_worthy",Component}(Utils_1.EventEmitter);exports.Component=Component,exports.default=Component},{"../Utils":353,rxjs:89,"rxjs/operators":285}],363:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("underscore"),Error_1=require("../Error"),ComponentService=function(){function ComponentService(container,navigator){this._components={},this._container=container,this._navigator=navigator;for(var _i=0,_a=_.values(ComponentService.registeredComponents);_i<_a.length;_i++){var component=_a[_i];this._components[component.componentName]={active:!1,component:new component(component.componentName,container,navigator)}}this._coverComponent=new ComponentService.registeredCoverComponent("cover",container,navigator),this._coverComponent.activate(),this._coverActivated=!0}return ComponentService.register=function(component){void 0===ComponentService.registeredComponents[component.componentName]&&(ComponentService.registeredComponents[component.componentName]=component)},ComponentService.registerCover=function(coverComponent){ComponentService.registeredCoverComponent=coverComponent},Object.defineProperty(ComponentService.prototype,"coverActivated",{get:function(){return this._coverActivated},enumerable:!0,configurable:!0}),ComponentService.prototype.activateCover=function(){if(!this._coverActivated){this._coverActivated=!0;for(var _i=0,_a=_.values(this._components);_i<_a.length;_i++){var component=_a[_i];component.active&&component.component.deactivate()}}},ComponentService.prototype.deactivateCover=function(){if(this._coverActivated){this._coverActivated=!1;for(var _i=0,_a=_.values(this._components);_i<_a.length;_i++){var component=_a[_i];component.active&&component.component.activate()}}},ComponentService.prototype.activate=function(name){this._checkName(name),this._components[name].active=!0,this._coverActivated||this.get(name).activate()},ComponentService.prototype.configure=function(name,conf){this._checkName(name),this.get(name).configure(conf)},ComponentService.prototype.deactivate=function(name){this._checkName(name),this._components[name].active=!1,this._coverActivated||this.get(name).deactivate()},ComponentService.prototype.resize=function(){for(var _i=0,_a=_.values(this._components);_i<_a.length;_i++){_a[_i].component.resize()}},ComponentService.prototype.get=function(name){return this._components[name].component},ComponentService.prototype.getCover=function(){return this._coverComponent},ComponentService.prototype._checkName=function(name){if(!(name in this._components))throw new Error_1.ArgumentBeeviewError("Component does not exist: "+name)},ComponentService.registeredComponents={},ComponentService}();exports.ComponentService=ComponentService,exports.default=ComponentService},{"../Error":345,underscore:292}],364:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),Component_1=require("../Component"),Urls_1=require("../utils/Urls"),operators_1=require("rxjs/operators"),CoverComponent=function(_super){function CoverComponent(name,container,navigator){return _super.call(this,name,container,navigator)||this}return __extends(CoverComponent,_super),CoverComponent.prototype._activate=function(){var _this=this;this._keyDisposable=this._navigator.stateService.currentNode$.pipe(operators_1.withLatestFrom(this._configuration$,function(node,configuration){return[node,configuration]}),operators_1.filter(function(_a){var node=_a[0],configuration=_a[1];return node.key!==configuration.key}),operators_1.map(function(_a){var node=_a[0];_a[1];return node}),operators_1.map(function(node){return{key:node.key,src:node.image.src}})).subscribe(this._configurationSubject$),this._disposable=this._configuration$.pipe(operators_1.map(function(conf){return conf.key?conf.state===Component_1.CoverState.Hidden?{name:_this._name,vnode:vd.h("div.Cover.CoverDone",[_this._getCoverBackgroundVNode(conf)])}:{name:_this._name,vnode:_this._getCoverButtonVNode(conf)}:{name:_this._name,vnode:vd.h("div",[])}})).subscribe(this._container.domRenderer.render$)},CoverComponent.prototype._deactivate=function(){this._disposable.unsubscribe(),this._keyDisposable.unsubscribe()},CoverComponent.prototype._getDefaultConfiguration=function(){return{state:Component_1.CoverState.Visible}},CoverComponent.prototype._getCoverButtonVNode=function(conf){var _this=this,cover=conf.state===Component_1.CoverState.Loading?"div.Cover.CoverLoading":"div.Cover";return vd.h(cover,[this._getCoverBackgroundVNode(conf),vd.h("button.CoverButton",{onclick:function(){_this.configure({state:Component_1.CoverState.Loading})}},["Explore"]),vd.h("a.CoverLogo",{href:"",target:""},[])])},CoverComponent.prototype._getCoverBackgroundVNode=function(conf){var properties={style:{backgroundImage:null!=conf.src?"url("+conf.src+")":Urls_1.Urls.thumbnail(conf.key)}},children=[];return conf.state===Component_1.CoverState.Loading&&(children.push(vd.h("div.maphive_logo",{},[])),children.push(vd.h("div.maphive_text",{},[]))),children.push(vd.h("div.CoverBackgroundGradient",{},[])),vd.h("div.CoverBackground",properties,children)},CoverComponent.componentName="cover",CoverComponent}(Component_1.Component);exports.CoverComponent=CoverComponent,Component_1.ComponentService.registerCover(CoverComponent),exports.default=CoverComponent},{"../Component":343,"../utils/Urls":483,"rxjs/operators":285,"virtual-dom":296}],365:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var _=require("underscore"),vd=require("virtual-dom"),rxjs_1=require("rxjs"),Component_1=require("../Component"),operators_1=require("rxjs/operators"),DebugComponent=function(_super){function DebugComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;return _this._open$=new rxjs_1.BehaviorSubject(!1),_this._displaying=!1,_this}return __extends(DebugComponent,_super),DebugComponent.prototype._activate=function(){var _this=this;this._disposable=this._navigator.stateService.currentState$.pipe(operators_1.combineLatest(this._open$,this._navigator.imageLoadingService.loadstatus$,function(frame,open,loadStatus){return{name:_this._name,vnode:_this._getDebugVNode(open,_this._getDebugInfo(frame,loadStatus))}})).subscribe(this._container.domRenderer.render$)},DebugComponent.prototype._deactivate=function(){this._disposable.unsubscribe()},DebugComponent.prototype._getDefaultConfiguration=function(){return{}},DebugComponent.prototype._getDebugInfo=function(frame,loadStatus){var ret=[];ret.push(vd.h("h2","Node")),frame.state.currentNode&&ret.push(vd.h("p","currentNode: "+frame.state.currentNode.key)),frame.state.previousNode&&ret.push(vd.h("p","previousNode: "+frame.state.previousNode.key)),ret.push(vd.h("h2","Loading"));for(var total=0,loaded=0,loading=0,_i=0,_a=_.values(loadStatus);_i<_a.length;_i++){var loadStat=_a[_i];total+=loadStat.loaded,loadStat.loaded!==loadStat.total?loading++:loaded++}return ret.push(vd.h("p","Loaded Images: "+loaded)),ret.push(vd.h("p","Loading Images: "+loading)),ret.push(vd.h("p","Total bytes loaded: "+total)),ret.push(vd.h("h2","Camera")),ret.push(vd.h("p","camera.position.x: "+frame.state.camera.position.x)),ret.push(vd.h("p","camera.position.y: "+frame.state.camera.position.y)),ret.push(vd.h("p","camera.position.z: "+frame.state.camera.position.z)),ret.push(vd.h("p","camera.lookat.x: "+frame.state.camera.lookat.x)),ret.push(vd.h("p","camera.lookat.y: "+frame.state.camera.lookat.y)),ret.push(vd.h("p","camera.lookat.z: "+frame.state.camera.lookat.z)),ret.push(vd.h("p","camera.up.x: "+frame.state.camera.up.x)),ret.push(vd.h("p","camera.up.y: "+frame.state.camera.up.y)),ret.push(vd.h("p","camera.up.z: "+frame.state.camera.up.z)),ret},DebugComponent.prototype._getDebugVNode=function(open,info){return open?vd.h("div.Debug",{},[vd.h("h2",{},["Debug"]),this._getDebugVNodeButton(open),vd.h("pre",{},info)]):this._getDebugVNodeButton(open)},DebugComponent.prototype._getDebugVNodeButton=function(open){var buttonText=open?"Disable Debug":"D",buttonCssClass=open?"":".DebugButtonFixed";return open?vd.h("button.DebugButton"+buttonCssClass,{onclick:this._closeDebugElement.bind(this)},[buttonText]):vd.h("button.DebugButton"+buttonCssClass,{onclick:this._openDebugElement.bind(this)},[buttonText])},DebugComponent.prototype._closeDebugElement=function(open){this._open$.next(!1)},DebugComponent.prototype._openDebugElement=function(){this._open$.next(!0)},DebugComponent.componentName="debug",DebugComponent}(Component_1.Component);exports.DebugComponent=DebugComponent,Component_1.ComponentService.register(DebugComponent),exports.default=DebugComponent},{"../Component":343,rxjs:89,"rxjs/operators":285,underscore:292,"virtual-dom":296}],366:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),rxjs_1=require("rxjs"),Component_1=require("../Component"),Utils_1=require("../Utils"),operators_1=require("rxjs/operators"),ImageComponent=function(_super){function ImageComponent(name,container,navigator,dom){var _this=_super.call(this,name,container,navigator)||this;return _this._canvasId=container.id+"-"+_this._name,_this._dom=dom||new Utils_1.DOM,_this}return __extends(ImageComponent,_super),ImageComponent.prototype._activate=function(){var _this=this,canvasSize$=this._container.domRenderer.element$.pipe(operators_1.map(function(element){return _this._dom.document.getElementById(_this._canvasId)}),operators_1.filter(function(canvas){return!!canvas}),operators_1.map(function(canvas){var adaptableDomRenderer=canvas.parentElement,width=adaptableDomRenderer.offsetWidth;return[canvas,{height:adaptableDomRenderer.offsetHeight,width:width}]}),operators_1.distinctUntilChanged(function(s1,s2){return s1.height===s2.height&&s1.width===s2.width},function(_a){_a[0];return _a[1]}));this.drawSubscription=rxjs_1.combineLatest(canvasSize$,this._navigator.stateService.currentNode$).subscribe(function(_a){var _b=_a[0],canvas=_b[0],size=_b[1],node=_a[1];canvas.width=size.width,canvas.height=size.height,canvas.getContext("2d").drawImage(node.image,0,0,size.width,size.height)}),this._container.domRenderer.renderAdaptive$.next({name:this._name,vnode:vd.h("canvas#"+this._canvasId,[])})},ImageComponent.prototype._deactivate=function(){this.drawSubscription.unsubscribe()},ImageComponent.prototype._getDefaultConfiguration=function(){return{}},ImageComponent.componentName="image",ImageComponent}(Component_1.Component);exports.ImageComponent=ImageComponent,Component_1.ComponentService.register(ImageComponent),exports.default=ImageComponent},{"../Component":343,"../Utils":353,rxjs:89,"rxjs/operators":285,"virtual-dom":296}],367:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var _=require("underscore"),vd=require("virtual-dom"),Component_1=require("../Component"),operators_1=require("rxjs/operators"),LoadingComponent=function(_super){function LoadingComponent(name,container,navigator){return _super.call(this,name,container,navigator)||this}return __extends(LoadingComponent,_super),LoadingComponent.prototype._activate=function(){var _this=this;this._loadingSubscription=this._navigator.loadingService.loading$.pipe(operators_1.combineLatest(this._navigator.imageLoadingService.loadstatus$,function(loading,loadStatus){if(!loading)return{name:"loading",vnode:_this._getBarVNode(100)};for(var total=0,loaded=0,_i=0,_a=_.values(loadStatus);_i<_a.length;_i++){var loadStat=_a[_i];loadStat.loaded!==loadStat.total&&(loaded+=loadStat.loaded,total+=loadStat.total)}var percentage=100;return 0!==total&&(percentage=loaded/total*100),{name:_this._name,vnode:_this._getBarVNode(percentage)}})).subscribe(this._container.domRenderer.render$)},LoadingComponent.prototype._deactivate=function(){this._loadingSubscription.unsubscribe()},LoadingComponent.prototype._getDefaultConfiguration=function(){return{}},LoadingComponent.prototype._getBarVNode=function(percentage){var loadingBarStyle={};return 100!==percentage?(loadingBarStyle.width=percentage.toFixed(0)+"%",loadingBarStyle.opacity="1"):(loadingBarStyle.width="100%",loadingBarStyle.opacity="0"),vd.h("div.Loading",{style:{}},[vd.h("div.LoadingBar",{style:loadingBarStyle},[])])},LoadingComponent.componentName="loading",LoadingComponent}(Component_1.Component);exports.LoadingComponent=LoadingComponent,Component_1.ComponentService.register(LoadingComponent),exports.default=LoadingComponent},{"../Component":343,"rxjs/operators":285,underscore:292,"virtual-dom":296}],368:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),rxjs_1=require("rxjs"),Edge_1=require("../Edge"),Component_1=require("../Component"),operators_1=require("rxjs/operators"),NavigationComponent=function(_super){function NavigationComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;return _this._seqNames={},_this._seqNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.Prev]]="Prev",_this._seqNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.Next]]="Next",_this._spaTopNames={},_this._spaTopNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.TurnLeft]]="Turnleft",_this._spaTopNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.StepLeft]]="Left",_this._spaTopNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.StepForward]]="Forward",_this._spaTopNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.StepRight]]="Right",_this._spaTopNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.TurnRight]]="Turnright",_this._spaBottomNames={},_this._spaBottomNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.TurnU]]="Turnaround",_this._spaBottomNames[Edge_1.EdgeDirection[Edge_1.EdgeDirection.StepBackward]]="Backward",_this}return __extends(NavigationComponent,_super),NavigationComponent.prototype._activate=function(){var _this=this;this._renderSubscription=rxjs_1.combineLatest(this._navigator.stateService.currentNode$,this._configuration$).pipe(operators_1.switchMap(function(_a){var node=_a[0],configuration=_a[1],sequenceEdges$=configuration.sequence?node.sequenceEdges$.pipe(operators_1.map(function(status){return status.edges.map(function(edge){return edge.data.direction})})):rxjs_1.of([]),spatialEdges$=!node.pano&&configuration.spatial?node.spatialEdges$.pipe(operators_1.map(function(status){return status.edges.map(function(edge){return edge.data.direction})})):rxjs_1.of([]);return rxjs_1.combineLatest(sequenceEdges$,spatialEdges$).pipe(operators_1.map(function(_a){var seq=_a[0],spa=_a[1];return seq.concat(spa)}))}),operators_1.map(function(edgeDirections){var seqs=_this._createArrowRow(_this._seqNames,edgeDirections),spaTops=_this._createArrowRow(_this._spaTopNames,edgeDirections),spaBottoms=_this._createArrowRow(_this._spaBottomNames,edgeDirections),seqContainer=vd.h("div.NavigationSequence",seqs),spaTopContainer=vd.h("div.NavigationSpatialTop",spaTops),spaBottomContainer=vd.h("div.NavigationSpatialBottom",spaBottoms),spaContainer=vd.h("div.NavigationSpatial",[spaTopContainer,spaBottomContainer]);return{name:_this._name,vnode:vd.h("div.NavigationContainer",[seqContainer,spaContainer])}})).subscribe(this._container.domRenderer.render$)},NavigationComponent.prototype._deactivate=function(){this._renderSubscription.unsubscribe()},NavigationComponent.prototype._getDefaultConfiguration=function(){return{sequence:!0,spatial:!0}},NavigationComponent.prototype._createArrowRow=function(arrowNames,edgeDirections){var arrows=[];for(var arrowName in arrowNames)if(arrowNames.hasOwnProperty(arrowName)){var direction=Edge_1.EdgeDirection[arrowName];-1!==edgeDirections.indexOf(direction)?arrows.push(this._createVNode(direction,arrowNames[arrowName],"visible")):arrows.push(this._createVNode(direction,arrowNames[arrowName],"hidden"))}return arrows},NavigationComponent.prototype._createVNode=function(direction,name,visibility){var _this=this;return vd.h("span.Direction.Direction"+name,{onclick:function(ev){_this._navigator.moveDir$(direction).subscribe(function(node){},function(error){console.error(error)})},style:{visibility:visibility}},[])},NavigationComponent.componentName="navigation",NavigationComponent}(Component_1.Component);exports.NavigationComponent=NavigationComponent,Component_1.ComponentService.register(NavigationComponent),exports.default=NavigationComponent},{"../Component":343,"../Edge":344,rxjs:89,"rxjs/operators":285,"virtual-dom":296}],369:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var _=require("underscore"),vd=require("virtual-dom"),rxjs_1=require("rxjs"),Component_1=require("../Component"),operators_1=require("rxjs/operators"),DescriptionState=function(){},RouteState=function(){},RouteTrack=function(){this.nodeInstructions=[],this.nodeInstructionsOrdered=[]},RouteComponent=function(_super){function RouteComponent(name,container,navigator){return _super.call(this,name,container,navigator)||this}return __extends(RouteComponent,_super),RouteComponent.prototype._activate=function(){var _slowedStream$,_routeTrack$,_this=this;_slowedStream$=this._navigator.stateService.currentState$.pipe(operators_1.filter(function(frame){return frame.id%2==0}),operators_1.filter(function(frame){return frame.state.nodesAhead<15}),operators_1.distinctUntilChanged(void 0,function(frame){return frame.state.lastNode.key})),_routeTrack$=this.configuration$.pipe(operators_1.mergeMap(function(conf){return rxjs_1.from(conf.paths)}),operators_1.distinct(function(p){return p.sequenceKey}),operators_1.mergeMap(function(path){return _this._navigator.api.sequenceByKey$([path.sequenceKey]).pipe(operators_1.map(function(sequenceByKey){return sequenceByKey[path.sequenceKey]}))}),operators_1.combineLatest(this.configuration$,function(sequence,conf){for(var i=0,instructionPlaces=[],_i=0,_a=conf.paths;_i<_a.length;_i++){var path=_a[_i];if(path.sequenceKey===sequence.key){for(var nodeInstructions=[],saveKey=!1,_b=0,_c=sequence.keys;_b<_c.length;_b++){var key=_c[_b];if(path.startKey===key&&(saveKey=!0),saveKey){for(var description=null,_d=0,_e=path.infoKeys;_d<_e.length;_d++){var infoKey=_e[_d];infoKey.key===key&&(description=infoKey.description)}nodeInstructions.push({description:description,key:key})}path.stopKey===key&&(saveKey=!1)}instructionPlaces.push({nodeInstructions:nodeInstructions,place:i})}i++}return instructionPlaces}),operators_1.scan(function(routeTrack,instructionPlaces){for(var _i=0,instructionPlaces_1=instructionPlaces;_i<instructionPlaces_1.length;_i++){var instructionPlace=instructionPlaces_1[_i];routeTrack.nodeInstructionsOrdered[instructionPlace.place]=instructionPlace.nodeInstructions}return routeTrack.nodeInstructions=_.flatten(routeTrack.nodeInstructionsOrdered),routeTrack},new RouteTrack)),this._disposable=_slowedStream$.pipe(operators_1.combineLatest(_routeTrack$,this.configuration$,function(frame,routeTrack,conf){return{conf:conf,frame:frame,routeTrack:routeTrack}}),operators_1.scan(function(routeState,rtAndFrame){return void 0===rtAndFrame.conf.playing||rtAndFrame.conf.playing?(routeState.routeTrack=rtAndFrame.routeTrack,routeState.currentNode=rtAndFrame.frame.state.currentNode,routeState.lastNode=rtAndFrame.frame.state.lastNode,routeState.playing=!0):(_this._navigator.stateService.cutNodes(),routeState.playing=!1),routeState},new RouteState),operators_1.filter(function(routeState){return routeState.playing}),operators_1.filter(function(routeState){for(var _i=0,_a=routeState.routeTrack.nodeInstructions;_i<_a.length;_i++){var nodeInstruction=_a[_i];if(nodeInstruction&&nodeInstruction.key===routeState.lastNode.key)return!0}return!1}),operators_1.distinctUntilChanged(void 0,function(routeState){return routeState.lastNode.key}),operators_1.mergeMap(function(routeState){for(var i=0,_i=0,_a=routeState.routeTrack.nodeInstructions;_i<_a.length;_i++){if(_a[_i].key===routeState.lastNode.key)break;i++}var nextInstruction=routeState.routeTrack.nodeInstructions[i+1];return nextInstruction?_this._navigator.graphService.cacheNode$(nextInstruction.key):rxjs_1.of(null)}),operators_1.combineLatest(this.configuration$,function(node,conf){return{conf:conf,node:node}}),operators_1.filter(function(cAN){return null!==cAN.node&&cAN.conf.playing}),operators_1.pluck("node")).subscribe(this._navigator.stateService.appendNode$),this._disposableDescription=this._navigator.stateService.currentNode$.pipe(operators_1.combineLatest(_routeTrack$,this.configuration$,function(node,routeTrack,conf){if(void 0!==conf.playing&&!conf.playing)return"quit";for(var description=null,_i=0,_a=routeTrack.nodeInstructions;_i<_a.length;_i++){var nodeInstruction=_a[_i];if(nodeInstruction.key===node.key){description=nodeInstruction.description;break}}return description}),operators_1.scan(function(descriptionState,description){return description!==descriptionState.description&&null!==description?(descriptionState.description=description,descriptionState.showsLeft=6):descriptionState.showsLeft--,"quit"===description&&(descriptionState.description=null),descriptionState},new DescriptionState),operators_1.map(function(descriptionState){return 0<descriptionState.showsLeft&&descriptionState.description?{name:_this._name,vnode:_this._getRouteAnnotationNode(descriptionState.description)}:{name:_this._name,vnode:vd.h("div",[])}})).subscribe(this._container.domRenderer.render$)},RouteComponent.prototype._deactivate=function(){this._disposable.unsubscribe(),this._disposableDescription.unsubscribe()},RouteComponent.prototype._getDefaultConfiguration=function(){return{}},RouteComponent.prototype.play=function(){this.configure({playing:!0})},RouteComponent.prototype.stop=function(){this.configure({playing:!1})},RouteComponent.prototype._getRouteAnnotationNode=function(description){return vd.h("div.RouteFrame",{},[vd.h("p",{textContent:description},[])])},RouteComponent.componentName="route",RouteComponent}(Component_1.Component);exports.RouteComponent=RouteComponent,Component_1.ComponentService.register(RouteComponent),exports.default=RouteComponent},{"../Component":343,rxjs:89,"rxjs/operators":285,underscore:292,"virtual-dom":296}],370:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),rxjs_1=require("rxjs"),Component_1=require("../../Component"),operators_1=require("rxjs/operators"),DirectionComponent=function(_super){function DirectionComponent(name,container,navigator,directionDOMRenderer){var _this=_super.call(this,name,container,navigator)||this;return _this._renderer=directionDOMRenderer||new Component_1.DirectionDOMRenderer(_this.defaultConfiguration,container.element),_this._hoveredKeySubject$=new rxjs_1.Subject,_this._hoveredKey$=_this._hoveredKeySubject$.pipe(operators_1.share()),_this}return __extends(DirectionComponent,_super),Object.defineProperty(DirectionComponent.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),DirectionComponent.prototype.setHighlightKey=function(highlightKey){this.configure({highlightKey:highlightKey})},DirectionComponent.prototype.setMinWidth=function(minWidth){this.configure({minWidth:minWidth})},DirectionComponent.prototype.setMaxWidth=function(maxWidth){this.configure({maxWidth:maxWidth})},DirectionComponent.prototype.resize=function(){this._renderer.resize(this._container.element)},DirectionComponent.prototype._activate=function(){var _this=this;this._configurationSubscription=this._configuration$.subscribe(function(configuration){_this._renderer.setConfiguration(configuration)}),this._nodeSubscription=this._navigator.stateService.currentNode$.pipe(operators_1.tap(function(node){_this._container.domRenderer.render$.next({name:_this._name,vnode:vd.h("div",{},[])}),_this._renderer.setNode(node)}),operators_1.withLatestFrom(this._configuration$),operators_1.switchMap(function(_a){var node=_a[0],configuration=_a[1];return rxjs_1.combineLatest(node.spatialEdges$,configuration.distinguishSequence?_this._navigator.graphService.cacheSequence$(node.sequenceKey).pipe(operators_1.catchError(function(error,caught){return console.error("Failed to cache sequence ("+node.sequenceKey+")",error),rxjs_1.of(null)})):rxjs_1.of(null))})).subscribe(function(_a){var edgeStatus=_a[0],sequence=_a[1];_this._renderer.setEdges(edgeStatus,sequence)}),this._renderCameraSubscription=this._container.renderService.renderCameraFrame$.pipe(operators_1.tap(function(renderCamera){_this._renderer.setRenderCamera(renderCamera)}),operators_1.map(function(renderCamera){return _this._renderer}),operators_1.filter(function(renderer){return renderer.needsRender}),operators_1.map(function(renderer){return{name:_this._name,vnode:renderer.render(_this._navigator)}})).subscribe(this._container.domRenderer.render$),this._hoveredKeySubscription=rxjs_1.combineLatest([this._container.domRenderer.element$,this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$.pipe(operators_1.startWith(null)),this._container.mouseService.mouseUp$.pipe(operators_1.startWith(null))],function(e,rc,mm,mu){return e}).pipe(operators_1.map(function(element){for(var elements=element.getElementsByClassName("DirectionsPerspective"),i=0;i<elements.length;i++){var hovered=elements.item(i).querySelector(":hover");if(null!=hovered&&hovered.hasAttribute("data-key"))return hovered.getAttribute("data-key")}return null}),operators_1.distinctUntilChanged()).subscribe(this._hoveredKeySubject$)},DirectionComponent.prototype._deactivate=function(){this._configurationSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this._renderCameraSubscription.unsubscribe(),this._hoveredKeySubscription.unsubscribe()},DirectionComponent.prototype._getDefaultConfiguration=function(){return{distinguishSequence:!1,maxWidth:460,minWidth:260}},DirectionComponent.componentName="direction",DirectionComponent}(Component_1.Component);exports.DirectionComponent=DirectionComponent,Component_1.ComponentService.register(DirectionComponent),exports.default=DirectionComponent},{"../../Component":343,rxjs:89,"rxjs/operators":285,"virtual-dom":296}],371:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Geo_1=require("../../Geo"),DirectionDOMCalculator=function(){function DirectionDOMCalculator(configuration,element){this._spatial=new Geo_1.Spatial,this._minThresholdWidth=320,this._maxThresholdWidth=1480,this._minThresholdHeight=240,this._maxThresholdHeight=820,this._configure(configuration),this._resize(element),this._reset()}return Object.defineProperty(DirectionDOMCalculator.prototype,"minWidth",{get:function(){return this._minWidth},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"maxWidth",{get:function(){return this._maxWidth},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"containerWidth",{get:function(){return this._containerWidth},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"containerWidthCss",{get:function(){return this._containerWidthCss},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"containerMarginCss",{get:function(){return this._containerMarginCss},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"containerLeftCss",{get:function(){return this._containerLeftCss},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"containerHeight",{get:function(){return this._containerHeight},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"containerHeightCss",{get:function(){return this._containerHeightCss},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"containerBottomCss",{get:function(){return this._containerBottomCss},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"stepCircleSize",{get:function(){return this._stepCircleSize},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"stepCircleSizeCss",{get:function(){return this._stepCircleSizeCss},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"stepCircleMarginCss",{get:function(){return this._stepCircleMarginCss},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"turnCircleSize",{get:function(){return this._turnCircleSize},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"turnCircleSizeCss",{get:function(){return this._turnCircleSizeCss},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"outerRadius",{get:function(){return this._outerRadius},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"innerRadius",{get:function(){return this._innerRadius},enumerable:!0,configurable:!0}),Object.defineProperty(DirectionDOMCalculator.prototype,"shadowOffset",{get:function(){return this._shadowOffset},enumerable:!0,configurable:!0}),DirectionDOMCalculator.prototype.configure=function(configuration){this._configure(configuration),this._reset()},DirectionDOMCalculator.prototype.resize=function(element){this._resize(element),this._reset()},DirectionDOMCalculator.prototype.angleToCoordinates=function(angle){return[Math.cos(angle),Math.sin(angle)]},DirectionDOMCalculator.prototype.relativeAngleToCoordiantes=function(first,second){var relativeAngle=this._spatial.wrapAngle(first-second);return this.angleToCoordinates(relativeAngle)},DirectionDOMCalculator.prototype._configure=function(configuration){this._minWidth=configuration.minWidth,this._maxWidth=this._getMaxWidth(configuration.minWidth,configuration.maxWidth)},DirectionDOMCalculator.prototype._resize=function(element){this._elementWidth=element.offsetWidth,this._elementHeight=element.offsetHeight},DirectionDOMCalculator.prototype._reset=function(){this._containerWidth=this._getContainerWidth(this._elementWidth,this._elementHeight),this._containerHeight=this._getContainerHeight(this.containerWidth),this._stepCircleSize=this._getStepCircleDiameter(this._containerHeight),this._turnCircleSize=this._getTurnCircleDiameter(this.containerHeight),this._outerRadius=this._getOuterRadius(this._containerHeight),this._innerRadius=this._getInnerRadius(this._containerHeight),this._shadowOffset=3,this._containerWidthCss=this._numberToCssPixels(this._containerWidth),this._containerMarginCss=this._numberToCssPixels(-.5*this._containerWidth),this._containerLeftCss=this._numberToCssPixels(Math.floor(.5*this._elementWidth)),this._containerHeightCss=this._numberToCssPixels(this._containerHeight),this._containerBottomCss=this._numberToCssPixels(Math.floor(-.08*this._containerHeight)),this._stepCircleSizeCss=this._numberToCssPixels(this._stepCircleSize),this._stepCircleMarginCss=this._numberToCssPixels(-.5*this._stepCircleSize),this._turnCircleSizeCss=this._numberToCssPixels(this._turnCircleSize)},DirectionDOMCalculator.prototype._getContainerWidth=function(elementWidth,elementHeight){var relativeWidth=(elementWidth-this._minThresholdWidth)/(this._maxThresholdWidth-this._minThresholdWidth),relativeHeight=(elementHeight-this._minThresholdHeight)/(this._maxThresholdHeight-this._minThresholdHeight),coeff=Math.max(0,Math.min(1,Math.min(relativeWidth,relativeHeight)));return coeff=.04*Math.round(25*coeff),this._minWidth+coeff*(this._maxWidth-this._minWidth)},DirectionDOMCalculator.prototype._getContainerHeight=function(containerWidth){return.77*containerWidth},DirectionDOMCalculator.prototype._getStepCircleDiameter=function(containerHeight){return.34*containerHeight},DirectionDOMCalculator.prototype._getTurnCircleDiameter=function(containerHeight){return.3*containerHeight},DirectionDOMCalculator.prototype._getOuterRadius=function(containerHeight){return.31*containerHeight},DirectionDOMCalculator.prototype._getInnerRadius=function(containerHeight){return.125*containerHeight},DirectionDOMCalculator.prototype._numberToCssPixels=function(value){return value+"px"},DirectionDOMCalculator.prototype._getMaxWidth=function(value,minWidth){return minWidth<value?value:minWidth},DirectionDOMCalculator}();exports.DirectionDOMCalculator=DirectionDOMCalculator,exports.default=DirectionDOMCalculator},{"../../Geo":346}],372:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),Component_1=require("../../Component"),Edge_1=require("../../Edge"),Geo_1=require("../../Geo"),DirectionDOMRenderer=function(){function DirectionDOMRenderer(configuration,element){this._isEdge=!1,this._spatial=new Geo_1.Spatial,this._calculator=new Component_1.DirectionDOMCalculator(configuration,element),this._node=null,this._rotation={phi:0,theta:0},this._epsilon=.5*Math.PI/180,this._highlightKey=null,this._distinguishSequence=!1,this._needsRender=!1,this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[],this._stepDirections=[Edge_1.EdgeDirection.StepForward,Edge_1.EdgeDirection.StepBackward,Edge_1.EdgeDirection.StepLeft,Edge_1.EdgeDirection.StepRight],this._turnDirections=[Edge_1.EdgeDirection.TurnLeft,Edge_1.EdgeDirection.TurnRight,Edge_1.EdgeDirection.TurnU],this._turnNames={},this._turnNames[Edge_1.EdgeDirection.TurnLeft]="TurnLeft",this._turnNames[Edge_1.EdgeDirection.TurnRight]="TurnRight",this._turnNames[Edge_1.EdgeDirection.TurnU]="TurnAround";var isIE=!!document.documentMode;this._isEdge=!isIE&&!!window.StyleMedia}return Object.defineProperty(DirectionDOMRenderer.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),DirectionDOMRenderer.prototype.render=function(navigator){this._needsRender=!1;var rotation=this._rotation,steps=[],turns=[];return this._node.pano?steps=steps.concat(this._createPanoArrows(navigator,rotation)):(steps=(steps=steps.concat(this._createPerspectiveToPanoArrows(navigator,rotation))).concat(this._createStepArrows(navigator,rotation)),turns=turns.concat(this._createTurnArrows(navigator))),this._getContainer(steps,turns,rotation)},DirectionDOMRenderer.prototype.setEdges=function(edgeStatus,sequence){this._setEdges(edgeStatus,sequence),this._setNeedsRender()},DirectionDOMRenderer.prototype.setNode=function(node){this._node=node,this._clearEdges(),this._setNeedsRender()},DirectionDOMRenderer.prototype.setRenderCamera=function(renderCamera){var rotation=renderCamera.rotation;Math.abs(rotation.phi-this._rotation.phi)<this._epsilon||(this._rotation=rotation,this._setNeedsRender())},DirectionDOMRenderer.prototype.setConfiguration=function(configuration){var needsRender=!1;this._highlightKey===configuration.highlightKey&&this._distinguishSequence===configuration.distinguishSequence||(this._highlightKey=configuration.highlightKey,this._distinguishSequence=configuration.distinguishSequence,needsRender=!0),this._calculator.minWidth===configuration.minWidth&&this._calculator.maxWidth===configuration.maxWidth||(this._calculator.configure(configuration),needsRender=!0),needsRender&&this._setNeedsRender()},DirectionDOMRenderer.prototype.resize=function(element){this._calculator.resize(element),this._setNeedsRender()},DirectionDOMRenderer.prototype._setNeedsRender=function(){null!=this._node&&(this._needsRender=!0)},DirectionDOMRenderer.prototype._clearEdges=function(){this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[]},DirectionDOMRenderer.prototype._setEdges=function(edgeStatus,sequence){this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[];for(var _i=0,_a=edgeStatus.edges;_i<_a.length;_i++){var direction=(edge=_a[_i]).data.direction;-1<this._stepDirections.indexOf(direction)?this._stepEdges.push(edge):-1<this._turnDirections.indexOf(direction)?this._turnEdges.push(edge):edge.data.direction===Edge_1.EdgeDirection.Pano&&this._panoEdges.push(edge)}if(this._distinguishSequence&&null!=sequence)for(var _b=0,edges_1=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges);_b<edges_1.length;_b++)for(var edge,edgeKey=(edge=edges_1[_b]).to,_c=0,_d=sequence.keys;_c<_d.length;_c++){if(_d[_c]===edgeKey){this._sequenceEdgeKeys.push(edgeKey);break}}},DirectionDOMRenderer.prototype._createPanoArrows=function(navigator,rotation){for(var arrows=[],_i=0,_a=this._panoEdges;_i<_a.length;_i++){var panoEdge=_a[_i];arrows.push(this._createVNodeByKey(navigator,panoEdge.to,panoEdge.data.worldMotionAzimuth,rotation,this._calculator.outerRadius,"DirectionsArrowPano"))}for(var _b=0,_c=this._stepEdges;_b<_c.length;_b++){var stepEdge=_c[_b];arrows.push(this._createPanoToPerspectiveArrow(navigator,stepEdge.to,stepEdge.data.worldMotionAzimuth,rotation,stepEdge.data.direction))}return arrows},DirectionDOMRenderer.prototype._createPanoToPerspectiveArrow=function(navigator,key,azimuth,rotation,direction){var threshold=Math.PI/8,relativePhi=rotation.phi;switch(direction){case Edge_1.EdgeDirection.StepBackward:relativePhi=rotation.phi-Math.PI;break;case Edge_1.EdgeDirection.StepLeft:relativePhi=rotation.phi+Math.PI/2;break;case Edge_1.EdgeDirection.StepRight:relativePhi=rotation.phi-Math.PI/2}return Math.abs(this._spatial.wrapAngle(azimuth-relativePhi))<threshold?this._createVNodeByKey(navigator,key,azimuth,rotation,this._calculator.outerRadius,"DirectionsArrowStep"):this._createVNodeDisabled(key,azimuth,rotation)},DirectionDOMRenderer.prototype._createPerspectiveToPanoArrows=function(navigator,rotation){for(var arrows=[],_i=0,_a=this._panoEdges;_i<_a.length;_i++){var panoEdge=_a[_i];arrows.push(this._createVNodeByKey(navigator,panoEdge.to,panoEdge.data.worldMotionAzimuth,rotation,this._calculator.innerRadius,"DirectionsArrowPano",!0))}return arrows},DirectionDOMRenderer.prototype._createStepArrows=function(navigator,rotation){for(var arrows=[],_i=0,_a=this._stepEdges;_i<_a.length;_i++){var stepEdge=_a[_i];arrows.push(this._createVNodeByDirection(navigator,stepEdge.to,stepEdge.data.worldMotionAzimuth,rotation,stepEdge.data.direction))}return arrows},DirectionDOMRenderer.prototype._createTurnArrows=function(navigator){for(var turns=[],_i=0,_a=this._turnEdges;_i<_a.length;_i++){var turnEdge=_a[_i],direction=turnEdge.data.direction,name_1=this._turnNames[direction];turns.push(this._createVNodeByTurn(navigator,turnEdge.to,name_1,direction))}return turns},DirectionDOMRenderer.prototype._createVNodeByKey=function(navigator,key,azimuth,rotation,offset,className,shiftVertically){return this._createVNode(key,azimuth,rotation,offset,className,"DirectionsCircle",function(e){navigator.moveToKey$(key).subscribe(function(node){},function(error){console.error(error)})},shiftVertically)},DirectionDOMRenderer.prototype._createVNodeByDirection=function(navigator,key,azimuth,rotation,direction){return this._createVNode(key,azimuth,rotation,this._calculator.outerRadius,"DirectionsArrowStep","DirectionsCircle",function(e){navigator.moveDir$(direction).subscribe(function(node){},function(error){console.error(error)})})},DirectionDOMRenderer.prototype._createVNodeByTurn=function(navigator,key,className,direction){var style={height:this._calculator.turnCircleSizeCss,transform:"rotate(0)",width:this._calculator.turnCircleSizeCss};switch(direction){case Edge_1.EdgeDirection.TurnLeft:style.left="5px",style.top="5px";break;case Edge_1.EdgeDirection.TurnRight:style.right="5px",style.top="5px";break;case Edge_1.EdgeDirection.TurnU:style.left="5px",style.bottom="5px"}var circleProperties={attributes:{"data-key":key},onclick:function(e){navigator.moveDir$(direction).subscribe(function(node){},function(error){console.error(error)})},style:style},circleClassName="TurnCircle";-1<this._sequenceEdgeKeys.indexOf(key)&&(circleClassName+="Sequence"),this._highlightKey===key&&(circleClassName+="Highlight");var turn=vd.h("div."+className,{},[]);return vd.h("div."+circleClassName,circleProperties,[turn])},DirectionDOMRenderer.prototype._createVNodeDisabled=function(key,azimuth,rotation){return this._createVNode(key,azimuth,rotation,this._calculator.outerRadius,"DirectionsArrowDisabled","DirectionsCircleDisabled")},DirectionDOMRenderer.prototype._createVNode=function(key,azimuth,rotation,radius,className,circleClassName,onClick,shiftVertically){var translation=this._calculator.angleToCoordinates(azimuth-rotation.phi),translationX=Math.round(-radius*translation[1]+.5*this._calculator.containerWidth),translationY=Math.round(-radius*translation[0]+.5*this._calculator.containerHeight),shadowTranslation=this._calculator.relativeAngleToCoordiantes(azimuth,rotation.phi),shadowOffset=this._calculator.shadowOffset,filter="drop-shadow("+-shadowOffset*shadowTranslation[1]+"px "+shadowOffset*shadowTranslation[0]+"px 1px rgba(0,0,0,0.8))",properties={style:{"-webkit-filter":filter,filter:filter}},chevron=vd.h("div."+className,properties,[]),azimuthDeg=-this._spatial.radToDeg(azimuth-rotation.phi),circleTransform=shiftVertically?"translate("+translationX+"px, "+translationY+"px) rotate("+azimuthDeg+"deg) translateZ(-0.01px)":"translate("+translationX+"px, "+translationY+"px) rotate("+azimuthDeg+"deg)",circleProperties={attributes:{"data-key":key},onclick:onClick,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:circleTransform,width:this._calculator.stepCircleSizeCss}};return-1<this._sequenceEdgeKeys.indexOf(key)&&(circleClassName+="Sequence"),this._highlightKey===key&&(circleClassName+="Highlight"),vd.h("div."+circleClassName,circleProperties,[chevron])},DirectionDOMRenderer.prototype._getContainer=function(steps,turns,rotation){var transform=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)",properties={oncontextmenu:function(event){event.preventDefault()},style:{bottom:this._calculator.containerBottomCss,height:this._calculator.containerHeightCss,left:this._calculator.containerLeftCss,marginLeft:this._calculator.containerMarginCss,transform:transform,width:this._calculator.containerWidthCss}};return vd.h("div.DirectionsPerspective",properties,turns.concat(steps))},DirectionDOMRenderer}();exports.DirectionDOMRenderer=DirectionDOMRenderer,exports.default=DirectionDOMRenderer},{"../../Component":343,"../../Edge":344,"../../Geo":346,"virtual-dom":296}],373:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),Render_1=require("../../Render"),Tiles_1=require("../../Tiles"),Utils_1=require("../../Utils"),operators_1=require("rxjs/operators"),ImagePlaneComponent=function(_super){function ImagePlaneComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;return _this._imageTileLoader=new Tiles_1.ImageTileLoader(Utils_1.Urls.tileScheme,Utils_1.Urls.tileDomain,Utils_1.Urls.origin),_this._roiCalculator=new Tiles_1.RegionOfInterestCalculator,_this._rendererOperation$=new rxjs_1.Subject,_this._rendererCreator$=new rxjs_1.Subject,_this._rendererDisposer$=new rxjs_1.Subject,_this._renderer$=_this._rendererOperation$.pipe(operators_1.scan(function(renderer,operation){return operation(renderer)},null),operators_1.filter(function(renderer){return null!=renderer}),operators_1.distinctUntilChanged(void 0,function(renderer){return renderer.frameId})),_this._rendererCreator$.pipe(operators_1.map(function(){return function(renderer){if(null!=renderer)throw new Error("Multiple image plane states can not be created at the same time");return new Component_1.ImagePlaneGLRenderer}})).subscribe(_this._rendererOperation$),_this._rendererDisposer$.pipe(operators_1.map(function(){return function(renderer){return renderer.dispose(),null}})).subscribe(_this._rendererOperation$),_this}return __extends(ImagePlaneComponent,_super),ImagePlaneComponent.prototype._activate=function(){var _this=this;this._rendererSubscription=this._renderer$.pipe(operators_1.map(function(renderer){var renderHash={name:_this._name,render:{frameId:renderer.frameId,needsRender:renderer.needsRender,render:renderer.render.bind(renderer),stage:Render_1.GLRenderStage.Background}};return renderer.clearNeedsRender(),renderHash})).subscribe(this._container.glRenderer.render$),this._rendererCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.pipe(operators_1.map(function(frame){return function(renderer){return renderer.updateFrame(frame),renderer}})).subscribe(this._rendererOperation$);var textureProvider$=this._navigator.stateService.currentState$.pipe(operators_1.distinctUntilChanged(void 0,function(frame){return frame.state.currentNode.key}),operators_1.combineLatest(this._configuration$),operators_1.filter(function(args){return!0===args[1].imageTiling}),operators_1.map(function(args){return args[0]}),operators_1.withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$),operators_1.map(function(_a){var frame=_a[0],renderer=_a[1],size=_a[2],state=frame.state,viewportSize=Math.max(size.width,size.height),currentNode=state.currentNode,currentTransform=state.currentTransform,tileSize=2048<viewportSize?2048:1024<viewportSize?1024:512;return new Tiles_1.TextureProvider(currentNode.key,currentTransform.basicWidth,currentTransform.basicHeight,tileSize,currentNode.image,_this._imageTileLoader,new Tiles_1.ImageTileStore,renderer)}),operators_1.publishReplay(1),operators_1.refCount());this._textureProviderSubscription=textureProvider$.subscribe(function(){}),this._setTextureProviderSubscription=textureProvider$.pipe(operators_1.map(function(provider){return function(renderer){return renderer.setTextureProvider(provider.key,provider),renderer}})).subscribe(this._rendererOperation$),this._setTileSizeSubscription=this._container.renderService.size$.pipe(operators_1.switchMap(function(size){return rxjs_1.combineLatest(textureProvider$,rxjs_1.of(size)).pipe(operators_1.first())})).subscribe(function(_a){var provider=_a[0],size=_a[1],viewportSize=Math.max(size.width,size.height),tileSize=2048<viewportSize?2048:1024<viewportSize?1024:512;provider.setTileSize(tileSize)}),this._abortTextureProviderSubscription=textureProvider$.pipe(operators_1.pairwise()).subscribe(function(pair){pair[0].abort()});var roiTrigger$=rxjs_1.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.pipe(operators_1.debounceTime(250))).pipe(operators_1.map(function(_a){var camera=_a[0],size=_a[1];return[camera.camera.position.clone(),camera.camera.lookat.clone(),camera.zoom.valueOf(),size.height.valueOf(),size.width.valueOf()]}),operators_1.pairwise(),operators_1.skipWhile(function(pls){return pls[1][2]-pls[0][2]<0||0===pls[1][2]}),operators_1.map(function(pls){var samePosition=pls[0][0].equals(pls[1][0]),sameLookat=pls[0][1].equals(pls[1][1]),sameZoom=pls[0][2]===pls[1][2],sameHeight=pls[0][3]===pls[1][3],sameWidth=pls[0][4]===pls[1][4];return samePosition&&sameLookat&&sameZoom&&sameHeight&&sameWidth}),operators_1.distinctUntilChanged(),operators_1.filter(function(stalled){return stalled}),operators_1.switchMap(function(stalled){return _this._container.renderService.renderCameraFrame$.pipe(operators_1.first())}),operators_1.withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$));this._setRegionOfInterestSubscription=textureProvider$.pipe(operators_1.switchMap(function(provider){return roiTrigger$.pipe(operators_1.map(function(_a){var camera=_a[0],size=_a[1],transform=_a[2];return[_this._roiCalculator.computeRegionOfInterest(camera,size,transform),provider]}))}),operators_1.filter(function(args){return!args[1].disposed})).subscribe(function(args){var roi=args[0];args[1].setRegionOfInterest(roi)});var hasTexture$=textureProvider$.pipe(operators_1.switchMap(function(provider){return provider.hasTexture$}),operators_1.startWith(!1),operators_1.publishReplay(1),operators_1.refCount());this._hasTextureSubscription=hasTexture$.subscribe(function(){});var nodeImage$=this._navigator.stateService.currentNode$.pipe(operators_1.debounceTime(1e3),operators_1.withLatestFrom(hasTexture$),operators_1.filter(function(args){return!args[1]}),operators_1.map(function(args){return args[0]}),operators_1.filter(function(node){return node.pano?Utils_1.Settings.maxImageSize>Utils_1.Settings.basePanoramaSize:Utils_1.Settings.maxImageSize>Utils_1.Settings.baseImageSize}),operators_1.switchMap(function(node){var baseImageSize=node.pano?Utils_1.Settings.basePanoramaSize:Utils_1.Settings.baseImageSize;return Math.max(node.image.width,node.image.height)>baseImageSize?rxjs_1.empty():node.cacheImage$(Utils_1.Settings.maxImageSize).pipe(operators_1.map(function(n){return[n.image,n]})).pipe(operators_1.takeUntil(hasTexture$.pipe(operators_1.filter(function(hasTexture){return hasTexture}))),operators_1.catchError(function(error,caught){return console.error("Failed to fetch high res image ("+node.key+")",error),rxjs_1.empty()}))}),operators_1.share());this._updateBackgroundSubscription=nodeImage$.pipe(operators_1.withLatestFrom(textureProvider$)).subscribe(function(args){args[0][1].key!==args[1].key||args[1].disposed||args[1].updateBackground(args[0][0])}),this._updateTextureImageSubscription=nodeImage$.pipe(operators_1.map(function(imn){return function(renderer){return renderer.updateTextureImage(imn[0],imn[1]),renderer}})).subscribe(this._rendererOperation$)},ImagePlaneComponent.prototype._deactivate=function(){this._rendererDisposer$.next(null),this._abortTextureProviderSubscription.unsubscribe(),this._hasTextureSubscription.unsubscribe(),this._rendererSubscription.unsubscribe(),this._setRegionOfInterestSubscription.unsubscribe(),this._setTextureProviderSubscription.unsubscribe(),this._setTileSizeSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._textureProviderSubscription.unsubscribe(),this._updateBackgroundSubscription.unsubscribe(),this._updateTextureImageSubscription.unsubscribe()},ImagePlaneComponent.prototype._getDefaultConfiguration=function(){return{imageTiling:!1}},ImagePlaneComponent.componentName="imagePlane",ImagePlaneComponent}(Component_1.Component);exports.ImagePlaneComponent=ImagePlaneComponent,Component_1.ComponentService.register(ImagePlaneComponent),exports.default=ImagePlaneComponent},{"../../Component":343,"../../Render":349,"../../Tiles":352,"../../Utils":353,rxjs:89,"rxjs/operators":285}],374:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),Component_1=require("../../Component"),ImagePlaneFactory=function(){function ImagePlaneFactory(imagePlaneDepth,imageSphereRadius){this._imagePlaneDepth=null!=imagePlaneDepth?imagePlaneDepth:200,this._imageSphereRadius=null!=imageSphereRadius?imageSphereRadius:200}return ImagePlaneFactory.prototype.createMesh=function(node,transform){return node.pano?this._createImageSphere(node,transform):this._createImagePlane(node,transform)},ImagePlaneFactory.prototype._createImageSphere=function(node,transform){var texture=this._createTexture(node.image),materialParameters=this._createSphereMaterialParameters(transform,texture),material=new THREE.ShaderMaterial(materialParameters);return this._useMesh(transform,node)?new THREE.Mesh(this._getImageSphereGeo(transform,node),material):new THREE.Mesh(this._getFlatImageSphereGeo(transform),material)},ImagePlaneFactory.prototype._createImagePlane=function(node,transform){var texture=this._createTexture(node.image),materialParameters=this._createPlaneMaterialParameters(transform,texture),material=new THREE.ShaderMaterial(materialParameters),geometry=this._useMesh(transform,node)?this._getImagePlaneGeo(transform,node):this._getFlatImagePlaneGeo(transform);return new THREE.Mesh(geometry,material)},ImagePlaneFactory.prototype._createSphereMaterialParameters=function(transform,texture){var gpano=transform.gpano,halfCroppedWidth=(gpano.FullPanoWidthPixels-gpano.CroppedAreaImageWidthPixels)/2,phiShift=2*Math.PI*(gpano.CroppedAreaLeftPixels-halfCroppedWidth)/gpano.FullPanoWidthPixels,phiLength=2*Math.PI*gpano.CroppedAreaImageWidthPixels/gpano.FullPanoWidthPixels,halfCroppedHeight=(gpano.FullPanoHeightPixels-gpano.CroppedAreaImageHeightPixels)/2,thetaShift=Math.PI*(halfCroppedHeight-gpano.CroppedAreaTopPixels)/gpano.FullPanoHeightPixels,thetaLength=Math.PI*gpano.CroppedAreaImageHeightPixels/gpano.FullPanoHeightPixels;return{depthWrite:!1,fragmentShader:Component_1.ImagePlaneShaders.equirectangular.fragment,side:THREE.DoubleSide,transparent:!0,uniforms:{opacity:{type:"f",value:1},phiLength:{type:"f",value:phiLength},phiShift:{type:"f",value:phiShift},projectorMat:{type:"m4",value:transform.rt},projectorTex:{type:"t",value:texture},thetaLength:{type:"f",value:thetaLength},thetaShift:{type:"f",value:thetaShift}},vertexShader:Component_1.ImagePlaneShaders.equirectangular.vertex}},ImagePlaneFactory.prototype._createPlaneMaterialParameters=function(transform,texture){return{depthWrite:!1,fragmentShader:Component_1.ImagePlaneShaders.perspective.fragment,side:THREE.DoubleSide,transparent:!0,uniforms:{bbox:{type:"v4",value:new THREE.Vector4(0,0,1,1)},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:transform.projectorMatrix()},projectorTex:{type:"t",value:texture}},vertexShader:Component_1.ImagePlaneShaders.perspective.vertex}},ImagePlaneFactory.prototype._createTexture=function(image){var texture=new THREE.Texture(image);return texture.minFilter=THREE.LinearFilter,texture.needsUpdate=!0,texture},ImagePlaneFactory.prototype._useMesh=function(transform,node){return node.mesh.vertices.length&&transform.hasValidScale},ImagePlaneFactory.prototype._getImageSphereGeo=function(transform,node){for(var geometry=new THREE.Geometry,vertices=node.mesh.vertices,faces=node.mesh.faces,numVertices=vertices.length/3,i=0;i<numVertices;++i){var x=vertices[(index=3*i)+0],y=vertices[index+1],z=vertices[index+2];geometry.vertices.push(new THREE.Vector3(x,y,z))}var numFaces=faces.length/3;for(i=0;i<numFaces;++i){var index;x=faces[(index=3*i)+0],y=faces[index+1],z=faces[index+2];geometry.faces.push(new THREE.Face3(x,y,z))}return geometry},ImagePlaneFactory.prototype._getImagePlaneGeo=function(transform,node){for(var t=(new THREE.Matrix4).getInverse(transform.srt),minZ=5*transform.scale,maxZ=this._imagePlaneDepth*transform.scale,vertices=node.mesh.vertices,numVertices=vertices.length/3,positions=new Float32Array(vertices.length),i=0;i<numVertices;++i){var index=3*i,x=vertices[0+index],y=vertices[1+index],z=vertices[2+index],boundedZ=Math.max(minZ,Math.min(z,maxZ)),factor=boundedZ/z,p=new THREE.Vector3(x*factor,y*factor,boundedZ);p.applyMatrix4(t),positions[0+index]=p.x,positions[1+index]=p.y,positions[2+index]=p.z}var faces=node.mesh.faces,indices=new Uint16Array(faces.length);for(i=0;i<faces.length;++i)indices[i]=faces[i];var geometry=new THREE.BufferGeometry;return geometry.addAttribute("position",new THREE.BufferAttribute(positions,3)),geometry.setIndex(new THREE.BufferAttribute(indices,1)),geometry},ImagePlaneFactory.prototype._getFlatImageSphereGeo=function(transform){var gpano=transform.gpano,phiStart=2*Math.PI*gpano.CroppedAreaLeftPixels/gpano.FullPanoWidthPixels,phiLength=2*Math.PI*gpano.CroppedAreaImageWidthPixels/gpano.FullPanoWidthPixels,thetaStart=Math.PI*(gpano.FullPanoHeightPixels-gpano.CroppedAreaImageHeightPixels-gpano.CroppedAreaTopPixels)/gpano.FullPanoHeightPixels,thetaLength=Math.PI*gpano.CroppedAreaImageHeightPixels/gpano.FullPanoHeightPixels;return new THREE.SphereGeometry(this._imageSphereRadius,20,40,phiStart-Math.PI/2,phiLength,thetaStart,thetaLength)},ImagePlaneFactory.prototype._getFlatImagePlaneGeo=function(transform){var width=transform.width,height=transform.height,size=Math.max(width,height),dx=width/2/size,dy=height/2/size,vertices=[];vertices.push(transform.unprojectSfM([-dx,-dy],this._imagePlaneDepth)),vertices.push(transform.unprojectSfM([dx,-dy],this._imagePlaneDepth)),vertices.push(transform.unprojectSfM([dx,dy],this._imagePlaneDepth)),vertices.push(transform.unprojectSfM([-dx,dy],this._imagePlaneDepth));for(var positions=new Float32Array(12),i=0;i<vertices.length;i++){var index=3*i;positions[0+index]=vertices[i][0],positions[1+index]=vertices[i][1],positions[2+index]=vertices[i][2]}var indices=new Uint16Array(6);indices[0]=0,indices[1]=1,indices[2]=3,indices[3]=1,indices[4]=2,indices[5]=3;var geometry=new THREE.BufferGeometry;return geometry.addAttribute("position",new THREE.BufferAttribute(positions,3)),geometry.setIndex(new THREE.BufferAttribute(indices,1)),geometry},ImagePlaneFactory}();exports.ImagePlaneFactory=ImagePlaneFactory,exports.default=ImagePlaneFactory},{"../../Component":343,three:288}],375:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../Component"),Geo_1=require("../../Geo"),ImagePlaneGLRenderer=function(){function ImagePlaneGLRenderer(){this._imagePlaneFactory=new Component_1.ImagePlaneFactory(200,2e3),this._imagePlaneScene=new Component_1.ImagePlaneScene,this._alpha=0,this._alphaOld=0,this._fadeOutSpeed=.05,this._lastCamera=new Geo_1.Camera,this._epsilon=1e-6,this._currentKey=null,this._previousKey=null,this._providerDisposers={},this._frameId=0,this._needsRender=!1}return Object.defineProperty(ImagePlaneGLRenderer.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(ImagePlaneGLRenderer.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),ImagePlaneGLRenderer.prototype.indicateNeedsRender=function(){this._needsRender=!0},ImagePlaneGLRenderer.prototype.updateFrame=function(frame){this._updateFrameId(frame.id),this._needsRender=this._updateAlpha(frame.state.alpha)||this._needsRender,this._needsRender=this._updateAlphaOld(frame.state.alpha)||this._needsRender,this._needsRender=this._updateImagePlanes(frame.state)||this._needsRender},ImagePlaneGLRenderer.prototype.setTextureProvider=function(key,provider){var _this=this;if(key===this._currentKey){var createdSubscription=provider.textureCreated$.subscribe(function(texture){_this._updateTexture(texture)}),updatedSubscription=provider.textureUpdated$.subscribe(function(updated){_this._needsRender=!0});if(key in this._providerDisposers)(0,this._providerDisposers[key])(),delete this._providerDisposers[key];this._providerDisposers[key]=function(){createdSubscription.unsubscribe(),updatedSubscription.unsubscribe(),provider.dispose()}}},ImagePlaneGLRenderer.prototype._updateTexture=function(texture){this._needsRender=!0;for(var _i=0,_a=this._imagePlaneScene.imagePlanes;_i<_a.length;_i++){var material=_a[_i].material,oldTexture=material.uniforms.projectorTex.value;material.uniforms.projectorTex.value=null,oldTexture.dispose(),material.uniforms.projectorTex.value=texture}},ImagePlaneGLRenderer.prototype.updateTextureImage=function(image,node){if(this._currentKey===node.key){this._needsRender=!0;for(var _i=0,_a=this._imagePlaneScene.imagePlanes;_i<_a.length;_i++){var texture=_a[_i].material.uniforms.projectorTex.value;texture.image=image,texture.needsUpdate=!0}}},ImagePlaneGLRenderer.prototype.render=function(perspectiveCamera,renderer){for(var planeAlpha=this._imagePlaneScene.imagePlanesOld.length?1:this._alpha,_i=0,_a=this._imagePlaneScene.imagePlanes;_i<_a.length;_i++){_a[_i].material.uniforms.opacity.value=planeAlpha}for(var _b=0,_c=this._imagePlaneScene.imagePlanesOld;_b<_c.length;_b++){_c[_b].material.uniforms.opacity.value=this._alphaOld}renderer.render(this._imagePlaneScene.scene,perspectiveCamera),renderer.render(this._imagePlaneScene.sceneOld,perspectiveCamera);for(var _d=0,_e=this._imagePlaneScene.imagePlanes;_d<_e.length;_d++){_e[_d].material.uniforms.opacity.value=this._alpha}renderer.render(this._imagePlaneScene.scene,perspectiveCamera)},ImagePlaneGLRenderer.prototype.clearNeedsRender=function(){this._needsRender=!1},ImagePlaneGLRenderer.prototype.dispose=function(){this._imagePlaneScene.clear()},ImagePlaneGLRenderer.prototype._updateFrameId=function(frameId){this._frameId=frameId},ImagePlaneGLRenderer.prototype._updateAlpha=function(alpha){return alpha!==this._alpha&&(this._alpha=alpha,!0)},ImagePlaneGLRenderer.prototype._updateAlphaOld=function(alpha){return!(alpha<1||0===this._alphaOld)&&(this._alphaOld=Math.max(0,this._alphaOld-this._fadeOutSpeed),!0)},ImagePlaneGLRenderer.prototype._updateImagePlanes=function(state){if(null==state.currentNode||state.currentNode.key===this._currentKey)return!1;var previousKey=null!=state.previousNode?state.previousNode.key:null,currentKey=state.currentNode.key;this._previousKey!==previousKey&&this._previousKey!==currentKey&&this._previousKey in this._providerDisposers&&((0,this._providerDisposers[this._previousKey])(),delete this._providerDisposers[this._previousKey]);if(null!=previousKey){if(previousKey!==this._currentKey&&previousKey!==this._previousKey){var previousMesh=this._imagePlaneFactory.createMesh(state.previousNode,state.previousTransform);this._imagePlaneScene.updateImagePlanes([previousMesh])}this._previousKey=previousKey}this._currentKey=currentKey;var currentMesh=this._imagePlaneFactory.createMesh(state.currentNode,state.currentTransform);return this._imagePlaneScene.updateImagePlanes([currentMesh]),this._alphaOld=1,!0},ImagePlaneGLRenderer}();exports.ImagePlaneGLRenderer=ImagePlaneGLRenderer,exports.default=ImagePlaneGLRenderer},{"../../Component":343,"../../Geo":346}],376:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),ImagePlaneScene=function(){function ImagePlaneScene(){this.scene=new THREE.Scene,this.sceneOld=new THREE.Scene,this.imagePlanes=[],this.imagePlanesOld=[]}return ImagePlaneScene.prototype.updateImagePlanes=function(planes){this._dispose(this.imagePlanesOld,this.sceneOld);for(var _i=0,_a=this.imagePlanes;_i<_a.length;_i++){var plane=_a[_i];this.scene.remove(plane),this.sceneOld.add(plane)}for(var _b=0,planes_1=planes;_b<planes_1.length;_b++){plane=planes_1[_b];this.scene.add(plane)}this.imagePlanesOld=this.imagePlanes,this.imagePlanes=planes},ImagePlaneScene.prototype.addImagePlanes=function(planes){for(var _i=0,planes_2=planes;_i<planes_2.length;_i++){var plane=planes_2[_i];this.scene.add(plane),this.imagePlanes.push(plane)}},ImagePlaneScene.prototype.addImagePlanesOld=function(planes){for(var _i=0,planes_3=planes;_i<planes_3.length;_i++){var plane=planes_3[_i];this.sceneOld.add(plane),this.imagePlanesOld.push(plane)}},ImagePlaneScene.prototype.setImagePlanes=function(planes){this._clear(),this.addImagePlanes(planes)},ImagePlaneScene.prototype.setImagePlanesOld=function(planes){this._clearOld(),this.addImagePlanesOld(planes)},ImagePlaneScene.prototype.clear=function(){this._clear(),this._clearOld()},ImagePlaneScene.prototype._clear=function(){this._dispose(this.imagePlanes,this.scene),this.imagePlanes.length=0},ImagePlaneScene.prototype._clearOld=function(){this._dispose(this.imagePlanesOld,this.sceneOld),this.imagePlanesOld.length=0},ImagePlaneScene.prototype._dispose=function(planes,scene){for(var _i=0,planes_4=planes;_i<planes_4.length;_i++){var plane=planes_4[_i];scene.remove(plane),plane.geometry.dispose(),plane.material.dispose();var texture=plane.material.uniforms.projectorTex.value;null!=texture&&texture.dispose()}},ImagePlaneScene}();exports.ImagePlaneScene=ImagePlaneScene,exports.default=ImagePlaneScene},{three:288}],377:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("path");var ImagePlaneShaders=function(){function ImagePlaneShaders(){}return ImagePlaneShaders.equirectangular={fragment:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float phiLength;\nuniform float phiShift;\nuniform float thetaLength;\nuniform float thetaShift;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vec3 b = normalize(vRstq.xyz);\n float lat = -asin(b.y);\n float lon = atan(b.x, b.z);\n float x = (lon - phiShift) / phiLength + 0.5;\n float y = (lat - thetaShift) / thetaLength + 0.5;\n vec4 baseColor = texture2D(projectorTex, vec2(x, y));\n baseColor.a = opacity;\n gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},ImagePlaneShaders.perspective={fragment:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform vec4 bbox;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n float x = vRstq.x / vRstq.w;\n float y = vRstq.y / vRstq.w;\n\n vec4 baseColor;\n if (x > bbox[0] && y > bbox[1] && x < bbox[2] && y < bbox[3]) {\n baseColor = texture2D(projectorTex, vec2(x, y));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},ImagePlaneShaders}();exports.ImagePlaneShaders=ImagePlaneShaders},{path:85}],378:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),State_1=require("../../State"),Render_1=require("../../Render"),Utils_1=require("../../Utils"),Component_1=require("../../Component"),operators_1=require("rxjs/operators"),SliderState=function(){function SliderState(){this._imagePlaneFactory=new Component_1.ImagePlaneFactory,this._imagePlaneScene=new Component_1.ImagePlaneScene,this._currentKey=null,this._previousKey=null,this._currentPano=!1,this._frameId=0,this._glNeedsRender=!1,this._domNeedsRender=!0,this._curtain=1}return Object.defineProperty(SliderState.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(SliderState.prototype,"curtain",{get:function(){return this._curtain},enumerable:!0,configurable:!0}),Object.defineProperty(SliderState.prototype,"glNeedsRender",{get:function(){return this._glNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(SliderState.prototype,"domNeedsRender",{get:function(){return this._domNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(SliderState.prototype,"sliderVisible",{get:function(){return this._sliderVisible},set:function(value){this._sliderVisible=value,this._domNeedsRender=!0},enumerable:!0,configurable:!0}),Object.defineProperty(SliderState.prototype,"disabled",{get:function(){return null==this._currentKey||null==this._previousKey||this._currentPano},enumerable:!0,configurable:!0}),SliderState.prototype.update=function(frame){this._updateFrameId(frame.id);var needsRender=this._updateImagePlanes(frame.state);this._domNeedsRender=needsRender||this._domNeedsRender,needsRender=this._updateCurtain(frame.state.alpha)||needsRender,this._glNeedsRender=needsRender||this._glNeedsRender},SliderState.prototype.updateTexture=function(image,node){var imagePlanes=node.key===this._currentKey?this._imagePlaneScene.imagePlanes:node.key===this._previousKey?this._imagePlaneScene.imagePlanesOld:[];if(0!==imagePlanes.length){this._glNeedsRender=!0;for(var _i=0,imagePlanes_1=imagePlanes;_i<imagePlanes_1.length;_i++){var texture=imagePlanes_1[_i].material.uniforms.projectorTex.value;texture.image=image,texture.needsUpdate=!0}}},SliderState.prototype.render=function(perspectiveCamera,renderer){this.disabled||renderer.render(this._imagePlaneScene.sceneOld,perspectiveCamera),renderer.render(this._imagePlaneScene.scene,perspectiveCamera)},SliderState.prototype.dispose=function(){this._imagePlaneScene.clear()},SliderState.prototype.clearGLNeedsRender=function(){this._glNeedsRender=!1},SliderState.prototype.clearDomNeedsRender=function(){this._domNeedsRender=!1},SliderState.prototype._updateFrameId=function(frameId){this._frameId=frameId},SliderState.prototype._updateImagePlanes=function(state){if(null!=state.currentNode){var needsRender=!1;return null!=state.previousNode&&this._previousKey!==state.previousNode.key&&(needsRender=!0,this._previousKey=state.previousNode.key,this._imagePlaneScene.setImagePlanesOld([this._imagePlaneFactory.createMesh(state.previousNode,state.previousTransform)])),this._currentKey!==state.currentNode.key&&(needsRender=!0,this._currentKey=state.currentNode.key,this._currentPano=state.currentNode.pano,this._imagePlaneScene.setImagePlanes([this._imagePlaneFactory.createMesh(state.currentNode,state.currentTransform)]),this.disabled||this._updateBbox()),needsRender}},SliderState.prototype._updateCurtain=function(alpha){return!(this.disabled||Math.abs(this._curtain-alpha)<.001)&&(this._curtain=alpha,this._updateBbox(),!0)},SliderState.prototype._updateBbox=function(){for(var _i=0,_a=this._imagePlaneScene.imagePlanes;_i<_a.length;_i++){_a[_i].material.uniforms.bbox.value.z=this._curtain}},SliderState}(),SliderComponent=function(_super){function SliderComponent(name,container,navigator,dom){var _this=_super.call(this,name,container,navigator)||this;return _this._dom=dom||new Utils_1.DOM,_this._sliderStateOperation$=new rxjs_1.Subject,_this._sliderStateCreator$=new rxjs_1.Subject,_this._sliderStateDisposer$=new rxjs_1.Subject,_this._sliderState$=_this._sliderStateOperation$.pipe(operators_1.scan(function(sliderState,operation){return operation(sliderState)},null),operators_1.filter(function(sliderState){return null!=sliderState}),operators_1.distinctUntilChanged(void 0,function(sliderState){return sliderState.frameId})),_this._sliderStateCreator$.pipe(operators_1.map(function(){return function(sliderState){if(null!=sliderState)throw new Error("Multiple slider states can not be created at the same time");return new SliderState}})).subscribe(_this._sliderStateOperation$),_this._sliderStateDisposer$.pipe(operators_1.map(function(){return function(sliderState){return sliderState.dispose(),null}})).subscribe(_this._sliderStateOperation$),_this}return __extends(SliderComponent,_super),SliderComponent.prototype.setKeys=function(keys){this.configure({keys:keys})},SliderComponent.prototype.setInitialPosition=function(initialPosition){this.configure({initialPosition:initialPosition})},SliderComponent.prototype.setSliderVisible=function(sliderVisible){this.configure({sliderVisible:sliderVisible})},SliderComponent.prototype._activate=function(){var _this=this;this._sliderContainer=this._dom.createElement("div","beeview-js-slider-container",this._container.element),this._sliderWrapper=this._dom.createElement("div","SliderWrapper",this._sliderContainer),this._sliderControl=this._dom.createElement("input","SliderControl",this._sliderWrapper),this._sliderControl.setAttribute("type","range"),this._sliderControl.setAttribute("min","0"),this._sliderControl.setAttribute("max","1000"),this._sliderControl.style.visibility="hidden",this._moveToHandler=function(e){var curtain=Number(e.target.value)/1e3;_this._navigator.stateService.moveTo(curtain)},this._sliderControl.addEventListener("input",this._moveToHandler),this._sliderControl.addEventListener("change",this._moveToHandler),rxjs_1.combineLatest(this._navigator.stateService.state$,this._configuration$).pipe(operators_1.first()).subscribe(function(_a){var state=_a[0],configuration=_a[1];if(state===State_1.State.Traversing){_this._navigator.stateService.wait();var position=null!=configuration.initialPosition?configuration.initialPosition:1;_this._sliderControl.value=(1e3*position).toString(),_this._navigator.stateService.moveTo(position)}}),this._glRenderSubscription=this._sliderState$.pipe(operators_1.map(function(sliderState){var renderHash={name:_this._name,render:{frameId:sliderState.frameId,needsRender:sliderState.glNeedsRender,render:sliderState.render.bind(sliderState),stage:Render_1.GLRenderStage.Background}};return sliderState.clearGLNeedsRender(),renderHash})).subscribe(this._container.glRenderer.render$),this._domRenderSubscription=this._sliderState$.pipe(operators_1.filter(function(sliderState){return sliderState.domNeedsRender})).subscribe(function(sliderState){_this._sliderControl.value=(1e3*sliderState.curtain).toString();var visibility=sliderState.disabled||!sliderState.sliderVisible?"hidden":"visible";_this._sliderControl.style.visibility=visibility,sliderState.clearDomNeedsRender()}),this._sliderStateCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.pipe(operators_1.map(function(frame){return function(sliderState){return sliderState.update(frame),sliderState}})).subscribe(this._sliderStateOperation$),this._setSliderVisibleSubscription=this._configuration$.pipe(operators_1.map(function(configuration){return null==configuration.sliderVisible||configuration.sliderVisible}),operators_1.distinctUntilChanged(),operators_1.map(function(sliderVisible){return function(sliderState){return sliderState.sliderVisible=sliderVisible,sliderState}})).subscribe(this._sliderStateOperation$),this._setKeysSubscription=this._configuration$.pipe(operators_1.filter(function(configuration){return null!=configuration.keys}),operators_1.switchMap(function(configuration){return rxjs_1.zip(_this._catchCacheNode$(configuration.keys.background),_this._catchCacheNode$(configuration.keys.foreground)).pipe(operators_1.map(function(nodes){return{background:nodes[0],foreground:nodes[1]}}),operators_1.zip(_this._navigator.stateService.currentState$.pipe(operators_1.first())),operators_1.map(function(nf){return{nodes:nf[0],state:nf[1].state}}))})).subscribe(function(co){null!=co.state.currentNode&&null!=co.state.previousNode&&co.state.currentNode.key===co.nodes.foreground.key&&co.state.previousNode.key===co.nodes.background.key||(co.state.currentNode.key!==co.nodes.background.key?co.state.currentNode.key!==co.nodes.foreground.key||1!==co.state.trajectory.length?(_this._navigator.stateService.setNodes([co.nodes.background]),_this._navigator.stateService.setNodes([co.nodes.foreground])):_this._navigator.stateService.prependNodes([co.nodes.background]):_this._navigator.stateService.setNodes([co.nodes.foreground]))},function(e){console.error(e)});var previousNode$=this._navigator.stateService.currentState$.pipe(operators_1.map(function(frame){return frame.state.previousNode}),operators_1.filter(function(node){return null!=node}),operators_1.distinctUntilChanged(void 0,function(node){return node.key}));this._nodeSubscription=rxjs_1.merge(previousNode$,this._navigator.stateService.currentNode$).pipe(operators_1.filter(function(node){return node.pano?Utils_1.Settings.maxImageSize>Utils_1.Settings.basePanoramaSize:Utils_1.Settings.maxImageSize>Utils_1.Settings.baseImageSize}),operators_1.mergeMap(function(node){var baseImageSize=node.pano?Utils_1.Settings.basePanoramaSize:Utils_1.Settings.baseImageSize;return Math.max(node.image.width,node.image.height)>baseImageSize?rxjs_1.empty():node.cacheImage$(Utils_1.Settings.maxImageSize).pipe(operators_1.map(function(n){return[n.image,n]}),operators_1.catchError(function(error,caught){return console.error("Failed to fetch high res slider image ("+node.key+")",error),rxjs_1.empty()}))}),operators_1.map(function(_a){var element=_a[0],node=_a[1];return function(sliderState){return sliderState.updateTexture(element,node),sliderState}})).subscribe(this._sliderStateOperation$)},SliderComponent.prototype._deactivate=function(){var _this=this;this._navigator.stateService.state$.pipe(operators_1.first()).subscribe(function(state){state===State_1.State.Waiting&&_this._navigator.stateService.traverse()}),this._sliderStateDisposer$.next(null),this._setKeysSubscription.unsubscribe(),this._setSliderVisibleSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._glRenderSubscription.unsubscribe(),this._domRenderSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this.configure({keys:null}),this._sliderControl.removeEventListener("input",this._moveToHandler),this._sliderControl.removeEventListener("change",this._moveToHandler),this._container.element.removeChild(this._sliderContainer),this._moveToHandler=null,this._sliderControl=null,this._sliderWrapper=null,this._sliderContainer=null},SliderComponent.prototype._getDefaultConfiguration=function(){return{}},SliderComponent.prototype._catchCacheNode$=function(key){return this._navigator.graphService.cacheNode$(key).pipe(operators_1.catchError(function(error,caught){return console.error("Failed to cache slider node ("+key+")",error),rxjs_1.empty()}))},SliderComponent.componentName="slider",SliderComponent}(Component_1.Component);exports.SliderComponent=SliderComponent,Component_1.ComponentService.register(SliderComponent),exports.default=SliderComponent},{"../../Component":343,"../../Render":349,"../../State":350,"../../Utils":353,rxjs:89,"rxjs/operators":285}],379:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(CoverState){CoverState[CoverState.Hidden=0]="Hidden",CoverState[CoverState.Loading=1]="Loading",CoverState[CoverState.Visible=2]="Visible"}(exports.CoverState||(exports.CoverState={}))},{}],380:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ICoverConfiguration_1=require("./ICoverConfiguration");exports.CoverState=ICoverConfiguration_1.CoverState},{"./ICoverConfiguration":379}],381:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../Component"),Edge_1=require("../../Edge"),operators_1=require("rxjs/operators"),KeySequenceNavigationHandler=function(_super){function KeySequenceNavigationHandler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(KeySequenceNavigationHandler,_super),KeySequenceNavigationHandler.prototype._enable=function(){var _this=this,sequenceEdges$=this._navigator.stateService.currentNode$.pipe(operators_1.switchMap(function(node){return node.sequenceEdges$}));this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(operators_1.withLatestFrom(sequenceEdges$)).subscribe(function(_a){var event=_a[0],edgeStatus=_a[1],direction=null;switch(event.keyCode){case 38:direction=Edge_1.EdgeDirection.Next;break;case 40:direction=Edge_1.EdgeDirection.Prev;break;default:return}if(event.preventDefault(),event.altKey&&!event.shiftKey&&edgeStatus.cached)for(var _i=0,_b=edgeStatus.edges;_i<_b.length;_i++){var edge=_b[_i];if(edge.data.direction===direction)return void _this._navigator.moveToKey$(edge.to).subscribe(function(n){},function(e){console.error(e)})}})},KeySequenceNavigationHandler.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},KeySequenceNavigationHandler.prototype._getConfiguration=function(enable){return{keySequenceNavigation:enable}},KeySequenceNavigationHandler}(Component_1.HandlerBase);exports.KeySequenceNavigationHandler=KeySequenceNavigationHandler,exports.default=KeySequenceNavigationHandler},{"../../Component":343,"../../Edge":344,"rxjs/operators":285}],382:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../Component"),Edge_1=require("../../Edge"),operators_1=require("rxjs/operators"),KeySpatialNavigationHandler=function(_super){function KeySpatialNavigationHandler(component,container,navigator,spatial){var _this=_super.call(this,component,container,navigator)||this;return _this._spatial=spatial,_this}return __extends(KeySpatialNavigationHandler,_super),KeySpatialNavigationHandler.prototype._enable=function(){var _this=this,spatialEdges$=this._navigator.stateService.currentNode$.pipe(operators_1.switchMap(function(node){return node.spatialEdges$}));this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(operators_1.withLatestFrom(spatialEdges$,this._navigator.stateService.currentState$)).subscribe(function(_a){var event=_a[0],edgeStatus=_a[1],frame=_a[2],pano=frame.state.currentNode.pano,direction=null;switch(event.keyCode){case 37:direction=event.shiftKey&&!pano?Edge_1.EdgeDirection.TurnLeft:Edge_1.EdgeDirection.StepLeft;break;case 38:direction=event.shiftKey&&!pano?Edge_1.EdgeDirection.Pano:Edge_1.EdgeDirection.StepForward;break;case 39:direction=event.shiftKey&&!pano?Edge_1.EdgeDirection.TurnRight:Edge_1.EdgeDirection.StepRight;break;case 40:direction=event.shiftKey&&!pano?Edge_1.EdgeDirection.TurnU:Edge_1.EdgeDirection.StepBackward;break;default:return}if(event.preventDefault(),!(event.altKey||!edgeStatus.cached||event.shiftKey&&pano))if(pano){var shifts={};shifts[Edge_1.EdgeDirection.StepBackward]=Math.PI,shifts[Edge_1.EdgeDirection.StepForward]=0,shifts[Edge_1.EdgeDirection.StepLeft]=Math.PI/2,shifts[Edge_1.EdgeDirection.StepRight]=-Math.PI/2;for(var phi=_this._rotationFromCamera(frame.state.camera).phi,navigationAngle=_this._spatial.wrapAngle(phi+shifts[direction]),threshold=Math.PI/4,edges=edgeStatus.edges.filter(function(e){return e.data.direction===Edge_1.EdgeDirection.Pano||e.data.direction===direction}),smallestAngle=Number.MAX_VALUE,toKey=null,_i=0,edges_1=edges;_i<edges_1.length;_i++){var edge=edges_1[_i],angle=Math.abs(_this._spatial.wrapAngle(edge.data.worldMotionAzimuth-navigationAngle));angle<Math.min(smallestAngle,threshold)&&(smallestAngle=angle,toKey=edge.to)}if(null==toKey)return;_this._moveToKey(toKey)}else _this._moveDir(direction,edgeStatus)})},KeySpatialNavigationHandler.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},KeySpatialNavigationHandler.prototype._getConfiguration=function(enable){return{keySpatialNavigation:enable}},KeySpatialNavigationHandler.prototype._moveDir=function(direction,edgeStatus){for(var _i=0,_a=edgeStatus.edges;_i<_a.length;_i++){var edge=_a[_i];if(edge.data.direction===direction)return void this._moveToKey(edge.to)}},KeySpatialNavigationHandler.prototype._moveToKey=function(key){this._navigator.moveToKey$(key).subscribe(function(n){},function(e){console.error(e)})},KeySpatialNavigationHandler.prototype._rotationFromCamera=function(camera){var direction=camera.lookat.clone().sub(camera.position),upProjection=direction.clone().dot(camera.up),planeProjection=direction.clone().sub(camera.up.clone().multiplyScalar(upProjection));return{phi:Math.atan2(planeProjection.y,planeProjection.x),theta:Math.PI/2-this._spatial.angleToPlane(direction.toArray(),[0,0,1])}},KeySpatialNavigationHandler}(Component_1.HandlerBase);exports.KeySpatialNavigationHandler=KeySpatialNavigationHandler,exports.default=KeySpatialNavigationHandler},{"../../Component":343,"../../Edge":344,"rxjs/operators":285}],383:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../Component"),operators_1=require("rxjs/operators"),KeyZoomHandler=function(_super){function KeyZoomHandler(component,container,navigator,viewportCoords){var _this=_super.call(this,component,container,navigator)||this;return _this._viewportCoords=viewportCoords,_this}return __extends(KeyZoomHandler,_super),KeyZoomHandler.prototype._enable=function(){var _this=this;this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(_a){var event=_a[0],render=_a[1],transform=_a[2];if(!(event.altKey||event.shiftKey||event.ctrlKey||event.metaKey)){var delta=0;switch(event.key){case"+":delta=1;break;case"-":delta=-1;break;default:return}event.preventDefault();var unprojected=_this._viewportCoords.unprojectFromViewport(0,0,render.perspective),reference=transform.projectBasic(unprojected.toArray());_this._navigator.stateService.zoomIn(delta,reference)}})},KeyZoomHandler.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},KeyZoomHandler.prototype._getConfiguration=function(enable){return{keyZoom:enable}},KeyZoomHandler}(Component_1.HandlerBase);exports.KeyZoomHandler=KeyZoomHandler,exports.default=KeyZoomHandler},{"../../Component":343,"rxjs/operators":285}],384:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../Component"),Geo_1=require("../../Geo"),KeyboardComponent=function(_super){function KeyboardComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;return _this._keyZoomHandler=new Component_1.KeyZoomHandler(_this,container,navigator,new Geo_1.ViewportCoords),_this._keySequenceNavigationHandler=new Component_1.KeySequenceNavigationHandler(_this,container,navigator),_this._keySpatialNavigationHandler=new Component_1.KeySpatialNavigationHandler(_this,container,navigator,new Geo_1.Spatial),_this}return __extends(KeyboardComponent,_super),Object.defineProperty(KeyboardComponent.prototype,"keyZoom",{get:function(){return this._keyZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(KeyboardComponent.prototype,"keySequenceNavigation",{get:function(){return this._keySequenceNavigationHandler},enumerable:!0,configurable:!0}),Object.defineProperty(KeyboardComponent.prototype,"keySpatialNavigation",{get:function(){return this._keySpatialNavigationHandler},enumerable:!0,configurable:!0}),KeyboardComponent.prototype._activate=function(){var _this=this;this._configurationSubscription=this._configuration$.subscribe(function(configuration){configuration.keyZoom?_this._keyZoomHandler.enable():_this._keyZoomHandler.disable(),configuration.keySequenceNavigation?_this._keySequenceNavigationHandler.enable():_this._keySequenceNavigationHandler.disable(),configuration.keySpatialNavigation?_this._keySpatialNavigationHandler.enable():_this._keySpatialNavigationHandler.disable()})},KeyboardComponent.prototype._deactivate=function(){this._configurationSubscription.unsubscribe()},KeyboardComponent.prototype._getDefaultConfiguration=function(){return{keySequenceNavigation:!0,keySpatialNavigation:!0,keyZoom:!0}},KeyboardComponent.componentName="keyboard",KeyboardComponent}(Component_1.Component);exports.KeyboardComponent=KeyboardComponent,Component_1.ComponentService.register(KeyboardComponent),exports.default=KeyboardComponent},{"../../Component":343,"../../Geo":346}],385:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MarkerComponent_1=require("./MarkerComponent");exports.MarkerComponent=MarkerComponent_1.MarkerComponent;var SimpleMarker_1=require("./marker/SimpleMarker");exports.SimpleMarker=SimpleMarker_1.SimpleMarker;var CircleMarker_1=require("./marker/CircleMarker");exports.CircleMarker=CircleMarker_1.CircleMarker;var ArrowMarker_1=require("./marker/ArrowMarker");exports.ArrowMarker=ArrowMarker_1.ArrowMarker;var DotMarker_1=require("./marker/DotMarker");exports.DotMarker=DotMarker_1.DotMarker},{"./MarkerComponent":386,"./marker/ArrowMarker":389,"./marker/CircleMarker":390,"./marker/DotMarker":391,"./marker/SimpleMarker":393}],386:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),when=require("when"),rxjs_1=require("rxjs"),Component_1=require("../../Component"),Render_1=require("../../Render"),Graph_1=require("../../Graph"),Geo_1=require("../../Geo"),operators_1=require("rxjs/operators"),MarkerComponent=function(_super){function MarkerComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;return _this._relativeGroundAltitude=-2,_this._geoCoords=new Geo_1.GeoCoords,_this._graphCalculator=new Graph_1.GraphCalculator,_this._markerScene=new Component_1.MarkerScene,_this._markerSet=new Component_1.MarkerSet,_this._viewportCoords=new Geo_1.ViewportCoords,_this}return __extends(MarkerComponent,_super),Object.defineProperty(MarkerComponent.prototype,"mouseMove$",{get:function(){return this._mouseMove$},enumerable:!0,configurable:!0}),MarkerComponent.prototype.add=function(markers){this._markerSet.add(markers)},MarkerComponent.prototype.get=function(markerId){return this._markerSet.get(markerId)},MarkerComponent.prototype.getAll=function(){return this._markerSet.getAll()},MarkerComponent.prototype.getMarkerIdAt=function(pixelPoint){var _this=this;return when.promise(function(resolve,reject){_this._container.renderService.renderCamera$.pipe(operators_1.first(),operators_1.map(function(render){var viewport=_this._viewportCoords.canvasToViewport(pixelPoint[0],pixelPoint[1],_this._container.element);return _this._markerScene.intersectObjects(viewport,render.perspective)})).subscribe(function(id){resolve(id)},function(error){reject(error)})})},MarkerComponent.prototype.has=function(markerId){return this._markerSet.has(markerId)},MarkerComponent.prototype.remove=function(markerIds){this._markerSet.remove(markerIds)},MarkerComponent.prototype.removeAll=function(){this._markerSet.removeAll()},MarkerComponent.prototype._activate=function(){var _this=this,groundAltitude$=this._navigator.stateService.currentState$.pipe(operators_1.map(function(frame){return frame.state.camera.position.z+_this._relativeGroundAltitude}),operators_1.distinctUntilChanged(function(a1,a2){return Math.abs(a1-a2)<.01}),operators_1.publishReplay(1),operators_1.refCount()),geoInitiated$=rxjs_1.combineLatest(groundAltitude$,this._navigator.stateService.reference$).pipe(operators_1.first(),operators_1.map(function(){}),operators_1.publishReplay(1),operators_1.refCount()),clampedConfiguration$=this._configuration$.pipe(operators_1.map(function(configuration){return{visibleBBoxSize:Math.max(1,Math.min(200,configuration.visibleBBoxSize))}})),currentlatLon$=this._navigator.stateService.currentNode$.pipe(operators_1.map(function(node){return node.latLon}),operators_1.publishReplay(1),operators_1.refCount()),visibleBBox$=rxjs_1.combineLatest(clampedConfiguration$,currentlatLon$).pipe(operators_1.map(function(_a){var configuration=_a[0],latLon=_a[1];return _this._graphCalculator.boundingBoxCorners(latLon,configuration.visibleBBoxSize/2)}),operators_1.publishReplay(1),operators_1.refCount()),visibleMarkers$=rxjs_1.combineLatest(rxjs_1.of(this._markerSet).pipe(operators_1.concat(this._markerSet.changed$)),visibleBBox$).pipe(operators_1.map(function(_a){var set=_a[0],bbox=_a[1];return set.search(bbox)}));this._setChangedSubscription=geoInitiated$.pipe(operators_1.switchMap(function(){return visibleMarkers$.pipe(operators_1.withLatestFrom(_this._navigator.stateService.reference$,groundAltitude$))})).subscribe(function(_a){for(var markers=_a[0],reference=_a[1],alt=_a[2],geoCoords=_this._geoCoords,markerScene=_this._markerScene,sceneMarkers=markerScene.markers,markersToRemove=Object.assign({},sceneMarkers),_i=0,markers_1=markers;_i<markers_1.length;_i++){var marker=markers_1[_i];if(marker.id in sceneMarkers)delete markersToRemove[marker.id];else{var point3d=geoCoords.geodeticToEnu(marker.latLon.lat,marker.latLon.lon,reference.alt+alt,reference.lat,reference.lon,reference.alt);markerScene.add(marker,point3d)}}for(var id in markersToRemove)markersToRemove.hasOwnProperty(id)&&markerScene.remove(id)}),this._markersUpdatedSubscription=geoInitiated$.pipe(operators_1.switchMap(function(){return _this._markerSet.updated$.pipe(operators_1.withLatestFrom(visibleBBox$,_this._navigator.stateService.reference$,groundAltitude$))})).subscribe(function(_a){for(var markers=_a[0],_b=_a[1],sw=_b[0],ne=_b[1],reference=_a[2],alt=_a[3],geoCoords=_this._geoCoords,markerScene=_this._markerScene,_i=0,markers_2=markers;_i<markers_2.length;_i++){var marker=markers_2[_i],exists=markerScene.has(marker.id),visible=marker.latLon.lat>sw.lat&&marker.latLon.lat<ne.lat&&marker.latLon.lon>sw.lon&&marker.latLon.lon<ne.lon;if(visible){var point3d=geoCoords.geodeticToEnu(marker.latLon.lat,marker.latLon.lon,reference.alt+alt,reference.lat,reference.lon,reference.alt);markerScene.add(marker,point3d)}else!visible&&exists&&markerScene.remove(marker.id)}}),this._referenceSubscription=this._navigator.stateService.reference$.pipe(operators_1.skip(1),operators_1.withLatestFrom(groundAltitude$)).subscribe(function(_a){for(var reference=_a[0],alt=_a[1],geoCoords=_this._geoCoords,markerScene=_this._markerScene,_i=0,_b=markerScene.getAll();_i<_b.length;_i++){var marker=_b[_i],point3d=geoCoords.geodeticToEnu(marker.latLon.lat,marker.latLon.lon,reference.alt+alt,reference.lat,reference.lon,reference.alt);markerScene.update(marker.id,point3d)}}),this._adjustHeightSubscription=groundAltitude$.pipe(operators_1.skip(1),operators_1.withLatestFrom(this._navigator.stateService.reference$,currentlatLon$)).subscribe(function(_a){for(var alt=_a[0],reference=_a[1],latLon=_a[2],geoCoords=_this._geoCoords,markerScene=_this._markerScene,position=geoCoords.geodeticToEnu(latLon.lat,latLon.lon,reference.alt+alt,reference.lat,reference.lon,reference.alt),_i=0,_b=markerScene.getAll();_i<_b.length;_i++){var marker=_b[_i],point3d=geoCoords.geodeticToEnu(marker.latLon.lat,marker.latLon.lon,reference.alt+alt,reference.lat,reference.lon,reference.alt),distanceX=point3d[0]-position[0],distanceY=point3d[1]-position[1],groundDistance=Math.sqrt(distanceX*distanceX+distanceY*distanceY);50<groundDistance||markerScene.lerpAltitude(marker.id,alt,Math.min(1,Math.max(0,1.2-1.2*groundDistance/50)))}}),this._renderSubscription=this._navigator.stateService.currentState$.pipe(operators_1.map(function(frame){var scene=_this._markerScene;return{name:_this._name,render:{frameId:frame.id,needsRender:scene.needsRender,render:scene.render.bind(scene),stage:Render_1.GLRenderStage.Foreground}}})).subscribe(this._container.glRenderer.render$),this._mouseMove$=rxjs_1.combineLatest(this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$).pipe(operators_1.map(function(_a){var render=_a[0],event=_a[1],element=_this._container.element,_b=_this._viewportCoords.canvasPosition(event,element),canvasX=_b[0],canvasY=_b[1],viewport=_this._viewportCoords.canvasToViewport(canvasX,canvasY,element);return[event,_this._markerScene.intersectObjects(viewport,render.perspective)]}),operators_1.publishReplay(1),operators_1.refCount());var hoveredMarkerId$=this._mouseMove$.pipe(operators_1.map(function(_a){_a[0];return _a[1]}),operators_1.publishReplay(1),operators_1.refCount()),draggingStarted$=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).pipe(operators_1.map(function(event){return!0})),draggingStopped$=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).pipe(operators_1.map(function(event){return!1})),filteredDragging$=rxjs_1.merge(draggingStarted$,draggingStopped$).pipe(operators_1.startWith(!1));this._dragEventSubscription=draggingStarted$.pipe(operators_1.withLatestFrom(hoveredMarkerId$),operators_1.merge(rxjs_1.combineLatest(draggingStopped$,rxjs_1.of(null))),operators_1.startWith([!1,null]),operators_1.pairwise()).subscribe(function(_a){var previous=_a[0],current=_a[1],dragging=current[0],eventType=dragging?MarkerComponent.dragstart:MarkerComponent.dragend,id=dragging?current[1]:previous[1],markerEvent={marker:_this._markerScene.get(id),target:_this,type:eventType};_this.fire(eventType,markerEvent)});var mouseDown$=rxjs_1.merge(this._container.mouseService.mouseDown$.pipe(operators_1.map(function(event){return!0})),this._container.mouseService.documentMouseUp$.pipe(operators_1.map(function(event){return!1}))).pipe(operators_1.startWith(!1));this._mouseClaimSubscription=rxjs_1.combineLatest(this._container.mouseService.active$,hoveredMarkerId$.pipe(operators_1.distinctUntilChanged()),mouseDown$,filteredDragging$).pipe(operators_1.map(function(_a){var active=_a[0],markerId=_a[1],mouseDown=_a[2],filteredDragging=_a[3];return!active&&null!=markerId&&mouseDown||filteredDragging}),operators_1.distinctUntilChanged()).subscribe(function(claim){claim?(_this._container.mouseService.claimMouse(_this._name,1),_this._container.mouseService.claimWheel(_this._name,1)):(_this._container.mouseService.unclaimMouse(_this._name),_this._container.mouseService.unclaimWheel(_this._name))});var offset$=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).pipe(operators_1.withLatestFrom(hoveredMarkerId$,this._container.renderService.renderCamera$),operators_1.map(function(_a){var e=_a[0],id=_a[1],r=_a[2],marker=_this._markerScene.get(id),element=_this._container.element,_b=_this._viewportCoords.projectToCanvas(marker.geometry.position.toArray(),element,r.perspective),groundCanvasX=_b[0],groundCanvasY=_b[1],_c=_this._viewportCoords.canvasPosition(e,element);return[marker,[_c[0]-groundCanvasX,_c[1]-groundCanvasY],r]}),operators_1.publishReplay(1),operators_1.refCount());this._updateMarkerSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).pipe(operators_1.withLatestFrom(offset$,this._navigator.stateService.reference$,clampedConfiguration$)).subscribe(function(_a){var event=_a[0],_b=_a[1],marker=_b[0],offset=_b[1],render=_b[2],reference=_a[2],configuration=_a[3];if(_this._markerScene.has(marker.id)){var element=_this._container.element,_c=_this._viewportCoords.canvasPosition(event,element),canvasX=_c[0],canvasY=_c[1],groundX=canvasX-offset[0],groundY=canvasY-offset[1],_d=_this._viewportCoords.canvasToViewport(groundX,groundY,element),viewportX=_d[0],viewportY=_d[1],direction=new THREE.Vector3(viewportX,viewportY,1).unproject(render.perspective).sub(render.perspective.position).normalize(),distance=Math.min(_this._relativeGroundAltitude/direction.z,configuration.visibleBBoxSize/2-.1);if(!(distance<0)){var intersection=direction.clone().multiplyScalar(distance).add(render.perspective.position);intersection.z=render.perspective.position.z+_this._relativeGroundAltitude;var _e=_this._geoCoords.enuToGeodetic(intersection.x,intersection.y,intersection.z,reference.lat,reference.lon,reference.alt),lat=_e[0],lon=_e[1];_this._markerScene.update(marker.id,intersection.toArray(),{lat:lat,lon:lon}),_this._markerSet.update(marker);var markerEvent={marker:marker,target:_this,type:MarkerComponent.changed};_this.fire(MarkerComponent.changed,markerEvent)}}})},MarkerComponent.prototype._deactivate=function(){this._adjustHeightSubscription.unsubscribe(),this._dragEventSubscription.unsubscribe(),this._markersUpdatedSubscription.unsubscribe(),this._mouseClaimSubscription.unsubscribe(),this._referenceSubscription.unsubscribe(),this._renderSubscription.unsubscribe(),this._setChangedSubscription.unsubscribe(),this._updateMarkerSubscription.unsubscribe(),this._markerScene.clear()},MarkerComponent.prototype._getDefaultConfiguration=function(){return{visibleBBoxSize:100}},MarkerComponent.componentName="marker",MarkerComponent.changed="changed",MarkerComponent.dragstart="dragstart",MarkerComponent.dragend="dragend",MarkerComponent}(Component_1.Component);exports.MarkerComponent=MarkerComponent,Component_1.ComponentService.register(MarkerComponent),exports.default=MarkerComponent},{"../../Component":343,"../../Geo":346,"../../Graph":347,"../../Render":349,rxjs:89,"rxjs/operators":285,three:288,when:337}],387:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),MarkerScene=function(){function MarkerScene(scene,raycaster){this._needsRender=!1,this._interactiveObjects=[],this._markers={},this._objectMarkers={},this._raycaster=raycaster||new THREE.Raycaster,this._scene=scene||new THREE.Scene}return Object.defineProperty(MarkerScene.prototype,"markers",{get:function(){return this._markers},enumerable:!0,configurable:!0}),Object.defineProperty(MarkerScene.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),MarkerScene.prototype.add=function(marker,position){marker.id in this._markers&&this._dispose(marker.id),marker.createGeometry(position),this._scene.add(marker.geometry);for(var _i=0,_a=(this._markers[marker.id]=marker).getInteractiveObjects();_i<_a.length;_i++){var interactiveObject=_a[_i];this._interactiveObjects.push(interactiveObject),this._objectMarkers[interactiveObject.uuid]=marker.id}this._needsRender=!0},MarkerScene.prototype.clear=function(){for(var id in this._markers)this._markers.hasOwnProperty&&this._dispose(id);this._needsRender=!0},MarkerScene.prototype.get=function(id){return this._markers[id]},MarkerScene.prototype.getAll=function(){var _this=this;return Object.keys(this._markers).map(function(id){return _this._markers[id]})},MarkerScene.prototype.has=function(id){return id in this._markers},MarkerScene.prototype.intersectObjects=function(_a,camera){var viewportX=_a[0],viewportY=_a[1];this._raycaster.setFromCamera(new THREE.Vector2(viewportX,viewportY),camera);for(var _i=0,intersects_1=this._raycaster.intersectObjects(this._interactiveObjects);_i<intersects_1.length;_i++){var intersect=intersects_1[_i];if(intersect.object.uuid in this._objectMarkers)return this._objectMarkers[intersect.object.uuid]}return null},MarkerScene.prototype.lerpAltitude=function(id,alt,alpha){id in this._markers&&(this._markers[id].lerpAltitude(alt,alpha),this._needsRender=!0)},MarkerScene.prototype.remove=function(id){id in this._markers&&(this._dispose(id),this._needsRender=!0)},MarkerScene.prototype.render=function(perspectiveCamera,renderer){renderer.render(this._scene,perspectiveCamera),this._needsRender=!1},MarkerScene.prototype.update=function(id,position,latLon){id in this._markers&&(this._markers[id].updatePosition(position,latLon),this._needsRender=!0)},MarkerScene.prototype._dispose=function(id){var marker=this._markers[id];this._scene.remove(marker.geometry);for(var _i=0,_a=marker.getInteractiveObjects();_i<_a.length;_i++){var interactiveObject=_a[_i],index=this._interactiveObjects.indexOf(interactiveObject);-1!==index?this._interactiveObjects.splice(index,1):console.warn("Object does not exist ("+interactiveObject.id+") for "+id),delete this._objectMarkers[interactiveObject.uuid]}marker.disposeGeometry(),delete this._markers[id]},MarkerScene}();exports.MarkerScene=MarkerScene,exports.default=MarkerScene},{three:288}],388:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rbush=require("rbush"),rxjs_1=require("rxjs"),MarkerSet=function(){function MarkerSet(){this._hash={},this._index=rbush(16,[".lon",".lat",".lon",".lat"]),this._indexChanged$=new rxjs_1.Subject,this._updated$=new rxjs_1.Subject}return Object.defineProperty(MarkerSet.prototype,"changed$",{get:function(){return this._indexChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(MarkerSet.prototype,"updated$",{get:function(){return this._updated$},enumerable:!0,configurable:!0}),MarkerSet.prototype.add=function(markers){for(var updated=[],hash=this._hash,index=this._index,_i=0,markers_1=markers;_i<markers_1.length;_i++){var marker=markers_1[_i],id=marker.id;id in hash&&(index.remove(hash[id]),updated.push(marker));var item={lat:marker.latLon.lat,lon:marker.latLon.lon,marker:marker};hash[id]=item,index.insert(item)}0<updated.length&&this._updated$.next(updated),markers.length>updated.length&&this._indexChanged$.next(this)},MarkerSet.prototype.has=function(id){return id in this._hash},MarkerSet.prototype.get=function(id){return this.has(id)?this._hash[id].marker:void 0},MarkerSet.prototype.getAll=function(){return this._index.all().map(function(indexItem){return indexItem.marker})},MarkerSet.prototype.remove=function(ids){for(var hash=this._hash,index=this._index,changed=!1,_i=0,ids_1=ids;_i<ids_1.length;_i++){var id=ids_1[_i];if(id in hash){var item=hash[id];index.remove(item),delete hash[id],changed=!0}}changed&&this._indexChanged$.next(this)},MarkerSet.prototype.removeAll=function(){this._hash={},this._index.clear(),this._indexChanged$.next(this)},MarkerSet.prototype.search=function(_a){var sw=_a[0],ne=_a[1];return this._index.search({maxX:ne.lon,maxY:ne.lat,minX:sw.lon,minY:sw.lat}).map(function(indexItem){return indexItem.marker})},MarkerSet.prototype.update=function(marker){var hash=this._hash,index=this._index,id=marker.id;if(id in hash){index.remove(hash[id]);var item={lat:marker.latLon.lat,lon:marker.latLon.lon,marker:marker};hash[id]=item,index.insert(item)}},MarkerSet}();exports.MarkerSet=MarkerSet,exports.default=MarkerSet},{rbush:88,rxjs:89}],389:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),ArrowMarker=function(_super){function ArrowMarker(id,latLon,options){var _this=_super.call(this,id,latLon)||this;return options=options||{},_this._color=null!=options.color?options.color:16777215,_this._opacity=null!=options.opacity?options.opacity:.4,_this._radius=null!=options.radius?options.radius:1,_this._interactive=null==options.interactive||options.interactive,_this}return __extends(ArrowMarker,_super),ArrowMarker.prototype._createGeometry=function(position){var circle=new THREE.Mesh(new THREE.CircleGeometry(this._radius,100),new THREE.MeshBasicMaterial({color:this._color,opacity:this._opacity,transparent:!0}));circle.up.fromArray([0,0,1]),circle.renderOrder=-1;var group=new THREE.Object3D;group.add(circle),group.position.fromArray(position),this._geometry=group},ArrowMarker.prototype._disposeGeometry=function(){for(var _i=0,_a=this._geometry.children;_i<_a.length;_i++){var mesh=_a[_i];mesh.geometry.dispose(),mesh.material.dispose()}},ArrowMarker.prototype._getInteractiveObjects=function(){return this._interactive?[this._geometry.children[0]]:[]},ArrowMarker}(require("../../../Component").Marker);exports.ArrowMarker=ArrowMarker,exports.default=ArrowMarker},{"../../../Component":343,three:288}],390:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),CircleMarker=function(_super){function CircleMarker(id,latLon,options){var _this=_super.call(this,id,latLon)||this;return options=options||{},_this._color=null!=options.color?options.color:16777215,_this._opacity=null!=options.opacity?options.opacity:.4,_this._radius=null!=options.radius?options.radius:.4,_this}return __extends(CircleMarker,_super),CircleMarker.prototype._createGeometry=function(position){var circle=new THREE.Mesh(new THREE.CircleGeometry(this._radius,100),new THREE.MeshBasicMaterial({color:this._color,opacity:this._opacity,transparent:!0}));circle.up.fromArray([0,0,1]),circle.renderOrder=-1,circle.position.z=1e-4;var group=new THREE.Object3D;group.add(circle),group.position.fromArray(position),this._geometry=group},CircleMarker.prototype._disposeGeometry=function(){for(var _i=0,_a=this._geometry.children;_i<_a.length;_i++){var mesh=_a[_i];mesh.geometry.dispose(),mesh.material.dispose()}},CircleMarker.prototype._getInteractiveObjects=function(){return[]},CircleMarker}(require("../../../Component").Marker);exports.CircleMarker=CircleMarker,exports.default=CircleMarker},{"../../../Component":343,three:288}],391:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),DotMarker=function(_super){function DotMarker(id,latLon,options){var _this=_super.call(this,id,latLon)||this;return options=options||{},_this._offsetFactor=null!=options.offsetFactor?options.offsetFactor:-.1,_this._outerColor=null!=options.outerColor?options.outerColor:0,_this}return __extends(DotMarker,_super),DotMarker.prototype._createGeometry=function(position){var circleOuter=new THREE.Mesh(new THREE.CircleGeometry(.2,100),new THREE.MeshBasicMaterial({color:this._outerColor,opacity:.05,transparent:!0,polygonOffset:!0,polygonOffsetFactor:this._offsetFactor})),circleInner=new THREE.Mesh(new THREE.CircleGeometry(.125,100),new THREE.MeshBasicMaterial({color:16777215,opacity:.7,transparent:!0,polygonOffset:!0,polygonOffsetFactor:this._offsetFactor-.1}));circleOuter.up.fromArray([0,0,1]),circleOuter.renderOrder=-1,circleOuter.position.z=1e-4,circleInner.position.z=1e-4;var group=new THREE.Object3D;group.add(circleOuter),group.add(circleInner),group.position.fromArray(position),this._geometry=group},DotMarker.prototype._disposeGeometry=function(){for(var _i=0,_a=this._geometry.children;_i<_a.length;_i++){var mesh=_a[_i];mesh.geometry.dispose(),mesh.material.dispose()}},DotMarker.prototype._getInteractiveObjects=function(){return[]},DotMarker}(require("../../../Component").Marker);exports.DotMarker=DotMarker,exports.default=DotMarker},{"../../../Component":343,three:288}],392:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Marker=function(){function Marker(id,latLon){this._id=id,this._latLon=latLon}return Object.defineProperty(Marker.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(Marker.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(Marker.prototype,"latLon",{get:function(){return this._latLon},enumerable:!0,configurable:!0}),Marker.prototype.createGeometry=function(position){this._geometry||(this._createGeometry(position),this._geometry.updateMatrixWorld(!0))},Marker.prototype.disposeGeometry=function(){this._geometry&&(this._disposeGeometry(),this._geometry=void 0)},Marker.prototype.getInteractiveObjects=function(){return this._geometry?this._getInteractiveObjects():[]},Marker.prototype.lerpAltitude=function(alt,alpha){this._geometry&&(this._geometry.position.z=(1-alpha)*this._geometry.position.z+alpha*alt)},Marker.prototype.updatePosition=function(position,latLon){latLon&&(this._latLon.lat=latLon.lat,this._latLon.lon=latLon.lon),this._geometry&&(this._geometry.position.fromArray(position),this._geometry.updateMatrixWorld(!0))},Marker}();exports.Marker=Marker,exports.default=Marker},{}],393:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),SimpleMarker=function(_super){function SimpleMarker(id,latLon,options){var _this=_super.call(this,id,latLon)||this;return options=options||{},_this._ballColor=null!=options.ballColor?options.ballColor:16711680,_this._ballOpacity=null!=options.ballOpacity?options.ballOpacity:.8,_this._circleToRayAngle=2,_this._color=null!=options.color?options.color:16711680,_this._interactive=!!options.interactive,_this._opacity=null!=options.opacity?options.opacity:.4,_this._radius=null!=options.radius?options.radius:1,_this}return __extends(SimpleMarker,_super),SimpleMarker.prototype._createGeometry=function(position){var radius=this._radius,cone=new THREE.Mesh(this._markerGeometry(radius,8,8),new THREE.MeshBasicMaterial({color:this._color,opacity:this._opacity,shading:THREE.SmoothShading,transparent:!0}));cone.renderOrder=1;var ball=new THREE.Mesh(new THREE.SphereGeometry(radius/2,8,8),new THREE.MeshBasicMaterial({color:this._ballColor,opacity:this._ballOpacity,shading:THREE.SmoothShading,transparent:!0}));ball.position.z=this._markerHeight(radius);var group=new THREE.Object3D;group.add(ball),group.add(cone),group.position.fromArray(position),this._geometry=group},SimpleMarker.prototype._disposeGeometry=function(){for(var _i=0,_a=this._geometry.children;_i<_a.length;_i++){var mesh=_a[_i];mesh.geometry.dispose(),mesh.material.dispose()}},SimpleMarker.prototype._getInteractiveObjects=function(){return this._interactive?[this._geometry.children[0]]:[]},SimpleMarker.prototype._markerHeight=function(radius){var t=Math.tan(Math.PI-this._circleToRayAngle);return radius*Math.sqrt(1+t*t)},SimpleMarker.prototype._markerGeometry=function(radius,widthSegments,heightSegments){var geometry=new THREE.Geometry;widthSegments=Math.max(3,Math.floor(widthSegments)||8),heightSegments=Math.max(2,Math.floor(heightSegments)||6);for(var height=this._markerHeight(radius),vertices=[],y=0;y<=heightSegments;++y){for(var verticesRow=[],x=0;x<=widthSegments;++x){var u=x/widthSegments*Math.PI*2,v=y/heightSegments*Math.PI,r=void 0;if(v<this._circleToRayAngle)r=radius;else{var t=Math.tan(v-this._circleToRayAngle);r=radius*Math.sqrt(1+t*t)}var vertex=new THREE.Vector3;vertex.x=r*Math.cos(u)*Math.sin(v),vertex.y=r*Math.sin(u)*Math.sin(v),vertex.z=r*Math.cos(v)+height,geometry.vertices.push(vertex),verticesRow.push(geometry.vertices.length-1)}vertices.push(verticesRow)}for(y=0;y<heightSegments;++y)for(x=0;x<widthSegments;++x){var v1=vertices[y][x+1],v2=vertices[y][x],v3=vertices[y+1][x],v4=vertices[y+1][x+1],n1=geometry.vertices[v1].clone().normalize(),n2=geometry.vertices[v2].clone().normalize(),n3=geometry.vertices[v3].clone().normalize(),n4=geometry.vertices[v4].clone().normalize();geometry.faces.push(new THREE.Face3(v1,v2,v4,[n1,n2,n4])),geometry.faces.push(new THREE.Face3(v2,v3,v4,[n2.clone(),n3,n4.clone()]))}return geometry.computeFaceNormals(),geometry.boundingSphere=new THREE.Sphere(new THREE.Vector3,radius+height),geometry},SimpleMarker}(require("../../../Component").Marker);exports.SimpleMarker=SimpleMarker,exports.default=SimpleMarker},{"../../../Component":343,three:288}],394:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),operators_1=require("rxjs/operators"),BounceHandler=function(_super){function BounceHandler(component,container,navigator,viewportCoords,spatial){var _this=_super.call(this,component,container,navigator)||this;return _this._spatial=spatial,_this._viewportCoords=viewportCoords,_this._basicDistanceThreshold=.001,_this._basicRotationThreshold=.05,_this._bounceCoeff=.1,_this}return __extends(BounceHandler,_super),BounceHandler.prototype._enable=function(){var _this=this,inTransition$=this._navigator.stateService.currentState$.pipe(operators_1.map(function(frame){return frame.state.alpha<1}));this._bounceSubscription=rxjs_1.combineLatest(inTransition$,this._navigator.stateService.inTranslation$,this._container.mouseService.active$,this._container.touchService.active$).pipe(operators_1.map(function(noForce){return noForce[0]||noForce[1]||noForce[2]||noForce[3]}),operators_1.distinctUntilChanged(),operators_1.switchMap(function(noForce){return noForce?rxjs_1.empty():rxjs_1.combineLatest(_this._container.renderService.renderCamera$,_this._navigator.stateService.currentTransform$.pipe(operators_1.first()))})).subscribe(function(args){var renderCamera=args[0],perspectiveCamera=renderCamera.perspective,transform=args[1];if((transform.hasValidScale||!(renderCamera.camera.focal<.1))&&0!==renderCamera.perspective.aspect&&renderCamera.perspective.aspect!==Number.POSITIVE_INFINITY){var distanceThreshold=_this._basicDistanceThreshold/Math.pow(2,renderCamera.zoom),basicCenter=_this._viewportCoords.viewportToBasic(0,0,transform,perspectiveCamera);if(!(Math.abs(basicCenter[0]-.5)<distanceThreshold&&Math.abs(basicCenter[1]-.5)<distanceThreshold)){var basicDistances=_this._viewportCoords.getBasicDistances(transform,perspectiveCamera),basicX=0,basicY=0;if(!(basicDistances[0]<distanceThreshold&&basicDistances[1]<distanceThreshold&&basicDistances[2]<distanceThreshold&&basicDistances[3]<distanceThreshold||Math.abs(basicDistances[0]-basicDistances[2])<distanceThreshold&&Math.abs(basicDistances[1]-basicDistances[3])<distanceThreshold)){var coeff=_this._bounceCoeff;0<basicDistances[1]&&0===basicDistances[3]?basicX=-coeff*basicDistances[1]:0===basicDistances[1]&&0<basicDistances[3]?basicX=coeff*basicDistances[3]:0<basicDistances[1]&&0<basicDistances[3]&&(basicX=coeff*(basicDistances[3]-basicDistances[1])/2),0<basicDistances[0]&&0===basicDistances[2]?basicY=coeff*basicDistances[0]:0===basicDistances[0]&&0<basicDistances[2]?basicY=-coeff*basicDistances[2]:0<basicDistances[0]&&0<basicDistances[2]&&(basicY=coeff*(basicDistances[0]-basicDistances[2])/2);var rotationThreshold=_this._basicRotationThreshold;basicX=_this._spatial.clamp(basicX,-rotationThreshold,rotationThreshold),basicY=_this._spatial.clamp(basicY,-rotationThreshold,rotationThreshold),_this._navigator.stateService.rotateBasicUnbounded([basicX,basicY])}}}})},BounceHandler.prototype._disable=function(){this._bounceSubscription.unsubscribe()},BounceHandler.prototype._getConfiguration=function(enable){return{}},BounceHandler}(Component_1.HandlerBase);exports.BounceHandler=BounceHandler,exports.default=BounceHandler},{"../../Component":343,rxjs:89,"rxjs/operators":285}],395:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),operators_1=require("rxjs/operators"),DoubleClickZoomHandler=function(_super){function DoubleClickZoomHandler(component,container,navigator,viewportCoords){var _this=_super.call(this,component,container,navigator)||this;return _this._viewportCoords=viewportCoords,_this}return __extends(DoubleClickZoomHandler,_super),DoubleClickZoomHandler.prototype._enable=function(){var _this=this;this._zoomSubscription=rxjs_1.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.dblClick$),this._container.touchService.doubleTap$.pipe(operators_1.map(function(e){var touch=e.touches[0];return{clientX:touch.clientX,clientY:touch.clientY,shiftKey:e.shiftKey}}))).pipe(operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(_a){var event=_a[0],render=_a[1],transform=_a[2],element=_this._container.element,_b=_this._viewportCoords.canvasPosition(event,element),canvasX=_b[0],canvasY=_b[1],unprojected=_this._viewportCoords.unprojectFromCanvas(canvasX,canvasY,element,render.perspective),reference=transform.projectBasic(unprojected.toArray()),delta=event.shiftKey?-1:1;_this._navigator.stateService.zoomIn(delta,reference)})},DoubleClickZoomHandler.prototype._disable=function(){this._zoomSubscription.unsubscribe()},DoubleClickZoomHandler.prototype._getConfiguration=function(enable){return{doubleClickZoom:enable}},DoubleClickZoomHandler}(Component_1.HandlerBase);exports.DoubleClickZoomHandler=DoubleClickZoomHandler,exports.default=DoubleClickZoomHandler},{"../../Component":343,rxjs:89,"rxjs/operators":285}],396:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),rxjs_1=require("rxjs"),Component_1=require("../../Component"),operators_1=require("rxjs/operators"),DragPanHandler=function(_super){function DragPanHandler(component,container,navigator,viewportCoords,spatial){var _this=_super.call(this,component,container,navigator)||this;return _this._spatial=spatial,_this._viewportCoords=viewportCoords,_this._basicRotationThreshold=.05,_this._forceCoeff=.2,_this}return __extends(DragPanHandler,_super),DragPanHandler.prototype._enable=function(){var _this=this,draggingStarted$=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragStart$).pipe(operators_1.map(function(event){return!0})),draggingStopped$=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$).pipe(operators_1.map(function(event){return!1}));this._activeMouseSubscription=rxjs_1.merge(draggingStarted$,draggingStopped$).subscribe(this._container.mouseService.activate$),this._preventDefaultSubscription=rxjs_1.merge(draggingStarted$,draggingStopped$).pipe(operators_1.switchMap(function(dragging){return dragging?_this._container.mouseService.documentMouseMove$:rxjs_1.empty()}),operators_1.merge(this._container.touchService.touchMove$)).subscribe(function(event){event.preventDefault()});var touchMovingStarted$=this._container.touchService.singleTouchDragStart$.pipe(operators_1.map(function(event){return!0})),touchMovingStopped$=this._container.touchService.singleTouchDragEnd$.pipe(operators_1.map(function(event){return!1}));this._activeTouchSubscription=rxjs_1.merge(touchMovingStarted$,touchMovingStopped$).subscribe(this._container.touchService.activate$);var basicRotation$=this._navigator.stateService.currentState$.pipe(operators_1.map(function(frame){return frame.state.currentNode.fullPano||frame.state.nodesAhead<1}),operators_1.distinctUntilChanged(),operators_1.switchMap(function(enable){if(!enable)return rxjs_1.empty();var mouseDrag$=_this._container.mouseService.filtered$(_this._component.name,_this._container.mouseService.mouseDragStart$).pipe(operators_1.switchMap(function(mouseDragStart){return rxjs_1.of(mouseDragStart).pipe(operators_1.concat(_this._container.mouseService.filtered$(_this._component.name,_this._container.mouseService.mouseDrag$)),operators_1.merge(_this._container.mouseService.filtered$(_this._component.name,_this._container.mouseService.mouseDragEnd$).pipe(operators_1.map(function(e){return null}))),operators_1.takeWhile(function(e){return!!e}),operators_1.startWith(null))}),operators_1.pairwise(),operators_1.filter(function(pair){return null!=pair[0]&&null!=pair[1]})),singleTouchDrag$=rxjs_1.merge(_this._container.touchService.singleTouchDragStart$,_this._container.touchService.singleTouchDrag$,_this._container.touchService.singleTouchDragEnd$.pipe(operators_1.map(function(t){return null}))).pipe(operators_1.map(function(event){return null!=event&&0<event.touches.length?event.touches[0]:null}),operators_1.pairwise(),operators_1.filter(function(pair){return null!=pair[0]&&null!=pair[1]}));return rxjs_1.merge(mouseDrag$,singleTouchDrag$)}),operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,this._navigator.stateService.currentCamera$),operators_1.map(function(_a){var events=_a[0],render=_a[1],transform=_a[2],camera=_a[3].clone(),previousEvent=events[0],event=events[1],movementX=event.clientX-previousEvent.clientX,movementY=event.clientY-previousEvent.clientY,element=_this._container.element,_b=_this._viewportCoords.canvasPosition(event,element),canvasX=_b[0],canvasY=_b[1],currentDirection=_this._viewportCoords.unprojectFromCanvas(canvasX,canvasY,element,render.perspective).sub(render.perspective.position),directionX=_this._viewportCoords.unprojectFromCanvas(canvasX-movementX,canvasY,element,render.perspective).sub(render.perspective.position),directionY=_this._viewportCoords.unprojectFromCanvas(canvasX,canvasY-movementY,element,render.perspective).sub(render.perspective.position),deltaPhi=(0<movementX?1:-1)*directionX.angleTo(currentDirection),deltaTheta=(0<movementY?-1:1)*directionY.angleTo(currentDirection),upQuaternion=(new THREE.Quaternion).setFromUnitVectors(camera.up,new THREE.Vector3(0,0,1)),upQuaternionInverse=upQuaternion.clone().inverse(),offset=new THREE.Vector3;offset.copy(camera.lookat).sub(camera.position),offset.applyQuaternion(upQuaternion);var length=offset.length(),phi=Math.atan2(offset.y,offset.x);phi+=deltaPhi;var theta=Math.atan2(Math.sqrt(offset.x*offset.x+offset.y*offset.y),offset.z);theta+=deltaTheta,theta=Math.max(.01,Math.min(Math.PI-1.5,theta)),offset.x=Math.sin(theta)*Math.cos(phi),offset.y=Math.sin(theta)*Math.sin(phi),offset.z=Math.cos(theta),offset.applyQuaternion(upQuaternionInverse);var lookat=(new THREE.Vector3).copy(camera.position).add(offset.multiplyScalar(length)),basic=transform.projectBasic(lookat.toArray()),original=transform.projectBasic(camera.lookat.toArray()),x=basic[0]-original[0],y=basic[1]-original[1];1<Math.abs(x)?x=0:.5<x?x-=1:x<-.5&&(x+=1);var rotationThreshold=_this._basicRotationThreshold;if(x=_this._spatial.clamp(x,-rotationThreshold,rotationThreshold),y=_this._spatial.clamp(y,-rotationThreshold,rotationThreshold),transform.fullPano)return[x,y];var pixelDistances=_this._viewportCoords.getPixelDistances(_this._container.element,transform,render.perspective),coeff=_this._forceCoeff;return 0<pixelDistances[0]&&y<0&&basic[1]<.5&&(y/=Math.max(1,coeff*pixelDistances[0])),0<pixelDistances[1]&&0<x&&.5<basic[0]&&(x/=Math.max(1,coeff*pixelDistances[1])),0<pixelDistances[2]&&0<y&&.5<basic[1]&&(y/=Math.max(1,coeff*pixelDistances[2])),0<pixelDistances[3]&&x<0&&basic[0]<.5&&(x/=Math.max(1,coeff*pixelDistances[3])),[x,y]}),operators_1.share());this._rotateBasicWithoutInertiaSubscription=basicRotation$.subscribe(function(basicRotation){_this._navigator.stateService.rotateBasicWithoutInertia(basicRotation)}),this._rotateBasicSubscription=basicRotation$.pipe(operators_1.scan(function(rotationBuffer,rotation){return _this._drainBuffer(rotationBuffer),rotationBuffer.push([Date.now(),rotation]),rotationBuffer},[]),operators_1.sample(rxjs_1.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$),this._container.touchService.singleTouchDragEnd$)),operators_1.map(function(rotationBuffer){for(var drainedBuffer=_this._drainBuffer(rotationBuffer.slice()),basicRotation=[0,0],_i=0,drainedBuffer_1=drainedBuffer;_i<drainedBuffer_1.length;_i++){var rotation=drainedBuffer_1[_i];basicRotation[0]+=rotation[1][0],basicRotation[1]+=rotation[1][1]}var count=drainedBuffer.length;return 0<count&&(basicRotation[0]/=count,basicRotation[1]/=count),basicRotation})).subscribe(function(basicRotation){_this._navigator.stateService.rotateBasic(basicRotation)})},DragPanHandler.prototype._disable=function(){this._activeMouseSubscription.unsubscribe(),this._activeTouchSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._rotateBasicSubscription.unsubscribe(),this._rotateBasicWithoutInertiaSubscription.unsubscribe(),this._activeMouseSubscription=null,this._activeTouchSubscription=null,this._preventDefaultSubscription=null,this._rotateBasicSubscription=null},DragPanHandler.prototype._getConfiguration=function(enable){return{dragPan:enable}},DragPanHandler.prototype._drainBuffer=function(buffer){for(var now=Date.now();0<buffer.length&&50<now-buffer[0][0];)buffer.shift();return buffer},DragPanHandler}(Component_1.HandlerBase);exports.DragPanHandler=DragPanHandler,exports.default=DragPanHandler},{"../../Component":343,rxjs:89,"rxjs/operators":285,three:288}],397:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../Component"),Geo_1=require("../../Geo"),MouseComponent=function(_super){function MouseComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this,spatial=new Geo_1.Spatial,viewportCoords=new Geo_1.ViewportCoords;return _this._spatial=spatial,_this._viewportCoords=viewportCoords,_this._bounceHandler=new Component_1.BounceHandler(_this,container,navigator,viewportCoords,spatial),_this._doubleClickZoomHandler=new Component_1.DoubleClickZoomHandler(_this,container,navigator,viewportCoords),_this._dragPanHandler=new Component_1.DragPanHandler(_this,container,navigator,viewportCoords,spatial),_this._scrollZoomHandler=new Component_1.ScrollZoomHandler(_this,container,navigator,viewportCoords),_this._touchZoomHandler=new Component_1.TouchZoomHandler(_this,container,navigator,viewportCoords),_this}return __extends(MouseComponent,_super),Object.defineProperty(MouseComponent.prototype,"doubleClickZoom",{get:function(){return this._doubleClickZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(MouseComponent.prototype,"dragPan",{get:function(){return this._dragPanHandler},enumerable:!0,configurable:!0}),Object.defineProperty(MouseComponent.prototype,"scrollZoom",{get:function(){return this._scrollZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(MouseComponent.prototype,"touchZoom",{get:function(){return this._touchZoomHandler},enumerable:!0,configurable:!0}),MouseComponent.prototype._activate=function(){var _this=this;this._bounceHandler.enable(),this._configurationSubscription=this._configuration$.subscribe(function(configuration){configuration.doubleClickZoom?_this._doubleClickZoomHandler.enable():_this._doubleClickZoomHandler.disable(),configuration.dragPan?_this._dragPanHandler.enable():_this._dragPanHandler.disable(),configuration.scrollZoom?_this._scrollZoomHandler.enable():_this._scrollZoomHandler.disable(),configuration.touchZoom?_this._touchZoomHandler.enable():_this._touchZoomHandler.disable()}),this._container.mouseService.claimMouse(this._name,0)},MouseComponent.prototype._deactivate=function(){this._container.mouseService.unclaimMouse(this._name),this._configurationSubscription.unsubscribe(),this._bounceHandler.disable(),this._doubleClickZoomHandler.disable(),this._dragPanHandler.disable(),this._scrollZoomHandler.disable(),this._touchZoomHandler.disable()},MouseComponent.prototype._getDefaultConfiguration=function(){return{doubleClickZoom:!0,dragPan:!0,scrollZoom:!0,touchZoom:!0}},MouseComponent.componentName="mouse",MouseComponent}(Component_1.Component);exports.MouseComponent=MouseComponent,Component_1.ComponentService.register(MouseComponent),exports.default=MouseComponent},{"../../Component":343,"../../Geo":346}],398:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../Component"),operators_1=require("rxjs/operators"),ScrollZoomHandler=function(_super){function ScrollZoomHandler(component,container,navigator,viewportCoords){var _this=_super.call(this,component,container,navigator)||this;return _this._viewportCoords=viewportCoords,_this}return __extends(ScrollZoomHandler,_super),ScrollZoomHandler.prototype._enable=function(){var _this=this;this._container.mouseService.claimWheel(this._component.name,0),this._preventDefaultSubscription=this._container.mouseService.mouseWheel$.subscribe(function(event){event.preventDefault()}),this._zoomSubscription=this._container.mouseService.filteredWheel$(this._component.name,this._container.mouseService.mouseWheel$).pipe(operators_1.withLatestFrom(this._navigator.stateService.currentState$,function(w,f){return[w,f]}),operators_1.filter(function(args){var state=args[1].state;return state.currentNode.fullPano||state.nodesAhead<1}),operators_1.map(function(args){return args[0]}),operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(w,r,t){return[w,r,t]})).subscribe(function(args){var event=args[0],render=args[1],transform=args[2],element=_this._container.element,_a=_this._viewportCoords.canvasPosition(event,element),canvasX=_a[0],canvasY=_a[1],unprojected=_this._viewportCoords.unprojectFromCanvas(canvasX,canvasY,element,render.perspective),reference=transform.projectBasic(unprojected.toArray()),deltaY=event.deltaY;1===event.deltaMode?deltaY*=40:2===event.deltaMode&&(deltaY*=800);var zoom=-3*deltaY/_this._viewportCoords.containerToCanvas(element)[1];_this._navigator.stateService.zoomIn(zoom,reference)})},ScrollZoomHandler.prototype._disable=function(){this._container.mouseService.unclaimWheel(this._component.name),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},ScrollZoomHandler.prototype._getConfiguration=function(enable){return{scrollZoom:enable}},ScrollZoomHandler}(Component_1.HandlerBase);exports.ScrollZoomHandler=ScrollZoomHandler,exports.default=ScrollZoomHandler},{"../../Component":343,"rxjs/operators":285}],399:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),operators_1=require("rxjs/operators"),TouchZoomHandler=function(_super){function TouchZoomHandler(component,container,navigator,viewportCoords){var _this=_super.call(this,component,container,navigator)||this;return _this._viewportCoords=viewportCoords,_this}return __extends(TouchZoomHandler,_super),TouchZoomHandler.prototype._enable=function(){var _this=this;this._preventDefaultSubscription=this._container.touchService.pinch$.subscribe(function(pinch){pinch.originalEvent.preventDefault()});var pinchStarted$=this._container.touchService.pinchStart$.pipe(operators_1.map(function(event){return!0})),pinchStopped$=this._container.touchService.pinchEnd$.pipe(operators_1.map(function(event){return!1}));this._activeSubscription=rxjs_1.merge(pinchStarted$,pinchStopped$).subscribe(this._container.touchService.activate$),this._zoomSubscription=this._container.touchService.pinch$.pipe(operators_1.withLatestFrom(this._navigator.stateService.currentState$),operators_1.filter(function(args){var state=args[1].state;return state.currentNode.fullPano||state.nodesAhead<1}),operators_1.map(function(args){return args[0]}),operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(_a){var pinch=_a[0],render=_a[1],transform=_a[2],element=_this._container.element,_b=_this._viewportCoords.canvasPosition(pinch,element),canvasX=_b[0],canvasY=_b[1],unprojected=_this._viewportCoords.unprojectFromCanvas(canvasX,canvasY,element,render.perspective),reference=transform.projectBasic(unprojected.toArray()),_c=_this._viewportCoords.containerToCanvas(element),canvasWidth=_c[0],canvasHeight=_c[1],zoom=3*pinch.distanceChange/Math.min(canvasWidth,canvasHeight);_this._navigator.stateService.zoomIn(zoom,reference)})},TouchZoomHandler.prototype._disable=function(){this._activeSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},TouchZoomHandler.prototype._getConfiguration=function(enable){return{touchZoom:enable}},TouchZoomHandler}(Component_1.HandlerBase);exports.TouchZoomHandler=TouchZoomHandler,exports.default=TouchZoomHandler},{"../../Component":343,rxjs:89,"rxjs/operators":285}],400:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),Marker_1=require("../marker/Marker"),PathRender_1=require("./PathRender"),PathMarker_1=require("./PathMarker"),PathEvent_1=require("./PathEvent"),operators_1=require("rxjs/operators"),PathComponent=function(_super){function PathComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;_this._markerComponent=new Marker_1.MarkerComponent(name,container,navigator);var pathMarker=new PathMarker_1.PathMarker;return _this._pathRender=new PathRender_1.PathRender(_this._markerComponent,pathMarker),_this._pathEvent=new PathEvent_1.PathEvent(_this._markerComponent,_this._pathRender,pathMarker,container,navigator),_this}return __extends(PathComponent,_super),PathComponent.prototype._activate=function(){var _this=this;this._markerComponent.activate(),this._pathEvent.bind(),this._disposable=rxjs_1.combineLatest(this._navigator.stateService.currentNodeExternal$,this._navigator.imageLoadingService.loadpath$,this._navigator.imageLoadingService.loadpathOutdoor$).pipe(operators_1.tap(function(_a){var node=_a[0],path=_a[1],outdoorPath=_a[2];_this._pathRender.render(node,path.concat(outdoorPath))})).subscribe(function(){})},PathComponent.prototype._deactivate=function(){this._disposable.unsubscribe(),this._pathEvent.unbind(),this._markerComponent.deactivate()},PathComponent.prototype._getDefaultConfiguration=function(){return{}},PathComponent.componentName="path",PathComponent}(Component_1.Component);exports.PathComponent=PathComponent,Component_1.ComponentService.register(PathComponent),exports.default=PathComponent},{"../../Component":343,"../marker/Marker":385,"./PathEvent":401,"./PathMarker":402,"./PathRender":403,rxjs:89,"rxjs/operators":285}],401:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Viewer_1=require("../../viewer/Viewer"),Projection_1=require("../../viewer/Projection"),_=require("underscore"),operators_1=require("rxjs/operators"),PathEvent=function(){function PathEvent(markerComponent,pathRender,pathMarker,container,navigator){this._markerComponent=markerComponent,this._pathRender=pathRender,this._pathMarker=pathMarker,this._container=container,this._navigator=navigator,this._projection=new Projection_1.Projection,this._movingMarkerId="moving-path",this._activeMarkerId="active-path"}return PathEvent.prototype.bind=function(){var _this=this;return this._disposable=rxjs_1.merge(this._mapMouseEvent$(Viewer_1.Viewer.mousedown,this._container.mouseService.mouseDown$),this._mapMouseEvent$(Viewer_1.Viewer.mouseup,this._container.mouseService.mouseUp$),this._mapMouseEvent$(Viewer_1.Viewer.mousemove,this._container.mouseService.mouseMove$)).pipe(operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$),operators_1.map(function(_a){var _b=_a[0],type=_b[0],event=_b[1],render=_a[1],reference=_a[2],transform=_a[3],unprojection=_this._projection.eventToUnprojection(event,_this._container.element,render,reference,transform);return{basicPoint:unprojection.basicPoint,latLon:unprojection.latLon,originalEvent:event,pixelPoint:unprojection.pixelPoint,target:null,type:type}})).subscribe(function(event){switch(event.type){case"mousemove":_this._mouseMove(event);break;case"mousedown":_this._mouseDownEvent=event;break;case"mouseup":_this._mouseUpEvent=event,_this._mouseClick(event)}}),this},PathEvent.prototype.unbind=function(){return this._disposable.unsubscribe(),this},PathEvent.prototype._mapMouseEvent$=function(type,mouseEvent$){return mouseEvent$.pipe(operators_1.map(function(event){return[type,event]}))},PathEvent.prototype._isClick=function(){return _.isEqual(this._mouseDownEvent.pixelPoint,this._mouseUpEvent.pixelPoint)},PathEvent.prototype._mouseClick=function(event){var _this=this;if(this._isClick()){var latLon=event.latLon;if(event.latLon||(latLon=this._mousemoveLatLon),latLon){var nearNode_1=this._findNearNodeByDistance(latLon,2);if(nearNode_1)return void this._markerComponent.getMarkerIdAt(event.pixelPoint).then(function(){return _this._updateClickState(nearNode_1.key)});var nextPathNode=this._findNextNode(latLon);nextPathNode&&(PathEvent.currentNode=nextPathNode,this._navigator.moveToKey$(nextPathNode.key))}}},PathEvent.prototype._updateClickState=function(clickId){null!==clickId&&clickId!==this._movingMarkerId&&this._navigator.moveToKey$(clickId)},PathEvent.prototype._mouseMove=function(event){null===event.latLon?this._removeMovingMarker():(this._mousemoveLatLon=event.latLon,this._createMovingMarker(event.latLon),this._createActiveMarker(event.latLon))},PathEvent.prototype._createMovingMarker=function(latLon){return this._movingMarker=this._pathMarker.createCircleMarker(this._movingMarkerId,latLon),this._markerComponent.add([this._movingMarker]),this},PathEvent.prototype._createActiveMarker=function(latLon){var nearNode=this._findNearNodeByDistance(latLon,2);return nearNode?(this._activeMarker=this._pathMarker.createHighMarker(this._activeMarkerId,nearNode.l),this._markerComponent.add([this._activeMarker])):this._removeActiveMarker(),this},PathEvent.prototype._removeMovingMarker=function(){return this._movingMarker=null,this},PathEvent.prototype._removeActiveMarker=function(){return this._markerComponent.remove([this._activeMarkerId]),this._activeMarker=null,this},PathEvent.prototype._findNearNodeByDistance=function(latLon,meter){var _this=this,enableArea=this._pathRender.enableAreaPathNodes.filter(function(pathNode){return _this._pathRender.getDisance(pathNode.l,latLon)<=meter}),min=_.min(enableArea.map(function(pathNode){return _this._pathRender.getDisance(pathNode.l,latLon)}));return enableArea.find(function(pathNode){return _this._pathRender.getDisance(pathNode.l,latLon)===min})},PathEvent.prototype._findNextNode=function(latLon){var minDistance,minPathNode,currentIndex,minIndex,_this=this;return _.forEach(this._pathRender.allAreaPathNodes,function(value){var distance=_this._pathRender.getDisance(value.l,latLon);(!minDistance||distance<minDistance)&&(minDistance=distance,minPathNode=value)}),_.forEach(this._pathRender.allAreaPathNodes,function(value,key){value.key===PathEvent.currentNode.key&&(currentIndex=key),value.key===minPathNode.key&&(minIndex=key)}),currentIndex<=minIndex?this._pathRender.allAreaPathNodes[currentIndex+1]:this._pathRender.allAreaPathNodes[currentIndex-1]},PathEvent}();exports.PathEvent=PathEvent},{"../../viewer/Projection":494,"../../viewer/Viewer":497,rxjs:89,"rxjs/operators":285,underscore:292}],402:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Marker_1=require("../marker/Marker"),PathMarker=function(){function PathMarker(){}return PathMarker.prototype.createArrowMarker=function(id,latlon){return new Marker_1.DotMarker(id,{lat:latlon.lat,lon:latlon.lon},{offsetFactor:-.1})},PathMarker.prototype.createCircleMarker=function(id,latlon){return new Marker_1.DotMarker(id,{lat:latlon.lat,lon:latlon.lon},{outerColor:16777215,offsetFactor:-.5})},PathMarker.prototype.createHighMarker=function(id,latlon){return new Marker_1.DotMarker(id,{lat:latlon.lat,lon:latlon.lon},{offsetFactor:-.3})},PathMarker}();exports.PathMarker=PathMarker},{"../marker/Marker":385}],403:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Marker_1=require("../marker/Marker"),PathEvent_1=require("./PathEvent"),PathRender=function(){function PathRender(markerComponent,pathMarker){this._meter=15,this._markerComponent=markerComponent,this._pathMarker=pathMarker,this._enableAreaPathNodes=[]}return Object.defineProperty(PathRender.prototype,"enableAreaPathNodes",{get:function(){return this._enableAreaPathNodes},enumerable:!0,configurable:!0}),Object.defineProperty(PathRender.prototype,"allAreaPathNodes",{get:function(){return this._allAreaPathNodes},enumerable:!0,configurable:!0}),PathRender.prototype.render=function(node,path){return PathEvent_1.PathEvent.currentNode=node,this._enableAreaPathNodes=this._getEnableAreaPathNodes(node,this._filterPathNodes(path)),this._allAreaPathNodes=this._getEnableAreaPathNodes(node,path),this._markerComponent.remove(this._getMarkerIds()),this._markerComponent.add(this._getMarkerArr(this._enableAreaPathNodes)),this},PathRender.prototype.getDisance=function(start,end){if(start&&end){var radLat1=this._toRad(start.lat),radLat2=this._toRad(end.lat),deltaLat=radLat1-radLat2,deltaLng=this._toRad(start.lon)-this._toRad(end.lon);return 6378137*(2*Math.asin(Math.sqrt(Math.pow(Math.sin(deltaLat/2),2)+Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(deltaLng/2),2))))}return 9999},PathRender.prototype._getMarkerIds=function(){return this._markerComponent.getAll().filter(function(marker){return!(marker instanceof Marker_1.CircleMarker)}).map(function(marker){return marker.id})},PathRender.prototype._filterPathNodes=function(path){return path.filter(function(val,index){return index%2==0})},PathRender.prototype._getEnableAreaPathNodes=function(node,path){var _this=this;return path.slice().filter(function(pathNode){return!!pathNode}).filter(function(pathNode){return pathNode.floor.id===node.floor.id}).filter(function(pathNode){if(_this.getDisance(node.latLon,pathNode.l)<_this._meter)return pathNode})},PathRender.prototype._toRad=function(d){return d*Math.PI/180},PathRender.prototype._getMarkerArr=function(pathNodes){var _this=this;return pathNodes.map(function(pathNode){return _this._pathMarker.createArrowMarker(pathNode.key,pathNode.l)})},PathRender}();exports.PathRender=PathRender},{"../marker/Marker":385,"./PathEvent":401}],404:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Popup_1=require("./popup/Popup");exports.Popup=Popup_1.Popup;var PopupComponent_1=require("./PopupComponent");exports.PopupComponent=PopupComponent_1.PopupComponent},{"./PopupComponent":405,"./popup/Popup":406}],405:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),Utils_1=require("../../Utils"),operators_1=require("rxjs/operators"),PopupComponent=function(_super){function PopupComponent(name,container,navigator,dom){var _this=_super.call(this,name,container,navigator)||this;return _this._dom=dom||new Utils_1.DOM,_this._popups=[],_this._added$=new rxjs_1.Subject,_this._popups$=new rxjs_1.Subject,_this}return __extends(PopupComponent,_super),PopupComponent.prototype.add=function(popups){for(var _i=0,popups_1=popups;_i<popups_1.length;_i++){var popup=popups_1[_i];-1===this._popups.indexOf(popup)&&(this._popups.push(popup),this._activated&&popup.setParentContainer(this._popupContainer))}this._added$.next(popups),this._popups$.next(this._popups)},PopupComponent.prototype.getAll=function(){return this._popups.slice()},PopupComponent.prototype.remove=function(popups){for(var _i=0,popups_2=popups;_i<popups_2.length;_i++){var popup=popups_2[_i];this._remove(popup)}this._popups$.next(this._popups)},PopupComponent.prototype.removeAll=function(){for(var _i=0,_a=this._popups.slice();_i<_a.length;_i++){var popup=_a[_i];this._remove(popup)}this._popups$.next(this._popups)},PopupComponent.prototype._activate=function(){var _this=this;this._popupContainer=this._dom.createElement("div","Beeview-js-popup-container",this._container.element);for(var _i=0,_a=this._popups;_i<_a.length;_i++){_a[_i].setParentContainer(this._popupContainer)}this._updateAllSubscription=rxjs_1.combineLatest(this._container.renderService.renderCamera$,this._container.renderService.size$,this._navigator.stateService.currentTransform$).subscribe(function(_a){for(var renderCamera=_a[0],size=_a[1],transform=_a[2],_i=0,_b=_this._popups;_i<_b.length;_i++){_b[_i].update(renderCamera,size,transform)}});var changed$=this._popups$.pipe(operators_1.startWith(this._popups),operators_1.switchMap(function(popups){return rxjs_1.from(popups).pipe(operators_1.mergeMap(function(popup){return popup.changed$}))}),operators_1.map(function(popup){return[popup]}));this._updateAddedChangedSubscription=this._added$.pipe(operators_1.merge(changed$),operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._container.renderService.size$,this._navigator.stateService.currentTransform$)).subscribe(function(_a){for(var popups=_a[0],renderCamera=_a[1],size=_a[2],transform=_a[3],_i=0,popups_3=popups;_i<popups_3.length;_i++){popups_3[_i].update(renderCamera,size,transform)}})},PopupComponent.prototype._deactivate=function(){this._updateAllSubscription.unsubscribe(),this._updateAddedChangedSubscription.unsubscribe();for(var _i=0,_a=this._popups;_i<_a.length;_i++){_a[_i].remove()}this._container.element.removeChild(this._popupContainer),delete this._popupContainer},PopupComponent.prototype._getDefaultConfiguration=function(){return{}},PopupComponent.prototype._remove=function(popup){var index=this._popups.indexOf(popup);if(-1!==index){var removed=this._popups.splice(index,1)[0];this._activated&&removed.remove()}},PopupComponent.componentName="popup",PopupComponent}(Component_1.Component);exports.PopupComponent=PopupComponent,Component_1.ComponentService.register(PopupComponent),exports.default=PopupComponent},{"../../Component":343,"../../Utils":353,rxjs:89,"rxjs/operators":285}],406:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Geo_1=require("../../../Geo"),Utils_1=require("../../../Utils"),Viewer_1=require("../../../Viewer"),Popup=function(){function Popup(options,viewportCoords,dom){this._options={},options&&(this._options.capturePointer=null==options.capturePointer||options.capturePointer,this._options.clean=options.clean,this._options.float=options.float,this._options.offset=options.offset,this._options.opacity=options.opacity,this._options.position=options.position),this._dom=dom||new Utils_1.DOM,this._viewportCoords=viewportCoords||new Geo_1.ViewportCoords,this._notifyChanged$=new rxjs_1.Subject}return Object.defineProperty(Popup.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Popup.prototype.remove=function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._parentContainer&&delete this._parentContainer},Popup.prototype.setBasicPoint=function(basicPoint){this._point=basicPoint.slice(),this._rect=null,this._notifyChanged$.next(this)},Popup.prototype.setBasicRect=function(basicRect){this._rect=basicRect.slice(),this._point=null,this._notifyChanged$.next(this)},Popup.prototype.setDOMContent=function(htmlNode){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content);var className="beeviewjs-popup-content"+(!0===this._options.clean?"-clean":"")+(!0===this._options.capturePointer?" beeviewjs-popup-capture-pointer":"");this._content=this._dom.createElement("div",className,this._container),this._content.appendChild(htmlNode),this._notifyChanged$.next(this)},Popup.prototype.setHTML=function(html){var child,frag=this._dom.document.createDocumentFragment(),temp=this._dom.createElement("body");for(temp.innerHTML=html;child=temp.firstChild;)frag.appendChild(child);this.setDOMContent(frag)},Popup.prototype.setText=function(text){this.setDOMContent(this._dom.document.createTextNode(text))},Popup.prototype.setParentContainer=function(parentContainer){this._parentContainer=parentContainer},Popup.prototype.update=function(renderCamera,size,transform){var _a;if(this._parentContainer&&this._content&&(this._point||this._rect)){if(!this._container){if(this._container=this._dom.createElement("div","beeviewjs-popup",this._parentContainer),!0!==this._options.clean&&this._options.float!==Viewer_1.Alignment.Center){var tipClassName="beeviewjs-popup-tip"+(!0===this._options.capturePointer?" beeviewjs-popup-capture-pointer":"");this._tip=this._dom.createElement("div",tipClassName,this._container),this._dom.createElement("div","beeviewjs-popup-tip-inner",this._tip)}this._container.appendChild(this._content),this._parentContainer.appendChild(this._container),null!=this._options.opacity&&(this._container.style.opacity=this._options.opacity.toString())}var pointPixel=null,position=this._alignmentToPopupAligment(this._options.position),float=this._alignmentToPopupAligment(this._options.float);if(null!=this._point)pointPixel=this._viewportCoords.basicToCanvasSafe(this._point[0],this._point[1],{offsetHeight:size.height,offsetWidth:size.width},transform,renderCamera.perspective);else{for(var classList_1=this._container.classList,appliedPosition=null,_i=0,alignments_1=["center","top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];_i<alignments_1.length;_i++){var alignment=alignments_1[_i];if(classList_1.contains("beeviewjs-popup-float-"+alignment)){appliedPosition=alignment;break}}pointPixel=(_a=this._rectToPixel(this._rect,position,appliedPosition,renderCamera,size,transform))[0],position=_a[1],float||(float=position)}if(null!=pointPixel){if(this._container.style.visibility="visible",!float){var width=this._container.offsetWidth,height=this._container.offsetHeight,floats=this._pixelToFloats(pointPixel,size,width,height);float=0===floats.length?"top":floats.join("-")}var offset=this._normalizeOffset(this._options.offset);pointPixel=[pointPixel[0]+offset[float][0],pointPixel[1]+offset[float][1]],pointPixel=[Math.round(pointPixel[0]),Math.round(pointPixel[1])];var floatTranslate={bottom:"translate(-50%,0)","bottom-left":"translate(-100%,0)","bottom-right":"translate(0,0)",center:"translate(-50%,-50%)",left:"translate(-100%,-50%)",right:"translate(0,-50%)",top:"translate(-50%,-100%)","top-left":"translate(-100%,-100%)","top-right":"translate(0,-100%)"},classList=this._container.classList;for(var key in floatTranslate)floatTranslate.hasOwnProperty(key)&&classList.remove("beeviewjs-popup-float-"+key);classList.add("beeviewjs-popup-float-"+float),this._container.style.transform=floatTranslate[float]+" translate("+pointPixel[0]+"px,"+pointPixel[1]+"px)"}else this._container.style.visibility="hidden"}},Popup.prototype._rectToPixel=function(rect,position,appliedPosition,renderCamera,size,transform){if(!position){for(var width=this._container.offsetWidth,height=this._container.offsetHeight,floatOffsets={bottom:[0,height/2],"bottom-left":[-width/2,height/2],"bottom-right":[width/2,height/2],left:[-width/2,0],right:[width/2,0],top:[0,-height/2],"top-left":[-width/2,-height/2],"top-right":[width/2,-height/2]},largestVisibleArea=[0,null,null],_i=0,automaticPositions_1=["top","bottom","left","right"];_i<automaticPositions_1.length;_i++){var automaticPosition=automaticPositions_1[_i],pointBasic_1=this._pointFromRectPosition(rect,automaticPosition),pointPixel=this._viewportCoords.basicToCanvasSafe(pointBasic_1[0],pointBasic_1[1],{offsetHeight:size.height,offsetWidth:size.width},transform,renderCamera.perspective);if(null!=pointPixel){var floatOffset=floatOffsets[automaticPosition],offsetedPosition=[pointPixel[0]+floatOffset[0],pointPixel[1]+floatOffset[1]],staticCoeff=null!=appliedPosition&&appliedPosition===automaticPosition?1:.7;if(0===this._pixelToFloats(offsetedPosition,size,width/staticCoeff,height/(2*staticCoeff)).length&&0<pointPixel[0]&&pointPixel[0]<size.width&&0<pointPixel[1]&&pointPixel[1]<size.height)return[pointPixel,automaticPosition];var minX=Math.max(offsetedPosition[0]-width/2,0),maxX=Math.min(offsetedPosition[0]+width/2,size.width),minY=Math.max(offsetedPosition[1]-height/2,0),maxY=Math.min(offsetedPosition[1]+height/2,size.height),visibleArea=staticCoeff*Math.max(0,maxX-minX)*Math.max(0,maxY-minY);visibleArea>largestVisibleArea[0]&&(largestVisibleArea[0]=visibleArea,largestVisibleArea[1]=pointPixel,largestVisibleArea[2]=automaticPosition)}}if(0<largestVisibleArea[0])return[largestVisibleArea[1],largestVisibleArea[2]]}var pointBasic=this._pointFromRectPosition(rect,position);return[this._viewportCoords.basicToCanvasSafe(pointBasic[0],pointBasic[1],{offsetHeight:size.height,offsetWidth:size.width},transform,renderCamera.perspective),null!=position?position:"top"]},Popup.prototype._alignmentToPopupAligment=function(float){switch(float){case Viewer_1.Alignment.Bottom:return"bottom";case Viewer_1.Alignment.BottomLeft:return"bottom-left";case Viewer_1.Alignment.BottomRight:return"bottom-right";case Viewer_1.Alignment.Center:return"center";case Viewer_1.Alignment.Left:return"left";case Viewer_1.Alignment.Right:return"right";case Viewer_1.Alignment.Top:return"top";case Viewer_1.Alignment.TopLeft:return"top-left";case Viewer_1.Alignment.TopRight:return"top-right";default:return null}},Popup.prototype._normalizeOffset=function(offset){if(null==offset)return this._normalizeOffset(0);if("number"!=typeof offset)return{bottom:offset.bottom||[0,0],"bottom-left":offset.bottomLeft||[0,0],"bottom-right":offset.bottomRight||[0,0],center:offset.center||[0,0],left:offset.left||[0,0],right:offset.right||[0,0],top:offset.top||[0,0],"top-left":offset.topLeft||[0,0],"top-right":offset.topRight||[0,0]};var sideOffset=offset,cornerOffset=(0<=sideOffset?1:-1)*Math.round(Math.sqrt(.5*Math.pow(sideOffset,2)));return{bottom:[0,sideOffset],"bottom-left":[-cornerOffset,cornerOffset],"bottom-right":[cornerOffset,cornerOffset],center:[0,0],left:[-sideOffset,0],right:[sideOffset,0],top:[0,-sideOffset],"top-left":[-cornerOffset,-cornerOffset],"top-right":[cornerOffset,-cornerOffset]}},Popup.prototype._pixelToFloats=function(pointPixel,size,width,height){var floats=[];return pointPixel[1]<height?floats.push("bottom"):pointPixel[1]>size.height-height&&floats.push("top"),pointPixel[0]<width/2?floats.push("right"):pointPixel[0]>size.width-width/2&&floats.push("left"),floats},Popup.prototype._pointFromRectPosition=function(rect,position){switch(position){case"bottom":return[(rect[0]+rect[2])/2,rect[3]];case"bottom-left":return[rect[0],rect[3]];case"bottom-right":return[rect[2],rect[3]];case"center":return[(rect[0]+rect[2])/2,(rect[1]+rect[3])/2];case"left":return[rect[0],(rect[1]+rect[3])/2];case"right":return[rect[2],(rect[1]+rect[3])/2];case"top":return[(rect[0]+rect[2])/2,rect[1]];case"top-left":return[rect[0],rect[1]];case"top-right":return[rect[2],rect[1]];default:return[(rect[0]+rect[2])/2,rect[3]]}},Popup}();exports.Popup=Popup,exports.default=Popup},{"../../../Geo":346,"../../../Utils":353,"../../../Viewer":354,rxjs:89}],407:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),Edge_1=require("../../Edge"),operators_1=require("rxjs/operators"),SequenceComponent=function(_super){function SequenceComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;return _this._nodesAhead=5,_this._configurationOperation$=new rxjs_1.Subject,_this._sequenceDOMRenderer=new Component_1.SequenceDOMRenderer(container.element),_this._sequenceDOMInteraction=new Component_1.SequenceDOMInteraction,_this._containerWidth$=new rxjs_1.Subject,_this._hoveredKeySubject$=new rxjs_1.Subject,_this._hoveredKey$=_this._hoveredKeySubject$.pipe(operators_1.share()),_this._edgeStatus$=_this._navigator.stateService.currentNode$.pipe(operators_1.switchMap(function(node){return node.sequenceEdges$}),operators_1.publishReplay(1),operators_1.refCount()),_this}return __extends(SequenceComponent,_super),Object.defineProperty(SequenceComponent.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),SequenceComponent.prototype.play=function(){this.configure({playing:!0})},SequenceComponent.prototype.stop=function(){this.configure({playing:!1})},SequenceComponent.prototype.setDirection=function(direction){this.configure({direction:direction})},SequenceComponent.prototype.setHighlightKey=function(highlightKey){this.configure({highlightKey:highlightKey})},SequenceComponent.prototype.setMaxWidth=function(maxWidth){this.configure({maxWidth:maxWidth})},SequenceComponent.prototype.setMinWidth=function(minWidth){this.configure({minWidth:minWidth})},SequenceComponent.prototype.setVisible=function(visible){this.configure({visible:visible})},SequenceComponent.prototype.resize=function(){var _this=this;this._configuration$.pipe(operators_1.first(),operators_1.map(function(configuration){return _this._sequenceDOMRenderer.getContainerWidth(_this._container.element,configuration)})).subscribe(function(containerWidth){_this._containerWidth$.next(containerWidth)})},SequenceComponent.prototype._activate=function(){var _this=this;this._renderSubscription=rxjs_1.combineLatest(this._edgeStatus$,this._configuration$,this._containerWidth$).pipe(operators_1.map(function(ec){var edgeStatus=ec[0],configuration=ec[1],containerWidth=ec[2],vNode=_this._sequenceDOMRenderer.render(edgeStatus,configuration,containerWidth,_this,_this._sequenceDOMInteraction,_this._navigator);return{name:_this._name,vnode:vNode}})).subscribe(this._container.domRenderer.render$),this._containerWidthSubscription=this._configuration$.pipe(operators_1.distinctUntilChanged(function(value1,value2){return value1[0]===value2[0]&&value1[1]===value2[1]},function(configuration){return[configuration.minWidth,configuration.maxWidth]}),operators_1.map(function(configuration){return _this._sequenceDOMRenderer.getContainerWidth(_this._container.element,configuration)})).subscribe(this._containerWidth$),this._configurationSubscription=this._configurationOperation$.pipe(operators_1.scan(function(configuration,operation){return operation(configuration)},{playing:!1}),operators_1.finalize(function(){null!=_this._playingSubscription&&(_this._navigator.stateService.cutNodes(),_this._stop())})).subscribe(function(){}),this._configuration$.pipe(operators_1.map(function(newConfiguration){return function(configuration){return newConfiguration.playing!==configuration.playing&&(_this._navigator.stateService.cutNodes(),newConfiguration.playing?_this._play():_this._stop()),configuration.playing=newConfiguration.playing,configuration}})).subscribe(this._configurationOperation$),this._stopSubscription=this._configuration$.pipe(operators_1.switchMap(function(configuration){var edgeStatus$=configuration.playing?_this._edgeStatus$:rxjs_1.empty(),edgeDirection$=rxjs_1.of(configuration.direction);return rxjs_1.combineLatest(edgeStatus$,edgeDirection$)}),operators_1.map(function(ne){var edgeStatus=ne[0],direction=ne[1];if(!edgeStatus.cached)return!0;for(var _i=0,_a=edgeStatus.edges;_i<_a.length;_i++){if(_a[_i].data.direction===direction)return!0}return!1}),operators_1.filter(function(hasEdge){return!hasEdge}),operators_1.map(function(hasEdge){return{playing:!1}})).subscribe(this._configurationSubject$),this._hoveredKeySubscription=this._sequenceDOMInteraction.mouseEnterDirection$.pipe(operators_1.switchMap(function(direction){return _this._edgeStatus$.pipe(operators_1.map(function(edgeStatus){for(var _i=0,_a=edgeStatus.edges;_i<_a.length;_i++){var edge=_a[_i];if(edge.data.direction===direction)return edge.to}return null}),operators_1.takeUntil(_this._sequenceDOMInteraction.mouseLeaveDirection$),operators_1.concat(rxjs_1.of(null)))}),operators_1.distinctUntilChanged()).subscribe(this._hoveredKeySubject$)},SequenceComponent.prototype._deactivate=function(){this._stopSubscription.unsubscribe(),this._renderSubscription.unsubscribe(),this._configurationSubscription.unsubscribe(),this._containerWidthSubscription.unsubscribe(),this._hoveredKeySubscription.unsubscribe(),this.stop()},SequenceComponent.prototype._getDefaultConfiguration=function(){return{direction:Edge_1.EdgeDirection.Next,maxWidth:117,minWidth:70,playing:!1,visible:!0}},SequenceComponent.prototype._play=function(){var _this=this;this._playingSubscription=this._navigator.stateService.currentState$.pipe(operators_1.filter(function(frame){return frame.state.nodesAhead<_this._nodesAhead}),operators_1.map(function(frame){return frame.state.lastNode}),operators_1.distinctUntilChanged(void 0,function(lastNode){return lastNode.key}),operators_1.withLatestFrom(this._configuration$,function(lastNode,configuration){return[lastNode,configuration.direction]}),operators_1.switchMap(function(nd){return(-1<[Edge_1.EdgeDirection.Next,Edge_1.EdgeDirection.Prev].indexOf(nd[1])?nd[0].sequenceEdges$:nd[0].spatialEdges$).pipe(operators_1.filter(function(status){return status.cached}),operators_1.zip(rxjs_1.of(nd[1]),function(status,direction){return[status,direction]}))}),operators_1.map(function(ed){for(var direction=ed[1],_i=0,_a=ed[0].edges;_i<_a.length;_i++){var edge=_a[_i];if(edge.data.direction===direction)return edge.to}return null}),operators_1.filter(function(key){return null!=key}),operators_1.switchMap(function(key){return _this._navigator.graphService.cacheNode$(key)})).subscribe(function(node){_this._navigator.stateService.appendNodes([node])},function(error){console.error(error),_this.stop()}),this._clearSubscription=this._navigator.stateService.currentNode$.pipe(operators_1.bufferCount(1,7)).subscribe(function(nodes){_this._navigator.stateService.clearPriorNodes()}),this.fire(SequenceComponent.playingchanged,!0)},SequenceComponent.prototype._stop=function(){this._playingSubscription.unsubscribe(),this._playingSubscription=null,this._clearSubscription.unsubscribe(),this._clearSubscription=null,this.fire(SequenceComponent.playingchanged,!1)},SequenceComponent.componentName="sequence",SequenceComponent.playingchanged="playingchanged",SequenceComponent}(Component_1.Component);exports.SequenceComponent=SequenceComponent,Component_1.ComponentService.register(SequenceComponent),exports.default=SequenceComponent},{"../../Component":343,"../../Edge":344,rxjs:89,"rxjs/operators":285}],408:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),SequenceDOMInteraction=function(){function SequenceDOMInteraction(){this._mouseEnterDirection$=new rxjs_1.Subject,this._mouseLeaveDirection$=new rxjs_1.Subject}return Object.defineProperty(SequenceDOMInteraction.prototype,"mouseEnterDirection$",{get:function(){return this._mouseEnterDirection$},enumerable:!0,configurable:!0}),Object.defineProperty(SequenceDOMInteraction.prototype,"mouseLeaveDirection$",{get:function(){return this._mouseLeaveDirection$},enumerable:!0,configurable:!0}),SequenceDOMInteraction}();exports.SequenceDOMInteraction=SequenceDOMInteraction,exports.default=SequenceDOMInteraction},{rxjs:89}],409:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),Edge_1=require("../../Edge"),SequenceDOMRenderer=function(){function SequenceDOMRenderer(element){this._minThresholdWidth=320,this._maxThresholdWidth=1480,this._minThresholdHeight=240,this._maxThresholdHeight=820}return SequenceDOMRenderer.prototype.render=function(edgeStatus,configuration,containerWidth,component,interaction,navigator){if(!1===configuration.visible)return vd.h("div.SequenceContainer",{},[]);for(var nextKey=null,prevKey=null,_i=0,_a=edgeStatus.edges;_i<_a.length;_i++){var edge=_a[_i];edge.data.direction===Edge_1.EdgeDirection.Next&&(nextKey=edge.to),edge.data.direction===Edge_1.EdgeDirection.Prev&&(prevKey=edge.to)}var playingButton=this._createPlayingButton(nextKey,prevKey,configuration,component),arrows=this._createSequenceArrows(nextKey,prevKey,configuration,interaction,navigator),containerProperties={oncontextmenu:function(event){event.preventDefault()},style:{height:.27*containerWidth+"px",width:containerWidth+"px"}};return vd.h("div.SequenceContainer",containerProperties,arrows.concat([playingButton]))},SequenceDOMRenderer.prototype.getContainerWidth=function(element,configuration){var elementWidth=element.offsetWidth,elementHeight=element.offsetHeight,minWidth=configuration.minWidth,maxWidth=configuration.maxWidth;maxWidth<minWidth&&(maxWidth=minWidth);var relativeWidth=(elementWidth-this._minThresholdWidth)/(this._maxThresholdWidth-this._minThresholdWidth),relativeHeight=(elementHeight-this._minThresholdHeight)/(this._maxThresholdHeight-this._minThresholdHeight);return minWidth+Math.max(0,Math.min(1,Math.min(relativeWidth,relativeHeight)))*(maxWidth-minWidth)},SequenceDOMRenderer.prototype._createPlayingButton=function(nextKey,prevKey,configuration,component){var canPlay=configuration.direction===Edge_1.EdgeDirection.Next&&null!=nextKey||configuration.direction===Edge_1.EdgeDirection.Prev&&null!=prevKey,buttonProperties={onclick:configuration.playing?function(e){component.stop()}:canPlay?function(e){component.play()}:null,style:{}},iconClass=configuration.playing?"Stop":canPlay?"Play":"PlayDisabled",icon=vd.h("div.SequenceComponentIcon",{className:iconClass},[]),buttonClass=canPlay?"SequencePlay":"SequencePlayDisabled";return vd.h("div."+buttonClass,buttonProperties,[icon])},SequenceDOMRenderer.prototype._createSequenceArrows=function(nextKey,prevKey,configuration,interaction,navigator){var nextProperties={onclick:null!=nextKey?function(e){navigator.moveDir$(Edge_1.EdgeDirection.Next).subscribe(function(node){},function(error){console.error(error)})}:null,onmouseenter:function(e){interaction.mouseEnterDirection$.next(Edge_1.EdgeDirection.Next)},onmouseleave:function(e){interaction.mouseLeaveDirection$.next(Edge_1.EdgeDirection.Next)},style:{}},prevProperties={onclick:null!=prevKey?function(e){navigator.moveDir$(Edge_1.EdgeDirection.Prev).subscribe(function(node){},function(error){console.error(error)})}:null,onmouseenter:function(e){interaction.mouseEnterDirection$.next(Edge_1.EdgeDirection.Prev)},onmouseleave:function(e){interaction.mouseLeaveDirection$.next(Edge_1.EdgeDirection.Prev)},style:{}},nextClass=this._getStepClassName(Edge_1.EdgeDirection.Next,nextKey,configuration.highlightKey),prevClass=this._getStepClassName(Edge_1.EdgeDirection.Prev,prevKey,configuration.highlightKey),nextIcon=vd.h("div.SequenceComponentIcon",[]),prevIcon=vd.h("div.SequenceComponentIcon",[]);return[vd.h("div."+nextClass,nextProperties,[nextIcon]),vd.h("div."+prevClass,prevProperties,[prevIcon])]},SequenceDOMRenderer.prototype._getStepClassName=function(direction,key,highlightKey){var className=direction===Edge_1.EdgeDirection.Next?"SequenceStepNext":"SequenceStepPrev";return null==key?className+="Disabled":highlightKey===key&&(className+="Highlight"),className},SequenceDOMRenderer}();exports.SequenceDOMRenderer=SequenceDOMRenderer,exports.default=SequenceDOMRenderer},{"../../Edge":344,"virtual-dom":296}],410:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var GeometryTagError_1=require("./error/GeometryTagError");exports.GeometryTagError=GeometryTagError_1.GeometryTagError;var PointGeometry_1=require("./geometry/PointGeometry");exports.PointGeometry=PointGeometry_1.PointGeometry;var RectGeometry_1=require("./geometry/RectGeometry");exports.RectGeometry=RectGeometry_1.RectGeometry;var PolygonGeometry_1=require("./geometry/PolygonGeometry");exports.PolygonGeometry=PolygonGeometry_1.PolygonGeometry;var OutlineTag_1=require("./tag/OutlineTag");exports.OutlineTag=OutlineTag_1.OutlineTag;var SpotTag_1=require("./tag/SpotTag");exports.SpotTag=SpotTag_1.SpotTag;var TagComponent_1=require("./TagComponent");exports.TagComponent=TagComponent_1.TagComponent;var TagMode_1=require("./TagMode");exports.TagMode=TagMode_1.TagMode},{"./TagComponent":411,"./TagMode":414,"./error/GeometryTagError":418,"./geometry/PointGeometry":420,"./geometry/PolygonGeometry":421,"./geometry/RectGeometry":422,"./tag/OutlineTag":434,"./tag/SpotTag":437}],411:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var when=require("when"),rxjs_1=require("rxjs"),Component_1=require("../../Component"),Geo_1=require("../../Geo"),Render_1=require("../../Render"),operators_1=require("rxjs/operators"),TagComponent=function(_super){function TagComponent(name,container,navigator){var _this=_super.call(this,name,container,navigator)||this;return _this._tagDomRenderer=new Component_1.TagDOMRenderer,_this._tagScene=new Component_1.TagScene,_this._tagSet=new Component_1.TagSet,_this._tagCreator=new Component_1.TagCreator(_this,navigator),_this._viewportCoords=new Geo_1.ViewportCoords,_this._createHandlers={CreatePoint:new Component_1.CreatePointHandler(_this,container,navigator,_this._viewportCoords,_this._tagCreator),CreatePolygon:new Component_1.CreatePolygonHandler(_this,container,navigator,_this._viewportCoords,_this._tagCreator),CreateRect:new Component_1.CreateRectHandler(_this,container,navigator,_this._viewportCoords,_this._tagCreator),CreateRectDrag:new Component_1.CreateRectDragHandler(_this,container,navigator,_this._viewportCoords,_this._tagCreator),Default:void 0},_this._editVertexHandler=new Component_1.EditVertexHandler(_this,container,navigator,_this._viewportCoords,_this._tagSet),_this._renderTags$=_this._tagSet.changed$.pipe(operators_1.map(function(tagSet){var tags=tagSet.getAll();return tags.sort(function(t1,t2){var id1=t1.tag.id,id2=t2.tag.id;return id1<id2?-1:id2<id1?1:0}),tags}),operators_1.share()),_this._tagChanged$=_this._renderTags$.pipe(operators_1.switchMap(function(tags){return rxjs_1.from(tags).pipe(operators_1.mergeMap(function(tag){return rxjs_1.merge(tag.tag.changed$,tag.tag.geometryChanged$)}))}),operators_1.share()),_this._renderTagGLChanged$=_this._renderTags$.pipe(operators_1.switchMap(function(tags){return rxjs_1.from(tags).pipe(operators_1.mergeMap(function(tag){return tag.glObjectsChanged$}))}),operators_1.share()),_this._createGeometryChanged$=_this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return null!=tag?tag.geometryChanged$:rxjs_1.empty()}),operators_1.share()),_this._createGLObjectsChanged$=_this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return null!=tag?tag.glObjectsChanged$:rxjs_1.empty()}),operators_1.share()),_this._creatingConfiguration$=_this._configuration$.pipe(operators_1.distinctUntilChanged(function(c1,c2){return c1.mode===c2.mode},function(configuration){return{createColor:configuration.createColor,mode:configuration.mode}}),operators_1.publishReplay(1),operators_1.refCount()),_this._creatingConfiguration$.subscribe(function(configuration){_this.fire(TagComponent.modechanged,configuration.mode)}),_this}return __extends(TagComponent,_super),TagComponent.prototype.add=function(tags){var _this=this;this._activated?this._navigator.stateService.currentTransform$.pipe(operators_1.first()).subscribe(function(transform){_this._tagSet.add(tags,transform);var renderTags=tags.map(function(tag){return _this._tagSet.get(tag.id)});_this._tagScene.add(renderTags)}):this._tagSet.addDeactivated(tags)},TagComponent.prototype.changeMode=function(mode){this.configure({mode:mode})},TagComponent.prototype.get=function(tagId){if(this._activated){var renderTag=this._tagSet.get(tagId);return void 0!==renderTag?renderTag.tag:void 0}return this._tagSet.getDeactivated(tagId)},TagComponent.prototype.getAll=function(){return this.activated?this._tagSet.getAll().map(function(renderTag){return renderTag.tag}):this._tagSet.getAllDeactivated()},TagComponent.prototype.getTagIdsAt=function(pixelPoint){var _this=this;return when.promise(function(resolve,reject){_this._container.renderService.renderCamera$.pipe(operators_1.first(),operators_1.map(function(render){var viewport=_this._viewportCoords.canvasToViewport(pixelPoint[0],pixelPoint[1],_this._container.element);return _this._tagScene.intersectObjects(viewport,render.perspective)})).subscribe(function(ids){resolve(ids)},function(error){reject(error)})})},TagComponent.prototype.has=function(tagId){return this._activated?this._tagSet.has(tagId):this._tagSet.hasDeactivated(tagId)},TagComponent.prototype.remove=function(tagIds){this._activated?(this._tagSet.remove(tagIds),this._tagScene.remove(tagIds)):this._tagSet.removeDeactivated(tagIds)},TagComponent.prototype.removeAll=function(){this._activated?(this._tagSet.removeAll(),this._tagScene.removeAll()):this._tagSet.removeAllDeactivated()},TagComponent.prototype._activate=function(){var _this=this;this._editVertexHandler.enable();var handlerGeometryCreated$=rxjs_1.from(Object.keys(this._createHandlers)).pipe(operators_1.map(function(key){return _this._createHandlers[key]}),operators_1.filter(function(handler){return!!handler}),operators_1.mergeMap(function(handler){return handler.geometryCreated$}),operators_1.share());this._fireGeometryCreatedSubscription=handlerGeometryCreated$.subscribe(function(geometry){_this.fire(TagComponent.geometrycreated,geometry)}),this._fireCreateGeometryEventSubscription=this._tagCreator.tag$.pipe(operators_1.skipWhile(function(tag){return null==tag}),operators_1.distinctUntilChanged()).subscribe(function(tag){var eventType=null!=tag?TagComponent.creategeometrystart:TagComponent.creategeometryend;_this.fire(eventType,_this)}),this._handlerStopCreateSubscription=handlerGeometryCreated$.subscribe(function(){_this.changeMode(Component_1.TagMode.Default)}),this._handlerEnablerSubscription=this._creatingConfiguration$.subscribe(function(configuration){_this._disableCreateHandlers();var mode=Component_1.TagMode[configuration.mode],handler=_this._createHandlers[mode];handler&&handler.enable()}),this._fireTagsChangedSubscription=this._renderTags$.subscribe(function(tags){_this.fire(TagComponent.tagschanged,_this)}),this._stopCreateSubscription=this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return null!=tag?tag.aborted$.pipe(operators_1.map(function(t){return null})):rxjs_1.empty()})).subscribe(function(){_this.changeMode(Component_1.TagMode.Default)}),this._setGLCreateTagSubscription=this._tagCreator.tag$.subscribe(function(tag){_this._tagScene.hasCreateTag()&&_this._tagScene.removeCreateTag(),null!=tag&&_this._tagScene.addCreateTag(tag)}),this._createGLObjectsChangedSubscription=this._createGLObjectsChanged$.subscribe(function(tag){_this._tagScene.updateCreateTagObjects(tag)}),this._updateGLObjectsSubscription=this._renderTagGLChanged$.subscribe(function(tag){_this._tagScene.updateObjects(tag)}),this._updateTagSceneSubscription=this._tagChanged$.subscribe(function(tag){_this._tagScene.update()}),this._domSubscription=this._renderTags$.pipe(operators_1.startWith([]),operators_1.tap(function(tags){_this._container.domRenderer.render$.next({name:_this._name,vnode:_this._tagDomRenderer.clear()})}),operators_1.combineLatest(this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._container.renderService.size$,this._tagChanged$.pipe(operators_1.startWith(null)),this._tagCreator.tag$.pipe(operators_1.merge(this._createGeometryChanged$),operators_1.startWith(null)),function(renderTags,rc,atlas,size,tag,ct){return[rc,atlas,size,renderTags,tag,ct]}),operators_1.map(function(args){return{name:_this._name,vnode:_this._tagDomRenderer.render(args[3],args[5],args[1],args[0].perspective,args[2])}})).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.pipe(operators_1.map(function(frame){var tagScene=_this._tagScene;return{name:_this._name,render:{frameId:frame.id,needsRender:tagScene.needsRender,render:tagScene.render.bind(tagScene),stage:Render_1.GLRenderStage.Foreground}}})).subscribe(this._container.glRenderer.render$),this._navigator.stateService.currentTransform$.pipe(operators_1.first()).subscribe(function(transform){_this._tagSet.activate(transform),_this._tagScene.add(_this._tagSet.getAll())})},TagComponent.prototype._deactivate=function(){this._editVertexHandler.disable(),this._disableCreateHandlers(),this._tagScene.clear(),this._tagSet.deactivate(),this._tagCreator.delete$.next(null),this._updateGLObjectsSubscription.unsubscribe(),this._updateTagSceneSubscription.unsubscribe(),this._stopCreateSubscription.unsubscribe(),this._setGLCreateTagSubscription.unsubscribe(),this._createGLObjectsChangedSubscription.unsubscribe(),this._domSubscription.unsubscribe(),this._glSubscription.unsubscribe(),this._fireCreateGeometryEventSubscription.unsubscribe(),this._fireGeometryCreatedSubscription.unsubscribe(),this._fireTagsChangedSubscription.unsubscribe(),this._handlerStopCreateSubscription.unsubscribe(),this._handlerEnablerSubscription.unsubscribe(),this._container.element.classList.remove("component-tag-create")},TagComponent.prototype._getDefaultConfiguration=function(){return{createColor:16777215,mode:Component_1.TagMode.Default}},TagComponent.prototype._disableCreateHandlers=function(){var createHandlers=this._createHandlers;for(var key in createHandlers)if(createHandlers.hasOwnProperty(key)){var handler=createHandlers[key];handler&&handler.disable()}},TagComponent.componentName="tag",TagComponent.creategeometryend="creategeometryend",TagComponent.creategeometrystart="creategeometrystart",TagComponent.modechanged="modechanged",TagComponent.geometrycreated="geometrycreated",TagComponent.tagschanged="tagschanged",TagComponent}(Component_1.Component);exports.TagComponent=TagComponent,Component_1.ComponentService.register(TagComponent),exports.default=TagComponent},{"../../Component":343,"../../Geo":346,"../../Render":349,rxjs:89,"rxjs/operators":285,when:337}],412:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),operators_1=require("rxjs/operators"),TagCreator=function(){function TagCreator(component,navigator){this._component=component,this._navigator=navigator,this._tagOperation$=new rxjs_1.Subject,this._createPolygon$=new rxjs_1.Subject,this._createRect$=new rxjs_1.Subject,this._delete$=new rxjs_1.Subject,this._tag$=this._tagOperation$.pipe(operators_1.scan(function(tag,operation){return operation(tag)},null),operators_1.share()),this._createRect$.pipe(operators_1.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$),operators_1.map(function(_a){var coord=_a[0],conf=_a[1],transform=_a[2];return function(tag){var geometry=new Component_1.RectGeometry([coord[0],coord[1],coord[0],coord[1]]);return new Component_1.OutlineCreateTag(geometry,{color:conf.createColor},transform)}})).subscribe(this._tagOperation$),this._createPolygon$.pipe(operators_1.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$),operators_1.map(function(_a){var coord=_a[0],conf=_a[1],transform=_a[2];return function(tag){var geometry=new Component_1.PolygonGeometry([[coord[0],coord[1]],[coord[0],coord[1]],[coord[0],coord[1]]]);return new Component_1.OutlineCreateTag(geometry,{color:conf.createColor},transform)}})).subscribe(this._tagOperation$),this._delete$.pipe(operators_1.map(function(){return function(tag){return null}})).subscribe(this._tagOperation$)}return Object.defineProperty(TagCreator.prototype,"createRect$",{get:function(){return this._createRect$},enumerable:!0,configurable:!0}),Object.defineProperty(TagCreator.prototype,"createPolygon$",{get:function(){return this._createPolygon$},enumerable:!0,configurable:!0}),Object.defineProperty(TagCreator.prototype,"delete$",{get:function(){return this._delete$},enumerable:!0,configurable:!0}),Object.defineProperty(TagCreator.prototype,"tag$",{get:function(){return this._tag$},enumerable:!0,configurable:!0}),TagCreator}();exports.TagCreator=TagCreator,exports.default=TagCreator},{"../../Component":343,rxjs:89,"rxjs/operators":285}],413:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),TagDOMRenderer=function(){function TagDOMRenderer(){}return TagDOMRenderer.prototype.render=function(tags,createTag,atlas,camera,size){for(var vNodes=[],_i=0,tags_1=tags;_i<tags_1.length;_i++){var tag=tags_1[_i];vNodes=vNodes.concat(tag.getDOMObjects(atlas,camera,size))}return null!=createTag&&(vNodes=vNodes.concat(createTag.getDOMObjects(camera,size))),vd.h("div.TagContainer",{},vNodes)},TagDOMRenderer.prototype.clear=function(){return vd.h("div",{},[])},TagDOMRenderer}();exports.TagDOMRenderer=TagDOMRenderer},{"virtual-dom":296}],414:[function(require,module,exports){"use strict";var TagMode;Object.defineProperty(exports,"__esModule",{value:!0}),function(TagMode){TagMode[TagMode.Default=0]="Default",TagMode[TagMode.CreatePoint=1]="CreatePoint",TagMode[TagMode.CreatePolygon=2]="CreatePolygon",TagMode[TagMode.CreateRect=3]="CreateRect",TagMode[TagMode.CreateRectDrag=4]="CreateRectDrag"}(TagMode=exports.TagMode||(exports.TagMode={})),exports.default=TagMode},{}],415:[function(require,module,exports){"use strict";var TagOperation;Object.defineProperty(exports,"__esModule",{value:!0}),function(TagOperation){TagOperation[TagOperation.None=0]="None",TagOperation[TagOperation.Centroid=1]="Centroid",TagOperation[TagOperation.Vertex=2]="Vertex"}(TagOperation=exports.TagOperation||(exports.TagOperation={})),exports.default=TagOperation},{}],416:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),TagScene=function(){function TagScene(scene,raycaster){this._createTag=null,this._needsRender=!1,this._raycaster=raycaster||new THREE.Raycaster,this._scene=scene||new THREE.Scene,this._objectTags={},this._retrievableObjects=[],this._tags={}}return Object.defineProperty(TagScene.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),TagScene.prototype.add=function(tags){for(var _i=0,tags_1=tags;_i<tags_1.length;_i++){var tag=tags_1[_i];tag.tag.id in this._tags&&this._remove(tag.tag.id),this._add(tag)}this._needsRender=!0},TagScene.prototype.addCreateTag=function(tag){for(var _i=0,_a=tag.glObjects;_i<_a.length;_i++){var object=_a[_i];this._scene.add(object)}this._createTag={tag:tag,objects:tag.glObjects},this._needsRender=!0},TagScene.prototype.clear=function(){for(var _i=0,_a=Object.keys(this._tags);_i<_a.length;_i++){var id=_a[_i];this._remove(id)}this._needsRender=!1},TagScene.prototype.get=function(id){return this.has(id)?this._tags[id].tag:void 0},TagScene.prototype.has=function(id){return id in this._tags},TagScene.prototype.hasCreateTag=function(){return null!=this._createTag},TagScene.prototype.intersectObjects=function(_a,camera){var viewportX=_a[0],viewportY=_a[1];this._raycaster.setFromCamera(new THREE.Vector2(viewportX,viewportY),camera);for(var intersectedIds=[],_i=0,intersects_1=this._raycaster.intersectObjects(this._retrievableObjects);_i<intersects_1.length;_i++){var intersect=intersects_1[_i];intersect.object.uuid in this._objectTags&&intersectedIds.push(this._objectTags[intersect.object.uuid])}return intersectedIds},TagScene.prototype.remove=function(ids){for(var _i=0,ids_1=ids;_i<ids_1.length;_i++){var id=ids_1[_i];this._remove(id)}this._needsRender=!0},TagScene.prototype.removeAll=function(){for(var _i=0,_a=Object.keys(this._tags);_i<_a.length;_i++){var id=_a[_i];this._remove(id)}this._needsRender=!0},TagScene.prototype.removeCreateTag=function(){if(null!=this._createTag){for(var _i=0,_a=this._createTag.objects;_i<_a.length;_i++){var object=_a[_i];this._scene.remove(object)}this._createTag.tag.dispose(),this._createTag=null,this._needsRender=!0}},TagScene.prototype.render=function(perspectiveCamera,renderer){renderer.render(this._scene,perspectiveCamera),this._needsRender=!1},TagScene.prototype.update=function(){this._needsRender=!0},TagScene.prototype.updateCreateTagObjects=function(tag){if(this._createTag.tag!==tag)throw new Error("Create tags do not have the same reference.");for(var _i=0,_a=this._createTag.objects;_i<_a.length;_i++){var object=_a[_i];this._scene.remove(object)}for(var _b=0,_c=tag.glObjects;_b<_c.length;_b++){object=_c[_b];this._scene.add(object)}this._createTag.objects=tag.glObjects,this._needsRender=!0},TagScene.prototype.updateObjects=function(tag){var id=tag.tag.id;if(this._tags[id].tag!==tag)throw new Error("Tags do not have the same reference.");var tagObjects=this._tags[id];this._removeObjects(tagObjects),delete this._tags[id],this._add(tag),this._needsRender=!0},TagScene.prototype._add=function(tag){var id=tag.tag.id,tagObjects={tag:tag,objects:[],retrievableObjects:[]};this._tags[id]=tagObjects;for(var _i=0,_a=tag.getGLObjects();_i<_a.length;_i++){var object=_a[_i];tagObjects.objects.push(object),this._scene.add(object)}for(var _b=0,_c=tag.getRetrievableObjects();_b<_c.length;_b++){var retrievableObject=_c[_b];tagObjects.retrievableObjects.push(retrievableObject),this._retrievableObjects.push(retrievableObject),this._objectTags[retrievableObject.uuid]=tag.tag.id}},TagScene.prototype._remove=function(id){var tagObjects=this._tags[id];this._removeObjects(tagObjects),tagObjects.tag.dispose(),delete this._tags[id]},TagScene.prototype._removeObjects=function(tagObjects){for(var _i=0,_a=tagObjects.objects;_i<_a.length;_i++){var object=_a[_i];this._scene.remove(object)}for(var _b=0,_c=tagObjects.retrievableObjects;_b<_c.length;_b++){var retrievableObject=_c[_b],index=this._retrievableObjects.indexOf(retrievableObject);-1!==index&&this._retrievableObjects.splice(index,1)}},TagScene}();exports.TagScene=TagScene,exports.default=TagScene},{three:288}],417:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../Component"),TagSet=function(){function TagSet(){this._active=!1,this._hash={},this._hashDeactivated={},this._notifyChanged$=new rxjs_1.Subject}return Object.defineProperty(TagSet.prototype,"active",{get:function(){return this._active},enumerable:!0,configurable:!0}),Object.defineProperty(TagSet.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),TagSet.prototype.activate=function(transform){if(!this._active){for(var id in this._hashDeactivated)if(this._hashDeactivated.hasOwnProperty(id)){var tag=this._hashDeactivated[id];this._add(tag,transform)}this._hashDeactivated={},this._active=!0,this._notifyChanged$.next(this)}},TagSet.prototype.deactivate=function(){if(this._active){for(var id in this._hash)this._hash.hasOwnProperty(id)&&(this._hashDeactivated[id]=this._hash[id].tag);this._hash={},this._active=!1}},TagSet.prototype.add=function(tags,transform){this._assertActivationState(!0);for(var _i=0,tags_1=tags;_i<tags_1.length;_i++){var tag=tags_1[_i];this._add(tag,transform)}this._notifyChanged$.next(this)},TagSet.prototype.addDeactivated=function(tags){this._assertActivationState(!1);for(var _i=0,tags_2=tags;_i<tags_2.length;_i++){var tag=tags_2[_i];if(!(tag instanceof Component_1.OutlineTag||tag instanceof Component_1.SpotTag))throw new Error("Tag type not supported");this._hashDeactivated[tag.id]=tag}},TagSet.prototype.get=function(id){return this.has(id)?this._hash[id]:void 0},TagSet.prototype.getAll=function(){var hash=this._hash;return Object.keys(hash).map(function(id){return hash[id]})},TagSet.prototype.getAllDeactivated=function(){var hashDeactivated=this._hashDeactivated;return Object.keys(hashDeactivated).map(function(id){return hashDeactivated[id]})},TagSet.prototype.getDeactivated=function(id){return this.hasDeactivated(id)?this._hashDeactivated[id]:void 0},TagSet.prototype.has=function(id){return id in this._hash},TagSet.prototype.hasDeactivated=function(id){return id in this._hashDeactivated},TagSet.prototype.remove=function(ids){this._assertActivationState(!0);for(var hash=this._hash,_i=0,ids_1=ids;_i<ids_1.length;_i++){var id=ids_1[_i];id in hash&&delete hash[id]}this._notifyChanged$.next(this)},TagSet.prototype.removeAll=function(){this._assertActivationState(!0),this._hash={},this._notifyChanged$.next(this)},TagSet.prototype.removeAllDeactivated=function(){this._assertActivationState(!1),this._hashDeactivated={}},TagSet.prototype.removeDeactivated=function(ids){this._assertActivationState(!1);for(var hashDeactivated=this._hashDeactivated,_i=0,ids_2=ids;_i<ids_2.length;_i++){var id=ids_2[_i];id in hashDeactivated&&delete hashDeactivated[id]}},TagSet.prototype._add=function(tag,transform){if(tag instanceof Component_1.OutlineTag)this._hash[tag.id]=new Component_1.OutlineRenderTag(tag,transform);else{if(!(tag instanceof Component_1.SpotTag))throw new Error("Tag type not supported");this._hash[tag.id]=new Component_1.SpotRenderTag(tag,transform)}},TagSet.prototype._assertActivationState=function(should){if(should!==this._active)throw new Error("Tag set not in correct state for operation.")},TagSet}();exports.TagSet=TagSet,exports.default=TagSet},{"../../Component":343,rxjs:89}],418:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Error_1=require("../../../Error"),GeometryTagError=function(_super){function GeometryTagError(message){var _this=_super.call(this,null!=message?message:"The provided geometry value is incorrect")||this;return _this.name="GeometryTagError",_this}return __extends(GeometryTagError,_super),GeometryTagError}(Error_1.BeeviewError);exports.GeometryTagError=GeometryTagError,exports.default=Error_1.BeeviewError},{"../../../Error":345}],419:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Geometry=function(){function Geometry(){this._notifyChanged$=new rxjs_1.Subject}return Object.defineProperty(Geometry.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Geometry}();exports.Geometry=Geometry,exports.default=Geometry},{rxjs:89}],420:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../../Component"),PointGeometry=function(_super){function PointGeometry(point){var _this=_super.call(this)||this,x=point[0],y=point[1];if(x<0||1<x||y<0||1<y)throw new Component_1.GeometryTagError("Basic coordinates must be on the interval [0, 1].");return _this._point=point.slice(),_this}return __extends(PointGeometry,_super),Object.defineProperty(PointGeometry.prototype,"point",{get:function(){return this._point},enumerable:!0,configurable:!0}),PointGeometry.prototype.getCentroid2d=function(){return this._point.slice()},PointGeometry.prototype.getCentroid3d=function(transform){return transform.unprojectBasic(this._point,200)},PointGeometry.prototype.setCentroid2d=function(value,transform){var changed=[Math.max(0,Math.min(1,value[0])),Math.max(0,Math.min(1,value[1]))];this._point[0]=changed[0],this._point[1]=changed[1],this._notifyChanged$.next(this)},PointGeometry}(Component_1.Geometry);exports.PointGeometry=PointGeometry},{"../../../Component":343}],421:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../../Component"),PolygonGeometry=function(_super){function PolygonGeometry(polygon,holes){var _this=_super.call(this)||this,polygonLength=polygon.length;if(polygonLength<3)throw new Component_1.GeometryTagError("A polygon must have three or more positions.");if(polygon[0][0]!==polygon[polygonLength-1][0]||polygon[0][1]!==polygon[polygonLength-1][1])throw new Component_1.GeometryTagError("First and last positions must be equivalent.");_this._polygon=[];for(var _i=0,polygon_1=polygon;_i<polygon_1.length;_i++){if((vertex=polygon_1[_i])[0]<0||1<vertex[0]||vertex[1]<0||1<vertex[1])throw new Component_1.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].");_this._polygon.push(vertex.slice())}if(_this._holes=[],null==holes)return _this;for(var i=0;i<holes.length;i++){var hole=holes[i],holeLength=hole.length;if(holeLength<3)throw new Component_1.GeometryTagError("A polygon hole must have three or more positions.");if(hole[0][0]!==hole[holeLength-1][0]||hole[0][1]!==hole[holeLength-1][1])throw new Component_1.GeometryTagError("First and last positions of hole must be equivalent.");_this._holes.push([]);for(var _a=0,hole_1=hole;_a<hole_1.length;_a++){var vertex;if((vertex=hole_1[_a])[0]<0||1<vertex[0]||vertex[1]<0||1<vertex[1])throw new Component_1.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].");_this._holes[i].push(vertex.slice())}}return _this}return __extends(PolygonGeometry,_super),Object.defineProperty(PolygonGeometry.prototype,"polygon",{get:function(){return this._polygon},enumerable:!0,configurable:!0}),Object.defineProperty(PolygonGeometry.prototype,"holes",{get:function(){return this._holes},enumerable:!0,configurable:!0}),PolygonGeometry.prototype.addVertex2d=function(vertex){var clamped=[Math.max(0,Math.min(1,vertex[0])),Math.max(0,Math.min(1,vertex[1]))];this._polygon.splice(this._polygon.length-1,0,clamped),this._notifyChanged$.next(this)},PolygonGeometry.prototype.getVertex2d=function(index){return this._polygon[index].slice()},PolygonGeometry.prototype.removeVertex2d=function(index){if(index<0||index>=this._polygon.length||this._polygon.length<4)throw new Component_1.GeometryTagError("Index for removed vertex must be valid.");if(0<index&&index<this._polygon.length-1)this._polygon.splice(index,1);else{this._polygon.splice(0,1),this._polygon.pop();var closing=this._polygon[0].slice();this._polygon.push(closing)}this._notifyChanged$.next(this)},PolygonGeometry.prototype.setVertex2d=function(index,value,transform){var changed=[Math.max(0,Math.min(1,value[0])),Math.max(0,Math.min(1,value[1]))];0===index||index===this._polygon.length-1?(this._polygon[0]=changed.slice(),this._polygon[this._polygon.length-1]=changed.slice()):this._polygon[index]=changed.slice(),this._notifyChanged$.next(this)},PolygonGeometry.prototype.setCentroid2d=function(value,transform){for(var xs=this._polygon.map(function(point){return point[0]}),ys=this._polygon.map(function(point){return point[1]}),minX=Math.min.apply(Math,xs),maxX=Math.max.apply(Math,xs),minY=Math.min.apply(Math,ys),maxY=Math.max.apply(Math,ys),centroid=this.getCentroid2d(),minTranslationX=-minX,maxTranslationX=1-maxX,minTranslationY=-minY,maxTranslationY=1-maxY,translationX=Math.max(minTranslationX,Math.min(maxTranslationX,value[0]-centroid[0])),translationY=Math.max(minTranslationY,Math.min(maxTranslationY,value[1]-centroid[1])),_i=0,_a=this._polygon;_i<_a.length;_i++){var point=_a[_i];point[0]+=translationX,point[1]+=translationY}this._notifyChanged$.next(this)},PolygonGeometry.prototype.getPoints3d=function(transform){return this.getVertices3d(transform)},PolygonGeometry.prototype.getVertex3d=function(index,transform){return transform.unprojectBasic(this._polygon[index],200)},PolygonGeometry.prototype.getVertices2d=function(){return this._polygon.slice()},PolygonGeometry.prototype.getVertices3d=function(transform){return this._polygon.map(function(point){return transform.unprojectBasic(point,200)})},PolygonGeometry.prototype.getHoleVertices3d=function(transform){for(var holes3d=[],_i=0,_a=this._holes;_i<_a.length;_i++){var hole3d=_a[_i].map(function(point){return transform.unprojectBasic(point,200)});holes3d.push(hole3d)}return holes3d},PolygonGeometry.prototype.getCentroid2d=function(){for(var polygon=this._polygon,area=0,centroidX=0,centroidY=0,i=0;i<polygon.length-1;i++){var xi=polygon[i][0],yi=polygon[i][1],xi1=polygon[i+1][0],yi1=polygon[i+1][1],a=xi*yi1-xi1*yi;area+=a,centroidX+=(xi+xi1)*a,centroidY+=(yi+yi1)*a}return[centroidX/=6*(area/=2),centroidY/=6*area]},PolygonGeometry.prototype.getCentroid3d=function(transform){var centroid2d=this.getCentroid2d();return transform.unprojectBasic(centroid2d,200)},PolygonGeometry.prototype.getTriangles3d=function(transform){return this._triangulate(this._polygon,this.getPoints3d(transform),this._holes,this.getHoleVertices3d(transform))},PolygonGeometry.prototype.getPoleOfAccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._polygon.slice())},PolygonGeometry.prototype.getPoleOfAccessibility3d=function(transform){var pole2d=this._getPoleOfInaccessibility2d(this._polygon.slice());return transform.unprojectBasic(pole2d,200)},PolygonGeometry}(Component_1.VertexGeometry);exports.PolygonGeometry=PolygonGeometry,exports.default=PolygonGeometry},{"../../../Component":343}],422:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../../Component"),RectGeometry=function(_super){function RectGeometry(rect){var _this=_super.call(this)||this;if(rect[1]>rect[3])throw new Component_1.GeometryTagError("Basic Y coordinates values can not be inverted.");for(var _i=0,rect_1=rect;_i<rect_1.length;_i++){var coord=rect_1[_i];if(coord<0||1<coord)throw new Component_1.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}return _this._anchorIndex=void 0,_this._rect=rect.slice(0,4),_this._inverted=_this._rect[0]>_this._rect[2],_this}return __extends(RectGeometry,_super),Object.defineProperty(RectGeometry.prototype,"anchorIndex",{get:function(){return this._anchorIndex},enumerable:!0,configurable:!0}),Object.defineProperty(RectGeometry.prototype,"inverted",{get:function(){return this._inverted},enumerable:!0,configurable:!0}),Object.defineProperty(RectGeometry.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),RectGeometry.prototype.initializeAnchorIndexing=function(index){if(void 0!==this._anchorIndex)throw new Error("Anchor indexing is already initialized.");if(index<0||3<index)throw new Error("Invalid anchor index: "+index+".");this._anchorIndex=void 0===index?0:index},RectGeometry.prototype.terminateAnchorIndexing=function(){this._anchorIndex=void 0},RectGeometry.prototype.setOppositeVertex2d=function(opposite,transform){if(void 0===this._anchorIndex)throw new Error("Anchor indexing needs to be initialized.");var changed=[Math.max(0,Math.min(1,opposite[0])),Math.max(0,Math.min(1,opposite[1]))],original=this._rect.slice(),anchor=0===this._anchorIndex?[original[0],original[3]]:1===this._anchorIndex?[original[0],original[1]]:2===this._anchorIndex?[original[2],original[1]]:[original[2],original[3]];if(transform.fullPano){var deltaX=this._anchorIndex<2?changed[0]-original[2]:changed[0]-original[0];!this._inverted&&this._anchorIndex<2&&changed[0]<.25&&.75<original[2]&&deltaX<-.5?(this._inverted=!0,this._anchorIndex=changed[1]<anchor[1]?0:1):!this._inverted&&2<=this._anchorIndex&&changed[0]<.25&&.75<original[2]&&deltaX<-.5?(this._inverted=!0,this._anchorIndex=changed[1]<anchor[1]?0:1):this._inverted&&2<=this._anchorIndex&&changed[0]<.25&&.75<original[0]&&deltaX<-.5?(this._inverted=!1,this._anchorIndex=changed[0]<anchor[0]?changed[1]<anchor[1]?3:2:changed[1]<anchor[1]?0:1):!this._inverted&&2<=this._anchorIndex&&.75<changed[0]&&original[0]<.25&&.5<deltaX?(this._inverted=!0,this._anchorIndex=changed[1]<anchor[1]?3:2):!this._inverted&&this._anchorIndex<2&&.75<changed[0]&&original[0]<.25&&.5<deltaX?(this._inverted=!0,this._anchorIndex=changed[1]<anchor[1]?3:2):this._inverted&&this._anchorIndex<2&&.75<changed[0]&&original[2]<.25&&.5<deltaX?(this._inverted=!1,this._anchorIndex=changed[0]<anchor[0]?changed[1]<anchor[1]?3:2:changed[1]<anchor[1]?0:1):this._inverted&&this._anchorIndex<2&&changed[0]>original[0]?(this._inverted=!1,this._anchorIndex=changed[1]<anchor[1]?0:1):this._inverted&&2<=this._anchorIndex&&changed[0]<original[2]?(this._inverted=!1,this._anchorIndex=changed[1]<anchor[1]?3:2):this._inverted?this._anchorIndex<2?this._anchorIndex=changed[1]<anchor[1]?0:1:this._anchorIndex=changed[1]<anchor[1]?3:2:this._anchorIndex=anchor[0]<=changed[0]&&changed[1]<anchor[1]?0:anchor[0]<=changed[0]&&anchor[1]<=changed[1]?1:changed[0]<anchor[0]&&anchor[1]<=changed[1]?2:3;var rect=[];0===this._anchorIndex?(rect[0]=anchor[0],rect[1]=changed[1],rect[2]=changed[0],rect[3]=anchor[1]):1===this._anchorIndex?(rect[0]=anchor[0],rect[1]=anchor[1],rect[2]=changed[0],rect[3]=changed[1]):2===this._anchorIndex?(rect[0]=changed[0],rect[1]=anchor[1],rect[2]=anchor[0],rect[3]=changed[1]):(rect[0]=changed[0],rect[1]=changed[1],rect[2]=anchor[0],rect[3]=anchor[1]),(!this._inverted&&rect[0]>rect[2]||this._inverted&&rect[0]<rect[2])&&(rect[0]=original[0],rect[2]=original[2]),rect[1]>rect[3]&&(rect[1]=original[1],rect[3]=original[3]),this._rect[0]=rect[0],this._rect[1]=rect[1],this._rect[2]=rect[2],this._rect[3]=rect[3]}else{this._anchorIndex=anchor[0]<=changed[0]&&changed[1]<anchor[1]?0:anchor[0]<=changed[0]&&anchor[1]<=changed[1]?1:changed[0]<anchor[0]&&anchor[1]<=changed[1]?2:3;rect=[];0===this._anchorIndex?(rect[0]=anchor[0],rect[1]=changed[1],rect[2]=changed[0],rect[3]=anchor[1]):1===this._anchorIndex?(rect[0]=anchor[0],rect[1]=anchor[1],rect[2]=changed[0],rect[3]=changed[1]):2===this._anchorIndex?(rect[0]=changed[0],rect[1]=anchor[1],rect[2]=anchor[0],rect[3]=changed[1]):(rect[0]=changed[0],rect[1]=changed[1],rect[2]=anchor[0],rect[3]=anchor[1]),rect[0]>rect[2]&&(rect[0]=original[0],rect[2]=original[2]),rect[1]>rect[3]&&(rect[1]=original[1],rect[3]=original[3]),this._rect[0]=rect[0],this._rect[1]=rect[1],this._rect[2]=rect[2],this._rect[3]=rect[3]}this._notifyChanged$.next(this)},RectGeometry.prototype.setVertex2d=function(index,value,transform){var original=this._rect.slice(),changed=[Math.max(0,Math.min(1,value[0])),Math.max(0,Math.min(1,value[1]))],rect=[];if(0===index?(rect[0]=changed[0],rect[1]=original[1],rect[2]=original[2],rect[3]=changed[1]):1===index?(rect[0]=changed[0],rect[1]=changed[1],rect[2]=original[2],rect[3]=original[3]):2===index?(rect[0]=original[0],rect[1]=changed[1],rect[2]=changed[0],rect[3]=original[3]):3===index&&(rect[0]=original[0],rect[1]=original[1],rect[2]=changed[0],rect[3]=changed[1]),transform.fullPano){var passingBoundaryLeftward=index<2&&.75<changed[0]&&original[0]<.25||2<=index&&this._inverted&&.75<changed[0]&&original[2]<.25,passingBoundaryRightward=index<2&&this._inverted&&changed[0]<.25&&.75<original[0]||2<=index&&changed[0]<.25&&.75<original[2];passingBoundaryLeftward||passingBoundaryRightward?this._inverted=!this._inverted:(rect[0]-original[0]<-.25&&(rect[0]=original[0]),.25<rect[2]-original[2]&&(rect[2]=original[2])),(!this._inverted&&rect[0]>rect[2]||this._inverted&&rect[0]<rect[2])&&(rect[0]=original[0],rect[2]=original[2])}else rect[0]>rect[2]&&(rect[0]=original[0],rect[2]=original[2]);rect[1]>rect[3]&&(rect[1]=original[1],rect[3]=original[3]),this._rect[0]=rect[0],this._rect[1]=rect[1],this._rect[2]=rect[2],this._rect[3]=rect[3],this._notifyChanged$.next(this)},RectGeometry.prototype.setCentroid2d=function(value,transform){var original=this._rect.slice(),x0=original[0],x1=this._inverted?original[2]+1:original[2],y0=original[1],y1=original[3],centerX=x0+(x1-x0)/2,centerY=y0+(y1-y0)/2,translationX=0;if(null!=transform.gpano&&transform.gpano.CroppedAreaImageWidthPixels===transform.gpano.FullPanoWidthPixels)translationX=this._inverted?value[0]+1-centerX:value[0]-centerX;else{var minTranslationX=-x0,maxTranslationX=1-x1;translationX=Math.max(minTranslationX,Math.min(maxTranslationX,value[0]-centerX))}var minTranslationY=-y0,maxTranslationY=1-y1,translationY=Math.max(minTranslationY,Math.min(maxTranslationY,value[1]-centerY));this._rect[0]=original[0]+translationX,this._rect[1]=original[1]+translationY,this._rect[2]=original[2]+translationX,this._rect[3]=original[3]+translationY,this._rect[0]<0?(this._rect[0]+=1,this._inverted=!this._inverted):1<this._rect[0]&&(this._rect[0]-=1,this._inverted=!this._inverted),this._rect[2]<0?(this._rect[2]+=1,this._inverted=!this._inverted):1<this._rect[2]&&(this._rect[2]-=1,this._inverted=!this._inverted),this._notifyChanged$.next(this)},RectGeometry.prototype.getPoints3d=function(transform){return this._getPoints2d(transform).map(function(point){return transform.unprojectBasic(point,200)})},RectGeometry.prototype.getVertex2d=function(index){return this._rectToVertices2d(this._rect)[index]},RectGeometry.prototype.getNonAdjustedVertex2d=function(index){return this._rectToNonAdjustedVertices2d(this._rect)[index]},RectGeometry.prototype.getVertex3d=function(index,transform){return transform.unprojectBasic(this._rectToVertices2d(this._rect)[index],200)},RectGeometry.prototype.getVertices2d=function(){return this._rectToVertices2d(this._rect)},RectGeometry.prototype.getVertices3d=function(transform){return this._rectToVertices2d(this._rect).map(function(vertex){return transform.unprojectBasic(vertex,200)})},RectGeometry.prototype.getCentroid2d=function(){var rect=this._rect,x0=rect[0],x1=this._inverted?rect[2]+1:rect[2],y0=rect[1];return[x0+(x1-x0)/2,y0+(rect[3]-y0)/2]},RectGeometry.prototype.getCentroid3d=function(transform){var centroid2d=this.getCentroid2d();return transform.unprojectBasic(centroid2d,200)},RectGeometry.prototype.getPoleOfAccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect))},RectGeometry.prototype.getPoleOfAccessibility3d=function(transform){var pole2d=this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));return transform.unprojectBasic(pole2d,200)},RectGeometry.prototype.getTriangles3d=function(transform){return this._triangulate(this._rectToVertices2d(this._rect),this.getVertices3d(transform))},RectGeometry.prototype.validate=function(bottomRight){var rect=this._rect;return!(!this._inverted&&bottomRight[0]<rect[0]||.25<bottomRight[0]-rect[2]||bottomRight[1]<rect[1])},RectGeometry.prototype._getPoints2d=function(transform){for(var vertices2d=this._rectToVertices2d(this._rect),sides=vertices2d.length-1,points2d=[],i=0;i<sides;++i)for(var startX=vertices2d[i][0],startY=vertices2d[i][1],intervalX=(vertices2d[i+1][0]-startX)/9,intervalY=(vertices2d[i+1][1]-startY)/9,j=0;j<10;++j){var point=[startX+j*intervalX,startY+j*intervalY];points2d.push(point)}return points2d},RectGeometry.prototype._rectToVertices2d=function(rect){return[[rect[0],rect[3]],[rect[0],rect[1]],[this._inverted?rect[2]+1:rect[2],rect[1]],[this._inverted?rect[2]+1:rect[2],rect[3]],[rect[0],rect[3]]]},RectGeometry.prototype._rectToNonAdjustedVertices2d=function(rect){return[[rect[0],rect[3]],[rect[0],rect[1]],[rect[2],rect[1]],[rect[2],rect[3]],[rect[0],rect[3]]]},RectGeometry}(Component_1.VertexGeometry);exports.RectGeometry=RectGeometry,exports.default=RectGeometry},{"../../../Component":343}],423:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var earcut=require("earcut"),polylabel=require("@mapbox/polylabel"),VertexGeometry=function(_super){function VertexGeometry(){return _super.call(this)||this}return __extends(VertexGeometry,_super),VertexGeometry.prototype._getPoleOfInaccessibility2d=function(points2d){return polylabel([points2d],.03)},VertexGeometry.prototype._triangulate=function(points2d,points3d,holes2d,holes3d){for(var data=[points2d.slice(0,-1)],_i=0,_a=null!=holes2d?holes2d:[];_i<_a.length;_i++){var hole2d=_a[_i];data.push(hole2d.slice(0,-1))}for(var points=points3d.slice(0,-1),_b=0,_c=null!=holes3d?holes3d:[];_b<_c.length;_b++){var hole3d=_c[_b];points=points.concat(hole3d.slice(0,-1))}for(var flattened=earcut.flatten(data),indices=earcut(flattened.vertices,flattened.holes,flattened.dimensions),triangles=[],i=0;i<indices.length;++i){var point=points[indices[i]];triangles.push(point[0]),triangles.push(point[1]),triangles.push(point[2])}return triangles},VertexGeometry}(require("../../../Component").Geometry);exports.VertexGeometry=VertexGeometry,exports.default=VertexGeometry},{"../../../Component":343,"@mapbox/polylabel":1,earcut:49}],424:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../../Component"),operators_1=require("rxjs/operators"),CreateHandlerBase=function(_super){function CreateHandlerBase(component,container,navigator,viewportCoords,tagCreator){var _this=_super.call(this,component,container,navigator,viewportCoords)||this;return _this._tagCreator=tagCreator,_this._geometryCreated$=new rxjs_1.Subject,_this}return __extends(CreateHandlerBase,_super),Object.defineProperty(CreateHandlerBase.prototype,"geometryCreated$",{get:function(){return this._geometryCreated$},enumerable:!0,configurable:!0}),CreateHandlerBase.prototype._enable=function(){this._enableCreate(),this._container.element.classList.add("component-tag-create")},CreateHandlerBase.prototype._disable=function(){this._container.element.classList.remove("component-tag-create"),this._disableCreate()},CreateHandlerBase.prototype._validateBasic=function(basic){var x=basic[0],y=basic[1];return 0<=x&&x<=1&&0<=y&&y<=1},CreateHandlerBase.prototype._mouseEventToBasic$=function(mouseEvent$){var _this=this;return mouseEvent$.pipe(operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$),operators_1.map(function(_a){var event=_a[0],camera=_a[1],transform=_a[2];return _this._mouseEventToBasic(event,_this._container.element,camera,transform)}))},CreateHandlerBase}(Component_1.TagHandlerBase);exports.CreateHandlerBase=CreateHandlerBase,exports.default=CreateHandlerBase},{"../../../Component":343,rxjs:89,"rxjs/operators":285}],425:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../../Component"),operators_1=require("rxjs/operators"),CreatePointHandler=function(_super){function CreatePointHandler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(CreatePointHandler,_super),CreatePointHandler.prototype._enableCreate=function(){this._container.mouseService.deferPixels(this._name,4),this._geometryCreatedSubscription=this._mouseEventToBasic$(this._container.mouseService.proximateClick$).pipe(operators_1.filter(this._validateBasic),operators_1.map(function(basic){return new Component_1.PointGeometry(basic)})).subscribe(this._geometryCreated$)},CreatePointHandler.prototype._disableCreate=function(){this._container.mouseService.undeferPixels(this._name),this._geometryCreatedSubscription.unsubscribe()},CreatePointHandler.prototype._getNameExtension=function(){return"create-point"},CreatePointHandler}(Component_1.CreateHandlerBase);exports.CreatePointHandler=CreatePointHandler,exports.default=CreatePointHandler},{"../../../Component":343,"rxjs/operators":285}],426:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var CreatePolygonHandler=function(_super){function CreatePolygonHandler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(CreatePolygonHandler,_super),CreatePolygonHandler.prototype._addPoint=function(tag,basicPoint){tag.addPoint(basicPoint)},Object.defineProperty(CreatePolygonHandler.prototype,"_create$",{get:function(){return this._tagCreator.createPolygon$},enumerable:!0,configurable:!0}),CreatePolygonHandler.prototype._getNameExtension=function(){return"create-polygon"},CreatePolygonHandler.prototype._setVertex2d=function(tag,basicPoint,transform){tag.geometry.setVertex2d(tag.geometry.polygon.length-2,basicPoint,transform)},CreatePolygonHandler}(require("../../../Component").CreateVertexHandler);exports.CreatePolygonHandler=CreatePolygonHandler,exports.default=CreatePolygonHandler},{"../../../Component":343}],427:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../../Component"),operators_1=require("rxjs/operators"),CreateRectDragHandler=function(_super){function CreateRectDragHandler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(CreateRectDragHandler,_super),CreateRectDragHandler.prototype._enableCreate=function(){var _this=this;this._container.mouseService.claimMouse(this._name,2),this._deleteSubscription=this._navigator.stateService.currentTransform$.pipe(operators_1.map(function(transform){return null}),operators_1.skip(1)).subscribe(this._tagCreator.delete$),this._createSubscription=this._mouseEventToBasic$(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$)).pipe(operators_1.filter(this._validateBasic)).subscribe(this._tagCreator.createRect$),this._initializeAnchorIndexingSubscription=this._tagCreator.tag$.pipe(operators_1.filter(function(tag){return!!tag})).subscribe(function(tag){tag.geometry.initializeAnchorIndexing()});var basicMouse$=rxjs_1.merge(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseMove$),this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseMove$)).pipe(operators_1.combineLatest(this._container.renderService.renderCamera$),operators_1.withLatestFrom(this._navigator.stateService.currentTransform$),operators_1.map(function(_a){var _b=_a[0],event=_b[0],camera=_b[1],transform=_a[1];return _this._mouseEventToBasic(event,_this._container.element,camera,transform)}));this._setVertexSubscription=this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return tag?rxjs_1.combineLatest(rxjs_1.of(tag),basicMouse$,_this._navigator.stateService.currentTransform$):rxjs_1.empty()})).subscribe(function(_a){var tag=_a[0],basicPoint=_a[1],transform=_a[2];tag.geometry.setOppositeVertex2d(basicPoint,transform)});var basicMouseDragEnd$=this._container.mouseService.mouseDragEnd$.pipe(operators_1.withLatestFrom(this._mouseEventToBasic$(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$)).pipe(operators_1.filter(this._validateBasic)),function(event,basicPoint){return basicPoint}),operators_1.share());this._addPointSubscription=this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return tag?rxjs_1.combineLatest(rxjs_1.of(tag),basicMouseDragEnd$):rxjs_1.empty()})).subscribe(function(_a){var tag=_a[0],basicPoint=_a[1],rectGeometry=tag.geometry;rectGeometry.validate(basicPoint)||(basicPoint=rectGeometry.getNonAdjustedVertex2d(3)),tag.addPoint(basicPoint)}),this._geometryCreatedSubscription=this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return tag?tag.created$.pipe(operators_1.map(function(t){return t.geometry})):rxjs_1.empty()})).subscribe(this._geometryCreated$)},CreateRectDragHandler.prototype._disableCreate=function(){this._container.mouseService.unclaimMouse(this._name),this._tagCreator.delete$.next(null),this._addPointSubscription.unsubscribe(),this._createSubscription.unsubscribe(),this._deleteSubscription.unsubscribe(),this._geometryCreatedSubscription.unsubscribe(),this._initializeAnchorIndexingSubscription.unsubscribe(),this._setVertexSubscription.unsubscribe()},CreateRectDragHandler.prototype._getNameExtension=function(){return"create-rect-drag"},CreateRectDragHandler}(Component_1.CreateHandlerBase);exports.CreateRectDragHandler=CreateRectDragHandler,exports.default=CreateRectDragHandler},{"../../../Component":343,rxjs:89,"rxjs/operators":285}],428:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../../../Component"),operators_1=require("rxjs/operators"),CreateRectHandler=function(_super){function CreateRectHandler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(CreateRectHandler,_super),Object.defineProperty(CreateRectHandler.prototype,"_create$",{get:function(){return this._tagCreator.createRect$},enumerable:!0,configurable:!0}),CreateRectHandler.prototype._addPoint=function(tag,basicPoint){var rectGeometry=tag.geometry;rectGeometry.validate(basicPoint)||(basicPoint=rectGeometry.getNonAdjustedVertex2d(3)),tag.addPoint(basicPoint)},CreateRectHandler.prototype._enable=function(){_super.prototype._enable.call(this),this._initializeAnchorIndexingSubscription=this._tagCreator.tag$.pipe(operators_1.filter(function(tag){return!!tag})).subscribe(function(tag){tag.geometry.initializeAnchorIndexing()})},CreateRectHandler.prototype._disable=function(){_super.prototype._disable.call(this),this._initializeAnchorIndexingSubscription.unsubscribe()},CreateRectHandler.prototype._getNameExtension=function(){return"create-rect"},CreateRectHandler.prototype._setVertex2d=function(tag,basicPoint,transform){tag.geometry.setOppositeVertex2d(basicPoint,transform)},CreateRectHandler}(Component_1.CreateVertexHandler);exports.CreateRectHandler=CreateRectHandler,exports.default=CreateRectHandler},{"../../../Component":343,"rxjs/operators":285}],429:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../../Component"),operators_1=require("rxjs/operators"),CreateVertexHandler=function(_super){function CreateVertexHandler(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(CreateVertexHandler,_super),CreateVertexHandler.prototype._enableCreate=function(){var _this=this;this._container.mouseService.deferPixels(this._name,4);var transformChanged$=this._navigator.stateService.currentTransform$.pipe(operators_1.map(function(transform){}),operators_1.publishReplay(1),operators_1.refCount());this._deleteSubscription=transformChanged$.pipe(operators_1.skip(1)).subscribe(this._tagCreator.delete$);var basicClick$=this._mouseEventToBasic$(this._container.mouseService.proximateClick$).pipe(operators_1.share());this._createSubscription=transformChanged$.pipe(operators_1.switchMap(function(){return basicClick$.pipe(operators_1.filter(_this._validateBasic),operators_1.take(1))})).subscribe(this._create$),this._setVertexSubscription=this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return tag?rxjs_1.combineLatest(rxjs_1.of(tag),rxjs_1.merge(_this._container.mouseService.mouseMove$,_this._container.mouseService.domMouseMove$),_this._container.renderService.renderCamera$,_this._navigator.stateService.currentTransform$):rxjs_1.empty()})).subscribe(function(_a){var tag=_a[0],event=_a[1],camera=_a[2],transform=_a[3],basicPoint=_this._mouseEventToBasic(event,_this._container.element,camera,transform);_this._setVertex2d(tag,basicPoint,transform)}),this._addPointSubscription=this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return tag?rxjs_1.combineLatest(rxjs_1.of(tag),basicClick$):rxjs_1.empty()})).subscribe(function(_a){var tag=_a[0],basicPoint=_a[1];_this._addPoint(tag,basicPoint)}),this._geometryCreateSubscription=this._tagCreator.tag$.pipe(operators_1.switchMap(function(tag){return tag?tag.created$.pipe(operators_1.map(function(t){return t.geometry})):rxjs_1.empty()})).subscribe(this._geometryCreated$)},CreateVertexHandler.prototype._disableCreate=function(){this._container.mouseService.undeferPixels(this._name),this._tagCreator.delete$.next(null),this._addPointSubscription.unsubscribe(),this._createSubscription.unsubscribe(),this._deleteSubscription.unsubscribe(),this._geometryCreateSubscription.unsubscribe(),this._setVertexSubscription.unsubscribe()},CreateVertexHandler}(Component_1.CreateHandlerBase);exports.CreateVertexHandler=CreateVertexHandler,exports.default=CreateVertexHandler},{"../../../Component":343,rxjs:89,"rxjs/operators":285}],430:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../../Component"),operators_1=require("rxjs/operators"),EditVertexHandler=function(_super){function EditVertexHandler(component,container,navigator,viewportCoords,tagSet){var _this=_super.call(this,component,container,navigator,viewportCoords)||this;return _this._tagSet=tagSet,_this}return __extends(EditVertexHandler,_super),EditVertexHandler.prototype._enable=function(){var _this=this,interaction$=this._tagSet.changed$.pipe(operators_1.map(function(tagSet){return tagSet.getAll()}),operators_1.switchMap(function(tags){return rxjs_1.from(tags).pipe(operators_1.mergeMap(function(tag){return tag.interact$}))}),operators_1.switchMap(function(interaction){return rxjs_1.of(interaction).pipe(operators_1.concat(_this._container.mouseService.documentMouseUp$.pipe(operators_1.map(function(){return{offsetX:0,offsetY:0,operation:Component_1.TagOperation.None,tag:null}}),operators_1.first())))}),operators_1.share()),mouseMove$=rxjs_1.merge(this._container.mouseService.mouseMove$,this._container.mouseService.domMouseMove$).pipe(operators_1.share());this._claimMouseSubscription=interaction$.pipe(operators_1.switchMap(function(interaction){return interaction.tag?_this._container.mouseService.domMouseDragStart$:rxjs_1.empty()})).subscribe(function(){_this._container.mouseService.claimMouse(_this._name,3)}),this._cursorSubscription=interaction$.pipe(operators_1.map(function(interaction){return interaction.cursor}),operators_1.distinctUntilChanged()).subscribe(function(cursor){for(var _i=0,interactionCursors_1=["crosshair","move","nesw-resize","nwse-resize"];_i<interactionCursors_1.length;_i++){var interactionCursor=interactionCursors_1[_i];_this._container.element.classList.remove("component-tag-edit-"+interactionCursor)}cursor&&_this._container.element.classList.add("component-tag-edit-"+cursor)}),this._unclaimMouseSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseDragEnd$).subscribe(function(e){_this._container.mouseService.unclaimMouse(_this._name)}),this._preventDefaultSubscription=interaction$.pipe(operators_1.switchMap(function(interaction){return interaction.tag?_this._container.mouseService.documentMouseMove$:rxjs_1.empty()})).subscribe(function(event){event.preventDefault()}),this._updateGeometrySubscription=interaction$.pipe(operators_1.withLatestFrom(mouseMove$),operators_1.switchMap(function(_a){var interaction=_a[0],mouseMove=_a[1];if(interaction.operation===Component_1.TagOperation.None||!interaction.tag)return rxjs_1.empty();var mouseDrag$=rxjs_1.of(mouseMove).pipe(operators_1.concat(_this._container.mouseService.filtered$(_this._name,_this._container.mouseService.domMouseDrag$).pipe(operators_1.filter(function(event){return _this._viewportCoords.insideElement(event,_this._container.element)}))));return rxjs_1.combineLatest(mouseDrag$,_this._container.renderService.renderCamera$).pipe(operators_1.withLatestFrom(rxjs_1.of(interaction),_this._navigator.stateService.currentTransform$,function(_a,i,transform){return[_a[0],_a[1],i,transform]}))})).subscribe(function(_a){var mouseEvent=_a[0],renderCamera=_a[1],interaction=_a[2],transform=_a[3],basic=_this._mouseEventToBasic(mouseEvent,_this._container.element,renderCamera,transform,interaction.offsetX,interaction.offsetY),geometry=interaction.tag.geometry;interaction.operation===Component_1.TagOperation.Centroid?geometry.setCentroid2d(basic,transform):interaction.operation===Component_1.TagOperation.Vertex&&geometry.setVertex2d(interaction.vertexIndex,basic,transform)})},EditVertexHandler.prototype._disable=function(){this._claimMouseSubscription.unsubscribe(),this._cursorSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._unclaimMouseSubscription.unsubscribe(),this._updateGeometrySubscription.unsubscribe()},EditVertexHandler.prototype._getNameExtension=function(){return"edit-vertex"},EditVertexHandler}(Component_1.TagHandlerBase);exports.EditVertexHandler=EditVertexHandler,exports.default=EditVertexHandler},{"../../../Component":343,rxjs:89,"rxjs/operators":285}],431:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var TagHandlerBase=function(_super){function TagHandlerBase(component,container,navigator,viewportCoords){var _this=_super.call(this,component,container,navigator)||this;return _this._name=_this._component.name+"-"+_this._getNameExtension(),_this._viewportCoords=viewportCoords,_this}return __extends(TagHandlerBase,_super),TagHandlerBase.prototype._getConfiguration=function(enable){return{}},TagHandlerBase.prototype._mouseEventToBasic=function(event,element,camera,transform,offsetX,offsetY){offsetX=null!=offsetX?offsetX:0,offsetY=null!=offsetY?offsetY:0;var _a=this._viewportCoords.canvasPosition(event,element),canvasX=_a[0],canvasY=_a[1];return this._viewportCoords.canvasToBasic(canvasX-offsetX,canvasY-offsetY,element,transform,camera.perspective)},TagHandlerBase}(require("../../../Component").HandlerBase);exports.TagHandlerBase=TagHandlerBase,exports.default=TagHandlerBase},{"../../../Component":343}],432:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),vd=require("virtual-dom"),rxjs_1=require("rxjs"),Component_1=require("../../../Component"),Geo_1=require("../../../Geo"),operators_1=require("rxjs/operators"),OutlineCreateTag=function(){function OutlineCreateTag(geometry,options,transform,viewportCoords){var _this=this;this._geometry=geometry,this._options={color:null==options.color?16777215:options.color},this._transform=transform,this._viewportCoords=viewportCoords||new Geo_1.ViewportCoords,this._outline=this._createOutine(),this._glObjects=[this._outline],this._aborted$=new rxjs_1.Subject,this._created$=new rxjs_1.Subject,this._glObjectsChanged$=new rxjs_1.Subject,this._geometryChangedSubscription=this._geometry.changed$.subscribe(function(vertexGeometry){_this._disposeOutline(),_this._outline=_this._createOutine(),_this._glObjects=[_this._outline],_this._glObjectsChanged$.next(_this)})}return Object.defineProperty(OutlineCreateTag.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineCreateTag.prototype,"glObjects",{get:function(){return this._glObjects},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineCreateTag.prototype,"aborted$",{get:function(){return this._aborted$},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineCreateTag.prototype,"created$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineCreateTag.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineCreateTag.prototype,"geometryChanged$",{get:function(){var _this=this;return this._geometry.changed$.pipe(operators_1.map(function(geometry){return _this}))},enumerable:!0,configurable:!0}),OutlineCreateTag.prototype.dispose=function(){this._disposeOutline(),this._geometryChangedSubscription.unsubscribe()},OutlineCreateTag.prototype.getDOMObjects=function(camera,size){var _this=this,vNodes=[],container={offsetHeight:size.height,offsetWidth:size.width},abort=function(e){e.stopPropagation(),_this._aborted$.next(_this)};if(this._geometry instanceof Component_1.RectGeometry){var anchorIndex=this._geometry.anchorIndex,vertexIndex=void 0===anchorIndex?1:anchorIndex,_a=this._geometry.getVertex2d(vertexIndex),basicX=_a[0],basicY=_a[1],canvasPoint=this._viewportCoords.basicToCanvasSafe(basicX,basicY,container,this._transform,camera);if(null!=canvasPoint){var pointProperties={style:{background:this._colorToBackground(this._options.color),transform:transform=this._canvasToTransform(canvasPoint)}},completerProperties={onclick:abort,style:{transform:transform}};vNodes.push(vd.h("div.TagInteractor",completerProperties,[])),vNodes.push(vd.h("div.TagVertex",pointProperties,[]))}}else if(this._geometry instanceof Component_1.PolygonGeometry){var polygonGeometry_1=this._geometry,_b=polygonGeometry_1.getVertex2d(0),firstVertexBasicX=_b[0],firstVertexBasicY=_b[1],firstVertexCanvas=this._viewportCoords.basicToCanvasSafe(firstVertexBasicX,firstVertexBasicY,container,this._transform,camera);if(null!=firstVertexCanvas){completerProperties={onclick:4<polygonGeometry_1.polygon.length?function(e){e.stopPropagation(),polygonGeometry_1.removeVertex2d(polygonGeometry_1.polygon.length-2),_this._created$.next(_this)}:abort,style:{transform:transform=this._canvasToTransform(firstVertexCanvas)}};var firstClass=4<polygonGeometry_1.polygon.length?"TagCompleter":"TagInteractor";vNodes.push(vd.h("div."+firstClass,completerProperties,[]))}if(3<polygonGeometry_1.polygon.length){var _c=polygonGeometry_1.getVertex2d(polygonGeometry_1.polygon.length-3),lastVertexBasicX=_c[0],lastVertexBasicY=_c[1],lastVertexCanvas=this._viewportCoords.basicToCanvasSafe(lastVertexBasicX,lastVertexBasicY,container,this._transform,camera);if(null!=lastVertexCanvas){completerProperties={onclick:function(e){e.stopPropagation(),polygonGeometry_1.removeVertex2d(polygonGeometry_1.polygon.length-3)},style:{transform:transform=this._canvasToTransform(lastVertexCanvas)}};vNodes.push(vd.h("div.TagInteractor",completerProperties,[]))}}var verticesBasic=polygonGeometry_1.polygon.slice();verticesBasic.splice(-2,2);for(var _i=0,verticesBasic_1=verticesBasic;_i<verticesBasic_1.length;_i++){var vertexBasic=verticesBasic_1[_i],vertexCanvas=this._viewportCoords.basicToCanvasSafe(vertexBasic[0],vertexBasic[1],container,this._transform,camera);if(null!=vertexCanvas){var transform;pointProperties={style:{background:this._colorToBackground(this._options.color),transform:transform=this._canvasToTransform(vertexCanvas)}};vNodes.push(vd.h("div.TagVertex",pointProperties,[]))}}}return vNodes},OutlineCreateTag.prototype.addPoint=function(point){if(this._geometry instanceof Component_1.RectGeometry){if(!this._geometry.validate(point))return;this._created$.next(this)}else if(this._geometry instanceof Component_1.PolygonGeometry){this._geometry.addVertex2d(point)}},OutlineCreateTag.prototype._canvasToTransform=function(canvas){return"translate(-50%,-50%) translate("+Math.round(canvas[0])+"px,"+Math.round(canvas[1])+"px)"},OutlineCreateTag.prototype._colorToBackground=function(color){return"#"+("000000"+color.toString(16)).substr(-6)},OutlineCreateTag.prototype._createOutine=function(){var polygon3d=this._geometry.getPoints3d(this._transform),positions=this._getLinePositions(polygon3d),geometry=new THREE.BufferGeometry;geometry.addAttribute("position",new THREE.BufferAttribute(positions,3));var material=new THREE.LineBasicMaterial({color:this._options.color,linewidth:1});return new THREE.Line(geometry,material)},OutlineCreateTag.prototype._disposeOutline=function(){if(null!=this._outline){var line=this._outline;line.geometry.dispose(),line.material.dispose(),this._outline=null,this._glObjects=[]}},OutlineCreateTag.prototype._getLinePositions=function(polygon3d){for(var length=polygon3d.length,positions=new Float32Array(3*length),i=0;i<length;++i){var index=3*i,position=polygon3d[i];positions[index]=position[0],positions[1+index]=position[1],positions[2+index]=position[2]}return positions},OutlineCreateTag}();exports.OutlineCreateTag=OutlineCreateTag,exports.default=OutlineCreateTag},{"../../../Component":343,"../../../Geo":346,rxjs:89,"rxjs/operators":285,three:288,"virtual-dom":296}],433:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),vd=require("virtual-dom"),Component_1=require("../../../Component"),OutlineRenderTag=function(_super){function OutlineRenderTag(tag,transform){var _this=_super.call(this,tag,transform)||this;return _this._fill=transform.gpano?null:_this._createFill(),_this._holes=1<=_this._tag.lineWidth?_this._createHoles():[],_this._outline=1<=_this._tag.lineWidth?_this._createOutline():null,_this._geometryChangedSubscription=_this._tag.geometry.changed$.subscribe(function(geometry){null!=_this._fill&&_this._updateFillGeometry(),0<_this._holes.length&&_this._updateHoleGeometries(),null!=_this._outline&&_this._updateOulineGeometry()}),_this._changedSubscription=_this._tag.changed$.subscribe(function(changedTag){var glObjectsChanged=!1;null!=_this._fill&&_this._updateFillMaterial(_this._fill.material),null==_this._outline?1<=_this._tag.lineWidth&&(_this._holes=_this._createHoles(),_this._outline=_this._createOutline(),glObjectsChanged=!0):(_this._updateHoleMaterials(),_this._updateOutlineMaterial()),glObjectsChanged&&_this._glObjectsChanged$.next(_this)}),_this}return __extends(OutlineRenderTag,_super),OutlineRenderTag.prototype.dispose=function(){this._disposeFill(),this._disposeHoles(),this._disposeOutline(),this._changedSubscription.unsubscribe(),this._geometryChangedSubscription.unsubscribe()},OutlineRenderTag.prototype.getDOMObjects=function(atlas,camera,size){var _this=this,vNodes=[],isRect=this._tag.geometry instanceof Component_1.RectGeometry,isPerspective=!this._transform.gpano,container={offsetHeight:size.height,offsetWidth:size.width};if(null!=this._tag.icon&&(isRect||isPerspective)){var _a=this._tag.geometry instanceof Component_1.RectGeometry?this._tag.geometry.getVertex2d(this._tag.iconIndex):this._tag.geometry.getPoleOfAccessibility2d(),iconBasicX=_a[0],iconBasicY=_a[1],iconCanvas=this._viewportCoords.basicToCanvasSafe(iconBasicX,iconBasicY,container,this._transform,camera);if(null!=iconCanvas){var interact=function(e){_this._interact$.next({offsetX:0,offsetY:0,operation:Component_1.TagOperation.None,tag:_this._tag})};if(atlas.loaded){var sprite=atlas.getDOMSprite(this._tag.icon,this._tag.iconFloat),properties={onclick:function(e){e.stopPropagation(),_this._tag.click$.next(_this._tag)},onmousedown:interact,style:{transform:transform="translate("+Math.round(iconCanvas[0])+"px,"+Math.round(iconCanvas[1])+"px)"}};vNodes.push(vd.h("div.TagSymbol",properties,[sprite]))}}}else if(null!=this._tag.text&&(isRect||isPerspective)){var _b=this._tag.geometry instanceof Component_1.RectGeometry?this._tag.geometry.getVertex2d(3):this._tag.geometry.getPoleOfAccessibility2d(),textBasicX=_b[0],textBasicY=_b[1],textCanvas=this._viewportCoords.basicToCanvasSafe(textBasicX,textBasicY,container,this._transform,camera);if(null!=textCanvas){var textCanvasX=Math.round(textCanvas[0]),textCanvasY=Math.round(textCanvas[1]),transform=this._tag.geometry instanceof Component_1.RectGeometry?"translate("+textCanvasX+"px,"+textCanvasY+"px)":"translate(-50%, -50%) translate("+textCanvasX+"px,"+textCanvasY+"px)";properties={onmousedown:interact=function(e){_this._interact$.next({offsetX:0,offsetY:0,operation:Component_1.TagOperation.None,tag:_this._tag})},style:{color:this._colorToCss(this._tag.textColor),transform:transform},textContent:this._tag.text};vNodes.push(vd.h("span.TagSymbol",properties,[]))}}if(!this._tag.editable)return vNodes;var lineColor=this._colorToCss(this._tag.lineColor);if(this._tag.geometry instanceof Component_1.RectGeometry){var _c=this._tag.geometry.getCentroid2d(),centroidBasicX=_c[0],centroidBasicY=_c[1],centroidCanvas=this._viewportCoords.basicToCanvasSafe(centroidBasicX,centroidBasicY,container,this._transform,camera);if(null!=centroidCanvas){properties={onmousedown:interact=this._interact(Component_1.TagOperation.Centroid,"move"),style:{background:lineColor,transform:transform="translate(-50%, -50%) translate("+Math.round(centroidCanvas[0])+"px,"+Math.round(centroidCanvas[1])+"px)"}};vNodes.push(vd.h("div.TagMover",properties,[]))}}for(var vertices2d=this._tag.geometry.getVertices2d(),i=0;i<vertices2d.length-1;i++)if(!isRect||!(null!=this._tag.icon&&i===this._tag.iconIndex||null==this._tag.icon&&null!=this._tag.text&&3===i)){var _d=vertices2d[i],vertexBasicX=_d[0],vertexBasicY=_d[1],vertexCanvas=this._viewportCoords.basicToCanvasSafe(vertexBasicX,vertexBasicY,container,this._transform,camera);if(null!=vertexCanvas){var cursor=isRect?i%2==0?"nesw-resize":"nwse-resize":"crosshair";properties={onmousedown:interact=this._interact(Component_1.TagOperation.Vertex,cursor,i),style:{background:lineColor,transform:transform="translate(-50%, -50%) translate("+Math.round(vertexCanvas[0])+"px,"+Math.round(vertexCanvas[1])+"px)",cursor:cursor}};if(vNodes.push(vd.h("div.TagResizer",properties,[])),this._tag.indicateVertices){var pointProperties={style:{background:lineColor,transform:transform}};vNodes.push(vd.h("div.TagVertex",pointProperties,[]))}}}return vNodes},OutlineRenderTag.prototype.getGLObjects=function(){var glObjects=[];null!=this._fill&&glObjects.push(this._fill);for(var _i=0,_a=this._holes;_i<_a.length;_i++){var hole=_a[_i];glObjects.push(hole)}return null!=this._outline&&glObjects.push(this._outline),glObjects},OutlineRenderTag.prototype.getRetrievableObjects=function(){return null!=this._fill?[this._fill]:[]},OutlineRenderTag.prototype._colorToCss=function(color){return"#"+("000000"+color.toString(16)).substr(-6)},OutlineRenderTag.prototype._createFill=function(){var triangles=this._tag.geometry.getTriangles3d(this._transform),positions=new Float32Array(triangles),geometry=new THREE.BufferGeometry;geometry.addAttribute("position",new THREE.BufferAttribute(positions,3)),geometry.computeBoundingSphere();var material=new THREE.MeshBasicMaterial({side:THREE.DoubleSide,transparent:!0});return this._updateFillMaterial(material),new THREE.Mesh(geometry,material)},OutlineRenderTag.prototype._createHoles=function(){var holes=[];if(this._tag.geometry instanceof Component_1.PolygonGeometry)for(var _i=0,holes3d_1=this._tag.geometry.getHoleVertices3d(this._transform);_i<holes3d_1.length;_i++){var holePoints3d=holes3d_1[_i],hole=this._createLine(holePoints3d);holes.push(hole)}return holes},OutlineRenderTag.prototype._createLine=function(points3d){var positions=this._getLinePositions(points3d),geometry=new THREE.BufferGeometry;geometry.addAttribute("position",new THREE.BufferAttribute(positions,3)),geometry.computeBoundingSphere();var material=new THREE.LineBasicMaterial;this._updateLineBasicMaterial(material);var line=new THREE.Line(geometry,material);return line.renderOrder=1,line},OutlineRenderTag.prototype._createOutline=function(){var points3d=this._tag.geometry.getPoints3d(this._transform);return this._createLine(points3d)},OutlineRenderTag.prototype._disposeFill=function(){null!=this._fill&&(this._fill.geometry.dispose(),this._fill.material.dispose(),this._fill=null)},OutlineRenderTag.prototype._disposeHoles=function(){for(var _i=0,_a=this._holes;_i<_a.length;_i++){var hole=_a[_i];hole.geometry.dispose(),hole.material.dispose()}this._holes=[]},OutlineRenderTag.prototype._disposeOutline=function(){null!=this._outline&&(this._outline.geometry.dispose(),this._outline.material.dispose(),this._outline=null)},OutlineRenderTag.prototype._getLinePositions=function(points3d){for(var length=points3d.length,positions=new Float32Array(3*length),i=0;i<length;++i){var index=3*i,position=points3d[i];positions[0+index]=position[0],positions[1+index]=position[1],positions[2+index]=position[2]}return positions},OutlineRenderTag.prototype._interact=function(operation,cursor,vertexIndex){var _this=this;return function(e){var offsetX=e.offsetX-e.target.offsetWidth/2,offsetY=e.offsetY-e.target.offsetHeight/2;_this._interact$.next({cursor:cursor,offsetX:offsetX,offsetY:offsetY,operation:operation,tag:_this._tag,vertexIndex:vertexIndex})}},OutlineRenderTag.prototype._updateFillGeometry=function(){var triangles=this._tag.geometry.getTriangles3d(this._transform),positions=new Float32Array(triangles),geometry=this._fill.geometry,attribute=geometry.getAttribute("position");attribute.array.length===positions.length?(attribute.set(positions),attribute.needsUpdate=!0):(geometry.removeAttribute("position"),geometry.addAttribute("position",new THREE.BufferAttribute(positions,3))),geometry.computeBoundingSphere()},OutlineRenderTag.prototype._updateFillMaterial=function(material){material.color=new THREE.Color(this._tag.fillColor),material.opacity=this._tag.fillOpacity,material.needsUpdate=!0},OutlineRenderTag.prototype._updateHoleGeometries=function(){var holes3d=this._tag.geometry.getHoleVertices3d(this._transform);if(holes3d.length!==this._holes.length)throw new Error("Changing the number of holes is not supported.");for(var i=0;i<this._holes.length;i++){var holePoints3d=holes3d[i],hole=this._holes[i];this._updateLine(hole,holePoints3d)}},OutlineRenderTag.prototype._updateHoleMaterials=function(){for(var _i=0,_a=this._holes;_i<_a.length;_i++){var material=_a[_i].material;this._updateLineBasicMaterial(material)}},OutlineRenderTag.prototype._updateLine=function(line,points3d){var positions=this._getLinePositions(points3d),geometry=line.geometry,attribute=geometry.getAttribute("position");attribute.set(positions),attribute.needsUpdate=!0,geometry.computeBoundingSphere()},OutlineRenderTag.prototype._updateOulineGeometry=function(){var points3d=this._tag.geometry.getPoints3d(this._transform);this._updateLine(this._outline,points3d)},OutlineRenderTag.prototype._updateOutlineMaterial=function(){var material=this._outline.material;this._updateLineBasicMaterial(material)},OutlineRenderTag.prototype._updateLineBasicMaterial=function(material){material.color=new THREE.Color(this._tag.lineColor),material.linewidth=Math.max(this._tag.lineWidth,1),material.visible=1<=this._tag.lineWidth&&0<this._tag.lineOpacity,material.opacity=this._tag.lineOpacity,material.transparent=this._tag.lineOpacity<1,material.needsUpdate=!0},OutlineRenderTag}(Component_1.RenderTag);exports.OutlineRenderTag=OutlineRenderTag},{"../../../Component":343,three:288,"virtual-dom":296}],434:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Component_1=require("../../../Component"),Viewer_1=require("../../../Viewer"),OutlineTag=function(_super){function OutlineTag(id,geometry,options){var _this=_super.call(this,id,geometry)||this;return options=options||{},_this._editable=null!=options.editable&&options.editable,_this._fillColor=null==options.fillColor?16777215:options.fillColor,_this._fillOpacity=null==options.fillOpacity?0:options.fillOpacity,_this._icon=void 0===options.icon?null:options.icon,_this._iconFloat=null==options.iconFloat?Viewer_1.Alignment.Center:options.iconFloat,_this._iconIndex=null==options.iconIndex?3:options.iconIndex,_this._indicateVertices=null==options.indicateVertices||options.indicateVertices,_this._lineColor=null==options.lineColor?16777215:options.lineColor,_this._lineOpacity=null==options.lineOpacity?1:options.lineOpacity,_this._lineWidth=null==options.lineWidth?1:options.lineWidth,_this._text=void 0===options.text?null:options.text,_this._textColor=null==options.textColor?16777215:options.textColor,_this._click$=new rxjs_1.Subject,_this._click$.subscribe(function(t){_this.fire(OutlineTag.click,_this)}),_this}return __extends(OutlineTag,_super),Object.defineProperty(OutlineTag.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"editable",{get:function(){return this._editable},set:function(value){this._editable=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"fillColor",{get:function(){return this._fillColor},set:function(value){this._fillColor=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(value){this._fillOpacity=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"icon",{get:function(){return this._icon},set:function(value){this._icon=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"iconFloat",{get:function(){return this._iconFloat},set:function(value){this._iconFloat=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"iconIndex",{get:function(){return this._iconIndex},set:function(value){this._iconIndex=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(value){this._indicateVertices=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"lineColor",{get:function(){return this._lineColor},set:function(value){this._lineColor=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(value){this._lineOpacity=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(value){this._lineWidth=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"text",{get:function(){return this._text},set:function(value){this._text=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(OutlineTag.prototype,"textColor",{get:function(){return this._textColor},set:function(value){this._textColor=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),OutlineTag.prototype.setOptions=function(options){this._editable=null==options.editable?this._editable:options.editable,this._icon=void 0===options.icon?this._icon:options.icon,this._iconFloat=null==options.iconFloat?this._iconFloat:options.iconFloat,this._iconIndex=null==options.iconIndex?this._iconIndex:options.iconIndex,this._indicateVertices=null==options.indicateVertices?this._indicateVertices:options.indicateVertices,this._lineColor=null==options.lineColor?this._lineColor:options.lineColor,this._lineWidth=null==options.lineWidth?this._lineWidth:options.lineWidth,this._fillColor=null==options.fillColor?this._fillColor:options.fillColor,this._fillOpacity=null==options.fillOpacity?this._fillOpacity:options.fillOpacity,this._text=void 0===options.text?this._text:options.text,this._textColor=null==options.textColor?this._textColor:options.textColor,this._notifyChanged$.next(this)},OutlineTag.click="click",OutlineTag}(Component_1.Tag);exports.OutlineTag=OutlineTag,exports.default=OutlineTag},{"../../../Component":343,"../../../Viewer":354,rxjs:89}],435:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Geo_1=require("../../../Geo"),RenderTag=function(){function RenderTag(tag,transform,viewportCoords){this._tag=tag,this._transform=transform,this._viewportCoords=viewportCoords||new Geo_1.ViewportCoords,this._glObjectsChanged$=new rxjs_1.Subject,this._interact$=new rxjs_1.Subject}return Object.defineProperty(RenderTag.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(RenderTag.prototype,"interact$",{get:function(){return this._interact$},enumerable:!0,configurable:!0}),Object.defineProperty(RenderTag.prototype,"tag",{get:function(){return this._tag},enumerable:!0,configurable:!0}),RenderTag}();exports.RenderTag=RenderTag,exports.default=RenderTag},{"../../../Geo":346,rxjs:89}],436:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var vd=require("virtual-dom"),Component_1=require("../../../Component"),Viewer_1=require("../../../Viewer"),SpotRenderTag=function(_super){function SpotRenderTag(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(SpotRenderTag,_super),SpotRenderTag.prototype.dispose=function(){},SpotRenderTag.prototype.getDOMObjects=function(atlas,camera,size){var _this=this,tag=this._tag,container={offsetHeight:size.height,offsetWidth:size.width},vNodes=[],_a=tag.geometry.getCentroid2d(),centroidBasicX=_a[0],centroidBasicY=_a[1],centroidCanvas=this._viewportCoords.basicToCanvasSafe(centroidBasicX,centroidBasicY,container,this._transform,camera);if(null!=centroidCanvas){var interactNone=function(e){_this._interact$.next({offsetX:0,offsetY:0,operation:Component_1.TagOperation.None,tag:tag})},canvasX=Math.round(centroidCanvas[0]),canvasY=Math.round(centroidCanvas[1]);if(null!=tag.icon){if(atlas.loaded){var sprite=atlas.getDOMSprite(tag.icon,Viewer_1.Alignment.Bottom),properties={onmousedown:interactNone,style:{pointerEvents:"all",transform:"translate("+canvasX+"px,"+(canvasY+8)+"px)"}};vNodes.push(vd.h("div",properties,[sprite]))}}else if(null!=tag.text){var transform_2="translate(-50%,0%) translate("+canvasX+"px,"+(canvasY+8)+"px)";properties={onmousedown:interactNone,style:{color:this._colorToCss(tag.textColor),transform:transform_2},textContent:tag.text};vNodes.push(vd.h("span.TagSymbol",properties,[]))}var interact=this._interact(Component_1.TagOperation.Centroid,tag,"move"),background=this._colorToCss(tag.color),transform="translate(-50%,-50%) translate("+canvasX+"px,"+canvasY+"px)";if(tag.editable){var interactorProperties={onmousedown:interact,style:{background:background,transform:transform}};vNodes.push(vd.h("div.TagSpotInteractor",interactorProperties,[]))}var pointProperties={style:{background:background,transform:transform}};vNodes.push(vd.h("div.TagVertex",pointProperties,[]))}return vNodes},SpotRenderTag.prototype.getGLObjects=function(){return[]},SpotRenderTag.prototype.getRetrievableObjects=function(){return[]},SpotRenderTag.prototype._colorToCss=function(color){return"#"+("000000"+color.toString(16)).substr(-6)},SpotRenderTag.prototype._interact=function(operation,tag,cursor,vertexIndex){var _this=this;return function(e){var offsetX=e.offsetX-e.target.offsetWidth/2,offsetY=e.offsetY-e.target.offsetHeight/2;_this._interact$.next({cursor:cursor,offsetX:offsetX,offsetY:offsetY,operation:operation,tag:tag,vertexIndex:vertexIndex})}},SpotRenderTag}(Component_1.RenderTag);exports.SpotRenderTag=SpotRenderTag},{"../../../Component":343,"../../../Viewer":354,"virtual-dom":296}],437:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var SpotTag=function(_super){function SpotTag(id,geometry,options){var _this=_super.call(this,id,geometry)||this;return options=options||{},_this._color=null==options.color?16777215:options.color,_this._editable=null!=options.editable&&options.editable,_this._icon=void 0===options.icon?null:options.icon,_this._text=void 0===options.text?null:options.text,_this._textColor=null==options.textColor?16777215:options.textColor,_this}return __extends(SpotTag,_super),Object.defineProperty(SpotTag.prototype,"color",{get:function(){return this._color},set:function(value){this._color=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(SpotTag.prototype,"editable",{get:function(){return this._editable},set:function(value){this._editable=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(SpotTag.prototype,"icon",{get:function(){return this._icon},set:function(value){this._icon=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(SpotTag.prototype,"text",{get:function(){return this._text},set:function(value){this._text=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(SpotTag.prototype,"textColor",{get:function(){return this._textColor},set:function(value){this._textColor=value,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),SpotTag.prototype.setOptions=function(options){this._color=null==options.color?this._color:options.color,this._editable=null==options.editable?this._editable:options.editable,this._icon=void 0===options.icon?this._icon:options.icon,this._text=void 0===options.text?this._text:options.text,this._textColor=null==options.textColor?this._textColor:options.textColor,this._notifyChanged$.next(this)},SpotTag}(require("../../../Component").Tag);exports.SpotTag=SpotTag,exports.default=SpotTag},{"../../../Component":343}],438:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Utils_1=require("../../../Utils"),operators_1=require("rxjs/operators"),Tag=function(_super){function Tag(id,geometry){var _this=_super.call(this)||this;return _this._id=id,_this._geometry=geometry,_this._notifyChanged$=new rxjs_1.Subject,_this._notifyChanged$.subscribe(function(t){_this.fire(Tag.changed,_this)}),_this._geometry.changed$.subscribe(function(g){_this.fire(Tag.geometrychanged,_this)}),_this}return __extends(Tag,_super),Object.defineProperty(Tag.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(Tag.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(Tag.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(Tag.prototype,"geometryChanged$",{get:function(){var _this=this;return this._geometry.changed$.pipe(operators_1.map(function(geometry){return _this}),operators_1.share())},enumerable:!0,configurable:!0}),Tag.changed="changed",Tag.geometrychanged="geometrychanged",Tag}(Utils_1.EventEmitter);exports.Tag=Tag,exports.default=Tag},{"../../../Utils":353,rxjs:89,"rxjs/operators":285}],439:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var HandlerBase=function(){function HandlerBase(component,container,navigator){this._component=component,this._container=container,this._navigator=navigator,this._enabled=!1}return Object.defineProperty(HandlerBase.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),HandlerBase.prototype.enable=function(){!this._enabled&&this._component.activated&&(this._enable(),this._enabled=!0,this._component.configure(this._getConfiguration(!0)))},HandlerBase.prototype.disable=function(){this._enabled&&(this._disable(),this._enabled=!1,this._component.activated&&this._component.configure(this._getConfiguration(!1)))},HandlerBase}();exports.HandlerBase=HandlerBase,exports.default=HandlerBase},{}],440:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var ArgumentBeeviewError=function(_super){function ArgumentBeeviewError(message){var _this=_super.call(this,null!=message?message:"The argument is not valid.")||this;return _this.name="ArgumentBeeviewError",_this}return __extends(ArgumentBeeviewError,_super),ArgumentBeeviewError}(require("./BeeviewError").BeeviewError);exports.ArgumentBeeviewError=ArgumentBeeviewError,exports.default=ArgumentBeeviewError},{"./BeeviewError":441}],441:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var BeeviewError=function(_super){function BeeviewError(message){var _this=_super.call(this,message)||this;return _this.name="BeeviewError",_this}return __extends(BeeviewError,_super),BeeviewError}(Error);exports.BeeviewError=BeeviewError,exports.default=BeeviewError},{}],442:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var GraphBeeviewError=function(_super){function GraphBeeviewError(message){var _this=_super.call(this,message)||this;return _this.name="GraphBeeviewError",_this}return __extends(GraphBeeviewError,_super),GraphBeeviewError}(require("./BeeviewError").BeeviewError);exports.GraphBeeviewError=GraphBeeviewError,exports.default=GraphBeeviewError},{"./BeeviewError":441}],443:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),Camera=function(){function Camera(transform){null!=transform?(this._position=(new THREE.Vector3).fromArray(transform.unprojectSfM([0,0],0)),this._lookat=(new THREE.Vector3).fromArray(transform.unprojectSfM([0,0],10)),this._up=transform.upVector(),this._focal=this._getFocal(transform)):(this._position=new THREE.Vector3(0,0,0),this._lookat=new THREE.Vector3(0,0,1),this._up=new THREE.Vector3(0,-1,0),this._focal=1)}return Object.defineProperty(Camera.prototype,"position",{get:function(){return this._position},enumerable:!0,configurable:!0}),Object.defineProperty(Camera.prototype,"lookat",{get:function(){return this._lookat},enumerable:!0,configurable:!0}),Object.defineProperty(Camera.prototype,"up",{get:function(){return this._up},enumerable:!0,configurable:!0}),Object.defineProperty(Camera.prototype,"focal",{get:function(){return this._focal},set:function(value){this._focal=value},enumerable:!0,configurable:!0}),Camera.prototype.lerpCameras=function(a,b,alpha){this._position.subVectors(b.position,a.position).multiplyScalar(alpha).add(a.position),this._lookat.subVectors(b.lookat,a.lookat).multiplyScalar(alpha).add(a.lookat),this._up.subVectors(b.up,a.up).multiplyScalar(alpha).add(a.up),this._focal=(1-alpha)*a.focal+alpha*b.focal},Camera.prototype.copy=function(other){this._position.copy(other.position),this._lookat.copy(other.lookat),this._up.copy(other.up),this._focal=other.focal},Camera.prototype.clone=function(){var camera=new Camera;return camera.position.copy(this._position),camera.lookat.copy(this._lookat),camera.up.copy(this._up),camera.focal=this._focal,camera},Camera.prototype.diff=function(other){var pd=this._position.distanceToSquared(other.position),ld=this._lookat.distanceToSquared(other.lookat),ud=this._up.distanceToSquared(other.up),fd=100*Math.abs(this._focal-other.focal);return Math.max(pd,ld,ud,fd)},Camera.prototype._getFocal=function(transform){if(null==transform.gpano)return transform.focal;var vFov=Math.PI*transform.gpano.CroppedAreaImageHeightPixels/transform.gpano.FullPanoHeightPixels,focal=.5/Math.tan(vFov/2);return Math.min(1/(2*(Math.sqrt(2)-1)),Math.max(.5,focal))},Camera}();exports.Camera=Camera},{three:288}],444:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var GeoCoords=function(){function GeoCoords(){this._wgs84a=6378137,this._wgs84b=6356752.31424518}return GeoCoords.prototype.geodeticToEnu=function(lat,lon,alt,refLat,refLon,refAlt){var ecef=this.geodeticToEcef(lat,lon,alt);return this.ecefToEnu(ecef[0],ecef[1],ecef[2],refLat,refLon,refAlt)},GeoCoords.prototype.enuToGeodetic=function(x,y,z,refLat,refLon,refAlt){var ecef=this.enuToEcef(x,y,z,refLat,refLon,refAlt);return this.ecefToGeodetic(ecef[0],ecef[1],ecef[2])},GeoCoords.prototype.ecefToEnu=function(X,Y,Z,refLat,refLon,refAlt){var refEcef=this.geodeticToEcef(refLat,refLon,refAlt),V=[X-refEcef[0],Y-refEcef[1],Z-refEcef[2]];refLat=refLat*Math.PI/180,refLon=refLon*Math.PI/180;var cosLat=Math.cos(refLat),sinLat=Math.sin(refLat),cosLon=Math.cos(refLon),sinLon=Math.sin(refLon);return[-sinLon*V[0]+cosLon*V[1],-sinLat*cosLon*V[0]-sinLat*sinLon*V[1]+cosLat*V[2],cosLat*cosLon*V[0]+cosLat*sinLon*V[1]+sinLat*V[2]]},GeoCoords.prototype.enuToEcef=function(x,y,z,refLat,refLon,refAlt){var refEcef=this.geodeticToEcef(refLat,refLon,refAlt);refLat=refLat*Math.PI/180,refLon=refLon*Math.PI/180;var cosLat=Math.cos(refLat),sinLat=Math.sin(refLat),cosLon=Math.cos(refLon),sinLon=Math.sin(refLon);return[-sinLon*x-sinLat*cosLon*y+cosLat*cosLon*z+refEcef[0],cosLon*x-sinLat*sinLon*y+cosLat*sinLon*z+refEcef[1],cosLat*y+sinLat*z+refEcef[2]]},GeoCoords.prototype.geodeticToEcef=function(lat,lon,alt){var a=this._wgs84a,b=this._wgs84b;lat=lat*Math.PI/180,lon=lon*Math.PI/180;var cosLat=Math.cos(lat),sinLat=Math.sin(lat),cosLon=Math.cos(lon),sinLon=Math.sin(lon),a2=a*a,b2=b*b,L=1/Math.sqrt(a2*cosLat*cosLat+b2*sinLat*sinLat),nhcl=(a2*L+alt)*cosLat;return[nhcl*cosLon,nhcl*sinLon,(b2*L+alt)*sinLat]},GeoCoords.prototype.ecefToGeodetic=function(X,Y,Z){var a=this._wgs84a,b=this._wgs84b,a2=a*a,b2=b*b,a2mb2=a2-b2,ea=Math.sqrt(a2mb2/a2),eb=Math.sqrt(a2mb2/b2),p=Math.sqrt(X*X+Y*Y),theta=Math.atan2(Z*a,p*b),sinTheta=Math.sin(theta),cosTheta=Math.cos(theta),lon=Math.atan2(Y,X),lat=Math.atan2(Z+eb*eb*b*sinTheta*sinTheta*sinTheta,p-ea*ea*a*cosTheta*cosTheta*cosTheta),sinLat=Math.sin(lat),alt=p/Math.cos(lat)-a/Math.sqrt(1-ea*ea*sinLat*sinLat);return[180*lat/Math.PI,180*lon/Math.PI,alt]},GeoCoords}();exports.GeoCoords=GeoCoords,exports.default=GeoCoords},{}],445:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),Spatial=function(){function Spatial(){this._epsilon=1e-9}return Spatial.prototype.azimuthalToBearing=function(phi){return-phi+Math.PI/2},Spatial.prototype.degToRad=function(deg){return Math.PI*deg/180},Spatial.prototype.radToDeg=function(rad){return 180*rad/Math.PI},Spatial.prototype.rotationMatrix=function(angleAxis){var axis=new THREE.Vector3(angleAxis[0],angleAxis[1],angleAxis[2]),angle=axis.length();return 0<angle&&axis.normalize(),(new THREE.Matrix4).makeRotationAxis(axis,angle)},Spatial.prototype.rotate=function(vector,angleAxis){var v=new THREE.Vector3(vector[0],vector[1],vector[2]),rotationMatrix=this.rotationMatrix(angleAxis);return v.applyMatrix4(rotationMatrix),v},Spatial.prototype.opticalCenter=function(rotation,translation){var angleAxis=[-rotation[0],-rotation[1],-rotation[2]],vector=[-translation[0],-translation[1],-translation[2]];return this.rotate(vector,angleAxis)},Spatial.prototype.viewingDirection=function(rotation){var angleAxis=[-rotation[0],-rotation[1],-rotation[2]];return this.rotate([0,0,1],angleAxis)},Spatial.prototype.wrap=function(value,min,max){if(max<min)throw new Error("Invalid arguments: max must be larger than min.");for(var interval=max-min;max<value||value<min;)max<value?value-=interval:value<min&&(value+=interval);return value},Spatial.prototype.wrapAngle=function(angle){return this.wrap(angle,-Math.PI,Math.PI)},Spatial.prototype.clamp=function(value,min,max){return value<min?min:max<value?max:value},Spatial.prototype.angleBetweenVector2=function(x1,y1,x2,y2){var angle=Math.atan2(y2,x2)-Math.atan2(y1,x1);return this.wrapAngle(angle)},Spatial.prototype.angleDifference=function(angle1,angle2){var angle=angle2-angle1;return this.wrapAngle(angle)},Spatial.prototype.relativeRotationAngle=function(rotation1,rotation2){var R1T=this.rotationMatrix([-rotation1[0],-rotation1[1],-rotation1[2]]),R2=this.rotationMatrix(rotation2),elements=R1T.multiply(R2).elements;return Math.acos((elements[0]+elements[5]+elements[10]-1)/2)},Spatial.prototype.angleToPlane=function(vector,planeNormal){var v=(new THREE.Vector3).fromArray(vector),norm=v.length();if(norm<this._epsilon)return 0;var projection=v.dot((new THREE.Vector3).fromArray(planeNormal));return Math.asin(projection/norm)},Spatial.prototype.distanceFromLatLon=function(lat1,lon1,lat2,lon2){var dLat=this.degToRad(lat2-lat1),dLon=this.degToRad(lon2-lon1),hav=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(lat1)*Math.cos(lat2)*Math.sin(dLon/2)*Math.sin(dLon/2);return 12742e3*Math.atan2(Math.sqrt(hav),Math.sqrt(1-hav))},Spatial}();exports.Spatial=Spatial,exports.default=Spatial},{three:288}],446:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),Transform=function(){function Transform(node,image,translation){this._orientation=this._getValue(node.orientation,1);var imageWidth=null!=image?image.width:4,imageHeight=null!=image?image.height:3,keepOrientation=this._orientation<5;this._width=this._getValue(node.width,keepOrientation?imageWidth:imageHeight),this._height=this._getValue(node.height,keepOrientation?imageHeight:imageWidth),this._basicAspect=keepOrientation?this._width/this._height:this._height/this._width,this._basicWidth=keepOrientation?node.width:node.height,this._basicHeight=keepOrientation?node.height:node.width,this._focal=this._getValue(node.focal,1),this._scale=this._getValue(node.scale,0),this._gpano=null!=node.gpano?node.gpano:null,this._rt=this._getRt(node.rotation,translation)}return Object.defineProperty(Transform.prototype,"basicAspect",{get:function(){return this._basicAspect},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"basicHeight",{get:function(){return this._basicHeight},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"basicWidth",{get:function(){return this._basicWidth},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"focal",{get:function(){return this._focal},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"fullPano",{get:function(){return null!=this._gpano&&0===this._gpano.CroppedAreaLeftPixels&&0===this._gpano.CroppedAreaTopPixels&&this._gpano.CroppedAreaImageWidthPixels===this._gpano.FullPanoWidthPixels&&this._gpano.CroppedAreaImageHeightPixels===this._gpano.FullPanoHeightPixels},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"gpano",{get:function(){return this._gpano},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"orientation",{get:function(){return this._orientation},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"rt",{get:function(){return this._rt},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"srt",{get:function(){return this._srt},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"scale",{get:function(){return this._scale},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"hasValidScale",{get:function(){return.01<this._scale&&this._scale<50},enumerable:!0,configurable:!0}),Object.defineProperty(Transform.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Transform.prototype.upVector=function(){var rte=this._rt.elements;switch(this._orientation){case 1:return new THREE.Vector3(-rte[1],-rte[5],-rte[9]);case 3:return new THREE.Vector3(rte[1],rte[5],rte[9]);case 6:return new THREE.Vector3(-rte[0],-rte[4],-rte[8]);case 8:return new THREE.Vector3(rte[0],rte[4],rte[8]);default:return new THREE.Vector3(-rte[1],-rte[5],-rte[9])}},Transform.prototype.projectorMatrix=function(){var projector=this._normalizedToTextureMatrix(),f=this._focal,projection=(new THREE.Matrix4).set(f,0,0,0,0,f,0,0,0,0,0,0,0,0,1,0);return projector.multiply(projection),projector.multiply(this._rt),projector},Transform.prototype.projectBasic=function(point3d){var sfm=this.projectSfM(point3d);return this._sfmToBasic(sfm)},Transform.prototype.unprojectBasic=function(basic,distance){var sfm=this._basicToSfm(basic);return this.unprojectSfM(sfm,distance)},Transform.prototype.projectSfM=function(point3d){var v=new THREE.Vector4(point3d[0],point3d[1],point3d[2],1);return v.applyMatrix4(this._rt),this._bearingToSfm([v.x,v.y,v.z])},Transform.prototype.unprojectSfM=function(sfm,distance){var bearing=this._sfmToBearing(sfm),v=new THREE.Vector4(distance*bearing[0],distance*bearing[1],distance*bearing[2],1);return v.applyMatrix4((new THREE.Matrix4).getInverse(this._rt)),[v.x/v.w,v.y/v.w,v.z/v.w]},Transform.prototype._sfmToBearing=function(sfm){if(this._fullPano()){var lon=2*sfm[0]*Math.PI,lat=2*-sfm[1]*Math.PI;return[Math.cos(lat)*Math.sin(lon),-Math.sin(lat),Math.cos(lat)*Math.cos(lon)]}if(this._gpano){var size=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels),fullPanoPixel=[sfm[0]*size+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,sfm[1]*size+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels];lon=2*Math.PI*(fullPanoPixel[0]/this.gpano.FullPanoWidthPixels-.5),lat=-Math.PI*(fullPanoPixel[1]/this.gpano.FullPanoHeightPixels-.5);return[Math.cos(lat)*Math.sin(lon),-Math.sin(lat),Math.cos(lat)*Math.cos(lon)]}var v=new THREE.Vector3(sfm[0],sfm[1],this._focal);return v.normalize(),[v.x,v.y,v.z]},Transform.prototype._bearingToSfm=function(bearing){if(this._fullPano()){var x=bearing[0],y=bearing[1],z=bearing[2],lon=Math.atan2(x,z),lat=Math.atan2(-y,Math.sqrt(x*x+z*z));return[lon/(2*Math.PI),-lat/(2*Math.PI)]}if(this._gpano){x=bearing[0],y=bearing[1],z=bearing[2],lon=Math.atan2(x,z),lat=Math.atan2(-y,Math.sqrt(x*x+z*z));var fullPanoPixel=[(lon/(2*Math.PI)+.5)*this.gpano.FullPanoWidthPixels,(-lat/Math.PI+.5)*this.gpano.FullPanoHeightPixels],size=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels);return[(fullPanoPixel[0]-this.gpano.CroppedAreaLeftPixels-this.gpano.CroppedAreaImageWidthPixels/2)/size,(fullPanoPixel[1]-this.gpano.CroppedAreaTopPixels-this.gpano.CroppedAreaImageHeightPixels/2)/size]}return 0<bearing[2]?[bearing[0]*this._focal/bearing[2],bearing[1]*this._focal/bearing[2]]:[bearing[0]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,bearing[1]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY]},Transform.prototype._basicToSfm=function(basic){var rotatedX,rotatedY;switch(this._orientation){case 1:rotatedX=basic[0],rotatedY=basic[1];break;case 3:rotatedX=1-basic[0],rotatedY=1-basic[1];break;case 6:rotatedX=basic[1],rotatedY=1-basic[0];break;case 8:rotatedX=1-basic[1],rotatedY=basic[0];break;default:rotatedX=basic[0],rotatedY=basic[1]}var w=this._width,h=this._height,s=Math.max(w,h);return[rotatedX*w/s-w/s/2,rotatedY*h/s-h/s/2]},Transform.prototype._sfmToBasic=function(sfm){var basicX,basicY,w=this._width,h=this._height,s=Math.max(w,h),rotatedX=(sfm[0]+w/s/2)/w*s,rotatedY=(sfm[1]+h/s/2)/h*s;switch(this._orientation){case 1:basicX=rotatedX,basicY=rotatedY;break;case 3:basicX=1-rotatedX,basicY=1-rotatedY;break;case 6:basicX=1-rotatedY,basicY=rotatedX;break;case 8:basicX=rotatedY,basicY=1-rotatedX;break;default:basicX=rotatedX,basicY=rotatedY}return[basicX,basicY]},Transform.prototype._fullPano=function(){return null!=this.gpano&&0===this.gpano.CroppedAreaLeftPixels&&0===this.gpano.CroppedAreaTopPixels&&this.gpano.CroppedAreaImageWidthPixels===this.gpano.FullPanoWidthPixels&&this.gpano.CroppedAreaImageHeightPixels===this.gpano.FullPanoHeightPixels},Transform.prototype._getValue=function(value,fallback){return null!=value&&0<value?value:fallback},Transform.prototype._getRt=function(rotation,translation){var axis=new THREE.Vector3(rotation[0],rotation[1],rotation[2]),angle=axis.length();0<angle&&axis.normalize();var rt=new THREE.Matrix4;return rt.makeRotationAxis(axis,angle),rt.setPosition(new THREE.Vector3(translation[0],translation[1],translation[2])),rt},Transform.prototype._getSrt=function(rt,scale){var srt=rt.clone(),elements=srt.elements;return elements[12]=scale*elements[12],elements[13]=scale*elements[13],elements[14]=scale*elements[14],srt.scale(new THREE.Vector3(scale,scale,scale)),srt},Transform.prototype._normalizedToTextureMatrix=function(){var size=Math.max(this._width,this._height),w=size/this._width,h=size/this._height;switch(this._orientation){case 1:return(new THREE.Matrix4).set(w,0,0,.5,0,-h,0,.5,0,0,1,0,0,0,0,1);case 3:return(new THREE.Matrix4).set(-w,0,0,.5,0,h,0,.5,0,0,1,0,0,0,0,1);case 6:return(new THREE.Matrix4).set(0,-h,0,.5,-w,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new THREE.Matrix4).set(0,h,0,.5,w,0,0,.5,0,0,1,0,0,0,0,1);default:return(new THREE.Matrix4).set(w,0,0,.5,0,-h,0,.5,0,0,1,0,0,0,0,1)}},Transform}();exports.Transform=Transform},{three:288}],447:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),ViewportCoords=function(){function ViewportCoords(){this._unprojectDepth=200}return ViewportCoords.prototype.basicToCanvas=function(basicX,basicY,container,transform,camera){var point3d=transform.unprojectBasic([basicX,basicY],this._unprojectDepth);return this.projectToCanvas(point3d,container,camera)},ViewportCoords.prototype.basicToCanvasSafe=function(basicX,basicY,container,transform,camera){var point3d=transform.unprojectBasic([basicX,basicY],this._unprojectDepth),pointCamera=this.worldToCamera(point3d,camera);if(0<pointCamera[2])return null;var _a=this.cameraToViewport(pointCamera,camera),viewportX=_a[0],viewportY=_a[1];return this.viewportToCanvas(viewportX,viewportY,container)},ViewportCoords.prototype.basicToViewport=function(basicX,basicY,transform,camera){var point3d=transform.unprojectBasic([basicX,basicY],this._unprojectDepth);return this.projectToViewport(point3d,camera)},ViewportCoords.prototype.cameraToViewport=function(pointCamera,camera){var viewport=(new THREE.Vector3).fromArray(pointCamera).applyMatrix4(camera.projectionMatrix);return[viewport.x,viewport.y]},ViewportCoords.prototype.canvasPosition=function(event,element){var clientRect=element.getBoundingClientRect();return[event.clientX-clientRect.left-element.clientLeft,event.clientY-clientRect.top-element.clientTop]},ViewportCoords.prototype.canvasToBasic=function(canvasX,canvasY,container,transform,camera){var point3d=this.unprojectFromCanvas(canvasX,canvasY,container,camera).toArray();return transform.projectBasic(point3d)},ViewportCoords.prototype.canvasToViewport=function(canvasX,canvasY,container){var _a=this.containerToCanvas(container);return[2*canvasX/_a[0]-1,1-2*canvasY/_a[1]]},ViewportCoords.prototype.containerToCanvas=function(container){return[container.offsetWidth,container.offsetHeight]},ViewportCoords.prototype.getBasicDistances=function(transform,camera){var topLeftBasic=this.viewportToBasic(-1,1,transform,camera),topRightBasic=this.viewportToBasic(1,1,transform,camera),bottomRightBasic=this.viewportToBasic(1,-1,transform,camera),bottomLeftBasic=this.viewportToBasic(-1,-1,transform,camera),topBasicDistance=0,rightBasicDistance=0,bottomBasicDistance=0,leftBasicDistance=0;return topLeftBasic[1]<0&&topRightBasic[1]<0&&(topBasicDistance=topLeftBasic[1]>topRightBasic[1]?-topLeftBasic[1]:-topRightBasic[1]),1<topRightBasic[0]&&1<bottomRightBasic[0]&&(rightBasicDistance=topRightBasic[0]<bottomRightBasic[0]?topRightBasic[0]-1:bottomRightBasic[0]-1),1<bottomRightBasic[1]&&1<bottomLeftBasic[1]&&(bottomBasicDistance=bottomRightBasic[1]<bottomLeftBasic[1]?bottomRightBasic[1]-1:bottomLeftBasic[1]-1),bottomLeftBasic[0]<0&&topLeftBasic[0]<0&&(leftBasicDistance=bottomLeftBasic[0]>topLeftBasic[0]?-bottomLeftBasic[0]:-topLeftBasic[0]),[topBasicDistance,rightBasicDistance,bottomBasicDistance,leftBasicDistance]},ViewportCoords.prototype.getPixelDistances=function(container,transform,camera){var topLeftBasic=this.viewportToBasic(-1,1,transform,camera),topRightBasic=this.viewportToBasic(1,1,transform,camera),bottomRightBasic=this.viewportToBasic(1,-1,transform,camera),bottomLeftBasic=this.viewportToBasic(-1,-1,transform,camera),topPixelDistance=0,rightPixelDistance=0,bottomPixelDistance=0,leftPixelDistance=0,_a=this.containerToCanvas(container),canvasWidth=_a[0],canvasHeight=_a[1];if(topLeftBasic[1]<0&&topRightBasic[1]<0){var basicX=topLeftBasic[1]>topRightBasic[1]?topLeftBasic[0]:topRightBasic[0];topPixelDistance=0<(canvas=this.basicToCanvas(basicX,0,container,transform,camera))[1]?canvas[1]:0}if(1<topRightBasic[0]&&1<bottomRightBasic[0]){var basicY=topRightBasic[0]<bottomRightBasic[0]?topRightBasic[1]:bottomRightBasic[1];rightPixelDistance=(canvas=this.basicToCanvas(1,basicY,container,transform,camera))[0]<canvasWidth?canvasWidth-canvas[0]:0}if(1<bottomRightBasic[1]&&1<bottomLeftBasic[1]){basicX=bottomRightBasic[1]<bottomLeftBasic[1]?bottomRightBasic[0]:bottomLeftBasic[0];bottomPixelDistance=(canvas=this.basicToCanvas(basicX,1,container,transform,camera))[1]<canvasHeight?canvasHeight-canvas[1]:0}if(bottomLeftBasic[0]<0&&topLeftBasic[0]<0){var canvas;basicY=bottomLeftBasic[0]>topLeftBasic[0]?bottomLeftBasic[1]:topLeftBasic[1];leftPixelDistance=0<(canvas=this.basicToCanvas(0,basicY,container,transform,camera))[0]?canvas[0]:0}return[topPixelDistance,rightPixelDistance,bottomPixelDistance,leftPixelDistance]},ViewportCoords.prototype.insideElement=function(event,element){var clientRect=element.getBoundingClientRect(),minX=clientRect.left+element.clientLeft,maxX=minX+element.clientWidth,minY=clientRect.top+element.clientTop,maxY=minY+element.clientHeight;return event.clientX>minX&&event.clientX<maxX&&event.clientY>minY&&event.clientY<maxY},ViewportCoords.prototype.projectToCanvas=function(point3d,container,camera){var viewport=this.projectToViewport(point3d,camera);return this.viewportToCanvas(viewport[0],viewport[1],container)},ViewportCoords.prototype.projectToViewport=function(point3d,camera){var viewport=new THREE.Vector3(point3d[0],point3d[1],point3d[2]).project(camera);return[viewport.x,viewport.y]},ViewportCoords.prototype.unprojectFromCanvas=function(canvasX,canvasY,container,camera){var viewport=this.canvasToViewport(canvasX,canvasY,container);return this.unprojectFromViewport(viewport[0],viewport[1],camera)},ViewportCoords.prototype.unprojectFromViewport=function(viewportX,viewportY,camera){return new THREE.Vector3(viewportX,viewportY,1).unproject(camera)},ViewportCoords.prototype.viewportToBasic=function(viewportX,viewportY,transform,camera){var point3d=new THREE.Vector3(viewportX,viewportY,1).unproject(camera).toArray();return transform.projectBasic(point3d)},ViewportCoords.prototype.viewportToCanvas=function(viewportX,viewportY,container){var _a=this.containerToCanvas(container);return[_a[0]*(viewportX+1)/2,-_a[1]*(viewportY-1)/2]},ViewportCoords.prototype.worldToCamera=function(point3d,camera){return new THREE.Vector3(point3d[0],point3d[1],point3d[2]).applyMatrix4(camera.matrixWorldInverse).toArray()},ViewportCoords}();exports.ViewportCoords=ViewportCoords,exports.default=ViewportCoords},{three:288}],448:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var FilterCreator=function(){function FilterCreator(){}return FilterCreator.prototype.createFilter=function(filter){return new Function("node","return "+this._compile(filter)+";")},FilterCreator.prototype._compile=function(filter){if(null==filter||filter.length<=1)return"true";var operator=filter[0];return"("+("=="===operator?this._compileComparisonOp("===",filter[1],filter[2],!1):"!="===operator?this._compileComparisonOp("!==",filter[1],filter[2],!1):">"===operator||">="===operator||"<"===operator||"<="===operator?this._compileComparisonOp(operator,filter[1],filter[2],!0):"in"===operator?this._compileInOp(filter[1],filter.slice(2)):"!in"===operator?this._compileNegation(this._compileInOp(filter[1],filter.slice(2))):"all"===operator?this._compileLogicalOp(filter.slice(1),"&&"):"true")+")"},FilterCreator.prototype._compare=function(a,b){return a<b?-1:b<a?1:0},FilterCreator.prototype._compileComparisonOp=function(operator,property,value,checkType){var left=this._compilePropertyReference(property),right=JSON.stringify(value);return(checkType?"typeof "+left+"===typeof "+right+"&&":"")+left+operator+right},FilterCreator.prototype._compileInOp=function(property,values){var compare=this._compare;return JSON.stringify(values.sort(compare))+".indexOf("+this._compilePropertyReference(property)+")!==-1"},FilterCreator.prototype._compileLogicalOp=function(filters,operator){var compile=this._compile.bind(this);return filters.map(compile).join(operator)},FilterCreator.prototype._compileNegation=function(expression){return"!("+expression+")"},FilterCreator.prototype._compilePropertyReference=function(property){return"node["+JSON.stringify(property)+"]"},FilterCreator}();exports.FilterCreator=FilterCreator,exports.default=FilterCreator},{}],449:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rbush=require("rbush"),_=require("underscore"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),Edge_1=require("../Edge"),Error_1=require("../Error"),Graph_1=require("../Graph"),Graph=function(){function Graph(api,nodeIndex,graphCalculator,edgeCalculator,filterCreator,configuration){this._api=api,this._cachedPaths={},this._cachedNodes={},this._cachedNodeTiles={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._changed$=new rxjs_1.Subject,this._defaultAlt=2,this._edgeCalculator=null!=edgeCalculator?edgeCalculator:new Edge_1.EdgeCalculator,this._filterCreator=null!=filterCreator?filterCreator:new Graph_1.FilterCreator,this._filter=this._filterCreator.createFilter(void 0),this._graphCalculator=null!=graphCalculator?graphCalculator:new Graph_1.GraphCalculator,this._configuration=null!=configuration?configuration:{maxSequences:50,maxUnusedNodes:100,maxUnusedTiles:20},this._nodes={},this._nodeIndex=null!=nodeIndex?nodeIndex:rbush(16,[".lat",".lon",".lat",".lon"]),this._nodeIndexTiles={},this._nodeToTile={},this._preStored={},this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._tilePrecision=7,this._tileThreshold=20}return Object.defineProperty(Graph.prototype,"changed$",{get:function(){return this._changed$},enumerable:!0,configurable:!0}),Graph.prototype.cachePath$=function(key){var _this=this,node=this.getNode(key);return this._api.buildingByKey$(node.building.id).pipe(operators_1.map(function(value){return _this._cachedPaths[node.building.id]=_.values(value).map(function(val){return val.images}).reduce(function(pre,cur){return pre.concat(cur)},[]),_this._cachedPaths[node.building.id]}))},Graph.prototype.cacheOutdoorPath$=function(lon,lat){var _this=this,latLon={lon:lon,lat:lat};return this._api.outdoorByLatLon$(latLon,200).pipe(operators_1.map(function(outdoors){var list=[];outdoors.forEach(function(outdoor){return list=list.concat(outdoor.outdoorImages)});var outdoorImageHash=_this._graphCalculator.encodeH(latLon);return _this._cachedPaths[outdoorImageHash]=list,_this._cachedPaths[outdoorImageHash]}))},Graph.prototype.cacheFill$=function(key){var _this=this;if(key in this._cachingFull$)throw new Error_1.GraphBeeviewError("Cannot fill node while caching full ("+key+").");if(!this.hasNode(key))throw new Error_1.GraphBeeviewError("Cannot fill node that does not exist in graph ("+key+").");if(key in this._cachingFill$)return this._cachingFill$[key];var node=this.getNode(key);if(node.full)throw new Error_1.GraphBeeviewError("Cannot fill node that is already full ("+key+").");return this._cachingFill$[key]=this._api.imageByKeyFill$([key]).pipe(operators_1.tap(function(imageByKeyFill){node.full||_this._makeFull(node,imageByKeyFill[key]),delete _this._cachingFill$[key]}),operators_1.map(function(imageByKeyFill){return _this}),operators_1.finalize(function(){key in _this._cachingFill$&&delete _this._cachingFill$[key],_this._changed$.next(_this)}),operators_1.share()),this._cachingFill$[key]},Graph.prototype.cacheFull$=function(key){var _this=this;if(key in this._cachingFull$)return this._cachingFull$[key];if(this.hasNode(key))throw new Error_1.GraphBeeviewError("Cannot cache full node that already exist in graph ("+key+").");var getImageByKey$=this._api.imageByKeyFull$([key]).pipe(operators_1.catchError(function(){return _this._api.imageByKeyFullForOutdoor$([key])}));return this._cachingFull$[key]=getImageByKey$.pipe(operators_1.tap(function(imageByKeyFull){var fn=imageByKeyFull[key];if(_this.hasNode(key)){(node=_this.getNode(key)).full||_this._makeFull(node,fn)}else{if(null==fn.sequence||null==fn.sequence.key)throw new Error_1.GraphBeeviewError("Node has no sequence ("+key+").");var node=new Graph_1.Node(fn);_this._makeFull(node,fn);var h=_this._graphCalculator.encodeH(node.originalLatLon,_this._tilePrecision);_this._preStore(h,node),_this._setNode(node),delete _this._cachingFull$[key]}}),operators_1.map(function(imageByKeyFull){return _this}),operators_1.finalize(function(){key in _this._cachingFull$&&delete _this._cachingFull$[key],_this._changed$.next(_this)}),operators_1.share()),this._cachingFull$[key]},Graph.prototype.cacheNodeSequence$=function(key){if(!this.hasNode(key))throw new Error_1.GraphBeeviewError("Cannot cache sequence edges of node that does not exist in graph ("+key+").");var node=this.getNode(key);if(node.sequenceKey in this._sequences)throw new Error_1.GraphBeeviewError("Sequence already cached ("+key+"), ("+node.sequenceKey+").");return this._cacheSequence$(node.sequenceKey)},Graph.prototype.cacheSequence$=function(sequenceKey){if(sequenceKey in this._sequences)throw new Error_1.GraphBeeviewError("Sequence already cached ("+sequenceKey+")");return this._cacheSequence$(sequenceKey)},Graph.prototype.cacheSequenceEdges=function(key){var node=this.getNode(key);if(!(node.sequenceKey in this._sequences))throw new Error_1.GraphBeeviewError("Sequence is not cached ("+key+"), ("+node.sequenceKey+")");var sequence=this._sequences[node.sequenceKey].sequence,edges=this._edgeCalculator.computeSequenceEdges(node,sequence);node.cacheSequenceEdges(edges)},Graph.prototype.cacheSpatialArea$=function(key){var _this=this;if(!this.hasNode(key))throw new Error_1.GraphBeeviewError("Cannot cache spatial area of node that does not exist in graph ("+key+").");if(key in this._cachedSpatialEdges)throw new Error_1.GraphBeeviewError("Node already spatially cached ("+key+").");if(!(key in this._requiredSpatialArea))throw new Error_1.GraphBeeviewError("Spatial area not determined ("+key+").");var spatialArea=this._requiredSpatialArea[key];if(0===Object.keys(spatialArea.cacheNodes).length)throw new Error_1.GraphBeeviewError("Spatial nodes already cached ("+key+").");if(key in this._cachingSpatialArea$)return this._cachingSpatialArea$[key];for(var batches=[];0<spatialArea.cacheKeys.length;)batches.push(spatialArea.cacheKeys.splice(0,200));for(var batchesToCache=batches.length,spatialNodes$=[],_loop_1=function(batch){var spatialNodeBatch$=this_1._api.imageByKeyFill$(batch).pipe(operators_1.tap(function(imageByKeyFill){for(var fillKey in imageByKeyFill)if(imageByKeyFill.hasOwnProperty(fillKey)){var spatialNode=spatialArea.cacheNodes[fillKey];if(spatialNode.full)delete spatialArea.cacheNodes[fillKey];else{var fillNode=imageByKeyFill[fillKey];_this._makeFull(spatialNode,fillNode),delete spatialArea.cacheNodes[fillKey]}}0==--batchesToCache&&delete _this._cachingSpatialArea$[key]}),operators_1.map(function(imageByKeyFill){return _this}),operators_1.catchError(function(error){for(var _i=0,batch_1=batch;_i<batch_1.length;_i++){var batchKey=batch_1[_i];batchKey in spatialArea.all&&delete spatialArea.all[batchKey],batchKey in spatialArea.cacheNodes&&delete spatialArea.cacheNodes[batchKey]}throw 0==--batchesToCache&&delete _this._cachingSpatialArea$[key],error}),operators_1.finalize(function(){0===Object.keys(spatialArea.cacheNodes).length&&_this._changed$.next(_this)}),operators_1.share());spatialNodes$.push(spatialNodeBatch$)},this_1=this,_i=0,batches_1=batches;_i<batches_1.length;_i++){_loop_1(batches_1[_i])}return this._cachingSpatialArea$[key]=spatialNodes$},Graph.prototype.cacheSpatialEdges=function(key){if(key in this._cachedSpatialEdges)throw new Error_1.GraphBeeviewError("Spatial edges already cached ("+key+").");var node=this.getNode(key),sequence=this._sequences[node.sequenceKey].sequence,fallbackKeys=[],prevKey=sequence.findPrevKey(node.key);null!=prevKey&&fallbackKeys.push(prevKey);var nextKey=sequence.findNextKey(node.key);null!=nextKey&&fallbackKeys.push(nextKey);var allSpatialNodes=this._requiredSpatialArea[key].all,potentialNodes=[],filter=this._filter;for(var spatialNodeKey in allSpatialNodes)if(allSpatialNodes.hasOwnProperty(spatialNodeKey)){var spatialNode=allSpatialNodes[spatialNodeKey];filter(spatialNode)&&potentialNodes.push(spatialNode)}var potentialEdges=this._edgeCalculator.getPotentialEdges(node,potentialNodes,fallbackKeys),edges=this._edgeCalculator.computeStepEdges(node,potentialEdges,prevKey,nextKey);edges=(edges=(edges=(edges=edges.concat(this._edgeCalculator.computeTurnEdges(node,potentialEdges))).concat(this._edgeCalculator.computePanoEdges(node,potentialEdges))).concat(this._edgeCalculator.computePerspectiveToPanoEdges(node,potentialEdges))).concat(this._edgeCalculator.computeSimilarEdges(node,potentialEdges)),node.cacheSpatialEdges(edges),this._cachedSpatialEdges[key]=node,delete this._requiredSpatialArea[key],delete this._cachedNodeTiles[key]},Graph.prototype.cacheTiles$=function(key){var _this=this;if(key in this._cachedNodeTiles)throw new Error_1.GraphBeeviewError("Tiles already cached ("+key+").");if(key in this._cachedSpatialEdges)throw new Error_1.GraphBeeviewError("Spatial edges already cached so tiles considered cached ("+key+").");if(!(key in this._requiredNodeTiles))throw new Error_1.GraphBeeviewError("Tiles have not been determined ("+key+").");var nodeTiles=this._requiredNodeTiles[key];if(0===nodeTiles.cache.length&&0===nodeTiles.caching.length)throw new Error_1.GraphBeeviewError("Tiles already cached ("+key+").");if(!this.hasNode(key))throw new Error_1.GraphBeeviewError("Cannot cache tiles of node that does not exist in graph ("+key+").");var hs=nodeTiles.cache.slice();nodeTiles.caching=this._requiredNodeTiles[key].caching.concat(hs),nodeTiles.cache=[];for(var cacheTiles$=[],_loop_2=function(h){var cacheTile$=null;h in this_2._cachingTiles$?cacheTile$=this_2._cachingTiles$[h]:(cacheTile$=this_2._api.imagesByH$(h,this_2.getNode(key).latLon).pipe(operators_1.tap(function(imagesByH){var coreNodes=imagesByH[h];if(!(h in _this._cachedTiles)){_this._nodeIndexTiles[h]=[],_this._cachedTiles[h]={accessed:(new Date).getTime(),nodes:[]};var hCache=_this._cachedTiles[h].nodes,preStored=_this._removeFromPreStore(h);for(var index in coreNodes)if(coreNodes.hasOwnProperty(index)){var coreNode=coreNodes[index];if(null==coreNode)break;if(null!=coreNode.sequence&&null!=coreNode.sequence.key)if(null!=preStored&&coreNode.key in preStored){var node_1=preStored[coreNode.key];delete preStored[coreNode.key],hCache.push(node_1);var nodeIndexItem_1={lat:node_1.latLon.lat,lon:node_1.latLon.lon,node:node_1};_this._nodeIndex.insert(nodeIndexItem_1),_this._nodeIndexTiles[h].push(nodeIndexItem_1),_this._nodeToTile[node_1.key]=h}else{var node=new Graph_1.Node(coreNode);hCache.push(node);var nodeIndexItem={lat:node.latLon.lat,lon:node.latLon.lon,node:node};_this._nodeIndex.insert(nodeIndexItem),_this._nodeIndexTiles[h].push(nodeIndexItem),_this._nodeToTile[node.key]=h,_this._setNode(node)}else console.warn("Sequence missing, discarding ("+coreNode.key+")")}delete _this._cachingTiles$[h]}}),operators_1.map(function(imagesByH){return _this}),operators_1.catchError(function(error){throw delete _this._cachingTiles$[h],error}),operators_1.share()),this_2._cachingTiles$[h]=cacheTile$),cacheTiles$.push(cacheTile$.pipe(operators_1.tap(function(graph){var index=nodeTiles.caching.indexOf(h);-1<index&&nodeTiles.caching.splice(index,1),0===nodeTiles.caching.length&&0===nodeTiles.cache.length&&(delete _this._requiredNodeTiles[key],_this._cachedNodeTiles[key]=!0)}),operators_1.finalize(function(){_this._changed$.next(_this)}),operators_1.share()))},this_2=this,_i=0,_a=nodeTiles.caching;_i<_a.length;_i++){_loop_2(_a[_i])}return cacheTiles$},Graph.prototype.initializeCache=function(key){if(key in this._cachedNodes)throw new Error_1.GraphBeeviewError("Node already in cache ("+key+").");var node=this.getNode(key);node.initializeCache(new Graph_1.NodeCache);var accessed=(new Date).getTime();this._cachedNodes[key]={accessed:accessed,node:node},this._updateCachedTileAccess(key,accessed)},Graph.prototype.isCachingFill=function(key){return key in this._cachingFill$},Graph.prototype.isCachingFull=function(key){return key in this._cachingFull$},Graph.prototype.isCachingNodeSequence=function(key){return this.getNode(key).sequenceKey in this._cachingSequences$},Graph.prototype.isCachingSequence=function(sequenceKey){return sequenceKey in this._cachingSequences$},Graph.prototype.isCachingTiles=function(key){return key in this._requiredNodeTiles&&0===this._requiredNodeTiles[key].cache.length&&0<this._requiredNodeTiles[key].caching.length},Graph.prototype.hasInitializedCache=function(key){return key in this._cachedNodes},Graph.prototype.hasCachedPaths=function(key){return key in this._cachedPaths},Graph.prototype.getCachedPaths=function(key){return this._cachedPaths[key]},Graph.prototype.hasNode=function(key){var accessed=(new Date).getTime();return this._updateCachedNodeAccess(key,accessed),this._updateCachedTileAccess(key,accessed),key in this._nodes},Graph.prototype.hasNodeSequence=function(key){var sequenceKey=this.getNode(key).sequenceKey,hasNodeSequence=sequenceKey in this._sequences;return hasNodeSequence&&(this._sequences[sequenceKey].accessed=(new Date).getTime()),hasNodeSequence},Graph.prototype.hasSequence=function(sequenceKey){var hasSequence=sequenceKey in this._sequences;return hasSequence&&(this._sequences[sequenceKey].accessed=(new Date).getTime()),hasSequence},Graph.prototype.hasSpatialArea=function(key){if(!this.hasNode(key))throw new Error_1.GraphBeeviewError("Spatial area nodes cannot be determined if node not in graph ("+key+").");if(key in this._cachedSpatialEdges)return!0;if(key in this._requiredSpatialArea)return 0===Object.keys(this._requiredSpatialArea[key].cacheNodes).length;for(var node=this.getNode(key),bbox=this._graphCalculator.boundingBoxCorners(node.latLon,this._tileThreshold),spatialNodes={all:{},cacheKeys:[],cacheNodes:{}},_i=0,spatialItems_1=this._nodeIndex.search({maxX:bbox[1].lat,maxY:bbox[1].lon,minX:bbox[0].lat,minY:bbox[0].lon});_i<spatialItems_1.length;_i++){var spatialItem=spatialItems_1[_i];spatialNodes.all[spatialItem.node.key]=spatialItem.node,spatialItem.node.full||(spatialNodes.cacheKeys.push(spatialItem.node.key),spatialNodes.cacheNodes[spatialItem.node.key]=spatialItem.node)}return 0===(this._requiredSpatialArea[key]=spatialNodes).cacheKeys.length},Graph.prototype.hasTiles=function(key){var _this=this;if(key in this._cachedNodeTiles)return!0;if(key in this._cachedSpatialEdges)return!0;if(!this.hasNode(key))throw new Error_1.GraphBeeviewError("Node does not exist in graph ("+key+").");var nodeTiles={cache:[],caching:[]};if(key in this._requiredNodeTiles)nodeTiles=this._requiredNodeTiles[key];else{var node=this.getNode(key);nodeTiles.cache=this._graphCalculator.encodeHs(node.latLon,this._tilePrecision,this._tileThreshold).filter(function(h){return!(h in _this._cachedTiles)}),0<nodeTiles.cache.length&&(this._requiredNodeTiles[key]=nodeTiles)}return 0===nodeTiles.cache.length&&0===nodeTiles.caching.length},Graph.prototype.getNode=function(key){var accessed=(new Date).getTime();return this._updateCachedNodeAccess(key,accessed),this._updateCachedTileAccess(key,accessed),this._nodes[key]},Graph.prototype.getSequence=function(sequenceKey){var sequenceAccess=this._sequences[sequenceKey];return sequenceAccess.accessed=(new Date).getTime(),sequenceAccess.sequence},Graph.prototype.resetSpatialEdges=function(){for(var _i=0,cachedKeys_1=Object.keys(this._cachedSpatialEdges);_i<cachedKeys_1.length;_i++){var cachedKey=cachedKeys_1[_i];this._cachedSpatialEdges[cachedKey].resetSpatialEdges(),delete this._cachedSpatialEdges[cachedKey]}},Graph.prototype.reset=function(keepKeys){for(var nodes=[],_i=0,keepKeys_1=keepKeys;_i<keepKeys_1.length;_i++){var key=keepKeys_1[_i];if(!this.hasNode(key))throw new Error("Node does not exist "+key);(node=this.getNode(key)).resetSequenceEdges(),node.resetSpatialEdges(),nodes.push(node)}for(var _a=0,_b=Object.keys(this._cachedNodes);_a<_b.length;_a++){var cachedKey=_b[_a];-1===keepKeys.indexOf(cachedKey)&&(this._cachedNodes[cachedKey].node.dispose(),delete this._cachedNodes[cachedKey])}this._cachedNodeTiles={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._nodes={},this._nodeToTile={},this._preStored={};for(var _c=0,nodes_1=nodes;_c<nodes_1.length;_c++){var node=nodes_1[_c];this._nodes[node.key]=node;var h=this._graphCalculator.encodeH(node.originalLatLon,this._tilePrecision);this._preStore(h,node)}this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._nodeIndexTiles={},this._nodeIndex.clear()},Graph.prototype.setFilter=function(filter){this._filter=this._filterCreator.createFilter(filter)},Graph.prototype.uncache=function(keepKeys){var keysInUse={};this._addNewKeys(keysInUse,this._cachingFull$),this._addNewKeys(keysInUse,this._cachingFill$),this._addNewKeys(keysInUse,this._cachingTiles$),this._addNewKeys(keysInUse,this._cachingSpatialArea$),this._addNewKeys(keysInUse,this._requiredNodeTiles),this._addNewKeys(keysInUse,this._requiredSpatialArea);for(var _i=0,keepKeys_2=keepKeys;_i<keepKeys_2.length;_i++){(key=keepKeys_2[_i])in keysInUse||(keysInUse[key]=!0)}var keepHs={};for(var key in keysInUse)if(keysInUse.hasOwnProperty(key))for(var node=this._nodes[key],_a=0,nodeHs_1=this._graphCalculator.encodeHs(node.latLon);_a<nodeHs_1.length;_a++){var nodeH=nodeHs_1[_a];nodeH in keepHs||(keepHs[nodeH]=!0)}var potentialHs=[];for(var h in this._cachedTiles)!this._cachedTiles.hasOwnProperty(h)||h in keepHs||potentialHs.push([h,this._cachedTiles[h]]);for(var _b=0,uncacheHs_1=potentialHs.sort(function(h1,h2){return h2[1].accessed-h1[1].accessed}).slice(this._configuration.maxUnusedTiles).map(function(h){return h[0]});_b<uncacheHs_1.length;_b++){var uncacheH=uncacheHs_1[_b];this._uncacheTile(uncacheH)}var potentialNodes=[];for(var key in this._cachedNodes)!this._cachedNodes.hasOwnProperty(key)||key in keysInUse||potentialNodes.push(this._cachedNodes[key]);for(var _c=0,uncacheNodes_1=potentialNodes.sort(function(n1,n2){return n2.accessed-n1.accessed}).slice(this._configuration.maxUnusedNodes);_c<uncacheNodes_1.length;_c++){var nodeAccess=uncacheNodes_1[_c];nodeAccess.node.uncache();key=nodeAccess.node.key;delete this._cachedNodes[key],key in this._cachedNodeTiles&&delete this._cachedNodeTiles[key],key in this._cachedSpatialEdges&&delete this._cachedSpatialEdges[key]}var potentialSequences=[];for(var sequenceKey in this._sequences)!this._sequences.hasOwnProperty(sequenceKey)||sequenceKey in this._cachingSequences$||potentialSequences.push(this._sequences[sequenceKey]);for(var _d=0,uncacheSequences_1=potentialSequences.sort(function(s1,s2){return s2.accessed-s1.accessed}).slice(this._configuration.maxSequences);_d<uncacheSequences_1.length;_d++){var sequenceAccess=uncacheSequences_1[_d];sequenceKey=sequenceAccess.sequence.key;delete this._sequences[sequenceKey],sequenceAccess.sequence.dispose()}},Graph.prototype._addNewKeys=function(keys,dict){for(var key in dict)dict.hasOwnProperty(key)&&this.hasNode(key)&&(key in keys||(keys[key]=!0))},Graph.prototype._cacheSequence$=function(sequenceKey){var _this=this;if(sequenceKey in this._cachingSequences$)return this._cachingSequences$[sequenceKey];var getSequenceByKey$=this._api.sequenceByKey$([sequenceKey]).pipe(operators_1.catchError(function(){return _this._api.sequenceByKeyForOutdoor$([sequenceKey])}));return this._cachingSequences$[sequenceKey]=getSequenceByKey$.pipe(operators_1.tap(function(sequenceByKey){sequenceKey in _this._sequences||(_this._sequences[sequenceKey]={accessed:(new Date).getTime(),sequence:new Graph_1.Sequence(sequenceByKey[sequenceKey])}),delete _this._cachingSequences$[sequenceKey]}),operators_1.map(function(sequenceByKey){return _this}),operators_1.finalize(function(){sequenceKey in _this._cachingSequences$&&delete _this._cachingSequences$[sequenceKey],_this._changed$.next(_this)}),operators_1.share()),this._cachingSequences$[sequenceKey]},Graph.prototype._makeFull=function(node,fillNode){null==fillNode.calt&&(fillNode.calt=this._defaultAlt),null==fillNode.c_rotation&&(fillNode.c_rotation=this._graphCalculator.rotationFromCompass(fillNode.ca,fillNode.orientation)),node.makeFull(fillNode)},Graph.prototype._preStore=function(h,node){h in this._preStored||(this._preStored[h]={}),this._preStored[h][node.key]=node},Graph.prototype._removeFromPreStore=function(h){var preStored=null;return h in this._preStored&&(preStored=this._preStored[h],delete this._preStored[h]),preStored},Graph.prototype._setNode=function(node){var key=node.key;this.hasNode(key)||(this._nodes[key]=node)},Graph.prototype._uncacheTile=function(h){for(var _i=0,_a=this._cachedTiles[h].nodes;_i<_a.length;_i++){var node=_a[_i],key=node.key;delete this._nodes[key],delete this._nodeToTile[key],key in this._cachedNodes&&delete this._cachedNodes[key],key in this._cachedNodeTiles&&delete this._cachedNodeTiles[key],key in this._cachedSpatialEdges&&delete this._cachedSpatialEdges[key],node.dispose()}for(var _b=0,_c=this._nodeIndexTiles[h];_b<_c.length;_b++){var nodeIndexItem=_c[_b];this._nodeIndex.remove(nodeIndexItem)}delete this._nodeIndexTiles[h],delete this._cachedTiles[h]},Graph.prototype._updateCachedTileAccess=function(key,accessed){key in this._nodeToTile&&(this._cachedTiles[this._nodeToTile[key]].accessed=accessed)},Graph.prototype._updateCachedNodeAccess=function(key,accessed){key in this._cachedNodes&&(this._cachedNodes[key].accessed=accessed)},Graph}();exports.Graph=Graph,exports.default=Graph},{"../Edge":344,"../Error":345,"../Graph":347,rbush:88,rxjs:89,"rxjs/operators":285,underscore:292}],450:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var geohash=require("latlon-geohash"),THREE=require("three"),Geo_1=require("../Geo"),GeoHashDirections=function(){function GeoHashDirections(){}return GeoHashDirections.n="n",GeoHashDirections.nw="nw",GeoHashDirections.w="w",GeoHashDirections.sw="sw",GeoHashDirections.s="s",GeoHashDirections.se="se",GeoHashDirections.e="e",GeoHashDirections.ne="ne",GeoHashDirections}(),GraphCalculator=function(){function GraphCalculator(geoCoords){this._geoCoords=null!=geoCoords?geoCoords:new Geo_1.GeoCoords}return GraphCalculator.prototype.encodeH=function(latLon,precision){return void 0===precision&&(precision=7),geohash.encode(latLon.lat,latLon.lon,precision)},GraphCalculator.prototype.encodeHs=function(latLon,precision,threshold){void 0===precision&&(precision=7),void 0===threshold&&(threshold=20);var h=geohash.encode(latLon.lat,latLon.lon,precision),bounds=geohash.bounds(h),ne=bounds.ne,sw=bounds.sw,neighbours=geohash.neighbours(h),bl=[0,0,0],tr=this._geoCoords.geodeticToEnu(ne.lat,ne.lon,0,sw.lat,sw.lon,0),position=this._geoCoords.geodeticToEnu(latLon.lat,latLon.lon,0,sw.lat,sw.lon,0),l=position[0]-bl[0]<threshold,r=tr[0]-position[0]<threshold,b=position[1]-bl[1]<threshold,t=tr[1]-position[1]<threshold,hs=[h];return t&&hs.push(neighbours[GeoHashDirections.n]),t&&l&&hs.push(neighbours[GeoHashDirections.nw]),l&&hs.push(neighbours[GeoHashDirections.w]),l&&b&&hs.push(neighbours[GeoHashDirections.sw]),b&&hs.push(neighbours[GeoHashDirections.s]),b&&r&&hs.push(neighbours[GeoHashDirections.se]),r&&hs.push(neighbours[GeoHashDirections.e]),r&&t&&hs.push(neighbours[GeoHashDirections.ne]),hs},GraphCalculator.prototype.boundingBoxCorners=function(latLon,threshold){var bl=this._geoCoords.enuToGeodetic(-threshold,-threshold,0,latLon.lat,latLon.lon,0),tr=this._geoCoords.enuToGeodetic(threshold,threshold,0,latLon.lat,latLon.lon,0);return[{lat:bl[0],lon:bl[1]},{lat:tr[0],lon:tr[1]}]},GraphCalculator.prototype.rotationFromCompass=function(compassAngle,orientation){var x=0,y=0,z=0;switch(orientation){case 1:x=Math.PI/2;break;case 3:x=-Math.PI/2,z=Math.PI;break;case 6:y=-Math.PI/2,z=-Math.PI/2;break;case 8:y=Math.PI/2,z=Math.PI/2}var rz=(new THREE.Matrix4).makeRotationZ(z),euler=new THREE.Euler(x,y,compassAngle*Math.PI/180,"XYZ"),re=(new THREE.Matrix4).makeRotationFromEuler(euler),rotation=(new THREE.Vector4).setAxisAngleFromRotationMatrix(re.multiply(rz));return rotation.multiplyScalar(rotation.w).toArray().slice(0,3)},GraphCalculator}();exports.GraphCalculator=GraphCalculator,exports.default=GraphCalculator},{"../Geo":346,"latlon-geohash":80,three:288}],451:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),GraphCalculator_1=require("./GraphCalculator"),GraphService=function(){function GraphService(graph,imageLoadingService){this._graph$=rxjs_1.of(graph).pipe(operators_1.concat(graph.changed$),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._graph$.subscribe(function(){}),this._imageLoadingService=imageLoadingService,this._firstGraphSubjects$=[],this._initializeCacheSubscriptions=[],this._sequenceSubscriptions=[],this._spatialSubscriptions=[],this._graphCalculator=new GraphCalculator_1.default}return GraphService.prototype.cachePath$=function(key){var _this=this,path$=this._graph$.pipe(operators_1.first(),operators_1.mergeMap(function(graph){var node=graph.getNode(key);return node.building?graph.hasCachedPaths(node.building.id)?rxjs_1.of(graph.getCachedPaths(node.building.id)):graph.cachePath$(key):rxjs_1.of([]).pipe(operators_1.delay(500))}),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount());return path$.subscribe(function(path){_this._imageLoadingService.loadpath$.next(path)},function(error){console.error("Failed to cache path ("+key+")",error)}),path$},GraphService.prototype.cacheOutdoorPath$=function(key){var _this=this,path$=this._graph$.pipe(operators_1.first(),operators_1.mergeMap(function(graph){var node=graph.getNode(key),outdoorImageHash=_this._graphCalculator.encodeH(node.latLon);return graph.hasCachedPaths(outdoorImageHash)?rxjs_1.of(graph.getCachedPaths(outdoorImageHash)):graph.cacheOutdoorPath$(node.latLon.lon,node.latLon.lat)}),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount());return path$.subscribe(function(path){_this._imageLoadingService.loadpathOutdoor$.next(path)},function(error){console.error("Failed to cache path ("+key+")",error)}),path$},GraphService.prototype.cacheNode$=function(key){var _this=this,firstGraphSubject$=new rxjs_1.Subject;this._firstGraphSubjects$.push(firstGraphSubject$);var firstGraph$=firstGraphSubject$.pipe(operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),node$=firstGraph$.pipe(operators_1.map(function(graph){return graph.getNode(key)}),operators_1.mergeMap(function(node){return node.assetsCached?rxjs_1.of(node):node.cacheAssets$()}),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount());node$.subscribe(function(node){_this._imageLoadingService.loadnode$.next(node)},function(error){console.error("Failed to cache node ("+key+")",error)});var initializeCacheSubscription=this._graph$.pipe(operators_1.first(),operators_1.mergeMap(function(graph){return graph.isCachingFull(key)||!graph.hasNode(key)?graph.cacheFull$(key):rxjs_1.of(graph)}),operators_1.tap(function(graph){graph.hasInitializedCache(key)||graph.initializeCache(key)}),operators_1.finalize(function(){null!=initializeCacheSubscription&&(_this._removeFromArray(initializeCacheSubscription,_this._initializeCacheSubscriptions),_this._removeFromArray(firstGraphSubject$,_this._firstGraphSubjects$))})).subscribe(function(graph){firstGraphSubject$.next(graph),firstGraphSubject$.complete()},function(error){firstGraphSubject$.error(error)});initializeCacheSubscription.closed||this._initializeCacheSubscriptions.push(initializeCacheSubscription);var sequenceSubscription=firstGraph$.pipe(operators_1.mergeMap(function(graph){return graph.isCachingNodeSequence(key)||!graph.hasNodeSequence(key)?graph.cacheNodeSequence$(key):rxjs_1.of(graph)}),operators_1.tap(function(graph){graph.getNode(key).sequenceEdges.cached||graph.cacheSequenceEdges(key)}),operators_1.finalize(function(){null!=sequenceSubscription&&_this._removeFromArray(sequenceSubscription,_this._sequenceSubscriptions)})).subscribe(function(graph){},function(error){console.error("Failed to cache sequence edges ("+key+").",error)});sequenceSubscription.closed||this._sequenceSubscriptions.push(sequenceSubscription);var spatialSubscription=firstGraph$.pipe(operators_1.expand(function(graph){return graph.hasTiles(key)?rxjs_1.empty():rxjs_1.from(graph.cacheTiles$(key)).pipe(operators_1.mergeMap(function(graph$){return graph$.pipe(operators_1.mergeMap(function(g){return g.isCachingTiles(key)?rxjs_1.empty():rxjs_1.of(g)}),operators_1.catchError(function(error,caught$){return console.error("Failed to cache tile data ("+key+").",error),rxjs_1.empty()}))}))}),operators_1.last(),operators_1.mergeMap(function(graph){return graph.hasSpatialArea(key)?rxjs_1.of(graph):rxjs_1.from(graph.cacheSpatialArea$(key)).pipe(operators_1.mergeMap(function(graph$){return graph$.pipe(operators_1.catchError(function(error,caught$){return console.error("Failed to cache spatial nodes ("+key+").",error),rxjs_1.empty()}))}))}),operators_1.last(),operators_1.mergeMap(function(graph){return graph.hasNodeSequence(key)?rxjs_1.of(graph):graph.cacheNodeSequence$(key)}),operators_1.tap(function(graph){graph.getNode(key).spatialEdges.cached||graph.cacheSpatialEdges(key)}),operators_1.finalize(function(){null!=spatialSubscription&&_this._removeFromArray(spatialSubscription,_this._spatialSubscriptions)})).subscribe(function(graph){},function(error){console.error("Failed to cache spatial edges ("+key+").",error)});return spatialSubscription.closed||this._spatialSubscriptions.push(spatialSubscription),node$.pipe(operators_1.first(function(node){return node.assetsCached}))},GraphService.prototype.cacheSequence$=function(sequenceKey){return this._graph$.pipe(operators_1.first(),operators_1.mergeMap(function(graph){return graph.isCachingSequence(sequenceKey)||!graph.hasSequence(sequenceKey)?graph.cacheSequence$(sequenceKey):rxjs_1.of(graph)}),operators_1.map(function(graph){return graph.getSequence(sequenceKey)}))},GraphService.prototype.setFilter$=function(filter){return this._resetSubscriptions(this._spatialSubscriptions),this._graph$.pipe(operators_1.first(),operators_1.tap(function(graph){graph.resetSpatialEdges(),graph.setFilter(filter)}))},GraphService.prototype.reset$=function(keepKeys){return this._abortSubjects(this._firstGraphSubjects$),this._resetSubscriptions(this._initializeCacheSubscriptions),this._resetSubscriptions(this._sequenceSubscriptions),this._resetSubscriptions(this._spatialSubscriptions),this._graph$.pipe(operators_1.first(),operators_1.tap(function(graph){graph.reset(keepKeys)}))},GraphService.prototype.uncache$=function(keepKeys){return this._graph$.pipe(operators_1.first(),operators_1.tap(function(graph){graph.uncache(keepKeys)}))},GraphService.prototype._abortSubjects=function(subjects){for(var _i=0,_a=subjects.slice();_i<_a.length;_i++){var subject=_a[_i];this._removeFromArray(subject,subjects),subject.error(new Error("Cache node request was aborted."))}},GraphService.prototype._removeFromArray=function(object,objects){var index=objects.indexOf(object);-1!==index&&objects.splice(index,1)},GraphService.prototype._resetSubscriptions=function(subscriptions){for(var _i=0,_a=subscriptions.slice();_i<_a.length;_i++){var subscription=_a[_i];this._removeFromArray(subscription,subscriptions),subscription.closed||subscription.unsubscribe()}},GraphService}();exports.GraphService=GraphService,exports.default=GraphService},{"./GraphCalculator":450,rxjs:89,"rxjs/operators":285}],452:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),ImageLoadingService=function(){function ImageLoadingService(){this._loadnode$=new rxjs_1.Subject,this._loadpath$=new rxjs_1.Subject,this._loadpathOutdoor$=new rxjs_1.Subject,this._loadstatus$=this._loadnode$.pipe(operators_1.scan(function(nodes,node){return nodes[node.key]=node.loadStatus,nodes},{}),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._loadpath$.subscribe(function(){}),this._loadpathOutdoor$.subscribe(function(){}),this._loadstatus$.subscribe(function(){})}return Object.defineProperty(ImageLoadingService.prototype,"loadpath$",{get:function(){return this._loadpath$},enumerable:!0,configurable:!0}),Object.defineProperty(ImageLoadingService.prototype,"loadpathOutdoor$",{get:function(){return this._loadpathOutdoor$},enumerable:!0,configurable:!0}),Object.defineProperty(ImageLoadingService.prototype,"loadnode$",{get:function(){return this._loadnode$},enumerable:!0,configurable:!0}),Object.defineProperty(ImageLoadingService.prototype,"loadstatus$",{get:function(){return this._loadstatus$},enumerable:!0,configurable:!0}),ImageLoadingService}();exports.ImageLoadingService=ImageLoadingService},{rxjs:89,"rxjs/operators":285}],453:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Pbf=require("pbf"),MeshReader=function(){function MeshReader(){}return MeshReader.read=function(buffer){return new Pbf(buffer).readFields(MeshReader._readMeshField,{faces:[],vertices:[]})},MeshReader._readMeshField=function(tag,mesh,pbf){1===tag?mesh.vertices.push(pbf.readFloat()):2===tag&&mesh.faces.push(pbf.readVarint())},MeshReader}();exports.MeshReader=MeshReader},{pbf:86}],454:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var operators_1=require("rxjs/operators"),Node=function(){function Node(core){this._cache=null,this._core=core,this._fill=null}return Object.defineProperty(Node.prototype,"assetsCached",{get:function(){return null!=this._core&&null!=this._fill&&null!=this._cache&&null!=this._cache.image&&null!=this._cache.mesh},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"cache",{get:function(){return this._cache},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"alt",{get:function(){return this._fill.calt},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"ca",{get:function(){return null!=this._fill.cca?this._fill.cca:this._fill.ca},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"capturedAt",{get:function(){return this._fill.captured_at},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"computedCA",{get:function(){return this._fill.cca},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"computedLatLon",{get:function(){return this._core.cl},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"focal",{get:function(){return this._fill.cfocal},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"full",{get:function(){return null!=this._fill},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"fullPano",{get:function(){return null!=this._fill.gpano&&0===this._fill.gpano.CroppedAreaLeftPixels&&0===this._fill.gpano.CroppedAreaTopPixels&&this._fill.gpano.CroppedAreaImageWidthPixels===this._fill.gpano.FullPanoWidthPixels&&this._fill.gpano.CroppedAreaImageHeightPixels===this._fill.gpano.FullPanoHeightPixels},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"gpano",{get:function(){return this._fill.gpano},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"height",{get:function(){return this._fill.height},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"image",{get:function(){return this._cache.image},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"key",{get:function(){return this._core.key},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"latLon",{get:function(){return null!=this._core.l?this._core.l:this._core.cl},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"loadStatus",{get:function(){return this._cache.loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"merged",{get:function(){return null!=this._fill&&null!=this._fill.merge_version&&0<this._fill.merge_version},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"mergeCC",{get:function(){return this._fill.merge_cc},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"mergeVersion",{get:function(){return this._fill.merge_version},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"mesh",{get:function(){return this._cache.mesh},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"orientation",{get:function(){return this._fill.orientation},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"originalCA",{get:function(){return this._fill.ca},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"originalLatLon",{get:function(){return this._core.l},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"pano",{get:function(){return null!=this._fill.gpano&&null!=this._fill.gpano.FullPanoWidthPixels},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"projectKey",{get:function(){return null!=this._fill.project?this._fill.project.key:null},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"rotation",{get:function(){return this._fill.c_rotation},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"translation",{get:function(){return this._fill.c_translation},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"scale",{get:function(){return this._fill.atomic_scale},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"sequenceKey",{get:function(){return this._core.sequence.key},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"sequenceEdges",{get:function(){return this._cache.sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"sequenceEdges$",{get:function(){return this._cache.sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"spatialEdges",{get:function(){return this._cache.spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"spatialEdges$",{get:function(){return this._cache.spatialEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"userKey",{get:function(){return this._fill.user.key},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"username",{get:function(){return this._fill.user.username},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"tags",{get:function(){return this._fill.tags},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"width",{get:function(){return this._fill.width},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"floor",{get:function(){return this._fill.floor},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"floorId",{get:function(){return this._fill.floor.id},enumerable:!0,configurable:!0}),Object.defineProperty(Node.prototype,"building",{get:function(){return this._fill.building},enumerable:!0,configurable:!0}),Node.prototype.cacheAssets$=function(){var _this=this;return this._cache.cacheAssets$(this.key,this.pano,this.merged).pipe(operators_1.map(function(cache){return _this}))},Node.prototype.cacheImage$=function(imageSize){var _this=this;return this._cache.cacheImage$(this.key,imageSize).pipe(operators_1.map(function(cache){return _this}))},Node.prototype.cacheSequenceEdges=function(edges){this._cache.cacheSequenceEdges(edges)},Node.prototype.cacheSpatialEdges=function(edges){this._cache.cacheSpatialEdges(edges)},Node.prototype.dispose=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null),this._core=null,this._fill=null},Node.prototype.initializeCache=function(cache){if(null!=this._cache)throw new Error("Node cache already initialized ("+this.key+").");this._cache=cache},Node.prototype.makeFull=function(fill){if(null==fill)throw new Error("Fill can not be null.");this._fill=fill},Node.prototype.resetSequenceEdges=function(){this._cache.resetSequenceEdges()},Node.prototype.resetSpatialEdges=function(){this._cache.resetSpatialEdges()},Node.prototype.uncache=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null)},Node}();exports.Node=Node,exports.default=Node},{"rxjs/operators":285}],455:[function(require,module,exports){(function(Buffer){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),Graph_1=require("../Graph"),Utils_1=require("../Utils"),NodeCache=function(){function NodeCache(){this._disposed=!1,this._image=null,this._loadStatus={loaded:0,total:0},this._mesh=null,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$=new rxjs_1.Subject,this._sequenceEdges$=this._sequenceEdgesChanged$.pipe(operators_1.startWith(this._sequenceEdges),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(function(){}),this._spatialEdgesChanged$=new rxjs_1.Subject,this._spatialEdges$=this._spatialEdgesChanged$.pipe(operators_1.startWith(this._spatialEdges),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(function(){}),this._cachingAssets$=null}return Object.defineProperty(NodeCache.prototype,"image",{get:function(){return this._image},enumerable:!0,configurable:!0}),Object.defineProperty(NodeCache.prototype,"loadStatus",{get:function(){return this._loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(NodeCache.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),Object.defineProperty(NodeCache.prototype,"sequenceEdges",{get:function(){return this._sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(NodeCache.prototype,"sequenceEdges$",{get:function(){return this._sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(NodeCache.prototype,"spatialEdges",{get:function(){return this._spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(NodeCache.prototype,"spatialEdges$",{get:function(){return this._spatialEdges$},enumerable:!0,configurable:!0}),NodeCache.prototype.cacheAssets$=function(key,pano,merged){var _this=this;return null!=this._cachingAssets$||(this._cachingAssets$=rxjs_1.combineLatest(this._cacheImage$(key),function(imageStatus){return _this._loadStatus.loaded=0,_this._loadStatus.total=0,_this._mesh={faces:[],vertices:[]},imageStatus&&(_this._image=imageStatus.object,_this._loadStatus.loaded+=imageStatus.loaded.loaded,_this._loadStatus.total+=imageStatus.loaded.total),_this}).pipe(operators_1.finalize(function(){_this._cachingAssets$=null}),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount())),this._cachingAssets$},NodeCache.prototype.cacheImage$=function(key,imageSize){var _this=this;return null!=this._image&&imageSize<=Math.max(this._image.width,this._image.height)?rxjs_1.of(this):this._cacheImage$(key).pipe(operators_1.first(function(status){return null!=status.object}),operators_1.tap(function(status){_this._disposeImage(),_this._image=status.object}),operators_1.map(function(imageStatus){return _this}))},NodeCache.prototype.cacheSequenceEdges=function(edges){this._sequenceEdges={cached:!0,edges:edges},this._sequenceEdgesChanged$.next(this._sequenceEdges)},NodeCache.prototype.cacheSpatialEdges=function(edges){this._spatialEdges={cached:!0,edges:edges},this._spatialEdgesChanged$.next(this._spatialEdges)},NodeCache.prototype.dispose=function(){this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._disposeImage(),this._mesh=null,this._loadStatus.loaded=0,this._loadStatus.total=0,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges),this._spatialEdgesChanged$.next(this._spatialEdges),this._disposed=!0,null!=this._imageRequest&&this._imageRequest.abort(),null!=this._meshRequest&&this._meshRequest.abort()},NodeCache.prototype.resetSequenceEdges=function(){this._sequenceEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges)},NodeCache.prototype.resetSpatialEdges=function(){this._spatialEdges={cached:!1,edges:[]},this._spatialEdgesChanged$.next(this._spatialEdges)},NodeCache.prototype._cacheImage$=function(key){var _this=this;return rxjs_1.Observable.create(function(subscriber){var xmlHTTP=new XMLHttpRequest;xmlHTTP.open("GET",Utils_1.Urls.thumbnail(key),!0),xmlHTTP.setRequestHeader("Accept","image/jpeg"),xmlHTTP.custom&&xmlHTTP.custom.xhr&&(xmlHTTP=xmlHTTP.custom.xhr),xmlHTTP.responseType="arraybuffer",xmlHTTP.timeout=15e3,xmlHTTP.onload=function(pe){if(200!==xmlHTTP.status)return _this._imageRequest=null,void subscriber.error(new Error("Failed to fetch image ("+key+"). Status: "+xmlHTTP.status+", "+xmlHTTP.statusText));var image=new Image;image.crossOrigin="Anonymous",image.onload=function(e){if(_this._imageRequest=null,_this._disposed)return window.URL.revokeObjectURL(image.src),void subscriber.error(new Error("Image load was aborted ("+key+")"));subscriber.next({loaded:{loaded:pe.loaded,total:pe.total},object:image}),subscriber.complete()},image.onerror=function(error){_this._imageRequest=null,subscriber.error(new Error("Failed to load image ("+key+")"))};var blob=new Blob([xmlHTTP.response]);image.src=window.URL.createObjectURL(blob)},xmlHTTP.onprogress=function(pe){_this._disposed||subscriber.next({loaded:{loaded:pe.loaded,total:pe.total},object:null})},xmlHTTP.onerror=function(error){_this._imageRequest=null,subscriber.error(new Error("Failed to fetch image ("+key+")"))},xmlHTTP.ontimeout=function(e){_this._imageRequest=null,subscriber.error(new Error("Image request timed out ("+key+")"))},xmlHTTP.onabort=function(event){_this._imageRequest=null,subscriber.error(new Error("Image request was aborted ("+key+")"))},(_this._imageRequest=xmlHTTP).send(null)})},NodeCache.prototype._cacheMesh$=function(key,merged){var _this=this;return rxjs_1.Observable.create(function(subscriber){if(!merged)return subscriber.next(_this._createEmptyMeshLoadStatus()),void subscriber.complete();var xmlHTTP=new XMLHttpRequest;xmlHTTP.open("GET",Utils_1.Urls.protoMesh(key),!0),xmlHTTP.setRequestHeader("Accept","application/mesh"),xmlHTTP.custom&&xmlHTTP.custom.xhr&&(xmlHTTP=xmlHTTP.custom.xhr),xmlHTTP.responseType="arraybuffer",xmlHTTP.timeout=15e3,xmlHTTP.onload=function(pe){if(_this._meshRequest=null,!_this._disposed){200===xmlHTTP.status&&Graph_1.MeshReader.read(new Buffer(xmlHTTP.response));subscriber.next({loaded:{loaded:pe.loaded,total:pe.total},object:{faces:[],vertices:[]}}),subscriber.complete()}},xmlHTTP.onprogress=function(pe){_this._disposed||subscriber.next({loaded:{loaded:pe.loaded,total:pe.total},object:null})},xmlHTTP.onerror=function(e){_this._meshRequest=null,subscriber.next(_this._createEmptyMeshLoadStatus()),subscriber.complete()},xmlHTTP.ontimeout=function(e){_this._meshRequest=null,subscriber.next(_this._createEmptyMeshLoadStatus()),subscriber.complete()},xmlHTTP.onabort=function(e){_this._meshRequest=null},(_this._meshRequest=xmlHTTP).send(null)})},NodeCache.prototype._createEmptyMeshLoadStatus=function(){return{loaded:{loaded:0,total:0},object:{faces:[],vertices:[]}}},NodeCache.prototype._disposeImage=function(){null!=this._image&&window.URL.revokeObjectURL(this._image.src),this._image=null},NodeCache}();exports.NodeCache=NodeCache,exports.default=NodeCache}).call(this,require("buffer").Buffer)},{"../Graph":347,"../Utils":353,buffer:48,rxjs:89,"rxjs/operators":285}],456:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("underscore"),Sequence=function(){function Sequence(sequence){this._key=sequence.key,this._keys=sequence.keys,this._country=sequence.country,this._city=sequence.city,this._building=sequence.building,this._floor=sequence.floor,this._loopLine=sequence.loop_line}return Object.defineProperty(Sequence.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(Sequence.prototype,"keys",{get:function(){return this._keys},enumerable:!0,configurable:!0}),Object.defineProperty(Sequence.prototype,"country",{get:function(){return this._country},enumerable:!0,configurable:!0}),Object.defineProperty(Sequence.prototype,"city",{get:function(){return this._city},enumerable:!0,configurable:!0}),Object.defineProperty(Sequence.prototype,"building",{get:function(){return this._building},enumerable:!0,configurable:!0}),Object.defineProperty(Sequence.prototype,"floor",{get:function(){return this._floor},enumerable:!0,configurable:!0}),Object.defineProperty(Sequence.prototype,"floorVersion",{get:function(){return this._loopLine},enumerable:!0,configurable:!0}),Sequence.prototype.dispose=function(){this._key=null,this._keys=null},Sequence.prototype.findNextKey=function(key){var i=_.indexOf(this._keys,key);return i+1>=this._keys.length||-1===i?null:this._keys[i+1]},Sequence.prototype.findPrevKey=function(key){var i=_.indexOf(this._keys,key);return 0===i||-1===i?null:this._keys[i-1]},Sequence}();exports.Sequence=Sequence,exports.default=Sequence},{underscore:292}],457:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),Edge_1=require("../../Edge"),Error_1=require("../../Error"),Geo_1=require("../../Geo"),EdgeCalculator=function(){function EdgeCalculator(settings,directions,coefficients){this._spatial=new Geo_1.Spatial,this._geoCoords=new Geo_1.GeoCoords,this._settings=null!=settings?settings:new Edge_1.EdgeCalculatorSettings,this._directions=null!=directions?directions:new Edge_1.EdgeCalculatorDirections,this._coefficients=null!=coefficients?coefficients:new Edge_1.EdgeCalculatorCoefficients}return EdgeCalculator.prototype.getPotentialEdges=function(node,potentialNodes,fallbackKeys){if(!node.full)throw new Error_1.ArgumentBeeviewError("Node has to be full.");if(!node.merged)return[];for(var currentDirection=this._spatial.viewingDirection(node.rotation),currentVerticalDirection=this._spatial.angleToPlane(currentDirection.toArray(),[0,0,1]),potentialEdges=[],_i=0,potentialNodes_1=potentialNodes;_i<potentialNodes_1.length;_i++){var potential=potentialNodes_1[_i];if(potential.merged&&potential.key!==node.key){var enu=this._geoCoords.geodeticToEnu(potential.latLon.lat,potential.latLon.lon,potential.alt,node.latLon.lat,node.latLon.lon,node.alt),motion=new THREE.Vector3(enu[0],enu[1],enu[2]),distance=motion.length();if(!(distance>this._settings.maxDistance&&fallbackKeys.indexOf(potential.key)<0)){var motionChange=this._spatial.angleBetweenVector2(currentDirection.x,currentDirection.y,motion.x,motion.y),verticalMotion=this._spatial.angleToPlane(motion.toArray(),[0,0,1]),direction=this._spatial.viewingDirection(potential.rotation),directionChange=this._spatial.angleBetweenVector2(currentDirection.x,currentDirection.y,direction.x,direction.y),verticalDirectionChange=this._spatial.angleToPlane(direction.toArray(),[0,0,1])-currentVerticalDirection,rotation=this._spatial.relativeRotationAngle(node.rotation,potential.rotation),worldMotionAzimuth=this._spatial.angleBetweenVector2(1,0,motion.x,motion.y),sameSequence=null!=potential.sequenceKey&&null!=node.sequenceKey&&potential.sequenceKey===node.sequenceKey,sameMergeCC=null==potential.mergeCC&&null==node.mergeCC||potential.mergeCC===node.mergeCC,sameUser=potential.userKey===node.userKey,potentialEdge={capturedAt:potential.capturedAt,croppedPano:potential.pano&&!potential.fullPano,directionChange:directionChange,distance:distance,fullPano:potential.fullPano,key:potential.key,motionChange:motionChange,rotation:rotation,sameMergeCC:sameMergeCC,sameSequence:sameSequence,sameUser:sameUser,sequenceKey:potential.sequenceKey,verticalDirectionChange:verticalDirectionChange,verticalMotion:verticalMotion,worldMotionAzimuth:worldMotionAzimuth};potentialEdges.push(potentialEdge)}}}return potentialEdges},EdgeCalculator.prototype.computeSequenceEdges=function(node,sequence){if(!node.full)throw new Error_1.ArgumentBeeviewError("Node has to be full.");if(node.sequenceKey!==sequence.key)throw new Error_1.ArgumentBeeviewError("Node and sequence does not correspond.");var edges=[],nextKey=sequence.findNextKey(node.key);null!=nextKey&&edges.push({data:{direction:Edge_1.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:node.key,to:nextKey});var prevKey=sequence.findPrevKey(node.key);return null!=prevKey&&edges.push({data:{direction:Edge_1.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:node.key,to:prevKey}),edges},EdgeCalculator.prototype.computeSimilarEdges=function(node,potentialEdges){var _this=this;if(!node.full)throw new Error_1.ArgumentBeeviewError("Node has to be full.");for(var nodeFullPano=node.fullPano,sequenceGroups={},_i=0,potentialEdges_1=potentialEdges;_i<potentialEdges_1.length;_i++){if(null!=(potentialEdge=potentialEdges_1[_i]).sequenceKey&&(!potentialEdge.sameSequence&&potentialEdge.sameMergeCC)){if(nodeFullPano){if(!potentialEdge.fullPano)continue}else if(!potentialEdge.fullPano&&Math.abs(potentialEdge.directionChange)>this._settings.similarMaxDirectionChange)continue;potentialEdge.distance>this._settings.similarMaxDistance||potentialEdge.sameUser&&Math.abs(potentialEdge.capturedAt-node.capturedAt)<this._settings.similarMinTimeDifference||(null==sequenceGroups[potentialEdge.sequenceKey]&&(sequenceGroups[potentialEdge.sequenceKey]=[]),sequenceGroups[potentialEdge.sequenceKey].push(potentialEdge))}}var similarEdges=[],calculateScore=node.fullPano?function(potentialEdge){return potentialEdge.distance}:function(potentialEdge){return _this._coefficients.similarDistance*potentialEdge.distance+_this._coefficients.similarRotation*potentialEdge.rotation};for(var sequenceKey in sequenceGroups)if(sequenceGroups.hasOwnProperty(sequenceKey)){for(var lowestScore=Number.MAX_VALUE,similarEdge=null,_a=0,_b=sequenceGroups[sequenceKey];_a<_b.length;_a++){var potentialEdge,score=calculateScore(potentialEdge=_b[_a]);score<lowestScore&&(lowestScore=score,similarEdge=potentialEdge)}null!=similarEdge&&similarEdges.push(similarEdge)}return similarEdges.map(function(potentialEdge){return{data:{direction:Edge_1.EdgeDirection.Similar,worldMotionAzimuth:potentialEdge.worldMotionAzimuth},from:node.key,to:potentialEdge.key}})},EdgeCalculator.prototype.computeStepEdges=function(node,potentialEdges,prevKey,nextKey){if(!node.full)throw new Error_1.ArgumentBeeviewError("Node has to be full.");var edges=[];if(node.pano)return edges;for(var k in this._directions.steps)if(this._directions.steps.hasOwnProperty(k)){for(var step=this._directions.steps[k],lowestScore=Number.MAX_VALUE,edge=null,fallback=null,_i=0,potentialEdges_2=potentialEdges;_i<potentialEdges_2.length;_i++){var potential=potentialEdges_2[_i];if(!potential.croppedPano&&!potential.fullPano&&!(Math.abs(potential.directionChange)>this._settings.stepMaxDirectionChange)){var motionDifference=this._spatial.angleDifference(step.motionChange,potential.motionChange),directionMotionDifference=this._spatial.angleDifference(potential.directionChange,motionDifference),drift=Math.max(Math.abs(motionDifference),Math.abs(directionMotionDifference));if(!(Math.abs(drift)>this._settings.stepMaxDrift)){var potentialKey=potential.key;if(!step.useFallback||potentialKey!==prevKey&&potentialKey!==nextKey||(fallback=potential),!(potential.distance>this._settings.stepMaxDistance)){motionDifference=Math.sqrt(motionDifference*motionDifference+potential.verticalMotion*potential.verticalMotion);var score=this._coefficients.stepPreferredDistance*Math.abs(potential.distance-this._settings.stepPreferredDistance)/this._settings.stepMaxDistance+this._coefficients.stepMotion*motionDifference/this._settings.stepMaxDrift+this._coefficients.stepRotation*potential.rotation/this._settings.stepMaxDirectionChange+this._coefficients.stepSequencePenalty*(potential.sameSequence?0:1)+this._coefficients.stepMergeCCPenalty*(potential.sameMergeCC?0:1);score<lowestScore&&(lowestScore=score,edge=potential)}}}}null!=(edge=null==edge?fallback:edge)&&edges.push({data:{direction:step.direction,worldMotionAzimuth:edge.worldMotionAzimuth},from:node.key,to:edge.key})}return edges},EdgeCalculator.prototype.computeTurnEdges=function(node,potentialEdges){if(!node.full)throw new Error_1.ArgumentBeeviewError("Node has to be full.");var edges=[];if(node.pano)return edges;for(var k in this._directions.turns)if(this._directions.turns.hasOwnProperty(k)){for(var turn=this._directions.turns[k],lowestScore=Number.MAX_VALUE,edge=null,_i=0,potentialEdges_3=potentialEdges;_i<potentialEdges_3.length;_i++){var potential=potentialEdges_3[_i];if(!potential.croppedPano&&!potential.fullPano&&!(potential.distance>this._settings.turnMaxDistance)){var rig=turn.direction!==Edge_1.EdgeDirection.TurnU&&potential.distance<this._settings.turnMaxRigDistance&&Math.abs(potential.directionChange)>this._settings.turnMinRigDirectionChange,directionDifference=this._spatial.angleDifference(turn.directionChange,potential.directionChange),score=void 0;if(rig&&0<potential.directionChange*turn.directionChange&&Math.abs(potential.directionChange)<Math.abs(turn.directionChange))score=-Math.PI/2+Math.abs(potential.directionChange);else{if(Math.abs(directionDifference)>this._settings.turnMaxDirectionChange)continue;var motionDifference=turn.motionChange?this._spatial.angleDifference(turn.motionChange,potential.motionChange):0;motionDifference=Math.sqrt(motionDifference*motionDifference+potential.verticalMotion*potential.verticalMotion),score=this._coefficients.turnDistance*potential.distance/this._settings.turnMaxDistance+this._coefficients.turnMotion*motionDifference/Math.PI+this._coefficients.turnSequencePenalty*(potential.sameSequence?0:1)+this._coefficients.turnMergeCCPenalty*(potential.sameMergeCC?0:1)}score<lowestScore&&(lowestScore=score,edge=potential)}}null!=edge&&edges.push({data:{direction:turn.direction,worldMotionAzimuth:edge.worldMotionAzimuth},from:node.key,to:edge.key})}return edges},EdgeCalculator.prototype.computePerspectiveToPanoEdges=function(node,potentialEdges){if(!node.full)throw new Error_1.ArgumentBeeviewError("Node has to be full.");if(node.pano)return[];for(var lowestScore=Number.MAX_VALUE,edge=null,_i=0,potentialEdges_4=potentialEdges;_i<potentialEdges_4.length;_i++){var potential=potentialEdges_4[_i];if(potential.fullPano){var score=this._coefficients.panoPreferredDistance*Math.abs(potential.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(potential.motionChange)/Math.PI+this._coefficients.panoMergeCCPenalty*(potential.sameMergeCC?0:1);score<lowestScore&&(lowestScore=score,edge=potential)}}return null==edge?[]:[{data:{direction:Edge_1.EdgeDirection.Pano,worldMotionAzimuth:edge.worldMotionAzimuth},from:node.key,to:edge.key}]},EdgeCalculator.prototype.computePanoEdges=function(node,potentialEdges){if(!node.full)throw new Error_1.ArgumentBeeviewError("Node has to be full.");if(!node.fullPano)return[];for(var panoEdges=[],potentialPanos=[],potentialSteps=[],_i=0,potentialEdges_5=potentialEdges;_i<potentialEdges_5.length;_i++){if(!((potential=potentialEdges_5[_i]).distance>this._settings.panoMaxDistance))if(potential.fullPano){if(potential.distance<this._settings.panoMinDistance)continue;potentialPanos.push(potential)}else{if(potential.croppedPano)continue;for(var k in this._directions.panos)if(this._directions.panos.hasOwnProperty(k)){var pano=this._directions.panos[k],turn=this._spatial.angleDifference(potential.directionChange,potential.motionChange),turnChange=this._spatial.angleDifference(pano.directionChange,turn);if(!(Math.abs(turnChange)>this._settings.panoMaxStepTurnChange)){potentialSteps.push([pano.direction,potential]);break}}}}for(var maxRotationDifference=Math.PI/this._settings.panoMaxItems,occupiedAngles=[],stepAngles=[],index=0;index<this._settings.panoMaxItems;index++){for(var rotation=index/this._settings.panoMaxItems*2*Math.PI,lowestScore=Number.MAX_VALUE,edge=null,_a=0,potentialPanos_1=potentialPanos;_a<potentialPanos_1.length;_a++){var potential=potentialPanos_1[_a],motionDifference=this._spatial.angleDifference(rotation,potential.motionChange);if(!(Math.abs(motionDifference)>maxRotationDifference)){for(var occupiedDifference=Number.MAX_VALUE,_b=0,occupiedAngles_1=occupiedAngles;_b<occupiedAngles_1.length;_b++){var occupiedAngle=occupiedAngles_1[_b],difference=Math.abs(this._spatial.angleDifference(occupiedAngle,potential.motionChange));difference<occupiedDifference&&(occupiedDifference=difference)}if(!(occupiedDifference<=maxRotationDifference))(score=this._coefficients.panoPreferredDistance*Math.abs(potential.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(motionDifference)/maxRotationDifference+this._coefficients.panoSequencePenalty*(potential.sameSequence?0:1)+this._coefficients.panoMergeCCPenalty*(potential.sameMergeCC?0:1))<lowestScore&&(lowestScore=score,edge=potential)}}null!=edge?(occupiedAngles.push(edge.motionChange),panoEdges.push({data:{direction:Edge_1.EdgeDirection.Pano,worldMotionAzimuth:edge.worldMotionAzimuth},from:node.key,to:edge.key})):stepAngles.push(rotation)}var occupiedStepAngles={};occupiedStepAngles[Edge_1.EdgeDirection.Pano]=occupiedAngles,occupiedStepAngles[Edge_1.EdgeDirection.StepForward]=[],occupiedStepAngles[Edge_1.EdgeDirection.StepLeft]=[],occupiedStepAngles[Edge_1.EdgeDirection.StepBackward]=[],occupiedStepAngles[Edge_1.EdgeDirection.StepRight]=[];for(var _c=0,stepAngles_1=stepAngles;_c<stepAngles_1.length;_c++){var stepAngle=stepAngles_1[_c],occupations=[];for(var k in this._directions.panos)if(this._directions.panos.hasOwnProperty(k)){pano=this._directions.panos[k];for(var allOccupiedAngles=occupiedStepAngles[Edge_1.EdgeDirection.Pano].concat(occupiedStepAngles[pano.direction]).concat(occupiedStepAngles[pano.prev]).concat(occupiedStepAngles[pano.next]),_d=(lowestScore=Number.MAX_VALUE,edge=null,0),potentialSteps_1=potentialSteps;_d<potentialSteps_1.length;_d++){if((potential=potentialSteps_1[_d])[0]===pano.direction){var motionChange=this._spatial.angleDifference(stepAngle,potential[1].motionChange);if(!(Math.abs(motionChange)>maxRotationDifference)){for(var score,minOccupiedDifference=Number.MAX_VALUE,_e=0,allOccupiedAngles_1=allOccupiedAngles;_e<allOccupiedAngles_1.length;_e++){occupiedAngle=allOccupiedAngles_1[_e];(occupiedDifference=Math.abs(this._spatial.angleDifference(occupiedAngle,potential[1].motionChange)))<minOccupiedDifference&&(minOccupiedDifference=occupiedDifference)}if(!(minOccupiedDifference<=maxRotationDifference))(score=this._coefficients.panoPreferredDistance*Math.abs(potential[1].distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(motionChange)/maxRotationDifference+this._coefficients.panoMergeCCPenalty*(potential[1].sameMergeCC?0:1))<lowestScore&&(lowestScore=score,edge=potential)}}}null!=edge&&(occupations.push(edge),panoEdges.push({data:{direction:edge[0],worldMotionAzimuth:edge[1].worldMotionAzimuth},from:node.key,to:edge[1].key}))}for(var _f=0,occupations_1=occupations;_f<occupations_1.length;_f++){var occupation=occupations_1[_f];occupiedStepAngles[occupation[0]].push(occupation[1].motionChange)}}return panoEdges},EdgeCalculator}();exports.EdgeCalculator=EdgeCalculator,exports.default=EdgeCalculator},{"../../Edge":344,"../../Error":345,"../../Geo":346,three:288}],458:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EdgeCalculatorCoefficients=function(){this.panoPreferredDistance=2,this.panoMotion=2,this.panoSequencePenalty=1,this.panoMergeCCPenalty=4,this.stepPreferredDistance=4,this.stepMotion=3,this.stepRotation=4,this.stepSequencePenalty=2,this.stepMergeCCPenalty=6,this.similarDistance=2,this.similarRotation=3,this.turnDistance=4,this.turnMotion=2,this.turnSequencePenalty=1,this.turnMergeCCPenalty=4};exports.EdgeCalculatorCoefficients=EdgeCalculatorCoefficients,exports.default=EdgeCalculatorCoefficients},{}],459:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Edge_1=require("../../Edge"),EdgeCalculatorDirections=function(){this.steps={},this.turns={},this.panos={},this.steps[Edge_1.EdgeDirection.StepForward]={direction:Edge_1.EdgeDirection.StepForward,motionChange:0,useFallback:!0},this.steps[Edge_1.EdgeDirection.StepBackward]={direction:Edge_1.EdgeDirection.StepBackward,motionChange:Math.PI,useFallback:!0},this.steps[Edge_1.EdgeDirection.StepLeft]={direction:Edge_1.EdgeDirection.StepLeft,motionChange:Math.PI/2,useFallback:!1},this.steps[Edge_1.EdgeDirection.StepRight]={direction:Edge_1.EdgeDirection.StepRight,motionChange:-Math.PI/2,useFallback:!1},this.turns[Edge_1.EdgeDirection.TurnLeft]={direction:Edge_1.EdgeDirection.TurnLeft,directionChange:Math.PI/2,motionChange:Math.PI/4},this.turns[Edge_1.EdgeDirection.TurnRight]={direction:Edge_1.EdgeDirection.TurnRight,directionChange:-Math.PI/2,motionChange:-Math.PI/4},this.turns[Edge_1.EdgeDirection.TurnU]={direction:Edge_1.EdgeDirection.TurnU,directionChange:Math.PI,motionChange:null},this.panos[Edge_1.EdgeDirection.StepForward]={direction:Edge_1.EdgeDirection.StepForward,directionChange:0,next:Edge_1.EdgeDirection.StepLeft,prev:Edge_1.EdgeDirection.StepRight},this.panos[Edge_1.EdgeDirection.StepBackward]={direction:Edge_1.EdgeDirection.StepBackward,directionChange:Math.PI,next:Edge_1.EdgeDirection.StepRight,prev:Edge_1.EdgeDirection.StepLeft},this.panos[Edge_1.EdgeDirection.StepLeft]={direction:Edge_1.EdgeDirection.StepLeft,directionChange:Math.PI/2,next:Edge_1.EdgeDirection.StepBackward,prev:Edge_1.EdgeDirection.StepForward},this.panos[Edge_1.EdgeDirection.StepRight]={direction:Edge_1.EdgeDirection.StepRight,directionChange:-Math.PI/2,next:Edge_1.EdgeDirection.StepForward,prev:Edge_1.EdgeDirection.StepBackward}};exports.EdgeCalculatorDirections=EdgeCalculatorDirections},{"../../Edge":344}],460:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EdgeCalculatorSettings=function(){function EdgeCalculatorSettings(){this.panoMinDistance=.1,this.panoMaxDistance=20,this.panoPreferredDistance=5,this.panoMaxItems=4,this.panoMaxStepTurnChange=Math.PI/8,this.rotationMaxDistance=this.turnMaxRigDistance,this.rotationMaxDirectionChange=Math.PI/6,this.rotationMaxVerticalDirectionChange=Math.PI/8,this.similarMaxDirectionChange=Math.PI/8,this.similarMaxDistance=12,this.similarMinTimeDifference=432e5,this.stepMaxDistance=20,this.stepMaxDirectionChange=Math.PI/6,this.stepMaxDrift=Math.PI/6,this.stepPreferredDistance=4,this.turnMaxDistance=15,this.turnMaxDirectionChange=2*Math.PI/9,this.turnMaxRigDistance=.65,this.turnMinRigDirectionChange=Math.PI/6}return Object.defineProperty(EdgeCalculatorSettings.prototype,"maxDistance",{get:function(){return Math.max(this.panoMaxDistance,this.similarMaxDistance,this.stepMaxDistance,this.turnMaxDistance)},enumerable:!0,configurable:!0}),EdgeCalculatorSettings}();exports.EdgeCalculatorSettings=EdgeCalculatorSettings,exports.default=EdgeCalculatorSettings},{}],461:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(EdgeDirection){EdgeDirection[EdgeDirection.Next=0]="Next",EdgeDirection[EdgeDirection.Prev=1]="Prev",EdgeDirection[EdgeDirection.StepLeft=2]="StepLeft",EdgeDirection[EdgeDirection.StepRight=3]="StepRight",EdgeDirection[EdgeDirection.StepForward=4]="StepForward",EdgeDirection[EdgeDirection.StepBackward=5]="StepBackward",EdgeDirection[EdgeDirection.TurnLeft=6]="TurnLeft",EdgeDirection[EdgeDirection.TurnRight=7]="TurnRight",EdgeDirection[EdgeDirection.TurnU=8]="TurnU",EdgeDirection[EdgeDirection.Pano=9]="Pano",EdgeDirection[EdgeDirection.Similar=10]="Similar"}(exports.EdgeDirection||(exports.EdgeDirection={}))},{}],462:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("underscore"),vd=require("virtual-dom"),rxjs_1=require("rxjs"),Render_1=require("../Render"),operators_1=require("rxjs/operators"),DOMRenderer=function(){function DOMRenderer(element,renderService,currentFrame$){this._adaptiveOperation$=new rxjs_1.Subject,this._render$=new rxjs_1.Subject,this._renderAdaptive$=new rxjs_1.Subject,this._renderService=renderService,this._currentFrame$=currentFrame$;var rootNode=vd.create(vd.h("div.domRenderer",[]));element.appendChild(rootNode),this._offset$=this._adaptiveOperation$.pipe(operators_1.scan(function(adaptive,operation){return operation(adaptive)},{elementHeight:element.offsetHeight,elementWidth:element.offsetWidth,imageAspect:0,renderMode:Render_1.RenderMode.Fill}),operators_1.filter(function(adaptive){return 0<adaptive.imageAspect&&0<adaptive.elementWidth&&0<adaptive.elementHeight}),operators_1.map(function(adaptive){var elementAspect=adaptive.elementWidth/adaptive.elementHeight,ratio=adaptive.imageAspect/elementAspect,verticalOffset=0,horizontalOffset=0;return adaptive.renderMode===Render_1.RenderMode.Letterbox?adaptive.imageAspect>elementAspect?verticalOffset=adaptive.elementHeight*(1-1/ratio)/2:horizontalOffset=adaptive.elementWidth*(1-ratio)/2:adaptive.imageAspect>elementAspect?horizontalOffset=-adaptive.elementWidth*(ratio-1)/2:verticalOffset=-adaptive.elementHeight*(1/ratio-1)/2,{bottom:verticalOffset,left:horizontalOffset,right:horizontalOffset,top:verticalOffset}})),this._currentFrame$.pipe(operators_1.filter(function(frame){return null!=frame.state.currentNode}),operators_1.distinctUntilChanged(function(k1,k2){return k1===k2},function(frame){return frame.state.currentNode.key}),operators_1.map(function(frame){return frame.state.currentTransform.basicAspect}),operators_1.map(function(aspect){return function(adaptive){return adaptive.imageAspect=aspect,adaptive}})).subscribe(this._adaptiveOperation$),this._renderAdaptive$.pipe(operators_1.scan(function(vNodeHashes,vNodeHash){return null==vNodeHash.vnode?delete vNodeHashes[vNodeHash.name]:vNodeHashes[vNodeHash.name]=vNodeHash.vnode,vNodeHashes},{}),operators_1.combineLatest(this._offset$),operators_1.map(function(vo){var vNodes=_.values(vo[0]),offset=vo[1],properties={style:{bottom:offset.bottom+"px",left:offset.left+"px","pointer-events":"none",position:"absolute",right:offset.right+"px",top:offset.top+"px"}};return{name:"adaptiveDomRenderer",vnode:vd.h("div.adaptiveDomRenderer",properties,vNodes)}})).subscribe(this._render$),this._vNode$=this._render$.pipe(operators_1.scan(function(vNodeHashes,vNodeHash){return null==vNodeHash.vnode?delete vNodeHashes[vNodeHash.name]:vNodeHashes[vNodeHash.name]=vNodeHash.vnode,vNodeHashes},{}),operators_1.map(function(vNodeHashes){var vNodes=_.values(vNodeHashes);return vd.h("div.domRenderer",vNodes)})),this._vPatch$=this._vNode$.pipe(operators_1.scan(function(nodePatch,vNode){return nodePatch.vpatch=vd.diff(nodePatch.vnode,vNode),nodePatch.vnode=vNode,nodePatch},{vnode:vd.h("div.domRenderer",[]),vpatch:null}),operators_1.pluck("vpatch")),this._element$=this._vPatch$.pipe(operators_1.scan(function(oldElement,vPatch){return vd.patch(oldElement,vPatch)},rootNode),operators_1.publishReplay(1),operators_1.refCount()),this._element$.subscribe(function(){}),this._renderService.size$.pipe(operators_1.map(function(size){return function(adaptive){return adaptive.elementWidth=size.width,adaptive.elementHeight=size.height,adaptive}})).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.pipe(operators_1.map(function(renderMode){return function(adaptive){return adaptive.renderMode=renderMode,adaptive}})).subscribe(this._adaptiveOperation$)}return Object.defineProperty(DOMRenderer.prototype,"element$",{get:function(){return this._element$},enumerable:!0,configurable:!0}),Object.defineProperty(DOMRenderer.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),Object.defineProperty(DOMRenderer.prototype,"renderAdaptive$",{get:function(){return this._renderAdaptive$},enumerable:!0,configurable:!0}),DOMRenderer.prototype.clear=function(name){this._renderAdaptive$.next({name:name,vnode:null}),this._render$.next({name:name,vnode:null})},DOMRenderer}();exports.DOMRenderer=DOMRenderer,exports.default=DOMRenderer},{"../Render":349,rxjs:89,"rxjs/operators":285,underscore:292,"virtual-dom":296}],463:[function(require,module,exports){"use strict";var GLRenderStage;Object.defineProperty(exports,"__esModule",{value:!0}),function(GLRenderStage){GLRenderStage[GLRenderStage.Background=0]="Background",GLRenderStage[GLRenderStage.Foreground=1]="Foreground"}(GLRenderStage=exports.GLRenderStage||(exports.GLRenderStage={})),exports.default=GLRenderStage},{}],464:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),rxjs_1=require("rxjs"),Render_1=require("../Render"),Utils_1=require("../Utils"),operators_1=require("rxjs/operators"),GLRenderer=function(){function GLRenderer(canvasContainer,renderService,dom){var _this=this;this._renderFrame$=new rxjs_1.Subject,this._renderCameraOperation$=new rxjs_1.Subject,this._render$=new rxjs_1.Subject,this._clear$=new rxjs_1.Subject,this._renderOperation$=new rxjs_1.Subject,this._rendererOperation$=new rxjs_1.Subject,this._eraserOperation$=new rxjs_1.Subject,this._renderService=renderService,this._dom=dom||new Utils_1.DOM,this._renderer$=this._rendererOperation$.pipe(operators_1.scan(function(renderer,operation){return operation(renderer)},{needsRender:!1,renderer:null})),this._renderCollection$=this._renderOperation$.pipe(operators_1.scan(function(hashes,operation){return operation(hashes)},{}),operators_1.share()),this._renderCamera$=this._renderCameraOperation$.pipe(operators_1.scan(function(rc,operation){return operation(rc)},{frameId:-1,needsRender:!1,perspective:null})),this._eraser$=this._eraserOperation$.pipe(operators_1.startWith(function(eraser){return eraser}),operators_1.scan(function(eraser,operation){return operation(eraser)},{needsRender:!1})),rxjs_1.combineLatest([this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$],function(renderer,hashes,rc,eraser){return{camera:rc,eraser:eraser,renderer:renderer,renders:Object.keys(hashes).map(function(key){return hashes[key]})}}).pipe(operators_1.filter(function(co){for(var needsRender=co.renderer.needsRender||co.camera.needsRender||co.eraser.needsRender,frameId=co.camera.frameId,_i=0,_a=co.renders;_i<_a.length;_i++){var render=_a[_i];if(render.frameId!==frameId)return!1;needsRender=needsRender||render.needsRender}return needsRender}),operators_1.distinctUntilChanged(function(n1,n2){return n1===n2},function(co){return co.eraser.needsRender?-1:co.camera.frameId})).subscribe(function(co){co.renderer.needsRender=!1,co.camera.needsRender=!1,co.eraser.needsRender=!1;for(var perspectiveCamera=co.camera.perspective,backgroundRenders=[],foregroundRenders=[],_i=0,_a=co.renders;_i<_a.length;_i++){(render=_a[_i]).stage===Render_1.GLRenderStage.Background?backgroundRenders.push(render.render):render.stage===Render_1.GLRenderStage.Foreground&&foregroundRenders.push(render.render)}var renderer=co.renderer.renderer;renderer.clear();for(var _b=0,backgroundRenders_1=backgroundRenders;_b<backgroundRenders_1.length;_b++){(render=backgroundRenders_1[_b])(perspectiveCamera,renderer)}renderer.clearDepth();for(var _c=0,foregroundRenders_1=foregroundRenders;_c<foregroundRenders_1.length;_c++){var render;(render=foregroundRenders_1[_c])(perspectiveCamera,renderer)}}),this._renderFrame$.pipe(operators_1.map(function(rc){return function(irc){return irc.frameId=rc.frameId,irc.perspective=rc.perspective,!0===rc.changed&&(irc.needsRender=!0),irc}})).subscribe(this._renderCameraOperation$),this._renderFrameSubscribe();var renderHash$=this._render$.pipe(operators_1.map(function(hash){return function(hashes){return hashes[hash.name]=hash.render,hashes}})),clearHash$=this._clear$.pipe(operators_1.map(function(name){return function(hashes){return delete hashes[name],hashes}}));rxjs_1.merge(renderHash$,clearHash$).subscribe(this._renderOperation$),this._webGLRenderer$=this._render$.pipe(operators_1.first(),operators_1.map(function(hash){var canvas=_this._dom.createElement("canvas","Beeview-js-canvas");canvas.style.position="absolute",canvas.setAttribute("tabindex","0"),canvasContainer.appendChild(canvas);var element=renderService.element,webGLRenderer=new THREE.WebGLRenderer({canvas:canvas});return webGLRenderer.setPixelRatio(window.devicePixelRatio),webGLRenderer.setSize(element.offsetWidth,element.offsetHeight),webGLRenderer.setClearColor(new THREE.Color(2105376),1),webGLRenderer.autoClear=!1,webGLRenderer}),operators_1.publishReplay(1),operators_1.refCount()),this._webGLRenderer$.subscribe(function(){});var createRenderer$=this._webGLRenderer$.pipe(operators_1.first(),operators_1.map(function(webGLRenderer){return function(renderer){return renderer.needsRender=!0,renderer.renderer=webGLRenderer,renderer}})),resizeRenderer$=this._renderService.size$.pipe(operators_1.map(function(size){return function(renderer){return null==renderer.renderer||(renderer.renderer.setSize(size.width,size.height),renderer.needsRender=!0),renderer}})),clearRenderer$=this._clear$.pipe(operators_1.map(function(name){return function(renderer){return null==renderer.renderer||(renderer.needsRender=!0),renderer}}));rxjs_1.merge(createRenderer$,resizeRenderer$,clearRenderer$).subscribe(this._rendererOperation$);var renderCollectionEmpty$=this._renderCollection$.pipe(operators_1.filter(function(hashes){return 0===Object.keys(hashes).length}),operators_1.share());renderCollectionEmpty$.subscribe(function(hashes){null!=_this._renderFrameSubscription&&(_this._renderFrameSubscription.unsubscribe(),_this._renderFrameSubscription=null,_this._renderFrameSubscribe())}),renderCollectionEmpty$.pipe(operators_1.map(function(hashes){return function(eraser){return eraser.needsRender=!0,eraser}})).subscribe(this._eraserOperation$)}return Object.defineProperty(GLRenderer.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),Object.defineProperty(GLRenderer.prototype,"webGLRenderer$",{get:function(){return this._webGLRenderer$},enumerable:!0,configurable:!0}),GLRenderer.prototype.clear=function(name){this._clear$.next(name)},GLRenderer.prototype._renderFrameSubscribe=function(){var _this=this;this._render$.pipe(operators_1.first(),operators_1.map(function(renderHash){return function(irc){return irc.needsRender=!0,irc}})).subscribe(function(operation){_this._renderCameraOperation$.next(operation)}),this._renderFrameSubscription=this._render$.pipe(operators_1.first(),operators_1.mergeMap(function(hash){return _this._renderService.renderCameraFrame$})).subscribe(this._renderFrame$)},GLRenderer}();exports.GLRenderer=GLRenderer,exports.default=GLRenderer},{"../Render":349,"../Utils":353,rxjs:89,"rxjs/operators":285,three:288}],465:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),Geo_1=require("../Geo"),Render_1=require("../Render"),RenderCamera=function(){function RenderCamera(elementWidth,elementHeight,renderMode){this.alpha=-1,this.zoom=0,this._frameId=-1,this._changed=!1,this._changedForFrame=-1,this.currentAspect=1,this.currentPano=!1,this.previousAspect=1,this.previousPano=!1,this.renderMode=renderMode,this._spatial=new Geo_1.Spatial,this._camera=new Geo_1.Camera;var perspectiveCameraAspect=this._getPerspectiveCameraAspect(elementWidth,elementHeight);this._perspective=new THREE.PerspectiveCamera(50,perspectiveCameraAspect,.4,1e4),this._perspective.matrixAutoUpdate=!1,this._rotation={phi:0,theta:0}}return Object.defineProperty(RenderCamera.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(RenderCamera.prototype,"changed",{get:function(){return this.frameId===this._changedForFrame},enumerable:!0,configurable:!0}),Object.defineProperty(RenderCamera.prototype,"frameId",{get:function(){return this._frameId},set:function(value){this._frameId=value,this._changed&&(this._changed=!1,this._changedForFrame=value)},enumerable:!0,configurable:!0}),Object.defineProperty(RenderCamera.prototype,"perspective",{get:function(){return this._perspective},enumerable:!0,configurable:!0}),Object.defineProperty(RenderCamera.prototype,"rotation",{get:function(){return this._rotation},enumerable:!0,configurable:!0}),RenderCamera.prototype.updateAspect=function(elementWidth,elementHeight){var perspectiveCameraAspect=this._getPerspectiveCameraAspect(elementWidth,elementHeight);this._perspective.aspect=perspectiveCameraAspect,this._changed=!0},RenderCamera.prototype.updateProjection=function(){var currentAspect=this._getAspect(this.currentAspect,this.currentPano,this.perspective.aspect),previousAspect=this._getAspect(this.previousAspect,this.previousPano,this.perspective.aspect),aspect=(1-this.alpha)*previousAspect+this.alpha*currentAspect,verticalFov=this._getVerticalFov(aspect,this._camera.focal,this.zoom);this._perspective.fov=verticalFov,this._perspective.updateProjectionMatrix(),this._changed=!0},RenderCamera.prototype.updatePerspective=function(camera){this._perspective.up.copy(camera.up),this._perspective.position.copy(camera.position),this._perspective.lookAt(camera.lookat),this._perspective.updateMatrix(),this._perspective.updateMatrixWorld(!1),this._changed=!0},RenderCamera.prototype.updateRotation=function(camera){this._rotation=this._getRotation(camera)},RenderCamera.prototype._getVerticalFov=function(aspect,focal,zoom){return 2*Math.atan(.5/(Math.pow(2,zoom)*aspect*focal))*180/Math.PI},RenderCamera.prototype._getAspect=function(nodeAspect,pano,perspectiveCameraAspect){if(pano)return 1;var coeff=Math.max(1,1/nodeAspect);return(this.renderMode===Render_1.RenderMode.Letterbox?perspectiveCameraAspect<nodeAspect:nodeAspect<perspectiveCameraAspect)?coeff*perspectiveCameraAspect:coeff*nodeAspect},RenderCamera.prototype._getPerspectiveCameraAspect=function(elementWidth,elementHeight){return 0===elementWidth?0:elementWidth/elementHeight},RenderCamera.prototype._getRotation=function(camera){var direction=camera.lookat.clone().sub(camera.position),up=camera.up.clone(),upProjection=direction.clone().dot(up),planeProjection=direction.clone().sub(up.clone().multiplyScalar(upProjection));return{phi:Math.atan2(planeProjection.y,planeProjection.x),theta:Math.PI/2-this._spatial.angleToPlane(direction.toArray(),[0,0,1])}},RenderCamera}();exports.RenderCamera=RenderCamera,exports.default=RenderCamera},{"../Geo":346,"../Render":349,three:288}],466:[function(require,module,exports){"use strict";var RenderMode;Object.defineProperty(exports,"__esModule",{value:!0}),function(RenderMode){RenderMode[RenderMode.Letterbox=0]="Letterbox",RenderMode[RenderMode.Fill=1]="Fill"}(RenderMode=exports.RenderMode||(exports.RenderMode={})),exports.default=RenderMode},{}],467:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Geo_1=require("../Geo"),Render_1=require("../Render"),operators_1=require("rxjs/operators"),RenderService=function(){function RenderService(element,currentFrame$,renderMode){var _this=this;this._element=element,this._currentFrame$=currentFrame$,this._spatial=new Geo_1.Spatial,renderMode=null!=renderMode?renderMode:Render_1.RenderMode.Fill,this._resize$=new rxjs_1.Subject,this._renderCameraOperation$=new rxjs_1.Subject,this._size$=new rxjs_1.BehaviorSubject({height:this._element.offsetHeight,width:this._element.offsetWidth}),this._resize$.pipe(operators_1.map(function(){return{height:_this._element.offsetHeight,width:_this._element.offsetWidth}})).subscribe(this._size$),this._renderMode$=new rxjs_1.BehaviorSubject(renderMode),this._renderCameraHolder$=this._renderCameraOperation$.pipe(operators_1.startWith(function(rc){return rc}),operators_1.scan(function(rc,operation){return operation(rc)},new Render_1.RenderCamera(this._element.offsetWidth,this._element.offsetHeight,renderMode)),operators_1.publishReplay(1),operators_1.refCount()),this._renderCameraFrame$=this._currentFrame$.pipe(operators_1.withLatestFrom(this._renderCameraHolder$,function(frame,renderCamera){return[frame,renderCamera]}),operators_1.tap(function(args){var frame=args[0],rc=args[1],camera=frame.state.camera;if(rc.alpha!==frame.state.alpha||rc.zoom!==frame.state.zoom||1e-9<rc.camera.diff(camera)){var currentTransform=frame.state.currentTransform,previousTransform=null!=frame.state.previousTransform?frame.state.previousTransform:frame.state.currentTransform,previousNode=null!=frame.state.previousNode?frame.state.previousNode:frame.state.currentNode;rc.currentAspect=currentTransform.basicAspect,rc.currentPano=frame.state.currentNode.pano,rc.previousAspect=previousTransform.basicAspect,rc.previousPano=previousNode.pano,rc.alpha=frame.state.alpha,rc.zoom=frame.state.zoom,rc.camera.copy(camera),rc.updatePerspective(camera),rc.updateRotation(camera),rc.updateProjection()}rc.frameId=frame.id}),operators_1.map(function(args){return args[1]}),operators_1.publishReplay(1),operators_1.refCount()),this._renderCamera$=this._renderCameraFrame$.pipe(operators_1.filter(function(rc){return rc.changed}),operators_1.publishReplay(1),operators_1.refCount()),this._bearing$=this._renderCamera$.pipe(operators_1.map(function(renderCamera){var bearing=_this._spatial.radToDeg(_this._spatial.azimuthalToBearing(renderCamera.rotation.phi));return _this._spatial.wrap(bearing,0,360)}),operators_1.publishReplay(1),operators_1.refCount()),this._size$.pipe(operators_1.skip(1),operators_1.map(function(size){return function(rc){return rc.updateAspect(size.width,size.height),rc.updateProjection(),rc}})).subscribe(this._renderCameraOperation$),this._renderMode$.pipe(operators_1.skip(1),operators_1.map(function(rm){return function(rc){return rc.renderMode=rm,rc.updateProjection(),rc}})).subscribe(this._renderCameraOperation$),this._bearing$.subscribe(function(){}),this._renderCameraHolder$.subscribe(function(){}),this._size$.subscribe(function(){}),this._renderMode$.subscribe(function(){}),this._renderCamera$.subscribe(function(){}),this._renderCameraFrame$.subscribe(function(){})}return Object.defineProperty(RenderService.prototype,"bearing$",{get:function(){return this._bearing$},enumerable:!0,configurable:!0}),Object.defineProperty(RenderService.prototype,"element",{get:function(){return this._element},enumerable:!0,configurable:!0}),Object.defineProperty(RenderService.prototype,"resize$",{get:function(){return this._resize$},enumerable:!0,configurable:!0}),Object.defineProperty(RenderService.prototype,"size$",{get:function(){return this._size$},enumerable:!0,configurable:!0}),Object.defineProperty(RenderService.prototype,"renderMode$",{get:function(){return this._renderMode$},enumerable:!0,configurable:!0}),Object.defineProperty(RenderService.prototype,"renderCameraFrame$",{get:function(){return this._renderCameraFrame$},enumerable:!0,configurable:!0}),Object.defineProperty(RenderService.prototype,"renderCamera$",{get:function(){return this._renderCamera$},enumerable:!0,configurable:!0}),RenderService}();exports.RenderService=RenderService,exports.default=RenderService},{"../Geo":346,"../Render":349,rxjs:89,"rxjs/operators":285}],468:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var FrameGenerator=function(){function FrameGenerator(root){root.requestAnimationFrame?(this._cancelAnimationFrame=root.cancelAnimationFrame.bind(root),this._requestAnimationFrame=root.requestAnimationFrame.bind(root)):root.mozRequestAnimationFrame?(this._cancelAnimationFrame=root.mozCancelAnimationFrame.bind(root),this._requestAnimationFrame=root.mozRequestAnimationFrame.bind(root)):root.webkitRequestAnimationFrame?(this._cancelAnimationFrame=root.webkitCancelAnimationFrame.bind(root),this._requestAnimationFrame=root.webkitRequestAnimationFrame.bind(root)):root.msRequestAnimationFrame?(this._cancelAnimationFrame=root.msCancelAnimationFrame.bind(root),this._requestAnimationFrame=root.msRequestAnimationFrame.bind(root)):root.oRequestAnimationFrame?(this._cancelAnimationFrame=root.oCancelAnimationFrame.bind(root),this._requestAnimationFrame=root.oRequestAnimationFrame.bind(root)):(this._cancelAnimationFrame=root.clearTimeout.bind(root),this._requestAnimationFrame=function(cb){return root.setTimeout(cb,1e3/60)})}return Object.defineProperty(FrameGenerator.prototype,"cancelAnimationFrame",{get:function(){return this._cancelAnimationFrame},enumerable:!0,configurable:!0}),Object.defineProperty(FrameGenerator.prototype,"requestAnimationFrame",{get:function(){return this._requestAnimationFrame},enumerable:!0,configurable:!0}),FrameGenerator}();exports.FrameGenerator=FrameGenerator,exports.default=FrameGenerator},{}],469:[function(require,module,exports){"use strict";var State;Object.defineProperty(exports,"__esModule",{value:!0}),function(State){State[State.Traversing=0]="Traversing",State[State.Waiting=1]="Waiting"}(State=exports.State||(exports.State={})),exports.default=State},{}],470:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var State_1=require("../State"),Geo_1=require("../Geo"),StateContext=function(){function StateContext(){this._state=new State_1.TraversingState({alpha:1,camera:new Geo_1.Camera,currentIndex:-1,reference:{alt:0,lat:0,lon:0},trajectory:[],zoom:0})}return StateContext.prototype.traverse=function(){this._state=this._state.traverse()},StateContext.prototype.wait=function(){this._state=this._state.wait()},Object.defineProperty(StateContext.prototype,"state",{get:function(){if(this._state instanceof State_1.TraversingState)return State_1.State.Traversing;if(this._state instanceof State_1.WaitingState)return State_1.State.Waiting;throw new Error("Invalid state")},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"reference",{get:function(){return this._state.reference},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"alpha",{get:function(){return this._state.alpha},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"camera",{get:function(){return this._state.camera},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"zoom",{get:function(){return this._state.zoom},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"currentNode",{get:function(){return this._state.currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"previousNode",{get:function(){return this._state.previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"currentCamera",{get:function(){return this._state.currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"currentTransform",{get:function(){return this._state.currentTransform},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"previousTransform",{get:function(){return this._state.previousTransform},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"trajectory",{get:function(){return this._state.trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"currentIndex",{get:function(){return this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"lastNode",{get:function(){return this._state.trajectory[this._state.trajectory.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"nodesAhead",{get:function(){return this._state.trajectory.length-1-this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(StateContext.prototype,"motionless",{get:function(){return this._state.motionless},enumerable:!0,configurable:!0}),StateContext.prototype.getCenter=function(){return this._state.getCenter()},StateContext.prototype.setCenter=function(center){this._state.setCenter(center)},StateContext.prototype.setZoom=function(zoom){this._state.setZoom(zoom)},StateContext.prototype.update=function(fps){this._state.update(fps)},StateContext.prototype.append=function(nodes){this._state.append(nodes)},StateContext.prototype.prepend=function(nodes){this._state.prepend(nodes)},StateContext.prototype.remove=function(n){this._state.remove(n)},StateContext.prototype.clear=function(){this._state.clear()},StateContext.prototype.clearPrior=function(){this._state.clearPrior()},StateContext.prototype.cut=function(){this._state.cut()},StateContext.prototype.set=function(nodes){this._state.set(nodes)},StateContext.prototype.rotate=function(delta){this._state.rotate(delta)},StateContext.prototype.rotateBasic=function(basicRotation){this._state.rotateBasic(basicRotation)},StateContext.prototype.rotateBasicUnbounded=function(basicRotation){this._state.rotateBasicUnbounded(basicRotation)},StateContext.prototype.rotateBasicWithoutInertia=function(basicRotation){this._state.rotateBasicWithoutInertia(basicRotation)},StateContext.prototype.rotateToBasic=function(basic){this._state.rotateToBasic(basic)},StateContext.prototype.move=function(delta){this._state.move(delta)},StateContext.prototype.moveTo=function(delta){this._state.moveTo(delta)},StateContext.prototype.zoomIn=function(delta,reference){this._state.zoomIn(delta,reference)},StateContext}();exports.StateContext=StateContext},{"../Geo":346,"../State":350}],471:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),State_1=require("../State"),operators_1=require("rxjs/operators"),StateService=function(){function StateService(){var _this=this;this._appendNode$=new rxjs_1.Subject,this._start$=new rxjs_1.Subject,this._frame$=new rxjs_1.Subject,this._fpsSampleRate=30,this._contextOperation$=new rxjs_1.BehaviorSubject(function(context){return context}),this._context$=this._contextOperation$.pipe(operators_1.scan(function(context,operation){return operation(context)},new State_1.StateContext),operators_1.publishReplay(1),operators_1.refCount()),this._state$=this._context$.pipe(operators_1.map(function(context){return context.state}),operators_1.distinctUntilChanged(),operators_1.publishReplay(1),operators_1.refCount()),this._fps$=this._start$.pipe(operators_1.switchMap(function(){return _this._frame$.pipe(operators_1.bufferCount(1,_this._fpsSampleRate),operators_1.map(function(frameIds){return(new Date).getTime()}),operators_1.pairwise(),operators_1.map(function(times){return Math.max(20,1e3*_this._fpsSampleRate/(times[1]-times[0]))}),operators_1.startWith(60))}),operators_1.share()),this._currentState$=this._frame$.pipe(operators_1.withLatestFrom(this._fps$,this._context$,function(frameId,fps,context){return[frameId,fps,context]}),operators_1.filter(function(fc){return null!=fc[2].currentNode}),operators_1.tap(function(fc){fc[2].update(fc[1])}),operators_1.map(function(fc){return{fps:fc[1],id:fc[0],state:fc[2]}}),operators_1.share()),this._lastState$=this._currentState$.pipe(operators_1.publishReplay(1),operators_1.refCount());var nodeChanged$=this._currentState$.pipe(operators_1.distinctUntilChanged(void 0,function(f){return f.state.currentNode.key}),operators_1.publishReplay(1),operators_1.refCount()),nodeChangedSubject$=new rxjs_1.Subject;nodeChanged$.subscribe(nodeChangedSubject$),this._currentKey$=new rxjs_1.BehaviorSubject(null),nodeChangedSubject$.pipe(operators_1.map(function(f){return f.state.currentNode.key})).subscribe(this._currentKey$),this._currentNode$=nodeChangedSubject$.pipe(operators_1.map(function(f){return f.state.currentNode}),operators_1.publishReplay(1),operators_1.refCount()),this._currentCamera$=nodeChangedSubject$.pipe(operators_1.map(function(f){return f.state.currentCamera}),operators_1.publishReplay(1),operators_1.refCount()),this._currentTransform$=nodeChangedSubject$.pipe(operators_1.map(function(f){return f.state.currentTransform}),operators_1.publishReplay(1),operators_1.refCount()),this._reference$=nodeChangedSubject$.pipe(operators_1.map(function(f){return f.state.reference}),operators_1.distinctUntilChanged(function(r1,r2){return r1.lat===r2.lat&&r1.lon===r2.lon},function(reference){return{lat:reference.lat,lon:reference.lon}}),operators_1.publishReplay(1),operators_1.refCount()),this._currentNodeExternal$=nodeChanged$.pipe(operators_1.map(function(f){return f.state.currentNode}),operators_1.publishReplay(1),operators_1.refCount()),this._appendNode$.pipe(operators_1.map(function(node){return function(context){return context.append([node]),context}})).subscribe(this._contextOperation$),this._inMotionOperation$=new rxjs_1.Subject,nodeChanged$.pipe(operators_1.map(function(frame){return!0})).subscribe(this._inMotionOperation$),this._inMotionOperation$.pipe(operators_1.distinctUntilChanged(),operators_1.filter(function(moving){return moving}),operators_1.switchMap(function(moving){return _this._currentState$.pipe(operators_1.filter(function(frame){return 0===frame.state.nodesAhead}),operators_1.map(function(frame){return[frame.state.camera.clone(),frame.state.zoom]}),operators_1.pairwise(),operators_1.map(function(pair){var c1=pair[0][0],c2=pair[1][0],z1=pair[0][1],z2=pair[1][1];return 1e-5<c1.diff(c2)||1e-5<Math.abs(z1-z2)}),operators_1.first(function(changed){return!changed}))})).subscribe(this._inMotionOperation$),this._inMotion$=this._inMotionOperation$.pipe(operators_1.distinctUntilChanged(),operators_1.publishReplay(1),operators_1.refCount()),this._inTranslationOperation$=new rxjs_1.Subject,nodeChanged$.pipe(operators_1.map(function(frame){return!0})).subscribe(this._inTranslationOperation$),this._inTranslationOperation$.pipe(operators_1.distinctUntilChanged(),operators_1.filter(function(inTranslation){return inTranslation}),operators_1.switchMap(function(inTranslation){return _this._currentState$.pipe(operators_1.filter(function(frame){return 0===frame.state.nodesAhead}),operators_1.map(function(frame){return frame.state.camera.position.clone()}),operators_1.pairwise(),operators_1.map(function(pair){return 0!==pair[0].distanceToSquared(pair[1])}),operators_1.first(function(changed){return!changed}))})).subscribe(this._inTranslationOperation$),this._inTranslation$=this._inTranslationOperation$.pipe(operators_1.distinctUntilChanged(),operators_1.publishReplay(1),operators_1.refCount()),this._state$.subscribe(function(){}),this._currentNode$.subscribe(function(){}),this._currentCamera$.subscribe(function(){}),this._currentTransform$.subscribe(function(){}),this._reference$.subscribe(function(){}),this._currentNodeExternal$.subscribe(function(){}),this._lastState$.subscribe(function(){}),this._inMotion$.subscribe(function(){}),this._inTranslation$.subscribe(function(){}),this._frameId=null,this._frameGenerator=new State_1.FrameGenerator(window)}return Object.defineProperty(StateService.prototype,"currentState$",{get:function(){return this._currentState$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"currentNode$",{get:function(){return this._currentNode$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"currentKey$",{get:function(){return this._currentKey$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"currentNodeExternal$",{get:function(){return this._currentNodeExternal$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"currentCamera$",{get:function(){return this._currentCamera$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"currentTransform$",{get:function(){return this._currentTransform$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"state$",{get:function(){return this._state$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"reference$",{get:function(){return this._reference$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"inMotion$",{get:function(){return this._inMotion$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"inTranslation$",{get:function(){return this._inTranslation$},enumerable:!0,configurable:!0}),Object.defineProperty(StateService.prototype,"appendNode$",{get:function(){return this._appendNode$},enumerable:!0,configurable:!0}),StateService.prototype.traverse=function(){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.traverse()})},StateService.prototype.wait=function(){this._invokeContextOperation(function(context){context.wait()})},StateService.prototype.appendNodes=function(nodes){this._invokeContextOperation(function(context){context.append(nodes)})},StateService.prototype.prependNodes=function(nodes){this._invokeContextOperation(function(context){context.prepend(nodes)})},StateService.prototype.removeNodes=function(n){this._invokeContextOperation(function(context){context.remove(n)})},StateService.prototype.clearNodes=function(){this._invokeContextOperation(function(context){context.clear()})},StateService.prototype.clearPriorNodes=function(){this._invokeContextOperation(function(context){context.clearPrior()})},StateService.prototype.cutNodes=function(){this._invokeContextOperation(function(context){context.cut()})},StateService.prototype.setNodes=function(nodes){this._invokeContextOperation(function(context){context.set(nodes)})},StateService.prototype.rotate=function(delta){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.rotate(delta)})},StateService.prototype.rotateBasic=function(basicRotation){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.rotateBasic(basicRotation)})},StateService.prototype.rotateBasicUnbounded=function(basicRotation){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.rotateBasicUnbounded(basicRotation)})},StateService.prototype.rotateBasicWithoutInertia=function(basicRotation){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.rotateBasicWithoutInertia(basicRotation)})},StateService.prototype.rotateToBasic=function(basic){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.rotateToBasic(basic)})},StateService.prototype.move=function(delta){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.move(delta)})},StateService.prototype.moveTo=function(position){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.moveTo(position)})},StateService.prototype.zoomIn=function(delta,reference){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.zoomIn(delta,reference)})},StateService.prototype.getCenter=function(){return this._lastState$.pipe(operators_1.first(),operators_1.map(function(frame){return frame.state.getCenter()}))},StateService.prototype.getZoom=function(){return this._lastState$.pipe(operators_1.first(),operators_1.map(function(frame){return frame.state.zoom}))},StateService.prototype.setCenter=function(center){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.setCenter(center)})},StateService.prototype.setZoom=function(zoom){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(context){context.setZoom(zoom)})},StateService.prototype.start=function(){null==this._frameId&&(this._start$.next(null),this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId))},StateService.prototype.stop=function(){null!=this._frameId&&(this._frameGenerator.cancelAnimationFrame(this._frameId),this._frameId=null)},StateService.prototype._invokeContextOperation=function(action){this._contextOperation$.next(function(context){return action(context),context})},StateService.prototype._frame=function(time){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId)},StateService}();exports.StateService=StateService},{"../State":350,rxjs:89,"rxjs/operators":285}],472:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Error_1=require("../../Error"),Geo_1=require("../../Geo"),StateBase=function(){function StateBase(state){this._spatial=new Geo_1.Spatial,this._geoCoords=new Geo_1.GeoCoords,this._referenceThreshold=.01,this._reference=state.reference,this._alpha=state.alpha,this._camera=state.camera.clone(),this._zoom=state.zoom,this._currentIndex=state.currentIndex,this._trajectory=state.trajectory.slice(),this._trajectoryTransforms=[],this._trajectoryCameras=[];for(var _i=0,_a=this._trajectory;_i<_a.length;_i++){var node=_a[_i],translation=this._nodeToTranslation(node),transform=new Geo_1.Transform(node,node.image,translation);this._trajectoryTransforms.push(transform),this._trajectoryCameras.push(new Geo_1.Camera(transform))}this._currentNode=0<this._trajectory.length?this._trajectory[this._currentIndex]:null,this._previousNode=1<this._trajectory.length&&0<this.currentIndex?this._trajectory[this._currentIndex-1]:null,this._currentCamera=0<this._trajectoryCameras.length?this._trajectoryCameras[this._currentIndex].clone():new Geo_1.Camera,this._previousCamera=1<this._trajectoryCameras.length&&0<this.currentIndex?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}return Object.defineProperty(StateBase.prototype,"reference",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"alpha",{get:function(){return this._getAlpha()},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"zoom",{get:function(){return this._zoom},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"trajectory",{get:function(){return this._trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"currentIndex",{get:function(){return this._currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"currentNode",{get:function(){return this._currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"previousNode",{get:function(){return this._previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"currentCamera",{get:function(){return this._currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"currentTransform",{get:function(){return 0<this._trajectoryTransforms.length?this._trajectoryTransforms[this.currentIndex]:null},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"previousTransform",{get:function(){return 1<this._trajectoryTransforms.length&&0<this.currentIndex?this._trajectoryTransforms[this.currentIndex-1]:null},enumerable:!0,configurable:!0}),Object.defineProperty(StateBase.prototype,"motionless",{get:function(){return this._motionless},enumerable:!0,configurable:!0}),StateBase.prototype.append=function(nodes){if(nodes.length<1)throw Error("Trajectory can not be empty");this._currentIndex<0?this.set(nodes):(this._trajectory=this._trajectory.concat(nodes),this._appendToTrajectories(nodes))},StateBase.prototype.prepend=function(nodes){if(nodes.length<1)throw Error("Trajectory can not be empty");this._trajectory=nodes.slice().concat(this._trajectory),this._currentIndex+=nodes.length,this._setCurrentNode(),this._setReference(this._currentNode)?this._setTrajectories():this._prependToTrajectories(nodes),this._setCurrentCamera()},StateBase.prototype.remove=function(n){if(n<0)throw Error("n must be a positive integer");if(this._currentIndex-1<n)throw Error("Current and previous nodes can not be removed");for(var i=0;i<n;i++)this._trajectory.shift(),this._trajectoryTransforms.shift(),this._trajectoryCameras.shift(),this._currentIndex--;this._setCurrentNode()},StateBase.prototype.clearPrior=function(){0<this._currentIndex&&this.remove(this._currentIndex-1)},StateBase.prototype.clear=function(){this.cut(),0<this._currentIndex&&this.remove(this._currentIndex-1)},StateBase.prototype.cut=function(){for(;this._trajectory.length-1>this._currentIndex;)this._trajectory.pop(),this._trajectoryTransforms.pop(),this._trajectoryCameras.pop()},StateBase.prototype.set=function(nodes){this._setTrajectory(nodes),this._setCurrentNode(),this._setReference(this._currentNode),this._setTrajectories(),this._setCurrentCamera()},StateBase.prototype.getCenter=function(){return null!=this._currentNode?this.currentTransform.projectBasic(this._camera.lookat.toArray()):[.5,.5]},StateBase.prototype._setCurrent=function(){this._setCurrentNode(),this._setReference(this._currentNode)&&this._setTrajectories(),this._setCurrentCamera()},StateBase.prototype._setCurrentCamera=function(){this._currentCamera=this._trajectoryCameras[this._currentIndex].clone(),this._previousCamera=0<this._currentIndex?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()},StateBase.prototype._motionlessTransition=function(){return null!=this._currentNode&&null!=this._previousNode&&!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent())},StateBase.prototype._setReference=function(node){return!(Math.abs(node.latLon.lat-this.reference.lat)<this._referenceThreshold&&Math.abs(node.latLon.lon-this.reference.lon)<this._referenceThreshold)&&(!(null!=this._previousNode&&!this._motionlessTransition())&&(this._reference.lat=node.latLon.lat,this._reference.lon=node.latLon.lon,this._reference.alt=node.alt,!0))},StateBase.prototype._setCurrentNode=function(){this._currentNode=0<this._trajectory.length?this._trajectory[this._currentIndex]:null,this._previousNode=0<this._currentIndex?this._trajectory[this._currentIndex-1]:null},StateBase.prototype._setTrajectory=function(nodes){if(nodes.length<1)throw new Error_1.ArgumentBeeviewError("Trajectory can not be empty");null!=this._currentNode?(this._trajectory=[this._currentNode].concat(nodes),this._currentIndex=1):(this._trajectory=nodes.slice(),this._currentIndex=0)},StateBase.prototype._setTrajectories=function(){this._trajectoryTransforms.length=0,this._trajectoryCameras.length=0,this._appendToTrajectories(this._trajectory)},StateBase.prototype._appendToTrajectories=function(nodes){for(var _i=0,nodes_1=nodes;_i<nodes_1.length;_i++){var node=nodes_1[_i];if(!node.assetsCached)throw new Error_1.ArgumentBeeviewError("Assets must be cached when node is added to trajectory");var translation=this._nodeToTranslation(node),transform=new Geo_1.Transform(node,node.image,translation);this._trajectoryTransforms.push(transform),this._trajectoryCameras.push(new Geo_1.Camera(transform))}},StateBase.prototype._prependToTrajectories=function(nodes){for(var _i=0,_a=nodes.reverse();_i<_a.length;_i++){var node=_a[_i];if(!node.assetsCached)throw new Error_1.ArgumentBeeviewError("Assets must be cached when added to trajectory");var translation=this._nodeToTranslation(node),transform=new Geo_1.Transform(node,node.image,translation);this._trajectoryTransforms.unshift(transform),this._trajectoryCameras.unshift(new Geo_1.Camera(transform))}},StateBase.prototype._nodeToTranslation=function(node){var C=this._geoCoords.geodeticToEnu(node.latLon.lat,node.latLon.lon,node.alt,this._reference.lat,this._reference.lon,this._reference.alt),RC=this._spatial.rotate(C,node.rotation);return[-RC.x,-RC.y,-RC.z]},StateBase.prototype._sameConnectedComponent=function(){var current=this._currentNode,previous=this._previousNode;return!(current&¤t.mergeCC&&previous&&previous.mergeCC)||current.mergeCC===previous.mergeCC},StateBase.prototype._withinOriginalDistance=function(){var current=this._currentNode,previous=this._previousNode;return!current||!previous||this._spatial.distanceFromLatLon(current.originalLatLon.lat,current.originalLatLon.lon,previous.originalLatLon.lat,previous.originalLatLon.lon)<25},StateBase}();exports.StateBase=StateBase},{"../../Error":345,"../../Geo":346}],473:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),UnitBezier=require("@mapbox/unitbezier"),State_1=require("../../State"),RotationDelta=function(){function RotationDelta(phi,theta){this._phi=phi,this._theta=theta}return Object.defineProperty(RotationDelta.prototype,"phi",{get:function(){return this._phi},set:function(value){this._phi=value},enumerable:!0,configurable:!0}),Object.defineProperty(RotationDelta.prototype,"theta",{get:function(){return this._theta},set:function(value){this._theta=value},enumerable:!0,configurable:!0}),Object.defineProperty(RotationDelta.prototype,"isZero",{get:function(){return 0===this._phi&&0===this._theta},enumerable:!0,configurable:!0}),RotationDelta.prototype.copy=function(delta){this._phi=delta.phi,this._theta=delta.theta},RotationDelta.prototype.lerp=function(other,alpha){this._phi=(1-alpha)*this._phi+alpha*other.phi,this._theta=(1-alpha)*this._theta+alpha*other.theta},RotationDelta.prototype.multiply=function(value){this._phi*=value,this._theta*=value},RotationDelta.prototype.threshold=function(value){this._phi=Math.abs(this._phi)>value?this._phi:0,this._theta=Math.abs(this._theta)>value?this._theta:0},RotationDelta.prototype.lengthSquared=function(){return this._phi*this._phi+this._theta*this._theta},RotationDelta.prototype.reset=function(){this._phi=0,this._theta=0},RotationDelta}(),TraversingState=function(_super){function TraversingState(state){var _this=_super.call(this,state)||this;return _this._adjustCameras(),_this._motionless=_this._motionlessTransition(),_this._baseAlpha=_this._alpha,_this._animationSpeed=.025,_this._unitBezier=new UnitBezier(.74,.67,.38,.96),_this._useBezier=!1,_this._rotationDelta=new RotationDelta(0,0),_this._requestedRotationDelta=null,_this._basicRotation=[0,0],_this._requestedBasicRotation=null,_this._requestedBasicRotationUnbounded=null,_this._rotationAcceleration=.86,_this._rotationIncreaseAlpha=.97,_this._rotationDecreaseAlpha=.9,_this._rotationThreshold=.001,_this._unboundedRotationAlpha=.8,_this._desiredZoom=state.zoom,_this._minZoom=0,_this._maxZoom=3,_this._lookatDepth=10,_this._desiredLookat=null,_this._desiredCenter=null,_this}return __extends(TraversingState,_super),TraversingState.prototype.traverse=function(){throw new Error("Not implemented")},TraversingState.prototype.wait=function(){return new State_1.WaitingState(this)},TraversingState.prototype.append=function(nodes){var emptyTrajectory=0===this._trajectory.length;emptyTrajectory&&this._resetTransition(),_super.prototype.append.call(this,nodes),emptyTrajectory&&(this._setDesiredCenter(),this._setDesiredZoom())},TraversingState.prototype.prepend=function(nodes){var emptyTrajectory=0===this._trajectory.length;emptyTrajectory&&this._resetTransition(),_super.prototype.prepend.call(this,nodes),emptyTrajectory&&(this._setDesiredCenter(),this._setDesiredZoom())},TraversingState.prototype.set=function(nodes){_super.prototype.set.call(this,nodes),this._desiredLookat=null,this._resetTransition(),this._clearRotation(),this._setDesiredCenter(),this._setDesiredZoom(),this._trajectory.length<3&&(this._useBezier=!0)},TraversingState.prototype.move=function(delta){throw new Error("Not implemented")},TraversingState.prototype.moveTo=function(delta){throw new Error("Not implemented")},TraversingState.prototype.rotate=function(rotationDelta){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,(this._requestedBasicRotation=null)!=this._requestedRotationDelta?(this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+rotationDelta.phi,this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+rotationDelta.theta):this._requestedRotationDelta=new RotationDelta(rotationDelta.phi,rotationDelta.theta))},TraversingState.prototype.rotateBasic=function(basicRotation){if(null!=this._currentNode)if(this._desiredZoom=this._zoom,this._desiredLookat=null,(this._requestedRotationDelta=null)!=this._requestedBasicRotation){this._requestedBasicRotation[0]+=basicRotation[0],this._requestedBasicRotation[1]+=basicRotation[1];var threshold=.05/Math.pow(2,this._zoom);this._requestedBasicRotation[0]=this._spatial.clamp(this._requestedBasicRotation[0],-threshold,threshold),this._requestedBasicRotation[1]=this._spatial.clamp(this._requestedBasicRotation[1],-threshold,threshold)}else this._requestedBasicRotation=basicRotation.slice()},TraversingState.prototype.rotateBasicUnbounded=function(basicRotation){null!=this._currentNode&&(null!=this._requestedBasicRotationUnbounded?(this._requestedBasicRotationUnbounded[0]+=basicRotation[0],this._requestedBasicRotationUnbounded[1]+=basicRotation[1]):this._requestedBasicRotationUnbounded=basicRotation.slice())},TraversingState.prototype.rotateBasicWithoutInertia=function(basic){if(null!=this._currentNode){this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null;var threshold=.05/Math.pow(2,this._zoom),basicRotation=basic.slice();basicRotation[0]=this._spatial.clamp(basicRotation[0],-threshold,threshold),basicRotation[1]=this._spatial.clamp(basicRotation[1],-threshold,threshold),this._applyRotationBasic(basicRotation)}},TraversingState.prototype.rotateToBasic=function(basic){if(null!=this._currentNode){this._desiredZoom=this._zoom,this._desiredLookat=null,basic[0]=this._spatial.clamp(basic[0],0,1),basic[1]=this._spatial.clamp(basic[1],0,1);var lookat=this.currentTransform.unprojectBasic(basic,this._lookatDepth);this._currentCamera.lookat.fromArray(lookat)}},TraversingState.prototype.zoomIn=function(delta,reference){if(null!=this._currentNode){this._desiredZoom=Math.max(this._minZoom,Math.min(this._maxZoom,this._desiredZoom+delta));var currentCenter=this.currentTransform.projectBasic(this._currentCamera.lookat.toArray()),currentCenterX=currentCenter[0],currentCenterY=currentCenter[1],zoom0=Math.pow(2,this._zoom),zoom1=Math.pow(2,this._desiredZoom),refX=reference[0],refY=reference[1];null!=this.currentTransform.gpano&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels&&(.5<refX-currentCenterX?refX-=1:.5<currentCenterX-refX&&(refX=1+refX));var newCenterX=refX-zoom0/zoom1*(refX-currentCenterX),newCenterY=refY-zoom0/zoom1*(refY-currentCenterY),gpano=this.currentTransform.gpano;newCenterY=this._currentNode.fullPano?(newCenterX=this._spatial.wrap(newCenterX+this._basicRotation[0],0,1),this._spatial.clamp(newCenterY+this._basicRotation[1],.05,.95)):null!=gpano&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels?(newCenterX=this._spatial.wrap(newCenterX+this._basicRotation[0],0,1),this._spatial.clamp(newCenterY+this._basicRotation[1],0,1)):(newCenterX=this._spatial.clamp(newCenterX,0,1),this._spatial.clamp(newCenterY,0,1)),this._desiredLookat=(new THREE.Vector3).fromArray(this.currentTransform.unprojectBasic([newCenterX,newCenterY],this._lookatDepth))}},TraversingState.prototype.setCenter=function(center){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._desiredZoom=this._zoom;var clamped=[this._spatial.clamp(center[0],0,1),this._spatial.clamp(center[1],0,1)];if(null!=this._currentNode){this._desiredCenter=null;var currentLookat=(new THREE.Vector3).fromArray(this.currentTransform.unprojectBasic(clamped,this._lookatDepth)),previousTransform=null!=this.previousTransform?this.previousTransform:this.currentTransform,previousLookat=(new THREE.Vector3).fromArray(previousTransform.unprojectBasic(clamped,this._lookatDepth));this._currentCamera.lookat.copy(currentLookat),this._previousCamera.lookat.copy(previousLookat)}else this._desiredCenter=clamped},TraversingState.prototype.setZoom=function(zoom){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._zoom=this._spatial.clamp(zoom,this._minZoom,this._maxZoom),this._desiredZoom=this._zoom},TraversingState.prototype.update=function(fps){1===this._alpha&&this._currentIndex+this._alpha<this._trajectory.length&&(this._currentIndex+=1,this._useBezier=this._trajectory.length<3&&this._currentIndex+1===this._trajectory.length,this._setCurrent(),this._resetTransition(),this._clearRotation(),this._desiredZoom=this._currentNode.fullPano?this._zoom:0,this._desiredLookat=null);var animationSpeed=this._animationSpeed*(60/fps);this._baseAlpha=Math.min(1,this._baseAlpha+animationSpeed),this._useBezier?this._alpha=this._unitBezier.solve(this._baseAlpha):this._alpha=this._baseAlpha,this._updateRotation(),this._rotationDelta.isZero||(this._applyRotation(this._previousCamera),this._applyRotation(this._currentCamera)),this._updateRotationBasic(),0===this._basicRotation[0]&&0===this._basicRotation[1]||this._applyRotationBasic(this._basicRotation),this._updateZoom(animationSpeed),this._updateLookat(animationSpeed),this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},TraversingState.prototype._getAlpha=function(){return this._motionless?Math.ceil(this._alpha):this._alpha},TraversingState.prototype._setCurrentCamera=function(){_super.prototype._setCurrentCamera.call(this),this._adjustCameras()},TraversingState.prototype._adjustCameras=function(){if(null!=this._previousNode){var lookat=this._camera.lookat.clone().sub(this._camera.position);this._previousCamera.lookat.copy(lookat.clone().add(this._previousCamera.position)),this._currentNode.fullPano&&this._currentCamera.lookat.copy(lookat.clone().add(this._currentCamera.position))}},TraversingState.prototype._resetTransition=function(){this._alpha=0,this._baseAlpha=0,this._motionless=this._motionlessTransition()},TraversingState.prototype._applyRotation=function(camera){if(null!=camera){var q=(new THREE.Quaternion).setFromUnitVectors(camera.up,new THREE.Vector3(0,0,1)),qInverse=q.clone().inverse(),offset=new THREE.Vector3;offset.copy(camera.lookat).sub(camera.position),offset.applyQuaternion(q);var length=offset.length(),phi=Math.atan2(offset.y,offset.x);phi+=this._rotationDelta.phi;var theta=Math.atan2(Math.sqrt(offset.x*offset.x+offset.y*offset.y),offset.z);theta+=this._rotationDelta.theta,theta=Math.max(.1,Math.min(Math.PI-.1,theta)),offset.x=Math.sin(theta)*Math.cos(phi),offset.y=Math.sin(theta)*Math.sin(phi),offset.z=Math.cos(theta),offset.applyQuaternion(qInverse),camera.lookat.copy(camera.position).add(offset.multiplyScalar(length))}},TraversingState.prototype._applyRotationBasic=function(basicRotation){var currentNode=this._currentNode,previousNode=null!=this._previousNode?this.previousNode:this.currentNode,currentCamera=this._currentCamera,previousCamera=this._previousCamera,currentTransform=this.currentTransform,previousTransform=null!=this.previousTransform?this.previousTransform:this.currentTransform,currentBasic=currentTransform.projectBasic(currentCamera.lookat.toArray()),previousBasic=previousTransform.projectBasic(previousCamera.lookat.toArray()),currentGPano=currentTransform.gpano,previousGPano=previousTransform.gpano;currentNode.fullPano?(currentBasic[0]=this._spatial.wrap(currentBasic[0]+basicRotation[0],0,1),currentBasic[1]=this._spatial.clamp(currentBasic[1]+basicRotation[1],.05,.95)):(null!=currentGPano&¤tTransform.gpano.CroppedAreaImageWidthPixels===currentTransform.gpano.FullPanoWidthPixels?currentBasic[0]=this._spatial.wrap(currentBasic[0]+basicRotation[0],0,1):currentBasic[0]=this._spatial.clamp(currentBasic[0]+basicRotation[0],0,1),currentBasic[1]=this._spatial.clamp(currentBasic[1]+basicRotation[1],0,1)),previousNode.fullPano?(previousBasic[0]=this._spatial.wrap(previousBasic[0]+basicRotation[0],0,1),previousBasic[1]=this._spatial.clamp(previousBasic[1]+basicRotation[1],.05,.95)):null!=previousGPano&&previousTransform.gpano.CroppedAreaImageWidthPixels===previousTransform.gpano.FullPanoWidthPixels?(previousBasic[0]=this._spatial.wrap(previousBasic[0]+basicRotation[0],0,1),previousBasic[1]=this._spatial.clamp(previousBasic[1]+basicRotation[1],0,1)):(previousBasic[0]=this._spatial.clamp(previousBasic[0]+basicRotation[0],0,1),previousBasic[1]=this._spatial.clamp(currentBasic[1]+basicRotation[1],0,1));var currentLookat=currentTransform.unprojectBasic(currentBasic,this._lookatDepth);currentCamera.lookat.fromArray(currentLookat);var previousLookat=previousTransform.unprojectBasic(previousBasic,this._lookatDepth);previousCamera.lookat.fromArray(previousLookat)},TraversingState.prototype._updateZoom=function(animationSpeed){var diff=this._desiredZoom-this._zoom,sign=0<diff?1:diff<0?-1:0;0!=diff&&(Math.abs(diff)<.002?(this._zoom=this._desiredZoom,null!=this._desiredLookat&&(this._desiredLookat=null)):this._zoom+=sign*Math.max(Math.abs(5*animationSpeed*diff),.002))},TraversingState.prototype._updateLookat=function(animationSpeed){if(null!==this._desiredLookat){var diff=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);Math.abs(diff)<1e-6?(this._currentCamera.lookat.copy(this._desiredLookat),this._desiredLookat=null):this._currentCamera.lookat.lerp(this._desiredLookat,5*animationSpeed)}},TraversingState.prototype._updateRotation=function(){if(null!=this._requestedRotationDelta)return this._rotationDelta.lengthSquared()<this._requestedRotationDelta.lengthSquared()?this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationIncreaseAlpha):this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationDecreaseAlpha),void(this._requestedRotationDelta=null);this._rotationDelta.isZero||(this._rotationDelta.multiply(this._rotationAcceleration),this._rotationDelta.threshold(this._rotationThreshold))},TraversingState.prototype._updateRotationBasic=function(){if(null!=this._requestedBasicRotation){var x=this._basicRotation[0],y=this._basicRotation[1],reqX=this._requestedBasicRotation[0],reqY=this._requestedBasicRotation[1];return Math.abs(reqX)>Math.abs(x)?this._basicRotation[0]=(1-this._rotationIncreaseAlpha)*x+this._rotationIncreaseAlpha*reqX:this._basicRotation[0]=(1-this._rotationDecreaseAlpha)*x+this._rotationDecreaseAlpha*reqX,Math.abs(reqY)>Math.abs(y)?this._basicRotation[1]=(1-this._rotationIncreaseAlpha)*y+this._rotationIncreaseAlpha*reqY:this._basicRotation[1]=(1-this._rotationDecreaseAlpha)*y+this._rotationDecreaseAlpha*reqY,void(this._requestedBasicRotation=null)}if(null!=this._requestedBasicRotationUnbounded){reqX=this._requestedBasicRotationUnbounded[0],reqY=this._requestedBasicRotationUnbounded[1];if(0<Math.abs(reqX)&&(this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*reqX),0<Math.abs(reqY)&&(this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*reqY),null!=this._desiredLookat){var desiredBasicLookat=this.currentTransform.projectBasic(this._desiredLookat.toArray());desiredBasicLookat[0]+=reqX,desiredBasicLookat[1]+=reqY,this._desiredLookat=(new THREE.Vector3).fromArray(this.currentTransform.unprojectBasic(desiredBasicLookat,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}0===this._basicRotation[0]&&0===this._basicRotation[1]||(this._basicRotation[0]=this._rotationAcceleration*this._basicRotation[0],this._basicRotation[1]=this._rotationAcceleration*this._basicRotation[1],Math.abs(this._basicRotation[0])<this._rotationThreshold/Math.pow(2,this._zoom)&&Math.abs(this._basicRotation[1])<this._rotationThreshold/Math.pow(2,this._zoom)&&(this._basicRotation=[0,0]))},TraversingState.prototype._clearRotation=function(){this._currentNode.fullPano||(null!=this._requestedRotationDelta&&(this._requestedRotationDelta=null),this._rotationDelta.isZero||this._rotationDelta.reset(),null!=this._requestedBasicRotation&&(this._requestedBasicRotation=null),(0<this._basicRotation[0]||0<this._basicRotation[1])&&(this._basicRotation=[0,0]))},TraversingState.prototype._setDesiredCenter=function(){if(null!=this._desiredCenter){var lookatDirection=(new THREE.Vector3).fromArray(this.currentTransform.unprojectBasic(this._desiredCenter,this._lookatDepth)).sub(this._currentCamera.position);this._currentCamera.lookat.copy(this._currentCamera.position.clone().add(lookatDirection)),this._previousCamera.lookat.copy(this._previousCamera.position.clone().add(lookatDirection)),this._desiredCenter=null}},TraversingState.prototype._setDesiredZoom=function(){this._desiredZoom=this._currentNode.fullPano||null==this._previousNode?this._zoom:0},TraversingState}(State_1.StateBase);exports.TraversingState=TraversingState},{"../../State":350,"@mapbox/unitbezier":2,three:288}],474:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var State_1=require("../../State"),WaitingState=function(_super){function WaitingState(state){var _this=_super.call(this,state)||this;return _this._zoom=0,_this._adjustCameras(),_this._motionless=_this._motionlessTransition(),_this}return __extends(WaitingState,_super),WaitingState.prototype.traverse=function(){return new State_1.TraversingState(this)},WaitingState.prototype.wait=function(){throw new Error("Not implemented")},WaitingState.prototype.prepend=function(nodes){_super.prototype.prepend.call(this,nodes),this._motionless=this._motionlessTransition()},WaitingState.prototype.set=function(nodes){_super.prototype.set.call(this,nodes),this._motionless=this._motionlessTransition()},WaitingState.prototype.rotate=function(delta){},WaitingState.prototype.rotateBasic=function(basicRotation){},WaitingState.prototype.rotateBasicUnbounded=function(basicRotation){},WaitingState.prototype.rotateBasicWithoutInertia=function(basicRotation){},WaitingState.prototype.rotateToBasic=function(basic){},WaitingState.prototype.zoomIn=function(delta,reference){},WaitingState.prototype.move=function(delta){this._alpha=Math.max(0,Math.min(1,this._alpha+delta))},WaitingState.prototype.moveTo=function(position){this._alpha=Math.max(0,Math.min(1,position))},WaitingState.prototype.update=function(fps){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},WaitingState.prototype.setCenter=function(center){},WaitingState.prototype.setZoom=function(zoom){},WaitingState.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha},WaitingState.prototype._setCurrentCamera=function(){_super.prototype._setCurrentCamera.call(this),this._adjustCameras()},WaitingState.prototype._adjustCameras=function(){if(null!=this._previousNode){if(this._currentNode.fullPano){var lookat=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(lookat.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){lookat=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(lookat.clone().add(this._previousCamera.position))}}},WaitingState}(State_1.StateBase);exports.WaitingState=WaitingState},{"../../State":350}],475:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),ImageTileLoader=function(){function ImageTileLoader(scheme,host,origin){this._scheme=scheme,this._host=host,this._origin=null!=origin?"?origin="+origin:""}return ImageTileLoader.prototype.getTile=function(identifier,x,y,w,h,scaledW,scaledH){var characteristics="/"+identifier+"/"+x+","+y+","+w+","+h+"/"+scaledW+","+scaledH+"/0/default.jpg",url=this._scheme+"://"+this._host+characteristics+this._origin,xmlHTTP=null;return[rxjs_1.Observable.create(function(subscriber){(xmlHTTP=new XMLHttpRequest).open("GET",url,!0),xmlHTTP.custom&&xmlHTTP.custom.xhr&&(xmlHTTP=xmlHTTP.custom.xhr),xmlHTTP.responseType="arraybuffer",xmlHTTP.timeout=15e3,xmlHTTP.onload=function(event){if(200===xmlHTTP.status){var image=new Image;image.crossOrigin="Anonymous",image.onload=function(e){subscriber.next(image),subscriber.complete()},image.onerror=function(error){subscriber.error(new Error("Failed to load tile image ("+identifier+": "+x+","+y+","+w+","+h+")"))};var blob=new Blob([xmlHTTP.response]);image.src=window.URL.createObjectURL(blob)}else subscriber.error(new Error("Failed to fetch tile ("+identifier+": "+x+","+y+","+w+","+h+"). Status: "+xmlHTTP.status+", "+xmlHTTP.statusText))},xmlHTTP.onerror=function(error){subscriber.error(new Error("Failed to fetch tile ("+identifier+": "+x+","+y+","+w+","+h+")"))},xmlHTTP.ontimeout=function(error){subscriber.error(new Error("Tile request timed out ("+identifier+": "+x+","+y+","+w+","+h+")"))},xmlHTTP.onabort=function(event){subscriber.error(new Error("Tile request was aborted ("+identifier+": "+x+","+y+","+w+","+h+")"))},xmlHTTP.send(null)}),function(){null!=xmlHTTP&&xmlHTTP.abort()}]},ImageTileLoader}();exports.ImageTileLoader=ImageTileLoader,exports.default=ImageTileLoader},{rxjs:89}],476:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ImageTileStore=function(){function ImageTileStore(){this._images={}}return ImageTileStore.prototype.addImage=function(image,key,level){level in this._images||(this._images[level]={}),this._images[level][key]=image},ImageTileStore.prototype.dispose=function(){for(var _i=0,_a=Object.keys(this._images);_i<_a.length;_i++){for(var level=_a[_i],levelImages=this._images[level],_b=0,_c=Object.keys(levelImages);_b<_c.length;_b++){var key=_c[_b];window.URL.revokeObjectURL(levelImages[key].src),delete levelImages[key]}delete this._images[level]}},ImageTileStore.prototype.getImage=function(key,level){return this._images[level][key]},ImageTileStore.prototype.hasImage=function(key,level){return level in this._images&&key in this._images[level]},ImageTileStore}();exports.ImageTileStore=ImageTileStore,exports.default=ImageTileStore},{}],477:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Geo_1=require("../Geo"),RegionOfInterestCalculator=function(){function RegionOfInterestCalculator(){this._viewportCoords=new Geo_1.ViewportCoords}return RegionOfInterestCalculator.prototype.computeRegionOfInterest=function(renderCamera,size,transform){var viewportBoundaryPoints=this._viewportBoundaryPoints(4),bbox=this._viewportPointsBoundingBox(viewportBoundaryPoints,renderCamera,transform);this._clipBoundingBox(bbox);var viewportPixelWidth=2/size.width,viewportPixelHeight=2/size.height,centralViewportPixel=[[-.5*viewportPixelWidth,.5*viewportPixelHeight],[.5*viewportPixelWidth,.5*viewportPixelHeight],[.5*viewportPixelWidth,-.5*viewportPixelHeight],[-.5*viewportPixelWidth,-.5*viewportPixelHeight]],cpbox=this._viewportPointsBoundingBox(centralViewportPixel,renderCamera,transform);return{bbox:bbox,pixelHeight:cpbox.maxY-cpbox.minY,pixelWidth:cpbox.maxX-cpbox.minX+(cpbox.minX<cpbox.maxX?0:1)}},RegionOfInterestCalculator.prototype._viewportBoundaryPoints=function(pointsPerSide){for(var points=[],os=[[-1,1],[1,1],[1,-1],[-1,-1]],ds=[[2,0],[0,-2],[-2,0],[0,2]],side=0;side<4;++side)for(var o=os[side],d=ds[side],i=0;i<pointsPerSide;++i)points.push([o[0]+d[0]*i/pointsPerSide,o[1]+d[1]*i/pointsPerSide]);return points},RegionOfInterestCalculator.prototype._viewportPointsBoundingBox=function(viewportPoints,renderCamera,transform){var _this=this,basicPoints=viewportPoints.map(function(point){return _this._viewportCoords.viewportToBasic(point[0],point[1],transform,renderCamera.perspective)});return null!=transform.gpano?this._boundingBoxPano(basicPoints):this._boundingBox(basicPoints)},RegionOfInterestCalculator.prototype._boundingBox=function(points){for(var bbox={maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY},i=0;i<points.length;++i)bbox.minX=Math.min(bbox.minX,points[i][0]),bbox.maxX=Math.max(bbox.maxX,points[i][0]),bbox.minY=Math.min(bbox.minY,points[i][1]),bbox.maxY=Math.max(bbox.maxY,points[i][1]);return bbox},RegionOfInterestCalculator.prototype._boundingBoxPano=function(points){for(var _this=this,xs=[],ys=[],i=0;i<points.length;++i)xs.push(points[i][0]),ys.push(points[i][1]);xs.sort(function(a,b){return _this._sign(a-b)}),ys.sort(function(a,b){return _this._sign(a-b)});var intervalX=this._intervalPano(xs);return{maxX:intervalX[1],maxY:ys[ys.length-1],minX:intervalX[0],minY:ys[0]}},RegionOfInterestCalculator.prototype._intervalPano=function(xs){for(var maxdx=0,maxi=-1,i=0;i<xs.length-1;++i){var dx=xs[i+1]-xs[i];maxdx<dx&&(maxdx=dx,maxi=i)}return maxdx<xs[0]+1-xs[xs.length-1]?[xs[0],xs[xs.length-1]]:[xs[maxi+1],xs[maxi]]},RegionOfInterestCalculator.prototype._clipBoundingBox=function(bbox){bbox.minX=Math.max(0,Math.min(1,bbox.minX)),bbox.maxX=Math.max(0,Math.min(1,bbox.maxX)),bbox.minY=Math.max(0,Math.min(1,bbox.minY)),bbox.maxY=Math.max(0,Math.min(1,bbox.maxY))},RegionOfInterestCalculator.prototype._sign=function(n){return 0<n?1:n<0?-1:0},RegionOfInterestCalculator}();exports.RegionOfInterestCalculator=RegionOfInterestCalculator,exports.default=RegionOfInterestCalculator},{"../Geo":346}],478:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),TextureProvider=function(){function TextureProvider(key,width,height,tileSize,background,imageTileLoader,imageTileStore,renderer){this._disposed=!1,this._key=key,(width<=0||height<=0)&&console.warn("Original image size ("+width+", "+height+") is invalid ("+key+"). Tiles will not be loaded."),this._width=width,this._height=height,this._maxLevel=Math.ceil(Math.log(Math.max(height,width))/Math.log(2)),this._currentLevel=-1,this._tileSize=tileSize,this._updated$=new rxjs_1.Subject,this._createdSubject$=new rxjs_1.Subject,this._created$=this._createdSubject$.pipe(operators_1.publishReplay(1),operators_1.refCount()),this._createdSubscription=this._created$.subscribe(function(){}),this._hasSubject$=new rxjs_1.Subject,this._has$=this._hasSubject$.pipe(operators_1.startWith(!1),operators_1.publishReplay(1),operators_1.refCount()),this._hasSubscription=this._has$.subscribe(function(){}),this._abortFunctions=[],this._tileSubscriptions={},this._renderedCurrentLevelTiles={},this._renderedTiles={},this._background=background,this._camera=null,this._imageTileLoader=imageTileLoader,this._imageTileStore=imageTileStore,this._renderer=renderer,this._renderTarget=null,this._roi=null}return Object.defineProperty(TextureProvider.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(TextureProvider.prototype,"hasTexture$",{get:function(){return this._has$},enumerable:!0,configurable:!0}),Object.defineProperty(TextureProvider.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(TextureProvider.prototype,"textureUpdated$",{get:function(){return this._updated$},enumerable:!0,configurable:!0}),Object.defineProperty(TextureProvider.prototype,"textureCreated$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),TextureProvider.prototype.abort=function(){for(var key in this._tileSubscriptions)this._tileSubscriptions.hasOwnProperty(key)&&this._tileSubscriptions[key].unsubscribe();this._tileSubscriptions={};for(var _i=0,_a=this._abortFunctions;_i<_a.length;_i++){(0,_a[_i])()}this._abortFunctions=[]},TextureProvider.prototype.dispose=function(){this._disposed?console.warn("Texture already disposed ("+this._key+")"):(this.abort(),null!=this._renderTarget&&(this._renderTarget.dispose(),this._renderTarget=null),this._imageTileStore.dispose(),this._imageTileStore=null,this._background=null,this._camera=null,this._imageTileLoader=null,this._renderer=null,this._roi=null,this._createdSubscription.unsubscribe(),this._hasSubscription.unsubscribe(),this._disposed=!0)},TextureProvider.prototype.setRegionOfInterest=function(roi){if(!(this._width<=0||this._height<=0)){this._roi=roi;var width=1/this._roi.pixelWidth,height=1/this._roi.pixelHeight,size=Math.max(height,width),currentLevel=Math.max(0,Math.min(this._maxLevel,Math.ceil(Math.log(size)/Math.log(2))));if(currentLevel!==this._currentLevel){this.abort(),this._currentLevel=currentLevel,this._currentLevel in this._renderedTiles||(this._renderedTiles[this._currentLevel]=[]),this._renderedCurrentLevelTiles={};for(var _i=0,_a=this._renderedTiles[this._currentLevel];_i<_a.length;_i++){var tile=_a[_i];this._renderedCurrentLevelTiles[this._tileKey(this._tileSize,tile)]=!0}}var topLeft=this._getTileCoords([this._roi.bbox.minX,this._roi.bbox.minY]),bottomRight=this._getTileCoords([this._roi.bbox.maxX,this._roi.bbox.maxY]),tiles=this._getTiles(topLeft,bottomRight);if(null==this._camera){this._camera=new THREE.OrthographicCamera(-this._width/2,this._width/2,this._height/2,-this._height/2,-1,1),this._camera.position.z=1;var gl=this._renderer.getContext(),maxTextureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE),backgroundSize=Math.max(this._width,this._height),scale=backgroundSize<maxTextureSize?1:maxTextureSize/backgroundSize,targetWidth=Math.floor(scale*this._width),targetHeight=Math.floor(scale*this._height);this._renderTarget=new THREE.WebGLRenderTarget(targetWidth,targetHeight,{depthBuffer:!1,format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter,stencilBuffer:!1}),this._renderToTarget(0,0,this._width,this._height,this._background),this._createdSubject$.next(this._renderTarget.texture),this._hasSubject$.next(!0)}this._fetchTiles(tiles)}},TextureProvider.prototype.setTileSize=function(tileSize){this._tileSize=tileSize},TextureProvider.prototype.updateBackground=function(background){this._background=background},TextureProvider.prototype._fetchTile=function(tile,level,x,y,w,h,scaledX,scaledY){var _this=this,getTile=this._imageTileLoader.getTile(this._key,x,y,w,h,scaledX,scaledY),tile$=getTile[0],abort=getTile[1];this._abortFunctions.push(abort);var tileKey=this._tileKey(this._tileSize,tile),subscription=tile$.subscribe(function(image){_this._renderToTarget(x,y,w,h,image),_this._removeFromDictionary(tileKey,_this._tileSubscriptions),_this._removeFromArray(abort,_this._abortFunctions),_this._setTileRendered(tile,_this._currentLevel),_this._imageTileStore.addImage(image,tileKey,level),_this._updated$.next(!0)},function(error){_this._removeFromDictionary(tileKey,_this._tileSubscriptions),_this._removeFromArray(abort,_this._abortFunctions),console.error(error)});subscription.closed||(this._tileSubscriptions[tileKey]=subscription)},TextureProvider.prototype._fetchTiles=function(tiles){for(var tileSize=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),_i=0,tiles_1=tiles;_i<tiles_1.length;_i++){var tile=tiles_1[_i],tileKey=this._tileKey(this._tileSize,tile);if(!(tileKey in this._renderedCurrentLevelTiles||tileKey in this._tileSubscriptions)){var tileX=tileSize*tile[0],tileY=tileSize*tile[1],tileWidth=tileX+tileSize>this._width?this._width-tileX:tileSize,tileHeight=tileY+tileSize>this._height?this._height-tileY:tileSize;if(this._imageTileStore.hasImage(tileKey,this._currentLevel))this._renderToTarget(tileX,tileY,tileWidth,tileHeight,this._imageTileStore.getImage(tileKey,this._currentLevel)),this._setTileRendered(tile,this._currentLevel),this._updated$.next(!0);else{var scaledX=Math.floor(tileWidth/tileSize*this._tileSize),scaledY=Math.floor(tileHeight/tileSize*this._tileSize);this._fetchTile(tile,this._currentLevel,tileX,tileY,tileWidth,tileHeight,scaledX,scaledY)}}}},TextureProvider.prototype._getTileCoords=function(point){var tileSize=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),maxX=Math.ceil(this._width/tileSize)-1,maxY=Math.ceil(this._height/tileSize)-1;return[Math.min(Math.floor(this._width*point[0]/tileSize),maxX),Math.min(Math.floor(this._height*point[1]/tileSize),maxY)]},TextureProvider.prototype._getTiles=function(topLeft,bottomRight){var xs=[];if(topLeft[0]>bottomRight[0]){for(var tileSize=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),maxX=Math.ceil(this._width/tileSize)-1,x=topLeft[0];x<=maxX;x++)xs.push(x);for(x=0;x<=bottomRight[0];x++)xs.push(x)}else for(x=topLeft[0];x<=bottomRight[0];x++)xs.push(x);for(var tiles=[],_i=0,xs_1=xs;_i<xs_1.length;_i++){x=xs_1[_i];for(var y=topLeft[1];y<=bottomRight[1];y++)tiles.push([x,y])}return tiles},TextureProvider.prototype._removeFromArray=function(item,array){var index=array.indexOf(item);-1!==index&&array.splice(index,1)},TextureProvider.prototype._removeFromDictionary=function(key,dict){key in dict&&delete dict[key]},TextureProvider.prototype._renderToTarget=function(x,y,w,h,image){var texture=new THREE.Texture(image);texture.minFilter=THREE.LinearFilter,texture.needsUpdate=!0;var geometry=new THREE.PlaneGeometry(w,h),material=new THREE.MeshBasicMaterial({map:texture,side:THREE.FrontSide}),mesh=new THREE.Mesh(geometry,material);mesh.position.x=-this._width/2+x+w/2,mesh.position.y=this._height/2-y-h/2;var scene=new THREE.Scene;scene.add(mesh),this._renderer.render(scene,this._camera,this._renderTarget),this._renderer.setRenderTarget(void 0),scene.remove(mesh),geometry.dispose(),material.dispose(),texture.dispose()},TextureProvider.prototype._setTileRendered=function(tile,level){for(var _i=0,otherLevels_1=Object.keys(this._renderedTiles).map(function(key){return parseInt(key,10)}).filter(function(renderedLevel){return renderedLevel!==level});_i<otherLevels_1.length;_i++){var otherLevel=otherLevels_1[_i],scale=Math.pow(2,otherLevel-level);if(otherLevel<level)for(var x=Math.floor(scale*tile[0]),y=Math.floor(scale*tile[1]),_a=0,_b=this._renderedTiles[otherLevel].slice();_a<_b.length;_a++){if((otherTile=_b[_a])[0]===x&&otherTile[1]===y){var index=this._renderedTiles[otherLevel].indexOf(otherTile);this._renderedTiles[otherLevel].splice(index,1)}}else for(var startX=scale*tile[0],endX=startX+scale-1,startY=scale*tile[1],endY=startY+scale-1,_c=0,_d=this._renderedTiles[otherLevel].slice();_c<_d.length;_c++){var otherTile;if((otherTile=_d[_c])[0]>=startX&&otherTile[0]<=endX&&otherTile[1]>=startY&&otherTile[1]<=endY){index=this._renderedTiles[otherLevel].indexOf(otherTile);this._renderedTiles[otherLevel].splice(index,1)}}0===this._renderedTiles[otherLevel].length&&delete this._renderedTiles[otherLevel]}this._renderedTiles[level].push(tile),this._renderedCurrentLevelTiles[this._tileKey(this._tileSize,tile)]=!0},TextureProvider.prototype._tileKey=function(tileSize,tile){return tileSize+"-"+tile[0]+"-"+tile[1]},TextureProvider}();exports.TextureProvider=TextureProvider,exports.default=TextureProvider},{rxjs:89,"rxjs/operators":285,three:288}],479:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var DOM=function(){function DOM(doc){this._document=doc||document}return Object.defineProperty(DOM.prototype,"document",{get:function(){return this._document},enumerable:!0,configurable:!0}),DOM.prototype.createElement=function(tagName,className,container){var element=this._document.createElement(tagName);return className&&(element.className=className),container&&container.appendChild(element),element},DOM}();exports.DOM=DOM,exports.default=DOM},{}],480:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EventEmitter=function(){function EventEmitter(){this._events={}}return EventEmitter.prototype.on=function(eventType,fn){this._events[eventType]=this._events[eventType]||[],this._events[eventType].push(fn)},EventEmitter.prototype.off=function(eventType,fn){if(eventType)if(this._listens(eventType))delete this._events[eventType];else{var idx=this._events[eventType].indexOf(fn);0<=idx&&this._events[eventType].splice(idx,1),this._events[eventType].length&&delete this._events[eventType]}else this._events={}},EventEmitter.prototype.fire=function(eventType,data){if(this._listens(eventType))for(var _i=0,_a=this._events[eventType];_i<_a.length;_i++){_a[_i].call(this,data)}},EventEmitter.prototype._listens=function(eventType){return!(!this._events||!this._events[eventType])},EventEmitter}();exports.EventEmitter=EventEmitter,exports.default=EventEmitter},{}],481:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Viewer_1=require("../Viewer"),Settings=function(){function Settings(){}return Settings.setOptions=function(options){Settings._baseImageSize=null!=options.baseImageSize?options.baseImageSize:Viewer_1.ImageSize.Size640,Settings._basePanoramaSize=null!=options.basePanoramaSize?options.basePanoramaSize:Viewer_1.ImageSize.Size2048,Settings._maxImageSize=null!=options.maxImageSize?options.maxImageSize:Viewer_1.ImageSize.Size2048},Object.defineProperty(Settings,"baseImageSize",{get:function(){return Settings._baseImageSize},enumerable:!0,configurable:!0}),Object.defineProperty(Settings,"basePanoramaSize",{get:function(){return Settings._basePanoramaSize},enumerable:!0,configurable:!0}),Object.defineProperty(Settings,"maxImageSize",{get:function(){return Settings._maxImageSize},enumerable:!0,configurable:!0}),Settings}();exports.Settings=Settings,exports.default=Settings},{"../Viewer":354}],482:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isBrowser=function(){return"undefined"!=typeof window&&"undefined"!=typeof document},exports.isArraySupported=function(){return!!(Array.prototype&&Array.prototype.filter&&Array.prototype.indexOf&&Array.prototype.map)},exports.isFunctionSupported=function(){return!(!Function.prototype||!Function.prototype.bind)},exports.isJSONSupported=function(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON},exports.isObjectSupported=function(){return!(!Object.keys||!Object.assign)};var isWebGLSupportedCache=void 0;function isWebGLSupported(){var webGLContextAttributes={alpha:!1,antialias:!1,depth:!0,failIfMajorPerformanceCaveat:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,stencil:!0},canvas=document.createElement("canvas"),context=canvas.getContext("webgl",webGLContextAttributes)||canvas.getContext("experimental-webgl",webGLContextAttributes);if(!context)return!1;for(var supportedExtensions=context.getSupportedExtensions(),_i=0,requiredExtensions_1=["OES_standard_derivatives"];_i<requiredExtensions_1.length;_i++){var requiredExtension=requiredExtensions_1[_i];if(-1===supportedExtensions.indexOf(requiredExtension))return!1}return!0}exports.isWebGLSupportedCached=function(){return void 0===isWebGLSupportedCache&&(isWebGLSupportedCache=isWebGLSupported()),isWebGLSupportedCache},exports.isWebGLSupported=isWebGLSupported},{}],483:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var visUrl="https://api-test.mapxus.com/vis",Urls=function(){function Urls(){}return Object.defineProperty(Urls,"tileScheme",{get:function(){return"https"},enumerable:!0,configurable:!0}),Object.defineProperty(Urls,"tileDomain",{get:function(){return"d2qb1440i7l50o.cloudfront.net"},enumerable:!0,configurable:!0}),Object.defineProperty(Urls,"origin",{get:function(){return"beeview.webgl"},enumerable:!0,configurable:!0}),Object.defineProperty(Urls,"authUrl",{get:function(){return"https://api-test.mapxus.com/bms/api/v1/user/verification"},enumerable:!0,configurable:!0}),Urls.thumbnail=function(key){return Urls.tileScheme+"://beeview-oss.mapxus.com/prod/public/thumbnails/"+key+".jpg?x-oss-process=style/test"},Urls.protoMesh=function(key){return visUrl+"/static/meshs/"+key},Urls.graphqlModel=function(){return visUrl+"/graphql"},Urls.fetchBuildings=function(){return visUrl+"/buildings"},Urls}();exports.Urls=Urls,exports.default=Urls},{}],484:[function(require,module,exports){"use strict";var Alignment;Object.defineProperty(exports,"__esModule",{value:!0}),function(Alignment){Alignment[Alignment.Bottom=0]="Bottom",Alignment[Alignment.BottomLeft=1]="BottomLeft",Alignment[Alignment.BottomRight=2]="BottomRight",Alignment[Alignment.Center=3]="Center",Alignment[Alignment.Left=4]="Left",Alignment[Alignment.Right=5]="Right",Alignment[Alignment.Top=6]="Top",Alignment[Alignment.TopLeft=7]="TopLeft",Alignment[Alignment.TopRight=8]="TopRight"}(Alignment=exports.Alignment||(exports.Alignment={})),exports.default=Alignment},{}],485:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var operators_1=require("rxjs/operators"),CacheService=function(){function CacheService(graphService,stateService){this._graphService=graphService,this._stateService=stateService,this._started=!1}return Object.defineProperty(CacheService.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),CacheService.prototype.start=function(){var _this=this;this._started||(this._uncacheSubscription=this._stateService.currentState$.pipe(operators_1.distinctUntilChanged(void 0,function(frame){return frame.state.currentNode.key}),operators_1.map(function(frame){return frame.state.trajectory.map(function(n){return n.key})}),operators_1.bufferCount(1,5),operators_1.switchMap(function(keepKeysBuffer){var keepKeys=keepKeysBuffer[0];return _this._graphService.uncache$(keepKeys)})).subscribe(function(){}),this._started=!0)},CacheService.prototype.stop=function(){this._started&&(this._uncacheSubscription.unsubscribe(),this._uncacheSubscription=null,this._started=!1)},CacheService}();exports.CacheService=CacheService,exports.default=CacheService},{"rxjs/operators":285}],486:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Component_1=require("../Component"),operators_1=require("rxjs/operators"),ComponentController=function(){function ComponentController(container,navigator,observer,key,options,componentService){var _this=this;this._container=container,this._observer=observer,this._navigator=navigator,this._options=null!=options?options:{},this._key=key,this._navigable=null==key,this._componentService=componentService||new Component_1.ComponentService(this._container,this._navigator),this._coverComponent=this._componentService.getCover(),this._initializeComponents(),key?(this._initilizeCoverComponent(),this._subscribeCoverComponent()):this._navigator.movedToKey$.pipe(operators_1.first(function(k){return null!=k})).subscribe(function(k){_this._key=k,_this._componentService.deactivateCover(),_this._coverComponent.configure({key:_this._key,state:Component_1.CoverState.Hidden}),_this._subscribeCoverComponent(),_this._navigator.stateService.start(),_this._observer.startEmit()})}return Object.defineProperty(ComponentController.prototype,"navigable",{get:function(){return this._navigable},enumerable:!0,configurable:!0}),ComponentController.prototype.get=function(name){return this._componentService.get(name)},ComponentController.prototype.activate=function(name){this._componentService.activate(name)},ComponentController.prototype.activateCover=function(){this._coverComponent.configure({state:Component_1.CoverState.Visible})},ComponentController.prototype.deactivate=function(name){this._componentService.deactivate(name)},ComponentController.prototype.deactivateCover=function(){this._coverComponent.configure({state:Component_1.CoverState.Loading})},ComponentController.prototype.resize=function(){this._componentService.resize()},ComponentController.prototype._initializeComponents=function(){var options=this._options;this._uFalse(options.background,"background"),this._uFalse(options.debug,"debug"),this._uFalse(options.image,"image"),this._uFalse(options.navigation,"navigation"),this._uFalse(options.popup,"popup"),this._uFalse(options.route,"route"),this._uFalse(options.slider,"slider"),this._uFalse(options.tag,"tag"),this._uFalse(options.sequence,"sequence"),this._uFalse(options.direction,"direction"),this._uFalse(options.marker,"marker"),this._uTrue(options.cache,"cache"),this._uTrue(options.path,"path"),this._uTrue(options.bearing,"bearing"),this._uTrue(options.imagePlane,"imagePlane"),this._uTrue(options.keyboard,"keyboard"),this._uTrue(options.loading,"loading"),this._uTrue(options.mouse,"mouse")},ComponentController.prototype._initilizeCoverComponent=function(){var options=this._options;this._coverComponent.configure({key:this._key}),void 0===options.cover||options.cover?this.activateCover():this.deactivateCover()},ComponentController.prototype._setNavigable=function(navigable){this._navigable!==navigable&&(this._navigable=navigable,this._observer.navigable$.next(navigable))},ComponentController.prototype._subscribeCoverComponent=function(){var _this=this;this._coverComponent.configuration$.subscribe(function(conf){conf.state===Component_1.CoverState.Loading?_this._navigator.stateService.currentKey$.pipe(operators_1.first(),operators_1.switchMap(function(key){var keyChanged=null==key||key!==conf.key;return keyChanged&&_this._setNavigable(!1),keyChanged?_this._navigator.moveToKey$(conf.key):_this._navigator.stateService.currentNode$.pipe(operators_1.first())})).subscribe(function(node){_this._navigator.stateService.start(),_this._observer.startEmit(),_this._coverComponent.configure({state:Component_1.CoverState.Hidden}),_this._componentService.deactivateCover(),_this._setNavigable(!0)},function(error){console.error("Failed to deactivate cover.",error),_this._coverComponent.configure({state:Component_1.CoverState.Visible})}):conf.state===Component_1.CoverState.Visible&&(_this._observer.stopEmit(),_this._navigator.stateService.stop(),_this._componentService.activateCover(),_this._setNavigable(null==conf.key))})},ComponentController.prototype._uFalse=function(option,name){void 0!==option?"boolean"!=typeof option?(this._componentService.configure(name,option),this._componentService.activate(name)):option?this._componentService.activate(name):this._componentService.deactivate(name):this._componentService.deactivate(name)},ComponentController.prototype._uTrue=function(option,name){void 0!==option?"boolean"!=typeof option?(this._componentService.configure(name,option),this._componentService.activate(name)):option?this._componentService.activate(name):this._componentService.deactivate(name):this._componentService.activate(name)},ComponentController}();exports.ComponentController=ComponentController},{"../Component":343,"rxjs/operators":285}],487:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Render_1=require("../Render"),Utils_1=require("../Utils"),Viewer_1=require("../Viewer"),Container=function(){function Container(id,stateService,options,dom){if(this.id=id,this._dom=dom||new Utils_1.DOM,this._container=this._dom.document.getElementById(id),!this._container)throw new Error("Container '"+id+"' not found.");this._container.classList.add("beeview-js"),this._canvasContainer=this._dom.createElement("div","beeview-js-interactive",this._container),this._domContainer=this._dom.createElement("div","beeview-js-dom",this._container),this.renderService=new Render_1.RenderService(this._container,stateService.currentState$,options.renderMode),this.glRenderer=new Render_1.GLRenderer(this._canvasContainer,this.renderService,this._dom),this.domRenderer=new Render_1.DOMRenderer(this._domContainer,this.renderService,stateService.currentState$),this.keyboardService=new Viewer_1.KeyboardService(this._canvasContainer),this.mouseService=new Viewer_1.MouseService(this._container,this._canvasContainer,this._domContainer,document),this.touchService=new Viewer_1.TouchService(this._canvasContainer,this._domContainer),this.spriteService=new Viewer_1.SpriteService(options.sprite)}return Object.defineProperty(Container.prototype,"element",{get:function(){return this._container},enumerable:!0,configurable:!0}),Object.defineProperty(Container.prototype,"canvasContainer",{get:function(){return this._canvasContainer},enumerable:!0,configurable:!0}),Container}();exports.Container=Container,exports.default=Container},{"../Render":349,"../Utils":353,"../Viewer":354}],488:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(ImageSize){ImageSize[ImageSize.Size320=320]="Size320",ImageSize[ImageSize.Size640=640]="Size640",ImageSize[ImageSize.Size1024=1024]="Size1024",ImageSize[ImageSize.Size2048=2048]="Size2048"}(exports.ImageSize||(exports.ImageSize={}))},{}],489:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),KeyboardService=function(){function KeyboardService(canvasContainer){this._keyDown$=rxjs_1.fromEvent(canvasContainer,"keydown")}return Object.defineProperty(KeyboardService.prototype,"keyDown$",{get:function(){return this._keyDown$},enumerable:!0,configurable:!0}),KeyboardService}();exports.KeyboardService=KeyboardService,exports.default=KeyboardService},{rxjs:89}],490:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("underscore"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),LoadingService=function(){function LoadingService(){this._loadersSubject$=new rxjs_1.Subject,this._loaders$=this._loadersSubject$.pipe(operators_1.scan(function(loaders,loader){return void 0!==loader.task&&(loaders[loader.task]=loader.loading),loaders},{}),operators_1.startWith({}),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount())}return Object.defineProperty(LoadingService.prototype,"loading$",{get:function(){return this._loaders$.pipe(operators_1.map(function(loaders){return _.reduce(loaders,function(loader,acc){return loader||acc},!1)}),operators_1.debounceTime(100),operators_1.distinctUntilChanged())},enumerable:!0,configurable:!0}),LoadingService.prototype.taskLoading$=function(task){return this._loaders$.pipe(operators_1.map(function(loaders){return!!loaders[task]}),operators_1.debounceTime(100),operators_1.distinctUntilChanged())},LoadingService.prototype.startLoading=function(task){this._loadersSubject$.next({loading:!0,task:task})},LoadingService.prototype.stopLoading=function(task){this._loadersSubject$.next({loading:!1,task:task})},LoadingService}();exports.LoadingService=LoadingService,exports.default=LoadingService},{rxjs:89,"rxjs/operators":285,underscore:292}],491:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Geo_1=require("../Geo"),operators_1=require("rxjs/operators"),MouseService=function(){function MouseService(container,canvasContainer,domContainer,doc,viewportCoords){var _this=this;this._canvasContainer=canvasContainer,this._domContainer=domContainer,this._viewportCoords=null!=viewportCoords?viewportCoords:new Geo_1.ViewportCoords,this._activeSubject$=new rxjs_1.BehaviorSubject(!1),this._active$=this._activeSubject$.pipe(operators_1.distinctUntilChanged(),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._claimMouse$=new rxjs_1.Subject,this._claimWheel$=new rxjs_1.Subject,this._deferPixelClaims$=new rxjs_1.Subject,this._deferPixels$=this._deferPixelClaims$.pipe(operators_1.scan(function(claims,claim){return null==claim.deferPixels?delete claims[claim.name]:claims[claim.name]=claim.deferPixels,claims},{}),operators_1.map(function(claims){var deferPixelMax=-1;for(var key in claims)if(claims.hasOwnProperty(key)){var deferPixels=claims[key];deferPixelMax<deferPixels&&(deferPixelMax=deferPixels)}return deferPixelMax}),operators_1.startWith(-1),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._deferPixels$.subscribe(function(){}),this._documentMouseMove$=rxjs_1.fromEvent(doc,"mousemove"),this._documentMouseUp$=rxjs_1.fromEvent(doc,"mouseup"),this._mouseDown$=rxjs_1.fromEvent(canvasContainer,"mousedown"),this._mouseLeave$=rxjs_1.fromEvent(canvasContainer,"mouseleave"),this._mouseMove$=rxjs_1.fromEvent(canvasContainer,"mousemove"),this._mouseUp$=rxjs_1.fromEvent(canvasContainer,"mouseup"),this._mouseOut$=rxjs_1.fromEvent(canvasContainer,"mouseout"),this._mouseOver$=rxjs_1.fromEvent(canvasContainer,"mouseover"),this._domMouseDown$=rxjs_1.fromEvent(domContainer,"mousedown"),this._domMouseMove$=rxjs_1.fromEvent(domContainer,"mousemove"),this._click$=rxjs_1.fromEvent(canvasContainer,"click"),this._contextMenu$=rxjs_1.fromEvent(canvasContainer,"contextmenu"),this._dblClick$=rxjs_1.merge(rxjs_1.fromEvent(container,"click"),rxjs_1.fromEvent(canvasContainer,"dblclick")).pipe(operators_1.bufferCount(3,1),operators_1.filter(function(events){var event1=events[0],event2=events[1],event3=events[2];return"click"===event1.type&&"click"===event2.type&&"dblclick"===event3.type&&event1.target.parentNode===canvasContainer&&event2.target.parentNode===canvasContainer}),operators_1.map(function(events){return events[2]}),operators_1.share()),rxjs_1.merge(this._domMouseDown$,this._domMouseMove$,this._dblClick$,this._contextMenu$).subscribe(function(event){event.preventDefault()}),this._mouseWheel$=rxjs_1.merge(rxjs_1.fromEvent(canvasContainer,"wheel"),rxjs_1.fromEvent(domContainer,"wheel")).pipe(operators_1.share()),this._consistentContextMenu$=rxjs_1.merge(this._mouseDown$,this._mouseMove$,this._mouseOut$,this._mouseUp$,this._contextMenu$).pipe(operators_1.bufferCount(3,1),operators_1.filter(function(events){return"mousedown"===events[0].type&&"contextmenu"===events[1].type&&"mouseup"===events[2].type}),operators_1.map(function(events){return events[1]}),operators_1.share());var dragStop$=rxjs_1.merge(rxjs_1.fromEvent(window,"blur"),this._documentMouseUp$.pipe(operators_1.filter(function(e){return 0===e.button}))).pipe(operators_1.share()),mouseDragInitiate$=this._createMouseDragInitiate$(this._mouseDown$,dragStop$,!0).pipe(operators_1.share());this._mouseDragStart$=this._createMouseDragStart$(mouseDragInitiate$).pipe(operators_1.share()),this._mouseDrag$=this._createMouseDrag$(mouseDragInitiate$,dragStop$).pipe(operators_1.share()),this._mouseDragEnd$=this._createMouseDragEnd$(this._mouseDragStart$,dragStop$).pipe(operators_1.share());var domMouseDragInitiate$=this._createMouseDragInitiate$(this._domMouseDown$,dragStop$,!1).pipe(operators_1.share());this._domMouseDragStart$=this._createMouseDragStart$(domMouseDragInitiate$).pipe(operators_1.share()),this._domMouseDrag$=this._createMouseDrag$(domMouseDragInitiate$,dragStop$).pipe(operators_1.share()),this._domMouseDragEnd$=this._createMouseDragEnd$(this._domMouseDragStart$,dragStop$).pipe(operators_1.share()),this._proximateClick$=this._mouseDown$.pipe(operators_1.switchMap(function(mouseDown){return _this._click$.pipe(operators_1.takeUntil(_this._createDeferredMouseMove$(mouseDown,_this._documentMouseMove$)),operators_1.take(1))}),operators_1.multicast(new rxjs_1.Subject),operators_1.refCount()),this._staticClick$=this._mouseDown$.pipe(operators_1.switchMap(function(e){return _this._click$.pipe(operators_1.takeUntil(_this._documentMouseMove$),operators_1.take(1))}),operators_1.multicast(new rxjs_1.Subject),operators_1.refCount()),this._mouseDragStart$.subscribe(),this._mouseDrag$.subscribe(),this._mouseDragEnd$.subscribe(),this._domMouseDragStart$.subscribe(),this._domMouseDrag$.subscribe(),this._domMouseDragEnd$.subscribe(),this._staticClick$.subscribe(),this._mouseOwner$=this._createOwner$(this._claimMouse$).pipe(operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._wheelOwner$=this._createOwner$(this._claimWheel$).pipe(operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._mouseOwner$.subscribe(function(){}),this._wheelOwner$.subscribe(function(){})}return Object.defineProperty(MouseService.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"documentMouseMove$",{get:function(){return this._documentMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"documentMouseUp$",{get:function(){return this._documentMouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"domMouseDragStart$",{get:function(){return this._domMouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"domMouseDrag$",{get:function(){return this._domMouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"domMouseDragEnd$",{get:function(){return this._domMouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"domMouseDown$",{get:function(){return this._domMouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"domMouseMove$",{get:function(){return this._domMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseOwner$",{get:function(){return this._mouseOwner$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseDown$",{get:function(){return this._mouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseMove$",{get:function(){return this._mouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseLeave$",{get:function(){return this._mouseLeave$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseOut$",{get:function(){return this._mouseOut$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseOver$",{get:function(){return this._mouseOver$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseUp$",{get:function(){return this._mouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"dblClick$",{get:function(){return this._dblClick$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"contextMenu$",{get:function(){return this._consistentContextMenu$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseWheel$",{get:function(){return this._mouseWheel$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseDragStart$",{get:function(){return this._mouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseDrag$",{get:function(){return this._mouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"mouseDragEnd$",{get:function(){return this._mouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"proximateClick$",{get:function(){return this._proximateClick$},enumerable:!0,configurable:!0}),Object.defineProperty(MouseService.prototype,"staticClick$",{get:function(){return this._staticClick$},enumerable:!0,configurable:!0}),MouseService.prototype.claimMouse=function(name,zindex){this._claimMouse$.next({name:name,zindex:zindex})},MouseService.prototype.unclaimMouse=function(name){this._claimMouse$.next({name:name,zindex:null})},MouseService.prototype.deferPixels=function(name,deferPixels){this._deferPixelClaims$.next({name:name,deferPixels:deferPixels})},MouseService.prototype.undeferPixels=function(name){this._deferPixelClaims$.next({name:name,deferPixels:null})},MouseService.prototype.claimWheel=function(name,zindex){this._claimWheel$.next({name:name,zindex:zindex})},MouseService.prototype.unclaimWheel=function(name){this._claimWheel$.next({name:name,zindex:null})},MouseService.prototype.filtered$=function(name,observable$){return this._filtered(name,observable$,this._mouseOwner$)},MouseService.prototype.filteredWheel$=function(name,observable$){return this._filtered(name,observable$,this._wheelOwner$)},MouseService.prototype._createDeferredMouseMove$=function(origin,mouseMove$){return mouseMove$.pipe(operators_1.map(function(mouseMove){var deltaX=mouseMove.clientX-origin.clientX,deltaY=mouseMove.clientY-origin.clientY;return[mouseMove,Math.sqrt(deltaX*deltaX+deltaY*deltaY)]}),operators_1.withLatestFrom(this._deferPixels$),operators_1.filter(function(_a){var _b=_a[0],delta=(_b[0],_b[1]);return _a[1]<delta}),operators_1.map(function(_a){var _b=_a[0],mouseMove=_b[0];_b[1],_a[1];return mouseMove}))},MouseService.prototype._createMouseDrag$=function(mouseDragStartInitiate$,stop$){var _this=this;return mouseDragStartInitiate$.pipe(operators_1.map(function(_a){_a[0];return _a[1]}),operators_1.switchMap(function(mouseMove){return rxjs_1.of(mouseMove).pipe(operators_1.concat(_this._documentMouseMove$),operators_1.takeUntil(stop$))}))},MouseService.prototype._createMouseDragEnd$=function(mouseDragStart$,stop$){return mouseDragStart$.pipe(operators_1.switchMap(function(event){return stop$.pipe(operators_1.first())}))},MouseService.prototype._createMouseDragStart$=function(mouseDragStartInitiate$){return mouseDragStartInitiate$.pipe(operators_1.map(function(_a){var mouseDown=_a[0];_a[1];return mouseDown}))},MouseService.prototype._createMouseDragInitiate$=function(mouseDown$,stop$,defer){var _this=this;return mouseDown$.pipe(operators_1.filter(function(mouseDown){return 0===mouseDown.button}),operators_1.switchMap(function(mouseDown){return rxjs_1.combineLatest(rxjs_1.of(mouseDown),defer?_this._createDeferredMouseMove$(mouseDown,_this._documentMouseMove$):_this._documentMouseMove$).pipe(operators_1.takeUntil(stop$),operators_1.take(1))}))},MouseService.prototype._createOwner$=function(claim$){return claim$.pipe(operators_1.scan(function(claims,claim){return null==claim.zindex?delete claims[claim.name]:claims[claim.name]=claim.zindex,claims},{}),operators_1.map(function(claims){var owner=null,zIndexMax=-1;for(var name_1 in claims)claims.hasOwnProperty(name_1)&&claims[name_1]>zIndexMax&&(zIndexMax=claims[name_1],owner=name_1);return owner}),operators_1.startWith(null))},MouseService.prototype._filtered=function(name,observable$,owner$){return observable$.pipe(operators_1.withLatestFrom(owner$),operators_1.filter(function(_a){_a[0];return _a[1]===name}),operators_1.map(function(_a){var item=_a[0];_a[1];return item}))},MouseService}();exports.MouseService=MouseService,exports.default=MouseService},{"../Geo":346,rxjs:89,"rxjs/operators":285}],492:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),Graph_1=require("../Graph"),Edge_1=require("../Edge"),State_1=require("../State"),Viewer_1=require("../Viewer"),API_1=require("../api/API"),operators_1=require("rxjs/operators"),Navigator=function(){function Navigator(api,graphService,imageLoadingService,loadingService,stateService,cacheService){this._api=null!=api?api:new API_1.API,this._imageLoadingService=null!=imageLoadingService?imageLoadingService:new Graph_1.ImageLoadingService,this._graphService=null!=graphService?graphService:new Graph_1.GraphService(new Graph_1.Graph(this.api),this._imageLoadingService),this._loadingService=null!=loadingService?loadingService:new Viewer_1.LoadingService,this._loadingName="navigator",this._stateService=null!=stateService?stateService:new State_1.StateService,this._cacheService=null!=cacheService?cacheService:new Viewer_1.CacheService(this._graphService,this._stateService),this._cacheService.start(),this._keyRequested$=new rxjs_1.BehaviorSubject(null),this._movedToKey$=new rxjs_1.BehaviorSubject(null),this._request$=null,this._requestSubscription=null,this._nodeRequestSubscription=null}return Object.defineProperty(Navigator.prototype,"api",{get:function(){return this._api},enumerable:!0,configurable:!0}),Object.defineProperty(Navigator.prototype,"graphService",{get:function(){return this._graphService},enumerable:!0,configurable:!0}),Object.defineProperty(Navigator.prototype,"imageLoadingService",{get:function(){return this._imageLoadingService},enumerable:!0,configurable:!0}),Object.defineProperty(Navigator.prototype,"loadingService",{get:function(){return this._loadingService},enumerable:!0,configurable:!0}),Object.defineProperty(Navigator.prototype,"movedToKey$",{get:function(){return this._movedToKey$},enumerable:!0,configurable:!0}),Object.defineProperty(Navigator.prototype,"stateService",{get:function(){return this._stateService},enumerable:!0,configurable:!0}),Navigator.prototype.moveToKey$=function(key){this._abortRequest("to key "+key),this._loadingService.startLoading(this._loadingName);var node$=this._moveToKey$(key);return this._makeRequest$(node$)},Navigator.prototype.moveDir$=function(direction){var _this=this;this._abortRequest("in dir "+Edge_1.EdgeDirection[direction]),this._loadingService.startLoading(this._loadingName);var node$=this.stateService.currentNode$.pipe(operators_1.first(),operators_1.mergeMap(function(node){return(-1<[Edge_1.EdgeDirection.Next,Edge_1.EdgeDirection.Prev].indexOf(direction)?node.sequenceEdges$:node.spatialEdges$).pipe(operators_1.first(),operators_1.map(function(status){for(var _i=0,_a=status.edges;_i<_a.length;_i++){var edge=_a[_i];if(edge.data.direction===direction)return edge.to}return null}))}),operators_1.mergeMap(function(directionKey){return null==directionKey?(_this._loadingService.stopLoading(_this._loadingName),rxjs_1.throwError(new Error("Direction ("+direction+") does not exist for current node."))):_this._moveToKey$(directionKey)}));return this._makeRequest$(node$)},Navigator.prototype.moveCloseTo$=function(lat,lon,floorCode,buildingId){var _this=this;this._abortRequest("to lat "+lat+", lon "+lon),this._loadingService.startLoading(this._loadingName);var node$=this.api.imageCloseTo$({lat:lat,lon:lon},floorCode,buildingId).pipe(operators_1.mergeMap(function(fullNode){return null==fullNode?(_this._loadingService.stopLoading(_this._loadingName),rxjs_1.throwError(new Error("No image found close to lat "+lat+", lon "+lon+"."))):_this._moveToKey$(fullNode.key)}));return this._makeRequest$(node$)},Navigator.prototype.setFilter$=function(filter){var _this=this;return this._stateService.clearNodes(),this._movedToKey$.pipe(operators_1.first(),operators_1.mergeMap(function(key){return null!=key?_this._trajectoryKeys$().pipe(operators_1.mergeMap(function(keys){return _this._graphService.setFilter$(filter).pipe(operators_1.mergeMap(function(graph){return _this._cacheKeys$(keys)}))}),operators_1.last()):_this._keyRequested$.pipe(operators_1.first(),operators_1.mergeMap(function(requestedKey){return null!=requestedKey?_this._graphService.setFilter$(filter).pipe(operators_1.mergeMap(function(graph){return _this._graphService.cacheNode$(requestedKey)})):_this._graphService.setFilter$(filter).pipe(operators_1.map(function(graph){}))}))}),operators_1.map(function(node){}))},Navigator.prototype._cacheKeys$=function(keys){var _this=this,cacheNodes$=keys.map(function(key){return _this._graphService.cacheNode$(key)});return rxjs_1.from(cacheNodes$).pipe(operators_1.mergeAll())},Navigator.prototype._abortRequest=function(reason){null!=this._requestSubscription&&(this._requestSubscription.unsubscribe(),this._requestSubscription=null),null!=this._nodeRequestSubscription&&(this._nodeRequestSubscription.unsubscribe(),this._nodeRequestSubscription=null),null!=this._request$&&(this._request$.error(new Error("Request aborted by a subsequent request "+reason+".")),this._request$=null)},Navigator.prototype._makeRequest$=function(node$){var _this=this;return this._request$=new rxjs_1.ReplaySubject(1),this._requestSubscription=this._request$.subscribe(void 0,function(e){}),this._nodeRequestSubscription=node$.subscribe(function(node){_this._request$.next(node),_this._request$.complete()},function(error){_this._request$.error(error)}),this._request$},Navigator.prototype._moveToKey$=function(key){var _this=this;return this._keyRequested$.next(key),this._graphService.cacheNode$(key).pipe(operators_1.tap(function(node){_this._graphService.cachePath$(key),_this._graphService.cacheOutdoorPath$(key),_this._stateService.setNodes([node]),_this._movedToKey$.next(node.key)}),operators_1.finalize(function(){_this._loadingService.stopLoading(_this._loadingName)}))},Navigator.prototype._trajectoryKeys$=function(){return this._stateService.currentState$.pipe(operators_1.first(),operators_1.map(function(frame){return frame.state.trajectory.map(function(node){return node.key})}))},Navigator}();exports.Navigator=Navigator,exports.default=Navigator},{"../Edge":344,"../Graph":347,"../State":350,"../Viewer":354,"../api/API":355,rxjs:89,"rxjs/operators":285}],493:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),MarkerComponent=require("../component/marker/Marker");exports.MarkerComponent=MarkerComponent;var Viewer_1=require("../Viewer"),when=require("when"),operators_1=require("rxjs/operators"),Observer=function(){function Observer(eventEmitter,navigator,container){var _this=this;this._container=container,this._eventEmitter=eventEmitter,this._navigator=navigator,this._projection=new Viewer_1.Projection,this._started=!1,this._navigable$=new rxjs_1.Subject,this._navigable$.subscribe(function(navigable){_this._eventEmitter.fire(Viewer_1.Viewer.navigablechanged,navigable)}),this._navigator.loadingService.loading$.subscribe(function(loading){_this._eventEmitter.fire(Viewer_1.Viewer.loadingchanged,loading)})}return Object.defineProperty(Observer.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),Object.defineProperty(Observer.prototype,"navigable$",{get:function(){return this._navigable$},enumerable:!0,configurable:!0}),Observer.prototype.projectBasic$=function(basicPoint){var _this=this;return rxjs_1.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(operators_1.first(),operators_1.map(function(_a){var render=_a[0],transform=_a[1],canvasPoint=_this._projection.basicToCanvas(basicPoint,_this._container.element,render,transform);return[Math.round(canvasPoint[0]),Math.round(canvasPoint[1])]}))},Observer.prototype.startEmit=function(){var _this=this;if(!this._started){this._started=!0,this._currentNodeSubscription=this._navigator.stateService.currentNodeExternal$.subscribe(function(node){_this.setFilter(["==","floorId",node.floorId]),_this._eventEmitter.fire(Viewer_1.Viewer.nodechanged,node)}),this._sequenceEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(operators_1.switchMap(function(node){return node.sequenceEdges$})).subscribe(function(status){_this._eventEmitter.fire(Viewer_1.Viewer.sequenceedgeschanged,status)}),this._spatialEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(operators_1.switchMap(function(node){return node.spatialEdges$})).subscribe(function(status){_this._eventEmitter.fire(Viewer_1.Viewer.spatialedgeschanged,status)}),this._moveSubscription=rxjs_1.combineLatest(this._navigator.stateService.inMotion$,this._container.mouseService.active$,this._container.touchService.active$).pipe(operators_1.map(function(values){return values[0]||values[1]||values[2]}),operators_1.distinctUntilChanged()).subscribe(function(started){started?_this._eventEmitter.fire(Viewer_1.Viewer.movestart,null):_this._eventEmitter.fire(Viewer_1.Viewer.moveend,null)}),this._bearingSubscription=this._container.renderService.bearing$.pipe(operators_1.throttleTime(100),operators_1.distinctUntilChanged(function(b1,b2){return Math.abs(b2-b1)<1})).subscribe(function(bearing){_this._eventEmitter.fire(Viewer_1.Viewer.bearingchanged,bearing)});var mouseMove$=this._container.mouseService.active$.pipe(operators_1.switchMap(function(active){return active?rxjs_1.empty():_this._container.mouseService.mouseMove$}));this._viewerMouseEventSubscription=rxjs_1.merge(this._mapMouseEvent$(Viewer_1.Viewer.click,this._container.mouseService.staticClick$),this._mapMouseEvent$(Viewer_1.Viewer.contextmenu,this._container.mouseService.contextMenu$),this._mapMouseEvent$(Viewer_1.Viewer.dblclick,this._container.mouseService.dblClick$),this._mapMouseEvent$(Viewer_1.Viewer.mousedown,this._container.mouseService.mouseDown$),this._mapMouseEvent$(Viewer_1.Viewer.mousemove,mouseMove$),this._mapMouseEvent$(Viewer_1.Viewer.mouseout,this._container.mouseService.mouseOut$),this._mapMouseEvent$(Viewer_1.Viewer.mouseover,this._container.mouseService.mouseOver$),this._mapMouseEvent$(Viewer_1.Viewer.mouseup,this._container.mouseService.mouseUp$)).pipe(operators_1.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$),operators_1.map(function(_a){var _b=_a[0],type=_b[0],event=_b[1],render=_a[1],reference=_a[2],transform=_a[3],unprojection=_this._projection.eventToUnprojection(event,_this._container.element,render,reference,transform);return{basicPoint:unprojection.basicPoint,latLon:unprojection.latLon,originalEvent:event,pixelPoint:unprojection.pixelPoint,target:_this._eventEmitter,type:type}})).subscribe(function(event){_this._eventEmitter.fire(event.type,event)})}},Observer.prototype.stopEmit=function(){this.started&&(this._started=!1,this._bearingSubscription.unsubscribe(),this._currentNodeSubscription.unsubscribe(),this._moveSubscription.unsubscribe(),this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._viewerMouseEventSubscription.unsubscribe(),this._bearingSubscription=null,this._currentNodeSubscription=null,this._moveSubscription=null,this._sequenceEdgesSubscription=null,this._spatialEdgesSubscription=null,this._viewerMouseEventSubscription=null)},Observer.prototype.unproject$=function(canvasPoint){var _this=this;return rxjs_1.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$).pipe(operators_1.first(),operators_1.map(function(_a){var render=_a[0],reference=_a[1],transform=_a[2];return _this._projection.canvasToUnprojection(canvasPoint,_this._container.element,render,reference,transform).latLon}))},Observer.prototype.unprojectBasic$=function(canvasPoint){var _this=this;return rxjs_1.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(operators_1.first(),operators_1.map(function(_a){var render=_a[0],transform=_a[1];return _this._projection.canvasToBasic(canvasPoint,_this._container.element,render,transform)}))},Observer.prototype.setFilter=function(filter){var _this=this;return when.promise(function(resolve,reject){_this._navigator.setFilter$(filter).subscribe(function(){resolve(void 0)},function(error){reject(error)})})},Observer.prototype._mapMouseEvent$=function(type,mouseEvent$){return mouseEvent$.pipe(operators_1.map(function(event){return[type,event]}))},Observer}();exports.Observer=Observer,exports.default=Observer},{"../Viewer":354,"../component/marker/Marker":385,rxjs:89,"rxjs/operators":285,when:337}],494:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),Geo_1=require("../Geo"),Projection=function(){function Projection(geoCoords,viewportCoords){this._geoCoords=geoCoords||new Geo_1.GeoCoords,this._viewportCoords=viewportCoords||new Geo_1.ViewportCoords}return Projection.prototype.basicToCanvas=function(basicPoint,container,render,transform){return this._viewportCoords.basicToCanvas(basicPoint[0],basicPoint[1],container,transform,render.perspective)},Projection.prototype.canvasToBasic=function(canvasPoint,container,render,transform){var basicPoint=this._viewportCoords.canvasToBasic(canvasPoint[0],canvasPoint[1],container,transform,render.perspective);return(basicPoint[0]<0||1<basicPoint[0]||basicPoint[1]<0||1<basicPoint[1])&&(basicPoint=null),basicPoint},Projection.prototype.eventToUnprojection=function(event,container,render,reference,transform){var pixelPoint=this._viewportCoords.canvasPosition(event,container);return this.canvasToUnprojection(pixelPoint,container,render,reference,transform)},Projection.prototype.canvasToUnprojection=function(canvasPoint,container,render,reference,transform){var canvasX=canvasPoint[0],canvasY=canvasPoint[1],_a=this._viewportCoords.canvasToViewport(canvasX,canvasY,container),viewportX=_a[0],viewportY=_a[1],point3d=new THREE.Vector3(viewportX,viewportY,1).unproject(render.perspective),basicPoint=transform.projectBasic(point3d.toArray());(basicPoint[0]<0||1<basicPoint[0]||basicPoint[1]<0||1<basicPoint[1])&&(basicPoint=null);var direction3d=point3d.clone().sub(render.camera.position).normalize(),dist=-2/direction3d.z,latLon=null;if(0<dist&&dist<100&&basicPoint){var point=direction3d.clone().multiplyScalar(dist).add(render.camera.position),latLonArray=this._geoCoords.enuToGeodetic(point.x,point.y,point.z,reference.lat,reference.lon,reference.alt).slice(0,2);latLon={lat:latLonArray[0],lon:latLonArray[1]}}return{basicPoint:basicPoint,latLon:latLon,pixelPoint:[canvasX,canvasY]}},Projection}();exports.Projection=Projection,exports.default=Projection},{"../Geo":346,three:288}],495:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),vd=require("virtual-dom"),rxjs_1=require("rxjs"),Viewer_1=require("../Viewer"),operators_1=require("rxjs/operators"),SpriteAtlas=function(){function SpriteAtlas(){}return Object.defineProperty(SpriteAtlas.prototype,"json",{set:function(value){this._json=value},enumerable:!0,configurable:!0}),Object.defineProperty(SpriteAtlas.prototype,"image",{set:function(value){this._image=value,this._texture=new THREE.Texture(this._image),this._texture.minFilter=THREE.NearestFilter},enumerable:!0,configurable:!0}),Object.defineProperty(SpriteAtlas.prototype,"loaded",{get:function(){return!(!this._image||!this._json)},enumerable:!0,configurable:!0}),SpriteAtlas.prototype.getGLSprite=function(name){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");var definition=this._json[name];if(!definition)return console.warn("Sprite with key"+name+"does not exist in sprite definition."),new THREE.Object3D;var texture=this._texture.clone();texture.needsUpdate=!0;var width=this._image.width,height=this._image.height;texture.offset.x=definition.x/width,texture.offset.y=(height-definition.y-definition.height)/height,texture.repeat.x=definition.width/width,texture.repeat.y=definition.height/height;var material=new THREE.SpriteMaterial({map:texture});return new THREE.Sprite(material)},SpriteAtlas.prototype.getDOMSprite=function(name,float){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==float&&(float=Viewer_1.Alignment.Center);var definition=this._json[name];if(!definition)return console.warn("Sprite with key"+name+"does not exist in sprite definition."),vd.h("div",{},[]);var clipTop=definition.y,clipRigth=definition.x+definition.width,clipBottom=definition.y+definition.height,clipLeft=definition.x,left=-definition.x,top=-definition.y,height=this._image.height,width=this._image.width;switch(float){case Viewer_1.Alignment.Bottom:case Viewer_1.Alignment.Center:case Viewer_1.Alignment.Top:left-=definition.width/2;break;case Viewer_1.Alignment.BottomLeft:case Viewer_1.Alignment.Left:case Viewer_1.Alignment.TopLeft:left-=definition.width;break;case Viewer_1.Alignment.BottomRight:case Viewer_1.Alignment.Right:case Viewer_1.Alignment.BottomRight:}switch(float){case Viewer_1.Alignment.Center:case Viewer_1.Alignment.Left:case Viewer_1.Alignment.Right:top-=definition.height/2;break;case Viewer_1.Alignment.Top:case Viewer_1.Alignment.TopLeft:case Viewer_1.Alignment.TopRight:top-=definition.height;break;case Viewer_1.Alignment.Bottom:case Viewer_1.Alignment.BottomLeft:case Viewer_1.Alignment.BottomRight:}var pixelRatioInverse=1/definition.pixelRatio;clipTop*=pixelRatioInverse,clipRigth*=pixelRatioInverse,clipBottom*=pixelRatioInverse,clipLeft*=pixelRatioInverse,left*=pixelRatioInverse,top*=pixelRatioInverse,height*=pixelRatioInverse,width*=pixelRatioInverse;var properties={src:this._image.src,style:{clip:"rect("+clipTop+"px, "+clipRigth+"px, "+clipBottom+"px, "+clipLeft+"px)",height:height+"px",left:left+"px",position:"absolute",top:top+"px",width:width+"px"}};return vd.h("img",properties,[])},SpriteAtlas}(),SpriteService=function(){function SpriteService(sprite){var _this=this;if(this._retina=1<window.devicePixelRatio,this._spriteAtlasOperation$=new rxjs_1.Subject,this._spriteAtlas$=this._spriteAtlasOperation$.pipe(operators_1.startWith(function(atlas){return atlas}),operators_1.scan(function(atlas,operation){return operation(atlas)},new SpriteAtlas),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),this._spriteAtlas$.subscribe(function(){}),null!=sprite){var format=this._retina?"@2x":"",imageXmlHTTP=new XMLHttpRequest;imageXmlHTTP.open("GET",sprite+format+".png",!0),imageXmlHTTP.custom&&imageXmlHTTP.custom.xhr&&(imageXmlHTTP=imageXmlHTTP.custom.xhr),imageXmlHTTP.responseType="arraybuffer",imageXmlHTTP.onload=function(){var image=new Image;image.onload=function(){_this._spriteAtlasOperation$.next(function(atlas){return atlas.image=image,atlas})};var blob=new Blob([imageXmlHTTP.response]);image.src=window.URL.createObjectURL(blob)},imageXmlHTTP.onerror=function(error){console.error(new Error("Failed to fetch sprite sheet ("+sprite+format+".png)"))},imageXmlHTTP.send();var jsonXmlHTTP=new XMLHttpRequest;jsonXmlHTTP.open("GET",sprite+format+".json",!0),jsonXmlHTTP.custom&&jsonXmlHTTP.custom.xhr&&(jsonXmlHTTP=jsonXmlHTTP.custom.xhr),jsonXmlHTTP.responseType="text",jsonXmlHTTP.onload=function(){var json=JSON.parse(jsonXmlHTTP.response);_this._spriteAtlasOperation$.next(function(atlas){return atlas.json=json,atlas})},jsonXmlHTTP.onerror=function(error){console.error(new Error("Failed to fetch sheet ("+sprite+format+".json)"))},jsonXmlHTTP.send()}}return Object.defineProperty(SpriteService.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:!0,configurable:!0}),SpriteService}();exports.SpriteService=SpriteService,exports.default=SpriteService},{"../Viewer":354,rxjs:89,"rxjs/operators":285,three:288,"virtual-dom":296}],496:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),TouchService=function(){function TouchService(canvasContainer,domContainer){var _this=this;this._canvasContainer=canvasContainer,this._domContainer=domContainer,this._activeSubject$=new rxjs_1.BehaviorSubject(!1),this._active$=this._activeSubject$.pipe(operators_1.distinctUntilChanged(),operators_1.multicast(new rxjs_1.ReplaySubject(1)),operators_1.refCount()),rxjs_1.fromEvent(domContainer,"touchmove").subscribe(function(event){event.preventDefault()}),this._touchStart$=rxjs_1.fromEvent(canvasContainer,"touchstart"),this._touchMove$=rxjs_1.fromEvent(canvasContainer,"touchmove"),this._touchEnd$=rxjs_1.fromEvent(canvasContainer,"touchend"),this._touchCancel$=rxjs_1.fromEvent(canvasContainer,"touchcancel");var tapStart$=this._touchStart$.pipe(operators_1.filter(function(te){return 1===te.touches.length&&1===te.targetTouches.length}),operators_1.share());this._doubleTap$=tapStart$.pipe(operators_1.bufferWhen(function(){return tapStart$.pipe(operators_1.first(),operators_1.switchMap(function(event){return rxjs_1.timer(300).pipe(operators_1.merge(tapStart$),operators_1.take(1))}))}),operators_1.filter(function(events){return 2===events.length}),operators_1.map(function(events){return events[events.length-1]}),operators_1.share()),this._doubleTap$.subscribe(function(event){event.preventDefault()}),this._singleTouchMove$=this._touchMove$.pipe(operators_1.filter(function(te){return 1===te.touches.length&&1===te.targetTouches.length}),operators_1.share());var singleTouchStart$=rxjs_1.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(operators_1.filter(function(te){return 1===te.touches.length&&1===te.targetTouches.length})),multipleTouchStart$=rxjs_1.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(operators_1.filter(function(te){return 1<=te.touches.length})),touchStop$=rxjs_1.merge(this._touchEnd$,this._touchCancel$).pipe(operators_1.filter(function(te){return 0===te.touches.length}));this._singleTouchDragStart$=singleTouchStart$.pipe(operators_1.mergeMap(function(e){return _this._singleTouchMove$.pipe(operators_1.takeUntil(rxjs_1.merge(touchStop$,multipleTouchStart$)),operators_1.take(1))})),this._singleTouchDragEnd$=singleTouchStart$.pipe(operators_1.mergeMap(function(e){return rxjs_1.merge(touchStop$,multipleTouchStart$).pipe(operators_1.first())})),this._singleTouchDrag$=singleTouchStart$.pipe(operators_1.switchMap(function(te){return _this._singleTouchMove$.pipe(operators_1.skip(1),operators_1.takeUntil(rxjs_1.merge(multipleTouchStart$,touchStop$)))}));var touchesChanged$=rxjs_1.merge(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=touchesChanged$.pipe(operators_1.filter(function(te){return 2===te.touches.length&&2===te.targetTouches.length})),this._pinchEnd$=touchesChanged$.pipe(operators_1.filter(function(te){return 2!==te.touches.length||2!==te.targetTouches.length})),this._pinchOperation$=new rxjs_1.Subject,this._pinch$=this._pinchOperation$.pipe(operators_1.scan(function(pinch,operation){return operation(pinch)},{changeX:0,changeY:0,clientX:0,clientY:0,distance:0,distanceChange:0,distanceX:0,distanceY:0,originalEvent:null,pageX:0,pageY:0,screenX:0,screenY:0,touch1:null,touch2:null})),this._touchMove$.pipe(operators_1.filter(function(te){return 2===te.touches.length&&2===te.targetTouches.length}),operators_1.map(function(te){return function(previous){var touch1=te.touches[0],touch2=te.touches[1],minX=Math.min(touch1.clientX,touch2.clientX),maxX=Math.max(touch1.clientX,touch2.clientX),minY=Math.min(touch1.clientY,touch2.clientY),centerClientX=minX+(maxX-minX)/2,centerClientY=minY+(Math.max(touch1.clientY,touch2.clientY)-minY)/2,centerPageX=centerClientX+touch1.pageX-touch1.clientX,centerPageY=centerClientY+touch1.pageY-touch1.clientY,centerScreenX=centerClientX+touch1.screenX-touch1.clientX,centerScreenY=centerClientY+touch1.screenY-touch1.clientY,distanceX=Math.abs(touch1.clientX-touch2.clientX),distanceY=Math.abs(touch1.clientY-touch2.clientY),distance=Math.sqrt(distanceX*distanceX+distanceY*distanceY),distanceChange=distance-previous.distance;return{changeX:distanceX-previous.distanceX,changeY:distanceY-previous.distanceY,clientX:centerClientX,clientY:centerClientY,distance:distance,distanceChange:distanceChange,distanceX:distanceX,distanceY:distanceY,originalEvent:te,pageX:centerPageX,pageY:centerPageY,screenX:centerScreenX,screenY:centerScreenY,touch1:touch1,touch2:touch2}}})).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.pipe(operators_1.switchMap(function(te){return _this._pinch$.pipe(operators_1.skip(1),operators_1.takeUntil(_this._pinchEnd$))}))}return Object.defineProperty(TouchService.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"doubleTap$",{get:function(){return this._doubleTap$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"touchStart$",{get:function(){return this._touchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"touchMove$",{get:function(){return this._touchMove$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"touchEnd$",{get:function(){return this._touchEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"touchCancel$",{get:function(){return this._touchCancel$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"singleTouchDragStart$",{get:function(){return this._singleTouchDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"singleTouchDrag$",{get:function(){return this._singleTouchDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"singleTouchDragEnd$",{get:function(){return this._singleTouchDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"pinch$",{get:function(){return this._pinchChange$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"pinchStart$",{get:function(){return this._pinchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(TouchService.prototype,"pinchEnd$",{get:function(){return this._pinchEnd$},enumerable:!0,configurable:!0}),TouchService}();exports.TouchService=TouchService},{rxjs:89,"rxjs/operators":285}],497:[function(require,module,exports){"use strict";var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)});Object.defineProperty(exports,"__esModule",{value:!0});var when=require("when"),rxjs_1=require("rxjs"),Viewer_1=require("../Viewer"),Utils_1=require("../Utils"),Auth_1=require("../api/Auth"),API_1=require("../api/API"),GraphQLCreator_1=require("../api/GraphQLCreator"),operators_1=require("rxjs/operators"),Viewer=function(_super){function Viewer(options){var _this=_super.call(this)||this;return _this._authComplete$=new rxjs_1.AsyncSubject,Utils_1.Settings.setOptions(options),(new Auth_1.Auth).applyToken(options.appId,options.secret,options.keyPlatform,{bundleId:options.bundleId,packageName:options.packageName,sha1:options.sha1}).then(function(res){var token=res.data.result.idToken,creator=new GraphQLCreator_1.default(token);_this._api=new API_1.default(creator),_this._navigator=new Viewer_1.Navigator(_this._api),_this._container=new Viewer_1.Container(options.container,_this._navigator.stateService,options),_this._observer=new Viewer_1.Observer(_this,_this._navigator,_this._container),_this._componentController=new Viewer_1.ComponentController(_this._container,_this._navigator,_this._observer,options.imageId,options.component),_this._authComplete$.next(options.imageId),_this._authComplete$.complete()}),_this}return __extends(Viewer,_super),Viewer.prototype.renderComplete=function(callback){var _this=this;this._authComplete$.pipe(operators_1.mergeMap(function(key){return key?_this._observer.navigable$:rxjs_1.of("complete")})).subscribe(function(){return callback()})},Viewer.prototype.searchOutdoorImageByBbox=function(neLat,neLon,swLat,swLon){var northEastLatLon={lat:neLat,lon:neLon},southWestLatLon={lat:swLat,lon:swLon};return this._api.outdoorByBbox$(northEastLatLon,southWestLatLon).pipe(operators_1.map(function(sequences){var list=[];return sequences.forEach(function(sequence){return list=list.concat(sequence.outdoorImages)}),list}),operators_1.mergeMap(function(list){return rxjs_1.of(list)}))},Viewer.prototype.searchOutdoorByBbox=function(neLat,neLon,swLat,swLon){var northEastLatLon={lat:neLat,lon:neLon},southWestLatLon={lat:swLat,lon:swLon};return this._api.outdoorByBbox$(northEastLatLon,southWestLatLon)},Viewer.prototype.searchBuildingsById=function(id){return this._api.buildingByKey$(id)},Object.defineProperty(Viewer.prototype,"isNavigable",{get:function(){return this._componentController.navigable},enumerable:!0,configurable:!0}),Viewer.prototype.activateComponent=function(name){this._componentController.activate(name)},Viewer.prototype.activateCover=function(){this._componentController.activateCover()},Viewer.prototype.deactivateComponent=function(name){this._componentController.deactivate(name)},Viewer.prototype.deactivateCover=function(){this._componentController.deactivateCover()},Viewer.prototype.getBearing=function(){var _this=this;return when.promise(function(resolve,reject){_this._container.renderService.bearing$.pipe(operators_1.first()).subscribe(function(bearing){resolve(bearing)},function(error){reject(error)})})},Viewer.prototype.getCenter=function(){var _this=this;return when.promise(function(resolve,reject){_this._navigator.stateService.getCenter().subscribe(function(center){resolve(center)},function(error){reject(error)})})},Viewer.prototype.getComponent=function(name){return this._componentController.get(name)},Viewer.prototype.getContainer=function(){return this._container.element},Viewer.prototype.getZoom=function(){var _this=this;return when.promise(function(resolve,reject){_this._navigator.stateService.getZoom().subscribe(function(zoom){resolve(zoom)},function(error){reject(error)})})},Viewer.prototype.moveCloseTo=function(lat,lon,floorCode,buildingId){var moveCloseTo$=this.isNavigable?this._navigator.moveCloseTo$(lat,lon,floorCode,buildingId):rxjs_1.throwError(new Error("Calling moveCloseTo is not supported when viewer is not navigable."));return when.promise(function(resolve,reject){moveCloseTo$.subscribe(function(node){resolve(node)},function(error){reject(error)})})},Viewer.prototype.moveDir=function(dir){var moveDir$=this.isNavigable?this._navigator.moveDir$(dir):rxjs_1.throwError(new Error("Calling moveDir is not supported when viewer is not navigable."));return when.promise(function(resolve,reject){moveDir$.subscribe(function(node){resolve(node)},function(error){reject(error)})})},Viewer.prototype.moveToKey=function(key){var moveToKey$=this.isNavigable?this._navigator.moveToKey$(key):rxjs_1.throwError(new Error("Calling moveToKey is not supported when viewer is not navigable."));return when.promise(function(resolve,reject){moveToKey$.subscribe(function(node){resolve(node)},function(error){reject(error)})})},Viewer.prototype.projectFromBasic=function(basicPoint){var _this=this;return when.promise(function(resolve,reject){_this._observer.projectBasic$(basicPoint).subscribe(function(pixelPoint){resolve(pixelPoint)},function(error){reject(error)})})},Viewer.prototype.resize=function(){this._container.renderService.resize$.next(null),this._componentController.resize()},Viewer.prototype.setCenter=function(center){this._navigator.stateService.setCenter(center)},Viewer.prototype.setFilter=function(filter){var _this=this;return when.promise(function(resolve,reject){_this._navigator.setFilter$(filter).subscribe(function(){resolve(void 0)},function(error){reject(error)})})},Viewer.prototype.setRenderMode=function(renderMode){this._container.renderService.renderMode$.next(renderMode)},Viewer.prototype.setZoom=function(zoom){this._navigator.stateService.setZoom(zoom)},Viewer.prototype.setBearing=function(bearing){var _this=this,timer=setInterval(function(){_this.getBearing().then(function(currentBearing){Math.floor(Math.abs(currentBearing-bearing))<15?clearInterval(timer):_this._navigator.stateService.rotateBasicWithoutInertia([1,0])})})},Viewer.prototype.unproject=function(pixelPoint){var _this=this;return when.promise(function(resolve,reject){_this._observer.unproject$(pixelPoint).subscribe(function(latLon){resolve(latLon)},function(error){reject(error)})})},Viewer.prototype.unprojectToBasic=function(pixelPoint){var _this=this;return when.promise(function(resolve,reject){_this._observer.unprojectBasic$(pixelPoint).subscribe(function(basicPoint){resolve(basicPoint)},function(error){reject(error)})})},Viewer.bearingchanged="bearingchanged",Viewer.click="click",Viewer.contextmenu="contextmenu",Viewer.dblclick="dblclick",Viewer.loadingchanged="loadingchanged",Viewer.mousedown="mousedown",Viewer.mousemove="mousemove",Viewer.mouseout="mouseout",Viewer.mouseover="mouseover",Viewer.mouseup="mouseup",Viewer.moveend="moveend",Viewer.movestart="movestart",Viewer.navigablechanged="navigablechanged",Viewer.nodechanged="nodechanged",Viewer.sequenceedgeschanged="sequenceedgeschanged",Viewer.spatialedgeschanged="spatialedgeschanged",Viewer}(Utils_1.EventEmitter);exports.Viewer=Viewer},{"../Utils":353,"../Viewer":354,"../api/API":355,"../api/Auth":356,"../api/GraphQLCreator":358,rxjs:89,"rxjs/operators":285,when:337}]},{},[348])(348)});
|