@arcgis/core 4.34.0-next.67 → 4.34.0-next.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/applications/Components/analysisUtils.d.ts +1 -0
  2. package/applications/Components/analysisUtils.js +1 -1
  3. package/applications/MapViewer/mediaUtils.d.ts +1 -0
  4. package/applications/MapViewer/mediaUtils.js +1 -1
  5. package/arcade/Feature.js +1 -1
  6. package/arcade/functions/measures.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/097a5c333de28ec5e16f.js +1 -0
  9. package/assets/esri/core/workers/chunks/2f44848916051f5501eb.js +1 -0
  10. package/assets/esri/core/workers/chunks/{2cd27b06226e30aec5da.js → 3cef77453623bbb37ad2.js} +1 -1
  11. package/assets/esri/core/workers/chunks/3d2629357242492afcfa.js +1 -0
  12. package/assets/esri/core/workers/chunks/49486c2e12e768b347ed.js +1 -0
  13. package/assets/esri/core/workers/chunks/{cad03967e132a28512c2.js → 4aa98309081e6889ccbb.js} +1 -1
  14. package/assets/esri/core/workers/chunks/570b17a1a4ab405bbdcb.js +1 -0
  15. package/assets/esri/core/workers/chunks/5a6b487b70ca85a45f57.js +1 -0
  16. package/assets/esri/core/workers/chunks/5a95688651d7e8b7101d.js +1 -0
  17. package/assets/esri/core/workers/chunks/6433116597021a9af680.js +1 -0
  18. package/assets/esri/core/workers/chunks/{5d8c64693830506c8776.js → 643acb12ec6a1d4b4fbb.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{90491262b6d6a126c32f.js → 7944c18b270c85ff2e41.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{35df19d1eab3a694c3fa.js → 978fab0f0b10edde4ff8.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{27027493a8dba8305693.js → a07321a901d6847d1a6b.js} +1 -1
  22. package/assets/esri/core/workers/chunks/a6f66492651646c18f10.js +1 -0
  23. package/assets/esri/core/workers/chunks/{a44f17397d8589433dae.js → b683b0fa7fc430b4d9c5.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{2f7e192ee2066f863e1d.js → c908184d747d33366881.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{997a2a1a51039ce7e4e3.js → dd84f630466a26722d57.js} +1 -1
  26. package/assets/esri/core/workers/chunks/e2486bf5546443408c85.js +1 -0
  27. package/assets/esri/core/workers/chunks/{96102a9296afd1bfe1a9.js → e956d437c0c2ea81db93.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{d6f5297f7b323c340727.js → f060a52a9b69eb250d63.js} +1 -1
  29. package/assets/esri/core/workers/chunks/f1865b28f0f75cadd716.js +1 -0
  30. package/assets/esri/core/workers/chunks/{06ff5f34ad9bdf9705de.js → f47a0b9e500af2b9453b.js} +8 -2
  31. package/assets/esri/core/workers/chunks/f8adac87e48ea86bec21.js +1 -0
  32. package/assets/esri/core/workers/chunks/fe475b1ecdefecfcd541.js +1 -0
  33. package/assets/esri/themes/base/widgets/_Expand.scss +1 -1
  34. package/assets/esri/themes/dark/main.css +1 -1
  35. package/assets/esri/themes/light/main.css +1 -1
  36. package/assets/esri/themes/light/view.css +1 -1
  37. package/chunks/ComponentShader.glsl.js +42 -36
  38. package/chunks/LineSeries.js +1 -1
  39. package/config.js +1 -1
  40. package/core/MemCache.js +1 -1
  41. package/core/MemCachePool.js +1 -1
  42. package/editing/geometry/lineUtils.js +1 -1
  43. package/geometry/ellipsoidUtils.js +1 -1
  44. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  45. package/geometry/support/curves/circleUtils.js +1 -1
  46. package/geometry/support/curves/curveLength.js +1 -1
  47. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  48. package/interfaces.d.ts +72 -527
  49. package/kernel.js +1 -1
  50. package/layers/support/ElevationTileData.js +1 -1
  51. package/layers/support/gaussianSplatUtils.js +1 -1
  52. package/package.json +1 -1
  53. package/support/elevationInfoUtils.js +1 -1
  54. package/support/revision.js +1 -1
  55. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  56. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  57. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  58. package/views/2d/interactive/editingTools/MediaTransformToolsWrapper.js +5 -0
  59. package/views/3d/analysis/ElevationProfile/ElevationProfileSceneLineComputation.js +1 -1
  60. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +5 -0
  61. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  62. package/views/3d/glTF/loader.js +1 -1
  63. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  64. package/views/3d/interactive/editingTools/isSupportedObjectUtils.js +1 -1
  65. package/views/3d/interactive/editingTools/move/isSupportedObject.js +1 -1
  66. package/views/3d/interactive/editingTools/reshape/isSupportedObject.js +1 -1
  67. package/views/3d/interactive/editingTools/transform/isSupportedGraphic.js +1 -1
  68. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  69. package/views/3d/layers/I3SMeshView3D.js +1 -1
  70. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  71. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  72. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  73. package/views/3d/layers/graphics/ElevationContext.js +1 -1
  74. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  75. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  76. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  77. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  78. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  79. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  80. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  81. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  82. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  83. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  84. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  85. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  86. package/views/3d/layers/graphics/Graphics3DPointSymbol.js +1 -1
  87. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  88. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  89. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  90. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  91. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  92. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  93. package/views/3d/layers/graphics/Labeler.js +1 -1
  94. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  95. package/views/3d/layers/graphics/QueryEngineCache.js +1 -1
  96. package/views/3d/layers/graphics/elevationAlignPointsInFeatures.js +1 -1
  97. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  98. package/views/3d/layers/i3s/CachedMeshData.js +1 -1
  99. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  100. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  101. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  102. package/views/3d/layers/i3s/PointCloudRendererNode.js +1 -1
  103. package/views/3d/layers/support/FeatureTile.js +1 -1
  104. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  105. package/views/3d/support/CombinedElevationProvider.js +1 -1
  106. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  107. package/views/3d/terrain/MapDataCacheItem.js +5 -0
  108. package/views/3d/terrain/OverlayManager.js +1 -1
  109. package/views/3d/terrain/OverlayRenderer.js +1 -1
  110. package/views/3d/terrain/TerrainSurface.js +1 -1
  111. package/views/3d/terrain/Tile.js +1 -1
  112. package/views/3d/terrain/TileTexture.js +1 -1
  113. package/views/3d/webgl/ManagedFBO.js +1 -1
  114. package/views/3d/webgl/ManagedFBOAttachment.js +1 -1
  115. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  116. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  117. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  118. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  119. package/views/3d/webgl-engine/core/FBOPool.js +1 -1
  120. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +8 -2
  121. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  122. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  123. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  124. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  125. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  126. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  127. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  128. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  129. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +17 -0
  130. package/views/GroundView.js +1 -1
  131. package/views/analysis/ElevationProfile/ElevationProfileChart.js +5 -0
  132. package/views/analysis/ElevationProfile/constants.js +1 -1
  133. package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +5 -0
  134. package/views/analysis/ElevationProfile/elevationProfileChartTheme.js +5 -0
  135. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  136. package/views/webgl/Texture.js +1 -1
  137. package/views/webgl/VertexArrayObject.js +1 -1
  138. package/widgets/Bookmarks.js +1 -1
  139. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  140. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  141. package/widgets/Editor/support/EditorItem.js +1 -1
  142. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  143. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  144. package/widgets/Expand.js +1 -1
  145. package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
  146. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  147. package/widgets/support/SelectionList.js +1 -1
  148. package/assets/esri/core/workers/chunks/047d6f7b1677cc7ab271.js +0 -1
  149. package/assets/esri/core/workers/chunks/0f20c0eec850a39620a1.js +0 -1
  150. package/assets/esri/core/workers/chunks/3212a476184be25d17f8.js +0 -1
  151. package/assets/esri/core/workers/chunks/39d69afc9da9db0c75ab.js +0 -1
  152. package/assets/esri/core/workers/chunks/548818df658b607a364e.js +0 -1
  153. package/assets/esri/core/workers/chunks/70dc7ec6474f0801bc04.js +0 -1
  154. package/assets/esri/core/workers/chunks/7597ef10d1699e7088e5.js +0 -1
  155. package/assets/esri/core/workers/chunks/8a104b35708a492bd614.js +0 -1
  156. package/assets/esri/core/workers/chunks/a634764dec5404f4a1d7.js +0 -1
  157. package/assets/esri/core/workers/chunks/bafd9b0f6e817252cb31.js +0 -1
  158. package/assets/esri/core/workers/chunks/bc9f54a6b577c43189fd.js +0 -1
  159. package/assets/esri/core/workers/chunks/de4da985c398c8bcf2e7.js +0 -1
  160. package/assets/esri/core/workers/chunks/f4d4c1f13522f20b00d1.js +0 -1
  161. package/graphic/BuildingGraphicOrigin.d.ts +0 -4
  162. package/graphic/CSVGraphicOrigin.d.ts +0 -4
  163. package/graphic/CatalogGraphicOrigin.d.ts +0 -4
  164. package/graphic/FeatureGraphicOrigin.d.ts +0 -4
  165. package/graphic/GeoJSONGraphicOrigin.d.ts +0 -4
  166. package/graphic/GeoRSSGraphicOrigin.d.ts +0 -4
  167. package/graphic/KnowledgeGraphGraphicOrigin.d.ts +0 -4
  168. package/graphic/MapImageGraphicOrigin.d.ts +0 -4
  169. package/graphic/MapNotesGraphicOrigin.d.ts +0 -4
  170. package/graphic/OGCFeatureGraphicOrigin.d.ts +0 -4
  171. package/graphic/OrientedImageryGraphicOrigin.d.ts +0 -4
  172. package/graphic/ParquetGraphicOrigin.d.ts +0 -4
  173. package/graphic/PointCloudGraphicOrigin.d.ts +0 -4
  174. package/graphic/SceneGraphicOrigin.d.ts +0 -4
  175. package/graphic/StreamGraphicOrigin.d.ts +0 -4
  176. package/graphic/SubtypeGroupGraphicOrigin.d.ts +0 -4
  177. package/graphic/TileGraphicOrigin.d.ts +0 -4
  178. package/graphic/VoxelGraphicOrigin.d.ts +0 -4
  179. package/graphic/WCSGraphicOrigin.d.ts +0 -4
  180. package/graphic/WFSGraphicOrigin.d.ts +0 -4
  181. package/graphic/graphicOrigins.d.ts +0 -22
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as t}from"tslib";import{R as e,D as i}from"../../../chunks/ResponsiveTheme.js";import"../../../intl.js";import s from"../../../core/Accessor.js";import{createTask as o}from"../../../core/asyncUtils.js";import{makeHandle as n,handlesGroup as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as a,isAborted as l}from"../../../core/promiseUtils.js";import{watch as p}from"../../../core/reactiveUtils.js";import{formatDecimal as c,unitName as d}from"../../../core/unitFormatUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as m}from"../../../core/libs/gl-matrix-2/math/common.js";import{isDarkMode as f}from"../../../support/modeUtils.js";import{getConfig as g,notAvailable as x}from"./constants.js";import{getAdjustedBounds as _}from"./elevationProfileChartBoundsUtils.js";import{themeLight as y,themeDark as v}from"./elevationProfileChartTheme.js";import{binaryFindClosest as A}from"./elevationProfileGenerationUtils.js";import{isInputSketched as T}from"./elevationProfileGeometryUtils.js";import{c as b,N as S}from"../../../chunks/chartUtilsAm5.js";import{fetchMessageBundle as L}from"../../../intl/messages.js";import{X as w,a as P,V as F,A as M,b as C,L as j}from"../../../chunks/LineSeries.js";import{b as k,d as z,a as I,C as X}from"../../../chunks/Theme.js";import{T as D}from"../../../chunks/Tooltip.js";import{substitute as H}from"../../../intl/substitute.js";import{formatNumber as V}from"../../../intl/number.js";let Y=class extends s{get chartVisible(){const t=this._chartData;if(null==t)return!1;if(!T(this.analysisView?.analysis))return t.refined;let e=0;for(const{samples:i}of t.lines)e+=i?.length??0;return t.refined||e<=g().largeChartSamples}get spinnerVisible(){return null!=this._chartData&&(this.analysisView?.progress??0)<1}get _chartData(){const{analysisView:t,messages:e,_unitsMessages:i,uniformScaling:s}=this,o=!!this.view?.stationary,n=this._lineData;if(n&&this._hasInput&&t&&e&&i&&o)return{lines:n,effectiveUnits:t.effectiveUnits,statistics:t.statistics,refined:1===t.progress,dynamicElevationRange:t.analysis.profiles.some(t=>"scene"===t.type),uniformScaling:s,messages:e,unitsMessages:i}}get _hasInput(){return null!=this.analysisView?.analysis.input}get _lineData(){const{analysisView:t}=this;if(!t)return;const{analysis:e,results:i}=t,{profiles:s}=e;if(i.length!==s.length)return;const o=[];for(let n=0;n<s.length;n++){const t=s.at(n),e=i.at(n);if(!e.available||!e.rawResult?.hasZ||!t.chartOptions.lineVisible)continue;const r="input"!==t.type;o.push({id:t.id,type:t.type,title:t.title,color:t.color,samples:e.samples,fillEnabled:r,strokeOffsetY:r?-1:0,strokeWidth:1.5})}return o}constructor(t){super(t),this.view=null,this.analysisView=null,this.messages=null,this.uniformScaling=!1,this._theme=y,this._data=null,this._seriesInfos=new Map,this._state="loading",this._pointerIsOver=!1,this._rtl=!1,this._chartInfo=null,this._unitsMessages=null}initialize(){this.addHandles(o(t=>this._initializeChart(t)))}destroy(){this._chartInfo=null,this._seriesInfos.clear(),this._data=null}async _initializeChart(t){const[s,o]=await Promise.all([b(this.container),L("esri/core/t9n/Units")]);a(t);const n=N(this.container),r=f(),c=r?v:y;s.setThemes(r?[e.new(s),i.new(s)]:[e.new(s)]),this._rtl=n,this._theme=c,this._unitsMessages=o;const d=s.container.children.push(w.new(s,{panX:!0,panY:!0,paddingTop:c.paddingTop,paddingBottom:c.paddingBottom,paddingLeft:n?c.paddingRight:c.paddingLeft,paddingRight:n?c.paddingLeft:c.paddingRight,maxTooltipDistance:-1}));d.zoomOutButton.set("forceHidden",!0);const h=d.xAxes.push(this._createXAxis(s)),u=d.yAxes.push(this._createYAxis(s));this._chartInfo={chart:d,xAxis:h,yAxis:u};const m=P.new(d.root,{behavior:"none",xAxis:h,yAxis:u,snapToSeriesBy:"y"});m.lineY.set("visible",!1),d.set("cursor",m),this._initializeTest(d),this.addHandles([this._setupZoomHandling(),this._setupCursorHandling(),J(s.events.once("frameended",()=>{l(t)||(this._state="ready")})),J(s),p(()=>this._chartData,this._update.bind(this))]),this._update(this._chartData)}_initializeTest(t){}_update(t){if(!t)return;const e=this._data;this._chartInfo?.chart.get("cursor")?.set("forceHidden",!t?.refined);const i=e?.uniformScaling!==t?.uniformScaling;this._data=t,this._updateAxes(),this._updateSeries(),i&&this._zoomOut(),this._updateTooltips()}_zoomOut(){this._chartInfo?.xAxis.zoom(0,1),this._chartInfo?.yAxis.zoom(0,1)}_createXAxis(t){const e=this._theme,i=F.new(t,{renderer:M.new(t,{})});i.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:this._makeFormatter(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),i.axisHeader.set("forceHidden",!0);const s=i.get("renderer");s.setAll({inside:!1,minGridDistance:e.xAxisMinGridDistance}),s.labels.template.setAll({centerX:z,centerY:z,fill:k(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.xAxisMaxLabelPosition,minPosition:e.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:e.xAxisLabelsSpacing});const o=i.set("tooltip",D.new(t,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));return o.get("background")?.setAll({fill:k(e.axisTooltipBackgroundColor),stroke:void 0}),o.label.setAll({fill:k(e.axisTooltipLabelColor),fontFamily:e.fontFamily,fontSize:e.axisTooltipFontSize,paddingBottom:e.axisTooltipPaddingBottom,paddingLeft:e.axisTooltipPaddingHorizontal,paddingRight:e.axisTooltipPaddingHorizontal,paddingTop:e.axisTooltipPaddingTop,direction:this._rtl?"rtl":"ltr"}),s.grid.template.setAll({strokeOpacity:1,stroke:k(e.axisGridStroke)}),i}_createYAxis(t){const e=this._theme,i=this._rtl,s=F.new(t,{renderer:C.new(t,{})});s.setAll({baseValue:g().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:this._makeFormatter(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),s.axisHeader.set("visible",!1);const o=s.get("renderer");return o.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:i,inside:!0}),o.labels.template.setAll({centerX:z,centerY:I,fill:k(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:i?0:e.yAxisLabelSpacing,paddingRight:i?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:k(e.axisGridStroke)}),s}_setupZoomHandling(){const t=this._chartInfo;if(!t)return n();const{xAxis:e,yAxis:i}=t,s=()=>{this.onRangeChange(B(e),B(i))},o=t=>[t.on("start",s),t.on("end",s)];return q([...o(e),...o(i)])}_setupCursorHandling(){const t=this._chartInfo;if(!t)return n();const{chart:e,xAxis:i,yAxis:s}=t,o=e.get("cursor"),r=e.plotContainer.events,a=t=>{this._pointerIsOver=t,this._updateTooltips()},l=()=>{a(!1),this.onCursorPositionChange(null,null)};return q([o?.events.on("cursormoved",()=>{if(!this._pointerIsOver)return;this._updateTooltips();let t=o?.getPrivate("positionX")??0,e=o?.getPrivate("positionY")??0;const n=this._data;if(null!=n?.statistics){const{maxDistance:o,minElevation:r,maxElevation:a}=n.statistics;let l,p;if(null!=o){1===B(i)?(l=0,p=o):(l=W(i),p=Z(i)),t=E(t,l,p,0,o)}if(null!=r&&null!=a){1===B(s)?(l=r,p=a):(l=W(s),p=Z(s)),e=E(e,l,p,r,a)}}this.onCursorPositionChange(t,e)}),r.on("pointerover",()=>a(!0)),r.on("pointerout",l),r.on("blur",l)])}_updateAxes(){const t=this._chartInfo;if(!t)return;const{chart:e,xAxis:i,yAxis:s}=t,o=this._data,{minX:n,maxX:r,minY:a,maxY:l}=_({data:o,pixelWidth:i.width(),pixelHeight:s.height()}),p=!!o?.uniformScaling,c=!!o?.refined;e.setAll({panX:!0,panY:p,pinchZoomX:c,pinchZoomY:c&&p,wheelX:"panX",wheelY:c?p?"zoomXY":"zoomX":"none"}),i.setAll({max:r,min:n,panX:!0,panY:!1,zoomX:!0,zoomY:p}),s.setAll({max:l,min:a,panX:!1,panY:p,zoomX:p,zoomY:p})}_updateSeries(){const t=this._seriesInfos,e=this._chartInfo;if(!e)return;const{chart:i,xAxis:s,yAxis:o}=e,n=this._data;if(!n||0===n.lines.length)return void i.series.clear();const r=new Map,a=new Set(i.series.values),l=n.lines.length;for(let p=0;p<l;p++){const s=n.lines[p];let o=t.get(s.id);o?(o.fill&&a.delete(o.fill),a.delete(o.line)):(o=U(e,this._theme,this._rtl,s),o.fill&&i.series.push(o.fill),i.series.push(o.line)),r.set(o.id,o);const c=l-p-1;o.fill?.set("layer",c),o.line.set("layer",l+c),this._updateLineSeries(o,s)}this._seriesInfos=r;for(const p of a)i.series.removeValue(p);s.set("layer",l+1),o.set("layer",l+2)}_updateLineSeries(t,e){const i=k(e.color.toCss()),s=e.samples??[],o=s.length>0,{line:n,fill:r}=t;n.set("visible",o),n.set("stroke",i),r?.set("visible",o),r?.set("fill",X.lighten(i,this._theme.seriesFillLighten)),n.data.setAll(s),r?.data.setAll(s)}_updateTooltips(){const t=this._getSeriesTooltipText();t?(this._seriesInfos.forEach(e=>{const i=e.line.get("tooltip");i.set("forceHidden",!1),i.label.set("text",t)}),this._chartInfo?.xAxis.getTooltip()?.setAll({tooltipText:this._getAxisTooltipText()})):this._seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)})}_getSeriesTooltipText(){const t=this._data?.lines.map(t=>({line:t,y:this._getPointNearestToCursor(t)?.elevation})).sort(G);return t&&0!==t.length&&null!=t[0].y?t.map(({y:t,line:e})=>this._getTooltipTextForLine(e,t)).join("\n"):null}_getPointNearestToCursor(t){const e=t.samples??[];if(0===e.length)return null;const i=this._chartInfo;if(!i)return null;const{chart:s,xAxis:o}=i,n=s.get("cursor"),r=n?.getPrivate("positionX")??0,a=o.toAxisPosition(r),l=o.positionToValue(a);return A(e,l,t=>t.distance)}_getTooltipTextForLine(t,e){const i=this._data,s=this.messages,o=this._unitsMessages;if(!i||!s||!o)return"";const n=`[${t.color.toHex()}]●[/]`,r=" ",a=g().formatPrecision,l=H(s.chartTooltip,{name:$(t,s),elevation:null!=e?c(o,e,i.effectiveUnits.elevation,a):x});return this._rtl?l+r+n:n+r+l}_getAxisTooltipText(){const t=this._data,e=this._unitsMessages;if(!t||!e)return"";const i=t.lines[0],s=i?this._getPointNearestToCursor(i):null,o=g().formatPrecision;return null!=s?c(e,s.distance,t.effectiveUnits.distance,o):"-"}_makeFormatter(t,e){const i=S.new(t,{});return i.format=(t,i,s)=>{const o=this._data,n=this._unitsMessages;if(!o||!n||"string"==typeof t)return"";return`${V(t,{maximumFractionDigits:s})} ${d(n,o.effectiveUnits[e],"abbr")}`},i}};function U(t,e,i,s){const{id:o}=s,n=R(t,`line-${o}`),r=O(t,e,i);n.setAll({dy:s.strokeOffsetY,tooltip:r}),n.strokes.template.setAll({strokeWidth:s.strokeWidth});let a=null;return s.fillEnabled&&(a=R(t,`fill-${o}`),a.fills.template.setAll({fillOpacity:1,visible:!0})),{id:o,line:n,fill:a}}function R({chart:t,xAxis:e,yAxis:i},s){return j.new(t.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:s,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:e,yAxis:i})}function O({chart:t},e,i){const s=D.new(t.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),o=e.seriesTooltipPaddingHorizontal,n=e.seriesTooltipPaddingVertical;return s.label.setAll({fill:k(e.seriesTooltipLabelColor),fontFamily:e.fontFamily,fontSize:e.seriesTooltipFontSize,paddingBottom:n,paddingLeft:o,paddingRight:o,paddingTop:n,textAlign:i?"end":"start",direction:"ltr"}),s.get("background")?.setAll({stroke:void 0,fill:k(e.seriesTooltipBackgroundColor)}),s.adapters.add("dy",t=>{const i=e.seriesTooltipSpacing,o=s.get("pointTo")?.y??0;return(t??0)+(s.y()>o?i:-i)}),s}function B(t){const e=Math.abs((t.get("end")??0)-(t.get("start")??0)),i=0!==e?1/e:1;return Math.abs(1-i)<m()?1:i}function E(t,e,i,s,o){return(e+t*(i-e)-s)/(o-s)}function G({y:t},{y:e}){return null==t?1:null==e?-1:e-t}function W(t){return t.positionToValue(t.get("start")??0)}function Z(t){return t.positionToValue(t.get("end")??1)}function $(t,e){const i=t.title;if(null!=i)return i;switch(t.type){case"ground":return e.profiles.ground;case"input":return e.profiles.input;case"query":return e.profiles.query;case"scene":return e.profiles.scene;default:return""}}function N(t){const e=t?.closest("[dir]");return null!==e&&e instanceof HTMLElement&&"rtl"===e.dir||"rtl"===document.dir}function q(t){return r(t.map(J))}function J(t){return n(()=>t?.dispose())}t([h()],Y.prototype,"view",void 0),t([h()],Y.prototype,"analysisView",void 0),t([h()],Y.prototype,"container",void 0),t([h()],Y.prototype,"messages",void 0),t([h()],Y.prototype,"onRangeChange",void 0),t([h()],Y.prototype,"onCursorPositionChange",void 0),t([h()],Y.prototype,"uniformScaling",void 0),t([h()],Y.prototype,"chartVisible",null),t([h()],Y.prototype,"spinnerVisible",null),t([h()],Y.prototype,"test",void 0),t([h()],Y.prototype,"_theme",void 0),t([h()],Y.prototype,"_data",void 0),t([h()],Y.prototype,"_seriesInfos",void 0),t([h()],Y.prototype,"_state",void 0),t([h()],Y.prototype,"_pointerIsOver",void 0),t([h()],Y.prototype,"_rtl",void 0),t([h()],Y.prototype,"_chartInfo",void 0),t([h()],Y.prototype,"_unitsMessages",void 0),t([h()],Y.prototype,"_chartData",null),t([h()],Y.prototype,"_hasInput",null),t([h()],Y.prototype,"_lineData",null),Y=t([u("esri.views.analysis.ElevationProfile.ElevationProfileChart")],Y);export{Y as ElevationProfileChart};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{makeHandle as e}from"../../../core/handleUtils.js";import{convertUnit as t}from"../../../core/unitUtils.js";let i={noDataValue:-5e5,defaultQueryOptions:()=>({noDataValue:i.noDataValue,demResolution:"auto",maximumAutoTileRequests:150,ignoreInvisibleLayers:!0}),updateThrottleMillis:100,delayAfterPreviewMillis:500,defaultDemResolution:t(10,"centimeters","meters"),densificationMaxSamples:3e3,largeChartSamples:1e4,maxTotalSamples:1e5,maxChartRatio:300,minSlopeSampleDistance:10,formatPrecision:1,profileLinesUpdateThrottleMillis:100,hoveredPointsStyle:{size:14,borderStyle:"solid",borderWidth:3,borderColor:"#ffffff",boxShadow:"0px 0px 0px 5px rgba(255,255,255,0.2)"}};function l(){return i}function o(t){const l=i;return i={...i,...t},e(()=>{i=l})}function a(){return o({defaultDemResolution:100,densificationMaxSamples:500,updateThrottleMillis:0,delayAfterPreviewMillis:0})}const r={progress:1,hasZ:!1,samples:[],statistics:null,spatialReference:null};export{r as errorResult,l as getConfig,o as setConfig,a as setTestConfig};
5
+ import{makeHandle as e}from"../../../core/handleUtils.js";import{convertUnit as t}from"../../../core/unitUtils.js";let i={noDataValue:-5e5,defaultQueryOptions:()=>({noDataValue:i.noDataValue,demResolution:"auto",maximumAutoTileRequests:150,ignoreInvisibleLayers:!0}),updateThrottleMillis:100,delayAfterPreviewMillis:500,defaultDemResolution:t(10,"centimeters","meters"),densificationMaxSamples:3e3,largeChartSamples:1e4,maxTotalSamples:1e5,maxChartRatio:300,minSlopeSampleDistance:10,formatPrecision:1,profileLinesUpdateThrottleMillis:100,hoveredPointsStyle:{size:14,borderStyle:"solid",borderWidth:3,borderColor:"#ffffff",boxShadow:"0px 0px 0px 5px rgba(255,255,255,0.2)"}};function l(){return i}function o(t){const l=i;return i={...i,...t},e(()=>{i=l})}function a(){return o({defaultDemResolution:100,densificationMaxSamples:500,updateThrottleMillis:0,delayAfterPreviewMillis:0})}const r={progress:1,hasZ:!1,samples:[],statistics:null,spatialReference:null},s=" ― ";export{r as errorResult,l as getConfig,s as notAvailable,o as setConfig,a as setTestConfig};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{convertUnit as t}from"../../../core/unitUtils.js";import{getConfig as n}from"./constants.js";import{yAxisExtraFactorBottom as i,yAxisExtraFactorTop as e,minRange as a}from"./elevationProfileChartTheme.js";const o={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};function l({data:l,pixelWidth:c,pixelHeight:s}){if(!l)return o;const u=l.statistics,x=0,f=u?.maxDistance;let d=u?.minElevation,h=u?.maxElevation;if(null==f||null==d||null==h)return o;const v=Math.max(f-x,a);let p=Math.max(h-d,a);const X=l.effectiveUnits;if(l.dynamicElevationRange){const i=t(v,X.distance,X.elevation);p=Math.max(p,i/n().maxChartRatio)}return d-=i*p,h=d+p+e*p,[d,h]=r(d,h,10),p=h-d,l.uniformScaling?m({data:l,bounds:{minX:x,maxX:f,minY:d,maxY:h},pixelWidth:c,pixelHeight:s,centered:!0}):{minX:x,maxX:x+v,minY:d,maxY:d+p}}function m({data:n,bounds:i,pixelWidth:e,pixelHeight:a,centered:l}){if(!n)return i;let{minX:m,maxX:r,minY:c,maxY:u}=i;if(null==m||null==r||null==c||null==u)return o;const x=r-m,f=u-c,d=n.effectiveUnits,h=t(f,d.elevation,d.distance)/a/(x/e);return h>=1?[m,r]=s([m,r],h):[c,u]=s([c,u],1/h),{minX:m,maxX:r,minY:c,maxY:u}}function r(t,n,i=10){const e=c(n-t,!1);if(0===e)return[t,n];const a=c(e/(i-1),!0);return[Math.floor(t/a)*a,Math.ceil(n/a)*a]}function c(t,n){const i=Math.floor(Math.log10(t)),e=t/10**i;let a;return a=n?e<1.5?1:e<3?2:e<5?2.5:e<7?5:10:e<=1?1:e<=2?2:e<=3?2.5:e<=5?5:10,a*10**i}function s([t,n],i,e){const a=(n-t)*i;{const i=(t+n)/2-a/2;return[i,i+a]}}export{l as getAdjustedBounds};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ const i=.001,o=.1,a=.02,s=15,t=12,e="#f8f8f8",l="#a9a9a9",n="#323232",r={fontFamily:"Avenir Next",paddingBottom:t/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:l,axisTooltipFontSize:12,axisTooltipBackgroundColor:n,axisTooltipLabelColor:e,axisTooltipPaddingTop:Math.round(t/4),axisTooltipPaddingBottom:Math.round(t/4),axisTooltipPaddingHorizontal:Math.round(s/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(t/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(s/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:e,seriesTooltipLabelColor:n,seriesFillLighten:.9,seriesTooltipSpacing:t/2,seriesTooltipPaddingVertical:Math.round(s/4),seriesTooltipPaddingHorizontal:Math.round(s/4)},d={...r,axisGridStroke:n,axisLabelsColor:l,axisTooltipBackgroundColor:n,axisTooltipLabelColor:e,seriesTooltipBackgroundColor:n,seriesTooltipLabelColor:e,seriesFillLighten:-.75};export{i as minRange,d as themeDark,r as themeLight,a as yAxisExtraFactorBottom,o as yAxisExtraFactorTop};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{floatEqualUlp as e,lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{distance as o,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{m as i}from"../../../chunks/vec32.js";import a from"../../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../../geometry/projectionUtils.js";import l from"../../../geometry/SpatialReference.js";import{geodesicLengths as f,isSupported as p,inverseGeodeticSolver as h,directGeodeticSolver as m}from"../../../geometry/support/geodesicUtils.js";import{getElevationOffset as d}from"../../../support/elevationInfoUtils.js";import{ElevationProfileGenerationError as g}from"./ElevationProfileGenerationError.js";async function y(e,t,o,s,i,a,p){let h,m,d;const y=e.spatialReference,j=y.isGeographic||y.isWebMercator;let v=0;if(!j){const{execute:t}=await import("../../../geometry/operators/lengthOperator.js");n(p),v=t(e,{unit:"meters"}),n(p)}const P=1/r(s);if(j){await c([{source:y,dest:s},{source:y,dest:l.WGS84}],p);const n=B(e);h=f([n],"meters")[0];const r=w(h,i);if(F(e,h,r)>a)throw new g("too-complex");const j=R(n,t,o);({densifiedPath:m,distances:d}=W(j,r,P)),m=u(m,s)}else{await c([{source:y,dest:s}],p),h=v;const r=w(h,i);if(F(e,h,r)>a)throw new g("too-complex");const l=R(e,t,o);({densifiedPath:m,distances:d}=E(l,r,P)),n(p),m=u(m,s)}return{densifiedPath:m,pathLength:h*P,distances:d}}function w(e,t){const n=e/t.densificationMaxSamples;return Math.max(t.samplingDistance,n)}function R(e,t,n){if(null==t)return P(e);const r=e.spatialReference,o=t.mode,s=d(t,r);let i=null;switch(n.type){case"2d":i=j(e,o,s);break;case"3d":i=v(e,o,s,n)}return null==i?P(e):new a({hasZ:!0,hasM:!1,spatialReference:r,paths:Z(e.paths,i)})}function j({hasZ:e},t,n){return"absolute-height"===t?e?([e,t,r])=>[e,t,r+n]:([e,t])=>[e,t,n]:null}function v({spatialReference:e,hasZ:t},n,r,{elevationProvider:o}){const s=(t,n,r,s)=>o?.getElevation(t,n,r,e,s)??0;switch(n){case"on-the-ground":return([e,t])=>[e,t,s(e,t,0,"ground")];case"absolute-height":return t?([e,t,n])=>[e,t,n+r]:([e,t])=>[e,t,r];case"relative-to-ground":return t?([e,t,n])=>[e,t,n+s(e,t,n,"ground")+r]:([e,t])=>[e,t,s(e,t,0,"ground")+r];case"relative-to-scene":return t?([e,t,n])=>[e,t,n+s(e,t,n,"scene")+r]:([e,t])=>[e,t,s(e,t,0,"scene")+r];default:return null}}function P(e){return e.hasZ?new a({hasZ:!1,hasM:!1,spatialReference:e.spatialReference,paths:Z(e.paths,([e,t])=>[e,t])}):e}function Z(e,t){const n=e.length,r=new Array(n);for(let o=0;o<n;++o){const n=e[o],s=n.length,i=new Array(n.length);r[o]=i;for(let e=0;e<s;++e)i[e]=t(n[e])}return r}function x(e){return null!=e&&"polyline"===e.type&&e.paths.length>0&&e.paths.every(e=>e.length>=2)}function M(e){return S(e)&&x(e.geometry)}function S(e){return z(e)&&U(e?.geometry)}function U(e){return!z(e)&&null!=e&&"polyline"===e.type}function b(e){return z(e)?e:null}function A(e){return z(e)?e.geometry:e}function z(e){return null!=e&&"geometry"in e}function G(t,n,o,s,i){const{spatialReference:c,hasZ:u}=t,l={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:c,metersPerSR:r(c)},f=[],p=[];let h=0;for(let r=0;r<t.paths.length;++r){const a=t.paths[r],c=new Array,u=new Array;let m=0;for(let t=1;t<a.length;++t){const r=a[t-1],f=a[t],p=s(l,r,f);let d;for(d=m;d<p.distance&&!e(d,p.distance);d+=n)c.push(i(p,d)),u.push((h+d)*o);m=d-p.distance,h+=p.distance,c.push(f),u.push(h*o)}f[r]=c,p[r]=u}return{densifiedPath:new a({spatialReference:c,hasZ:u,paths:f}),distances:p}}function E(e,t,n){const{hasZ:r}=e;return G(e,t,n,D,r?q:O)}function W(e,t,n){const{hasZ:r}=e;return G(e,t,n,k,r?L:I)}function k(e,t,n){return e.distance=0,h(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function D(e,t,n){return e.from=t,e.to=n,e.distance=o(n,t)*e.metersPerSR,e}function I({from:e,azimuth:t,spatialReference:n},r){return m([0,0],e,t,r,n)}function L({from:e,to:n,azimuth:r,distance:o,spatialReference:s},i){const a=i/o,c=[0,0,t(e[2],n[2],a)];return m(c,e,r,i,s),c}function O({from:e,to:t,distance:n},r){return s([0,0],e,t,r/n)}function q({from:e,to:t,distance:n},r){return i([0,0,0],e,t,r/n)}function B(e){return p(e.spatialReference)?e:u(e,l.WGS84)}function C(e){return e.paths.reduce((e,t)=>e+t.length,0)}function F(e,t,n){return C(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce(e=>1+e,0)-1)}export{C as countPoints,y as densifyPath,A as getInputGeometry,b as getInputGraphic,z as isGraphic,U as isPolyline,S as isPolylineGraphic,M as isValidInputGraphic,x as isValidInputPath,R as toAbsoluteHeightElevation};
5
+ import{floatEqualUlp as e,lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{distance as o,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{m as i}from"../../../chunks/vec32.js";import a from"../../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../../geometry/projectionUtils.js";import l from"../../../geometry/SpatialReference.js";import{geodesicLengths as f,isSupported as p,inverseGeodeticSolver as h,directGeodeticSolver as m}from"../../../geometry/support/geodesicUtils.js";import{getElevationOffset as d}from"../../../support/elevationInfoUtils.js";import{ElevationProfileGenerationError as g}from"./ElevationProfileGenerationError.js";async function y(e,t,o,s,i,a,p){let h,m,d;const y=e.spatialReference,j=y.isGeographic||y.isWebMercator;let v=0;if(!j){const{execute:t}=await import("../../../geometry/operators/lengthOperator.js");n(p),v=t(e,{unit:"meters"}),n(p)}const P=1/r(s);if(j){await c([{source:y,dest:s},{source:y,dest:l.WGS84}],p);const n=C(e);h=f([n],"meters")[0];const r=w(h,i);if(H(e,h,r)>a)throw new g("too-complex");const j=R(n,t,o);({densifiedPath:m,distances:d}=k(j,r,P)),m=u(m,s)}else{await c([{source:y,dest:s}],p),h=v;const r=w(h,i);if(H(e,h,r)>a)throw new g("too-complex");const l=R(e,t,o);({densifiedPath:m,distances:d}=W(l,r,P)),n(p),m=u(m,s)}return{densifiedPath:m,pathLength:h*P,distances:d}}function w(e,t){const n=e/t.densificationMaxSamples;return Math.max(t.samplingDistance,n)}function R(e,t,n){if(null==t)return P(e);const r=e.spatialReference,o=t.mode,s=d(t,r);let i=null;switch(n.type){case"2d":i=j(e,o,s);break;case"3d":i=v(e,o,s,n)}return null==i?P(e):new a({hasZ:!0,hasM:!1,spatialReference:r,paths:Z(e.paths,i)})}function j({hasZ:e},t,n){return"absolute-height"===t?e?([e,t,r])=>[e,t,r+n]:([e,t])=>[e,t,n]:null}function v({spatialReference:e,hasZ:t},n,r,{elevationProvider:o}){const s=(t,n,r,s)=>o?.getElevation(t,n,r,e,s)??0;switch(n){case"on-the-ground":return([e,t])=>[e,t,s(e,t,0,"ground")];case"absolute-height":return t?([e,t,n])=>[e,t,n+r]:([e,t])=>[e,t,r];case"relative-to-ground":return t?([e,t,n])=>[e,t,n+s(e,t,n,"ground")+r]:([e,t])=>[e,t,s(e,t,0,"ground")+r];case"relative-to-scene":return t?([e,t,n])=>[e,t,n+s(e,t,n,"scene")+r]:([e,t])=>[e,t,s(e,t,0,"scene")+r];default:return null}}function P(e){return e.hasZ?new a({hasZ:!1,hasM:!1,spatialReference:e.spatialReference,paths:Z(e.paths,([e,t])=>[e,t])}):e}function Z(e,t){const n=e.length,r=new Array(n);for(let o=0;o<n;++o){const n=e[o],s=n.length,i=new Array(n.length);r[o]=i;for(let e=0;e<s;++e)i[e]=t(n[e])}return r}function x(e){return null!=e&&"polyline"===e.type&&e.paths.length>0&&e.paths.every(e=>e.length>=2)}function M(e){return S(e)&&x(e.geometry)}function S(e){return z(e)&&U(e?.geometry)}function U(e){return!z(e)&&null!=e&&"polyline"===e.type}function b(e){return z(e)?e:null}function A(e){return z(e)?e.geometry:e}function z(e){return null!=e&&"geometry"in e}function G(e){const t=e?.input;return!z(t)&&U(t)}function E(t,n,o,s,i){const{spatialReference:c,hasZ:u}=t,l={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:c,metersPerSR:r(c)},f=[],p=[];let h=0;for(let r=0;r<t.paths.length;++r){const a=t.paths[r],c=new Array,u=new Array;let m=0;for(let t=1;t<a.length;++t){const r=a[t-1],f=a[t],p=s(l,r,f);let d;for(d=m;d<p.distance&&!e(d,p.distance);d+=n)c.push(i(p,d)),u.push((h+d)*o);m=d-p.distance,h+=p.distance,c.push(f),u.push(h*o)}f[r]=c,p[r]=u}return{densifiedPath:new a({spatialReference:c,hasZ:u,paths:f}),distances:p}}function W(e,t,n){const{hasZ:r}=e;return E(e,t,n,I,r?B:q)}function k(e,t,n){const{hasZ:r}=e;return E(e,t,n,D,r?O:L)}function D(e,t,n){return e.distance=0,h(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function I(e,t,n){return e.from=t,e.to=n,e.distance=o(n,t)*e.metersPerSR,e}function L({from:e,azimuth:t,spatialReference:n},r){return m([0,0],e,t,r,n)}function O({from:e,to:n,azimuth:r,distance:o,spatialReference:s},i){const a=i/o,c=[0,0,t(e[2],n[2],a)];return m(c,e,r,i,s),c}function q({from:e,to:t,distance:n},r){return s([0,0],e,t,r/n)}function B({from:e,to:t,distance:n},r){return i([0,0,0],e,t,r/n)}function C(e){return p(e.spatialReference)?e:u(e,l.WGS84)}function F(e){return e.paths.reduce((e,t)=>e+t.length,0)}function H(e,t,n){return F(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce(e=>1+e,0)-1)}export{F as countPoints,y as densifyPath,A as getInputGeometry,b as getInputGraphic,z as isGraphic,G as isInputSketched,U as isPolyline,S as isPolylineGraphic,M as isValidInputGraphic,x as isValidInputPath,R as toAbsoluteHeightElevation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../core/Error.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{abortMaybe as i}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as s,isAbortError as o}from"../../core/promiseUtils.js";import{checkWebGLError as a}from"./checkWebGLError.js";import{ResourceType as n,CompressedTextureFormat as p}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as m,deriveInternalFormat as h,isTexImageSource as d,is3DTarget as c,validateTexture as _,isCompressedFormat as u,getDimensions as g,calcMipmapLevels as x,isSizedPixelFormat as T,isSizedDepthFormat as M,isSizedDepthStencilFormat as b}from"./textureUtils.js";import{ValidatedTextureDescriptor as f}from"./ValidatedTextureDescriptor.js";const w=null,D=!!has("esri-tests-disable-gpu-memory-measurements"),E=()=>e.getLogger("esri/views/webgl/Texture");let A=class e{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,i=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=i;else{const r=f.validate(e,i);if(!r)throw new t("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return D?0:l(this._descriptor)}get cachedMemory(){return this.usedMemory}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(n.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=i,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(t){this._descriptor.compress=t}disableCompression(){this._descriptor.compress=void 0}setData(t){this.abortCompression(),!m(t)&&this._descriptor.internalFormat&&r(p,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(t),!m(t)&&this._descriptor.compress&&this._compressOnWorker(t)}updateData(i,r,s,o,a,n,p=0){n||E().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||E().error("An attempt to update uninitialized texture!");const l=this._descriptor;l.internalFormat=h(l);const{context:c,pixelFormat:_,dataType:u,target:g,isImmutable:x}=l;if(x&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");const T=c.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES,!0);(r<0||s<0||r+o>l.width||s+a>l.height)&&E().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:M}=c;p&&(o&&a||E().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),M.pixelStorei(M.UNPACK_SKIP_ROWS,p)),d(n)?M.texSubImage2D(g,i,r,s,o,a,_,u,n):m(n)?M.compressedTexSubImage2D(g,i,r,s,o,a,l.internalFormat,n.levels[i]):M.texSubImage2D(g,i,r,s,o,a,_,u,n),p&&M.pixelStorei(M.UNPACK_SKIP_ROWS,0),c.bindTexture(T,e.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(i,r,s,o,a,n,p,l){l||E().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||E().error("An attempt to update an uninitialized texture!");const d=this._descriptor;d.internalFormat=h(d);const{context:_,pixelFormat:u,dataType:g,isImmutable:x,target:T}=d;if(x&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");c(T)||E().warn("Attempting to set 3D texture data on a non-3D texture");const M=_.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);_.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),(r<0||s<0||o<0||r+a>d.width||s+n>d.height||o+p>d.depth)&&E().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:b}=_;if(m(l))l=l.levels[i],b.compressedTexSubImage3D(T,i,r,s,o,a,n,p,d.internalFormat,l);else{const t=l;b.texSubImage3D(T,i,r,s,o,a,n,p,u,g,t)}_.bindTexture(M,e.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const i=this._descriptor;if(0===i.width||0===i.height)return;if(!i.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");i.hasMipmap=!0,this._samplingModeDirty=!0,_(i)}9729===i.samplingMode?(this._samplingModeDirty=!0,i.samplingMode=9985):9728===i.samplingMode&&(this._samplingModeDirty=!0,i.samplingMode=9984);const r=this._descriptor.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(i.target),this._descriptor.context.bindTexture(r,e.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,_(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,_(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(t){t!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=t,this.setSamplingMode(t?9729:9728),_(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=i(this._compressionAbortController)}_setData(i,r){const s=this._descriptor,o=s.context?.gl;if(!o)return;a(o),this.hasWebGLTextureObject||(this._glName=o.createTexture(),s.context.instanceCounter.increment(n.Texture,this)),_(s);const p=s.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);s.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),a(o);const l=r??s.target,g=c(l);if(d(i))this._setDataFromTexImageSource(i,l);else{const{width:e,height:r,depth:n}=s;if(null==e||null==r)throw new t("texture:missing-size","Width and height must be specified!");if(g&&null==n)throw new t("texture:missing-depth","Depth must be specified!");if(s.internalFormat=h(s),s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(l,s.internalFormat,s.hasMipmap,e,r,n),m(i)){if(!u(s.internalFormat))throw new t("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(i,s.internalFormat,l)}else this._texImage(l,0,s.internalFormat,e,r,n,i),a(o),s.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),a(o),s.context.bindTexture(p,e.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(t=null){for(let e=34069;e<=34074;e++)this._setData(t,e)}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_setDataFromTexImageSource(t,e){const{gl:i}=this._descriptor.context,r=this._descriptor;r.internalFormat=h(r);const s=c(e),{width:o,height:n,depth:p}=g(t);r.width&&r.height,r.width||(r.width=o),r.height||(r.height=n),s&&r.depth,s&&(r.depth=p),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(e,r.internalFormat,r.hasMipmap,o,n,p),this._texImage(e,0,r.internalFormat,o,n,p,t),a(i),r.hasMipmap&&(this.generateMipmap(),a(i))}_setDataFromCompressedSource(t,e,i){const r=this._descriptor,{width:s,height:o,depth:a}=r,n=t.levels,p=x(i,s,o,a),l=Math.min(p,n.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((t,r,s,o)=>{const a=n[Math.min(t,n.length-1)];this._compressedTexImage(i,t,e,r,s,o,a)},l)}_texStorage(e,i,r,s,o,a){const{gl:n}=this._descriptor.context;if(!T(i)&&!M(i)&&!b(i))throw new t("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const p=r?x(e,s,o,a):1;if(c(e)){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");n.texStorage3D(e,p,i,s,o,a)}else n.texStorage2D(e,p,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e),{isImmutable:m,pixelFormat:h,dataType:d}=this._descriptor;if(m){if(null!=n){const r=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texSubImage3D(e,i,0,0,0,s,o,a,h,d,r)}else p.texSubImage2D(e,i,0,0,s,o,h,d,r)}}else{const m=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texImage3D(e,i,r,s,o,a,0,h,d,m)}else p.texImage2D(e,i,r,s,o,0,h,d,m)}}_compressedTexImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e);if(this._descriptor.isImmutable){if(null!=n)if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexSubImage3D(e,i,0,0,0,s,o,a,r,n)}else p.compressedTexSubImage2D(e,i,0,0,s,o,r,n)}else if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexImage3D(e,i,r,s,o,a,0,n)}else p.compressedTexImage2D(e,i,r,s,o,0,n)}async _compressOnWorker(t){const{width:i,height:r,context:a,flipped:n,preMultiplyAlpha:p,hasMipmap:l}=this._descriptor,m=this._descriptor.compress?.compressionTracker,h=this._descriptor.compress?.compressionCallback,{compressedTextureETC:d,compressedTextureS3TC:c}=a.capabilities;if(!e.compressionWorkerHandle?.isCompressible(t,this._descriptor)||!d&&!c)return;this.abortCompression();const _=new AbortController;this._compressionAbortController=_,m?.increment();try{let o;t instanceof Uint8Array?o=t.buffer:(o=await createImageBitmap(t,{imageOrientation:n?"flipY":"none"}),s(_));const a={data:o,width:i,height:r,needsFlip:t instanceof Uint8Array&&this.descriptor.flipped,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:p,hasMipmap:l,hasETC:!!d,hasS3TC:!!c},m=await e.compressionWorkerHandle.invoke(a,_.signal,"low");if(s(_),m.compressedTexture&&this.hasWebGLTextureObject){const t=this.usedMemory;this._descriptor.internalFormat=m.internalFormat,this._setData(m.compressedTexture),h?.(t-this.usedMemory)}}catch(u){o(u)||E().error("Texture compression failed!")}finally{m?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null)}}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:o,hasMipmap:a,target:n}=this._descriptor;const p=32879===n;if(null==r||null==s||p&&null==o)throw new t("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,o),a&&(1!==r||1!==s||p&&1!==o)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(o=Math.max(1,o>>1))}_applySamplingMode(){const t=this._descriptor,e=t.context?.gl;let i=t.samplingMode,r=t.samplingMode;9985===i||9987===i?(i=9729,t.hasMipmap||(r=9729)):9984!==i&&9986!==i||(i=9728,t.hasMipmap||(r=9728)),e.texParameteri(t.target,e.TEXTURE_MAG_FILTER,i),e.texParameteri(t.target,e.TEXTURE_MIN_FILTER,r)}_applyWrapMode(){const t=this._descriptor,e=t.context?.gl;"number"==typeof t.wrapMode?(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode)):(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode.s),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode.t))}_applyShadowMode(){const t=this._descriptor,e=t.context?.gl,i=t.compareEnabled?e.COMPARE_REF_TO_TEXTURE:e.NONE;e.texParameteri(t.target,e.TEXTURE_COMPARE_MODE,i),t.compareEnabled&&e.texParameteri(t.target,e.TEXTURE_COMPARE_FUNC,e.GREATER),a(e)}_applyAnisotropicFilteringParameters(){const t=this._descriptor,e=t.context.capabilities.textureFilterAnisotropic;if(!e)return;t.context.gl.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY,t.maxAnisotropy??1)}};export{A as Texture,w as tracer};
5
+ import t from"../../core/Error.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{abortMaybe as i}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as s,isAbortError as o}from"../../core/promiseUtils.js";import{checkWebGLError as a}from"./checkWebGLError.js";import{ResourceType as n,CompressedTextureFormat as p}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as m,deriveInternalFormat as h,isTexImageSource as d,is3DTarget as c,validateTexture as _,isCompressedFormat as u,getDimensions as g,calcMipmapLevels as x,isSizedPixelFormat as T,isSizedDepthFormat as M,isSizedDepthStencilFormat as b}from"./textureUtils.js";import{ValidatedTextureDescriptor as f}from"./ValidatedTextureDescriptor.js";const w=null,D=!!has("esri-tests-disable-gpu-memory-measurements"),E=()=>e.getLogger("esri/views/webgl/Texture");let A=class e{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,i=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=i;else{const r=f.validate(e,i);if(!r)throw new t("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return D?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(n.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=i,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(t){this._descriptor.compress=t}disableCompression(){this._descriptor.compress=void 0}setData(t){this.abortCompression(),!m(t)&&this._descriptor.internalFormat&&r(p,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(t),!m(t)&&this._descriptor.compress&&this._compressOnWorker(t)}updateData(i,r,s,o,a,n,p=0){n||E().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||E().error("An attempt to update uninitialized texture!");const l=this._descriptor;l.internalFormat=h(l);const{context:c,pixelFormat:_,dataType:u,target:g,isImmutable:x}=l;if(x&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");const T=c.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES,!0);(r<0||s<0||r+o>l.width||s+a>l.height)&&E().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:M}=c;p&&(o&&a||E().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),M.pixelStorei(M.UNPACK_SKIP_ROWS,p)),d(n)?M.texSubImage2D(g,i,r,s,o,a,_,u,n):m(n)?M.compressedTexSubImage2D(g,i,r,s,o,a,l.internalFormat,n.levels[i]):M.texSubImage2D(g,i,r,s,o,a,_,u,n),p&&M.pixelStorei(M.UNPACK_SKIP_ROWS,0),c.bindTexture(T,e.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(i,r,s,o,a,n,p,l){l||E().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||E().error("An attempt to update an uninitialized texture!");const d=this._descriptor;d.internalFormat=h(d);const{context:_,pixelFormat:u,dataType:g,isImmutable:x,target:T}=d;if(x&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");c(T)||E().warn("Attempting to set 3D texture data on a non-3D texture");const M=_.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);_.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),(r<0||s<0||o<0||r+a>d.width||s+n>d.height||o+p>d.depth)&&E().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:b}=_;if(m(l))l=l.levels[i],b.compressedTexSubImage3D(T,i,r,s,o,a,n,p,d.internalFormat,l);else{const t=l;b.texSubImage3D(T,i,r,s,o,a,n,p,u,g,t)}_.bindTexture(M,e.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const i=this._descriptor;if(0===i.width||0===i.height)return;if(!i.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");i.hasMipmap=!0,this._samplingModeDirty=!0,_(i)}9729===i.samplingMode?(this._samplingModeDirty=!0,i.samplingMode=9985):9728===i.samplingMode&&(this._samplingModeDirty=!0,i.samplingMode=9984);const r=this._descriptor.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(i.target),this._descriptor.context.bindTexture(r,e.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,_(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,_(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(t){t!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=t,this.setSamplingMode(t?9729:9728),_(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=i(this._compressionAbortController)}_setData(i,r){const s=this._descriptor,o=s.context?.gl;if(!o)return;a(o),this.hasWebGLTextureObject||(this._glName=o.createTexture(),s.context.instanceCounter.increment(n.Texture,this)),_(s);const p=s.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);s.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),a(o);const l=r??s.target,g=c(l);if(d(i))this._setDataFromTexImageSource(i,l);else{const{width:e,height:r,depth:n}=s;if(null==e||null==r)throw new t("texture:missing-size","Width and height must be specified!");if(g&&null==n)throw new t("texture:missing-depth","Depth must be specified!");if(s.internalFormat=h(s),s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(l,s.internalFormat,s.hasMipmap,e,r,n),m(i)){if(!u(s.internalFormat))throw new t("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(i,s.internalFormat,l)}else this._texImage(l,0,s.internalFormat,e,r,n,i),a(o),s.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),a(o),s.context.bindTexture(p,e.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(t=null){for(let e=34069;e<=34074;e++)this._setData(t,e)}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_setDataFromTexImageSource(t,e){const{gl:i}=this._descriptor.context,r=this._descriptor;r.internalFormat=h(r);const s=c(e),{width:o,height:n,depth:p}=g(t);r.width&&r.height,r.width||(r.width=o),r.height||(r.height=n),s&&r.depth,s&&(r.depth=p),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(e,r.internalFormat,r.hasMipmap,o,n,p),this._texImage(e,0,r.internalFormat,o,n,p,t),a(i),r.hasMipmap&&(this.generateMipmap(),a(i))}_setDataFromCompressedSource(t,e,i){const r=this._descriptor,{width:s,height:o,depth:a}=r,n=t.levels,p=x(i,s,o,a),l=Math.min(p,n.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((t,r,s,o)=>{const a=n[Math.min(t,n.length-1)];this._compressedTexImage(i,t,e,r,s,o,a)},l)}_texStorage(e,i,r,s,o,a){const{gl:n}=this._descriptor.context;if(!T(i)&&!M(i)&&!b(i))throw new t("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const p=r?x(e,s,o,a):1;if(c(e)){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");n.texStorage3D(e,p,i,s,o,a)}else n.texStorage2D(e,p,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e),{isImmutable:m,pixelFormat:h,dataType:d}=this._descriptor;if(m){if(null!=n){const r=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texSubImage3D(e,i,0,0,0,s,o,a,h,d,r)}else p.texSubImage2D(e,i,0,0,s,o,h,d,r)}}else{const m=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texImage3D(e,i,r,s,o,a,0,h,d,m)}else p.texImage2D(e,i,r,s,o,0,h,d,m)}}_compressedTexImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e);if(this._descriptor.isImmutable){if(null!=n)if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexSubImage3D(e,i,0,0,0,s,o,a,r,n)}else p.compressedTexSubImage2D(e,i,0,0,s,o,r,n)}else if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexImage3D(e,i,r,s,o,a,0,n)}else p.compressedTexImage2D(e,i,r,s,o,0,n)}async _compressOnWorker(t){const{width:i,height:r,context:a,flipped:n,preMultiplyAlpha:p,hasMipmap:l}=this._descriptor,m=this._descriptor.compress?.compressionTracker,h=this._descriptor.compress?.compressionCallback,{compressedTextureETC:d,compressedTextureS3TC:c}=a.capabilities;if(!e.compressionWorkerHandle?.isCompressible(t,this._descriptor)||!d&&!c)return;this.abortCompression();const _=new AbortController;this._compressionAbortController=_,m?.increment();try{let o;t instanceof Uint8Array?o=t.buffer:(o=await createImageBitmap(t,{imageOrientation:n?"flipY":"none"}),s(_));const a={data:o,width:i,height:r,needsFlip:t instanceof Uint8Array&&this.descriptor.flipped,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:p,hasMipmap:l,hasETC:!!d,hasS3TC:!!c},m=await e.compressionWorkerHandle.invoke(a,_.signal,"low");if(s(_),m.compressedTexture&&this.hasWebGLTextureObject){const t=this.usedMemory;this._descriptor.internalFormat=m.internalFormat,this._setData(m.compressedTexture),h?.(t-this.usedMemory)}}catch(u){o(u)||E().error("Texture compression failed!")}finally{m?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null)}}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:o,hasMipmap:a,target:n}=this._descriptor;const p=32879===n;if(null==r||null==s||p&&null==o)throw new t("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,o),a&&(1!==r||1!==s||p&&1!==o)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(o=Math.max(1,o>>1))}_applySamplingMode(){const t=this._descriptor,e=t.context?.gl;let i=t.samplingMode,r=t.samplingMode;9985===i||9987===i?(i=9729,t.hasMipmap||(r=9729)):9984!==i&&9986!==i||(i=9728,t.hasMipmap||(r=9728)),e.texParameteri(t.target,e.TEXTURE_MAG_FILTER,i),e.texParameteri(t.target,e.TEXTURE_MIN_FILTER,r)}_applyWrapMode(){const t=this._descriptor,e=t.context?.gl;"number"==typeof t.wrapMode?(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode)):(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode.s),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode.t))}_applyShadowMode(){const t=this._descriptor,e=t.context?.gl,i=t.compareEnabled?e.COMPARE_REF_TO_TEXTURE:e.NONE;e.texParameteri(t.target,e.TEXTURE_COMPARE_MODE,i),t.compareEnabled&&e.texParameteri(t.target,e.TEXTURE_COMPARE_FUNC,e.GREATER),a(e)}_applyAnisotropicFilteringParameters(){const t=this._descriptor,e=t.context.capabilities.textureFilterAnisotropic;if(!e)return;t.context.gl.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY,t.maxAnisotropy??1)}};export{A as Texture,w as tracer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{toConst as e}from"../../core/compilerUtils.js";import t from"../../core/Logger.js";import{disposeMaybe as r}from"../../core/maybe.js";import{baseTypedArrayMemory as s}from"../../core/memoryEstimations.js";import{ResourceType as i}from"./enums.js";import{bindVertexBufferLayout as n}from"./Util.js";import{fromBuffers as o}from"./VertexAttributeLocations.js";const f=()=>t.getLogger("esri.views.webgl.VertexArrayObject");let u=class{constructor(t,r,s){this._context=t,this._indexBuffer=s,this._buffers=r instanceof Map?r:new Map([["geometry",r]]),this.locations=e(o(this._buffers))}get glName(){return this._glName}get context(){return this._context}get buffers(){return e(this._buffers)}buffer(e="geometry"){return this.buffers.get(e)}get indexBuffer(){return this._indexBuffer}getByteLength(e){return this.buffer(e)?.sizeBytes??0}vertexCount(e){const t=this.buffer(e);return t?t.sizeBytes/t.layout[0].stride:0}get usedMemory(){return Array.from(this._buffers.values()).reduce((e,t)=>e+t.usedMemory,this._indexBuffer?.usedMemory??0+(this._buffers.size+(this._indexBuffer?1:0))*s)}get cachedMemory(){return this.usedMemory}dispose(){this._context?(this._context.getBoundVAO()===this&&this._context.bindVAO(null),this._buffers.forEach(e=>e.dispose()),this._buffers.clear(),this._indexBuffer=r(this._indexBuffer),this.disposeVAOOnly()):(this._glName||this._buffers.size>0)&&f().warn("Leaked WebGL VAO")}disposeVAOOnly(){this._glName&&(this._context.gl.deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(i.VertexArrayObject,this)),this._context=null}bind(e=this.locations){const t=this._context.gl;this._glName?t.bindVertexArray(this._glName):(this._context.instanceCounter.increment(i.VertexArrayObject,this),this._glName=t.createVertexArray(),t.bindVertexArray(this._glName),this._bindLayout(e))}_bindLayout(e){const{_buffers:t,_indexBuffer:r}=this;if(t||f().error("Vertex buffer dictionary is empty!"),t.forEach(t=>n(this._context,e,t)),null!=r){const e=this._context.gl;this._context.gl.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.glName)}}unbind(){this._context.gl.bindVertexArray(null)}};export{u as VertexArrayObject};
5
+ import{toConst as e}from"../../core/compilerUtils.js";import t from"../../core/Logger.js";import{disposeMaybe as r}from"../../core/maybe.js";import{baseTypedArrayMemory as s}from"../../core/memoryEstimations.js";import{ResourceType as i}from"./enums.js";import{bindVertexBufferLayout as n}from"./Util.js";import{fromBuffers as o}from"./VertexAttributeLocations.js";const f=()=>t.getLogger("esri.views.webgl.VertexArrayObject");let u=class{constructor(t,r,s){this._context=t,this._indexBuffer=s,this._buffers=r instanceof Map?r:new Map([["geometry",r]]),this.locations=e(o(this._buffers))}get glName(){return this._glName}get context(){return this._context}get buffers(){return e(this._buffers)}buffer(e="geometry"){return this.buffers.get(e)}get indexBuffer(){return this._indexBuffer}getByteLength(e){return this.buffer(e)?.sizeBytes??0}vertexCount(e){const t=this.buffer(e);return t?t.sizeBytes/t.layout[0].stride:0}get usedMemory(){return Array.from(this._buffers.values()).reduce((e,t)=>e+t.usedMemory,this._indexBuffer?.usedMemory??0+(this._buffers.size+(this._indexBuffer?1:0))*s)}dispose(){this._context?(this._context.getBoundVAO()===this&&this._context.bindVAO(null),this._buffers.forEach(e=>e.dispose()),this._buffers.clear(),this._indexBuffer=r(this._indexBuffer),this.disposeVAOOnly()):(this._glName||this._buffers.size>0)&&f().warn("Leaked WebGL VAO")}disposeVAOOnly(){this._glName&&(this._context.gl.deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(i.VertexArrayObject,this)),this._context=null}bind(e=this.locations){const t=this._context.gl;this._glName?t.bindVertexArray(this._glName):(this._context.instanceCounter.increment(i.VertexArrayObject,this),this._glName=t.createVertexArray(),t.bindVertexArray(this._glName),this._bindLayout(e))}_bindLayout(e){const{_buffers:t,_indexBuffer:r}=this;if(t||f().error("Vertex buffer dictionary is empty!"),t.forEach(t=>n(this._context,e,t)),null!=r){const e=this._context.gl;this._context.gl.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.glName)}}unbind(){this._context.gl.bindVertexArray(null)}};export{u as VertexArrayObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{isSome as t}from"../core/arrayUtils.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{formatDate as a,convertDateFormatToIntlOptions as s}from"../intl/date.js";import{system as n}from"../time/constants.js";import{SlideThumbnail as l}from"../webdoc/support/SlideThumbnail.js";import d from"./Widget.js";import m from"./Bookmarks/BookmarksUserState.js";import c from"./Bookmarks/BookmarksViewModel.js";import u from"./Bookmarks/BookmarksVisibleElements.js";import{css as k}from"./Bookmarks/css.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{Heading as b}from"./support/Heading.js";import{calciteListFilterProps as _}from"./support/listUtils.js";import{setFocus as g}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as B}from"./support/jsxFactory.js";let w=class extends(o(d)){constructor(e,t){super(e,t),this._addInputNode=null,this._editInputNode=null,this._urlEditInputNode=null,this._lastDragDetail=null,this._selectedDragBookmarkUid=null,this._editIncludeTimeExtent=void 0,this._userState=null,this._focusRootFlowItem=!1,this._focusAddFlowItem=!1,this._focusEditFlowItem=!1,this.disabled=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.viewModel=new c,this.visibleElements=new u,this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t,bookmarks:o}=this,{toEl:i,fromEl:r,dragEl:a,newIndex:s}=e;if(!o.length)return;if(!r||!i||t?.newIndex===s&&t?.dragEl===a&&t?.toEl===i&&t?.fromEl===r)return;this._lastDragDetail=e;const n=Array.from(r.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);o.sort((e,t)=>{const o=n.indexOf(e.uid),i=n.indexOf(t.uid);return o>i?1:o<i?-1:0}),this._selectedDragBookmarkUid=a.value}}loadDependencies(){return h({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),"chip-group":()=>import("@esri/calcite-components/dist/components/calcite-chip-group"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),fab:()=>import("@esri/calcite-components/dist/components/calcite-fab"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),"table-cell":()=>import("@esri/calcite-components/dist/components/calcite-table-cell"),"table-header":()=>import("@esri/calcite-components/dist/components/calcite-table-header"),"table-row":()=>import("@esri/calcite-components/dist/components/calcite-table-row")})}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultEditOptions(){return this.viewModel.defaultEditOptions}set defaultEditOptions(e){this.viewModel.defaultEditOptions=e}get bookmarks(){return this.viewModel.bookmarks}set bookmarks(e){this.viewModel.bookmarks=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"bookmark"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}endAddBookmark(){this._userState=null}goTo(e){return this.viewModel.goTo(e)}render(){return B("div",{class:this.classes(k.base,p.widget,p.panel)},this._renderBookmarksContainer())}startAddBookmark(){this._userState=new m({state:"add"}),this._focusAddFlowItem=!0}_renderNoBookmarksContainer(e){const{messages:t,viewModel:{state:o}}=this;return e.length||"loading"===o?null:B("div",{class:p.empty,key:"no-bookmarks"},B("calcite-icon",{icon:"bookmark",scale:"l"}),B(b,{class:this.classes(p.heading,k.noBookmarksHeader),level:this.headingLevel},t?.noBookmarksHeading),B("p",{class:k.noBookmarksDescription},t.noBookmarksDescription))}_renderEditBookmarkFlowItems(){const{_userState:e}=this,t=e?.editedBookmark;return t&&"edit"===e?.state?this._renderEditingBookmark(t):[]}_renderBookmarkItems(e){return e?e.toArray().map(e=>this._renderBookmark(e)):[]}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:o,oldIndex:i}=e;t.insertBefore(o,t.children[i])}_renderBookmarksContainer(){const{viewModel:{state:e,bookmarks:o},dragEnabled:i,messages:r,disabled:a,filterPlaceholder:s,filterText:n,visible:l,headingLevel:d,visibleElements:{closeButton:m,collapseButton:c,filter:u,heading:h,flow:p},uid:b}=this,g=o.filter(t),f=g.length?B("calcite-list",{class:k.list,displayMode:"flat",dragEnabled:i,filterEnabled:u,filterPlaceholder:s,filterProps:_,filterText:n,group:`bookmarks-${b}`,key:"bookmark-list",label:r.widgetLabel,selectionAppearance:"border",selectionMode:"none",onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},this._renderBookmarkItems(g),u?B("div",{class:k.filterNoResults,slot:"filter-no-results"},B("calcite-notice",{kind:"info",open:!0,width:"full"},B("div",{slot:"message"},r.noBookmarksHeading),";")):null):null,v=[B("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:m,closed:!l,collapsible:c,disabled:a,heading:h?r.widgetLabel:void 0,headingLevel:d,loading:"loading"===e,selected:!this._userState?.state,onCalciteFlowItemClose:()=>this.visible=!1},this._renderNoBookmarksContainer(g),f,this._renderAddBookmarkButton()),this._renderAddingBookmark(),this._renderEditBookmarkFlowItems()];return l?p?B("calcite-flow",{key:"root-flow"},v):v:null}_renderAddBookmarkButton(){const{messages:e,_userState:t,disabled:o,viewModel:{view:i,state:r},visibleElements:{addBookmarkButton:a}}=this,s=t?.loading??!1;return i&&"loading"!==r&&a?B("calcite-fab",{appearance:"outline-fill",bind:this,class:k.addBookmarkButton,disabled:o||s,icon:"plus",key:"add-bookmark-item",kind:"neutral",loading:s,onclick:this.startAddBookmark,slot:"fab",text:e.addBookmark,textEnabled:!0,title:e.addBookmark,type:"button"}):null}_renderEditContainer(e){const{messagesCommon:t,visibleElements:{editBookmarkButton:o}}=this,i=`${t.edit} ${this._getBookmarkTitle(e)}`;return o?B("calcite-action",{appearance:"transparent",icon:"pencil",key:"edit-action",onclick:()=>this._showEditBookmarkForm(e),slot:"actions-end",text:i,title:i}):null}_renderBookmarkImage(e,t){return t?B("img",{alt:"",class:k.bookmarkImage,key:"bookmark-image",src:e.thumbnail?.url}):null}_renderBookmarkTimeSwitch(e){const{messages:t,viewModel:{view:o}}=this,{timeExtent:i}=e;return o?.timeExtent??i?B("calcite-label",{layout:"inline-space-between"},t.includeTimeExtent,B("calcite-switch",{checked:!!i,onCalciteSwitchChange:e=>{this._editIncludeTimeExtent=!!e.currentTarget.checked}})):null}_renderEditBookmarkTimeExtent(e){return this._editIncludeTimeExtent?this._renderBookmarkTimeExtent(e):null}_getTimeExtentStrings(e){const{visibleElements:t}=this,{timeExtent:o}=e;if(!o)return{};const{start:i,end:r}=o,a=null!=r&&(null==i||i.getTime()!==r.getTime()),s=i?this._formatDate(i):"",n=i&&t.time?this._formatTime(i):"";if(!a)return{startDate:s,startTime:n};return{startDate:s,startTime:n,endDate:this._formatDate(r),endTime:t.time?this._formatTime(r):""}}_renderTimeExtentDescription(e){const{startDate:t,startTime:o,endDate:i,endTime:r}=this._getTimeExtentStrings(e);if(!t)return"";const a=`${t} ${o}`;return i?`${a} - ${`${i} ${r}`}`:a}_renderBookmarkTimeExtent(e,t=!1){const{messages:o}=this,{startDate:i,startTime:r,endDate:a,endTime:s}=this._getTimeExtentStrings(e),n=t?null:B("calcite-table-row",{slot:"table-header"},B("calcite-table-header",{heading:o.startDate}),a?B("calcite-table-header",{heading:o.endDate}):null);return i?B("calcite-table",{caption:o.timeExtent,scale:"s"},n,B("calcite-table-row",null,B("calcite-table-cell",null,i," ",r?[B("br",null),r]:null),a?B("calcite-table-cell",null,a,s?[B("br",null),s]:null):null)):null}_renderBookmarkActiveScrim(e,t){return this.viewModel.activeBookmark===e&&t?B("calcite-scrim",{key:"bookmark-active-scrim",loading:!0}):null}_renderBookmarkActiveLoader(e,t){return this.viewModel.activeBookmark!==e||t?null:B("calcite-loader",{class:k.loader,inline:!0,key:"bookmark-active-loader",label:this.messagesCommon.loading})}_renderBookmarkImageIcon(e,t){return this.viewModel.activeBookmark===e||t?null:B("calcite-icon",{icon:"bookmark",key:"bookmark-icon",scale:"s"})}_renderBookmarkThumbnail(e){const t=this.visibleElements.thumbnail&&!!e.thumbnail?.url;return B("div",{class:k.bookmarkImageContainer,slot:"content-start"},this._renderBookmarkActiveScrim(e,t),this._renderBookmarkImage(e,t),this._renderBookmarkActiveLoader(e,t),this._renderBookmarkImageIcon(e,t))}_focusSelectedDragEl(e,t){this._selectedDragBookmarkUid===t.uid&&(g(e),this._selectedDragBookmarkUid=null)}_renderBookmark(e){return B("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes({[k.dragEnabled]:this.dragEnabled}),description:this._renderTimeExtentDescription(e),key:e.uid,label:this._getBookmarkTitle(e),value:e.uid,onCalciteListItemSelect:()=>this._goToBookmark(e)},this._renderBookmarkThumbnail(e),this._renderBookmarkContent(e),this._renderEditContainer(e))}_renderBookmarkContent(e){return B("div",{class:k.bookmarkContent,slot:"content"},B("span",{class:k.bookmarkContentLabel},this._getBookmarkTitle(e)),this._renderBookmarkTimeExtent(e,!0))}_renderEditingBookmarkName(e){const{messages:t,_userState:o}=this,i="name-required"===o?.validationState;return B("calcite-label",null,t.title,B("calcite-input",{afterCreate:this._storeEditInput,bind:this,class:k.editBookmarkInput,name:"bookmark-name",placeholder:t.titlePlaceholder,required:!0,type:"text",value:e.name}),i?B("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidTitle):null)}_renderEditingBookmarkActions(){const{messagesCommon:e,_userState:t}=this,o=t?.bookmark;return[B("calcite-button",{appearance:"transparent",kind:"danger",onclick:()=>this._deleteBookmark(o),slot:"footer",type:"button",width:"full"},e.delete),B("calcite-button",{appearance:"outline",bind:this,onclick:this._closeEditBookmarkForm,slot:"footer",type:"button",width:"full"},e.cancel),B("calcite-button",{slot:"footer",type:"submit",width:"full"},e.save)]}_handleUrlEditInputChange(){const{_userState:e,_urlEditInputNode:t}=this,o=t?.value;if(!e?.editedBookmark||!o)return;e.validationState=void 0,e.editedBookmark.thumbnail?.isDataURI&&(e.screenshotUrl=e.editedBookmark.thumbnail?.url);const i=new l({url:o});i.isSecureUrl&&(e.customUrl=o,e.editedBookmark.thumbnail=i)}_renderEditingTimeExtent(e){const{capabilities:t,view:o}=this.viewModel,{timeExtent:i}=e;return t.time&&(o?.timeExtent??i)?B("div",{key:"edit-bookmark-time-container"},this._renderBookmarkTimeSwitch(e),this._renderEditBookmarkTimeExtent(e)):null}_renderEditingBookmarkImage(e){const{_userState:t}=this,o=t?.thumbnailState,i=e.thumbnail?.isSecureUrl?"url"===o:e.thumbnail?.isDataURI?"screenshot"===o:null;if(i)return this._renderBookmarkImage(e,i)}_renderEditingThumbnail(e){const{_userState:t,visibleElements:o}=this,i=t?.thumbnailState;return o.thumbnail&&"none"!==i?B("div",{class:k.authoringImageContainer},this._renderEditingBookmarkImage(e)):null}_renderUpdateThumbnailButton(){const{visibleElements:e,messages:t,_userState:o}=this,i=o?.thumbnailState;return e.thumbnail&&"screenshot"===i?B("calcite-button",{appearance:"outline",class:k.authoringRefreshThumbnailButton,iconStart:"refresh",key:"update-thumbnail",kind:"neutral",onclick:()=>{this._updateThumbnail()},width:"full"},t.updateThumbnail):null}_renderEditingBookmarkUrlInput(e){const{messages:t,_userState:o}=this,i=e.thumbnail?.url,r=e.thumbnail?.isSecureUrl?i:void 0,a=i&&"absolute-url-required"===o?.validationState,s=o?.thumbnailState;return"url"===s?B("calcite-label",{key:"thumbnail-url-input"},B("calcite-input",{afterCreate:this._storeUrlEditInput,bind:this,name:"bookmark-thumbnail-url",pattern:"https://.*",placeholder:t?`https://<${t.imageUrlPlaceholder}>`:void 0,required:!0,title:t.imageUrlTooltip,type:"text",value:r,onCalciteInputChange:this._handleUrlEditInputChange,onCalciteInputInput:this._handleUrlEditInputChange}),a?B("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidImageUrl):null):null}_renderThumbnailSelector(){const{visibleElements:e,messages:t,_userState:o}=this,i=o?.thumbnailState;return e.thumbnail?B("calcite-label",{key:"thumbnail-chip-group"},t.thumbnail,B("calcite-chip-group",{label:t.thumbnail,selectionMode:"single-persist",onCalciteChipGroupSelect:e=>this._handleThumbnailTypeSelect(e.currentTarget.selectedItems[0].value)},B("calcite-chip",{label:t.screenshot,selected:"screenshot"===i,value:"screenshot"},t.screenshot),B("calcite-chip",{label:t.url,selected:"url"===i,value:"url"},t.url),B("calcite-chip",{label:t.none,selected:"none"===i,value:"none"},t.none))):null}_renderEditingBookmark(e){const{disabled:t,messagesCommon:o,headingLevel:i}=this;return e?B("form",{bind:this,class:k.form,disabled:this.disabled,onsubmit:this._editBookmarkSubmit},B("calcite-flow-item",{afterCreate:this._focusEditFlowItemNode,afterUpdate:this._focusEditFlowItemNode,bind:this,disabled:t,heading:o.edit,headingLevel:i,key:"edit-bookmark-form",selected:"edit"===this._userState?.state,onCalciteFlowItemBack:e=>{e.preventDefault(),this._closeEditBookmarkForm()}},B("div",{class:k.formContent},B("div",{class:k.authoring},this._renderEditingBookmarkName(e),this._renderThumbnailSelector(),this._renderEditingThumbnail(e),this._renderEditingBookmarkUrlInput(e),this._renderUpdateThumbnailButton(),this._renderEditingTimeExtent(e))),this._renderEditingBookmarkActions())):null}_renderAddingBookmarkName(){const{_userState:e,messages:t}=this,o="name-required"===e?.validationState;return B("calcite-label",null,t.title,B("calcite-input",{afterCreate:this._storeAddInput,bind:this,class:k.addBookmarkInput,name:"bookmark-name",placeholder:t.titlePlaceholder,required:!0,type:"text",value:""}),o?B("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidTitle):null)}_renderAddingBookmarkActions(){const{messagesCommon:e}=this;return[B("calcite-button",{appearance:"outline",bind:this,onclick:this._endAddBookmark,slot:"footer",type:"button",width:"full"},e.cancel),B("calcite-button",{slot:"footer",type:"submit",width:"full"},e.add)]}_renderAddingBookmark(){const{disabled:e,messages:t,headingLevel:o,_userState:i}=this;return"add"===i?.state?B("form",{bind:this,class:k.form,disabled:e,onsubmit:this._addBookmarkSubmitClick},B("calcite-flow-item",{afterCreate:this._focusAddFlowItemNode,afterUpdate:this._focusAddFlowItemNode,bind:this,disabled:e,heading:t.addBookmark,headingLevel:o,key:"add-bookmark-form",selected:"add"===this._userState?.state,onCalciteFlowItemBack:e=>{e.preventDefault(),this._endAddBookmark()}},B("div",{class:k.formContent},this._renderAddingBookmarkName()),this._renderAddingBookmarkActions())):null}_getBookmarkTitle(e){return e?.name||this.messagesCommon.untitled}_formatDate(e){return e?a(e,{...s("short-date"),timeZone:this.viewModel.view?.timeZone??n}):""}_formatTime(e){return e?a(e,{...s("long-time"),timeZone:this.viewModel.view?.timeZone??n}):""}_endAddBookmark(){this.endAddBookmark(),this._focusRootFlowItem=!0}_showEditBookmarkForm(e){e&&(this._editIncludeTimeExtent=!!e.timeExtent,this._userState=new m({bookmark:e,state:"edit"}),this._focusEditFlowItem=!0,this.viewModel.goTo(e))}async _createNewScreenshotUrl(){const e=await this.viewModel.createBookmark();return e.thumbnail?.url??null}_storeCurrentUrl(){const{_userState:e}=this,t=e?.editedBookmark?.thumbnail?.url;t&&(e?.editedBookmark?.thumbnail?.isSecureUrl?e.customUrl=t:e?.editedBookmark?.thumbnail?.isDataURI&&(e.screenshotUrl=t))}async _handleThumbnailTypeSelect(e){const{_userState:t}=this;if(!t)return;const{screenshotUrl:o,customUrl:i,editedBookmark:r}=t,a="screenshot"===e?o??await this._createNewScreenshotUrl():"url"===e&&i?i:null;this._storeCurrentUrl(),r&&a&&(r.thumbnail=new l({url:a})),t.validationState=void 0,t.thumbnailState=e}_closeEditBookmarkForm(){this._userState=null,this._focusRootFlowItem=!0}_addBookmarkSubmitClick(e){e.preventDefault(),this._addBookmarkSubmit()}async _addBookmarkSubmit(){const{_addInputNode:e,_userState:t,viewModel:o,viewModel:{bookmarks:i}}=this;if(!t)return;const r=e?e.value.trim():null;if(!r)return void(t.validationState="name-required");t.loading=!0;const a=await o.createBookmark();a.name=r,i.add(a),this._endAddBookmark()}async _editBookmarkAndClose(e,t){const{viewModel:o,viewModel:{defaultEditOptions:i}}=this;await o.editBookmark(e,{...i,...t}),this._closeEditBookmarkForm()}_editBookmarkSubmit(e){e.preventDefault();const{_editInputNode:t,_userState:o,_editIncludeTimeExtent:i,_urlEditInputNode:r}=this;if(!o?.bookmark||!o.editedBookmark)return;o.validationState=void 0,o.customUrl=void 0,o.screenshotUrl=void 0;const a=t?.value.trim();if(!a)return void(o.validationState="name-required");o.bookmark.name=a,o.bookmark.thumbnail=o.editedBookmark.thumbnail,i||(o.bookmark.timeExtent=null);const s=o.thumbnailState;if("url"===s&&r){const e=r.value,t=new l({url:e});if(!t.isSecureUrl)return void(o.validationState="absolute-url-required");o.bookmark.thumbnail=t}else"none"===s&&(o.bookmark.thumbnail=null);this._editBookmarkAndClose(o.bookmark,{takeScreenshot:!1,captureTimeExtent:i})}_storeEditInput(e){this._editInputNode=e}_storeAddInput(e){this._addInputNode=e}_storeUrlEditInput(e){this._urlEditInputNode=e}_deleteBookmark(e){this._closeEditBookmarkForm(),e&&(this.viewModel.bookmarks.remove(e),e.destroy())}_goToBookmark(e){this.endAddBookmark(),this.viewModel.goTo(e)}async _updateThumbnail(){const{_userState:e,viewModel:t}=this;e&&(e.validationState=void 0,await t.editBookmark(e.editedBookmark,{takeScreenshot:!0,captureViewpoint:!1,captureRotation:!1,captureScale:!1,captureTimeExtent:!1}))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,g(e))}_focusEditFlowItemNode(e){this._focusEditFlowItem&&(this._focusEditFlowItem=!1,g(e))}_focusAddFlowItemNode(e){this._focusAddFlowItem&&(this._focusAddFlowItem=!1,g(e))}};e([i()],w.prototype,"_editIncludeTimeExtent",void 0),e([i({type:m})],w.prototype,"_userState",void 0),e([i()],w.prototype,"_focusRootFlowItem",void 0),e([i()],w.prototype,"_focusAddFlowItem",void 0),e([i()],w.prototype,"_focusEditFlowItem",void 0),e([i()],w.prototype,"defaultCreateOptions",null),e([i()],w.prototype,"defaultEditOptions",null),e([i()],w.prototype,"bookmarks",null),e([i()],w.prototype,"disabled",void 0),e([i()],w.prototype,"dragEnabled",void 0),e([i()],w.prototype,"filterPlaceholder",void 0),e([i()],w.prototype,"filterText",void 0),e([i()],w.prototype,"headingLevel",void 0),e([i()],w.prototype,"goToOverride",null),e([i()],w.prototype,"icon",null),e([i()],w.prototype,"label",null),e([i(),f("esri/widgets/Bookmarks/t9n/Bookmarks")],w.prototype,"messages",void 0),e([i(),f("esri/t9n/common")],w.prototype,"messagesCommon",void 0),e([i()],w.prototype,"uiStrings",void 0),e([i()],w.prototype,"view",null),e([i({type:c}),v(["select-bookmark","bookmark-edit","bookmark-select"])],w.prototype,"viewModel",void 0),e([i({type:u,nonNullable:!0})],w.prototype,"visibleElements",void 0),e([i()],w.prototype,"endAddBookmark",null),e([i()],w.prototype,"startAddBookmark",null),w=e([r("esri.widgets.Bookmarks")],w);const E=w;export{E as default};
5
+ import{__decorate as e}from"tslib";import{isSome as t}from"../core/arrayUtils.js";import{deprecateWidget as o}from"../core/deprecate.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import r from"../core/Logger.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{formatDate as n,convertDateFormatToIntlOptions as l}from"../intl/date.js";import{system as d}from"../time/constants.js";import{SlideThumbnail as m}from"../webdoc/support/SlideThumbnail.js";import c from"./Widget.js";import u from"./Bookmarks/BookmarksUserState.js";import k from"./Bookmarks/BookmarksViewModel.js";import h from"./Bookmarks/BookmarksVisibleElements.js";import{css as p}from"./Bookmarks/css.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as g}from"./support/Heading.js";import{calciteListFilterProps as f}from"./support/listUtils.js";import{setFocus as v}from"./support/widgetUtils.js";import{messageBundle as B}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as E}from"./support/jsxFactory.js";let I=class extends(i(c)){constructor(e,t){super(e,t),this._addInputNode=null,this._editInputNode=null,this._urlEditInputNode=null,this._lastDragDetail=null,this._selectedDragBookmarkUid=null,this._editIncludeTimeExtent=void 0,this._userState=null,this._focusRootFlowItem=!1,this._focusAddFlowItem=!1,this._focusEditFlowItem=!1,this.disabled=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.viewModel=new k,this.visibleElements=new h,this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t,bookmarks:o}=this,{toEl:i,fromEl:r,dragEl:a,newIndex:s}=e;if(!o.length)return;if(!r||!i||t?.newIndex===s&&t?.dragEl===a&&t?.toEl===i&&t?.fromEl===r)return;this._lastDragDetail=e;const n=Array.from(r.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);o.sort((e,t)=>{const o=n.indexOf(e.uid),i=n.indexOf(t.uid);return o>i?1:o<i?-1:0}),this._selectedDragBookmarkUid=a.value},o(r.getLogger(this),"Bookmarks","arcgis-bookmarks",{version:"4.34"})}loadDependencies(){return b({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),"chip-group":()=>import("@esri/calcite-components/dist/components/calcite-chip-group"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),fab:()=>import("@esri/calcite-components/dist/components/calcite-fab"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),"table-cell":()=>import("@esri/calcite-components/dist/components/calcite-table-cell"),"table-header":()=>import("@esri/calcite-components/dist/components/calcite-table-header"),"table-row":()=>import("@esri/calcite-components/dist/components/calcite-table-row")})}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultEditOptions(){return this.viewModel.defaultEditOptions}set defaultEditOptions(e){this.viewModel.defaultEditOptions=e}get bookmarks(){return this.viewModel.bookmarks}set bookmarks(e){this.viewModel.bookmarks=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"bookmark"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}endAddBookmark(){this._userState=null}goTo(e){return this.viewModel.goTo(e)}render(){return E("div",{class:this.classes(p.base,_.widget,_.panel)},this._renderBookmarksContainer())}startAddBookmark(){this._userState=new u({state:"add"}),this._focusAddFlowItem=!0}_renderNoBookmarksContainer(e){const{messages:t,viewModel:{state:o}}=this;return e.length||"loading"===o?null:E("div",{class:_.empty,key:"no-bookmarks"},E("calcite-icon",{icon:"bookmark",scale:"l"}),E(g,{class:this.classes(_.heading,p.noBookmarksHeader),level:this.headingLevel},t?.noBookmarksHeading),E("p",{class:p.noBookmarksDescription},t.noBookmarksDescription))}_renderEditBookmarkFlowItems(){const{_userState:e}=this,t=e?.editedBookmark;return t&&"edit"===e?.state?this._renderEditingBookmark(t):[]}_renderBookmarkItems(e){return e?e.toArray().map(e=>this._renderBookmark(e)):[]}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:o,oldIndex:i}=e;t.insertBefore(o,t.children[i])}_renderBookmarksContainer(){const{viewModel:{state:e,bookmarks:o},dragEnabled:i,messages:r,disabled:a,filterPlaceholder:s,filterText:n,visible:l,headingLevel:d,visibleElements:{closeButton:m,collapseButton:c,filter:u,heading:k,flow:h},uid:b}=this,_=o.filter(t),g=_.length?E("calcite-list",{class:p.list,displayMode:"flat",dragEnabled:i,filterEnabled:u,filterPlaceholder:s,filterProps:f,filterText:n,group:`bookmarks-${b}`,key:"bookmark-list",label:r.widgetLabel,selectionAppearance:"border",selectionMode:"none",onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},this._renderBookmarkItems(_),u?E("div",{class:p.filterNoResults,slot:"filter-no-results"},E("calcite-notice",{kind:"info",open:!0,width:"full"},E("div",{slot:"message"},r.noBookmarksHeading),";")):null):null,v=[E("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:m,closed:!l,collapsible:c,disabled:a,heading:k?r.widgetLabel:void 0,headingLevel:d,loading:"loading"===e,selected:!this._userState?.state,onCalciteFlowItemClose:()=>this.visible=!1},this._renderNoBookmarksContainer(_),g,this._renderAddBookmarkButton()),this._renderAddingBookmark(),this._renderEditBookmarkFlowItems()];return l?h?E("calcite-flow",{key:"root-flow"},v):v:null}_renderAddBookmarkButton(){const{messages:e,_userState:t,disabled:o,viewModel:{view:i,state:r},visibleElements:{addBookmarkButton:a}}=this,s=t?.loading??!1;return i&&"loading"!==r&&a?E("calcite-fab",{appearance:"outline-fill",bind:this,class:p.addBookmarkButton,disabled:o||s,icon:"plus",key:"add-bookmark-item",kind:"neutral",loading:s,onclick:this.startAddBookmark,slot:"fab",text:e.addBookmark,textEnabled:!0,title:e.addBookmark,type:"button"}):null}_renderEditContainer(e){const{messagesCommon:t,visibleElements:{editBookmarkButton:o}}=this,i=`${t.edit} ${this._getBookmarkTitle(e)}`;return o?E("calcite-action",{appearance:"transparent",icon:"pencil",key:"edit-action",onclick:()=>this._showEditBookmarkForm(e),slot:"actions-end",text:i,title:i}):null}_renderBookmarkImage(e,t){return t?E("img",{alt:"",class:p.bookmarkImage,key:"bookmark-image",src:e.thumbnail?.url}):null}_renderBookmarkTimeSwitch(e){const{messages:t,viewModel:{view:o}}=this,{timeExtent:i}=e;return o?.timeExtent??i?E("calcite-label",{layout:"inline-space-between"},t.includeTimeExtent,E("calcite-switch",{checked:!!i,onCalciteSwitchChange:e=>{this._editIncludeTimeExtent=!!e.currentTarget.checked}})):null}_renderEditBookmarkTimeExtent(e){return this._editIncludeTimeExtent?this._renderBookmarkTimeExtent(e):null}_getTimeExtentStrings(e){const{visibleElements:t}=this,{timeExtent:o}=e;if(!o)return{};const{start:i,end:r}=o,a=null!=r&&(null==i||i.getTime()!==r.getTime()),s=i?this._formatDate(i):"",n=i&&t.time?this._formatTime(i):"";if(!a)return{startDate:s,startTime:n};return{startDate:s,startTime:n,endDate:this._formatDate(r),endTime:t.time?this._formatTime(r):""}}_renderTimeExtentDescription(e){const{startDate:t,startTime:o,endDate:i,endTime:r}=this._getTimeExtentStrings(e);if(!t)return"";const a=`${t} ${o}`;return i?`${a} - ${`${i} ${r}`}`:a}_renderBookmarkTimeExtent(e,t=!1){const{messages:o}=this,{startDate:i,startTime:r,endDate:a,endTime:s}=this._getTimeExtentStrings(e),n=t?null:E("calcite-table-row",{slot:"table-header"},E("calcite-table-header",{heading:o.startDate}),a?E("calcite-table-header",{heading:o.endDate}):null);return i?E("calcite-table",{caption:o.timeExtent,scale:"s"},n,E("calcite-table-row",null,E("calcite-table-cell",null,i," ",r?[E("br",null),r]:null),a?E("calcite-table-cell",null,a,s?[E("br",null),s]:null):null)):null}_renderBookmarkActiveScrim(e,t){return this.viewModel.activeBookmark===e&&t?E("calcite-scrim",{key:"bookmark-active-scrim",loading:!0}):null}_renderBookmarkActiveLoader(e,t){return this.viewModel.activeBookmark!==e||t?null:E("calcite-loader",{class:p.loader,inline:!0,key:"bookmark-active-loader",label:this.messagesCommon.loading})}_renderBookmarkImageIcon(e,t){return this.viewModel.activeBookmark===e||t?null:E("calcite-icon",{icon:"bookmark",key:"bookmark-icon",scale:"s"})}_renderBookmarkThumbnail(e){const t=this.visibleElements.thumbnail&&!!e.thumbnail?.url;return E("div",{class:p.bookmarkImageContainer,slot:"content-start"},this._renderBookmarkActiveScrim(e,t),this._renderBookmarkImage(e,t),this._renderBookmarkActiveLoader(e,t),this._renderBookmarkImageIcon(e,t))}_focusSelectedDragEl(e,t){this._selectedDragBookmarkUid===t.uid&&(v(e),this._selectedDragBookmarkUid=null)}_renderBookmark(e){return E("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes({[p.dragEnabled]:this.dragEnabled}),description:this._renderTimeExtentDescription(e),key:e.uid,label:this._getBookmarkTitle(e),value:e.uid,onCalciteListItemSelect:()=>this._goToBookmark(e)},this._renderBookmarkThumbnail(e),this._renderBookmarkContent(e),this._renderEditContainer(e))}_renderBookmarkContent(e){return E("div",{class:p.bookmarkContent,slot:"content"},E("span",{class:p.bookmarkContentLabel},this._getBookmarkTitle(e)),this._renderBookmarkTimeExtent(e,!0))}_renderEditingBookmarkName(e){const{messages:t,_userState:o}=this,i="name-required"===o?.validationState;return E("calcite-label",null,t.title,E("calcite-input",{afterCreate:this._storeEditInput,bind:this,class:p.editBookmarkInput,name:"bookmark-name",placeholder:t.titlePlaceholder,required:!0,type:"text",value:e.name}),i?E("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidTitle):null)}_renderEditingBookmarkActions(){const{messagesCommon:e,_userState:t}=this,o=t?.bookmark;return[E("calcite-button",{appearance:"transparent",kind:"danger",onclick:()=>this._deleteBookmark(o),slot:"footer",type:"button",width:"full"},e.delete),E("calcite-button",{appearance:"outline",bind:this,onclick:this._closeEditBookmarkForm,slot:"footer",type:"button",width:"full"},e.cancel),E("calcite-button",{slot:"footer",type:"submit",width:"full"},e.save)]}_handleUrlEditInputChange(){const{_userState:e,_urlEditInputNode:t}=this,o=t?.value;if(!e?.editedBookmark||!o)return;e.validationState=void 0,e.editedBookmark.thumbnail?.isDataURI&&(e.screenshotUrl=e.editedBookmark.thumbnail?.url);const i=new m({url:o});i.isSecureUrl&&(e.customUrl=o,e.editedBookmark.thumbnail=i)}_renderEditingTimeExtent(e){const{capabilities:t,view:o}=this.viewModel,{timeExtent:i}=e;return t.time&&(o?.timeExtent??i)?E("div",{key:"edit-bookmark-time-container"},this._renderBookmarkTimeSwitch(e),this._renderEditBookmarkTimeExtent(e)):null}_renderEditingBookmarkImage(e){const{_userState:t}=this,o=t?.thumbnailState,i=e.thumbnail?.isSecureUrl?"url"===o:e.thumbnail?.isDataURI?"screenshot"===o:null;if(i)return this._renderBookmarkImage(e,i)}_renderEditingThumbnail(e){const{_userState:t,visibleElements:o}=this,i=t?.thumbnailState;return o.thumbnail&&"none"!==i?E("div",{class:p.authoringImageContainer},this._renderEditingBookmarkImage(e)):null}_renderUpdateThumbnailButton(){const{visibleElements:e,messages:t,_userState:o}=this,i=o?.thumbnailState;return e.thumbnail&&"screenshot"===i?E("calcite-button",{appearance:"outline",class:p.authoringRefreshThumbnailButton,iconStart:"refresh",key:"update-thumbnail",kind:"neutral",onclick:()=>{this._updateThumbnail()},width:"full"},t.updateThumbnail):null}_renderEditingBookmarkUrlInput(e){const{messages:t,_userState:o}=this,i=e.thumbnail?.url,r=e.thumbnail?.isSecureUrl?i:void 0,a=i&&"absolute-url-required"===o?.validationState,s=o?.thumbnailState;return"url"===s?E("calcite-label",{key:"thumbnail-url-input"},E("calcite-input",{afterCreate:this._storeUrlEditInput,bind:this,name:"bookmark-thumbnail-url",pattern:"https://.*",placeholder:t?`https://<${t.imageUrlPlaceholder}>`:void 0,required:!0,title:t.imageUrlTooltip,type:"text",value:r,onCalciteInputChange:this._handleUrlEditInputChange,onCalciteInputInput:this._handleUrlEditInputChange}),a?E("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidImageUrl):null):null}_renderThumbnailSelector(){const{visibleElements:e,messages:t,_userState:o}=this,i=o?.thumbnailState;return e.thumbnail?E("calcite-label",{key:"thumbnail-chip-group"},t.thumbnail,E("calcite-chip-group",{label:t.thumbnail,selectionMode:"single-persist",onCalciteChipGroupSelect:e=>this._handleThumbnailTypeSelect(e.currentTarget.selectedItems[0].value)},E("calcite-chip",{label:t.screenshot,selected:"screenshot"===i,value:"screenshot"},t.screenshot),E("calcite-chip",{label:t.url,selected:"url"===i,value:"url"},t.url),E("calcite-chip",{label:t.none,selected:"none"===i,value:"none"},t.none))):null}_renderEditingBookmark(e){const{disabled:t,messagesCommon:o,headingLevel:i}=this;return e?E("form",{bind:this,class:p.form,disabled:this.disabled,onsubmit:this._editBookmarkSubmit},E("calcite-flow-item",{afterCreate:this._focusEditFlowItemNode,afterUpdate:this._focusEditFlowItemNode,bind:this,disabled:t,heading:o.edit,headingLevel:i,key:"edit-bookmark-form",selected:"edit"===this._userState?.state,onCalciteFlowItemBack:e=>{e.preventDefault(),this._closeEditBookmarkForm()}},E("div",{class:p.formContent},E("div",{class:p.authoring},this._renderEditingBookmarkName(e),this._renderThumbnailSelector(),this._renderEditingThumbnail(e),this._renderEditingBookmarkUrlInput(e),this._renderUpdateThumbnailButton(),this._renderEditingTimeExtent(e))),this._renderEditingBookmarkActions())):null}_renderAddingBookmarkName(){const{_userState:e,messages:t}=this,o="name-required"===e?.validationState;return E("calcite-label",null,t.title,E("calcite-input",{afterCreate:this._storeAddInput,bind:this,class:p.addBookmarkInput,name:"bookmark-name",placeholder:t.titlePlaceholder,required:!0,type:"text",value:""}),o?E("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidTitle):null)}_renderAddingBookmarkActions(){const{messagesCommon:e}=this;return[E("calcite-button",{appearance:"outline",bind:this,onclick:this._endAddBookmark,slot:"footer",type:"button",width:"full"},e.cancel),E("calcite-button",{slot:"footer",type:"submit",width:"full"},e.add)]}_renderAddingBookmark(){const{disabled:e,messages:t,headingLevel:o,_userState:i}=this;return"add"===i?.state?E("form",{bind:this,class:p.form,disabled:e,onsubmit:this._addBookmarkSubmitClick},E("calcite-flow-item",{afterCreate:this._focusAddFlowItemNode,afterUpdate:this._focusAddFlowItemNode,bind:this,disabled:e,heading:t.addBookmark,headingLevel:o,key:"add-bookmark-form",selected:"add"===this._userState?.state,onCalciteFlowItemBack:e=>{e.preventDefault(),this._endAddBookmark()}},E("div",{class:p.formContent},this._renderAddingBookmarkName()),this._renderAddingBookmarkActions())):null}_getBookmarkTitle(e){return e?.name||this.messagesCommon.untitled}_formatDate(e){return e?n(e,{...l("short-date"),timeZone:this.viewModel.view?.timeZone??d}):""}_formatTime(e){return e?n(e,{...l("long-time"),timeZone:this.viewModel.view?.timeZone??d}):""}_endAddBookmark(){this.endAddBookmark(),this._focusRootFlowItem=!0}_showEditBookmarkForm(e){e&&(this._editIncludeTimeExtent=!!e.timeExtent,this._userState=new u({bookmark:e,state:"edit"}),this._focusEditFlowItem=!0,this.viewModel.goTo(e))}async _createNewScreenshotUrl(){const e=await this.viewModel.createBookmark();return e.thumbnail?.url??null}_storeCurrentUrl(){const{_userState:e}=this,t=e?.editedBookmark?.thumbnail?.url;t&&(e?.editedBookmark?.thumbnail?.isSecureUrl?e.customUrl=t:e?.editedBookmark?.thumbnail?.isDataURI&&(e.screenshotUrl=t))}async _handleThumbnailTypeSelect(e){const{_userState:t}=this;if(!t)return;const{screenshotUrl:o,customUrl:i,editedBookmark:r}=t,a="screenshot"===e?o??await this._createNewScreenshotUrl():"url"===e&&i?i:null;this._storeCurrentUrl(),r&&a&&(r.thumbnail=new m({url:a})),t.validationState=void 0,t.thumbnailState=e}_closeEditBookmarkForm(){this._userState=null,this._focusRootFlowItem=!0}_addBookmarkSubmitClick(e){e.preventDefault(),this._addBookmarkSubmit()}async _addBookmarkSubmit(){const{_addInputNode:e,_userState:t,viewModel:o,viewModel:{bookmarks:i}}=this;if(!t)return;const r=e?e.value.trim():null;if(!r)return void(t.validationState="name-required");t.loading=!0;const a=await o.createBookmark();a.name=r,i.add(a),this._endAddBookmark()}async _editBookmarkAndClose(e,t){const{viewModel:o,viewModel:{defaultEditOptions:i}}=this;await o.editBookmark(e,{...i,...t}),this._closeEditBookmarkForm()}_editBookmarkSubmit(e){e.preventDefault();const{_editInputNode:t,_userState:o,_editIncludeTimeExtent:i,_urlEditInputNode:r}=this;if(!o?.bookmark||!o.editedBookmark)return;o.validationState=void 0,o.customUrl=void 0,o.screenshotUrl=void 0;const a=t?.value.trim();if(!a)return void(o.validationState="name-required");o.bookmark.name=a,o.bookmark.thumbnail=o.editedBookmark.thumbnail,i||(o.bookmark.timeExtent=null);const s=o.thumbnailState;if("url"===s&&r){const e=r.value,t=new m({url:e});if(!t.isSecureUrl)return void(o.validationState="absolute-url-required");o.bookmark.thumbnail=t}else"none"===s&&(o.bookmark.thumbnail=null);this._editBookmarkAndClose(o.bookmark,{takeScreenshot:!1,captureTimeExtent:i})}_storeEditInput(e){this._editInputNode=e}_storeAddInput(e){this._addInputNode=e}_storeUrlEditInput(e){this._urlEditInputNode=e}_deleteBookmark(e){this._closeEditBookmarkForm(),e&&(this.viewModel.bookmarks.remove(e),e.destroy())}_goToBookmark(e){this.endAddBookmark(),this.viewModel.goTo(e)}async _updateThumbnail(){const{_userState:e,viewModel:t}=this;e&&(e.validationState=void 0,await t.editBookmark(e.editedBookmark,{takeScreenshot:!0,captureViewpoint:!1,captureRotation:!1,captureScale:!1,captureTimeExtent:!1}))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,v(e))}_focusEditFlowItemNode(e){this._focusEditFlowItem&&(this._focusEditFlowItem=!1,v(e))}_focusAddFlowItemNode(e){this._focusAddFlowItem&&(this._focusAddFlowItem=!1,v(e))}};e([a()],I.prototype,"_editIncludeTimeExtent",void 0),e([a({type:u})],I.prototype,"_userState",void 0),e([a()],I.prototype,"_focusRootFlowItem",void 0),e([a()],I.prototype,"_focusAddFlowItem",void 0),e([a()],I.prototype,"_focusEditFlowItem",void 0),e([a()],I.prototype,"defaultCreateOptions",null),e([a()],I.prototype,"defaultEditOptions",null),e([a()],I.prototype,"bookmarks",null),e([a()],I.prototype,"disabled",void 0),e([a()],I.prototype,"dragEnabled",void 0),e([a()],I.prototype,"filterPlaceholder",void 0),e([a()],I.prototype,"filterText",void 0),e([a()],I.prototype,"headingLevel",void 0),e([a()],I.prototype,"goToOverride",null),e([a()],I.prototype,"icon",null),e([a()],I.prototype,"label",null),e([a(),B("esri/widgets/Bookmarks/t9n/Bookmarks")],I.prototype,"messages",void 0),e([a(),B("esri/t9n/common")],I.prototype,"messagesCommon",void 0),e([a()],I.prototype,"uiStrings",void 0),e([a()],I.prototype,"view",null),e([a({type:k}),w(["select-bookmark","bookmark-edit","bookmark-select"])],I.prototype,"viewModel",void 0),e([a({type:h,nonNullable:!0})],I.prototype,"visibleElements",void 0),e([a()],I.prototype,"endAddBookmark",null),e([a()],I.prototype,"startAddBookmark",null),I=e([s("esri.widgets.Bookmarks")],I);const S=I;export{S as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as o}from"../../core/maybe.js";import{watch as s}from"../../core/reactiveUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../layers/GraphicsLayer.js";import{hasEffectiveFeatureExpressionInfo as d}from"../../support/elevationInfoUtils.js";import{highlightsSupported as n}from"../../views/support/layerViewUtils.js";import h from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as c,handleKeys as p}from"./UpdateRecordWorkflow.js";import{getVisualVariableAttributes as w,setUpGeometryUpdate as u,updateGraphicSymbolWhenRequired as m,swapForEditingSession as y,cloneGraphicExceptMesh as f,canCreateInteractiveEditSession as g,isTerminalUpdateEventType as k}from"./workflowUtils.js";import _ from"../Sketch/SketchViewModel.js";var V;const v={...p,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol(),waitingForTool:Symbol()};let M=V=class extends c{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchViewModel=null,this._webStyleCache=new Map}destroy(){this._layerViewEditSession?.rollback()}async commit(){this.removeHandles(v.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFeatureFormViewModel(){super._initializeFeatureFormViewModel(),this.addHandles([this._featureFormViewModel.on("value-change",e=>{this._layerViewEditSession?.setAttribute(e.fieldName,e.value)}),s(()=>this._featureFormViewModel.feature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;n(t)&&this.addHandles(t.highlight(e.feature),v.highlights)}async _configureSketchViewModel(){const e=this._sketchViewModel;if(!e)return;const{data:t,_featureFormViewModel:i,_sketchGraphicClone:o}=this,{edits:s,viewModel:r}=t,a=s.feature,{view:l}=r,d=w(a),n=await u({feature:a,featureClone:o,visualVariableAttributes:d,sketchViewModel:e,view:l,onUpdate:({geometry:e,attributes:t},o)=>{if(s.updateAttributes(t),s.updateGeometry(e),i.feature&&(i.feature.geometry=e),null!=d.rotation){const{field:e}=d.rotation;i.setValue(e,t[e])}if(null!=d.size){const{field:e}=d.size;i.setValue(e,t[e])}("undo"===o.type||"redo"===o.type||"update"===o.type&&null!=o.toolEventInfo&&k(o.toolEventInfo.type))&&i.notifyFeatureGeometryChanged()},addUpdatingPromise:e=>{this._updatingHandles.addPromise(e)},addHandle:e=>{this.addHandles(e,v.waitingForTool)},webStyleCache:this._webStyleCache});this.addHandles(n,v.sketchGraphics),e.addHandles(n)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:s}=e,r=e.edits.feature,{capabilities:a,layer:n}=e.editorItem,{view:h}=e.viewModel;if(this.removeHandles([v.highlights,v.sketchGraphics,v.sketchViewModel,v.waitingForTool]),!a.update.geometry||s||"3d"===h?.type&&d(n.elevationInfo))return{enter:async()=>{this.hasHandles(v.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([v.highlights])};const c=new l({elevationInfo:n.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),p=new _({allowDeleteKey:!1,layer:c,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,view:h});return this._sketchViewModel=p,h?.map.add(c),await(h?.whenLayerView(c)),this.addHandles(i(()=>{h?.destroyed||h?.map.remove(c),c.destroyed||c.destroy(),this._sketchViewModel=o(p)}),v.sketchViewModel),await m(t,this._webStyleCache,"2d"===h?.type?h.scale:null),this.addHandles([await y(p,r,t)]),{enter:async()=>{this.hasHandles(v.sketchGraphics)||await this._configureSketchViewModel()},exit:()=>this.removeHandles([v.sketchGraphics]),viewModel:p}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=f(e),{edits:i,layerView:o}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),g(o)&&(this._layerViewEditSession=o.createInteractiveEditSession(t))}static async create(e){const t=new V({data:await h.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([r()],M.prototype,"_layerViewEditSession",void 0),e([r()],M.prototype,"_sketchGraphicClone",void 0),e([r()],M.prototype,"_sketchViewModel",void 0),M=V=e([a("esri.widgets.Editor.UpdateFeatureWorkflow")],M);export{M as UpdateFeatureWorkflow,v as handleKeys};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as o}from"../../core/maybe.js";import{watch as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../layers/GraphicsLayer.js";import{highlightsSupported as d}from"../../views/support/layerViewUtils.js";import h from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as n,handleKeys as c}from"./UpdateRecordWorkflow.js";import{getVisualVariableAttributes as p,setUpGeometryUpdate as w,updateGraphicSymbolWhenRequired as u,swapForEditingSession as m,cloneGraphicExceptMesh as y,canCreateInteractiveEditSession as f,isTerminalUpdateEventType as g}from"./workflowUtils.js";import k from"../Sketch/SketchViewModel.js";var _;const V={...c,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol(),waitingForTool:Symbol()};let v=_=class extends n{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchViewModel=null,this._webStyleCache=new Map}destroy(){this._layerViewEditSession?.rollback()}async commit(){this.removeHandles(V.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFeatureFormViewModel(){super._initializeFeatureFormViewModel(),this.addHandles([this._featureFormViewModel.on("value-change",e=>{this._layerViewEditSession?.setAttribute(e.fieldName,e.value)}),s(()=>this._featureFormViewModel.feature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;d(t)&&this.addHandles(t.highlight(e.feature),V.highlights)}async _configureSketchViewModel(){const e=this._sketchViewModel;if(!e)return;const{data:t,_featureFormViewModel:i,_sketchGraphicClone:o}=this,{edits:s,viewModel:a}=t,r=s.feature,{view:l}=a,d=p(r),h=await w({feature:r,featureClone:o,visualVariableAttributes:d,sketchViewModel:e,view:l,onUpdate:({geometry:e,attributes:t},o)=>{if(s.updateAttributes(t),s.updateGeometry(e),i.feature&&(i.feature.geometry=e),null!=d.rotation){const{field:e}=d.rotation;i.setValue(e,t[e])}if(null!=d.size){const{field:e}=d.size;i.setValue(e,t[e])}("undo"===o.type||"redo"===o.type||"update"===o.type&&null!=o.toolEventInfo&&g(o.toolEventInfo.type))&&i.notifyFeatureGeometryChanged()},addUpdatingPromise:e=>{this._updatingHandles.addPromise(e)},addHandle:e=>{this.addHandles(e,V.waitingForTool)},webStyleCache:this._webStyleCache});this.addHandles(h,V.sketchGraphics),e.addHandles(h)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:s}=e,a=e.edits.feature,{capabilities:r,layer:d}=e.editorItem,{view:h}=e.viewModel;if(this.removeHandles([V.highlights,V.sketchGraphics,V.sketchViewModel,V.waitingForTool]),!r.update.geometry||s)return{enter:async()=>{this.hasHandles(V.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([V.highlights])};const n=new l({elevationInfo:d.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),c=new k({allowDeleteKey:!1,layer:n,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,view:h});return this._sketchViewModel=c,h?.map.add(n),await(h?.whenLayerView(n)),this.addHandles(i(()=>{h?.destroyed||h?.map.remove(n),n.destroyed||n.destroy(),this._sketchViewModel=o(c)}),V.sketchViewModel),await u(t,this._webStyleCache,"2d"===h?.type?h.scale:null),this.addHandles([await m(c,a,t)]),{enter:async()=>{this.hasHandles(V.sketchGraphics)||await this._configureSketchViewModel()},exit:()=>this.removeHandles([V.sketchGraphics]),viewModel:c}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=y(e),{edits:i,layerView:o}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),f(o)&&(this._layerViewEditSession=o.createInteractiveEditSession(t))}static async create(e){const t=new _({data:await h.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([a()],v.prototype,"_layerViewEditSession",void 0),e([a()],v.prototype,"_sketchGraphicClone",void 0),e([a()],v.prototype,"_sketchViewModel",void 0),v=_=e([r("esri.widgets.Editor.UpdateFeatureWorkflow")],v);export{v as UpdateFeatureWorkflow,V as handleKeys};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Logger.js";import{destroyMaybe as s}from"../../core/maybe.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{isTable as u}from"../../layers/support/layerUtils.js";import{hasEffectiveFeatureExpressionInfo as p}from"../../support/elevationInfoUtils.js";import c from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateFeaturesWorkflowData.js";import h from"./Workflow.js";import{whenEditorLayerView as m,makeMultipleSourceLayersError as y}from"./workflowUtils.js";import{SketchController as w}from"./support/SketchController.js";var g;const F=()=>a.getLogger("esri.widgets.Editor.UpdateFeaturesWorkflow");let _=g=class extends h{constructor(t){super(t),this.type="update-features",this._formViewModel=null,this._sketchController=null}async initialize(){this._initializeFormViewModel();try{await this._updatingHandles.addPromise((async()=>{const{fullFeatures:t}=await this.data.when();this._formViewModel.features=new o(t),await this._initializeVisuals(t)})())}catch(t){this.cancel({force:!0,error:new i("update-features-workflow:initialize","Failed to initialize the workflow data.",t)})}}destroy(){this._sketchController=s(this._sketchController),this._formViewModel.destroy()}get features(){return this.data.features}get formViewModel(){return this._formViewModel}get hasPendingEdits(){const{data:t}=this;return t.features.some(e=>!!t.getPendingEditsForFeature(e)?.modified)}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get selectedFeature(){return this.data.selectedFeature}get sketchViewModel(){return this._sketchController?.viewModel}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||!!this._sketchController?.updating}async commit(){const{data:t,_formViewModel:e}=this;for(const r of t.fullFeatures)E(t.getPendingEditsForFeature(r),e.getValues(r));await super.commit()}static create(t){const{applyEdits:o,applyEditsFeatureService:i,...a}=t,s=e(t.features.map(t=>t.sourceLayer??t.layer)).map(e=>t.viewModel.editorItems.find(t=>t.layer===e)).filter(r),n=new g({data:new f({...a,editorItems:s}),onCommit:M(t.applyEdits)});return n._set("steps",b()),n}async deleteAndCommit(){return this.data.stageDelete(),this.commit()}enter(){throw new Error("Method not implemented.")}exit(t){throw new Error("Method not implemented.")}async reset(){}async save(){const{formViewModel:t}=this;t.submit(),t.valid&&await super.save()}async start(){await super.start(),await n(()=>!this.updating)}_initializeFormViewModel(){const{data:t}=this,e=t.viewModel.view,r=t.getEditorItemForLayer(k(t)),o=new c({editType:"UPDATE",map:e?.map,readOnly:!1===r?.capabilities.update.attributes,spatialReference:e?.spatialReference,timeZone:t.timeZone});this._formViewModel=o,this.addHandles(o.on("value-change",e=>{for(const r of e.features)t.getPendingEditsForFeature(r)?.setAttribute(e.fieldName,e.value);this._sketchController?.notifyAttributesChanged(e)}))}async _initializeHighlights(t,e,r){const o=await m(r,e);this.addHandles(o.highlight(t))}async _initializeSketchController(t,e,r){const o=new w({sourceLayer:e,view:r,features:t});this._sketchController=o,await n(()=>!o.updating);const{data:i}=this;await o.startUpdatingFeatures(t,t=>{const e=[];for(const{feature:r,geometry:o}of t)i.getPendingEditsForFeature(r)?.updateGeometry(o),e.push(r);this._formViewModel.notifyGeometriesChanged(e)},()=>{F().warnOnce("editor:batch-update-visual-variables","UpdateFeaturesWorkflow does not currently support modifying visual variables through the scale and rotate tools.")})}async _initializeVisuals(t){const{data:e}=this,{view:r}=e.viewModel;if(!r)return;const o=k(e);if(u(o))return;const i=e.getEditorItemForLayer(o);return!i?.capabilities.update.geometry||"3d"===r?.type&&p(o.elevationInfo)?this._initializeHighlights(t,o,r):this._initializeSketchController(t,o,r)}};t([l()],_.prototype,"features",null),t([l()],_.prototype,"formViewModel",null),t([l()],_.prototype,"hasPendingEdits",null),t([l()],_.prototype,"parent",null),t([l()],_.prototype,"parentLayer",null),t([l()],_.prototype,"selectedFeature",null),t([l()],_.prototype,"sketchViewModel",null),t([l()],_.prototype,"type",void 0),t([l()],_.prototype,"updating",null),t([l()],_.prototype,"_formViewModel",void 0),t([l()],_.prototype,"_sketchController",void 0),_=g=t([d("esri.widgets.Editor.UpdateFeaturesWorkflow")],_);const v=_;function b(){return[{id:"editing-features",async setUp(){},async tearDown(){}}]}function M(t){return async e=>{const r=k(e),o=[],i=[];for(const t of e.fullFeatures){const r=e.getPendingEditsForFeature(t),a=r?.stagedForDelete;if(!r?.modified&&!a)continue;const s=t.clone();if(!r?.attributesModified||a){const e=t.sourceLayer;if(!e){F().warn("Feature has no sourceLayer. It will not be included in any applyEdits payload.");continue}const r=e.objectIdField;if(s.attributes={[r]:t.getAttribute(r)},"scene"===e.type&&null!=e.infoFor3D){const r=e.associatedLayer?.globalIdField;null!=r&&s.setAttribute(r,t.getAttribute(r))}}r?.geometryModified&&!a||(s.geometry=null),a?i.push(s):o.push(s)}if(o.length+i.length===0)return void F().warn("No edits to apply. Workflow will finish without sending an applyEdits request.");const a={updateFeatures:o.length>0?o:void 0,deleteFeatures:i.length>0?i:void 0};await t(r,a)}}function k(t){if(t.layers.length>1)throw y();return t.layers[0]}function E(t,e){if(!t||!t.feature)return;const{attributes:r}=t.feature;Object.keys(e).some(t=>e[t]!==r[t])&&t.updateAttributes(e)}export{v as default};
5
+ import{__decorate as t}from"tslib";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Logger.js";import{destroyMaybe as s}from"../../core/maybe.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{isTable as u}from"../../layers/support/layerUtils.js";import c from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import p from"./UpdateFeaturesWorkflowData.js";import f from"./Workflow.js";import{whenEditorLayerView as h,makeMultipleSourceLayersError as m}from"./workflowUtils.js";import{SketchController as y}from"./support/SketchController.js";var w;const g=()=>a.getLogger("esri.widgets.Editor.UpdateFeaturesWorkflow");let F=w=class extends f{constructor(t){super(t),this.type="update-features",this._formViewModel=null,this._sketchController=null}async initialize(){this._initializeFormViewModel();try{await this._updatingHandles.addPromise((async()=>{const{fullFeatures:t}=await this.data.when();this._formViewModel.features=new o(t),await this._initializeVisuals(t)})())}catch(t){this.cancel({force:!0,error:new i("update-features-workflow:initialize","Failed to initialize the workflow data.",t)})}}destroy(){this._sketchController=s(this._sketchController),this._formViewModel.destroy()}get features(){return this.data.features}get formViewModel(){return this._formViewModel}get hasPendingEdits(){const{data:t}=this;return t.features.some(e=>!!t.getPendingEditsForFeature(e)?.modified)}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get selectedFeature(){return this.data.selectedFeature}get sketchViewModel(){return this._sketchController?.viewModel}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||!!this._sketchController?.updating}async commit(){const{data:t,_formViewModel:e}=this;for(const r of t.fullFeatures)k(t.getPendingEditsForFeature(r),e.getValues(r));await super.commit()}static create(t){const{applyEdits:o,applyEditsFeatureService:i,...a}=t,s=e(t.features.map(t=>t.sourceLayer??t.layer)).map(e=>t.viewModel.editorItems.find(t=>t.layer===e)).filter(r),n=new w({data:new p({...a,editorItems:s}),onCommit:v(t.applyEdits)});return n._set("steps",b()),n}async deleteAndCommit(){return this.data.stageDelete(),this.commit()}enter(){throw new Error("Method not implemented.")}exit(t){throw new Error("Method not implemented.")}async reset(){}async save(){const{formViewModel:t}=this;t.submit(),t.valid&&await super.save()}async start(){await super.start(),await n(()=>!this.updating)}_initializeFormViewModel(){const{data:t}=this,e=t.viewModel.view,r=t.getEditorItemForLayer(M(t)),o=new c({editType:"UPDATE",map:e?.map,readOnly:!1===r?.capabilities.update.attributes,spatialReference:e?.spatialReference,timeZone:t.timeZone});this._formViewModel=o,this.addHandles(o.on("value-change",e=>{for(const r of e.features)t.getPendingEditsForFeature(r)?.setAttribute(e.fieldName,e.value);this._sketchController?.notifyAttributesChanged(e)}))}async _initializeHighlights(t,e,r){const o=await h(r,e);this.addHandles(o.highlight(t))}async _initializeSketchController(t,e,r){const o=new y({sourceLayer:e,view:r,features:t});this._sketchController=o,await n(()=>!o.updating);const{data:i}=this;await o.startUpdatingFeatures(t,t=>{const e=[];for(const{feature:r,geometry:o}of t)i.getPendingEditsForFeature(r)?.updateGeometry(o),e.push(r);this._formViewModel.notifyGeometriesChanged(e)},()=>{g().warnOnce("editor:batch-update-visual-variables","UpdateFeaturesWorkflow does not currently support modifying visual variables through the scale and rotate tools.")})}async _initializeVisuals(t){const{data:e}=this,{view:r}=e.viewModel;if(!r)return;const o=M(e);if(u(o))return;const i=e.getEditorItemForLayer(o);return i?.capabilities.update.geometry?this._initializeSketchController(t,o,r):this._initializeHighlights(t,o,r)}};t([l()],F.prototype,"features",null),t([l()],F.prototype,"formViewModel",null),t([l()],F.prototype,"hasPendingEdits",null),t([l()],F.prototype,"parent",null),t([l()],F.prototype,"parentLayer",null),t([l()],F.prototype,"selectedFeature",null),t([l()],F.prototype,"sketchViewModel",null),t([l()],F.prototype,"type",void 0),t([l()],F.prototype,"updating",null),t([l()],F.prototype,"_formViewModel",void 0),t([l()],F.prototype,"_sketchController",void 0),F=w=t([d("esri.widgets.Editor.UpdateFeaturesWorkflow")],F);const _=F;function b(){return[{id:"editing-features",async setUp(){},async tearDown(){}}]}function v(t){return async e=>{const r=M(e),o=[],i=[];for(const t of e.fullFeatures){const r=e.getPendingEditsForFeature(t),a=r?.stagedForDelete;if(!r?.modified&&!a)continue;const s=t.clone();if(!r?.attributesModified||a){const e=t.sourceLayer;if(!e){g().warn("Feature has no sourceLayer. It will not be included in any applyEdits payload.");continue}const r=e.objectIdField;if(s.attributes={[r]:t.getAttribute(r)},"scene"===e.type&&null!=e.infoFor3D){const r=e.associatedLayer?.globalIdField;null!=r&&s.setAttribute(r,t.getAttribute(r))}}r?.geometryModified&&!a||(s.geometry=null),a?i.push(s):o.push(s)}if(o.length+i.length===0)return void g().warn("No edits to apply. Workflow will finish without sending an applyEdits request.");const a={updateFeatures:o.length>0?o:void 0,deleteFeatures:i.length>0?i:void 0};await t(r,a)}}function M(t){if(t.layers.length>1)throw m();return t.layers[0]}function k(t,e){if(!t||!t.feature)return;const{attributes:r}=t.feature;Object.keys(e).some(t=>e[t]!==r[t])&&t.updateAttributes(e)}export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isTable as s}from"../../../layers/support/layerUtils.js";import{hasEffectiveFeatureExpressionInfo as i}from"../../../support/elevationInfoUtils.js";import l from"./EditorEditingCapabilities.js";import{formTemplateHasInvalidFields as a}from"../../FeatureForm/featureFormUtils.js";let p=class extends t{constructor(e){super(e),this.disabled=!1,this.layer=null,this.layerInfo=null,this.layerView=null}get _suspended(){return!!this.layerView?.suspended}get capabilities(){return new l({layer:this.layer,layerInfo:this.layerInfo,layerView:this.layerView})}get editable(){const{create:e,relationship:t,update:r,delete:{enabled:o}}=this.capabilities,s=e.attachments.enabled||r.attachments.enabled;return!this.disabled&&(e.enabled||r.enabled||s||o||t.enabled)}get formTemplate(){return this.capabilities.formTemplate}get hasInvalidFormTemplate(){return a(this.layer,this.formTemplate)}get isTable(){return s(this.layer)}get supportsCreateFeaturesWorkflow(){if(this.disabled)return!1;if("3d"===this.layerView?.view?.type&&i(this.layer.elevationInfo))return!1;const{enabled:e,geometry:t}=this.capabilities.create;return this.isTable?e:e&&t}get supportsUpdateWorkflow(){const{capabilities:e}=this;return!this.disabled&&(e.update.enabled||e.update.attachments.enabled||e.delete.enabled)}get visible(){const{layer:e}=this,t=e.parent;return!this._suspended&&e.visible&&(!t||!("visible"in t)||t.visible)}};e([r()],p.prototype,"_suspended",null),e([r()],p.prototype,"capabilities",null),e([r()],p.prototype,"disabled",void 0),e([r()],p.prototype,"editable",null),e([r()],p.prototype,"formTemplate",null),e([r()],p.prototype,"hasInvalidFormTemplate",null),e([r()],p.prototype,"isTable",null),e([r()],p.prototype,"layer",void 0),e([r()],p.prototype,"layerInfo",void 0),e([r()],p.prototype,"layerView",void 0),e([r()],p.prototype,"supportsCreateFeaturesWorkflow",null),e([r()],p.prototype,"supportsUpdateWorkflow",null),e([r()],p.prototype,"visible",null),p=e([o("esri.widgets.Editor.support.EditorItem")],p);const n=p;export{n as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{isTable as o}from"../../../layers/support/layerUtils.js";import i from"./EditorEditingCapabilities.js";import{formTemplateHasInvalidFields as l}from"../../FeatureForm/featureFormUtils.js";let a=class extends t{constructor(e){super(e),this.disabled=!1,this.layer=null,this.layerInfo=null,this.layerView=null}get _suspended(){return!!this.layerView?.suspended}get capabilities(){return new i({layer:this.layer,layerInfo:this.layerInfo,layerView:this.layerView})}get editable(){const{create:e,relationship:t,update:r,delete:{enabled:s}}=this.capabilities,o=e.attachments.enabled||r.attachments.enabled;return!this.disabled&&(e.enabled||r.enabled||o||s||t.enabled)}get formTemplate(){return this.capabilities.formTemplate}get hasInvalidFormTemplate(){return l(this.layer,this.formTemplate)}get isTable(){return o(this.layer)}get supportsCreateFeaturesWorkflow(){if(this.disabled)return!1;const{enabled:e,geometry:t}=this.capabilities.create;return this.isTable?e:e&&t}get supportsUpdateWorkflow(){const{capabilities:e}=this;return!this.disabled&&(e.update.enabled||e.update.attachments.enabled||e.delete.enabled)}get visible(){const{layer:e}=this,t=e.parent;return!this._suspended&&e.visible&&(!t||!("visible"in t)||t.visible)}};e([r()],a.prototype,"_suspended",null),e([r()],a.prototype,"capabilities",null),e([r()],a.prototype,"disabled",void 0),e([r()],a.prototype,"editable",null),e([r()],a.prototype,"formTemplate",null),e([r()],a.prototype,"hasInvalidFormTemplate",null),e([r()],a.prototype,"isTable",null),e([r()],a.prototype,"layer",void 0),e([r()],a.prototype,"layerInfo",void 0),e([r()],a.prototype,"layerView",void 0),e([r()],a.prototype,"supportsCreateFeaturesWorkflow",null),e([r()],a.prototype,"supportsUpdateWorkflow",null),e([r()],a.prototype,"visible",null),a=e([s("esri.widgets.Editor.support.EditorItem")],a);const p=a;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import{lineSection as t}from"../../../editing/geometry/lineUtils.js";import{createCoordinateHelper as r}from"../../../views/interactive/coordinateHelper.js";async function n(t,r){if("point"===t.type||"extent"===t.type||"mesh"===t.type)throw new e("editing:unsupported-split-geometry",`Cannot split geometry of type ${t.type}`);if("point"===r.type&&p(t))return await o(t,r);if("polyline"===r.type&&c(t))return a(t,r);if("polygon"===r.type&&s(t))return i(t,r);throw new e("editing:unsupported-split-geometry",`Geometry of type ${r.type} cannot be used to split geometry of type ${t.type}`)}async function o(n,o){const{apiConverter:i,arcadeGeometryFunctions:{planarLength3D:a},arcadeMeasures:{pointToCoordinate:p},lengthOperator:s}=await l(),c=i.fromSpatialReference(n.spatialReference)?.getTolerance()??.001,u=p(n,o);if(null==u||null==u.distance||u.distance>c)return null;const y=p(n,u.coordinate);if(null==y||null==y.distanceAlong)throw new e("editing:split-by-point-failed","Failed to determine the split point on the polyline.");const m=y.coordinate.hasZ&&n.hasZ,f=m?a:s.execute,g=r(m,n.hasM,n.spatialReference),d=f(n),w=t(n,0,y.distanceAlong,g),h=t(n,y.distanceAlong,d,g),O=f(w),j=f(h),P=Math.max(O,j);if(0===P)return null;const x=P===O?w:h;return{remainingPart:x,newPart:0===Math.min(O,j)?null:x===w?h:w}}async function i(e,t){const{differenceOperator:r,intersectionOperator:n}=await u(),o=n.execute(e,t);if(!o)return null;const i=r.execute(e,t);return i?{newPart:o,remainingPart:i}:{newPart:null,remainingPart:o}}async function a(e,t){const{cutOperator:r}=await y(),n=r.execute(e,t);if(2!==n.length)return null;const o=n[0];return{newPart:n[1]??null,remainingPart:o}}function p(e){return"polyline"===e.type}function s(e){return"polygon"===e.type||"polyline"===e.type||"multipoint"===e.type}function c(e){return"polygon"===e.type||"polyline"===e.type}async function l(){const[e,t,r,n]=await Promise.all([import("../../../geometry/operators/support/apiConverter.js"),import("../../../arcade/geometry/functions.js"),import("../../../arcade/functions/measures.js"),import("../../../geometry/operators/lengthOperator.js")]);return{apiConverter:e,arcadeGeometryFunctions:t,lengthOperator:n,arcadeMeasures:r}}async function u(){const[e,t]=await Promise.all([import("../../../geometry/operators/differenceOperator.js"),import("../../../geometry/operators/intersectionOperator.js")]);return{differenceOperator:e,intersectionOperator:t}}async function y(){return{cutOperator:await import("../../../geometry/operators/cutOperator.js")}}export{n as splitGeometry};
5
+ import e from"../../../core/Error.js";import{splitSegmentAtPoint as t}from"../../../editing/geometry/lineUtils.js";import r from"../../../geometry/Polyline.js";import{isCurvedGeometry as n,getEndpoint as o}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as a}from"../../../views/interactive/coordinateHelper.js";async function i(t,r){if("point"===t.type||"extent"===t.type||"mesh"===t.type)throw new e("editing:unsupported-split-geometry",`Cannot split geometry of type ${t.type}`);if("point"===r.type&&c(t))return await s(t,r);if("polyline"===r.type&&y(t))return l(t,r);if("polygon"===r.type&&u(t))return p(t,r);throw new e("editing:unsupported-split-geometry",`Geometry of type ${r.type} cannot be used to split geometry of type ${t.type}`)}async function s(i,s){const{apiConverter:p,arcadeGeometryFunctions:{planarLength3D:l},arcadeMeasures:{pointToCoordinate:c},lengthOperator:u}=await f(),y=p.fromSpatialReference(i.spatialReference)?.getTolerance()??.001,m=c(i,s);if(null==m||null==m.distance||m.distance>y)return null;const h=c(i,m.coordinate);if(null==h||null==h.distanceAlong||null==h.partId||null==h.segmentId)throw new e("editing:split-by-point-failed","Failed to determine the split point on the polyline.");const g=h.coordinate.hasZ&&i.hasZ,d=g?l:u.execute,w=a(g,i.hasM,i.spatialReference),P=n(i),j=P?i.curvePaths:i.paths,O=[],v=[];for(let e=0;e<j.length;e++){const r=j[e];if(e<h.partId)O.push(r);else if(e>h.partId)v.push(r);else{const e=[],n=[];for(let a=0;a<r.length;a++){const i=r[a];if(a<h.segmentId)e.push(i);else if(a>h.segmentId)n.push(i);else{const s=o(i),p=r.at(a+1),l=w.pointToArray(h.coordinate);if(a++,!p){e.push(i,l),n.push(l);continue}const[c,u]=t(s,p,l,y);e.push(...c),n.push(...u)}}e.length>0&&O.push(e),n.length>0&&v.push(n)}}const M=new r({[P?"curvePaths":"paths"]:O,spatialReference:i.spatialReference,hasZ:i.hasZ,hasM:i.hasM}),x=new r({[P?"curvePaths":"paths"]:v,spatialReference:i.spatialReference,hasZ:i.hasZ,hasM:i.hasM}),R=d(M),I=d(x),Z=Math.max(R,I);if(0===Z)return null;const C=Z===R?M:x;return{remainingPart:C,newPart:0===Math.min(R,I)?null:C===M?x:M}}async function p(e,t){const{differenceOperator:r,intersectionOperator:n}=await m(),o=n.execute(e,t);if(!o)return null;const a=r.execute(e,t);return a?{newPart:o,remainingPart:a}:{newPart:null,remainingPart:o}}async function l(e,t){const{cutOperator:r}=await h(),n=r.execute(e,t);if(2!==n.length)return null;const o=n[0];return{newPart:n[1]??null,remainingPart:o}}function c(e){return"polyline"===e.type}function u(e){return"polygon"===e.type||"polyline"===e.type||"multipoint"===e.type}function y(e){return"polygon"===e.type||"polyline"===e.type}async function f(){const[e,t,r,n]=await Promise.all([import("../../../geometry/operators/support/apiConverter.js"),import("../../../arcade/geometry/functions.js"),import("../../../arcade/functions/measures.js"),import("../../../geometry/operators/lengthOperator.js")]);return{apiConverter:e,arcadeGeometryFunctions:t,lengthOperator:n,arcadeMeasures:r}}async function m(){const[e,t]=await Promise.all([import("../../../geometry/operators/differenceOperator.js"),import("../../../geometry/operators/intersectionOperator.js")]);return{differenceOperator:e,intersectionOperator:t}}async function h(){return{cutOperator:await import("../../../geometry/operators/cutOperator.js")}}export{i as splitGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{R as t,D as i}from"../../../chunks/ResponsiveTheme.js";import"../../../intl.js";import{handlesGroup as e,makeHandle as o}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{signal as s}from"../../../core/signal.js";import{unitName as a,formatDecimal as l}from"../../../core/unitFormatUtils.js";import{convertUnit as r}from"../../../core/unitUtils.js";import{getEpsilon as d}from"../../../core/libs/gl-matrix-2/math/common.js";import{getConfig as c,notAvailable as p}from"./constants.js";import{getTranslatedLineTitle as m}from"./intlUtils.js";import{niceScale as u}from"./niceScale.js";import{binaryFindClosest as f}from"./profileUtils.js";import{c as x,N as g}from"../../../chunks/chartUtilsAm5.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkMode as A}from"../../../support/modeUtils.js";import{X as v,V as b,A as y,a as T,b as L,L as M}from"../../../chunks/LineSeries.js";import{b as S,d as F,a as P,C as k}from"../../../chunks/Theme.js";import{T as X}from"../../../chunks/Tooltip.js";import{formatNumber as Y}from"../../../intl/number.js";import{substitute as z}from"../../../intl/substitute.js";const C="#f8f8f8",j="#a9a9a9",w="#323232",H="line",B="fill",U=15,D=12,R=.001,O=.1,W=.02,G={fontFamily:"Avenir Next",paddingBottom:D/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:j,axisTooltipFontSize:12,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,axisTooltipPaddingTop:Math.round(D/4),axisTooltipPaddingBottom:Math.round(D/4),axisTooltipPaddingHorizontal:Math.round(U/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(D/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(U/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:C,seriesTooltipLabelColor:w,seriesFillLighten:.9,seriesTooltipSpacing:D/2,seriesTooltipPaddingVertical:Math.round(U/4),seriesTooltipPaddingHorizontal:Math.round(U/4)},V={...G,axisGridStroke:w,axisLabelsColor:j,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:C,seriesFillLighten:-.75},E={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function I(o){const a=await x(o.container);n(o.abortOptions);const l=A(),r=l?V:G;a.setThemes(l?[t.new(a),i.new(a)]:[t.new(a)]);const d=h(o.container),c=a.container.children.push(v.new(a,{panX:!0,panY:!0,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:d?r.paddingRight:r.paddingLeft,paddingRight:d?r.paddingLeft:r.paddingRight,maxTooltipDistance:-1}));c.zoomOutButton.set("forceHidden",!0);const p=c.xAxes.push(b.new(a,{renderer:y.new(a,{})})),m=c.yAxes.push(b.new(a,{renderer:T.new(a,{})})),u=s(null),f=s("loading"),g={chart:c,xAxis:p,yAxis:m,seriesInfos:new Map,messages:null,theme:r,pointerIsOver:!1,rtl:d,get state(){return f.value},get data(){return u.value},set data(t){u.value=t}};Z(g),q(g),N(g);const L=e([lt(g,o.onRangeChange),dt(g,o.onCursorPositionChange),yt(a.events.once("frameended",()=>{f.value="ready"})),yt(a)]);let M;return{destroy:()=>{L.remove(),f.value="destroyed"},update:t=>{t.data===g.data&&t.messages===g.messages||$(g)||J(g,t)},zoomOut:()=>K(g),test:M}}function $(t){return"destroyed"===t.state}function N({chart:t,xAxis:i,yAxis:e}){const o=L.new(t.root,{behavior:"none",xAxis:i,yAxis:e,snapToSeriesBy:"y"});o.lineY.set("visible",!1),t.set("cursor",o)}function Z(t){const{chart:i,xAxis:e,theme:o}=t;e.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),e.axisHeader.set("forceHidden",!0);const n=e.get("renderer");n.setAll({inside:!1,minGridDistance:o.xAxisMinGridDistance}),n.labels.template.setAll({centerX:F,centerY:F,fill:S(o.axisLabelsColor),fontFamily:o.fontFamily,fontSize:o.axisLabelsFontSize,fontWeight:o.axisLabelsFontWeight,maxPosition:o.xAxisMaxLabelPosition,minPosition:o.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:o.xAxisLabelsSpacing});const s=e.set("tooltip",X.new(i.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));s.get("background")?.setAll({fill:S(o.axisTooltipBackgroundColor),stroke:void 0}),s.label.setAll({fill:S(o.axisTooltipLabelColor),fontFamily:o.fontFamily,fontSize:o.axisTooltipFontSize,paddingBottom:o.axisTooltipPaddingBottom,paddingLeft:o.axisTooltipPaddingHorizontal,paddingRight:o.axisTooltipPaddingHorizontal,paddingTop:o.axisTooltipPaddingTop,direction:t.rtl?"rtl":"ltr"}),n.grid.template.setAll({strokeOpacity:1,stroke:S(o.axisGridStroke)})}function q(t){const{yAxis:i,theme:e,rtl:o}=t;i.setAll({baseValue:c().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),i.axisHeader.set("visible",!1);const n=i.get("renderer");n.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:o,inside:!0}),n.labels.template.setAll({centerX:F,centerY:P,fill:S(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:o?0:e.yAxisLabelSpacing,paddingRight:o?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),n.grid.template.setAll({strokeOpacity:1,stroke:S(e.axisGridStroke)})}function J(t,i){if($(t))return;const e=t.data??void 0,o=i.data??void 0;t.chart.get("cursor")?.set("forceHidden",!o?.refined);const n=e!==o,s=e?.effectiveUnits!==o?.effectiveUnits,a=e?.uniformScaling!==o?.uniformScaling;t.data=o,t.messages=i.messages,(n||s)&&(Q(t),et(t)),a&&K(t),pt(t)}function K(t){$(t)||(t.xAxis.zoom(0,1),t.yAxis.zoom(0,1))}function Q(t){const{chart:i,data:e,xAxis:o,yAxis:n}=t,{minX:s,maxX:a,minY:l,maxY:r}=_({data:e,pixelWidth:o.width(),pixelHeight:n.height()}),d=!!e?.uniformScaling,c=!!e?.refined;i.setAll({panX:!0,panY:d,pinchZoomX:c,pinchZoomY:c&&d,wheelX:"panX",wheelY:c?d?"zoomXY":"zoomX":"none"}),o.setAll({max:a,min:s,panX:!0,panY:!1,zoomX:!0,zoomY:d}),n.setAll({max:r,min:l,panX:!1,panY:d,zoomX:d,zoomY:d})}function _({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return E;const o=t.statistics,n=0,s=o?.maxDistance;let a=o?.minElevation,l=o?.maxElevation;if(null==s||null==a||null==l)return E;const d=Math.max(s-n,R);let p=Math.max(l-a,R);const m=t.effectiveUnits;if(t.dynamicElevationRange){const t=r(d,m.distance,m.elevation);p=Math.max(p,t/c().maxChartRatio)}return a-=W*p,l=a+p+O*p,[a,l]=u(a,l,10),p=l-a,t.uniformScaling?tt({data:t,bounds:{minX:n,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:n,maxX:n+d,minY:a,maxY:a+p}}function tt({data:t,bounds:i,pixelWidth:e,pixelHeight:o,centered:n}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:d}=i;if(null==s||null==a||null==l||null==d)return E;const c=a-s,p=d-l,m=t.effectiveUnits,u=r(p,m.elevation,m.distance)/o/(c/e);return u>=1?[s,a]=it([s,a],u):[l,d]=it([l,d],1/u),{minX:s,maxX:a,minY:l,maxY:d}}function it([t,i],e,o){const n=(i-t)*e;{const e=(t+i)/2-n/2;return[e,e+n]}}function et(t){const{chart:i,data:e,seriesInfos:o,xAxis:n,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const n=e.lines[d];let s=o.get(n.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=nt(t,n),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),ot(t,s,n)}t.seriesInfos=a;for(const d of l)i.series.removeValue(d);n.set("layer",r+1),s.set("layer",r+2)}function ot({theme:t},i,e){const o=S(e.color.toCss()),n=e.samples??[],s=n.length>0,{line:a,fill:l}=i;a.set("visible",s),a.set("stroke",o),l?.set("visible",s),l?.set("fill",k.lighten(o,t.seriesFillLighten)),a.data.setAll(n),l?.data.setAll(n)}function nt(t,i){const{id:e}=i,o=st(t,`${H}-${e}`),n=at(t);o.setAll({dy:i.chartStrokeOffsetY,tooltip:n}),o.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let s=null;return i.chartFillEnabled&&(s=st(t,`${B}-${e}`),s.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:o,fill:s}}function st(t,i){return M.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function at({theme:t,chart:i,rtl:e}){const o=X.new(i.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=t.seriesTooltipPaddingHorizontal,s=t.seriesTooltipPaddingVertical;return o.label.setAll({fill:S(t.seriesTooltipLabelColor),fontFamily:t.fontFamily,fontSize:t.seriesTooltipFontSize,paddingBottom:s,paddingLeft:n,paddingRight:n,paddingTop:s,textAlign:e?"end":"start",direction:"ltr"}),o.get("background")?.setAll({stroke:void 0,fill:S(t.seriesTooltipBackgroundColor)}),o.adapters.add("dy",i=>{const e=t.seriesTooltipSpacing,n=o.get("pointTo")?.y??0;return(i??0)+(o.y()>n?e:-e)}),o}function lt(t,i){const{xAxis:e,yAxis:o}=t,n=()=>{i(rt(e),rt(o))},s=t=>[t.on("start",n),t.on("end",n)];return bt([...s(e),...s(o)])}function rt(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<d()?1:e}function dt(t,i){const{chart:e,xAxis:o,yAxis:n}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver=i,pt(t)},r=()=>{l(!1),i(null,null)};return bt([s?.events.on("cursormoved",()=>{if(!t.pointerIsOver)return;pt(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l?.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;let r,d;if(null!=t){1===rt(o)?(r=0,d=t):(r=At(o),d=vt(o)),e=ct(e,r,d,0,t)}if(null!=i&&null!=s){1===rt(n)?(r=i,d=s):(r=At(n),d=vt(n)),a=ct(a,r,d,i,s)}}i(e,a)}),a.on("pointerover",()=>l(!0)),a.on("pointerout",r),a.on("blur",r)])}function ct(t,i,e,o,n){return(i+t*(e-i)-o)/(n-o)}function pt(t){const i=mt(t);if(!i)return void t.seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)});t.seriesInfos.forEach(t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)});t.xAxis.getTooltip().setAll({tooltipText:xt(t)})}function mt(t){const{data:i}=t,e=i?.lines.map(i=>({line:i,y:ht(t,i)?.elevation})).sort(ut);return e&&0!==e.length&&null!=e[0].y?e.map(({y:i,line:e})=>ft(t,e,i)).join("\n"):null}function ut({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function ft(t,i,e){const{data:o,messages:n}=t;if(null==o||null==n)return"";const s=`[${i.color.toHex()}]●[/]`,a=" ",r=c().formatPrecision,d=z(n.chartTooltip,{name:m(i,n),elevation:null!=e?l(n,e,o.effectiveUnits.elevation,r):p});return t.rtl?d+a+s:s+a+d}function xt(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const o=i.lines[0],n=o?ht(t,o):null,s=c().formatPrecision;return null!=n?l(e,n.distance,i.effectiveUnits.distance,s):"-"}function gt(t,i){const e=g.new(t.chart.root,{});return e.format=(e,o,n)=>{const{data:s,messages:l}=t;if(null==l||null==s||"string"==typeof e)return"";return`${Y(e,{maximumFractionDigits:n})} ${a(l,s.effectiveUnits[i],"abbr")}`},e}function ht({chart:t,xAxis:i},e){const o=e.samples??[];if(0===o.length)return null;const n=t.get("cursor"),s=n?.getPrivate("positionX")??0,a=i.toAxisPosition(s),l=i.positionToValue(a);return f(o,l,t=>t.distance)}function At(t){return t.positionToValue(t.get("start")??0)}function vt(t){return t.positionToValue(t.get("end")??1)}function bt(t){return e(t.map(yt))}function yt(t){return o(()=>{t?.dispose()})}export{I as createChart,_ as getAdjustedBounds};
5
+ import{R as t,D as i}from"../../../chunks/ResponsiveTheme.js";import"../../../intl.js";import{handlesGroup as e,makeHandle as o}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{signal as s}from"../../../core/signal.js";import{unitName as a,formatDecimal as l}from"../../../core/unitFormatUtils.js";import{convertUnit as r}from"../../../core/unitUtils.js";import{getEpsilon as d}from"../../../core/libs/gl-matrix-2/math/common.js";import{getConfig as c,notAvailable as p}from"./constants.js";import{getTranslatedLineTitle as m}from"./intlUtils.js";import{niceScale as u}from"./niceScale.js";import{binaryFindClosest as f}from"./profileUtils.js";import{c as x,N as g}from"../../../chunks/chartUtilsAm5.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkMode as A}from"../../../support/modeUtils.js";import{X as v,V as b,A as y,b as T,a as L,L as M}from"../../../chunks/LineSeries.js";import{b as S,d as F,a as P,C as k}from"../../../chunks/Theme.js";import{T as X}from"../../../chunks/Tooltip.js";import{formatNumber as Y}from"../../../intl/number.js";import{substitute as z}from"../../../intl/substitute.js";const C="#f8f8f8",j="#a9a9a9",w="#323232",H="line",B="fill",U=15,D=12,R=.001,O=.1,W=.02,G={fontFamily:"Avenir Next",paddingBottom:D/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:j,axisTooltipFontSize:12,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,axisTooltipPaddingTop:Math.round(D/4),axisTooltipPaddingBottom:Math.round(D/4),axisTooltipPaddingHorizontal:Math.round(U/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(D/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(U/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:C,seriesTooltipLabelColor:w,seriesFillLighten:.9,seriesTooltipSpacing:D/2,seriesTooltipPaddingVertical:Math.round(U/4),seriesTooltipPaddingHorizontal:Math.round(U/4)},V={...G,axisGridStroke:w,axisLabelsColor:j,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:C,seriesFillLighten:-.75},E={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function I(o){const a=await x(o.container);n(o.abortOptions);const l=A(),r=l?V:G;a.setThemes(l?[t.new(a),i.new(a)]:[t.new(a)]);const d=h(o.container),c=a.container.children.push(v.new(a,{panX:!0,panY:!0,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:d?r.paddingRight:r.paddingLeft,paddingRight:d?r.paddingLeft:r.paddingRight,maxTooltipDistance:-1}));c.zoomOutButton.set("forceHidden",!0);const p=c.xAxes.push(b.new(a,{renderer:y.new(a,{})})),m=c.yAxes.push(b.new(a,{renderer:T.new(a,{})})),u=s(null),f=s("loading"),g={chart:c,xAxis:p,yAxis:m,seriesInfos:new Map,messages:null,theme:r,pointerIsOver:!1,rtl:d,get state(){return f.value},get data(){return u.value},set data(t){u.value=t}};Z(g),q(g),N(g);const L=e([lt(g,o.onRangeChange),dt(g,o.onCursorPositionChange),yt(a.events.once("frameended",()=>{f.value="ready"})),yt(a)]);let M;return{destroy:()=>{L.remove(),f.value="destroyed"},update:t=>{t.data===g.data&&t.messages===g.messages||$(g)||J(g,t)},zoomOut:()=>K(g),test:M}}function $(t){return"destroyed"===t.state}function N({chart:t,xAxis:i,yAxis:e}){const o=L.new(t.root,{behavior:"none",xAxis:i,yAxis:e,snapToSeriesBy:"y"});o.lineY.set("visible",!1),t.set("cursor",o)}function Z(t){const{chart:i,xAxis:e,theme:o}=t;e.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),e.axisHeader.set("forceHidden",!0);const n=e.get("renderer");n.setAll({inside:!1,minGridDistance:o.xAxisMinGridDistance}),n.labels.template.setAll({centerX:F,centerY:F,fill:S(o.axisLabelsColor),fontFamily:o.fontFamily,fontSize:o.axisLabelsFontSize,fontWeight:o.axisLabelsFontWeight,maxPosition:o.xAxisMaxLabelPosition,minPosition:o.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:o.xAxisLabelsSpacing});const s=e.set("tooltip",X.new(i.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));s.get("background")?.setAll({fill:S(o.axisTooltipBackgroundColor),stroke:void 0}),s.label.setAll({fill:S(o.axisTooltipLabelColor),fontFamily:o.fontFamily,fontSize:o.axisTooltipFontSize,paddingBottom:o.axisTooltipPaddingBottom,paddingLeft:o.axisTooltipPaddingHorizontal,paddingRight:o.axisTooltipPaddingHorizontal,paddingTop:o.axisTooltipPaddingTop,direction:t.rtl?"rtl":"ltr"}),n.grid.template.setAll({strokeOpacity:1,stroke:S(o.axisGridStroke)})}function q(t){const{yAxis:i,theme:e,rtl:o}=t;i.setAll({baseValue:c().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),i.axisHeader.set("visible",!1);const n=i.get("renderer");n.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:o,inside:!0}),n.labels.template.setAll({centerX:F,centerY:P,fill:S(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:o?0:e.yAxisLabelSpacing,paddingRight:o?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),n.grid.template.setAll({strokeOpacity:1,stroke:S(e.axisGridStroke)})}function J(t,i){if($(t))return;const e=t.data??void 0,o=i.data??void 0;t.chart.get("cursor")?.set("forceHidden",!o?.refined);const n=e!==o,s=e?.effectiveUnits!==o?.effectiveUnits,a=e?.uniformScaling!==o?.uniformScaling;t.data=o,t.messages=i.messages,(n||s)&&(Q(t),et(t)),a&&K(t),pt(t)}function K(t){$(t)||(t.xAxis.zoom(0,1),t.yAxis.zoom(0,1))}function Q(t){const{chart:i,data:e,xAxis:o,yAxis:n}=t,{minX:s,maxX:a,minY:l,maxY:r}=_({data:e,pixelWidth:o.width(),pixelHeight:n.height()}),d=!!e?.uniformScaling,c=!!e?.refined;i.setAll({panX:!0,panY:d,pinchZoomX:c,pinchZoomY:c&&d,wheelX:"panX",wheelY:c?d?"zoomXY":"zoomX":"none"}),o.setAll({max:a,min:s,panX:!0,panY:!1,zoomX:!0,zoomY:d}),n.setAll({max:r,min:l,panX:!1,panY:d,zoomX:d,zoomY:d})}function _({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return E;const o=t.statistics,n=0,s=o?.maxDistance;let a=o?.minElevation,l=o?.maxElevation;if(null==s||null==a||null==l)return E;const d=Math.max(s-n,R);let p=Math.max(l-a,R);const m=t.effectiveUnits;if(t.dynamicElevationRange){const t=r(d,m.distance,m.elevation);p=Math.max(p,t/c().maxChartRatio)}return a-=W*p,l=a+p+O*p,[a,l]=u(a,l,10),p=l-a,t.uniformScaling?tt({data:t,bounds:{minX:n,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:n,maxX:n+d,minY:a,maxY:a+p}}function tt({data:t,bounds:i,pixelWidth:e,pixelHeight:o,centered:n}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:d}=i;if(null==s||null==a||null==l||null==d)return E;const c=a-s,p=d-l,m=t.effectiveUnits,u=r(p,m.elevation,m.distance)/o/(c/e);return u>=1?[s,a]=it([s,a],u):[l,d]=it([l,d],1/u),{minX:s,maxX:a,minY:l,maxY:d}}function it([t,i],e,o){const n=(i-t)*e;{const e=(t+i)/2-n/2;return[e,e+n]}}function et(t){const{chart:i,data:e,seriesInfos:o,xAxis:n,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const n=e.lines[d];let s=o.get(n.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=nt(t,n),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),ot(t,s,n)}t.seriesInfos=a;for(const d of l)i.series.removeValue(d);n.set("layer",r+1),s.set("layer",r+2)}function ot({theme:t},i,e){const o=S(e.color.toCss()),n=e.samples??[],s=n.length>0,{line:a,fill:l}=i;a.set("visible",s),a.set("stroke",o),l?.set("visible",s),l?.set("fill",k.lighten(o,t.seriesFillLighten)),a.data.setAll(n),l?.data.setAll(n)}function nt(t,i){const{id:e}=i,o=st(t,`${H}-${e}`),n=at(t);o.setAll({dy:i.chartStrokeOffsetY,tooltip:n}),o.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let s=null;return i.chartFillEnabled&&(s=st(t,`${B}-${e}`),s.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:o,fill:s}}function st(t,i){return M.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function at({theme:t,chart:i,rtl:e}){const o=X.new(i.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=t.seriesTooltipPaddingHorizontal,s=t.seriesTooltipPaddingVertical;return o.label.setAll({fill:S(t.seriesTooltipLabelColor),fontFamily:t.fontFamily,fontSize:t.seriesTooltipFontSize,paddingBottom:s,paddingLeft:n,paddingRight:n,paddingTop:s,textAlign:e?"end":"start",direction:"ltr"}),o.get("background")?.setAll({stroke:void 0,fill:S(t.seriesTooltipBackgroundColor)}),o.adapters.add("dy",i=>{const e=t.seriesTooltipSpacing,n=o.get("pointTo")?.y??0;return(i??0)+(o.y()>n?e:-e)}),o}function lt(t,i){const{xAxis:e,yAxis:o}=t,n=()=>{i(rt(e),rt(o))},s=t=>[t.on("start",n),t.on("end",n)];return bt([...s(e),...s(o)])}function rt(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<d()?1:e}function dt(t,i){const{chart:e,xAxis:o,yAxis:n}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver=i,pt(t)},r=()=>{l(!1),i(null,null)};return bt([s?.events.on("cursormoved",()=>{if(!t.pointerIsOver)return;pt(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l?.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;let r,d;if(null!=t){1===rt(o)?(r=0,d=t):(r=At(o),d=vt(o)),e=ct(e,r,d,0,t)}if(null!=i&&null!=s){1===rt(n)?(r=i,d=s):(r=At(n),d=vt(n)),a=ct(a,r,d,i,s)}}i(e,a)}),a.on("pointerover",()=>l(!0)),a.on("pointerout",r),a.on("blur",r)])}function ct(t,i,e,o,n){return(i+t*(e-i)-o)/(n-o)}function pt(t){const i=mt(t);if(!i)return void t.seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)});t.seriesInfos.forEach(t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)});t.xAxis.getTooltip().setAll({tooltipText:xt(t)})}function mt(t){const{data:i}=t,e=i?.lines.map(i=>({line:i,y:ht(t,i)?.elevation})).sort(ut);return e&&0!==e.length&&null!=e[0].y?e.map(({y:i,line:e})=>ft(t,e,i)).join("\n"):null}function ut({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function ft(t,i,e){const{data:o,messages:n}=t;if(null==o||null==n)return"";const s=`[${i.color.toHex()}]●[/]`,a=" ",r=c().formatPrecision,d=z(n.chartTooltip,{name:m(i,n),elevation:null!=e?l(n,e,o.effectiveUnits.elevation,r):p});return t.rtl?d+a+s:s+a+d}function xt(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const o=i.lines[0],n=o?ht(t,o):null,s=c().formatPrecision;return null!=n?l(e,n.distance,i.effectiveUnits.distance,s):"-"}function gt(t,i){const e=g.new(t.chart.root,{});return e.format=(e,o,n)=>{const{data:s,messages:l}=t;if(null==l||null==s||"string"==typeof e)return"";return`${Y(e,{maximumFractionDigits:n})} ${a(l,s.effectiveUnits[i],"abbr")}`},e}function ht({chart:t,xAxis:i},e){const o=e.samples??[];if(0===o.length)return null;const n=t.get("cursor"),s=n?.getPrivate("positionX")??0,a=i.toAxisPosition(s),l=i.positionToValue(a);return f(o,l,t=>t.distance)}function At(t){return t.positionToValue(t.get("start")??0)}function vt(t){return t.positionToValue(t.get("end")??1)}function bt(t){return e(t.map(yt))}function yt(t){return o(()=>{t?.dispose()})}export{I as createChart,_ as getAdjustedBounds};
package/widgets/Expand.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{makeHandle as t}from"../core/handleUtils.js";import{watch as o,initial as n}from"../core/reactiveUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import l from"./Widget.js";import r from"./Expand/ExpandViewModel.js";import{loadCalciteComponents as a}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import{isWidget as p,hasDomNode as d}from"./support/widget.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import{tsx as u}from"./support/jsxFactory.js";const m="esri-expand",g={base:m,toggle:`${m}__toggle`,popoverContent:`${m}__popover-content`,panel:`${m}__panel`,panelContent:`${m}__panel-content`,sheet:`${m}__sheet`,contentContainer:`${m}__content-container`,icon:"esri-collapse__icon",iconFlip:"esri-collapse__icon-flip",iconNumber:`${m}__icon-number`},v="chevrons-left",_="chevrons-right",w=Symbol("scheduleRender-override-handle");let y=class extends l{constructor(e,t){super(e,t),this._boundScheduledRender=this.scheduleRender.bind(this),this.closeOnEsc=!0,this.collapseTooltip="",this.content="",this.expandTooltip="",this.focusTrapDisabled=!1,this.iconNumber=0,this.messages=null,this.messagesCommon=null,this.mode="auto",this.placement=null,this.viewModel=new r,this.toggle=()=>{this.viewModel.expanded=!this.viewModel.expanded},this._handlePopoverClose=e=>{e.target===this._popoverEl&&(this.viewModel.expanded=e.currentTarget.open)},this._handleSheetClose=e=>{this.viewModel.expanded=e.currentTarget.open},this._handlePanelClose=e=>{this.viewModel.expanded=!e.currentTarget.closed},this._handleKeyDown=e=>{this.viewModel.expanded&&"Escape"===e.key&&!this._willCloseOnEsc(e)&&e.preventDefault()},this._storeToggleActionEl=e=>{this._toggleActionEl=e},this._storePopoverEl=e=>{this._popoverEl=e}}initialize(){this.addHandles(o(()=>this.viewModel?.view?.size,()=>this._popoverEl?.reposition(),n))}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),sheet:()=>import("@esri/calcite-components/dist/components/calcite-sheet")})}get expandTitle(){const{expanded:e,messagesCommon:t,collapseTooltip:o,expandTooltip:n}=this;return(e?o||t?.collapse:n||t?.expand)??""}get _displaySheet(){switch(this.mode){case"drawer":return!0;case"auto":return"xsmall"===this.viewModel.view?.widthBreakpoint;default:return!1}}get autoCollapse(){return this.viewModel.autoCollapse}set autoCollapse(e){this.viewModel.autoCollapse=e}get collapseIcon(){return _}set collapseIcon(e){this._overrideIfSome("collapseIcon",e)}get expanded(){return this.viewModel.expanded}set expanded(e){this.viewModel.expanded=e}get expandIcon(){return"object"==typeof this.content&&"icon"in this.content&&this.content.icon?this.content.icon:v}set expandIcon(e){this._overrideIfSome("expandIcon",e)}get group(){return this.viewModel.group}set group(e){this.viewModel.group=e}get icon(){return null}get label(){return"object"==typeof this.content&&"label"in this.content&&this.content.label?this.content.label:this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}expand(){this.viewModel.expanded=!0}collapse(){this.viewModel.expanded=!1}render(){const{_displaySheet:e,_toggleActionEl:t,viewModel:{expanded:o},label:n,placement:s}=this;return u("div",{class:this.classes(g.base,c.widget)},this._renderToggle(),e?u("calcite-sheet",{class:g.sheet,heightScale:"l",label:n,onkeydown:this._handleKeyDown,open:o,position:"block-end",onCalciteSheetClose:this._handleSheetClose},u("calcite-panel",{class:g.panel,closable:!0,closed:!o,heading:n,onkeydown:this._handleKeyDown,onCalcitePanelClose:this._handlePanelClose},u("div",{class:g.panelContent},this._renderContent()))):t?u("calcite-popover",{afterCreate:this._storePopoverEl,afterUpdate:this._storePopoverEl,focusTrapDisabled:this.focusTrapDisabled,label:n,onkeydown:this._handleKeyDown,open:o,overlayPositioning:"fixed",placement:s??this._getPlacement(),referenceElement:t,onCalcitePopoverClose:this._handlePopoverClose},u("div",{class:g.popoverContent},this._renderContent())):null)}_getPlacement(){const{container:e,view:t}=this,o=e&&t?t.ui.getPosition(e):null;if(!o||"manual"===o)return"auto";const[n,s]=o.split("-");return`${"right"===s?"left":"right"}-${"bottom"===n?"end":"start"}`}_willCloseOnEsc(e){const{closeOnEsc:t}=this;return"function"==typeof t?t(e):t}_renderBadgeNumber(){const{expanded:e,iconNumber:t}=this;return t&&!e?u("span",{class:g.iconNumber,key:"expand__icon-number"},t):null}_renderToggleButton(){const{expanded:e,expandTitle:t,expandIcon:o,collapseIcon:n}=this,s=e?n:o,i=s===v||s===_;return u("calcite-action",{afterCreate:this._storeToggleActionEl,afterUpdate:this._storeToggleActionEl,class:c.widgetButton,onclick:this.toggle,scale:"s",text:t,title:t},s?u("calcite-icon",{class:this.classes(g.icon,i&&g.iconFlip),icon:s,scale:"s"}):null)}_renderToggle(){return u("div",{class:g.toggle},this._renderToggleButton(),this._renderBadgeNumber())}_renderContent(){const{content:e}=this;return"string"==typeof e?u("div",{class:g.contentContainer,innerHTML:e,key:"content__string"}):p(e)?u("div",{afterCreate:()=>{this._overwriteChildScheduleRender(e)},afterRemoved:()=>this.removeHandles(w),afterUpdate:()=>{e.scheduleRender!==this._boundScheduledRender&&(this.removeHandles(w),this._overwriteChildScheduleRender(e))},class:g.contentContainer,key:"content__widget"},e.render()):e instanceof HTMLElement?u("div",{afterCreate:this._attachToNode,bind:e,class:g.contentContainer,key:"content__html-element"}):d(e)?u("div",{afterCreate:this._attachToNode,bind:e.domNode,class:g.contentContainer,key:"content__node"}):null}_overwriteChildScheduleRender(e){const o=e.scheduleRender;e.scheduleRender=this._boundScheduledRender,this.addHandles(t(()=>e.scheduleRender=o),w)}_attachToNode(e){const t=this;e.appendChild(t)}};e([s({readOnly:!0})],y.prototype,"expandTitle",null),e([s()],y.prototype,"_toggleActionEl",void 0),e([s()],y.prototype,"_displaySheet",null),e([s()],y.prototype,"autoCollapse",null),e([s()],y.prototype,"closeOnEsc",void 0),e([s()],y.prototype,"collapseIcon",null),e([s()],y.prototype,"collapseTooltip",void 0),e([s()],y.prototype,"content",void 0),e([s()],y.prototype,"expanded",null),e([s()],y.prototype,"expandIcon",null),e([s()],y.prototype,"expandTooltip",void 0),e([s()],y.prototype,"focusTrapDisabled",void 0),e([s()],y.prototype,"group",null),e([s()],y.prototype,"icon",null),e([s()],y.prototype,"iconNumber",void 0),e([s()],y.prototype,"label",null),e([s(),h("esri/widgets/Expand/t9n/Expand")],y.prototype,"messages",void 0),e([s(),h("esri/t9n/common")],y.prototype,"messagesCommon",void 0),e([s()],y.prototype,"mode",void 0),e([s()],y.prototype,"placement",void 0),e([s()],y.prototype,"view",null),e([s({type:r})],y.prototype,"viewModel",void 0),y=e([i("esri.widgets.Expand")],y);const C=y;export{C as default};
5
+ import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import{makeHandle as o}from"../core/handleUtils.js";import n from"../core/Logger.js";import{watch as s,initial as i}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import p from"./Expand/ExpandViewModel.js";import{loadCalciteComponents as c}from"./support/componentsUtils.js";import{globalCss as d}from"./support/globalCss.js";import{isWidget as h,hasDomNode as u}from"./support/widget.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import{tsx as g}from"./support/jsxFactory.js";const v="esri-expand",_={base:v,toggle:`${v}__toggle`,popoverContent:`${v}__popover-content`,panel:`${v}__panel`,panelContent:`${v}__panel-content`,sheet:`${v}__sheet`,contentContainer:`${v}__content-container`,icon:"esri-collapse__icon",iconFlip:"esri-collapse__icon-flip",iconNumber:`${v}__icon-number`},w="chevrons-left",y="chevrons-right",f=Symbol("scheduleRender-override-handle");let x=class extends a{constructor(e,o){super(e,o),this._boundScheduledRender=this.scheduleRender.bind(this),this.closeOnEsc=!0,this.collapseTooltip="",this.content="",this.expandTooltip="",this.focusTrapDisabled=!1,this.iconNumber=0,this.messages=null,this.messagesCommon=null,this.mode="auto",this.placement=null,this.viewModel=new p,this.toggle=()=>{this.viewModel.expanded=!this.viewModel.expanded},this._handlePopoverClose=e=>{e.target===this._popoverEl&&(this.viewModel.expanded=e.currentTarget.open)},this._handleSheetClose=e=>{this.viewModel.expanded=e.currentTarget.open},this._handlePanelClose=e=>{this.viewModel.expanded=!e.currentTarget.closed},this._handleKeyDown=e=>{this.viewModel.expanded&&"Escape"===e.key&&!this._willCloseOnEsc(e)&&e.preventDefault()},this._storeToggleActionEl=e=>{this._toggleActionEl=e},this._storePopoverEl=e=>{this._popoverEl=e},t(n.getLogger(this),"Expand","arcgis-expand",{version:"4.34"})}initialize(){this.addHandles(s(()=>this.viewModel?.view?.size,()=>this._popoverEl?.reposition(),i))}loadDependencies(){return c({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),sheet:()=>import("@esri/calcite-components/dist/components/calcite-sheet")})}get expandTitle(){const{expanded:e,messagesCommon:t,collapseTooltip:o,expandTooltip:n}=this;return(e?o||t?.collapse:n||t?.expand)??""}get _displaySheet(){switch(this.mode){case"drawer":return!0;case"auto":return"xsmall"===this.viewModel.view?.widthBreakpoint;default:return!1}}get autoCollapse(){return this.viewModel.autoCollapse}set autoCollapse(e){this.viewModel.autoCollapse=e}get collapseIcon(){return y}set collapseIcon(e){this._overrideIfSome("collapseIcon",e)}get expanded(){return this.viewModel.expanded}set expanded(e){this.viewModel.expanded=e}get expandIcon(){return"object"==typeof this.content&&"icon"in this.content&&this.content.icon?this.content.icon:w}set expandIcon(e){this._overrideIfSome("expandIcon",e)}get group(){return this.viewModel.group}set group(e){this.viewModel.group=e}get icon(){return null}get label(){return"object"==typeof this.content&&"label"in this.content&&this.content.label?this.content.label:this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}expand(){this.viewModel.expanded=!0}collapse(){this.viewModel.expanded=!1}render(){const{_displaySheet:e,_toggleActionEl:t,viewModel:{expanded:o},label:n,placement:s}=this;return g("div",{class:this.classes(_.base,d.widget)},this._renderToggle(),e?g("calcite-sheet",{class:_.sheet,heightScale:"l",label:n,onkeydown:this._handleKeyDown,open:o,position:"block-end",onCalciteSheetClose:this._handleSheetClose},g("calcite-panel",{class:_.panel,closable:!0,closed:!o,heading:n,onkeydown:this._handleKeyDown,onCalcitePanelClose:this._handlePanelClose},g("div",{class:_.panelContent},this._renderContent()))):t?g("calcite-popover",{afterCreate:this._storePopoverEl,afterUpdate:this._storePopoverEl,focusTrapDisabled:this.focusTrapDisabled,label:n,onkeydown:this._handleKeyDown,open:o,overlayPositioning:"fixed",placement:s??this._getPlacement(),referenceElement:t,onCalcitePopoverClose:this._handlePopoverClose},g("div",{class:_.popoverContent},this._renderContent())):null)}_getPlacement(){const{container:e,view:t}=this,o=e&&t?t.ui.getPosition(e):null;if(!o||"manual"===o)return"auto";const[n,s]=o.split("-");return`${"right"===s?"left":"right"}-${"bottom"===n?"end":"start"}`}_willCloseOnEsc(e){const{closeOnEsc:t}=this;return"function"==typeof t?t(e):t}_renderBadgeNumber(){const{expanded:e,iconNumber:t}=this;return t&&!e?g("span",{class:_.iconNumber,key:"expand__icon-number"},t):null}_renderToggleButton(){const{expanded:e,expandTitle:t,expandIcon:o,collapseIcon:n}=this,s=e?n:o,i=s===w||s===y;return g("calcite-action",{afterCreate:this._storeToggleActionEl,afterUpdate:this._storeToggleActionEl,class:d.widgetButton,onclick:this.toggle,scale:"s",text:t,title:t},s?g("calcite-icon",{class:this.classes(_.icon,i&&_.iconFlip),icon:s,scale:"s"}):null)}_renderToggle(){return g("div",{class:_.toggle},this._renderToggleButton(),this._renderBadgeNumber())}_renderContent(){const{content:e}=this;return"string"==typeof e?g("div",{class:_.contentContainer,innerHTML:e,key:"content__string"}):h(e)?g("div",{afterCreate:()=>{this._overwriteChildScheduleRender(e)},afterRemoved:()=>this.removeHandles(f),afterUpdate:()=>{e.scheduleRender!==this._boundScheduledRender&&(this.removeHandles(f),this._overwriteChildScheduleRender(e))},class:_.contentContainer,key:"content__widget"},e.render()):e instanceof HTMLElement?g("div",{afterCreate:this._attachToNode,bind:e,class:_.contentContainer,key:"content__html-element"}):u(e)?g("div",{afterCreate:this._attachToNode,bind:e.domNode,class:_.contentContainer,key:"content__node"}):null}_overwriteChildScheduleRender(e){const t=e.scheduleRender;e.scheduleRender=this._boundScheduledRender,this.addHandles(o(()=>e.scheduleRender=t),f)}_attachToNode(e){const t=this;e.appendChild(t)}};e([l({readOnly:!0})],x.prototype,"expandTitle",null),e([l()],x.prototype,"_toggleActionEl",void 0),e([l()],x.prototype,"_displaySheet",null),e([l()],x.prototype,"autoCollapse",null),e([l()],x.prototype,"closeOnEsc",void 0),e([l()],x.prototype,"collapseIcon",null),e([l()],x.prototype,"collapseTooltip",void 0),e([l()],x.prototype,"content",void 0),e([l()],x.prototype,"expanded",null),e([l()],x.prototype,"expandIcon",null),e([l()],x.prototype,"expandTooltip",void 0),e([l()],x.prototype,"focusTrapDisabled",void 0),e([l()],x.prototype,"group",null),e([l()],x.prototype,"icon",null),e([l()],x.prototype,"iconNumber",void 0),e([l()],x.prototype,"label",null),e([l(),m("esri/widgets/Expand/t9n/Expand")],x.prototype,"messages",void 0),e([l(),m("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([l()],x.prototype,"mode",void 0),e([l()],x.prototype,"placement",void 0),e([l()],x.prototype,"view",null),e([l({type:p})],x.prototype,"viewModel",void 0),x=e([r("esri.widgets.Expand")],x);const C=x;export{C as default};