@arcgis/core 4.34.0-next.92 → 4.34.0-next.94
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/Color.js +1 -1
- package/Ground.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileDisplayUnits.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileUnits.js → ElevationProfileDisplayUnits.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +1 -1
- package/analysis/ElevationProfile/ElevationProfileViewOptions.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/004b13c1db79c9e668b1.js +1 -0
- package/assets/esri/core/workers/chunks/{700b5a536f97233bc4af.js → 03b455e9405a8b6fec68.js} +1 -1
- package/assets/esri/core/workers/chunks/{a244afea77127e54dd3a.js → 08b0fc6bfe9640ee2525.js} +1 -1
- package/assets/esri/core/workers/chunks/0a981061df08da19372c.js +1 -0
- package/assets/esri/core/workers/chunks/{db5a985ccc6b7d0ad855.js → 176f56de787bf486be9f.js} +1 -1
- package/assets/esri/core/workers/chunks/1fc7df018c8f802565a6.js +1 -0
- package/assets/esri/core/workers/chunks/20003728a679479b14dc.js +1 -0
- package/assets/esri/core/workers/chunks/20f4c6d8b310ecab97be.js +1 -0
- package/assets/esri/core/workers/chunks/25639559336109ff3df1.js +1 -0
- package/assets/esri/core/workers/chunks/26081b6486c623735657.js +1 -0
- package/assets/esri/core/workers/chunks/2698f656405876f4bd20.js +1 -0
- package/assets/esri/core/workers/chunks/{4660798b3b45dcb5cecb.js → 2b9c9a35a6e1f56920b5.js} +2 -2
- package/assets/esri/core/workers/chunks/352511dbc67166face40.js +1 -0
- package/assets/esri/core/workers/chunks/3acd79a6a0572926a799.js +1 -0
- package/assets/esri/core/workers/chunks/3d7923d25734d03a4d27.js +1 -0
- package/assets/esri/core/workers/chunks/48133effac2eacc2196e.js +1 -0
- package/assets/esri/core/workers/chunks/4dfcd03082be83600f3a.js +1 -0
- package/assets/esri/core/workers/chunks/503c81dda242e6077317.js +1 -0
- package/assets/esri/core/workers/chunks/{06aed0a5464965be8d52.js → 56b3bb68b61b77138186.js} +1 -1
- package/assets/esri/core/workers/chunks/5746c4861af83c1d57a8.js +1 -0
- package/assets/esri/core/workers/chunks/5aacd1c6b171c99b41f5.js +1 -0
- package/assets/esri/core/workers/chunks/6810ecdeccf4b7eae5e2.js +1 -0
- package/assets/esri/core/workers/chunks/6b208f5d423da64c8559.js +1 -0
- package/assets/esri/core/workers/chunks/{7a240ab31d9ff2d2c5af.js → 73db6c070b049fe05147.js} +1 -1
- package/assets/esri/core/workers/chunks/801451fb572bc5f1f270.js +1 -0
- package/assets/esri/core/workers/chunks/82e0d22619dc26920ca9.js +1 -0
- package/assets/esri/core/workers/chunks/8f426cb210a4250517d5.js +1 -0
- package/assets/esri/core/workers/chunks/94ddf029698991d853b9.js +1 -0
- package/assets/esri/core/workers/chunks/97eb2cfc1f036feea9a9.js +1 -0
- package/assets/esri/core/workers/chunks/98381404f2d99a1f9341.js +1 -0
- package/assets/esri/core/workers/chunks/9adecee0ed2f1df3b0d2.js +1 -0
- package/assets/esri/core/workers/chunks/a0fab8cd791c33d3895d.js +1 -0
- package/assets/esri/core/workers/chunks/{a85acb948cc7d22be592.js → a410dcf80d17a2383337.js} +1 -1
- package/assets/esri/core/workers/chunks/{d9d86cf0500fa29d1d43.js → a98b284b147258629947.js} +1 -1
- package/assets/esri/core/workers/chunks/b1ccbc2fef7f7e5e04f7.js +1 -0
- package/assets/esri/core/workers/chunks/b5c829e904bc9cb5347d.js +1 -0
- package/assets/esri/core/workers/chunks/bec9ddd38c9ab9f2561b.js +1 -0
- package/assets/esri/core/workers/chunks/bf9031749d10e7d457b6.js +1 -0
- package/assets/esri/core/workers/chunks/bf9d09493fd849ea69fd.js +1 -0
- package/assets/esri/core/workers/chunks/c4641c2c130c7b8bcdee.js +1 -0
- package/assets/esri/core/workers/chunks/{58e2652810143f509fe1.js → c473b15d4d52f0a63d20.js} +1 -1
- package/assets/esri/core/workers/chunks/c8e4fe0e3b109eb80e8e.js +1 -0
- package/assets/esri/core/workers/chunks/c9159ebf930af3f336f3.js +1 -0
- package/assets/esri/core/workers/chunks/cd0c222a36caa7f80860.js +1 -0
- package/assets/esri/core/workers/chunks/ce2fcaa21d6efcdf4da5.js +1 -0
- package/assets/esri/core/workers/chunks/d2df6e685d6cffc5f486.js +1 -0
- package/assets/esri/core/workers/chunks/{c27783ce7ea51a5e49c5.js → e153b61560a7a869db63.js} +1 -1
- package/assets/esri/core/workers/chunks/e2c293331515f3bd0355.js +1 -0
- package/assets/esri/core/workers/chunks/{100a0041ee42b0b2fa32.js → e5d974593043d5e2b502.js} +1 -1
- package/assets/esri/core/workers/chunks/ec7b156425f25d231078.js +1 -0
- package/assets/esri/core/workers/chunks/{1194c2432c31def87db1.js → f71b76c9506178124fa3.js} +1 -1
- package/assets/esri/core/workers/chunks/fb456e7425e09df17d8c.js +1 -0
- package/assets/esri/core/workers/chunks/{f6806780ca2aa591475a.js → fe1dcf9f81da4adbb1fe.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/themes/base/_core.scss +0 -2
- package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +10 -7
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/CutFillComposition.glsl.js +15 -3
- package/chunks/CutFillMask.glsl.js +1 -1
- package/chunks/WaterSurface.glsl.js +0 -1
- package/chunks/bundle.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/colorUtils.js +1 -1
- package/config.js +1 -1
- package/core/CollectionFlattener.js +1 -1
- package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +1 -1
- package/geometry/operators/json/graphicBufferOperator.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/geometry/support/geometryUtils.js +1 -1
- package/geometry/support/meshUtils/elevationSampler.js +1 -1
- package/geometry/support/meshUtils.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/interfaces.d.ts +262 -339
- package/kernel.js +1 -1
- package/layers/BaseElevationLayer.js +1 -1
- package/layers/BaseTileLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/dehydratedFeatureComparison.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/ElevationQueryContext.js +5 -0
- package/layers/support/ElevationSampler.js +1 -1
- package/layers/support/ElevationTile.js +1 -1
- package/layers/support/GeometryDescriptor.js +1 -1
- package/layers/support/ParquetEncodingLocation.js +1 -1
- package/layers/support/ParquetEncodingWkb.js +1 -1
- package/layers/support/RasterBandInfo.js +1 -1
- package/layers/support/TileElevationSampler.js +5 -0
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/TileKey.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/parquetEncodingUtils.js +5 -0
- package/layers/support/parquetUtils.js +1 -1
- package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/NetworkSystemLayers.js +1 -1
- package/networks/support/typeUtils.js +1 -1
- package/package.json +3 -2
- package/popup/FieldInfo.js +1 -1
- package/popup/content/AttachmentsContent.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/flow/BrushFlow.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/AnimatableTextureResource.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/utils.js +1 -1
- package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
- package/views/2d/layers/VideoLayerView2D.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/navigation/actions/Pan.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/support/GaussianSplatSortWorker.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
- package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/Viewport2DMixin.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineQueryComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +1 -1
- package/views/analysis/ExclusiveOperationManager.js +5 -0
- package/views/interactive/snapping/LineSnapper.js +1 -1
- package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/PendingFeatureTile.js +1 -1
- package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
- package/views/interactive/snapping/snappingUtils.js +1 -1
- package/views/navigation/Navigation.js +1 -1
- package/views/popupAdapter.js +5 -0
- package/views/support/GroundViewElevationSampler.js +1 -1
- package/views/video/VideoOperationalDataView.js +1 -1
- package/views/webgl/ContextState.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/widgets/Attachments/AttachmentsViewModel.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureMedia/chartCommon.js +1 -1
- package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
- package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/services/DepthImageService.js +5 -0
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/chartUtilsAm5.js +1 -1
- package/assets/esri/core/workers/chunks/08374e5805fcedc1cb57.js +0 -1
- package/assets/esri/core/workers/chunks/0b24a6c06d1becbb6815.js +0 -1
- package/assets/esri/core/workers/chunks/14114be3afd6d292f89c.js +0 -1
- package/assets/esri/core/workers/chunks/19f1bfe815896d4983af.js +0 -1
- package/assets/esri/core/workers/chunks/22c3a21bc9f32c429c48.js +0 -1
- package/assets/esri/core/workers/chunks/2605062e44f2d4e73f14.js +0 -1
- package/assets/esri/core/workers/chunks/282c4f3484c605ce7d5e.js +0 -1
- package/assets/esri/core/workers/chunks/2e1cc11462846febb3b2.js +0 -1
- package/assets/esri/core/workers/chunks/37b5007660535f1c91c6.js +0 -1
- package/assets/esri/core/workers/chunks/393274af1804e5b6046a.js +0 -1
- package/assets/esri/core/workers/chunks/3b2ef975831eb75b40fb.js +0 -1
- package/assets/esri/core/workers/chunks/3ff3e1507220d3869c76.js +0 -1
- package/assets/esri/core/workers/chunks/4133ab8720e7e4afa9a6.js +0 -1
- package/assets/esri/core/workers/chunks/4d807bfe75108438db83.js +0 -1
- package/assets/esri/core/workers/chunks/5ad1985a9e66fb2232ae.js +0 -1
- package/assets/esri/core/workers/chunks/5b7a2ee44883b1fb2a5f.js +0 -1
- package/assets/esri/core/workers/chunks/614a00a3179f8fe23f45.js +0 -1
- package/assets/esri/core/workers/chunks/6aa349e1adf844df4b5b.js +0 -1
- package/assets/esri/core/workers/chunks/83065bef261314f9b2c5.js +0 -1
- package/assets/esri/core/workers/chunks/8bdbd94a59269e216fba.js +0 -1
- package/assets/esri/core/workers/chunks/8cae725e631d922853c8.js +0 -1
- package/assets/esri/core/workers/chunks/8f4cfef97716c3502b0f.js +0 -1
- package/assets/esri/core/workers/chunks/8ff2daef892881ff2019.js +0 -1
- package/assets/esri/core/workers/chunks/9bb6984f24cd5461a754.js +0 -1
- package/assets/esri/core/workers/chunks/9f2a3f37fe9b19ef1209.js +0 -1
- package/assets/esri/core/workers/chunks/a1196637268b89281780.js +0 -1
- package/assets/esri/core/workers/chunks/a6a2d4602dfeb62e0ecc.js +0 -1
- package/assets/esri/core/workers/chunks/b240298b8b643a323d34.js +0 -1
- package/assets/esri/core/workers/chunks/b47f26d6aa9a2848a677.js +0 -1
- package/assets/esri/core/workers/chunks/b661ea374fe38c8e29ca.js +0 -1
- package/assets/esri/core/workers/chunks/b8997ae5893afa0298d1.js +0 -1
- package/assets/esri/core/workers/chunks/baa48614d9567d5f240d.js +0 -1
- package/assets/esri/core/workers/chunks/c20862fe15295a294bbd.js +0 -1
- package/assets/esri/core/workers/chunks/c3020747f9001ca6a6e7.js +0 -1
- package/assets/esri/core/workers/chunks/c7c76a8a1c47eb62bef1.js +0 -1
- package/assets/esri/core/workers/chunks/c95e6bef8c97cf647869.js +0 -1
- package/assets/esri/core/workers/chunks/d71836cf70b9604832f1.js +0 -1
- package/assets/esri/core/workers/chunks/e99fc64b67bb0c71dc34.js +0 -1
- package/assets/esri/core/workers/chunks/eea9d49d55c2d1355497.js +0 -1
- package/assets/esri/core/workers/chunks/fb6ebb780bb59e252887.js +0 -1
- package/assets/esri/core/workers/chunks/ff6d189ba78980d40bb5.js +0 -1
- package/assets/esri/themes/base/widgets/_ButtonMenu.scss +0 -87
- package/chunks/Button.js +0 -5
- package/chunks/ColorSet.js +0 -5
- package/chunks/DefaultTheme.js +0 -5
- package/chunks/LineSeries.js +0 -5
- package/chunks/ResponsiveTheme.js +0 -5
- package/chunks/Theme.js +0 -5
- package/chunks/Tick.js +0 -5
- package/chunks/Tooltip.js +0 -5
- package/chunks/ar.js +0 -5
- package/chunks/bg_BG.js +0 -5
- package/chunks/bs_BA.js +0 -5
- package/chunks/ca_ES.js +0 -5
- package/chunks/chartUtilsAm5.js +0 -5
- package/chunks/cs_CZ.js +0 -5
- package/chunks/da_DK.js +0 -5
- package/chunks/de_CH.js +0 -5
- package/chunks/de_DE.js +0 -5
- package/chunks/el_GR.js +0 -5
- package/chunks/en_CA.js +0 -5
- package/chunks/en_US.js +0 -5
- package/chunks/es_ES.js +0 -5
- package/chunks/et_EE.js +0 -5
- package/chunks/fi_FI.js +0 -5
- package/chunks/fr_FR.js +0 -5
- package/chunks/he_IL.js +0 -5
- package/chunks/hr_HR.js +0 -5
- package/chunks/hu_HU.js +0 -5
- package/chunks/id_ID.js +0 -5
- package/chunks/it_IT.js +0 -5
- package/chunks/ja_JP.js +0 -5
- package/chunks/ko_KR.js +0 -5
- package/chunks/lt_LT.js +0 -5
- package/chunks/lv_LV.js +0 -5
- package/chunks/nb_NO.js +0 -5
- package/chunks/nl_NL.js +0 -5
- package/chunks/pl_PL.js +0 -5
- package/chunks/pt_BR.js +0 -5
- package/chunks/pt_PT.js +0 -5
- package/chunks/ro_RO.js +0 -5
- package/chunks/ru_RU.js +0 -5
- package/chunks/sk_SK.js +0 -5
- package/chunks/sl_SL.js +0 -5
- package/chunks/sr_RS.js +0 -5
- package/chunks/sv_SE.js +0 -5
- package/chunks/th_TH.js +0 -5
- package/chunks/tr_TR.js +0 -5
- package/chunks/uk_UA.js +0 -5
- package/chunks/vi_VN.js +0 -5
- package/chunks/zh_Hans.js +0 -5
- package/chunks/zh_Hant.js +0 -5
- package/widgets/FeatureTable/Grid/support/ButtonMenu.d.ts +0 -4
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +0 -5
- package/widgets/FeatureTable/Grid/support/ButtonMenuItem.d.ts +0 -4
- package/widgets/FeatureTable/Grid/support/ButtonMenuItem.js +0 -5
- package/widgets/FeatureTable/Grid/support/ButtonMenuViewModel.d.ts +0 -4
- package/widgets/FeatureTable/Grid/support/ButtonMenuViewModel.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{markAsTarget as e,fromValues as t}from"../../sketch/normalizedPoint.js";import{DrapedEdgeSnappingCandidate as n}from"../candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as d}from"../candidates/EdgeSnappingCandidate.js";import{VertexSnappingCandidate as r}from"../candidates/VertexSnappingCandidate.js";function a({x:e,y:n,z:d}){return t(e,n,d??0)}function o(t,o){switch(t.type){case"edge":return t.draped?new n({edgeStart:a(t.start),edgeEnd:a(t.end),targetPoint:e(a(t.target)),objectId:t.objectId,getGroundElevation:o}):new d({edgeStart:a(t.start),edgeEnd:a(t.end),targetPoint:e(a(t.target)),objectId:t.objectId,isDraped:!1});case"vertex":return new r({targetPoint:e(a(t.target)),objectId:t.objectId,isDraped:!1})}}function i(e,t){return
|
|
5
|
+
import{markAsTarget as e,fromValues as t}from"../../sketch/normalizedPoint.js";import{DrapedEdgeSnappingCandidate as n}from"../candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as d}from"../candidates/EdgeSnappingCandidate.js";import{VertexSnappingCandidate as r}from"../candidates/VertexSnappingCandidate.js";function a({x:e,y:n,z:d}){return t(e,n,d??0)}function o(t,o){switch(t.type){case"edge":return t.draped?new n({edgeStart:a(t.start),edgeEnd:a(t.end),targetPoint:e(a(t.target)),objectId:t.objectId,getGroundElevation:o}):new d({edgeStart:a(t.start),edgeEnd:a(t.end),targetPoint:e(a(t.target)),objectId:t.objectId,isDraped:!1});case"vertex":return new r({targetPoint:e(a(t.target)),objectId:t.objectId,isDraped:!1})}}function i(e,t){return"3d"===e?.type?(n,d)=>e.elevationProvider.getElevation(n,d,0,t,"ground"):()=>null}export{o as convertSnappingCandidate,i as makeGetGroundElevation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{watch as e,syncAndInitial as t}from"../../../core/reactiveUtils.js";import{intersection as
|
|
5
|
+
import{watch as e,syncAndInitial as t}from"../../../core/reactiveUtils.js";import{intersection as n}from"../../../core/SetUtils.js";import{sqlAnd as r}from"../../../core/sql.js";import{mergeTimeExtents as o}from"../../../core/timeUtils.js";import{s as i}from"../../../chunks/vec32.js";import{makeDehydratedPoint as s}from"../../../layers/graphics/dehydratedPoint.js";import a from"../../../rest/support/Query.js";import{ViewEventPriorities as p}from"../../input/InputManager.js";import{snappingKeys as l}from"../keybindings.js";import{fromAnyMapPoint as c}from"../sketch/normalizedPoint.js";import{isWebMap as m}from"../../../webmap/utils.js";const d=Symbol("grid-placement-graphic");function u(e,t){const n=e.length===t.length&&e[0]===t[0]&&e[1]===t[1];switch(e.length){case 2:return n;case 3:return n&&e[2]===t[2];case 4:return n&&e[2]===t[2]&&e[3]===t[3]}return!1}function g(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function f(e,t){return Math.sqrt(g(e,t))}function y(e,t){t.sort((t,n)=>i(t.targetPoint,e)-i(n.targetPoint,e))}function h({parameters:{point:e,distance:t,returnEdge:n,vertexMode:i,coordinateHelper:{spatialReference:p},filter:l},mode:c,returnZ:m,filter:d}){const u=d?.clone()??new a({where:"1=1"});return u.returnZ=m??"3d"===c,l&&(u.geometry=l.geometry,u.distance=l.distance,u.spatialRelationship=l.spatialRelationship,u.where=r(u.where,l.where),u.timeExtent=o(u.timeExtent,l.timeExtent),u.objectIds=w(u.objectIds,l.objectIds)),{point:s(e[0],e[1],e[2],p.toJSON()),mode:c,distance:t,returnEdge:n,vertexMode:i,query:u.toJSON()}}function w(e,t){return e||t?t?e?Array.from(n(new Set(e),new Set(t))):t:e:null}function j(e,t,n){return{left:c(e.leftVertex.pos,t,n),right:c(e.rightVertex.pos,t,n)}}const b=Symbol("snapping-toggle");function v(n,r=()=>{}){const o=e(()=>({view:n.view,snappingOptions:n.snappingOptions}),({view:e,snappingOptions:t})=>{if(n.removeHandles(b),!e||!t)return;const o=p.TOOL,i=[e.on("key-down",e=>{e.key!==l.toggle||e.repeat||(t.enabledToggled=!0,r())},o),e.on("key-up",e=>{e.key===l.toggle&&(t.enabledToggled=!1,r())},o),e.on("pointer-move",e=>{const n=e.native.ctrlKey;t.enabledToggled!==n&&(t.enabledToggled=n,r())},o)];n.addHandles(i,b)},t);n.addHandles(o)}function x(e){return m(e)&&"utilityNetworks"in e&&!!e.utilityNetworks?.length}function k(e){return"line"===e?.type}export{j as editEdgeToSnappingEdge,d as gridPlacementGraphicSymbol,k as isLine,x as isUtilityNetworkWebMap,h as makeSnappingQuery,u as objectEqual,f as screenDistance,v as setupSnappingToggleHandles,y as sortCandidatesInPlace,g as squaredScreenDistance};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import
|
|
5
|
+
import{__decorate as o}from"tslib";import e from"../../core/Accessor.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import r from"../../core/Logger.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import p from"./NavigationActionMap.js";import n from"./gamepad/GamepadSettings.js";let m=class extends e{constructor(o){super(o),this.actionMap=new p,this.browserTouchPanEnabled=!0,this.gamepad=new n,this.momentumEnabled=!0}get mouseWheelZoomEnabled(){return"zoom"===this.actionMap.mouseWheel}set mouseWheelZoomEnabled(o){t(r.getLogger(this),"mouseWheelZoomEnabled",{replacement:"actionMap.mouseWheel",version:"4.32",warnOnce:!0}),this.actionMap.mouseWheel=o?"zoom":"none"}};o([a({type:p,nonNullable:!0})],m.prototype,"actionMap",void 0),o([a({type:Boolean})],m.prototype,"browserTouchPanEnabled",void 0),o([a({type:n,nonNullable:!0})],m.prototype,"gamepad",void 0),o([a({type:Boolean})],m.prototype,"momentumEnabled",void 0),o([a({type:Boolean})],m.prototype,"mouseWheelZoomEnabled",null),m=o([s("esri.views.navigation.Navigation")],m);const i=m;export{i as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const e="popup",n="manual";function o(e){const{popupElement:n,popup:o}=e||{};return n??o??null}function i(e){return null!=e&&"open"in e&&"declaredClass"in e}function p(e){return!!e&&"arcgis-popup"===e.tagName.toLowerCase()}function t(o,t,a){const[l,u,c]=t;if(a){const[n,o,t]=a;n&&i(o)&&(o.view=null,n.remove(o,e),o!==u&&u&&o.destroy()),n&&t&&p(t)&&(t.view=null,n.remove(t,e),t!==c&&c&&t.remove())}l&&i(u)&&(u.view=o,l.add(u,{key:e,position:n,internal:!0})),l&&c&&p(c)&&(c.view=o,l.add(c,{key:e,position:n,internal:!0}))}async function a(e,n){const{popup:o,popupElement:t}=e;if(i(o)){const e=await o.viewModel.handleViewClick(n);await o.open(e)}else if(t&&p(t)){const e=await t.handleViewClick(n);await t.open(e)}else n?.defer(async()=>{await e.setupPopup();const{popup:o,popupElement:t}=e;if(i(o)&&!e.destroyed&&e.ready&&e.popupEnabled){const e=await o.viewModel.handleViewClick(n);await o.open(e)}else if(t&&p(t)){const e=await t.handleViewClick(n);await t.open(e)}})}function l(e,n){const{popup:o,popupElement:t}=e;if(i(o))return o.open(n);t&&p(t)&&t.open(n)}function u(e,n){i(e)&&e.close(),n&&p(n)&&(n.visible=!1)}export{t as addPopup,u as closePopup,i as isPopup,p as isPopupElement,l as openPopupWithOptions,a as openPopupWithViewClick,o as popupFromView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as r}from"tslib";import{
|
|
5
|
+
import{__decorate as r}from"tslib";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import e from"../../layers/support/ElevationSampler.js";import{elevationNoDataValue as s}from"../3d/terrain/TerrainConst.js";let p=class extends e{constructor(r){super(r),this.noDataValue=s}};r([o({constructOnly:!0})],p.prototype,"view",void 0),r([o({readOnly:!0})],p.prototype,"noDataValue",void 0),p=r([t("esri.views.support.GroundViewElevationSampler")],p);export{p as GroundViewElevationSampler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../Viewpoint.js";import i from"../../core/CollectionFlattener.js";import{destroyMaybe as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../Viewpoint.js";import i from"../../core/CollectionFlattener.js";import{destroyMaybe as s}from"../../core/maybe.js";import{whenOnce as r,watch as a,syncAndInitial as o}from"../../core/reactiveUtils.js";import{initialize as n}from"../../core/workers/workers.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{isLoadedOrLoadFor as h}from"../../geometry/projectionUtils.js";import d from"../../layers/support/TileInfo.js";import m from"../View.js";import{Viewport2DBaseMixin as c}from"../Viewport2DBaseMixin.js";import g from"../2d/AnimationManager.js";import{GoToManager as u}from"../2d/GoToManager.js";import{layerView2DImporter as w}from"../2d/layerViewModuleImportUtils.js";import y from"../2d/tiling/TileInfoView.js";import"../2d/tiling/TileKey.js";import"../2d/tiling/TileQueue.js";import"../2d/tiling/TileStrategy.js";import{extentToScale as f}from"../2d/viewpointUtils.js";import V from"../2d/layers/features/support/TileStore.js";import{hitTest as v}from"../2d/support/hitTestUtils.js";import{Timeline as M}from"../2d/support/Timeline.js";let j,T,_,S;async function b(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:s}]=await Promise.all([import("../2d/webglDeps.js"),import("../2d/mapViewDeps.js")]);j=e,T=t,_=i,S=s}let C=class extends(c(m)){constructor(e){super(e),this.stage=null,this.rootLayerViews=new i({getCollections:()=>[this.layerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.timeline=new M,this.goToManager=new u({view:this}),this.labelManager=null,this.animationsEnabled=!0,this.map=null,this.surface=null,this.padding={top:0,right:0,bottom:0,left:0},n()}initialize(){this.addResolvingPromise(r(()=>this.ready))}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=s(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy()}get graphicsTileStore(){return new V(this.featuresTilingScheme)}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return h(t.spatialReference,i)}async hitTest(e,t){return v(this,e,t)}goTo(e,t){return this.goToManager.goTo(e,t)}toMap(e){return this.stateManager.toMap(e)}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}loadAsyncDependencies(){return b()}hasLayerViewModule(e){return w.hasLayerViewModule(e)}importLayerView(e){return w.importLayerView(e)}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:s,padding:r,size:a}=this;if(!e)return null;const o=s&&"initialViewProperties"in s?s.initialViewProperties:void 0,n=this.stateManager.getUserStartupOptions(this.size),l=o?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,d=l?.rotation??0,m=l?.scale||p&&f(p,[a[0]-r.left-r.right,a[1]-r.top-r.bottom]),c=n.center??h,g=n.rotation??d,u=n.scale??m;return c&&u?new t({targetGeometry:c,scale:u,rotation:g}):null}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container)}_startup(){this.timeline.begin("VideoOperationalDataView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new _({view:this});this._set("labelManager",t);const i=new g({view:this});this._set("animationManager",i);const s=new S({view:this,animationManager:i});this._set("mapViewNavigation",s);const r=new y(d.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",r);const n=new j({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new T(r)});this._set("graphicsView",n),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),this.stage.on("webgl-error",e=>this.fatalError=e.error),a(()=>this.stationary,e=>this.stage.stationary=e,o),a(()=>this.state.id,()=>this.stage.state=this.state,o)],"video-graphics-view"),this._updateStageChildren(),this.timeline.end("VideoOperationalDataView Startup"),this.frameTask.start(),this.stage.viewIsReady=!0,this._set("ready",!0)}_teardown(){this.removeHandles("video-graphics-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.stage.destroy(),this.stage=null;const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}};e([l()],C.prototype,"stage",void 0),e([l({readOnly:!0})],C.prototype,"featuresTilingScheme",void 0),e([l({readOnly:!0})],C.prototype,"graphicsTileStore",null),e([l()],C.prototype,"graphicsView",void 0),e([l({type:M,readOnly:!0})],C.prototype,"timeline",void 0),e([l()],C.prototype,"goToManager",void 0),e([l()],C.prototype,"labelManager",void 0),e([l()],C.prototype,"animationsEnabled",void 0),e([l()],C.prototype,"map",void 0),e([l({readOnly:!0})],C.prototype,"typeSpecificPreconditionsReady",null),e([l({readOnly:!0})],C.prototype,"surface",void 0),C=e([p("esri.views.video.VideoOperationalDataView")],C);const D=C;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class
|
|
5
|
+
import{DrawBufferBack as t}from"./enums.js";class e{constructor(){this.blend=!1,this.blendColor={r:0,g:0,b:0,a:0},this.blendFunction={srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0},this.blendEquation={mode:32774,modeAlpha:32774},this.colorMask={r:!0,g:!0,b:!0,a:!0},this.faceCulling=!1,this.cullFace=1029,this.frontFace=2305,this.scissorTest=!1,this.scissorRect={x:0,y:0,width:0,height:0},this.depthTest=!1,this.depthFunction=513,this.clearDepth=1,this.depthWrite=!0,this.depthRange={zNear:0,zFar:1},this.viewport=null,this.stencilTest=!1,this.polygonOffsetFill=!1,this.polygonOffset=[0,0],this.stencilFunction={face:1032,func:519,ref:0,mask:1},this.clearStencil=0,this.stencilWriteMask=1,this.stencilOperation={face:1032,fail:7680,zFail:7680,zPass:7680},this.clearColor={r:0,g:0,b:0,a:0},this.program=null,this.vertexBuffer=null,this.indexBuffer=null,this.uniformBuffer=null,this.pixelPackBuffer=null,this.pixelUnpackBuffer=null,this.copyReadBuffer=null,this.copyWriteBuffer=null,this.transformFeedbackBuffer=null,this.uniformBufferBindingPoints=new Array,this.transformBufferBindingPoints=new Array,this.readFramebuffer=null,this.drawFramebuffer=null,this.drawBuffers={defaultFramebuffer:[t],fbos:new WeakMap},this.renderbuffer=null,this.activeTexture=0,this.textureUnitMap=new Array,this.vertexArrayObject=null}}export{e as ContextState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../core/has.js";import{disposeMaybe as t}from"../../core/maybe.js";import{after as e}from"../../core/promiseUtils.js";import{Milliseconds as s}from"../../core/time.js";import{webglDebugEnabled as i,checkWebGLError as a,getErrorMessage as r}from"./checkWebGLError.js";import{ContextState as n}from"./ContextState.js";import{ColorAttachment0 as l,baseTextureUnit as h,ResourceType as f,PrimitiveType as o}from"./enums.js";import{InstanceCounter as u}from"./InstanceCounter.js";import{Parameters as c}from"./Parameters.js";import{ProgramCache as d}from"./ProgramCache.js";import{StateTracker as _}from"./renderState.js";import{Texture as b}from"./Texture.js";import{WebGLDriverTest as g}from"./WebGLDriverTest.js";import{Capabilities as p}from"./capabilities/Capabilities.js";let m=class{constructor(t,e){this.gl=t,this.instanceCounter=new u,this._programCache=new d(this),this._transformFeedbackRequestInfo=null,this._state=new n,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(e){this._options=e,this._capabilities=new p(this.gl,e),this._parameters=new c(this.gl,this._capabilities,e),b.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new n,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new _({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)},setDrawBuffers:t=>{if(t)this.setDrawBuffers(t.buffers);else{const{drawFramebuffer:t}=this._state;null===t?this.setDrawBuffers([1029]):0===t.colorAttachments.length?this.setDrawBuffers([0]):this.setDrawBuffers([l])}}}),this.enforceState(),t(this._driverTest),this._driverTest=new g(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new c(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=t(this._driverTest),this._programCache=t(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null,i()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(h+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e);if(i?.length!==t.length||!i.every((e,s)=>e===t[s]))if(t.length>this.parameters.maxDrawBuffers)console.error("Setting more active draw buffers than GL.MAX_DRAW_BUFFERS allows.");else{if(s){if(t.length>1)return void console.error("The default framebuffer can only have one active draw buffer.");if(1029!==t[0]&&0!==t[0])return void console.error("The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers.")}s||!t.includes(1029)?(this.gl.drawBuffers(t),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),this._stateTracker.invalidateDrawBuffers()):console.error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTi or GL.NONE as draw buffers.")}}clear(t,e=255){if(t){if(16384&t){const t=this._state.drawFramebuffer?.colorAttachments;t&&this.setDrawBuffers(t),this.setColorMask(!0,!0,!0,!0)}256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t)}}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i=void 0){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i=void 0){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i=void 0){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=F(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),a(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),a(this.gl)}drawElements(t,e,s,a){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=F(t,e)),this.gl.drawElements(t,e,s,a),i()){const i=r(this.gl);if(i){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:a},o=n?.size??0,u=a+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";console.error(`drawElements: ${i}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,r){this.gl.drawElementsInstanced(t,e,s,i,r),a(this.gl)}logInfo(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){this._state.program!==t&&(this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null))}bindTexture(t,e,s=!1){(e>=this.parameters.maxTextureImageUnits||e<0)&&console.error("Input texture unit is out of range of available units!");const i=this._state.textureUnitMap[e];return null==t?.glName?(null!=i&&(this.setActiveTexture(e,s),this.gl.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[e]=null,i):s||i!==t?(this.setActiveTexture(e,s),this.gl.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,i):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),i)}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(this._stateTracker.invalidateDrawBuffers(),null==t)return this.gl.bindFramebuffer(36160,null),void(this._state.readFramebuffer=this._state.drawFramebuffer=null);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t}}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._stateTracker.invalidateDrawBuffers(),this._state.drawFramebuffer=t??null))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=B(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=B(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=B(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=B(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=B(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=B(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=B(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=B(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return console.error("Uniform buffer binding point is out of range!"),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):console.error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,a){null!=e?(i()&&(a??e.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==a?this.bindBufferRange(35345,t,e.buffer,s,a):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=B(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=B(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=B(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=B(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=B(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=B(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=B(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=s(10)){const{gl:i}=this,a=i.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(f.Sync,a),i.flush();do{await e(t),r=i.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(f.Sync,a),i.deleteSync(a),37149===r)throw new Error("Client wait failed")}getBoundFramebufferObject(t=36160){return 36008===t?this._state.readFramebuffer:this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e,s=!1){const i=this.getBoundFramebufferObject();try{this.bindFramebuffer(t,s),e()}finally{this.bindFramebuffer(i,s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setDrawBuffers([1029]),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(l)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[1029])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[l])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(h+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName)}t.activeTexture(h+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function B(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function F(t,e){switch(t){case o.POINTS:return 2*e;case o.TRIANGLES:return e/3;case o.TRIANGLE_STRIP:case o.TRIANGLE_FAN:return e-2;default:return 0}}export{m as RenderingContext};
|
|
5
|
+
import has from"../../core/has.js";import{disposeMaybe as t}from"../../core/maybe.js";import{after as e}from"../../core/promiseUtils.js";import{Milliseconds as s}from"../../core/time.js";import{webglDebugEnabled as i,checkWebGLError as a,getErrorMessage as r}from"./checkWebGLError.js";import{ContextState as n}from"./ContextState.js";import{DrawBufferBack as l,DrawBufferNone as h,ColorAttachment0 as f,baseTextureUnit as o,ResourceType as u,PrimitiveType as c}from"./enums.js";import{InstanceCounter as d}from"./InstanceCounter.js";import{Parameters as _}from"./Parameters.js";import{ProgramCache as b}from"./ProgramCache.js";import{StateTracker as g}from"./renderState.js";import{Texture as p}from"./Texture.js";import{WebGLDriverTest as m}from"./WebGLDriverTest.js";import{Capabilities as B}from"./capabilities/Capabilities.js";let F=class{constructor(t,e){this.gl=t,this.instanceCounter=new d,this._programCache=new b(this),this._transformFeedbackRequestInfo=null,this._state=new n,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(e){this._options=e,this._capabilities=new B(this.gl,e),this._parameters=new _(this.gl,this._capabilities,e),p.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new n,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new g({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)},setDrawBuffers:t=>{if(t)this.setDrawBuffers(t.buffers);else{const{drawFramebuffer:t}=this._state;null===t?this.setDrawBuffers([l]):0===t.colorAttachments.length?this.setDrawBuffers([h]):this.setDrawBuffers([f])}}}),this.enforceState(),t(this._driverTest),this._driverTest=new m(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new _(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=t(this._driverTest),this._programCache=t(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null,i()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(o+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e);if(i?.length!==t.length||!i.every((e,s)=>e===t[s]))if(t.length>this.parameters.maxDrawBuffers)console.error("Setting more active draw buffers than GL.MAX_DRAW_BUFFERS allows.");else{if(s){if(t.length>1)return void console.error("The default framebuffer can only have one active draw buffer.");if(t[0]!==l&&t[0]!==h)return void console.error("The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers.")}s||!t.includes(l)?(this.gl.drawBuffers(t),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),this._stateTracker.invalidateDrawBuffers()):console.error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTi or GL.NONE as draw buffers.")}}clear(t,e=255){if(t){if(16384&t){const t=this._state.drawFramebuffer?.colorAttachments;t&&this.setDrawBuffers(t),this.setColorMask(!0,!0,!0,!0)}256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t)}}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i=void 0){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i=void 0){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i=void 0){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=x(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),a(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),a(this.gl)}drawElements(t,e,s,a){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=x(t,e)),this.gl.drawElements(t,e,s,a),i()){const i=r(this.gl);if(i){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:a},o=n?.size??0,u=a+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";console.error(`drawElements: ${i}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,r){this.gl.drawElementsInstanced(t,e,s,i,r),a(this.gl)}logInfo(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){this._state.program!==t&&(this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null))}bindTexture(t,e,s=!1){(e>=this.parameters.maxTextureImageUnits||e<0)&&console.error("Input texture unit is out of range of available units!");const i=this._state.textureUnitMap[e];return null==t?.glName?(null!=i&&(this.setActiveTexture(e,s),this.gl.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[e]=null,i):s||i!==t?(this.setActiveTexture(e,s),this.gl.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,i):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),i)}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(this._stateTracker.invalidateDrawBuffers(),null==t)return this.gl.bindFramebuffer(36160,null),void(this._state.readFramebuffer=this._state.drawFramebuffer=null);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t}}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._stateTracker.invalidateDrawBuffers(),this._state.drawFramebuffer=t??null))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=T(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=T(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=T(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=T(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=T(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=T(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=T(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=T(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return console.error("Uniform buffer binding point is out of range!"),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):console.error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,a){null!=e?(i()&&(a??e.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==a?this.bindBufferRange(35345,t,e.buffer,s,a):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=T(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=T(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=T(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=T(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=T(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=T(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=T(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=s(10)){const{gl:i}=this,a=i.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(u.Sync,a),i.flush();do{await e(t),r=i.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(u.Sync,a),i.deleteSync(a),37149===r)throw new Error("Client wait failed")}getBoundFramebufferObject(t=36160){return 36008===t?this._state.readFramebuffer:this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e,s=!1){const i=this.getBoundFramebufferObject();try{this.bindFramebuffer(t,s),e()}finally{this.bindFramebuffer(i,s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setDrawBuffers([l]),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(f)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[l])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[f])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(o+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName)}t.activeTexture(o+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function T(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function x(t,e){switch(t){case c.POINTS:return 2*e;case c.TRIANGLES:return e/3;case c.TRIANGLE_STRIP:case c.TRIANGLE_FAN:return e-2;default:return 0}}export{F as RenderingContext};
|
package/views/webgl/enums.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const _={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},R={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,HALF_FLOAT:5131},E={RGBA4:32854,R16F:33325,RG16F:33327,RGB32F:34837,RGBA16F:34842,R32F:33326,RG32F:33328,RGBA32F:34836,R11F_G11F_B10F:35898,RGB8:32849,RGBA8:32856,RGB5_A1:32855,R8:33321,RG8:33323,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,RGB16F:34843,RGB9_E5:35901,SRGB8:35905,SRGB8_ALPHA8:35907,RGB565:36194,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2:32857,RGB10_A2UI:36975},S=Object.values(E),G={DEPTH24_STENCIL8:35056,DEPTH32F_STENCIL8:36013},T={DEPTH_COMPONENT16:33189,DEPTH_COMPONENT24:33190,DEPTH_COMPONENT32F:36012},N={FLOAT:R.FLOAT,UNSIGNED_BYTE:R.UNSIGNED_BYTE,UNSIGNED_INT_24_8:34042,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,BYTE:R.BYTE,UNSIGNED_SHORT:R.UNSIGNED_SHORT,SHORT:R.SHORT,UNSIGNED_INT:R.UNSIGNED_INT,INT:R.INT,HALF_FLOAT:5131,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269},I=33984,O={Texture:0,TileTexture:1,BufferObject:2,VertexArrayObject:3,Shader:4,Program:5,FramebufferObject:6,Renderbuffer:7,TransformFeedback:8,Sync:9,UNCOUNTED:10,LinesOfCode:10,Uniform:11,COUNT:12},B=
|
|
5
|
+
const _={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},R={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,HALF_FLOAT:5131},E={RGBA4:32854,R16F:33325,RG16F:33327,RGB32F:34837,RGBA16F:34842,R32F:33326,RG32F:33328,RGBA32F:34836,R11F_G11F_B10F:35898,RGB8:32849,RGBA8:32856,RGB5_A1:32855,R8:33321,RG8:33323,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,RGB16F:34843,RGB9_E5:35901,SRGB8:35905,SRGB8_ALPHA8:35907,RGB565:36194,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2:32857,RGB10_A2UI:36975},S=Object.values(E),G={DEPTH24_STENCIL8:35056,DEPTH32F_STENCIL8:36013},T={DEPTH_COMPONENT16:33189,DEPTH_COMPONENT24:33190,DEPTH_COMPONENT32F:36012},N={FLOAT:R.FLOAT,UNSIGNED_BYTE:R.UNSIGNED_BYTE,UNSIGNED_INT_24_8:34042,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,BYTE:R.BYTE,UNSIGNED_SHORT:R.UNSIGNED_SHORT,SHORT:R.SHORT,UNSIGNED_INT:R.UNSIGNED_INT,INT:R.INT,HALF_FLOAT:5131,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269},I=33984,O={Texture:0,TileTexture:1,BufferObject:2,VertexArrayObject:3,Shader:4,Program:5,FramebufferObject:6,Renderbuffer:7,TransformFeedback:8,Sync:9,UNCOUNTED:10,LinesOfCode:10,Uniform:11,COUNT:12},B=1029,A=0,D=36064,C=36065,U=36066,P=36067,F=36068,H=36069,e=36070,L=36071,M=36072,r=36073,f=36074,t=36075,X=36076,a=36077,b=36078,c=36079,n=33306,o=36096,u=36128,Y={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497};export{D as ColorAttachment0,C as ColorAttachment1,f as ColorAttachment10,t as ColorAttachment11,X as ColorAttachment12,a as ColorAttachment13,b as ColorAttachment14,c as ColorAttachment15,U as ColorAttachment2,P as ColorAttachment3,F as ColorAttachment4,H as ColorAttachment5,e as ColorAttachment6,L as ColorAttachment7,M as ColorAttachment8,r as ColorAttachment9,Y as CompressedTextureFormat,R as DataType,o as DepthAttachment,n as DepthStencilAttachment,B as DrawBufferBack,A as DrawBufferNone,N as PixelType,_ as PrimitiveType,O as ResourceType,T as SizedDepthFormat,G as SizedDepthStencilFormat,E as SizedPixelFormat,u as StencilAttachment,I as baseTextureUnit,S as sizedPixelFormatValues};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import a from"../../core/Accessor.js";import i from"../../core/Collection.js";import n from"../../core/Error.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{cast as c}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../popup/support/AttachmentsOrderByInfo.js";import l from"../../rest/query/support/AttachmentInfo.js";import p from"../../rest/support/AttachmentQuery.js";import{getSourceLayer as m}from"../Feature/support/featureUtils.js";const u={editing:!1,operations:{add:!0,update:!0,delete:!0}},f=i.ofType(l);let y=class extends a{constructor(t){super(t),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.attachmentKeywords=null,this.attachmentTypes=null,this.capabilities={...u},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new f,this.fileInfos=new i,this.graphic=null,this.mode="view",this.orderByFields=null,this.filesEnabled=!1,this.addHandles(r(()=>this.graphic,()=>this._graphicChanged(),s))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(t){return{...u,...t}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:t}=this;if(!t)return!1;const e=t.layer||t.sourceLayer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsResize||!1}get supportsTypeWildcard(){const{graphic:t}=this;if(!t)return!1;const e=t.layer||t.sourceLayer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsTypeWildcard||!1}async getAttachments(){const{_attachmentLayer:t,attachmentInfos:e,orderByFields:a,attachmentTypes:i,attachmentKeywords:r,supportsTypeWildcard:s}=this;if(!t||"function"!=typeof t.queryAttachments)throw new n("invalid-layer","getAttachments(): A valid layer is required.");const o=this._getObjectId();if("number"!=typeof o)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const c=a?.map(t=>`${t.field} ${"descending"===t.order?"DESC":"ASC"}`),h=new p({objectIds:[o],returnMetadata:!0,orderByFields:c,attachmentTypes:s?i?.map(t=>`${t}/*`):void 0,keywords:r}),d=[],l=t.queryAttachments(h).then(t=>t[o]||d).catch(()=>d);this._getAttachmentsPromise=l,this.notifyChange("state");const m=await l;return e.destroyAll(),m.length&&e.addMany(m),this._getAttachmentsPromise=null,this.notifyChange("state"),m}async addAttachment(t,e=this.graphic){const{_attachmentLayer:a,attachmentInfos:i,capabilities:r}=this;if(!e)throw new n("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:e});if(!t)throw new n("invalid-attachment","addAttachment(): An attachment is required.",{attachment:t});if(!r.operations?.add)throw new n("invalid-capabilities","addAttachment(): add capabilities are required.");if(!a||"function"!=typeof a.addAttachment)throw new n("invalid-layer","addAttachment(): A valid layer is required.");const s=a.addAttachment(e,t).then(t=>this._queryAttachment(t.objectId,e)),o=await s;return i.add(o),o}async deleteAttachment(t){const{_attachmentLayer:e,attachmentInfos:a,graphic:i,capabilities:r}=this;if(!t)throw new n("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!r.operations?.delete)throw new n("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!e||"function"!=typeof e.deleteAttachments)throw new n("invalid-layer","deleteAttachment(): A valid layer is required.");if(!i)throw new n("invalid-graphic","deleteAttachment(): A graphic is required.");const s=e.deleteAttachments(i,[t.id]).then(()=>t),o=await s;return a.remove(o),o.destroy(),o}async updateAttachment(t,e=this.activeAttachmentInfo){const{_attachmentLayer:a,attachmentInfos:i,graphic:r,capabilities:s}=this;if(!t)throw new n("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:t});if(!e)throw new n("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!s.operations?.update)throw new n("invalid-capabilities","updateAttachment(): Update capabilities are required.");const o=i.indexOf(e);if(!a||"function"!=typeof a.updateAttachment)throw new n("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new n("invalid-graphic","updateAttachment(): A graphic is required.");const c=a.updateAttachment(r,e.id,t).then(t=>this._queryAttachment(t.objectId)),h=await c;return i.splice(o,1,h),h}async commitFiles(){return await Promise.all(this.fileInfos.items.map(t=>this.addAttachment(t.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(t,e){if(!t||!e)return null;const a={file:t,form:e};return this.fileInfos.add(a),a}updateFile(t,e,a=this.activeFileInfo){if(!t||!e||!a)return null;const i=this.fileInfos.indexOf(a);return i>-1&&this.fileInfos.splice(i,1,{file:t,form:e}),this.fileInfos.items[i]}deleteFile(t){const e=this.fileInfos.find(e=>e.file===t);return e?(this.fileInfos.remove(e),e):null}async _queryAttachment(t,e){const{_attachmentLayer:a}=this;if(!t||!a?.queryAttachments)throw new n("invalid-attachment-id","Could not query attachment.");const i=this._getObjectId(e);if("number"!=typeof i)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const r=new p({objectIds:[i],attachmentsWhere:`AttachmentId=${t}`,returnMetadata:!0});return a.queryAttachments(r).then(t=>t[i][0])}_getObjectId(t=this.graphic){return t?.getObjectId()??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>this.attachmentInfos.destroyAll()))}_setAttachmentLayer(){const{graphic:t}=this,e=m(t);this._attachmentLayer=e?"scene"===e.type&&null!=e.associatedLayer?e.associatedLayer:e:null}};t([o({type:[String]})],y.prototype,"attachmentKeywords",void 0),t([o({type:[["application","audio","image","model","text","video"]]})],y.prototype,"attachmentTypes",void 0),t([o()],y.prototype,"capabilities",void 0),t([c("capabilities")],y.prototype,"castCapabilities",null),t([o()],y.prototype,"activeAttachmentInfo",void 0),t([o()],y.prototype,"activeFileInfo",void 0),t([o({readOnly:!0,type:f})],y.prototype,"attachmentInfos",void 0),t([o()],y.prototype,"fileInfos",void 0),t([o({type:e})],y.prototype,"graphic",void 0),t([o()],y.prototype,"mode",void 0),t([o({type:[d]})],y.prototype,"orderByFields",void 0),t([o({readOnly:!0})],y.prototype,"state",null),t([o()],y.prototype,"filesEnabled",void 0),t([o({readOnly:!0})],y.prototype,"supportsResizeAttachments",null),t([o({readOnly:!0})],y.prototype,"supportsTypeWildcard",null),y=t([h("esri.widgets.Attachments.AttachmentsViewModel")],y);export{y as default};
|
package/widgets/Attachments.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../core/Error.js";import{on as s,watch as i,initial as a}from"../core/reactiveUtils.js";import{formatFileSize as n}from"../core/unitFormatUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import c from"./Attachments/AttachmentsViewModel.js";import{getIconPath as m,isSupportedImage as h}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{legacyIcon as b}from"./support/legacyIcon.js";import{discardNode as _,storeNode as g,isRTL as f}from"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{tsx as y}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";const A={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},w="esri-attachments",F={base:w,loaderContainer:`${w}__loader-container`,loader:`${w}__loader`,container:`${w}__container`,containerList:`${w}__container--list`,containerPreview:`${w}__container--preview`,actions:`${w}__actions`,deleteButton:`${w}__delete-button`,addAttachmentButton:`${w}__add-attachment-button`,errorMessage:`${w}__error-message`,items:`${w}__items`,item:`${w}__item`,itemButton:`${w}__item-button`,itemMask:`${w}__item-mask`,itemMaskIcon:`${w}__item-mask--icon`,itemImage:`${w}__image`,itemImageResizable:`${w}__image--resizable`,itemLabel:`${w}__label`,itemFilename:`${w}__filename`,itemChevronIcon:`${w}__item-chevron-icon`,itemLink:`${w}__item-link`,itemLinkOverlay:`${w}__item-link-overlay`,itemLinkOverlayIcon:`${w}__item-link-overlay-icon`,itemAddIcon:`${w}__item-add-icon`,formNode:`${w}__form-node`,fileFieldset:`${w}__file-fieldset`,fileLabel:`${w}__file-label`,fileName:`${w}__file-name`,fileInput:`${w}__file-input`,metadata:`${w}__metadata`,metadataFieldset:`${w}__metadata-fieldset`,progressBar:`${w}__progress-bar`},k=window.CSS;let M=class extends d{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...A},this._supportsImageOrientation=k&&k.supports&&k.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e?.viewModel||(e={viewModel:new c,...e}),e}initialize(){this.addHandles([s(()=>this.viewModel?.attachmentInfos,"change",()=>this.scheduleRender()),s(()=>this.viewModel?.fileInfos,"change",()=>this.scheduleRender()),i(()=>this.viewModel?.mode,()=>this._modeChanged(),a)])}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"attachment"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...A,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:add-attachment",this.messages.addErrorMessage,e)),e})}deleteAttachment(e){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(s).then(t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:update-attachment",this.messages.updateErrorMessage,e)),e})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return y("div",{class:this.classes(F.base,p.widget)},e?this._renderProgressBar():null,"loading"===s?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?y("div",{class:F.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this._renderAddForm():"edit"===t?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return y("div",{class:F.loaderContainer,key:"loader"},y("div",{class:F.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?y("div",{class:F.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,p.buttonSmall,p.buttonHalf,e&&p.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?y("button",{class:this.classes(p.button,p.buttonSecondary,p.buttonSmall,p.buttonHalf,{[p.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,n=t?y("span",{class:F.fileName,key:"file-name"},t.name):null,l=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},y("fieldset",{class:F.fileFieldset},n,y("label",{class:this.classes(F.fileLabel,p.button,p.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,y("input",{bind:this,class:F.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),a,i);return y("div",{class:F.formNode,key:"add-form-container"},l)}_renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:l}=s,r=a||!i;let o,d,c,m;i?(o=i.type,d=i.name,c=i.size):e&&"file"in e?(o=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(o=e.contentType,d=e.name,c=e.size,m=e.url);const h=l.editing&&l.operations?.delete&&t.deleteButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,F.deleteButton,{[p.buttonDisabled]:a}),disabled:a,key:"delete-button",onclick:t=>this._submitDeleteAttachment(t,e),type:"button"},this.messages.delete):void 0,u=l.editing&&l.operations?.update&&t.updateButton?y("button",{class:this.classes(p.button,p.buttonSmall,p.buttonThird,{[p.buttonDisabled]:r}),disabled:r,key:"update-button",type:"submit"},this.messages.update):void 0,b=this.visibleElements.cancelUpdateButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,p.buttonThird,{[p.buttonDisabled]:a}),disabled:a,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,f=l.editing&&l.operations?.update?y("fieldset",{class:F.fileFieldset,key:"file"},y("span",{class:F.fileName,key:"file-name"},d),y("label",{class:this.classes(F.fileLabel,p.button,p.buttonSecondary)},this.messages.changeFile,y("input",{bind:this,class:F.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,v=y("fieldset",{class:F.metadataFieldset,key:"size"},y("label",null,n(this.messagesUnits,c??0))),A=y("fieldset",{class:F.metadataFieldset,key:"content-type"},y("label",null,o)),w=null!=m?y("a",{class:F.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),y("div",{class:F.itemLinkOverlay},y("span",{class:F.itemLinkOverlayIcon},y("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),k=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},y("div",{class:F.metadata},v,A),f,y("div",{class:F.actions},h,b,u));return y("div",{class:F.formNode,key:"edit-form-container"},w,k)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=m(t),a={[F.itemImageResizable]:s};return y("div",{class:this.classes(F.itemMaskIcon,F.itemMask),key:i},y("img",{alt:e,class:this.classes(a,F.itemImage),src:i,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,size:n,url:l}=e;if(!s||!h(i))return this._renderGenericImageMask(a,i);const r=this._getCSSTransform(e),o=r?{transform:r,"image-orientation":"none"}:{},d=`${l}${l?.includes("?")?"&":"?"}w=${t}&s=${n}`,c={[F.itemImageResizable]:s};return y("div",{class:this.classes(F.itemMask),key:d},y("img",{alt:a,class:this.classes(c,F.itemImage),src:d,styles:o,title:a}))}_renderFile(e){const{file:t}=e;return y("li",{class:F.item,key:t},y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:F.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),y("label",{class:F.itemLabel},y("span",{class:F.itemFilename},t.name||this.messages.noTitle),y("span",{"aria-hidden":"true",class:this.classes(F.itemChevronIcon,f(this.container)?b.left:b.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:l,name:r,url:o}=e,d=this._renderImageMask(e,"list"===t?48:400),c=a.editing?y("span",{"aria-hidden":"true",class:this.classes(F.itemChevronIcon,f(this.container)?b.left:b.right)}):null,m=[d,"preview"===i&&n&&h(l)?null:y("label",{class:F.itemLabel},y("span",{class:F.itemFilename},r||this.messages.noTitle),c)],u=a.editing?y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:F.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},m):y("a",{class:F.itemButton,href:o??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},m);return y("li",{class:F.item,key:e},u)}_renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,l=!!i?.length,r=!!n?.length,o={[F.containerList]:"preview"!==e,[F.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,F.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},y("span",{"aria-hidden":"true",class:this.classes(F.itemAddIcon,b.plus)}),this.messages.add):void 0,c=l?y("ul",{class:F.items,key:"attachments-list"},i.toArray().map(t=>this._renderAttachmentInfo({attachmentInfo:t,displayType:e}))):void 0,m=r?y("ul",{class:F.items,key:"file-list"},n.toArray().map(e=>this._renderFile(e))):void 0,h=r||l?void 0:y("div",{class:p.empty},this.messages.noAttachments);return y("div",{class:this.classes(F.container,o),key:"attachments-container"},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t.files?.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([l()],M.prototype,"capabilities",null),e([l()],M.prototype,"displayType",void 0),e([l({readOnly:!0})],M.prototype,"effectiveDisplayType",null),e([l()],M.prototype,"graphic",null),e([l()],M.prototype,"icon",null),e([l()],M.prototype,"label",null),e([l(),v("esri/widgets/Attachments/t9n/Attachments")],M.prototype,"messages",void 0),e([l(),v("esri/core/t9n/Units")],M.prototype,"messagesUnits",void 0),e([l({readOnly:!0})],M.prototype,"selectedFile",void 0),e([l({readOnly:!0})],M.prototype,"submitting",void 0),e([l({readOnly:!0})],M.prototype,"error",void 0),e([l({type:c})],M.prototype,"viewModel",void 0),e([l()],M.prototype,"visibleElements",void 0),e([r("visibleElements")],M.prototype,"castVisibleElements",null),M=e([o("esri.widgets.Attachments")],M);export{M as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../core/Error.js";import{on as s,watch as i,initial as a}from"../core/reactiveUtils.js";import{formatFileSize as n}from"../core/unitFormatUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{cast as l}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import c from"./Attachments/AttachmentsViewModel.js";import{getIconPath as m,isSupportedImage as h}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{legacyIcon as b}from"./support/legacyIcon.js";import{discardNode as _,storeNode as g,isRTL as v}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as y}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";const w={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},A="esri-attachments",M={base:A,loaderContainer:`${A}__loader-container`,loader:`${A}__loader`,container:`${A}__container`,containerList:`${A}__container--list`,containerPreview:`${A}__container--preview`,actions:`${A}__actions`,deleteButton:`${A}__delete-button`,addAttachmentButton:`${A}__add-attachment-button`,errorMessage:`${A}__error-message`,items:`${A}__items`,item:`${A}__item`,itemButton:`${A}__item-button`,itemMask:`${A}__item-mask`,itemMaskIcon:`${A}__item-mask--icon`,itemImage:`${A}__image`,itemImageResizable:`${A}__image--resizable`,itemLabel:`${A}__label`,itemFilename:`${A}__filename`,itemChevronIcon:`${A}__item-chevron-icon`,itemLink:`${A}__item-link`,itemLinkOverlay:`${A}__item-link-overlay`,itemLinkOverlayIcon:`${A}__item-link-overlay-icon`,itemAddIcon:`${A}__item-add-icon`,formNode:`${A}__form-node`,fileFieldset:`${A}__file-fieldset`,fileLabel:`${A}__file-label`,fileName:`${A}__file-name`,fileInput:`${A}__file-input`,metadata:`${A}__metadata`,metadataFieldset:`${A}__metadata-fieldset`,progressBar:`${A}__progress-bar`},F=window.CSS;let k=class extends d{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...w},this._supportsImageOrientation=F&&F.supports&&F.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e?.viewModel||(e={viewModel:new c,...e}),e}initialize(){this.addHandles([s(()=>this.viewModel?.attachmentInfos,"change",()=>this.scheduleRender()),s(()=>this.viewModel?.fileInfos,"change",()=>this.scheduleRender()),i(()=>this.viewModel?.mode,()=>this._modeChanged(),a)])}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get attachmentKeywords(){return this.viewModel.attachmentKeywords}set attachmentKeywords(e){this.viewModel.attachmentKeywords=e}get attachmentTypes(){return this.viewModel.attachmentTypes}set attachmentTypes(e){this.viewModel.attachmentTypes=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"attachment"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...w,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:add-attachment",this.messages.addErrorMessage,e)),e})}deleteAttachment(e){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(s).then(t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:update-attachment",this.messages.updateErrorMessage,e)),e})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return y("div",{class:this.classes(M.base,p.widget)},e?this._renderProgressBar():null,"loading"===s?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?y("div",{class:M.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this._renderAddForm():"edit"===t?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return y("div",{class:M.loaderContainer,key:"loader"},y("div",{class:M.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?y("div",{class:M.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,p.buttonSmall,p.buttonHalf,e&&p.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?y("button",{class:this.classes(p.button,p.buttonSecondary,p.buttonSmall,p.buttonHalf,{[p.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,n=t?y("span",{class:M.fileName,key:"file-name"},t.name):null,r=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},y("fieldset",{class:M.fileFieldset},n,y("label",{class:this.classes(M.fileLabel,p.button,p.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,y("input",{bind:this,class:M.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),a,i);return y("div",{class:M.formNode,key:"add-form-container"},r)}_renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:r}=s,l=a||!i;let o,d,c,m;i?(o=i.type,d=i.name,c=i.size):e&&"file"in e?(o=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(o=e.contentType,d=e.name,c=e.size,m=e.url);const h=r.editing&&r.operations?.delete&&t.deleteButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,M.deleteButton,{[p.buttonDisabled]:a}),disabled:a,key:"delete-button",onclick:t=>this._submitDeleteAttachment(t,e),type:"button"},this.messages.delete):void 0,u=r.editing&&r.operations?.update&&t.updateButton?y("button",{class:this.classes(p.button,p.buttonSmall,p.buttonThird,{[p.buttonDisabled]:l}),disabled:l,key:"update-button",type:"submit"},this.messages.update):void 0,b=this.visibleElements.cancelUpdateButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,p.buttonThird,{[p.buttonDisabled]:a}),disabled:a,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,v=r.editing&&r.operations?.update?y("fieldset",{class:M.fileFieldset,key:"file"},y("span",{class:M.fileName,key:"file-name"},d),y("label",{class:this.classes(M.fileLabel,p.button,p.buttonSecondary)},this.messages.changeFile,y("input",{bind:this,class:M.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,f=y("fieldset",{class:M.metadataFieldset,key:"size"},y("label",null,n(this.messagesUnits,c??0))),w=y("fieldset",{class:M.metadataFieldset,key:"content-type"},y("label",null,o)),A=null!=m?y("a",{class:M.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),y("div",{class:M.itemLinkOverlay},y("span",{class:M.itemLinkOverlayIcon},y("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),F=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},y("div",{class:M.metadata},f,w),v,y("div",{class:M.actions},h,b,u));return y("div",{class:M.formNode,key:"edit-form-container"},A,F)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=m(t),a={[M.itemImageResizable]:s};return y("div",{class:this.classes(M.itemMaskIcon,M.itemMask),key:i},y("img",{alt:e,class:this.classes(a,M.itemImage),src:i,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,size:n,url:r}=e;if(!s||!h(i))return this._renderGenericImageMask(a,i);const l=this._getCSSTransform(e),o=l?{transform:l,"image-orientation":"none"}:{},d=`${r}${r?.includes("?")?"&":"?"}w=${t}&s=${n}`,c={[M.itemImageResizable]:s};return y("div",{class:this.classes(M.itemMask),key:d},y("img",{alt:a,class:this.classes(c,M.itemImage),src:d,styles:o,title:a}))}_renderFile(e){const{file:t}=e;return y("li",{class:M.item,key:t},y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:M.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),y("label",{class:M.itemLabel},y("span",{class:M.itemFilename},t.name||this.messages.noTitle),y("span",{"aria-hidden":"true",class:this.classes(M.itemChevronIcon,v(this.container)?b.left:b.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:r,name:l,url:o}=e,d=this._renderImageMask(e,"list"===t?48:400),c=a.editing?y("span",{"aria-hidden":"true",class:this.classes(M.itemChevronIcon,v(this.container)?b.left:b.right)}):null,m=[d,"preview"===i&&n&&h(r)?null:y("label",{class:M.itemLabel},y("span",{class:M.itemFilename},l||this.messages.noTitle),c)],u=a.editing?y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:M.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},m):y("a",{class:M.itemButton,href:o??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},m);return y("li",{class:M.item,key:e},u)}_renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,r=!!i?.length,l=!!n?.length,o={[M.containerList]:"preview"!==e,[M.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,M.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},y("span",{"aria-hidden":"true",class:this.classes(M.itemAddIcon,b.plus)}),this.messages.add):void 0,c=r?y("ul",{class:M.items,key:"attachments-list"},i.toArray().map(t=>this._renderAttachmentInfo({attachmentInfo:t,displayType:e}))):void 0,m=l?y("ul",{class:M.items,key:"file-list"},n.toArray().map(e=>this._renderFile(e))):void 0,h=l||r?void 0:y("div",{class:p.empty},this.messages.noAttachments);return y("div",{class:this.classes(M.container,o),key:"attachments-container"},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t.files?.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([r()],k.prototype,"capabilities",null),e([r()],k.prototype,"displayType",void 0),e([r({readOnly:!0})],k.prototype,"effectiveDisplayType",null),e([r()],k.prototype,"attachmentKeywords",null),e([r()],k.prototype,"attachmentTypes",null),e([r()],k.prototype,"graphic",null),e([r()],k.prototype,"icon",null),e([r()],k.prototype,"label",null),e([r(),f("esri/widgets/Attachments/t9n/Attachments")],k.prototype,"messages",void 0),e([r(),f("esri/core/t9n/Units")],k.prototype,"messagesUnits",void 0),e([r({readOnly:!0})],k.prototype,"selectedFile",void 0),e([r({readOnly:!0})],k.prototype,"submitting",void 0),e([r({readOnly:!0})],k.prototype,"error",void 0),e([r({type:c})],k.prototype,"viewModel",void 0),e([r()],k.prototype,"visibleElements",void 0),e([l("visibleElements")],k.prototype,"castVisibleElements",null),k=e([o("esri.widgets.Attachments")],k);export{k as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{isTiledLayer as i,isBasemap3DSupportedLayer as r,isIntegratedMesh3DTilesLayer as n,isBasemapSupportedTiledLayer as s}from"../../../layers/support/layerUtils.js";import{stringFromViewingMode as l}from"../../../views/ViewingMode.js";import{getTileInfoAndExtentFromWMTSLayer as o,checkIfTileInfoSupportedForView as p}from"../../../views/3d/terrain/terrainUtils.js";import{TilingScheme as c}from"../../../views/3d/terrain/TilingScheme.js";import{isSpatialReferenceSupported as m}from"../../../views/support/spatialReferenceSupport.js";async function f(e,t={}){const{basemap:i,view:r}=e;await i.load(t),w(i),await h(i,r,t),a(t)}async function u(t,r={}){const{basemap:n,view:s}=t;a(r);const l=n.baseLayers.find(e=>"unknown"===e.type)?.loadError;if(null!=l)throw l;if(!s||"spatialReferenceLocked"in s&&!s.spatialReferenceLocked)return;if(await n.load(r),a(r),0===n.baseLayers.length)return;const o=n.baseLayers.at(0);if(!i(o))return;if(n.spatialReference){if(s.spatialReference.equals(n.spatialReference))return;y()}await o.load(r),a(r);const p=(("supportedSpatialReferences"in o?o.supportedSpatialReferences:null)||["tileInfo"in o?o.tileInfo?.spatialReference:null]).filter(e);0!==p.length&&p.every(e=>!s.spatialReference.equals(e))&&y()}function y(){throw new t("basemap-compatibility:incompatible-spatial-reference","Basemap spatial reference is not compatible with the view")}function w(e){if(0===e.baseLayers.length&&0===e.groundLayers.length&&0===e.referenceLayers.length)return;const t=e.baseLayers.concat(e.referenceLayers).toArray().filter(e=>!r(e)).map(e=>b(e));if(t.length)throw t[0];if(e.groundLayers){if(e.groundLayers.filter(e=>!n(e
|
|
5
|
+
import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{isTiledLayer as i,isBasemap3DSupportedLayer as r,isIntegratedMesh3DTilesLayer as n,isBasemapSupportedTiledLayer as s}from"../../../layers/support/layerUtils.js";import{stringFromViewingMode as l}from"../../../views/ViewingMode.js";import{getTileInfoAndExtentFromWMTSLayer as o,checkIfTileInfoSupportedForView as p}from"../../../views/3d/terrain/terrainUtils.js";import{TilingScheme as c}from"../../../views/3d/terrain/TilingScheme.js";import{isSpatialReferenceSupported as m}from"../../../views/support/spatialReferenceSupport.js";async function f(e,t={}){const{basemap:i,view:r}=e;await i.load(t),w(i),await h(i,r,t),a(t)}async function u(t,r={}){const{basemap:n,view:s}=t;a(r);const l=n.baseLayers.find(e=>"unknown"===e.type)?.loadError;if(null!=l)throw l;if(!s||"spatialReferenceLocked"in s&&!s.spatialReferenceLocked)return;if(await n.load(r),a(r),0===n.baseLayers.length)return;const o=n.baseLayers.at(0);if(!i(o))return;if(n.spatialReference){if(s.spatialReference.equals(n.spatialReference))return;y()}await o.load(r),a(r);const p=(("supportedSpatialReferences"in o?o.supportedSpatialReferences:null)||["tileInfo"in o?o.tileInfo?.spatialReference:null]).filter(e);0!==p.length&&p.every(e=>!s.spatialReference.equals(e))&&y()}function y(){throw new t("basemap-compatibility:incompatible-spatial-reference","Basemap spatial reference is not compatible with the view")}function w(e){if(0===e.baseLayers.length&&0===e.groundLayers.length&&0===e.referenceLayers.length)return;const t=e.baseLayers.concat(e.referenceLayers).toArray().filter(e=>!r(e)).map(e=>b(e));if(t.length)throw t[0];if(e.groundLayers){if(e.groundLayers.filter(e=>!n(e)).map(e=>b(e)).length)throw t[0]}}function b(e){return new t("basemap-compatibility:unsupported-basemap-layer-type","Unsupported basemap layer type ${operationalLayerType}",{layer:e,operationalLayerType:e.operationalLayerType||"unknown"})}async function h(e,a,i){let r=e.baseLayers.at(0);if(e.groundLayers?.length>0)r=e.groundLayers.at(0);else{if(!(e.baseLayers.length>0))return;r=e.baseLayers.at(0)}if(s(r)){try{await r.load(i)}catch(n){const e="basemap-compatibility:unknown-error",a="Unknown basemap compatibility error",{name:i=e,message:r=a,details:s}=n;throw new t(i,r,s)}g(r,a)}}function g(e,a){const i=a.state.viewingMode;if(!i)return;let r,n;if("wmts"===e?.type){const s=o(e,a.spatialReference,i);if(null==s.tileInfo)throw new t("basemapgalleryitem:tiling-scheme-incompatible","Basemap tiling scheme is incompatible with the view");r=s.tileInfo,n=s.fullExtent}else r=e.tileInfo,n=e.fullExtent;if(null==r)return;if(!m(r.spatialReference,i))throw new t(`basemapgalleryitem:spatial-reference-unsupported-${l(i)}`,`Basemap spatial reference is unsupported in ${l(i)} mode`);const s="vector-tile"===e?.type?r.getCompatibleForVTL(256):null;if(1===i){let a=p(r,n,null,i);if(a&&"vector-tile"===e?.type&&null!=n&&s&&!p(s,n,null,i)&&(a=null),a){const e=r.spatialReference.isWebMercator?"web-mercator":"wgs84";throw new t(`basemapgalleryitem:tiling-scheme-unsupported-${e}-global`,"Basemap tiling scheme is unsupported in global mode",{error:a})}}else if(c.checkUnsupported(r))throw new t("basemapgalleryitem:tiling-scheme-unsupported-local","Basemap tiling scheme is unsupported in local mode");const f=a.basemapTerrain?.tilingScheme;if(f&&!f.compatibleWith(r)&&("vector-tile"!==e?.type||!s||!f.compatibleWith(s)))throw new t("basemapgalleryitem:tiling-scheme-incompatible","Basemap tiling scheme is incompatible with the view")}export{u as default2DCompatibility,f as default3DCompatibility};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{R as t,D as i}from"../../../chunks/ResponsiveTheme.js";import"../../../intl.js";import{handlesGroup as e,makeHandle as o}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{signal as s}from"../../../core/signal.js";import{unitName as a,formatDecimal as l}from"../../../core/unitFormatUtils.js";import{convertUnit as r}from"../../../core/unitUtils.js";import{getEpsilon as d}from"../../../core/libs/gl-matrix-2/math/common.js";import{getConfig as c,notAvailable as p}from"./constants.js";import{getTranslatedLineTitle as m}from"./intlUtils.js";import{niceScale as u}from"./niceScale.js";import{binaryFindClosest as f}from"./profileUtils.js";import{c as x,N as g}from"../../../chunks/chartUtilsAm5.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkMode as A}from"../../../support/modeUtils.js";import{X as v,V as b,A as y,b as T,a as L,L as M}from"../../../chunks/LineSeries.js";import{b as S,d as F,a as P,C as k}from"../../../chunks/Theme.js";import{T as X}from"../../../chunks/Tooltip.js";import{formatNumber as Y}from"../../../intl/number.js";import{substitute as z}from"../../../intl/substitute.js";const C="#f8f8f8",j="#a9a9a9",w="#323232",H="line",B="fill",U=15,D=12,R=.001,O=.1,W=.02,G={fontFamily:"Avenir Next",paddingBottom:D/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:j,axisTooltipFontSize:12,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,axisTooltipPaddingTop:Math.round(D/4),axisTooltipPaddingBottom:Math.round(D/4),axisTooltipPaddingHorizontal:Math.round(U/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(D/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(U/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:C,seriesTooltipLabelColor:w,seriesFillLighten:.9,seriesTooltipSpacing:D/2,seriesTooltipPaddingVertical:Math.round(U/4),seriesTooltipPaddingHorizontal:Math.round(U/4)},V={...G,axisGridStroke:w,axisLabelsColor:j,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:C,seriesFillLighten:-.75},E={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function I(o){const a=await x(o.container);n(o.abortOptions);const l=A(o.container),r=l?V:G;a.setThemes(l?[t.new(a),i.new(a)]:[t.new(a)]);const d=h(o.container),c=a.container.children.push(v.new(a,{panX:!0,panY:!0,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:d?r.paddingRight:r.paddingLeft,paddingRight:d?r.paddingLeft:r.paddingRight,maxTooltipDistance:-1}));c.zoomOutButton.set("forceHidden",!0);const p=c.xAxes.push(b.new(a,{renderer:y.new(a,{})})),m=c.yAxes.push(b.new(a,{renderer:T.new(a,{})})),u=s(null),f=s("loading"),g={chart:c,xAxis:p,yAxis:m,seriesInfos:new Map,messages:null,theme:r,pointerIsOver:!1,rtl:d,get state(){return f.value},get data(){return u.value},set data(t){u.value=t}};Z(g),q(g),N(g);const L=e([lt(g,o.onRangeChange),dt(g,o.onCursorPositionChange),yt(a.events.once("frameended",()=>{f.value="ready"})),yt(a)]);let M;return{destroy:()=>{L.remove(),f.value="destroyed"},update:t=>{t.data===g.data&&t.messages===g.messages||$(g)||J(g,t)},zoomOut:()=>K(g),test:M}}function $(t){return"destroyed"===t.state}function N({chart:t,xAxis:i,yAxis:e}){const o=L.new(t.root,{behavior:"none",xAxis:i,yAxis:e,snapToSeriesBy:"y"});o.lineY.set("visible",!1),t.set("cursor",o)}function Z(t){const{chart:i,xAxis:e,theme:o}=t;e.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),e.axisHeader.set("forceHidden",!0);const n=e.get("renderer");n.setAll({inside:!1,minGridDistance:o.xAxisMinGridDistance}),n.labels.template.setAll({centerX:F,centerY:F,fill:S(o.axisLabelsColor),fontFamily:o.fontFamily,fontSize:o.axisLabelsFontSize,fontWeight:o.axisLabelsFontWeight,maxPosition:o.xAxisMaxLabelPosition,minPosition:o.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:o.xAxisLabelsSpacing});const s=e.set("tooltip",X.new(i.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));s.get("background")?.setAll({fill:S(o.axisTooltipBackgroundColor),stroke:void 0}),s.label.setAll({fill:S(o.axisTooltipLabelColor),fontFamily:o.fontFamily,fontSize:o.axisTooltipFontSize,paddingBottom:o.axisTooltipPaddingBottom,paddingLeft:o.axisTooltipPaddingHorizontal,paddingRight:o.axisTooltipPaddingHorizontal,paddingTop:o.axisTooltipPaddingTop,direction:t.rtl?"rtl":"ltr"}),n.grid.template.setAll({strokeOpacity:1,stroke:S(o.axisGridStroke)})}function q(t){const{yAxis:i,theme:e,rtl:o}=t;i.setAll({baseValue:c().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),i.axisHeader.set("visible",!1);const n=i.get("renderer");n.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:o,inside:!0}),n.labels.template.setAll({centerX:F,centerY:P,fill:S(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:o?0:e.yAxisLabelSpacing,paddingRight:o?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),n.grid.template.setAll({strokeOpacity:1,stroke:S(e.axisGridStroke)})}function J(t,i){if($(t))return;const e=t.data??void 0,o=i.data??void 0;t.chart.get("cursor")?.set("forceHidden",!o?.refined);const n=e!==o,s=e?.effectiveUnits!==o?.effectiveUnits,a=e?.uniformScaling!==o?.uniformScaling;t.data=o,t.messages=i.messages,(n||s)&&(Q(t),et(t)),a&&K(t),pt(t)}function K(t){$(t)||(t.xAxis.zoom(0,1),t.yAxis.zoom(0,1))}function Q(t){const{chart:i,data:e,xAxis:o,yAxis:n}=t,{minX:s,maxX:a,minY:l,maxY:r}=_({data:e,pixelWidth:o.width(),pixelHeight:n.height()}),d=!!e?.uniformScaling,c=!!e?.refined;i.setAll({panX:!0,panY:d,pinchZoomX:c,pinchZoomY:c&&d,wheelX:"panX",wheelY:c?d?"zoomXY":"zoomX":"none"}),o.setAll({max:a,min:s,panX:!0,panY:!1,zoomX:!0,zoomY:d}),n.setAll({max:r,min:l,panX:!1,panY:d,zoomX:d,zoomY:d})}function _({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return E;const o=t.statistics,n=0,s=o?.maxDistance;let a=o?.minElevation,l=o?.maxElevation;if(null==s||null==a||null==l)return E;const d=Math.max(s-n,R);let p=Math.max(l-a,R);const m=t.effectiveUnits;if(t.dynamicElevationRange){const t=r(d,m.distance,m.elevation);p=Math.max(p,t/c().maxChartRatio)}return a-=W*p,l=a+p+O*p,[a,l]=u(a,l,10),p=l-a,t.uniformScaling?tt({data:t,bounds:{minX:n,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:n,maxX:n+d,minY:a,maxY:a+p}}function tt({data:t,bounds:i,pixelWidth:e,pixelHeight:o,centered:n}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:d}=i;if(null==s||null==a||null==l||null==d)return E;const c=a-s,p=d-l,m=t.effectiveUnits,u=r(p,m.elevation,m.distance)/o/(c/e);return u>=1?[s,a]=it([s,a],u):[l,d]=it([l,d],1/u),{minX:s,maxX:a,minY:l,maxY:d}}function it([t,i],e,o){const n=(i-t)*e;{const e=(t+i)/2-n/2;return[e,e+n]}}function et(t){const{chart:i,data:e,seriesInfos:o,xAxis:n,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const n=e.lines[d];let s=o.get(n.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=nt(t,n),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),ot(t,s,n)}t.seriesInfos=a;for(const d of l)i.series.removeValue(d);n.set("layer",r+1),s.set("layer",r+2)}function ot({theme:t},i,e){const o=S(e.color.toCss()),n=e.samples??[],s=n.length>0,{line:a,fill:l}=i;a.set("visible",s),a.set("stroke",o),l?.set("visible",s),l?.set("fill",k.lighten(o,t.seriesFillLighten)),a.data.setAll(n),l?.data.setAll(n)}function nt(t,i){const{id:e}=i,o=st(t,`${H}-${e}`),n=at(t);o.setAll({dy:i.chartStrokeOffsetY,tooltip:n}),o.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let s=null;return i.chartFillEnabled&&(s=st(t,`${B}-${e}`),s.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:o,fill:s}}function st(t,i){return M.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function at({theme:t,chart:i,rtl:e}){const o=X.new(i.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=t.seriesTooltipPaddingHorizontal,s=t.seriesTooltipPaddingVertical;return o.label.setAll({fill:S(t.seriesTooltipLabelColor),fontFamily:t.fontFamily,fontSize:t.seriesTooltipFontSize,paddingBottom:s,paddingLeft:n,paddingRight:n,paddingTop:s,textAlign:e?"end":"start",direction:"ltr"}),o.get("background")?.setAll({stroke:void 0,fill:S(t.seriesTooltipBackgroundColor)}),o.adapters.add("dy",i=>{const e=t.seriesTooltipSpacing,n=o.get("pointTo")?.y??0;return(i??0)+(o.y()>n?e:-e)}),o}function lt(t,i){const{xAxis:e,yAxis:o}=t,n=()=>{i(rt(e),rt(o))},s=t=>[t.on("start",n),t.on("end",n)];return bt([...s(e),...s(o)])}function rt(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<d()?1:e}function dt(t,i){const{chart:e,xAxis:o,yAxis:n}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver=i,pt(t)},r=()=>{l(!1),i(null,null)};return bt([s?.events.on("cursormoved",()=>{if(!t.pointerIsOver)return;pt(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l?.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;let r,d;if(null!=t){1===rt(o)?(r=0,d=t):(r=At(o),d=vt(o)),e=ct(e,r,d,0,t)}if(null!=i&&null!=s){1===rt(n)?(r=i,d=s):(r=At(n),d=vt(n)),a=ct(a,r,d,i,s)}}i(e,a)}),a.on("pointerover",()=>l(!0)),a.on("pointerout",r),a.on("blur",r)])}function ct(t,i,e,o,n){return(i+t*(e-i)-o)/(n-o)}function pt(t){const i=mt(t);if(!i)return void t.seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)});t.seriesInfos.forEach(t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)});t.xAxis.getTooltip().setAll({tooltipText:xt(t)})}function mt(t){const{data:i}=t,e=i?.lines.map(i=>({line:i,y:ht(t,i)?.elevation})).sort(ut);return e&&0!==e.length&&null!=e[0].y?e.map(({y:i,line:e})=>ft(t,e,i)).join("\n"):null}function ut({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function ft(t,i,e){const{data:o,messages:n}=t;if(null==o||null==n)return"";const s=`[${i.color.toHex()}]●[/]`,a=" ",r=c().formatPrecision,d=z(n.chartTooltip,{name:m(i,n),elevation:null!=e?l(n,e,o.effectiveUnits.elevation,r):p});return t.rtl?d+a+s:s+a+d}function xt(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const o=i.lines[0],n=o?ht(t,o):null,s=c().formatPrecision;return null!=n?l(e,n.distance,i.effectiveUnits.distance,s):"-"}function gt(t,i){const e=g.new(t.chart.root,{});return e.format=(e,o,n)=>{const{data:s,messages:l}=t;if(null==l||null==s||"string"==typeof e)return"";return`${Y(e,{maximumFractionDigits:n})} ${a(l,s.effectiveUnits[i],"abbr")}`},e}function ht({chart:t,xAxis:i},e){const o=e.samples??[];if(0===o.length)return null;const n=t.get("cursor"),s=n?.getPrivate("positionX")??0,a=i.toAxisPosition(s),l=i.positionToValue(a);return f(o,l,t=>t.distance)}function At(t){return t.positionToValue(t.get("start")??0)}function vt(t){return t.positionToValue(t.get("end")??1)}function bt(t){return e(t.map(yt))}function yt(t){return o(()=>{t?.dispose()})}export{I as createChart,_ as getAdjustedBounds};
|
|
5
|
+
import*as t from"@amcharts/amcharts5/index.js";import{XYChart as i,ValueAxis as e,AxisRendererX as o,AxisRendererY as n,XYCursor as s,LineSeries as a}from"@amcharts/amcharts5/xy.js";import l from"@amcharts/amcharts5/themes/Dark.js";import r from"@amcharts/amcharts5/themes/Responsive.js";import"../../../intl.js";import{handlesGroup as d,makeHandle as c}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as p}from"../../../core/promiseUtils.js";import{signal as m}from"../../../core/signal.js";import{unitName as u,formatDecimal as x}from"../../../core/unitFormatUtils.js";import{convertUnit as f}from"../../../core/unitUtils.js";import{getEpsilon as g}from"../../../core/libs/gl-matrix-2/math/common.js";import{getConfig as h,notAvailable as A}from"./constants.js";import{getTranslatedLineTitle as v}from"./intlUtils.js";import{niceScale as b}from"./niceScale.js";import{binaryFindClosest as y}from"./profileUtils.js";import{createRoot as T}from"../../support/chartUtilsAm5.js";import{isRTL as L}from"../../support/widgetUtils.js";import{isDarkMode as M}from"../../../support/modeUtils.js";import{formatNumber as F}from"../../../intl/number.js";import{substitute as S}from"../../../intl/substitute.js";const P="#f8f8f8",X="#a9a9a9",Y="#323232",z="line",k="fill",C=15,j=12,w=.001,H=.1,B=.02,U={fontFamily:"Avenir Next",paddingBottom:j/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:X,axisTooltipFontSize:12,axisTooltipBackgroundColor:Y,axisTooltipLabelColor:P,axisTooltipPaddingTop:Math.round(j/4),axisTooltipPaddingBottom:Math.round(j/4),axisTooltipPaddingHorizontal:Math.round(C/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(j/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(C/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:P,seriesTooltipLabelColor:Y,seriesFillLighten:.9,seriesTooltipSpacing:j/2,seriesTooltipPaddingVertical:Math.round(C/4),seriesTooltipPaddingHorizontal:Math.round(C/4)},D={...U,axisGridStroke:Y,axisLabelsColor:X,axisTooltipBackgroundColor:Y,axisTooltipLabelColor:P,seriesTooltipBackgroundColor:Y,seriesTooltipLabelColor:P,seriesFillLighten:-.75},R={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function O(t){const s=await T(t.container);p(t.abortOptions);const a=M(t.container),c=a?D:U;s.setThemes(a?[r.new(s),l.new(s)]:[r.new(s)]);const u=L(t.container),x=s.container.children.push(i.new(s,{panX:!0,panY:!0,paddingTop:c.paddingTop,paddingBottom:c.paddingBottom,paddingLeft:u?c.paddingRight:c.paddingLeft,paddingRight:u?c.paddingLeft:c.paddingRight,maxTooltipDistance:-1}));x.zoomOutButton.set("forceHidden",!0);const f=x.xAxes.push(e.new(s,{renderer:o.new(s,{})})),g=x.yAxes.push(e.new(s,{renderer:n.new(s,{})})),h=m(null),A=m("loading"),v={chart:x,xAxis:f,yAxis:g,seriesInfos:new Map,messages:null,theme:c,pointerIsOver:!1,rtl:u,get state(){return A.value},get data(){return h.value},set data(t){h.value=t}};E(v),I(v),G(v);const b=d([et(v,t.onRangeChange),nt(v,t.onCursorPositionChange),gt(s.events.once("frameended",()=>{A.value="ready"})),gt(s)]);let y;return{destroy:()=>{b.remove(),A.value="destroyed"},update:t=>{t.data===v.data&&t.messages===v.messages||W(v)||V(v,t)},zoomOut:()=>$(v),test:y}}function W(t){return"destroyed"===t.state}function G({chart:t,xAxis:i,yAxis:e}){const o=s.new(t.root,{behavior:"none",xAxis:i,yAxis:e,snapToSeriesBy:"y"});o.lineY.set("visible",!1),t.set("cursor",o)}function E(i){const{chart:e,xAxis:o,theme:n}=i;o.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:pt(i,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),o.axisHeader.set("forceHidden",!0);const s=o.get("renderer");s.setAll({inside:!1,minGridDistance:n.xAxisMinGridDistance}),s.labels.template.setAll({centerX:t.p0,centerY:t.p0,fill:t.color(n.axisLabelsColor),fontFamily:n.fontFamily,fontSize:n.axisLabelsFontSize,fontWeight:n.axisLabelsFontWeight,maxPosition:n.xAxisMaxLabelPosition,minPosition:n.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:n.xAxisLabelsSpacing});const a=o.set("tooltip",t.Tooltip.new(e.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));a.get("background")?.setAll({fill:t.color(n.axisTooltipBackgroundColor),stroke:void 0}),a.label.setAll({fill:t.color(n.axisTooltipLabelColor),fontFamily:n.fontFamily,fontSize:n.axisTooltipFontSize,paddingBottom:n.axisTooltipPaddingBottom,paddingLeft:n.axisTooltipPaddingHorizontal,paddingRight:n.axisTooltipPaddingHorizontal,paddingTop:n.axisTooltipPaddingTop,direction:i.rtl?"rtl":"ltr"}),s.grid.template.setAll({strokeOpacity:1,stroke:t.color(n.axisGridStroke)})}function I(i){const{yAxis:e,theme:o,rtl:n}=i;e.setAll({baseValue:h().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:pt(i,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),e.axisHeader.set("visible",!1);const s=e.get("renderer");s.setAll({minGridDistance:o.yAxisMinGridDistance,opposite:n,inside:!0}),s.labels.template.setAll({centerX:t.p0,centerY:t.p100,fill:t.color(o.axisLabelsColor),fontFamily:o.fontFamily,fontSize:o.axisLabelsFontSize,fontWeight:o.axisLabelsFontWeight,maxPosition:o.yAxisMaxLabelPosition,minPosition:o.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:n?0:o.yAxisLabelSpacing,paddingRight:n?o.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),s.grid.template.setAll({strokeOpacity:1,stroke:t.color(o.axisGridStroke)})}function V(t,i){if(W(t))return;const e=t.data??void 0,o=i.data??void 0;t.chart.get("cursor")?.set("forceHidden",!o?.refined);const n=e!==o,s=e?.effectiveUnits!==o?.effectiveUnits,a=e?.uniformScaling!==o?.uniformScaling;t.data=o,t.messages=i.messages,(n||s)&&(N(t),K(t)),a&&$(t),at(t)}function $(t){W(t)||(t.xAxis.zoom(0,1),t.yAxis.zoom(0,1))}function N(t){const{chart:i,data:e,xAxis:o,yAxis:n}=t,{minX:s,maxX:a,minY:l,maxY:r}=Z({data:e,pixelWidth:o.width(),pixelHeight:n.height()}),d=!!e?.uniformScaling,c=!!e?.refined;i.setAll({panX:!0,panY:d,pinchZoomX:c,pinchZoomY:c&&d,wheelX:"panX",wheelY:c?d?"zoomXY":"zoomX":"none"}),o.setAll({max:a,min:s,panX:!0,panY:!1,zoomX:!0,zoomY:d}),n.setAll({max:r,min:l,panX:!1,panY:d,zoomX:d,zoomY:d})}function Z({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return R;const o=t.statistics,n=0,s=o?.maxDistance;let a=o?.minElevation,l=o?.maxElevation;if(null==s||null==a||null==l)return R;const r=Math.max(s-n,w);let d=Math.max(l-a,w);const c=t.effectiveUnits;if(t.dynamicElevationRange){const t=f(r,c.distance,c.elevation);d=Math.max(d,t/h().maxChartRatio)}return a-=B*d,l=a+d+H*d,[a,l]=b(a,l,10),d=l-a,t.uniformScaling?q({data:t,bounds:{minX:n,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:n,maxX:n+r,minY:a,maxY:a+d}}function q({data:t,bounds:i,pixelWidth:e,pixelHeight:o,centered:n}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:r}=i;if(null==s||null==a||null==l||null==r)return R;const d=a-s,c=r-l,p=t.effectiveUnits,m=f(c,p.elevation,p.distance)/o/(d/e);return m>=1?[s,a]=J([s,a],m):[l,r]=J([l,r],1/m),{minX:s,maxX:a,minY:l,maxY:r}}function J([t,i],e,o){const n=(i-t)*e;{const e=(t+i)/2-n/2;return[e,e+n]}}function K(t){const{chart:i,data:e,seriesInfos:o,xAxis:n,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const n=e.lines[d];let s=o.get(n.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=_(t,n),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),Q(t,s,n)}t.seriesInfos=a;for(const d of l)i.series.removeValue(d);n.set("layer",r+1),s.set("layer",r+2)}function Q({theme:i},e,o){const n=t.color(o.color.toCss()),s=o.samples??[],a=s.length>0,{line:l,fill:r}=e;l.set("visible",a),l.set("stroke",n),r?.set("visible",a),r?.set("fill",t.Color.lighten(n,i.seriesFillLighten)),l.data.setAll(s),r?.data.setAll(s)}function _(t,i){const{id:e}=i,o=tt(t,`${z}-${e}`),n=it(t);o.setAll({dy:i.chartStrokeOffsetY,tooltip:n}),o.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let s=null;return i.chartFillEnabled&&(s=tt(t,`${k}-${e}`),s.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:o,fill:s}}function tt(t,i){return a.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function it({theme:i,chart:e,rtl:o}){const n=t.Tooltip.new(e.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),s=i.seriesTooltipPaddingHorizontal,a=i.seriesTooltipPaddingVertical;return n.label.setAll({fill:t.color(i.seriesTooltipLabelColor),fontFamily:i.fontFamily,fontSize:i.seriesTooltipFontSize,paddingBottom:a,paddingLeft:s,paddingRight:s,paddingTop:a,textAlign:o?"end":"start",direction:"ltr"}),n.get("background")?.setAll({stroke:void 0,fill:t.color(i.seriesTooltipBackgroundColor)}),n.adapters.add("dy",t=>{const e=i.seriesTooltipSpacing,o=n.get("pointTo")?.y??0;return(t??0)+(n.y()>o?e:-e)}),n}function et(t,i){const{xAxis:e,yAxis:o}=t,n=()=>{i(ot(e),ot(o))},s=t=>[t.on("start",n),t.on("end",n)];return ft([...s(e),...s(o)])}function ot(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<g()?1:e}function nt(t,i){const{chart:e,xAxis:o,yAxis:n}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver=i,at(t)},r=()=>{l(!1),i(null,null)};return ft([s?.events.on("cursormoved",()=>{if(!t.pointerIsOver)return;at(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l?.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;let r,d;if(null!=t){1===ot(o)?(r=0,d=t):(r=ut(o),d=xt(o)),e=st(e,r,d,0,t)}if(null!=i&&null!=s){1===ot(n)?(r=i,d=s):(r=ut(n),d=xt(n)),a=st(a,r,d,i,s)}}i(e,a)}),a.on("pointerover",()=>l(!0)),a.on("pointerout",r),a.on("blur",r)])}function st(t,i,e,o,n){return(i+t*(e-i)-o)/(n-o)}function at(t){const i=lt(t);if(!i)return void t.seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)});t.seriesInfos.forEach(t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)});t.xAxis.getTooltip().setAll({tooltipText:ct(t)})}function lt(t){const{data:i}=t,e=i?.lines.map(i=>({line:i,y:mt(t,i)?.elevation})).sort(rt);return e&&0!==e.length&&null!=e[0].y?e.map(({y:i,line:e})=>dt(t,e,i)).join("\n"):null}function rt({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function dt(t,i,e){const{data:o,messages:n}=t;if(null==o||null==n)return"";const s=`[${i.color.toHex()}]●[/]`,a=" ",l=h().formatPrecision,r=S(n.chartTooltip,{name:v(i,n),elevation:null!=e?x(n,e,o.effectiveUnits.elevation,l):A});return t.rtl?r+a+s:s+a+r}function ct(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const o=i.lines[0],n=o?mt(t,o):null,s=h().formatPrecision;return null!=n?x(e,n.distance,i.effectiveUnits.distance,s):"-"}function pt(i,e){const o=t.NumberFormatter.new(i.chart.root,{});return o.format=(t,o,n)=>{const{data:s,messages:a}=i;if(null==a||null==s||"string"==typeof t)return"";return`${F(t,{maximumFractionDigits:n})} ${u(a,s.effectiveUnits[e],"abbr")}`},o}function mt({chart:t,xAxis:i},e){const o=e.samples??[];if(0===o.length)return null;const n=t.get("cursor"),s=n?.getPrivate("positionX")??0,a=i.toAxisPosition(s),l=i.positionToValue(a);return y(o,l,t=>t.distance)}function ut(t){return t.positionToValue(t.get("start")??0)}function xt(t){return t.positionToValue(t.get("end")??1)}function ft(t){return d(t.map(gt))}function gt(t){return c(()=>{t?.dispose()})}export{O as createChart,Z as getAdjustedBounds};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{watch as t,initial as o}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import s from"../Widget.js";import n from"./FeatureContent.js";import d from"./FeatureFields.js";import l from"./FeatureMedia.js";import a from"./FeatureExpression/FeatureExpressionViewModel.js";import{loadCalciteComponents as p}from"../support/componentsUtils.js";import"../support/widgetUtils.js";import{tsx as c}from"../support/jsxFactory.js";import"@arcgis/toolkit/dom";const m="esri-feature",u={base:`${m}-expression`,loadingSpinnerContainer:`${m}__loading-container`};let g=class extends s{constructor(e,t){super(e,t),this._contentWidget=null,this.viewModel=new a}initialize(){this.addHandles(t(()=>this.viewModel?.contentElementViewModel,()=>this._setupExpressionWidget(),o))}loadDependencies(){return p({loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._destroyContentWidget()}render(){const{state:e}=this.viewModel;return c("div",{class:u.base},"loading"===e?this._renderLoading():"disabled"===e?null:this._contentWidget?.render())}_renderLoading(){return c("div",{class:u.loadingSpinnerContainer,key:"loading-container"},c("calcite-loader",{inline:!0,label:""}))}_destroyContentWidget(){const{_contentWidget:e}=this;e&&(e.viewModel=null,e.destroy()),this._contentWidget=null}_setupExpressionWidget(){const{contentElementViewModel:e,contentElement:t}=this.viewModel,o=t?.type;this._destroyContentWidget();const i=e?"fields"===o?new d({viewModel:e}):"media"===o?new l({viewModel:e}):"text"===o?new n({viewModel:e}):null:null;this._contentWidget=i,this.scheduleRender()}};e([i({type:a})],g.prototype,"viewModel",void 0),g=e([r("esri.widgets.Feature.FeatureExpression")],g);export{g as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{watch as t,initial as o}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import s from"../Widget.js";import n from"./FeatureContent.js";import d from"./FeatureFields.js";import l from"./FeatureMedia.js";import a from"./FeatureExpression/FeatureExpressionViewModel.js";import{loadCalciteComponents as p}from"../support/componentsUtils.js";import"../support/widgetUtils.js";import{tsx as c}from"../support/jsxFactory.js";import"@arcgis/toolkit/dom";const m="esri-feature",u={base:`${m}-expression`,loadingSpinnerContainer:`${m}__loading-container`};let g=class extends s{constructor(e,t){super(e,t),this._contentWidget=null,this.viewModel=new a}initialize(){this.addHandles(t(()=>this.viewModel?.contentElementViewModel,()=>this._setupExpressionWidget(),o))}loadDependencies(){return p({loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._destroyContentWidget()}render(){const{state:e}=this.viewModel;return c("div",{class:u.base},"loading"===e?this._renderLoading():"disabled"===e?null:this._contentWidget?.render())}_renderLoading(){return c("div",{class:u.loadingSpinnerContainer,key:"loading-container"},c("calcite-loader",{inline:!0,label:""}))}_destroyContentWidget(){const{_contentWidget:e}=this;e&&(e.viewModel=null,e.destroy()),this._contentWidget=null}_setupExpressionWidget(){const{contentElementViewModel:e,contentElement:t}=this.viewModel,o=t?.type;this._destroyContentWidget();const i=e?"fields"===o?new d({viewModel:e}):"media"===o?new l({viewModel:e,view:this.viewModel.view}):"text"===o?new n({viewModel:e}):null:null;this._contentWidget=i,this.scheduleRender()}};e([i({type:a})],g.prototype,"viewModel",void 0),g=e([r("esri.widgets.Feature.FeatureExpression")],g);export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{color as a}from"@amcharts/amcharts5/index.js";export{ColorSet as ColorSetAm5,Scrollbar as ScrollbarAm5,Theme as ThemeAm5,Tooltip as TooltipAm5,color as colorAm5}from"@amcharts/amcharts5/index.js";export{default as AnimatedThemeAm5}from"@amcharts/amcharts5/themes/Animated.js";export{default as DarkThemeAm5}from"@amcharts/amcharts5/themes/Dark.js";export{default as ResponsiveThemeAm5}from"@amcharts/amcharts5/themes/Responsive.js";const e=["#2888B8","#EB7028","#48A375","#9370B1","#e55035","#3d9ccc","#DC7B04","#b87bb0","#3fa681","#EE6386"].map(e=>a(e));export{e as esriChartColorSet};
|