@arcgis/core 4.28.0-next.20230921 → 4.28.0-next.20230922
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/Graphic.js +1 -1
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/arcade/featureset/support/StatsField.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{2cb36f9686693234991a.js → 07a2dab2f645dcd7d8d6.js} +1 -1
- package/assets/esri/core/workers/chunks/07f6175b52366b2c28bd.js +1 -0
- package/assets/esri/core/workers/chunks/098073c3b2849f56dad8.js +1 -0
- package/assets/esri/core/workers/chunks/{580039dd491854ca325c.js → 21fc02f0d5716c4a7acd.js} +1 -1
- package/assets/esri/core/workers/chunks/{072b4e041b8630c513a0.js → 243b1f9b2fba02946481.js} +1 -1
- package/assets/esri/core/workers/chunks/{dff1c3c38dda2bd1a9d6.js → 246a954347fe9318190e.js} +1 -1
- package/assets/esri/core/workers/chunks/{314c307e30f308a40a28.js → 25b09e9c0511c8e1cf8a.js} +1 -1
- package/assets/esri/core/workers/chunks/28a5ef2e2daa4207dd8b.js +1 -0
- package/assets/esri/core/workers/chunks/2b017e1aa1be71974c2e.js +1 -0
- package/assets/esri/core/workers/chunks/425b5733bb88e6efe242.js +1 -0
- package/assets/esri/core/workers/chunks/{c9dfb145f0c1d93e0fbd.js → 4bcca5fffb1fcc2d4353.js} +1 -1
- package/assets/esri/core/workers/chunks/4bf1a7e82a68ccee0ee1.js +1 -0
- package/assets/esri/core/workers/chunks/4c110c7f4f940ec58010.js +1 -0
- package/assets/esri/core/workers/chunks/{bde89b2684b6185992ef.js → 4ed77097e69fa3096ce4.js} +1 -1
- package/assets/esri/core/workers/chunks/{1cbaba30f55f00f7498b.js → 51324d042f469f3b8914.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f4e9b1663ec521bfe00.js → 542ce10e1872399790b4.js} +1 -1
- package/assets/esri/core/workers/chunks/54d2b7e2ac4ba883bee8.js +1 -0
- package/assets/esri/core/workers/chunks/54ecb6cae310818d1aa2.js +1 -0
- package/assets/esri/core/workers/chunks/57c932e289d89d97da4b.js +1 -0
- package/assets/esri/core/workers/chunks/{6403de6fc067cf8f7436.js → 592c1fb531f2be928e8a.js} +1 -1
- package/assets/esri/core/workers/chunks/609a475ab395f2ce63e2.js +1 -0
- package/assets/esri/core/workers/chunks/{332689bf60d246485993.js → 65186e168dd112ac6221.js} +1 -1
- package/assets/esri/core/workers/chunks/6b9248fb2d6aadbce7bb.js +1 -0
- package/assets/esri/core/workers/chunks/709465832d306e02df52.js +1 -0
- package/assets/esri/core/workers/chunks/{bbc0dcd316c5598bc9ad.js → 74368a5213def6c200a2.js} +1 -1
- package/assets/esri/core/workers/chunks/78e7af899d9d50aa7e74.js +1 -0
- package/assets/esri/core/workers/chunks/7fe641cf1467496e670a.js +1 -0
- package/assets/esri/core/workers/chunks/{df8f62beb36fb9d2ac81.js → 810c8d6ff19976fd1366.js} +1 -1
- package/assets/esri/core/workers/chunks/83a15aa4b1c5252c651b.js +1 -0
- package/assets/esri/core/workers/chunks/85e436decdd693f240ee.js +1 -0
- package/assets/esri/core/workers/chunks/{243a4eed107d363dfad8.js → 887652bbdb3b71d0a089.js} +1 -1
- package/assets/esri/core/workers/chunks/896bfda379cf620b63ec.js +1 -0
- package/assets/esri/core/workers/chunks/{1f7e041140088f8ac489.js → 97073a60f0ea2a397165.js} +1 -1
- package/assets/esri/core/workers/chunks/{101f776316a85b708927.js → a99070ec4c06c435b744.js} +1 -1
- package/assets/esri/core/workers/chunks/{21a9c8aa2a9e9990df41.js → b499b4fa771e8c422b43.js} +1 -1
- package/assets/esri/core/workers/chunks/bffad8aec92f982cc75a.js +1 -0
- package/assets/esri/core/workers/chunks/d414dba3179bcf75bc6b.js +1 -0
- package/assets/esri/core/workers/chunks/{b449d6bd5851187d419f.js → d6e5408f9fa6b4bcd118.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ca759f72d3bb29e9ea9.js → e14da83329f7771135bc.js} +2 -2
- package/assets/esri/core/workers/chunks/{f508ccfde6425dabe9ac.js → ee0bf611d191103a7046.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed1fbc1bc8d50453e2f5.js → f793cd41fcd022baeea2.js} +1 -1
- package/assets/esri/core/workers/chunks/fb87fd64411b78afea23.js +1 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -0
- 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/config.js +1 -1
- package/core/Accessor.js +1 -1
- package/core/has.js +1 -1
- package/core/sql/DateOnly.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/sql.js +1 -1
- package/identity/IdentityForm.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +28 -199
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/graphics/applyEditsUtils.js +5 -0
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/orientedImagery/core/CameraOrientationLTP.js +1 -1
- package/layers/orientedImagery/core/ElevationSourceDefinitions.js +5 -0
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/core/cameraOrientationFactory.js +1 -1
- package/layers/orientedImagery/core/utils.js +5 -0
- package/layers/orientedImagery/transformations/groundToImageUtils.js +1 -1
- package/layers/support/fieldProperties.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/versionManagement/VersionManagementService.js +1 -1
- package/versionManagement/support/EditMomentStack.js +5 -0
- package/versionManagement/support/versionManagementUtils.js +1 -1
- package/views/2d/engine/Container.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/ManagedCanvas.js +5 -0
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/GroupContainer.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/WGLContainer.js +1 -1
- package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
- package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/graphics/BaseGraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
- package/views/2d/layers/support/DisplayGL.js +1 -1
- package/views/2d/webglDeps.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/featureEditing.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginInput.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureFactory.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgeProcessing.js +1 -1
- package/views/View.js +1 -1
- package/views/interactive/tooltip/TooltipContentWithHelpMessage.js +1 -1
- package/views/interactive/tooltip/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/constraintUtils.js +1 -1
- package/views/interactive/tooltip/content/Fields.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawMesh.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformAbsolute.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphic.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicZ.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexZ.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/contextUtils.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/AreaMeasurement3D.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/Compass.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Directions/components/SaveLayer.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/components/FooterActions.js +1 -1
- package/widgets/Editor/components/Notices.js +1 -1
- package/widgets/Editor/components/PanelContent.js +1 -1
- package/widgets/Editor/components/PanelToolbar.js +1 -1
- package/widgets/Editor/components/Prompt.js +1 -1
- package/widgets/Editor/components/Settings.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/components/UploadDetails.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/components/LegendItem.js +1 -1
- package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
- package/widgets/ElevationProfile/components/Statistics.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureContent.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/Feature/support/FeatureContentMixin.js +1 -1
- package/widgets/Feature/support/FeatureElementInfo.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Features/FeaturesRelatedRecords.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Histogram.js +1 -1
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Home.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/Classic.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/NavigationToggle.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast/components/DiscreteConfigurator.js +1 -1
- package/widgets/ShadowCast/components/DurationConfigurator.js +1 -1
- package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
- package/widgets/ShadowCast/components/ThresholdConfigurator.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/widgets/VideoPlayer.js +1 -1
- package/widgets/Weather/LabeledSlider.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/Zoom/IconButton.js +1 -1
- package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ClassedColorSlider.js +1 -1
- package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSlider.js +1 -1
- package/widgets/smartMapping/HeatmapSlider.js +1 -1
- package/widgets/smartMapping/OpacitySlider.js +1 -1
- package/widgets/smartMapping/SizeSlider.js +1 -1
- package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/Heading.js +1 -1
- package/widgets/support/LabeledSwitch.js +1 -1
- package/widgets/support/MeasurementWidgetContent.js +1 -1
- package/widgets/support/Popover.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SketchTooltipControls.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/widgets/support/TimezonePicker.js +1 -1
- package/widgets/support/UnitSelect.js +1 -1
- package/assets/esri/core/workers/chunks/092920c25cac89c038ee.js +0 -1
- package/assets/esri/core/workers/chunks/1b3655f5bf5d90fa8730.js +0 -1
- package/assets/esri/core/workers/chunks/1cf7bb514e7eefc3e9c6.js +0 -1
- package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +0 -1
- package/assets/esri/core/workers/chunks/2d0d03cbea83c868edba.js +0 -1
- package/assets/esri/core/workers/chunks/2e130cb2f1038055c07b.js +0 -1
- package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +0 -1
- package/assets/esri/core/workers/chunks/4f4a424d1747d04501df.js +0 -1
- package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +0 -1
- package/assets/esri/core/workers/chunks/650a317b6dc245a7060f.js +0 -1
- package/assets/esri/core/workers/chunks/7a358b1fd0c0cce59e9b.js +0 -1
- package/assets/esri/core/workers/chunks/83d1a1b3d371c991cc4c.js +0 -1
- package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +0 -1
- package/assets/esri/core/workers/chunks/c60cf62f374e71e562fc.js +0 -1
- package/assets/esri/core/workers/chunks/c8f239c25fe864f0e47a.js +0 -1
- package/assets/esri/core/workers/chunks/cad260881653567bc8f9.js +0 -1
- package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +0 -1
- package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +0 -1
- package/assets/esri/core/workers/chunks/f38c54ada9e7012a2960.js +0 -1
- package/core/watchUtils.d.ts +0 -4
- package/core/watchUtils.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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Graphic.js";import t from"../../core/Collection.js";import a from"../../core/Error.js";import{clone as r}from"../../core/lang.js";import s from"../../core/Logger.js";import{createResolver as o}from"../../core/promiseUtils.js";import{dataComponents as i}from"../../core/urlUtils.js";import{generateBracedUUID as n}from"../../core/uuid.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{isEditBusLayer as l,emitApplyEditsEvent as u}from"../mixins/EditBusLayer.js";import{getMimeTypeFormatId as p,getFilenameFormatId as c}from"../support/infoFor3D.js";import{getEffectiveEditingEnabled as h,getEffectiveLayerCapabilities as m}from"../support/layerUtils.js";function y(e){return e&&null!=e.applyEdits}function f(e){return"object"==typeof e&&null!=e&&"objectId"in e&&!!e.objectId}function g(e){return e.every(f)}function b(e){return"object"==typeof e&&null!=e&&"globalId"in e&&!!e.globalId}function F(e){return e.every(b)}async function w(e,t,a,s={}){let i;if(l(e)&&e.url)i=u(e.url,e.layerId,s.gdbVersion,"original-and-current-features"===s.returnServiceEditsOption);else{i=o(),i.promise.then((t=>{(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length)&&e.emit("edits",t)}));const t={result:i.promise};e.emit("apply-edits",t)}try{const{results:o,edits:n}=await A(e,t,a,s),d=e=>e.filter((e=>!e.error)).map(r),l={edits:n,addedFeatures:d(o.addFeatureResults),updatedFeatures:d(o.updateFeatureResults),deletedFeatures:d(o.deleteFeatureResults),addedAttachments:d(o.addAttachmentResults),updatedAttachments:d(o.updateAttachmentResults),deletedAttachments:d(o.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:o.editMoment?new Date(o.editMoment):null};return o.editedFeatureResults?.length&&(l.editedFeatures=o.editedFeatureResults),i.resolve(l),o}catch(n){throw i.reject(n),n}}async function A(e,t,r,s){if(await e.load(),!y(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!h(e))throw new a(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:o,options:i}=await v(e,r,s);return o.addFeatures?.length||o.updateFeatures?.length||o.deleteFeatures?.length||o.addAttachments?.length||o.updateAttachments?.length||o.deleteAttachments?.length?{edits:o,results:await t.applyEdits(o,i)}:{edits:o,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function v(e,r,o){const i=r&&(r.addFeatures||r.updateFeatures||r.deleteFeatures),n=r&&(r.addAttachments||r.updateAttachments||r.deleteAttachments),d=null!=e.infoFor3D;if(!r||!i&&!n)throw new a(`${e.type}-layer:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");const l=m(e);if(!l.data.isVersioned&&o?.gdbVersion)throw new a(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!l.editing.supportsRollbackOnFailure&&o?.rollbackOnFailureEnabled)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");if(!l.editing.supportsGlobalId&&o?.globalIdUsed)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!l.editing.supportsGlobalId&&n)throw new a(`${e.type}-layer:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!o?.globalIdUsed&&n)throw new a(`${e.type}-layer:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true");const u={...o};if(null!=u.rollbackOnFailureEnabled||l.editing.supportsRollbackOnFailure||(u.rollbackOnFailureEnabled=!0),u.rollbackOnFailureEnabled||"original-and-current-features"!==u.returnServiceEditsOption||(!1===u.rollbackOnFailureEnabled&&s.getLogger("esri.layers.graphics.editingSupport").warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwrritten and set to true."),u.rollbackOnFailureEnabled=!0),!l.editing.supportsReturnServiceEditsInSourceSpatialReference&&u.returnServiceEditsInSourceSR)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(u.returnServiceEditsInSourceSR&&"original-and-current-features"!==u.returnServiceEditsOption)throw new a(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const p={...r};if(p.addFeatures=r&&t.isCollection(r.addFeatures)?r.addFeatures.toArray():p.addFeatures||[],p.updateFeatures=r&&t.isCollection(r.updateFeatures)?r.updateFeatures.toArray():p.updateFeatures||[],p.deleteFeatures=r&&t.isCollection(r.deleteFeatures)?r.deleteFeatures.toArray():p.deleteFeatures||[],p.addFeatures.length&&!l.operations.supportsAdd)throw new a(`${e.type}-layer:unsupported-operation`,"Layer does not support adding features.");if(p.updateFeatures.length&&!l.operations.supportsUpdate)throw new a(`${e.type}-layer:unsupported-operation`,"Layer does not support updating features.");if(p.deleteFeatures.length&&!l.operations.supportsDelete)throw new a(`${e.type}-layer:unsupported-operation`,"Layer does not support deleting features.");p.addAttachments=p.addAttachments||[],p.updateAttachments=p.updateAttachments||[],p.deleteAttachments=p.deleteAttachments||[],p.addFeatures=p.addFeatures.map(L),p.updateFeatures=p.updateFeatures.map(L),p.addAssetFeatures=[];const c=o?.globalIdUsed||d;if(c){const{globalIdField:t}=e;if(null==t)throw new a(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");p.addFeatures.forEach((e=>j(e,t)))}p.addFeatures.forEach((t=>$(t,e,c))),p.updateFeatures.forEach((t=>R(t,e,c))),p.deleteFeatures.forEach((t=>S(t,e,c))),p.addAttachments.forEach((t=>O(t,e))),p.updateAttachments.forEach((t=>O(t,e))),d&&await k(p,e);return{edits:await U(p),options:u}}function I(e,t,r){if(r){if("attributes"in e&&!e.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if("geometry"in e&&null!=e.geometry){if(e.geometry.hasZ&&!1===t.capabilities?.data.supportsZ)throw new a(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities?.data.supportsM)throw new a(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function E(e,t){if("geometry"in e&&"mesh"===e.geometry?.type&&null!=t.infoFor3D){const{geometry:r}=e;if(r.vertexSpace.isGeoreferenced)throw new a(`${t.type}-layer:georeferenced-mesh-unsupported`,"Uploading georeferenced meshes to a layer is not supported.")}}function $(e,t,a){I(e,t,a),E(e,t)}function S(e,t,a){I(e,t,a)}function R(e,t,r){I(e,t,r),E(e,t);const s=m(t);if("geometry"in e&&null!=e.geometry&&!s?.editing.supportsGeometryUpdate)throw new a(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function O(e,t){const{feature:r,attachment:s}=e;if(!r||"attributes"in r&&!r.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in r)&&!r.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!s.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!s.data&&!s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(s.data instanceof File&&!!s.data.name)&&!s.name)throw new a(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities?.editing.supportsUploadWithItemId&&s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof s.data){const e=i(s.data);if(e&&!e.isBase64)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function j(e,t){const{attributes:a}=e;null==a[t]&&(a[t]=n())}async function U(e){const t=e.addFeatures??[],a=e.updateFeatures??[],r=t.concat(a).map((e=>e.geometry)),s=await d(r),o=t.length,i=a.length;return s.slice(0,o).forEach(((e,a)=>t[a].geometry=e)),s.slice(o,o+i).forEach(((e,t)=>a[t].geometry=e)),e}function L(t){const a=new e;return t.attributes||(t.attributes={}),a.geometry=t.geometry,a.attributes=t.attributes,a}async function k(e,t){if(null==t.infoFor3D)return;const{infoFor3D:r}=t,s=p("model/gltf-binary",r.supportedFormats)??c("glb",r.supportedFormats);if(!(!!s&&r.editFormats.includes(s)))throw new a(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??=[];const{addAssetFeatures:o}=e;for(const a of e.addFeatures??[])B(a)&&o.push(a);for(const a of e.updateFeatures??[])B(a)&&o.push(a)}function B(e){return"mesh"===e?.geometry?.type}function D(e,t,r,s){if(!y(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new a(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(r,s)}export{w as applyEdits,F as isFeatureIdentifierArrayWithGlobalId,g as isFeatureIdentifierArrayWithObjectId,b as isFeatureIdentifierWithGlobalId,f as isFeatureIdentifierWithObjectId,D as uploadAssets};
|
|
5
|
+
import e from"../../Graphic.js";import t from"../../core/Collection.js";import a from"../../core/Error.js";import{clone as r}from"../../core/lang.js";import s from"../../core/Logger.js";import{createResolver as i}from"../../core/promiseUtils.js";import{dataComponents as n}from"../../core/urlUtils.js";import{generateBracedUUID as o}from"../../core/uuid.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{isEditBusLayer as l,emitApplyEditsEvent as u}from"../mixins/EditBusLayer.js";import{isValidFieldValue as p}from"../support/fieldUtils.js";import{getMimeTypeFormatId as c,getFilenameFormatId as h}from"../support/infoFor3D.js";import{getEffectiveEditingEnabled as m,getEffectiveLayerCapabilities as f}from"../support/layerUtils.js";function y(e){return e&&null!=e.applyEdits}function g(e){return"object"==typeof e&&null!=e&&"objectId"in e&&!!e.objectId}function b(e){return e.every(g)}function w(e){return"object"==typeof e&&null!=e&&"globalId"in e&&!!e.globalId}function F(e){return e.every(w)}async function A(e,t,a,s={}){let n;if(l(e)&&e.url)n=u(e.url,e.layerId,s.gdbVersion,"original-and-current-features"===s.returnServiceEditsOption);else{n=i(),n.promise.then((t=>{(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length)&&e.emit("edits",t)}));const t={result:n.promise};e.emit("apply-edits",t)}try{const{results:i,edits:o}=await v(e,t,a,s),d=e=>e.filter((e=>!e.error)).map(r),l={edits:o,addedFeatures:d(i.addFeatureResults),updatedFeatures:d(i.updateFeatureResults),deletedFeatures:d(i.deleteFeatureResults),addedAttachments:d(i.addAttachmentResults),updatedAttachments:d(i.updateAttachmentResults),deletedAttachments:d(i.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:i.editMoment?new Date(i.editMoment):null};return i.editedFeatureResults?.length&&(l.editedFeatures=i.editedFeatureResults),n.resolve(l),i}catch(o){throw n.reject(o),o}}async function v(e,t,r,s){if(await e.load(),!y(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!m(e))throw new a(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:i,options:n}=await I(e,r,s);return i.addFeatures?.length||i.updateFeatures?.length||i.deleteFeatures?.length||i.addAttachments?.length||i.updateAttachments?.length||i.deleteAttachments?.length?{edits:i,results:await t.applyEdits(i,n)}:{edits:i,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function I(e,t,r){const i=f(e),n=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),o=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),d=null!=e.infoFor3D;if(D(t,i,r,!!n,!!o,`${e.type}-layer`),!i.data.isVersioned&&r?.gdbVersion)throw new a(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!i.editing.supportsRollbackOnFailure&&r?.rollbackOnFailureEnabled)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const l={...r};if(null!=l.rollbackOnFailureEnabled||i.editing.supportsRollbackOnFailure||(l.rollbackOnFailureEnabled=!0),l.rollbackOnFailureEnabled||"original-and-current-features"!==l.returnServiceEditsOption||(!1===l.rollbackOnFailureEnabled&&s.getLogger("esri.layers.graphics.editingSupport").warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwrritten and set to true."),l.rollbackOnFailureEnabled=!0),!i.editing.supportsReturnServiceEditsInSourceSpatialReference&&l.returnServiceEditsInSourceSR)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(l.returnServiceEditsInSourceSR&&"original-and-current-features"!==l.returnServiceEditsOption)throw new a(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const u=B(t,i,`${e.type}-layer`),p=r?.globalIdUsed||d,c=e.fields.filter((e=>"big-integer"===e.type||"oid"===e.type&&e.length>=8));if(p){const{globalIdField:t}=e;if(null==t)throw new a(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");u.addFeatures.forEach((e=>U(e,t)))}u.addFeatures.forEach((t=>S(t,e,p,c))),u.updateFeatures.forEach((t=>j(t,e,p,c))),u.deleteFeatures.forEach((t=>R(t,e,p,c))),u.addAttachments.forEach((t=>O(t,e))),u.updateAttachments.forEach((t=>O(t,e))),d&&await T(u,e);return{edits:await L(u),options:l}}function $(e,t,r,s){if(r){if("attributes"in e&&!e.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(s.length&&"attributes"in e)for(const i of s){const r=e.attributes[i.name];if(!p(i,r))throw new a(`${t.type}-layer:invalid-parameter`,`Big-integer field '${i.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&null!=e.geometry){if(e.geometry.hasZ&&!1===t.capabilities?.data.supportsZ)throw new a(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities?.data.supportsM)throw new a(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function E(e,t){if("geometry"in e&&"mesh"===e.geometry?.type&&null!=t.infoFor3D){const{geometry:r}=e;if(r.vertexSpace.isGeoreferenced)throw new a(`${t.type}-layer:georeferenced-mesh-unsupported`,"Uploading georeferenced meshes to a layer is not supported.")}}function S(e,t,a,r){$(e,t,a,r),E(e,t)}function R(e,t,a,r){$(e,t,a,r)}function j(e,t,r,s){$(e,t,r,s),E(e,t);const i=f(t);if("geometry"in e&&null!=e.geometry&&!i?.editing.supportsGeometryUpdate)throw new a(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function O(e,t){const{feature:r,attachment:s}=e;if(!r||"attributes"in r&&!r.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in r)&&!r.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!s.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!s.data&&!s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(s.data instanceof File&&!!s.data.name)&&!s.name)throw new a(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities?.editing.supportsUploadWithItemId&&s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof s.data){const e=n(s.data);if(e&&!e.isBase64)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function U(e,t){const{attributes:a}=e;null==a[t]&&(a[t]=o())}async function L(e){const t=e.addFeatures??[],a=e.updateFeatures??[],r=t.concat(a).map((e=>e.geometry)),s=await d(r),i=t.length,n=a.length;return s.slice(0,i).forEach(((e,a)=>t[a].geometry=e)),s.slice(i,i+n).forEach(((e,t)=>a[t].geometry=e)),e}function k(e){return{addFeatures:Array.from(e?.addFeatures??[]),updateFeatures:Array.from(e?.updateFeatures??[]),deleteFeatures:e&&t.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function B(e,t,r){const s=k(e);if(s.addFeatures?.length&&!t.operations.supportsAdd)throw new a(`${r}:unsupported-operation`,"Layer does not support adding features.");if(s.updateFeatures?.length&&!t.operations.supportsUpdate)throw new a(`${r}:unsupported-operation`,"Layer does not support updating features.");if(s.deleteFeatures?.length&&!t.operations.supportsDelete)throw new a(`${r}:unsupported-operation`,"Layer does not support deleting features.");return s.addFeatures=s.addFeatures.map(G),s.updateFeatures=s.updateFeatures.map(G),s.addAssetFeatures=[],s}function D(e,t,r,s,i,n){if(!e||!s&&!i)throw new a(`${n}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");if(!t.editing.supportsGlobalId&&r?.globalIdUsed)throw new a(`${n}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!t.editing.supportsGlobalId&&i)throw new a(`${n}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!r?.globalIdUsed&&i)throw new a(`${n}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function G(t){const a=new e;return t.attributes||(t.attributes={}),a.geometry=t.geometry,a.attributes=t.attributes,a}async function T(e,t){if(null==t.infoFor3D)return;const{infoFor3D:r}=t,s=c("model/gltf-binary",r.supportedFormats)??h("glb",r.supportedFormats);if(!(!!s&&r.editFormats.includes(s)))throw new a(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??=[];const{addAssetFeatures:i}=e;for(const a of e.addFeatures??[])M(a)&&i.push(a);for(const a of e.updateFeatures??[])M(a)&&i.push(a)}function M(e){return"mesh"===e?.geometry?.type}function V(e,t,r,s){if(!y(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new a(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(r,s)}export{A as applyEdits,D as checkEditingCapabilities,F as isFeatureIdentifierArrayWithGlobalId,b as isFeatureIdentifierArrayWithObjectId,w as isFeatureIdentifierWithGlobalId,g as isFeatureIdentifierWithObjectId,k as normalizeCollections,B as normalizeEdits,L as normalizeGeometries,G as shallowCloneFeature,V as uploadAssets};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import{id as s}from"../../../kernel.js";import r from"../../../request.js";import a from"../../../TimeExtent.js";import{isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as n}from"../../../core/jsonMap.js";import u from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{setDeepValue as d}from"../../../core/object.js";import{debounce as c,after as p,throwIfAbortError as h}from"../../../core/promiseUtils.js";import{getMetersPerCartesianUnitForSR as y}from"../../../core/unitUtils.js";import{join as m,parseData as f}from"../../../core/urlUtils.js";import{generateBracedUUID as g}from"../../../core/uuid.js";import{property as R}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";import b from"../../../geometry/Extent.js";import{initializeProjection as w,project as F}from"../../../geometry/projection.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{toRelativeVertexSpace as q}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isOriginalExternal as _}from"../../../geometry/support/meshUtils/External.js";import{isFeatureIdentifierArrayWithGlobalId as O,isFeatureIdentifierArrayWithObjectId as I}from"../editingSupport.js";import{createDrawingInfo as A}from"./support/clientSideDefaults.js";import j from"./support/QueryTask.js";import{isHostedAgolService as x}from"../../support/arcgisLayerUrl.js";import{ensureLayerCredential as T}from"../../support/featureLayerUtils.js";import{getAssetMapTable as N}from"../../support/infoFor3D.js";import{executeQueryJSON as v}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as J}from"../../../rest/query/operations/editsZScale.js";import M from"../../../rest/support/Query.js";import U from"../../../geometry/SpatialReference.js";const k=new n({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),L=new Set(["Feature Layer","Oriented Imagery Layer","Table"]),C=new n({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let Q=class extends u{constructor(){super(...arguments),this.type="feature-layer",this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}})),this._ongoingAssetUploads=new Map}load(e){const t=this.layer.sourceJSON,s=this._fetchService(t,{...e}).then((()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,e))).then((()=>this._ensureLatestMetadata(e)));return this.addResolvingPromise(s),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:r,gdbVersion:a,spatialReference:i,fieldsIndex:o}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==r,u=e?.operations?.supportsQueryAttachments??!1;return new j({url:t.path,pbfSupported:n,fieldsIndex:o,infoFor3D:r,dynamicDataSource:s,gdbVersion:a,sourceSpatialReference:i,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const{layer:s}=this;await T(s,"editing");const a=e.attributes[s.objectIdField],i=s.parsedUrl.path+"/"+a+"/addAttachment",o=this._getLayerRequestOptions(),n=this._getFormDataForAttachment(t,o.query);try{const e=await r(i,{body:n});return this._createFeatureEditResult(e.data.addAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async updateAttachment(e,t,s){await this.load();const{layer:a}=this;await T(a,"editing");const i=e.attributes[a.objectIdField],o=a.parsedUrl.path+"/"+i+"/updateAttachment",n=this._getLayerRequestOptions({query:{attachmentId:t}}),u=this._getFormDataForAttachment(s,n.query);try{const e=await r(o,{body:u});return this._createFeatureEditResult(e.data.updateAttachmentResult)}catch(l){throw this._createAttachmentErrorResult(i,l)}}async applyEdits(e,t){await this.load();const{layer:a}=this;await T(a,"editing");const o=a.infoFor3D,n=null!=o,u=n||(t?.globalIdUsed??!1),l=n?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,d=e.addFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],c=(await Promise.all(d)).filter(i),p=e.updateFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],h=(await Promise.all(p)).filter(i),y=this._getFeatureIds(e.deleteFeatures,u);J(c,h,a.spatialReference);const m=await this._getAttachmentEditsJSON(e),f=a.capabilities.editing.supportsAsyncApplyEdits&&n,g={gdbVersion:t?.gdbVersion||a.gdbVersion,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,sessionId:t?.sessionId,async:f};t?.returnServiceEditsOption?(g.edits=JSON.stringify([{id:a.layerId,adds:c,updates:h,deletes:y,attachments:m,assetMaps:l}]),g.returnServiceEditsOption=k.toJSON(t?.returnServiceEditsOption),g.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(g.adds=c.length?JSON.stringify(c):null,g.updates=h.length?JSON.stringify(h):null,g.deletes=y.length?u?JSON.stringify(y):y.join(","):null,g.attachments=m&&JSON.stringify(m),g.assetMaps=null!=l?JSON.stringify(l):void 0);const R=this._getLayerRequestOptions({method:"post",query:g}),S=t?.returnServiceEditsOption?a.url:a.parsedUrl.path,b=f?await this._asyncApplyEdits(S+"/applyEdits",R):await r(S+"/applyEdits",R);if(!a.capabilities.operations?.supportsEditing&&a.effectiveCapabilities?.operations?.supportsEditing){const e=s?.findCredential(a.url);await(e?.refreshToken())}return this._createEditsResult(b)}async deleteAttachments(e,t){await this.load();const{layer:s}=this;await T(s,"editing");const a=e.attributes[s.objectIdField],i=s.parsedUrl.path+"/"+a+"/deleteAttachments";try{return(await r(i,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(this._createFeatureEditResult)}catch(o){throw this._createAttachmentErrorResult(a,o)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:s,url:i}=this.layer,{data:o}=await r(`${i}/${s}`,t),{id:n,extent:u,fullExtent:l,timeExtent:d}=o,c=u||l;return{id:n,fullExtent:c&&b.fromJSON(c),timeExtent:d&&a.fromJSON({start:d[0],end:d[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){await this.load();const s=await this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)});return e.outStatistics?.length&&s.features.length&&s.features.forEach((t=>{const s=t.attributes;e.outStatistics?.forEach((({outStatisticFieldName:e})=>{const t=e&&e.toLowerCase();t&&t in s&&e!==t&&(s[e]=s[t],delete s[t])}))})),s}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!x(this.layer.url))return"unavailable";const e=m(this.layer.url,"status"),t=await r(e,{query:{f:"json"}});return C.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:s}=await import("./support/uploadAssets.js");return s(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}async _asyncApplyEdits(e,t){const s=(await r(e,t)).data.statusUrl;for(;;){const e=(await r(s,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return r(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new o("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new o("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await p(D)}}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const s={};has("featurelayer-advanced-symbols")&&(s.returnAdvancedSymbols=!0),t?.cacheBust&&(s._ts=Date.now());const{data:a}=await r(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:s,signal:t?.signal}));e=a}this.sourceJSON=await this._patchServiceJSON(e,t?.signal);const s=e.type;if(!L.has(s))throw new o("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}async _patchServiceJSON(e,t){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=A(e.geometryType).renderer;d("drawingInfo.renderer",t,e)}if("esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),null==e.extent)try{const{data:s}=await r(this.layer.url,this._getLayerRequestOptions({signal:t}));s.spatialReference&&(e.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:s.spatialReference})}catch(s){h(s)}return e}async _ensureLatestMetadata(e){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...e,cacheBust:!0})}async _getFeatureJSON(e,t){const{geometry:s}=e,r={...e.attributes};if(null!=t&&"mesh"===s?.type){const{transformFieldRoles:e}=t,{origin:a,spatialReference:i,transform:o}=s,n=this.layer.spatialReference;await w(i,n);const u=F(a,n);if(r[e.originX]=u.x,r[e.originY]=u.y,r[e.originZ]=u.z??0,null!=o){const{translation:t,scale:a,rotation:u}=o,{vertexSpace:l}=s,d=l.isGeoreferenced?1:y(i)/y(n);r[e.translationX]=t[0]*d,r[e.translationY]=t[2]*d,r[e.translationZ]=-t[1]*d,r[e.scaleX]=a[0],r[e.scaleY]=a[2],r[e.scaleZ]=a[1],r[e.rotationX]=u[0],r[e.rotationY]=u[2],r[e.rotationZ]=-u[1],r[e.rotationDeg]=u[3]}return{attributes:r}}return null==s?{attributes:r}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:r}}async _getAttachmentEditsJSON(e){const t=await Promise.all((e.addAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),s=await Promise.all((e.updateAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),r=e.deleteAttachments??[];return t.length||s.length||r.length?{adds:t,updates:s,deletes:[...r]}:null}async _getAttachmentEditJSON(e){const{feature:t,attachment:s}=e,{globalId:r,name:a,contentType:i,data:o,uploadId:n}=s,u={globalId:r};if(t&&("attributes"in t?u.parentGlobalId=t.attributes&&t.attributes[this.layer.globalIdField]:t.globalId&&(u.parentGlobalId=t.globalId)),n)u.uploadId=n;else if(o){const e=await f(o);e&&(u.contentType=e.mediaType,u.data=e.data),o instanceof File&&(u.name=o.name)}return a&&(u.name=a),i&&(u.contentType=i),u}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;const s=await this._filterRedundantAssetMaps(t);if(!t?.length)return null;const r=new Array,a=new Map;for(const i of s){const{geometry:e}=i,{vertexSpace:t}=e;if(t.isRelative)r.push(e);else{const t=q(e);a.set(t,e),i.geometry=t,r.push(t)}}await this.uploadAssets(r);for(const[i,o]of a)o.addExternalSources(i.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(s),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,s=this.layer.globalIdField,r=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,o=i.getExternalSourcesOnService(r),n=a.getAttribute(s);if(0===o.length){l.getLogger(this).error(`Skipping feature ${n}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:u}=o.find(_)??o[0],{vertexSpace:d}=e,c=d.isGeoreferenced?["PROJECT_VERTICES"]:[];for(const s of u)1===s.parts.length?t.push({globalId:g(),parentGlobalId:n,assetName:s.assetName,assetHash:s.parts[0].partHash,flags:c}):l.getLogger(this).error(`Skipping asset ${s.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_getFeatureIds(e,t){if(!e||0===e.length)return[];if(t&&O(e))return e.map((e=>e.globalId));if(I(e))return e.map((e=>e.objectId));const{layer:s}=this,r=t?s.globalIdField:s.objectIdField;return r?e.map((e=>e.getAttribute(r))):[]}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,r=[];let a=null;if(Array.isArray(t))for(const u of t)r.push({id:u.id,editedFeatures:u.editedFeatures}),u.id===s&&(a={addResults:u.addResults??[],updateResults:u.updateResults??[],deleteResults:u.deleteResults??[],attachments:u.attachments,editMoment:u.editMoment});else a=t;const i=a?.assetMaps;if(i){for(const e of i.addResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`);for(const e of i.updateResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`)}const o=a?.attachments,n={addFeatureResults:a?.addResults?.map(this._createFeatureEditResult,this)??[],updateFeatureResults:a?.updateResults?.map(this._createFeatureEditResult,this)??[],deleteFeatureResults:a?.deleteResults?.map(this._createFeatureEditResult,this)??[],addAttachmentResults:o&&o.addResults?o.addResults.map(this._createFeatureEditResult,this):[],updateAttachmentResults:o&&o.updateResults?o.updateResults.map(this._createFeatureEditResult,this):[],deleteAttachmentResults:o&&o.deleteResults?o.deleteResults.map(this._createFeatureEditResult,this):[]};if(a?.editMoment&&(n.editMoment=a.editMoment),r.length>0){n.editedFeatureResults=[];for(const e of r){const{editedFeatures:t}=e,s=t?.spatialReference?new U(t.spatialReference):null;n.editedFeatureResults.push({layerId:e.id,editedFeatures:{adds:t?.adds?.map((e=>this._createEditedFeature(e,s)))||[],updates:t?.updates?.map((e=>({original:this._createEditedFeature(e[0],s),current:this._createEditedFeature(e[1],s)})))||[],deletes:t?.deletes?.map((e=>this._createEditedFeature(e,s)))||[],spatialReference:s}})}}return n}_createEditedFeature(e,s){return new t({attributes:e.attributes,geometry:E({...e.geometry,spatialReference:s})})}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new o("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_createAttachmentErrorResult(e,t){const s=t.details.messages&&t.details.messages[0]||t.message,r=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new o("feature-layer-source:attachment-failure",s,{code:r})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const r in t){const e=t[r];null!=e&&(s.set?s.set(r,e):s.append(r,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:r}=this.layer;return{...e,query:{gdbVersion:s,layer:r?JSON.stringify({source:r}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _filterRedundantAssetMaps(e){const{layer:t}=this,{globalIdField:s,infoFor3D:r,parsedUrl:a}=t;if(null==r||null==s)return e;const o=N(r);if(null==o)return e;const n=m(a.path,`../${o.id}`),u=new Array,l=new Array;for(const i of e)i.geometry.metadata.getExternalSourcesOnService(a).length>0?l.push(i):u.push(i);const d=l.map((e=>e.getAttribute(s))).filter(i);if(0===d.length)return e;const{assetMapFieldRoles:{parentGlobalId:c,assetHash:p}}=r,h=new M;h.where=`${c} IN (${d.map((e=>`'${e}'`))})`,h.outFields=[p,c],h.returnGeometry=!1;const y=await v(n,h),{features:f}=y;return 0===f.length?e:[...u,...l.filter((e=>{const t=e.getAttribute(s);if(!t)return!0;const{metadata:r}=e.geometry,i=f.filter((e=>e.getAttribute(c)===t));if(0===i.length)return!0;const o=i.map((e=>e.getAttribute(p)));return r.getExternalSourcesOnService(a).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>o.every((t=>e!==t))))}))]}};e([R()],Q.prototype,"type",void 0),e([R({constructOnly:!0})],Q.prototype,"layer",void 0),e([R({readOnly:!0})],Q.prototype,"queryTask",null),Q=e([S("esri.layers.graphics.sources.FeatureLayerSource")],Q);const D=1e3,P=Q;export{P as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{id as t}from"../../../kernel.js";import s from"../../../request.js";import r from"../../../TimeExtent.js";import{isSome as a}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as o}from"../../../core/jsonMap.js";import n from"../../../core/Loadable.js";import u from"../../../core/Logger.js";import{setDeepValue as l}from"../../../core/object.js";import{debounce as c,after as d,throwIfAbortError as p}from"../../../core/promiseUtils.js";import{join as y}from"../../../core/urlUtils.js";import{generateBracedUUID as h}from"../../../core/uuid.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Extent.js";import{toRelativeVertexSpace as S}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isOriginalExternal as w}from"../../../geometry/support/meshUtils/External.js";import{createFeatureEditResult as q,getFeatureJSON as R,getFeatureIds as O,getAttachmentEditsJSON as E,unpackEditResultData as b,createEditedFeatures as A}from"../applyEditsUtils.js";import{createDrawingInfo as F}from"./support/clientSideDefaults.js";import x from"./support/QueryTask.js";import{isHostedAgolService as _}from"../../support/arcgisLayerUrl.js";import{ensureLayerCredential as j}from"../../support/featureLayerUtils.js";import{getAssetMapTable as I}from"../../support/infoFor3D.js";import{executeQueryJSON as T}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as v}from"../../../rest/query/operations/editsZScale.js";import N from"../../../rest/support/Query.js";import J from"../../../geometry/SpatialReference.js";const U=new o({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),k=new Set(["Feature Layer","Oriented Imagery Layer","Table"]),M=new o({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let C=class extends n{constructor(){super(...arguments),this.type="feature-layer",this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}})),this._ongoingAssetUploads=new Map}load(e){const t=this.layer.sourceJSON,s=this._fetchService(t,{...e}).then((()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,e))).then((()=>this._ensureLatestMetadata(e)));return this.addResolvingPromise(s),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:r,gdbVersion:a,spatialReference:i,fieldsIndex:o}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==r,u=e?.operations?.supportsQueryAttachments??!1;return new x({url:t.path,pbfSupported:n,fieldsIndex:o,infoFor3D:r,dynamicDataSource:s,gdbVersion:a,sourceSpatialReference:i,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const{layer:r}=this;await j(r,"editing");const a=e.attributes[r.objectIdField],i=r.parsedUrl.path+"/"+a+"/addAttachment",o=this._getLayerRequestOptions(),n=this._getFormDataForAttachment(t,o.query);try{const e=await s(i,{body:n});return q(e.data.addAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async updateAttachment(e,t,r){await this.load();const{layer:a}=this;await j(a,"editing");const i=e.attributes[a.objectIdField],o=a.parsedUrl.path+"/"+i+"/updateAttachment",n=this._getLayerRequestOptions({query:{attachmentId:t}}),u=this._getFormDataForAttachment(r,n.query);try{const e=await s(o,{body:u});return q(e.data.updateAttachmentResult)}catch(l){throw this._createAttachmentErrorResult(i,l)}}async applyEdits(e,r){await this.load();const{layer:i}=this;await j(i,"editing");const o=i.infoFor3D,n=null!=o,u=n||(r?.globalIdUsed??!1),l=n?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,c=e.addFeatures?.map((e=>R(this.layer,e,o)))??[],d=(await Promise.all(c)).filter(a),p=e.updateFeatures?.map((e=>R(this.layer,e,o)))??[],y=(await Promise.all(p)).filter(a),h=O(this.layer,e.deleteFeatures,u);v(d,y,i.spatialReference);const m=await E(this.layer,e),f=i.capabilities.editing.supportsAsyncApplyEdits&&n,g={gdbVersion:r?.gdbVersion||i.gdbVersion,rollbackOnFailure:r?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:r?.returnEditMoment,usePreviousEditMoment:r?.usePreviousEditMoment,sessionId:r?.sessionId,async:f};r?.returnServiceEditsOption?(g.edits=JSON.stringify([{id:i.layerId,adds:d,updates:y,deletes:h,attachments:m,assetMaps:l}]),g.returnServiceEditsOption=U.toJSON(r?.returnServiceEditsOption),g.returnServiceEditsInSourceSR=r?.returnServiceEditsInSourceSR):(g.adds=d.length?JSON.stringify(d):null,g.updates=y.length?JSON.stringify(y):null,g.deletes=h.length?u?JSON.stringify(h):h.join(","):null,g.attachments=m&&JSON.stringify(m),g.assetMaps=null!=l?JSON.stringify(l):void 0);const S=this._getLayerRequestOptions({method:"post",query:g}),w=r?.returnServiceEditsOption?i.url:i.parsedUrl.path,q=f?await this._asyncApplyEdits(w+"/applyEdits",S):await s(w+"/applyEdits",S);if(!i.capabilities.operations?.supportsEditing&&i.effectiveCapabilities?.operations?.supportsEditing){const e=t?.findCredential(i.url);await(e?.refreshToken())}return this._createEditsResult(q)}async deleteAttachments(e,t){await this.load();const{layer:r}=this;await j(r,"editing");const a=e.attributes[r.objectIdField],i=r.parsedUrl.path+"/"+a+"/deleteAttachments";try{return(await s(i,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(q)}catch(o){throw this._createAttachmentErrorResult(a,o)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:a,url:i}=this.layer,{data:o}=await s(`${i}/${a}`,t),{id:n,extent:u,fullExtent:l,timeExtent:c}=o,d=u||l;return{id:n,fullExtent:d&&g.fromJSON(d),timeExtent:c&&r.fromJSON({start:c[0],end:c[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){await this.load();const s=await this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)});return e.outStatistics?.length&&s.features.length&&s.features.forEach((t=>{const s=t.attributes;e.outStatistics?.forEach((({outStatisticFieldName:e})=>{const t=e&&e.toLowerCase();t&&t in s&&e!==t&&(s[e]=s[t],delete s[t])}))})),s}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!_(this.layer.url))return"unavailable";const e=y(this.layer.url,"status"),t=await s(e,{query:{f:"json"}});return M.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:s}=await import("./support/uploadAssets.js");return s(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}async _asyncApplyEdits(e,t){const r=(await s(e,t)).data.statusUrl;for(;;){const e=(await s(r,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return s(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new i("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new i("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await d(L)}}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const r={};has("featurelayer-advanced-symbols")&&(r.returnAdvancedSymbols=!0),t?.cacheBust&&(r._ts=Date.now());const{data:a}=await s(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:r,signal:t?.signal}));e=a}this.sourceJSON=await this._patchServiceJSON(e,t?.signal);const r=e.type;if(!k.has(r))throw new i("feature-layer-source:unsupported-type",`Source type "${r}" is not supported`)}async _patchServiceJSON(e,t){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=F(e.geometryType).renderer;l("drawingInfo.renderer",t,e)}if("esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),null==e.extent)try{const{data:r}=await s(this.layer.url,this._getLayerRequestOptions({signal:t}));r.spatialReference&&(e.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:r.spatialReference})}catch(r){p(r)}return e}async _ensureLatestMetadata(e){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...e,cacheBust:!0})}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;const s=await this._filterRedundantAssetMaps(t);if(!t?.length)return null;const r=new Array,a=new Map;for(const i of s){const{geometry:e}=i,{vertexSpace:t}=e;if(t.isRelative)r.push(e);else{const t=S(e);a.set(t,e),i.geometry=t,r.push(t)}}await this.uploadAssets(r);for(const[i,o]of a)o.addExternalSources(i.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(s),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,s=this.layer.globalIdField,r=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,o=i.getExternalSourcesOnService(r),n=a.getAttribute(s);if(0===o.length){u.getLogger(this).error(`Skipping feature ${n}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:l}=o.find(w)??o[0],{vertexSpace:c}=e,d=c.isGeoreferenced?["PROJECT_VERTICES"]:[];for(const s of l)1===s.parts.length?t.push({globalId:h(),parentGlobalId:n,assetName:s.assetName,assetHash:s.parts[0].partHash,flags:d}):u.getLogger(this).error(`Skipping asset ${s.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,r=[];let a=null;if(Array.isArray(t))for(const o of t)r.push({id:o.id,editedFeatures:o.editedFeatures}),o.id===s&&(a={addResults:o.addResults??[],updateResults:o.updateResults??[],deleteResults:o.deleteResults??[],attachments:o.attachments,editMoment:o.editMoment});else a=t;const i=b(a);if(r.length>0){i.editedFeatureResults=[];for(const e of r){const{editedFeatures:t}=e,s=t?.spatialReference?new J(t.spatialReference):null;i.editedFeatureResults.push({layerId:e.id,editedFeatures:A(t,s)})}}return i}_createAttachmentErrorResult(e,t){const s=t.details.messages&&t.details.messages[0]||t.message,r=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new i("feature-layer-source:attachment-failure",s,{code:r})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const r in t){const e=t[r];null!=e&&(s.set?s.set(r,e):s.append(r,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:r}=this.layer;return{...e,query:{gdbVersion:s,layer:r?JSON.stringify({source:r}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _filterRedundantAssetMaps(e){const{layer:t}=this,{globalIdField:s,infoFor3D:r,parsedUrl:i}=t;if(null==r||null==s)return e;const o=I(r);if(null==o)return e;const n=y(i.path,`../${o.id}`),u=new Array,l=new Array;for(const a of e)a.geometry.metadata.getExternalSourcesOnService(i).length>0?l.push(a):u.push(a);const c=l.map((e=>e.getAttribute(s))).filter(a);if(0===c.length)return e;const{assetMapFieldRoles:{parentGlobalId:d,assetHash:p}}=r,h=new N;h.where=`${d} IN (${c.map((e=>`'${e}'`))})`,h.outFields=[p,d],h.returnGeometry=!1;const m=await T(n,h),{features:f}=m;return 0===f.length?e:[...u,...l.filter((e=>{const t=e.getAttribute(s);if(!t)return!0;const{metadata:r}=e.geometry,a=f.filter((e=>e.getAttribute(d)===t));if(0===a.length)return!0;const o=a.map((e=>e.getAttribute(p)));return r.getExternalSourcesOnService(i).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>o.every((t=>e!==t))))}))]}};e([m()],C.prototype,"type",void 0),e([m({constructOnly:!0})],C.prototype,"layer",void 0),e([m({readOnly:!0})],C.prototype,"queryTask",null),C=e([f("esri.layers.graphics.sources.FeatureLayerSource")],C);const L=1e3,Q=C;export{Q 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{clone as s}from"../../core/lang.js";import{createResolver as i}from"../../core/promiseUtils.js";import"../../core/Logger.js";import"../../core/accessorSupport/ensureType.js";import"../../core/Error.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{defaultVersionNameLookup as d}from"../../versionManagement/support/versionManagementUtils.js";const
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{clone as s}from"../../core/lang.js";import{createResolver as i}from"../../core/promiseUtils.js";import"../../core/Logger.js";import"../../core/accessorSupport/ensureType.js";import"../../core/Error.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{defaultVersionNameLookup as d,isVersionInEditSession as n}from"../../versionManagement/support/versionManagementUtils.js";const o=new t.EventEmitter;function l(e){return o.on("apply-edits",new WeakRef(e))}function a(e){return o.on("update-moment",new WeakRef(e))}function c(e,t,s=null,r=!1){const d=i();return r=null==t||r,o.emit("apply-edits",{serviceUrl:e,layerId:t,gdbVersion:s,mayReceiveServiceEdits:r,result:d.promise}),d}function h(e,t,s=null,i){o.emit("update-moment",{serviceUrl:e,layerId:t,gdbVersion:s,moment:i})}const u="esri.layers.mixins.EditBusLayer",m=Symbol(u);function p(e){return null!=e&&"object"==typeof e&&m in e}function b(e){return null!=e&&"object"==typeof e&&"gdbVersion"in e}function g(e,t,s){const i=new URL(e).host,r=d.get(i),n=e=>!e||e===r;return n(t)&&n(s)||t===s}const F=t=>{var i;let d=class extends t{constructor(...e){super(...e),this[i]=!0,this._applyEditsHandler=e=>{const{serviceUrl:t,layerId:i,gdbVersion:r,mayReceiveServiceEdits:d,result:o}=e,l=t===this.url,a=null!=i&&null!=this.layerId&&i===this.layerId,c=b(this),h=b(this)&&g(t,r,this.gdbVersion);if(!l||c&&!h||!a&&!d)return;const u=o.then((e=>{if(a&&(e.addedFeatures.length||e.updatedFeatures.length||e.deletedFeatures.length||e.addedAttachments.length||e.updatedAttachments.length||e.deletedAttachments.length))return this.emit("edits",s(e)),e;const t=e.editedFeatures?.find((({layerId:e})=>e===this.layerId));if(t){const{adds:i,updates:r,deletes:d}=t.editedFeatures,n={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:i?i.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],deletedFeatures:d?d.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],updatedFeatures:r?r.map((({current:{attributes:e}})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],editedFeatures:s(e.editedFeatures),exceededTransferLimit:!1,historicMoment:s(e.historicMoment)};return this.emit("edits",n),n}return{edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:[],deletedFeatures:[],updatedFeatures:[],editedFeatures:s(e.editedFeatures),exceededTransferLimit:!1,historicMoment:s(e.historicMoment)}})).then((e=>("historicMoment"in this&&this.historicMoment!==e.historicMoment&&n(t,r)&&(this.historicMoment=e.historicMoment),e)));this.emit("apply-edits",{result:u})},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:s,moment:i}=e,r=t===this.url,d=b(this),n=b(this)&&g(t,s,this.gdbVersion),o=b(this)&&!g(t,this.gdbVersion,null);r&&d&&n&&o&&"historicMoment"in this&&this.historicMoment!==e.moment&&(this.historicMoment=i)},this.when().then((()=>{this.addHandles(l(this._applyEditsHandler)),"historicMoment"in this&&this.addHandles(a(this._updateMomentHandler))}),(()=>{}))}};return i=m,d=e([r(u)],d),d};export{F as EditBusLayer,c as emitApplyEditsEvent,h as emitUpdateMomentEvent,p as isEditBusLayer,b as isLayerWithGDBVersion,l as onApplyEditsEvent,a as onUpdateMomentEvent,g as versionMatches};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../../chunks/tslib.es6.js";import{ClonableMixin as o}from"../../../core/Clonable.js";import{JSONSupportMixin as t}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import{ClonableMixin as o}from"../../../core/Clonable.js";import{JSONSupportMixin as t}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{cast as s}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import p from"./CameraOrientation.js";import{cameraOrientationRegistry as a,createCameraOrientation as c}from"./utils.js";import{CameraOrientationType as n}from"../enums/CameraOrientationType.js";let m=class extends(o(t(p))){constructor(){super(...arguments),this.type=4}toString(){const{type:r,latitude:o,longitude:t,ellipsoidRadius:e,squaredEccentricity:s,properties:i}=this,p=`${i}`.split("|");return p.splice(1,1),`${r}|${o}|${t}|${e}|${s}|${p.join("|")}`}};r([e({json:{write:!0}})],m.prototype,"type",void 0),r([e({json:{write:!0},type:Number})],m.prototype,"latitude",void 0),r([e({json:{write:!0},type:Number})],m.prototype,"longitude",void 0),r([e({json:{write:!0},type:Number})],m.prototype,"ellipsoidRadius",void 0),r([e({json:{write:!0},type:Number})],m.prototype,"squaredEccentricity",void 0),r([e({json:{write:!0}}),s((r=>r?c(r):null))],m.prototype,"properties",void 0),m=r([i("esri.layers.orientedImagery.core.CameraOrientationLTP")],m);const u=m;a.set(`${n.LTP}`,{desc:"Using Latitude and Longitude",constructor:m});export{u 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.28/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends r{};o([e({type:Number,json:{write:!0}})],s.prototype,"lod",void 0),o([e({type:String,json:{write:!0}})],s.prototype,"rasterFunction",void 0),o([e({type:String,json:{write:!0}})],s.prototype,"url",void 0),s=o([t("esri.layers.orientedImagery.cor.ElevationSourceDefinitions.ElevationSource")],s);let i=class extends r{};o([e({type:Number,json:{write:!0}})],i.prototype,"constantElevation",void 0),i=o([t("esri.layers.orientedImagery.cor.ElevationSourceDefinitions.ConstantElevation")],i);const n=o=>"constantElevation"in o;export{i as ConstantElevation,s as ElevationSource,n as isConstantElevation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{ClonableMixin as r}from"../../../core/Clonable.js";import t from"../../../core/Error.js";import{JSONSupport as a}from"../../../core/JSONSupport.js";import o from"../../../core/Logger.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as p}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as c}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../../core/accessorSupport/decorators/writer.js";import m from"./CameraOrientation.js";import y from"./cameraOrientationFactory.js";import{appendPrefixAndSuffix as u,getEffectiveElevationSource as d,orientedImageryTypeMap as f}from"./utils.js";import{CameraOrientationType as g}from"../enums/CameraOrientationType.js";import h from"../../../geometry/Point.js";function v(e){throw new t("exposure-point:missing-default-value",`a value for ${e} is missing in default properties`)}function O(e,r){throw new t("exposure-point:missing-attribute-value",`a value for ${e} is missing in attribute table`,{exposurePoint:r})}let w=class extends(r(a)){constructor(e){super(e),this.cameraOrientation=null,this.elevation=null,this.elevationSource=null,this.name=null}read(e,r){const t={},{attributes:a,layer:o,geometry:i}=e;for(const n in a)t[n.toLowerCase()]=a[n];super.read({geometry:i,layer:o??{},...t},r)}readCameraHeading(e,r){const{cameraheading:t,camheading:a,layer:o}=r;return t??a??o.cameraHeading}readCameraHeight(e,r){const{cameraheight:t,avghtag:a,layer:o}=r;return t??a??o.cameraHeight}readCamOffset(e,r){const{cameraoffset:t,camoffset:a}=r;return t?.split(";").map(Number)??a?.split(";").map(Number)??null}writeCameraOffset(e,r){e&&(r.cameraOffset=e.join(";"))}readCameraOrientation(e,r){const{cameraorientation:t,camori:a}=r;return t??a}readCameraPitch(e,r){const{camerapitch:t,campitch:a,layer:o}=r;return t??a??o.cameraPitch}readCameraRoll(e,r){const{cameraroll:t,camroll:a,layer:o}=r;return t??a??o.cameraRoll}readDepthImage(e,r){const{depthimage:t,depthimg:a,layer:o}=r,i=t??a??null,{depthImagePathPrefix:n,depthImagePathSuffix:p}=o??{};return u(i,n,p)}readElevationSource(e,r){const{elevationsource:t,layer:a}=r,{demPathSuffix:o,demPathPrefix:i}=a;if(t){const e=this._parseIfJSON(t);return d(e,i,o)}return a.effectiveElevationSource}readFarDistance(e,r){const{fardistance:t,fardist:a,layer:o}=r;return t??a??o.farDistance}readHFOV(e,r){const{horizontalfieldofview:t,hfov:a,layer:o}=r;return t??a??o.horizontalFieldOfView}readImageURL(e,r){const{imagepath:t,layer:a}=r;t||O("imagePath",this);const{imagePathPrefix:o,imagePathSuffix:i}=a;return u(t,o,i)}readImageRotation(e,r){const{imagerotation:t,imgrot:a,layer:o}=r;return t??a??o.imageRotation}get isHorizontal(){return"horizontal"===this.orientedImageryType}get isInspection(){return"inspection"===this.orientedImageryType}get isNadir(){return"nadir"===this.orientedImageryType}get isOblique(){return"oblique"===this.orientedImageryType}get isSpherical(){return"360"===this.orientedImageryType}get location(){const{cameraOrientation:e,geometry:r,cameraHeight:t,elevation:a}=this;if(e){const{type:r,x:t,y:a,z:o,horizontalWKID:i}=e;return new h({x:t,y:a,z:o,spatialReference:{wkid:r===g.LTP?4326:i}})}if("number"!=typeof t)throw v("cameraHeight");return r.z=(a??0)+t,r}readNearDistance(e,r){const{neardistance:t,neardist:a,layer:o}=r;return t??a??o.nearDistance}readOrientationAccuracy(e,r){const{accuracy:t,orientationaccuracy:a}=r;return a?.split(";").map(Number)??t?.split(";").map(Number)??null}writeOrientationAccuracy(e,r){e&&(r.orientationAccuracy=e.join(";"))}readOIType(e,r){const{orientedimagerytype:t,oitype:a,camerapitch:o,campitch:i,layer:n}=r,p=f.read(t??a??n.orientedImageryType),c=o??i??n.cameraPitch;return"oblique"===p?c<10?"nadir":"oblique":p}readVFOV(e,r){const{verticalfieldofview:t,vfov:a,layer:o}=r;return t??a??o.verticalFieldOfView}_parseIfJSON(e){let r=null;try{r=JSON.parse(e)}catch(t){o.getLogger(this).error("couldn't parse the given elevation source JSON",e,t)}return r}};e([i({type:Date,json:{write:{enabled:!0,target:"aquisitionDate"},name:"acquisitiondate"}})],w.prototype,"acquisitionDate",void 0),e([i({type:Number,json:{write:!0,read:{source:["cameraheading","camheading","layer.cameraHeading"]}}})],w.prototype,"cameraHeading",void 0),e([c("cameraHeading")],w.prototype,"readCameraHeading",null),e([i({type:Number,json:{write:!0}})],w.prototype,"cameraHeight",void 0),e([c("cameraHeight",["cameraheight","avghtag","layer.cameraHeight"])],w.prototype,"readCameraHeight",null),e([i()],w.prototype,"cameraOffset",void 0),e([c("cameraOffset",["cameraoffset","camoffset"])],w.prototype,"readCamOffset",null),e([l("cameraOffset")],w.prototype,"writeCameraOffset",null),e([i({json:{write:!0},type:m}),n((e=>e?y.getCameraOrientation(e):null))],w.prototype,"cameraOrientation",void 0),e([c("cameraOrientation",["cameraorientation","camori"])],w.prototype,"readCameraOrientation",null),e([i({type:Number,json:{write:!0}})],w.prototype,"cameraPitch",void 0),e([c("cameraPitch",["camerapitch","campitch","layer.cameraPitch"])],w.prototype,"readCameraPitch",null),e([i({type:Number,json:{write:!0}})],w.prototype,"cameraRoll",void 0),e([c("cameraRoll",["cameraroll","camroll","layer.cameraRoll"])],w.prototype,"readCameraRoll",null),e([i({json:{write:!0},type:String})],w.prototype,"depthImage",void 0),e([c("depthImage",["depthimage","depthimg"])],w.prototype,"readDepthImage",null),e([i({type:Number,json:{write:!0}})],w.prototype,"elevation",void 0),e([i({json:{write:!0}})],w.prototype,"elevationSource",void 0),e([c("elevationSource",["elevationsource","layer.effectiveElevationSource"])],w.prototype,"readElevationSource",null),e([i({json:{name:"exposurestationid",write:{target:"exposureStationId"}},type:String})],w.prototype,"exposureStationId",void 0),e([i({type:Number,json:{write:!0}})],w.prototype,"farDistance",void 0),e([c("farDistance",["fardistance","fardist","layer.farDistance"])],w.prototype,"readFarDistance",null),e([i({type:h,json:{name:"geometry"}})],w.prototype,"geometry",void 0),e([i({type:Number,json:{write:!0}})],w.prototype,"horizontalFieldOfView",void 0),e([c("horizontalFieldOfView",["horizontalfieldofview","hfov","layer.horizontalFieldOfView"])],w.prototype,"readHFOV",null),e([i({json:{write:!0},type:String})],w.prototype,"imagePath",void 0),e([c("imagePath",["imagepath"])],w.prototype,"readImageURL",null),e([i({type:Number,json:{write:!0}})],w.prototype,"imageRotation",void 0),e([c("imageRotation",["imagerotation","imgrot","layer.imageRotation"])],w.prototype,"readImageRotation",null),e([i()],w.prototype,"isHorizontal",null),e([i()],w.prototype,"isInspection",null),e([i()],w.prototype,"isNadir",null),e([i()],w.prototype,"isOblique",null),e([i()],w.prototype,"isSpherical",null),e([i()],w.prototype,"location",null),e([i({json:{write:!0},type:String})],w.prototype,"name",void 0),e([i({type:Number,json:{write:!0}})],w.prototype,"nearDistance",void 0),e([c("nearDistance",["neardistance","neardist","layer.nearDistance"])],w.prototype,"readNearDistance",null),e([i({json:{write:!0,name:"objectid"},type:Number})],w.prototype,"objectId",void 0),e([i()],w.prototype,"orientationAccuracy",void 0),e([c("orientationAccuracy",["accuracy","orientationaccuracy"])],w.prototype,"readOrientationAccuracy",null),e([l("orientationAccuracy")],w.prototype,"writeOrientationAccuracy",null),e([p(f)],w.prototype,"orientedImageryType",void 0),e([c("orientedImageryType",["orientedimagerytype","oitype","layer.orientedImageryType"])],w.prototype,"readOIType",null),e([i({type:Number,json:{name:"sortorder",write:{target:"sortOrder"}}})],w.prototype,"sortOrder",void 0),e([i({type:Number,json:{write:!0}})],w.prototype,"verticalFieldOfView",void 0),e([c("verticalFieldOfView",["verticalfieldofview","vfov","layer.verticalFieldOfView"])],w.prototype,"readVFOV",null),w=e([s("esri.layers.orientedImagery.core.ExposurePoint")],w);const j=w;export{j 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/Error.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{createCameraOrientation as o,cameraOrientationRegistry as t}from"./utils.js";let e=class{static getCameraOrientation(r){return o(r)}static register(r,s,o){t.set(r,{desc:s,constructor:o})}};e=r([s("esri.layers.orientedImagery.core.cameraOrientationFactory")],e);const c=e;export{c 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.28/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{JSONMap as t}from"../../../core/jsonMap.js";import n from"./CameraOrientationHPR.js";import i from"./CameraOrientationOPK.js";import e from"./CameraOrientationYPR.js";import{ElevationSource as o,isConstantElevation as r,ConstantElevation as s}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as a}from"../enums/CameraOrientationType.js";function c(t,n,i){return n&&(t=`${n}/${t}`),i&&(t+=`/${i}`),t}function l(t,n,i){let{url:e}=t;return e?(e=c(e,n,i),new o({...t,url:e})):null}function f(t,n,i){return t?r(t)?new s(t):l(t,n,i):t}const u=new t({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),p=new t({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique","":null}),m=new Map;m.set(`${a.OPK}`,{desc:"Using Omega Phi Kappa",constructor:i}),m.set(`${a.HPR}`,{desc:"Using Heading, Pitch and Roll",constructor:n}),m.set(`${a.YPR}`,{desc:"Using Yaw, Pitch and Roll",constructor:e});const d=new Map;function g(t){const[n,i,e,o,r,s,a,c,l,f,u,p,m,d,g,h,P,D,y,O,$,w,C]=t;return{type:n,horizontalWKID:i,verticalWKID:e,x:o,y:r,z:s,omega:a,phi:c,kappa:l,affineTransformations:[f,u,p,m,d,g],focalLength:h,principalOffsetPoint:[P,D],radialDistortionCoefficients:[y,O,$],tangentialDistortionCoefficients:[w,C]}}function h(t){const[n,i,e,o,r,s,a,c,l,f,u,p,m,d,g,h,P,D,y,O,$,w,C]=t;return{type:n,horizontalWKID:i,verticalWKID:e,x:o,y:r,z:s,heading:a,pitch:c,roll:l,affineTransformations:[f,u,p,m,d,g],focalLength:h,principalOffsetPoint:[P,D],radialDistortionCoefficients:[y,O,$],tangentialDistortionCoefficients:[w,C]}}function P(t){const[n,i,e,o,r,s,a,c,l,f,u,p,m,d,g,h,P,D,y,O,$,w,C]=t;return{type:n,horizontalWKID:i,verticalWKID:e,x:o,y:r,z:s,yaw:a,pitch:c,roll:l,affineTransformations:[f,u,p,m,d,g],focalLength:h,principalOffsetPoint:[P,D],radialDistortionCoefficients:[y,O,$],tangentialDistortionCoefficients:[w,C]}}function D(t){const[n,i,e,o,r,s,...a]=t,c=d.get(s);if(!c)return null;return{type:n,latitude:i,longitude:e,ellipsoidRadius:o,squaredEccentricity:r,properties:c([s,"",...a])}}function y(t){if(!t)return null;const n=`${t}`.split("|");if(0===n.length)return null;const i=m.get(n[0]);if(!i)return null;const e=d.get(n[0]);if(!e)return null;return new(0,i.constructor)(e(n))}d.set(`${a.HPR}`,h),d.set(`${a.YPR}`,P),d.set(`${a.OPK}`,g),d.set(`${a.LTP}`,D);export{c as appendPrefixAndSuffix,m as cameraOrientationRegistry,y as createCameraOrientation,f as getEffectiveElevationSource,p as orientedImageryTypeMap,l as processElevationSource,u as timeIntervalUnitTypeMap,d as transformersRegistry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{j as
|
|
5
|
+
import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as a}from"../../../core/promiseUtils.js";import{j as r}from"../../../chunks/mat3.js";import i from"../../../geometry/Point.js";import{project as n}from"../../../geometry/projection.js";import{geographicToWebMercator as o}from"../../../geometry/support/webMercatorUtils.js";import s from"../../ElevationLayer.js";import{isConstantElevation as c}from"../core/ElevationSourceDefinitions.js";import{calculateRotationMatrix as l,geographicToLTP as m}from"./utils.js";function u(e){return"esri.Graphic"===e?.declaredClass}const f=Math.PI/180;async function p(e,t,a=!1){if(!e)return[];e=e.map((e=>"esri.geometry.Point"===e.declaredClass?e:i.fromJSON(e)));const{feature:r}=t,{attributes:n}=r;if(isNaN(parseFloat(n.elevation))){const e=await d([r.geometry],t);r.attributes.elevation=e[0].z}return d(e,t,a).then((e=>h(e,t)))}async function d(e,r,i=!1){if(i)return e;const{feature:n,options:o,currentCoveragePolygon:l}=r,m=n.attributes.elevationSource;if(!m)return e;if(c(m)){const{constantElevation:t}=m;return"number"!=typeof t?e:g(e,t)}const{url:f}=m;if(!f)return e;const{elevationSample:p}=n;if(!p){const r=u(l)?l.geometry?.extent:l.extent;if(!r)return e;const i=r.clone();i.xmin/=2,i.xmax*=2,i.ymin/=2,i.ymax*=2;const c=new s(f);let m=e;try{await c.load(),n.elevationSample=await c.createElevationSampler(i,o),m=e.map(y(n.elevationSample))}catch(d){a(d)||t.getLogger("esri.layers.orientedImagery.transformations.groundToImageUtils").warn(`#updateElevation() failed to update elevation using the provided elevation source URL: ${f}. Please provide a valid elevation source url.`,d)}finally{c.destroy()}return m}return e.map(y(p))}function y(e){return t=>{t.z=1;const a=e.queryElevation(n(t,e.spatialReference));return a?.z&&(t.z=a.z),t}}function g(e,t){return e.map((e=>(e.z=t,e)))}function h(e,t){const{attributes:a}=t.feature;return a.isSpherical||360===a.horizontalFieldOfView?{}:a.cameraOrientation?.isAdvanced?w(e,t):Promise.resolve(v(e,t))}function v(e,t){const{feature:a,imageProperties:n}=t,{width:s,height:c}=n,{attributes:u}=a,p=l("HPR",[u.cameraHeading,u.cameraPitch,u.cameraRoll]),d=Math.sin(u.imageRotation??0*f),y=Math.cos(u.imageRotation??0*f),g=s??1,h=c??1,v=[Math.abs(y*g+d*h),Math.abs(y*h-d*g)],w={horizontal:1/(2*Math.tan(u.horizontalFieldOfView*f/2)),vertical:1/(2*Math.tan(u.verticalFieldOfView*f/2))},R=[-w.horizontal,0,.5,0,w.vertical,.5,0,0,1];let b=new i(u.geometry);b.spatialReference.isWGS84&&4!==u.cameraOrientation?.type&&(b=o(b));const x=b.spatialReference.isWebMercator?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*b.y/6378137))):1,M=r(new Array(9),p,R);return e.map((e=>{let t=new i(e);if(t.spatialReference.isWGS84)if(4===u.cameraOrientation?.type){const e=u.cameraOrientation;t=new i(m(t,[e.latitude,e.longitude,e.ellipsoidRadius,e.squaredEccentricity]))}else t=new i(o(t));const a=(t.z??0)-(b.z??0),r=(t.x-b.x)/x,n=(t.y-b.y)/x,s=(M[0]*r+M[1]*n+M[2]*a)/(M[6]*r+M[7]*n+M[8]*a),c=(M[3]*r+M[4]*n+M[5]*a)/(M[6]*r+M[7]*n+M[8]*a),l={x:s*v[0],y:c*v[1]};return{x:y*(l.x-v[0]/2)+d*(l.y-v[1]/2)+g/2,y:-d*(l.x-v[0]/2)+y*(l.y-v[1]/2)+h/2}}))}function w(t,a){const{feature:r}=a,{attributes:s}=r,c=s.cameraOrientation;if(!c)throw new e("groundToImageUtils:missing-camera-orientation-parameters","CameraOrientation Parameters are required to perform advanced transformations");let u=new i(s.location);u.spatialReference.isWGS84&&4!==s.cameraOrientation?.type&&(u=o(u));const f=u.spatialReference.isWebMercator?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*u.y/6378137))):1;let p;if("esri.layers.orientedImagery.core.CameraOrientationOPK"===c.declaredClass){const{omega:e,phi:t,kappa:a}=c;p=l("OPK",[e,t,a])}else{const{cameraHeading:e,cameraPitch:t,cameraRoll:a}=s;p=l("HPR",[e,t,a])}const{principalOffsetPoint:d,focalLength:y,radialDistortionCoefficients:g,affineTransformations:h,tangentialDistortionCoefficients:v}=c;return Promise.all(t.map((e=>{let t;return e.spatialReference.equals(u.spatialReference)?(t=new i(e),a(t)):(t=n(e,u.spatialReference),t?a(t):null);function a(e){if(e.spatialReference.isWGS84)if(4===s.cameraOrientation?.type){const t=s.cameraOrientation;e=new i(m(e,[t.latitude,t.longitude,t.ellipsoidRadius,t.squaredEccentricity]))}else e=new i(o(e));const t=(e.z??0)-(u.z??0),a=(e.x-u.x)/f,r=(e.y-u.y)/f,n=(p[0]*a+p[1]*r+p[2]*t)/(p[6]*a+p[7]*r+p[8]*t),c=(p[3]*a+p[4]*r+p[5]*t)/(p[6]*a+p[7]*r+p[8]*t),l=n**2+c**2;let w=0,R=0,b=0,x=0,M=0,P=0,O=0;g&&(w=g[0]??0,R=g[1]??0,b=g[2]??0),v&&(x=v[0],M=v[1]),d&&(P=d[0]??0,O=d[1]??0);const z=1+(w||0)*l+(R||0)*l*l+(b||0)*l*l*l;let j=n*z+(x||0)*(l+2*n**2)+2*(M||0)*n*c,S=c*z+(M||0)*(l+2*c**2)+2*(x||0)*n*c;j=-(y??0)*j+P,S=-(y??0)*S+O;return{x:Number(h[0])+Number(h[1])*j+Number(h[2])*S,y:Number(h[3])+Number(h[4])*j+Number(h[5])*S}}})))}export{p as transformPoints,d as updateElevation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Logger.js";import i from"./Field.js";import
|
|
5
|
+
import has from"../../core/has.js";import e from"../../core/Logger.js";import i from"./Field.js";import r from"./FieldsIndex.js";import{fixFields as t}from"./fieldUtils.js";function s(){return{fields:{type:[i],value:null,set:function(i){if(has("big-integer-warning-enabled"))for(const r of i??[])("big-integer"===r.type||"oid"===r.type&&r.length>=8)&&e.getLogger("esri.layers.support.fieldProperties").warnOnce("field-attributes-layer:big-integer-field",`Layer references a big-integer field '${r.name}', support for which is currently experimental. Only integers less than ${Number.MAX_SAFE_INTEGER} are supported. Integers larger than this value may result in degraded performance or broken functionality. Disable this warning message by setting the esriConfig flag big-integer-warning-enabled to false.`,{layer:this,field:r});this._set("fields",i)}},fieldsIndex:{readOnly:!0,get(){return new r(this.fields??[])}},outFields:{type:[String],json:{read:!1},set:function(e){this._userOutFields=e,this.notifyChange("outFields")},get:function(){const i=this._userOutFields;if(!i||!i.length)return null;if(i.includes("*"))return["*"];if(!this.fields)return i;for(const r of i){const t=this.fieldsIndex?.has(r);t||e.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${r} found in outFields`,{layer:this,outFields:i})}return t(this.fieldsIndex,i)}}}}export{s as defineFieldProperties};
|
package/networks/Network.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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../Graphic.js";import r from"../request.js";import o from"../core/Error.js";import
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../Graphic.js";import r from"../request.js";import o from"../core/Error.js";import s from"../core/Loadable.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{isAbortError as n}from"../core/promiseUtils.js";import{urlToObject as l}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import u from"../geometry/Extent.js";import{fromJSON as c}from"../geometry/support/jsonUtils.js";import{versionMatches as m,onApplyEditsEvent as y,onUpdateMomentEvent as h,emitApplyEditsEvent as f}from"../layers/mixins/EditBusLayer.js";import{parse as g}from"../layers/support/arcgisLayerUrl.js";import v from"./support/TopologyValidationJobInfo.js";import{networkFromPortalItem as w}from"./support/utils.js";import{isVersionInEditSession as j}from"../versionManagement/support/versionManagementUtils.js";import S from"../geometry/SpatialReference.js";let U=class extends(a(s)){static fromPortalItem(e){return w(e)}constructor(e){super(e),this.id=null,this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null,this.gdbVersion=null,this.historicMoment=null,this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:o}=e,s=t===this.featureServiceUrl,i=m(t,r,this.gdbVersion);s&&i&&o.then((e=>{j(t,r)&&(this.historicMoment=e.historicMoment)}))},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:r,moment:o}=e,s=t===this.featureServiceUrl,i=m(t,r,this.gdbVersion);s&&i&&(this.historicMoment=o)},this.when().then((()=>{this.addHandles([y(this._applyEditsHandler),h(this._updateMomentHandler)])}),(()=>{}))}initialize(){this.when().catch((e=>{n(e)||i.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){return l(this.layerUrl)}get featureServiceUrl(){return g(this.parsedUrl.path).url.path}get networkServiceUrl(){return this.featureServiceUrl.replace(/\/FeatureServer/i,"/UtilityNetworkServer")}get layerId(){return g(this.parsedUrl.path).sublayer}get networkSystemLayers(){return null}async load(e){return this.addResolvingPromise(this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e)),this.addResolvingPromise(this._fetchLayerMetaData(this.layerUrl,e)),this}getLayerIdBySourceId(e){if(this.dataElement){const t=this.dataElement.domainNetworks;for(const r of t){for(const t of r.edgeSources??[])if(t.sourceId===e)return t.layerId;for(const t of r.junctionSources??[])if(t.sourceId===e)return t.layerId}return null}return null}async queryNamedTraceConfigurations(e,t){const[{queryNamedTraceConfigurations:r},{default:o}]=await Promise.all([import("../rest/networks/queryNamedTraceConfigurations.js"),import("../rest/networks/support/QueryNamedTraceConfigurationsParameters.js")]),s=this.networkServiceUrl,i=o.from(e);return(await r(s,i,{...t}))?.namedTraceConfigurations}async validateTopology(e,t){if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");const[{validateNetworkTopology:r},{default:s}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),i=s.from(e);i.gdbVersion=this.gdbVersion;const a=this.networkServiceUrl,n=this.featureServiceUrl,l=f(n,null,null,!0),d=await r(a,i,{...t});if(d?.serviceEdits){const e=[];for(const t of d.serviceEdits){const{editedFeatures:r}=t,o=r?.spatialReference?new S(r.spatialReference):null;e.push({layerId:t.layerId,editedFeatures:{adds:r?.adds?.map((e=>this._createEditedFeature(e,o)))||[],updates:r?.updates?.map((e=>({original:this._createEditedFeature(e[0],o),current:this._createEditedFeature(e[1],o)})))||[],deletes:r?.deletes?.map((e=>this._createEditedFeature(e,o)))||[],spatialReference:o}})}l.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],editedFeatures:e,exceededTransferLimit:!1,historicMoment:d.moment})}return d}async submitTopologyValidationJob(e,t){if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");if(!this.gdbVersion)throw new o("network:undefined-gdb-version","version must be defined");const[{submitValidateNetworkTopologyJob:r},{default:s}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),i=s.from(e);i.gdbVersion=this.gdbVersion;const a=this.networkServiceUrl,n=this.featureServiceUrl?f(this.featureServiceUrl,null,null,!0):void 0,l=await r(a,i,{...t});return new v({statusUrl:l,editsResolver:n})}_createEditedFeature(e,r){return new t({attributes:e.attributes,geometry:c({...e.geometry,spatialReference:r})})}async _fetchLayerMetaData(e,t){const o=await r(e,{responseType:"json",query:{f:"json"},...t});this.sourceJSON=o.data,this.read(o.data,{origin:"service"})}async _fetchDataElement(e,t,o){if(this.dataElement)return;const s=await r(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([t]),f:"json"},...o}).then((e=>e.data.layerDataElements?.[0]));s&&this.read(s,{origin:"service"})}};e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:!0}},read:!1}})],U.prototype,"id",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:{source:"name"}}},read:!1}})],U.prototype,"title",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:"url"},write:{target:"url",isRequired:!0}}},read:!1}})],U.prototype,"layerUrl",void 0),e([d({type:Object,json:{origins:{service:{read:!0}},read:!1}})],U.prototype,"dataElement",void 0),e([d({type:u,json:{origins:{service:{read:{source:"extent"}}},read:!1}})],U.prototype,"fullExtent",void 0),e([d({type:S,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:!1}})],U.prototype,"spatialReference",void 0),e([d({type:["utility","trace"],readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"type",void 0),e([d({readOnly:!0})],U.prototype,"datasetName",null),e([d({readOnly:!0})],U.prototype,"owner",null),e([d({readOnly:!0})],U.prototype,"schemaGeneration",null),e([d({readOnly:!0})],U.prototype,"parsedUrl",null),e([d({readOnly:!0})],U.prototype,"featureServiceUrl",null),e([d({readOnly:!0})],U.prototype,"networkServiceUrl",null),e([d({readOnly:!0})],U.prototype,"layerId",null),e([d()],U.prototype,"sourceJSON",void 0),e([d({readOnly:!0})],U.prototype,"networkSystemLayers",null),e([d()],U.prototype,"gdbVersion",void 0),e([d({type:Date})],U.prototype,"historicMoment",void 0),U=e([p("esri.networks.Network")],U);const b=U;export{b as default};
|
package/package.json
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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import{isSome as s}from"../../core/arrayUtils.js";import r from"../../core/Error.js";import{IdentifiableMixin as i}from"../../core/Identifiable.js";import{JSONSupportMixin as a}from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import n from"../../core/Loadable.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../geometry/SpatialReference.js";import{getFeatureJSON as c,getFeatureIds as m,getAttachmentEditsJSON as y,unpackEditResultData as f,createEditedFeatures as h}from"../../layers/graphics/applyEditsUtils.js";import{checkEditingCapabilities as S,normalizeEdits as v,normalizeGeometries as g}from"../../layers/graphics/editingSupport.js";import{emitApplyEditsEvent as R}from"../../layers/mixins/EditBusLayer.js";import{parseUrl as b,asValidOptions as E,encode as F}from"../utils.js";import{unapplyEditsZUnitScaling as j}from"../query/operations/editsZScale.js";import{readBoolean as w,readNumber as A}from"../support/jsonUtils.js";import{isVersionInEditSession as k,currentSessionId as O}from"../../versionManagement/support/versionManagementUtils.js";function C(e){return{data:V(e),sync:N(e),operations:I(e.capabilities,e),query:D(e),editing:M(e)}}function V(e){return{isDataVersioned:w(e,"hasVersionedData",!1)}}function I(e,t){const s=e?e.toLowerCase().split(",").map((e=>e.trim())):[],r=s.includes("query"),i=s.includes("editing")&&!t.datesInUnknownTimezone;let a=i&&s.includes("create"),o=i&&s.includes("delete"),n=i&&s.includes("update");return i&&!(a||o||n)&&(a=o=n=!0),{supportsAdd:a,supportsDelete:o,supportsEditing:i,supportsChangeTracking:s.includes("changetracking"),supportsQuery:r,supportsQueryDataElements:w(t,"supportsQueryDataElements",!1),supportsQueryDomains:w(t,"supportsQueryDomains",!1),supportsQueryContingentValues:w(t,"supportsQueryContingentValues",!1),supportsSync:s.includes("sync"),supportsUpdate:n}}function D(e){return{maxRecordCountFactor:A(e,"maxRecordCountFactor",void 0),maxRecordCount:A(e,"maxRecordCount",void 0)}}function M(e){const t=e?.advancedEditingCapabilities;return{supportsGlobalId:w(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:w(t,"supportsReturnServiceEditsInSourceSR",!1),supportsSplit:w(t,"supportsSplit",!1),supportsAsyncApplyEdits:w(t,"supportsAsyncApplyEdits",!1)}}function N(e){const t=e?.syncCapabilities,s=t?.supportedSyncDataOptions;return{supportsAsync:w(t,"supportsAsync",!1),supportedSyncDataOptions:{annotations:1==(1&s),dimensions:2==(2&s),contingentValues:4==(4&s),attributeRules:8==(8&s),utilityNetworkSystem:16==(16&s),annotationFullModel:32==(32&s),include3DObjects:64==(64&s),utilityNetworkMissingLayers:128==(128&s),preserveTrueCurves:256==(256&s)}}}let U=class extends(a(i(n))){constructor(e){super(e),this.sourceJSON=null,this.userTypeExtensions=[],this.layerInfos=[],this.tableInfos=[],this.capabilities=null}read(e,t){this.sourceJSON=e,super.read(e,t)}get utilityNetworkUrl(){for(const e of this.sourceJSON.layers)if("Utility Network Layer"===e.type)return`${this.url}/${e.id}`;return null}get versionManagementServiceUrl(){return this.sourceJSON.hasBranchVersionedData?this.url.replace(/\/FeatureServer/i,"/VersionManagementServer"):null}readCapabilities(e,t){return C(t)}load(e){return this.addResolvingPromise(this._fetchService(this.url,e)),Promise.resolve(this)}async applyEdits(e,t){let s=null;try{const{results:r,edits:i,editedFeatures:a}=await this._internalApplyEdits(e,t),n=e=>e.filter((e=>!e.error)).map(o);let u=0;return r.map((e=>{s=R(this.url,null,t?.gdbVersion,!0);const r={edits:i[u],addedFeatures:n(e.addFeatureResults),updatedFeatures:n(e.updateFeatureResults),deletedFeatures:n(e.deleteFeatureResults),addedAttachments:n(e.addAttachmentResults),updatedAttachments:n(e.updateAttachmentResults),deletedAttachments:n(e.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:e.editMoment?new Date(e.editMoment):null};u+=1,a.length>0&&(r.editedFeatures=a),s.resolve(r),s=null})),r}catch(r){throw s&&s.reject(r),r}}async _internalApplyEdits(e,r){const i=r?.globalIdUsed??!1,a=l.fromJSON(this.sourceJSON.spatialReference),{edits:o,options:n}=await this._processApplyEditsParams(e,r),u=await Promise.all(o.map((async e=>{const t=e.addFeatures?.map((e=>c({spatialReference:a},e,null)))??[],r=(await Promise.all(t)).filter(s),o=e.updateFeatures?.map((e=>c({spatialReference:a},e,null)))??[],n=(await Promise.all(o)).filter(s),u=m(e.identifierFields,e.deleteFeatures,i);j(r,n,a);const d=await y(e.identifierFields,e);return{id:e.id,adds:r,updates:n,deletes:u,attachments:d}}))),d={gdbVersion:n?.gdbVersion,rollbackOnFailure:!0,useGlobalIds:i,returnEditMoment:!0,honorSequenceOfEdits:n?.honorSequenceOfEdits,usePreviousEditMoment:n?.usePreviousEditMoment,returnServiceEditsInSourceSR:n?.returnServiceEditsInSourceSR,returnServiceEditOption:"originalAndCurrentFeatures",async:!1},p=await k(this.url,r?.gdbVersion||null);p&&(d.sessionId=O),d.edits=JSON.stringify(u);const f=b(this.url),h=E(f.query,{query:F({...d,f:"json"}),method:"post"});p&&(h.authMode="immediate");const S=await t(this.url+"/applyEdits",h);return{...this._createServiceEditsResult(S),edits:o}}_createServiceEditsResult(e){const t=e.data,s=[];return{results:t.map((e=>{const t={addResults:e.addResults??[],updateResults:e.updateResults??[],deleteResults:e.deleteResults??[],attachments:e.attachments,editMoment:e.editMoment},r=f(t),i=e.editedFeatures,a=i?.spatialReference?new l({wkid:i?.spatialReference.wkid,wkt:i?.spatialReference.wkt,latestWkid:i?.spatialReference.latestWkid,latestVcsWkid:i?.spatialReference.latestVcsWkid,vcsWkid:i?.spatialReference.vcsWkid}):null,o=h(i,a);return s.push({layerId:e.id,editedFeatures:o}),{id:e.id,editedFeatures:o,...r}})),editedFeatures:s}}async _processApplyEditsParams(e,t){const s={...t};return{edits:await Promise.all(e.map((async e=>{const s=this.capabilities,i=e&&(e.addFeatures||e.updateFeatures||e.deleteFeatures),a=e&&(e.addAttachments||e.updateAttachments||e.deleteAttachments);if(S(e,s,t,!!i,!!a,"feature-service"),!s.data.isDataVersioned&&t?.gdbVersion)throw new r("feature-service:invalid-parameter","'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");const o=v(e,s,"feature-service");return{...await g(o),id:e.id,identifierFields:e.identifierFields}}))),options:s}}async _fetchService(e,s){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:b(e)});const r=await t(e,{responseType:"json",query:{f:"json"},...s});this.read(r.data)}};e([u()],U.prototype,"url",void 0),e([u()],U.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],U.prototype,"utilityNetworkUrl",null),e([u({readOnly:!0})],U.prototype,"versionManagementServiceUrl",null),e([u()],U.prototype,"userTypeExtensions",void 0),e([u({json:{read:{source:"layers"}}})],U.prototype,"layerInfos",void 0),e([u({json:{read:{source:"tables"}}})],U.prototype,"tableInfos",void 0),e([u({readOnly:!0,json:{read:{source:["hasVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"]}}})],U.prototype,"capabilities",void 0),e([d("service","capabilities")],U.prototype,"readCapabilities",null),U=e([p("esri.services.FeatureService")],U);const x=U;export{x as default};
|
package/support/arcadeUtils.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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../geometry.js";import{p as e,c as
|
|
5
|
+
import"../geometry.js";import{p as e,c as n,e as r,a as t,r as o,l as s,b as i,d as a,f as u,s as l,g as c}from"../chunks/arcade.js";export{h as arcade}from"../chunks/arcade.js";import f from"../arcade/Dictionary.js";import p from"../arcade/Feature.js";import{o as m,q as y,k as d,c as v,a as g,b as x,r as j,u as w,s as b}from"../chunks/languageUtils.js";import{clone as E}from"../core/lang.js";import{DateOnly as S}from"../core/sql/DateOnly.js";import{TimeOnly as F}from"../core/sql/TimeOnly.js";import $ from"../geometry/Point.js";import R from"../geometry/Polygon.js";import C from"../geometry/Polyline.js";import k from"../geometry/Multipoint.js";import z from"../geometry/Extent.js";const M=/^\$(feature|aggregatedFeatures)\./i,P={vars:{$feature:"any",$view:"any"},spatialReference:null};function A(e){return e.replaceAll(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function I(e){return null==e?null:m(e)||y(e)?"array":d(e)?"date":v(e)?"text":g(e)?"boolean":x(e)?"number":e instanceof f?"dictionary":j(e)?"feature":e instanceof $?"point":e instanceof R?"polygon":e instanceof C?"polyline":e instanceof k?"multipoint":e instanceof z?"extent":e instanceof S?"dateOnly":e instanceof F?"time":w(e)?"featureSet":b(e)?"featureSetCollection":null}function q(n){if(!n)return null;try{return e(n)}catch(r){}return null}function O(e,r){const t="string"==typeof e?q(e):e;if(!t)return null;try{return r=r||E(P),n(t,r)}catch(o){}return null}function G(e,n){return{vars:{$feature:null==e?new p:p.createFromGraphic(e,null),$view:n&&n.view},spatialReference:n&&n.sr}}function T(e,n,r){return p.createFromGraphicLikeObject(n,e,r,null)}function V(e,n){null!=e.vars&&(e.vars.$feature=n)}function D(e,n){let t;try{t=r(e,n)}catch(o){t=null}return t}function L(e,n){let r;try{r=e?e(n):null}catch(t){r=null}return r}function J(e,n){try{return e?e(n):Promise.resolve(null)}catch(r){return Promise.resolve(null)}}function U(e,n){if(!e)return[];const r="string"==typeof e?q(e):e;if(!r)return[];const o=t(r);let s=new Array;o.forEach((e=>{M.test(e)&&(e=e.replace(M,""),s.push(e))}));const i=s.filter((e=>e.includes("*")));return s=s.filter((e=>!i.includes(e))),n&&i.forEach((e=>{const r=new RegExp(`^${e.split(/\*+/).map(A).join(".*")}$`,"i");n.forEach((e=>r.test(e)?s.push(e):null))})),[...new Set(s.sort())]}function B(e){return o(e,"$view")}function H(e,n){return!!e&&o(e,n)}function K(e){if(!e||null==e.spatialReference&&(null==e.scale||null==e.viewingMode))return;return{view:e.viewingMode&&null!=e.scale?new f({viewingMode:e.viewingMode,scale:e.scale}):null,sr:e.spatialReference}}function N({url:e,spatialReference:n,lrucache:r,interceptor:t}){const o=u();return o?o.createFeatureSetCollectionFromService(e,n,r,t):null}function Q({layer:e,spatialReference:n,outFields:r,returnGeometry:t,lrucache:o,interceptor:s}){if(null===e)return null;const i=u();return i?i.constructFeatureSet(e,n,r,t??!0,o,s):null}function W(e){if(null===e?.map)return null;const n=u();return n?n.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function X(e,n){return f.convertJsonToArcade(e,n)}function Y(e,n,r=[]){return s(e,n,r)}function Z(){return i()}function _(){return a()}function ee(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type||"dot-density"===e.type||"dictionary"===e.type||"pie-chart"===e.type}function ne(e){return"esri.layers.support.LabelClass"===e.declaredClass}function re(e){return"esri.PopupTemplate"===e.declaredClass}function te(e,n){if(!e)return!1;if("string"==typeof e)return n(e);const r=e;if(ee(r)){if("dot-density"===r.type){const e=r.attributes?.some((e=>n(e.valueExpression)));if(e)return e}const e=r.visualVariables,t=!!e&&e.some((e=>{let r=n(e.valueExpression);return"size"===e.type&&(ue(e.minSize)&&(r=r||n(e.minSize.valueExpression)),ue(e.maxSize)&&(r=r||n(e.maxSize.valueExpression))),r}));return!(!("valueExpression"in r)||!n(r.valueExpression))||t}if(ne(r)){const e=r.labelExpressionInfo&&r.labelExpressionInfo.expression;return!(!e||!n(e))||!1}return!!re(r)&&(!!r.expressionInfos&&r.expressionInfos.some((e=>n(e.expression)))||Array.isArray(r.content)&&r.content.some((e=>"expression"===e.type&&n(e.expressionInfo?.expression))))}function oe(e){const n=q(e);return!!n&&l(n)}function se(e){return te(e,oe)}function ie(e){const n=q(e);return!!n&&c(n)}function ae(e){return te(e,ie)}function ue(e){return e&&"esri.renderers.visualVariables.SizeVariable"===e.declaredClass}export{f as Dictionary,p as arcadeFeature,Q as convertFeatureLayerToFeatureSet,X as convertJsonToArcade,W as convertMapToFeatureSetCollection,N as convertServiceUrlToWorkspace,G as createExecContext,T as createFeature,O as createFunction,q as createSyntaxTree,B as dependsOnView,_ as enableFeatureSetOperations,Z as enableGeometryOperations,D as evalSyntaxTree,J as executeAsyncFunction,L as executeFunction,U as extractFieldNames,I as getArcadeType,K as getViewInfo,se as hasGeometryFunctions,ae as hasGeometryOperations,H as hasVariable,Y as loadScriptDependencies,V as updateExecContext};
|
package/support/revision.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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20230922",f="fab7665fcc82231d9f046834fbae3eea24b1577d";export{e as buildDate,f as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{c as i}from"../../chunks/mat2df32.js";import{m as n,t as r,c as o,s,r as a}from"../../chunks/mat2d.js";import"../../widgets/support/widgetUtils.js";import{tsx as l}from"../../widgets/support/jsxFactory.js";const h="http://www.w3.org/2000/svg";let f=0,c=0;const d=has("android"),u=has("chrome")||d&&d>=4?"auto":"optimizeLegibility",y={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},p=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let g={},m={};const x={solid:"none",shortdash:[4,1],shortdot:[1,1],shortdashdot:[4,1,1,1],shortdashdotdot:[4,1,1,1,1,1],dot:[1,3],dash:[4,3],longdash:[8,3],dashdot:[4,3,1,3],longdashdot:[8,3,1,3],longdashdotdot:[8,3,1,3,1,3]},w=Math.PI;let k=1;function b(t,e){const i=t*(w/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map((t=>`${t.command} ${t.values.join(" ")}`)).join(" ").trim()}function v(t,i,n,r){if(t){if("circle"===t.type)return l("circle",{fill:i,"fill-rule":"evenodd",stroke:n.color,"stroke-width":n.width,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-dasharray":n.dashArray,"stroke-dashoffset":n.dashOffset,"stroke-miterlimit":"4",cx:t.cx,cy:t.cy,r:t.r});if("ellipse"===t.type)return l("ellipse",{fill:i,"fill-rule":"evenodd",stroke:n.color,"stroke-width":n.width,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-dasharray":n.dashArray,"stroke-miterlimit":"4",cx:t.cx,cy:t.cy,rx:t.rx,ry:t.ry});if("rect"===t.type)return l("rect",{fill:i,"fill-rule":"evenodd",stroke:n.color,"stroke-width":n.width,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-dasharray":n.dashArray,"stroke-miterlimit":"4",x:t.x,y:t.y,width:t.width,height:t.height});if("image"===t.type)return l("image",{href:t.src,x:t.x,y:t.y,width:t.width,height:t.height,preserveAspectRatio:"none"});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return l("path",{fill:i,"fill-rule":"evenodd",stroke:n.color,"stroke-width":n.width,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-dasharray":n.dashArray,"stroke-miterlimit":"4",d:e})}if("text"===t.type)return e(r),l("text",{"dominant-baseline":r.dominantBaseline,fill:i,"fill-rule":"evenodd",stroke:n.color,"stroke-width":n.width,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-dasharray":n.dashArray,"stroke-miterlimit":"4","text-anchor":r.align,"text-decoration":r.decoration,kerning:r.kerning,rotate:r.rotate,"text-rendering":u,"font-style":r.font.style,"font-variant":r.font.variant,"font-weight":r.font.weight,"font-size":r.font.size,"font-family":r.font.family,x:t.x,y:t.y},t.text)}return null}function M(e){const i={fill:"none",pattern:null,linearGradient:null};if(e)if("type"in e&&"pattern"===e.type){const t="patternId-"+ ++f;i.fill=`url(#${t})`,i.pattern={id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}}}else if("type"in e&&"linear"===e.type){const n="linearGradientId-"+ ++c;i.fill=`url(#${n})`,i.linearGradient={id:n,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map((e=>({offset:e.offset,color:e.color&&new t(e.color).toString()})))}}else if(e){const n=new t(e);i.fill=n.toString()}return i}function A(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};if(e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashArray&&(i.dashOffset=e.dashoffset),e.style)){let t=null;if(e.style in x&&(t=x[e.style]),Array.isArray(t)){t=t.slice(0);const i=e.width??0;for(let e=0;e<t.length;++e)t[e]*=i;if("butt"!==e.cap){for(let e=0;e<t.length;e+=2)t[e]-=i,t[e]<1&&(t[e]=1);for(let e=1;e<t.length;e+=2)t[e]+=i}t=t.join(",")}i.dashArray=t}return i}function S(t,i){const n={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const r=t.alignBaseline,o="baseline"===r?"auto":"top"===r?"text-top":"bottom"===r?"hanging":r;n.align=t.align,n.dominantBaseline=o,n.decoration=t.decoration,n.kerning=t.kerning?"auto":"0",n.rotate=t.rotated?"90":"0",e(i),n.font.style=i.style||"normal",n.font.variant=i.variant||"normal",n.font.weight=i.weight||"normal",n.font.size=i.size&&i.size.toString()||"10pt",n.font.family=i.family||"serif"}return n}function $(t){const{pattern:e,linearGradient:i}=t;if(e)return l("pattern",{id:e.id,patternUnits:"userSpaceOnUse",x:e.x,y:e.y,width:e.width,height:e.height},l("image",{x:e.image.x,y:e.image.y,width:e.image.width,height:e.image.height,href:e.image.href}));if(i){const t=i.stops.map(((t,e)=>l("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color})));return l("linearGradient",{id:i.id,gradientUnits:"userSpaceOnUse",x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},t)}return null}function N(t,e){if(!t||0===t.length)return null;const i=[];for(const n of t){const{shape:t,fill:e,stroke:r,font:o}=n,s=M(e),a=A(r),l="text"===t.type?S(t,o):null,h=v(t,s.fill,a,l);h&&i.push(h)}return l("mask",{id:e,maskUnits:"userSpaceOnUse"},l("g",null,i))}function G(t,e,i){return r(t,o(t),[e,i])}function I(t,e,i,n,r){return s(t,o(t),[e,i]),t[4]=t[4]*e-n*e+n,t[5]=t[5]*i-r*i+r,t}function z(t,e,i,n){const r=e%360*Math.PI/180;a(t,o(t),r);const s=Math.cos(r),l=Math.sin(r),h=t[4],f=t[5];return t[4]=h*s-f*l+n*l-i*s+i,t[5]=f*s+h*l-i*l-n*s+n,t}function B(t,e){g&&"left"in g?(null!=g.left&&g.left>t&&(g.left=t),(null==g.right||g.right<t)&&(g.right=t),(null==g.top||g.top>e)&&(g.top=e),(null==g.bottom||g.bottom<e)&&(g.bottom=e)):g={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let n;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(n=0;n<i;n+=2)B(e[n],e[n+1]);m.x=e[i-2],m.y=e[i-1];break;case"H":for(n=0;n<i;++n)B(e[n],m.y);m.x=e[i-1];break;case"V":for(n=0;n<i;++n)B(m.x,e[n]);m.y=e[i-1];break;case"m":{let t=0;"x"in m||(B(m.x=e[0],m.y=e[1]),t=2);for(n=t;n<i;n+=2)B(m.x+=e[n],m.y+=e[n+1]);break}case"l":case"t":for(n=0;n<i;n+=2)B(m.x+=e[n],m.y+=e[n+1]);break;case"h":for(n=0;n<i;++n)B(m.x+=e[n],m.y);break;case"v":for(n=0;n<i;++n)B(m.x,m.y+=e[n]);break;case"c":for(n=0;n<i;n+=6)B(m.x+e[n],m.y+e[n+1]),B(m.x+e[n+2],m.y+e[n+3]),B(m.x+=e[n+4],m.y+=e[n+5]);break;case"s":case"q":for(n=0;n<i;n+=4)B(m.x+e[n],m.y+e[n+1]),B(m.x+=e[n+2],m.y+=e[n+3]);break;case"A":for(n=0;n<i;n+=7)B(e[n+5],e[n+6]);m.x=e[i-2],m.y=e[i-1];break;case"a":for(n=0;n<i;n+=7)B(m.x+=e[n+5],m.y+=e[n+6])}}function F(t,e,i){const n=y[t.toLowerCase()];let r;"number"==typeof n&&(n?e.length>=n&&(r={action:t,args:e.slice(0,e.length-e.length%n)},i.push(r),U(r)):(r={action:t,args:[]},i.push(r),U(r)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(p),i=[];if(g={},m={},!e)return null;let n="",r=[];const o=e.length;for(let a=0;a<o;++a){const t=e[a],o=parseFloat(t);isNaN(o)?(n&&F(n,r,i),r=[],n=t):r.push(o)}F(n,r,i);const s={x:0,y:0,width:0,height:0};return g&&"left"in g&&(s.x=g.left,s.y=g.top,s.width=g.right-g.left,s.height=g.bottom-g.top),s}function T(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function E(t){const e={x:0,y:0,width:0,height:0};let i=null,n=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),n=Math.max(n,o.x+o.width),r=Math.max(r,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,n=o.x+o.width,r=o.y+o.height);return i&&(i.width=n-i.x,i.height=r-i.y),i}function V(t,e,r,o,s,a,l,h,f){let c=(l&&a?b(a,e):e)/2,d=(l&&a?b(a,r):r)/2;if(f){const t=f[0],e=f[1];c=(l&&a?b(a,t):t)/2,d=(l&&a?b(a,e):e)/2}const u=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(s&&0!==u&&0!==y){const t=e!==r?e/r:u/y,i=e>r?e:r;let o=1,s=1;isNaN(i)||(t>1?(o=i/u,s=i/t/y):(s=i/y,o=i*t/u)),n(g,g,I(p,o,s,c,d)),m=!0}const x=t.x+(u-o)/2,w=t.y+(y-o)/2;if(n(g,g,G(p,c-x,d-w)),!m&&(u>e||y>r)){const t=u/e>y/r,i=(t?e:r)/(t?u:y);n(g,g,I(p,i,i,x,w))}return a&&n(g,g,z(p,a,x,w)),h&&n(g,g,G(p,h[0],h[1])),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function C(t,e,i){const n=t?.effects.find((t=>"bloom"===t.type));if(!n)return null;const{strength:r,radius:o}=n,s=r>0?o:0,a=(r+s)*e,h=4*r+1;return l("filter",{id:`bloom${i}`,x:"-100%",y:"-100%",width:"300%",height:"300%",filterUnits:"userSpaceOnUse"},l("feMorphology",{operator:"dilate",radius:(r+.5*s)*(5**(e/100)*(.4+e/100)),in:"SourceGraphic",result:"dilate"}),l("feGaussianBlur",{in:"dilate",stdDeviation:a/25,result:"blur"}),l("feGaussianBlur",{in:"blur",stdDeviation:a/50,result:"intensityBlur"}),l("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},l("feFuncR",{type:"linear",slope:h}),l("feFuncG",{type:"linear",slope:h}),l("feFuncB",{type:"linear",slope:h})),l("feMerge",null,l("feMergeNode",{in:"intensityBlur"}),l("feMergeNode",{in:"intensityBrightness"}),l("feGaussianBlur",{stdDeviation:r/10})))}function D(t,i,n,r={}){const o=[],s=[],a=++k,f=C(r.effectView,i,a);let c=null;if(f){const t=r.effectView?.effects.find((t=>"bloom"===t.type)),e=(t.strength?t.strength+t.radius/2:0)/3,o=i+i*e,s=n+n*e;c=[Math.max(o,10),Math.max(s,10)]}for(let e=0;e<t.length;e++){const a=t[e],h=[],f=[];let d=0,u=0,y=0;for(const t of a){const{shape:e,fill:i,stroke:n,font:s,offset:a}=t;r.ignoreStrokeWidth||"text"===e.type||(d+=n&&n.width||0);const l=M(i),c=A(n),p="text"===e.type?S(e,s):null;o.push($(l)),h.push(v(e,l.fill,c,p)),f.push(T(e)),a&&(u+=a[0],y+=a[1])}const p=V(E(f),i,n,d,r.scale??!1,r.rotation,r.useRotationSize??!1,[u,y],c);let g=null;if(r.masking){const t=`mask-${e}`,i=r.masking[e];o.push(N(i,t)),g=`url(#${t})`}s.push(g?l("g",{mask:g},l("g",{transform:p},h)):l("g",{transform:p},h))}r.useRotationSize&&r.rotation&&(i=b(r.rotation,i),n=b(r.rotation,n)),f&&(e(c),i=c[0],n=c[1]);return l("svg",{xmlns:h,width:i,height:n,style:"display: block;","aria-labelledby":r.ariaLabel,role:"img",focusable:!1},f,l("defs",null,o),f?l("g",{filter:`url(#bloom${a})`},s):s)}export{E as computeBBox,M as generateFillAttributes,A as generateStrokeAttributes,S as generateTextAttributes,T as getBoundingBox,V as getTransformMatrix,$ as renderDef,D as renderSVG,v as renderShape};
|
|
5
|
+
import t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{c as i}from"../../chunks/mat2df32.js";import{m as n,t as r,c as o,s,r as a}from"../../chunks/mat2d.js";import"../../widgets/support/widgetUtils.js";import{tsx as l}from"../../widgets/support/jsxFactory.js";const h="http://www.w3.org/2000/svg";let f=0,c=0;const d=has("android"),u=has("chrome")||d&&d>=4?"auto":"optimizeLegibility",y={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},p=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let g={},m={};const x={solid:"none",shortdash:[4,1],shortdot:[1,1],shortdashdot:[4,1,1,1],shortdashdotdot:[4,1,1,1,1,1],dot:[1,3],dash:[4,3],longdash:[8,3],dashdot:[4,3,1,3],longdashdot:[8,3,1,3],longdashdotdot:[8,3,1,3,1,3]},w=Math.PI;let k=1;function b(t,e){const i=t*(w/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map((t=>`${t.command} ${t.values.join(" ")}`)).join(" ").trim()}function v(t,i,n,r){if(t){if("circle"===t.type)return l("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:n.color,"stroke-dasharray":n.dashArray,"stroke-dashoffset":n.dashOffset,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-miterlimit":"4","stroke-width":n.width});if("ellipse"===t.type)return l("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:n.color,"stroke-dasharray":n.dashArray,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-miterlimit":"4","stroke-width":n.width});if("rect"===t.type)return l("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:n.color,"stroke-dasharray":n.dashArray,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-miterlimit":"4","stroke-width":n.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return l("image",{height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return l("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:n.color,"stroke-dasharray":n.dashArray,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-miterlimit":"4","stroke-width":n.width})}if("text"===t.type)return e(r),l("text",{"dominant-baseline":r.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":r.font.family,"font-size":r.font.size,"font-style":r.font.style,"font-variant":r.font.variant,"font-weight":r.font.weight,kerning:r.kerning,rotate:r.rotate,stroke:n.color,"stroke-dasharray":n.dashArray,"stroke-linecap":n.cap,"stroke-linejoin":n.join,"stroke-miterlimit":"4","stroke-width":n.width,"text-anchor":r.align,"text-decoration":r.decoration,"text-rendering":u,x:t.x,y:t.y},t.text)}return null}function M(e){const i={fill:"none",pattern:null,linearGradient:null};if(e)if("type"in e&&"pattern"===e.type){const t="patternId-"+ ++f;i.fill=`url(#${t})`,i.pattern={id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}}}else if("type"in e&&"linear"===e.type){const n="linearGradientId-"+ ++c;i.fill=`url(#${n})`,i.linearGradient={id:n,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map((e=>({offset:e.offset,color:e.color&&new t(e.color).toString()})))}}else if(e){const n=new t(e);i.fill=n.toString()}return i}function A(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};if(e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashArray&&(i.dashOffset=e.dashoffset),e.style)){let t=null;if(e.style in x&&(t=x[e.style]),Array.isArray(t)){t=t.slice(0);const i=e.width??0;for(let e=0;e<t.length;++e)t[e]*=i;if("butt"!==e.cap){for(let e=0;e<t.length;e+=2)t[e]-=i,t[e]<1&&(t[e]=1);for(let e=1;e<t.length;e+=2)t[e]+=i}t=t.join(",")}i.dashArray=t}return i}function S(t,i){const n={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const r=t.alignBaseline,o="baseline"===r?"auto":"top"===r?"text-top":"bottom"===r?"hanging":r;n.align=t.align,n.dominantBaseline=o,n.decoration=t.decoration,n.kerning=t.kerning?"auto":"0",n.rotate=t.rotated?"90":"0",e(i),n.font.style=i.style||"normal",n.font.variant=i.variant||"normal",n.font.weight=i.weight||"normal",n.font.size=i.size&&i.size.toString()||"10pt",n.font.family=i.family||"serif"}return n}function $(t){const{pattern:e,linearGradient:i}=t;if(e)return l("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},l("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map(((t,e)=>l("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color})));return l("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function N(t,e){if(!t||0===t.length)return null;const i=[];for(const n of t){const{shape:t,fill:e,stroke:r,font:o}=n,s=M(e),a=A(r),l="text"===t.type?S(t,o):null,h=v(t,s.fill,a,l);h&&i.push(h)}return l("mask",{id:e,maskUnits:"userSpaceOnUse"},l("g",null,i))}function G(t,e,i){return r(t,o(t),[e,i])}function I(t,e,i,n,r){return s(t,o(t),[e,i]),t[4]=t[4]*e-n*e+n,t[5]=t[5]*i-r*i+r,t}function z(t,e,i,n){const r=e%360*Math.PI/180;a(t,o(t),r);const s=Math.cos(r),l=Math.sin(r),h=t[4],f=t[5];return t[4]=h*s-f*l+n*l-i*s+i,t[5]=f*s+h*l-i*l-n*s+n,t}function B(t,e){g&&"left"in g?(null!=g.left&&g.left>t&&(g.left=t),(null==g.right||g.right<t)&&(g.right=t),(null==g.top||g.top>e)&&(g.top=e),(null==g.bottom||g.bottom<e)&&(g.bottom=e)):g={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let n;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(n=0;n<i;n+=2)B(e[n],e[n+1]);m.x=e[i-2],m.y=e[i-1];break;case"H":for(n=0;n<i;++n)B(e[n],m.y);m.x=e[i-1];break;case"V":for(n=0;n<i;++n)B(m.x,e[n]);m.y=e[i-1];break;case"m":{let t=0;"x"in m||(B(m.x=e[0],m.y=e[1]),t=2);for(n=t;n<i;n+=2)B(m.x+=e[n],m.y+=e[n+1]);break}case"l":case"t":for(n=0;n<i;n+=2)B(m.x+=e[n],m.y+=e[n+1]);break;case"h":for(n=0;n<i;++n)B(m.x+=e[n],m.y);break;case"v":for(n=0;n<i;++n)B(m.x,m.y+=e[n]);break;case"c":for(n=0;n<i;n+=6)B(m.x+e[n],m.y+e[n+1]),B(m.x+e[n+2],m.y+e[n+3]),B(m.x+=e[n+4],m.y+=e[n+5]);break;case"s":case"q":for(n=0;n<i;n+=4)B(m.x+e[n],m.y+e[n+1]),B(m.x+=e[n+2],m.y+=e[n+3]);break;case"A":for(n=0;n<i;n+=7)B(e[n+5],e[n+6]);m.x=e[i-2],m.y=e[i-1];break;case"a":for(n=0;n<i;n+=7)B(m.x+=e[n+5],m.y+=e[n+6])}}function F(t,e,i){const n=y[t.toLowerCase()];let r;"number"==typeof n&&(n?e.length>=n&&(r={action:t,args:e.slice(0,e.length-e.length%n)},i.push(r),U(r)):(r={action:t,args:[]},i.push(r),U(r)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(p),i=[];if(g={},m={},!e)return null;let n="",r=[];const o=e.length;for(let a=0;a<o;++a){const t=e[a],o=parseFloat(t);isNaN(o)?(n&&F(n,r,i),r=[],n=t):r.push(o)}F(n,r,i);const s={x:0,y:0,width:0,height:0};return g&&"left"in g&&(s.x=g.left,s.y=g.top,s.width=g.right-g.left,s.height=g.bottom-g.top),s}function T(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function E(t){const e={x:0,y:0,width:0,height:0};let i=null,n=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),n=Math.max(n,o.x+o.width),r=Math.max(r,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,n=o.x+o.width,r=o.y+o.height);return i&&(i.width=n-i.x,i.height=r-i.y),i}function V(t,e,r,o,s,a,l,h,f){let c=(l&&a?b(a,e):e)/2,d=(l&&a?b(a,r):r)/2;if(f){const t=f[0],e=f[1];c=(l&&a?b(a,t):t)/2,d=(l&&a?b(a,e):e)/2}const u=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(s&&0!==u&&0!==y){const t=e!==r?e/r:u/y,i=e>r?e:r;let o=1,s=1;isNaN(i)||(t>1?(o=i/u,s=i/t/y):(s=i/y,o=i*t/u)),n(g,g,I(p,o,s,c,d)),m=!0}const x=t.x+(u-o)/2,w=t.y+(y-o)/2;if(n(g,g,G(p,c-x,d-w)),!m&&(u>e||y>r)){const t=u/e>y/r,i=(t?e:r)/(t?u:y);n(g,g,I(p,i,i,x,w))}return a&&n(g,g,z(p,a,x,w)),h&&n(g,g,G(p,h[0],h[1])),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function C(t,e,i){const n=t?.effects.find((t=>"bloom"===t.type));if(!n)return null;const{strength:r,radius:o}=n,s=r>0?o:0,a=(r+s)*e,h=4*r+1;return l("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},l("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(r+.5*s)*(5**(e/100)*(.4+e/100)),result:"dilate"}),l("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:a/25}),l("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:a/50}),l("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},l("feFuncR",{slope:h,type:"linear"}),l("feFuncG",{slope:h,type:"linear"}),l("feFuncB",{slope:h,type:"linear"})),l("feMerge",null,l("feMergeNode",{in:"intensityBlur"}),l("feMergeNode",{in:"intensityBrightness"}),l("feGaussianBlur",{stdDeviation:r/10})))}function D(t,i,n,r={}){const o=[],s=[],a=++k,f=C(r.effectView,i,a);let c=null;if(f){const t=r.effectView?.effects.find((t=>"bloom"===t.type)),e=(t.strength?t.strength+t.radius/2:0)/3,o=i+i*e,s=n+n*e;c=[Math.max(o,10),Math.max(s,10)]}for(let e=0;e<t.length;e++){const a=t[e],h=[],f=[];let d=0,u=0,y=0;for(const t of a){const{shape:e,fill:i,stroke:n,font:s,offset:a}=t;r.ignoreStrokeWidth||"text"===e.type||(d+=n&&n.width||0);const l=M(i),c=A(n),p="text"===e.type?S(e,s):null;o.push($(l)),h.push(v(e,l.fill,c,p)),f.push(T(e)),a&&(u+=a[0],y+=a[1])}const p=V(E(f),i,n,d,r.scale??!1,r.rotation,r.useRotationSize??!1,[u,y],c);let g=null;if(r.masking){const t=`mask-${e}`,i=r.masking[e];o.push(N(i,t)),g=`url(#${t})`}s.push(g?l("g",{mask:g},l("g",{transform:p},h)):l("g",{transform:p},h))}r.useRotationSize&&r.rotation&&(i=b(r.rotation,i),n=b(r.rotation,n)),f&&(e(c),i=c[0],n=c[1]);const d="display: block;";return l("svg",{"aria-labelledby":r.ariaLabel,focusable:!1,height:n,role:"img",style:d,width:i,xmlns:h},f,l("defs",null,o),f?l("g",{filter:`url(#bloom${a})`},s):s)}export{E as computeBBox,M as generateFillAttributes,A as generateStrokeAttributes,S as generateTextAttributes,T as getBoundingBox,V as getTransformMatrix,$ as renderDef,D as renderSVG,v as renderShape};
|